@barchart/chart-lib 2.312.1 → 2.312.3
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 +1 -1
- chart-lib/package.json +1 -1
chart-lib/barchart.chart.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e){return e&&e.__esModule?e.default:e}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i={},s={},n=t.parcelRequireffd0;let r;var o;let a;var l;let c;var u;let h;var d;let p;var f;let m;var g;let y;var T;let S;var A;let v;var P;let C;var b;let E;var _;let M;var L;let O;var w;let I;var D;let x;var N;let R;var H;let V;var F;let B;var k;let U;var W;let $;var G;let z;var Y;let j;var K;let q;var X;let Z;var J;let Q;var ee;let te;var ie;let se;var ne;let re;var oe;let ae;var le;let ce;var ue;let he;var de;let pe;var fe;function me(e,t){return function(...i){return e.apply(this,[t,...i])}}function ge(e,t,i){return function(...s){return e.apply(this,[t,i,...s])}}function ye(...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 Te(e){return e}function Se(e){return null!==e}function Ae(e){return e.reduce(((e,t)=>e+t),0)}function ve(e){const t=e.length;return t>0?Ae(e)/t:0}function Pe(e){return e.every((e=>null!==e))}function Ce(e,t){return Array.from(Array(t)).map(((t,i)=>i+e))}function be(e,t){const i=[],s=[];return e.forEach((e=>{t(e)?i.push(e):s.push(e)})),{yes:i,no:s}}function Ee(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}function _e(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 Me(e,t){return e.filter((e=>!t.includes(e)))}function Le(e,t,i=Te){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 Oe(e,t=0){if(!(e.length<t+1))return e[e.length-t-1]}function we(e){if(!(e.length<1))return e[0]}function Ie(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}null==n&&((n=function(e){if(e in i)return i[e].exports;if(e in s){var t=s[e];delete s[e];var n={id:e,exports:{}};return i[e]=n,t.call(n.exports,n,n.exports),n.exports}var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}).register=function(e,t){s[e]=t},t.parcelRequireffd0=n),n.register("3DQaT",(function(e,t){!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=function(){var e,d,p,f,m=1,g=2,y=3,T=4,S=5,A=6,v=7,P='Unexpected token "%0"',C="Unexpected end of path";function b(){for(var e,t=E();R("|");)W(),(e||(e=[t])).push(E());return e?{type:l,args:e}:t}function E(){return R("(")?_():L()}function _(){B("(");var e=b();B(")");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 R("[")?function(){B("[");var e=function(){if(R(":"))return W(),{type:u,toIdx:N()};var e=N();if(R(":"))return W(),R("]")?{type:u,fromIdx:e}:{type:u,fromIdx:e,toIdx:N()};return{type:u,idx:e}}();return B("]"),{type:n,arg:e}}():R("{")?function(){B("{");var e=O();return B("}"),{type:s,arg:e}}():R("(")?_():void 0}function L(){H()||Y(W());var e,s=!1;R("^")?(W(),s=!0):F()&&(e=W().val.substr(1));for(var n,r=[];n=V()?function(){var e,t=W().val,s=k();(R("*")||s.type===m||s.type===y)&&(e=W().val);return{type:i,selector:t,prop:e}}():M();)r.push(n);return{type:t,fromRoot:s,subst:e,parts:r}}function O(){for(var e,t=w();R("||");)W(),(e||(e=[t])).push(w());return e?{type:r,op:"||",args:e}:t}function w(){for(var e,t=I();R("&&");)W(),(e||(e=[t])).push(I());return e?{type:r,op:"&&",args:e}:t}function I(){for(var e=D();R("==")||R("!=")||R("===")||R("!==")||R("^==")||R("==^")||R("^=")||R("=^")||R("$==")||R("==$")||R("$=")||R("=$")||R("*==")||R("==*")||R("*=")||R("=*");)e={type:o,op:W().val,args:[e,I()]};return e}function D(){for(var e=function(){var e=x();for(;R("+")||R("-");)e={type:a,op:W().val,args:[e,x()]};return e}();R("<")||R(">")||R("<=")||R(">=");)e={type:o,op:W().val,args:[e,D()]};return e}function x(){for(var e=N();R("*")||R("/")||R("%");)e={type:a,op:W().val,args:[e,x()]};return e}function N(){return R("!")||R("-")?{type:c,op:W().val,arg:N()}:(e=k().type)===y||e===g||e===T||e===S?{type:h,val:W().val}:H()?L():R("(")?function(){B("(");var e=O();return B(")"),e}():Y(W());var e}function R(e){var t=k();return t.type===A&&t.val===e}function H(){return V()||F()||R("^")}function V(){var e=k();if(e.type===A){var t=e.val;return"."===t||".."===t}return!1}function F(){var e=k();return e.type===m&&"$"===e.val[0]}function B(e){var t=W();t.type===A&&t.val===e||Y(t)}function k(){if(null!==p)return p;var e=d;return p=U(),d=e,p}function U(){for(;t=e[d]," \r\n\t".indexOf(t)>-1;)++d;var t;if(d>=f)return{type:v,range:[d,d]};var i=function(){var t=d,i=e[d],s=e[d+1];if("."===i){if($(s))return;return"."===e[++d]?{type:A,val:"..",range:[t,++d]}:{type:A,val:".",range:[t,d]}}if("="===s){var n=e[d+2];if("="===n){if("=!^$*".indexOf(i)>=0)return{type:A,val:i+s+n,range:[t,d+=3]}}else if("^$*".indexOf(n)>=0){if("="===i)return{type:A,val:i+s+n,range:[t,d+=3]}}else if("=!^$*><".indexOf(i)>=0)return{type:A,val:i+s,range:[t,d+=2]}}else if("="===i&&"^$*".indexOf(s)>=0)return{type:A,val:i+s,range:[t,d+=2]};if(i===s&&("|"===i||"&"===i))return{type:A,val:i+s,range:[t,d+=2]};if(":{}()[]^+-*/%!><|".indexOf(i)>=0)return{type:A,val:i,range:[t,++d]}}();if(i||(i=function(){var t=e[d];if(!G(t))return;var i=d,s=t;for(;++d<f&&z(t=e[d]);)s+=t;switch(s){case"true":case"false":return{type:T,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]}}}())||(i=function(){if('"'!==e[d]&&"'"!==e[d])return;var t,i=e[d],s=++d,n="",r=!1;for(;d<f;){if("\\"===(t=e[d++]))t=e[d++];else if(('"'===t||"'"===t)&&t===i){r=!0;break}n+=t}if(r)return{type:y,val:n,range:[s,d]}}())||(i=function(){var t=d,i=e[d],s="."===i;if(s||$(i)){for(var n=i;++d<f;){if("."===(i=e[d])){if(s)return;s=!0}else if(!$(i))break;n+=i}return{type:g,val:s?parseFloat(n):parseInt(n,10),range:[t,d]}}}()))return i;i={range:[d,d]},d>=f?i.type=v:i.val=e[d],Y(i)}function W(){var e;return p?(d=p.range[1],e=p,p=null,e):U()}function $(e){return"0123456789".indexOf(e)>=0}function G(e){return"$"===e||"@"===e||"_"===e||e>="a"&&e<="z"||e>="A"&&e<="Z"}function z(e){return G(e)||e>="0"&&e<="9"}function Y(e){e.type===v&&j(e,C),j(e,P,e.val)}function j(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=W();return s.type!==v&&Y(s),i}}(),p=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 T(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,"++];"),A(t.arg,a,l),e.push(_(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 A(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?(A(o.fromIdx,n=f(),s),A(o.toIdx,r=f(),s),e.push(i,"=",s,".slice(",n,",",r,");"),m(n,r)):(A(o.fromIdx,n=f(),s),e.push(i,"=",s,".slice(",n,");"),m(n)):(A(o.toIdx,r=f(),s),e.push(i,"=",s,".slice(0,",r,");"),m(r))}function A(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:T(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;"),A(g,r,n),A(y,o,n);var T=g.type===t,S=y.type===h;e.push(a,"="),T?e.push("true;"):e.push("isArr(",r,");"),e.push(l,"="),S?e.push("false;"):e.push("isArr(",o,");"),e.push("if("),T||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,"=",N[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;A(o[0],n,s),A(o[1],r,s),e.push(i,"=",N[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()),A(o[l],n,s),e.push("if(",_(o[l++],n),") {");e.push(i,"= true;");break;case"||":for(;l<a;)r.push(n=f()),A(o[l],n,s),e.push("if(",_(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(A(r,n,s),t.op){case"!":e.push(i,"= !",_(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(",N[t](i,s),") {")}function P(t,i,s){for(var n=[],r=t.args,o=r.length,a=0;a<o;)n.push(f()),A(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 _(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 L(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".indexOf(",t,") === 0"].join("")}function O(e,t){return[e,"!= null &&",t,"!= null &&",e,".toString().toLowerCase().indexOf(",t,".toString().toLowerCase()) === 0"].join("")}function w(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".length >=",t,".length &&",e,".lastIndexOf(",t,") ===",e,".length -",t,".length"].join("")}function I(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 D(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".indexOf(",t,") > -1"].join("")}function x(e,t){return[e,"!= null && ",t,"!= null &&",e,".toString().toLowerCase().indexOf(",t,".toString().toLowerCase()) > -1"].join("")}var N={"===":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},"^==":L,"==^":function(e,t){return L(t,e)},"^=":O,"=^":function(e,t){return O(t,e)},"$==":w,"==$":function(e,t){return w(t,e)},"$=":I,"=$":function(e,t){return I(t,e)},"*==":D,"==*":function(e,t){return D(t,e)},"=*":function(e,t){return x(t,e)},"*=":x,"+":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=[],A(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},T={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)&&(T[t]&&T[t](y[t],e[t]),y[t]=e[t])},S.compile=f,S.apply=S,"object"==typeof e.exports?e.exports=S:"object"==typeof modules?modules.define("jspath",(function(e){e(S)})):"function"==typeof define?define((function(e,t,i){i.exports=S})):window.JSPath=S}()})),n.register("2nrEA",(function(e,t){(function(){var t=function(e){if(null===e||"object"!=typeof e)return e;var i;if(e instanceof Date)return(i=new Date).setTime(e.getTime()),i;if(e instanceof RegExp)return i=new RegExp(e);if(e instanceof Array){i=[];for(var s=0,n=e.length;s<n;s++)i[s]=t(e[s]);return i}if(e instanceof Object){for(var r in i={},e)e.hasOwnProperty(r)&&(i[r]=t(e[r]));return i}throw new Error("Unable to clone object!")},i=function(e){for(var i=[t(e[0])],s=i[0].key,n=i[0].object,r=1,o=e.length;r<o;r++)n=n[s],s=e[r].key,i.push({object:n,key:s});return i},s=function(e,t){var i=e.length-1,s=e[i].key;t[i].object[s]=e[i].object[s]},n={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},r={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}},o={alpha:function(e){return/^[a-zA-Z]+$/.test(e)},alphanumeric:function(e){return/^[a-zA-Z0-9]+$/.test(e)},identifier:function(e){return/^[-_a-zA-Z0-9]+$/.test(e)},hexadecimal:function(e){return/^[a-fA-F0-9]+$/.test(e)},numeric:function(e){return/^[0-9]+$/.test(e)},"date-time":function(e){return!isNaN(Date.parse(e))&&-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){if(/^(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)$/.test(e)&&e.split(".").sort()[3]<=255)return!0;return!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)}},a={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}},l=function(e){return-1===e.indexOf("://")?e:e.split("#")[0]},c=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},u=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}},h=function(e,t,r,o){var a,l,d,p,f,m,g,y,T,S,A,v,P,C=!1,b={},E=t[t.length-1],_=r.length-1,M=r[_].object,L=r[_].key,O=M[L];if(E.hasOwnProperty("$ref"))return(t=c(e,t,E.$ref))?h(e,t,r,o):{$ref:E.$ref};if(E.hasOwnProperty("type"))if("string"==typeof E.type){if(o.useCoerce&&e.coerceType.hasOwnProperty(E.type)&&(O=M[L]=e.coerceType[E.type](O)),!e.fieldType[E.type](O))return{type:E.type}}else{for(C=!0,a=0,l=E.type.length;a<l&&C;a++)e.fieldType[E.type[a]](O)&&(C=!1);if(C)return{type:E.type}}if(E.hasOwnProperty("allOf"))for(a=0,l=E.allOf.length;a<l;a++)if(y=h(e,t.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,l=E.oneOf.length,d=0;a<l;a++)if(A=i(r),y=h(e,t.concat(E.oneOf[a]),A,o))(v=y.schema?Object.keys(y.schema).length:1)<P&&(P=v,b=y);else{if((d+=1)>1)break;s(A,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,l=E.anyOf.length;a<l;a++){if(A=i(r),!(y=h(e,t.concat(E.anyOf[a]),A,o))){s(A,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")&&(A=i(r),!(y=h(e,t.concat(E.not),A,o))))return{not:!0}}else{if(E.hasOwnProperty("oneOf")){for(P=1/0,a=0,l=E.oneOf.length,d=0;a<l;a++)if(y=h(e,t.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,l=E.anyOf.length;a<l;a++){if(!(y=h(e,t.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=h(e,t.concat(E.not),r,o)))return{not:!0}}if(E.hasOwnProperty("dependencies"))for(m in E.dependencies)if(E.dependencies.hasOwnProperty(m)&&O.hasOwnProperty(m))if(Array.isArray(E.dependencies[m])){for(a=0,l=E.dependencies[m].length;a<l;a++)if(!O.hasOwnProperty(E.dependencies[m][a]))return{dependencies:!0}}else if(y=h(e,t.concat(E.dependencies[m]),r,o))return y;if(Array.isArray(O)){if(E.hasOwnProperty("items"))if(Array.isArray(E.items)){for(a=0,l=E.items.length;a<l;a++)null!==(y=h(e,t.concat(E.items[a]),r.concat({object:O,key:a}),o))&&(b[a]=y,C=!0);if(O.length>l&&E.hasOwnProperty("additionalItems"))if("boolean"==typeof E.additionalItems){if(!E.additionalItems)return{additionalItems:!0}}else for(a=l,l=O.length;a<l;a++)null!==(y=h(e,t.concat(E.additionalItems),r.concat({object:O,key:a}),o))&&(b[a]=y,C=!0)}else for(a=0,l=O.length;a<l;a++)null!==(y=h(e,t.concat(E.items),r.concat({object:O,key:a}),o))&&(b[a]=y,C=!0);else if(E.hasOwnProperty("additionalItems")&&"boolean"!=typeof E.additionalItems)for(a=0,l=O.length;a<l;a++)null!==(y=h(e,t.concat(E.additionalItems),r.concat({object:O,key:a}),o))&&(b[a]=y,C=!0);if(C)return{schema:b}}else{for(m in T=[],b={},O)O.hasOwnProperty(m)&&T.push(m);if(o.checkRequired&&E.required)for(a=0,l=E.required.length;a<l;a++)O.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=T.length;a--;){if(S=!1,p&&E.properties.hasOwnProperty(T[a])&&(S=!0,null!==(y=h(e,t.concat(E.properties[T[a]]),r.concat({object:O,key:T[a]}),o))&&(b[T[a]]=y,C=!0)),f)for(m in E.patternProperties)E.patternProperties.hasOwnProperty(m)&&T[a].match(m)&&(S=!0,null!==(y=h(e,t.concat(E.patternProperties[m]),r.concat({object:O,key:T[a]}),o))&&(b[T[a]]=y,C=!0));S&&T.splice(a,1)}if(o.useDefault&&p&&!C)for(m in E.properties)E.properties.hasOwnProperty(m)&&!O.hasOwnProperty(m)&&E.properties[m].hasOwnProperty("default")&&(O[m]=E.properties[m].default);if(o.removeAdditional&&p&&!0!==E.additionalProperties&&"object"!=typeof E.additionalProperties)for(a=0,l=T.length;a<l;a++)delete O[T[a]];else if(E.hasOwnProperty("additionalProperties"))if("boolean"==typeof E.additionalProperties){if(!E.additionalProperties)for(a=0,l=T.length;a<l;a++)b[T[a]]={additional:!0},C=!0}else for(a=0,l=T.length;a<l;a++)null!==(y=h(e,t.concat(E.additionalProperties),r.concat({object:O,key:T[a]}),o))&&(b[T[a]]=y,C=!0);if(C)return{schema:b}}for(g in E)E.hasOwnProperty(g)&&!n.hasOwnProperty(g)&&("format"===g?e.fieldFormat.hasOwnProperty(E[g])&&!e.fieldFormat[E[g]](O,E,r,o)&&(b[g]=!0,C=!0):e.fieldValidate.hasOwnProperty(g)&&!e.fieldValidate[g](O,E[g].hasOwnProperty("$data")?u(r,E[g].$data):E[g],E,r,o)&&(b[g]=!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(r),this.fieldValidate=t(a),this.fieldFormat=t(o),this.defaultOptions=t(d),this.schema={}}p.prototype={validate:function(e,t,i){var s=[e],n=null,r=[{object:{__root__:t},key:"__root__"}];if("string"==typeof e&&!(s=c(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=h(this,s,r,i))?{validation:n.hasOwnProperty("schema")?n.schema:n}:null},resolveRef:function(e,t){return c(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[l(t.id)]=t}else if(!e)throw new Error("jjv: schema needs either a name or id attribute.");e&&(this.schema[l(e)]=t)}},void 0!==e.exports?e.exports=p:"function"==typeof define&&define.amd?define((function(){return p})):this.jjv=p}).call(e.exports)})),n.register("eG07G",(function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.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=e.exports.default})),n.register("c15IW",(function(e,t){!function(i,s){var n={};i.PubSub?(n=i.PubSub,console.warn("PubSub already loaded, using existing version")):(i.PubSub=n,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(e){setTimeout(r(e),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)}}(n)),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}("object"==typeof window&&window||this)})),(o=r||(r={}))[o.Browser=0]="Browser",o[o.NodeJs=1]="NodeJs",(l=a||(a={}))[l["1D"]=0]="1D",l[l["5D"]=1]="5D",l[l["1M"]=2]="1M",l[l["3M"]=3]="3M",l[l["6M"]=4]="6M",l[l["1Y"]=5]="1Y",l[l["5Y"]=6]="5Y",l[l.Max=7]="Max",(u=c||(c={}))[u.WithSeries=0]="WithSeries",u[u.TimeAxis=1]="TimeAxis",(d=h||(h={}))[d.UsePrevious=0]="UsePrevious",d[d.UseNext=1]="UseNext",d[d.UseNone=2]="UseNone",(f=p||(p={}))[f.Minimum=0]="Minimum",f[f.Everything=1]="Everything",f[f.Manual=2]="Manual",(g=m||(m={}))[g.NoAction=0]="NoAction",g[g.IgnoreTimelineOnly=1]="IgnoreTimelineOnly",g[g.ModelTransformRequired=2]="ModelTransformRequired",(T=y||(y={}))[T.Down=0]="Down",T[T.Up=1]="Up",T[T.Same=2]="Same",(A=S||(S={}))[A.ChangeBased=0]="ChangeBased",A[A.OpenVsClose=1]="OpenVsClose",(P=v||(v={}))[P.OHLC=0]="OHLC",P[P.Line=1]="Line",P[P.Candlestick=2]="Candlestick",P[P.Area=3]="Area",P[P.Column=4]="Column",P[P.Dots=5]="Dots",P[P.HLC=6]="HLC",P[P.HL=7]="HL",P[P.Ribbon=8]="Ribbon",P[P.Step=9]="Step",P[P.HollowCandles=10]="HollowCandles",P[P.HeikinAshi=11]="HeikinAshi",P[P.ElderImpulseSystem=12]="ElderImpulseSystem",P[P.Renko=13]="Renko",P[P.Range=14]="Range",P[P.LineBreak=15]="LineBreak",P[P.Kagi=16]="Kagi",P[P.PointAndFigure=17]="PointAndFigure",P[P.Baseline=18]="Baseline",P[P.PercentChange=19]="PercentChange",P[P.MultiColumn=20]="MultiColumn",P[P.StackedColumn=21]="StackedColumn",(b=C||(C={}))[b.Tick=0]="Tick",b[b.Intraday=1]="Intraday",b[b.Day=2]="Day",b[b.Week=3]="Week",b[b.Month=4]="Month",b[b.Quarter=5]="Quarter",b[b.Year=6]="Year",(_=E||(E={}))[_.None=0]="None",_[_.Nearest=1]="Nearest",_[_.Continue=2]="Continue",_[_.PerCount=3]="PerCount",_[_.PerVolume=4]="PerVolume",_[_.PerRange=5]="PerRange",_[_.PerSeconds=6]="PerSeconds",(L=M||(M={}))[L.Png=0]="Png",L[L.Jpeg=1]="Jpeg",L[L.Pdf=2]="Pdf",L[L.Svg=3]="Svg",(w=O||(O={}))[w.Number=0]="Number",w[w.String=1]="String",w[w.Date=2]="Date",(D=I||(I={}))[D.FromMetaData=0]="FromMetaData",D[D.AsInteger=1]="AsInteger",D[D.UseMetricUnit=2]="UseMetricUnit",D[D.AsPercent=3]="AsPercent",(N=x||(x={}))[N.Common=0]="Common",N[N.Study=1]="Study",N[N.BalanceSheet=2]="BalanceSheet",N[N.IncomeStatement=3]="IncomeStatement",N[N.Forward=4]="Forward",N[N.Seasonal=5]="Seasonal",N[N.Event=6]="Event",N[N.Option=7]="Option",(H=R||(R={}))[H.Unknown=0]="Unknown",H[H.Equity=1]="Equity",H[H.EquityOption=2]="EquityOption",H[H.Future=3]="Future",H[H.FutureOption=4]="FutureOption",H[H.Forex=5]="Forex",H[H.Index=6]="Index",(F=V||(V={}))[F.None=0]="None",F[F.Value=1]="Value",F[F.Percent=2]="Percent",(k=B||(B={}))[k.Linear=0]="Linear",k[k.Logarithmic=1]="Logarithmic",(W=U||(U={}))[W.Symbol=0]="Symbol",W[W.Expression=1]="Expression",W[W.Study=2]="Study",W[W.Forward=3]="Forward",W[W.BalanceSheet=4]="BalanceSheet",W[W.IncomeStatement=5]="IncomeStatement",W[W.Seasonal=6]="Seasonal",(G=$||($={}))[G.Normal=0]="Normal",G[G.Forward=1]="Forward",G[G.HistoricalForward=2]="HistoricalForward",G[G.Study=3]="Study",G[G.BalanceSheet=4]="BalanceSheet",G[G.IncomeStatement=5]="IncomeStatement",G[G.Events=6]="Events",G[G.Options=7]="Options",(Y=z||(z={}))[Y.Left=0]="Left",Y[Y.Center=1]="Center",Y[Y.Right=2]="Right",(K=j||(j={}))[K.Arrow=0]="Arrow",K[K.Crosshair=1]="Crosshair",K[K.Move=2]="Move",K[K.Hand=3]="Hand",K[K.ResizeVertical=4]="ResizeVertical",K[K.Grabbing=5]="Grabbing",K[K.ResizeHorizontal=6]="ResizeHorizontal",(X=q||(q={}))[X.NotApplicable=0]="NotApplicable",X[X.Left=1]="Left",X[X.Middle=2]="Middle",X[X.Right=3]="Right",(J=Z||(Z={}))[J.Shift=0]="Shift",J[J.Alt=1]="Alt",J[J.Control=2]="Control",J[J.Meta=3]="Meta",(ee=Q||(Q={}))[ee.None=0]="None",ee[ee.Horizontal=1]="Horizontal",ee[ee.Vertical=2]="Vertical",ee[ee.Both=3]="Both",(ie=te||(te={}))[ie.Unspecified=0]="Unspecified",ie[ie.GBE=1]="GBE",ie[ie.cmdtyView=2]="cmdtyView",ie[ie.DemoSite=3]="DemoSite",ie[ie.InternalFeed=4]="InternalFeed",ie[ie.Widget=5]="Widget",ie[ie.FreeWidget=6]="FreeWidget",(ne=se||(se={}))[ne.Unspecified=0]="Unspecified",ne[ne.Head=1]="Head",ne[ne.Tail=2]="Tail",(oe=re||(re={}))[oe.wheel=0]="wheel",oe[oe["wheel+shift"]=1]="wheel+shift",oe[oe.none=2]="none",(le=ae||(ae={}))[le.Auto=0]="Auto",le[le.Draggable=1]="Draggable",(ue=ce||(ce={}))[ue.Page=0]="Page",ue[ue.Application=1]="Application",(de=he||(he={}))[de.None=0]="None",de[de.Created=1]="Created",de[de.Deleted=2]="Deleted",de[de.Moved=3]="Moved",de[de.PointMoved=4]="PointMoved",de[de.TextChanged=5]="TextChanged",de[de.Undo=6]="Undo",de[de.Redo=7]="Redo",de[de.Cancelled=8]="Cancelled",de[de.Executed=9]="Executed",(fe=pe||(pe={}))[fe.None=0]="None",fe[fe.Min=1]="Min",fe[fe.Max=2]="Max";const De=(e,t)=>e[t];function xe(e,t,i=(e=>e),s=De,n=0,r=e.length-1){for(;n<r;){const l=n+r>>>1,c=s(e,l);((o=i(c))<(a=t)?-1:o>a?1:o>=a?0:NaN)<0?n=l+1:r=l}var o,a;return n}function Ne(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 Re(e,t){return Array.from({length:e},((e,i)=>t(i)))}function He(e,t){const i=Ze;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)}function Ve(e,t){return e[t%e.length]}function Fe(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}}let Be=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"");let ke=null;function Ue(){return null===ke&&(ke="ontouchstart"in globalThis),ke}function We(e,t){return"Backspace"===e||"Delete"===e||8===t||46===t}function $e(e,t){return"Escape"===e||27===t}function Ge(e,t){return"F2"===e||113===t}function ze(e,t){return"ArrowLeft"===e||37===t}function Ye(e,t){return"ArrowRight"===e||39===t}function je(e,t){t.sentAt=Date.now(),PubSub.publish(e,t)}function Ke(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=>je(e,t)),t)}function qe(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=>je(e,t)),t)}function Xe(e){return null!=e}function Ze(...e){return e.every((e=>null!=e))}function Je(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 Qe(e){return Ze(e)&&Number.isFinite(e)}function et(e){const t="both"===e;return[t||"vertical"===e,t||"horizontal"===e]}function tt(e,t,i){return t.includes(e)?e:i}function it(e,t){return Ze(e)?e:t}function st(e,t){return Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function nt(e,t,...i){if(!Ze(e))return t;let s=e;for(const e of i){if(!Ze(s)||!st(s,e))return t;s=s[e]}return s}function rt(e){return null==e?e:JSON.parse(JSON.stringify(e))}function ot(e,t,i=!0){const s=Object.keys(t),n=Object.keys(e);for(const o of s)if(r=o,!i||n.includes(r)){const i=e[o];void 0===i||"object"!=typeof i||Array.isArray(i)?e[o]=t[o]:at(e[o],t[o])}var r}function at(e,t){ot(e,t)}function lt(e,t){const i=Object.keys(t);for(const s of i)e[s]=e[s]||t[s]}function ct(e=[]){return e.reduce(((e,t)=>(e[t.name]=t.value,e)),{})}function ut(e){return e?new Date(e):null}function ht(e){let t="";for(const i in e){const s=`${i}=${encodeURIComponent(e[i])}`;t+=(t.length>0?"&":"")+s}return t}function dt(e,t){ot(e,t,!1)}const pt=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,ft=[1e3,60,60,24,7,30/7,12];function mt(e){const t=pt.exec(e);if(!Ze(t))return null;const i=t.slice(2,9).map((e=>Ze(e)?parseFloat(e):0)).reverse();return ft.forEach(((e,t)=>{for(let s=t;s<i.length;s++)i[s]=i[s]*e})),Math.floor(Ae(i))}function gt(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 yt(){return Be(12)}function Tt(e,t,i){return Math.min(Math.max(i,e),t)}var St,At={};At={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 vt={},Pt={};Pt=(()=>{function e(e,i,s,n,r){s===String?At.string(e)||t(i,"string",r):s===Number?At.number(e)||t(i,"number",r):s===Function?At.fn(e)||t(i,"function",r):s===Boolean?At.boolean(e)||t(i,"boolean",r):s===Date?At.date(e)||t(i,"date",r):s===Array?At.array(e)||t(i,"array",r):e instanceof(s||Object)||t(i,n,r)}function t(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 i(e,t){throw new Error(`The argument [ ${e||"unspecified"} ] failed a validation check [ ${t||"No description available"} ]`)}return{argumentIsRequired(t,i,s,n){e(t,i,s,n)},argumentIsOptional(t,s,n,r,o,a){null!=t&&(e(t,s,n,r),At.fn(o)&&!o(t)&&i(s,a))},argumentIsArray(t,i,s,n){if(this.argumentIsRequired(t,i,Array),s){let r;r="function"==typeof s&&s!==Function?(e,t)=>void 0!==s.prototype&&e instanceof s||s(e,`${i}[${t}]`):(t,r)=>e(t,i,s,n,r),t.forEach(((e,t)=>{r(e,t)}))}},argumentIsValid(e,t,s,n){s(e)||i(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()}]`)}}})(),vt=(()=>{const e={camel:{}};return 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=>(Pt.argumentIsRequired(t,"s",String),t.replace(e.camel.violations,(e=>e.toLocaleLowerCase()))),truncate:(e,t)=>At.string(e)&&e.length>t?e.substring(0,t)+" ...":e,padLeft(e,t,i){if(Pt.argumentIsRequired(e,"s",String),Pt.argumentIsRequired(t,"length",Number),Pt.argumentIsRequired(i,"character",String),1!==i.length)throw new Error('The "character" argument must be one character in length.');return i.repeat(t-e.length)+e},format:(e,...t)=>(Pt.argumentIsRequired(e,"s",String),e.replace(/{(\d+)}/g,((e,i)=>{let s;if(i<t.length){const n=t[i];s=At.undefined(n)||At.null(n)?e:n.toString()}else s=e;return s})))}})();var Ct,bt={};bt=(()=>{const e=new Map;class t{constructor(i,s){Pt.argumentIsRequired(i,"code",String),Pt.argumentIsRequired(s,"description",String),this._code=i,this._description=s;const n=this.constructor;e.has(n)||e.set(n,[]);null===t.fromCode(n,i)&&e.get(n).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})(),Ct=(()=>{class e extends bt{constructor(e,t,i){super(e,t),this._id=i}get id(){return this._id}toJSON(){return this._id}static parse(t){return bt.fromCode(e,t)}static fromId(t){return bt.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 n}static get FOREX(){return r}static get CMDTY_STATS(){return o}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}}const t=new e("STK","U.S. Equity",1),i=new e("STKOPT","Equity Option",34),s=new e("FUT","Future",2),n=new e("FUTOPT","Future Option",12),r=new e("FOREX","FOREX",10),o=new e("CMDTY","cmdtyStats",24);return e})(),St=(()=>{class e{constructor(){}static getIsConcrete(e){return At.string(e)&&!this.getIsReference(e)}static getIsReference(e){return At.string(e)&&r.futures.alias.test(e)}static getIsFuture(e){return At.string(e)&&(r.futures.concrete.test(e)||r.futures.alias.test(e))}static getIsCash(t){return e.getIsFuture(t)&&r.futures.cash.test(t)}static getIsFutureSpread(e){return At.string(e)&&r.futures.spread.test(e)}static getIsFutureOption(e){return At.string(e)&&(r.futures.options.short.test(e)||r.futures.options.long.test(e)||r.futures.options.historical.test(e))}static getIsForex(e){return At.string(e)&&r.forex.test(e)}static getIsCrypto(e){return At.string(e)&&r.crypto.test(e)}static getIsIndex(e){return At.string(e)&&r.indicies.external.test(e)}static getIsSector(e){return At.string(e)&&r.indicies.sector.test(e)}static getIsCanadianFund(e){return At.string(e)&&r.funds.canadian.test(e)}static getIsCmdty(e){return At.string(e)&&(r.cmdty.stats.test(e)||r.cmdty.internal.test(e)||r.cmdty.external.test(e))}static getIsCmdtyStats(e){return At.string(e)&&r.cmdty.stats.test(e)}static getIsBats(e){return At.string(e)&&n.bats.test(e)}static getIsEquityOption(e){return At.string(e)&&r.equities.options.test(e)}static getIsExpired(t){const i=e.parseInstrumentType(t);let n=!1;if(null!==i&&i.year&&i.month){const e=l();if(i.year<e)n=!0;else if(i.year===e&&s.hasOwnProperty(i.month)){(new Date).getMonth()+1>s[i.month]&&(n=!0)}}return n}static getIsC3(e){return At.string(e)&&(r.c3.concrete.test(e)||r.c3.alias.test(e))}static getIsPlatts(e){return At.string(e)&&(r.platts.concrete.test(e)||r.platts.alias.test(e))}static getIsPit(e,t){return At.string(e)&&At.string(t)&&n.pit.test(t)}static getIsGrainBid(e){return At.string(e)&&r.bids.test(e)}static parseInstrumentType(e){if(!At.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 getProducerSymbol(e){if(!At.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 getFuturesOptionPipelineFormat(t){const i=e.parseInstrumentType(t);let s=null;if("future_option"===i.type){const e=h(i.option_type);s=`${i.root}${i.month}${c(i.year,1)}|${i.strike}${e}`}return s}static getFuturesExplicitFormat(t){let i=null;if(e.getIsFuture(t)&&e.getIsConcrete(t)){const s=e.parseInstrumentType(t);i=`${s.root}${s.month}${vt.padLeft(Math.floor(s.year%100).toString(),2,"0")}`}return i}static getFuturesYear(e,t){return u(e,t)}static displayUsingPercent(e){return At.string(e)&&n.percent.test(e)}toString(){return"[SymbolParser]"}}const 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},n={bats:/^(.*)\.BZ$/i,percent:/(\.RT)$/,pit:/\(P(it)?\)/},r={bids:/^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i,c3:{}};r.c3.alias=/^(C3:)(.*)$/i,r.c3.concrete=/(\.C3)$/i,r.cmdty={},r.cmdty.stats=/(\.CS)$/i,r.cmdty.internal=/(\.CM)$/i,r.cmdty.external=/(\.CP)$/i,r.crypto=/^\^([A-Z]{3})([A-Z]{3,4})$/i,r.equities={},r.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,r.forex=/^\^([A-Z]{3})([A-Z]{3})$/i,r.funds={},r.funds.canadian=/(.*)(\.CF)$/i,r.futures={},r.futures.alias=/^([A-Z][A-Z0-9\$\-!\.]{0,2})(\*{1})([0-9]{1,2})$/i,r.futures.concrete=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,r.futures.spread=/^_S_/i,r.futures.cash=/(.*)(Y00)$/,r.futures.options={},r.futures.options.historical=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,r.futures.options.long=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,r.futures.options.short=/^([A-Z][A-Z0-9\$\-!\.]?)([A-Z])([0-9]{1,4})([A-Z])$/i,r.indicies={},r.indicies.external=/^\$(.*)$/i,r.indicies.sector=/^\-(.*)$/i,r.platts={},r.platts.alias=/^(PLATTS:)(.*)$/i,r.platts.concrete=/^(.*)(\.PT)$/i;const o=[];o.push((e=>{let t=null;return r.futures.spread.test(e)&&(t={},t.symbol=e,t.type="future_spread"),t})),o.push((e=>{let t=null;const i=e.match(r.futures.concrete);return null!==i&&(t={},t.symbol=e,t.type="future",t.asset=Ct.FUTURE,t.dynamic=!1,t.root=i[1],t.month=i[2],t.year=u(i[3],i[2])),t})),o.push((e=>{let t=null;const i=e.match(r.futures.alias);return null!==i&&(t={},t.symbol=e,t.type="future",t.asset=Ct.FUTURE,t.dynamic=!0,t.root=i[1],t.dynamicCode=i[3]),t})),o.push((e=>{let t=null;return r.forex.test(e)&&(t={},t.symbol=e,t.type="forex",t.asset=Ct.FOREX),t})),o.push((e=>{let t=null;const i=e.match(r.equities.options);if(null!==i){const s=void 0!==i[4]?i[4]:"";t={},t.symbol=e,t.type="equity_option",t.asset=Ct.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})),o.push((e=>{let t=null;return r.indicies.external.test(e)&&(t={},t.symbol=e,t.type="index"),t})),o.push((e=>{let t=null;return r.indicies.sector.test(e)&&(t={},t.symbol=e,t.type="sector"),t})),o.push((e=>{let t=null;const i=e.match(r.futures.options.short);if(null!==i){t={};const s=i[4].charCodeAt(0),n=80;let r,o;s<n?(r="call",o=s-67):(r="put",o=s-n),t.symbol=e,t.type="future_option",t.asset=Ct.FUTURE_OPTION,t.option_type=r,t.strike=parseInt(i[3]),t.root=i[1],t.month=i[2],t.year=l()+o}return t})),o.push((e=>{let t=null;const s=e.match(r.futures.options.long)||e.match(r.futures.options.historical);var n;return null!==s&&(t={},t.symbol=e,t.type="future_option",t.asset=Ct.FUTURE_OPTION,t.option_type="C"===s[5]?"call":"put",t.strike=parseInt(s[4]),t.root=s[1],t.month=(n=s[2],i[n]||n),t.year=u(s[3])),t})),o.push((e=>{let t=null;return null!==e.match(r.cmdty.stats)&&(t={},t.symbol=e,t.type="cmdtyStats",t.asset=Ct.CMDTY_STATS),t}));const a=[];function l(){return(new Date).getFullYear()}function c(e,t){const i=e.toString();return i.substring(i.length-t,i.length)}function u(e,t){const i=l();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 h(e){return"call"===e?"C":"put"===e?"P":null}return a.push((i=>{let s=null;if(e.getIsFuture(i)&&e.getIsConcrete(i)){const e=i.match(r.futures.concrete);if(null!==e){const i=e[1],n=e[2],r=u(e[3],n);if(r>l()+9){const e=t[n];e&&(s=`${i}${e}${c(r,1)}`)}}}return s})),a.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})),a.push((t=>{let i=null;if(e.getIsFutureOption(t)){const s=e.parseInstrumentType(t),n=h(s.option_type);if(s.root.length<3){const e=n.charCodeAt(0);i=`${s.root}${s.month}${s.strike}${String.fromCharCode(e+s.year-l())}`}else i=`${s.root}${s.month}${c(s.year,1)}|${s.strike}${n}`}return i})),a.push((e=>{let t=null;return r.c3.alias.test(e)&&(t=e.replace(r.c3.alias,"$2.C3")),t})),a.push((e=>{let t=null;return r.platts.alias.test(e)&&(t=e.replace(r.platts.alias,"$2.PT")),t})),a.push((e=>e)),e})();var Et;function _t(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 Mt(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Lt(e){return Lt="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},Lt(e)}function Ot(e){Mt(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Lt(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)),new Date(NaN))}function wt(e,t){Mt(2,arguments);var i=Ot(e),s=_t(t);if(isNaN(s))return new Date(NaN);if(!s)return i;var n=i.getDate(),r=new Date(i.getTime());r.setMonth(i.getMonth()+s+1,0);var o=r.getDate();return n>=o?r:(i.setFullYear(r.getFullYear(),r.getMonth(),n),i)}function It(e,t){Mt(2,arguments);var i=_t(t);return wt(e,12*i)}function Dt(e){Mt(1,arguments);var t=Ot(e),i=new Date(0);return i.setFullYear(t.getFullYear(),0,1),i.setHours(0,0,0,0),i}function xt(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){Mt(1,arguments);var t=Ot(e);return t.setHours(0,0,0,0),t}Et=(()=>{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)}})();var Rt=864e5;function Ht(e,t){Mt(2,arguments);var i=Nt(e),s=Nt(t),n=i.getTime()-xt(i),r=s.getTime()-xt(s);return Math.round((n-r)/Rt)}function Vt(e){Mt(1,arguments);var t=Ot(e),i=Ht(t,Dt(t)),s=i+1;return s}function Ft(e){return Mt(1,arguments),Ot(e).getFullYear()}function Bt(e){Mt(1,arguments);var t=Ot(e);return t.setDate(1),t.setHours(0,0,0,0),t}function kt(t){return e(St).parseInstrumentType(t)}const Ut=()=>Vt(Date.now()),Wt=function(e){const t=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 ni(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}})),$t=e=>Wt(e,Ut());async function Gt(e){if(!ti(e))return e;const{root:t,dynamic:i,dynamicCode:s}=kt(e);if(!Ze(t,i,s))return null;const n=await $t(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 zt(t){return e(St).getIsFutureOption(t)}function Yt(t){return e(St).getIsFuture(t)}const jt=/^_S_SP_([^_]+)_([^_]+)$/;function Kt(e){const t=e.match(jt);return!(!t||3!==t.length)&&(Yt(t[1])&&Yt(t[2]))}const qt=/^([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 Xt(e){return qt.test(e)}function Zt(t){return e(St).getIsEquityOption(t)}function Jt(e){return Yt(e)?`${function(e){if(!Yt(e))return null;const t=kt(e);return t.root}(e)}Y00`:null}function Qt(e){return String(e%100).padStart(2,"0")}function ei(e,t=!1){if(!Yt(e))return e;const i=kt(e);return function(e,t,i,s=!1){return`${e}${t}${s?i:Qt(i)}`}(i.root,i.month,i.year,t)}function ti(e){const t=kt(e);return Ze(t)&&!0===t.dynamic}function ii(e){const t=Yt(e)||zt(e),i="_S_"===e.substring(0,2);return(t||Zt(e))&&!i}function si(e){return Yt(e)?"America/Chicago":"America/New_York"}async function ni(e){const t=await fP("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 ri(t){if(!Yt(t))return null;const i=kt(t),s=e(Et).getCodeToNumberMap()[i.month];return Bt(new Date(i.year,s-1))}function oi(e,t){const i=kt(e),s=(i.year+t)%100;return`${i.root}${i.month}${Qt(s)}`}function ai(e,t){const i=Yt(e),s=Xt(e),n=Kt(e);return i?oi(e,t):s?function(e,t){const i=qt.exec(e),s=Number.parseInt(i[2]),n=Ft(It(new Date(s+(s>79?1900:2e3),0,1),t));return`${i[1]}${Qt(n)}${i[3]}`}(e,t):n?function(e,t){const i=e.match(jt);return`_S_SP_${oi(i[1],t)}_${oi(i[2],t)}`}(e,t):null}async function li(e){const t=e=>[e,!1,!1],i=Yt(e),s=Xt(e),n=function(e){return!!Yt(e)&&"Y"===kt(e).month}(e);if(!i&&!s||n)return t(e);if(i){const{root:t,month:i}=kt(e),s=await Gt(`${t}*1`);if(!ti(e)){const s=(await $t(t))?.symbols??[];if(s.includes(e))return[e,!0,!1];for(let e of s){if(kt(e).month===i)return[e,!0,!0]}}return[s,!0,!0]}if(s){const i=qt.exec(e);return t(`${i[1]}${Qt(Ft(new Date))}${i[3]}`)}return t(e)}function ci(e){const t=e.getRootNode();return t===document?document.body:t}function ui(e,t=document){const i=di(e,t);return Ze(i)?i.innerHTML:null}function hi(e){e.remove()}function di(e,t=document){return Ti(e,t)[0]}function pi(e,t){for(const i in t)e.style[i]=t[i]}function fi(e,t){for(const i in t)e.setAttribute(i,t[i])}function mi(e,t,i){const s=di(`#${e}`,t);if(Ze(s))return s;const n=yi(t,i);return n.id=e,n}function gi(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 yi(e,t){return e.appendChild(document.createElement(t))}function Ti(e,t=document){return t.querySelectorAll(e)}function Si(e,t){e&&(e.innerHTML=t)}async function Ai(e,t="asyncReadyWork"){Ze(this[t])||(this[t]={});const i=this[t];return Ze(i.result)?Promise.resolve(i.result):(Ze(i.promise)||(i.promise=e.call(this),i.promise.then((e=>{i.result=e}))),i.promise)}class vi{_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 Pi=globalThis.devicePixelRatio||1,Ci={EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:Ue()?20*Pi:5*Pi,HALF_ANN_POINT_DIMENSION:Ue()?10:6,OUT_OF_SCREEN:8192,DEFAULT_SYMBOL_WIDTH_HEIGHT:32,PANE_SPLITTER_PERCENT_HEIGHT:.75,BASIS_MAIN:"$main",INPUT_PERIOD:"Period",INPUT_PERIOD1:"Period1",INPUT_PERIOD2:"Period2",INPUT_PERIOD3:"Period3",INPUT_SYMBOL:"Symbol",INPUT_SMOOTHING:"Smoothing",INPUT_SOURCE:"Source",INPUT_WIDTH:"Width",EMPTY_ARRAY:[],CHART_DEFINITION:"chart.def.json",CHART_SCHEMA:"chart.schema.json",STUDIES_SCHEMA:"studies.schema.json",STUDIES_LIST:"studies.lst.json",FIELDS_SCHEMA:"fields.schema.json",FIELDS_LIST:"fields.lst.json",ACCESSOR_SCHEMA:"accessor.schema.json",EVENTS:["dividends","earnings","splits","custom"],EVENT_PROPERTIES:["show","color","title"],PLACEHOLDER_SYMBOL_NAME:"PLACEHOLDER",REALTIME_INITIAL_QUOTE:"REFRESH_QUOTE",REALTIME_TRADE:"TRADE",REALTIME_VOLUME:"VOLUME",TOOLTIP_X_OFFSET:15,TOOLTIP_Y_OFFSET:30,TOOLTIP_TOGGLE_SIDE_ANIM_MS:300,TOOLTIP_TOGGLE_DISTANCE_TOLERANCE:10,CARDS_X_OFFSET:5,CARDS_Y_OFFSET:5,PANE_CAP_MAX_PADDING_PERCENT:.15,PANE_CAP_MIN_PADDING_PERCENT:.075,PANE_TINY_PADDING_PIXELS:5,STANDARD_VISIBLE_BARS:130,ACTION_GET:"Get",ACTION_DELETE:"Delete",ACTION_TEMPLATE:"Template",ACTION_AGGREGATION:"Aggregation",ACTION_PLOT:"Plot",MINIMUM_BAR_WIDTH:.02,MAXIMUM_BAR_WIDTH:180,MINIMUM_BARS_VISIBLE:5,COLOR_TRANSPARENT:"rgba(0, 0, 0, 0)",AT_LINE:"line",AT_LINE_2:"line2",AT_FILL:"fill",AT_FILL2:"fill2",AT_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:[v.Renko,v.LineBreak,v.Kagi,v.PointAndFigure],INTRA_THRESHOLD:mt("P30D"),ONE_DAY_MILLIS:mt("P1D"),ONE_MINUTE_MILLIS:6e4,TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:mt("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),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};var bi={},Ei={};Ei=function(e,t,i,s){if(!At.number(e))return"";(!At.string(i)||i.length>1)&&(i="");const n=e<0&&!0===s;n&&(e=0-e);let r=e.toFixed(t);if(i&&(e<-999||e>999)){const s=e<0;let o=0===t,a=0;const l=[];for(let e=r.length-1;!(e<0);e--){3!==a||s&&0===e||(l.unshift(i),a=0);const t=r.charAt(e);l.unshift(t),o?a+=1:"."===t&&(o=!0)}n&&(l.unshift("("),l.push(")")),r=l.join("")}else n&&(r="("+r+")");return r};var _i={};_i=function(e,t,i,s,n){if(!At.number(e))return"";if(!At.number(t))return"";if(!At.number(i))return"";(!At.string(s)||s.length>1)&&(s=".");const r=Math.abs(e),o=function(e,t){const i=Math.floor(e);return 0===i&&""===t?"":i}(r,s),a=function(e){return e-Math.floor(e)}(r)*t,l=function(e,t){return["000",Math.floor(e)].join("").substr(-1*t)}(Math.floor(parseFloat(a.toFixed(1))),i);let c,u;return e<0?(n=At.boolean(n)&&n)?(c="(",u=")"):(c="-",u=""):(c="",u=""),[c,o,s,l,u].join("")};var Mi={},Li={},Oi={};!function(e){var t,i=1e6,s=1e6,n="[big.js] ",r=n+"Invalid ",o=r+"decimal places",a=r+"rounding mode",l=n+"Division by zero",c={},u=void 0,h=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function d(e,t,i,s){var n=e.c;if(i===u&&(i=e.constructor.RM),0!==i&&1!==i&&2!==i&&3!==i)throw Error(a);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]!==u))),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]!==u||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 p(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}c.abs=function(){var e=new this.constructor(this);return e.s=1,e},c.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},c.div=function(e){var t=this,s=t.constructor,n=t.c,r=(e=new s(e)).c,a=t.s==e.s?1:-1,c=s.DP;if(c!==~~c||c<0||c>i)throw Error(o);if(!r[0])throw Error(l);if(!n[0])return e.s=a,e.c=[e.e=0],e;var h,p,f,m,g,y=r.slice(),T=h=r.length,S=n.length,A=n.slice(0,h),v=A.length,P=e,C=P.c=[],b=0,E=c+(P.e=t.e-e.e)+1;for(P.s=a,a=E<0?0:E,y.unshift(0);v++<h;)A.push(0);do{for(f=0;f<10;f++){if(h!=(v=A.length))m=h>v?1:-1;else for(g=-1,m=0;++g<h;)if(r[g]!=A[g]){m=r[g]>A[g]?1:-1;break}if(!(m<0))break;for(p=v==h?r:y;v;){if(A[--v]<p[v]){for(g=v;g&&!A[--g];)A[g]=9;--A[g],A[v]+=10}A[v]-=p[v]}for(;!A[0];)A.shift()}C[b++]=m?f:++f,A[0]&&m?A[v]=n[T]||0:A=[n[T]]}while((T++<S||A[0]!==u)&&a--);return C[0]||1==b||(C.shift(),P.e--,E--),b>E&&d(P,E,s.RM,A[0]!==u),P},c.eq=function(e){return 0===this.cmp(e)},c.gt=function(e){return this.cmp(e)>0},c.gte=function(e){return this.cmp(e)>-1},c.lt=function(e){return this.cmp(e)<0},c.lte=function(e){return this.cmp(e)<1},c.minus=c.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},c.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(l);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)))},c.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},c.plus=c.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},c.pow=function(e){var t=this,i=new t.constructor("1"),n=i,o=e<0;if(e!==~~e||e<-1e6||e>s)throw Error(r+"exponent");for(o&&(e=-e);1&e&&(n=n.times(t)),e>>=1;)t=t.times(t);return o?i.div(n):n},c.prec=function(e,t){if(e!==~~e||e<1||e>i)throw Error(r+"precision");return d(new this.constructor(this),e,t)},c.round=function(e,t){if(e===u)e=0;else if(e!==~~e||e<-i||e>i)throw Error(o);return d(new this.constructor(this),e+this.e+1,t)},c.sqrt=function(){var e,t,i,s=this,r=s.constructor,o=s.s,a=s.e,l=new r("0.5");if(!s.c[0])return new r(s);if(o<0)throw Error(n+"No square root");0===(o=Math.sqrt(+p(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 r(((o=Math.sqrt(t))==1/0?"5e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+a)):e=new r(o+""),a=e.e+(r.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 d(e,(r.DP-=4)+e.e+1,r.RM)},c.times=c.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},c.toExponential=function(e,t){var s=this,n=s.c[0];if(e!==u){if(e!==~~e||e<0||e>i)throw Error(o);for(s=d(new s.constructor(s),++e,t);s.c.length<e;)s.c.push(0)}return p(s,!0,!!n)},c.toFixed=function(e,t){var s=this,n=s.c[0];if(e!==u){if(e!==~~e||e<0||e>i)throw Error(o);for(e=e+(s=d(new s.constructor(s),e+s.e+1,t)).e+1;s.c.length<e;)s.c.push(0)}return p(s,!1,!!n)},c.toJSON=c.toString=function(){var e=this,t=e.constructor;return p(e,e.e<=t.NE||e.e>=t.PE,!!e.c[0])},c.toNumber=function(){var e=+p(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(n+"Imprecise conversion");return e},c.toPrecision=function(e,t){var s=this,n=s.constructor,o=s.c[0];if(e!==u){if(e!==~~e||e<1||e>i)throw Error(r+"precision");for(s=d(new n(s),e,t);s.c.length<e;)s.c.push(0)}return p(s,e<=s.e||s.e<=n.NE||s.e>=n.PE,!!o)},c.valueOf=function(){var e=this,t=e.constructor;if(!0===t.strict)throw Error(n+"valueOf disallowed");return p(e,e.e<=t.NE||e.e>=t.PE,!0)},t=function e(){function t(i){var s=this;if(!(s instanceof t))return i===u?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(r+"value");i=0===i&&1/i<0?"-0":String(i)}!function(e,t){var i,s,n;if(!h.test(t))throw Error(r+"number");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);for(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=c,t.DP=20,t.RM=1,t.NE=-7,t.PE=21,t.strict=false,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}(),t.default=t.Big=t,"function"==typeof define&&define.amd?define((function(){return t})):Oi?Oi=t:e.Big=t}(Oi),Li=(()=>{class e{constructor(e){this._big=a(e)}add(t){return new e(this._big.plus(a(t)))}subtract(t){return new e(this._big.minus(a(t)))}multiply(t){return new e(this._big.times(a(t)))}divide(t){return new e(this._big.div(a(t)))}raise(t){return Pt.argumentIsRequired(t,"exponent",Number),new e(this._big.pow(t))}round(t,i){Pt.argumentIsRequired(t,"places",Number),Pt.argumentIsOptional(i,"mode",l,"RoundingMode");const s=i||l.NORMAL;return new e(this._big.round(t,s.value))}mod(t){return new e(this._big.mod(a(t)))}absolute(){return new e(this._big.abs())}opposite(){return this.multiply(-1)}getIsZero(e,i){return Pt.argumentIsOptional(e,"approximate",Boolean),Pt.argumentIsOptional(i,"places",Number),this._big.eq(t)||At.boolean(e)&&e&&this.round(i||Oi.DP,l.NORMAL).getIsZero()}getIsPositive(){return this._big.gt(t)}getIsNegative(){return this._big.lt(t)}getIsGreaterThan(e){return this._big.gt(a(e))}getIsGreaterThanOrEqual(e){return this._big.gte(a(e))}getIsLessThan(e){return this._big.lt(a(e))}getIsLessThanOrEqual(e){return this._big.lte(a(e))}getIsBetween(e,t,i){return Pt.argumentIsOptional(i,"exclusive",Boolean),At.boolean(i)&&i?this.getIsGreaterThan(e)&&this.getIsLessThan(t):this.getIsGreaterThanOrEqual(e)&&this.getIsLessThanOrEqual(t)}getIsEqual(e){return this._big.eq(a(e))}getIsApproximate(t,i){if(0===i)return this.getIsEqual(t);const s=this.subtract(t).absolute(),n=e.ONE.divide(new e(10).raise(i));return s.getIsLessThan(n)}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(e){return Pt.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 Pt.argumentIsRequired(t,"value",e,"Decimal"),new e(t._big)}static parse(t){return new e(t)}static get ZERO(){return n}static get ONE(){return r}static get NEGATIVE_ONE(){return o}static get ROUNDING_MODE(){return l}static getIsZero(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsZero()}static getIsNotZero(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),!t.getIsZero()}static getIsPositive(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()}static getIsNotPositive(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()||t.getIsZero()}static getIsNegative(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()}static getIsNotNegative(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()||t.getIsZero()}static compareDecimals(t,i){return Pt.argumentIsRequired(t,"a",e,"Decimal"),Pt.argumentIsRequired(i,"b",e,"Decimal"),t._big.gt(i._big)?1:t._big.lt(i._big)?-1:0}toString(){return"[Decimal]"}}const t=new Oi(0),i=new Oi(1),s=new Oi(-1),n=new e(t),r=new e(i),o=new e(s);function a(t){return t instanceof Oi?t:t instanceof e?t._big:new Oi(t)}class l extends bt{constructor(e,t){super(e.toString(),t),this._value=e}get value(){return this._value}static get UP(){return c}static get DOWN(){return u}static get NORMAL(){return h}toString(){return"[RoundingMode]"}}const c=new l(3,"up"),u=new l(0,"down"),h=new l(1,"normal");return e})(),Mi=(()=>{class e extends bt{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(e){Pt.argumentIsValid(e,"tickIncrement",At.integer,"must be an integer");const t=new Li(1),i=new Li(10);let s;s=this.supportsFractions?t.divide(this._fractionFactor):t.divide(i.raise(this._decimalDigits));return s.multiply(e).toFloat()}getMinimumTickValue(e,t){Pt.argumentIsValid(e,"tickIncrement",At.integer,"must be an integer"),Pt.argumentIsValid(t,"pointValue",At.number,"must be a number");return new Li(this.getMinimumTick(e)).multiply(t).toFloat()}roundToNearestTick(e,t,i){let s;Pt.argumentIsValid(e,"value",(e=>At.number(e)||e instanceof Li),"must be a number primitive or a Decimal instance"),Pt.argumentIsValid(t,"minimumTick",(e=>At.number(e)||e instanceof Li),"must be a number primitive or a Decimal instance"),Pt.argumentIsOptional(i,"roundToZero",Boolean),s=e instanceof Li?e:new Li(e);let n=s.divide(t);return s.mod(t).getIsZero()||(n=n.round(0,At.boolean(i)&&i?Li.ROUNDING_MODE.DOWN:Li.ROUNDING_MODE.NORMAL)),n.multiply(t).toFloat()}toString(){return`[UnitCode (code=${this.code})]`}static parse(t){return bt.fromCode(e,t)}static fromBaseCode(t){return bt.getItems(e).find((e=>e.baseCode===t))||null}}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);return e})(),bi=function(e,t,i,s,n,r){if(!At.number(e))return"";const o=Mi.parse(t);if(null===o)return"";if((!At.string(i)||i.length>1)&&(i="."),s=At.boolean(s)&&s,r=At.boolean(r)&&r,o.supportsFractions&&"."!==i){const t=o.getFractionFactor(s),n=o.getFractionDigits(s);return _i(e,t,n,i,r)}return Ei(e,o.decimalDigits,n,r)};var wi;wi=(()=>{const 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===Ct.FUTURE_OPTION){const i=s.root;if("ZB"===i||"ZN"===i||e.ZB.test(i)||e.ZN.test(i))return _i(t,64,2,"-",!1);if("ZT"===i||"ZF"===i||e.ZT.test(i)||e.ZF.test(i))return _i(t,640,3,"-",!1)}return bi(t,i,"-",!0,",")}})();const Ii=[{min:0,divider:1,suffix:"",decimals:0},{min:1e5,divider:1e3,suffix:"K",decimals:0},{min:1e6,divider:1e6,suffix:"M",decimals:2},{min:1e9,divider:1e9,suffix:"B",decimals:3}];function Di(e){if(Ze(e)){const t=nt(SP().config,null,"overrides","symbology","translateSymbol");if(Ze(t)&&"function"==typeof t)try{const i=t(e);if(Ze(i))return i}catch(t){dP(`Failed translating the symbol '${e}', error is ${t.message}`,"warn")}}return e}function xi(t,i,s){if(null==t)return"";if(!this.isReady)return t.toFixed(0);if(i.format===I.FromMetaData)return function(t,i,s){const n=SP().config;return n.mode===te[te.cmdtyView]&&null!=s?e(wi)(t,i,s):e(bi)(t,i,"-",n.isAlt64,",",!1)}(t,this.unitCode,this._profile);switch(i.format){case I.AsInteger:return t.toFixed();case I.UseMetricUnit:{s=s||{};const e=Object.assign({},{range:[t,t],allDigits:!1},s);if(s.allDigits)return Hi(t,0);Array.isArray(e.range)&&e.range.length||(e.range=[t,t]);const i=Math.max(Math.abs(e.range[0]),Math.abs(e.range[1])),n=function(e,t){const i=_e(e,t);return-1===i?null:e[i]}(Ii,(e=>i>e.min))||Ii[0];return`${(t/n.divider).toFixed(n.decimals)}${n.suffix}`}case I.AsPercent:return`${(100*t).toFixed(2)}%`;default:return""}}function Ni(e,t,i){const s=i?.overridePrecision;return Number.isFinite(s)&&s>=0?Hi(e,s):null}class Ri{name="";unitCode="";exchange="";pointValue=1;tickIncrement=1;symbolType="Unknown";expiration="";_minMovement=null;constructor(e){this.resolved=this.symbol=e,this.timeZone=si(Di(this.symbol)),this._profile=null}initialize(e){Bi(e)||at(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=Ni(e,0,i);return null!==s?s:xi.call(this,e,t,i)}parse(e){throw new Error("Not implemented yet")}getInlineMetadata(e){const t=ui(`#${Ci.INLINE_DATA_ELEMENT_ID}`);if(!Ze(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(!Yt(e))return e;const i=kt(e);return t.find((e=>kt(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 fP("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){dP(`Failed fetching the metadata for ${e}, error is ${t.message}`,"warn")}return{name:"",exchange:"",unitCode:"A",pointValue:1,tickIncrement:1}}}function Hi(t,i){return e(Ei)(t,i,",",!1)}function Vi(e,t=!1){return new ji(e,t)}class Fi extends Ri{shutdown(){}async ready(){return Ai.call(this,(async()=>{const e=Di(this.symbol);let t=this.getInlineMetadata(e);return Bi(t)&&(t=await this.getFallbackMetadata(e)),this.initialize(t),!0}))}getCacheableEntities(e){e.add(this)}}function Bi(e){return!Xe(e)||!Ze(e.unitCode,e.name,e.exchange)||0===e.unitCode.length}class ki extends Ri{shutdown(){}equityOptionProfile(){return{name:this.symbol,exchange:"",unitCode:"A",pointValue:1,tickIncrement:1,symbolType:"EquityOption"}}async ready(){return Ai.call(this,(async()=>{const e=Di(this.symbol);if(Zt(e))return this.initialize(this.equityOptionProfile()),!0;const t=ti(e),i=await(t?Gt(e):e);this.resolved=ei(i);const[s,n]=await li(this.resolved),r=new Promise((e=>{setTimeout((()=>e(null)),Ci.META_DATA_GET_TIMETOUT)}));let o=await Promise.race([r,this.getProfile(s)]);return Bi(o)&&(o=this.getInlineMetadata(s)),Bi(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 Ui extends ki{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=SP(),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}}}let Wi;var $i;($i=Wi||(Wi={}))[$i.UNKNOWN_INSTRUMENT_TYPE=0]="UNKNOWN_INSTRUMENT_TYPE",$i[$i.FOREX=1]="FOREX",$i[$i.INDEX=2]="INDEX",$i[$i.EQUITY=3]="EQUITY",$i[$i.FUTURE=4]="FUTURE",$i[$i.OPTION=5]="OPTION",$i[$i.SPREAD=6]="SPREAD",$i[$i.MUTUAL_FUND=7]="MUTUAL_FUND",$i[$i.MONEY_MARKET_FUND=8]="MONEY_MARKET_FUND",$i[$i.USER_DEFINED_SPREAD=9]="USER_DEFINED_SPREAD",$i[$i.EQUITY_OPTION=10]="EQUITY_OPTION",$i[$i.OTHER=99]="OTHER",$i[$i.UNRECOGNIZED=-1]="UNRECOGNIZED";class Gi extends ki{_profileSource=new vi;priceDenominator=1;quantityDenominator=1;priceScaling=1;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 Wi.EQUITY:return"Equity";case Wi.FUTURE:return"Future";case Wi.OPTION:return"FutureOption";case Wi.FOREX:return"Forex";case Wi.INDEX:return"Index";case Wi.EQUITY_OPTION:return"EquityOption";case Wi.UNKNOWN_INSTRUMENT_TYPE:case Wi.UNRECOGNIZED:case Wi.OTHER:default:return"Unknown"}}getFallbackApi(){return"getOFInstrumentDefinition"}processFallback(e){const t=e.definition;return t.instrumentType=Wi[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}const n=SP();return{symbolType:this.getType(e.instrumentType),pointValue:e.contractPointValue,tickIncrement:e.minimumPriceIncrement,exchange:n.exchanges.find((t=>t.exchangeId===e.exchangeId))?.code??"",name:e.description,unitCode:e.barchartBaseCode,timeZone:e.timeZoneName}}async getProfile(e){const t=SP(),i=await t.client.connection,s=await i.getInstrument(this.getRequest(e));return s.length<1?null:this.getProfileFromInstrumentDefinition(s[0])}}class zi{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=Ni(e,0,i);return null!==s?s:Hi(e,this._decimals)}getCacheableEntities(e){}}class Yi{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?"":Ze(e)?e.toFixed(0):""}getCacheableEntities(e){}}class ji{unitCode="";pointValue=1;tickIncrement=1;minMovement=0;symbol="";symbolType="Unknown";resolved="";name="";exchange="";constructor(e,t=!1){const i=SP().getMetaDataSource();this.inner=e.map((e=>i.getMetaData(e))),this.forceDecimals=t}get isReady(){return null!=this.unitCode}async ready(){return Ai.call(this,(async()=>{const e=(await Promise.all(this.inner.map((e=>e.ready())))).every(Te);if(e){const e=e=>parseInt(e,16),t=t=>e(t.unitCode),{yes:i,no:s}=be(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=Ni(e,0,i);return null!==s?s:xi.call(this,e,t,i)}getCacheableEntities(e){this.inner.forEach((t=>e.add(t)))}shutdown(){}}class Ki{constructor(){this.metaDataCache=new Map}getMetaData(e){if(e===Ci.PLACEHOLDER_SYMBOL_NAME)return new Yi;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 qi extends Ki{metaDataCreator(e){return new Fi(e)}}class Xi extends Ki{metaDataCreator(e){return new Ui(e)}}class Zi extends Ki{metaDataCreator(e){return new Gi(e)}}const Ji=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,Qi=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,es=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,ts={r:255,g:255,b:255,a:1},is={r:0,g:0,b:0,a:1};function ss(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function ns(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 rs(e,t){return{x:e.x-t.x,y:e.y-t.y}}function os(e,t){return{x:e.x+t.x,y:e.y+t.y}}function as(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function ls(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 cs(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(Te)}function us(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)}`}(gs(e))}function hs(e,t){const i=gs(e);return i.a=t,Ss(i)}function ds(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 ps=e=>{const t=gs(e);return Ss(ds(function({r:e,g:t,b:i,a:s}){return{r:255-e,g:255-t,b:255-i,a:s}}(t),t,.7))},fs=(e,t=!1)=>ye(gs,(i=>ds(i,is,e,t)),Ss);function ms(e,t=!1){return ye(gs,(i=>ds(i,ts,e,t)),Ss)}function gs(e){if(["r","g","b","a"].map((t=>e[t])).every((e=>Ze(e))))return e;const t=Ze(e.linearGradient)?e._refColor:e,i=Ji.exec(t);if(null!==i){const e=Ze(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=es.exec(t),i=Qi.exec(t),s=(e,t)=>Ze(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 ys(e){const{r:t,g:i,b:s}=gs(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 Ts(e){return ys(e)>66.66?"#000":"#fff"}function Ss(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function As(e,t){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.clip()}class vs{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 vs(this.x,this.y,this.width,this.height)}}class Ps{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 Cs(e,t){e.moveTo(t.x,t.y)}function bs(e,t){e.lineTo(t.x,t.y)}function Es(e,t,i){e.rect(t.x,t.y,i.x-t.x,i.y-t.y)}function _s(e,t=Ci.LINE_HEIGHT_MULTIPLIER){return t*e.measureText("M").width}function Ms(e,t=!1,i=1){const s=Ls(e,t,i).y;return s-Math.sign(s)*Ci.DEFAULT_ADORN_OFFSET.y}function Ls(e,t=!1,i=1){const s={...Ci.DEFAULT_ADORN_OFFSET};return t&&(s.y=-(i*_s(e,1)+s.y)),s}function Os(e,t,i,s=z.Left){const n=Array.isArray(t)?t:[t],r=_s(e,1),o=Math.max(...n.map((t=>e.measureText(t).width))),a=r*n.length;let l=i.x;s===z.Right&&(l-=o),s===z.Center&&(l-=o/2);const c=i.y-r;return u=new vs(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 ws(e,t,i,s=z.Left,n,r){e.save();const o=Array.isArray(t)?t:[t],a=_s(e,1);if(Ze(r)){const n=Os(e,t,i,s);e.fillStyle=r,Is(e,n,!1)}Ze(n)&&(e.fillStyle=n);const l=i.x;let c=i.y;o.forEach((t=>{e.textAlign=z[s].toLowerCase(),e.fillText(t,l,c),c+=a})),e.restore()}function Is(e,t,i=!0){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),i&&e.stroke(),e.fill()}function Ds(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 xs(e,{x:t,y:i},{x:s,y:n}){e.beginPath(),e.moveTo(t,i),e.lineTo(s,n),e.stroke()}function Ns(e,t,i,s){xs(e,{x:t,y:i},{x:t,y:s})}function Rs(e,t,i,s){xs(e,{x:i,y:t},{x:s,y:t})}function Hs(e,t,i){switch(t){case"zero":Vs(e,i,"0");break;case"one":Vs(e,i,"1");break;case"two":Vs(e,i,"2");break;case"three":Vs(e,i,"3");break;case"four":Vs(e,i,"4");break;case"five":Vs(e,i,"5");break;case"six":Vs(e,i,"6");break;case"seven":Vs(e,i,"7");break;case"eight":Vs(e,i,"8");break;case"nine":Vs(e,i,"9");break;case"question":Vs(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}=Fs(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}=Fs(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}=Fs(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}=Fs(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}=Fs(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}=Fs(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}=Bs(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}=Bs(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":Vs(e,i,"B");break;case"sell":Vs(e,i,"S")}}function Vs(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),Ds(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 Fs(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 Bs(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 ks(){const e=SP().config.bypassSmoothing||!1;return{prolog:t=>{e&&t.translate(.5,.5)},adjust:t=>e?Je(t,0):t,epilog:t=>{e&&t.translate(-.5,-.5)}}}const Us=(e,t)=>!0,Ws=(e,t)=>e.map(((e,i)=>({shown:t(e,i),value:e,line:{width:1,color:$s(i),dashStyle:"Solid"}}))),$s=e=>Ve(Js,e),Gs=e=>e.filter((e=>e.shown)),zs={width:1,color:"#000",dashStyle:"Solid"},Ys={width:1,color:"rgba(136,136,136,0.75)",dashStyle:"Dash"},js={color:Ci.COLOR_TRANSPARENT},Ks={[Ci.AT_SINGLE_STYLE]:!0,[Ci.AT_SHOW_BACKGROUND]:!1};function qs(e,t){const i=rt(nt(e,zs,"annotationTraits","line")),s=rt(nt(e,Ys,"annotationTraits","line2")),n=rt(nt(e,js,"annotationTraits","fill")),r=An[t],o=r?.defaults||{};SP().config.colorfulAnnotations||(at(o,Ks),"GannBox"!==t&&"GannSquare"!==t||(o[Ci.AT_SHOW_BACKGROUND]=!0));const a=r?.editable.includes(Ci.AT_LINE_2),l=Ze(o[Ci.AT_LINE_2]),c={line:i,fill:n,...o};return a&&!l&&(c.line2=s),c}function Xs(e,t){Object.keys(t).forEach((i=>{i===Ci.LINE_DASH_PROP_NAME?e.setLineDash(t[i]):e[i]=t[i]}))}function Zs(e){const t=ye(gs,Ss);return{lineWidth:e.line.width,strokeStyle:t(e.line.color),fillStyle:t(e.fill.color),lineDash:cs(e.line.dashStyle)}}const Js=["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)"],Qs=[Ci.AT_LINE,Ci.AT_ALLOW_PRICES_CHANGE_UI],en=[Ci.AT_FILL,Ci.AT_ALLOW_PRICES_CHANGE_UI],tn=[Ci.AT_LINE,Ci.AT_FILL,Ci.AT_ALLOW_PRICES_CHANGE_UI],sn=[...tn,Ci.AT_FILL_TEXT],nn=[Ci.AT_TEXT_LINES,Ci.AT_FILL,Ci.AT_ALLOW_PRICES_CHANGE_UI],rn=[...Qs,Ci.AT_LINE_2,Ci.AT_SHOW_PRICES,Ci.AT_SHOW_LEVELS,Ci.AT_LEVELS_KIND,Ci.AT_LABELS,Ci.AT_EXTEND_LEFT,Ci.AT_EXTEND_RIGHT,Ci.AT_SHOW_TRENDLINE,Ci.AT_FACTORS,Ci.AT_PRICES_ON_SCALE,Ci.AT_REVERSE,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY,Ci.AT_LEVELS_RESPECT_LOG_SCALE],on=[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236],an=e=>({[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LEVELS_KIND]:Ci.AT_LEVELS_PERCENTS,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_EXTEND_LEFT]:!1,[Ci.AT_EXTEND_RIGHT]:!1,[Ci.AT_SHOW_TRENDLINE]:!0,[Ci.AT_FACTORS]:Ws(on.slice(2),((t,i)=>0<=t&&t<=e)),[Ci.AT_PRICES_ON_SCALE]:!1,[Ci.AT_REVERSE]:!1,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2,[Ci.AT_LEVELS_RESPECT_LOG_SCALE]:!1}),ln=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_SHOW_TRENDLINE,type:"bool"},{id:Ci.AT_LINE_2,type:"line",enabledIf:Ci.AT_SHOW_TRENDLINE},{id:Ci.AT_EXTEND_LEFT,type:"bool"},{id:Ci.AT_EXTEND_RIGHT,type:"bool"},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_REVERSE,type:"bool"},{id:Ci.AT_SHOW_PRICES,type:"bool"},{id:Ci.AT_PRICES_ON_SCALE,type:"bool"},{id:Ci.AT_SHOW_LEVELS,type:"bool"},{id:Ci.AT_LEVELS_KIND,type:"string",enum:[Ci.AT_LEVELS_PERCENTS,Ci.AT_LEVELS_VALUES],enabledIf:Ci.AT_SHOW_LEVELS},{id:Ci.AT_LABELS,type:"string",enum:[Ci.AT_LABELS_LEFT,Ci.AT_LABELS_CENTER,Ci.AT_LABELS_RIGHT]},{id:Ci.AT_LEVELS_RESPECT_LOG_SCALE,type:"bool"}],cn={[Ci.AT_LINE]:{color:"#3861f6",width:1,dashStyle:"Solid"},[Ci.AT_FILL]:{color:"rgba(56, 97, 246, 0.2)"},[Ci.AT_FILL_TEXT]:{color:"#f0f0f0"},[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},un=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_FILL,type:"color"},{id:Ci.AT_FILL_TEXT,type:"color"}],hn=[0,.25,.382,.5,.618,.75,1],dn=[8,4,3,2,1].map((e=>`1/${e}`)).concat([2,3,4,8].map((e=>`${e}/1`))),pn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_SHOW_PRICES,type:"bool"},{id:Ci.AT_RATIO,type:"bool"},{id:Ci.AT_SHOW_PERCENTDIFF,type:"bool"},{id:Ci.AT_SHOW_BARCOUNT,type:"bool"},{id:Ci.AT_EXTEND_PT_1,type:"bool"},{id:Ci.AT_EXTEND_PT_2,type:"bool"},{id:Ci.AT_MARKER,type:"object",properties:[{id:Ci.AT_KIND,type:"string",enum:[Ci.AT_ARROW]},{id:Ci.AT_VERTEX,type:"string",enum:[Ci.AT_VERTEX_NONE,Ci.AT_VERTEX_START,Ci.AT_VERTEX_END,Ci.AT_VERTEX_BOTH]}]}],fn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"}],mn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_FILL,type:"color"}],gn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_FILL,type:"color"},{id:Ci.AT_FILL2,type:"color"},{id:Ci.AT_FILL_TEXT,type:"color"},{id:Ci.AT_COMPACT,type:"bool"},{id:Ci.AT_ACCOUNT_SIZE,type:"number"},{id:Ci.AT_RISK,type:"number"},{id:Ci.AT_RISK_IS_PERCENT,type:"bool"}],yn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_FILL,type:"color"}],Tn={[Ci.AT_KIND]:Ci.AT_ARROW,[Ci.AT_VERTEX]:Ci.AT_VERTEX_NONE},Sn=[Ci.AT_LINE,Ci.AT_RATIO,Ci.AT_SHOW_PRICES,Ci.AT_ALLOW_PRICES_CHANGE_UI,Ci.AT_SHOW_BARCOUNT,Ci.AT_SHOW_PERCENTDIFF,Ci.AT_EXTEND_PT_1,Ci.AT_EXTEND_PT_2,Ci.AT_MARKER],An={Line:{editable:Sn,defaults:{[Ci.AT_SHOW_PRICES]:!1,[Ci.AT_SHOW_BARCOUNT]:!1,[Ci.AT_SHOW_PERCENTDIFF]:!1,[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!1,[Ci.AT_MARKER]:Tn,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:pn,numPoints:2},Ray:{editable:Sn,defaults:{[Ci.AT_SHOW_PRICES]:!1,[Ci.AT_SHOW_BARCOUNT]:!1,[Ci.AT_SHOW_PERCENTDIFF]:!1,[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!0,[Ci.AT_MARKER]:Tn,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:pn,numPoints:2},VerticalLine:{editable:[Ci.AT_LINE,Ci.AT_SHOW_TIMESTAMPS,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_SHOW_TIMESTAMPS]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_SHOW_TIMESTAMPS,type:"bool"}],numPoints:1},HorizontalLine:{editable:[Ci.AT_LINE,Ci.AT_SHOW_PRICES,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_SHOW_PRICES,type:"bool"}],numPoints:1},TrendChannel:{editable:[...Qs,Ci.AT_EXTEND_PT_1,Ci.AT_EXTEND_PT_2],defaults:{[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!1,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[...fn,{id:Ci.AT_EXTEND_PT_1,type:"bool"},{id:Ci.AT_EXTEND_PT_2,type:"bool"}],numPoints:3},GannLine:{editable:Sn,defaults:{[Ci.AT_SHOW_PRICES]:!1,[Ci.AT_SHOW_BARCOUNT]:!1,[Ci.AT_SHOW_PERCENTDIFF]:!1,[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!0,[Ci.AT_MARKER]:Tn,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:pn,numPoints:2},SpeedResistanceArcs:{editable:Qs,types:fn,numPoints:2},SpeedResistanceFan:{editable:Qs,types:fn,numPoints:2},AndrewsPitchfork:{editable:Qs,types:fn,numPoints:3},Rectangle:{editable:tn,types:mn,numPoints:2},Ellipse:{editable:tn,types:mn,numPoints:2},DateRange:{editable:sn,defaults:cn,types:un,numPoints:2},PriceRange:{editable:sn,defaults:cn,types:un,numPoints:2},DatePriceRange:{editable:[...sn,Ci.AT_DRAW_BORDER],defaults:{...cn,[Ci.AT_DRAW_BORDER]:!1},types:[...un,{id:Ci.AT_DRAW_BORDER,type:"bool"}],numPoints:2},GannBox:{editable:[Ci.AT_LINE,Ci.AT_LINE_2,Ci.AT_ALLOW_PRICES_CHANGE_UI,Ci.AT_PRICE_LEVELS,Ci.AT_TIME_LEVELS,Ci.AT_SHOW_LEFT_LABELS,Ci.AT_SHOW_RIGHT_LABELS,Ci.AT_SHOW_TOP_LABELS,Ci.AT_SHOW_BOTTOM_LABELS,Ci.AT_SHOW_ANGLES,Ci.AT_REVERSE,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_LINE]:{color:"#33776b",width:1,dashStyle:"Solid"},[Ci.AT_LINE_2]:{color:"#33776b",width:1,dashStyle:"Solid"},[Ci.AT_PRICE_LEVELS]:Ws(hn,Us),[Ci.AT_TIME_LEVELS]:Ws(hn,Us),[Ci.AT_SHOW_LEFT_LABELS]:!0,[Ci.AT_SHOW_RIGHT_LABELS]:!0,[Ci.AT_SHOW_TOP_LABELS]:!0,[Ci.AT_SHOW_BOTTOM_LABELS]:!0,[Ci.AT_SHOW_ANGLES]:!1,[Ci.AT_REVERSE]:!1,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_PRICE_LEVELS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_LEFT_LABELS,type:"bool"},{id:Ci.AT_SHOW_RIGHT_LABELS,type:"bool"},{id:Ci.AT_TIME_LEVELS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_TOP_LABELS,type:"bool"},{id:Ci.AT_SHOW_BOTTOM_LABELS,type:"bool"},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_REVERSE,type:"bool"},{id:Ci.AT_SHOW_ANGLES,type:"bool"},{id:Ci.AT_LINE_2,type:"line",enabledIf:Ci.AT_SHOW_ANGLES}],numPoints:2},GannSquare:{editable:[...Qs,Ci.AT_LEVELS,Ci.AT_FANS,Ci.AT_ARCS,Ci.AT_REVERSE,Ci.AT_SHOW_RANGES_RATIO,Ci.AT_PRICE_BAR_RATIO,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_LINE]:{color:"#712b9c",width:1,dashStyle:"Solid"},[Ci.AT_LEVELS]:Ws([0,1,2,3,4,5],Us),[Ci.AT_FANS]:Ws(["8x1","5x1","4x1","3x1","2x1","1x1","1x2","1x3","1x4","1x5","1x8"],((e,t)=>t>3&&t<7)),[Ci.AT_ARCS]:Ws(["1x0","1x1","1.5x0","2x0","2x1","3x0","3x1","4x0","4x1","5x0","5x1"],Us),[Ci.AT_REVERSE]:!1,[Ci.AT_SHOW_RANGES_RATIO]:!0,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_LEVELS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"string",editable:!1,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_FANS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"string",editable:!1,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_ARCS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"string",editable:!1,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_REVERSE,type:"bool"},{id:Ci.AT_PRICE_BAR_RATIO,type:"number",editable:!0},{id:Ci.AT_SHOW_RANGES_RATIO,type:"bool"}],numPoints:2},LongPosition:{editable:[Ci.AT_LINE,Ci.AT_FILL,Ci.AT_FILL2,Ci.AT_FILL_TEXT,Ci.AT_COMPACT,Ci.AT_ACCOUNT_SIZE,Ci.AT_RISK,Ci.AT_RISK_IS_PERCENT,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_FILL]:{color:"rgba(0, 160, 0, 0.2)"},[Ci.AT_FILL2]:{color:"rgba(205, 0, 0, 0.2)"},[Ci.AT_FILL_TEXT]:{color:"#fff"},[Ci.AT_COMPACT]:!1,[Ci.AT_ACCOUNT_SIZE]:1e3,[Ci.AT_RISK]:25,[Ci.AT_RISK_IS_PERCENT]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:gn,numPoints:4},ShortPosition:{editable:[Ci.AT_LINE,Ci.AT_FILL,Ci.AT_FILL2,Ci.AT_FILL_TEXT,Ci.AT_COMPACT,Ci.AT_ACCOUNT_SIZE,Ci.AT_RISK,Ci.AT_RISK_IS_PERCENT,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_FILL]:{color:"rgba(205, 0, 0, 0.2)"},[Ci.AT_FILL2]:{color:"rgba(0, 160, 0, 0.2)"},[Ci.AT_FILL_TEXT]:{color:"#fff"},[Ci.AT_COMPACT]:!1,[Ci.AT_ACCOUNT_SIZE]:1e3,[Ci.AT_RISK]:25,[Ci.AT_RISK_IS_PERCENT]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:gn,numPoints:4},FiftyPercentLine:{editable:[Ci.AT_USE_52WEEK_PRICES,Ci.AT_LINE,Ci.AT_LINE_2,Ci.AT_SHOW_PRICES,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_USE_52WEEK_PRICES]:!1,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_USE_52WEEK_PRICES,type:"bool"},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_LINE_2,type:"line"},{id:Ci.AT_SHOW_PRICES,type:"bool"}],numPoints:2},FibonacciRetracement:{editable:rn,defaults:an(1),types:ln,numPoints:2},TrendBasedFibExtension:{editable:rn,defaults:an(5),types:ln,numPoints:3},FibonacciFan:{editable:[...Qs,Ci.AT_SHOW_LEVELS,Ci.AT_LABELS,Ci.AT_FACTORS,Ci.AT_REVERSE,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_REVERSE]:!1,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2,[Ci.AT_FACTORS]:Ws(on.slice(2),((e,t)=>t>=0&&t<=6))},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_LEVELS,type:"bool"},{id:Ci.AT_LABELS,type:"string",enum:[Ci.AT_LABELS_LEFT,Ci.AT_LABELS_CENTER,Ci.AT_LABELS_RIGHT]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_REVERSE,type:"bool"}],numPoints:2},FibonacciArcs:{editable:[...Qs,Ci.AT_LINE_2,Ci.AT_SHOW_TRENDLINE,Ci.AT_FACTORS,Ci.AT_SHOW_LEVELS,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_TRENDLINE]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2,[Ci.AT_FACTORS]:Ws(on.slice(2),((e,t)=>t>=0&&t<=6))},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_SHOW_TRENDLINE,type:"bool"},{id:Ci.AT_LINE_2,type:"line",enabledIf:Ci.AT_SHOW_TRENDLINE},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},FibonacciChannel:{editable:[...Qs,Ci.AT_SHOW_PRICES,Ci.AT_SHOW_LEVELS,Ci.AT_LEVELS_KIND,Ci.AT_LABELS,Ci.AT_EXTEND_PT_1,Ci.AT_EXTEND_PT_2,Ci.AT_FACTORS,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LEVELS_KIND]:Ci.AT_LEVELS_PERCENTS,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!1,[Ci.AT_FACTORS]:Ws(on.slice(2),Us),[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_EXTEND_PT_1,type:"bool"},{id:Ci.AT_EXTEND_PT_2,type:"bool"},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_SHOW_PRICES,type:"bool"},{id:Ci.AT_SHOW_LEVELS,type:"bool"},{id:Ci.AT_LEVELS_KIND,type:"string",enum:[Ci.AT_LEVELS_PERCENTS,Ci.AT_LEVELS_VALUES],enabledIf:Ci.AT_SHOW_LEVELS},{id:Ci.AT_LABELS,type:"string",enum:[Ci.AT_LABELS_LEFT,Ci.AT_LABELS_CENTER,Ci.AT_LABELS_RIGHT]}],numPoints:3},GannFan:{editable:[...Qs,Ci.AT_ANGLES,Ci.AT_SHOW_LEVELS,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2,[Ci.AT_ANGLES]:Ws(dn,Us)},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_ANGLES,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"string",editable:!1,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},SymbolArrowUp:{editable:en,types:yn,numPoints:1},SymbolArrowDown:{editable:en,types:yn,numPoints:1},SymbolArrowRight:{editable:en,types:yn,numPoints:1},SymbolArrowLeft:{editable:en,types:yn,numPoints:1},SymbolArrowHorizontal:{editable:en,types:yn,numPoints:1},SymbolArrowVertical:{editable:en,types:yn,numPoints:1},SymbolArcDown:{editable:en,types:yn,numPoints:1},SymbolArcUp:{editable:en,types:yn,numPoints:1},SymbolThumbsUp:{editable:en,types:yn,numPoints:1},SymbolThumbsDown:{editable:en,types:yn,numPoints:1},SymbolZero:{editable:en,types:yn,numPoints:1},SymbolOne:{editable:en,types:yn,numPoints:1},SymbolTwo:{editable:en,types:yn,numPoints:1},SymbolThree:{editable:en,types:yn,numPoints:1},SymbolFour:{editable:en,types:yn,numPoints:1},SymbolFive:{editable:en,types:yn,numPoints:1},SymbolSix:{editable:en,types:yn,numPoints:1},SymbolSeven:{editable:en,types:yn,numPoints:1},SymbolEight:{editable:en,types:yn,numPoints:1},SymbolNine:{editable:en,types:yn,numPoints:1},SymbolQuestion:{editable:en,types:yn,numPoints:1},SymbolFishHook:{editable:en,types:yn,numPoints:1},SymbolBuy:{editable:en,types:yn,numPoints:1},SymbolSell:{editable:en,types:yn,numPoints:1},FibonacciTimeZones:{editable:[...Qs,Ci.AT_FACTORS,Ci.AT_SHOW_LEVELS,Ci.AT_LABELS,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_FACTORS]:Ws([0,1,2,3,5,8,13,21,34,55,89,144],Us),[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_SHOW_LEVELS,type:"bool"},{id:Ci.AT_LABELS,type:"string",enum:[Ci.AT_LABELS_LEFT,Ci.AT_LABELS_CENTER,Ci.AT_LABELS_RIGHT]}],numPoints:2},Text:{editable:nn,types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_TEXT_LINES,type:"array",items:{ref:Ci.AT_TEXT_ITEM}},{id:Ci.AT_TEXT_ITEM,type:"string"},{id:Ci.AT_FILL,type:"color"}],numPoints:2},ProfitLoss:{editable:[...tn,Ci.AT_SHOW_PRICES,Ci.AT_NUM_CONTRACTS,Ci.AT_POSITION,Ci.AT_PROFIT_LOSS],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!1,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_NUM_CONTRACTS]:1,[Ci.AT_POSITION]:Ci.AT_POSITION_LONG,[Ci.AT_PROFIT_LOSS]:void 0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_PROFIT_LOSS,type:"number",editable:!1},{id:Ci.AT_NUM_CONTRACTS,type:"number"},{id:Ci.AT_POSITION,type:"string",enum:[Ci.AT_POSITION_SHORT,Ci.AT_POSITION_LONG]},...mn,{id:Ci.AT_SHOW_PRICES,type:"bool"}],numPoints:2},RewardRisk:{editable:[...tn,Ci.AT_SHOW_PRICES,Ci.AT_NUM_CONTRACTS,Ci.AT_POSITION,Ci.AT_RISK,Ci.AT_REWARD,Ci.AT_RATIO],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!1,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_NUM_CONTRACTS]:1,[Ci.AT_POSITION]:Ci.AT_POSITION_LONG,[Ci.AT_RISK]:void 0,[Ci.AT_REWARD]:void 0,[Ci.AT_RATIO]:void 0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_REWARD,type:"number",editable:!1},{id:Ci.AT_RISK,type:"number",editable:!1},{id:Ci.AT_RATIO,type:"number",editable:!1},{id:Ci.AT_NUM_CONTRACTS,type:"number"},{id:Ci.AT_POSITION,type:"string",enum:[Ci.AT_POSITION_SHORT,Ci.AT_POSITION_LONG]},...mn,{id:Ci.AT_SHOW_PRICES,type:"bool"}],numPoints:2}};function vn(e){return e?An[e].editable:An}var Pn;Pn=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart HTML5 Charts","definitions":{"color":{"type":"string","pattern":"^(#([0-9a-fA-F]{3}){1,2})|(rgba\\\\((\\\\s*\\\\d{1,3}\\\\s*,){3}\\\\s*[01]+(\\\\.\\\\d+)?\\\\))|(rgb\\\\((\\\\s*\\\\d{1,3}\\\\s*)(,\\\\s*\\\\d{1,3}\\\\s*){2}\\\\))$"},"orientationChoice":{"type":"string","enum":["vertical","horizontal","both","none"]},"dashStyle":{"type":"string","enum":["Solid","ShortDash","ShortDot","ShortDashDot","ShortDashDotDot","SparseDot","Dot","Dash","LongDash","DashDot","LongDashDot","LongDashDotDot"]},"aggUnit":{"type":"string","enum":["Tick","Intraday","Day","Week","Month","Quarter","Year"]},"aggSpec":{"type":"string","enum":["None","Nearest","Continue","PerCount","PerVolume","PerRange","PerSeconds"]},"period":{"type":"string","pattern":"^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$"},"density":{"type":"integer","minimum":5},"precision":{"type":"integer","minimum":0},"curveAttr":{"type":"string","enum":["ChangeBased","OpenVsClose"]},"paddingPercent":{"type":"number","minimum":0.001,"maximum":0.999},"fundamental":{"type":"string","enum":["AccountsPayable","AccruedExpenses","Cash","CommonShares","DeferredIncomeTax","DeferredLongRevenues","EquityOtherInvestments","IncomeTaxPayable","Intangibles","Inventories","LongTermDebt","MarketableSec","OtherCurrentAssets","OtherCurrentLiabilities","OtherEquity","OtherNonCurrentAssets","OtherNonCurrentLiabilities","PpeNet","PrepaidExpenses","Receivables","RetainedEarnings","ShorttermDebt","TotalAssets","TotalCurrentAssets","TotalCurrentLiabilities","TotalLiabilities","TotalLiabilitiesAndEquity","TotalNonCurrentAssets","TotalNonCurrentLiabilities","TotalShareholdersEquity","BasicEpsContOp","BasicEpsTotalOp","CostGoods","DilutedEpsContOp","DilutedEpsTotalOp","Ebitda","GrossProfit","IncomeTax","InterestExpense","NetIncome","OperatingExpenses","OperatingIncome","OtherIncomeExpenses","PreTaxIncome","Sales"]},"studyField":{"type":"string","enum":["HL/2","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","ENVU","ENVD","ENVEXPU","ENVEXPD","ENVSMOU","ENVSMOD","SMA","TMA","WMA","VOLMA","OSC","VOSC","RSI","RSIAVG","STORSI","STORSIAVG","HH","LL","PercK","PercD","PercR","WGCL","BOLLBU","BOLLBL","BOLLBM","BOLLBW","BOLLBP","OBVOL","OBVOLAVG","ATR","ATRP","PDI","MDI","ADX","ADXM","ADL","ADWM","ADWMMA","CHAOSC","TP","KCUP","KCMID","KCLOW","KBUP","KBMID","KBLOW","KCEUP","KCEMID","KCELOW","DONUP","DONMID","DONLOW","DONW","PVT","ROC","TRIX","PVPT","PVPTR","PVPTS","ARNUP","ARNLOW","ARNOSC","TCHNUP","TCHNLOW","ALJAW","ALTEETH","ALLIPS","PLTLN","AWOS","AWOSMA","MFMUL","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","EMVMA","ERBLPOW","ERBRPOW","FI","MI","MOM","MOMMA","MFI","MSD","NVI","NVIEMA","PVI","PVIEMA","PPO","PPOS","PPOH","PVO","PVOS","PVOH","HV","PERF","WASI","WWVSARU","WWVSARD","PARSARS","PARSARL","MOVLR","TRSP1","TRSP2","PPTPIV","PPTR1","PPTR2","PPTR3","PPTS1","PPTS2","PPTS3","COTLCCMSP","COTLCLGSP","COTLCSMSP","COTDAGPRO","COTDAGSPD","COTDAGMNM","COTDAGOTH","COTFTRDLI","COTFTRASM","COTFTRLVF","COTFTROTH","TR","IMPVOL","CTM","CPMI","CTLTM","CTLTMF","DEMA","TEMA","TSI","TSISIG","ADJATR","COTR","GMMA3","GMMA5","GMMA8","GMMA10","GMMA12","GMMA15","GMMA30","GMMA35","GMMA40","GMMA45","GMMA50","GMMA60","MCGD","HMA","COPP","CPPH4","CPPH3","CPPH2","CPPH1","CPPL1","CPPL2","CPPL3","CPPL4","REATRHI","REATRLO","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","CTPI","TCHRE","PCTCHG","ATRMA","STOMOMIX","CHDMOMOSC","VSTOPUP","VSTOPLOW","SUPTR","BARCOLIX","BARKIND","CONVLN","BASELN","LEADSP1","LEADSP2","LAGGSP","VWAP","VWAPSD1U","VWAPSD1L","VWAPSD2U","VWAPSD2L","PLVI","MNVI","DIFA","DOSCH","DOSCS","BOLLSQ","TTMSQZON","TTMSQZOFF","TTMSQZOSC","CRS","CRSAVG","JPIB","JPIS","DRS","MRS","PMO","PMOS","RVOL","WGALPH","UPVOL","DNVOL","TOTVOL","AVWAP","KST","KSTSIG","STC","MCCLO","NHLAI","CMBCI","CMBCIF","CMBCIS","COTI","CHEXL","CHEXS","MBBUO","MBBUI","MBBM","MBBLI","MBBLO","CHOP","MACLD1","MACLD2","BTI","PCUP1","PCDN1","PCUP2","PCDN2","PCUP3","PCDN3","PCTD","PCTP"]},"generalField":{"type":"string","enum":["DateTime","Open","High","Low","Close","TradeSize","Volume","OpenInterest","Last","Symbol","Change","PercentChange","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","VOL","MAENV","MAENVEXP","MAENVSMO","MASMO","MATRI","MAWEI","MAVOL","OSCI","OSCIVOL","RSI","RSIMOD","RSISTO","STOCHF","STOCHS","WPERCR","HHLL","WGCL","BBANDS","BWIDTH","BPERC","BSQUEEZE","OBVOL","ATR","ATRP","ADX","ADXMOD","ADL","ADWM","CHAOSC","TP","KELCHN","KELEXP","KELBND","DONCHN","DONWIDTH","PVT","ROC","TRIX","PPMOV","ARNUPDW","ARNOSC","TCHN","ALLG","PLTLN","AWEOSC","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","ERBLPOW","ERBRPOW","FI","MI","MOM","MFI","MSD","NVI","PVI","PPO","PVO","HV","PERF","WASI","WWVOL","PARTP","MOVLR","TRSP","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","CPMI","DEMA","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRHI","REATRLO","LINRCHN","CSHO","CSHB","CTPI","TCHRE","PCTCHG","OPINT","STOMOMIX","CHDMOMOSC","VSTOP","SUPTR","ICHCLD","VWAP","VOIN","DIFA","DOSC","MARIB","HASMO","TTMSQZ","CRS","JPI","CTTP","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"]},"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"}}}]},"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"]},"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"}},"required":["value","line"]},"studyBands":{"type":"array","items":{"$ref":"#/definitions/studyBand"}},"studyBand":{"type":"object","additionalProperties":false,"properties":{"range":{"$ref":"#/definitions/range"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["range","fill"]},"studyType":{"type":"string","pattern":"Study"},"studyPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"basis":{"type":"string","default":"$main"},"study":{"$ref":"#/definitions/study"},"source":{"$ref":"#/definitions/curveField"},"inputs":{"$ref":"#/definitions/inputs"},"type":{"$ref":"#/definitions/studyType"},"levels":{"$ref":"#/definitions/studyLevels"},"bands":{"$ref":"#/definitions/studyBands"},"detachedScale":{"type":"boolean"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["study","type"]},"exprType":{"type":"string","pattern":"Expression"},"exprPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"expression":{"type":"string"},"type":{"$ref":"#/definitions/exprType"},"main":{"type":"boolean","default":false},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["expression","type"]},"forwardType":{"type":"string","pattern":"Forward"},"intOffset":{"type":"integer","minimum":0,"multipleOf":1},"intOffsets":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/intOffset"}},"forwardPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"forward":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/forwardType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["forward","type"]},"seasonalType":{"type":"string","pattern":"Seasonal"},"seasonalPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"seasonal":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"usesInAverage":{"type":"array","minItems":0,"items":{"type":"boolean"},"default":[]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/seasonalType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["seasonal","type"]},"annPoint":{"type":"object","additionalProperties":false,"properties":{"price":{"type":"number"},"time":{"type":"number"}},"required":["price","time"]},"lineTrait":{"type":"object","additionalProperties":false,"properties":{"width":{"type":"number","minimum":0,"default":1},"color":{"$ref":"#/definitions/color","default":"#000"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"}}},"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":135,"multipleOf":1}},"required":["panes","version"]}');var Cn;Cn=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 bn;bn=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 En;En=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 _n;function Mn(t){switch(t){case Ci.CHART_SCHEMA:return e(Pn);case Ci.STUDIES_SCHEMA:return e(Cn);case Ci.FIELDS_SCHEMA:return e(bn);case Ci.ACCESSOR_SCHEMA:return e(En);default:throw new Error(`Unknown schema name: ${t}`)}}_n=JSON.parse('[{"id":"MA","meta":{"title":"Moving Average","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#808080"],"fields":["MA"]}]}},{"id":"CSHO","meta":{"title":"Cash Overlay","overlay":true},"defaults":{"source":"Symbol","curves":[{"colors":["#834c3f"],"fields":["CSHO"]}]}},{"id":"CSHB","meta":{"title":"Cash Basis","overlay":false},"defaults":{"source":"Symbol","curves":[{"colors":["#b2b900"],"fields":["CSHB"]}]}},{"id":"MAVOL","meta":{"title":"Volume Moving Average","overlay":false,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10},{"name":"BarColoring","value":"LikeMain"}],"curves":[{"colors":["#9075d6"],"fields":["VOLMA"]},{"colors":["#ef4226","#00b04b","#1f4bb6"],"fields":["Volume"],"style":"Column","varyColorPerBar":true}]}},{"id":"OSCI","meta":{"title":"Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#ae272d"],"fields":["OSC"]}]}},{"id":"OSCIVOL","meta":{"title":"Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#9326ff"],"fields":["VOSC"]}]}},{"id":"MAENV","meta":{"title":"Moving Average Envelope","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVU"]},{"colors":["#25329b"],"fields":["ENVD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVU","ENVD"],"style":"Ribbon","lineWidth":0}]}},{"id":"LINRCHN","meta":{"title":"Linear Regression Channel","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100},{"name":"Width","value":2}],"curves":[{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRUP"]},{"colors":["rgba(255, 0, 0, 0.3)"],"fields":["LINRMID"]},{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRLOW"]},{"colors":["rgba(0, 0, 255, 0.1)"],"fields":["LINRUP","LINRMID"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 0, 0, 0.1)"],"fields":["LINRMID","LINRLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVEXP","meta":{"title":"Moving Average Envelope Exponential","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVEXPU"]},{"colors":["#25329b"],"fields":["ENVEXPD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVEXPU","ENVEXPD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVSMO","meta":{"title":"Moving Average Envelope Smoothed","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVSMOU"]},{"colors":["#25329b"],"fields":["ENVSMOD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVSMOU","ENVSMOD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAEXP","meta":{"title":"Moving Average Exponential","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","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","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","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","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":"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":"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","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Width","value":2},{"name":"Offset","value":0},{"name":"Source","value":"Close"}],"curves":[{"colors":["#9075d6"],"fields":["BOLLBU"]},{"colors":["#89211e"],"fields":["BOLLBM"]},{"colors":["#00aaab"],"fields":["BOLLBL"]},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["BOLLBU","BOLLBL"],"style":"Ribbon","lineWidth":0}]}},{"id":"MBBANDS","meta":{"title":"Modified Bollinger Bands","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"MultInside","value":3},{"name":"MultOutside","value":4},{"name":"Offset","value":0},{"name":"Source","value":"Close"}],"curves":[{"colors":["#9075d6"],"fields":["MBBUO"],"lineWidth":2},{"colors":["#9075d6"],"fields":["MBBUI"],"lineWidth":1},{"colors":["#89211e"],"fields":["MBBM"],"lineWidth":1},{"colors":["#00aaab"],"fields":["MBBLI"],"lineWidth":1},{"colors":["#00aaab"],"fields":["MBBLO"],"lineWidth":2},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["MBBUI","MBBLI"],"style":"Ribbon","lineWidth":0}]}},{"id":"BWIDTH","meta":{"title":"Bollinger Width","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#f18900"],"fields":["BOLLBW"]}]}},{"id":"BPERC","meta":{"title":"Bollinger Bands %B","decimals":4,"overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#138484"],"fields":["BOLLBP"]}],"levels":[{"value":0,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":1,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(19, 132, 132, 0.1)"},"range":{"from":0,"to":1}}]}},{"id":"OBVOL","meta":{"title":"On Balance Volume","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"Period","value":20}],"curves":[{"colors":["#2284dd"],"fields":["OBVOL"]},{"colors":["#896fc3"],"fields":["OBVOLAVG"]}]}},{"id":"ATR","meta":{"title":"Average True Range","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Smoothing","value":"SMA"},{"name":"Period2","value":20}],"curves":[{"colors":["#ffaf1c"],"fields":["ATR"]},{"colors":["#1c6cff"],"fields":["ATRMA"]}]}},{"id":"ATRP","meta":{"title":"Average True Range Percent","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","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"]}]}},{"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"]}]}},{"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},"defaults":{"inputs":[{"name":"Period","value":20}],"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":"KELEXP","meta":{"title":"Keltner Channel Exponential","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#f18900"],"fields":["KCEUP"]},{"colors":["#2284dd"],"fields":["KCEMID"]},{"colors":["#480048"],"fields":["KCELOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KCEUP","KCELOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"KELBND","meta":{"title":"Keltner Bands","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Multiplier","value":2.5}],"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","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":15},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#743800"],"fields":["DEMA"]}]}},{"id":"TEMA","meta":{"title":"Moving Average Exponential TEMA","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","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","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","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#7f8000","rgba(12, 50, 255, 0.3)"],"fields":["CCI"],"zones":[{"value":-100,"colors":1},{"value":100,"colors":2},{"colors":1}]}],"levels":[{"value":-100,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Center","line":{"color":"#606060","dashStyle":"DashDot"}},{"value":100,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(127, 128, 0, 0)"},"range":{"from":-100,"to":100}}]}},{"id":"EMV","meta":{"title":"Ease Of Movement","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#9326ff"],"fields":["EMV"]},{"colors":["#808080"],"fields":["EMVMA"]}]}},{"id":"ERBLPOW","meta":{"title":"Elder Ray Bull Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#005716"],"fields":["ERBLPOW"],"style":"Column"}]}},{"id":"ERBRPOW","meta":{"title":"Elder Ray Bear Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#ae272d"],"fields":["ERBRPOW"],"style":"Column"}]}},{"id":"FI","meta":{"title":"Force Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":13}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["FI"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"MI","meta":{"title":"Mass Index","overlay":false},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["MI"]}]}},{"id":"MOM","meta":{"title":"Momentum","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Movement","value":20}],"curves":[{"colors":["#808080"],"fields":["MOM"]},{"colors":["#505050"],"fields":["MOMMA"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MFI","meta":{"title":"Money Flow Index","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#543daa"],"fields":["MFI"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#787878","dashStyle":"Dash"}},{"value":50,"name":"Center","line":{"color":"rgba(120, 120, 120, 0.5)","dashStyle":"Dash"}},{"value":80,"name":"Overbought","line":{"color":"#787878","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(126, 87, 194, 0.1)"},"range":{"from":20,"to":80}}]}},{"id":"MSD","meta":{"title":"Moving Standard Deviation","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#0c32ff"],"fields":["MSD"]}]}},{"id":"PCTCHG","meta":{"title":"Percent Change","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#037d27"],"fields":["PCTCHG"]}]}},{"id":"NVI","meta":{"title":"Negative Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#480048"],"fields":["NVI"]},{"colors":["#7f8000"],"fields":["NVIEMA"]}]}},{"id":"PVI","meta":{"title":"Positive Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#00b04b"],"fields":["PVI"]},{"colors":["#005716"],"fields":["PVIEMA"]}]}},{"id":"PPO","meta":{"title":"Percentage Price Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"curves":[{"colors":["#808080"],"fields":["PPO"]},{"colors":["#bc41ce"],"fields":["PPOS"]},{"colors":["rgba(252, 13, 27, 0.3)","#fc0d1b","rgba(0, 176, 75, 0.3)","#00b04b"],"fields":["PPOH"],"style":"Column","varyColorPerBar":true}]}},{"id":"PVO","meta":{"title":"Percentage Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"curves":[{"colors":["#808080"],"fields":["PVO"]},{"colors":["#bc41ce"],"fields":["PVOS"]},{"colors":["#9075d6"],"fields":["PVOH"],"style":"Column"}]}},{"id":"HV","meta":{"title":"Historical Volatility","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#7f8000"],"fields":["HV"]}]}},{"id":"PERF","meta":{"title":"Price Performance","overlay":false,"decimals":2,"enumerations":[{"input":"Anchor","values":["SeriesStart","VisibleStart"]}]},"defaults":{"source":"Close","inputs":[{"name":"Anchor","value":"SeriesStart"}],"curves":[{"colors":["#00aaab"],"fields":["PERF"]}]}},{"id":"WASI","meta":{"title":"Wilder Accumulative Swing Index","overlay":false},"defaults":{"inputs":[{"name":"Limit","value":3}],"curves":[{"colors":["#bc41ce"],"fields":["WASI"]}]}},{"id":"WWVOL","meta":{"title":"Welles Wilder Volatility","overlay":true},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Constant","value":3}],"curves":[{"colors":["#9326ff"],"fields":["WWVSARD"],"style":"Dots"},{"colors":["#f18900"],"fields":["WWVSARU"],"style":"Dots"}]}},{"id":"PARTP","meta":{"title":"Parabolic Time/Price (SAR)","overlay":true},"defaults":{"inputs":[{"name":"Acceleration","value":50},{"name":"Limit","value":5}],"curves":[{"colors":["#25329b"],"fields":["PARSARS"],"style":"Dots"},{"colors":["#00aaab"],"fields":["PARSARL"],"style":"Dots"}]}},{"id":"REATRHI","meta":{"title":"Retracement ATR High","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"High"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#25329b"],"fields":["REATRHI"],"style":"Dots"}]}},{"id":"REATRLO","meta":{"title":"Retracement ATR Low","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["Low","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#b25900"],"fields":["REATRLO"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Offset","value":0}],"curves":[{"colors":["#480048"],"fields":["MOVLR"]}]}},{"id":"TRSP","meta":{"title":"Trend Seeker®","overlay":true,"enumerations":[{"input":"VelocityUpTrend","values":["1","2","3","4","5","6","7","8","9"]},{"input":"VelocitySideTrend","values":["1","2","3","4","5","6","7","8","9"]},{"input":"VelocityDownTrend","values":["1","2","3","4","5","6","7","8","9"]}]},"defaults":{"inputs":[{"name":"VelocityUpTrend","value":"3"},{"name":"VelocitySideTrend","value":"3"},{"name":"VelocityDownTrend","value":"3"}],"curves":[{"colors":["#24ad54"],"fields":["TRSP1"],"style":"Dots"},{"colors":["#ec4533"],"fields":["TRSP2"],"style":"Dots"}]}},{"id":"COTLC","meta":{"title":"Commitment of Traders (COT) Chart","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTLCCMSP"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTLCLGSP"],"style":"Step"},{"colors":["#403daf"],"fields":["COTLCSMSP"],"style":"Step"}]}},{"id":"COTDAG","meta":{"title":"Commitment of Traders (COT) Disaggregated","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTDAGPRO"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTDAGSPD"],"style":"Step"},{"colors":["#403daf"],"fields":["COTDAGMNM"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTDAGOTH"],"style":"Step"}]}},{"id":"COTFTR","meta":{"title":"Commitment of Traders (COT) Financial","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTFTRDLI"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTFTRASM"],"style":"Step"},{"colors":["#403daf"],"fields":["COTFTRLVF"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTFTROTH"],"style":"Step"}]}},{"id":"PIVPTS","meta":{"title":"Pivot Points","overlay":true,"enumerations":[{"input":"Previous","values":["Day","Week","Month"]}]},"defaults":{"inputs":[{"name":"Previous","value":"Day"}],"curves":[{"colors":["#79a2e3"],"fields":["PPTR3"]},{"colors":["#f08f4c"],"fields":["PPTR2"]},{"colors":["#492c6e"],"fields":["PPTR1"]},{"colors":["#28adcc"],"fields":["PPTPIV"]},{"colors":["#8f040a"],"fields":["PPTS1"]},{"colors":["#8cba32"],"fields":["PPTS2"]},{"colors":["#0e2339"],"fields":["PPTS3"]}]}},{"id":"CPP","meta":{"title":"Camarilla Pivot Points","overlay":true},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["CPPH4"]},{"colors":["#00b04b"],"fields":["CPPH3"]},{"colors":["#00b04b"],"fields":["CPPH2"]},{"colors":["#00b04b"],"fields":["CPPH1"]},{"colors":["#d47928"],"fields":["CPPL1"]},{"colors":["#d47928"],"fields":["CPPL2"]},{"colors":["#d47928"],"fields":["CPPL3"]},{"colors":["#d47928"],"fields":["CPPL4"]}]}},{"id":"IMPVOL","meta":{"title":"Implied Volatility (Futures)","overlay":false,"decimals":2},"defaults":{"curves":[{"colors":["#ffc270"],"fields":["IMPVOL"]}]}},{"id":"CTM","meta":{"title":"CommodityTrends Cycle Trading Momentum","overlay":false},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#2642ef"],"fields":["CTM"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]},{"colors":["#9326ff"],"fields":["CTLTM"]}]}},{"id":"CPMI","meta":{"title":"CommodityTrends Principal Momentum Indicator","overlay":false},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#2642ef"],"fields":["CPMI"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}]}},{"id":"CTPI","meta":{"title":"CommodityTrends Turning Point Indicator","overlay":false,"decimals":2,"range":{"min":0,"max":100}},"defaults":{"curves":[{"colors":["#ef4226","#2642ef"],"fields":["CTPI"],"zones":[{"value":50,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}],"levels":[{"value":25,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"name":"Center","line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":75,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"GMMA","meta":{"title":"Guppy Multiple Moving Average","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":3},{"name":"Period2","value":5},{"name":"Period3","value":8},{"name":"Period4","value":10},{"name":"Period5","value":12},{"name":"Period6","value":15},{"name":"Period7","value":30},{"name":"Period8","value":35},{"name":"Period9","value":40},{"name":"Period10","value":45},{"name":"Period11","value":50},{"name":"Period12","value":60}],"curves":[{"colors":["#008ae6"],"fields":["GMMA3"]},{"colors":["#008ae6"],"fields":["GMMA5"]},{"colors":["#008ae6"],"fields":["GMMA8"]},{"colors":["#008ae6"],"fields":["GMMA10"]},{"colors":["#008ae6"],"fields":["GMMA12"]},{"colors":["#008ae6"],"fields":["GMMA15"]},{"colors":["#b32400"],"fields":["GMMA30"]},{"colors":["#b32400"],"fields":["GMMA35"]},{"colors":["#b32400"],"fields":["GMMA40"]},{"colors":["#b32400"],"fields":["GMMA45"]},{"colors":["#b32400"],"fields":["GMMA50"]},{"colors":["#b32400"],"fields":["GMMA60"]}]}},{"id":"STOMOMIX","meta":{"title":"Stochastic Momentum Index","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":10},{"name":"Period2","value":3}],"curves":[{"colors":["#3bb4e5"],"fields":["STOMOMIX"]}],"levels":[{"value":-40,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":40,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CHDMOMOSC","meta":{"title":"Chande Momentum Oscillator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":9}],"curves":[{"colors":["#27c6da"],"fields":["CHDMOMOSC"]}],"levels":[{"value":-50,"name":"Oversold","line":{"color":"#606060"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":50,"name":"Overbought","line":{"color":"#606060"}}]}},{"id":"VSTOP","meta":{"title":"Volatility Stop","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Multiplier","value":2}],"curves":[{"colors":["#50cc52"],"fields":["VSTOPUP"],"style":"Dots"},{"colors":["#d46757"],"fields":["VSTOPLOW"],"style":"Dots"}]}},{"id":"SUPTR","meta":{"title":"Supertrend","overlay":true},"defaults":{"inputs":[{"name":"Period","value":7},{"name":"Multiplier","value":4}],"curves":[{"colors":["#ff5252","#4cb050"],"fields":["SUPTR"],"style":"Line","varyColorPerBar":true}]}},{"id":"ICHCLD","meta":{"title":"Ichimoku Clouds","overlay":true},"defaults":{"inputs":[{"name":"PeriodConversionLine","value":9},{"name":"PeriodBaseLine","value":26},{"name":"PeriodLaggingSpan2","value":52},{"name":"Displacement","value":26}],"curves":[{"colors":["#0080cd"],"fields":["CONVLN"],"style":"Line"},{"colors":["#cd0000"],"fields":["BASELN"],"style":"Line"},{"colors":["#009900"],"fields":["LAGGSP"],"style":"Line"},{"colors":["#00cd00"],"fields":["LEADSP1"],"style":"Line"},{"colors":["#ff0000"],"fields":["LEADSP2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["LEADSP1","LEADSP2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"VWAP","meta":{"title":"Volume Weighted Average Price (VWAP)","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","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","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","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","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period","value":20}],"curves":[{"colors":["#ffb347"],"fields":["AVG"]}]}},{"id":"VOIN","meta":{"title":"Vortex Indicator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#60b1df"],"fields":["PLVI"]},{"colors":["#ea336f"],"fields":["MNVI"]}]}},{"id":"DIFA","meta":{"title":"Distance From Average","overlay":false,"decimals":2,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Distance","values":["Amount","Percentage"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":200},{"name":"Average","value":"MA"},{"name":"Distance","value":"Percentage"}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","#fc0d1b","rgba(0, 176, 75, 0.3)","#00b04b"],"fields":["DIFA"],"style":"Column","varyColorPerBar":true}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodRsi","value":14},{"name":"PeriodEma1","value":5},{"name":"PeriodEma2","value":3},{"name":"PeriodMa","value":9},{"name":"PeriodSig","value":9}],"curves":[{"colors":["#ef5350","#26a69a"],"fields":["DOSCH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]},{"colors":["#cc66ff"],"fields":["DOSCS"]}]}},{"id":"BSQUEEZE","meta":{"title":"Bollinger Bands Squeeze","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#3d8283"],"fields":["BOLLSQ"]}]}},{"id":"MARIB","meta":{"title":"Moving Average Ribbon","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","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":"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"]}]},"defaults":{"source":"Close","inputs":[{"name":"Bars","value":24},{"name":"Volume","value":"Up/Down"},{"name":"BarColoring","value":"LikeMain"},{"name":"Position","value":"Left"},{"name":"WidthPercent","value":40}],"curves":[{"colors":["rgba(239, 65, 38, 0.3)","rgba(0, 176, 76, 0.3)","rgba(31, 74, 182, 0.3)","rgba(226,49,240, 0.8)"],"fields":["DNVOL","UPVOL","TOTVOL"],"style":"Column","varyColorPerBar":true}]}},{"id":"KST","meta":{"title":"Know Sure Thing","enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/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","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":21},{"name":"Period2","value":34}],"curves":[{"colors":["#00cd00"],"fields":["MACLD1"],"style":"Line"},{"colors":["#ff0000"],"fields":["MACLD2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["MACLD1","MACLD2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"PC","meta":{"title":"Probability Cones","overlay":true,"enumerations":[{"input":"Volatility","values":["HV 30","HV 60","HV 90","HV 180","Custom"]},{"input":"StandardDeviations","values":["1","2","3"]}]},"defaults":{"inputs":[{"name":"Volatility","value":"HV 90"},{"name":"VolatilityPercent","value":20},{"name":"StandardDeviations","value":"3"},{"name":"PeriodForecast","value":45},{"name":"PeriodTarget","value":30},{"name":"TargetPrice1","value":0},{"name":"TargetPrice2","value":0}],"curves":[{"colors":["#5db660"],"fields":["PCUP1"],"style":"Line","dashStyle":"Dash"},{"colors":["#5db660"],"fields":["PCDN1"],"style":"Line","dashStyle":"Dash"},{"colors":["#4a7bfe"],"fields":["PCUP2"],"style":"Line","dashStyle":"Dash"},{"colors":["#4a7bfe"],"fields":["PCDN2"],"style":"Line","dashStyle":"Dash"},{"colors":["#ff5e5e"],"fields":["PCUP3"],"style":"Line","dashStyle":"Dash"},{"colors":["#ff5e5e"],"fields":["PCDN3"],"style":"Line","dashStyle":"Dash"},{"colors":["rgba(93, 182, 96, 0.1)"],"fields":["PCUP1","PCDN1"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(74, 123, 254, 0.1)"],"fields":["PCUP2","PCUP1"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(74, 123, 254, 0.1)"],"fields":["PCDN1","PCDN2"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 94, 94, 0.1)"],"fields":["PCUP3","PCUP2"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 94, 94, 0.1)"],"fields":["PCDN2","PCDN3"],"style":"Ribbon","lineWidth":0},{"colors":["#ff54e2"],"fields":["PCTD"],"lineWidth":2,"dashStyle":"Solid"},{"colors":["#ffaf2c"],"fields":["PCTP"],"lineWidth":2,"dashStyle":"Solid"}]}},{"id":"GREEKS","meta":{"title":"Greeks","overlay":false,"decimals":4},"defaults":{"curves":[{"colors":["#7ca685"],"fields":["Delta"]},{"colors":["#c16a6a"],"fields":["Gamma"]},{"colors":["#5a7ca9"],"fields":["Theta"]},{"colors":["#e4a76b"],"fields":["Vega"]}]}}]');let Ln=[],On=!1,wn=!0;function In(e){wn=e}function Dn(e){Ln=Ln.concat(_o(e,Ci.STUDIES_SCHEMA))}const xn=new Map;function Nn(){On||(Dn(e(_n)),On=!0);const t=te[SP()?.config.mode??"Unspecified"];if(!wn)return Ln;if(!xn.has(t)){const e=me(kn,t);xn.set(t,Ln.filter(e))}return xn.get(t)}function Rn(e){return rt(Vn(e))}function Hn(e){return qs(AP().display,e)}function Vn(e){return Nn().find((t=>t.id===e))}function Fn(e){return void 0!==Vn(e)}function Bn(e){const t=[xo.Open,xo.High,xo.Low,xo.Close,xo.Volume].map((e=>e.id));return e.defaults.source&&!t.includes(e.defaults.source)}function kn(e,t){const i=t.id,s=[te.GBE,te.cmdtyView];return!(["CPMI","CTPI","CTM","JPI","CTTP"].includes(i)&&!s.includes(e))}let Un=null,Wn=!1;function $n(){if(!Wn){const e=[x.Study,x.BalanceSheet,x.IncomeStatement],t=e.reduce(((e,t)=>(e[t]=[],e)),{});Object.values(xo).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(v).filter((e=>{const t=parseInt(e);if(Number.isFinite(t))return v[t]})),s=rt(Nn()).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=vn(),r=Object.entries(n).map((([e,t])=>({id:e,options:t.editable,types:t.types,numPoints:t.numPoints})));Un={studies:s,incomeStatements:t[x.IncomeStatement],balanceSheets:t[x.BalanceSheet],studyFields:t[x.Study],curveStyles:i,annotations:r},Wn=!0}return Un}var Gn;function zn(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=>zn(e,t,i))).filter((e=>e!==Ci.NULL_OBJECT));{let s=t.indexOf(e);if(-1!==s)return i[s];let n={};for(let s in e){const r=e[s];n[s]=zn(r,t,i)}return n}}function Yn(e,t,i){return[].concat((0,Gn.apply)(t,e,i))}function jn(e,t,i){let s=rt(e),n=Yn(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 zn(s,n,r)}Gn=n("3DQaT");const Kn=["1D","5D","1M","3M","6M","1Y","5Y","Max"];function qn(e){return 1===e.length}function Xn(e){return 1===e.length}const Zn={ATRLTR:"REATRHI",ATRSTR:"REATRLO",PeriodMARng:"PeriodAdjATR",PeriodAdjATR:"FactorAdjATR"};const Jn={BBANDS:{colors:["#89211e"],fields:["BOLLBM"],visible:!1},DONCHN:{colors:["#ff6a00"],fields:["DONMID"],visible:!1}};const Qn={[Ci.AT_SINGLE_STYLE]:!0,[Ci.AT_SHOW_BACKGROUND]:!1,[Ci.AT_BACKGROUND_OPACITY]:.2},er={[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LEVELS_KIND]:Ci.AT_LEVELS_PERCENTS,[Ci.AT_LABELS]:Ci.AT_LABELS_LEFT,[Ci.AT_EXTEND_LEFT]:!1,[Ci.AT_EXTEND_RIGHT]:!0,[Ci.AT_REVERSE]:!1,...Qn},tr={FibonacciFan:{[Ci.AT_SHOW_LEVELS]:!1,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_REVERSE]:!1,...Qn},FibonacciArcs:{[Ci.AT_SHOW_LEVELS]:!1,...Qn},FibonacciRetracement:{...er},TrendBasedFibExtension:{...er},FibonacciChannel:{[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LEVELS_KIND]:Ci.AT_LEVELS_PERCENTS,[Ci.AT_LABELS]:Ci.AT_LABELS_LEFT,...Qn},FibonacciTimeZones:{[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,...Qn},GannFan:{[Ci.AT_SHOW_LEVELS]:!1,...Qn},GannBox:{...Qn,[Ci.AT_SHOW_BACKGROUND]:!0},GannSquare:{...Qn,[Ci.AT_SHOW_BACKGROUND]:!0}},ir=["FibonacciFan","FibonacciArcs","FibonacciChannel","FibonacciTimeZones","FibonacciRetracement","TrendBasedFibExtension"],sr=[...ir,"GannFan","GannBox","GannSquare"],nr=["Line","Ray","GannLine"],rr=["ComputedText","ProfitLoss","RewardRisk"];function or(e){return ir.includes(e)?["factors"]:"GannFan"===e?["angles"]:"GannBox"===e?["priceLevels","timeLevels"]:"GannSquare"===e?["levels","fans","arcs"]:[]}function ar(e,t,i){const s=!st(e,t)||!Array.isArray(e[t]),n=!s&&e[t].some((e=>!Ze(e.value)));if(s||n)return e[t]=i[t],!0}function lr(e,t){if(!Ze(t))return;const i=or(e),s=qs(null,e);for(const e of i)if(!ar(t,e,s))for(const i of t[e])Number.isFinite(i.value)&&(i.value=Je(i.value,6))}function cr(e,t,i=!1){const s="FibonacciFan"===e,n=Ze(t);if(sr.includes(e)&&n){if(i){lt(t,tr[e])}const n=or(e),r=qs(null,e);for(const e of n)if(!ar(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)));Ze(i.line)||(i.line=t?t.line:{width:1,color:$s(Math.floor(100*Math.random())),dashStyle:"Solid"}),s&&0===i.value&&!Ze(i.shown)&&(i.shown=!0)}"FibonacciChannel"===e&&t[Ci.AT_SHOW_LABELS]?(t[Ci.AT_SHOW_LEVELS]=t[Ci.AT_SHOW_LABELS],delete t[Ci.AT_SHOW_LABELS]):"FibonacciArcs"!==e||t[Ci.AT_SHOW_TRENDLINE]||(t[Ci.AT_SHOW_TRENDLINE]=!0)}nr.includes(e)&&n&&!Ze(t[Ci.AT_MARKER])&&(t[Ci.AT_MARKER]={...Tn}),n&&(t[Ci.AT_ALLOW_PRICES_CHANGE_UI]=!rr.includes(e))}const ur=[3,4,5,6,7,8,9,10,11],hr=[12,13,14,15,16,17,18,19,20];const dr=[{name:"Source",value:"Close"},{name:"Average",value:"MA"}];function pr(e){return function(t){return t.version=e,t}}const fr={_3to4:function(e){const t=e.data.period;if(null!==t){const i="Max"===t?Ci.AUTOFIT_PERIOD:`P${t}`,s=Kn.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=Yn(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=rt(Ci.COLOR_DEFAULT_VARY)}return e.version=5,e},_5to6:function(e){const t=Yn(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=Yn(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=gs(e.curves[t].colors[0]);i.a=.1,e.curves.push({colors:[Ss(i)],fields:e.curves[0].fields.concat(e.curves[t].fields),lineWidth:0,style:"Ribbon"})}})),e.version=7,e},_7to8:function(e){const t=Yn(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===Ci.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=Yn(e,t);if(qn(s)){if(!qn(Yn(s,i))){const e=Yn(SP().template,t+i);qn(e)&&(s[0].minorGridLines=e[0])}}return e.version=9,e},_9to10:function(e){const t=".display.navigator",i=".enabled",s=Yn(e,t);if(Xn(s)){if(!Xn(Yn(s,i))){const e=Yn(SP().template,t+i);Xn(e)&&(s[0].enabled=e[0])}}return e.version=10,e},_10to11:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === "TCHN"}');return t.length>0&&t.forEach((e=>{if(e.inputs&&1===e.inputs.length&&e.inputs[0].name===Ci.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=Yn(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 Yn(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=Yn(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ATRLTR","ATRSTR"]}),i=e=>st(Zn,e)?Zn[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=Yn(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(Ze(t)&&Ze(t.factors)){const e=qs(null,i).factors,s=t.factors.map(((t,i)=>{const s=!Ze(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHM","STOCHS"]});return t.length>0&&t.forEach((e=>{const t="STOCHM"===e.study,i=Rn(t?"STOCHS":e.study);Ze(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["BBANDS","DONCHN"]});return t.length>0&&t.forEach((e=>{if(Ze(e.curves)&&3===e.curves?.length){const t=rt(Jn[e.study]);e.curves.push(t)}})),e.version=18,e},_18to19:function(e){const t=Yn(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=Yn(e,".display.yAxis");if(1===t.length){const e=t[0];Ze(e.showLastValue)&&(e.showLastValue=e.showLastValue?"All":"None")}return e.version=20,e},_20to21:function(e){const t=Yn(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=Yn(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=Yn(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=Yn(e,'..plots{.type === "Study" && .study === "MOM"}');if(t.length>0){const e=Rn("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=Yn(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=Rn(e.study).defaults.inputs})),e.version=26,e},_26to27:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === "ATR"}');if(t.length>0){const e=Rn("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=Yn(e,'..plots{.type === "Study"}'),i=Rn("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(Ze(t))return t.shift})(e);Ze(t)&&(e.shift=t)}))})),e.version=28,e},_28to29:function(e){const t=Mo(jn(e,'..plots{.type === "Study" && .study === "DEMARK"}',(e=>Ci.NULL_OBJECT)));return t.version=29,t},_29to30:function(e){const t=Mo(jn(e,'..plots{.type === "Study" && .study === "ULTOSC"}',(e=>Ci.NULL_OBJECT)));return t.version=30,t},_30to31:function(e){const t=Yn(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(Ze(n)){const e=qs(null,i);n.line2=e.line2}}})),e.version=31,e},_31to32:function(e){return e.version=32,e},_32to33:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:Nn().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=Yn(e,'..plots{.type === "Study" && .study === "VWAP"}'),i=Rn("VWAP");return t.length>0&&t.forEach((e=>{Ze(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=Yn(e,`..plots{.type === "Study" && .study === "${t}"}`);if(i.length>0){const e=Rn(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 Yn(e,"..annotations").forEach((e=>{e.uid=yt()})),e.version=36,e},_36to37:function(e){return e.version=37,e},_37to38:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === "CRS"}'),i=Rn("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=Yn(e,'..plots{.type === "Study" && .study === "PERF"}'),i=Rn("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=Yn(e,"..annotations"),i=["FibonacciTimeZones","FibonacciFan","FibonacciArcs"],s=vn();return t.forEach((e=>{const t=e.id;i.includes(t)?e.traits.factors=rt(s[t].defaults.factors):"GannFan"===t&&(e.traits.angles=rt(s[t].defaults.angles))})),e.version=43,e},_43to44:pr(44),_44to45:pr(45),_45to46:pr(46),_46to47:pr(47),_47to48:pr(48),_48to49:pr(49),_49to50:pr(50),_50to51:pr(51),_51to52:pr(52),_52to53:pr(53),_53to54:pr(54),_54to55:pr(55),_55to56:pr(56),_56to57:function(e){const t=Yn(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:pr(58),_58to59:pr(59),_59to60:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["VOL","MAVOL"]}),i=Rn("MAVOL"),s=e=>{if(!Ze(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(!Ze(e.curves))return;const t="VOL"===e.study?0:1;var n;Ze(e.inputs)||(e.inputs=[]),1===t&&1===e.curves?.length&&e.curves.push(rt(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:pr(61),_61to62:pr(62),_62to63:pr(63),_63to64:pr(64),_64to65:function(e){const t="DIFA",i=Yn(e,`..plots{.type === "Study" && .study === "${t}"}`),s=Rn(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 Yn(e,"..annotations").forEach((e=>{if("FibonacciTimeZones"===e.id){const t=e.points;if(1===t.length){const e=rt(t[0]);e.time+=1,t.push(e)}}})),e.version=66,e},_66to67:pr(67),_67to68:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === "DPO"}'),i=Rn("DPO");return t.length>0&&t.forEach((e=>{if(Ze(e.curves)&&1===e.curves?.length&&!Ze(e.levels)){const t=e.curves[0];if(1===t.colors?.length&&!Ze(t.zones)){e.levels=i.defaults.levels,t.zones=i.defaults.curves[0].zones;const s=hs(t.colors[0],.3);t.colors=[s,s]}}})),e.version=68,e},_68to69:pr(69),_69to70:function(e){const t="RSISTO",i=Yn(e,`..plots{.type === "Study" && .study === "${t}"}`),s=Rn(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 Yn(e,"..annotations").forEach((e=>cr(e.id,e.traits,!0))),e.version=71,e},_71to72:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["GTPI","GPMI","CBMI"]}),i=Rn("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:ur[Number(e.value)-1]}:"SlowNumber"===e.name?{name:"SlowPeriod",value:hr[Number(e.value)-1]}:e)),e.inputs.splice(2,0,i.defaults.inputs[2])))})),e.version=72,e},_72to73:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["JPI"]}),i=Rn("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:pr(74),_74to75:pr(75),_75to76:pr(76),_76to77:function(e){const t="COPP",i=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:[`${t}`]}),s=Rn(t);return i.length>0&&i.forEach((e=>{Ze(e.inputs)&&(e.curves=s.defaults.curves,e.levels=s.defaults.levels)})),e.version=77,e},_77to78:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MFI"]}),i=Rn("MFI");return t.length>0&&t.forEach((e=>{Ze(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i]}),n=Rn(t),r=Rn(i);return s.length>0&&s.forEach((e=>{if(Ze(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CCI"]}),i=Rn("CCI");return t.length>0&&t.forEach((e=>{if(Xe(e.inputs)){const t=e.curves[0].colors[0],s=hs(t,.3);e.curves=i.defaults.curves;const n=e.curves[0].colors;n[0]=n[3]=s,n[2]=t,Xe(e.levels)?e.levels.splice(1,0,i.defaults.levels[1]):e.levels=i.defaults.levels,Xe(e.bands)||(e.bands=i.defaults.bands)}})),e.version=80,e},_80to81:pr(81),_81to82:pr(82),_82to83:pr(83),_83to84:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP"]}),i=Rn("MACD");return t.length>0&&t.forEach((e=>{Ze(e.inputs)&&(e.levels=i.defaults.levels)})),e.version=84,e},_84to85:pr(85),_85to86:pr(86),_86to87:function(e){const t="BBANDS",i=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Rn(t);return i.length>0&&i.forEach((e=>{3===e.inputs?.length&&e.inputs.push(s.defaults.inputs[3])})),e.version=87,e},_87to88:pr(88),_88to89:pr(89),_89to90:function(e){const t=Yn(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=Yn(e,`..plots{.type === "Study" && .study === "${t}" }`),s=Rn(t);return i.length>0&&i.forEach((e=>{3===e.inputs?.length&&e.inputs.push(s.defaults.inputs[3])})),e.version=91,e},_91to92:pr(92),_92to93:pr(93),_93to94:pr(94),_94to95:pr(95),_95to96:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PMO"]}),i=Rn("PMO");return t.length>0&&t.forEach((e=>{Ze(e.inputs)&&(e.levels=i.defaults.levels)})),e.version=96,e},_96to97:pr(97),_97to98:pr(98),_98to99:pr(99),_99to100:pr(100),_100to101:pr(101),_101to102:function(e){return Yn(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[Ci.AT_SHOW_PRICES]=e.traits[Ci.AT_DRAW_LINES]??!0,delete e.traits[Ci.AT_DRAW_LINES],e.traits[Ci.AT_POSITION]=e.traits.pos??"Long",delete e.traits.pos,delete e.traits.kind,delete e.traits.points,e.traits[Ci.AT_ALLOW_PRICES_CHANGE_UI]=!1}})),e.version=102,e},_102to103:pr(103),_103to104:function(e){const t="UseAllFields";return Yn(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:pr(105),_105to106:function(e){const t=Yn(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(Xe(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:pr(107),_107to108:pr(108),_108to109:function(e){const t=Yn(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;Xe(i)&&i.splice(0,0,...dr);const s=e.curves;Xe(s)&&t&&(s[0].fields[0]="AVG")})),e.version=109,e},_109to110:pr(110),_110to111:function(e){return Yn(e,"..annotations").forEach((e=>{"LongPosition"!==e.id&&"ShortPosition"!==e.id||(e.traits[Ci.AT_ALLOW_PRICES_CHANGE_UI]=!0)})),e.version=111,e},_111to112:pr(112),_112to113:function(e){const t="CHEXI",i=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Rn(t).defaults;return i.length>0&&i.forEach((e=>{Xe(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=Yn(e,"..plots{.detachedScale}");return t.length>0&&t.forEach((e=>{e.detachedScale=!0})),e.version=114,e},_114to115:pr(115),_115to116:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHS"]});return t.length>0&&t.forEach((e=>{const t=Rn(e.study).defaults;Xe(e.inputs)&&Xe(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHAMF"]});return t.length>0&&t.forEach((e=>{const t=Rn(e.study).defaults;Xe(e.inputs)&&Xe(e.curves)&&(e.curves[0]=t.curves[0])})),e.version=117,e},_117to118:pr(118),_118to119:pr(119),_119to120:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHDMOMOSC","TSI","DIFA"]});return t.length>0&&t.forEach((e=>{const t=Rn(e.study).defaults;if(Xe(e.inputs)&&Xe(e.curves))switch(e.study){case"CHDMOMOSC":case"TSI":{const i=e.levels[0];e.levels=t.levels,e.levels[1]=i;break}case"DIFA":{const[i,s]=e.curves[0].colors;e.curves=t.curves,e.curves[0].colors=[i,us(i),s,us(s)];break}}})),e.version=120,e},_120to121:pr(121),_121to122:pr(122),_122to123:pr(123),_123to124:pr(124),_124to125:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP","PPO"]});return t.length>0&&t.forEach((e=>{const t=Rn(e.study).defaults;if(Xe(e.inputs)&&Xe(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=>hs(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:pr(126),_126to127:pr(127),_127to128:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CRS"]}),i=Rn("CRS");return t.length>0&&t.forEach((e=>{Ze(e.inputs)&&(e.levels=i.defaults.levels)})),e.version=128,e},_128to129:pr(129),_129to130:pr(130),_130to131:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PC"]}),i=Rn("PC");return t.length>0&&t.forEach((e=>{if(Xe(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:pr(132),_132to133:pr(133),_133to134:pr(134),_134to135:pr(135)};function mr(e,t){if(t===Ci.CHART_SCHEMA){const i=Yn(Mn(t),".properties.version.minimum")[0],s=e.version;if(s<i)return function(e,t,i){let s=e;try{for(In(!1);t<i;)s=(0,fr[`_${t}to${t+1}`])(s),t+=1}finally{In(!0)}return s}(e,s,i)}return e}function gr(e,t){Mt(2,arguments);var i=Nt(e),s=Nt(t);return i.getTime()===s.getTime()}function yr(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function Tr(e){Mt(1,arguments);var t=Ot(e),i=t.getMonth(),s=i-i%3;return t.setMonth(s,1),t.setHours(0,0,0,0),t}function Sr(e,t){Mt(2,arguments);var i=Tr(e),s=Tr(t);return i.getTime()===s.getTime()}var Ar={};function vr(){return Ar}function Pr(e,t){var i,s,n,r,o,a,l,c;Mt(1,arguments);var u=vr(),h=_t(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=Ot(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 Cr(e,t,i){Mt(2,arguments);var s=Pr(e,i),n=Pr(t,i);return s.getTime()===n.getTime()}function br(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getFullYear()===s.getFullYear()}function Er(e){return{unit:nt(e,"Day","unit"),size:nt(e,1,"size"),spec:nt(e,"None","spec"),isContractVolume:nt(e,!1,"isContractVolume"),dividendsAdjust:nt(e,!1,"dividendsAdjust"),backAdjust:nt(e,!1,"backAdjust"),daysToExpiration:nt(e,1,"daysToExpiration"),contractRoll:nt(e,"combined","contractRoll")}}function _r(e){const t=Er(e);return new xr(C[t.unit],t.size,E[t.spec],t.isContractVolume,t.dividendsAdjust,t.backAdjust,t.daysToExpiration,t.contractRoll)}function Mr(e){switch(e.unit){case C.Tick:return Dr;case C.Intraday:case C.Day:return Lr;case C.Week:return Or;case C.Month:return wr;case C.Quarter:return Ir;case C.Year:return br;default:return Dr}}function Lr(e,t){return gr(e,t)&&wr(e,t)}function Or(e,t){return Cr(e,t)&&wr(e,t)}function wr(e,t){return yr(e,t)&&br(e,t)}function Ir(e,t){return Sr(e,t)&&br(e,t)}function Dr(e,t){return+e==+t}class xr{constructor(e=C.Day,t=1,i=E.None,s=!1,n=!1,r=!1,o=1,a="combined"){this.unit=e,this.size=t,this.spec=i,this.isContractVolume=s,this.dividendsAdjust=n,this.backAdjust=r,this.daysToExpiration=o,this.contractRoll=a}duplicate(){return new xr(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===C.Tick){let e="T",t=!0;switch(this.spec){case E.PerCount:e="Tpb";break;case E.PerVolume:e="Vpb";break;case E.PerRange:e="Rpb";break;case E.PerSeconds:e="Spb";break;default:t=!1}return`${t?this.size:""}${e}`}if(this.unit===C.Intraday)return this.size%60==0?this.size/60+"h":`${this.size}`;{let e="";return this.spec===E.Nearest?e="n":this.spec===E.Continue&&(e="c"),`${this.size}${this.unitToString().substring(0,1)}${e}`}}unitToString(){let e="";switch(this.unit){case C.Tick:e="Tick";break;case C.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 C.Day:e="Daily";break;case C.Week:e="Weekly";break;case C.Month:e="Monthly";break;case C.Quarter:e="Quarterly";break;case C.Year:e="Yearly"}return e}describe(){let e=this.unitToString();switch(this.spec){case E.Nearest:e+=" Nearest";break;case E.Continue:e+=" Continue";break;case E.PerCount:e="Ticks Per Bar";break;case E.PerVolume:e="Volume Per Bar";break;case E.PerRange:e="Range Per Bar";break;case E.PerSeconds:e="Seconds Per Bar";case E.None:}return e}get hasSpec(){return this.spec!==E.None}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===C.Tick}get isIntraday(){return this.unit===C.Intraday}get isMultiContract(){const e=this.spec===E.Nearest,t=this.spec===E.Continue;return this.isEndOfDay&&(e||t)||this.isIntraday&&e}}function Nr(e){delete e.display.chart.bar}function Rr(e){Ze(e.display.xAxis.visibleRange)&&delete e.display.xAxis.visibleRange,Ze(e.data.range)&&delete e.data.range,delete e.data.checkRange}function Hr(e){Po(e.display.period)&&delete e.display.period}function Vr(e){Ze(e.display.density)&&delete e.display.density}function Fr(e){switch(v[e]){case v.OHLC:case v.HLC:case v.Candlestick:case v.HollowCandles:case v.HeikinAshi:case v.ElderImpulseSystem:case v.Range:case v.MultiColumn:return!0;default:return!1}}function Br(e){switch(v[e]){case v.Candlestick:case v.HollowCandles:case v.HeikinAshi:case v.ElderImpulseSystem:case v.Column:case v.Renko:case v.Range:case v.Kagi:case v.PointAndFigure:case v.LineBreak:case v.HLC:return!0;default:return!1}}function kr(e,t){const i=SP().getDefaultMultiFieldCurve();if(null!==i&&i.style===e)return i;const s=e=>e.id,n=[xo.Open,xo.High,xo.Low,xo.Close,xo.Change].map(s);v[e]===v.HLC&&n.splice(0,1);const r=[xo.Close].map(s),o=rt(Ci.COLOR_DEFAULT_AREA),a=rt(Ci.COLOR_DEFAULT_OHLC),l=rt(Ci.COLOR_DEFAULT_VARY),c={fields:n,colors:l,lineWidth:1,visible:!0,varyColorPerBar:t,style:e};switch(v[e]){case v.OHLC:case v.HLC:case v.Renko:case v.LineBreak:case v.Range:case v.Kagi:case v.PointAndFigure:c.colors=t?l:[a];break;case v.Candlestick:case v.HollowCandles:case v.HeikinAshi:case v.MultiColumn:break;case v.ElderImpulseSystem:c.colors=l.concat(o);break;case v.Line:case v.PercentChange:c.fields=r,c.colors=[a];break;case v.Area:c.fields=r,c.colors=[hs(o,.5),o];break;case v.Baseline:c.fields=r,c.colors=l.map((e=>hs(e,.5))),c.zones=[{value:0,colors:1},{colors:1}];break;case v.Column:c.fields=r;break;default:throw new Error(`Curve style "${e}" is not supported here.`)}return c}function Ur(e,t){var i;Object.keys(e).length>0&&(e.varyColorPerBar=e.varyColorPerBar||Br(e.style)||void 0!==(i=e.attributes)&&i.length>0&&i.some((e=>e===S[S.ChangeBased]||e===S[S.OpenVsClose])));const s=function(e,t){switch(e){case U.Symbol:case U.Expression:{const e=t.style||"Candlestick";return kr(e,t.varyColorPerBar||Br(e))}case U.Forward:case U.Seasonal:return{fields:["Close","Change"],style:"Line",lineWidth:2,visible:!0,colors:["#888"],varyColorPerBar:!1};default:throw new Error(`Unexpected plot type '${U[e]}', don't know its default curve.`)}}(U[t],e);return dt(s,e),"None"===e.lineMarker&&delete s.lineMarker,s}const Wr=["Renko","Kagi","PointAndFigure","LineBreak","Baseline"];function $r(e,t){const i=t.curves[0],s=oo(e),n=Ur(i,t.type);if(s.curves=[n],t.isMultiCurveMain&&t.curves.length>1&&s.curves.push(...t.curves.slice(1)),"Symbol"===t.type&&Ze(i)&&Wr.includes(i.style)){const e=s;Ze(t.inputs)?e.inputs=t.inputs:delete e.inputs}return e}function Gr(e,t,i){return i=i||" ",e.length>t?e:(t-=e.length,e+(i+=i.repeat(t)).slice(0,t))}class zr 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}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,zr.prototype):this.__proto__=zr.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,zr)}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=Gr("",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+" | "+Gr("",n.column-1," ")+Gr("",a-n.column,"^")}else t+="\n at "+r}return t}}const Yr=function(e,t){const i={},s=(t=void 0!==t?t:{}).grammarSource,n={expr:F};let r=F;const o=D("+",!1),a=D("-",!1),l=function(e,t){return function(e,t){return e.reduce((function(e,t){var i=t.filter((e=>"ws"!==e.op));return{op:i[0],left:e,right:i[1]}}),t)}(t,e)},c=D("*",!1),u=D("/",!1),h=D("^",!1),d=D("(",!1),p=D(")",!1),f=/^[0-9]/,m=x([["0","9"]],!1,!1),g=".",y=D(".",!1),T=D("{",!1),S=/^[A-Za-z0-9\^*$-.|:_]/,A=x([["A","Z"],["a","z"],["0","9"],"^","*",["$","."],"|",":","_"],!1,!1),v=D("}",!1),P=/^[A-Za-z]/,C=x([["A","Z"],["a","z"]],!1,!1),b=/^[ \t\r\n]/,E=x([" ","\t","\r","\n"],!1,!1);let _=0,M=0;const L=[{line:1,column:1}];let O,w=0,I=[];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 D(e,t){return{type:"literal",text:e,ignoreCase:t}}function x(e,t,i){return{type:"class",parts:e,inverted:t,ignoreCase:i}}function N(t){let i,s=L[t];if(s)return s;for(i=t-1;!L[i];)i--;for(s=L[i],s={line:s.line,column:s.column};i<t;)10===e.charCodeAt(i)?(s.line++,s.column=1):s.column++,i++;return L[t]=s,s}function R(e,t){const i=N(e),n=N(t);return{source:s,start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:n.line,column:n.column}}}function H(e){_<w||(_>w&&(w=_,I=[]),I.push(e))}function V(e,t,i){return new zr(zr.buildMessage(e,t),e,t,i)}function F(){let e;return e=B(),e}function B(){let t,s,n,r,c,u,h;if(t=_,s=k(),s!==i){if(n=[],r=_,c=G(),c!==i?(43===e.charCodeAt(_)?(u="+",_++):(u=i,H(o)),u===i&&(45===e.charCodeAt(_)?(u="-",_++):(u=i,H(a))),u!==i?(h=k(),h!==i?(c=[c,u,h],r=c):(_=r,r=i)):(_=r,r=i)):(_=r,r=i),r!==i)for(;r!==i;)n.push(r),r=_,c=G(),c!==i?(43===e.charCodeAt(_)?(u="+",_++):(u=i,H(o)),u===i&&(45===e.charCodeAt(_)?(u="-",_++):(u=i,H(a))),u!==i?(h=k(),h!==i?(c=[c,u,h],r=c):(_=r,r=i)):(_=r,r=i)):(_=r,r=i);else n=i;n!==i?(M=t,s=l(s,n),t=s):(_=t,t=i)}else _=t,t=i;return t===i&&(t=k()),t}function k(){let t,s,n,r,o,a,h;if(t=_,s=$(),s!==i){if(n=[],r=_,o=G(),o!==i?(42===e.charCodeAt(_)?(a="*",_++):(a=i,H(c)),a===i&&(47===e.charCodeAt(_)?(a="/",_++):(a=i,H(u))),a!==i?(h=$(),h!==i?(o=[o,a,h],r=o):(_=r,r=i)):(_=r,r=i)):(_=r,r=i),r!==i)for(;r!==i;)n.push(r),r=_,o=G(),o!==i?(42===e.charCodeAt(_)?(a="*",_++):(a=i,H(c)),a===i&&(47===e.charCodeAt(_)?(a="/",_++):(a=i,H(u))),a!==i?(h=$(),h!==i?(o=[o,a,h],r=o):(_=r,r=i)):(_=r,r=i)):(_=r,r=i);else n=i;n!==i?(M=t,s=l(s,n),t=s):(_=t,t=i)}else _=t,t=i;return t===i&&(t=$()),t}function U(){let t,s,n,r,o,a;return t=_,s=W(),s!==i?(n=G(),n!==i?(94===e.charCodeAt(_)?(r="^",_++):(r=i,H(h)),r!==i?(o=G(),o!==i?(a=W(),a!==i?(M=t,s={op:"^",left:s,right:a},t=s):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i),t===i&&(t=W()),t}function W(){let t,s,n,r,o,a,l;return t=function(){let t,s,n,r,o,a,l,c;if(t=_,s=G(),s!==i){if(n=_,r=[],f.test(e.charAt(_))?(o=e.charAt(_),_++):(o=i,H(m)),o!==i)for(;o!==i;)r.push(o),f.test(e.charAt(_))?(o=e.charAt(_),_++):(o=i,H(m));else r=i;if(r!==i){if(o=_,46===e.charCodeAt(_)?(a=".",_++):(a=i,H(y)),a===i&&(a=null),a!==i){for(l=[],f.test(e.charAt(_))?(c=e.charAt(_),_++):(c=i,H(m));c!==i;)l.push(c),f.test(e.charAt(_))?(c=e.charAt(_),_++):(c=i,H(m));l!==i?(a=[a,l],o=a):(_=o,o=i)}else _=o,o=i;o===i&&(o=null),o!==i?(r=[r,o],n=r):(_=n,n=i)}else _=n,n=i;n!==i?(M=t,s={op:"num",left:parseFloat(e.substring(M,_))},t=s):(_=t,t=i)}else _=t,t=i;return t}(),t===i&&(t=function(){let t,s,n,r,o,a,l,c,u;if(t=_,s=G(),s!==i)if(123===e.charCodeAt(_)?(n="{",_++):(n=i,H(T)),n!==i){if(r=[],S.test(e.charAt(_))?(o=e.charAt(_),_++):(o=i,H(A)),o!==i)for(;o!==i;)r.push(o),S.test(e.charAt(_))?(o=e.charAt(_),_++):(o=i,H(A));else r=i;if(r!==i)if(125===e.charCodeAt(_)?(o="}",_++):(o=i,H(v)),o!==i){if(a=_,46===e.charCodeAt(_)?(l=g,_++):(l=i,H(y)),l!==i){if(c=[],P.test(e.charAt(_))?(u=e.charAt(_),_++):(u=i,H(C)),u!==i)for(;u!==i;)c.push(u),P.test(e.charAt(_))?(u=e.charAt(_),_++):(u=i,H(C));else c=i;c!==i?(l=[l,c],a=l):(_=a,a=i)}else _=a,a=i;a===i&&(a=null),a!==i?(M=t,h=a,s={op:"sym",left:r.join(""),right:null==h?null:h[1].join("")},t=s):(_=t,t=i)}else _=t,t=i;else _=t,t=i}else _=t,t=i;else _=t,t=i;var h;return t}(),t===i&&(t=_,s=G(),s!==i?(40===e.charCodeAt(_)?(n="(",_++):(n=i,H(d)),n!==i?(r=G(),r!==i?(o=B(),o!==i?(a=G(),a!==i?(41===e.charCodeAt(_)?(l=")",_++):(l=i,H(p)),l!==i?(M=t,s={op:"grp",left:o},t=s):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i))),t}function $(){let t,s,n,r,o;return t=_,s=G(),s!==i?(45===e.charCodeAt(_)?(n="-",_++):(n=i,H(a)),n!==i?(r=G(),r!==i?(o=U(),o!==i?(M=t,s={op:n,left:o},t=s):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i),t===i&&(t=U()),t}function G(){let t,s,n;for(t=_,s=[],b.test(e.charAt(_))?(n=e.charAt(_),_++):(n=i,H(E));n!==i;)s.push(n),b.test(e.charAt(_))?(n=e.charAt(_),_++):(n=i,H(E));return s!==i&&(M=t,s={op:"ws"}),t=s,t}if(O=r(),O!==i&&_===e.length)return O;throw O!==i&&_<e.length&&H({type:"end"}),V(I,w<e.length?e.charAt(w):null,w<e.length?R(w,w+1):R(w,w))},jr=new Map,Kr=/\w[:]\w/;function qr(e){return"error"in e}function Xr(e,t=!1,i=!0){const s=e.trim();if(t&&jr.has(s))return rt(jr.get(s));try{const n=Yr(s);io(n,(e=>e.toUpperCase()),!0,!0);let r=eo(n);i&&function(e,t){if(e.some((e=>e.includes(":"))))return Jr(t,((e,t,i)=>{const s=(e,t=null,i="sym")=>({op:i,left:e,right:t}),n=e;if("sym"!==n.op||!Kr.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=eo(n));const o={text:e,model:n,clean:Qr(n),symbols:r};return t&&jr.set(s,o),o}catch(t){const i=t.location.start;return{text:e,error:`${t.message} \nLocation: line ${i.line}, column ${i.column}.`}}}function Zr(e,t){const i=function(e){const t=(t,i,s)=>{const n=t;if(so(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 Jr(e,i)}function Jr(e,t){if(!Ze(e))return null;const i=typeof e;if("number"===i||"string"===i)return e;const s=e;return t(s,Jr(s.left,t),Jr(s.right,t))}function Qr(e){return Jr(e,no)}function eo(e){const t=new Set;return Jr(e,((e,i,s)=>("sym"===e.op&&t.add(i),null))),Array.from(t)}function to(e){let t=0;const i=["+","-","*","/","^"];return Jr(e,((e,s,n)=>(i.includes(e.op)&&t++,null))),t>0}function io(e,t,i=!1,s=!1){const n=i?e:rt(e);return Jr(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 so(e){return!Ze(e.right)}function no(e,t,i){const s=e;if(so(s))switch(s.op){case"-":return`${s.op}${t}`;case"grp":return`(${t})`;case"sym":return`{${t}}`;case"num":return t.toString();default:throw new Error(`Unrecognized unary operator ${s.op}`)}else switch(s.op){case"+":case"-":case"*":case"/":case"^":return`${t} ${s.op} ${i}`;case"sym":return`{${t}}.${i}`;default:throw new Error(`Unrecognized binary operator ${s.op}`)}}const ro="..plots{.main === true}";function oo(e){return Yn(e,ro)[0]}function ao(e){const t=Yn(e,`..panes{${ro}}`)[0];return{mainPane:t,mainAxis:Yn(t,`..axes{${ro}}`)[0]}}function lo(e,t,i){const s=oo(t),n=s.type.toLowerCase();if(s[n]===Ci.PLACEHOLDER_SYMBOL_NAME){const s=oo(e),{mainAxis:n}=ao(t),r=n.annotations,o=go(t,s);if(i){const{mainAxis:e}=ao(o);e.annotations=r}return o}return t}const co="Symbol",uo="Expression",ho="Forward",po="Seasonal",fo=[co,uo,ho,po];function mo(e){const t=Xr(e),i=qr(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 go(e,t){const i=oo(e),s=e=>i.type===e,n=e=>Ze(t[e.toLowerCase()]),r=fo.find((e=>n(e))),o=r.toLowerCase();let a=t[o];const l=a===Ci.PLACEHOLDER_SYMBOL_NAME,c=n(uo)||n(ho)||n(po),u=fo.some((e=>n(e)&&!s(e))),h=SP().config.cachedAnnotationsCount||0,d=h>0,{mainAxis:p}=ao(e);u&&(p.comparison="None");const f=mo(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===Ci.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},T=(e,t)=>{const i=t.annCache||[],s=g(i,e);-1!==s&&(t.annotations=i[s].annotations)},S=e=>{const r=i;if(s(co))y(r.symbol,e);else if(s(uo))y(r.expression,e);else if(s(po)){const t=mo(r.seasonal);1===t.symbolCount&&y(t.firstSymbol,e)}delete e.annotations,n(co)?T(t.symbol,e):n(uo)?T(t.expression,e):n(po)&&1===f.symbolCount&&T(t.seasonal,e)};if(d){const t=Yn(e,"..axes");for(const e of t)S(e)}const A=n(uo)&&s(co)||n(co)&&s(uo);let v=jn(e,ro,(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=[{}]),(n(ho)||n(po))&&(e.offsets=[0])),e[o]=a,e)));if(u)if(n(ho))v.data.aggregation={unit:"Month"},v.display.period="P10Y";else if(n(po)&&!v.data.aggregation.isEndOfDay)v.data.aggregation={unit:"Day"},v.display.period=n(po)?"P9M":"P1Y10D";else if(s(ho)||s(po)){v.data.aggregation=SP().getDefaultAggregation(),v.data.maxDataPoints=Ci.DEFAULT_MAX_RECORDS;const e=SP().getDefaultPeriod();Ze(e)&&(v.display.period=e)}else n(uo)&&s(co)&&(Wr.includes(i.curves[0].style)&&(v=jn(v,ro,(e=>(delete e.inputs,e)))),"PerRange"===v.data.aggregation.spec&&(v.data.aggregation={unit:"Day"}));const P=new Map([['..plots{.type === "Study"}',e=>{const t=Rn(e.study);if(!Xe(t))return Ci.NULL_OBJECT;const i=Bn(t);return n(ho)||n(po)||n(uo)&&i?Ci.NULL_OBJECT:e}],['..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}',e=>n(co)?(e.symbol=a,e):Ci.NULL_OBJECT],["..plots{..events}",e=>(n(co)||delete e.events,e)]]);for(const[e,t]of P)v=jn(v,e,t);return u&&!A&&(v=$r(v,{type:r,curves:[{}]})),v=Mo(v),v}function yo(e){const t=SP().getDefaultDensity();Ze(t)&&(e.display.density=t)}function To(e,t){return jn(e,'..plots{.type === "Study" && (.study === "VOL" || .study === "MAVOL")}.curves{.fields === "TradeSize" || .fields === "Volume"}',(e=>(e.fields=t?[xo.TradeSize.id]:[xo.Volume.id],e)))}function So(e,t){const i=_r(e.data.aggregation),s=i.isTick&&!i.hasSpec,n=_r(t),r=n.isTick&&!n.hasSpec,o=e=>e.isIntraday&&e.hasSpec&&e.spec===E.PerRange,a=o(i),l=o(n);let c=jn(e,`${ro}.curves[0]`,(e=>{const t=[xo.Open.id,xo.High.id,xo.Low.id,xo.Close.id,xo.Change.id].slice();if(!a&&l)return kr("Range",!0);if(a&&!l&&(e.style="OHLC"),!r&&s){const i=SP().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=[xo.Last.id,xo.Change.id],e.style="Line",e.colors=["#0055cc"],e.varyColorPerBar=!1);return e}));return c=c=To(c,r),dt(c.data.aggregation,t),i.unit===n.unit&&i.size===n.size||(Hr(c),Rr(c),yo(c),Nr(c)),c}function Ao(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getTime()<s.getTime()}function vo(e,t){Mt(2,arguments);var i=_t(t);return wt(e,-i)}function Po(e){return Ze(e)&&e!==Ci.AUTOFIT_PERIOD}function Co(e){const t=Yn(e,"..axes{.annotations{.points{!.price || !.time}}}");t.length>0&&t.forEach((e=>{const t=e.annotations.map((e=>{const t=e.points.find((e=>Ze(e.price))),i=e.points.find((e=>Ze(e.time)));return Ze(t)&&Ze(i)?(e.points.forEach((e=>{Ze(e.price)||(e.price=t.price),Ze(e.time)||(e.time=i.time)})),e):null})).filter((e=>Ze(e)));t.length>0?e.annotations=t:delete e.annotations}));const i=Yn(e,"..panes"),s=e=>Ze(e.height)?e.height:1,n=i.map((e=>s(e))),r=Math.min(...n),o=r<.01?5/r:1;i.forEach((e=>e.height=Je(o*s(e),4)));const a=SP().config.showResizeHandles||!1;e.display.xAxis.resizeHandles=a;const l="wheel+shift";let c=SP().config.scrollBehavior||l;Object.values(re).filter((e=>"string"==typeof e)).includes(c)||(c=l),e.display.scrollBehavior=c;const u=Yn(e,'..plots{.type === "Study" && .study === "RSI"}');var h;return u.length>0&&u.forEach((e=>{if(Ze(e.bands)&&e.bands.length>0){const t=e.inputs&&1===e.inputs.length&&e.inputs[0].name===Ci.INPUT_PERIOD?e.inputs[0].value:null,i=Rn("RSI").defaults;e.curves=i.curves,e.inputs=i.inputs,Ze(t)&&(e.inputs[0].value=t),delete e.bands,e.levels=i.levels}})),(h=e).display?.density?(Hr(h),Rr(h)):Po(h.display?.period)&&Rr(h),function(e){const t=nt(e.display,null,"chart","bar");if(Ze(t)){const[e,i]=gt(t.width||0,t.spacing||0,Ci.MINIMUM_BAR_WIDTH,Ci.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=Yn(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=Yn(e,"..panes[0].axes[0].scale");if(1===t.length){const i=t[0],s=Yn(e,"..panes[0]..axes");s.length>0&&s.forEach((e=>e.scale=i))}}(e),function(e){const[t]=Yn(e,ro);Ze(t)&&t.type===U[U.Symbol]&&!Wr.includes(t.curves[0].style)&&Ze(t.inputs)&&delete t.inputs}(e),function(e){const[t]=Yn(e,ro);Ze(t)&&t.type===U[U.Symbol]&&t.curves[0].style===v[v.Renko]&&Ze(t.inputs)&&t.inputs.map((e=>e.value)).some((e=>void 0===e))&&(t.inputs=rt(Ci.DEFAULT_RENKO_INPUTS))}(e),function(e){const[t]=Yn(e,ro);if(Ze(t)&&t.type===U[U.Expression]){const i=t.curves[0].style,s=i===v[v.Range],n=i===v[v.Baseline],r=Wr.includes(i);s&&e.data?.aggregation.spec===E[E.PerRange]&&(e.data.aggregation={unit:"Day"}),n||!r&&!s||(delete t.inputs,t.curves[0]=kr("Candlestick",!0))}}(e),function(e){Yn(e,"..annotations").forEach((e=>{const{id:t,traits:i}=e;cr(t,i),lr(t,i)}))}(e),function(e){try{In(!1),Yn(e,'..plots{.type === "Study" && .curves.zones}').forEach((e=>{const t=Rn(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{In(!0)}}(e),function(e){const[t]=Yn(e,ro);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=Yn(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"===SP()?.config?.mode&&(delete e.data?.extendedHours,delete e.data?.buildContinuation)}(e),function(e){const t=e.data?.aggregation,i=e.data?.extendedHours,s=Xe(i);t&&"FormT"===t.spec&&(t.spec="None",s||(e.data.extendedHours=!0))}(e),function(e){const t=e.data?.buildContinuation,i=Xe(t),s=e.data?.aggregation;i&&s&&("Continue"!==s.spec||t||(s.spec="None"),t&&(s.spec="Continue"))}(e),function(e){try{In(!1),Yn(e,'..plots{.type === "Study" && .curves.varyColorPerBar}').forEach((e=>{const t=Rn(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{In(!0)}}(e),function(e){try{In(!1),Yn(e,'..plots{.type === "Study"}').forEach((e=>{const t=Rn(e.study).defaults;Xe(e.inputs)&&e.inputs.forEach(((e,i)=>{const s=t.inputs?.[i]?.value;!Xe(e.value)&&Xe(s)&&(e.value=s)})),Xe(e.levels)&&e.levels.forEach(((e,i)=>{const s=t.levels?.[i]?.value;!Xe(e.value)&&Xe(s)&&(e.value=s)})),Xe(e.bands)&&e.bands.forEach(((e,i)=>{const s=t.bands?.[i]?.range;!Xe(e.range.from)&&Xe(s?.from)&&(e.range.from=s.from),!Xe(e.range.to)&&Xe(s?.to)&&(e.range.to=s.to)}))}))}finally{In(!0)}}(e),function(e){let t=jn(e,"..annCache{!.annotations}",(e=>Ci.NULL_OBJECT));t=jn(t,"..annCache",(e=>{const t=ri(e.symbol);return null===t?e:Ao(t,vo(new Date,3))?Ci.NULL_OBJECT:e})),t=jn(t,"..annotations{.id === 'ComputedText' && !.traits.textLines}",(e=>Ci.NULL_OBJECT));const i=t.data.aggregation;return To(t,"Tick"===i.unit&&"None"===i.spec)}(e)}var bo;bo=n("2nrEA");let Eo=null;function _o(t,i){null===Eo&&(Eo=e(bo)(),Eo.defaultOptions.useDefault=!0,[Ci.CHART_SCHEMA,Ci.STUDIES_SCHEMA,Ci.FIELDS_SCHEMA,Ci.ACCESSOR_SCHEMA].forEach((e=>{Eo.addSchema(e,Mn(e))})));let s=mr(t,i);(function(e){return e===Ci.CHART_SCHEMA})(i)&&(Yn(s,`..plots{.type==="${U[U.Study]}"}`).forEach((e=>{const t=Rn(e.study);Ze(t)&<(e,t.defaults)})),s=Co(s));const n=Eo.validate(i,s);if(!!n){const e=JSON.stringify(n,null,4);throw new Error(`Document not valid according to schema ${i}; error is ${e}`)}return function(e){return e===Ci.ACCESSOR_SCHEMA}(i)&&function(e){const{id:t,context:i}=e,s=e=>Ze(i[e]),n=(e,t)=>{if(!Ze(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(!Ze(i.forward)){if(!Ze(i.curves)||!Ze(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(!Ze(i.seasonal)){if(!Ze(i.curves)||!Ze(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=Rn(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(!Ze(i.curves)||i.curves.length!==t.defaults.curves.length)throw new Error(s("curves"));const a=e(i.curves);if(0!==Me(e(t.defaults.curves),a).length)throw new Error(o("fields"));break}}}}(s),s}function Mo(e){const t=jn(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 jn(t,"..panes{!.axes}",(e=>Ci.NULL_OBJECT))}var Lo;Lo=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":"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":"(H+L)/2","shortName":"HL/2"},{"id":"HLC/3","category":"Study","name":"(H+L+C)/3","shortName":"HLC/3"},{"id":"OHLC/4","category":"Study","name":"(O+H+L+C)/4","shortName":"OHLC/4"},{"id":"HLCC/4","category":"Study","name":"(H+L+C+C)/4","shortName":"HLCC/4"},{"id":"AVG","category":"Study","name":"Average","shortName":"AVG"},{"id":"MA","category":"Study","name":"MA-Simple","shortName":"MA"},{"id":"MACLD1","category":"Study","name":"MA-Cloud-Fast","shortName":"MACLD1"},{"id":"MACLD2","category":"Study","name":"MA-Cloud-Slow","shortName":"MACLD2"},{"id":"MA1","category":"Study","name":"MA1-Simple","shortName":"MA1"},{"id":"MA2","category":"Study","name":"MA2-Simple","shortName":"MA2"},{"id":"MA3","category":"Study","name":"MA3-Simple","shortName":"MA3"},{"id":"MA4","category":"Study","name":"MA4-Simple","shortName":"MA4"},{"id":"MA5","category":"Study","name":"MA5-Simple","shortName":"MA5"},{"id":"MA6","category":"Study","name":"MA6-Simple","shortName":"MA6"},{"id":"MA7","category":"Study","name":"MA7-Simple","shortName":"MA7"},{"id":"MA8","category":"Study","name":"MA8-Simple","shortName":"MA8"},{"id":"MA9","category":"Study","name":"MA9-Simple","shortName":"MA9"},{"id":"MA10","category":"Study","name":"MA10-Simple","shortName":"MA10"},{"id":"MAS","category":"Study","name":"MA-Shorter","shortName":"MAS"},{"id":"MAL","category":"Study","name":"MA-Longer","shortName":"MAL"},{"id":"CMBCI","category":"Study","name":"Composite Index","shortName":"CMBCI"},{"id":"CMBCIF","category":"Study","name":"Fast Ma","shortName":"CMBCIF"},{"id":"CMBCIS","category":"Study","name":"Slow Ma","shortName":"CMBCIS"},{"id":"COTI","category":"Study","name":"COT Index","shortName":"COTI"},{"id":"CHEXL","category":"Study","name":"ChandelierExitLong","shortName":"CHEXL"},{"id":"CHEXS","category":"Study","name":"ChandelierExitShort","shortName":"CHEXS"},{"id":"SUPTR","category":"Study","name":"Supertrend","shortName":"SUPTR"},{"id":"BARCOLIX","category":"Study","name":"BarColorIndex","shortName":"BARCOLIX"},{"id":"BARKIND","category":"Study","name":"BarKind","shortName":"BARKIND"},{"id":"BREL","category":"Study","name":"BarRelation","shortName":"BREL"},{"id":"EMA","category":"Study","name":"MA-Exp","shortName":"MA(EXP)"},{"id":"MAHI","category":"Study","name":"MA-High","shortName":"MA(HI)"},{"id":"MALO","category":"Study","name":"MA-Low","shortName":"MA(LO)"},{"id":"MACD","category":"Study","name":"MACD","shortName":"MACD"},{"id":"MACDS","category":"Study","name":"MACD-Signal","shortName":"MACD(S)"},{"id":"MACDH","category":"Study","name":"MACD-Histogram","shortName":"MACD(H)"},{"id":"ENVU","category":"Study","name":"Envelope-Up","shortName":"ENV(UP)"},{"id":"ENVD","category":"Study","name":"Envelope-Down","shortName":"ENV(DN)"},{"id":"ENVEXPU","category":"Study","name":"Envelope-Exponential-Up","shortName":"ENVEXP(UP)"},{"id":"ENVEXPD","category":"Study","name":"Envelope-Exponential-Down","shortName":"ENVEXP(DN)"},{"id":"ENVSMOU","category":"Study","name":"Envelope-Smoothed-Up","shortName":"ENVSMO(UP)"},{"id":"ENVSMOD","category":"Study","name":"Envelope-Smoothed-Down","shortName":"ENVSMO(DN)"},{"id":"SMA","category":"Study","name":"MA-Smoothed","shortName":"MA(S)"},{"id":"CSHO","category":"Study","name":"Cash-Overlay","shortName":"CSHO"},{"id":"CSHB","category":"Study","name":"Cash-Basis","shortName":"CSHB"},{"id":"TMA","category":"Study","name":"MA-Triangular","shortName":"MA(TRI)"},{"id":"WMA","category":"Study","name":"MA-Weighted","shortName":"MA(W)"},{"id":"VOLMA","category":"Study","format":"UseMetricUnit","name":"MA-Volume","shortName":"VOLMA"},{"id":"OSC","category":"Study","name":"OSC","shortName":"OSC"},{"id":"VOSC","category":"Study","format":"UseMetricUnit","name":"OSC-Volume","shortName":"VOLOSC"},{"id":"RSI","category":"Study","name":"RSI","shortName":"RSI"},{"id":"RSIAVG","category":"Study","name":"RSI-Average","shortName":"RSIAVG"},{"id":"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":"BOLLBU","category":"Study","name":"Bollinger-Upper","shortName":"BOLL(U)"},{"id":"BOLLBL","category":"Study","name":"Bollinger-Lower","shortName":"BOLL(L)"},{"id":"BOLLBM","category":"Study","name":"Bollinger-Mid","shortName":"BOLL(M)"},{"id":"BOLLBW","category":"Study","name":"Bollinger-Width","shortName":"BOLLW"},{"id":"BOLLBP","category":"Study","name":"Bollinger-Percent","shortName":"%B"},{"id":"BOLLSQ","category":"Study","name":"Bollinger-Squeeze","shortName":"BOLL(S)"},{"id":"PCUP1","category":"Study","name":"ProbCone-Up1","shortName":"PCUP1"},{"id":"PCDN1","category":"Study","name":"ProbCone-Down1","shortName":"PCDN1"},{"id":"PCUP2","category":"Study","name":"ProbCone-Up2","shortName":"PCUP2"},{"id":"PCDN2","category":"Study","name":"ProbCone-Down2","shortName":"PCDN2"},{"id":"PCUP3","category":"Study","name":"ProbCone-Up3","shortName":"PCUP3"},{"id":"PCDN3","category":"Study","name":"ProbCone-Down3","shortName":"PCDN3"},{"id":"PCTD","category":"Study","name":"ProbCone-TgtDate","shortName":"PCTD"},{"id":"PCTP","category":"Study","name":"ProbCone-TgtPrice","shortName":"PCTP"},{"id":"MBBUO","category":"Study","name":"ModifiedBoll-UppOut","shortName":"MBOLL(UO)"},{"id":"MBBUI","category":"Study","name":"ModifiedBoll-UppIn","shortName":"MBOLL(UI)"},{"id":"MBBM","category":"Study","name":"ModifiedBoll-Mid","shortName":"MBOLL(M)"},{"id":"MBBLI","category":"Study","name":"ModifiedBoll-LowIn","shortName":"MBOLL(LI)"},{"id":"MBBLO","category":"Study","name":"ModifiedBoll-LowOut","shortName":"MBOLL(LO)"},{"id":"OBVOL","category":"Study","format":"UseMetricUnit","name":"OnBalanceVol","shortName":"OBVOL"},{"id":"OBVOLAVG","category":"Study","format":"UseMetricUnit","name":"OnBalanceVolAvg","shortName":"OBVOL"},{"id":"TR","category":"Study","name":"TrueRange","shortName":"TR"},{"id":"ATR","category":"Study","name":"AvgTrueRange","shortName":"ATR"},{"id":"ATRMA","category":"Study","name":"MA-ATR","shortName":"MA(ATR)"},{"id":"ADJATR","category":"Study","name":"AdjAvgTrueRange","shortName":"ADJATR"},{"id":"COTR","category":"Study","name":"ChgOverTrueRange","shortName":"COTR"},{"id":"ATRP","category":"Study","name":"AvgTrueRangePerc","shortName":"ATRP"},{"id":"STOMOMIX","category":"Study","name":"StochMomIndex","shortName":"STOMOMIX"},{"id":"CHDMOMOSC","category":"Study","name":"ChandeMomOsc","shortName":"CHDMOMOSC"},{"id":"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":"KCEUP","category":"Study","name":"KeltChanExp-Up","shortName":"KELE(UP)"},{"id":"KCEMID","category":"Study","name":"KeltChanExp-Mid","shortName":"KELE(MID)"},{"id":"KCELOW","category":"Study","name":"KeltChanExp-Low","shortName":"KELE(LO)"},{"id":"DONUP","category":"Study","name":"Donchian-Up","shortName":"DON(U)"},{"id":"DONMID","category":"Study","name":"Donchian-Mid","shortName":"DON(M)"},{"id":"DONLOW","category":"Study","name":"Donchian-Low","shortName":"DON(L)"},{"id":"DONW","category":"Study","name":"Donchian-Width","shortName":"DON(W)"},{"id":"PVT","category":"Study","format":"UseMetricUnit","name":"PriceVolChange","shortName":"PVOL"},{"id":"TRIX","category":"Study","name":"Triple-MA-Exp","shortName":"TRIX"},{"id":"ROC","category":"Study","name":"RateOfChange","shortName":"ROC"},{"id":"PVPT","category":"Study","name":"PivotPoint","shortName":"PVMOV"},{"id":"PVPTR","category":"Study","name":"PvtPt-Resistance","shortName":"PVMOV(R)"},{"id":"PVPTS","category":"Study","name":"PvtPt-Support","shortName":"PVMOV(S)"},{"id":"ARNUP","category":"Study","name":"Aroon-Up","shortName":"ARN(UP)"},{"id":"ARNLOW","category":"Study","name":"Aroon-Down","shortName":"ARN(DN)"},{"id":"VSTOPUP","category":"Study","name":"VolaStop-Up","shortName":"VSTOP(UP)"},{"id":"VSTOPLOW","category":"Study","name":"VolaStop-Down","shortName":"VSTOP(DN)"},{"id":"ARNOSC","category":"Study","name":"Aroon-Osci","shortName":"ARNOSC"},{"id":"TCHNUP","category":"Study","name":"TurtleChn-Up","shortName":"TCH(UP)"},{"id":"TCHNLOW","category":"Study","name":"TurtleChn-Low","shortName":"TCH(LO)"},{"id":"TCHRE","category":"Study","name":"TurtleChnRetrace","shortName":"TCHRE"},{"id":"ALJAW","category":"Study","name":"Alligator-Jaw","shortName":"AL(J)"},{"id":"ALTEETH","category":"Study","name":"Alligator-Teeth","shortName":"AL(T)"},{"id":"ALLIPS","category":"Study","name":"Alligator-Lips","shortName":"AL(L)"},{"id":"PLTLN","category":"Study","name":"PlotLine","shortName":"LINE"},{"id":"AWOS","category":"Study","name":"AwesomeOsc","shortName":"AWOSC"},{"id":"AWOSMA","category":"Study","name":"AwesomeOsc-MA","shortName":"AWOSC(MA)"},{"id":"MFMUL","category":"Study","name":"MoneyFlowMul"},{"id":"CLV","category":"Study","name":"CloseLocationValue","shortName":"CLV"},{"id":"CHOP","category":"Study","name":"ChoppinessIndex","shortName":"ChopIx"},{"id":"CHAMF","category":"Study","name":"ChaikinMoneyFlow","shortName":"CHAIKMF"},{"id":"CHAVOL","category":"Study","name":"ChaikinVolatility","shortName":"CHAIKVOL"},{"id":"DPO","category":"Study","name":"DetrendedPriceOsc","shortName":"DPO"},{"id":"CCI","category":"Study","name":"CommodityChannelIndex","shortName":"CCI"},{"id":"EMV","category":"Study","name":"EaseOfMovement","shortName":"EOM"},{"id":"EMVMA","category":"Study","name":"EaseOfMovementMA","shortName":"EOM(MA)"},{"id":"ERBLPOW","category":"Study","name":"ElderRayBullPow","shortName":"ER(BULL)"},{"id":"ERBRPOW","category":"Study","name":"ElderRayBearPow","shortName":"ER(BEAR)"},{"id":"FI","category":"Study","format":"UseMetricUnit","name":"ForceIndex","shortName":"FORCE"},{"id":"MI","category":"Study","name":"MassIndex","shortName":"MASS"},{"id":"MOM","category":"Study","name":"Momentum","shortName":"MOM"},{"id":"MOMMA","category":"Study","name":"MA-Momentum","shortName":"MA(MOM)"},{"id":"MFI","category":"Study","name":"MoneyFlowIndex","shortName":"MFI"},{"id":"MSD","category":"Study","name":"MovingStdDev","shortName":"MSD"},{"id":"PCTCHG","category":"Study","name":"PercentChange","shortName":"PCTCHG"},{"id":"LINRUP","category":"Study","name":"LinRegUpper","shortName":"LINRUP"},{"id":"LINRMID","category":"Study","name":"LinRegMiddle","shortName":"LINRMID"},{"id":"LINRLOW","category":"Study","name":"LinRegLower","shortName":"LINRLOW"},{"id":"NVI","category":"Study","name":"NegativeVolIndex","shortName":"NVI"},{"id":"NVIEMA","category":"Study","name":"NegativeVolIndexEMA","shortName":"NVI(EMA)"},{"id":"PVI","category":"Study","name":"PositiveVolIndex","shortName":"PVI"},{"id":"PVIEMA","category":"Study","name":"PositiveVolIndexEMA","shortName":"PVI(EMA)"},{"id":"PPO","category":"Study","name":"PercPriceOsc","shortName":"PPO"},{"id":"PPOS","category":"Study","name":"PPO-Signal","shortName":"PPO(S)"},{"id":"PPOH","category":"Study","name":"PPO-Histogram","shortName":"PPO(H)"},{"id":"PVO","category":"Study","name":"PercVolOsc","shortName":"PVO"},{"id":"PVOS","category":"Study","name":"PVO-Signal","shortName":"PVO(S)"},{"id":"PVOH","category":"Study","name":"PVO-Histogram","shortName":"PVO(H)"},{"id":"HV","category":"Study","name":"HistVolatility","shortName":"HISTVOL"},{"id":"PERF","category":"Study","name":"Performance","shortName":"PERF"},{"id":"STC","category":"Study","name":"SchaffTrendCycle","shortName":"STC"},{"id":"MCCLO","category":"Study","name":"McClellanOsc","shortName":"MCCLO"},{"id":"BTI","category":"Study","name":"BreadthThrust","shortName":"BTI"},{"id":"NHLAI","category":"Study","name":"NewHiLoAccIx","shortName":"NHLAI"},{"id":"KST","category":"Study","name":"KnowSureThing","shortName":"KST"},{"id":"KSTSIG","category":"Study","name":"KST-Signal","shortName":"KSTSIG"},{"id":"WASI","category":"Study","name":"WilderAccSwingIndex","shortName":"WACCSW"},{"id":"WWVSARU","category":"Study","name":"WilderVolSarUp","shortName":"WVOL-UP"},{"id":"WWVSARD","category":"Study","name":"WilderVolSarDown","shortName":"WVOL-DN"},{"id":"PARSARS","category":"Study","name":"ParabolicSarShort","shortName":"SHORT"},{"id":"PARSARL","category":"Study","name":"ParabolicSarLong","shortName":"LONG"},{"id":"REATRHI","category":"Study","name":"RetraceATRHigh","shortName":"REATRHI"},{"id":"REATRLO","category":"Study","name":"RetraceATRLow","shortName":"REATRLO"},{"id":"MOVLR","category":"Study","name":"MovingLinRegression","shortName":"MOVLINREG"},{"id":"TRSP1","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"TRSP2","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"COTLCCMSP","category":"Study","name":"Comm Spec","shortName":"COT(C)"},{"id":"COTLCLGSP","category":"Study","name":"Large Spec","shortName":"COT(L)"},{"id":"COTLCSMSP","category":"Study","name":"Small Spec","shortName":"COT(S)"},{"id":"COTDAGPRO","category":"Study","name":"Producers","shortName":"COTDIS(P)"},{"id":"COTDAGSPD","category":"Study","name":"Swap Dealers","shortName":"COTDIS(S)"},{"id":"COTDAGMNM","category":"Study","name":"Managed Money","shortName":"COTDIS(M)"},{"id":"COTDAGOTH","category":"Study","name":"Other Report","shortName":"COTDIS(O)"},{"id":"COTFTRDLI","category":"Study","name":"Dealer Intermediary","shortName":"COTFIN(D)"},{"id":"COTFTRASM","category":"Study","name":"Asset Manager","shortName":"COTFIN(A)"},{"id":"COTFTRLVF","category":"Study","name":"Leveraged Funds","shortName":"COTFIN(L)"},{"id":"COTFTROTH","category":"Study","name":"Other Report","shortName":"COTFIN(O)"},{"id":"PPTPIV","category":"Study","name":"Pivot Point","shortName":"PPT(P)"},{"id":"PPTR1","category":"Study","name":"1st Resistance","shortName":"PPT(R1)"},{"id":"PPTR2","category":"Study","name":"2nd Resistance","shortName":"PPT(R2)"},{"id":"PPTR3","category":"Study","name":"3rd Resistance","shortName":"PPT(R3)"},{"id":"PPTS1","category":"Study","name":"1st Support","shortName":"PPT(S1)"},{"id":"PPTS2","category":"Study","name":"2nd Support","shortName":"PPT(S2)"},{"id":"PPTS3","category":"Study","name":"3rd Support","shortName":"PPT(S3)"},{"id":"CPPH4","category":"Study","name":"4th Camarilla Res","shortName":"CPP(H4)"},{"id":"CPPH3","category":"Study","name":"3rd Camarilla Res","shortName":"CPP(H3)"},{"id":"CPPH2","category":"Study","name":"2nd Camarilla Res","shortName":"CPP(H2)"},{"id":"CPPH1","category":"Study","name":"1st Camarilla Res","shortName":"CPP(H1)"},{"id":"CPPL1","category":"Study","name":"1st Camarilla Supp","shortName":"CPP(L1)"},{"id":"CPPL2","category":"Study","name":"2nd Camarilla Supp","shortName":"CPP(L2)"},{"id":"CPPL3","category":"Study","name":"3rd Camarilla Supp","shortName":"CPP(L3)"},{"id":"CPPL4","category":"Study","name":"4th Camarilla Supp","shortName":"CPP(L4)"},{"id":"IMPVOL","category":"Study","name":"Implied Volatility","shortName":"IV"},{"id":"CTM","category":"Study","name":"Cycle Trading Momentum","shortName":"CTM"},{"id":"CPMI","category":"Study","name":"Principal Momentum","shortName":"CPMI"},{"id":"CTPI","category":"Study","name":"Turning Point","shortName":"CTPI"},{"id":"CTLTM","category":"Study","name":"Long-Term Momentum","shortName":"LTM"},{"id":"CTLTMF","category":"Study","name":"Long-Term Momentum, Fast","shortName":"LTM(F)"},{"id":"DEMA","category":"Study","name":"Double EMA","shortName":"DEMA"},{"id":"TEMA","category":"Study","name":"Triple EMA","shortName":"TEMA"},{"id":"TSI","category":"Study","name":"True Strength Index","shortName":"Tsi"},{"id":"TSISIG","category":"Study","name":"True Strength Index Signal","shortName":"TsiSig"},{"id":"GMMA3","category":"Study","name":"GMMA-EMA3","shortName":"GMMA(3)"},{"id":"GMMA5","category":"Study","name":"GMMA-EMA5","shortName":"GMMA(5)"},{"id":"GMMA8","category":"Study","name":"GMMA-EMA8","shortName":"GMMA(8)"},{"id":"GMMA10","category":"Study","name":"GMMA-EMA10","shortName":"GMMA(10)"},{"id":"GMMA12","category":"Study","name":"GMMA-EMA12","shortName":"GMMA(12)"},{"id":"GMMA15","category":"Study","name":"GMMA-EMA15","shortName":"GMMA(15)"},{"id":"GMMA30","category":"Study","name":"GMMA-EMA30","shortName":"GMMA(30)"},{"id":"GMMA35","category":"Study","name":"GMMA-EMA35","shortName":"GMMA(35)"},{"id":"GMMA40","category":"Study","name":"GMMA-EMA40","shortName":"GMMA(40)"},{"id":"GMMA45","category":"Study","name":"GMMA-EMA45","shortName":"GMMA(45)"},{"id":"GMMA50","category":"Study","name":"GMMA-EMA50","shortName":"GMMA(50)"},{"id":"GMMA60","category":"Study","name":"GMMA-EMA60","shortName":"GMMA(60)"},{"id":"CONVLN","category":"Study","name":"ConversionLine","shortName":"ConvLn"},{"id":"BASELN","category":"Study","name":"BaseLine","shortName":"BaseLn"},{"id":"LEADSP1","category":"Study","name":"LeadingSpanA","shortName":"LeadSpA"},{"id":"LEADSP2","category":"Study","name":"LeadingSpanB","shortName":"LeadSpB"},{"id":"LAGGSP","category":"Study","name":"LaggingSpan","shortName":"LaggSp"},{"id":"VWAP","category":"Study","name":"VWAP","shortName":"VWAP"},{"id":"AVWAP","category":"Study","name":"Anchored VWAP","shortName":"Anch-VWAP"},{"id":"VWAPSD1U","category":"Study","name":"VWAP Stdev1 Upper","shortName":"VWAP-Std1-Up"},{"id":"VWAPSD1L","category":"Study","name":"VWAP Stdev1 Lower","shortName":"VWAP-Std1-Lo"},{"id":"VWAPSD2U","category":"Study","name":"VWAP Stdev2 Upper","shortName":"VWAP-Std2-Up"},{"id":"VWAPSD2L","category":"Study","name":"VWAP Stdev2 Lower","shortName":"VWAP-Std2-Lo"},{"id":"DIFA","category":"Study","name":"Distance From Average","shortName":"DistAvg"},{"id":"DOSCH","category":"Study","name":"Derivative Oscillator","shortName":"DerOsc"},{"id":"DOSCS","category":"Study","name":"Derivative Oscillator Signal","shortName":"DerOscSig"},{"id":"TTMSQZON","category":"Study","name":"TTM Squeeze On","shortName":"TtmSqzOn"},{"id":"TTMSQZOFF","category":"Study","name":"TTM Squeeze Off","shortName":"TtmSqzOff"},{"id":"TTMSQZOSC","category":"Study","name":"TTM Squeeze Osc","shortName":"TtmSqzOsc"},{"id":"CRS","category":"Study","name":"CompRelStrength","shortName":"CRS"},{"id":"CRSAVG","category":"Study","name":"CompRelStrengthAvg","shortName":"CRS-Avg"},{"id":"DRS","category":"Study","name":"DorseyRelStrength","shortName":"DRS"},{"id":"MRS","category":"Study","name":"MansfieldRelStrength","shortName":"MRS"},{"id":"PMO","category":"Study","name":"PriceMomOsc","shortName":"PMO"},{"id":"PMOS","category":"Study","name":"PriceMomOscSig","shortName":"PMOS"},{"id":"RVOL","category":"Study","name":"Relative Volume","shortName":"RVOL"},{"id":"AccountsPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Accounts Payable","shortName":"AcctsPay"},{"id":"AccruedExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Accrued Expenses","shortName":"AccrdExp"},{"id":"Cash","category":"BalanceSheet","format":"UseMetricUnit","name":"Cash & Cash Equivalents","shortName":"Cash&CashEqv"},{"id":"CommonShares","category":"BalanceSheet","format":"UseMetricUnit","name":"Common Shares","shortName":"CommonShares"},{"id":"DeferredIncomeTax","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Income Tax","shortName":"DefIncTax"},{"id":"DeferredLongRevenues","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Revenues","shortName":"DefRev"},{"id":"EquityOtherInvestments","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity Investments","shortName":"OthEquityInvest"},{"id":"IncomeTaxPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Income Tax Payable","shortName":"IncTaxPayble"},{"id":"Intangibles","category":"BalanceSheet","format":"UseMetricUnit","name":"Intangibles","shortName":"Intangibles"},{"id":"Inventories","category":"BalanceSheet","format":"UseMetricUnit","name":"Inventories","shortName":"Inventory"},{"id":"LongTermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Long Term Debt","shortName":"LTDebt"},{"id":"MarketableSec","category":"BalanceSheet","format":"UseMetricUnit","name":"Liquid Securities","shortName":"LiqSecurities"},{"id":"OtherCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Miscellaneous Current Assets","shortName":"MiscCurrAssets"},{"id":"OtherCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Current Liabilities","shortName":"OthCurrLiab"},{"id":"OtherEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity","shortName":"OthEquity"},{"id":"OtherNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Assets","shortName":"OthNonCurrAssets"},{"id":"OtherNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Liabilities","shortName":"OthNonCurrLiab"},{"id":"PpeNet","category":"BalanceSheet","format":"UseMetricUnit","name":"PPE Net","shortName":"PPENet"},{"id":"PrepaidExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Prepaid Expenses","shortName":"PpdExp"},{"id":"Receivables","category":"BalanceSheet","format":"UseMetricUnit","name":"Receivables","shortName":"Receivables"},{"id":"RetainedEarnings","category":"BalanceSheet","format":"UseMetricUnit","name":"Retained Earnings","shortName":"RetEarnings"},{"id":"ShorttermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Short-Term Debt","shortName":"ShortTermDebt"},{"id":"TotalAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Assets","shortName":"TotAssets"},{"id":"TotalCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Assets","shortName":"TotCurrAssets"},{"id":"TotalCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Liabilities","shortName":"TotCurrLiab"},{"id":"TotalLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities","shortName":"TotalLiab"},{"id":"TotalLiabilitiesAndEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities & Equity","shortName":"TotLiab&Equity"},{"id":"TotalNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Assets","shortName":"TotNonCurrAssets"},{"id":"TotalNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Liabilities","shortName":"TotNonCurrLiabs"},{"id":"TotalShareholdersEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Shareholders Equity","shortName":"TotShareEquity"},{"id":"BasicEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Continued Operations","shortName":"EPSContOps"},{"id":"BasicEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Total Operations","shortName":"EPSTotOps"},{"id":"CostGoods","category":"IncomeStatement","format":"UseMetricUnit","name":"Cost of Goods","shortName":"COGS"},{"id":"DilutedEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Continued Operations","shortName":"DilutedEPSContOps"},{"id":"DilutedEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Total Operations","shortName":"DilutedEPSTotOps"},{"id":"Ebitda","category":"IncomeStatement","format":"UseMetricUnit","name":"EBITDA","shortName":"EBITDA"},{"id":"GrossProfit","category":"IncomeStatement","format":"UseMetricUnit","name":"Gross Profit","shortName":"GrProfit"},{"id":"IncomeTax","category":"IncomeStatement","format":"UseMetricUnit","name":"Income Tax","shortName":"IncomeTax"},{"id":"InterestExpense","category":"IncomeStatement","format":"UseMetricUnit","name":"Interest Expense","shortName":"IntExp"},{"id":"NetIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Net Income Less Expenses & Tax","shortName":"NetIncome"},{"id":"OperatingExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Expenses","shortName":"OpExpense"},{"id":"OperatingIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Income","shortName":"OpIncome"},{"id":"OtherIncomeExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Other Income","shortName":"OthInc"},{"id":"PreTaxIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Pretax Income","shortName":"PretaxInc"},{"id":"Sales","category":"IncomeStatement","format":"UseMetricUnit","name":"Sales","shortName":"Sales"},{"id":"JPIB","category":"Study","name":"JPI-Buy","shortName":"Buy"},{"id":"JPIS","category":"Study","name":"JPI-Sell","shortName":"Sell"}]');class Oo{constructor(e,t=O.Number,i=x.Common,s,n=I.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 wo={};let Io=!1;function Do(e){_o(e,Ci.FIELDS_SCHEMA).map((e=>{wo[e.id]=new Oo(e.id,O[e.type],x[e.category],e.name,I[e.format],e.shortName)}))}const xo=(Io||(Do(e(Lo)),Io=!0),wo),No={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",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"},Ro=[xo.Open,xo.High,xo.Low,xo.Close,xo.Volume,xo.Change,xo.PercentChange,xo.PreviousClose].reduce(((e,t,i)=>(e.set(t.id,1<<i),e)),new Map);function Ho(...e){return e.reduce(((e,t)=>Ro.has(t.id)?e|Ro.get(t.id):e),0)}class Vo{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){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&&Ro.has(i)&&(this._updated=this._updated|Ro.get(i)),n}}computeWellKnown(){const e=this.getValue(xo.Close),t=this.getValue(xo.PreviousClose);Ze(e,t)&&(this.hasField(xo.Change)&&this.update(xo.Change,e-t),this.hasField(xo.PercentChange)&&this.update(xo.PercentChange,(e-t)/t))}hasField(e){return Ze(this.fields)&&this.fields.includes(e)}hasSymbol(e){return!1}getValue(e){return this.hasField(e)?this.storage.get(e.id):null}shutdown(){}async ready(){return!1}}class Fo extends Vo{constructor(e){super(),this.symbol=e,this.translated=Di(this.symbol)}hasSymbol(e){return this.symbol===e}}class Bo extends Vo{constructor(e){super(Ci.PLACEHOLDER_SYMBOL_NAME),this.actual=e}async ready(){return!1}}class ko extends Vo{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 Uo={previousOpen:xo.PreviousOpen,previousClose:xo.PreviousClose,previousHigh:xo.PreviousHigh,previousLow:xo.PreviousLow,weeklyPreviousClose:xo.WeekPreviousClose,weeklyPreviousHigh:xo.WeekPreviousHigh,weeklyPreviousLow:xo.WeekPreviousLow,monthlyPreviousClose:xo.MonthPreviousClose,monthlyPreviousHigh:xo.MonthPreviousHigh,monthlyPreviousLow:xo.MonthPreviousLow,fiftyTwoWkHigh:xo.YearHigh,fiftyTwoWkLow:xo.YearLow},Wo=Object.values(Uo),$o=Object.keys(Uo);class Go extends Fo{triedFetchingExtraValues=!1;async ready(){return Ai.call(this,(async()=>{const e=SP().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await e.ready(),this.isValid}))}shutdown(){}getValue(e){return this.hasField(e)&&Wo.includes(e)&&null===super.getValue(e)&&!this.triedFetchingExtraValues&&this.supplementPreviousValues(),super.getValue(e)}supplementPreviousValues(){this.triedFetchingExtraValues=!0,fP("ondemand",`/getQuote.json?symbols=${this.translated}&fields=${$o.join(",")}`).then((e=>{try{const t=JSON.parse(e);if(200===t.status.code&&1===t.results.length){const e=t.results[0];$o.forEach((t=>this.update(Uo[t],e[t]))),SP().getRecordSource().subject.next({topic:No.RT_QUOTE,data:{symbol:this.symbol}})}}catch(e){dP(`Failed to fetch extra values for ${this.translated}`,"error")}}))}}class zo extends Fo{isValid=!1;constructor(e){super(e)}addOptionalField(e,t){Ze(t)&&(this.addFields(e),this.update(e,t))}async ready(){return Ai.call(this,(async()=>{const e=SP().config.environment===r[r.NodeJs]?null:ui(`#${Ci.INLINE_DATA_ELEMENT_ID}`);if(Ze(e)){const t=JSON.parse(e);if(this.translated in t){const e=t[this.translated].quote;this.update(xo.Open,e.open),this.update(xo.High,e.high),this.update(xo.Low,e.low),this.update(xo.Close,e.close),this.update(xo.PreviousClose,e.previousClose),this.update(xo.Volume,e.volume),$o.filter((e=>"previousClose"!==e)).forEach((t=>{this.addOptionalField(Uo[t],e[t])})),this.isValid=!0}else this.isValid=!1}else this.isValid=!1;return this.isValid}))}}const Yo=[xo.Open,xo.High,xo.Low,xo.Close,xo.PreviousClose];class jo extends Vo{constructor(e,t){super();this.resolved=e.map((([e,t])=>t)),this.mapping=new Map(e.map((([e,t])=>{return[e,(i=t,SP().getRecordSource().getRecord(i))];var i}))),this.model=t;const i=Yo.concat(xo.Change,xo.PercentChange);this.addFields(...i.filter((e=>e!==xo.Volume)))}async ready(){return Ai.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(){Yo.forEach((e=>{const t=Zr(this.model,this.getOneValue(e));this.update(e,Number.isFinite(t)?t:null)})),this.computeWellKnown()}}function Ko(e,t){return i=>i.topic===e&&i.data.symbol===t}var qo=function(e,t){return qo=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])},qo(e,t)};function Xo(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}qo(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function Zo(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{l(s.next(e))}catch(e){r(e)}}function a(e){try{l(s.throw(e))}catch(e){r(e)}}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 Jo(e,t){var i,s,n,r,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(l){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(o=0)),o;)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 o.label++,{value:a[1],done:!1};case 5:o.label++,s=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],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])}}}Object.create;function Qo(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 ea(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(e){n={error:e}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return o}function ta(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 ia(e){return this instanceof ia?(this.v=e,this):new ia(e)}function sa(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s,n=i.apply(e,t||[]),r=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(e){n[e]&&(s[e]=function(t){return new Promise((function(i,s){r.push([e,t,i,s])>1||a(e,t)}))})}function a(e,t){try{(i=n[e](t)).value instanceof ia?Promise.resolve(i.value.v).then(l,c):u(r[0][2],i)}catch(e){u(r[0][3],e)}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 na(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=Qo(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)}))}}}Object.create;function ra(e){return"function"==typeof e}function oa(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}var aa=oa((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 la(e,t){if(e){var i=e.indexOf(t);0<=i&&e.splice(i,1)}}var ca=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=Qo(r),a=o.next();!a.done;a=o.next()){a.value.remove(this)}}catch(t){e={error:t}}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(ra(l))try{l()}catch(e){n=e instanceof aa?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=Qo(c),h=u.next();!h.done;h=u.next()){var d=h.value;try{da(d)}catch(e){n=null!=n?n:[],e instanceof aa?n=ta(ta([],ea(n)),ea(e.errors)):n.push(e)}}}catch(e){i={error:e}}finally{try{h&&!h.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}if(n)throw new aa(n)}},e.prototype.add=function(t){var i;if(t&&t!==this)if(this.closed)da(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)&&la(t,e)},e.prototype.remove=function(t){var i=this._finalizers;i&&la(i,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),ua=ca.EMPTY;function ha(e){return e instanceof ca||e&&"closed"in e&&ra(e.remove)&&ra(e.add)&&ra(e.unsubscribe)}function da(e){ra(e)?e():e.unsubscribe()}var pa=function(e){function t(t,i){return e.call(this)||this}return Xo(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(ca),fa={setInterval:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var n=fa.delegate;return(null==n?void 0:n.setInterval)?n.setInterval.apply(n,ta([e,t],ea(i))):setInterval.apply(void 0,ta([e,t],ea(i)))},clearInterval:function(e){var t=fa.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},ma=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 Xo(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),fa.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&&fa.clearInterval(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(e){s=!0,i=e||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,la(s,this),null!=t&&(this.id=this.recycleAsyncId(i,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(pa),ga={now:function(){return(ga.delegate||Date).now()},delegate:void 0},ya=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=ga.now,e}(),Ta=new(function(e){function t(t,i){void 0===i&&(i=ya.now);var s=e.call(this,t,i)||this;return s.actions=[],s._active=!1,s}return Xo(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}(ya))(ma),Sa=Ta,Aa={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},va={setTimeout:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var n=va.delegate;return(null==n?void 0:n.setTimeout)?n.setTimeout.apply(n,ta([e,t],ea(i))):setTimeout.apply(void 0,ta([e,t],ea(i)))},clearTimeout:function(e){var t=va.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Pa(e){va.setTimeout((function(){var t=Aa.onUnhandledError;if(!t)throw e;t(e)}))}function Ca(){}var ba=_a("C",void 0,void 0);function Ea(e){return _a("N",e,void 0)}function _a(e,t,i){return{kind:e,value:t,error:i}}var Ma=null;function La(e){if(Aa.useDeprecatedSynchronousErrorHandling){var t=!Ma;if(t&&(Ma={errorThrown:!1,error:null}),e(),t){var i=Ma,s=i.errorThrown,n=i.error;if(Ma=null,s)throw n}}else e()}var Oa=function(e){function t(t){var i=e.call(this)||this;return i.isStopped=!1,t?(i.destination=t,ha(t)&&t.add(i)):i.destination=Ha,i}return Xo(t,e),t.create=function(e,t,i){return new xa(e,t,i)},t.prototype.next=function(e){this.isStopped?Ra(Ea(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Ra(_a("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Ra(ba,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}(ca),wa=Function.prototype.bind;function Ia(e,t){return wa.call(e,t)}var Da=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){Na(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Na(e)}else Na(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Na(e)}},e}(),xa=function(e){function t(t,i,s){var n,r,o=e.call(this)||this;ra(t)||!t?n={next:null!=t?t:void 0,error:null!=i?i:void 0,complete:null!=s?s:void 0}:o&&Aa.useDeprecatedNextContext?((r=Object.create(t)).unsubscribe=function(){return o.unsubscribe()},n={next:t.next&&Ia(t.next,r),error:t.error&&Ia(t.error,r),complete:t.complete&&Ia(t.complete,r)}):n=t;return o.destination=new Da(n),o}return Xo(t,e),t}(Oa);function Na(e){var t;Aa.useDeprecatedSynchronousErrorHandling?(t=e,Aa.useDeprecatedSynchronousErrorHandling&&Ma&&(Ma.errorThrown=!0,Ma.error=t)):Pa(e)}function Ra(e,t){var i=Aa.onStoppedNotification;i&&va.setTimeout((function(){return i(e,t)}))}var Ha={closed:!0,next:Ca,error:function(e){throw e},complete:Ca},Va="function"==typeof Symbol&&Symbol.observable||"@@observable";function Fa(e){return e}function Ba(e){return 0===e.length?Fa:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var ka=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 Oa||function(e){return e&&ra(e.next)&&ra(e.error)&&ra(e.complete)}(s)&&ha(s)?e:new xa(e,t,i);return La((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=Ua(t))((function(t,s){var n=new xa({next:function(t){try{e(t)}catch(e){s(e),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[Va]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ba(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Ua(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 Ua(e){var t;return null!==(t=null!=e?e:Aa.Promise)&&void 0!==t?t:Promise}function Wa(e){return e&&ra(e.schedule)}function $a(e,t,i){void 0===e&&(e=0),void 0===i&&(i=Sa);var s=-1;return null!=t&&(Wa(t)?i=t:s=t),new ka((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 Ga(e,t){return void 0===e&&(e=0),void 0===t&&(t=Ta),e<0&&(e=0),$a(e,e,t)}var za=oa((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Ya=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 Xo(t,e),t.prototype.lift=function(e){var t=new ja(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new za},t.prototype.next=function(e){var t=this;La((function(){var i,s;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var n=Qo(t.currentObservers),r=n.next();!r.done;r=n.next()){r.value.next(e)}}catch(e){i={error:e}}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;La((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;La((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?ua:(this.currentObservers=null,r.push(e),new ca((function(){t.currentObservers=null,la(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 ka;return e.source=this,e},t.create=function(e,t){return new ja(e,t)},t}(ka),ja=function(e){function t(t,i){var s=e.call(this)||this;return s.destination=t,s.source=i,s}return Xo(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:ua},t}(Ya);function Ka(e){return function(t){if(function(e){return ra(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function qa(e,t,i,s,n){return new Xa(e,t,i,s,n)}var Xa=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(e){t.error(e)}}:e.prototype._next,a._error=n?function(e){try{n(e)}catch(e){t.error(e)}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 Xo(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}(Oa);function Za(e){return ra(e[Va])}function Ja(e){return Symbol.asyncIterator&&ra(null==e?void 0:e[Symbol.asyncIterator])}function Qa(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.")}var el="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function tl(e){return ra(null==e?void 0:e[el])}function il(e){return ra(null==e?void 0:e.getReader)}function sl(e){if(e instanceof ka)return e;if(null!=e){if(Za(e))return o=e,new ka((function(e){var t=o[Va]();if(ra(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 ka((function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()}));if(ra(null==(s=e)?void 0:s.then))return i=e,new ka((function(e){i.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Pa)}));if(Ja(e))return nl(e);if(tl(e))return t=e,new ka((function(e){var i,s;try{for(var n=Qo(t),r=n.next();!r.done;r=n.next()){var o=r.value;if(e.next(o),e.closed)return}}catch(e){i={error:e}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}}e.complete()}));if(il(e))return nl(function(e){return sa(this,arguments,(function(){var t,i,s;return Jo(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,ia(t.read())];case 3:return i=n.sent(),s=i.value,i.done?[4,ia(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,ia(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 Qa(e)}function nl(e){return new ka((function(t){(function(e,t){var i,s,n,r;return Zo(this,void 0,void 0,(function(){var o,a;return Jo(this,(function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),i=na(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 rl(e,t){return Ka((function(i,s){var n=0;i.subscribe(qa(s,(function(i){return e.call(t,i,n++)&&s.next(i)})))}))}function ol(e){return ol="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},ol(e)}function al(e){return Mt(1,arguments),e instanceof Date||"object"===ol(e)&&"[object Date]"===Object.prototype.toString.call(e)}function ll(e){if(Mt(1,arguments),!al(e)&&"number"!=typeof e)return!1;var t=Ot(e);return!isNaN(Number(t))}function cl(e,t){Mt(2,arguments);var i=Ot(e).getTime(),s=_t(t);return new Date(i+s)}function ul(e,t){Mt(2,arguments);var i=_t(t);return cl(e,-i)}var hl=864e5;function dl(e){Mt(1,arguments);var t=Ot(e),i=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var s=t.getTime(),n=i-s;return Math.floor(n/hl)+1}function pl(e){Mt(1,arguments);var t=1,i=Ot(e),s=i.getUTCDay(),n=(s<t?7:0)+s-t;return i.setUTCDate(i.getUTCDate()-n),i.setUTCHours(0,0,0,0),i}function fl(e){Mt(1,arguments);var t=Ot(e),i=t.getUTCFullYear(),s=new Date(0);s.setUTCFullYear(i+1,0,4),s.setUTCHours(0,0,0,0);var n=pl(s),r=new Date(0);r.setUTCFullYear(i,0,4),r.setUTCHours(0,0,0,0);var o=pl(r);return t.getTime()>=n.getTime()?i+1:t.getTime()>=o.getTime()?i:i-1}function ml(e){Mt(1,arguments);var t=fl(e),i=new Date(0);i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0);var s=pl(i);return s}var gl=6048e5;function yl(e){Mt(1,arguments);var t=Ot(e),i=pl(t).getTime()-ml(t).getTime();return Math.round(i/gl)+1}function Tl(e,t){var i,s,n,r,o,a,l,c;Mt(1,arguments);var u=vr(),h=_t(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=Ot(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 Sl(e,t){var i,s,n,r,o,a,l,c;Mt(1,arguments);var u=Ot(e),h=u.getUTCFullYear(),d=vr(),p=_t(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=new Date(0);f.setUTCFullYear(h+1,0,p),f.setUTCHours(0,0,0,0);var m=Tl(f,t),g=new Date(0);g.setUTCFullYear(h,0,p),g.setUTCHours(0,0,0,0);var y=Tl(g,t);return u.getTime()>=m.getTime()?h+1:u.getTime()>=y.getTime()?h:h-1}function Al(e,t){var i,s,n,r,o,a,l,c;Mt(1,arguments);var u=vr(),h=_t(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=Sl(e,t),p=new Date(0);p.setUTCFullYear(d,0,h),p.setUTCHours(0,0,0,0);var f=Tl(p,t);return f}var vl=6048e5;function Pl(e,t){Mt(1,arguments);var i=Ot(e),s=Tl(i,t).getTime()-Al(i,t).getTime();return Math.round(s/vl)+1}function Cl(e,t){for(var i=e<0?"-":"",s=Math.abs(e).toString();s.length<t;)s="0"+s;return i+s}var bl={y:function(e,t){var i=e.getUTCFullYear(),s=i>0?i:1-i;return Cl("yy"===t?s%100:s,t.length)},M:function(e,t){var i=e.getUTCMonth();return"M"===t?String(i+1):Cl(i+1,2)},d:function(e,t){return Cl(e.getUTCDate(),t.length)},a:function(e,t){var i=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return i.toUpperCase();case"aaa":return i;case"aaaaa":return i[0];default:return"am"===i?"a.m.":"p.m."}},h:function(e,t){return Cl(e.getUTCHours()%12||12,t.length)},H:function(e,t){return Cl(e.getUTCHours(),t.length)},m:function(e,t){return Cl(e.getUTCMinutes(),t.length)},s:function(e,t){return Cl(e.getUTCSeconds(),t.length)},S:function(e,t){var i=t.length,s=e.getUTCMilliseconds();return Cl(Math.floor(s*Math.pow(10,i-3)),t.length)}},El="midnight",_l="noon",Ml="morning",Ll="afternoon",Ol="evening",wl="night";function Il(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+Cl(r,2)}function Dl(e,t){return e%60==0?(e>0?"-":"+")+Cl(Math.abs(e)/60,2):xl(e,t)}function xl(e,t){var i=t||"",s=e>0?"-":"+",n=Math.abs(e);return s+Cl(Math.floor(n/60),2)+i+Cl(n%60,2)}var Nl={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 bl.y(e,t)},Y:function(e,t,i,s){var n=Sl(e,s),r=n>0?n:1-n;return"YY"===t?Cl(r%100,2):"Yo"===t?i.ordinalNumber(r,{unit:"year"}):Cl(r,t.length)},R:function(e,t){return Cl(fl(e),t.length)},u:function(e,t){return Cl(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 Cl(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 Cl(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 bl.M(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 Cl(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=Pl(e,s);return"wo"===t?i.ordinalNumber(n,{unit:"week"}):Cl(n,t.length)},I:function(e,t,i){var s=yl(e);return"Io"===t?i.ordinalNumber(s,{unit:"week"}):Cl(s,t.length)},d:function(e,t,i){return"do"===t?i.ordinalNumber(e.getUTCDate(),{unit:"date"}):bl.d(e,t)},D:function(e,t,i){var s=dl(e);return"Do"===t?i.ordinalNumber(s,{unit:"dayOfYear"}):Cl(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 Cl(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 Cl(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 Cl(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?_l:0===n?El: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?Ol:n>=12?Ll:n>=4?Ml:wl,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 bl.h(e,t)},H:function(e,t,i){return"Ho"===t?i.ordinalNumber(e.getUTCHours(),{unit:"hour"}):bl.H(e,t)},K:function(e,t,i){var s=e.getUTCHours()%12;return"Ko"===t?i.ordinalNumber(s,{unit:"hour"}):Cl(s,t.length)},k:function(e,t,i){var s=e.getUTCHours();return 0===s&&(s=24),"ko"===t?i.ordinalNumber(s,{unit:"hour"}):Cl(s,t.length)},m:function(e,t,i){return"mo"===t?i.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):bl.m(e,t)},s:function(e,t,i){return"so"===t?i.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):bl.s(e,t)},S:function(e,t){return bl.S(e,t)},X:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();if(0===n)return"Z";switch(t){case"X":return Dl(n);case"XXXX":case"XX":return xl(n);default:return xl(n,":")}},x:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"x":return Dl(n);case"xxxx":case"xx":return xl(n);default:return xl(n,":")}},O:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Il(n,":");default:return"GMT"+xl(n,":")}},z:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Il(n,":");default:return"GMT"+xl(n,":")}},t:function(e,t,i,s){var n=s._originalDate||e;return Cl(Math.floor(n.getTime()/1e3),t.length)},T:function(e,t,i,s){return Cl((s._originalDate||e).getTime(),t.length)}},Rl=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"})}},Hl=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"})}},Vl={p:Hl,P:function(e,t){var i,s=e.match(/(P+)(p+)?/)||[],n=s[1],r=s[2];if(!r)return Rl(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}}",Rl(n,t)).replace("{{time}}",Hl(r,t))}},Fl=["D","DD"],Bl=["YY","YYYY"];function kl(e){return-1!==Fl.indexOf(e)}function Ul(e){return-1!==Bl.indexOf(e)}function Wl(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 $l={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"}},Gl=function(e,t,i){var s,n=$l[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};function zl(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.width?String(t.width):e.defaultWidth,s=e.formats[i]||e.formats[e.defaultWidth];return s}}var Yl={date:zl({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:zl({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:zl({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},jl={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Kl(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 ql(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)?Zl(l,(function(e){return e.test(a)})):Xl(l,(function(e){return e.test(a)}));o=e.valueCallback?e.valueCallback(c):c,o=i.valueCallback?i.valueCallback(o):o;var u=t.slice(a.length);return{value:o,rest:u}}}function Xl(e,t){for(var i in e)if(e.hasOwnProperty(i)&&t(e[i]))return i}function Zl(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i}function Jl(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];o=i.valueCallback?i.valueCallback(o):o;var a=t.slice(n.length);return{value:o,rest:a}}}var Ql={code:"en-US",formatDistance:Gl,formatLong:Yl,formatRelative:function(e,t,i,s){return jl[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:Kl({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Kl({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:Kl({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:Kl({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:Kl({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:Jl({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:ql({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:ql({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:ql({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:ql({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:ql({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}},ec=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tc=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ic=/^'([^]*?)'?$/,sc=/''/g,nc=/[a-zA-Z]/;function rc(e,t,i){var s,n,r,o,a,l,c,u,h,d,p,f,m,g,y,T,S,A;Mt(2,arguments);var v=String(t),P=vr(),C=null!==(s=null!==(n=null==i?void 0:i.locale)&&void 0!==n?n:P.locale)&&void 0!==s?s:Ql,b=_t(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=_t(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===(T=y.options)||void 0===T?void 0:T.weekStartsOn)&&void 0!==m?m:P.weekStartsOn)&&void 0!==f?f:null===(S=P.locale)||void 0===S||null===(A=S.options)||void 0===A?void 0:A.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 _=Ot(e);if(!ll(_))throw new RangeError("Invalid time value");var M=xt(_),L=ul(_,M),O={firstWeekContainsDate:b,weekStartsOn:E,locale:C,_originalDate:_},w=v.match(tc).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Vl[t])(e,C.formatLong):e})).join("").match(ec).map((function(s){if("''"===s)return"'";var n=s[0];if("'"===n)return oc(s);var r=Nl[n];if(r)return null!=i&&i.useAdditionalWeekYearTokens||!Ul(s)||Wl(s,t,String(e)),null!=i&&i.useAdditionalDayOfYearTokens||!kl(s)||Wl(s,t,String(e)),r(L,s,C.localize,O);if(n.match(nc))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return s})).join("");return w}function oc(e){var t=e.match(ic);return t?t[1].replace(sc,"'"):e}function ac(e,t){var i=function(e){if(!cc[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")),i="06/25/2014, 00:00:00"===t||"06/25/2014 00:00:00"===t;cc[e]=i?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 cc[e]}(t);return i.formatToParts?function(e,t){try{for(var i=e.formatToParts(t),s=[],n=0;n<i.length;n++){var r=lc[i[n].type];r>=0&&(s[r]=parseInt(i[n].value,10))}return s}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(i,e):function(e,t){var i=e.format(t).replace(/\u200E/g,""),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 lc={year:0,month:1,day:2,hour:3,minute:4,second:5};var cc={};function uc(e,t,i,s,n,r,o){var a=new Date(0);return a.setUTCFullYear(e,t,i),a.setUTCHours(s,n,r,o),a}var hc=36e5,dc={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function pc(e,t,i){var s,n,r;if(!e)return 0;if(s=dc.timezoneZ.exec(e))return 0;if(s=dc.timezoneHH.exec(e))return mc(r=parseInt(s[1],10))?-r*hc:NaN;if(s=dc.timezoneHHMM.exec(e)){r=parseInt(s[1],10);var o=parseInt(s[2],10);return mc(r,o)?(n=Math.abs(r)*hc+6e4*o,r>0?-n:n):NaN}if(function(e){if(gc[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),gc[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var a=i?t:function(e){return uc(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=fc(a,e),c=i?l:function(e,t,i){var s=e.getTime(),n=s-t,r=fc(new Date(n),i);if(t===r)return t;n-=r-t;var o=fc(new Date(n),i);return r===o?r:Math.max(r,o)}(t,l,e);return-c}return NaN}function fc(e,t){var i=ac(e,t),s=uc(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 mc(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var gc={};var yc={};Object.defineProperty(yc,"__esModule",{value:!0}),yc.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)},yc=yc.default;var Tc={};Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.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()},Tc=Tc.default;var Sc=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Ac=36e5,vc={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Sc};function Pc(t,i){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===t)return new Date(NaN);var s=i||{},n=null==s.additionalDigits?2:e(yc)(s.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new 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 r=Cc(t),o=bc(r.date,n),a=o.year,l=o.restDateString,c=Ec(l,a);if(isNaN(c))return new Date(NaN);if(c){var u,h=c.getTime(),d=0;if(r.time&&(d=_c(r.time),isNaN(d)))return new Date(NaN);if(r.timeZone||s.timeZone){if(u=pc(r.timeZone||s.timeZone,new Date(h+d)),isNaN(u))return new Date(NaN)}else u=e(Tc)(new Date(h+d)),u=e(Tc)(new Date(h+d+u));return new Date(h+d+u)}return new Date(NaN)}function Cc(e){var t,i={},s=vc.dateTimePattern.exec(e);if(s?(i.date=s[1],t=s[3]):(s=vc.datePattern.exec(e))?(i.date=s[1],t=s[2]):(i.date=null,t=e),t){var n=vc.timeZone.exec(t);n?(i.time=t.replace(n[1],""),i.timeZone=n[1].trim()):i.time=t}return i}function bc(e,t){var i,s=vc.YYY[t],n=vc.YYYYY[t];if(i=vc.YYYY.exec(e)||n.exec(e)){var r=i[1];return{year:parseInt(r,10),restDateString:e.slice(r.length)}}if(i=vc.YY.exec(e)||s.exec(e)){var o=i[1];return{year:100*parseInt(o,10),restDateString:e.slice(o.length)}}return{year:null}}function Ec(e,t){if(null===t)return null;var i,s,n,r;if(0===e.length)return(s=new Date(0)).setUTCFullYear(t),s;if(i=vc.MM.exec(e))return s=new Date(0),Ic(t,n=parseInt(i[1],10)-1)?(s.setUTCFullYear(t,n),s):new Date(NaN);if(i=vc.DDD.exec(e)){s=new Date(0);var o=parseInt(i[1],10);return function(e,t){if(t<1)return!1;var i=wc(e);return!(i&&t>366)&&!(!i&&t>365)}(t,o)?(s.setUTCFullYear(t,0,o),s):new Date(NaN)}if(i=vc.MMDD.exec(e)){s=new Date(0),n=parseInt(i[1],10)-1;var a=parseInt(i[2],10);return Ic(t,n,a)?(s.setUTCFullYear(t,n,a),s):new Date(NaN)}if(i=vc.Www.exec(e))return Dc(t,r=parseInt(i[1],10)-1)?Mc(t,r):new Date(NaN);if(i=vc.WwwD.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return Dc(t,r,l)?Mc(t,r,l):new Date(NaN)}return null}function _c(e){var t,i,s;if(t=vc.HH.exec(e))return xc(i=parseFloat(t[1].replace(",",".")))?i%24*Ac:NaN;if(t=vc.HHMM.exec(e))return xc(i=parseInt(t[1],10),s=parseFloat(t[2].replace(",",".")))?i%24*Ac+6e4*s:NaN;if(t=vc.HHMMSS.exec(e)){i=parseInt(t[1],10),s=parseInt(t[2],10);var n=parseFloat(t[3].replace(",","."));return xc(i,s,n)?i%24*Ac+6e4*s+1e3*n:NaN}return null}function Mc(e,t,i){t=t||0,i=i||0;var s=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 Lc=[31,28,31,30,31,30,31,31,30,31,30,31],Oc=[31,29,31,30,31,30,31,31,30,31,30,31];function wc(e){return e%400==0||e%4==0&&e%100!=0}function Ic(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var s=wc(e);if(s&&i>Oc[t])return!1;if(!s&&i>Lc[t])return!1}return!0}function Dc(e,t,i){return!(t<0||t>52)&&(null==i||!(i<0||i>6))}function xc(e,t,i){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==i||!(i<0||i>=60)))}function Nc(e,t,i){var s=Pc(e,i),n=pc(t,s,!0),r=new Date(s.getTime()-n),o=new Date(0);return o.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),o.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),o}var Rc={};Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.default=function(e){return(0,Vc.default)({},e)};var Hc,Vc=(Hc=n("eG07G"))&&Hc.__esModule?Hc:{default:Hc};function Fc(t,i,s){if("string"==typeof t&&!t.match(Sc)){var n=e(Rc)(s);return n.timeZone=i,Pc(t,n)}var r=Pc(t,s),o=uc(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()).getTime(),a=pc(i,new Date(o));return new Date(o+a)}Rc=Rc.default;const Bc=[xo.Open,xo.High,xo.Low,xo.Last,xo.Close,xo.PreviousClose,xo.PreviousHigh,xo.PreviousLow,xo.PreviousOpen,xo.Volume,xo.Change,xo.PercentChange,xo.YearHigh,xo.YearLow,xo.WeekPreviousClose,xo.WeekPreviousHigh,xo.WeekPreviousLow,xo.MonthPreviousClose,xo.MonthPreviousHigh,xo.MonthPreviousLow];class kc{constructor(){this.recordCache=new Map,this.translateSymbolBack=new Map}get subject(){if(!Ze(this._subject)){const t=Ga(Math.max(Ci.MINIMUM_THROTTLE,SP().config.throttleMillis||0)),i=Ga(Ci.BACKGROUND_TAB_THROTTLE),s=()=>globalThis.document?.hidden?i:t;this._subject=(new Ya).pipe((e=s,Ka((function(t,i){var s=null,n=null,r=function(){null==n||n.unsubscribe();var t=s;s=[],t&&i.next(t),sl(e()).subscribe(n=qa(i,r,Ca))};r(),t.subscribe(qa(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})))}))),rl((e=>e.length>0)))}var e;return this._subject}addRecordForSymbol(e,t){const i=Di(e);i!==e&&this.translateSymbolBack.set(i,e),this.recordCache.set(e,t)}removeRecordForSymbol(e){this.recordCache.delete(e);const t=Di(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 Bc}makeAndCacheRecord(e,t){if(e===Ci.PLACEHOLDER_SYMBOL_NAME)return new Bo(Ci.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 Uc extends kc{getRecord(e){return this.makeAndCacheRecord(e,(()=>new zo(e)))}evictUnused(e){super.evictUnused(e,(e=>e.shutdown()))}}class Wc extends kc{constructor(){super(),this.onMarketUpdate=this.onMarketUpdate.bind(this)}evictUnused(e){super.evictUnused(e,(e=>{e.shutdown(),SP().connection.off("marketUpdate",this.onMarketUpdate,e.translated)}))}getRecord(e){return this.makeAndCacheRecord(e,(()=>new Go(e)))}postInit(e,t){e&&SP().connection.on("marketUpdate",this.onMarketUpdate,t.translated)}onMarketUpdate(e){if(e.type===Ci.REALTIME_INITIAL_QUOTE){const t=this.updateFromQuote(e,!0);this.subject.next({topic:No.RT_QUOTE,data:e,updated:t})}else if(e.type===Ci.REALTIME_TRADE){const t=SP().connection.getMarketState().getQuote(e.symbol),i=this.updateFromQuote(t);this.subject.next({topic:No.RT_TRADE,data:e,updated:i}),e.symbol===Ci.DEBUG_SYMBOL&&console.log(`Trade\nSymbol: ${e.symbol} \t%cPrice: ${e.tradePrice} \t%cSize: ${e.tradeSize} \t%cTime: ${rc(e.time,Ci.DEBUG_TIME_FORMAT)} \t%cSession: ${e.session}`,"color:#0f0","color:#a7a","color:#f96","color:#bee")}else if(e.type===Ci.REALTIME_VOLUME){const t=this.updateFromVolume(e);0!==t&&(this.subject.next({topic:No.RT_VOLUME,data:e,updated:t}),e.symbol===Ci.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(xo.Open,e.openPrice),i.update(xo.High,e.highPrice),i.update(xo.Low,e.lowPrice),i.update(xo.Last,e.lastPrice),i.update(xo.Close,e.lastPrice);const s=(e,t)=>{Ze(t)&&i.update(e,t)};return s(xo.Volume,e.volume),i.update(xo.PreviousClose,e.previousPrice),t&&(s(xo.PreviousOpen,e.previousOpenPrice),s(xo.PreviousHigh,e.previousHighPrice),s(xo.PreviousLow,e.previousLowPrice)),i.computeWellKnown(),i.updated}updateFromVolume(e){const t=this.findRecordForSymbol(e.symbol);return t.resetUpdated(),t.update(xo.Volume,e.value),t.updated}}class $c extends kc{constructor(){super(),this.localTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone}get feed(){return SP()}evictUnused(e){super.evictUnused(e,(e=>{e.shutdown(),this.feed.unsubscribe(e.translated)}))}getRecord(e){return this.makeAndCacheRecord(e,(()=>new Go(e)))}postInit(e,t){e&&this.feed.subscribe(t.translated)}onSnapshot(e,t){const i=this.findRecordForSymbol(t),s=SP().metaDataSource.getMetaData(t);if(!s.isReady)return;const n=(e,t)=>{if(Xe(t)){const n=s.asPrice(t);return i.update(e,n),n}};i.resetUpdated();const r=n(xo.Open,e.open?.price),o=n(xo.High,e.high?.price),a=n(xo.Low,e.low?.price),l=n(xo.Last,e.last?.price);Xe(n(xo.Close,e.close?.price))||n(xo.Close,e.settlement?.price),e.volume?.volume&&i.update(xo.Volume,s.asQuantity(e.volume.volume));const c=this.toExchangeTime(e.transactionTime,s.timeZone);Xe(n(xo.PreviousClose,e.prevClose?.price))||n(xo.PreviousClose,e.previousSession?.settlement?.price),n(xo.PreviousOpen,e.previousSession?.open?.price),n(xo.PreviousHigh,e.previousSession?.high?.price),n(xo.PreviousLow,e.previousSession?.low?.price),n(xo.YearHigh,e.yearHigh?.price),n(xo.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!Xe(e)||e.isZero()?null:new Date(e.div(1e6).toNumber())}toExchangeTime(e,t){const i=this.asDate(e);if(null===i)return null;return Nc(Fc(i,this.localTimeZone),t)}onUpdate(e,t){if(!this.recordCache.has(t))return void dP(`[OpenFeed] update for unsubscribed symbol: ${t}`,"warn");const i=SP().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),r=i.asQuantity(n.quantity);if(null===e||0===r)continue;const o=this.toExchangeTime(n.transactionTime,i.timeZone),a=this.findRecordForSymbol(t),l=["High","Low","Volume"].map((e=>xo[e])),[c,u,h]=l.map((e=>a.getValue(e)));(!Xe(u)||e<u)&&a.update(xo.Low,e),(!Xe(c)||e>c)&&a.update(xo.High,e),a.update(xo.Last,e),a.update(xo.Close,e),a.update(xo.Volume,(Xe(h)?h:0)+r),a.computeWellKnown();const d={data:{symbol:t,tradePrice:e,tradeSize:r,session:"",time:o??s},topic:"rt.trade",updated:a.updated};this.subject.next(d)}}}function Gc(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 zc(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t),n=Gc(i,s),r=Math.abs(Ht(i,s));i.setDate(i.getDate()-n*r);var o=Number(Gc(i,s)===-n),a=n*(r-o);return 0===a?0:a}function Yc(e){Mt(1,arguments);var t=Ot(e);return t.setHours(23,59,59,999),t}function jc(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getTime()===s.getTime()}function Kc(e,t){Mt(2,arguments);var i=Ot(e),s=_t(t);return isNaN(s)?new Date(NaN):s?(i.setDate(i.getDate()+s),i):i}function qc(e,t){Mt(2,arguments);var i=_t(t);return Kc(e,-i)}function Xc(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 Xc(e,t,i.concat(n))}}var Zc=Xc(Kc,2);function Jc(e,t){Mt(2,arguments);var i=_t(t);return cl(e,6e4*i)}var Qc=Xc(Jc,2),eu=Xc(wt,2);var tu=Xc((function(e,t){Mt(2,arguments);var i=_t(t),s=3*i;return wt(e,s)}),2);function iu(e,t){Mt(2,arguments);var i=_t(t);return cl(e,1e3*i)}var su=Xc(iu,2);var nu=Xc((function(e,t){Mt(2,arguments);var i=_t(t),s=7*i;return Kc(e,s)}),2),ru=Xc(It,2),ou=Xc(rc,2);function au(e){return e.size-1}class lu{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(xo.DateTime)}prepend(e){this.base.prepend(e),this.processRetrieved()}append(e){this.base.append(e),this.processRetrieved()}}class cu extends lu{constructor(e){super(),this.container=e,this.retryCountForChunk=Ci.FETCH_TICK_CHUNK_RETRY_COUNT}getFirstDate(e){const t=super.getFirstDate(0);return e>0&&e<this.retryCountForChunk?Yc(qc(t,e)):t}process(e){const t=this.container,i=t.size>0?t.getLastDataPoint(xo.Last):null,s=t.getLastDataPoint(xo.DateTime);let n=e.time;return void 0!==s&&n<=s&&(n=cl(s,1)),t.addDataPoint(xo.DateTime,n),t.addDataPoint(xo.Last,e.tradePrice),t.addDataPoint(xo.TradeSize,e.tradeSize),t.addDataPoint(xo.Change,Ze(i)?e.tradePrice-i:null),{isUpdate:!1,time:n.getTime(),index:au(t)}}}class uu extends lu{constructor(e,t){super(),this.agg=t,this.container=e,this.durationAdd=this.getBarDurationAdder()}isSameBar(e,t){switch(this.agg.unit){case C.Tick:case C.Intraday:case C.Day:return Ao(t,this.durationAdd(e));case C.Week:return Cr(e,t);case C.Month:return yr(e,t);case C.Quarter:return Sr(e,t);case C.Year:return br(e,t);default:throw new Error(`Unexpected aggregation unit ${C[this.agg.unit]}`)}}getBarDurationAdder(){switch(this.agg.unit){case C.Tick:return su(this.agg.size);case C.Intraday:return Qc(this.agg.size);case C.Day:return Zc(this.agg.size);case C.Week:return nu(1);case C.Month:return eu(1);case C.Quarter:return tu(1);case C.Year:return ru(1);default:throw new Error(`Unexpected aggregation unit ${C[this.agg.unit]}`)}}fixupTimeBasedAggregationTimestamp(e){return e}isCorrection(e,t){const i=Ao(t,e);return i&&dP("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 jc(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(xo.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){const o=this.container,a=o.size>0?o.getLastDataPoint(xo.Close):null;o.addDataPoint(xo.DateTime,r),o.addDataPoint(xo.Open,e),o.addDataPoint(xo.High,t),o.addDataPoint(xo.Low,i),o.addDataPoint(xo.Close,s),o.addDataPoint(xo.Change,Ze(a)?s-a:null),o.addDataPoint(xo.Volume,n),o.hasField(xo.OpenInterest)&&o.addDataPoint(xo.OpenInterest,null)}addBar(e,t){const{nextTimestamp:i}=t,s=e.tradePrice;return this.createBar(s,s,s,s,e.tradeSize,i),{isUpdate:!1,time:i.getTime(),index:au(this.container)}}updateLastBar(e,t,i,s){const n=this.container,r=e=>n.getLastDataPoint(e);if(Ze(e)&&e>r(xo.High)&&n.setLastDataPoint(xo.High,e),Ze(t)&&t<r(xo.Low)&&n.setLastDataPoint(xo.Low,t),Ze(i)){n.setLastDataPoint(xo.Close,i);const e=n.getData(xo.Close)[n.size-2];n.setLastDataPoint(xo.Change,i-e)}if(Ze(s)){const e=n.getLastDataPoint(xo.Volume)+s;n.setLastDataPoint(xo.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:au(this.container)}}process(e){const t=this.getPosition(e);if(null===t)return null;const i=ou(Ci.DEBUG_TIME_FORMAT);return t.isUpdate?(e.symbol===Ci.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)):Ze(e.tradePrice)?(e.symbol===Ci.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(Ze(e.lastPrice,e.time))return this.updateLastBar(e.highPrice,e.lowPrice,e.lastPrice,void 0),{isUpdate:!0,time:e.time.getTime(),index:au(this.container)}}}class hu extends uu{constructor(e,t,i){super(t,i),this.innerBuilder=e,this.processRetrieved()}get base(){return this.innerBuilder.container}fixupTimeBasedAggregationTimestamp(e){return qc(e,zc(e,Ci.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(xo.DateTime)[e],tradeSize:0,tradePrice:0};[xo.Open,xo.High,xo.Low].forEach((i=>{t.tradePrice=this.base.getData(i)[e],super.process(t)})),t.tradePrice=this.base.getData(xo.Close)[e],t.tradeSize=this.base.getData(xo.Volume)[e],super.process(t)}}process(e){return this.innerBuilder.process(e),super.process(e)}}class du{storage={};constructor(e){this.fields=e,this.clear()}clear(){this.storage={},this.fields.forEach((e=>{this.storage[e.id]=[]}))}fixupTransition(e,t){if(e!==xo.Change||!this.hasField(xo.Close)||t<1)return;const i=this.storage[e.id],s=this.storage[xo.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(xo.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(xo.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(xo.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 Oe(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 pu extends du{constructor(){super([])}get size(){return 0}}class fu extends du{constructor(e,t){super(e),this.wrapper=t}isWrapped(e){return st(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 mu=Ci.RENKO_KAGI_NAMES;function gu(e){const{Method:t,Period:i,Source:s,BrickSize:n}=ct(e);return{method:tt(t,[mu.ATR,mu.TRD,mu.PCT],mu.ATR),period:Number.isFinite(i)?i:14,source:tt(s,[mu.CLS,mu.HL],mu.CLS),brickSize:Number.isFinite(n)?n:10}}function yu(e,t,i){return e.getData(t)[i]}function Tu(e,t){const[i,s]=[xo.High,xo.Low].map((i=>yu(e,i,t))),n=yu(e,xo.Close,t-1);return Math.max(i-s,Math.abs(i-n),Math.abs(s-n))}function Su(e,t){if(e.size<t)return null;const i=t-1,s=[];s.push(yu(e,xo.High,0)-yu(e,xo.Low,0));for(let i=1;i<t;++i)s.push(Tu(e,i));let n=ve(s);for(let s=t;s<e.size;++s){n=(n*i+Tu(e,s))/t}return n}const Au=e=>xo[e],vu=["DateTime","Open","High","Low","Close","Volume"].map(Au),Pu=vu.concat(["Change","Projection","BarIndex"].map(Au));class Cu extends lu{constructor(e,t){super(),this.supportsChunks=!1,this.innerBuilder=e,this.inputs=rt(t.inputs),this.brickSize=null,this.container=new du(Pu),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,Je(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*Ci.RENKO_MAX_BARS;for(;t>0&&e<i;){const i=Tu(this.base,t);e+=Math.floor(i/this.brickSize),t--}return t}processRetrieved(){const e=gu(this.inputs),{method:t,period:i,source:s}=e;if(this.brickSize=e.brickSize,t===mu.ATR)this.brickSize=Su(this.base,i);else if(t===mu.PCT)if((this.base?.size??0)>0){const e=this.base.getLastDataPoint(xo.Close);this.brickSize=e*this.brickSize/100}else this.brickSize=null;if(!Ze(this.brickSize))return;this.refPrices=s===mu.HL?(e,t,i)=>[t,i]:(e,t,i)=>[e,e];const n={},r=this.findSafeStartIndex();for(let e=r;e<this.base.size;e++){const t=this.getBarAt(e);if(e===r){this.initFirstBrick(n,t);continue}const i=this.isLastBase(e),{climbing:s,falling:o,moveUp:a,moveDown:l}=this.getMove(n,t,i);if(!s&&!o){n.volume+=t.volume;continue}n.proj=Number(i),n.barIndex=e;const c=t.date.getTime();if(s){const e=this.getBricksCount(a);for(let t=0;t<e;++t)this.constructClimbing(n,c,t,this.brickSize);i&&(this.constructClimbing(n,c,e,a%this.brickSize),this.projectionCount=e+1)}else if(o){const e=this.getBricksCount(l);for(let t=0;t<e;++t)this.constructFalling(n,c,t,this.brickSize);i&&(this.constructFalling(n,c,e,l%this.brickSize),this.projectionCount=e+1)}i||(this.lastFinalBrick=this.container.size-1,n.volume=0)}this.container.keepOnlyLast(Ci.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(xo.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(xo.DateTime,e.date),t.addDataPoint(xo.Open,e.open),t.addDataPoint(xo.Close,e.close),t.addDataPoint(xo.High,e.high),t.addDataPoint(xo.Low,e.low),t.addDataPoint(xo.Change,e.change),t.addDataPoint(xo.Volume,e.volume),t.addDataPoint(xo.Projection,e.proj),t.addDataPoint(xo.BarIndex,e.barIndex)}updateLastDataPoint(e){const t=this.container;t.setLastDataPoint(xo.DateTime,e.date),t.setLastDataPoint(xo.Open,e.open),t.setLastDataPoint(xo.Close,e.close),t.setLastDataPoint(xo.High,e.high),t.setLastDataPoint(xo.Low,e.low),t.setLastDataPoint(xo.Change,e.change),t.setLastDataPoint(xo.Volume,e.volume),t.setLastDataPoint(xo.Projection,e.proj),t.setLastDataPoint(xo.BarIndex,e.barIndex)}}const bu=[xo.DateTime,xo.Last,xo.TradeSize,xo.Change],Eu=[xo.DateTime,xo.Open,xo.High,xo.Low,xo.Close,xo.Volume,xo.Change],_u=[...Eu,xo.OpenInterest],Mu=[..._u,xo.Symbol],Lu=[xo.Open,xo.High,xo.Low,xo.Close,xo.Change];function Ou(e,t){const i=ii(e);return t.isTick?bu:t.isMultiContract?Mu:i||t.isEndOfDay?_u:Eu}function wu(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getTime()>s.getTime()}function Iu(e,t){const{unit:i}=e;return i===C.Year?Dt(t):i===C.Quarter?Tr(t):i===C.Month?Bt(t):i===C.Week?Pr(t):i===C.Day?Nt(t):t}function Du(e,t){return t.getFullYear()-1-(t.getFullYear()-1)%e}function xu(e){return Du(10,e)}function Nu(e,t){return xu(e)===xu(t)}function Ru(e,t){return Du(100,e)===xu(t)}function Hu(e){return new Date(e*Ci.OPTIONS_DATA_INCREMENT+Ci.OPTIONS_DATA_BASE)}function Vu(e){return(e.valueOf()-Ci.OPTIONS_DATA_BASE)/Ci.OPTIONS_DATA_INCREMENT}function Fu(e,t=Ci.ZERO_DATE){const i=new Date(`${e}T00:00:00`);return ll(i)?i:t}function Bu(e,t=Ci.ZERO_DATE){const i=new Date(e.replace(" ","T"));return ll(i)?i:t}class ku{constructor(e,t,i=0){this.symbol=e,this.aggregation=t,this.offset=i||0,this.previousTime=new Date(0),this.timeZone=this.getTimeZone(),this.isFuture=Yt(e),this.needsResolution=ti(e),this.hasOpenInterest=ii(e)}makeContainer(){return new du(Ou(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(xo.DateTime,this.parseDate(e[0+t])),this.container.addDataPoint(xo.Last,parseFloat(e[3+t])),this.container.addDataPoint(xo.TradeSize,parseInt(e[4+t])),this.container.addDataPoint(xo.Change,this.calculateChange(xo.Last)))}nullify(e){return 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(xo.Symbol)&&this.container.addDataPoint(xo.Symbol,t?e[0]:this.symbol),this.container.addDataPoint(xo.DateTime,this.parseDate(e[0+i])),this.container.addDataPoint(xo.Open,parseFloat(e[2+i])),this.container.addDataPoint(xo.High,parseFloat(e[3+i])),this.container.addDataPoint(xo.Low,parseFloat(e[4+i])),this.container.addDataPoint(xo.Close,parseFloat(e[5+i])),this.container.addDataPoint(xo.Volume,this.nullify(parseInt(e[6+i]))),this.container.addDataPoint(xo.Change,this.calculateChange()))}parseEod(e){const t=this.aggregation.isMultiContract,i=7+(this.hasOpenInterest?1:0);e.length===i&&(t&&this.container.addDataPoint(xo.Symbol,e[0]),this.container.addDataPoint(xo.DateTime,this.parseDate(e[1])),this.container.addDataPoint(xo.Open,parseFloat(e[2])),this.container.addDataPoint(xo.High,parseFloat(e[3])),this.container.addDataPoint(xo.Low,parseFloat(e[4])),this.container.addDataPoint(xo.Close,parseFloat(e[5])),this.container.addDataPoint(xo.Volume,this.nullify(parseInt(e[6]))),this.hasOpenInterest&&this.container.addDataPoint(xo.OpenInterest,this.nullify(parseInt(e[7]))),this.container.addDataPoint(xo.Change,this.calculateChange()))}calculateChange(e=xo.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 C.Tick:case C.Intraday:return Bu(e);default:return Fu(e)}}parseDate(e){const t=this.parseTimestamp(e);return this.aggregation.isEndOfDay?It(t,this.offset):(wu(t,this.previousTime)?this.previousTime=t:this.previousTime=cl(this.previousTime,1),this.previousTime)}getTimeZone(){return si(this.symbol)}}const{BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:Uu,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:Wu}=Ci;class $u{constructor(){this.supportsChunks=!0}getPageNameFor(e,t){switch(e.unit){case C.Tick:return Ci.BARCHART_HIST_SRV_TICKS_PAGE_NAME;case C.Intraday:return t&&e.spec===E.Nearest?Uu:Wu;case C.Day:case C.Week:case C.Month:case C.Quarter:case C.Year:return Ci.BARCHART_HIST_SRV_EOD_PAGE_NAME;default:return""}}addExtraParams(e){}makeUrl(e){const t={},i=Di(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===C.Intraday){const e=s.spec===E.PerRange?1:s.size;t.interval=e.toString()}const[r,o]=e.range,a=null!==r,l=null!==o;if(a&&(t.start=this.toHistoricalFeedDate(r,s)),!a||e.alwaysUseBarsToFetch){let i=e.barsToFetch||Ci.DEFAULT_MAX_RECORDS;s.unit===C.Tick&&s.spec!==E.None&&(i*=Ci.TICK_CUSTOM_AGG_MULTIPLIER),t.maxrecords=i.toString()}l&&(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"),this.addExtraParams(t);const c=ht(t),u=Yt(i);return`/${this.getPageNameFor(s,u)}?${c}`}toHistoricalFeedDate(e,t){return rc(e,t.isTick||t.isIntraday?Ci.FMT_HIST_FEED_PARAM_DATE_TIME:Ci.FMT_HIST_FEED_PARAM_DATE_ONLY)}getDataParam(e){let t="";const i=this.getSpecPart(e);switch(e.unit){case C.Tick:case C.Intraday:break;case C.Day:t=`daily${i}`;break;case C.Week:t=`weekly${i}`;break;case C.Month:t=`monthly${i}`;break;case C.Quarter:t=`quarterly${i}`;break;case C.Year:t=`yearly${i}`}return t}getSpecPart(e){return e.isMultiContract?e.spec===E.Continue?"continue":"nearest":""}getParser(e){const t=Di(e.symbol);return new ku(t,e.aggregation,e.offset)}async retrieve(e){const t=this.makeUrl(e),i=e.aggregation.unit===C.Tick?"timeseriesNew":"timeseries",s=await fP(i,t);return this.getParser(e).parse(s)}}class Gu{constructor(){this.supportsChunks=!1}addExtraParams(e){}async retrieve(e){const t=Di(e.symbol),i=this.emptyContainer(t,e.aggregation);if(e.aggregation.unit!==C.Day)return i;const s={symbol:t};this.addExtraParams(s);const n=`/${this.getPageName()}.json?${ht(s)}`,r=await fP("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(e){dP(`Failed parsing the JSON result from OnDemand, error is ${e.message}`)}return i}}class zu extends Gu{emptyContainer(e,t){return new du(Ou(e,t))}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){const s=i.hasField(xo.Symbol),n=t>0?i.getLastDataPoint(xo.Close):null;i.addDataPoint(xo.DateTime,Fu(e.date)),s&&i.addDataPoint(xo.Symbol,e.symbol),i.addDataPoint(xo.Open,e.open),i.addDataPoint(xo.High,e.high),i.addDataPoint(xo.Low,e.low),i.addDataPoint(xo.Close,e.close),i.addDataPoint(xo.Volume,e.volume),i.addDataPoint(xo.OpenInterest,e.openInterest);const r=null===n?null:Je(e.close-n,2);i.addDataPoint(xo.Change,r)}}const Yu={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{constructor(){this.supportsChunks=!1}async retrieve(e){const t=Di(e.symbol).replace(/\.bz$/i,""),i=e.fields.concat(xo.DateTime),s=()=>new du(i);if(e.aggregation.unit!==C.Day)return s();const n=`/get?${ht({symbol:t,apiKey:"default",fields:i.map((e=>Yu[e.id])).join(",")})}`,r=await fP("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===xo.DateTime?t.addDataPoint(xo.DateTime,Fu(e.date)):t.addDataPoint(i,n(e[Yu[i.id]]))}))})),t}catch(e){dP(`Failed parsing options JSON historical data result, error is ${e.message}`)}return s()}}function Ku(e,t){return Ka((function(i,s){var n=0;i.subscribe(qa(s,(function(i){s.next(e.call(t,i,n++))})))}))}var qu=Xc(qc,2);function Xu(e,t){return Mt(2,arguments),Ot(e).getTime()-Ot(t).getTime()}var Zu={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function Ju(e){return e?Zu[e]:Zu.trunc}function Qu(e,t,i){Mt(2,arguments);var s=Xu(e,t)/1e3;return Ju(null==i?void 0:i.roundingMethod)(s)}function eh(e,t){Mt(2,arguments);var i=_t(t);return iu(e,-i)}class th extends uu{constructor(e,t,i){super(t,i),this.innerBuilder=e,this.isBuildingBars=!1,this.retryCountForChunk=Ci.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=[xo.DateTime,xo.TradeSize,xo.Last],[t,i,s]=e.map((e=>this.base.getData(e)));for(let e=this.startFromIndex;e<this.base.size;e++){const n={isTrade:!0,time:t[e],tradeSize:i[e],tradePrice:s[e]};super.process(n)}this.isBuildingBars=!1}process(e){const t=this.innerBuilder.process(e);return e.time=new Date(t.time),super.process(e)}}class ih extends th{constructor(e,t,i){super(e,t,i)}fixupTimeBasedAggregationTimestamp(e){return eh(e,Qu(e,Bt(vo(e,1)))%this.agg.size)}}class sh extends th{constructor(e,t,i,s){super(e,i,s),this.series=t}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}}const nh=new Oo("_TICK_COUNT");class rh extends sh{anchorTimestamp=null;constructor(e,t,i,s){super(e,t,i,s)}get startFromIndex(){let e=0;const t=this.base.getTimeData();if(Ze(this.anchorTimestamp))e=Ie(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(nh,1),i}changeLastBar(e,t){const i=super.changeLastBar(e,t),s=this.container.getLastDataPoint(nh);return this.container.setLastDataPoint(nh,s+1),i}isUpdate(e,t,i,s){return this.container.getLastDataPoint(nh)<this.agg.size}}const oh=new Oo("_VOLUME_TALLY");class ah extends sh{constructor(e,t,i,s){super(e,t,i,s)}addBar(e,t){const i=this.container,s=(i.getLastDataPoint(oh)||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(xo.Volume,o?1:n),i.setLastDataPoint(oh,s));const a=super.addBar(e,t);return i.setLastDataPoint(xo.Volume,1),i.addDataPoint(oh,o?0:r),a}changeLastBar(e,t){const i=this.container,s=super.changeLastBar(e,t);i.setLastDataPoint(xo.Volume,1);const n=i.getLastDataPoint(oh)??0;return i.setLastDataPoint(oh,n+e.tradeSize),s}isUpdate(e,t,i,s){if(!gr(e,t))return!1;const n=this.container.getLastDataPoint(oh)??0;return s.tradeSize+n<this.agg.size}}class lh extends uu{constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.range=i.size,this.step=1;let n=SP().getMetaDataSource();this.metadata=n.getMetaData(s)}get priceRange(){return this.step*this.range}get base(){return this.innerBuilder.container}ready(){return Ai.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++){const t=this.base.getData(xo.Volume)[e],i=this.useHighOrLow(e);if(!Ze(i)){this.updateLastBar(void 0,void 0,void 0,t);continue}const s={isTrade:!0,time:this.base.getData(xo.DateTime)[e],tradeSize:t,tradePrice:i};super.process(s)}}useHighOrLow(e){const t=this.base.getData(xo.Close)[e];if(0==this.container.size)return t;const i=this.container.getLastDataPoint(xo.High),s=this.container.getLastDataPoint(xo.High),n=this.base.getData(xo.High)[e],r=this.base.getData(xo.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(xo.Low)+this.priceRange;if(i>s)return this.changeAndAddBar(s,e,t);const n=this.container.getLastDataPoint(xo.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(xo.Projection,0),this.addBar(t,i)}addBar(e,t){return this.container.addDataPoint(xo.Projection,1),super.addBar(e,t)}}const ch=[xo.Open,xo.High,xo.Low,xo.Close],uh=[xo.BARCOLIX,xo.High,xo.Low],hh=Ci.RENKO_KAGI_NAMES;function dh(e){const{BoxSizeMethod:t,Period:i,ReversalAmount:s}=ct(e);return{method:tt(t,[hh.ATR,hh.TRD],hh.ATR),period:Number.isFinite(i)?i:14,reversal:Number.isFinite(s)?s:30}}class ph extends uu{isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=rt(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(xo.BARCOLIX,null),this.container.size>1){const e=this.dataAt(xo.Close,this.container.size-2);this.setLast(xo.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(xo.Close),a=r(o),l=Math.abs(o)>=this.reversal,[c,u,h,d]=ch.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(xo.Close,e)>this.dataAt(xo.Open,e),t=this.container.size;if(t>1){const i=e(t-1),[s,n,r]=uh.map((e=>this.dataAt(e,t-2))),[,o,a]=uh.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(xo.BARCOLIX,l)}else this.setLast(xo.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=dh(this.inputs),{method:t,period:i,reversal:s}=e;if(this.reversal=s,t===hh.ATR&&(this.reversal=Su(this.base,i)),Ze(this.reversal)){this.container.clear(),this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){const t={isTrade:!0,time:this.baseAt(xo.DateTime,e),tradePrice:this.baseAt(xo.Close,e),tradeSize:this.baseAt(xo.Volume,e)};this.process(t)}this.isProcessingRetrieved=!1}}}function fh(e){let{LineCount:t}=ct(e);return{lineBreak:Number.isFinite(t)?t:3}}class mh extends uu{constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.inputs=rt(s.inputs);const n=fh(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(xo.DateTime)[e],tradeSize:this.base.getData(xo.Volume)[e],tradePrice:this.base.getData(xo.Close)[e]}}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(xo.Open,n),this.container.setLastDataPoint(xo.Low,Math.min(n,i)),this.container.setLastDataPoint(xo.High,Math.max(n,i))):this.resetProjection()}resetProjection(){const e=this.container;e.setLastDataPoint(xo.High,null),e.setLastDataPoint(xo.Low,null),e.setLastDataPoint(xo.Open,null),e.setLastDataPoint(xo.Close,null),e.setLastDataPoint(xo.Change,null)}isProjection(e){return this.agg.isIntraday||this.durationAdd(e).getTime()>Date.now()}updateProjection(e,t){this.container.setLastDataPoint(xo.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(xo.Projection)){const s=i.getLastDataPoint(xo.Close);if(null===this.findOpen(s,this.lineBreak,1))return this.updateProjection(e,t);i.setLastDataPoint(xo.Projection,0),i.setLastDataPoint(xo.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(xo.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(xo.Projection,1),!0)}findOpen(e,t,i=0){if(!Ze(e))return null;const s=this.container,n=s.size-1-i,r=s.getData(xo.Close)[n],o=s.getData(xo.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(xo.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(xo.High)[n-i])return null}return o}return r}startLine(e){this.container.addDataPoint(xo.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 gh=Ci.RENKO_KAGI_NAMES,yh=1,Th=2,Sh=3;function Ah(e){switch(e){case Ci.BARKIND_O:case Ci.BARKIND_XO:return!0;default:return!1}}function vh(e){switch(e){case Ci.BARKIND_X:case Ci.BARKIND_OX:return!0;default:return!1}}function Ph(e){const t=ct(e),{Source:i,BoxSizeMethod:s,Period:n}=t,{ReversalAmount:r,BoxSize:o,OneStepBack:a}=t,l=tt(i,[gh.CLS,gh.HL],gh.CLS),c=tt(s,[gh.ATR,gh.TRD],gh.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 Ch extends uu{isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=rt(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===gh.CLS}get currentKind(){return this.getLast(xo.BARKIND)}getTrendField(e){return this.closeBased?xo.Close:e?xo.Low:xo.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(xo.Close),o=this.getTrendPrice(e,!s),a=i?this.roundToBox(this.baseAt(xo.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(xo.BARKIND,null),this.computeBarColor(),null}inplaceReverse(){const e=Ah(this.currentKind)?Ci.BARKIND_OX:Ci.BARKIND_XO;this.setLast(xo.BARKIND,e)}canInplaceReverse(){return!function(e){switch(e){case Ci.BARKIND_OX:case Ci.BARKIND_XO:return!0;default:return!1}}(this.currentKind)&&this.getLast(xo.High)===this.getLast(xo.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(xo.Close),c=a(l),u=Math.abs(l)>=this.boxSize,h=o-this.getLast(xo.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(xo.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===yh&&s>0)return[n,Ci.BARKIND_X];if(t===Th&&s<0)return[n,Ci.BARKIND_O];if(t===Sh)return[n,s>0?Ci.BARKIND_X:Ci.BARKIND_O]}}return[null,null]}findFirstBarTrend(){if(this.innerBuilder.container.size<2)return null;if(this.closeBased){const[,e]=this.findFirstDiffLargerThanBox(xo.Close,Sh);return e}{const[e,t]=this.findFirstDiffLargerThanBox(xo.High,yh),[i,s]=this.findFirstDiffLargerThanBox(xo.Low,Th);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(xo.BARKIND,e-2))?Ci.BARKIND_X:Ci.BARKIND_O}this.setLast(xo.BARKIND,t)}process(e){return this.isProcessingRetrieved||this.innerBuilder.process(e),null===this.firstTrend?null:super.process(e)}processRetrieved(){const e=Ph(this.inputs),{method:t,period:i,reversal:s,source:n,boxSize:r,oneStepBack:o}=e;if(this.reversal=s,this.source=n,t===gh.ATR?this.boxSize=Su(this.base,i):this.boxSize=r,Ze(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(xo.DateTime,e),tradePrice:this.baseAt(xo.Close,e),_highPrice:this.baseAt(xo.High,e),_lowPrice:this.baseAt(xo.Low,e),tradeSize:this.baseAt(xo.Volume,e)};this.process(t)}this.isProcessingRetrieved=!1}}}const bh=new xr(C.Intraday,0);class Eh{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 Bo(e.symbol)}getHasVisible(e){return null!=this.query.visibleRange&&null!=this.query.visibleRange[e]}get hasVisibleFrom(){return this.getHasVisible("from")}get hasVisibleTo(){return this.getHasVisible("to")}refresh(){this.query.aggregation.isEndOfDay?this.alignToQuote=!0:this.loadMoreData(!1)}makeInnerBuilder(e){const t=this.query.aggregation;if(!t.isTick)return new uu(e,t);switch(t.spec){case E.None:case E.PerSeconds:case E.PerCount:case E.PerVolume:return new cu(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 du(Ou(this.query.symbol,e).concat(t)),n=t;switch(this.query.curveStyle){case v.Renko:return new Cu(n,this.query);case v.Kagi:{const e=s(bh,[xo.BARCOLIX]);return new ph(n,e,this.query)}case v.PointAndFigure:{const e=s(bh,[xo.BARKIND]);return new Ch(n,e,this.query)}case v.LineBreak:{const e=s(i,[xo.Projection]);return new mh(n,e,i,this.query)}}if(i.isIntraday&&i.spec===E.PerRange){const e=s(bh,[xo.Projection]);return new lh(n,e,i,this.query.symbol)}const r=t;if(i.isTick)switch(i.spec){case E.PerSeconds:return new ih(r,s(bh),i);case E.PerCount:{const e=s(bh,[nh]);return new rh(r,this,e,i)}case E.PerVolume:{const e=s(bh,[oh]);return new ah(r,this,e,i)}}return i.unit===C.Day&&i.size>1?new hu(n,s(i),i):t}onStreamingUpdates(e){if(this.isLoading)return;e.map((e=>{if(e.isTrade)return this.builder.process(e);if(e.isQuote&&this.alignToQuote){const t=this.builder.alignToQuote(e);return this.alignToQuote=!1,t}return null})).filter((e=>Ze(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)je(No.TS_MANYCHANGED,{series:this,part:se.Unspecified});else{const t={series:this,index:e.index};je(e.isUpdate?No.TS_DATAPOINTCHANGED:No.TS_DATAPOINTADDED,t)}e.timeCorrection&&je(No.TS_TIMELINECORRECTION,{...e.timeCorrection,series:this})}))}get hasData(){return null!==this.container}getRetriever(){return Zt(this.query.symbol)&&this.query.aggregation.isEndOfDay?new zu:new $u}getStreamingSubscription(){return SP().getRecordSource().subject.pipe(Ku((e=>{const t=this.query.aggregation.isEndOfDay,i=Ko(No.RT_TRADE,this.record.symbol),s=e.filter(i).filter((e=>Ze(e.data.time))).filter((e=>t||"T"!==e.data.session)).map((e=>{const i={isTrade:!0,tradePrice:e.data.tradePrice,tradeSize:e.data.tradeSize,time:e.data.time};return(e=>t&&"T"===e.data.session)(e)&&delete i.tradePrice,i})).reduce(((e,t)=>{const i=Oe(e);var s;return Ze(i)&&Ze(i.tradePrice)&&Ze(t.tradePrice)&&i.tradePrice===t.tradePrice&&i.time.getTime()===t.time.getTime()?i.tradeSize+=t.tradeSize:e.push((s=t,Object.assign({},s))),e}),[]),n=Ko(No.RT_QUOTE,this.record.symbol);return s.concat(e.filter(n).map((e=>({isQuote:!0,openPrice:e.data.openPrice,highPrice:e.data.highPrice,lowPrice:e.data.lowPrice,lastPrice:e.data.lastPrice,time:e.data.tradeTime}))))})),rl((e=>e.length>0))).subscribe(this.onStreamingUpdates.bind(this))}async loadMoreData(e=!0){if(this.isLoading||!this.builder.supportsChunks||!this.retriever.supportsChunks||!this.canLoadMoreData)return Promise.resolve();this.isLoading=!0,e?await this.loadHeadChunk():await this.loadTailChunk(),this.isLoading=!1}async loadTailChunk(){const e=this.query.duplicate();let t=this.builder.getLastDate();Ze(e.offset)&&0!==e.offset&&(t=It(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;je(No.TS_MANYCHANGED,{series:this,part:se.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);Ze(s.offset)&&0!==s.offset&&(n=It(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),je(No.TS_MANYCHANGED,{series:this,part:se.Head}))}async applyNearbyFixup(e){const t=this.query.aggregation,i=t.spec===E.Nearest,s=this.query.symbol,n=Yt(s);return!n||!t.isMultiContract||!i||e.size<1||this.serverComputedSeries?n&&ti(s)?await Gt(s):s:e.getLastDataPoint(xo.Symbol)}async ready(){return Ai.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=SP().getRecordSource().getRecord(t)),this.canLoadMoreData=!this.hasVisibleFrom&&e.size>0,this.builder=this.makeBuilder(e),await this.builder.ready(),this.container=this.builder.container,this.query.disableStreamingUpdates||(this.streamingSubscription=this.getStreamingSubscription()),!0}))}getCacheableEntities(e){e.add(this)}shutdown(){Ze(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class _h{constructor(e,t=!1){this._pretendEmpty=t,this.query=e,this.container=new pu}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 Mh{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.canLoadMoreData=!0,this.isLoading=!0,this.container=null,this.supplyCustomDemoData="DemoSite"===SP().config.mode}refresh(){}loadMoreData(e){throw new Error("Should not be called.")}get hasData(){return null!==this.container}shutdown(){}parseEvents(e){const t=new du([xo.DateTime,xo.Dividends,xo.Earnings,xo.Splits,xo.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=Fu(i[1]);t.addDataPoint(xo.DateTime,n),s(xo.Dividends,"Dividend",i[2],i[3]),s(xo.Earnings,"Earnings",i[2],i[3]),s(xo.Splits,"Split",i[2],i[3]),this.supplyCustomDemoData?s(xo.Custom,"Custom","Custom",Ci.FAKE_CUSTOM_EVENT):s(xo.Custom,"Custom",i[2],i[3])})),t}makeUrl(){const e={};e.symbols=this.query.symbol,e.start="19700102",e.end="20501230",Ci.EVENTS_BUILT_IN.forEach((t=>e[t]=this.query[t]));return`/queryevents.ashx?${ht(e)}`}async retrieve(){const e=this.makeUrl(),t=await fP("timeseries",e);return this.parseEvents(t)}async ready(){return Ai.call(this,(async()=>(this.container=await this.retrieve(),this.isLoading=this.canLoadMoreData=!1,!0)))}getCacheableEntities(e){e.add(this)}}class Oh{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 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 du(this.query.fields.concat(xo.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(xo.DateTime,Fu(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===C.Quarter?"Quarter":"Annual";const t=ht(e);return`/${this.query.seriesKind===$.BalanceSheet?"getBalanceSheets":"getIncomeStatements"}.json?${t}`}async retrieve(){const e=this.makeUrl(),t=await fP("ondemand",e);return this.parseFundamental(t)}async ready(){return Ai.call(this,(async()=>(this.container=await this.retrieve(),!0)))}getCacheableEntities(e){e.add(this)}}function wh(e,t){const i=e.findIndex((e=>e>t));return Math.max(i<0?e.length:i,0)}class Ih{setSymbols(e){const t=SP().getRecordSource();this.records=e.reduce(((e,i)=>{const s=t.getRecord(i);return this.addFieldsToRecord(s,i),e[i]=s,e}),{})}getStreamingSubscription(){return SP().getRecordSource().subject.pipe(rl((e=>e.length>0))).subscribe(this.onStreamingUpdates.bind(this))}onStreamingUpdates(e){e.forEach((e=>{const t=e.data,i=this.records[t.symbol];Ze(i)&&this.process(i)})),this.notifyAboutUpdates()}async retrieve(){const e=Object.values(this.records);return(await Promise.all(e.map((e=>e.ready())))).every(Te)&&(this.onRecordsReady(),e.forEach((e=>this.process(e))),this.streamingSubscription=this.getStreamingSubscription()),this.hasData}async ready(){return Ai.call(this,(async()=>await this.retrieve()))}shutdown(){Ze(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class Dh extends Ih{symbols=[];constructor(e){super(),this.symbols=e,this.setSymbols(e)}addFieldsToRecord(e,t){e.addFields(xo.Symbol),e.update(xo.Symbol,t)}notifyAboutUpdates(){je(No.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(xo.Close)}}class xh extends Ih{canLoadMoreData=!1;isLoading=!1;constructor(e){super(),this.query=e,this.setSymbols(e.symbols),this.dataPoints=e.symbols.length,this.container=null,this.fields=[xo.DateTime,xo.Close,xo.Symbol]}addFieldsToRecord(e,t){e.addFields(xo.DateTime,xo.Symbol),e.update(xo.DateTime,ri(t)),e.update(xo.Symbol,t)}refresh(){}loadMoreData(e){throw new Error("Should not be called.")}get hasData(){return null!==this.container&&this.container.size===this.dataPoints}notifyAboutUpdates(){je(No.TS_MANYCHANGED,{series:this,part:se.Unspecified})}onRecordsReady(){this.container=new du(this.fields)}findOrAddIndex(e){let t=this.container.getData(xo.Symbol).indexOf(e.symbol);if(t<0){const i=this.container.getData(xo.DateTime),s=ri(e.symbol);t=wh(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(xo.Last)??i}));if(!Pe(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 Nh{canLoadMoreData=!1;isLoading=!1;constructor(e){this.query=e,this.fields=[xo.DateTime,xo.Close,xo.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(xo.DateTime),r=ri(t),o=wh(n,r);s(o,xo.DateTime,r),s(o,xo.Close,i),s(o,xo.Symbol,t)}parseHistoricalForward(e){const t=new du(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=ye(qu(this.query.offset),ou(Ci.FMT_HIST_FEED_PARAM_DATE_ONLY))(new Date);return`/querylatesteod.ashx?${ht(e)}`}async retrieve(){const e=this.makeUrl(),t=await fP("timeseries",e);return this.parseHistoricalForward(t)}async ready(){return Ai.call(this,(async()=>(this.container=await this.retrieve(),!0)))}getCacheableEntities(e){e.add(this)}}class Rh extends Eh{constructor(e){super(e)}getRetriever(){return new ju}onStreamingUpdates(e){}}class Hh{constructor(e=!1){this.cacheSeries=e,this.seriesCache=new Map}getTimeSeries(e){return Ze(e.symbol)&&e.symbol===Ci.PLACEHOLDER_SYMBOL_NAME?new _h(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,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 $.Normal:return new Eh(e);case $.BalanceSheet:case $.IncomeStatement:return new Oh(e);case $.Events:return new Lh(e);case $.Forward:return new xh(e);case $.HistoricalForward:return new Nh(e);default:case $.Options:return new Rh(e);case $.Study:throw new Error(`The series kind '${$[e.seriesKind]}' is not supported yet.`)}}}var Vh={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"}},Fh=function(e,t,i){var s,n=Vh[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},Bh={date:zl({formats:{full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:zl({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:zl({formats:{full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},kh={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},Uh={code:"fr",formatDistance:Fh,formatLong:Bh,formatRelative:function(e,t,i,s){return kh[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:Kl({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:Kl({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:Kl({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:Kl({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:Kl({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:Jl({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e)}}),era:ql({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:ql({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:ql({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:ql({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:ql({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 Wh(e){Mt(1,arguments);var t=Ot(e),i=t.getDay();return i}function $h(e){Mt(1,arguments);var t=Ot(e),i=t.getMinutes();return i}function Gh(e){Mt(1,arguments);var t=Ot(e);return t.setMinutes(0,0,0),t}function zh(e,t){Mt(2,arguments);var i=Gh(e),s=Gh(t);return i.getTime()===s.getTime()}function Yh(e){Mt(1,arguments);var t=Ot(e);return t.setSeconds(0,0),t}function jh(e,t){Mt(2,arguments);var i=Yh(e),s=Yh(t);return i.getTime()===s.getTime()}const Kh=/{value:([^}]+)}/,qh=/%([aAdewbBmyYHkIlMpPSL])+/g;let Xh;var Zh;(Zh=Xh||(Xh={}))[Zh.Second=0]="Second",Zh[Zh.Minute=1]="Minute",Zh[Zh.Hour=2]="Hour",Zh[Zh.Day=3]="Day",Zh[Zh.Week=4]="Week",Zh[Zh.Month=5]="Month",Zh[Zh.Year=6]="Year";const Jh={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]}};function Qh(){const e=Object.keys(Jh);return 1===Jh.Day.Multipliers[0]&&e.forEach((e=>{const t=Jh[e],i=mt(t.Period);t.One=1*i,t.Multipliers=t.Multipliers.map((e=>e*i))})),Jh}function ed(e){switch(e.agg.unit){case C.Tick:return new ld(e);case C.Intraday:return new cd(e,e.agg.size);case C.Day:return new ud(e);case C.Week:return new hd(e);case C.Month:case C.Quarter:return new dd(e);case C.Year:return new pd(e);default:throw new Error(`Aggregation unit ${C[e.agg.unit]} not supported.`)}}const td=new Map;function id(e){if(!Ze(e))return null;if(!td.has(e)){const i=Ze(t=e)?t.replace(Kh,((e,t)=>t.replace(qh,((e,t)=>Ci.PHP_TO_UNICODE_TS_35_MAP[t])))):t;td.set(e,i)}var t;return td.get(e)}class sd{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=id(i),this.prevDate=null}get noPrevDate(){return!Ze(this.prevDate)}formatDate(e,t){return vd(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 nd="yyyy",rd="LLL ''yy",od=()=>Ad()?"d LLL":"LLL d",ad="HH:mm";class ld extends sd{constructor(e){super(e),this.repeatEach=Ci.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(!gr(this.prevDate,e))return this.asTick(e,1,"EEE");if(!zh(this.prevDate,e))return this.asTick(e,2,ad);this.repeatCounter++;const t=this.repeatCounter===this.repeatEach;return!jh(this.prevDate,e)||t?this.asTick(e,t?4:3,ad):null}}class cd extends sd{getTick(e){const t=this.checkPrev(e),i=0===this.minTickInterval||0==(e=>Qu(e,Nt(e)))(e)%(this.minTickInterval/1e3),s=!gr(this.prevDate,e),n=$h(e),r=!zh(this.prevDate,e)||t&&0===n;if(i){if(s)return this.asTick(e,1,od());if(r)return this.asTick(e,2,ad);if(0==n%30&&this.size<15)return this.asTick(e,3,ad);if(0==n%15&&this.size<=5)return this.asTick(e,4,ad)}return null}}class ud extends sd{constructor(e){super(e),this.monthDay=this.duration<22*Jh.Day.One,this.monthYear=this.duration>22*Jh.Day.One&&this.duration<7*Jh.Month.One,this.year=this.duration>7*Jh.Month.One}useTuesday(e){return!!this.noPrevDate||2===Wh(e)&&Xu(e,this.prevDate)>1728e5}getTick(e){this.checkPrev(e);const t=!yr(e,this.prevDate),i=!br(e,this.prevDate);return this.monthDay?1===Wh(e)||this.useTuesday(e)?this.asTick(e,1,od()):null:this.monthYear?t?this.asTick(e,1,rd):null:this.year&&i?this.asTick(e,1,nd):null}}class hd extends sd{constructor(e){super(e),this.monthDay=this.duration<4*Jh.Week.One,this.monthYear=this.duration>4*Jh.Week.One&&this.duration<6*Jh.Month.One,this.year=this.duration>6*Jh.Month.One}getTick(e){this.checkPrev(e);const t=!yr(e,this.prevDate),i=!br(e,this.prevDate);return this.monthDay?this.asTick(e,1,od()):this.monthYear?t?this.asTick(e,1,rd):null:this.year&&i?this.asTick(e,1,nd):null}}class dd extends sd{constructor(e){super(e),this.showMonths=this.duration<7*Jh.Month.One}getTick(e){this.checkPrev(e);const t=!br(e,this.prevDate);return this.showMonths?this.asTick(e,1,rd):t?this.asTick(e,1,nd):null}}class pd extends sd{constructor(e){super(e)}getTick(e){this.checkPrev(e);return!br(e,this.prevDate)?this.asTick(e,1,nd):null}}function fd(e){return Vu(e).toString()}function md(e){return Ze(e)?`${e.toFixed(2)}%`:""}function gd(e,t,i=!1){const s=e.plots[0],n=s.curves[0],r=Ze(n)&&n.fields.length>0?n.fields[0]:null;if(!Ze(r))return"";const o={range:e.fullDomain,allDigits:!1,forceTrailingZeros:i};return $d(s,e.pane.presenter,o),s.metaData.format(t,r,o)}function yd(e,t,i=!1){return e.comparison===V.Percent?md(t):gd(e,t,i)}function Td(e,t,i){const s=e.view?.xAxis?.overrideFormatter;if(s)return s(t);if(Ze(e.display.xAxis.isOrdinal))return fd(t);const n=i||e.display.xAxis.format;if(Ze(n)){return vd(t,id(n))}const r=e.data.aggregation,o=e.display?.xAxis?.nonEodLabelWithDate??!1;return r.isEndOfDay?Pd(r,t):Cd(r,t,o)}function Sd(){const e=nt(SP().config,null,"overrides","xAxis","getLocaleName");if(Ze(e)&&"function"==typeof e)try{return e()}catch(e){dP(`Failed retrieving the locale name, error is ${e.message}`,"warn")}}function Ad(){return"fr"===Sd()}function vd(e,t){return rc(e,t,function(){if("fr"===Sd())return{locale:Uh}}())}function Pd(e,t){if(!ll(t))return"";switch(e.unit){case C.Tick:case C.Intraday:case C.Day:case C.Week:default:return vd(t,"P");case C.Month:return vd(t,"LLL yyyy");case C.Quarter:return vd(t,"qqq yyyy");case C.Year:return vd(t,"yyyy")}}function Cd(e,t,i){if(!ll(t))return"";return vd(t,`${i?"P ":""} ${e.isTick?"pp":"p"}`)}const bd=(e,t)=>e.at(t);class Ed{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+Ci.TIMELINE_PROLOG_PADDING_BARS}get withPrologEpilogLength(){return this.withPrologLength+Ci.TIMELINE_EPILOG_PADDING_BARS}get firstSeriesIndex(){return Ci.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<Ci.TIMELINE_PROLOG_PADDING_BARS){const t=we(this._dates),i=e-Ci.TIMELINE_PROLOG_PADDING_BARS;return this.applyDateShift(t,i)}if(e>=this.withPrologLength){const t=Oe(this._dates),i=e-this.withPrologLength+1;return this.applyDateShift(t,i)}return this._dates[e-Ci.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=xe(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=xe(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 e=t.length-1;e>=0;e--)this._dates[e]=t[e];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 C.Year:return wt(e,12*t);case C.Quarter:return wt(e,3*t);case C.Month:return wt(e,t);case C.Week:return Kc(e,7*t);case C.Day:return Kc(e,t);case C.Intraday:return cl(e,s*t*Ci.ONE_MINUTE_MILLIS);case C.Tick:return cl(e,1e3*t)}}}const _d={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 Md(e){return!0===SP().config.useAllFieldsForComparison&&e.mainPlot.mainCurve.isOhlc&&e.mainAxis.comparison===V.None&&e.mainPane.axes.map((e=>e.plots)).flat().reduce(((e,t)=>e+(t.isSymbol?1:0)),0)>1}function Ld(e){const t=yi(e,"div");fi(t,{class:Ci.SVG_ICONS_DOM_NODE});const i=Object.keys(_d).map((e=>`<symbol id="${Dd(e)}" viewBox="0 0 1024 1024">${_d[e]}</symbol>`)).join("");t.innerHTML=`<svg style="display:none" xmlns="http://www.w3.org/2000/svg" version="1.1"><defs>${i}</defs></svg>`}const Od=new xr;function wd({plots:e,isMultiSymbol:t,isMultiContract:i,date:s,time:n,dateFieldName:r,hideSymbols:o,revealingClose:a}){const l=o&&a,c=[Rd(r,s,null,"heading"),n?Rd("Time",n,null,"heading"):""],u=e.map((e=>{if(0===e.values.length)return null;const s=(e=>!o&&((t||i)&&e.type===U.Symbol||t&&e.type===U.Expression&&e.isMain))(e)?Hd(U[e.type],e.name,e.values[0].color):"",n=e.values.map((t=>Rd(t.id===xo.Close.id&&l?e.description:t.longName,t.value,t.color)));if(e.events&&e.events.length){const t=e.events.map((e=>Hd(`${e.field.name} (${Pd(Od,e.date)})`,e.value,e.color)));n.push(...t)}return n.unshift(s),Ze(e.unalignedDate)&&n.unshift(Rd("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 Id(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)),f=e.mainPlot.axis.pane.id===h.id,m=a&&f?`<span class="field-name" style="padding-right:5px">${i} ${s||""}</span>`:"",g=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:f,isMain:m}=e,g=a.display.tooltip,y=h||d,T="value-title"+(m?" value-main":""),S=U[u],A=["Study","BalanceSheet","IncomeStatement"].includes(S)||"Expression"===S&&!i,v=!A||a.hasLegend&&i?"":Fd(l),P=function(e,t){const i=xd(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),C=o?function(e){const t=xd("moreActions");return`<a class="more-actions" data-plot-id="${e}" data-act="Menu" title="Actions">${t}</a>`}(l):"",b=Md(a)&&e.type===U.Symbol,E=(m||b)&&(!s||e.values.length>1),_=e=>E?e.abbreviation:"Close"===e.id&&r?d+" ":null,M=t?p.map((e=>Vd(_(e),e.value,e.color))).join(" ")+function(e){if(e&&e.length){return`Event ${e.map((e=>Vd(`${e.field.name} (${Pd(Od,e.date)})`,e.value,e.color))).join(" ")}`}return""}(f):"",L=p.length>0?`<div class="box" style="background-color:${e.values[0].color}"></div>`:"",O=t?"":L,w="Name"===g.mainTitle?c:d,I=n?e.visible&&t?"":`${d}`:`${w}`;let D=s&&b?`${d} (${I})`:I;g.showMainTitle||(D="");const x=()=>{const e=a.data?.aggregation.toShortString(),t=a.data?.aggregation.describe();return`<span class="value-main" title="${t}">·${e}·</span>`},N=e.isMain?x():"";return`\n <div class="plot">\n ${v} ${P} ${C} ${O}\n <a class="${T}" ${y?`title="${y}" `:""}data-plot-id="${l}">${D}</a>\n ${N} ${M}\n </div>\n `.trim()}(t,o,f,n,l,c,u,e))),y=`${m}${g.join("")}`,T=function(e,t){const i=e>0,s=e<t-1;return[`${i?Nd(!0,e):""}`,`${s?Nd(!1,e):""}`].join(" ").trim()}(d,t.length);return{id:`bc-tip-${h.id.substring(0,8)}`,isMainPane:f,content:y,moveContent:T,bounds:h.bounds}}))}function Dd(e){return`bchart-icon-${e}`}function xd(e,t=null,i=10){return`<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="${i}px" height="${i}px" ${Ze(t)?`style="fill:${t}"`:""}><use xlink:href="#${Dd(e)}"></use></svg>`}function Nd(e,t){const i=e?"Up":"Down";return`<span data-pane="${t}" data-dir="${i}" title="Move ${i}" class="move-pane">${xd(`chevron${i}`)}</span>`}function Rd(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 Hd(e,t,i=null){return Rd(e,t,i,"value-title")}function Vd(e,t,i){const s="string"==typeof i?` style="color: ${i}"`:"";return`${Ze(e)?`<span class="field-name">${e}</span>`:""}<span${s} class="field-value">${t}</span>`}function Fd(e){return`<a class="delete-plot" data-plot-id="${e}" title="Delete plot">${xd("delete")}</a>`}function Bd(e,t){Mt(2,arguments);var i=_t(t);return It(e,-i)}function kd(e,t,i,s,n,r){const o=function(e,t){const i=e.data.aggregation,s=e.display.xAxis,n=s.isOrdinal,r=Xe(n)&&n,o=r?s.ordinalName??"Value":"Date";return{date:r?fd(t):Pd(i,t),time:i.isEndOfDay||r?null:Cd(i,t,!1),isMultiSymbol:Gd(e),isMultiContract:i.isMultiContract,dateFieldName:o}}(e,t);o.offset=i,o.lastBarRefresh=!!s||!1,o.chartId=e.elementId;const a=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 o=n.timeSeries.container,a=n.type===U.Expression,l=n.axis.comparison!==V.None,c=n.axis.comparison===V.Percent,u=(e,s)=>n.customPlotValues&&s!==xo.DateTime?[n.getValueAt(s,t,i),0]:Wd(e,s,t,l),h=n,d=r?`${Vn(h.model.study).meta.title} ${h.fullParams}`:n.metaData.name||"",p={isMain:n.main,type:n.type,typeName:U[n.type],name:n.title,description:d,exchange:n.metaData.exchange||"",error:h.errorText,id:n.id,visible:n.visible};if(Ze(h.yearOffset)&&0!=h.yearOffset){const i=e.data.aggregation,s=Bd(t,h.yearOffset);p.unalignedDate=Pd(i,s)}const f=n.curves[0];s&&n.type===U.Symbol&&o.hasField(xo.Symbol)&&(t.valueOf()===Ci.ZERO_DATE.valueOf()?p.name=n.timeSeries.container?.getLastDataPoint(xo.Symbol):p.name=u(f,xo.Symbol)[0]);const m={},g={range:n.axis.yScale.domain(),allDigits:!0};$d(n,e,g);const y=(e,t)=>{const i=(t===xo.Change||t===xo.PercentChange)&&e>0?"+":"";return c?i+md(e):i+n.metaData.format(e,t,g)},T=Md(e),S=new Set;return p.values=n.curves.filter((e=>e.visible)).map((e=>(!n.main&&n.isSymbol&&T?Lu:e.fields).map((t=>{if(S.has(t))return null;S.add(t);const[i,s]=u(e,t),o=n.axis.yScale.priceToY(i);m[t.id]=!0;const l=n.customPlotValues?h.getColorOf(t):e.getColor(s,e.style!==v.HollowCandles,t);let c=y(i,t).trim();if(Ze(i)&&t===xo.Change){const[t]=u(e,xo.PercentChange);Ze(t)&&(c+=` (${y(t,xo.PercentChange)})`)}return{abbreviation:zd(t),shortName:t.shortName,id:t.id,name:t.name,longName:a&&!p.isMain?n.title:`${t.shortName} ${r?h.params:""}`.trim(),color:us(l),val:i,y:o,value:c}})).filter((e=>null!==e)))).flat(),p.events=n.findEvents(u(f,xo.DateTime)).filter((e=>e.field!==xo.Custom)),p}(e,t,r,o,i))).filter((e=>null!==e));return o.panes=e.panes.map((e=>({bounds:Ud(e),id:e.id,plots:a(e)}))),o}function Ud(e){const t=e.getBounds();if(!Ze(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 Wd(e,t,i,s=!1){const n=e.plot,r=n.timeSeries.container,o=n.axis.pane.presenter.timeline,a=xe(o,+i,Number,bd),l=o.at(a-e.shift);if(null===l)return[null,0];const c=r.getTimeData(),u=xe(c,+l,Number);return[!c[u]||c[u].getTime()!==l.getTime()?null:e.dataAt(t,u,!s),u]}function $d(e,t,i){Ze(e.precision)?i.overridePrecision=e.precision:e.isStudy&&Ze(t.mainPlot?.precision)&&!Ze(Vn(e.model.study).meta.decimals)&&(i.overridePrecision=t.mainPlot.precision)}function Gd(e){const t=e.mainPlot.symbol;return e.allPlots.some((e=>e.type===U.Symbol&&e.symbol!==t))}function zd(e){return e.id===xo.Change.id?"Δ":e.id.substring(0,1)}class Yd{fields=[];colors=[];style=v.Line;attributes=[];_shift=0;lineWidth=1;dashStyle="Solid";varyColorPerBar=!1;visible=!0;constructor(){this.id=yt(),this.plot=null}get shift(){return this._shift}set shift(e){this._shift=Ze(e)?e:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&this.fields.includes(xo.Close)}get name(){return this.isOhlc?"":this.fields[0].name}get isHeikinAshiStyle(){return this.style===v.HeikinAshi}get isCandle(){return this.style===v.Candlestick||this.style===v.HollowCandles||this.style===v.HeikinAshi}get isHollowCandles(){return this.style===v.HollowCandles}get isElderImpulseSystemStyle(){return this.style===v.ElderImpulseSystem}get isPercentChangeStyle(){return this.style===v.PercentChange}get isOhlcStyle(){return this.style===v.OHLC}get isHlcStyle(){return this.style===v.HLC}get isRangeStyle(){return this.style===v.Range}get isRenko(){return this.style===v.Renko}get isKagi(){return this.style===v.Kagi}get isPointAndFigure(){return this.style===v.PointAndFigure}get isLineBreak(){return this.style===v.LineBreak}get isBaseline(){return this.style===v.Baseline}get isLineLike(){return[v.Line,v.Area,v.Baseline,v.PercentChange].includes(this.style)}get isColumn(){return this.style===v.Column}get isMultiColumn(){return this.style===v.MultiColumn}get isStackedColumn(){return this.style===v.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=>S[e]))),this.colors=e.colors,this.fields=e.fields.map((e=>xo[e])),this.style=v[e.style],this.lineWidth=e.lineWidth,this.dashStyle=e.dashStyle,this.lineMarker=e.lineMarker,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(V.None),n=e===xo.PercentChange,r=e===xo.Change,o=n||(!i||s)&&r,a=this.timeSeries.container.hasField(xo.Last)?xo.Last:xo.Close,l=o?a:e,c=(e,t)=>{const i=this.timeSeries.container.getData(e)[t];return e.type!==O.Number?i:this.plot.priceMapper(i,t,e)},u=c(l,t);if(!o)return u;if(t<=1)return 0;const h=c(l,t-1),d=u-h;return n?0===h?0:d/h:d}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(!Ze(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(!Ze(t))return null;const i=this.yScale.domain();if(!Ze(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]=Wd(this,this.pickMainField(),t);if(!Ze(s))return;e.save(),As(e,this.plot.axis.pane.getBoundsWithoutScales()),e.fillStyle=us(this.getColor(n)),e.beginPath();ap(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 o=i.container.getTimeData(),a=this.shiftedTimeDomain[0],l={bar:this.view.xAxis.xScale.bar,domain:n,range:r,slice:s,start:xe(o,+a,Number)||0},c=Ze(this.zones);this.isOhlc?rp.call(this,e,l):this.isRenko||this.isLineBreak?Qd.call(this,e,l):this.style===v.Ribbon?this.varyColorPerBar?mp.call(this,e,l):fp.call(this,e,l,this.colors[0]):this.style===v.Area?c?Xd.call(this,e,l,Kd,!0):Kd.call(this,e,l,this.colors,!0):this.isColumn||this.isMultiColumn?c?Xd.call(this,e,l,tp,!0):tp.call(this,e,{...l,range:[null,null]}):this.isStackedColumn?ep.call(this,e,l):this.isBaseline?Jd.call(this,e,l):this.style===v.Step?c?Xd.call(this,e,l,sp):sp.call(this,e,l,this.colors[0]):this.isKagi?dp.call(this,e,l):this.isPointAndFigure?pp.call(this,e,l):this.style===v.Dots?ip.call(this,e,l):this.style===v.Line||this.isPercentChangeStyle?c?Xd.call(this,e,l,lp):this.varyColorPerBar?up.call(this,e,l):lp.call(this,e,l):dP(`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(xo.Last)?xo.Last:this.fields.includes(xo.Close)?xo.Close:this.fields[0]}get zoneColors(){if(!Ze(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?us(e[0]):e[1]}getComputedColor(e){if(!this.timeSeries.container.hasField(xo.BARCOLIX))return null;const t=this.dataAt(xo.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(xo.Open,e),s=this.dataAt(xo.High,e),n=this.dataAt(xo.Low,e),r=this.dataAt(xo.Close,e),o=this.dataAt(xo.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=Ze(s),o=Ze(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===E.None||(i.open=this.dataAt(xo.Open,e),i.close=this.dataAt(xo.Close,e)),i.change=this.dataAt(xo.Change,e)}let s;const n=function(e,{open:t,close:i,change:s},n){const r=n.length>2&&e!==v.HLC,o=Ze(t,i),a=o&&i>t,l=o&&i===t,c=s>0,u=0===s;return{useSame:r,isUp:a,isSame:l,isUpPrev:c,isSamePrev:u,isDown:!a&&!l,isDownPrev:!c&&!u}}(this.style,i,this.colors),r=this.getComputedColor(e);switch(this.style){case v.Candlestick:case v.Renko:case v.LineBreak:case v.Range:case v.HeikinAshi:case v.OHLC:case v.HLC:case v.Column:{if(Ze(r)){s=r;break}let t=n.useSame?n.isUp:n.isUp||n.isSame,i=n.isSame;const o=this.attributes||[],a=this.plot.isStudy&&!["HASMO","VOL","MAVOL"].includes(this.plot.model.study);if((o.includes(S.ChangeBased)||a)&&(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(xo.Projection,e)&&(s=fs(.5,!0)(s))}break}case v.ElderImpulseSystem:s=this.colors[this.dataAt(xo.BREL,e)];break;case v.HollowCandles:{const e=this.colors[n.isUpPrev||n.isSamePrev?1:0];s=t&&(n.isUp||n.isSame)?Ci.COLOR_TRANSPARENT:e;break}case v.Line:case v.PercentChange:case v.Ribbon:case v.Kagi:if(Ze(r)){s=r;break}s=this.colors[0];break;case v.PointAndFigure:{const t=vh(this.dataAt(xo.BARKIND,e))?1:0;s=this.colors[t];break}default:throw new Error(`Unexpected style ${v[this.style]} for a curve with varying colors`)}return Ze(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===v.Area?this.pickAreaStroke(s):s.length>0?s[0]:this.colors[0]}{const e=e=>e===i;return(this.isMultiColumn||this.isStackedColumn)&&Ze(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 jd([e,t],i,s){let n=i;const r=this.timeSeries.container.size;for(let i=e;i<=t;i++){for(;this.timeSeriesAt(n)<this.timelineAt(i-this.shift)&&n<r;)++n;if(n===r)break;const e=this.timeSeriesAt(n)>this.timelineAt(i-this.shift);s.call(this,n,e)}}function Kd(e,t,i,s=!1){lp.call(this,e,t,this.pickAreaStroke(i)),gp.call(this,e,t,i[0],s)}function qd(e,t){const i=Ze(e),s=Ze(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 vs(o.x,s,o.width,i-s)}else n=this.priceToY(e),r=new vs(o.x,o.y,o.width,n-o.y);else n=this.priceToY(t),r=new vs(o.x,n,o.width,o.y+o.height-n);return[n,r]}function Xd(e,t,i,s=!1,n){let r;this.zones.forEach(((o,a)=>{const l=o.value,[c,u]=qd.call(this,r,l);e.save(),As(e,u),s&&(t.range=[null,c]);let h=this.zoneColors[a];if(o.gradient){const t=((e,t)=>{const i=fs(.6)(e),s=ms(.6)(e),n="linLighten"===t;return[n?s:i,e,n?i:s]})(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 Ze(n)&&(h=n(a,h));i.call(this,e,t,h),e.restore(),r=l}))}function Zd(e,t){const{x:i,width:s}=this.pane.getBoundsWithoutScales();e.save(),e.lineWidth=1,e.strokeStyle="#888",e.setLineDash(cs("dot")),Rs(e,t,i,i+s),e.restore()}function Jd(e,t){const[i,s]=t.range,{baseLevel:n}=function(e){const{BaseLevel:t}=ct(e);return{baseLevel:Number.isFinite(t)?Tt(0,100,t):50}}(this.plot.inputs),r=(i-s)*n/100+s;this.zones[0].value=this.yToPrice(r),Zd.call(this,e,r);Xd.call(this,e,t,Kd,!0,((t,n)=>{const o=1===t,a=hs(n,0),l=e.createLinearGradient(0,o?i:s,0,r);return l.addColorStop(0,n),l.addColorStop(1,a),[l,hs(n,1)]}))}function Qd(e,{bar:t,slice:i,start:s}){let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;jd.call(this,i,s,((i,s)=>{if(!s){const[s,r]=[xo.Open,xo.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 ep(e,{bar:t,slice:i,start:s}){if(!this.isFirstVisibleOfStyle())return!1;let n=this.view.xAxis.xScale.range()[0]+t.offset;const r=ks();r.prolog(e);const o=this.plot.curves.filter((e=>e.isStackedColumn));jd.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),Ze(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 tp(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=ks();u.prolog(e),jd.call(this,i,s,((i,s)=>{s||l.forEach(((t,s)=>{const n=this.dataAt(t,i);if(Ze(n)){Ze(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 ip(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||Ci.CURVE_STYLE_DOTS_RADIUS),o=2*Math.PI;e.beginPath(),jd.call(this,i,s,((i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(Ze(s)){const t=this.priceToY(s);e.moveTo(n+r,t),e.arc(n,t,r,0,o)}}n+=t.totalWidth})),e.fill()}function sp(e,{bar:t,slice:i,start:s},n){let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;const o=ks();o.prolog(e),e.strokeStyle=n,e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(cs(this.dashStyle)),e.beginPath();let a=!1,l=null;jd.call(this,i,s,((i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(Ze(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(Ze(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 np=[xo.Open,xo.High,xo.Low,xo.Close];function rp(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=ks();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===gs(l).a;e.strokeStyle=m?c:l,op(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(),op(e,c,u,t,o,r,p)}(e,t,this.lineWidth,!this.isHlcStyle)};jd.call(this,i,s,((e,i)=>{if(!i){const i=np.map((t=>this.dataAt(t,e))),[s,n,d,p]=i;if(Ze(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);(!Ze(a)||m<a)&&(a=m,c=f),(!Ze(l)||g>l)&&(l=g,u=f),h(f)}}r+=t.totalWidth})),n&&(Ze(c)&&(c.isMin=!0,h(c)),Ze(u)&&(u.isMax=!0,h(u))),o.epilog(e)}function op(e,t,i,s,n,r,o,a=3){t&&Ds(e,{x:s,y:n+a},o,0,Math.PI),i&&Ds(e,{x:s,y:r-a},o,0,Math.PI,!0)}function ap(e,t,i,s,n=1){const r=Ci.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 lp(e,{bar:t,slice:i,start:s},n=null){const r=n||this.getColor(0),o=Xe(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();jd.call(this,i,s,((i,s)=>{if(!s){const t=this.dataAt(c,i);if(Ze(t)){const i=this.priceToY(t);o&&ap(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(cs(this.dashStyle)),cp(e,l,r)}function cp(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 up(e,{bar:t,slice:i,start:s}){e.lineWidth=this.lineWidth,e.lineCap="square",this.dashStyle&&e.setLineDash(cs(this.dashStyle));let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,r=null,o=null,a=[];jd.call(this,i,s,((i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(Ze(s)){const t=this.priceToY(s);o=this.getColor(i),r!==o&&(cp(e,a,r),a.length>0&&(a=[a.pop()]),r=o),a.push({x:n,y:t})}}n+=t.totalWidth})),cp(e,a,o)}const hp=[null,null,null,null];function dp(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=ks();r.prolog(e);let o=null,a=null,l=[];jd.call(this,i,s,((i,s)=>{if(!s){const s=e=>np.map((t=>this.dataAt(t,e))),[c,u,h,d]=s(i),[,p,f]=i<0?hp:s(i-1);if(Ze(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 T=Ze(o)&&o!==a,S=c===u?1:2,A=c===u?2:1;l.push({x:m,y:g[0]}),l.push({x:s,y:g[S]}),T&&(l.push({x:s,y:y}),cp(e,l,o),l=[]),T&&l.push({x:s,y:y}),l.push({x:s,y:g[A]}),o=a}}n+=t.totalWidth})),cp(e,l,a),r.epilog(e)}function pp(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=ks();a.prolog(e);const l=this.plot.timeSeries.builder.boxSize,c=l/2;jd.call(this,i,s,((i,s)=>{if(!s){const[t,s]=[xo.High,xo.Low].map((e=>this.dataAt(e,i))),n=this.colors[0],u=this.colors[1],h=this.dataAt(xo.BARKIND,i),d=vh(h),p=h===Ci.BARKIND_XO,f=h===Ci.BARKIND_OX;if(Ze(t,s))for(let i=t;i>=s;i-=l){const l=a.adjust(o),[h,m]=[l-r,l+r],[g,y,T]=[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,T),e.moveTo(h,T),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 fp(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(jd.call(this,i,s,((e,i)=>{if(!i){const t=this.dataAt(r,e),i=this.dataAt(o,e);Ze(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 t=1;t<l.length;++t)e.lineTo(l[t].x,l[t].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 mp(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;jd.call(this,i,s,((e,i)=>{if(!i){const t=this.dataAt(n,e),i=this.dataAt(r,e);if(Ze(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 gp(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,hs(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;jd.call(this,i,s,((i,s)=>{if(!s){const t=this.dataAt(c,i);if(Ze(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 yp{fields=[];inputs=[];constructor(e,t,i=$.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}getBuilderKey(){if(!Ze(this.curveStyle)||!Ci.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return"Standard";switch(this.curveStyle){case v.Renko:{const{method:e,period:t,source:i,brickSize:s}=gu(this.inputs);return`Renko;${"ATR"===e?`ATR;${t}`:`${e};${s}`};${i}`}case v.Kagi:{const{method:e,period:t,reversal:i}=dh(this.inputs);return`Kagi;${"ATR"===e?`ATR;${t}`:`User;${i}`}`}case v.PointAndFigure:{const e=Ph(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 v.LineBreak:{const{lineBreak:e}=fh(this.inputs);return`LineBreak;${e}`}default:return v[this.curveStyle]}}get needsExtraKey(){return[$.Options,$.BalanceSheet,$.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}|${i}`}duplicate(){const e=new yp(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=rt(this.fields),e}}var Tp=n("c15IW");function Sp(e,t){const i=e.query?.duplicate();if(Ze(i)&&i.symbol!==Ci.PLACEHOLDER_SYMBOL_NAME&&"Standard"===i.getBuilderKey()){0!==i.barsToFetch&&(i.barsToFetch=i.barsToFetch*Ci.SERVER_COMPUTED_STUDY_BAR_MULTIPLIER);const e=t(i);return e.serverComputedSeries=!0,e}return new _h}function Ap(e){return new Oo(e,O.Number,x.Study,e)}class vp{studyFields={};calculable=!0;useNotifications=!1;initialNotification=!1;computedServerSide=!1;usedAsStyle=!1;recalcTriggers=new Set;basisChangedToken=null;_canLoadMoreData=!1;isLoading=!1;sourceNeedsCompute=!1;allowEmptyValues=!1;constructor(e,...t){this.container=this._source=null,this.inputs=e.inputs,this.setOptions(e),this.innerSeries=t,this.id=yt(),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){lt(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 Ci.EMPTY_ARRAY}get hasData(){return null!==this.container}get source(){if(Ze(this._source))return this._source;const e=Ze(this.inputs)?this.inputs[Ci.INPUT_SOURCE]:null;return Ze(e)?xo[e]:null}set source(e){this._source=e}async ready(){return Ai.call(this,(async()=>{this.basisChangedToken=this.useNotifications?e(Tp).subscribe(No.TS_ALL,this.onBasisChanged.bind(this)):null;const t={tag:yt(),src:null},i=(await Promise.all(this.innerSeries.map((e=>e.ready())))).every(Te);return i&&this.calculate(t),i}))}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onBasisChanged(e,t){if(e===No.TS_EVENTSCHANGED||e===No.TS_LOADING||this.innerSeries.some((e=>!e.hasData)))return;if(!this.shouldTriggerOurRecalc(t.series)||null===this.base||this===t.series)return;const i={tag:yt(),src:t.series};switch(e){case No.TS_MANYCHANGED:this.calculate(i);break;case No.TS_DATAPOINTCHANGED:case No.TS_DATAPOINTADDED:{const s=this.innerSeries[this.baseIndex].calculable?this.base.size-1:t.index;this.recalculateAt(i,s,e===No.TS_DATAPOINTADDED);break}case No.TS_TIMELINECORRECTION:break;default:throw new Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.useNotifications&&this.basisChangedToken&&e(Tp).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){je(e,{series:this,index:t})}calculateCommon(e,t=null,i=-1,s=!0){const n=-1===i,r=n?t=>{!Ze(e.src)&&Ze(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&&(Ze(e.src)||this.initialNotification)&&this.notify(t,i)}calculate(e){this.calculateCommon(e,No.TS_MANYCHANGED,-1,!0)}recalculateAt(e,t,i){this.computedServerSide||(!i&&Xe(this.container)&&t>this.container.size-1&&(t=this.container.size-1),this.calculateCommon(e,i?No.TS_DATAPOINTADDED:No.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 Ze(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(xo.DateTime,xo.Symbol)}makeContainer(){const e=this.defaultWrappers.concat(this.getWrappers()),t=Object.keys(this.studyFields).map((e=>this.studyFields[e]),this);return new fu(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 Pp extends vp{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 Cp extends Pp{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){const[t,i,s,n]=[xo.Open,xo.High,xo.Low,xo.Close].map((t=>this.baseVal(t,e)),this);let r=null,o=null,a=null,l=null;const c=ve([t,i,s,n]);if(e<1)r=ve([t,n]),o=i,a=s,l=0;else{const[t,n]=[xo.Open,xo.Close].map((t=>this.container.getData(t)[e-1]),this);r=ve([t,n]),o=Math.max(i,r,c),a=Math.min(s,r,c),l=c-n}return{[xo.Open.id]:r,[xo.High.id]:o,[xo.Low.id]:a,[xo.Close.id]:c,[xo.Change.id]:l}}getWrappers(){return this.wrapBaseFields(xo.Volume,xo.OpenInterest)}}class bp extends vp{constructor(e,t){super(e,t),Ly(this)}calculateAt(e){let t=null;const i=this.period,[,s]=Oy(this);if(this.atLeast(e,i)&&s.hasField(this.source)){const n=this.past(e,i,this.source,s);this.allowEmptyValues?t=ve(n.filter(Se)):Pe(n)&&(t=ve(n))}return{[this.target.id]:t}}getWrappers(){return this.source===xo.Volume?this.wrapBaseFields(xo.Volume,xo.TradeSize,xo.Change,xo.Open,xo.Close):[]}}class Ep extends vp{constructor(e,t,i){super(e,t),this.multiplier=i(this.period),Ly(this)}calculateAt(e){let t=null;const[i,s]=Oy(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=ve(n.filter(Se)):Pe(n)&&(t=ve(n))}}}return{[this.target.id]:t}}}class _p extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=xo.OpenInterest;return this.base.hasField(i)&&(t=this.baseVal(i,e)),{[i.id]:t}}}const Mp={inField:xo.MA,outFields:[xo.ENVU,xo.ENVD],func:Qg},Lp={inField:xo.EMA,outFields:[xo.ENVEXPU,xo.ENVEXPD],func:ey},Op={inField:xo.SMA,outFields:[xo.ENVSMOU,xo.ENVSMOD],func:ty};class wp extends vp{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 Ip extends vp{constructor(e,t){super(e,t);const i=Qg(t,this.inputs.Period1,this.source),s=Qg(t,this.inputs.Period2,this.source),n=Ey(this.target,((e,t,i)=>t-i),i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}}const Dp={fields:[xo.MACD,xo.MACDS,xo.MACDH],avgFunc:Qg,mapFunc:_y,histogramVaryColor:!0},xp={fields:[xo.MACD,xo.MACDS,xo.MACDH],avgFunc:ey,mapFunc:_y,histogramVaryColor:!0},Np={fields:[xo.MACD,xo.CTLTM,xo.CTM],avgFunc:ey,mapFunc:_y,histogramVaryColor:!1},Rp={fields:[xo.MACD,xo.CTLTMF,xo.CPMI],avgFunc:ey,mapFunc:_y,histogramVaryColor:!1},Hp={fields:[xo.PPO,xo.PPOS,xo.PPOH],avgFunc:ey,mapFunc:My,histogramVaryColor:!0},Vp={fields:[xo.PVO,xo.PVOS,xo.PVOH],avgFunc:ey,mapFunc:My,histogramVaryColor:!1};class Fp extends vp{get helpers(){return[xo.BARCOLIX]}constructor(e,t,i){super(e,i),this.fields=t.fields,this.histogramVaryColor=t.histogramVaryColor;const s=t.avgFunc(i,e.inputs.Period1,e.source,void 0),n=t.avgFunc(i,e.inputs.Period2,e.source,void 0),r=Ey(this.fields[0],t.mapFunc,s,n),o=t.avgFunc(r,e.inputs.Period3,r.target,this.fields[1]),a=Ey(this.fields[2],_y,r,o);this.addInner(r,o,a)}calculateAt(e){let t=-1;if(this.histogramVaryColor&&e>0){const i=this.fields[2],s=this.container.getData(i)[e],n=this.container.getData(i)[e-1];if(Ze(s,n)){const i=s<=0;t=i?1:3,e>0&&(i&&s>n&&(t=0),!i&&s<n&&(t=2))}}return{[xo.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(this.fields[0],1),this.wrapInner(this.fields[1],2),this.wrapInner(this.fields[2],3)]}}const Bp=Ap("_AVG_GAIN"),kp=Ap("_AVG_LOSS");class Up extends vp{constructor(e,t,i){super(e,i);const s=fy(i,this.inputs.Period,this.source,xo.RSI,t),n=xy(e,"MA","Average")(s,this.inputs.PeriodAvg,xo.RSI,xo.RSIAVG);this.addInner(s,n)}getWrappers(){return[this.wrapInner(xo.RSI,1),this.wrapInner(xo.RSIAVG,2)]}}class Wp extends vp{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);Pe(s)&&(t=this.highest?Math.max(...s):Math.min(...s),this.index&&(t=i-s.indexOf(t)-1))}return{[this.target.id]:t}}}class $p extends vp{constructor(e,t,i){super(e,i),this.toHighest=t;const s=Ze(e.source),n=e.source,r=s?n:xo.Close;this.field=r;const o=s?n:xo.High;this.highField=o;const a=s?n:xo.Low;this.lowField=a;const l=ry(i,e.inputs.Period,this.highField,xo.HH,!0),c=ry(i,e.inputs.Period,this.lowField,xo.LL,!1);this.addInner(l,c)}calculateAt(e){let t=null;const i=this.baseVal(this.field,e),s=this.innVal(1,xo.HH,e),n=this.innVal(2,xo.LL,e);if(Pe([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 Gp=Ap("RawPercK");class zp extends vp{constructor(e,t,i,s){super(e,s);const n=oy(s,this.inputs.Period1,t?Gp:i,!1),r=xy(e,"MA"),o=r(n,this.inputs.Period2,n.target,t?i:xo.PercD),a=t?r(o,this.inputs.Period3,o.target,xo.PercD):o;this.kField=i,t?this.addInner(o,a):this.addInner(n,o)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(xo.PercD,2)]}}class Yp extends vp{constructor(e,t,i){super(e,i),this.kind=t;const s=this.inputs.Period,n=this.source,r=Qg(i,s,n),o="Modified"===t,a=gy(o?ay(i,n):i,s,o?xo.PCTCHG:n);this.addInner(r,a)}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null;const a=this.innVal(2,xo.MSD,e),l=null!==a;if(l){r=this.innVal(1,xo.MA,e);const l=this.inputs.Width*a;t=r+l,i=r-l,s=2*l,o=s/r*100,n=(this.baseVal(xo.Close,e)-i)/(t-i)}switch(this.kind){case"Regular":return{[xo.BOLLBU.id]:t,[xo.BOLLBL.id]:i,[xo.BOLLBM.id]:r};case"Width":return{[xo.BOLLBW.id]:s};case"Percent":return{[xo.BOLLBP.id]:n};case"Squeeze":return{[xo.BOLLSQ.id]:o};case"Modified":{let e=null,t=null,i=null,s=null;if(l){const n=this.inputs.MultInside,o=this.inputs.MultOutside;e=r+n*a,i=r-n*a,t=r+o*a,s=r-o*a}return{[xo.MBBUI.id]:e,[xo.MBBLI.id]:i,[xo.MBBUO.id]:t,[xo.MBBLO.id]:s,[xo.MBBM.id]:r}}default:return null}}}const jp=Ap("_ABS_CHG"),Kp=Ap("_MA_ABS_CHG"),qp=Ap("_CHG");const Xp=Ap("_PDM"),Zp=Ap("_MDM"),Jp=Ap("_TRS"),Qp=Ap("_PDS"),ef=Ap("_MDS"),tf=Ap("_DX");class sf extends vp{constructor(e,t,i,s){super(e,s),this.useEma=t,this.adxField=i,this.multiplier=2/(this.inputs.AdxSmoothing+1);const n=cy(s,xo.TR);this.addInner(n)}get helpers(){return[Xp,Zp,Jp,Qp,ef,tf]}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),Pe(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,xo.High),h=this.past(e,2,xo.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(xo.TR)[e];n=this.smooth1(e,Xp,Qp,t),r=this.smooth1(e,Zp,ef,i),s=this.smooth1(e,xo.TR,Jp,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,tf,this.adxField,l))}return{[Xp.id]:t,[Zp.id]:i,[Jp.id]:s,[Qp.id]:n,[ef.id]:r,[xo.PDI.id]:o,[xo.MDI.id]:a,[tf.id]:l,[this.adxField.id]:c}}getWrappers(){return[this.wrapInner(xo.TR,1)]}}class nf extends vp{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(!Ze(n)){n=s.container.hasField(xo.Close)?xo.Close:s.container.fields[0]}return this.innVal(i,n,e)})),i=null;return Pe(t)&&(i=this.calculateAtFunc(e,...t)),{[this.target.id]:i}}}function rf(e,t){const i=this.baseVal(xo.High,t),s=this.baseVal(xo.Low,t);return{[e.id]:(i+s)/2}}function of(e,t){const i=this.baseVal(xo.High,t),s=this.baseVal(xo.Low,t);return{[e.id]:i-s}}class af extends vp{constructor(e,t,i){super(e,i),this.calculateAtFunc=t}calculateAt(e){return this.calculateAtFunc.call(this,e)}}const lf=Ap("_RANGE"),cf=Ap("_MOV_RANGE"),uf=e=>dy(e,xo.TP),hf=e=>by(lf,me(of,lf),e),df={fields:[xo.KCUP,xo.KCLOW,xo.KCMID],midSeries:uf,midTarget:xo.TP,rangeSeries:hf,rangeTarget:lf,func:Qg,useMultiplier:!1},pf={fields:[xo.KCEUP,xo.KCELOW,xo.KCEMID],midSeries:uf,midTarget:xo.TP,rangeSeries:hf,rangeTarget:lf,func:ey,useMultiplier:!1},ff={fields:[xo.KBUP,xo.KBLOW,xo.KBMID],midSeries:e=>e,midTarget:xo.Close,rangeSeries:e=>cy(e,xo.TR),rangeTarget:xo.TR,func:ey,useMultiplier:!0};class mf extends vp{constructor(e,t,i){super(e,i),this.kind=t;const s=t.midSeries(i),n=t.func(s,this.inputs.Period,t.midTarget,t.fields[2]),r=t.rangeSeries(i),o=t.func(r,this.inputs.Period,t.rangeTarget,cf);this.addInner(n,o)}calculateAt(e){const t=this.innVal(1,this.kind.fields[2],e),i=this.innVal(2,cf,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 gf extends vp{constructor(e,t,i){super(e,i),this.isWidth=t;const s=ry(i,this.inputs.Period,xo.High,xo.DONUP,!0),n=ry(i,this.inputs.Period,xo.Low,xo.DONLOW,!1);this.addInner(s,n)}calculateAt(e){const t=this.innVal(1,xo.DONUP,e),i=this.innVal(2,xo.DONLOW,e),s=null===t&&null===i;return this.isWidth?{[xo.DONW.id]:s?null:t-i}:{[xo.DONMID.id]:s?null:(t+i)/2}}getWrappers(){return[this.wrapInner(xo.DONUP,1),this.wrapInner(xo.DONLOW,2)]}}const yf=Ap("_HIND"),Tf=Ap("_LIND");class Sf extends vp{constructor(e,t,i){super(e,i),this.justWidth=t,this.justWidth=t;const s=this.inputs.Period,n=ry(i,s,xo.High,yf,!0,!0),r=ry(i,s,xo.Low,Tf,!1,!0);this.addInner(n,r)}calculateAt(e){let t=null,i=null,s=null;const n=this.innVal(1,yf,e),r=this.innVal(2,Tf,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?{[xo.ARNOSC.id]:s}:{[xo.ARNUP.id]:t,[xo.ARNLOW.id]:i}}}const Af=Ap("_MIDPOINT");const vf=Ap("_MIDPOINT");class Pf extends vp{constructor(e,t,i){super(e,i),this.multiplyVol=t}calculateAt(e){const t=[xo.High,xo.Low,xo.Close,xo.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 Cf=Ap("_RANGE");const bf=Ap("_MATP");class Ef extends vp{constructor(e,t,i){super(e,i),this.isBull=t;const s=ey(i,this.inputs.Period,this.source);this.addInner(s)}calculateAt(e){let t=null;const i=this.innVal(1,xo.EMA,e);return null!==i&&(t=this.isBull?this.baseVal(xo.High,e)-i:this.baseVal(xo.Low,e)-i),{[this.isBull?xo.ERBLPOW.id:xo.ERBRPOW.id]:t}}}const _f=Ap("_FORCE");const Mf=Ap("_RANGE"),Lf=Ap("_EMA1"),Of=Ap("_EMA2"),wf=Ap("_RATIO");const If={isNegative:!1,fields:[xo.PVI,xo.PVIEMA]},Df={isNegative:!0,fields:[xo.NVI,xo.NVIEMA]};class xf extends vp{constructor(e,t,i){super(e,i),this.kind=t;const s=by(this.kind.fields[0],me((function(e,t){let i=1e3;if(t>0){const s=[xo.Close,xo.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=ey(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 Nf=Ap("_LOGPC");const Rf=Ap("_SWING_INDEX");const Hf=Ap("_MIN_CLOSE"),Vf=Ap("_MAX_CLOSE");const Ff=Ap("_EP"),Bf=Ap("_AF"),kf=Ap("_POS");const Uf=Ap("_IDY"),Wf=[0,0,0,1,1,1,5,5,2,1,1,0,50,50,0,1,1,1,5,0,0],$f=e=>Array(e).fill(0);function Gf(e,t,i){let s=e[i-1];return 0===t&&(s=e[i]),t<0&&(s=e[i+1]),s}function zf(e,t,i,s,n){const r=n[18];let o=s+1,a=0;for(let i=0;i<r;++i){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 Gf(e,t,4)}(n,i[s]),a}function Yf(e,t,i,s,n){let r=s;const o=function(e,t){return Gf(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 jf(e,t,i,s,n,r,o,a,l,c){const u=function(e,t){return Gf(e,t,10)}(n,i[s]),h=function(e,t){return Gf(e,t,13)}(n,i[s]),d=function(e,t){return Gf(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,T=e[s]+(p-p*m),S=[r,o];return(1===a||1!==d||y>r)&&(S[0]=y),(1===a||1!==d||T<o)&&(S[1]=T),S}function Kf(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 qf={1:{param:"cot",func:"parseCotLineChart",fields:[xo.DateTime,xo.COTLCCMSP,xo.COTLCLGSP,xo.COTLCSMSP]},2:{param:"cotadv",func:"parseDisaggregated",fields:[xo.DateTime,xo.COTDAGPRO,xo.COTDAGSPD,xo.COTDAGMNM,xo.COTDAGOTH]},3:{param:"cotfin",func:"parseFinancialTradersReport",fields:[xo.DateTime,xo.COTFTRDLI,xo.COTFTRASM,xo.COTFTRLVF,xo.COTFTROTH]}};class Xf extends vp{constructor(e,t,i){super(e,Sp(i,(e=>new Zf(t,e)))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=qf[t].fields.slice(1).map((e=>this.wrapInner(e,0)))}getWrappers(){return this.wrappers}}class Zf extends Eh{constructor(e,t){super(t),this.kind=e}getRetriever(){return new Jf(this.kind)}onStreamingUpdates(e){}}class Jf extends $u{constructor(e){super(),this.kind=e}addExtraParams(e){e[qf[this.kind].param]="y"}getParser(e){return new Qf(e.symbol,e.aggregation,this.kind)}}class Qf extends ku{constructor(e,t,i){super(e,t,0),this.kind=i}makeContainer(){return new du(qf[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[qf[this.kind].func]:null}parseCotLineChart(e){this.container.addDataPoint(xo.DateTime,this.parseDate(e[1])),this.container.addDataPoint(xo.COTLCCMSP,parseInt(e[2])),this.container.addDataPoint(xo.COTLCLGSP,parseInt(e[3])),this.container.addDataPoint(xo.COTLCSMSP,parseInt(e[4]))}parseDisaggregated(e){this.container.addDataPoint(xo.DateTime,this.parseDate(e[1])),this.container.addDataPoint(xo.COTDAGPRO,parseInt(e[2])),this.container.addDataPoint(xo.COTDAGSPD,parseInt(e[3])),this.container.addDataPoint(xo.COTDAGMNM,parseInt(e[4])),this.container.addDataPoint(xo.COTDAGOTH,parseInt(e[5]))}parseFinancialTradersReport(e){this.container.addDataPoint(xo.DateTime,this.parseDate(e[1])),this.container.addDataPoint(xo.COTFTRDLI,parseInt(e[2])),this.container.addDataPoint(xo.COTFTRASM,parseInt(e[3])),this.container.addDataPoint(xo.COTFTRLVF,parseInt(e[4])),this.container.addDataPoint(xo.COTFTROTH,parseInt(e[5]))}}class em extends Xf{constructor(e,t){super(e,1,t)}}const tm={Day:[xo.PreviousHigh,xo.PreviousLow,xo.PreviousClose],Week:[xo.WeekPreviousHigh,xo.WeekPreviousLow,xo.WeekPreviousClose],Month:[xo.MonthPreviousHigh,xo.MonthPreviousLow,xo.MonthPreviousClose]};class im extends vp{constructor(e,t,i){super(e,i),this.disabled=!Ze(i.query)||!Ze(i.query.symbol),this.disabled||(this.record=SP().getRecordSource().getRecord(i.query.symbol),this.record.addFields(...t),this.streamingSubscription=this.getStreamingSubscription()),this.initialNotification=!0}getStreamingSubscription(){return SP().getRecordSource().subject.pipe(Ku((e=>{const t=Ko(No.RT_QUOTE,this.record.symbol);return e.filter(t)})),rl((e=>e.length>0))).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return Ai.call(this,(async()=>Ze(this.record)?await this.record.ready()&&await super.ready():await super.ready()),"asyncReadyWork2")}onStreamingUpdates(e){if(this.record){const e={tag:yt(),src:null};this.calculate(e)}}shutdown(){super.shutdown(),this.disabled||this.streamingSubscription.unsubscribe()}getValues(e){return tm[e].map((e=>this.record.getValue(e)))}}class sm extends Eh{constructor(e){super(e)}getRetriever(){return zt(this.query.symbol)?new am:new nm}onStreamingUpdates(e){}}class nm extends $u{addExtraParams(e){e.impl="y"}getParser(e){return new om(e.symbol,e.aggregation)}}function rm(){return new du([xo.DateTime,xo.IMPVOL])}class om extends ku{constructor(e,t){super(e,t)}makeContainer(){return rm()}getParseFunc(){return this.parseImpVol}parseImpVol(e){!this.aggregation.isEndOfDay||e.length<9||(this.container.addDataPoint(xo.DateTime,this.parseDate(e[1])),this.container.addDataPoint(xo.IMPVOL,parseFloat(e[8])))}}class am extends Gu{emptyContainer(e,t){return rm()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(xo.DateTime,Fu(e.date.substring(0,10)));const s=Xe(e.impliedVolatility);i.addDataPoint(xo.IMPVOL,s?100*e.impliedVolatility:null)}}const lm=Ap("_ABS_CHG"),cm=Ap("_DS1_EMA1"),um=Ap("_DS1_EMA2"),hm=Ap("_DS2_EMA1"),dm=Ap("_DS2_EMA2");const pm=Ap("_DIFF");const fm=Ap("_SUM");const mm=Ap("_ABS_CHG"),gm=Ap("_HH_LL"),ym=Ap("_MULMA");class Tm extends vp{constructor(e,t,i){super(e,i);const s="Close"===e.inputs.TurtleChnField,n=Vy(i);if(!s&&n){const e=by(this.target,((e,t)=>null),i);this.addInner(e)}else{const e=Qg(by(mm,me(((e,t)=>({[mm.id]:t>0?e*Math.abs(this.baseVal(xo.Change,t)):null})),this.inputs.FactorATR),i),this.inputs.PeriodAdjATR,mm,xo.MA),n=t?xo.High:xo.Low,r=ry(i,this.inputs.PeriodTurtleChn,s?xo.Close:n,gm,t),o=Ey(ym,((e,t)=>this.inputs.FactorAdjATR*t),e),a=t?-1:1,l=(e,t,i)=>t+a*i,c=Ey(this.target,l,r,o);this.addInner(c)}}getWrappers(){return[this.wrapInner(this.target,1)]}}const Sm=Ap("_DIFF");class Am extends Pp{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=[xo.Open,xo.High,xo.Low,xo.Close],n=s.map((t=>i(t,e)));if(Pe(n)){const r=s.map((t=>i(t,e-1)));if(Pe(r)){t=n.map(((e,t)=>100*(e-r[t])/r[t]));const[i,s]=Ne(t);if(t[1]=s,t[2]=i,e>1){const i=this.container.getData(xo.Close)[e-1];t[4]=t[3]-i}}}}return{[xo.Open.id]:t[0],[xo.High.id]:t[1],[xo.Low.id]:t[2],[xo.Close.id]:t[3],[xo.Change.id]:t[4]}}getWrappers(){return this.wrapBaseFields(xo.Volume,xo.OpenInterest)}}const vm=Ap("_DIST"),Pm=Ap("_EMA_DIST1"),Cm=Ap("_EMA_DIST2"),bm=Ap("_DIFF"),Em=Ap("_EMA_DIFF1"),_m=Ap("_EMA_DIFF2");const Mm=Ap("_CHG"),Lm=Ap("_M1"),Om=Ap("_M2");const wm=Ap("_MAX"),Im=Ap("_MIN"),Dm=Ap("_ISUPTREND");const xm=Ap("_TRENDUP"),Nm=Ap("_TRENDDOWN"),Rm=Ap("_TREND");const Hm=Ap("_CUM_PRICE"),Vm=Ap("_CUM_VOL"),Fm=Ap("_PER_CHG");class Bm extends vp{constructor(e,t){super(e,t);const i=this.source,s=by(i,me(wy,i),t);this.addInner(s)}valueAt(e,t){return this.container.getData(e)[t]}dateAt(e){return this.container.getTimeData()[e]}}const km=Ap("_DIFF"),Um=[km,xo.Buy,xo.Sell];function Wm(e,t,i,s){let n=null,r=null,o=null;Ze(i,s)&&(o=i-s);const a=t>0?e.getData(km)[t-1]:null;return Ze(o,a)&&(n=o>0&&a<=0?1:null,r=o<0&&a>=0?-1:null),{[km.id]:o,[xo.Buy.id]:n,[xo.Sell.id]:r}}const $m=Ap("_PVM"),Gm=Ap("_NVM");Tp=n("c15IW");function zm(e,t,i){return new Ym(e,t,i)}class Ym{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=eo(e),this.valueSymbols=this.exprSymbols.filter((e=>void 0===this.innerLookup[e])),this.onlyForTimeline=Me(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;const t=this.innerSeries.filter((e=>e.canLoadMoreData)).map((t=>t.loadMoreData(e)));await Promise.all(t),this.isLoading=!1}get isExprInError(){return!Ze(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 Ai.call(this,(async()=>{this.basisChangedToken=e(Tp).subscribe(No.TS_ALL,this.onBasisChanged.bind(this)),this.quoteGroupToken=e(Tp).subscribe(No.RT_QUOTEGROUP,this.onQuoteGroup.bind(this));const t=this.innerSeries.map((e=>e.ready()));void 0!==this.policy.valueProvider&&t.push(this.policy.valueProvider.ready());const i=(await Promise.all(t)).every(Te);return i&&this.calculate(),i}))}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onQuoteGroup(e,t){t.source===this.policy.valueProvider&&this.innerSeries.every((e=>Ze(e.container)))&&this.calculateCommon(No.TS_MANYCHANGED)}onBasisChanged(e,t){if(this.policy.recompute===p.Manual)return;if(e===No.TS_EVENTSCHANGED||e===No.TS_LOADING)return;if(!this.shouldTriggerOurRecalc(t.series)||this.innerSeries.some((e=>!Ze(e.container))))return;const i=this.policy.mapper(t.series);if(e===No.TS_DATAPOINTCHANGED&&this.onlyForTimeline?.includes(i))return;switch(this.policy.recompute===p.Everything?No.TS_MANYCHANGED:e){case No.TS_MANYCHANGED:this.calculate();break;case No.TS_DATAPOINTCHANGED:case No.TS_DATAPOINTADDED:this.recalculate(e===No.TS_DATAPOINTADDED);break;default:throw new Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.basisChangedToken&&e(Tp).unsubscribe(this.basisChangedToken),this.quoteGroupToken&&(e(Tp).unsubscribe(this.quoteGroupToken),this.policy.valueProvider?.shutdown())}calculateAt(e){return e.isNull?null:this.sourceFields.map(((t,i)=>{if(t===xo.Volume)return Ae(this.exprSymbols.map((t=>e.inn[t].values[i]??0)));return Zr(this.exprModel,(t=>e.oneValue[t]??e.inn[t].values[i]))}))}pickMainField(){let e=null;for(const t of this.policy.fieldMap.values())if(null==e)e=t;else if(t===xo.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];Ze(s,n)&&e.setLastDataPoint(xo.Change,n-s)}calculateDataPoint(e,t){const i=this.calculateAt(e);if(null===i)return;e.atLeastOne=!0;const[s,n]=Ne(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(xo.Change,null),this.container.addDataPoint(xo.DateTime,new Date(e.timeStamp))),this.calculateLastChange()}notify(e){je(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,xo.DateTime)}timeline(e){return e.container.getData(xo.DateTime)}getRangeHelper(){switch(this.policy.missing){case h.UseNext:case h.UseNone:return Math.min;case h.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=>we(this.timeline(this.innerLookup[e])))))),end:new Date(e(...this.symbols.map((e=>Oe(this.timeline(this.innerLookup[e]))))))}}getFirstPos(){return this.getPos(this.getRange().begin)}getLastPos(){return this.getPos(this.getRange().end)}findIndex(e,t){const i=this.timeline(this.innerLookup[e]);switch(this.policy.missing){case h.UseNext:case h.UseNone:return i.findIndex((e=>e.valueOf()>=t.valueOf()));case h.UsePrevious:return Ie(i,(e=>e.valueOf()<=t.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=>!(Ze(e.timeStamp)||this.policy.stretch(e.symbol)&&1!==t)))}fillPosSymbolAt(e,t,i){e.index=t,e.timeStamp=this.timeStampAt(e.symbol,t);const s=(this.policy.missing===h.UseNone||this.policy.skipLeadingEmpty&&!i.atLeastOne)&&e.timeStamp&&e.timeStamp.valueOf()!==i.timeStamp.valueOf();return e.values=this.sourceFields.map((i=>s?null:this.fieldValueAt(e.symbol,t,i))),e}skippable(e){return!!this.innerLookup[e].container.isEmpty&&(this.policy.noDataApproach===m.IgnoreTimelineOnly&&this.onlyForTimeline.includes(e)||this.policy.noDataApproach===m.ModelTransformRequired)}get symbols(){const e=Object.keys(this.innerLookup);return Ze(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: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(;Ze(t.timeStamp)&&t.timeStamp.valueOf()<=e.timeStamp.valueOf();)this.fillPosSymbolAt(t,t.index+1,e)})),this.checkPos(e),e.isNull||(e.timeStamp=new Date(Math.min(...this.getInner(e).filter((e=>null!==e.timeStamp)).map((e=>e.timeStamp.valueOf())))),this.policy.missing===h.UsePrevious?this.getInner(e).forEach((t=>{const i=Ze(t.timeStamp);(i&&t.timeStamp.valueOf()>e.timeStamp.valueOf()||!i&&this.policy.stretch(t.symbol))&&this.fillPosSymbolAt(t,t.index-1,e)})):this.policy.missing===h.UseNone&&this.getInner(e).forEach((t=>this.fillPosSymbolAt(t,t.index,e)))))}shouldAdd(e){return this.container.getLastDataPoint(xo.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(e){this.crashedComputationReported||(dP(e,"error"),this.crashedComputationReported=!0)}}calculate(){const{yes:e,no:t}=be(this.innerSeries,(e=>!e.container.isEmpty));if(t.length>0&&this.policy.noDataApproach===m.ModelTransformRequired){const i=e=>e.map(this.policy.mapper),s=this.policy.modelTransform(i(e),i(t));null!==s&&(this.exprModel=s)}this.calculateCommon(No.TS_MANYCHANGED)}recalculate(e){if(this.isExprInError)return;const t=this.getLastPos(),i=this.shouldAdd(t);this.calculateCommon(i?No.TS_DATAPOINTADDED:No.TS_DATAPOINTCHANGED,t,i)}recalculateAt(e,t,i){return this.recalculate(i)}makeContainer(){const e=[xo.DateTime,xo.Change].concat(this.targetFields);return new du(e)}getCacheableEntities(e){this.innerSeries.forEach((t=>{t.getCacheableEntities(e)}))}}const jm=Ap("_AVG");const Km=Ap("_HAO"),qm=Ap("_HAH"),Xm=Ap("_HAL"),Zm=Ap("_HAC");const Jm=Ap("_DELTA");const Qm=Ap("_DIFF"),eg=Ap("_RANK"),tg=Ap("_CHG"),ig=Ap("_AVG"),sg=Ap("_HBRAKE_CHG"),ng=Ap("_HEIGHT_DELTA"),rg=Ap("_ACTION"),og=Ap("_REVERSAL"),ag=10,lg=e=>[e>0,e<0],cg=[null,null,null],ug=0,hg=1,dg=2;function pg([e,t],i){let s=null;if(i>0){const t=this.baseVal(e,i-1);Ze(t)&&(s=this.baseVal(e,i)-t)}return{[t.id]:s}}class fg extends vp{constructor(e,t){super(e,t);const i=xy(e,"MA","Average"),s=i(t,Tt(1,999,this.inputs.FastPeriod),xo.Close),n=Tt(0,999,this.inputs.SlowPeriod),r=n>0,o=r?i(t,n,xo.Close):t,a=Ey(Qm,r?(e,t,i)=>t-i:(e,t,i)=>i-t,s,o),l=by(tg,me(pg,[xo.Close,tg]),t),c=by(eg,(function(e){const t=Math.abs(this.baseVal(Qm,e));let i=null,s=0,n=0;for(let i=e-1;i>=0&&s<200;--i){s++,Math.abs(this.baseVal(Qm,i))<t&&n++}return s>0&&(i=Math.floor(n/s*ag)),i===ag&&i--,{[eg.id]:i}}),a),u=Tt(0,999,this.inputs.HandbrakePeriod);this.useHandbrake=u>0;const h=i(t,u,xo.Close,ig),d=by(sg,me(pg,[ig,sg]),h);this.addInner(l,a,c,d)}get helpers(){return[ng,xo.BARCOLIX,rg,og]}getStateAt(e){const t=this.innVal(2,Qm,e);return Ze(t)?lg(t):cg}findPreviousKnownState(e){for(let t=e-1;t>0;t--){const e=this.getStateAt(t);if(e===cg)return cg;const[i,s]=e;if(i||s)return e}return cg}getBuySell(e){const t=this.getStateAt(e);if(t===cg)return cg;const[i,s]=t,n=this.findPreviousKnownState(e),[r,o]=n;if(!i&&!s)return n===cg?cg:[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=ug;const[o,a,l]=this.getBuySell(e),[c,u]=[og,rg].map((t=>this.getPrev(t,e))),[h,d]=[0,-1].map((t=>this.innVal(4,sg,e+t)));if(n=l?ag:this.innVal(3,eg,e),this.useHandbrake&&Ze(h,d)){const t=!o&&h>0||!a&&h<0;l?(n=t?ag:12,r=u):!0!==c&&u!==hg||(o&&d>0||a&&d<0?(n=this.innVal(3,eg,e),r=dg):(n=t?11:13,r=hg))}if(Ze(this.innVal(2,Qm,e))){const t=this.innVal(1,tg,e),[i,n]=lg(t),r=Math.abs(t);(o&&i||a&&n)&&(s=r),(o&&n||a&&i)&&(s=-r)}return o?t=1:a&&(i=1),{[xo.JPIB.id]:t,[xo.JPIS.id]:i,[xo.BARCOLIX.id]:n,[ng.id]:s,[rg.id]:r,[og.id]:l}}}const mg=Ap("_SMTH_ROC"),gg=Ap("_TEN_SMTH_ROC");function yg(e,t,i,s,n){return new Ep({source:s,target:n,outFields:[n],aggregation:i,inputs:jg(t)},e,(e=>2/e))}const Tg=Ap("_VOL_AVG");const Sg=(()=>{const e=(t=51,Je(Math.pow(.5,1/t),6));var t;const i=Re(52,(t=>Math.pow(e,t))),s=52/Ae(i);return i.map((e=>e*s))})(),Ag=["Renko","Kagi","PointAndFigure","LineBreak"];const vg=Ap("_EMA1"),Pg=Ap("_EMA2"),Cg=Ap("_MACD"),bg=Ap("_PCTK"),Eg=Ap("_PCTD"),_g=Ap("_PCTK2");const Mg=Ap("_EMA1"),Lg=Ap("_EMA2"),Og=Ap("_CORE");class wg extends vp{constructor(e,t){if(super(e,t),Fy(t)){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{const e=by(xo.Close,((e,t)=>null),t),i=by(xo.Close,((e,t)=>null),t),s=by(this.target,((e,t)=>null),t);this.addInner(e,i,s),this.canLoadMoreData=!1}}get baseIndex(){return 1}getSeries(e,t){const i=e.duplicate();i.symbol=t;return SP().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 Ig=Ap("_INN_HL_ACC_IX"),Dg=new xr;class xg extends vp{isWeekly=!1;constructor(e,t){if(super(e,t),t instanceof _h)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===C.Week,this.isWeekly){const e=this.getSeries(t.query,r,Dg),o=(i=e,s=this.inputs,new xg({aggregation:Dg,source:null,target:n=Ig,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*Ci.US_TRADING_DAYS_PER_YEAR);return SP().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,xo.Close);Pe(s)&&(t=Ae(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(Ig);else{const t=this.container.getTimeData()[e],n=s.getTimeData();let r=xe(n,t),o=n[r],a=null;for(;r<s.size&&Cr(t,o);)a=r,r+=1,o=n[r];null!==a&&(i=s.getData(Ig)[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 Ng=Ap("_RSI1"),Rg=Ap("_RSI1_MOM"),Hg=Ap("_RSI2"),Vg=Ap("_RSI2_MA");const Fg=Ap("_MUL_ATR");class Bg extends vp{constructor(e,t){super(e,Sp(t,(t=>{const i=SP().getTimeSeriesDataSource();return t.seriesKind=$.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 kg=Ap("_CORE");class Ug extends Eh{constructor(e){super(e)}getRetriever(){return zt(this.query.symbol)?new Gg:Zt(this.query.symbol)?new zg:new $g}}function Wg(){const e=[xo.DateTime,xo.Delta,xo.Gamma,xo.Theta,xo.Vega];return new du(e)}class $g{constructor(){this.supportsChunks=!1}async retrieve(e){return Wg()}}class Gg extends Gu{emptyContainer(e,t){return Wg()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(xo.DateTime,Fu(e.date.substring(0,10))),i.addDataPoint(xo.Delta,e.delta),i.addDataPoint(xo.Gamma,e.gamma),i.addDataPoint(xo.Theta,e.theta),i.addDataPoint(xo.Vega,e.vega)}}class zg extends Gu{emptyContainer(e,t){return Wg()}addExtraParams(e){e.fields="delta,gamma,theta,vega"}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){i.addDataPoint(xo.DateTime,Fu(e.date)),i.addDataPoint(xo.Delta,e.delta),i.addDataPoint(xo.Gamma,e.gamma),i.addDataPoint(xo.Theta,e.theta),i.addDataPoint(xo.Vega,e.vega)}}const Yg={_TR:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=this.baseVal(xo.High,e),s=this.baseVal(xo.Low,e);if(e>0){const n=this.baseVal(xo.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 vp{constructor(e,t){super(e,t);const i=e.inputs.Modified;this.isModified=i}get helpers(){return[Bp,kp]}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(Pe(t)){const e=Ce(1,n),r=e.map((e=>this.gain(e,t))),o=e.map((e=>this.loss(e,t)));i=ve(r),s=ve(o)}}else{const t=this.container.getData(Bp)[e-1],r=this.container.getData(kp)[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{[Bp.id]:i,[kp.id]:s,[this.target.id]:t}}},MA:bp,MAEXP:class extends Ep{constructor(e,t){super(e,t,(e=>2/(e+1)))}},MAHLC:class extends vp{constructor(e,t){super(e,t);const i=Qg(t,this.inputs.Period1,xo.High,xo.MAHI),s=Qg(t,this.inputs.Period2,xo.Low,xo.MALO);this.addInner(i,s)}getWrappers(){return[this.wrapInner(xo.MAHI,1),this.wrapInner(xo.MALO,2)]}},VOL:class extends _p{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(xo.Volume,xo.TradeSize,xo.Change,xo.Open,xo.Close)}},MAENV:class extends wp{constructor(e,t){super(e,Mp,t)}},MAENVEXP:class extends wp{constructor(e,t){super(e,Lp,t)}},MAENVSMO:class extends wp{constructor(e,t){super(e,Op,t)}},MATRI:class extends vp{constructor(e,t){super(e,t);const i=Qg(t,this.inputs.Period,this.source),s=Qg(i,this.inputs.Period,xo.MA,xo.TMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(xo.TMA,2)]}},MAWEI:class extends vp{constructor(e,t){super(e,t);const i=this.period;this.triangle=i*(i+1)/2,Ly(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]=Oy(this);if(this.atLeast(e,i)){const n=this.past(e,i,this.source,s);this.allowEmptyValues?t=this.weightedAverage(n.filter(Se)):Pe(n)&&(t=this.weightedAverage(n))}return{[this.target.id]:t}}},MAVOL:bp,MASMO:class extends Ep{constructor(e,t){super(e,t,(e=>1/e))}},MACD:class extends Fp{constructor(e,t){super(e,Dp,t)}},MACDEXP:class extends Fp{constructor(e,t){super(e,xp,t)}},GMMA:class extends vp{constructor(e,t){super(e,t);for(let i=1;i<=12;++i){const s=e.inputs[`Period${i}`];this.addInner(ey(t,s,xo.Close,e.outFields[i-1]))}}getWrappers(){return Ce(1,12).map((e=>this.wrapInner(this.outFields[e-1],e)))}},OSCI:Ip,OSCIVOL:Ip,RSI:class extends Up{constructor(e,t){super(e,!1,t)}},RSIMOD:class extends Up{constructor(e,t){super(e,!0,t)}},RSISTO:class extends vp{constructor(e,t){super(e,t);const i=fy(t,this.inputs.Period,this.source),s=this.inputs.Range,n=by(xo.STORSI,(function(e){let t=null;if(this.atLeast(e,s)){const i=this.past(e,s,xo.RSI,this.base),n=Ne(i),r=n[0],o=n[1];t=(Oe(i)-r)/(o-r)}return{[xo.STORSI.id]:t}}),i),r=xy(e,"MA","Average")(n,this.inputs.PeriodAvg,xo.STORSI,xo.STORSIAVG);this.addInner(n,r)}getWrappers(){return[this.wrapInner(xo.STORSI,1),this.wrapInner(xo.STORSIAVG,2)]}},WPERCR:class extends $p{constructor(e,t){super(e,!0,t)}},HHLL:class extends vp{constructor(e,t){super(e,t);const i=ry(t,this.inputs.Period1,xo.High,xo.HH,!0),s=ry(t,this.inputs.Period2,xo.Low,xo.LL,!1);this.addInner(i,s)}getWrappers(){return[this.wrapInner(xo.HH,1),this.wrapInner(xo.LL,2)]}},WGCL:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=[xo.Close,xo.High,xo.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 zp{constructor(e,t){super(e,!1,xo.PercK,t)}},STOCHS:class extends zp{constructor(e,t){super(e,!0,xo.PercK,t)}},BBANDS:class extends Yp{constructor(e,t){super(e,"Regular",t)}},BWIDTH:class extends Yp{constructor(e,t){super(e,"Width",t)}},BPERC:class extends Yp{constructor(e,t){super(e,"Percent",t)}},OBVOL:class extends vp{constructor(e,t){super(e,t);const i=by(xo.OBVOL,(function(e){let t=null;if(e>0){const i=this.baseVal(xo.Close,e),s=this.baseVal(xo.Volume,e),n=this.baseVal(xo.Close,e-1);let r=this.container.getData(this.target)[e-1];Ze(r)||(r=0),t=i>n?r+s:i<n?r-s:r}return{[this.target.id]:t}}),t),s=xy(e,"MA","Average")(i,this.period,xo.OBVOL,xo.OBVOLAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(xo.OBVOL,1),this.wrapInner(xo.OBVOLAVG,2)]}},ATR:class extends vp{constructor(e,t){super(e,t);const i=cy(t,xo.TR),s=xy(e,"SMA")(i,this.inputs.Period,xo.TR,this.target),n=Qg(s,this.inputs.Period2,xo.ATR,xo.ATRMA);this.addInner(s,n)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(xo.ATRMA,2)]}},ATRP:class extends vp{constructor(e,t){super(e,t);const i=uy(t,e.inputs.Period,e.inputs.Smoothing);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(1,xo.ATR,e),s=this.baseVal(xo.Close,e);return Ze(i,s)&&s>0&&(t=i/s*100),{[xo.ATRP.id]:t}}},ADX:class extends sf{constructor(e,t){super(e,!1,xo.ADX,t)}},ADXMOD:class extends sf{constructor(e,t){super(e,!0,xo.ADXM,t)}},ADL:class extends vp{constructor(e,t){super(e,t);const i=my(t);this.addInner(i)}calculateAt(e){let t=null;return t=(e>0?this.container.getData(this.target)[e-1]:0)+this.innVal(1,xo.MFMUL,e),{[this.target.id]:t}}},ADWM:class extends vp{constructor(e,t){super(e,t);const i=by(xo.ADWM,(function(e){let t=null,i=null;if(e>0){const s=this.baseVal(xo.Close,e-1),n=Math.max(s,this.baseVal(xo.High,e)),r=Math.min(s,this.baseVal(xo.Low,e)),o=this.baseVal(xo.Close,e);if(t=o>s?o-r:o<s?o-n:0,e>1){i=(e>2?this.container.getData(xo.ADWM)[e-1]:0)+t}}return{[xo.ADWM.id]:i}}),t),s=Qg(i,this.inputs.Period,xo.ADWM,xo.ADWMMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(xo.ADWM,1),this.wrapInner(xo.ADWMMA,2)]}},CHAOSC:class extends vp{constructor(e,t){super(e,t);const i=xo.ADL;let s=hy(t,i),n=ey(s,3,i),r=ey(s,10,i),o=Ey(e.target,((e,t,i)=>t-i),n,r);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},TP:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;return t=ve([xo.Close,xo.High,xo.Low].map((t=>this.baseVal(t,e)))),{[this.target.id]:t}}},KELCHN:class extends mf{constructor(e,t){super(e,df,t)}},KELEXP:class extends mf{constructor(e,t){super(e,pf,t)}},KELBND:class extends mf{constructor(e,t){super(e,ff,t)}},DONCHN:class extends gf{constructor(e,t){super(e,!1,t)}},DONWIDTH:class extends gf{constructor(e,t){super(e,!0,t)}},PVT:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;if(e>0){const i=this.baseVal(xo.Close,e),s=this.baseVal(xo.Volume,e),n=this.baseVal(xo.Close,e-1);let r=this.container.getData(this.target)[e-1];Ze(r)||(r=0);t=r+(i-n)/n*s}return{[this.target.id]:t}}},ROC:class extends vp{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 vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.Period,this.source),s=ey(i,this.inputs.Period,i.target),n=ey(s,this.inputs.Period,s.target),r=py(n,1,n.target,this.target);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}},PPMOV:class extends vp{constructor(e,t){super(e,t);const i=dy(t,xo.PVPT);this.addInner(i)}calculateAt(e){const t=this.innVal(1,xo.PVPT,e),i=this.baseVal(xo.High,e),s=this.baseVal(xo.Low,e);return{[xo.PVPTR.id]:t+i-s,[xo.PVPTS.id]:t-i+s}}getWrappers(){return[this.wrapInner(xo.PVPT,1)]}},PIVPTS:class extends im{constructor(e,t){super(e,tm[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(Pe(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{[xo.PPTPIV.id]:t,[xo.PPTR1.id]:i,[xo.PPTR2.id]:n,[xo.PPTR3.id]:o,[xo.PPTS1.id]:s,[xo.PPTS2.id]:r,[xo.PPTS3.id]:a}}},CPP:class extends im{constructor(e,t){super(e,tm.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(Pe(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{[xo.CPPH4.id]:a,[xo.CPPH3.id]:r,[xo.CPPH2.id]:s,[xo.CPPH1.id]:t,[xo.CPPL1.id]:i,[xo.CPPL2.id]:n,[xo.CPPL3.id]:o,[xo.CPPL4.id]:l}}},ARNUPDW:class extends Sf{constructor(e,t){super(e,!1,t)}},ARNOSC:class extends Sf{constructor(e,t){super(e,!0,t)}},TCHN:class extends vp{constructor(e,t){super(e,t);const i="Close"===e.inputs.Range,s=Vy(t);if(!i&&s){const e=by(xo.TCHNUP,((e,t)=>null),t),i=by(xo.TCHNLOW,((e,t)=>null),t);this.addInner(e,i)}else{let s=ry(t,e.inputs.PeriodUpper,i?xo.Close:xo.High,xo.TCHNUP,!0),n=ry(t,e.inputs.PeriodLower,i?xo.Close:xo.Low,xo.TCHNLOW,!1);this.addInner(s,n)}}getWrappers(){return[this.wrapInner(xo.TCHNUP,1),this.wrapInner(xo.TCHNLOW,2)]}},TCHRE:class extends vp{constructor(e,t){super(e,t);const i=Sy(t,e.inputs.Period,e.inputs.Range);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(1,xo.TCHNUP,e),s=this.innVal(1,xo.TCHNLOW,e),n=this.inputs.Adjustment,r=this.inputs.Retracement;return"Long"===r?t=Ze(i)?i-n:null:"Short"===r&&(t=Ze(s)?s+n:null),{[this.target.id]:t}}},ALLG:class extends vp{constructor(e,t){super(e,t);const i=by(Af,me(rf,Af),t),s=ty(i,e.inputs.Period1,Af,xo.ALJAW),n=ty(i,e.inputs.Period2,Af,xo.ALTEETH),r=ty(i,e.inputs.Period3,Af,xo.ALLIPS);this.addInner(s,n,r)}calculateAt(e){return{[xo.ALJAW.id]:this.innVal(1,xo.ALJAW,e),[xo.ALTEETH.id]:this.innVal(2,xo.ALTEETH,e),[xo.ALLIPS.id]:this.innVal(3,xo.ALLIPS,e)}}},PLTLN:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){return{[xo.PLTLN.id]:this.inputs.Position}}},AWEOSC:class extends vp{constructor(e,t){super(e,t);const i=by(vf,me(rf,vf),t),s=Qg(i,this.inputs.Period1,vf),n=Qg(i,this.inputs.Period2,vf),r=Ey(xo.AWOS,((e,t,i)=>t-i),s,n),o=Qg(r,this.inputs.Period3,r.target,xo.AWOSMA);this.addInner(r,o)}getWrappers(){return[this.wrapInner(xo.AWOS,1),this.wrapInner(xo.AWOSMA,2)]}},MFV:class extends Pf{constructor(e,t){super(e,!0,t)}},CLV:class extends Pf{constructor(e,t){super(e,!1,t)}},CHAMF:class extends vp{constructor(e,t){super(e,t);const i=my(t);this.addInner(i)}calculateAt(e){let t=null;const i=this.period;if(this.atLeast(e,i)){const s=this.past(e,i,xo.Volume),n=this.past(e,i,xo.MFMUL,this.innCont(1));if(Pe(s)&&Pe(n)){const e=Ae(s);0!==e&&(t=Ae(n)/e)}}return{[this.target.id]:t}}},CHAVOL:class extends vp{constructor(e,t){super(e,t);const i=py(ey(by(Cf,me(of,Cf),t),this.inputs.Period1,Cf),this.inputs.Period2,xo.EMA,this.target);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},DPO:class extends vp{constructor(e,t){super(e,t);const i=this.inputs.Period;this.shift=Math.floor(i/2)+1;const s=Qg(t,i,e.source);this.addInner(s)}calculateAt(e){let t=null;const i=this.shift,s=this.innVal(1,xo.MA,e-i);return null!==s&&(t=this.baseVal(this.source,e)-s),{[this.target.id]:t}}},CCI:class extends vp{constructor(e,t){super(e,t);const i=dy(t),s=Qg(i,this.inputs.Period,i.target,bf);this.addInner(i,s)}calculateAt(e){let t=null;const i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,xo.TP,this.innCont(1));if(Pe(s)){const i=this.innVal(2,bf,e);if(null!==i){const n=s.reduce(((e,t,s)=>e+Math.abs(i-t)),0)/this.period;t=(this.innVal(1,xo.TP,e)-i)/(.015*n)}}}return{[this.target.id]:t}}},EMV:class extends vp{constructor(e,t){super(e,t);const i=by(xo.EMV,(function(e){let t=null;if(e>0){const i=[xo.High,xo.Low,xo.Volume],[s,n,r]=i.map((t=>this.baseVal(t,e))),o=[xo.High,xo.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=Qg(i,this.inputs.Period,xo.EMV,xo.EMVMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(xo.EMV,1),this.wrapInner(xo.EMVMA,2)]}},ERBRPOW:class extends Ef{constructor(e,t){super(e,!1,t)}},ERBLPOW:class extends Ef{constructor(e,t){super(e,!0,t)}},FI:class extends vp{constructor(e,t){super(e,t);const i=ey(by(_f,(function(e){let t=null;if(e>0){const i=this.baseVal(xo.Close,e),s=this.baseVal(xo.Volume,e);t=(i-this.baseVal(xo.Close,e-1))*s}return{[this.target.id]:t}}),t),this.inputs.Period,_f,xo.FI);this.addInner(i)}getWrappers(){return[this.wrapInner(xo.FI,1)]}},MI:class extends vp{constructor(e,t){super(e,t);const i=ey(by(Mf,me(of,Mf),t),9,Mf,Lf),s=ey(i,9,Lf,Of),n=Ey(wf,((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,wf,this.innCont(1));Pe(i)&&(t=Ae(i))}return{[this.target.id]:t}}},MOM:class extends vp{constructor(e,t){super(e,t);const i=this.inputs.Period,s=by(xo.MOM,ge(Iy,i,xo.Close),t),n=Qg(s,this.inputs.Movement,xo.MOM,xo.MOMMA);this.addInner(s,n)}getWrappers(){return[this.wrapInner(xo.MOM,1),this.wrapInner(xo.MOMMA,2)]}},MFI:class extends vp{constructor(e,t){super(e,t);const i=dy(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,xo.TP,this.innCont(1)),n=this.past(e,i,xo.Volume).map((e=>null!=e?e:0));if(Pe(s)&&Pe(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 vp{constructor(e,t){super(e,t),Ly(this);const i=Qg(t,this.inputs.Period,this.source);this.addInner(i)}calculateAt(e){let t=null;const[i,s]=Oy(this),n=this.innVal(i+1,xo.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(ve(r))}return{[this.target.id]:t}}getWrappers(){const[e]=Oy(this);return[this.wrapInner(xo.MA,e+1)]}},NVI:class extends xf{constructor(e,t){super(e,Df,t)}},PVI:class extends xf{constructor(e,t){super(e,If,t)}},PPO:class extends Fp{constructor(e,t){super(e,Hp,t)}},PVO:class extends Fp{constructor(e,t){super(e,Vp,t)}},HV:class extends vp{constructor(e,t){super(e,t);const i=Math.sqrt(Hy(e.aggregation));if(0===i){const e=by(this.target,((e,t)=>null),t);this.addInner(e)}else{const s=function(e,t){let i=null;const s=this.baseVal(xo.MSD,t);return null!==s&&(i=100*s*e),{[xo.HV.id]:i}},n=gy(by(Nf,me((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{[Nf.id]:i}}),xo.Close),t),e.inputs.Period,Nf,xo.MSD),r=by(xo.HV,me(s,i),n);this.addInner(r)}}getWrappers(){return[this.wrapInner(this.target,1)]}},PERF:class extends vp{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 vp{constructor(e,t){super(e,t)}get helpers(){return[Rf]}ohlcVals(e){return[xo.Open,xo.High,xo.Low,xo.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(Rf)[e-1];Ze(s)||(s=0);const[n,r,o,a]=this.ohlcVals(e),[l,c,u,h]=this.ohlcVals(e-1);if(Pe([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{[Rf.id]:t,[this.target.id]:i}}},WWVOL:class extends vp{constructor(e,t){super(e,t);const i=uy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[Vf,Hf]}calculateAt(e){let t=null,i=null,s=null,n=null,r=this.innVal(1,xo.ATR,e);if(null!==r){const o=this.baseVal(xo.Close,e),a=this.baseVal(xo.Close,e-1),l=this.period;s=Math.max(...this.past(e,l,xo.Close)),n=Math.min(...this.past(e,l,xo.Close));const c=r*this.inputs.Constant;if(null===this.innVal(1,xo.ATR,e-1)){o>a?t=s-c:i=n+c}else{const r=[xo.WWVSARU,xo.WWVSARD,Vf,Hf],[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{[Vf.id]:s,[Hf.id]:n,[xo.WWVSARU.id]:t,[xo.WWVSARD.id]:i}}},PARTP:class extends vp{constructor(e,t){super(e,t)}get helpers(){return[Ff,Bf,kf]}hlcVals(e){return[xo.High,xo.Low,xo.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=[kf,xo.PARSARS,xo.PARSARL,Ff,Bf],[d,m,g,y,T]=c.map((t=>this.me(t,e-1))),S=1===d,A=S?g:m,v=T*Math.abs(y-A);r=S?A+v>l?-1:1:A-v<a?1:-1;const P=d===r;if(o=P?S?Math.min(A+v,h,this.baseVal(xo.Low,e-2)):Math.max(A-v,u,this.baseVal(xo.High,e-2)):y,s=P?S?Math.max(a,y):Math.min(l,y):1===r?a:l,n=T,P){(S?s>y:s<y)&&T<f&&(n=T+p)}else n=p;1===r?t=o:i=o}}return{[Ff.id]:s,[Bf.id]:n,[kf.id]:r,[xo.PARSARS.id]:i,[xo.PARSARL.id]:t}}},MOVLR:class extends vp{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(Pe(s)){const e=Ae(s),n=(i*Ae(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 vp{haveEnoughData=!1;firstUsefulIndex=0;constructor(e,t){super(e,t),this.s3=this.itr=[];const i=["VelocityUpTrend","VelocitySideTrend","VelocityDownTrend"].map((t=>e.inputs[t]||"3")).map(Number);Wf.splice(6,3,...i)}get helpers(){return[Uf]}prepareComputation(){const e=this.base.getData(xo.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=$f(s),this.itr=$f(s),this.haveEnoughData&&Kf(e,this.s3,s)}us(e,t){return this.container.getData(e)[t]}recalculateAt(e,t,i){const s=this.base.getData(xo.Close),n=s.length;this.haveEnoughData&&Kf(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(xo.Close,e)){let r=n(xo.TRSP1),o=n(xo.TRSP2);s=n(Uf),null===r&&null===o&&(r=o=this.baseVal(xo.Close,this.firstUsefulIndex)),null===s&&(s=1);const a=this.base.getData(xo.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=Yf(a,this.s3,this.itr,e,Wf),c=zf(a,this.s3,this.itr,e,Wf);[r,o]=jf(a,this.s3,this.itr,e,Wf,r,o,s,l,c),this.itr[e]>=0&&(t=r),this.itr[e]<=0&&(i=o)}return{[Uf.id]:s,[xo.TRSP1.id]:t,[xo.TRSP2.id]:i}}},COTLC:em,COTDAG:class extends Xf{constructor(e,t){super(e,2,t)}},COTFTR:class extends Xf{constructor(e,t){super(e,3,t)}},IMPVOL:class extends vp{constructor(e,t){super(e,Sp(t,(e=>new sm(e)))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(xo.IMPVOL,0)]}},CTM:class extends Fp{constructor(e,t){e.inputs={Period1:5,Period2:21,Period3:34},super(e,Np,t)}},CPMI:class extends Fp{constructor(e,t){e.inputs={Period1:3,Period2:5,Period3:8},super(e,Rp,t)}},DEMA:class extends vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.Period,this.source),s=ey(i,this.inputs.Period,i.target),n=Ey(xo.DEMA,((e,t,i)=>2*t-i),i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(xo.DEMA,1)]}},TEMA:class extends vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.Period,this.source),s=ey(i,this.inputs.Period,i.target),n=ey(s,this.inputs.Period,s.target),r=Ey(xo.TEMA,((e,t,i,s)=>3*(t-i)+s),i,s,n);this.addInner(r)}getWrappers(){return[this.wrapInner(xo.TEMA,1)]}},TSI:class extends vp{constructor(e,t){super(e,t);const i=(e,t,i,s,n,r)=>{const o=ey(e,t,i,s);return ey(o,n,s,r)},s=by(lm,me(((e,t)=>({[e.id]:Math.abs(this.baseVal(xo.Change,t))})),lm),t),n=i(t,e.inputs.Period1,xo.Change,cm,e.inputs.Period2,um),r=i(s,e.inputs.Period1,lm,hm,e.inputs.Period2,dm),o=Ey(xo.TSI,((e,t,i)=>100*t/i),n,r),a=ey(o,e.inputs.Period3,xo.TSI,xo.TSISIG);this.addInner(o,a)}getWrappers(){return[this.wrapInner(xo.TSI,1),this.wrapInner(xo.TSISIG,2)]}},ADJATR:class extends vp{constructor(e,t){super(e,t);const i=by(jp,me(((e,t)=>{let i=0;return t>0&&(i=this.baseVal(e,t)-this.baseVal(e,t-1)),{[jp.id]:Math.abs(i)}}),this.source),t),s=xy(e,"MA")(i,this.inputs.Period,jp,Kp),n=Ey(xo.ADJATR,((e,t)=>2*t),s);this.addInner(n)}getWrappers(){return[this.wrapInner(xo.ADJATR,1)]}},COTR:class extends vp{constructor(e,t){super(e,t);const i=by(qp,(e=>{let t=0;return e>0&&(t=this.baseVal(xo.Close,e)-this.baseVal(xo.Close,e-1)),{[qp.id]:t}}),t),s=Ry(e)(t,this.inputs.Period,this.inputs.Smoothing),n=Ey(this.target,((e,t,i)=>Ze(t)&&Ze(i)?t/i:null),i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCGD:class extends vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.Period,xo.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,xo.EMA,e);if(Xe(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 vp{constructor(e,t){super(e,t);const i=this.inputs.Period,s=Math.floor(i/2),n=this.allowEmptyValues,r=iy(t,s,this.source,xo.WMA,n),o=iy(t,i,this.source,xo.WMA,n),a=iy(Ey(pm,((e,t,i)=>2*t-i),r,o),Math.floor(Math.sqrt(i)),pm,this.target,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},COPP:class extends vp{constructor(e,t){super(e,t);const i=py(t,this.inputs.PeriodRocLong),s=py(t,this.inputs.PeriodRocShort),n=iy(Ey(fm,((e,t,i)=>t+i),i,s),this.inputs.PeriodWma,fm,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},REATRHI:class extends Tm{constructor(e,t){super(e,!0,t)}},REATRLO:class extends Tm{constructor(e,t){super(e,!1,t)}},LINRCHN:class extends vp{constructor(e,t){super(e,t);const i=this.inputs.Period,s=by(xo.LINRMID,me((function(e,t){let i=null;if(t>=this.base.size-e){const s=e*(e+1)/2,n=s*s,r=e*(e+1)*(2*e+1)/6;let o=0,a=0,l=1;for(let t=e-1;t>=0;--t){const e=this.baseVal(xo.Close,this.base.size-1-t);o+=e,a+=l*e,l+=1}const c=(e*a-s*o)/(e*r-n);i=o/e-c*s/e+c*(t-this.base.size+e+1)}return{[xo.LINRMID.id]:i}}),i),t),n=by(this.source,(function(e){return{[this.target.id]:this.baseVal(this.target,e)}}),t),r=gy(Ey(Sm,((e,t,i)=>t-i),n,s),i,Sm);this.addInner(s,r)}calculateAt(e){const t=this.innVal(1,xo.LINRMID,e),i=Oe(this.innCont(2).getData(xo.MSD));let s=null,n=null;if(Ze(t,i)){const e=this.inputs.Width;s=t+e*i,n=t-e*i}return{[xo.LINRUP.id]:s,[xo.LINRLOW.id]:n}}getWrappers(){return[this.wrapInner(xo.LINRMID,1)]}},CSHO:class extends vp{constructor(e,t){super(e,t,Sp(t,(e=>{const t=rt(e);t.symbol=Jt(e.symbol);return Ze(t.symbol)?new Eh(t):new _h(t,!0)}))),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){const e=this.innCont(0);if(!Ze(e)||0===e.size)return;const t=this.innCont(1),i=e.getTimeData(),s=t.getTimeData(),n=t.getData(xo.Close),r=Array(i.length).fill(null);if(!(this.innerSeries[1]instanceof _h)){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(No.TS_MANYCHANGED,-1))}},CSHB:class extends vp{constructor(e,t){super(e,t,Ty(t))}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e===this.innerSeries[1]&&this.innHasData(0)&&this.innHasData(1)}calculateAt(e){const t=(t,i)=>Ze(this.innCont(t))?this.innVal(t,i,e):null,i=t(0,xo.Close),s=t(1,xo.CSHO);return{[this.target.id]:Ze(s)&&Ze(i)?s-i:null}}},CTPI:class extends zp{constructor(e,t){e.inputs={Period1:5,Period2:3,Period3:3},super(e,!0,xo.CTPI,t)}},PCTCHG:class extends vp{constructor(e,t){super(e,t),Ly(this)}calculateAt(e){let t=null;const[i]=Oy(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 _p{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(xo.TradeSize,xo.Change)}},STOMOMIX:class extends vp{constructor(e,t){super(e,t);const i=ry(t,e.inputs.Period1,xo.High,xo.HH,!0),s=ry(t,e.inputs.Period1,xo.Low,xo.LL,!1),n=ey(Ey(vm,((e,t,i)=>this.baseVal(xo.Close,e)-(t+i)/2),i,s),e.inputs.Period2,vm,Pm),r=ey(n,e.inputs.Period2,Pm,Cm),o=ey(Ey(bm,((e,t,i)=>t-i),i,s),e.inputs.Period2,bm,Em),a=ey(o,e.inputs.Period2,Em,_m),l=Ey(xo.STOMOMIX,((e,t,i)=>100*t/i),r,a);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},CHDMOMOSC:class extends vp{constructor(e,t){super(e,t);const i=by(Mm,(function(e){const t=xo.Close,i=e>0?this.baseVal(t,e)-this.baseVal(t,e-1):0;return{[Mm.id]:i}}),t),s=Ey(Lm,((e,t)=>t>=0?t:0),i),n=Ey(Om,((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,Lm,this.innCont(1)),n=this.past(e,i,Om,this.innCont(2));if(Pe(s)&&Pe(n)){const e=Ae(s),i=Ae(n);t=this.perc(e-i,e+i)}}return{[this.target.id]:t}}},VSTOP:class extends vp{constructor(e,t){super(e,t);const i=uy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[wm,Im,Dm]}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null,a=1;const l=this.baseVal(xo.Close,e),c=e=>((e,t)=>Ze(e)?e:t)(e,0),u=(e,t)=>this.container.getData(e)[t];e>0&&(s=Math.max(c(u(wm,e-1)),l),r=Math.min(c(u(Im,e-1)),l),a=u(Dm,e-1));const h=this.inputs.Multiplier,d=this.innVal(1,xo.ATR,e);if(Ze(d)){const c=1===a,p=c?s-h*d:r+h*d;let f=u(c?xo.VSTOPUP:xo.VSTOPLOW,e-1);Ze(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{[xo.VSTOPUP.id]:1===o?t:null,[xo.VSTOPLOW.id]:1===o?null:t,[wm.id]:i,[Im.id]:n,[Dm.id]:o}}},SUPTR:class extends vp{constructor(e,t){super(e,t);const i=uy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[xm,Nm,Rm,xo.BARCOLIX]}calculateAt(e){let t=0,i=0,s=0,n=null,r=0;const o=this.innVal(1,xo.ATR,e);if(Ze(o)){const a=(e,t)=>Ze(e)?e:t,l=[xo.Close,xo.High,xo.Low],[c,u,h]=l.map((t=>this.baseVal(t,e))),d=(u+h)/2,p=this.baseVal(xo.Close,e-1),f=this.inputs.Multiplier,m=d-f*o,g=d+f*o,y=[xm,Nm,Rm],[T,S,A]=y.map((t=>this.container.getData(t)[e-1]));t=p>T?Math.max(m,T):m,i=p<S?Math.min(g,S):g,s=c>S?1:c<T?-1:a(A,1);const v=1===s;n=v?t:i,r=v?1:0}return{[xm.id]:t,[Nm.id]:i,[Rm.id]:s,[xo.SUPTR.id]:n,[xo.BARCOLIX.id]:r}}},ICHCLD:class extends vp{constructor(e,t){super(e,t);const i=(e,t,i)=>Ey(i,((e,t,i)=>(t+i)/2),e,t),s=(e,s)=>i((e=>ry(t,e,xo.Low,xo.LL,!1))(e),(e=>ry(t,e,xo.High,xo.HH,!0))(e),s),n=s(e.inputs.PeriodConversionLine,xo.CONVLN),r=s(e.inputs.PeriodBaseLine,xo.BASELN),o=i(n,r,xo.LEADSP1),a=s(e.inputs.PeriodLaggingSpan2,xo.LEADSP2);this.addInner(n,r,o,a)}get helpers(){return[xo.BARCOLIX]}calculateAt(e){const t=this.innVal(3,xo.LEADSP1,e)>this.innVal(4,xo.LEADSP2,e)?1:0;return{[xo.LAGGSP.id]:this.baseVal(xo.Close,e),[xo.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(xo.CONVLN,1),this.wrapInner(xo.BASELN,2),this.wrapInner(xo.LEADSP1,3),this.wrapInner(xo.LEADSP2,4)]}},VWAP:class extends Bm{constructor(e,t){super(e,t)}get helpers(){return[Hm,Vm,Fm]}isSame(e,t){switch(this.inputs.AnchorPeriod){case"Session":default:return gr(e,t);case"Week":return Cr(e,t);case"Month":return yr(e,t);case"Quarter":return Sr(e,t);case"Year":return br(e,t);case"Decade":return Nu(e,t);case"Century":return Ru(e,t)}}findPrevPeriodChange(e){for(let t=e;t>0;t--)if(1===this.valueAt(Fm,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):Ci.ZERO_DATE,l=this.dateAt(e),c=o&&this.isSame(a,l),u=c?this.valueAt(Hm,e-1):0,h=c?this.valueAt(Vm,e-1):0,d=this.innVal(0,xo.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(xo.VWAP).slice(o,e);a.push(t);const l=ve(a),c=a.map((e=>(e-l)*(e-l))),u=Math.sqrt(ve(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{[Hm.id]:p,[Vm.id]:f,[Fm.id]:c?0:1,[xo.VWAP.id]:t,[xo.VWAPSD1U.id]:i,[xo.VWAPSD1L.id]:s,[xo.VWAPSD2U.id]:n,[xo.VWAPSD2L.id]:r}}},MACROSS:class extends vp{constructor(e,t){super(e,t);const i=xy(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,xo.MAS),n=i(t,e.inputs.Period2,this.source,xo.MAL);this.addInner(s,n)}get helpers(){return Um}calculateAt(e){const t=this.innVal(1,xo.MAS,e),i=this.innVal(2,xo.MAL,e);return Wm(this.container,e,t,i)}getWrappers(){return[this.wrapInner(xo.MAS,1),this.wrapInner(xo.MAL,2)]}},PACROSS:class extends vp{constructor(e,t){super(e,t),Ly(this);const i=xy(e,"MA","Average")(t,e.inputs.Period,this.source);this.addInner(i);const[s]=Oy(this);this._maIndex=s+1,this._maTarget=i.target}get helpers(){return Um}calculateAt(e){const t=this.innVal(this._maIndex,this._maTarget,e),[,i]=Oy(this),s=i.getData(this.source)[e],n=Wm(this.container,e,s,t);return n[this.target.id]=t,n}},VOIN:class extends vp{constructor(e,t){super(e,t);const i=by($m,(function(e){return{[$m.id]:e>0?Math.abs(this.baseVal(xo.High,e)-this.baseVal(xo.Low,e-1)):null}}),t),s=by(Gm,(function(e){return{[Gm.id]:e>0?Math.abs(this.baseVal(xo.Low,e)-this.baseVal(xo.High,e-1)):null}}),t),n=cy(t,xo.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,$m,this.innCont(1)),r=this.past(e,s,Gm,this.innCont(2)),o=this.past(e,s,xo.TR,this.innCont(3));if(Pe(n)&&Pe(r)&&Pe(o)){const e=Ae(n),s=Ae(r),a=Ae(o);t=e/a,i=s/a}}return{[xo.PLVI.id]:t,[xo.MNVI.id]:i}}},DIFA:class extends vp{constructor(e,t){super(e,t);const i=xy(e,"MA","Average")(t,this.period,this.source,jm);this.isPercent="Percentage"===e.inputs.Distance,this.addInner(i)}get helpers(){return[xo.BARCOLIX]}calculateAt(e){let t=null,i=null;const s=this.innVal(1,jm,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,[xo.BARCOLIX.id]:i}}},DOSC:class extends vp{constructor(e,t){super(e,t);const i=ey(fy(t,this.inputs.PeriodRsi,this.source,xo.RSI),this.inputs.PeriodEma1,xo.RSI,xo.EMA),s=ey(i,this.inputs.PeriodEma2,xo.EMA,xo.EMA),n=Qg(s,this.inputs.PeriodMa,xo.EMA,xo.MA);const r=Ey(xo.DOSCH,((e,t,i)=>t-i),s,n),o=Qg(r,this.inputs.PeriodSig,xo.DOSCH,xo.DOSCS);this.addInner(r,o)}getWrappers(){return[this.wrapInner(xo.DOSCH,1),this.wrapInner(xo.DOSCS,2)]}},BSQUEEZE:class extends Yp{constructor(e,t){super(e,"Squeeze",t)}},MARIB:class extends vp{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 e=0;e<n;++e){const n=Qg(t,i+e*s,this.source,this.outFields[e]);this.addInner(n)}}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 vp{constructor(e,t){super(e,t);const i=xy(e,"EMA","Smoothing1"),s=e.inputs.Period1,n=i(t,s,xo.Open),r=i(t,s,xo.High),o=i(t,s,xo.Low),a=i(t,s,xo.Close),l=Ey(Zm,((e,t,i,s,n)=>(t+i+s+n)/4),n,r,o,a);const c=Ey(Km,(function(e,t,i,s){let n=null;if(e>0){const s=this.container.getData(Km)[e-1],r=this.innVal(2,Zm,e-1);Ze(s,r)?n=(s+r)/2:Ze(t,i)&&(n=(t+i)/2)}return n}),n,a,l),u=Ey(qm,((e,t,i,s)=>Ze(t,i,s)?Math.max(t,Math.max(i,s)):null),r,c,l),h=Ey(Xm,((e,t,i,s)=>Ze(t,i,s)?Math.min(t,Math.min(i,s)):null),o,c,l),d=xy(e,"EMA","Smoothing2"),p=e.inputs.Period2,f=d(c,p,Km,xo.Open),m=d(u,p,qm,xo.High),g=d(h,p,Xm,xo.Low),y=d(l,p,Zm,xo.Close),T=by(xo.Change,(function(e){let t=null;if(e>0){const i=this.baseVal(xo.Close,e),s=this.baseVal(xo.Close,e-1);Ze(i,s)?t=i-s:Ze(i)&&!Ze(s)&&(t=0)}return{[xo.Change.id]:t}}),y);this.addInner(f,m,g,y,T)}getWrappers(){return[this.wrapInner(xo.Open,1),this.wrapInner(xo.High,2),this.wrapInner(xo.Low,3),this.wrapInner(xo.Close,4),this.wrapInner(xo.Change,5)]}},TTMSQZ:class extends vp{constructor(e,t){super(e,t);const i=e.inputs,s=ey(t,i.PeriodEmaKeltner,xo.Close),n=uy(t,i.PeriodAtrKeltner);function r(e,t,i,s){return Ze(i,s)?i+e*s:null}const o=i.MultiplierKeltner,a=Ey(xo.KCUP,me(r,o),s,n),l=Ey(xo.KCLOW,me(r,-o),s,n),c=Ay(t,i.PeriodBollinger,i.WidthBollinger),u=vy(t,i.PeriodMomentum),h=Qg(t,i.PeriodMomentum,xo.Close);const d=Py(Ey(Jm,(function(e,t,i,s){let n=null;const r=this.innVal(1,xo.DONMID,e);return Ze(r,s)&&(n=t-(r+s)/2),n}),t,u,h),i.PeriodMomentum,Jm,xo.TTMSQZOSC);this.addInner(a,l,c,d)}get helpers(){return[xo.BARCOLIX]}calculateAt(e){let t=null,i=null,s=-1;const n=this.innVal(1,xo.KCUP,e),r=this.innVal(2,xo.KCLOW,e),[o,a]=[xo.BOLLBU,xo.BOLLBL].map((t=>this.innVal(3,t,e)));o<n&&a>r?t=0:i=0;const l=this.innVal(4,xo.TTMSQZOSC,e),c=e>0?this.innVal(4,xo.TTMSQZOSC,e-1):null;if(Ze(l))if(Ze(c)){const e=c<l;s=l>=0?e?3:2:e?1:0}else s=2;return{[xo.TTMSQZON.id]:t,[xo.TTMSQZOFF.id]:i,[xo.BARCOLIX.id]:s}}getWrappers(){return[this.wrapInner(xo.TTMSQZOSC,4)]}},CRS:class extends vp{constructor(e,t){if(super(e,t),Fy(t)){const i=SP().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.inputs.Symbol.toUpperCase();const n=i.getTimeSeries(s),r=e=>e.query?.symbol,o=(e,t)=>`{${r(e)}} / {${r(t)}}`,{model:a}=Xr(o(t,n),!1),l=(e=>{const t=e.unit===C.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:p.Manual,missing:t?h.UseNext:h.UsePrevious,stretch:e=>!1,fieldMap:new Map([[xo.Close,xo.CRS]]),noDataApproach:m.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation),c=new Ym(a,[t,n],l),u=xy(e,"MA","Average")(c,this.period,xo.CRS,xo.CRSAVG);this.addInner(n,c,u),this.canLoadMoreData=!0,this.initialNotification=!0}else{const e=by(xo.Close,((e,t)=>null),t),i=by(xo.CRS,((e,t)=>null),t),s=by(xo.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(xo.CRS,2),this.wrapInner(xo.CRSAVG,3)]}},JPI:fg,CTTP:class extends fg{constructor(e,t){const i=Rn("JPI");e.inputs=ct(i.defaults.inputs.filter((e=>"HandbrakePeriod"!==e.name))),super(e,t)}},DRS:class extends vp{get indexSymbol(){return this.inputs[Ci.INPUT_SYMBOL]}constructor(e,t){if(super(e,t),Fy(t)){const i=SP().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.indexSymbol;const n=i.getTimeSeries(s),r=`{${t.query.symbol}} / {${n.query.symbol}} * 100`,{model:o}=Xr(r,!1),a=(e=>{const t=e.unit===C.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:p.Manual,missing:t?h.UseNext:h.UsePrevious,stretch:e=>!1,fieldMap:new Map([[xo.Close,xo.DRS]]),noDataApproach:m.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation),l=new Ym(o,[t,n],a);this.addInner(n,l),this.canLoadMoreData=!0,this.initialNotification=!0}else{const e=by(xo.Close,((e,t)=>null),t),i=by(xo.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(xo.DRS,2)]}},MRS:class extends vp{get indexSymbol(){return this.inputs[Ci.INPUT_SYMBOL]}constructor(e,t){super(e,t);const i=yy(t,this.indexSymbol,e.aggregation),s=Qg(i,this.period,xo.DRS);this.addInner(i,s),this.canLoadMoreData=!0,this.initialNotification=!0}calculateAt(e){const t=this.innVal(1,xo.DRS,e),i=this.innVal(2,xo.MA,e);let s=null;return Ze(t,i)&&0!==i&&(s=100*(t/i-1)),{[xo.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 vp{constructor(e,t){super(e,t);const i=py(t,1),s=e.aggregation,n=yg(i,this.inputs.Period1,s,xo.ROC,mg),r=yg(Ey(gg,((e,t)=>10*t),n),this.inputs.Period2,s,gg,xo.PMO),o=ey(r,this.inputs.Period3,xo.PMO,xo.PMOS);this.addInner(r,o)}getWrappers(){return[this.wrapInner(xo.PMO,1),this.wrapInner(xo.PMOS,2)]}},RVOL:class extends vp{constructor(e,t){super(e,t);const i=xy(e,"MA")(t,this.period,xo.Volume,Tg,!0);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(0,xo.Volume,e),s=this.innVal(1,Tg,e);return Ze(i,s)&&0!==s&&(t=i/s),{[this.target.id]:t}}},WGALPH:class extends vp{isFeasible=!0;constructor(e,t){super(e,t),this.isFeasible=!(t instanceof _h||Ag.includes(v[t.query.curveStyle])),this.isDaily=e.aggregation.unit===C.Day}acceptable(e,t,i,s){if(!this.isDaily)return e>0&&i-t>=5;if(0===s)return!0;return!Cr(this.baseVal(xo.DateTime,t),this.baseVal(xo.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*Sg[e]+1,i*=t}t=100*(i-1)}return{[this.target.id]:t}}},VOLAP:class extends vp{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(xo.Change,xo.Open,xo.Close)}},AVWAP:class extends Bm{constructor(e,t){super(e,t)}get helpers(){return[Hm,Vm]}isSameOhlcBar(e,t){const{unit:i,size:s}=this.aggregation;switch(i){case C.Tick:return e===t;case C.Intraday:return Ao(t,Jc(e,s));case C.Day:return Ao(t,Kc(e,s));case C.Week:return Cr(e,t);case C.Month:return yr(e,t);case C.Quarter:return Sr(e,t);case C.Year:return br(e,t);default:throw new Error(`Unexpected aggregation unit ${C[i]}`)}}calculateAt(e){let t=null,i=null,s=null;const n=this.inputs.Anchor,r=this.dateAt(e);if(Ao(n,r)||this.isSameOhlcBar(r,n)){const n=e>0,r=n?this.valueAt(Hm,e-1):0,o=n?this.valueAt(Vm,e-1):0,a=this.innVal(0,xo.Volume,e);i=r+this.innVal(1,this.source,e)*a,s=o+a,t=i/s}return{[Hm.id]:i,[Vm.id]:s,[xo.AVWAP.id]:t}}},KST:class extends vp{constructor(e,t){super(e,t);const i=this.source,s=by(i,me(wy,i),t),n=py(s,this.inputs.PeriodRoc1,i),r=py(s,this.inputs.PeriodRoc2,i),o=py(s,this.inputs.PeriodRoc3,i),a=py(s,this.inputs.PeriodRoc4,i),l=Qg(n,this.inputs.PeriodMa1,xo.ROC,xo.MA1),c=Qg(r,this.inputs.PeriodMa2,xo.ROC,xo.MA2),u=Qg(o,this.inputs.PeriodMa3,xo.ROC,xo.MA3),h=Qg(a,this.inputs.PeriodMa4,xo.ROC,xo.MA4),d=Ey(xo.KST,((e,t,i,s,n)=>t+2*i+3*s+4*n),l,c,u,h),p=Qg(d,this.inputs.PeriodSig,xo.KST,xo.KSTSIG);this.addInner(d,p)}getWrappers(){return[this.wrapInner(xo.KST,1),this.wrapInner(xo.KSTSIG,2)]}},STC:class extends vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.PeriodShort,xo.Close,vg),s=ey(t,this.inputs.PeriodLong,xo.Close,Pg),n=Ey(Cg,((e,t,i)=>t-i),i,s),r=this.inputs.PeriodStoch1,o=this.inputs.PeriodStoch2,a=xy(e,"EMA"),l=a(oy(n,r,bg,!1,Cg),o,bg,Eg),c=a(oy(l,r,_g,!1,Eg),o,_g,this.target);this.addInner(c)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCCLO:class extends wg{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){const s=(e,t,i)=>t-i,n="Yes"===this.inputs.RatioAdjusted,r=Ey(Og,n?(e,t,i)=>(t-i)/(t+i)*1e3:s,t,i),o=ey(r,this.inputs.Period1,Og,Mg),a=ey(r,this.inputs.Period2,Og,Lg);return Ey(this.target,s,o,a)}},NHLAI:xg,CMBCI:class extends vp{constructor(e,t){super(e,t);const i=fy(t,this.inputs.Period1Rsi,xo.Close,Ng),s=by(Rg,ge(Iy,this.inputs.Period1Mom,Ng),i),n=Qg(fy(t,this.inputs.Period2Rsi,xo.Close,Hg),this.inputs.Period2Ma,Hg,Vg),r=Ey(xo.CMBCI,((e,t,i)=>t+i),s,n),o=Qg(r,this.inputs.PeriodFastMa,xo.CMBCI,xo.CMBCIF),a=Qg(r,this.inputs.PeriodSlowMa,xo.CMBCI,xo.CMBCIS);this.addInner(r,o,a)}getWrappers(){return[this.wrapInner(xo.CMBCI,1),this.wrapInner(xo.CMBCIF,2),this.wrapInner(xo.CMBCIS,3)]}},COTI:class extends vp{constructor(e,t){super(e,function(e){return new em({source:xo.Close,inputs:{},outFields:Zg("COTLC")},e)}(t));const i=Number.parseInt(this.inputs.History),s=6===i?26:52*i,n=oy(this.innerSeries[0],s,xo.COTI,!1,xo.COTLCCMSP);this.initialNotification=!0,this.computedServerSide=!0,this.addInner(n)}getWrappers(){return[this.wrapInner(xo.COTI,1)]}},CHEXI:class extends vp{constructor(e,t){super(e,t),this.isLong="Long"===this.inputs.Direction;const i=this.period,s=uy(t,i),n=this.inputs.Multiplier,r=Ey(Fg,((e,t)=>null===t?null:n*t),s),o=ry(t,i,xo.High,xo.HH,!0),a=ry(t,i,xo.Low,xo.LL,!1);this.addInner(r,o,a)}calculateAt(e){let t=null,i=null;const s=this.innVal(1,Fg,e);if(null!==s)if(this.isLong){t=this.innVal(2,xo.HH,e)-s}else{i=this.innVal(3,xo.LL,e)+s}return{[xo.CHEXL.id]:t,[xo.CHEXS.id]:i}}},MBBANDS:class extends Yp{constructor(e,t){super(e,"Modified",t)}},OPTIV:class extends Bg{},IVRANK:class extends Bg{},IVPCTL:class extends Bg{},OPTVOLPC:class extends Bg{},OPTOIPC:class extends Bg{},OPTVOL:class extends Bg{},OPTOI:class extends Bg{},CHOP:class extends vp{constructor(e,t){super(e,t);const i=uy(t,1),s=this.inputs.Period,n=ry(t,s,xo.High,xo.HH,!0),r=ry(t,s,xo.Low,xo.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,xo.ATR,this.innCont(1));if(Pe(s)){const n=Ae(s)/(this.innVal(2,xo.HH,e)-this.innVal(3,xo.LL,e));t=100*Math.log10(n)/Math.log10(i)}}return{[this.target.id]:t}}},MACLD:class extends vp{constructor(e,t){super(e,t);const i=xy(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,xo.MACLD1),n=i(t,e.inputs.Period2,this.source,xo.MACLD2);this.addInner(s,n)}get helpers(){return[xo.BARCOLIX]}calculateAt(e){const t=this.innVal(1,xo.MACLD1,e)>this.innVal(2,xo.MACLD2,e)?1:0;return{[xo.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(xo.MACLD1,1),this.wrapInner(xo.MACLD2,2)]}},BTI:class extends wg{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){const s=Ey(kg,((e,t,i)=>t/(t+i)),t,i);return xy(e,"MA","Average")(s,this.inputs.Period,kg,this.target)}},PC:class extends vp{constructor(e,t){super(e,t),this.unitsPerYear=Hy(e.aggregation),this.stdDevs=this.toInt("StandardDeviations"),this.periodForecast=this.toInt("PeriodForecast");const i=this.getHistVolPeriod();if(null!==i){const s=Cy(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(xo.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(xo.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{[xo.PCUP1.id]:t,[xo.PCDN1.id]:i,[xo.PCUP2.id]:s,[xo.PCDN2.id]:n,[xo.PCUP3.id]:r,[xo.PCDN3.id]:o}}recalculateAt(e,t,i){const s={tag:yt(),src:this.innerSeries[0]};i&&this.calculate(s)}},GREEKS:class extends vp{constructor(e,t){super(e,Sp(t,(e=>new Ug(e)))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(xo.Delta,0),this.wrapInner(xo.Gamma,0),this.wrapInner(xo.Theta,0),this.wrapInner(xo.Vega,0)]}}};function jg(e){return{[Ci.INPUT_PERIOD]:e}}function Kg(e){return{[Ci.INPUT_SYMBOL]:e}}function qg(e){return{target:e,source:null,inputs:ly}}function Xg(e,t,i){if(st(Yg,e))return new Yg[e](t,i);const s=SP()?.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 Zg(e){return Rn(e).defaults.curves.reduce(((e,t)=>e.concat(t.fields.filter((t=>!e.includes(t))))),[]).map((e=>xo[e]))}function Jg(e,t,i,s){return{source:t,target:i,inputs:jg(e),allowEmptyValues:s}}function Qg(e,t,i,s=xo.MA,n=!1){return Xg("MA",Jg(t,i,s,n),e)}function ey(e,t,i,s=xo.EMA,n=!1){return Xg("MAEXP",Jg(t,i,s,n),e)}function ty(e,t,i,s=xo.SMA,n=!1){return Xg("MASMO",Jg(t,i,s,n),e)}function iy(e,t,i,s=xo.WMA,n=!1){return Xg("MAWEI",Jg(t,i,s,n),e)}function sy(e,t,i,s=xo.HMA,n=!1){return Xg("HMA",Jg(t,i,s,n),e)}function ny(e,t,i,s,n=xo.Close){return Xg("MACDEXP",{source:n,inputs:{Period1:t,Period2:i,Period3:s},outFields:[xo.MACD,xo.MACDS,xo.MACDH]},e)}function ry(e,t,i,s,n,r=!1){return new Wp({source:i,target:s,inputs:jg(t)},n,r,e)}function oy(e,t,i,s,n=null){return new $p({source:n,target:i,inputs:jg(t)},s,e)}function ay(e,t,i=xo.PCTCHG){return Xg("PCTCHG",{source:t,target:i,inputs:ly},e)}const ly={};function cy(e,t=xo.TR){return Xg("_TR",qg(t),e)}function uy(e,t,i="SMA",s=xo.ATR){return Xg("ATR",{target:s,inputs:{[Ci.INPUT_PERIOD]:t,[Ci.INPUT_SMOOTHING]:i},source:null},e)}function hy(e,t=xo.ADL){return Xg("ADL",qg(t),e)}function dy(e,t=xo.TP){return Xg("TP",qg(t),e)}function py(e,t,i=xo.Close,s=xo.ROC){return Xg("ROC",{source:i,target:s,inputs:jg(t)},e)}function fy(e,t,i,s=xo.RSI,n=!1){return Xg("_RSI",{source:i,target:s,inputs:{...jg(t),Modified:n}},e)}function my(e,t=xo.MFMUL){return Xg("MFV",qg(t),e)}function gy(e,t,i,s=xo.MSD){return Xg("MSD",{source:i,target:s,inputs:jg(t)},e)}function yy(e,t,i,s=xo.DRS){return Xg("DRS",{target:s,inputs:Kg(t),aggregation:i,source:null},e)}function Ty(e,t=xo.CSHO){return Xg("CSHO",qg(t),e)}function Sy(e,t,i){const s="TCHN";return Xg(s,{inputs:{PeriodUpper:t,PeriodLower:t,Range:i},outFields:Zg(s),source:null},e)}function Ay(e,t,i,s=xo.Close){const n="BBANDS",r=Zg(n);return Xg(n,{source:s,inputs:{[Ci.INPUT_PERIOD]:t,[Ci.INPUT_WIDTH]:i},outFields:r},e)}function vy(e,t){const i="DONCHN",s=Zg(i);return Xg(i,{inputs:jg(t),outFields:s,source:null},e)}function Py(e,t,i,s=xo.MOVLR){return Xg("MOVLR",{source:i,inputs:jg(t),target:s},e)}function Cy(e,t,i,s=xo.Close,n=xo.HV){return Xg("HV",{source:s,target:n,aggregation:i,inputs:jg(t)},e)}function by(e,t,i){return new af(qg(e),t,i)}function Ey(e,t,...i){return new nf(qg(e),t,...i)}function _y(e,t,i){return t-i}function My(e,t,i){return(t-i)/i*100}function Ly(e){const t=e.source;if(e.sourceNeedsCompute=function(e){switch(e.id){case"HL/2":case"HLC/3":case"OHLC/4":case"HLCC/4":return!0;default:return!1}}(t),e.sourceNeedsCompute){const i=by(t,me(wy,t),e.innerSeries[0]);e.addInner(i)}}function Oy(e){const t=e.sourceNeedsCompute?1:0;return[t,e.innCont(t)]}const wy=function(e,t){const i=[xo.Open,xo.High,xo.Low,xo.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"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:ty,ma:Qg,ema:ey,wma:iy,hma:sy};function xy(e,t,i="Smoothing"){const s=(e.inputs[i]??t).toLowerCase();return Dy[s]}const Ny={atr:uy,adjatr:function(e,t,i="MA",s=xo.Close,n=xo.ADJATR){return Xg("ADJATR",{source:s,target:n,inputs:{[Ci.INPUT_PERIOD]:t,[Ci.INPUT_SMOOTHING]:i}},e)}};function Ry(e){const t=e.inputs.TypeOfATR.toLowerCase();return Ny[t]}function Hy(e){switch(e.unit){case C.Day:return 252;case C.Week:return 52;case C.Month:return 12;default:return 0}}function Vy(e){const t=[xo.High,xo.Low];return e instanceof Ym&&2!==Le(e.targetFields,t).length}function Fy(e){return!(e instanceof _h)&&e.query instanceof yp}class By extends Pp{constructor(e,t){super(e,t,ey(t,13,xo.Close),ny(t,12,26,9,xo.Close)),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=y.Same;const i=this.innVal(1,xo.EMA,e),s=this.innVal(1,xo.EMA,e-1),n=this.innVal(2,xo.MACDH,e),r=this.innVal(2,xo.MACDH,e-1);return Ze(i,s,n,r)&&(i>s&&n>r?t=y.Up:i<s&&n<r&&(t=y.Down)),{[xo.BREL.id]:t}}getWrappers(){return this.wrapBaseFields(xo.Open,xo.High,xo.Low,xo.Close,xo.Change,xo.Volume,xo.OpenInterest)}}function ky(e,t){return Ze(t)?(this[e]=t,null):this[e]}class Uy{constructor(){this._domain=this._range=this._extent=null,this._padding=[0,0]}domain(e){return ky.call(this,"_domain",e)}range(e){return ky.call(this,"_range",e)}padding(e){return ky.call(this,"_padding",e)}get ready(){return Ze(this._domain,this._range)}}const Wy=1/Math.log2(10);function $y(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 Gy(e){return Math.sign(e)*Math.log10(1+Math.abs(e/Wy))}function zy(e){return Math.sign(e)*Wy*(-1+Math.pow(10,Math.abs(e)))}const Yy=[[0,1],[1,10],[10,100],[100,1e3],[1e3,1e4],[1e4,1e5]];class jy extends Uy{constructor(e,t){super(),this.scaleType=e,this.axis=t}domain(e){return this.axis&&e&&!Ee(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=Te,s=Te;switch(this.scaleType){case B.Linear:break;case B.Logarithmic:i=Gy,s=zy;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?$y(r,n):$y(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===B.Linear||s<0||n>1e5)return Ky(t,i,e);const r=this.findLogBand(s),o=this.findLogBand(n),a=2*e;return o-r==0?Ky(t,i,a):this.getLogTicks(r,o,a,i<t)}findLogBand(e){return Yy.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]=Yy[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=Ky(c,u,i);r=s?h.concat(r):r.concat(h)}}finally{this.domain(n)}return Fe(r,s?(e,t)=>e>t:(e,t)=>e<t),r}checkTicks(){return this.scaleType===B.Logarithmic}}function Ky(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 qy={color:Ci.COLOR_TRANSPARENT},Xy={color:Ci.COLOR_TRANSPARENT,width:0,dashStyle:"Solid"},Zy=[xo.Open,xo.High,xo.Low,xo.Close],Jy=new Set(Zy.map((e=>e.id))),Qy=new vs(0,0,0,0);class eT{notifyAboutPriceDomains=!1;customPlotValues=!1;_firstVisibleDate=null;_lastVisibleDate=null;main=!1;curves=[];type=U.Symbol;isShutDown=!1;targetFields=[];yScale=null;visible=!0;constructor(){this.axis=null,this.id=yt(),this.record=new Bo(""),this.metaData=new Yi,this.timeSeries=new _h,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&&Ze(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(e){return null}get isSymbol(){return this.is(U.Symbol)}get isExpression(){return this.is(U.Expression)}get isStudy(){return this.is(U.Study)}get isForward(){return this.is(U.Forward)}get isSeasonal(){return this.is(U.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 Cp(i(Lu.slice()),e);else if(this.mainCurve.isElderImpulseSystemStyle){const s=Lu.slice().concat(xo.BREL);t=new By(i(s),e)}else this.mainCurve.isPercentChangeStyle&&(t=new Am(i(Lu.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=U[e.type];const t=e;this.main=t.main,t.levels&&(this.levels=t.levels),t.bands&&(this.bands=t.bands),Ze(t.precision)&&(this.precision=t.precision),this.curves=e.curves.map((e=>{const t=new Yd;return t.plot=this,t.fromModel(e),t})),t.detachedScale&&(this.detachedScale=t.detachedScale,this.yScale=new jy(B.Linear,null)),this.visible=t.visible??!0}initialize(){}shutdown(){Ze(this.timeSeries)&&Ze(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){const e=this.axis.pane.presenter,t=new yp(null,e.data.aggregation,$.Normal,[ut(nt(e.data,null,"range","from")),ut(nt(e.data,null,"range","to"))]);return t.barsToFetch=e.data.maxDataPoints||Ci.DEFAULT_MAX_RECORDS,t.aggregation.backAdjust&&(t.barsToFetch=4*t.barsToFetch),t.chartId=e.elementId,t.curveStyle=this.curves[0].style,t.visibleRange=nt(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 Ze(this.detachedScale,this.yScale)&&this.detachedScale}getDetachedScaleMargins(){return Ci.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=Ci.OUT_OF_SCREEN;for(const i of this.levels){const s=this.priceToY(i.value);Xs(e,Zs({line:i.line,fill:qy})),xs(e,{x:-1,y:s},{x:t,y:s})}e.restore()}drawBands(e){e.save();const t=Ci.OUT_OF_SCREEN;for(const i of this.bands){const s=this.priceToY(i.range.to),n=this.priceToY(i.range.from);Xs(e,Zs({fill:i.fill,line:Xy}));Is(e,new vs(-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!==xo.DateTime)):[]}getEventsAt(e){const t=this.eventsSeries.container,i=i=>t.getData(i)[e];return this.getEventFields().map((t=>{const s=i(t);if(!Ze(s))return null;const n=this.getEventFor(t);if(!Ze(n))return null;const r={field:t,value:s,date:i(xo.DateTime),text:n.title,color:n.color};if(t===xo.Custom&&s===Ci.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?xo.High:i.isTick?xo.Last:xo.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(!Ze(n)||!Ze(n[0],n[1]))return;const r=(e,t=xo.DateTime)=>e.container.getData(t),o=r(this.eventsSeries),a=this.getRefPlot(i),l=a.timeSeries,c=r(l),u=i.data.aggregation,h=a===i.mainPlot,d=r(l,this.getRefEventField(a.mainCurve,h,u)),{chart:{fontFamily:p}}=this.axis.pane.presenter.display,f=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=Iu(u,e.date),r=xe(c,+n,Number),o=d[r];t.has(r)||t.set(r,-1);let a=t.get(r);t.set(r,++a);const l=s.timeToX(n),h=i.view.getEventRadius(),p=this.axis.yScale.priceToY(o)-a*(h+h+h);return{visible:!0,...e,x:l,y:p,r:h,rect:Qy}}))})).flat();e.save();let m=!0;f.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 vs(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,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){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===xo.Custom?t:null}hitTestCustomEvent(e){return null!==this.getCustomEventDataAt(e)}tryHandleCustomEventClick(e){const t=this.getCustomEventDataAt(e);return!!Ze(t)&&(this.showCustomEventPopup(t),!0)}isEmpty(){const e=this.timeSeries;return Ze(e)&&e.hasData&&e.container.isEmpty}draw(e){if(this.visible){Ze(this.levels)&&this.drawLevels(e),Ze(this.bands)&&this.drawBands(e);for(const t of this.curves)t.draw(e);Ze(this.annotations)&&this.drawAnnotations(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(!Ze(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(!Ze(n)||!ll(n))return e;if(this._firstVisibleDate!==n){this._firstVisibleDate=n;const e=this.timeSeries.container.getTimeData(),t=t=>xe(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,Jy.has(t.id));var t}getRefPriceMapField(e){return this.isOhlcMapping(e)||e===xo.PreviousClose?xo.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=V.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(V.Percent)||n===V.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 Ze(t)?t!==V.None:this.isComparison(V.Percent)||this.isComparison(V.Value)}onPriceDomainsUpdated(){}get presenter(){return this.axis?.pane?.presenter}}class tT extends eT{resolved=null;inputs=[];get symbol(){return this._symbol}get title(){return this.symbol}get showPrevious(){return this._showPrevious}getPreviousValue(){if(!Ze(this.timeSeries)||!Ze(this.timeSeries.record))return null;const e=this.axis.pane.presenter.display.chart.previous.field;return this.timeSeries.record.getValue(xo[e])}getTimeSeries(){const e=SP().getTimeSeriesDataSource(),t=this.makeQuery();switch(t.symbol=this.resolved,this.mainCurve.style){case v.Renko:case v.Kagi:case v.PointAndFigure:t.barsToFetch=10100,t.inputs=this.inputs;break;case v.Range:t.barsToFetch=4e3;break;case v.LineBreak:t.inputs=this.inputs}const i=this.axis.pane;if(Ze(i.alignedToYear)){const e=ri(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:se.Unspecified};this.presenter?.notifyHost(No.TS_MANYCHANGED,e),this.getEvents()}}))}getMetaData(){const e=SP().getMetaDataSource();this.metaData=e.getMetaData(this.resolved),this.metaData.ready().then((e=>{e&&this.presenter?.notifyHost(No.MD_CHANGED,{plot:this})}))}getEvents(){if(!this.hasEvents)return;const e=SP().getTimeSeriesDataSource(),t={symbol:this.symbol,seriesKind:$.Events,getHashKey:function(){return Object.values(this).filter((e=>"function"!=typeof e)).join("|")}};Ci.EVENTS.forEach((e=>{t[e]=nt(this.events,!1,e,"show")})),this._eventsSeries=e.getTimeSeries(t),this._eventsSeries.ready().then((e=>{e&&this.presenter?.notifyHost(No.TS_EVENTSCHANGED,{series:this.eventsSeries})}))}get eventsSeries(){return this._eventsSeries??null}get hasEvents(){return!!Ze(this.events)&&Ci.EVENTS.some((e=>nt(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=Mr(this.axis.pane.presenter.data.aggregation),this._symbol=t.symbol}getEventFor(e){const t=this.events[e.id.toLowerCase()];return Ze(t)&&t.show?t:null}async initialize(){return Ai.call(this,(async()=>(this.resolved=await Gt(this.symbol),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0))))}}class iT extends tT{constructor(e){super(),this.seriesKind=e}get showPrevious(){return!1}get title(){return`${this.curves[0].fields[0].name}(${C[this.fundamental].substring(0,1)})`}fromModel(e){this.fundamental=C[e.fundamental],super.fromModel(e)}makeQuery(){let e=new yp(this.symbol,new xr(this.fundamental),this.seriesKind);return e.fields=this.curves[0].fields,e}}class sT{constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){const e=SP().config.touchCrosshairDelayMillis;return Ze(e)&&Number.isFinite(e)?e:Ci.LONG_PRESS_DELAY_MILLIS}startLongPress(e,t,i){Ue()&&(this.longPressTimeout=setTimeout((()=>this.longPressTriggered(e,t,i)),this.getTouchCrosshairDelayMillis()))}longPressTriggered(e,t,i){this.cancelLongPress(),this.performLongPress(e,t,i)}cancelLongPress(){Ue()&&Ze(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(e,t,i){}}function nT(e){return e.locked||e.axis.pane.presenter.display.allAnnotationsLocked}class rT extends sT{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){JT(this.annotation,i)}onMouseMove(e){if(this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1),nT(this.annotation))return;const{point:t,view:i,offset:s}=e;if(!Xe(t)||t.axis!==this.annotation.axis)return;i.drawCrosshair({ap:t,offset:s}),this.cursorSet||(this.previous.axis.pane.presenter.view.setCursor(j.Move),this.cursorSet=!0);const n=rs(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(),fA(this.annotation,this.moved,he.Moved)}}class oT{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(Z.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1),nT(this.annotation))return;const{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),Ze(t)){const e=this.annotation.points[this.pointIndex],i=rs(t.point,e.point);switch(e.moveDirection){case Q.Both:e.update(t.price,t.time);break;case Q.Horizontal:e.update(e.price,t.time);break;case Q.Vertical:e.update(t.price,e.time)}this.moved=e.moveDirection!==Q.None,this.moved&&this.annotation.wasPointMovedByTool(e,i)}this.annotation.requestRedraw()}onMouseUp(e){fA(this.annotation,this.moved,he.PointMoved)}}class aT{constructor(e,t,i){this.anchor=e,this.isVertical=t,this.axis=i}hitTest(e){return!!Ze(this.anchor)&&(this.isVertical?Math.abs(e.x-this.anchor.x)<=Ci.HIT_TEST_TOLERANCE:Math.abs(e.y-this.anchor.y)<=Ci.HIT_TEST_TOLERANCE)}draw(e){const t=Ci.OUT_OF_SCREEN;this.isVertical?Ns(e,this.anchor.x,-t,t):Rs(e,this.anchor.y,-t,t)}}class lT{passive=!1;moveDirection=Q.Both;visible=!0;constructor(e,t,i){this.id=yt(),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!==Q.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){const e=this.axis.toPoint(this);Ze(e)&&Qe(e.x)&&Qe(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)<=Ci.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)-Ci.HALF_ANN_POINT_DIMENSION)}draw(e,t){if(Ze(this.point)){let i=Ci.HALF_ANN_POINT_DIMENSION;Ze(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 cT(e){return 0===gs(e.fill.color).a?e.line.color:e.fill.color}function uT(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 hT(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 dT{points=[];isSelected=!1;drawn=!0;alignPointsSupported=!1;visible=!0;locked=!1;computed=!1;constructor(e,t){this.axis=e,this.name=t,this.uid=yt()}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 Ci.EMPTY_ARRAY}getTimeScaleAdornments(){return Ci.EMPTY_ARRAY}extractTraits(e=!0){const t=rt(this.traits),i=vn(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:Je(+e.time,4)})))}offset(e){this.points.filter((e=>e.movable)).forEach((t=>{t.updateFromPoint(os(t.point,e))}))}get traits(){return this._traits||(this._traits=rt(this.defaultTraits)),this.adjustFill&&(this._traits.fill.color=cT(this._traits),this.adjustFill=!1),this._traits}set traits(e){void 0!==e&&dt(this.traits,e)}get activePoints(){return this.points.filter((e=>!e.passive))}get style(){return Zs(this.traits)}get defaultTraits(){return qs(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return Zs(this.defaultTraits)}get adornStyle(){const e=rt(this.defaultTraits);return e.fill.color=this.traits.line.color,e.line.width=0,e.line.color=Ci.COLOR_TRANSPARENT,Zs(e)}get pointsStyle(){const e=rt(this.defaultTraits);return e.line.dashStyle="Solid",Zs(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=Ze(e);!t||!s&&n||i.toPoint(),n&&s&&(this.isSelected||this.drawn)&&(Xs(e,this.pointsStyle),i.draw(e,this))}))}addPoints(e){for(let t=0;t<e;t++)this.points.push(new lT(this.axis))}toModel(){const e=this.extractPoints();return{id:this.name,uid:this.uid,visible:this.visible,locked:this.locked,points:e,traits:rt(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=Ze(e)?rt(e):{};Ze(t)&&dt(r,t),this.traits=r,Ze(i)&&this.updatePoints(i)}priceMap(e){return this.axis.priceMap(e)}flip(e){const t=this.getFlipAnchorIndices();if(!Xe(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 pT(e,t,i,s){return function(n,r=!0){const o=new t(n,e,i);return r?n.appendAnnotation(o):o.drawn=!1,Ze(s)&&(o.traits=s),o}}class fT{constructor(e,t,i,s,n){this.axis=n,Ze(e,t)&&(this.angle=as(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)+Ci.OUT_OF_SCREEN}hitTest(e){return!!Ze(this.p1,this.p2)&&ls([this.p1,this.p2],e,Ci.HIT_TEST_TOLERANCE)}draw(e){Ze(this.p1,this.p2)&&(xs(e,this.p1,this.p2),this.extended)}getAdornOffset(e){const t=Ls(e),i=_s(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 mT{constructor(e,t,i,s){this.axis=s,this.rect=new vs(e.x,e.y,t,i)}hitTest(e){return this.rect.contains(e)}draw(e,t){Is(e,this.rect)}}class gT extends dT{constructor(e,t){super(e,t)}draw(e,t){if(this.prepareDraw(e,t)&&!this.drawn){const t=this.getElements();Xs(e,this.style),t.forEach(((t,i)=>{Xs(e,this.getStyleForElement(t,i)),t.draw(e)})),Xs(e,this.adornStyle),this.adornElements(t,e);const i=this.getMarkers();Xs(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 it(this.traits?.singleStyle,!0)}get showBackground(){return it(this.traits?.showBackground,!1)}get backgroundOpacity(){return it(this.traits?.backgroundOpacity,0)}fillOnlyStyle(e){return Zs({line:{color:Ci.COLOR_TRANSPARENT,dashStyle:"Solid",width:0},fill:this.traits[e]})}lineOnlyStyle(e){return Zs({fill:{color:Ci.COLOR_TRANSPARENT},line:this.traits[e]})}makeLine(e,t){return new fT(e,t,!1,!1,this.axis)}applyBackgroundOpacity(e){return hs(us(e),this.backgroundOpacity)}getTraitsFor(e){const t={fill:{color:Ci.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 yT extends gT{constructor(e,t){super(e,t)}get factorsPropName(){return Ci.AT_FACTORS}get factors(){return Gs(this._factors??this.traits[this.factorsPropName])}getStyleForElement(e,t){return e.style??super.getStyleForElement(e,t)}get showLevels(){return this.traits[Ci.AT_SHOW_LEVELS]}get levelsKind(){return this.traits[Ci.AT_LEVELS_KIND]}get labels(){return this.traits[Ci.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[Ci.AT_PRICES_ON_SCALE]}formatLevelPrice(e,t){const i=this.levelsKind===Ci.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+` (${yd(this.axis,e)})`).trim()}return s}getAdornPointAndAlign(e,t){const i=this.labels,s=e instanceof fT,n=(e,t,i)=>({pt:e,align:t,offset:i});switch(i){case Ci.AT_LABELS_LEFT:return n(s?e.anchor1:e,z.Right,-t);default:case Ci.AT_LABELS_RIGHT:return n(s?e.anchor2:e,z.Left,t);case Ci.AT_LABELS_CENTER:return n(s?ss(e.anchor1,e.anchor2):e,z.Center,0)}}getColoredElements(e){const t=this.singleStyle;return this.factors.map((i=>{const s=e(i);return null===s?null:(t||(s.style=Zs(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 i of e){if(!Ze(i._data))continue;const{factor:e}=i._data,{ref:n,spacing:l,offsetY:c,text:u}=s(o,i,e),{pt:h,align:d,offset:p}=this.getAdornPointAndAlign(n,l);if(Os(r,u,this.getAdornTextPoint(r,c,h,p),d).contains(t)){a=!0;break}o=i}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(!Ze(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;ws(s,a,f,d,m)}c=e}))}getAdornTextPoint(e,t,i,s){const n=_s(e,.75);return os(i,{x:s,y:!0===t?n/2:t})}}class TT extends gT{constructor(e,t){super(e,t),this.resetComputedState()}get rectStyle(){return this.fillOnlyStyle(Ci.AT_FILL)}get rect(){const[e,t]=this.getScreenPoints(),i={x:e.x,y:Math.min(e.y,t.y)},s=new mT(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=xe(l,+i.time,Number,bd),u=xe(l,+s.time,Number,bd)-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=Zs(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 ST extends lT{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 AT{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 Ze(this.points[0].point,this.points[1].point)?new vs(this.left,this.top,this.width,this.height):null}}function vT(e){const t=new lT(e),i=new lT(e);return[t,i,new ST(e,t,i),new ST(e,i,t)]}class PT extends dT{constructor(e,t){super(e,t),this.points=vT(e),this.helper=new AT(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)&&(Xs(e,this.style),!0)}updatePoints(e){this.allowPricesChangeUI&&2===e.length&&e.forEach(((e,t)=>this.points[t].update(e.price,e.time)))}}class CT{constructor(e,t,i){this.points=e,this.lines=t,this.axis=i,this._actualWidth=0,this._fontSizeForWidth=0,this.helper=new AT(this.points)}hitTest(e){const t=this.getRect();return!!Xe(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 bT extends gT{constructor(e,t){super(e,t),this.textEditable=!0,this.points=vT(e),this.adjustFill=!0}get textLines(){return this.traits[Ci.AT_TEXT_LINES]}set textLines(e){this.traits[Ci.AT_TEXT_LINES]=e,this._textAnnElement=void 0}get textElement(){return!Ze(this._textAnnElement)&&this.visible&&(this._textAnnElement=new CT(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 ET extends bT{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 lT(this.axis,t,e)))}updateFrom(e,t,i,s,n){super.updateFrom(e,t,i,s,n),Ze(e?.textLines)&&(this.textLines=e.textLines)}getElements(){const e=super.getElements(),t=this.pricesPoints.map((e=>new aT(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 _T{constructor(e){this.annId=e}onKeyDown(e){if(null==this.annId)return;const{key:t,code:i,presenter:s}=e;if($e(t,i)){if(Ze(this.annotation)){this.annotation.axis.deleteAnnotation(this.annotation,!1),s.view.redraw()}pA(s,{toolChange:he.Cancelled,annId:this.annId})}}}class MT extends _T{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){const{point:t,button:i}=e;if(void 0===t)return;const s=Xe(this.annotation);return i===q.Left&&(s&&!this.dragged&&this.thirdPoint?(this.annotation.points[2].update(t.price,t.time),this.signalChange(),this.finish()):s&&this.dragged&&!this.thirdPoint?(this.annotation.points[1].update(t.price,t.time),this.signalChange(),this.finish()):(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())),!0}onMouseMove(e){const{point:t,view:i,offset:s}=e;return i.drawCrosshair({ap:t,offset:s}),Ze(this.annotation,t)&&(this.alignPointsMode=this.forceAlignPoints||e.getModifier(Z.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(){fA(this.annotation,!0,he.Created)}isAccidentalMouseUp(e){const{point:t}=e,i=this.annotation.points[0].point;return ns(t.point,i)<Ci.HIT_TEST_TOLERANCE}onMouseUp(e){void 0!==this.annotation?this.thirdPoint||!this.isAccidentalMouseUp(e)?(this.dragged=!1,this.thirdPoint||this.finish()):this.dragged=!0:gA(e)}}class LT extends MT{constructor(e,t=!1){super(e,t),this.forceAlignPoints=!0}}class OT extends MT{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}),Ze(this.annotation)&&this.dragged){const[e,i]=this.annotation.points;i.update(t.price,t.time);const s=rs(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 wT extends _T{constructor(e,t){super(e?e.annName:null),this.factory=e,this.existing=t,this.clicks=0,this.snapToSupported=!1,this.isNew=!Ze(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:cT(qs(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[Ci.AT_FILL].color}}}onMouseDown(e){const{point:t}=e;if(this.isNew)if(0===this.clicks){if(void 0===t)return void gA(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();pi(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(),fA(t,!0,this.isNew?he.Created:he.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 t=0;t<e.length;t++){const i=r.measureText(e[t]).width;i>s&&(s=i)}return r.restore(),{actualWidth:s,actualHeight:i}}}function IT(e){return SP().config.tooltipMovement===e}function DT(){return IT("Draggable")}function xT(){return IT("Auto")}const NT=Ci.TOOLTIP_STD_LEGACY_CLASS,RT=Ci.TOOLTIP_STD_CLASS,HT=Ci.TOOLTIP_BUBBLE_CLASS;class VT{constructor(e){this.view=e,this.isDrag=!1,this.tooltipElem=yi(e.el,"div"),fi(this.tooltipElem,{id:`${e.presenter.elementId}-global-tooltip`,class:`${RT} ${NT}`}),this.leftSide=!0,pi(this.tooltipElem,{visibility:"hidden",position:"absolute",cursor:DT()?"move":"default",zIndex:20,top:`${Ci.TOOLTIP_Y_OFFSET}px`,left:`${Ci.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===Ci.TOOLTIP_BUBBLE)this.canDrag=!1,this.tooltipElem.style.transition="none",this.tooltipElem.classList.remove(RT,NT),this.tooltipElem.classList.add(HT),pi(this.tooltipElem,{pointerEvents:"none"});else if(e===Ci.TOOLTIP_STD){this.canDrag=DT(),this.tooltipElem.classList.remove(HT),this.tooltipElem.classList.add(RT,NT);const e=Ci.TOOLTIP_TOGGLE_SIDE_ANIM_MS;pi(this.tooltipElem,{pointerEvents:"all",top:`${Ci.TOOLTIP_Y_OFFSET}px`,left:`${Ci.TOOLTIP_X_OFFSET}px`,transition:xT()?`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*Ci.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"),Si(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),hi(this.tooltipElem)}reposition(e,t){pi(this.tooltipElem,{left:`${e}px`,top:`${t}px`})}isAutoMove(){return this.mode===Ci.TOOLTIP_STD&&xT()}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=Ci.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?Ci.TOOLTIP_X_OFFSET:e.width-this.tooltipElem.offsetWidth-Ci.TOOLTIP_X_OFFSET);this.reposition(i,t)}}toggleSide(){this.isToggling||(this.isToggling=!0,setTimeout((()=>this.isToggling=!1),Ci.TOOLTIP_TOGGLE_SIDE_ANIM_MS),this.leftSide=!this.leftSide,this.repositionAuto())}}function FT(e){e.showTooltip&&BT(e,{time:Ci.ZERO_DATE,offset:Ci.OFFSCREEN_OFFSET,price:0,lastBarRefresh:void 0,justMain:void 0})}function BT(e,{time:t,lastBarRefresh:i,justMain:s,offset:n,price:r}){const o=kd(e,t,n,i,s,r),{mode:a,showMainPlot:l,hideSymbols:c,revealingClose:u}=e.display.tooltip,{includeTimestamp:h,showMainPlot:d,showPlotActions:p}=SP().config.tooltipHeaders||{},f=Ze(d)?d:l,m=!!Ze(h)&&h,g=!!Ze(c)&&c,y=!!Ze(u)&&u,T=!!Ze(p)&&p,S=t.valueOf()===Ci.ZERO_DATE.valueOf();switch(a){case Ci.TOOLTIP_CARDS:s||UT(e,o,f,!S,m&&!S,!1,g,y,T,e.hasLegend?e.view?.legend?.getLegendElem().clientHeight:0);break;case Ci.TOOLTIP_BUBBLE:if(!S){const t=o.panes.find((e=>{const{top:t,left:i,width:s,height:r}=e.bounds;return new vs(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">${wd({...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)})}UT(e,o,f,!1,!1,e.hasLegend,g,y,T);break;case Ci.TOOLTIP_STD:if(!S){const t=wd({...o,hideSymbols:g,revealingClose:y,plots:o.panes.map((e=>e.plots)).flat()});e.view.tooltip.show(t)}UT(e,o,f,!1,!1,e.hasLegend,g,y,T);break;case Ci.TOOLTIP_EXTERNAL:e.notifyHost(No.CH_TOOLTIPCHANGED,o);break;default:console.warn(`Unknown tooltip mode requested: ${a}`)}}function kT(e,t,i,s,n,r){pi(e,{position:"absolute",display:"flex","flex-direction":t,"flex-wrap":"wrap",left:`${i+Ci.CARDS_X_OFFSET}px`,top:`${n+Ci.CARDS_Y_OFFSET}px`,maxWidth:r-s-2*Ci.CARDS_X_OFFSET+"px"})}function UT(e,t,i=!1,s=!1,n=!1,r=!1,o=!1,a=!1,l=!1,c=0){const u=e.view.el,h=Id(e,t,i,s,n,o,a,l);h.some((e=>!Ze(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=mi(t,u,"div");kT(n,i&&Md(e)?"column":"row",o,a,l+c,h),gi(n,{"bcharts-card":!0,"bcharts-card-main":i,"bcharts-card-first":0===d}),n.innerHTML=s}let p=di(`#right-${t}`,u);Ze(p)||(p=document.createElement("div"),p.id=`right-${t}`,u.appendChild(p),gi(p,"bcharts-card bcharts-card-move")),pi(p,{position:"absolute",display:"block",right:`${a+Ci.CARDS_X_OFFSET}px`,top:`${l+c+Ci.CARDS_Y_OFFSET}px`}),p.innerHTML=n}))}let WT=null;function $T(){return null===WT&&(WT=SP().config.hostingModel===ce[ce.Application]),WT}class GT extends sT{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();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=$T();if(Ue()&&!h&&this.warmUp)return(a>7||u>7)&&(this.warmUp=!1,this.preventDefault=a>u),!1;if(this.preventDefault||!Ue()||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(j.Grabbing)}return h||this.preventDefault}finished(){pA(this.presenter)}onMouseLeave(){this.finished()}onMouseUp(){this.finished()}onMouseDblClick({presenter:e,offset:t,originalEvent:i}){Ue()&&QT(e,t,i)}performLongPress(e,t,i){e.enableTooltip(!0),e.resetActiveTool(),e.activeTool.startTouchCrosshairMode(e,t,i)}}let zT=null;function YT(e,t){const i=(new DOMParser).parseFromString(e,"image/svg+xml"),s=i.querySelector("svg")?.getAttribute("viewBox"),n=i.querySelector("path")?.getAttribute("d");if(Xe(s)&&Xe(n)){const e=s.split(" ").map(Number);4===e.length&&e.every(Number.isFinite)&&(zT={path:new Path2D(n),width:e[2],height:e[3],rect:new vs(0,0,0,0),logoClickable:t})}}function jT(e,{x:t,y:i,height:s,width:n}){if(!Xe(zT))return;const{path:r,width:o,height:a,rect:l}=zT,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()}class KT extends PT{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)&&(Is(e,this.getRect()),!0)}}function qT(e,t){return e<t?[e,t]:[t,e]}const XT={line:{width:1,color:"rgba(127, 127, 127, 0.3)",dashStyle:"LongDash"},fill:{color:"rgba(127, 127, 127, 0.1)"}};class ZT extends MT{snapToSupported=!1;preventDefault=!1;constructor(){super(pT("Rectangle",KT,null,XT),!1)}activated(){}deactivated(){Ze(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(Ze(this.axis,this.presenter)){pA(this.presenter,{toolChange:he.Executed,annId:"ZoomIn"});const e=this.annotation.points,t=qT(e[0].price,e[1].price),i=qT(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=Ci.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 JT(e,t){const i=hT(e);i.offset={x:t.x,y:t.y},i.canFlip=null!==e.getFlipAnchorIndices();const s=e.axis.pane.presenter;s.clearSelection(),s.notifyHost(No.CH_ANNNEEDSCONTEXTMENU,i)}function QT(e,t,i){const s={offset:{x:t.x,y:t.y},chart:e.accessor,originalEvent:i};e.notifyHost(No.CH_CHTNEEDSCONTEXTMENU,s)}class eS extends _T{constructor(e,t){super(e.annName),this.factory=e,this.maxClicks=t,this.clicks=0,this.snapToSupported=!0,this.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 gA(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),fA(this.annotation,!0,he.Created)):this.annotation.requestRedraw()}applyToPoints(e){this.annotation.points[this.clicks].update(e.price,e.time)}}class tS{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(),fA(i,!0,he.None)}}const iS=Ci.MARKER_ARROW_ANGLE*Math.PI/180/2;function sS(e,t){return nS(e.map((e=>e.point)),t)}function nS(e,t,i=Ci.MARKER_ARROW_LENGTH){return new rS(e,t,i)}class rS{constructor(e,t,i=Ci.MARKER_ARROW_LENGTH){this.vertex=t,this.arrowLen=i,this.p1=e[0],this.p2=e[1]}hitTest(e){const{anchor:t,p1:i,p2:s}=this.getArrowPoints();return ls([t,i],e,Ci.HIT_TEST_TOLERANCE)||ls([t,s],e,Ci.HIT_TEST_TOLERANCE)}draw(e){const{anchor:t,p1:i,p2:s}=this.getArrowPoints();xs(e,t,i),xs(e,t,s)}getArrowPoints(){const e=as(this.p1,this.p2),t="start"===this.vertex?0:Math.PI,i=e-iS+t,s=e+iS+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 oS{hitTest(){return!1}draw(){}}class aS extends gT{constructor(e,t){super(e,t),this.addPoints(2),this.alignPointsSupported=!0}get extend1(){return this.traits[Ci.AT_EXTEND_PT_1]}get extend2(){return this.traits[Ci.AT_EXTEND_PT_2]}get showPercentDiff(){return this.traits[Ci.AT_SHOW_PERCENTDIFF]}get showBarCount(){return this.traits[Ci.AT_SHOW_BARCOUNT]}get showRatio(){return this.traits[Ci.AT_RATIO]}getElements(){const e=this.points[0].point,t=this.points[1].point,i=new fT(e,t,this.extend1,this.extend2,this.axis),s=[];return this.extend1&&s.push(new fT(i.p1,e,!0,!1,this.axis)),s.push(new fT(e,t,!1,!1,this.axis)),this.extend2&&s.push(new fT(t,i.p2,!1,!0,this.axis)),s}formatRatio(e,t){return` (${Je(e/t,3)})`}formatPercDiff(e,t){const i=(t-e)/e*100;return` (${i>0?"+":""}${Je(i,2)}%)`}formatPrice(e){return yd(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=os(ss(i.point,s.point),n);ws(t,this.getBarCount(i.time,s.time).toFixed(0),e,z.Right)}const r=this.showRatio?this.formatRatio(i.price,s.price):"",o=`${this.showPrices?this.formatPrice(i.price):""}${r}`.trim();""!==o&&ws(t,o,os(i.point,n),z.Right);const a=this.showPercentDiff?this.formatPercDiff(i.price,s.price):"",l=`${this.showPrices?this.formatPrice(s.price):""}${a}`.trim();""!==l&&ws(t,l,os(s.point,n),z.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?sS(this.points,e):(console.warn(`There is no marker of ${i} kind`),new oS)))}}class lS extends gT{constructor(e,t){super(e,t),this.addPoints(1)}get showTimestamps(){return this.traits[Ci.AT_SHOW_TIMESTAMPS]}getElements(){return[new aT(this.points[0].point,!0,this.axis)]}getTimeScaleAdornments(){return this.showTimestamps?[{time:this.points[0].time,color:this.traits.line.color}]:super.getTimeScaleAdornments()}}class cS extends gT{constructor(e,t){super(e,t),this.addPoints(1)}getElements(){return[new aT(this.points[0].point,!1,this.axis)]}getPriceScaleAdornments(){return this.showPrices?[{price:this.points[0].price,color:this.traits.line.color}]:super.getPriceScaleAdornments()}}class uS extends gT{constructor(e,t,i){super(e,t),this.addPoints(2),Ze(i)&&Ze(i.points)&&i.points.forEach(((e,t)=>this.points[t].update(e.price,e.time)))}allPoints(){const[e,t]=this.points;return Ze(e,e.point,t,t.point)?[e,this.axis.toAnnotationPoint(ss(e.point,t.point)),t]:Ci.EMPTY_ARRAY}line2(){return this.traits[Ci.AT_LINE_2]}use52WeekPrices(){return this.traits[Ci.AT_USE_52WEEK_PRICES]}getElements(){const e=this.allPoints();return e===Ci.EMPTY_ARRAY?Ci.EMPTY_ARRAY:e.map((e=>new fT({x:-Ci.OUT_OF_SCREEN,y:e.point.y},{x:Ci.OUT_OF_SCREEN,y:e.point.y},!1,!1,this.axis)))}wasPointMovedByTool(e,t){Ze(this.use52WeekPrices())&&(this.traits[Ci.AT_USE_52WEEK_PRICES]=!1)}getStyleForElement(e,t){const i=this.line2();if(1!==t||!Ze(i))return super.getStyleForElement(e,t);const s=rt(this.traits);return s.line=i,Zs(s)}getPriceScaleAdornments(){const e=this.allPoints();if(!this.showPrices||e===Ci.EMPTY_ARRAY)return super.getPriceScaleAdornments();const t=this.traits.line,i=e.map((e=>({price:e.price,color:t.color}))),s=this.line2();return Ze(s)&&(i[1].color=s.color),i}getFlipAnchorIndices(){return null}}class hS extends yT{constructor(e,t,i){super(e,t),this.addPoints(i),this.helper=new lT(e)}get showTrendLine(){return this.traits[Ci.AT_SHOW_TRENDLINE]}get hasAllPoints(){return Ze(...this.points.map((e=>e.point)))}get line2(){return this.traits[Ci.AT_LINE_2]}get extendLeft(){return this.traits[Ci.AT_EXTEND_LEFT]}get extendRight(){return this.traits[Ci.AT_EXTEND_RIGHT]}get reverse(){return this.traits[Ci.AT_REVERSE]}get levelsRespectLogScale(){return this.traits[Ci.AT_LEVELS_RESPECT_LOG_SCALE]}getStyleForElement(e,t){if(e.isTrend){const e=rt(this.traits);return e.line=this.line2,Zs(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 fT(e,t,!i&&r,!i&&o,this.axis);return s.isTrend=i,s},u=this.levelsRespectLogScale&&this.axis.scale===B.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 Ci.AT_LABELS_LEFT:return this.extendLeft?s({x:n.x,y:e.anchor1.y},z.Left,t):super.getAdornPointAndAlign(e,t);default:case Ci.AT_LABELS_RIGHT:return this.extendRight?s({x:n.x+n.width,y:e.anchor2.y},z.Right,-t):super.getAdornPointAndAlign(e,t);case Ci.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||(Cs(i,e.p1),i.lineTo(t.p2.x,e.p1.y),bs(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 dS extends hS{constructor(e,t){super(e,t,2)}}class pS extends hS{constructor(e,t){super(e,t,3)}}const fS=(e,t)=>{const i=new Path2D;return null===e||(Cs(i,e.p1),bs(i,e.p2),bs(i,t.p2)),i};class mS extends yT{constructor(e,t){super(e,t),this.addPoints(2)}get reverse(){return this.traits[Ci.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 fT(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 fT({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,fS,this.getTextRef(),t)}}class gS extends mS{constructor(e,t){super(e,t)}}function yS(e,t,i){const s=ns(e,t);return new SS(e,t,s,0,Math.PI,null,i)}function TS(e,t,i,s,n,r){return new SS(e,null,t,i,s,n,r)}class SS{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,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){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(ns(this.left,e),ns(this.right,e));else{const i=this.hasScale?this.inverseScale(e):e,{x:s,y:n}=rs(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<=Ci.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),Ds(e,this.center,this.radius,this.startAngle,this.endAngle,this.isAntiClockwise??!1),e.restore()}}const AS=(e,t)=>{const i=new Path2D,{center:s}=t;if(Cs(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 Cs(n,r),n.arc(r.x,r.y,e.radius,e.endAngle,e.startAngle,!e.isAntiClockwise),i.addPath(n),i};class vS extends yT{constructor(e,t){super(e,t),this.addPoints(2)}getElements(){const[e,t]=this.getScreenPoints();if(!Ze(e,t))return[];const i=ns(e,t),s=rs(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 yS(e,l,this.axis)}));if(this.showTrendLine){const i=new fT(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,AS,this.getTextRef(),t)}}class PS extends vS{constructor(e,t){super(e,t)}getStyleForElement(e,t){if(e.isTrend){let e=rt(this.traits);return e.line=this.line2,Zs(e)}return super.getStyleForElement(e,t)}get showTrendLine(){return this.traits[Ci.AT_SHOW_TRENDLINE]}get line2(){return this.traits[Ci.AT_LINE_2]}}class CS extends yT{constructor(e,t){super(e,t),this.addPoints(2)}get factorsPropName(){return Ci.AT_ANGLES}getElements(){const[e,t]=this.getScreenPoints(),{x:i,y:s}=rs(t,e);return this.getColoredElements((({value:n})=>{const r=(t,i)=>new fT(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,fS,this.getTextRef(),t)}}class bS extends mS{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 fT(e,t,!1,!1,this.axis)].concat(super.getElements())}}class ES extends vS{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}}class _S extends gT{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 fT(t,{x:t.x+s,y:t.y+n},!1,!0,this.axis)),r.push(new fT(e,{x:e.x+s,y:e.y+n},!1,!0,this.axis)),r.push(new fT(i,{x:i.x+s,y:i.y+n},!1,!0,this.axis)),r.push(new fT(t,i,!1,!1,this.axis)),r}}class MS extends PT{constructor(e,t){super(e,t)}getEllipse(){const e=this.getRect();return null===e?null:new Ps(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 LS extends gT{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[Ci.AT_EXTEND_PT_1]}get extend2(){return this.traits[Ci.AT_EXTEND_PT_2]}getLastPoint(){const[e,t,i]=this.points;var s=ns(e.point,t.point),n=as(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 fT(e.point,t.point,this.extend1,this.extend2,this.axis)),Ze(i?.price)){var n=this.getLastPoint();s.push(new fT(i.point,n,this.extend1,this.extend2,this.axis))}return s}}class OS extends PT{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 Ci.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=xe(t,s,Number,bd);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=os(this.points[0].point,{x:0,y:-e/2}),a=os(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),Hs(e,this.kind,i),!0}}class wS extends yT{constructor(e,t){super(e,t),this.addPoints(2),this.helper=new lT(e)}getElements(){const e=this.axis.pane.presenter.timeline,{price:t,time:i}=this.points[0],s=xe(e,i,Number,bd),n=xe(e,this.points[1].time,Number,bd),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 aT(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 IS{snapToSupported=!0;isDrawingAnnotation=!0;constructor(){}onMouseMove(e){const{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){if(Ue()&&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(No.CH_ANNPOINTPICKED,s),pA(i,void 0)}}const DS="Open",xS="Closed";class NS extends gT{constructor(e,t,i){super(e,t),this.isLong=i,this.isHit=!1,this.addPoints(4);const s=(e,t)=>this.points[e].moveDirection=t;s(1,Q.Vertical),s(2,Q.Vertical),s(3,Q.Horizontal),this.twoDecMeta=new zi(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){const n=this.data(xo.DateTime),r=xe(n,+e,Number),o=xe(n,+t,Number),a={refIndex:-1,highestIndex:-1,lowestIndex:-1,highest:null,lowest:null,data:[]},[l,c,u]=[xo.High,xo.Low,xo.Close].map((e=>this.data(e))),h=e=>e-r;for(let e=r;e<=o;e++)i&&-1===a.refIndex&&Ze(this.entryPrice)&&this.entryPrice>=c[e]&&this.entryPrice<=l[e]&&(a.refIndex=h(e)),(!i||a.refIndex>=0&&h(e)>=a.refIndex)&&((!Ze(a.highest)||l[e]>a.highest)&&(a.highest=l[e]),(!Ze(a.lowest)||c[e]<a.lowest)&&(a.lowest=c[e])),i&&-1!==a.refIndex&&(-1===a.highestIndex&&l[e]>this.upperPrice&&(a.highestIndex=h(e)),-1===a.lowestIndex&&c[e]<this.lowerPrice&&(a.lowestIndex=h(e))),s&&a.data.push({high:l[e],low:c[e],close:u[e],time:n[e]});if(s&&a.data&&a.data.length>0){a.state=Ze(a.highest,a.lowest)&&(this.upperPrice<a.highest||this.lowerPrice>a.lowest)?xS:DS,a.special=-1===a.highestIndex&&-1===a.lowestIndex||a.highestIndex===a.lowestIndex;const e=Oe(a.data);if(a.toPrice=e.close,a.toTime=e.time,a.state===xS)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=Je(t,2)}return a}get dataWindow(){return Ze(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=xe(e,+this.points[0].time,Number,bd),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[Ci.AT_ACCOUNT_SIZE]}get risk(){const e=this.traits[Ci.AT_RISK_IS_PERCENT],t=this.traits[Ci.AT_RISK];return Je(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 Ci.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 Je(this.upperPrice-this.entryPrice,2)}get amountMultiplier(){return this.isLong?1:-1}get upperAmount(){return Je(this.accountSize+this.amountMultiplier*this.qty*this.upperDiff,2)}get upperPandL(){return Je(this.amountMultiplier*this.upperDiff*this.pointValue,2)}get isCompact(){return this.traits[Ci.AT_COMPACT]}get upper(){const e=yd(this.axis,this.priceMap(this.upperPrice)),t=`(${Je(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 Je(this.entryPrice-this.lowerPrice,2)}get lowerAmount(){return Je(this.accountSize-this.amountMultiplier*this.qty*this.lowerDiff,2)}get lowerPandL(){return Je(-this.amountMultiplier*this.lowerDiff*this.pointValue,2)}get lower(){const e=yd(this.axis,this.priceMap(this.lowerPrice)),t=`(${Je(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 Je(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(Ci.AT_FILL2)}get upperStyle(){return this.fillOnlyStyle(Ci.AT_FILL)}get textStyle(){return this.fillOnlyStyle(Ci.AT_FILL_TEXT)}get secondaryLineStyle(){return Zs({line:{color:this.traits.line.color,dashStyle:"ShortDash"},fill:{color:Ci.COLOR_TRANSPARENT}})}wasModifiedByTool(){Ze(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 fT(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 mT(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 mT(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 lT(this.axis,this.entryPrice,e.time),i=new lT(this.axis,a.toPrice,a.toTime),s=new fT(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 mT({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=>us(this.traits[e].color);return[{price:this.upperPrice,color:e(Ci.AT_FILL)},{price:this.entryPrice,color:e(Ci.AT_LINE)},{price:this.lowerPrice,color:e(Ci.AT_FILL2)}]}adornElements(e,t){const[i,s,n]=e;if(this.showTextAdornments){const[e,r]=[!0,!1].map((e=>Ms(t,e))),{x:o,y:a,width:l}=s.rect,c={x:o+l/2,y:a+e},u=this.textStyle.fillStyle;ws(t,this.upperText,c,z.Center,u,us(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)};ws(t,this.lowerText,m,z.Center,u,us(this.lowerStyle.fillStyle));const{p1:g,p2:y}=i,{x:T,y:S}=g,{x:A}=y,v=this.state||Ci.NOT_APPLICABLE,P=this.isCompact?`${this.formatDollarValue(this.pAndLValue)}`:`${v} P&L: ${this.formatDollarValue(this.pAndLValue)}, Qty: ${this.qty}`,C=this.isCompact?`${this.riskReward.toFixed(2)}`:`Risk/Reward Ratio: ${this.riskReward.toFixed(2)}`,b=e=>t.measureText(e).width,E=Math.max(b(P),b(C)),_={x:T+(A-T)/2,y:Math.abs(A-T)<1.25*E?S+Math.abs(r)+5:S+e+10},M=us(this.isUpperPerPAndL?this.upperStyle.fillStyle:this.lowerStyle.fillStyle);ws(t,[P,C],_,z.Center,u,M)}}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}}var RS=["years","months","weeks","days","hours","minutes","seconds"];function HS(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=vr(),l=null!==(i=null!==(s=null==t?void 0:t.locale)&&void 0!==s?s:a.locale)&&void 0!==i?i:Ql,c=null!==(n=null==t?void 0:t.format)&&void 0!==n?n:RS,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:" ";if(!l.formatDistance)return"";var d=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);return d}function VS(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t),n=i.getTime()-s.getTime();return n<0?-1:n>0?1:n}function FS(e){return FS="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},FS(e)}function BS(e,t){if(Mt(2,arguments),!t||"object"!==FS(t))return new Date(NaN);var i=t.years?_t(t.years):0,s=t.months?_t(t.months):0,n=t.weeks?_t(t.weeks):0,r=t.days?_t(t.days):0,o=t.hours?_t(t.hours):0,a=t.minutes?_t(t.minutes):0,l=t.seconds?_t(t.seconds):0,c=Ot(e),u=s||i?wt(c,s+12*i):c,h=r||n?Kc(u,r+7*n):u,d=a+60*o,p=l+60*d,f=1e3*p,m=new Date(h.getTime()+f);return m}Math.pow(10,8);var kS=36e5;function US(e,t,i){Mt(2,arguments);var s=Xu(e,t)/kS;return Ju(null==i?void 0:i.roundingMethod)(s)}function WS(e,t,i){Mt(2,arguments);var s=Xu(e,t)/6e4;return Ju(null==i?void 0:i.roundingMethod)(s)}function $S(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t),n=i.getFullYear()-s.getFullYear(),r=i.getMonth()-s.getMonth();return 12*n+r}function GS(e){Mt(1,arguments);var t=Ot(e),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t}function zS(e){Mt(1,arguments);var t=Ot(e);return Yc(t).getTime()===GS(t).getTime()}function YS(e,t){Mt(2,arguments);var i,s=Ot(e),n=Ot(t),r=VS(s,n),o=Math.abs($S(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=VS(s,n)===-r;zS(Ot(e))&&1===o&&1===VS(e,n)&&(a=!1),i=r*(o-Number(a))}return 0===i?0:i}function jS(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getFullYear()-s.getFullYear()}function KS(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t),n=VS(i,s),r=Math.abs(jS(i,s));i.setFullYear(1584),s.setFullYear(1584);var o=VS(i,s)===-n,a=n*(r-Number(o));return 0===a?0:a}function qS(e){Mt(1,arguments);var t=Ot(e.start),i=Ot(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(KS(i,t));var n=VS(i,t),r=BS(t,{years:n*s.years});s.months=Math.abs(YS(i,r));var o=BS(r,{months:n*s.months});s.days=Math.abs(zc(i,o));var a=BS(o,{days:n*s.days});s.hours=Math.abs(US(i,a));var l=BS(a,{hours:n*s.hours});s.minutes=Math.abs(WS(i,l));var c=BS(l,{minutes:n*s.minutes});return s.seconds=Math.abs(Qu(i,c)),s}class XS extends TT{display=null;constructor(e,t){super(e,t),this.points=vT(e),this.points[2].visible=!1,this.points[3].visible=!1,this.markers=[new oS]}isPointDrawn(e){return!!super.isPointDrawn(e)&&e.visible}makeLineArrow(e,t,i,s){const n=[ss(e,t),ss(i,s)];return[this.makeLine(n[0],n[1]),nS(n,"end",10)]}get rectColor(){return this.traits[Ci.AT_FILL].color}get textColor(){return this.traits[Ci.AT_FILL_TEXT].color}getMarkers(){return this.markers}formatDateDifference(e,t){if(this.presenter.data.aggregation.isEndOfDay)return`${zc(t,e)}d`;return HS(qS({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){const i=this.points[0].price<this.points[1].price,s=Ms(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){ws(t,this.text,this.getTextCoord(e[0],t),z.Center,this.textColor,us(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(xo.DateTime),r=xe(n,+i,Number),o=xe(n,+s,Number),a=Ae(this.data(xo.Volume).slice(r,o+1)),l=this.formatter.format(a,xo.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,xo.Close)} (${this.formatter.format(s,xo.PercentChange)})`]}resetComputedState(){this.display=null}getFlipAnchorIndices(){return[0,1]}}class ZS 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 JS 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 QS extends XS{get drawBorder(){return this.traits[Ci.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 eA extends TT{constructor(e,t){super(e,t),this.points=vT(e)}get priceLevels(){return Gs(this.traits[Ci.AT_PRICE_LEVELS])}get timeLevels(){return Gs(this.traits[Ci.AT_TIME_LEVELS])}get showAngles(){return this.traits[Ci.AT_SHOW_ANGLES]}get reverse(){return this.traits[Ci.AT_REVERSE]}get showLeftLabels(){return this.traits[Ci.AT_SHOW_LEFT_LABELS]}get showRightLabels(){return this.traits[Ci.AT_SHOW_RIGHT_LABELS]}get showTopLabels(){return this.traits[Ci.AT_SHOW_TOP_LABELS]}get showBottomLabels(){return this.traits[Ci.AT_SHOW_BOTTOM_LABELS]}getAngles(e,t){const i=this.getScreenPoints(),s=this.lineOnlyStyle(Ci.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=_s(t,1)/2,{x:o,y:a}=Ci.DEFAULT_ADORN_OFFSET,l=(e,i,s,n,r)=>{const o=os(e,i);ws(t,Number(s.toFixed(4)).toString(),o,n,r)},c=(e,i)=>{const s=new Path2D;Es(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,z.Right,d),this.showRightLabels&&l(e.p2,{x:-o,y:r},t,z.Left,d),p&&c(u,e)):(this.showTopLabels&&l(e.p1,{x:0,y:a},t,z.Center,d),this.showBottomLabels&&l(e.p2,{x:0,y:2*-a},t,z.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();Es(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 tA=e=>e.map((e=>({...e,dimensions:e.value.split("x").map(Number)}))),iA=(e,t)=>Math.abs(e-t)<1e-7;class sA extends TT{_parsedFans=null;_parsedArcs=null;constructor(e,t){super(e,t),this.points=vT(e),this._parsedFans=this._parsedArcs=null}get levels(){return Gs(this.traits[Ci.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[Ci.AT_SHOW_RANGES_RATIO]}get arcs(){return Gs(this.traits[Ci.AT_ARCS])}get fans(){return Gs(this.traits[Ci.AT_FANS])}get reverse(){return this.traits[Ci.AT_REVERSE]}get parsedFans(){return null===this._parsedFans&&(this._parsedFans=tA(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=tA(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[Ci.AT_PRICE_BAR_RATIO]}set priceBarRatio(e){this.traits[Ci.AT_PRICE_BAR_RATIO]=e}makeStyledLine(e,t,i){const s=this.makeLine(e,t);return this.singleStyle||(s.style=Zs(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=iA(n,r)?null:{x:1,y:r/n},a=this.getClipPath();return this.computedArcs.map((({computed:n,traits:r})=>{const l=TS(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=Zs(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 Es(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=Oe(s),t=AS(null,e),n=this.applyBackgroundOpacity(this.traits.line.color);i(t,e,n)}else{let e=null;s.forEach((t=>{const s=AS(e,t),n=t.style.fillStyle;i(s,t,n),e=t}))}t.restore()}if(this.showRangesRatio&&null!==this.unit){const e=Oe(this.computedLevels),i=(this.singleStyle?this:e).traits.line.color,[,s,n,r]=this.getReversedScreenPoints(),{x:o,y:a}=Ci.DEFAULT_ADORN_OFFSET,{flipX:l,signX:c,signY:u}=this.getOrientation(),h=os(n,{x:-o*c,y:a*u}),{priceDiff:d,barsDiff:p}=this.getLinesDataAtLevels(null,null),f=l?z.Right:z.Left;ws(t,p.toFixed(0),h,f,i);const m=os(r,{x:2*o*c,y:-a*u}),g=l?z.Left:z.Right;ws(t,this.formatter.format(d,xo.Close),m,g,i);const y=os(s,{x:-o*c,y:-a*u});ws(t,this.priceBarRatio.toFixed(6),y,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,!iA(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]}}class nA extends yT{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[Ci.AT_EXTEND_PT_1]}get extend2(){return this.traits[Ci.AT_EXTEND_PT_2]}getElements(){const[e,t,i]=this.getScreenPoints(),{x:s,y:n}=rs(i,e),r=i=>{const[s,n]=[e,t].map((e=>os(e,i)));return new fT(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,((e,t)=>{const i=new Path2D;return null===e||(Cs(i,e.p1),bs(i,e.p2),bs(i,t.p2),bs(i,t.p1)),i}),this.getTextRef(),t)}}class rA extends gT{constructor(e,t,i){super(e,t),this.computed=!0,this.bars=[],this.studyPlotId=i,this.invalidate()}setOptions(e){switch(this.numBars=Tt(2,1e3,e.Bars),this.alignLeft="Left"===e.Position,this.totalVolume="Total"===e.Volume,this.screenWidth=Tt(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(S.ChangeBased)}}}invalidate(){this.gotData=!1}getBarWidth(e,t){const i=this.bars[this.maxVolumeIndex];return e/(i[0]+i[1])*t}getElements(){if(this.gotData||this.getData(),!this.gotData||!this.studyPlot.mainCurve.visible)return[];const{x:e,width:t}=this.axis.pane.getBoundsWithoutScales(),i=t*this.screenWidth;return this.bars.map((([s,n],r)=>{if(0===s&&0===n)return null;const o=this.axis.toY(this.min+r*this.zone),a=this.axis.toY(this.min+(r+1)*this.zone),l=Math.abs(o-a),c=(i,s,n=0)=>{const r=this.alignLeft?e+n:e+t-i-n,o=new mT({x:r,y:a},i,l,this.axis);return o.style=s,o};let u=null;if(this.totalVolume){u=[c(this.getBarWidth(s+n,i),this.totalStyle)]}else{const e=this.getBarWidth(s,i),t=this.getBarWidth(n,i);u=[c(t,this.upStyle),c(e,this.downStyle,t)]}if(r===this.maxVolumeIndex){const i=u[u.length-1].rect,s=this.alignLeft?i.x+i.width:e,n=(a+o)/2,r=this.alignLeft?e+t:i.x;u.push(new fT({x:s,y:n},{x:r,y:n},!1,!1,this.axis))}return u})).filter((e=>Ze(e))).flat()}getStyleForElement(e,t){return e.style||super.getStyleForElement(e,t)}get presenter(){return this.axis.pane.presenter}get downStyle(){return this.fillOnlyStyle(Ci.AT_FILL)}get upStyle(){return this.fillOnlyStyle(Ci.AT_FILL2)}get totalStyle(){return this.fillOnlyStyle(Ci.AT_FILL_TEXT)}get lineStyle(){return this.lineOnlyStyle(Ci.AT_LINE)}getData(){if(this.axis.pane.presenter.data.aggregation.isTick)return;const[e,t]=this.presenter.view.xAxis.xScale.domain()||[];ll(e)&&ll(t)&&(this._firstVisibleDate!==e||this._lastVisibleDate!==t?([this._firstVisibleDate,this._lastVisibleDate]=[e,t],this.dataFromVisibleRange()):this.gotData=!0)}getBarIndex(e,t=!1){if(0===this.bars.length)return-1;const i=Math.floor((e-this.min)/this.zone);return t?Math.min(this.numBars-1,i):i}get studyPlot(){return this.presenter.allPlots.find((e=>e.id===this.studyPlotId))}dataFromVisibleRange(){const e=this.presenter.mainPlot.timeSeries.container,t=e?.getTimeData();if(!Ze(t))return;const i=e=>xe(t,+e,Number),s=i(this._firstVisibleDate),n=i(this._lastVisibleDate);if(s>=n)return;const[r,o,a,l]=["Open","Close","Change","Volume"].map((t=>{return i=xo[t],e.getData(i).slice(s,n+1);var i}));[this.min,this.max]=Ne(o),this.zone=(this.max-this.min)/this.numBars,this.bars=Re(this.numBars,(e=>[0,0])),o.forEach(((e,t)=>{const i=this.getBarIndex(e,!0),s=l[t];let n=null;n=this.useChange?a[t]>=0:r[t]<=o[t],this.bars[i][n?1:0]+=s}));let c=null;this.maxVolumeIndex=-1,this.bars.map((([e,t])=>e+t)).forEach(((e,t)=>{e>c&&(c=e,this.maxVolumeIndex=t)})),this.gotData=!0}}function oA(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 aA extends gT{periodTarget=0;targetPrice1=0;targetPrice2=0;pricesCount=0;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(Ci.AT_LINE),t=this.lineOnlyStyle(Ci.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 Xe(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 lT(this.axis,this.targetPrice,this.targetDate)],this.pricesCount>1&&this.points.push(new lT(this.axis,this.targetPrice2,this.targetDate)),this.unitsPerYear=Hy(this.presenter.data.aggregation),this.anchorPrice=this.mainCont.getLastDataPoint(xo.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=oA(t(this.targetPrice));if(this.pricesCount>1){const e=oA(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 aT(this.points[0].point,!0,this.axis)),e.push(new aT(this.points[0].point,!1,this.axis)),this.pricesCount>1&&e.push(new aT(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(Ms(t,e)))),s=this.pricesCount>1,n=this.points[0].point,r=s?this.points[1].point:n,o=this.traits.line2.color,a=Ts(o),l=_s(t),c=["Above","Below","Between"],u=(e,t)=>`${Je(100*e,2).toFixed(2)}% Probability ${c[t]}`,h=(e,i)=>ws(t,e,i,z.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 lA=new class{resizingPanes=!1;snapToSupported=!1;touchCrosshairMode=!1;previousTouchTimestamp=null;resizingScale=!1;resizingScaleId=null;lastScaleResizingOffset=null;touchCrosshairTimeout=null;lastResizingOffset=null;prevPinchDistance=null;constructor(){this.stopResizingScale(),this.notifyZoomChanged=Ke(No.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 Ci.EVENT_PIN_HIT;const t=e.presenter.selectedAnnotation;let i;void 0!==t&&(i=t.points.find((t=>t.hitTest(e.point))));let s=Oe(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(Ze(e))this.resetVerticalAxis(e),r=!0;else if(n)this.resetHorizontalAxis(i),r=!0;else if(Ue()){const e=i.selectedAnnotation;null!=e?JT(e,t):QT(i,t)}r&&s.redraw()}onMouseEnter(){this.previousTouchTimestamp=null}computePreviousTouchStartDuration(){if(!Ue())return null;const e=(new Date).getTime(),t=Ze(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?Z.Meta:Z.Control,u=i===q.Right||l&&i===q.Left&&e.getModifier(Z.Control);this.touchCrosshairMode&&Ze(this.touchCrosshairTimeout)&&(clearTimeout(this.touchCrosshairTimeout),this.touchCrosshairTimeout=null);const h=this.computePreviousTouchStartDuration();if(Ze(h)&&h<Ci.DOUBLE_CLICK_DURATION_MILLIS)return this.onMouseDblClick(e),!0;if(!u&&this.isLogoLink(n)&&o.notifyHost(No.CH_LOGOCLICKED,{chart:o.accessor}),Ze(t)&&o.allPlots.some((e=>e.tryHandleCustomEventClick(t.point))))return!0;if(Ze(s))return this.resizingPanes=!0,this.lastResizingOffset=n,this.splitter=s,o.enableTooltip(!1),!0;if(Ze(r)){return et(o.display.chart.zooming)[0]&&this.startAxisScaling(r,n),!0}if(null!=t){if(e.getModifier(c))return o.activeTool=new ZT,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?(null==i?QT(o,n,a):i?.locked&&JT(i,n),!0):!!this.touchCrosshairMode||(o.activeTool=new GT(t),o.activeTool.startPan(n),$T());const r=null!=s;if(u)return JT(i,n),Ue();{if(r&&!s.movable||!r&&!i.canMove(t.point))return!1;const e=r&&-1!==i.points.indexOf(s);return o.activeTool=e?new oT(i,s):new rT(i,t,n),Ue()}}return this.prevZoomingOffset=n,!1}onContextMenu(e){return!0}isLogoLink(e){const t=Xe(zT)&&zT.logoClickable?zT.rect:null;return Ze(t)&&t.contains(e)}onMouseMove(e){const{point:t,splitter:i,priceAxis:s,view:n,presenter:r,offset:o}=e;if(Ze(e.pinchZoom)&&e.pinchZoom&&Ze(e.pinchDistance))return Ze(this.prevPinchDistance)&&(e.delta=this.prevPinchDistance-e.pinchDistance,this.onWheel(e)),this.prevPinchDistance=e.pinchDistance,Ue();if(null!=i||this.resizingPanes)n.setCursor(j.ResizeVertical),this.resizingPanes&&this.resizePanes(n,o);else if(Ze(t)){const[e,i]=this.findHit(t);Ze(i)?t.presenter.view.setCursor(j.Crosshair):Ze(e)?e.isSelected?t.presenter.view.setCursor(j.Move):t.presenter.view.setCursor(j.Hand):t.presenter.view.setCursor(j.Arrow)}else if(Ze(s)){et(r.display.chart.zooming)[0]&&(n.setCursor(j.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(j.ResizeHorizontal)}return!t||this.resizingPanes?(this.hideCrosshairAndTooltips(n),Ue()):(this.isLogoLink(o)&&n.setCursor(j.Hand),this.showCrosshairAndTooltips(n,t,o),Ue())}showCrosshairAndTooltips(e,t,i){if(t.time&&(!Ue()||this.touchCrosshairMode)){e.drawCrosshair({ap:t,offset:i})&&e.presenter.showTooltip&&BT(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&&FT(e.presenter)}onMouseLeave(e){const{view:t,offset:i}=e,s=t.presenter.accessor.getPaneBounds()?.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}));s&&(this.hideCrosshairAndTooltips(t,!0),this.stopResizeZoom(t.presenter)),t.setCursor(j.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),Ue()){const t=function(){const e=SP().config.touchCrosshairTimeoutMillis;return Ze(e)&&Number.isFinite(e)?e:Ci.LONG_PRESS_TIMEOUT_MILLIS}();this.touchCrosshairTimeout=window.setTimeout((()=>{this.hideCrosshairAndTooltips(e.view,!0),this.touchCrosshairMode=!1}),t)}}applyZoom(e,t,i=!0){if(!et(e.display.chart.zooming)[1])return;const s=Math.sign(t)*(Ue()?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!(!(Ue()?"none"!==n:"wheel"===n||"wheel+shift"===n&&i(Z.Shift))||0===s)&&(e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(),this.applyZoom(t,s),!0)}get useKeyboardShortcuts(){return SP().config.hostingModel!==ce[ce.Application]}onKeyDown(e){const{key:t,code:i,presenter:s}=e;if(Ze(s.selectedAnnotation)&&We(t,i)){const e=s.selectedAnnotation;e.axis.deleteAnnotation(e),s.onAnnotationModifiedByTool(e,he.Deleted)}if(Ze(s.selectedAnnotation)&&($e(t,i)?s.clearSelection():Ge(t,i)&&s.selectedAnnotation instanceof bT&&s.selectedAnnotation.textEditable&&(s.activeTool=new wT(null,s.selectedAnnotation),s.activeTool.startEditing())),ze(t,i)||Ye(t,i)){const e=ze(t,i)?1:-1,n=s.view;n.xAxis.pan(e*n.xAxis.xScale.bar.totalWidth),n.redraw()}const n=window.navigator.platform.toLowerCase().startsWith("mac")?Z.Meta:Z.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(Z.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<Ci.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=Je(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=Ue()?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()}}},cA=e=>mA(eS,OS,1,e),uA=e=>mA(eS,ET,1,e),hA={Default:()=>function(){return lA},Line:()=>mA(MT,aS,!1),DateRange:()=>mA(MT,ZS,!1),PriceRange:()=>mA(MT,JS,!1),DatePriceRange:()=>mA(MT,QS,!1),GannBox:()=>mA(MT,eA,!1),GannSquare:()=>mA(OT,sA),Ray:()=>mA(MT,aS,!1),GannLine:()=>mA(LT,aS,!1),VerticalLine:()=>mA(eS,lS,1),HorizontalLine:()=>mA(eS,cS,1),LongPosition:()=>mA(eS,NS,1,!0),ShortPosition:()=>mA(eS,NS,1,!1),FiftyPercentLine:function(e,t){return Ze(e)?mA(tS,uS,e.axis||t.mainAxis,e):mA(eS,uS,2)},FibonacciRetracement:()=>mA(MT,dS,!1),TrendBasedFibExtension:()=>mA(MT,pS,!0),FibonacciFan:()=>mA(MT,gS,!1),FibonacciArcs:()=>mA(MT,PS,!1),FibonacciChannel:()=>mA(MT,nA,!0),GannFan:()=>mA(MT,CS,!1),SpeedResistanceFan:()=>mA(MT,bS,!1),SpeedResistanceArcs:()=>mA(MT,ES,!1),AndrewsPitchfork:()=>mA(eS,_S,3),Rectangle:()=>mA(MT,KT,!1),Ellipse:()=>mA(MT,MS,!1),TrendChannel:()=>mA(MT,LS,!0),SymbolArrowUp:()=>cA("arrow_up"),SymbolArrowDown:()=>cA("arrow_down"),SymbolArrowRight:()=>cA("arrow_right"),SymbolArrowLeft:()=>cA("arrow_left"),SymbolArrowHorizontal:()=>cA("arrow_horizontal"),SymbolArrowVertical:()=>cA("arrow_vertical"),SymbolArcDown:()=>cA("arc_down"),SymbolArcUp:()=>cA("arc_up"),SymbolThumbsUp:()=>cA("thumbs_up"),SymbolThumbsDown:()=>cA("thumbs_down"),SymbolZero:()=>cA("zero"),SymbolOne:()=>cA("one"),SymbolTwo:()=>cA("two"),SymbolThree:()=>cA("three"),SymbolFour:()=>cA("four"),SymbolFive:()=>cA("five"),SymbolSix:()=>cA("six"),SymbolSeven:()=>cA("seven"),SymbolEight:()=>cA("eight"),SymbolNine:()=>cA("nine"),SymbolQuestion:()=>cA("question"),SymbolFishHook:()=>cA("fish_hook"),SymbolBuy:()=>cA("buy"),SymbolSell:()=>cA("sell"),FibonacciTimeZones:()=>mA(MT,wS,!1),Text:()=>mA(wT,bT,null),PickPoint:()=>function(){return new IS},ZoomIn:()=>function(){return new ZT},ProfitLoss:uA,RewardRisk:uA,VolumeAtPrice:function(e){return mA(eS,rA,2,e)},ProbabilityCones:function(e){return mA(eS,aA,2,e)}};function dA(e,t=!1,i=null,s=null,n=null){let r=hA[e];return r=r(s,n),r(e,t,i)}function pA(e,t={}){e.enableTooltip(!0),e.resetActiveTool();const{axis:i,annotation:s,toolChange:n,annId:r}=t;Ze(i)&&e.onAnnotationsUpdated(i),Ze(s)&&e.onAnnotationModifiedByTool(s,n),[he.Cancelled,he.Executed,he.TextChanged].includes(n)&&e.onAnnotationDone(r,n)}function fA(e,t=!0,i=he.None){e.wasModifiedByTool();const s=e.axis,n={axis:s,annotation:e,toolChange:i};pA(s.pane.presenter,t?n:void 0)}function mA(e,t,i,s){return function(n,r,o){const a=pT(n,t,s,o);return a.annName=n,r?a:new e(a,i)}}function gA(e){e.button===q.Right&&pA(e.presenter)}function yA(e,t,i){const s={};s.source=xo[e.source],s.inputs=ct(e.inputs);const n=void 0!==e.target,r=Ze(i)?i:e.curves,o=n?[xo[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?xo[e.target]:s.outFields[0],s.aggregation=t,s}class TA extends eT{#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 Ze(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(!Ze(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(!Ze(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=Rn(this.model.study),t=e.meta.decimals;this.metaData=void 0!==t?new zi(t):this.basePlot.metaData,Ze(e.meta.range)&&(this.range=e.meta.range)}getDetachedScaleMargins(){const e=this.model?.study;return"VOL"===e&&this.axis?.pane.isMain?Ci.VOLUME_DETACHED_SCALE_MARGINS:super.getDetachedScaleMargins()}applySpecifics(e){const t=this.model.study;!0===Rn(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?V.Percent:V.None;break}case"PERF":{const t="VisibleStart"===e.inputs.Anchor;this.axis.comparison=t?V.Percent:V.None;break}case"JPI":case"CTTP":{const t=Re(10,(e=>.025*(e+1))),i=e=>t.map((t=>ms(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,Ze(this.annotations)||(this.annotations=[]);const t=dA("VolumeAtPrice",!0,{[Ci.AT_LINE]:{color:this.curves[0].colors[3],width:2},[Ci.AT_FILL]:{color:this.curves[0].colors[0]},[Ci.AT_FILL2]:{color:this.curves[0].colors[1]},[Ci.AT_FILL_TEXT]:{color:this.curves[0].colors[2]}},this.id)(this.axis,!1);t.setOptions(e.inputs),this.annIndex=this.annotations.push(t)-1;break}case"IVRANK":{let t=xo.ImplVolRank1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=xo.ImplVolRank5D;break;case"1-Month":t=xo.ImplVolRank1M;break;case"3-Month":t=xo.ImplVolRank3M;break;case"6-Month":t=xo.ImplVolRank6M;break;case"YTD":t=xo.ImplVolRankYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"IVPCTL":{let t=xo.ImplVolPerc1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=xo.ImplVolPerc5D;break;case"1-Month":t=xo.ImplVolPerc1M;break;case"3-Month":t=xo.ImplVolPerc3M;break;case"6-Month":t=xo.ImplVolPerc6M;break;case"YTD":t=xo.ImplVolPercYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"OPTIV":{let t=[xo.WeighImplVolHigh,xo.WeighImplVol,xo.WeighImplVolLow];switch(e.inputs.TimeFrame){case"1-Day":default:break;case"5-Day":t=[xo.WeighImplVolHigh5D,xo.WeighImplVol5D,xo.WeighImplVolLow5D];break;case"1-Month":t=[xo.WeighImplVolHigh1M,xo.WeighImplVol1M,xo.WeighImplVolLow1M];break;case"3-Month":t=[xo.WeighImplVolHigh3M,xo.WeighImplVol3M,xo.WeighImplVolLow3M];break;case"6-Month":t=[xo.WeighImplVolHigh6M,xo.WeighImplVol6M,xo.WeighImplVolLow6M];break;case"1-Year":t=[xo.WeighImplVolHigh1Y,xo.WeighImplVol1Y,xo.WeighImplVolLow1Y];break;case"YTD":t=[xo.WeighImplVolHighYTD,xo.WeighImplVolYTD,xo.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)),Ze(this.annotations)||(this.annotations=[]);const i=this.curves[11],s=this.curves[12],n=dA("ProbabilityCones",!0,{[Ci.AT_LINE]:{color:i.colors[0],width:i.lineWidth,dashStyle:i.dashStyle},[Ci.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);const s=this.annotations[this.annIndex],n=s.getBarIndex(i);if(n<0||n>=s.bars.length)return null;const[r,o]=s.bars[n];switch(e){case xo.UPVOL:return o;case xo.DNVOL:return r;case xo.TOTVOL:return r+o;default:throw new Error("Unexpected Volume At Price field")}}getColorOf(e){if(!this.isVolAP)return null;const t=this.curves[0].colors;switch(e){case xo.UPVOL:return t[1];case xo.DNVOL:return t[0];case xo.TOTVOL:return t[2];default:throw new Error("Unexpected Volume At Price field")}}isEmpty(){return!this.isVolAP&&super.isEmpty()}setCurveAttributes(e,t){const i=t=>this.curves[e].attributes=[S[t]];switch(t){case"LikeMain":{const t=this.axis.pane.presenter.mainPlot.curves[0].attributes,s=SP().config.defaultVolumeBarColoring;if(Ze(t))this.curves[e].attributes=[t[0]];else if(Ze(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(xo.Buy)||e.includes(xo.Sell)}getEventFor(e){switch(e){case xo.Buy:return{show:!0,title:"B",color:"#03c03c"};case xo.Sell:return{show:!0,title:"S",color:"#c23b22"};default:return null}}getEventFields(){return this.hasEvents?[xo.Buy,xo.Sell]:[]}async initialize(){if(this.model.basis!==Ci.BASIS_MAIN)throw new Error("Studies can currently only be based on the main (symbol) plot");return Ai.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=yA(this.model,e,this.curves);this.applySpecifics(t);let i=this.basePlot.timeSeries;i instanceof Cp&&(i=i.actual),this.timeSeries=Xg(this.model.study,t,i),this._hasEvents=this.doesSeriesEmitEvents(),this.timeSeries.useNotifications=!0;const s=this.title,n=this.basePlot.timeSeries instanceof _h;return this.timeSeries.ready().then((e=>{e||n||this.timeSeries.computedServerSide||dP(`Unable to calculate study values for ${s}`,"error")})),!0}))}get isJpi(){return"JPI"===this.model.study||"CTTP"===this.model.study}get isVolAP(){return"VOLAP"===this.model.study}onPriceDomainsUpdated(){this.isVolAP&&this.annotations[this.annIndex].invalidate()}shouldPriceMap(e){return this.isJpi?!!this.shouldMaybePriceMap&&(e.id===xo.JPIB.id||e.id===xo.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(xo.JPIB,t),r=s(xo.JPIS,t);if(null===n&&i.id===xo.JPIB.id||null===r&&i.id===xo.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 SA=[xo.Open,xo.High,xo.Low,xo.Close,xo.Volume];class AA extends eT{exprModel=null;symbols=null;get title(){return this.expression}get expression(){return this._expression}async parseExpression(){const e=Xr(this._expression);if(this.exprModel=null,this.symbols=null,qr(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!Ze(this.errorText)}#t(e){return{mapper:e=>e.query.symbol,loadMoreData:!0,recompute:p.Minimum,missing:h.UseNext,stretch:e=>!1,fieldMap:new Map(SA.map((e=>[e,e]))),noDataApproach:m.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:e}}getTimeSeries(){const e=this.getInnerSeries(),t=this.axis?.pane.presenter.data?.exprSkipLeadingEmpty??!1,i=new Ym(this.exprModel,e,this.#t(t));this.timeSeries=this.wrapIfAdvancedStyle(i);const s=this.title;this.timeSeries.ready().then((e=>{e||dP(`Unable to calculate expression: ${s}`,"error")}))}getInnerSeries(){const e=eo(this.exprModel),t=SP().getTimeSeriesDataSource();return e.map((e=>{const i=this.makeQuery();return i.symbol=e,t.getTimeSeries(i)}))}getRecord(){if(Ze(this.errorText))return;const e=this.metaData.inner.map((e=>[e.symbol,e.resolved]));this.record=new jo(e,rt(this.exprModel)),this.record.ready().then((e=>e))}getMetaData(){this.isValid&&(this.metaData=new ji(this.symbols),this.metaData.ready().then((e=>{e&&(this.getRecord(),this.presenter?.notifyHost(No.MD_CHANGED,{plot:this}))})))}fromModel(e){super.fromModel(e),this._expression=e.expression}async initialize(){return Ai.call(this,(async()=>(await this.parseExpression(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0))))}}class vA extends eT{fwdModel=null;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=Xr(this.forward),t=qr(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=` (${ye(qu(this.offset),ou(Ci.FMT_US_DATE_ONLY))(new Date)})`,this.outField=new Oo(`Close_${this.offset}`,O.Number,x.Forward,`Close (${this.offset})`),this.curves[0].fields[0]=this.outField):(this.suffix="",this.outField=xo.Close);const t=e=>Yt(`${e}*1`),{yes:i,no:s}=be(e.symbols,t),n=(await Promise.all(i.map((e=>ni(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!Ze(this.errorText)}getMetaData(){if(this.isValid){const e=Object.values(this.roots).flat();this.metaData=new ji(e),this.metaData.ready().then((e=>{e&&this.presenter?.notifyHost(No.MD_CHANGED,{plot:this})}))}}getForwardPolicy(e){return{mapper:e=>e.query.root,loadMoreData:!1,recompute:p.Everything,missing:h.UseNext,stretch:e=>!1,fieldMap:new Map([[xo.Close,this.outField]]),noDataApproach:m.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1,valueProvider:e}}getTimeSeries(){const e=SP().getTimeSeriesDataSource(),t=Object.keys(this.roots),i=0===this.offset?$.Forward:$.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 Dh(this.symbols):void 0;this.timeSeries=new Ym(this.fwdModel,s,this.getForwardPolicy(n)),this.timeSeries.ready().then((e=>{if(e){const e={series:this.timeSeries,part:se.Unspecified};this.presenter?.notifyHost(No.TS_MANYCHANGED,e)}}))}async initialize(){return Ai.call(this,(async()=>(await this.parseForward(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0))))}}function PA(e){Mt(1,arguments);var t=Ot(e),i=t.getFullYear();return t.setFullYear(i+1,0,0),t.setHours(23,59,59,999),t}const CA=e=>e.substr(0,e.lastIndexOf("::"));class bA extends eT{seaModel=null;isPlain=!1;isFutures=!1;suffix="";get title(){return this.isAverage?"Average":!this.hasComputation&&(this.symbols?.length??0)>0?this.outField.name:`${this.seasonal}${this.suffix}`}get seasonal(){return this._seasonal}fromModel(e){super.fromModel(e);const t=e;this.offset=t.offset,this.offsets=t.offsets,this.useInAverage=t.useInAverage,this.usesInAverage=t.usesInAverage,this.isAverage=!Ze(t.offset),this._seasonal=t.seasonal}constructSeasonal(e,t){return Qr(io(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,t)=>{const n=!!s||i.includes(e),r=this.usesInAverage[t];return n&&r})).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 Oo(`Close_${t}`,O.Number,x.Seasonal,`Close${this.suffix}`),this.curves[0].fields[0]=this.outField}applyOffset(e,t){return`${this.isPlain?e:ai(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=Xr(this.seasonal,!0),t=e=>(this.errorText=e,this.seaModel=null,null);if(qr(e))return t(e.error);let{model:i,symbols:s}=e;this.prepareFields();const n=new Map;for(const e of s){const t=ei(await Gt(e));n.set(e,t)}i=io(i,(e=>n.get(e))),s=Array.from(n.values());const r=s.every((e=>Yt(e)||Kt(e))),o=s.every((e=>Xt(e))),a=s.every((e=>!Yt(e)&&!Xt(e)&&!Kt(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=to(i);const l=this.isAverage?this.constructAverage(i):this.constructSeasonal(i,this.offset),{model:c,symbols:u}=Xr(l,!0);this.seaModel=c,this.hasComputation=to(c),this._seasonal=Qr(io(c,CA)),this.symbols=u,this.outField.name=this.outField.shortName=this.fixupFieldDescription()}get isValid(){return!Ze(this.errorText)}getActualSymbols(){return[...new Set(this.symbols.map(CA))]}fixupFieldDescription(){if(!this.hasComputation&&!this.isAverage){const e=CA(this.symbols[0]);if(this.isPlain)return`${e} ${(new Date).getFullYear()-this.offset}`;if(this.isFutures)return ei(e,!0)}return this.title}getMetaData(){if(this.isValid){const e=this.getActualSymbols(),t=1===e.length&&!this.hasComputation&&!this.isAverage,i=SP().getMetaDataSource();this.metaData=t?i.getMetaData(e[0]):new ji(e),this.metaData.ready().then((e=>{e&&this.presenter?.notifyHost(No.MD_CHANGED,{plot:this})}))}}getNoDataApproach(){return this.isAverage&&!this.coreHasComputation?m.ModelTransformRequired:this.hasComputation?m.NoAction:m.IgnoreTimelineOnly}get seasonalPolicy(){return{mapper:e=>e.query.surrogate||e.query.symbol,loadMoreData:!1,recompute:p.Everything,missing:this.hasComputation||this.useInAverage?h.UsePrevious:h.UseNone,stretch:e=>this.shouldStretch(e),fieldMap:new Map([[xo.Close,this.outField]]),noDataApproach:this.getNoDataApproach(),modelTransform:(e,t)=>{if(0===t.length)return this.seaModel;return Xr(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 It(new Date,-e)}yearFromOffset(e){return Ft(this.shiftYears(e))}getCmdtyRange(e){const t=this.shiftYears(e);return[Dt(t),PA(t)]}getTimeSeries(){if(!this.isValid)return;const e=SP().getTimeSeriesDataSource(),t=Object.keys(this.symbolToOffset).map((t=>{const i=this.makeQuery();return i.surrogate=t,i.symbol=CA(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&&Ze(...i.range)&&(i.range=i.range.map((e=>It(e,-i.offset)))),i.offset>0&&(i.disableStreamingUpdates=!0),e.getTimeSeries(i)}));this.timeSeries=new Ym(this.seaModel,t,this.seasonalPolicy),this.timeSeries.ready().then((e=>{if(e){const e={series:this.timeSeries,part:se.Unspecified};this.presenter?.notifyHost(No.TS_MANYCHANGED,e)}}))}async initialize(){return Ai.call(this,(async()=>(await this.parseSeasonal(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0))))}}const EA=["bottom","right","left"],_A={bottom:"center",right:"start",left:"end"};class MA{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=Ze(n);if(r=r||this.fontSize+this.padding+this.padding+(o?this.padding:0),!EA.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=_A[this.position],e.strokeStyle=this.strokeColor,e.fillStyle=us(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+_s(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 LA=({y:e,halfHeight:t})=>e+t;function OA(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=LA(n);r<o&&(e.y=o+1+e.halfHeight);LA(e)>t.y+t.height&&(e.y=t.y+t.height-e.halfHeight-1)}}))}const wA=({x:e,halfWidth:t})=>e-t-4,IA=({x:e,halfWidth:t})=>e+t+4,DA=(e,t)=>e-1-t-4,xA=(e,t)=>e+1+t+4;function NA(e,t){const i=e.length-1;e.forEach(((e,s,n)=>{const r=0===s,o=r?null:n[s-1],a=wA(e),l=r?t.x:IA(o);if(e.x-e.halfWidth<t.x&&(e.x=xA(t.x,e.halfWidth)),a<l)e.x=xA(l,e.halfWidth+4);else{const t=IA(e),r=s<i?wA(n[s+1]):Number.MAX_SAFE_INTEGER;if(t>r){const i=DA(e.x,t-r),s=DA(e.x,e.halfWidth-2),n=xA(l,o?.halfWidth??0);e.x=Math.max(s,i,n)}}IA(e)>t.x+t.width&&(e.x=DA(t.x+t.width,e.halfWidth))}))}const RA=Array.from(Array(6),((e,t)=>++t)).reverse();function HA(e){const t=e.plot.timeSeries.container;return null===t||t.size<1?null:e.getColor(t.size-1)}function VA(e){return e.curves.filter((t=>t.visible&&(e.type!==U.Study||t.style!==v.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===U.Study&&("JPI"===e.model.study||"CTTP"===e.model.study);return null!=s||o||(r=_e(n,(e=>null!==e)),s=-1!==r?n[r]:null),[s,r]}(e,i);return{value:s,color:HA(t),field:i,index:n}}))}class FA{constructor(e){this.pane=e,this.annotations=[],this.isCustomDomain=!1,this.primary=!1,this.onTheRight=!0,this.plots=[],this.label="",this.id=yt(),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 MA({fontSize:this.config.fontSize,arrowLength:this.config.innerTickSize})}makePlot(e){let t=null;switch(U[e.type]){case U.Symbol:t=new tT;break;case U.Expression:t=new AA;break;case U.Study:t=new TA;break;case U.IncomeStatement:t=new iT($.IncomeStatement);break;case U.BalanceSheet:t=new iT($.BalanceSheet);break;case U.Forward:t=new vA;break;case U.Seasonal:t=new bA;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!==V.None?this.pane.presenter.mainPlot.priceMap(t,void 0,xo.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 lT(this,t,i||void 0)}toX(e){return this.pane.presenter.view.toX(e)}priceMap(e){return this.comparison!==V.None?this.pane.presenter.mainPlot.priceMap(e,void 0,xo.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!==Q.Both&&e.moveDirection!==Q.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=xe(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<=Ci.SNAP_PROXIMITY_PIXELS)).reduce(((e,t)=>null===e||t.dist<e.dist?t:e),null);Ze(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*-as(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(Ze(this.pane.presenter.view))return this.snapTo(e)}makeAnnotation(e,t=!0){const i=dA(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];Qe(s.price)&&Qe(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,n=e.usesInAverage??[],r=s.map(((e,t)=>n[t]??!0));delete e.curves,delete e.offsets,delete e.usesInAverage;const o=s.length;for(let n=0;n<i.length;n++){const a=Object.assign({},e);a.curves=[i[n]],a.offsets=s;const l=a;l.offset=n===o?null:s[n];const c=!Ze(l.offset);l.useInAverage=!c&&(r[n]??!0),l.usesInAverage=r,(!c||o>1)&&t.push(a)}break}default:t.push(e)}return t}fromModel(e){this.comparison=V[e.comparison??"None"],this.scale=B[e.scale??"Linear"],this.yScale=new jy(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:ms(.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:Ci.ANN_DUPLICATE_OFFSET,y:Ci.ANN_DUPLICATE_OFFSET}),t.appendAnnotation(i),i.requestRedraw(),this.fireAnnotationsChanged()}updateAnnotation(e,t){e.isSelected&&this.pane.presenter.clearSelection(),lr(e.name,t.traits),e.updateFrom(t.traits,t.extras,t.isUndoRedo?null:t.points,t.visible,t.locked),t.isUndoRedo&&Ze(t.points)&&e.updateActivePoints(t.points),t.isUndoRedo||this.pane.presenter.undoRedoManager.done(uT(e,he.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 Ze(this._fullDomain)||(this._fullDomain=this.getDataDomain().domain),this._fullDomain}updateFullDomain(e=null){if(null===e&&this.comparison!==V.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(),o=e=>xe(r,+e,Number),a=Ze(t),l=a?o(t):0,c=Ze(i),u=c?o(i):r.length-1,h=e.curves.map((e=>e.fields)).flat().filter((e=>e.id!==xo.Change.id)),d=Ze(e.targetFields);d&&h.push(...e.targetFields);const p={},f=t=>{const[i,s]=(t=>{const i=d?e.curves[0]:e.curves.find((e=>e.fields.includes(t)));if(!Ze(i)||0===i.shift)return[l,u];if(!Ze(p[i.id])){const e=i.shiftedTimeDomain;if(!Ze(e))return[l,u];p[i.id]=[o(e[0]),o(e[1])]}return p[i.id]})(t),r=n.getData(t),a=Math.max(i,0),c=Math.min(r.length-1,s);return r.slice(a,c+1).map(((i,s)=>e.priceMapper(i,s,t)))},m=[null,null],g=e=>e.id,y=new Set(Le(n.fields,h,g).map(g));e.curves.filter((e=>e.visible)).map((e=>{const t=e.fields.filter((e=>y.has(e.id)));if(e.isStackedColumn){He(Ne(t.map((e=>f(e))).reduce(((e,t)=>t.map(((t,i)=>(e[i]||0)+(t||0)))),[])),m)}else t.map((e=>{const t=(e=>Ne(f(e)))(e);He(t,m)}))}));let T=pe.None;const S=[v.Column,v.MultiColumn,v.StackedColumn];if(a&&c&&!e.main&&e.curves.some((e=>S.includes(e.style)))){const e=m[0]>0,t=m[1]<0;e?(T=pe.Min,m[0]=0):t&&(T=pe.Max,m[1]=0)}return{domain:m,clamped:T}}getDataDomain([e,t]=[null,null],i=[null,null]){const s=rt(i);let n=!1;for(const i of this.plots.filter((e=>!e.hasDetachedScale))){const{domain:r,clamped:o}=this.getPlotDataDomain(i,e,t);Ze(r)&&(He(r,s),n=n||o!==pe.None)}if(!Ze(s))return{domain:null};const[r,o]=s;if(!Ze(r,o))return{domain:null};const a=[Number(r),Number(o)];a[0]===a[1]&&(a[0]-=1,a[1]+=1);let l=pe.None;return n&&(0===a[0]?l=pe.Min:0===a[1]&&(l=pe.Max)),{domain:a,clamped:l}}setDomain(){const e=this.pane.presenter,t=e.view.xAxis.xScale.domain();if(!Ze(t))return;for(const e of this.plots.filter((e=>e.hasDetachedScale))){const{domain:i}=this.getPlotDataDomain(e,t[0],t[1]);Ze(i)&&e.yScale.domain(i)}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=nt(e.display,!1,"chart","previous","forceVisible");Ze(t,i)&&s&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],t))}if(this.yScale.domain(i),Ze(i)){const e=this.getPadding(s);Ze(e)&&this.yScale.padding(e)}}getInitialPadding(){const e=ci(this.pane.presenter.hostElement);let t=di(`#${Ci.HEADER_SIZE_PLACEHOLDER_ID}`,e);if(!Ze(t)){t=yi(e,"div"),pi(t,{display:"none"}),fi(t,{id:Ci.HEADER_SIZE_PLACEHOLDER_ID,class:"bcharts-card bcharts-card-first"});const{lineHeight:i}=getComputedStyle(t);isNaN(Number.parseFloat(i))&&pi(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)+Ci.CARDS_Y_OFFSET}getPadding(e){const t=this.pane.presenter,i=t.display,s=nt(i,null,"yAxis","minPaddingPercent"),n=nt(i,null,"yAxis","maxPaddingPercent"),r=Ze(s),o=Ze(n),a=r||o?0:this.getInitialPadding(),l=o?n:Ci.PANE_CAP_MAX_PADDING_PERCENT,c=(r?s:Ci.PANE_CAP_MIN_PADDING_PERCENT)*this.viewBox.height,u=[o?l*this.viewBox.height:Math.max(c,Math.min(l*this.viewBox.height,a)),c];e===pe.Max?u[0]=Ci.PANE_TINY_PADDING_PIXELS:e===pe.Min&&(u[1]=Ci.PANE_TINY_PADDING_PIXELS);const h=t.mainPlot;return h&&h.hasEvents&&(u[0]+=3*t.view.getEventRadius()),u}clearTicks(){this.ticks=null}getTicks(e,t=0){const{height:i}=this.viewBox,s=_s(e,1.3),n={height:i,approxLineHeight:s,domain:this.yScale.domain()};if(Ze(this.ticks)&&Ze(n.domain)&&Ze(this.lastUsedOptions)&&Ze(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=nt(SP().config,null,"overrides","yAxis","tickProvider");if(Ze(a)&&"function"==typeof a&&n.height>0&&Ze(n.domain)){const e=rt(n);e.autoTicks=rt(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=yd(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(!Ze(this.fullDomain))return Ci.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(yd(this,t,!0)).width))),{innerTickSize:r,tickPadding:o}=this.config,a=n+r+2*o+(Ze(this.label)?_s(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(As(e,this.viewBox),e.font=`${c} ${u}px ${t}`,e.lineWidth=2,e.strokeStyle=i.color,e.textAlign="end",Ze(this.label)){e.save();const t=fs(.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=_s(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([]),Ns(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=yd(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(U.Symbol)||e.is(U.Expression);if(o&&u){const t=e.axis.comparison===V.Percent?V.None:V.Percent;c=e.priceMapper(a,r,n,t)}const h=e.hasDetachedScale?e.metaData.format(t,n):void 0,d=Ze(c)?1:2;l.push({y:e.priceToY(t),formattedValue:h,value:t,auxValue:c,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){const t=e.main?1:3;VA(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,xo.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&&OA(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=Ts(r),d=new MA({position:this.onTheRight?"right":"left",fontSize:this.config.fontSize,padding:this.config.indicatorPadding,fontFamily:i,textColor:h,strokeColor:r,backgroundColor:r}),p=n||yd(this,s);let f;const m=this.comparison===V.Percent;Xe(o)&&(f=m?gd(this,o):md(o)),d.draw(e,u,t,p,f)};r?l.forEach(u):RA.forEach((e=>l.filter((t=>t.priority===e)).forEach(u)))}}const BA=Symbol.for("__dloacip__");class kA{constructor(e){this.presenter=e,this.axes=[],this.height=0,this.alignedToYear=null,this.id=yt()}fromModel(e){this.height=e.height,!0===e.alignOnExpirations&&(this.alignedToYear=function(e){const t=e.map((e=>e.plots)).flat().filter((e=>U[e.type]==U.Symbol)).map((e=>e.symbol)).map((e=>ri(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 FA(this);return i.primary=0===t,i.fromModel(e),i}),this)}getBounds(){return this.viewBox}setViewBox(e){this.viewBox=e}draw(e){this.drawAxes(e),e.save(),this.clipToNoScales(e),this.drawPrevious(e),this.drawGrid(e),this.drawPlots(e),this.drawAnnotations(e),this.drawLogo(e),e.restore()}drawLogo(e){this.isMain&&!1!==this.presenter[BA]&&jT(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,xo.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=cs(c);e.save(),e.strokeStyle=l,e.lineWidth=u,e.setLineDash(h),Rs(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){As(e,this.getBoundsWithoutScales())}drawAnnotations(e){e.save();const{chart:{fontFamily:t},yAxis:{fontSize:i}}=this.presenter.display;e.font=`${i??12}px ${t}`,this.axes.forEach((t=>{t.annotations.forEach((t=>t.draw(e,!0)))})),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=this.axes[0],{fontWeight:c,fontSize:u}=l.config;e.font=`${c} ${u}px ${t}`;const h=l.getTicks(e),{leftOffset:d,rightOffset:p}=this.presenter.view,f=d,m=this.viewBox.width-p,g=(t,i,s)=>{e.lineWidth=t,e.strokeStyle=i,e.setLineDash(cs(s)),e.beginPath()};if(g(r,o,a),h.forEach((t=>{e.moveTo(f,t.y1),e.lineTo(m,t.y2)})),e.stroke(),n&&n.visible&&h.length>=2){const{lineWidth:t,color:i,dashStyle:s}=n,r=(h[0].y1-h[1].y1)/5;g(t,i,s),h.forEach((t=>{for(let i=1;i<5;i++){const s=Math.ceil(t.y1+i*r);e.moveTo(f,s),e.lineTo(m,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=cs(r);e.strokeStyle=n,e.setLineDash(o);const a=this.presenter.view.leftOffset,l=this.viewBox.width-this.presenter.view.rightOffset,c=ks();c.prolog(e),Rs(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";ws(e,SP().config.noDataText||Ci.NO_DATA_TEXT,{x:this.viewBox.centerX,y:this.viewBox.centerY},z.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=!Ze(i)||i,n=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 UA(e,t){return{width:e,spacing:t,get totalWidth(){return this.width+this.spacing},offset:0}}class WA extends Uy{constructor(e,t){super(),this.timeline=e,this.aggregation=t;const i=e.presenter.display;this.marginBars=i.xAxis.marginBars||0,this.bar=UA(nt(i,Ci.DEFAULT_BAR_WIDTH,"chart","bar","width"),nt(i,Ci.DEFAULT_BAR_SPACING,"chart","bar","spacing")),this._extent=null,this.wasZoomed=!1,this.fitAllData=!1}extent(e){return ky.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.scaleBarToFitDensity(this.timeline.withoutPrologEpilogLength);const e=this.display.xAxis.visibleRange;if(Ze(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(!Ze(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=xe(this.timeline,+r,Number,bd));return[n-s+1,n]}adjustDomain(){if(!Ze(this._range))return;this.scaleBarToFit();const e=this.deriveExtentsFromBarWidth(this.bar);Ze(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,xe(this.timeline,e,Number,bd)):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>Ci.MAXIMUM_BAR_WIDTH||s<Ci.MINIMUM_BAR_WIDTH)return!1;const r=UA(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)=>Ze(e)?xe(this.timeline,e,Number,bd,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(Ci.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;let i=this.timeline.at(t),s=i,n=t;const r=this.presenter.data.aggregation;if(r.isEndOfDay||r.isIntraday&&e>=Ci.INTRA_THRESHOLD)for(;n>0&&Xu(i,s)<e;)n--,s=this.timeline.at(n);else if(!r.isTick){let t=Math.floor(e/Ci.ONE_DAY_MILLIS);const s=e=>WS(e,Nt(e)),r=s(i);let o=i;for(;n>0;){let e=this.timeline.at(n);const i=gr(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]=gt(e,t,Ci.MINIMUM_BAR_WIDTH,Ci.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(){Ze(this.resetBar)?(this.bar.width=this.resetBar.width,this.bar.spacing=this.resetBar.spacing):(this.bar.width=Ci.DEFAULT_BAR_WIDTH,this.bar.spacing=Ci.DEFAULT_BAR_SPACING),delete this.presenter.model.display.chart.bar,this.adjustDomain()}isUsableExtent(e){return Ze(e)&&Ze(e[0],e[1])&&e[0]>=0&&e[1]<this.timeline.withPrologEpilogLength&&e[1]-e[0]>=Ci.MINIMUM_BARS_VISIBLE}shiftBars(e,t=null){if(!this._extent)return;const i=this._extent.map((t=>t+e));this.isUsableExtent(i)&&(Ze(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(!Ze(e)||!Ze(e[0]))return[];const t=e[0].getTime();return this.timeline.presenter.allPlots.map((e=>e.timeSeries)).filter((e=>!(!Ze(e)||!e.hasData||0===e.container.size||!0!==e.canLoadMoreData)&&t<=e.container.getTimeData()[0].getTime()))}}function $A(e){return{date:e,priority:1,text:fd(e)}}class GA{constructor(e){this.view=e,this.xScale=new WA(e.presenter.timeline,e.presenter.data.aggregation),this.ticks=null,this.lastUsedOptions=null,this.wasPanned=!1,this.panningXAxisAllowed=nt(e.presenter.display,!0,"xAxis","panning"),this.updateConfigFromModel();const t=e.presenter.renderTo.id,i=nt(SP().config,null,"overrides","xAxis","tickProvider");Ze(i)&&"function"==typeof i&&(this.overrideTickGetter=me(i,t));const s=nt(SP().config,null,"overrides","xAxis","formatter");Ze(s)&&"function"==typeof s&&(this.overrideFormatter=me(s,t))}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 MA({position:"bottom",fontSize:this.config.fontSize,fontFamily:e,padding:this.config.indicatorPadding,strokeColor:o,textColor:s,backgroundColor:ms(.15)(t),arrowLength:this.config.innerTickSize})}setDomain(){this.xScale.adjustDomain();const e=this.view.presenter.display.period===Ci.FIFTY_YEARS_MILLIS;Ze(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!!Ze(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=_s(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=ed(e);return t?$A:e=>i.getTick(e)}getTicks(e){if(Ze(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&&Ze(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(!Ze(e)||Number.isNaN(e.getTime()))return null;const i=s(e);return Ze(i)&&(i.index=n+t),i})).filter((e=>Ze(e))),this.ticks}normalizeDuration(e){const t=Qh();let i=t.Year;const s=Object.keys(t);for(let n=0;n<s.length-1;++n){const r=t[s[n]].Multipliers,o=t[s[n+1]].Multipliers,a=(Oe(r)+we(o))/2;if(e<=a){i=t[s[n]];break}}const n=i.Multipliers,r=n.findIndex((t=>e<t));let o=-1===r?Oe(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,T=cs(y);e.textAlign="center",e.font=`${l} ${c}px ${a}`,e.lineWidth=1,e.strokeStyle=g,e.fillStyle=i,e.setLineDash([]),Rs(e,p,d,d+f);const S=this.xScale.extent(),A=e=>!Ze(e)||!Ze(e[0],e[1]);if(A(S))return;const v=t=>e.measureText(t).width,P=n>0?n:120,C=this.xScale.domain();if(A(C))return;const b=(C[1].getTime()-C[0].getTime())*P*.6/f,E=this.normalizeDuration(b),_=this.view.presenter.data.aggregation.isEndOfDay,M=(e,t)=>{if(e.date.valueOf()===Ci.ZERO_DATE.valueOf())return!0;if(i=e.date,n=t.date,(Ze(i)?Xu(n,i):Ci.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||!!_&&o)},L=d+f,O=({text:i,x:s,date:n,forced:r})=>{Ze(n)&&(r||Ns(e,s,p,p+u),e.fillText(i,s,p+u+h+.71*c),t.visible&&!r&&(e.save(),e.lineWidth=m,e.setLineDash(T),Ns(e,s,0,p),e.restore()))},w={agg:this.view.presenter.data.aggregation,unitWidth:v("M"),barWidth:this.xScale.bar.width,extent:S,formatString:r,minTickInterval:s||0,duration:b},I=this.getTicks(w);let D={date:Ci.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),(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>L?L-n:s,e.x=s,e.forced=t!==s}else e.forced=!1})(e),M(D,e)?(O(D),D=e):e.priority<D.priority&&(D=e)})),O(D),this.drawTimeAdornments(e)}getAnnXScore(e,t){return[gr,Cr,yr,br].map(((i,s)=>(s+1)*Number(i(e,t)))).reduce(((e,t)=>e+t),0)}annTimeToX(e){const t=this.xScale.timeToIndex(e);if(!Xe(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 vs(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=Td(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&&NA(n,this.viewBox),n.forEach((t=>{const s=Ts(t.color);new MA({position:"bottom",fontSize:this.config.fontSize,fontFamily:i,padding:this.config.indicatorPadding,strokeColor:Ci.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(!(Ze(c)&&ll(c)))return!1;if(!n)return!0;t=this.xScale.timeToX(c);const u=cs(a);e.strokeStyle=o,e.setLineDash(u);const h=ks();if(h.prolog(e),Ns(e,h.adjust(t),0,h.adjust(this.viewBox.y)),h.epilog(e),!r||!s.visible)return!0;const d=Ze(s.format)?l:void 0,p=Td(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 zA={mousedown:"onMouseDown",mousemove:"onMouseMove",mouseup:"onMouseUp",dblclick:"onMouseDblClick",contextmenu:"onContextMenu",mouseover:"onMouseEnter",mouseout:"onMouseLeave",wheel:"onWheel",touchstart:"onMouseDown",touchmove:"onMouseMove",touchend:"onMouseUp",keydown:"onKeyDown"},YA={Shift:"shiftKey",Alt:"altKey",Control:"ctrlKey",Meta:"metaKey"};class jA{constructor(e){this.view=e,this.subscriptions=[]}init(e){const t=Ue();Object.keys(zA).filter((e=>!(e=>e.startsWith("touch"))(e)||t)).forEach((t=>{const i=e=>{const i=zA[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=Ue()&&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:q.Left,offset:n,view:t.view,presenter:t,originalEvent:e,getModifier:t=>e[YA[Z[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(Ze(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(Z[t])}}}}const KA=Lu.concat(xo.PercentChange);class qA{constructor(e){this.view=e,this.isOptionsChart=!1,this.id=`bc-legend-${yt()}`}getLegendElem(){const e=this.view.el;return mi(this.id,e,"div")}update(){const e=this.getLegendElem(),t=Ud(this.presenter.mainPane);if(!Ze(t))return;this.isOptionsChart=this.mainPlot.title.startsWith("CUSTOM-FABRICATED-SYMBOL-PREFIX");const{left:i,right:s,top:n,width:r}=t;kT(e,"row",i,s,n,r),gi(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}`)} ${this.maybeGetAdditionalPlots()}`;e.innerHTML=u}remove(){hi(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){return 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=KA.map((t=>e.getValue(t)));if(Pe(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=KA[t],n=this.format(e,s),r=zd(s);return`${this.spanAsName(r)}${this.spanAsValue(n,i)}`})).join(" ")} ${this.spanAsValue(`(${this.format(Oe(t),Oe(KA))})`,i)}`}return""}maybeGetQuote(){if(this.mainPlot.isSymbol&&this.mainPlot.timeSeries?.record?.isValid){const e=SP().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=SP().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 xd("rectangle",e.mainCurve.colors[0])}getLastValues(e){return this.isOptionsChart?"":VA(e).filter((e=>Ze(e.value))).map((e=>{const t=this.format(e.value,e.field);return this.spanAsValue(t,null,`color:${e.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)?Fd(e.id):"",r="All"!==t&&!e.isSeasonal?this.getLastValues(e):"";return this.div(`${n} ${i} ${s} ${r}`)})).join(" "):""}}class XA{splitters=[];canvasContainer=null;mouseCanvas=null;mainCanvas=null;leftOffset=0;rightOffset=0;el=null;listeners=[];customEventPopup=null;goToLatestButton=null;resetZoomAndVisibleRange=!1;constructor(){this.legend=new qA(this),this.draw=this.draw.bind(this),this.notifyLayoutChanged=qe(No.CH_CHTLAYOUTCHANGED,Ci.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=>Ze(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(Xe(s))return void t.onMovePaneClicked(s);const n=this.findSvgParentWithClass(i,"delete-plot");if(Xe(n))return void t.deletePlotClicked(n);const r=this.findSvgParentWithClass(i,"show-hide-plot");if(Xe(r))return void t.showHidePlotClicked(r);const o=this.findSvgParentWithClass(i,"more-actions");if(Xe(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),Ze(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))),pi(this.el,{flex:1,display:"flex",position:"relative","flex-direction":"column","touch-action":"pan-x pan-y"}),this.tooltip=new VT(this);const s=SP().config.getCustomEventPopup;this.customEventPopup=s?s(this):null;const{clientHeight:n,clientWidth:r}=this.el;this.width=r,this.height=n,this.canvasContainer=yi(this.el,"div"),fi(this.canvasContainer,{class:"chart-canvas-container"}),pi(this.canvasContainer,{flex:1,display:"flex","flex-direction":"column",position:"relative",height:"100%"}),this.mainCanvas=yi(this.canvasContainer,"canvas");const o={height:`${n}px`,width:`${r}px`,"z-index":2,position:"absolute",top:0,left:0};pi(this.mainCanvas,o),this.mouseCanvas=yi(this.canvasContainer,"canvas"),fi(this.mouseCanvas,{tabIndex:0}),o["z-index"]=3,o.outline="none",pi(this.mouseCanvas,o),this.goToLatestButton=yi(this.el,"button"),Si(this.goToLatestButton,'<svg version="1.1" 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>'),pi(this.goToLatestButton,{position:"absolute",right:0,bottom:0,"z-index":3}),fi(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 GA(this),this.eventCapture=new jA(this),this.eventCapture.init(this.mouseCanvas),this.setChartSize(r,n);const a=ci(this.el);Ze(di(`.${Ci.SVG_ICONS_DOM_NODE}`,a))||Ld(a)}reinitialize(){this.el&&Ti(".bcharts-card",this.el).forEach((e=>e.remove())),this.customEventPopup?.hide(),this.tooltip.hide(),this.tooltip.setMode(this.presenter.display.tooltip.mode),this.resetZoomAndVisibleRange?this.xAxis=new GA(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`};pi(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=>{fi(e,n),pi(e,i)})),this.mainContext.scale(s,s),this.mouseContext.scale(s,s),this.recalculateLayout(),this.presenter&&FT(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=Ae(n.map((e=>e.height))),o=0;const a=Ci.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 vs(0,o,this.width,c);e.setViewBox(u);const h=new vs(this.width-this.rightOffset,o,t,c),d=new vs(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 vs(this.leftOffset,o,this.width-this.rightOffset-this.leftOffset,l);this.splitters.push(e),o+=l}}));const u=new vs(this.leftOffset,o,this.width-this.rightOffset-this.leftOffset,e);this.xAxis.setViewBox(u),pi(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),this.xAxis.draw(this.mainContext);for(const e of this.presenter.panes)e.draw(this.mainContext);this.drawSplitters(this.mainContext),this.presenter.title.draw(this.mainContext);const e=SP().config.showGoToLatest,{showGoToLatest:t}=this.presenter.display.chart,i=Ze(e)?e:t;this.goToLatestButton.style.display=i&&this.xAxis.canGoToLast()?"block":"none",this.mainContext.restore()}get isHostElementVisible(){return Ze(this.el)&&Ze(this.el.offsetParent)}redraw(e=!1){this.isHostElementVisible&&(e?this.draw():SP().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=this.presenter.display.chart.backgroundColor,i=ps(t);e.strokeStyle=i,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 j.Arrow:default:return"default";case j.Crosshair:return"crosshair";case j.Hand:return"pointer";case j.Move:return"move";case j.ResizeVertical:return"ns-resize";case j.Grabbing:return"grabbing";case j.ResizeHorizontal:return"ew-resize"}}(e);pi(this.el,{cursor:t})}shutdown(){this.listeners.forEach((e=>e())),this.eventCapture&&this.eventCapture.shutdown(),this.tooltip&&this.tooltip.remove(),this.el&&Ti(".bcharts-card",this.el).forEach((e=>e.remove())),this.canvasContainer.remove()}getEventRadius(){const e=this.xAxis.xScale.bar.width/2;return Math.max(e,Ci.MIN_EVENT_RADIUS)}}class ZA{constructor(e){this.view=e,this.date=null,this.value=null,this.visible=!1,this._initialized=!1}initialize(){this.popupElement=yi(this.view.el,"div"),fi(this.popupElement,{id:`${this.view.presenter.elementId}-custom-event-host`}),pi(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=yi(this.popupElement,"a");fi(e,{class:"custom-event-close-button"}),pi(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()),pi(this.popupElement,{visibility:"visible",top:`${e.y}px`,left:`${e.x}px`,width:"310px"}),this.visible=!0}hideValue(){}hide(){this.visible&&(this.hideValue(),pi(this.popupElement,{visibility:"hidden"}),this.visible=!1)}}function JA(e,t){if(!function(e){return e.annotations&&e.annotations.length>0}(e))return;let i=t.annotations||[];t.annotations=i.concat(e.annotations)}const QA='..axes{..plots{.type==="Study"}}';function ev(e,t){const{mainAxis:i}=ao(e),{mainAxis:s}=ao(t);JA(i,s);const n=e=>Yn(e,'..plots{.type==="Study"}.study')[0],r=Yn(e,QA).filter((e=>e!==i)),o=Yn(t,QA).filter((e=>e!==s));return r.forEach((e=>{const t=n(e),i=o.find((e=>t===n(e)));Ze(i)&&JA(e,i)})),t}Tp=n("c15IW");function tv(e,t){let i=e;return t.paneHeights.forEach((e=>{i=jn(i,`..panes[${e.index}]`,(t=>(t.height=e.relativeHeight,t)))})),i}const iv={ok:!1,change:void 0,toApply:void 0};class sv{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,uT(e,he.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&&Xe(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(!Ze(e))return!1;switch(t){case he.None:case he.Undo:case he.Redo:dP(`Unexpected tool change ${he[t]} for undo/redo`,"warn");break;case he.Created:i?this.delete(e):this.add(e);break;case he.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?he.Undo:he.Redo;return Ze(s)&&this.presenter.onAnnotationModifiedByTool(s,n),!0}can(e){const t=e?this.undoStack:this.redoStack;if(t.length<1)return iv;const i=Oe(t),s=i.toolChange;if(!(e&&s!==he.Deleted&&s!==he.Created))return{ok:!0,change:s,toApply:i};const n=Ie(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)?iv:{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 nv{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;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 rv(e={}){const t=this.allPlots;if(!t.every((e=>Ze(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=new Map;return e.main&&(t.set(xo.DateTime,0),this.data.aggregation.isMultiContract&&!e.isExpression&&t.set(xo.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?Ci.FMT_ISO_DATE_ONLY:Ci.FMT_EXPORT_ALL_BUT_MILLIS,a=(e,t)=>e===xo.DateTime?rc(t,o):(e=>Ze(s,e)?Je(e,s):e)(t)?.toString()??"",l={},c=this.timeline.lastSeriesIndex,u=we(this.mainPlot.timeSeries.container.getTimeData()),h=xe(this.timeline,+u,Number,bd),d=(e,t)=>{const i=this.timeline.at(e),s=t.timeSeries.container,n=s.getTimeData(),c=l[t.id]||0,u=xe(n,+i,Number,De,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===xo.DateTime?rc(i,o):"";{const i=this.timeline.at(e-r),o=xe(n,+i,Number,De,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(",")},f=[];if(!i){const e=e=>{const t=new Array(r(e).length).fill("");return t[0]=(e=>`"${U[e.type]}: ${e.title}"`)(e),t};f.push(p(e)),f.push(p((e=>r(e).map((([e,t])=>`"${e.name}"`)))))}const m=[0,0];this.allCurves.forEach((e=>{e.fields.every((e=>n.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=h+m[0];e<=c+m[1];e++){const t=p(me(d,e));null!==t&&f.push(t)}return f.join("\n")}function ov(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),Xe(o)){const e=new nv(this);e.update(o),e.draw(l)}const u=this.mainPlot?.timeSeries.container?.getLastDataPoint(xo.DateTime);if(Xe(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:Ci.CARDS_X_OFFSET,y:Ci.CARDS_Y_OFFSET},h=kd(this,u,c,void 0,!1,0),d=`${h.date} ${h.time??""}`.trim(),[p,f]=[1,5],m=(e,t)=>l.measureText(e).width+t,g=(e,t,i,s,n)=>(l.fillStyle=s,l.fillText(e,t,i),m(e,n)),y=(e,t)=>e.type===U[t],T=e=>{let t=e.name;return e.isMain&&y(e,"Symbol")?t=`${e.description} (${e.name}) [${e.exchange}]`:y(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-f;let u=i+c.x,h=t+c.y;e.plots.some((e=>e.isMain))&&(u+=g(d,u,h,o,f)),e.plots.forEach(((e,t)=>{const s=T(e),r=!y(e,"Study")&&e.values.length>1;if(!e.isMain&&t>0){let t=u+m(s,f);e.values.forEach((e=>{r&&(t+=m(e.abbreviation,p)),t+=m(e.value,f)})),t>=l&&(u=i+c.x,h+=n)}u+=g(s,u,h,o,f),e.values.forEach((e=>{r&&(u+=g(e.abbreviation,u,h,a,p)),u+=g(e.value,u,h,e.color,f)}))}))}))}const h=e=>({width:n??i,height:r??s,data:e.toDataURL("image/png")});if(Xe(n)&&Xe(r)){const e=a(n,r);return e.drawImage(l.canvas,0,0,n,r),h(e.canvas)}return h(l.canvas)}const av=Symbol.for("__ias__");class lv{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=dA("Default"),this._activeTool=this.defaultTool,this.timeline=new Ed(this),this.undoRedoManager=new sv(this),this.title=new nv(this),this.notifySelectionChanged=Ke(No.CH_ANNSELECTIONCHANGED),this.notifyRecreated=Ke(No.CH_RECREATED),this.notifyDefinitionChanged=Ke(No.CH_DEFINITION_CHANGED)}getModel(){return this.model}get isEmpty(){return!Ze(this.model)}notifyHost(e,t){je(e,t)}async fromModel(e,t){if(this._isShutdown)return;Ze(this.model)&&this.allPlots.forEach((e=>e.shutdown())),this.sentInitialLoadNotification=!1,this.clearSelection(),this.model=e;const i=rt(e);this.data=i.data,this.data.aggregation=_r(i.data.aggregation),this.display=i.display,Ze(this.display.period)&&(this.display.period=mt(this.display.period)),this.panes=i.panes.map((e=>{const t=new kA(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),Ze(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=Er(jv(s,t,i)),r=Er(jv(s,e,i));if(hv(n,r))return!0;if(!cv(e.display?.xAxis?.visibleRange,t.display?.xAxis?.visibleRange)||e.display?.xAxis?.marginBars!==t.display?.xAxis?.marginBars||!cv(e.data?.range,t.data?.range)||e.display?.period!==t.display?.period||e.display?.density!==t.display?.density)return!0;const o=oo(t),a=oo(e);if(function(e,t){const i=e=>e.curves[0],s=i(e),n=i(t),r=uv.includes(s.style),o=uv.includes(n.style);if(r!==o)return!0;if(!o)return!1;if(s.style!==n.style)return!0;if(t.inputs){if(hv(ct(e.inputs),ct(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(){Ze(this.view)&&(this.view.shutdown(),this.view=void 0)}reinitializeView(){this._isShutdown||(Ze(this.view)?this.view.reinitialize():(this.view=new XA,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){Ze(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=e,Ze(this._activeTool.activated)&&this._activeTool.activated(this),this.notifyHost(No.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(!Ze(n))return;const r=Ze(n)&&n.main;let o=!1,a=!1;if(e===No.TS_TIMELINECORRECTION){if(!this.timeline.tryToCorrectLastBar(t.from,t.to))return;o=!0}const l=Ze(t.index)?i.container.getTimeData()[t.index]:null,c=e===No.TS_EVENTSCHANGED,u=this.view.xAxis,h=u.xScale;if(e===No.TS_MANYCHANGED||c){if(r&&this.data.checkRange){if(Ze(this.display.xAxis.visibleRange)){const e={id:"Period",context:{range:this.display.xAxis.visibleRange}};return e[av]=!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))}if((n.isSeasonal&&!u.wasVisibleRangeChanged||this.display?.xAxis?.isOrdinal)&&u.goToLatest(!0),t.part===se.Tail){const e=xe(this.timeline,l,Number,bd);u.shouldScrollIntoView(e)&&h.shiftBars(t.count)}this.timeline.invalidate(),this.allPlots.forEach((e=>e.invalidatePriceMappingCache())),o=!0}else if(e===No.TS_DATAPOINTADDED){const e=this.timeline.mergeDateIntoTimeline(l);-1!=e&&u.shouldScrollIntoView(e)?(h.shiftBars(1),o=!0):a=!0}else e===No.TS_DATAPOINTCHANGED&&(a=!0);if(!c&&s(this.mainPlot)&&i.hasData&&0===i.container.size&&this.notifyHost(No.CH_NODATAFORMAINSYMBOL,{chart:this.accessor}),o&&this.view.recalculateLayout(),a){o&&dP("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(),Ze(l)&&e.updateFullDomain(l)}))}if(!this.sentInitialLoadNotification&&e===No.TS_MANYCHANGED){if(this.allPlots.every((e=>e.timeSeries&&e.timeSeries.hasData))){this.sentInitialLoadNotification=!0,this.notifyHost(No.CH_ALL_DATA_PROJECTED,{chart:this.accessor}),FT(this);const e=this.display.period===Ci.FIFTY_YEARS_MILLIS;this.mainPlot&&e&&(h.fitAllData=!0,h.adjustDomain())}}this.view.redraw()}onMetaChanged(e,t){e===No.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(No.CH_AXISSCALECHANGED,s)}get previousMask(){return Ze(this._previousMask)||(this._previousMask=Ho(xo.PreviousClose)),this._previousMask}hasMatch(e,t){return e.some((e=>e.updated&&t))}get hasLegend(){return Ze(this._hasLegend)||(this._hasLegend=SP().config.mode===te[te.cmdtyView]),this._hasLegend}onStreamingUpdates(e){Ze(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 Ze(this._ohlcMask)||(this._ohlcMask=Ho(xo.Open,xo.High,xo.Low,xo.Close,xo.PreviousClose)),this._ohlcMask}updateMatches(e,t){if(0==(e&this.ohlcMask))return!1;const i=(e,t)=>Xe(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 SP().getRecordSource().subject.pipe(Ku((e=>e.filter((e=>this.updateMatches(e.updated,e.data.symbol))))),rl((e=>e.length>0))).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return Ze(this._hostElement)?this._hostElement.id:null}initialize(t){if(this._hostElement=t instanceof HTMLElement?t:di(`#${t}`),!this._hostElement)throw new Error(`There is no element ${t} in the DOM`);this.renderTo=t,this.seriesChangedToken=e(Tp).subscribe(No.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=e(Tp).subscribe(No.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return e(Tp).unsubscribe(this.seriesChangedToken),e(Tp).unsubscribe(this.metaChangedToken),Ze(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach((e=>e.shutdown())),this.model=void 0,this.closeView(),this.notifyHost(No.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(){Ze(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(j.Arrow)}print(e={}){const t=yi(document.body,"iframe");t.src="",t.style.display="none",t.onload=()=>{const{title:i}=e,s=ov.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),Ze(this.view)&&this.view.redraw(t)}enableTooltip(e){this.tooltipEnabled=e;const t=this.display.tooltip.mode===Ci.TOOLTIP_CARDS;!e&&t&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(e=!1){const t=this.display.tooltip,i=Ue();!e&&t.visible&&t.mode===Ci.TOOLTIP_CARDS&&Ti(".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 Yn(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,he.Deleted))}throw new Error(`Unknown sub-action ${e.id} for action ${Ci.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:U[i[s].type],index:s}}getSimplePlot(e,t){return this.accessor.change({id:"Plot",context:{id:Ci.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(No.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(No.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(No.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(No.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(No.CH_PANESREORDERED,{chart:this.accessor})}))}onAnnotationsUpdated(e,t=!1){const i=this.allAxes.indexOf(e),s=e.annotations.map((e=>e.toModel())),n=jn(this.model,`..axes[${(r={axisIndex:i,annotations:s}).axisIndex}]`,(e=>(e.annotations=r.annotations,e)));var r;try{this.model=_o(n,Ci.CHART_SCHEMA)}catch(e){dP(`Cannot update annotation (corrupts definition), error is: ${e.message}`,"error")}t&&this.view.draw(),this.notifyHost(No.CH_ANNOTATIONCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}onAnnotationModifiedByTool(e,t,i=!0){if(t!==he.None){if(i&&t!==he.Undo&&t!==he.Redo){const i=uT(e,t);this.undoRedoManager.done(i)}const s=hT(e);s.toolChange=he[t],this.notifyHost(No.CH_ANNMODIFIEDBYTOOL,s)}}onAnnotationDone(e,t){const i={id:e,chart:this.accessor,toolChange:he[t]};this.notifyHost(No.CH_ANNMODIFIEDBYTOOL,i)}onPaneHeightsUpdated(){const e=this.panes.map(((e,t)=>({index:t,relativeHeight:e.height})));this.model=tv(this.model,{paneHeights:e}),this.notifyHost(No.CH_PANEHEIGHTSCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}getDataStats(){const e=this.mainPlot.timeSeries.container;if(!Ze(e)||0===e.size)return null;const t=e.getTimeData();return{dataRange:{from:we(t).getTime(),to:Oe(t).getTime()},barCount:e.size}}}function cv(e,t){return e?.from===t?.from&&e?.to===t?.to}const uv=["Renko","Range","LineBreak","Kagi","PointAndFigure"];function hv(e,t){for(const i of Object.keys(e))if(e[i]!==t[i])return!0}const dv="MARKED_FOR_DELETION";function pv(e,t){if(0===t.plots.length)return e;let i=e;return t.plots.forEach((e=>{const t=gv(e.index),s=yv(i,t);Ze(s)&&s.type===e.type&&(i=jn(i,t,(e=>(e[dv]=!0,e))))})),i=jn(i,`..plots{.${dv} === true}`,(e=>Ci.NULL_OBJECT)),Mo(i)}function fv(e,{main:t,type:i,index:s},n){const r="..plots{.main === true}",o=Yn(e,"..panes").map(((e,t)=>{const i=1===Yn(e,r).length;return Yn(e,"..axes").map(((e,s)=>{const o=1===Yn(e,r).length;return Yn(e,"..plots").map((e=>{const r=function(e,t,i,s){const n=U[e.type],r={curves:rt(e.curves),type:e.type};r.precision=e.precision,r.visible=e.visible;const o=(e,t)=>{Ze(e[t])?r[t]=e[t].map((e=>rt(e))):r[t]=[]},a=(e,t,i=!1)=>{!0===t.main&&(e.main=!0,e.showPrevious=t.showPrevious,i&&null!=t.events&&(e.events=rt(t.events)))},l=e=>{Ze(s)&&(e.subtitles=s.allPlots.filter((e=>e.type===n)).map((e=>e.title)))};switch(n){case U.Symbol:{const t=e;r.title=t.symbol;const i=t=>{o(e,"inputs"),0===r.inputs.length&&(r.inputs=rt(t))};switch(r.curves[0].style){case"Renko":i(Ci.DEFAULT_RENKO_INPUTS);break;case"Kagi":i(Ci.DEFAULT_KAGI_INPUTS);break;case"PointAndFigure":i(Ci.DEFAULT_PNF_INPUTS);break;case"LineBreak":i(Ci.DEFAULT_LINEBREAK_INPUTS);break;case"Baseline":i(Ci.DEFAULT_BASELINE_INPUTS);break;case"Line":!0===t.main&&1===e.curves?.length&&(r.curves[0].lineMarker=e.curves[0].lineMarker??"None")}a(r,e,!0);break}case U.Study:{o(e,"inputs");const s=Rn(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 U.BalanceSheet:case U.IncomeStatement:{const t=xo[e.curves[0].fields[0]];r.title=`${t.name} (${e.fundamental.substring(0,1)})`,r.fundamentalId=t.id,r.frequency=e.fundamental;break}case U.Expression:r.title=e.expression,a(r,e);break;case U.Forward:r.title=e.forward,o(e,"offsets"),l(r),a(r,e);break;case U.Seasonal:r.title=e.seasonal,l(r),o(e,"offsets"),o(e,"usesInAverage"),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(Ze(i)){const e=o.filter((e=>e.type===i));return Ze(s)?e.filter((e=>e.index===s)):e}return o}function mv(e,t){"Study"===e.type&&t.curves?.forEach((e=>delete e.varyColorPerBar));const i=e;i.main&&"Symbol"!==e.type&&t.curves?.forEach((e=>delete e.lineMarker)),!function(e){const t=U[e.type];return t===U.Forward||t===U.Seasonal}(e)?Sv(e.curves,t.curves):Ze(t.curves)&&(e.curves=t.curves);const s=U[t.type];if(Ze(t.precision)?i.precision=t.precision:delete i.precision,s===U.Symbol)e.symbol=t.symbol;else if(s===U.Study)Av(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(s!==U.BalanceSheet&&s!==U.IncomeStatement||!t.frequency){if(s===U.Expression){const i=e;Ze(t.expression)&&(i.expression=t.expression)}else if(s===U.Forward){const i=e;Ze(t.offsets)&&(i.offsets=t.offsets),Ze(t.forward)&&(i.forward=t.forward)}else if(s===U.Seasonal){const i=e;Ze(t.offsets)&&(i.offsets=t.offsets),Ze(t.usesInAverage)&&(i.usesInAverage=t.usesInAverage),Ze(t.seasonal)&&(i.seasonal=t.seasonal)}}else e.fundamental=t.frequency}const gv=e=>`..plots[${e}]`;function yv(e,t){const i=Yn(e,t);return 1!==i.length?null:i[0]}const Tv=["withMain","overlay","standalone","clone"];function Sv(e,t){if(void 0!==t&&t.length===e.length)for(let i=0;i<e.length;++i){at(e[i],t[i]);const s=t[i].shift;Ze(s)&&(e[i].shift=s);const n=t[i].dashStyle;Ze(n)&&(e[i].dashStyle=n)}}function Av(e,t,i){const s=ct(e),n=ct(t);at(s,n);const r=(o=n,Object.keys(o).map((e=>({name:e,value:o[e]}))));var o;r.length>0&&(i.inputs=r)}function vv(e){return{axes:[{plots:[]}],height:e.display.chart.newPaneHeight??1}}function Pv(e){const t=vv(e);return e.panes.push(t),t}function Cv(e,t){const i=Xe(t.paneIndex)&&t.paneIndex<e.panes.length?e.panes[t.paneIndex]:Pv(e),s=i.axes[0];return t.oppositeScale??!1?Nv(i,s):s}function bv(e,t,i){let s=null;const{mainPane:n,mainAxis:r}=ao(e);switch(t){case"withMain":s=Nv(n,r);break;case"overlay":s=r;break;case"standalone":s=Pv(e).axes[0];break;case"clone":if("number"==typeof i){const t={main:!1,index:i,type:U[U.Study]},n=fv(e,t).find((e=>e.index===t.index));s=Yn(e,`..panes[${n.paneIndex}]..axes[${n.axisIndex}]`)[0]}}return s}const Ev=[{fields:[xo.Close.id],colors:["#888"],style:"Line",lineWidth:2,varyColorPerBar:!1,visible:!0}];function _v(e){return"Symbol"===e.type}const Mv={attributes:["OpenVsClose"],colors:["#b63400","#007f3e","#1664db"],fields:["Open","High","Low","Close","Change"],style:"Candlestick",varyColorPerBar:!0,lineWidth:1};let Lv=0;const Ov=["#0d223a","#8abc21","#910000","#2f7ed8","#42ccdc","#bf95df","#860262","#e5daa3","#4682e8","#aaa9c1","#fcccdc","#f66b00","#d875be","#e84b46"],wv="Symbol",Iv="Expression";function Dv(e,t){let i={curves:[{attributes:[],colors:Ov.slice(Lv,Lv+1),fields:e?[xo.Last.id]:[xo.Close.id],style:"Line",dashStyle:"Solid",varyColorPerBar:!1,lineWidth:2}]};return delete t.oppositeScale,lt(i,t),Ze(t.curves)&&at(i.curves,t.curves),Lv=(Lv+1)%Ov.length,i}const xv='..plots{(.type === "Symbol" || .type === "Expression") && .main !== true}';function Nv(e,t){let i=e.axes.find((e=>e!==t));return Ze(i)||(i={plots:[]},e.axes.push(i)),i}function Rv(e,t){const i=Yn(e,xv),s=Yn(t,xv),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}=ao(t),{mainAxis:l}=ao(e);return r.forEach((e=>{if(l.plots.includes(e))a.plots.push(e);else{Nv(o,a).plots.push(e)}})),t}const Hv=()=>Ci.NULL_OBJECT;function Vv(e){return jn(e,"..axes.annotations",Hv)}function Fv(e){return Mo(jn(e,'..plots{.type === "Symbol" && .main !== true}',Hv))}const Bv=".display.chart.previous";function kv(e,t,i){const s=[],n=i.allPlots[t.index];if(n?.type!==U[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 Uv(e,t,i){const s=[],n=i.allPlots[t.index];if(n?.type!==U[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 Wv(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 $v(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 Gv={MainPlot:go,Aggregation:{Update:So,Get:function(e,t,i){return rt(e.data.aggregation)}},Period:{Update:function(e,t,i){const s=Ze(t.period),n=Ze(t.range),r=Ze(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,Rr(e),Vr(e)),n)if(Ze(e.display.period)&&!Po(e.display.period)||(e.display.xAxis.visibleRange=t.range),Hr(e),Vr(e),Ze(i)){const s=function(e){const t=e.getDataStats();return null===t?null:t.dataRange}(i),n=_r(e.data.aggregation),r=i.data.aggregation,o=(l=r,(a=n).unit!==l.unit||a.size!==l.size||a.spec!==l.spec||!Ze(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,Rr(e),Hr(e)),(s||n||r)&&(Nr(e),i&&(i.forceResetVisibleRange=!0)),e},Delete:function(e,t,i){return Ze(t.period)&&t.period&&(delete e.display.period,yo(e),i&&(i.forceResetVisibleRange=!0)),e}},Crosshair:{Update:function(e,t){let[i,s]=et(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=jn(e,".display.xAxis.crosshair",(e=>(e.enabled=i,l(e,o,a),e)));return c=jn(c,".display.yAxis.crosshair",(e=>(e.enabled=s,l(e,n,r),e))),Ze(t.haloTracking)&&"boolean"==typeof t.haloTracking&&(c=jn(c,".display.chart",(e=>(e.plotHover=t.haloTracking,e)))),c},Get:function(e,t,i){const s=t=>Yn(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 jn(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=Yn(e,".display.tooltip")[0];return{visible:s.visible,mode:s.mode,showMainTitle:s.showMainTitle,mainTitle:s.mainTitle}}},Events:function(e,t){const i=rt(t);return Object.keys(t).forEach((e=>{Ci.EVENTS.includes(e)||delete i[e];let s=t[e];"boolean"==typeof s?s={show:t[e]}:Object.keys(s).forEach((e=>{Ci.EVENT_PROPERTIES.includes(e)||delete s[e]})),i[e]=s})),jn(e,ro,(e=>("Symbol"===e.type&&(e.events=e.events||{},Object.keys(i).forEach((t=>{e.events[t]=e.events[t]||{},ot(e.events[t],i[t],!1)}))),e)))},Scale:{Update:function(e,t){let i=jn(e,"..panes[0]..axes",(e=>(Xe(t.scale)&&(e.scale=t.scale),e)));return i=jn(i,".display.xAxis",(e=>(Xe(t.marginBars)&&(e.marginBars=t.marginBars),Xe(t.nonEodLabelWithDate)&&(e.nonEodLabelWithDate=t.nonEodLabelWithDate),Xe(t.ordinalName)&&(e.ordinalName=t.ordinalName),Xe(t.preventHorizontalLabelOverlap)&&(e.preventLabelOverlap=t.preventHorizontalLabelOverlap),e))),i=jn(i,".display.yAxis",(e=>{(Ze(t.minPadding)||Ze(t.maxPadding))&&dP("The 'minPadding' and 'maxPadding' are deprecated (ignored)","warn");const i=Xe(t.preventLabelOverlap)&&!Xe(t.preventVerticalLabelOverlap);i&&dP("The 'preventLabelOverlap' is deprecated, please use 'preventVerticalLabelOverlap'","warn");const s=i?t.preventLabelOverlap:t.preventVerticalLabelOverlap;return Xe(s)&&(e.preventLabelOverlap=s),Ze(t.includePercentChangeWithLastValue)&&(e.includePercentChangeWithLastValue=t.includePercentChangeWithLastValue),Ze(t.snapAnnotationsToPrices)&&(e.snapAnnotationsToPrices=t.snapAnnotationsToPrices),e})),Ze(t.labels)&&Array.isArray(t.labels)&&t.labels.forEach((e=>{const{axis:t,text:s,index:n}=e;Ze(t,s,n)&&"vertical"===t&&Number.isInteger(n)&&(i=jn(i,`..panes[0]..axes[${n}]`,(e=>(e.label=s,e))))})),i},Get:function(e,t,i){const{mainAxis:s}=ao(e),n=Yn(e,".display.xAxis")[0],r=Yn(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??""}}},Other:{Update:function(e,t,i){let s=e;if(Ze(t.comparisonMode)&&"string"==typeof t.comparisonMode&&st(V,t.comparisonMode)&&(s=jn(s,`..panes{${ro}}.axes`,(e=>(e.comparison=t.comparisonMode,e)))),Ze(t.gridLines)){const[e,i]=et(t.gridLines);s=jn(s,".display.xAxis.gridLines",(t=>(t.visible=e,t))),s=jn(s,".display.yAxis.gridLines",(e=>(e.visible=i,e)))}if(Ze(t.minorGridLines)){const[,e]=et(t.minorGridLines);s=jn(s,".display.yAxis.minorGridLines",(t=>(t.visible=e,t)))}Ze(t.newPaneHeight)&&"number"==typeof t.newPaneHeight&&(s=jn(s,".display.chart{.newPaneHeight > 0}",(e=>(e.newPaneHeight=t.newPaneHeight,e)))),Ze(t.showNavigator)&&"boolean"==typeof t.showNavigator&&(s=jn(s,".display.scrollbar",(e=>(e.visible=t.showNavigator,e)))),Ze(t.plotHover)&&"boolean"==typeof t.plotHover&&(s=jn(s,".display.chart",(e=>(e.plotHover=t.plotHover,e)))),Ze(t.showLastValue)&&"string"==typeof t.showLastValue&&(s=jn(s,".display.yAxis",(e=>(e.showLastValue=t.showLastValue,e)))),Ze(t.showMinMaxArc)&&"boolean"==typeof t.showMinMaxArc&&(s=jn(s,".display.chart",(e=>(e.showMinMaxArc=t.showMinMaxArc,e)))),Ze(t.showGoToLatest)&&"boolean"==typeof t.showGoToLatest&&(s=jn(s,".display.chart",(e=>(e.showGoToLatest=t.showGoToLatest,e)))),Ze(t.showLegend)&&"boolean"==typeof t.showLegend&&(s=jn(s,".display.chart",(e=>(e.showLegend=t.showLegend,e))),t.showLegend||i.view.removeLegend()),Ze(t.allAnnotationsLocked)&&"boolean"==typeof t.allAnnotationsLocked&&(s=jn(s,".display",(e=>(e.allAnnotationsLocked=t.allAnnotationsLocked,e)))),Ze(t.exprSkipLeadingEmpty)&&"boolean"==typeof t.exprSkipLeadingEmpty&&(s=jn(s,".data",(e=>(e.exprSkipLeadingEmpty=t.exprSkipLeadingEmpty,e))));const n=[];if(Ze(t.extendedHours)&&"boolean"==typeof t.extendedHours&&(s=jn(s,".data",(e=>(e.extendedHours=t.extendedHours,e)))),Ze(t.realTimeCboeBzx)&&"boolean"==typeof t.realTimeCboeBzx&&(s=jn(s,".data",(e=>(e.realTimeCboeBzx!==t.realTimeCboeBzx&&n.push("realTimeCboeBzx"),e.realTimeCboeBzx=t.realTimeCboeBzx,e)))),Ze(t.buildContinuation)&&"boolean"==typeof t.buildContinuation&&(s=jn(s,".data",(e=>(e.buildContinuation=t.buildContinuation,e)))),n.length>0){const e={chart:i.accessor,hostPropsChanged:n};i.notifyHost(No.CH_HOST_PROPS_CHANGED,e)}return s},Get:function(e,t,i){const s=Yn(e,`..panes{${ro}}.axes.comparison`)[0],n=e.display,r=(e,t)=>nt(e,!1,t,"visible"),o=e=>function(e,t){const i=e=>Ze(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=nt(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=Rn(t.studyId);if(!Xe(i))return dP(`Unknown or unavailable study with the id '${t.studyId}'`,"error"),e;const s=oo(e),n=Bn(i);if(s.type===U[U.Expression]&&n)return dP(`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};"overlay"===r&&"VOL"===t.studyId&&(o.detachedScale=!0),void 0!==t.curves&&(o.curves=i.defaults.curves),mv(o,t);const a=bv(e,r,t.cloneIndex);Ze(a)&&a.plots.push(o);const l=e.data.aggregation;return To(e,"Tick"===l.unit&&"None"===l.spec)}(e,t);case"IncomeStatement":case"BalanceSheet":return function(e,t){const i=oo(e);if(i.type!==U[U.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:x[xo[t.fundamentalId].category]};return mv(n,t),function(e,t){e.panes.push({axes:[{plots:[t]}]})}(e,n),e}(e,t);case"Expression":return function(e,t){const i=oo(e),s={curves:rt(_v(i)?i.curves:Ev),expression:"",type:"Expression"};return mv(s,t),Cv(e,t).plots.push(s),e}(e,t);case"Symbol":return function(e,t){const i=oo(e),s=SP().getDefaultMultiFieldCurve(),n=Ze(s)?s:Mv,r={curves:rt(_v(i)?i.curves:[n]),symbol:"",type:"Symbol"};return mv(r,t),Cv(e,t).plots.push(r),e}(e,t);default:throw new Error("Unexpected plot type '${type}', not supported currently")}},Get:fv,Delete:pv,Update:function(e,t,i){if(Ze(t.placement)&&!Tv.includes(t.placement))throw new Error(`Unknown placement: ${t.placement}`);const s=t.main?ro:gv(t.index),n=yv(e,s);if(!Xe(n)||Xe(t.type)&&n.type!==t.type)return e;if(Xe(t.visible))return n.visible=t.visible,e;if(n.main&&function(e){const t=U[e.type];return t===U.Symbol||t===U.Expression}(n)){if(t.curves){const i=e=>e.curves[0].style===v[v.Range],[s,r]=[i(n),i(t)],o=!s&&r;s&&!r?e=So(e,{unit:"Day",size:1,spec:"None"}):o&&(e=So(e,{unit:"Intraday",size:100,spec:"PerRange"}))}t.type||(t.type=n.type);const i=n;return Ze(t.precision)?i.precision=t.precision:delete i.precision,Ze(t.showPrevious)&&(e=jn(e,ro,(e=>(e.showPrevious=t.showPrevious,e)))),t.curves?$r(e,t):e}{let n=jn(e,s,(e=>(mv(e,t),e)));const r=fv(n,t,i).find((e=>e.index===t.index));if(!Ze(r))return e;if(!(t.type===U[U.Study]&&Ze(t.placement)&&t.placement!==r.placement))return n;const o=yv(n,s);n=pv(n,{id:"Delete",plots:[{index:t.index,type:t.type}]});const a=bv(n,t.placement);return null!==a&&a.plots.push(o),n}}},Compare:{Update:function(e,t){const i=function(e){return Ze(e.symbols)&&(dP("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=wv,e)))),e.plots?.some((e=>Ze(e.leftScale)))?(dP("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}=be(i,(e=>e.oppositeScale??!1)),{mainPane:r,mainAxis:o}=ao(e);r.alignOnExpirations=t.alignOnExpirations||!1;const a=Nv(r,o),l=e=>![wv,Iv].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;Lv=0;const h=me(Dv,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),Mo(e)},Get:function(e,t){const i=Yn(e,xv),{mainPane:s,mainAxis:n}=ao(e),r=[];for(const e of i){const t=n.plots.includes(e),i=e.type.toLowerCase(),s={curves:rt(e.curves),type:e.type,[i]:e[i],leftScale:!t};r.push(s)}return{plots:r,alignOnExpirations:s.alignOnExpirations}}},Annotation:{Get:function(e,t,i){const s=Yn(e,"..panes").map(((e,t)=>Yn(e,"..axes").map(((e,i)=>Yn(e,".annotations").map((e=>({...e,paneIndex:t,axisIndex:i}))))))).flat(2).map(((e,t)=>({...e,index:t})));return Ze(t.index)&&Number.isFinite(t.index)?t.index<s.length?[s[t.index]]:Ci.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=rt(e);if(t.strip.main){const e=oo(i),t=e.type.toLowerCase();e[t]=Ci.PLACEHOLDER_SYMBOL_NAME}return t.strip.annotations&&(i=Vv(i)),t.strip.compare&&(i=Fv(i)),i=jn(i,".data",(e=>(e.range&&(delete e.range,e.checkRange=!0),e))),i},Outline:function(e,t,i){const s=fv(e,{main:!0},i)[0],n=s.title===Ci.PLACEHOLDER_SYMBOL_NAME,r="Symbol"===s.type,o="Expression"===s.type,a=Xr(s.title);let l=[];return o&&!qr(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:Yn(e,xv).map((e=>e.symbol)),annotations:Yn(e,"..annotations").map((e=>e.id)),studies:fv(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=jn(e,".display.chart",(e=>(s&&(e.backgroundColor=s),c&&(e.fontSize=c),e)))),n){const e=e=>(e.color=n,e);i=jn(i,".display.xAxis.gridLines",e),i=jn(i,".display.yAxis.gridLines",e),i=jn(i,".display.yAxis.minorGridLines",e)}if(a){const e=e=>(e.dashStyle=a,e);i=jn(i,".display.xAxis.gridLines",e),i=jn(i,".display.yAxis.gridLines",e),i=jn(i,".display.yAxis.minorGridLines",e)}if(r){const e=e=>(e.textColor=r,e);i=jn(i,".display.xAxis",e),i=jn(i,".display.yAxis",e)}if(o){const e=e=>(e.color=o,e);i=jn(i,".display.xAxis.crosshair",e),i=jn(i,".display.yAxis.crosshair",e)}if(u||h){const e=e=>t=>(t.fontSize=e,t);u&&(i=jn(i,".display.xAxis",e(u))),h&&(i=jn(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=>Ci.NULL_OBJECT;if(!0===n){const e=e=>i.onAnnotationModifiedByTool(e,he.Deleted,!1);i.allAnnotations.forEach(e),a=jn(a,`${o}..annotations`,l)}return!0===r&&(a=jn(a,`${o}..plots{.type=="Study"}`,l)),a=Mo(a),a},Previous:{Update:function(e,t,i){return jn(e,Bv,(e=>(at(e,t),e)))},Get:function(e,t,i){return Yn(e,Bv)[0]}},MovePlot:{Update:function(e,t,i){if(!kv(0,t,i).includes(t.targetPane))return e;const s=$v(i,t.index),n=yv(e,gv(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,vv(e)),o=!1;break;case"ExistingBelow":r++;break;case"NewBelow":r++,o=!1,e.panes.splice(r,0,vv(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=Wv(e,s.pane);return u=Wv(u,r),Mo(u)},Get:kv},PinPlot:{Update:function(e,t,i){if(!Uv(0,t,i).includes(t.targetAxis))return e;const s=$v(i,t.index),n=e.panes[s.pane],r=yv(e,gv(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 Mo(Wv(e,s.pane))},Get:Uv}};function zv(e){return"function"==typeof e}function Yv(e,t){const i=Gv[e];if(zv(i))return i;{let e=void 0!==t?i[t]:void 0;if(!zv(e)&&(e=i[Ci.DEFAULT_ACCESSOR_SUBACTION],!zv(e)))throw new Error("Invalid accesor id and/or sub id");return e}}function jv(e,t,i){return Yv(e.id,e.context.id)(t,e.context,i)}function Kv(e){return{id:"MainPlot",context:e}}const qv={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1},Xv=Symbol.for("__ias__");class Zv{constructor(e=!1){this.headless=e,this.presenter=e?null:new lv(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)console.error("You cannot initialize a headless chart.");else if(this.presenter.initialize(e),Xe(t)){const e="string"==typeof t;e?dP("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(Kv(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(Ze(e)){cr(e,t),lr(e,t);const s=dA(e,!1,t,i,this.presenter);s.isDrawingAnnotation&&this.presenter.view.setCursor(j.Crosshair),this.presenter.activeTool=s,Ue()||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 AP()}get model(){return(this.headless?this._model:this.presenter.getModel())||AP()}asTemplate(e={main:!0,annotations:!1,compare:!1}){return this.change({id:Ci.ACTION_TEMPLATE,context:{strip:e}})}change(...e){const t={chart:this,actions:e.filter((e=>!e[Xv]))};t.actions.length>0&&this.presenter?.notifyHost(No.CH_API_ACTIONS_RECEIVED,t);const i=SP().config.validateInput,s=e.map((e=>i?_o(e,Ci.ACCESSOR_SCHEMA):e));if(1===s.length){const e=s[0];if(e.id===Ci.ACTION_TEMPLATE||e.context.id===Ci.ACTION_GET)return jv(e,this.model,this.presenter);if(!this.headless&&e.id===Ci.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(e.context)}const{yes:n,no:r}=be(s,(e=>e.id===Ci.ACTION_PLOT&&Ze(e.context)&&e.context.id===Ci.ACTION_DELETE)),o=rt(this.model);let a=rt(this.model);const l=r;n.length>0&&l.push({id:Ci.ACTION_PLOT,context:{id:Ci.ACTION_DELETE,plots:n.map((e=>e.context))}}),l.forEach((e=>{if(a=jv(e,a,this.presenter),!Ze(a))throw new Error("Forgot to return model from accessor")})),this.fromModel(a,o)}async fromModel(e,t){const i=_o(e,Ci.CHART_SCHEMA);this.headless?this._model=i:await(this.presenter?.fromModel(i,t))}async load(e,t){const i={...qv,...t};let s=_o(JSON.parse(e),Ci.CHART_SCHEMA);const n=this.model,r=rt(n);if(Ze(n)){if(s=lo(n,s,i.keepNewAnnotations),i.keepNewAnnotations||(s=Vv(s)),i.keepOldAnnotations&&(s=ev(n,s)),i.keepNewCompare||(s=Fv(s)),i.keepOldCompare&&(s=Rv(n,s)),i.keepOldAggregation){const e={id:Ci.ACTION_AGGREGATION,context:n.data.aggregation},t=s.display.density;s=jv(e,s,this.presenter),i.keepNewBarWidth&&Ze(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=AP();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}),Ze(s)){const i=jv({id:"Theme",context:{id:"Get"}},this.model,this.presenter);let n=jv(Kv(s),t,this.presenter);e&&(n=jv({id:"Theme",context:i},n,this.presenter)),this.presenter?.fromModel(n)}}this.clearUndoRedo(),this.presenter?.notifyHost(No.CH_RESET,{elementId:this.elementId})}print(e={}){this.headless||this.presenter.print(e)}getSVGForExport(){dP("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:rv.call(this.presenter,e)}exportImage(e={}){return this.headless?null:ov.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(Ze(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(No.CH_DIDBECOMEACTIVE,{chart:this})}}Tp=n("c15IW");function Jv(e){return e[e.length-1]}function Qv(e){return Wa(Jv(e))?e.pop():void 0}function eP(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 tP(e){for(var t,i,s=[],n=1;n<arguments.length;n++)s[n-1]=arguments[n];var r=null!==(t=Qv(s))&&void 0!==t?t:Ta,o=null!==(i=s[0])&&void 0!==i?i:null,a=s[1]||1/0;return Ka((function(t,i){var s=[],n=!1,l=function(e){var t=e.buffer;e.subs.unsubscribe(),la(s,e),i.next(t),n&&c()},c=function(){if(s){var t=new ca;i.add(t);var n={buffer:[],subs:t};s.push(n),eP(t,r,(function(){return l(n)}),e)}};null!==o&&o>=0?eP(i,r,c,o,!0):n=!0,c();var u=qa(i,(function(e){var t,i,n=s.slice();try{for(var r=Qo(n),o=r.next();!o.done;o=r.next()){var c=o.value,u=c.buffer;u.push(e),a<=u.length&&l(c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}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)}))}function iP(){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 sP(){let e=document.domain;const t=e.split("."),i="__tld"+(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 nP(e,t){!function(e){Object.keys(e).forEach((t=>!Ze(e[t])&&delete e[t]))}(t);return`${e}/?${new URLSearchParams(t).toString()}`}function rP(e,t=""){return nP(atob("aHR0cHM6Ly9iYXJjaGFydHdpZGdldHMud2Vic29sLmJhcmNoYXJ0LmNvbQ=="),{module:atob("YXV0aGVudGljYXRlQ2hhcnRSZWZlcmVy"),secret:t,referer:e})}function oP(e,t){return e+Math.random()*(t-e)}const aP=new Function(atob("Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg")),lP=new Function("f",atob("Zi5yZW1vdmVBbGxDaGFydHMoKTsg")),cP=new Function("m",atob("cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiOw=="));async function uP(e,t){if(t&&!cP(e.mode))return;let i=!1,s=0,n=25;for(;!i&&s<5;){const t=iP()||"FreeWidget"===e.mode,r=t?e.apiKey:"";try{const n=rP(t?"":sP(),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(aP,oP(2e3,3e3)),setTimeout((()=>lP(SP())),oP(4e3,5e3)))}var hP;function dP(e,t="info",i=""){const s=globalThis.console;s[void 0!==s[t]?t:"log"](e,i)}hP=JSON.parse('{"major":2,"minor":312,"patch":1,"prerelease":false}');const pP={environment:"Browser",validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:`/${Ci.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(cP(this.mode)&&this.knownSite){const{username:n,password:r}=this.credentials||{},o=Ze(n,r),a="timeseries"===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 fP(e,t){const i=SP()?.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 mP=!1,gP=null;function yP(e){const t=e.extensions?.studyProvider;if(!Ze(t))return;const i=t.getFields(),s=t.getStudies(),n=rt(Mn(Ci.CHART_SCHEMA)),r=n.definitions,o=r.studyField.enum,a=r.study.enum;for(const e of i)if(o.includes(e.id))throw new Error(`Field with id ${e.id} already exists`);for(const e of s)if(a.includes(e.id))throw new Error(`Study with id ${e.id} already exists`);var l,c;o.push(...i.map((e=>e.id))),a.push(...s.map((e=>e.id))),l=Ci.CHART_SCHEMA,c=n,Eo.addSchema(l,c),Do(i),Dn(s)}function TP(t,i={}){if(mP)throw new Error("You should only call initFeed once during page's lifetime");mP=!0;const s=Object.assign(pP);return at(s,i),Xe(s.logo)&&YT(s.logo,s.logoClickable??!1),yP(s),gP=new t(s),gP.version=function(){const t=e(hP),i=t.prerelease?`-${t.prerelease.identifier}.${t.prerelease.ordinal}`:"";return`${t.major}.${t.minor}.${t.patch}${i}`}(),dP(`%cBarchart Chart version ${gP.version}`,"info","font-size: larger"),gP.cachesData&&(gP.subject?.subscribe(gP.onPerformInternalGc.bind(gP)),e(Tp).subscribe(No.CH_ALL,gP.onChartChanged.bind(gP))),gP}function SP(){return gP}function AP(){return rt(SP()?.template)}function vP(){Xe(gP)&&(gP.shutdown(),mP=!1,gP=null)}function PP(){return new Zv(!0)}function CP(e){const t=PP();return t.load(e),t.change({id:"Outline",context:{id:"Get"}})}function bP(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 EP{constructor(e){this.config=e,this.timeSeriesSource=this.metaDataSource=this.recordSource=null,this.charts=new Map,this.pendingRedraw=new Set,this.ongoingAnimationCallbackId=null,this.drawCharts=this.drawCharts.bind(this),this.template=null,this.cachesData=!1,this._altDataSource=null,this._subject=null}get subject(){return Xe(this._subject)||(this._subject=(new Ya).pipe(tP(Ci.INTERNAL_GC_MILLIS),rl((e=>e.length>0)))),this._subject}setAltDataSource(e){this._altDataSource=e,this.timeSeriesSource=bP(this.timeSeriesSource,"getTimeSeries",e,"symbol"),this.metaDataSource=bP(this.metaDataSource,"getMetaData",e),this.recordSource=bP(this.recordSource,"getRecord",e)}getAltDataSource(){return this._altDataSource}getTimeSeriesDataSource(){if(!Xe(this.timeSeriesSource))throw new Error("No time series source defined");return this.timeSeriesSource}getMetaDataSource(){if(!Xe(this.metaDataSource))throw new Error("No metadata source defined");return this.metaDataSource}getRecordSource(){if(!Xe(this.recordSource))throw new Error("No record source defined");return this.recordSource}async ready(){return Ai.call(this,(async()=>{const e=this instanceof OP||this instanceof _P||this instanceof wP;await uP(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=_o(t,Ci.CHART_SCHEMA),!0}))}getHeadlessChart(){return PP()}fixupRenderTo(e){if(!Xe(e))return null;if(e instanceof HTMLElement)return e;const t=di(`#${e}`);if(Xe(t))return t;const i=[...this.charts.keys()].find((t=>t.id===e));return Xe(i)?i:null}checkChart(e,t){const i=this.fixupRenderTo(e),s=Xe(i)&&this.charts.has(i);return Xe(t)&&t!==s&&dP(`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 Zv;return this.charts.set(i,s),s.initialize(e,t),s}removeChart(e){const t=this.checkChart(e,!0);if(!Xe(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 Xe(t)?this.charts.get(t):null}redraw(e){const t=this.checkChart(e,!0);Xe(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),Xe(t)&&this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach((e=>{const t=this.getChart(e);if(!Xe(t?.presenter?.view))return;const i=t.presenter.view;i.isHostElementVisible&&i.draw()})),this.pendingRedraw.clear()}get emptyEntities(){return{metaData:new Set,records:new Set,timeSeries:new Set}}getCacheableEntities(){const e=this.emptyEntities;for(const t of this.charts.values())t.presenter.getCacheableEntities(e);return e.timeSeries.forEach((t=>{Xe(t)&&(Xe(t.record)?e.records.add(t.record):Ze(t.records)&&Object.values(t.records).forEach((t=>e.records.add(t))))})),e}clearCaches(){this.evictUnused(this.emptyEntities)}refreshCaches(){this.getTimeSeriesDataSource().refresh(),je(No.DF_STREAMRECONNECTED,{})}evictUnused(e){this.getMetaDataSource().evictUnused(e.metaData),this.getRecordSource().evictUnused(e.records),this.getTimeSeriesDataSource().evictUnused(e.timeSeries)}onPerformInternalGc(e){const t=this.getCacheableEntities();this.evictUnused(t)}onChartChanged(e,t){e!==No.CH_RECREATED&&e!==No.CH_SHUTDOWN||this.subject.next()}getDefaultMultiFieldCurve(){if(!Xe(this.template))return null;if(!this.knowDefaultCurve){const e=oo(this.template);1===e.curves.length&&Fr(e.curves[0].style)?this.defaultOhlcCurve=rt(e.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return!this.knowDefaultAggregation&&this.template&&(this.defaultAggregation=rt(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.clearCaches(),this.removeAllCharts()}}class _P extends EP{constructor(e){super(e),this.timeSeriesSource=new Hh(!1),this.metaDataSource=new qi,this.recordSource=new Uc}}class MP extends EP{constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new Hh(!0),this.metaDataSource=new qi,this.recordSource=new Uc}}const LP=["drazen.dotlic@barchart.com","princec","b.hebert24@barchart.com"];class OP extends EP{lastStreamingTimestamp=null;_isActivelyStreaming=null;needToResubscribe=!1;constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new Hh(!0),this.metaDataSource=new Xi,this.recordSource=new Wc,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,Xe(e)&&this.initializeStreaming()}addChart(e,t=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(e,t)}set isActivelyStreaming(e){Xe(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&&LP.includes(this.connection._username)&&dP(`[chart] Connection ${e}, last timestamp ${this.lastStreamingTimestamp}`)}onEvents({event:e}){e===Ci.BC_EVENT_DISCONNECTED||e===Ci.BC_EVENT_FEED_PAUSED?(this.debug(e),this.isActivelyStreaming=!1):e!==Ci.BC_EVENT_LOGGED_IN&&e!==Ci.BC_EVENT_FEED_RESUMED||(this.debug(e),this.isActivelyStreaming=!0)}shutdown(){super.shutdown(),Xe(this._connection)&&(this.connection.off("timestamp",this.onTimestamp),this.connection.off("events",this.onEvents),this.resetStreamingState(),this.connection.disconnect(),this.connection=null)}}class wP extends EP{_listener=null;_client=null;_subscriptions=new Map;_marketIdToSymbol=new Map;_exchanges=[];constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new Hh(!0),this.metaDataSource=new Zi,this.recordSource=new $c}set listener(e){Xe(e)&&(this._listener=e,this._listener.onConnected=this.onConnected.bind(this),this._listener.onMessage=this.onMessage.bind(this))}get client(){return this._client}set client(e){Xe(e)&&(this._client=e)}get exchanges(){return this._exchanges}async ready(){await super.ready();const e=await(this.client?.connection);return this._exchanges=await(e?.getExchanges())??[],!Xe(e)}subscribe(e){if(this._subscriptions.has(e)||!Xe(this._client))return;const t=this._client.subscribe(1,5,0,[e],null,null,null);this._subscriptions.set(e,t)}unsubscribe(e){if(!this._subscriptions.has(e)||!Xe(this._client))return;const t=this._subscriptions.get(e);this._client.unsubscribe(t),this._subscriptions.delete(e)}shutdown(){super.shutdown(),Xe(this._client)&&this._client.dispose(),this._client=this._listener=null}onConnected(e){this.refreshCaches()}get ofRecordSource(){return this.recordSource}findSymbolByMarketId(e){const t=e?.marketId.toNumber();return Xe(t)&&this._marketIdToSymbol.has(t)?this._marketIdToSymbol.get(t):null}onMessage(e){const t=e.subscriptionResponse;t&&this._subscriptions.has(t.symbol)&&this._marketIdToSymbol.set(t.marketId.toNumber(),t.symbol);const i=e.marketSnapshot;let s=this.findSymbolByMarketId(i);Xe(i)&&null!==s&&this.ofRecordSource.onSnapshot(i,s);const n=e.marketUpdate;s=this.findSymbolByMarketId(n),Xe(n)&&null!==s&&this.ofRecordSource.onUpdate(n,s)}}const IP=e(Tp=n("c15IW"));export{IP as PubSub,TP as initFeed,SP as getFeed,vP as shutdownFeed,CP as getChartOutline,EP as BaseDataFeed,_P as BarchartSiteDataFeed,MP as MiniWidgetDataFeed,OP as MarketDataFeed,wP as OpenFeed,uu as OHLCDataPointBuilder,Xr as parseExpression,Zr as evaluateExpression,Ym as ExpressionSeries,zm as makeExpression,Mh as ContainerWrapperTimeSeries,Hi as formatPriceWithDecimals,Vi as getCombinedMetaData,kc as BaseRecordSource,ko as EmptyRecord,Oo as Field,xo as Fields,du as TimeSeriesContainer,yp as TimeSeriesQuery,xr as Aggregation,Ai as asyncReady,ii as hasOpenInterest,Hu as optionValueToDate,yt as generateUid,$n as getTaxonomies,Fn as doesStudyExist,Hn as getAnnotationTraits,yA as getStudyOptions,vp as StudySeries,Ap as makeHelperField,Xg as makeStudy,by as convertSeries,Ey as mapSeries,Qg as movAvg,ey as movExp,ty as movSmo,iy as movWei,sy as movHul,Py as linReg,cy as trueRange,dy as typical,py as roc,gy as stdDev,No as Topics,ys as getLightness,se as ChunkPart,$ as SeriesKind,E as AggregationSpec,C as AggregationUnit,p as ExpressionRecompute,m as ExpressionNoDataApproach,h as ExpressionMissingBar,O as FieldValueType,x as FieldCategory,I as FieldFormat,ZA as CustomEventPopup,yi as appendDOMElement,pi as styleDOMElement,fi as setAttributesDOMElement};
|
|
1
|
+
function e(e){return e&&e.__esModule?e.default:e}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i={},s={},n=t.parcelRequireffd0;let r;var o;let a;var l;let c;var u;let h;var d;let p;var f;let m;var g;let y;var T;let S;var A;let v;var P;let C;var b;let E;var _;let M;var L;let O;var w;let I;var x;let D;var N;let R;var H;let V;var F;let B;var k;let U;var W;let $;var G;let z;var Y;let j;var K;let q;var X;let Z;var J;let Q;var ee;let te;var ie;let se;var ne;let re;var oe;let ae;var le;let ce;var ue;let he;var de;let pe;var fe;function me(e,t){return function(...i){return e.apply(this,[t,...i])}}function ge(e,t,i){return function(...s){return e.apply(this,[t,i,...s])}}function ye(...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 Te(e){return e}function Se(e){return null!==e}function Ae(e){return e.reduce(((e,t)=>e+t),0)}function ve(e){const t=e.length;return t>0?Ae(e)/t:0}function Pe(e){return e.every((e=>null!==e))}function Ce(e,t){return Array.from(Array(t)).map(((t,i)=>i+e))}function be(e,t){const i=[],s=[];return e.forEach((e=>{t(e)?i.push(e):s.push(e)})),{yes:i,no:s}}function Ee(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}function _e(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 Me(e,t){return e.filter((e=>!t.includes(e)))}function Le(e,t,i=Te){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 Oe(e,t=0){if(!(e.length<t+1))return e[e.length-t-1]}function we(e){if(!(e.length<1))return e[0]}function Ie(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}null==n&&((n=function(e){if(e in i)return i[e].exports;if(e in s){var t=s[e];delete s[e];var n={id:e,exports:{}};return i[e]=n,t.call(n.exports,n,n.exports),n.exports}var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}).register=function(e,t){s[e]=t},t.parcelRequireffd0=n),n.register("3DQaT",(function(e,t){!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=function(){var e,d,p,f,m=1,g=2,y=3,T=4,S=5,A=6,v=7,P='Unexpected token "%0"',C="Unexpected end of path";function b(){for(var e,t=E();R("|");)W(),(e||(e=[t])).push(E());return e?{type:l,args:e}:t}function E(){return R("(")?_():L()}function _(){B("(");var e=b();B(")");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 R("[")?function(){B("[");var e=function(){if(R(":"))return W(),{type:u,toIdx:N()};var e=N();if(R(":"))return W(),R("]")?{type:u,fromIdx:e}:{type:u,fromIdx:e,toIdx:N()};return{type:u,idx:e}}();return B("]"),{type:n,arg:e}}():R("{")?function(){B("{");var e=O();return B("}"),{type:s,arg:e}}():R("(")?_():void 0}function L(){H()||Y(W());var e,s=!1;R("^")?(W(),s=!0):F()&&(e=W().val.substr(1));for(var n,r=[];n=V()?function(){var e,t=W().val,s=k();(R("*")||s.type===m||s.type===y)&&(e=W().val);return{type:i,selector:t,prop:e}}():M();)r.push(n);return{type:t,fromRoot:s,subst:e,parts:r}}function O(){for(var e,t=w();R("||");)W(),(e||(e=[t])).push(w());return e?{type:r,op:"||",args:e}:t}function w(){for(var e,t=I();R("&&");)W(),(e||(e=[t])).push(I());return e?{type:r,op:"&&",args:e}:t}function I(){for(var e=x();R("==")||R("!=")||R("===")||R("!==")||R("^==")||R("==^")||R("^=")||R("=^")||R("$==")||R("==$")||R("$=")||R("=$")||R("*==")||R("==*")||R("*=")||R("=*");)e={type:o,op:W().val,args:[e,I()]};return e}function x(){for(var e=function(){var e=D();for(;R("+")||R("-");)e={type:a,op:W().val,args:[e,D()]};return e}();R("<")||R(">")||R("<=")||R(">=");)e={type:o,op:W().val,args:[e,x()]};return e}function D(){for(var e=N();R("*")||R("/")||R("%");)e={type:a,op:W().val,args:[e,D()]};return e}function N(){return R("!")||R("-")?{type:c,op:W().val,arg:N()}:(e=k().type)===y||e===g||e===T||e===S?{type:h,val:W().val}:H()?L():R("(")?function(){B("(");var e=O();return B(")"),e}():Y(W());var e}function R(e){var t=k();return t.type===A&&t.val===e}function H(){return V()||F()||R("^")}function V(){var e=k();if(e.type===A){var t=e.val;return"."===t||".."===t}return!1}function F(){var e=k();return e.type===m&&"$"===e.val[0]}function B(e){var t=W();t.type===A&&t.val===e||Y(t)}function k(){if(null!==p)return p;var e=d;return p=U(),d=e,p}function U(){for(;t=e[d]," \r\n\t".indexOf(t)>-1;)++d;var t;if(d>=f)return{type:v,range:[d,d]};var i=function(){var t=d,i=e[d],s=e[d+1];if("."===i){if($(s))return;return"."===e[++d]?{type:A,val:"..",range:[t,++d]}:{type:A,val:".",range:[t,d]}}if("="===s){var n=e[d+2];if("="===n){if("=!^$*".indexOf(i)>=0)return{type:A,val:i+s+n,range:[t,d+=3]}}else if("^$*".indexOf(n)>=0){if("="===i)return{type:A,val:i+s+n,range:[t,d+=3]}}else if("=!^$*><".indexOf(i)>=0)return{type:A,val:i+s,range:[t,d+=2]}}else if("="===i&&"^$*".indexOf(s)>=0)return{type:A,val:i+s,range:[t,d+=2]};if(i===s&&("|"===i||"&"===i))return{type:A,val:i+s,range:[t,d+=2]};if(":{}()[]^+-*/%!><|".indexOf(i)>=0)return{type:A,val:i,range:[t,++d]}}();if(i||(i=function(){var t=e[d];if(!G(t))return;var i=d,s=t;for(;++d<f&&z(t=e[d]);)s+=t;switch(s){case"true":case"false":return{type:T,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]}}}())||(i=function(){if('"'!==e[d]&&"'"!==e[d])return;var t,i=e[d],s=++d,n="",r=!1;for(;d<f;){if("\\"===(t=e[d++]))t=e[d++];else if(('"'===t||"'"===t)&&t===i){r=!0;break}n+=t}if(r)return{type:y,val:n,range:[s,d]}}())||(i=function(){var t=d,i=e[d],s="."===i;if(s||$(i)){for(var n=i;++d<f;){if("."===(i=e[d])){if(s)return;s=!0}else if(!$(i))break;n+=i}return{type:g,val:s?parseFloat(n):parseInt(n,10),range:[t,d]}}}()))return i;i={range:[d,d]},d>=f?i.type=v:i.val=e[d],Y(i)}function W(){var e;return p?(d=p.range[1],e=p,p=null,e):U()}function $(e){return"0123456789".indexOf(e)>=0}function G(e){return"$"===e||"@"===e||"_"===e||e>="a"&&e<="z"||e>="A"&&e<="Z"}function z(e){return G(e)||e>="0"&&e<="9"}function Y(e){e.type===v&&j(e,C),j(e,P,e.val)}function j(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=W();return s.type!==v&&Y(s),i}}(),p=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 T(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,"++];"),A(t.arg,a,l),e.push(_(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 A(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?(A(o.fromIdx,n=f(),s),A(o.toIdx,r=f(),s),e.push(i,"=",s,".slice(",n,",",r,");"),m(n,r)):(A(o.fromIdx,n=f(),s),e.push(i,"=",s,".slice(",n,");"),m(n)):(A(o.toIdx,r=f(),s),e.push(i,"=",s,".slice(0,",r,");"),m(r))}function A(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:T(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;"),A(g,r,n),A(y,o,n);var T=g.type===t,S=y.type===h;e.push(a,"="),T?e.push("true;"):e.push("isArr(",r,");"),e.push(l,"="),S?e.push("false;"):e.push("isArr(",o,");"),e.push("if("),T||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,"=",N[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;A(o[0],n,s),A(o[1],r,s),e.push(i,"=",N[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()),A(o[l],n,s),e.push("if(",_(o[l++],n),") {");e.push(i,"= true;");break;case"||":for(;l<a;)r.push(n=f()),A(o[l],n,s),e.push("if(",_(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(A(r,n,s),t.op){case"!":e.push(i,"= !",_(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(",N[t](i,s),") {")}function P(t,i,s){for(var n=[],r=t.args,o=r.length,a=0;a<o;)n.push(f()),A(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 _(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 L(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".indexOf(",t,") === 0"].join("")}function O(e,t){return[e,"!= null &&",t,"!= null &&",e,".toString().toLowerCase().indexOf(",t,".toString().toLowerCase()) === 0"].join("")}function w(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".length >=",t,".length &&",e,".lastIndexOf(",t,") ===",e,".length -",t,".length"].join("")}function I(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 x(e,t){return["typeof ",e,'=== "string" && typeof ',t,'=== "string" &&',e,".indexOf(",t,") > -1"].join("")}function D(e,t){return[e,"!= null && ",t,"!= null &&",e,".toString().toLowerCase().indexOf(",t,".toString().toLowerCase()) > -1"].join("")}var N={"===":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},"^==":L,"==^":function(e,t){return L(t,e)},"^=":O,"=^":function(e,t){return O(t,e)},"$==":w,"==$":function(e,t){return w(t,e)},"$=":I,"=$":function(e,t){return I(t,e)},"*==":x,"==*":function(e,t){return x(t,e)},"=*":function(e,t){return D(t,e)},"*=":D,"+":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=[],A(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},T={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)&&(T[t]&&T[t](y[t],e[t]),y[t]=e[t])},S.compile=f,S.apply=S,"object"==typeof e.exports?e.exports=S:"object"==typeof modules?modules.define("jspath",(function(e){e(S)})):"function"==typeof define?define((function(e,t,i){i.exports=S})):window.JSPath=S}()})),n.register("2nrEA",(function(e,t){(function(){var t=function(e){if(null===e||"object"!=typeof e)return e;var i;if(e instanceof Date)return(i=new Date).setTime(e.getTime()),i;if(e instanceof RegExp)return i=new RegExp(e);if(e instanceof Array){i=[];for(var s=0,n=e.length;s<n;s++)i[s]=t(e[s]);return i}if(e instanceof Object){for(var r in i={},e)e.hasOwnProperty(r)&&(i[r]=t(e[r]));return i}throw new Error("Unable to clone object!")},i=function(e){for(var i=[t(e[0])],s=i[0].key,n=i[0].object,r=1,o=e.length;r<o;r++)n=n[s],s=e[r].key,i.push({object:n,key:s});return i},s=function(e,t){var i=e.length-1,s=e[i].key;t[i].object[s]=e[i].object[s]},n={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},r={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}},o={alpha:function(e){return/^[a-zA-Z]+$/.test(e)},alphanumeric:function(e){return/^[a-zA-Z0-9]+$/.test(e)},identifier:function(e){return/^[-_a-zA-Z0-9]+$/.test(e)},hexadecimal:function(e){return/^[a-fA-F0-9]+$/.test(e)},numeric:function(e){return/^[0-9]+$/.test(e)},"date-time":function(e){return!isNaN(Date.parse(e))&&-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){if(/^(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)$/.test(e)&&e.split(".").sort()[3]<=255)return!0;return!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)}},a={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}},l=function(e){return-1===e.indexOf("://")?e:e.split("#")[0]},c=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},u=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}},h=function(e,t,r,o){var a,l,d,p,f,m,g,y,T,S,A,v,P,C=!1,b={},E=t[t.length-1],_=r.length-1,M=r[_].object,L=r[_].key,O=M[L];if(E.hasOwnProperty("$ref"))return(t=c(e,t,E.$ref))?h(e,t,r,o):{$ref:E.$ref};if(E.hasOwnProperty("type"))if("string"==typeof E.type){if(o.useCoerce&&e.coerceType.hasOwnProperty(E.type)&&(O=M[L]=e.coerceType[E.type](O)),!e.fieldType[E.type](O))return{type:E.type}}else{for(C=!0,a=0,l=E.type.length;a<l&&C;a++)e.fieldType[E.type[a]](O)&&(C=!1);if(C)return{type:E.type}}if(E.hasOwnProperty("allOf"))for(a=0,l=E.allOf.length;a<l;a++)if(y=h(e,t.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,l=E.oneOf.length,d=0;a<l;a++)if(A=i(r),y=h(e,t.concat(E.oneOf[a]),A,o))(v=y.schema?Object.keys(y.schema).length:1)<P&&(P=v,b=y);else{if((d+=1)>1)break;s(A,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,l=E.anyOf.length;a<l;a++){if(A=i(r),!(y=h(e,t.concat(E.anyOf[a]),A,o))){s(A,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")&&(A=i(r),!(y=h(e,t.concat(E.not),A,o))))return{not:!0}}else{if(E.hasOwnProperty("oneOf")){for(P=1/0,a=0,l=E.oneOf.length,d=0;a<l;a++)if(y=h(e,t.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,l=E.anyOf.length;a<l;a++){if(!(y=h(e,t.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=h(e,t.concat(E.not),r,o)))return{not:!0}}if(E.hasOwnProperty("dependencies"))for(m in E.dependencies)if(E.dependencies.hasOwnProperty(m)&&O.hasOwnProperty(m))if(Array.isArray(E.dependencies[m])){for(a=0,l=E.dependencies[m].length;a<l;a++)if(!O.hasOwnProperty(E.dependencies[m][a]))return{dependencies:!0}}else if(y=h(e,t.concat(E.dependencies[m]),r,o))return y;if(Array.isArray(O)){if(E.hasOwnProperty("items"))if(Array.isArray(E.items)){for(a=0,l=E.items.length;a<l;a++)null!==(y=h(e,t.concat(E.items[a]),r.concat({object:O,key:a}),o))&&(b[a]=y,C=!0);if(O.length>l&&E.hasOwnProperty("additionalItems"))if("boolean"==typeof E.additionalItems){if(!E.additionalItems)return{additionalItems:!0}}else for(a=l,l=O.length;a<l;a++)null!==(y=h(e,t.concat(E.additionalItems),r.concat({object:O,key:a}),o))&&(b[a]=y,C=!0)}else for(a=0,l=O.length;a<l;a++)null!==(y=h(e,t.concat(E.items),r.concat({object:O,key:a}),o))&&(b[a]=y,C=!0);else if(E.hasOwnProperty("additionalItems")&&"boolean"!=typeof E.additionalItems)for(a=0,l=O.length;a<l;a++)null!==(y=h(e,t.concat(E.additionalItems),r.concat({object:O,key:a}),o))&&(b[a]=y,C=!0);if(C)return{schema:b}}else{for(m in T=[],b={},O)O.hasOwnProperty(m)&&T.push(m);if(o.checkRequired&&E.required)for(a=0,l=E.required.length;a<l;a++)O.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=T.length;a--;){if(S=!1,p&&E.properties.hasOwnProperty(T[a])&&(S=!0,null!==(y=h(e,t.concat(E.properties[T[a]]),r.concat({object:O,key:T[a]}),o))&&(b[T[a]]=y,C=!0)),f)for(m in E.patternProperties)E.patternProperties.hasOwnProperty(m)&&T[a].match(m)&&(S=!0,null!==(y=h(e,t.concat(E.patternProperties[m]),r.concat({object:O,key:T[a]}),o))&&(b[T[a]]=y,C=!0));S&&T.splice(a,1)}if(o.useDefault&&p&&!C)for(m in E.properties)E.properties.hasOwnProperty(m)&&!O.hasOwnProperty(m)&&E.properties[m].hasOwnProperty("default")&&(O[m]=E.properties[m].default);if(o.removeAdditional&&p&&!0!==E.additionalProperties&&"object"!=typeof E.additionalProperties)for(a=0,l=T.length;a<l;a++)delete O[T[a]];else if(E.hasOwnProperty("additionalProperties"))if("boolean"==typeof E.additionalProperties){if(!E.additionalProperties)for(a=0,l=T.length;a<l;a++)b[T[a]]={additional:!0},C=!0}else for(a=0,l=T.length;a<l;a++)null!==(y=h(e,t.concat(E.additionalProperties),r.concat({object:O,key:T[a]}),o))&&(b[T[a]]=y,C=!0);if(C)return{schema:b}}for(g in E)E.hasOwnProperty(g)&&!n.hasOwnProperty(g)&&("format"===g?e.fieldFormat.hasOwnProperty(E[g])&&!e.fieldFormat[E[g]](O,E,r,o)&&(b[g]=!0,C=!0):e.fieldValidate.hasOwnProperty(g)&&!e.fieldValidate[g](O,E[g].hasOwnProperty("$data")?u(r,E[g].$data):E[g],E,r,o)&&(b[g]=!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(r),this.fieldValidate=t(a),this.fieldFormat=t(o),this.defaultOptions=t(d),this.schema={}}p.prototype={validate:function(e,t,i){var s=[e],n=null,r=[{object:{__root__:t},key:"__root__"}];if("string"==typeof e&&!(s=c(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=h(this,s,r,i))?{validation:n.hasOwnProperty("schema")?n.schema:n}:null},resolveRef:function(e,t){return c(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[l(t.id)]=t}else if(!e)throw new Error("jjv: schema needs either a name or id attribute.");e&&(this.schema[l(e)]=t)}},void 0!==e.exports?e.exports=p:"function"==typeof define&&define.amd?define((function(){return p})):this.jjv=p}).call(e.exports)})),n.register("eG07G",(function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.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=e.exports.default})),n.register("c15IW",(function(e,t){!function(i,s){var n={};i.PubSub?(n=i.PubSub,console.warn("PubSub already loaded, using existing version")):(i.PubSub=n,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(e){setTimeout(r(e),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)}}(n)),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}("object"==typeof window&&window||this)})),(o=r||(r={}))[o.Browser=0]="Browser",o[o.NodeJs=1]="NodeJs",(l=a||(a={}))[l["1D"]=0]="1D",l[l["5D"]=1]="5D",l[l["1M"]=2]="1M",l[l["3M"]=3]="3M",l[l["6M"]=4]="6M",l[l["1Y"]=5]="1Y",l[l["5Y"]=6]="5Y",l[l.Max=7]="Max",(u=c||(c={}))[u.WithSeries=0]="WithSeries",u[u.TimeAxis=1]="TimeAxis",(d=h||(h={}))[d.UsePrevious=0]="UsePrevious",d[d.UseNext=1]="UseNext",d[d.UseNone=2]="UseNone",(f=p||(p={}))[f.Minimum=0]="Minimum",f[f.Everything=1]="Everything",f[f.Manual=2]="Manual",(g=m||(m={}))[g.NoAction=0]="NoAction",g[g.IgnoreTimelineOnly=1]="IgnoreTimelineOnly",g[g.ModelTransformRequired=2]="ModelTransformRequired",(T=y||(y={}))[T.Down=0]="Down",T[T.Up=1]="Up",T[T.Same=2]="Same",(A=S||(S={}))[A.ChangeBased=0]="ChangeBased",A[A.OpenVsClose=1]="OpenVsClose",(P=v||(v={}))[P.OHLC=0]="OHLC",P[P.Line=1]="Line",P[P.Candlestick=2]="Candlestick",P[P.Area=3]="Area",P[P.Column=4]="Column",P[P.Dots=5]="Dots",P[P.HLC=6]="HLC",P[P.HL=7]="HL",P[P.Ribbon=8]="Ribbon",P[P.Step=9]="Step",P[P.HollowCandles=10]="HollowCandles",P[P.HeikinAshi=11]="HeikinAshi",P[P.ElderImpulseSystem=12]="ElderImpulseSystem",P[P.Renko=13]="Renko",P[P.Range=14]="Range",P[P.LineBreak=15]="LineBreak",P[P.Kagi=16]="Kagi",P[P.PointAndFigure=17]="PointAndFigure",P[P.Baseline=18]="Baseline",P[P.PercentChange=19]="PercentChange",P[P.MultiColumn=20]="MultiColumn",P[P.StackedColumn=21]="StackedColumn",(b=C||(C={}))[b.Tick=0]="Tick",b[b.Intraday=1]="Intraday",b[b.Day=2]="Day",b[b.Week=3]="Week",b[b.Month=4]="Month",b[b.Quarter=5]="Quarter",b[b.Year=6]="Year",(_=E||(E={}))[_.None=0]="None",_[_.Nearest=1]="Nearest",_[_.Continue=2]="Continue",_[_.PerCount=3]="PerCount",_[_.PerVolume=4]="PerVolume",_[_.PerRange=5]="PerRange",_[_.PerSeconds=6]="PerSeconds",(L=M||(M={}))[L.Png=0]="Png",L[L.Jpeg=1]="Jpeg",L[L.Pdf=2]="Pdf",L[L.Svg=3]="Svg",(w=O||(O={}))[w.Number=0]="Number",w[w.String=1]="String",w[w.Date=2]="Date",(x=I||(I={}))[x.FromMetaData=0]="FromMetaData",x[x.AsInteger=1]="AsInteger",x[x.UseMetricUnit=2]="UseMetricUnit",x[x.AsPercent=3]="AsPercent",(N=D||(D={}))[N.Common=0]="Common",N[N.Study=1]="Study",N[N.BalanceSheet=2]="BalanceSheet",N[N.IncomeStatement=3]="IncomeStatement",N[N.Forward=4]="Forward",N[N.Seasonal=5]="Seasonal",N[N.Event=6]="Event",N[N.Option=7]="Option",(H=R||(R={}))[H.Unknown=0]="Unknown",H[H.Equity=1]="Equity",H[H.EquityOption=2]="EquityOption",H[H.Future=3]="Future",H[H.FutureOption=4]="FutureOption",H[H.Forex=5]="Forex",H[H.Index=6]="Index",(F=V||(V={}))[F.None=0]="None",F[F.Value=1]="Value",F[F.Percent=2]="Percent",(k=B||(B={}))[k.Linear=0]="Linear",k[k.Logarithmic=1]="Logarithmic",(W=U||(U={}))[W.Symbol=0]="Symbol",W[W.Expression=1]="Expression",W[W.Study=2]="Study",W[W.Forward=3]="Forward",W[W.BalanceSheet=4]="BalanceSheet",W[W.IncomeStatement=5]="IncomeStatement",W[W.Seasonal=6]="Seasonal",(G=$||($={}))[G.Normal=0]="Normal",G[G.Forward=1]="Forward",G[G.HistoricalForward=2]="HistoricalForward",G[G.Study=3]="Study",G[G.BalanceSheet=4]="BalanceSheet",G[G.IncomeStatement=5]="IncomeStatement",G[G.Events=6]="Events",G[G.Options=7]="Options",(Y=z||(z={}))[Y.Left=0]="Left",Y[Y.Center=1]="Center",Y[Y.Right=2]="Right",(K=j||(j={}))[K.Arrow=0]="Arrow",K[K.Crosshair=1]="Crosshair",K[K.Move=2]="Move",K[K.Hand=3]="Hand",K[K.ResizeVertical=4]="ResizeVertical",K[K.Grabbing=5]="Grabbing",K[K.ResizeHorizontal=6]="ResizeHorizontal",(X=q||(q={}))[X.NotApplicable=0]="NotApplicable",X[X.Left=1]="Left",X[X.Middle=2]="Middle",X[X.Right=3]="Right",(J=Z||(Z={}))[J.Shift=0]="Shift",J[J.Alt=1]="Alt",J[J.Control=2]="Control",J[J.Meta=3]="Meta",(ee=Q||(Q={}))[ee.None=0]="None",ee[ee.Horizontal=1]="Horizontal",ee[ee.Vertical=2]="Vertical",ee[ee.Both=3]="Both",(ie=te||(te={}))[ie.Unspecified=0]="Unspecified",ie[ie.GBE=1]="GBE",ie[ie.cmdtyView=2]="cmdtyView",ie[ie.DemoSite=3]="DemoSite",ie[ie.InternalFeed=4]="InternalFeed",ie[ie.Widget=5]="Widget",ie[ie.FreeWidget=6]="FreeWidget",(ne=se||(se={}))[ne.Unspecified=0]="Unspecified",ne[ne.Head=1]="Head",ne[ne.Tail=2]="Tail",(oe=re||(re={}))[oe.wheel=0]="wheel",oe[oe["wheel+shift"]=1]="wheel+shift",oe[oe.none=2]="none",(le=ae||(ae={}))[le.Auto=0]="Auto",le[le.Draggable=1]="Draggable",(ue=ce||(ce={}))[ue.Page=0]="Page",ue[ue.Application=1]="Application",(de=he||(he={}))[de.None=0]="None",de[de.Created=1]="Created",de[de.Deleted=2]="Deleted",de[de.Moved=3]="Moved",de[de.PointMoved=4]="PointMoved",de[de.TextChanged=5]="TextChanged",de[de.Undo=6]="Undo",de[de.Redo=7]="Redo",de[de.Cancelled=8]="Cancelled",de[de.Executed=9]="Executed",(fe=pe||(pe={}))[fe.None=0]="None",fe[fe.Min=1]="Min",fe[fe.Max=2]="Max";const xe=(e,t)=>e[t];function De(e,t,i=(e=>e),s=xe,n=0,r=e.length-1){for(;n<r;){const l=n+r>>>1,c=s(e,l);((o=i(c))<(a=t)?-1:o>a?1:o>=a?0:NaN)<0?n=l+1:r=l}var o,a;return n}function Ne(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 Re(e,t){return Array.from({length:e},((e,i)=>t(i)))}function He(e,t){const i=Ze;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)}function Ve(e,t){return e[t%e.length]}function Fe(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}}let Be=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"");let ke=null;function Ue(){return null===ke&&(ke="ontouchstart"in globalThis),ke}function We(e,t){return"Backspace"===e||"Delete"===e||8===t||46===t}function $e(e,t){return"Escape"===e||27===t}function Ge(e,t){return"F2"===e||113===t}function ze(e,t){return"ArrowLeft"===e||37===t}function Ye(e,t){return"ArrowRight"===e||39===t}function je(e,t){t.sentAt=Date.now(),PubSub.publish(e,t)}function Ke(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=>je(e,t)),t)}function qe(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=>je(e,t)),t)}function Xe(e){return null!=e}function Ze(...e){return e.every((e=>null!=e))}function Je(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 Qe(e){return Ze(e)&&Number.isFinite(e)}function et(e){const t="both"===e;return[t||"vertical"===e,t||"horizontal"===e]}function tt(e,t,i){return t.includes(e)?e:i}function it(e,t){return Ze(e)?e:t}function st(e,t){return Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function nt(e,t,...i){if(!Ze(e))return t;let s=e;for(const e of i){if(!Ze(s)||!st(s,e))return t;s=s[e]}return s}function rt(e){return null==e?e:JSON.parse(JSON.stringify(e))}function ot(e,t,i=!0){const s=Object.keys(t),n=Object.keys(e);for(const o of s)if(r=o,!i||n.includes(r)){const i=e[o];void 0===i||"object"!=typeof i||Array.isArray(i)?e[o]=t[o]:at(e[o],t[o])}var r}function at(e,t){ot(e,t)}function lt(e,t){const i=Object.keys(t);for(const s of i)e[s]=e[s]||t[s]}function ct(e=[]){return e.reduce(((e,t)=>(e[t.name]=t.value,e)),{})}function ut(e){return e?new Date(e):null}function ht(e){let t="";for(const i in e){const s=`${i}=${encodeURIComponent(e[i])}`;t+=(t.length>0?"&":"")+s}return t}function dt(e,t){ot(e,t,!1)}const pt=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/,ft=[1e3,60,60,24,7,30/7,12];function mt(e){const t=pt.exec(e);if(!Ze(t))return null;const i=t.slice(2,9).map((e=>Ze(e)?parseFloat(e):0)).reverse();return ft.forEach(((e,t)=>{for(let s=t;s<i.length;s++)i[s]=i[s]*e})),Math.floor(Ae(i))}function gt(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 yt(){return Be(12)}function Tt(e,t,i){return Math.min(Math.max(i,e),t)}var St,At={};At={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 vt={},Pt={};Pt=(()=>{function e(e,i,s,n,r){s===String?At.string(e)||t(i,"string",r):s===Number?At.number(e)||t(i,"number",r):s===Function?At.fn(e)||t(i,"function",r):s===Boolean?At.boolean(e)||t(i,"boolean",r):s===Date?At.date(e)||t(i,"date",r):s===Array?At.array(e)||t(i,"array",r):e instanceof(s||Object)||t(i,n,r)}function t(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 i(e,t){throw new Error(`The argument [ ${e||"unspecified"} ] failed a validation check [ ${t||"No description available"} ]`)}return{argumentIsRequired(t,i,s,n){e(t,i,s,n)},argumentIsOptional(t,s,n,r,o,a){null!=t&&(e(t,s,n,r),At.fn(o)&&!o(t)&&i(s,a))},argumentIsArray(t,i,s,n){if(this.argumentIsRequired(t,i,Array),s){let r;r="function"==typeof s&&s!==Function?(e,t)=>void 0!==s.prototype&&e instanceof s||s(e,`${i}[${t}]`):(t,r)=>e(t,i,s,n,r),t.forEach(((e,t)=>{r(e,t)}))}},argumentIsValid(e,t,s,n){s(e)||i(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()}]`)}}})(),vt=(()=>{const e={camel:{}};return 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=>(Pt.argumentIsRequired(t,"s",String),t.replace(e.camel.violations,(e=>e.toLocaleLowerCase()))),truncate:(e,t)=>At.string(e)&&e.length>t?e.substring(0,t)+" ...":e,padLeft(e,t,i){if(Pt.argumentIsRequired(e,"s",String),Pt.argumentIsRequired(t,"length",Number),Pt.argumentIsRequired(i,"character",String),1!==i.length)throw new Error('The "character" argument must be one character in length.');return i.repeat(t-e.length)+e},format:(e,...t)=>(Pt.argumentIsRequired(e,"s",String),e.replace(/{(\d+)}/g,((e,i)=>{let s;if(i<t.length){const n=t[i];s=At.undefined(n)||At.null(n)?e:n.toString()}else s=e;return s})))}})();var Ct,bt={};bt=(()=>{const e=new Map;class t{constructor(i,s){Pt.argumentIsRequired(i,"code",String),Pt.argumentIsRequired(s,"description",String),this._code=i,this._description=s;const n=this.constructor;e.has(n)||e.set(n,[]);null===t.fromCode(n,i)&&e.get(n).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})(),Ct=(()=>{class e extends bt{constructor(e,t,i){super(e,t),this._id=i}get id(){return this._id}toJSON(){return this._id}static parse(t){return bt.fromCode(e,t)}static fromId(t){return bt.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 n}static get FOREX(){return r}static get CMDTY_STATS(){return o}toString(){return`[AssetClass (id=${this.id}, code=${this.code})]`}}const t=new e("STK","U.S. Equity",1),i=new e("STKOPT","Equity Option",34),s=new e("FUT","Future",2),n=new e("FUTOPT","Future Option",12),r=new e("FOREX","FOREX",10),o=new e("CMDTY","cmdtyStats",24);return e})(),St=(()=>{class e{constructor(){}static getIsConcrete(e){return At.string(e)&&!this.getIsReference(e)}static getIsReference(e){return At.string(e)&&r.futures.alias.test(e)}static getIsFuture(e){return At.string(e)&&(r.futures.concrete.test(e)||r.futures.alias.test(e))}static getIsCash(t){return e.getIsFuture(t)&&r.futures.cash.test(t)}static getIsFutureSpread(e){return At.string(e)&&r.futures.spread.test(e)}static getIsFutureOption(e){return At.string(e)&&(r.futures.options.short.test(e)||r.futures.options.long.test(e)||r.futures.options.historical.test(e))}static getIsForex(e){return At.string(e)&&r.forex.test(e)}static getIsCrypto(e){return At.string(e)&&r.crypto.test(e)}static getIsIndex(e){return At.string(e)&&r.indicies.external.test(e)}static getIsSector(e){return At.string(e)&&r.indicies.sector.test(e)}static getIsCanadianFund(e){return At.string(e)&&r.funds.canadian.test(e)}static getIsCmdty(e){return At.string(e)&&(r.cmdty.stats.test(e)||r.cmdty.internal.test(e)||r.cmdty.external.test(e))}static getIsCmdtyStats(e){return At.string(e)&&r.cmdty.stats.test(e)}static getIsBats(e){return At.string(e)&&n.bats.test(e)}static getIsEquityOption(e){return At.string(e)&&r.equities.options.test(e)}static getIsExpired(t){const i=e.parseInstrumentType(t);let n=!1;if(null!==i&&i.year&&i.month){const e=l();if(i.year<e)n=!0;else if(i.year===e&&s.hasOwnProperty(i.month)){(new Date).getMonth()+1>s[i.month]&&(n=!0)}}return n}static getIsC3(e){return At.string(e)&&(r.c3.concrete.test(e)||r.c3.alias.test(e))}static getIsPlatts(e){return At.string(e)&&(r.platts.concrete.test(e)||r.platts.alias.test(e))}static getIsPit(e,t){return At.string(e)&&At.string(t)&&n.pit.test(t)}static getIsGrainBid(e){return At.string(e)&&r.bids.test(e)}static parseInstrumentType(e){if(!At.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 getProducerSymbol(e){if(!At.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 getFuturesOptionPipelineFormat(t){const i=e.parseInstrumentType(t);let s=null;if("future_option"===i.type){const e=h(i.option_type);s=`${i.root}${i.month}${c(i.year,1)}|${i.strike}${e}`}return s}static getFuturesExplicitFormat(t){let i=null;if(e.getIsFuture(t)&&e.getIsConcrete(t)){const s=e.parseInstrumentType(t);i=`${s.root}${s.month}${vt.padLeft(Math.floor(s.year%100).toString(),2,"0")}`}return i}static getFuturesYear(e,t){return u(e,t)}static displayUsingPercent(e){return At.string(e)&&n.percent.test(e)}toString(){return"[SymbolParser]"}}const 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},n={bats:/^(.*)\.BZ$/i,percent:/(\.RT)$/,pit:/\(P(it)?\)/},r={bids:/^([A-Z]{2})([B|P])([A-Z\d]{3,4})-(\d+)-(\d+)(\.CM)$/i,c3:{}};r.c3.alias=/^(C3:)(.*)$/i,r.c3.concrete=/(\.C3)$/i,r.cmdty={},r.cmdty.stats=/(\.CS)$/i,r.cmdty.internal=/(\.CM)$/i,r.cmdty.external=/(\.CP)$/i,r.crypto=/^\^([A-Z]{3})([A-Z]{3,4})$/i,r.equities={},r.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,r.forex=/^\^([A-Z]{3})([A-Z]{3})$/i,r.funds={},r.funds.canadian=/(.*)(\.CF)$/i,r.futures={},r.futures.alias=/^([A-Z][A-Z0-9\$\-!\.]{0,2})(\*{1})([0-9]{1,2})$/i,r.futures.concrete=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,r.futures.spread=/^_S_/i,r.futures.cash=/(.*)(Y00)$/,r.futures.options={},r.futures.options.historical=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,r.futures.options.long=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,r.futures.options.short=/^([A-Z][A-Z0-9\$\-!\.]?)([A-Z])([0-9]{1,4})([A-Z])$/i,r.indicies={},r.indicies.external=/^\$(.*)$/i,r.indicies.sector=/^\-(.*)$/i,r.platts={},r.platts.alias=/^(PLATTS:)(.*)$/i,r.platts.concrete=/^(.*)(\.PT)$/i;const o=[];o.push((e=>{let t=null;return r.futures.spread.test(e)&&(t={},t.symbol=e,t.type="future_spread"),t})),o.push((e=>{let t=null;const i=e.match(r.futures.concrete);return null!==i&&(t={},t.symbol=e,t.type="future",t.asset=Ct.FUTURE,t.dynamic=!1,t.root=i[1],t.month=i[2],t.year=u(i[3],i[2])),t})),o.push((e=>{let t=null;const i=e.match(r.futures.alias);return null!==i&&(t={},t.symbol=e,t.type="future",t.asset=Ct.FUTURE,t.dynamic=!0,t.root=i[1],t.dynamicCode=i[3]),t})),o.push((e=>{let t=null;return r.forex.test(e)&&(t={},t.symbol=e,t.type="forex",t.asset=Ct.FOREX),t})),o.push((e=>{let t=null;const i=e.match(r.equities.options);if(null!==i){const s=void 0!==i[4]?i[4]:"";t={},t.symbol=e,t.type="equity_option",t.asset=Ct.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})),o.push((e=>{let t=null;return r.indicies.external.test(e)&&(t={},t.symbol=e,t.type="index"),t})),o.push((e=>{let t=null;return r.indicies.sector.test(e)&&(t={},t.symbol=e,t.type="sector"),t})),o.push((e=>{let t=null;const i=e.match(r.futures.options.short);if(null!==i){t={};const s=i[4].charCodeAt(0),n=80;let r,o;s<n?(r="call",o=s-67):(r="put",o=s-n),t.symbol=e,t.type="future_option",t.asset=Ct.FUTURE_OPTION,t.option_type=r,t.strike=parseInt(i[3]),t.root=i[1],t.month=i[2],t.year=l()+o}return t})),o.push((e=>{let t=null;const s=e.match(r.futures.options.long)||e.match(r.futures.options.historical);var n;return null!==s&&(t={},t.symbol=e,t.type="future_option",t.asset=Ct.FUTURE_OPTION,t.option_type="C"===s[5]?"call":"put",t.strike=parseInt(s[4]),t.root=s[1],t.month=(n=s[2],i[n]||n),t.year=u(s[3])),t})),o.push((e=>{let t=null;return null!==e.match(r.cmdty.stats)&&(t={},t.symbol=e,t.type="cmdtyStats",t.asset=Ct.CMDTY_STATS),t}));const a=[];function l(){return(new Date).getFullYear()}function c(e,t){const i=e.toString();return i.substring(i.length-t,i.length)}function u(e,t){const i=l();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 h(e){return"call"===e?"C":"put"===e?"P":null}return a.push((i=>{let s=null;if(e.getIsFuture(i)&&e.getIsConcrete(i)){const e=i.match(r.futures.concrete);if(null!==e){const i=e[1],n=e[2],r=u(e[3],n);if(r>l()+9){const e=t[n];e&&(s=`${i}${e}${c(r,1)}`)}}}return s})),a.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})),a.push((t=>{let i=null;if(e.getIsFutureOption(t)){const s=e.parseInstrumentType(t),n=h(s.option_type);if(s.root.length<3){const e=n.charCodeAt(0);i=`${s.root}${s.month}${s.strike}${String.fromCharCode(e+s.year-l())}`}else i=`${s.root}${s.month}${c(s.year,1)}|${s.strike}${n}`}return i})),a.push((e=>{let t=null;return r.c3.alias.test(e)&&(t=e.replace(r.c3.alias,"$2.C3")),t})),a.push((e=>{let t=null;return r.platts.alias.test(e)&&(t=e.replace(r.platts.alias,"$2.PT")),t})),a.push((e=>e)),e})();var Et;function _t(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 Mt(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Lt(e){return Lt="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},Lt(e)}function Ot(e){Mt(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Lt(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)),new Date(NaN))}function wt(e,t){Mt(2,arguments);var i=Ot(e),s=_t(t);if(isNaN(s))return new Date(NaN);if(!s)return i;var n=i.getDate(),r=new Date(i.getTime());r.setMonth(i.getMonth()+s+1,0);var o=r.getDate();return n>=o?r:(i.setFullYear(r.getFullYear(),r.getMonth(),n),i)}function It(e,t){Mt(2,arguments);var i=_t(t);return wt(e,12*i)}function xt(e){Mt(1,arguments);var t=Ot(e),i=new Date(0);return i.setFullYear(t.getFullYear(),0,1),i.setHours(0,0,0,0),i}function Dt(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){Mt(1,arguments);var t=Ot(e);return t.setHours(0,0,0,0),t}Et=(()=>{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)}})();var Rt=864e5;function Ht(e,t){Mt(2,arguments);var i=Nt(e),s=Nt(t),n=i.getTime()-Dt(i),r=s.getTime()-Dt(s);return Math.round((n-r)/Rt)}function Vt(e){Mt(1,arguments);var t=Ot(e),i=Ht(t,xt(t)),s=i+1;return s}function Ft(e){return Mt(1,arguments),Ot(e).getFullYear()}function Bt(e){Mt(1,arguments);var t=Ot(e);return t.setDate(1),t.setHours(0,0,0,0),t}function kt(t){return e(St).parseInstrumentType(t)}const Ut=()=>Vt(Date.now()),Wt=function(e){const t=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 ni(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}})),$t=e=>Wt(e,Ut());async function Gt(e){if(!ti(e))return e;const{root:t,dynamic:i,dynamicCode:s}=kt(e);if(!Ze(t,i,s))return null;const n=await $t(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 zt(t){return e(St).getIsFutureOption(t)}function Yt(t){return e(St).getIsFuture(t)}const jt=/^_S_SP_([^_]+)_([^_]+)$/;function Kt(e){const t=e.match(jt);return!(!t||3!==t.length)&&(Yt(t[1])&&Yt(t[2]))}const qt=/^([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 Xt(e){return qt.test(e)}function Zt(t){return e(St).getIsEquityOption(t)}function Jt(e){return Yt(e)?`${function(e){if(!Yt(e))return null;const t=kt(e);return t.root}(e)}Y00`:null}function Qt(e){return String(e%100).padStart(2,"0")}function ei(e,t=!1){if(!Yt(e))return e;const i=kt(e);return function(e,t,i,s=!1){return`${e}${t}${s?i:Qt(i)}`}(i.root,i.month,i.year,t)}function ti(e){const t=kt(e);return Ze(t)&&!0===t.dynamic}function ii(e){const t=Yt(e)||zt(e),i="_S_"===e.substring(0,2);return(t||Zt(e))&&!i}function si(e){return Yt(e)?"America/Chicago":"America/New_York"}async function ni(e){const t=await fP("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 ri(t){if(!Yt(t))return null;const i=kt(t),s=e(Et).getCodeToNumberMap()[i.month];return Bt(new Date(i.year,s-1))}function oi(e,t){const i=kt(e),s=(i.year+t)%100;return`${i.root}${i.month}${Qt(s)}`}function ai(e,t){const i=Yt(e),s=Xt(e),n=Kt(e);return i?oi(e,t):s?function(e,t){const i=qt.exec(e),s=Number.parseInt(i[2]),n=Ft(It(new Date(s+(s>79?1900:2e3),0,1),t));return`${i[1]}${Qt(n)}${i[3]}`}(e,t):n?function(e,t){const i=e.match(jt);return`_S_SP_${oi(i[1],t)}_${oi(i[2],t)}`}(e,t):null}async function li(e){const t=e=>[e,!1,!1],i=Yt(e),s=Xt(e),n=function(e){return!!Yt(e)&&"Y"===kt(e).month}(e);if(!i&&!s||n)return t(e);if(i){const{root:t,month:i}=kt(e),s=await Gt(`${t}*1`);if(!ti(e)){const s=(await $t(t))?.symbols??[];if(s.includes(e))return[e,!0,!1];for(let e of s){if(kt(e).month===i)return[e,!0,!0]}}return[s,!0,!0]}if(s){const i=qt.exec(e);return t(`${i[1]}${Qt(Ft(new Date))}${i[3]}`)}return t(e)}function ci(e){const t=e.getRootNode();return t===document?document.body:t}function ui(e,t=document){const i=di(e,t);return Ze(i)?i.innerHTML:null}function hi(e){e.remove()}function di(e,t=document){return Ti(e,t)[0]}function pi(e,t){for(const i in t)e.style[i]=t[i]}function fi(e,t){for(const i in t)e.setAttribute(i,t[i])}function mi(e,t,i){const s=di(`#${e}`,t);if(Ze(s))return s;const n=yi(t,i);return n.id=e,n}function gi(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 yi(e,t){return e.appendChild(document.createElement(t))}function Ti(e,t=document){return t.querySelectorAll(e)}function Si(e,t){e&&(e.innerHTML=t)}async function Ai(e,t="asyncReadyWork"){Ze(this[t])||(this[t]={});const i=this[t];return Ze(i.result)?Promise.resolve(i.result):(Ze(i.promise)||(i.promise=e.call(this),i.promise.then((e=>{i.result=e}))),i.promise)}class vi{_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 Pi=globalThis.devicePixelRatio||1,Ci={EVENT_PIN_HIT:[{selected:!1},null],HIT_TEST_TOLERANCE:Ue()?20*Pi:5*Pi,HALF_ANN_POINT_DIMENSION:Ue()?10:6,OUT_OF_SCREEN:8192,DEFAULT_SYMBOL_WIDTH_HEIGHT:32,PANE_SPLITTER_PERCENT_HEIGHT:.75,BASIS_MAIN:"$main",INPUT_PERIOD:"Period",INPUT_PERIOD1:"Period1",INPUT_PERIOD2:"Period2",INPUT_PERIOD3:"Period3",INPUT_SYMBOL:"Symbol",INPUT_SMOOTHING:"Smoothing",INPUT_SOURCE:"Source",INPUT_WIDTH:"Width",EMPTY_ARRAY:[],CHART_DEFINITION:"chart.def.json",CHART_SCHEMA:"chart.schema.json",STUDIES_SCHEMA:"studies.schema.json",STUDIES_LIST:"studies.lst.json",FIELDS_SCHEMA:"fields.schema.json",FIELDS_LIST:"fields.lst.json",ACCESSOR_SCHEMA:"accessor.schema.json",EVENTS:["dividends","earnings","splits","custom"],EVENT_PROPERTIES:["show","color","title"],PLACEHOLDER_SYMBOL_NAME:"PLACEHOLDER",REALTIME_INITIAL_QUOTE:"REFRESH_QUOTE",REALTIME_TRADE:"TRADE",REALTIME_VOLUME:"VOLUME",TOOLTIP_X_OFFSET:15,TOOLTIP_Y_OFFSET:30,TOOLTIP_TOGGLE_SIDE_ANIM_MS:300,TOOLTIP_TOGGLE_DISTANCE_TOLERANCE:10,CARDS_X_OFFSET:5,CARDS_Y_OFFSET:5,PANE_CAP_MAX_PADDING_PERCENT:.15,PANE_CAP_MIN_PADDING_PERCENT:.075,PANE_TINY_PADDING_PIXELS:5,STANDARD_VISIBLE_BARS:130,ACTION_GET:"Get",ACTION_DELETE:"Delete",ACTION_TEMPLATE:"Template",ACTION_AGGREGATION:"Aggregation",ACTION_PLOT:"Plot",MINIMUM_BAR_WIDTH:.02,MAXIMUM_BAR_WIDTH:180,MINIMUM_BARS_VISIBLE:5,COLOR_TRANSPARENT:"rgba(0, 0, 0, 0)",AT_LINE:"line",AT_LINE_2:"line2",AT_FILL:"fill",AT_FILL2:"fill2",AT_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:[v.Renko,v.LineBreak,v.Kagi,v.PointAndFigure],INTRA_THRESHOLD:mt("P30D"),ONE_DAY_MILLIS:mt("P1D"),ONE_MINUTE_MILLIS:6e4,TIME_SCALE_MAX_SPACE_NO_TICKS:80,FIFTY_YEARS_MILLIS:mt("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),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};var bi={},Ei={};Ei=function(e,t,i,s){if(!At.number(e))return"";(!At.string(i)||i.length>1)&&(i="");const n=e<0&&!0===s;n&&(e=0-e);let r=e.toFixed(t);if(i&&(e<-999||e>999)){const s=e<0;let o=0===t,a=0;const l=[];for(let e=r.length-1;!(e<0);e--){3!==a||s&&0===e||(l.unshift(i),a=0);const t=r.charAt(e);l.unshift(t),o?a+=1:"."===t&&(o=!0)}n&&(l.unshift("("),l.push(")")),r=l.join("")}else n&&(r="("+r+")");return r};var _i={};_i=function(e,t,i,s,n){if(!At.number(e))return"";if(!At.number(t))return"";if(!At.number(i))return"";(!At.string(s)||s.length>1)&&(s=".");const r=Math.abs(e),o=function(e,t){const i=Math.floor(e);return 0===i&&""===t?"":i}(r,s),a=function(e){return e-Math.floor(e)}(r)*t,l=function(e,t){return["000",Math.floor(e)].join("").substr(-1*t)}(Math.floor(parseFloat(a.toFixed(1))),i);let c,u;return e<0?(n=At.boolean(n)&&n)?(c="(",u=")"):(c="-",u=""):(c="",u=""),[c,o,s,l,u].join("")};var Mi={},Li={},Oi={};!function(e){var t,i=1e6,s=1e6,n="[big.js] ",r=n+"Invalid ",o=r+"decimal places",a=r+"rounding mode",l=n+"Division by zero",c={},u=void 0,h=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function d(e,t,i,s){var n=e.c;if(i===u&&(i=e.constructor.RM),0!==i&&1!==i&&2!==i&&3!==i)throw Error(a);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]!==u))),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]!==u||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 p(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}c.abs=function(){var e=new this.constructor(this);return e.s=1,e},c.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},c.div=function(e){var t=this,s=t.constructor,n=t.c,r=(e=new s(e)).c,a=t.s==e.s?1:-1,c=s.DP;if(c!==~~c||c<0||c>i)throw Error(o);if(!r[0])throw Error(l);if(!n[0])return e.s=a,e.c=[e.e=0],e;var h,p,f,m,g,y=r.slice(),T=h=r.length,S=n.length,A=n.slice(0,h),v=A.length,P=e,C=P.c=[],b=0,E=c+(P.e=t.e-e.e)+1;for(P.s=a,a=E<0?0:E,y.unshift(0);v++<h;)A.push(0);do{for(f=0;f<10;f++){if(h!=(v=A.length))m=h>v?1:-1;else for(g=-1,m=0;++g<h;)if(r[g]!=A[g]){m=r[g]>A[g]?1:-1;break}if(!(m<0))break;for(p=v==h?r:y;v;){if(A[--v]<p[v]){for(g=v;g&&!A[--g];)A[g]=9;--A[g],A[v]+=10}A[v]-=p[v]}for(;!A[0];)A.shift()}C[b++]=m?f:++f,A[0]&&m?A[v]=n[T]||0:A=[n[T]]}while((T++<S||A[0]!==u)&&a--);return C[0]||1==b||(C.shift(),P.e--,E--),b>E&&d(P,E,s.RM,A[0]!==u),P},c.eq=function(e){return 0===this.cmp(e)},c.gt=function(e){return this.cmp(e)>0},c.gte=function(e){return this.cmp(e)>-1},c.lt=function(e){return this.cmp(e)<0},c.lte=function(e){return this.cmp(e)<1},c.minus=c.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},c.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(l);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)))},c.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},c.plus=c.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},c.pow=function(e){var t=this,i=new t.constructor("1"),n=i,o=e<0;if(e!==~~e||e<-1e6||e>s)throw Error(r+"exponent");for(o&&(e=-e);1&e&&(n=n.times(t)),e>>=1;)t=t.times(t);return o?i.div(n):n},c.prec=function(e,t){if(e!==~~e||e<1||e>i)throw Error(r+"precision");return d(new this.constructor(this),e,t)},c.round=function(e,t){if(e===u)e=0;else if(e!==~~e||e<-i||e>i)throw Error(o);return d(new this.constructor(this),e+this.e+1,t)},c.sqrt=function(){var e,t,i,s=this,r=s.constructor,o=s.s,a=s.e,l=new r("0.5");if(!s.c[0])return new r(s);if(o<0)throw Error(n+"No square root");0===(o=Math.sqrt(+p(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 r(((o=Math.sqrt(t))==1/0?"5e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+a)):e=new r(o+""),a=e.e+(r.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 d(e,(r.DP-=4)+e.e+1,r.RM)},c.times=c.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},c.toExponential=function(e,t){var s=this,n=s.c[0];if(e!==u){if(e!==~~e||e<0||e>i)throw Error(o);for(s=d(new s.constructor(s),++e,t);s.c.length<e;)s.c.push(0)}return p(s,!0,!!n)},c.toFixed=function(e,t){var s=this,n=s.c[0];if(e!==u){if(e!==~~e||e<0||e>i)throw Error(o);for(e=e+(s=d(new s.constructor(s),e+s.e+1,t)).e+1;s.c.length<e;)s.c.push(0)}return p(s,!1,!!n)},c.toJSON=c.toString=function(){var e=this,t=e.constructor;return p(e,e.e<=t.NE||e.e>=t.PE,!!e.c[0])},c.toNumber=function(){var e=+p(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(n+"Imprecise conversion");return e},c.toPrecision=function(e,t){var s=this,n=s.constructor,o=s.c[0];if(e!==u){if(e!==~~e||e<1||e>i)throw Error(r+"precision");for(s=d(new n(s),e,t);s.c.length<e;)s.c.push(0)}return p(s,e<=s.e||s.e<=n.NE||s.e>=n.PE,!!o)},c.valueOf=function(){var e=this,t=e.constructor;if(!0===t.strict)throw Error(n+"valueOf disallowed");return p(e,e.e<=t.NE||e.e>=t.PE,!0)},t=function e(){function t(i){var s=this;if(!(s instanceof t))return i===u?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(r+"value");i=0===i&&1/i<0?"-0":String(i)}!function(e,t){var i,s,n;if(!h.test(t))throw Error(r+"number");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);for(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=c,t.DP=20,t.RM=1,t.NE=-7,t.PE=21,t.strict=false,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}(),t.default=t.Big=t,"function"==typeof define&&define.amd?define((function(){return t})):Oi?Oi=t:e.Big=t}(Oi),Li=(()=>{class e{constructor(e){this._big=a(e)}add(t){return new e(this._big.plus(a(t)))}subtract(t){return new e(this._big.minus(a(t)))}multiply(t){return new e(this._big.times(a(t)))}divide(t){return new e(this._big.div(a(t)))}raise(t){return Pt.argumentIsRequired(t,"exponent",Number),new e(this._big.pow(t))}round(t,i){Pt.argumentIsRequired(t,"places",Number),Pt.argumentIsOptional(i,"mode",l,"RoundingMode");const s=i||l.NORMAL;return new e(this._big.round(t,s.value))}mod(t){return new e(this._big.mod(a(t)))}absolute(){return new e(this._big.abs())}opposite(){return this.multiply(-1)}getIsZero(e,i){return Pt.argumentIsOptional(e,"approximate",Boolean),Pt.argumentIsOptional(i,"places",Number),this._big.eq(t)||At.boolean(e)&&e&&this.round(i||Oi.DP,l.NORMAL).getIsZero()}getIsPositive(){return this._big.gt(t)}getIsNegative(){return this._big.lt(t)}getIsGreaterThan(e){return this._big.gt(a(e))}getIsGreaterThanOrEqual(e){return this._big.gte(a(e))}getIsLessThan(e){return this._big.lt(a(e))}getIsLessThanOrEqual(e){return this._big.lte(a(e))}getIsBetween(e,t,i){return Pt.argumentIsOptional(i,"exclusive",Boolean),At.boolean(i)&&i?this.getIsGreaterThan(e)&&this.getIsLessThan(t):this.getIsGreaterThanOrEqual(e)&&this.getIsLessThanOrEqual(t)}getIsEqual(e){return this._big.eq(a(e))}getIsApproximate(t,i){if(0===i)return this.getIsEqual(t);const s=this.subtract(t).absolute(),n=e.ONE.divide(new e(10).raise(i));return s.getIsLessThan(n)}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(e){return Pt.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 Pt.argumentIsRequired(t,"value",e,"Decimal"),new e(t._big)}static parse(t){return new e(t)}static get ZERO(){return n}static get ONE(){return r}static get NEGATIVE_ONE(){return o}static get ROUNDING_MODE(){return l}static getIsZero(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsZero()}static getIsNotZero(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),!t.getIsZero()}static getIsPositive(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()}static getIsNotPositive(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()||t.getIsZero()}static getIsNegative(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsNegative()}static getIsNotNegative(t){return Pt.argumentIsRequired(t,"instance",e,"Decimal"),t.getIsPositive()||t.getIsZero()}static compareDecimals(t,i){return Pt.argumentIsRequired(t,"a",e,"Decimal"),Pt.argumentIsRequired(i,"b",e,"Decimal"),t._big.gt(i._big)?1:t._big.lt(i._big)?-1:0}toString(){return"[Decimal]"}}const t=new Oi(0),i=new Oi(1),s=new Oi(-1),n=new e(t),r=new e(i),o=new e(s);function a(t){return t instanceof Oi?t:t instanceof e?t._big:new Oi(t)}class l extends bt{constructor(e,t){super(e.toString(),t),this._value=e}get value(){return this._value}static get UP(){return c}static get DOWN(){return u}static get NORMAL(){return h}toString(){return"[RoundingMode]"}}const c=new l(3,"up"),u=new l(0,"down"),h=new l(1,"normal");return e})(),Mi=(()=>{class e extends bt{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(e){Pt.argumentIsValid(e,"tickIncrement",At.integer,"must be an integer");const t=new Li(1),i=new Li(10);let s;s=this.supportsFractions?t.divide(this._fractionFactor):t.divide(i.raise(this._decimalDigits));return s.multiply(e).toFloat()}getMinimumTickValue(e,t){Pt.argumentIsValid(e,"tickIncrement",At.integer,"must be an integer"),Pt.argumentIsValid(t,"pointValue",At.number,"must be a number");return new Li(this.getMinimumTick(e)).multiply(t).toFloat()}roundToNearestTick(e,t,i){let s;Pt.argumentIsValid(e,"value",(e=>At.number(e)||e instanceof Li),"must be a number primitive or a Decimal instance"),Pt.argumentIsValid(t,"minimumTick",(e=>At.number(e)||e instanceof Li),"must be a number primitive or a Decimal instance"),Pt.argumentIsOptional(i,"roundToZero",Boolean),s=e instanceof Li?e:new Li(e);let n=s.divide(t);return s.mod(t).getIsZero()||(n=n.round(0,At.boolean(i)&&i?Li.ROUNDING_MODE.DOWN:Li.ROUNDING_MODE.NORMAL)),n.multiply(t).toFloat()}toString(){return`[UnitCode (code=${this.code})]`}static parse(t){return bt.fromCode(e,t)}static fromBaseCode(t){return bt.getItems(e).find((e=>e.baseCode===t))||null}}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);return e})(),bi=function(e,t,i,s,n,r){if(!At.number(e))return"";const o=Mi.parse(t);if(null===o)return"";if((!At.string(i)||i.length>1)&&(i="."),s=At.boolean(s)&&s,r=At.boolean(r)&&r,o.supportsFractions&&"."!==i){const t=o.getFractionFactor(s),n=o.getFractionDigits(s);return _i(e,t,n,i,r)}return Ei(e,o.decimalDigits,n,r)};var wi;wi=(()=>{const 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===Ct.FUTURE_OPTION){const i=s.root;if("ZB"===i||"ZN"===i||e.ZB.test(i)||e.ZN.test(i))return _i(t,64,2,"-",!1);if("ZT"===i||"ZF"===i||e.ZT.test(i)||e.ZF.test(i))return _i(t,640,3,"-",!1)}return bi(t,i,"-",!0,",")}})();const Ii=[{min:0,divider:1,suffix:"",decimals:0},{min:1e5,divider:1e3,suffix:"K",decimals:0},{min:1e6,divider:1e6,suffix:"M",decimals:2},{min:1e9,divider:1e9,suffix:"B",decimals:3}];function xi(e){if(Ze(e)){const t=nt(SP().config,null,"overrides","symbology","translateSymbol");if(Ze(t)&&"function"==typeof t)try{const i=t(e);if(Ze(i))return i}catch(t){dP(`Failed translating the symbol '${e}', error is ${t.message}`,"warn")}}return e}function Di(t,i,s){if(null==t)return"";if(!this.isReady)return t.toFixed(0);if(i.format===I.FromMetaData)return function(t,i,s){const n=SP().config;return n.mode===te[te.cmdtyView]&&null!=s?e(wi)(t,i,s):e(bi)(t,i,"-",n.isAlt64,",",!1)}(t,this.unitCode,this._profile);switch(i.format){case I.AsInteger:return t.toFixed();case I.UseMetricUnit:{s=s||{};const e=Object.assign({},{range:[t,t],allDigits:!1},s);if(s.allDigits)return Hi(t,0);Array.isArray(e.range)&&e.range.length||(e.range=[t,t]);const i=Math.max(Math.abs(e.range[0]),Math.abs(e.range[1])),n=function(e,t){const i=_e(e,t);return-1===i?null:e[i]}(Ii,(e=>i>e.min))||Ii[0];return`${(t/n.divider).toFixed(n.decimals)}${n.suffix}`}case I.AsPercent:return`${(100*t).toFixed(2)}%`;default:return""}}function Ni(e,t,i){const s=i?.overridePrecision;return Number.isFinite(s)&&s>=0?Hi(e,s):null}class Ri{name="";unitCode="";exchange="";pointValue=1;tickIncrement=1;symbolType="Unknown";expiration="";_minMovement=null;constructor(e){this.resolved=this.symbol=e,this.timeZone=si(xi(this.symbol)),this._profile=null}initialize(e){Bi(e)||at(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=Ni(e,0,i);return null!==s?s:Di.call(this,e,t,i)}parse(e){throw new Error("Not implemented yet")}getInlineMetadata(e){const t=ui(`#${Ci.INLINE_DATA_ELEMENT_ID}`);if(!Ze(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(!Yt(e))return e;const i=kt(e);return t.find((e=>kt(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 fP("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){dP(`Failed fetching the metadata for ${e}, error is ${t.message}`,"warn")}return{name:"",exchange:"",unitCode:"A",pointValue:1,tickIncrement:1}}}function Hi(t,i){return e(Ei)(t,i,",",!1)}function Vi(e,t=!1){return new ji(e,t)}class Fi extends Ri{shutdown(){}async ready(){return Ai.call(this,(async()=>{const e=xi(this.symbol);let t=this.getInlineMetadata(e);return Bi(t)&&(t=await this.getFallbackMetadata(e)),this.initialize(t),!0}))}getCacheableEntities(e){e.add(this)}}function Bi(e){return!Xe(e)||!Ze(e.unitCode,e.name,e.exchange)||0===e.unitCode.length}class ki extends Ri{shutdown(){}equityOptionProfile(){return{name:this.symbol,exchange:"",unitCode:"A",pointValue:1,tickIncrement:1,symbolType:"EquityOption"}}async ready(){return Ai.call(this,(async()=>{const e=xi(this.symbol);if(Zt(e))return this.initialize(this.equityOptionProfile()),!0;const t=ti(e),i=await(t?Gt(e):e);this.resolved=ei(i);const[s,n]=await li(this.resolved),r=new Promise((e=>{setTimeout((()=>e(null)),Ci.META_DATA_GET_TIMETOUT)}));let o=await Promise.race([r,this.getProfile(s)]);return Bi(o)&&(o=this.getInlineMetadata(s)),Bi(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 Ui extends ki{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=SP(),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}}}let Wi;var $i;($i=Wi||(Wi={}))[$i.UNKNOWN_INSTRUMENT_TYPE=0]="UNKNOWN_INSTRUMENT_TYPE",$i[$i.FOREX=1]="FOREX",$i[$i.INDEX=2]="INDEX",$i[$i.EQUITY=3]="EQUITY",$i[$i.FUTURE=4]="FUTURE",$i[$i.OPTION=5]="OPTION",$i[$i.SPREAD=6]="SPREAD",$i[$i.MUTUAL_FUND=7]="MUTUAL_FUND",$i[$i.MONEY_MARKET_FUND=8]="MONEY_MARKET_FUND",$i[$i.USER_DEFINED_SPREAD=9]="USER_DEFINED_SPREAD",$i[$i.EQUITY_OPTION=10]="EQUITY_OPTION",$i[$i.OTHER=99]="OTHER",$i[$i.UNRECOGNIZED=-1]="UNRECOGNIZED";class Gi extends ki{_profileSource=new vi;priceDenominator=1;quantityDenominator=1;priceScaling=1;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 Wi.EQUITY:return"Equity";case Wi.FUTURE:return"Future";case Wi.OPTION:return"FutureOption";case Wi.FOREX:return"Forex";case Wi.INDEX:return"Index";case Wi.EQUITY_OPTION:return"EquityOption";case Wi.UNKNOWN_INSTRUMENT_TYPE:case Wi.UNRECOGNIZED:case Wi.OTHER:default:return"Unknown"}}getFallbackApi(){return"getOFInstrumentDefinition"}processFallback(e){const t=e.definition;return t.instrumentType=Wi[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}const n=SP();return{symbolType:this.getType(e.instrumentType),pointValue:e.contractPointValue,tickIncrement:e.minimumPriceIncrement,exchange:n.exchanges.find((t=>t.exchangeId===e.exchangeId))?.code??"",name:e.description,unitCode:e.barchartBaseCode,timeZone:e.timeZoneName}}async getProfile(e){const t=SP(),i=await t.client.connection,s=await i.getInstrument(this.getRequest(e));return s.length<1?null:this.getProfileFromInstrumentDefinition(s[0])}}class zi{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=Ni(e,0,i);return null!==s?s:Hi(e,this._decimals)}getCacheableEntities(e){}}class Yi{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?"":Ze(e)?e.toFixed(0):""}getCacheableEntities(e){}}class ji{unitCode="";pointValue=1;tickIncrement=1;minMovement=0;symbol="";symbolType="Unknown";resolved="";name="";exchange="";constructor(e,t=!1){const i=SP().getMetaDataSource();this.inner=e.map((e=>i.getMetaData(e))),this.forceDecimals=t}get isReady(){return null!=this.unitCode}async ready(){return Ai.call(this,(async()=>{const e=(await Promise.all(this.inner.map((e=>e.ready())))).every(Te);if(e){const e=e=>parseInt(e,16),t=t=>e(t.unitCode),{yes:i,no:s}=be(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=Ni(e,0,i);return null!==s?s:Di.call(this,e,t,i)}getCacheableEntities(e){this.inner.forEach((t=>e.add(t)))}shutdown(){}}class Ki{constructor(){this.metaDataCache=new Map}getMetaData(e){if(e===Ci.PLACEHOLDER_SYMBOL_NAME)return new Yi;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 qi extends Ki{metaDataCreator(e){return new Fi(e)}}class Xi extends Ki{metaDataCreator(e){return new Ui(e)}}class Zi extends Ki{metaDataCreator(e){return new Gi(e)}}const Ji=/^#([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/,Qi=/^rgb\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*)\)$/,es=/^rgba\((\s*\d{1,3}\s*),(\s*\d{1,3}\s*),(\s*\d{1,3}\s*),\s*([01]+(?:\.\d+)?)\)$/,ts={r:255,g:255,b:255,a:1},is={r:0,g:0,b:0,a:1};function ss(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function ns(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 rs(e,t){return{x:e.x-t.x,y:e.y-t.y}}function os(e,t){return{x:e.x+t.x,y:e.y+t.y}}function as(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function ls(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 cs(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(Te)}function us(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)}`}(gs(e))}function hs(e,t){const i=gs(e);return i.a=t,Ss(i)}function ds(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 ps=e=>{const t=gs(e);return Ss(ds(function({r:e,g:t,b:i,a:s}){return{r:255-e,g:255-t,b:255-i,a:s}}(t),t,.7))},fs=(e,t=!1)=>ye(gs,(i=>ds(i,is,e,t)),Ss);function ms(e,t=!1){return ye(gs,(i=>ds(i,ts,e,t)),Ss)}function gs(e){if(["r","g","b","a"].map((t=>e[t])).every((e=>Ze(e))))return e;const t=Ze(e.linearGradient)?e._refColor:e,i=Ji.exec(t);if(null!==i){const e=Ze(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=es.exec(t),i=Qi.exec(t),s=(e,t)=>Ze(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 ys(e){const{r:t,g:i,b:s}=gs(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 Ts(e){return ys(e)>66.66?"#000":"#fff"}function Ss(e){return`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`}function As(e,t){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),e.clip()}class vs{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 vs(this.x,this.y,this.width,this.height)}}class Ps{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 Cs(e,t){e.moveTo(t.x,t.y)}function bs(e,t){e.lineTo(t.x,t.y)}function Es(e,t,i){e.rect(t.x,t.y,i.x-t.x,i.y-t.y)}function _s(e,t=Ci.LINE_HEIGHT_MULTIPLIER){return t*e.measureText("M").width}function Ms(e,t=!1,i=1){const s=Ls(e,t,i).y;return s-Math.sign(s)*Ci.DEFAULT_ADORN_OFFSET.y}function Ls(e,t=!1,i=1){const s={...Ci.DEFAULT_ADORN_OFFSET};return t&&(s.y=-(i*_s(e,1)+s.y)),s}function Os(e,t,i,s=z.Left){const n=Array.isArray(t)?t:[t],r=_s(e,1),o=Math.max(...n.map((t=>e.measureText(t).width))),a=r*n.length;let l=i.x;s===z.Right&&(l-=o),s===z.Center&&(l-=o/2);const c=i.y-r;return u=new vs(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 ws(e,t,i,s=z.Left,n,r){e.save();const o=Array.isArray(t)?t:[t],a=_s(e,1);if(Ze(r)){const n=Os(e,t,i,s);e.fillStyle=r,Is(e,n,!1)}Ze(n)&&(e.fillStyle=n);const l=i.x;let c=i.y;o.forEach((t=>{e.textAlign=z[s].toLowerCase(),e.fillText(t,l,c),c+=a})),e.restore()}function Is(e,t,i=!0){e.beginPath(),e.rect(t.x,t.y,t.width,t.height),i&&e.stroke(),e.fill()}function xs(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 Ds(e,{x:t,y:i},{x:s,y:n}){e.beginPath(),e.moveTo(t,i),e.lineTo(s,n),e.stroke()}function Ns(e,t,i,s){Ds(e,{x:t,y:i},{x:t,y:s})}function Rs(e,t,i,s){Ds(e,{x:i,y:t},{x:s,y:t})}function Hs(e,t,i){switch(t){case"zero":Vs(e,i,"0");break;case"one":Vs(e,i,"1");break;case"two":Vs(e,i,"2");break;case"three":Vs(e,i,"3");break;case"four":Vs(e,i,"4");break;case"five":Vs(e,i,"5");break;case"six":Vs(e,i,"6");break;case"seven":Vs(e,i,"7");break;case"eight":Vs(e,i,"8");break;case"nine":Vs(e,i,"9");break;case"question":Vs(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}=Fs(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}=Fs(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}=Fs(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}=Fs(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}=Fs(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}=Fs(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}=Bs(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}=Bs(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":Vs(e,i,"B");break;case"sell":Vs(e,i,"S")}}function Vs(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),xs(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 Fs(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 Bs(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 ks(){const e=SP().config.bypassSmoothing||!1;return{prolog:t=>{e&&t.translate(.5,.5)},adjust:t=>e?Je(t,0):t,epilog:t=>{e&&t.translate(-.5,-.5)}}}const Us=(e,t)=>!0,Ws=(e,t)=>e.map(((e,i)=>({shown:t(e,i),value:e,line:{width:1,color:$s(i),dashStyle:"Solid"}}))),$s=e=>Ve(Js,e),Gs=e=>e.filter((e=>e.shown)),zs={width:1,color:"#000",dashStyle:"Solid"},Ys={width:1,color:"rgba(136,136,136,0.75)",dashStyle:"Dash"},js={color:Ci.COLOR_TRANSPARENT},Ks={[Ci.AT_SINGLE_STYLE]:!0,[Ci.AT_SHOW_BACKGROUND]:!1};function qs(e,t){const i=rt(nt(e,zs,"annotationTraits","line")),s=rt(nt(e,Ys,"annotationTraits","line2")),n=rt(nt(e,js,"annotationTraits","fill")),r=An[t],o=r?.defaults||{};SP().config.colorfulAnnotations||(at(o,Ks),"GannBox"!==t&&"GannSquare"!==t||(o[Ci.AT_SHOW_BACKGROUND]=!0));const a=r?.editable.includes(Ci.AT_LINE_2),l=Ze(o[Ci.AT_LINE_2]),c={line:i,fill:n,...o};return a&&!l&&(c.line2=s),c}function Xs(e,t){Object.keys(t).forEach((i=>{i===Ci.LINE_DASH_PROP_NAME?e.setLineDash(t[i]):e[i]=t[i]}))}function Zs(e){const t=ye(gs,Ss);return{lineWidth:e.line.width,strokeStyle:t(e.line.color),fillStyle:t(e.fill.color),lineDash:cs(e.line.dashStyle)}}const Js=["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)"],Qs=[Ci.AT_LINE,Ci.AT_ALLOW_PRICES_CHANGE_UI],en=[Ci.AT_FILL,Ci.AT_ALLOW_PRICES_CHANGE_UI],tn=[Ci.AT_LINE,Ci.AT_FILL,Ci.AT_ALLOW_PRICES_CHANGE_UI],sn=[...tn,Ci.AT_FILL_TEXT],nn=[Ci.AT_TEXT_LINES,Ci.AT_FILL,Ci.AT_ALLOW_PRICES_CHANGE_UI],rn=[...Qs,Ci.AT_LINE_2,Ci.AT_SHOW_PRICES,Ci.AT_SHOW_LEVELS,Ci.AT_LEVELS_KIND,Ci.AT_LABELS,Ci.AT_EXTEND_LEFT,Ci.AT_EXTEND_RIGHT,Ci.AT_SHOW_TRENDLINE,Ci.AT_FACTORS,Ci.AT_PRICES_ON_SCALE,Ci.AT_REVERSE,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY,Ci.AT_LEVELS_RESPECT_LOG_SCALE],on=[-.618,-.236,0,.236,.382,.5,.618,.786,1,1.272,1.618,2.618,3.618,4.236],an=e=>({[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LEVELS_KIND]:Ci.AT_LEVELS_PERCENTS,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_EXTEND_LEFT]:!1,[Ci.AT_EXTEND_RIGHT]:!1,[Ci.AT_SHOW_TRENDLINE]:!0,[Ci.AT_FACTORS]:Ws(on.slice(2),((t,i)=>0<=t&&t<=e)),[Ci.AT_PRICES_ON_SCALE]:!1,[Ci.AT_REVERSE]:!1,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2,[Ci.AT_LEVELS_RESPECT_LOG_SCALE]:!1}),ln=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_SHOW_TRENDLINE,type:"bool"},{id:Ci.AT_LINE_2,type:"line",enabledIf:Ci.AT_SHOW_TRENDLINE},{id:Ci.AT_EXTEND_LEFT,type:"bool"},{id:Ci.AT_EXTEND_RIGHT,type:"bool"},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_REVERSE,type:"bool"},{id:Ci.AT_SHOW_PRICES,type:"bool"},{id:Ci.AT_PRICES_ON_SCALE,type:"bool"},{id:Ci.AT_SHOW_LEVELS,type:"bool"},{id:Ci.AT_LEVELS_KIND,type:"string",enum:[Ci.AT_LEVELS_PERCENTS,Ci.AT_LEVELS_VALUES],enabledIf:Ci.AT_SHOW_LEVELS},{id:Ci.AT_LABELS,type:"string",enum:[Ci.AT_LABELS_LEFT,Ci.AT_LABELS_CENTER,Ci.AT_LABELS_RIGHT]},{id:Ci.AT_LEVELS_RESPECT_LOG_SCALE,type:"bool"}],cn={[Ci.AT_LINE]:{color:"#3861f6",width:1,dashStyle:"Solid"},[Ci.AT_FILL]:{color:"rgba(56, 97, 246, 0.2)"},[Ci.AT_FILL_TEXT]:{color:"#f0f0f0"},[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},un=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_FILL,type:"color"},{id:Ci.AT_FILL_TEXT,type:"color"}],hn=[0,.25,.382,.5,.618,.75,1],dn=[8,4,3,2,1].map((e=>`1/${e}`)).concat([2,3,4,8].map((e=>`${e}/1`))),pn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_SHOW_PRICES,type:"bool"},{id:Ci.AT_RATIO,type:"bool"},{id:Ci.AT_SHOW_PERCENTDIFF,type:"bool"},{id:Ci.AT_SHOW_BARCOUNT,type:"bool"},{id:Ci.AT_EXTEND_PT_1,type:"bool"},{id:Ci.AT_EXTEND_PT_2,type:"bool"},{id:Ci.AT_MARKER,type:"object",properties:[{id:Ci.AT_KIND,type:"string",enum:[Ci.AT_ARROW]},{id:Ci.AT_VERTEX,type:"string",enum:[Ci.AT_VERTEX_NONE,Ci.AT_VERTEX_START,Ci.AT_VERTEX_END,Ci.AT_VERTEX_BOTH]}]}],fn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"}],mn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_FILL,type:"color"}],gn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_FILL,type:"color"},{id:Ci.AT_FILL2,type:"color"},{id:Ci.AT_FILL_TEXT,type:"color"},{id:Ci.AT_COMPACT,type:"bool"},{id:Ci.AT_ACCOUNT_SIZE,type:"number"},{id:Ci.AT_RISK,type:"number"},{id:Ci.AT_RISK_IS_PERCENT,type:"bool"}],yn=[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_FILL,type:"color"}],Tn={[Ci.AT_KIND]:Ci.AT_ARROW,[Ci.AT_VERTEX]:Ci.AT_VERTEX_NONE},Sn=[Ci.AT_LINE,Ci.AT_RATIO,Ci.AT_SHOW_PRICES,Ci.AT_ALLOW_PRICES_CHANGE_UI,Ci.AT_SHOW_BARCOUNT,Ci.AT_SHOW_PERCENTDIFF,Ci.AT_EXTEND_PT_1,Ci.AT_EXTEND_PT_2,Ci.AT_MARKER],An={Line:{editable:Sn,defaults:{[Ci.AT_SHOW_PRICES]:!1,[Ci.AT_SHOW_BARCOUNT]:!1,[Ci.AT_SHOW_PERCENTDIFF]:!1,[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!1,[Ci.AT_MARKER]:Tn,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:pn,numPoints:2},Ray:{editable:Sn,defaults:{[Ci.AT_SHOW_PRICES]:!1,[Ci.AT_SHOW_BARCOUNT]:!1,[Ci.AT_SHOW_PERCENTDIFF]:!1,[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!0,[Ci.AT_MARKER]:Tn,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:pn,numPoints:2},VerticalLine:{editable:[Ci.AT_LINE,Ci.AT_SHOW_TIMESTAMPS,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_SHOW_TIMESTAMPS]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_SHOW_TIMESTAMPS,type:"bool"}],numPoints:1},HorizontalLine:{editable:[Ci.AT_LINE,Ci.AT_SHOW_PRICES,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_SHOW_PRICES,type:"bool"}],numPoints:1},TrendChannel:{editable:[...Qs,Ci.AT_EXTEND_PT_1,Ci.AT_EXTEND_PT_2],defaults:{[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!1,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[...fn,{id:Ci.AT_EXTEND_PT_1,type:"bool"},{id:Ci.AT_EXTEND_PT_2,type:"bool"}],numPoints:3},GannLine:{editable:Sn,defaults:{[Ci.AT_SHOW_PRICES]:!1,[Ci.AT_SHOW_BARCOUNT]:!1,[Ci.AT_SHOW_PERCENTDIFF]:!1,[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!0,[Ci.AT_MARKER]:Tn,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:pn,numPoints:2},SpeedResistanceArcs:{editable:Qs,types:fn,numPoints:2},SpeedResistanceFan:{editable:Qs,types:fn,numPoints:2},AndrewsPitchfork:{editable:Qs,types:fn,numPoints:3},Rectangle:{editable:tn,types:mn,numPoints:2},Ellipse:{editable:tn,types:mn,numPoints:2},DateRange:{editable:sn,defaults:cn,types:un,numPoints:2},PriceRange:{editable:sn,defaults:cn,types:un,numPoints:2},DatePriceRange:{editable:[...sn,Ci.AT_DRAW_BORDER],defaults:{...cn,[Ci.AT_DRAW_BORDER]:!1},types:[...un,{id:Ci.AT_DRAW_BORDER,type:"bool"}],numPoints:2},GannBox:{editable:[Ci.AT_LINE,Ci.AT_LINE_2,Ci.AT_ALLOW_PRICES_CHANGE_UI,Ci.AT_PRICE_LEVELS,Ci.AT_TIME_LEVELS,Ci.AT_SHOW_LEFT_LABELS,Ci.AT_SHOW_RIGHT_LABELS,Ci.AT_SHOW_TOP_LABELS,Ci.AT_SHOW_BOTTOM_LABELS,Ci.AT_SHOW_ANGLES,Ci.AT_REVERSE,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_LINE]:{color:"#33776b",width:1,dashStyle:"Solid"},[Ci.AT_LINE_2]:{color:"#33776b",width:1,dashStyle:"Solid"},[Ci.AT_PRICE_LEVELS]:Ws(hn,Us),[Ci.AT_TIME_LEVELS]:Ws(hn,Us),[Ci.AT_SHOW_LEFT_LABELS]:!0,[Ci.AT_SHOW_RIGHT_LABELS]:!0,[Ci.AT_SHOW_TOP_LABELS]:!0,[Ci.AT_SHOW_BOTTOM_LABELS]:!0,[Ci.AT_SHOW_ANGLES]:!1,[Ci.AT_REVERSE]:!1,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_PRICE_LEVELS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_LEFT_LABELS,type:"bool"},{id:Ci.AT_SHOW_RIGHT_LABELS,type:"bool"},{id:Ci.AT_TIME_LEVELS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_TOP_LABELS,type:"bool"},{id:Ci.AT_SHOW_BOTTOM_LABELS,type:"bool"},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_REVERSE,type:"bool"},{id:Ci.AT_SHOW_ANGLES,type:"bool"},{id:Ci.AT_LINE_2,type:"line",enabledIf:Ci.AT_SHOW_ANGLES}],numPoints:2},GannSquare:{editable:[...Qs,Ci.AT_LEVELS,Ci.AT_FANS,Ci.AT_ARCS,Ci.AT_REVERSE,Ci.AT_SHOW_RANGES_RATIO,Ci.AT_PRICE_BAR_RATIO,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_LINE]:{color:"#712b9c",width:1,dashStyle:"Solid"},[Ci.AT_LEVELS]:Ws([0,1,2,3,4,5],Us),[Ci.AT_FANS]:Ws(["8x1","5x1","4x1","3x1","2x1","1x1","1x2","1x3","1x4","1x5","1x8"],((e,t)=>t>3&&t<7)),[Ci.AT_ARCS]:Ws(["1x0","1x1","1.5x0","2x0","2x1","3x0","3x1","4x0","4x1","5x0","5x1"],Us),[Ci.AT_REVERSE]:!1,[Ci.AT_SHOW_RANGES_RATIO]:!0,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_LEVELS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"string",editable:!1,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_FANS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"string",editable:!1,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_ARCS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"string",editable:!1,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_REVERSE,type:"bool"},{id:Ci.AT_PRICE_BAR_RATIO,type:"number",editable:!0},{id:Ci.AT_SHOW_RANGES_RATIO,type:"bool"}],numPoints:2},LongPosition:{editable:[Ci.AT_LINE,Ci.AT_FILL,Ci.AT_FILL2,Ci.AT_FILL_TEXT,Ci.AT_COMPACT,Ci.AT_ACCOUNT_SIZE,Ci.AT_RISK,Ci.AT_RISK_IS_PERCENT,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_FILL]:{color:"rgba(0, 160, 0, 0.2)"},[Ci.AT_FILL2]:{color:"rgba(205, 0, 0, 0.2)"},[Ci.AT_FILL_TEXT]:{color:"#fff"},[Ci.AT_COMPACT]:!1,[Ci.AT_ACCOUNT_SIZE]:1e3,[Ci.AT_RISK]:25,[Ci.AT_RISK_IS_PERCENT]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:gn,numPoints:4},ShortPosition:{editable:[Ci.AT_LINE,Ci.AT_FILL,Ci.AT_FILL2,Ci.AT_FILL_TEXT,Ci.AT_COMPACT,Ci.AT_ACCOUNT_SIZE,Ci.AT_RISK,Ci.AT_RISK_IS_PERCENT,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_FILL]:{color:"rgba(205, 0, 0, 0.2)"},[Ci.AT_FILL2]:{color:"rgba(0, 160, 0, 0.2)"},[Ci.AT_FILL_TEXT]:{color:"#fff"},[Ci.AT_COMPACT]:!1,[Ci.AT_ACCOUNT_SIZE]:1e3,[Ci.AT_RISK]:25,[Ci.AT_RISK_IS_PERCENT]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:gn,numPoints:4},FiftyPercentLine:{editable:[Ci.AT_USE_52WEEK_PRICES,Ci.AT_LINE,Ci.AT_LINE_2,Ci.AT_SHOW_PRICES,Ci.AT_ALLOW_PRICES_CHANGE_UI],defaults:{[Ci.AT_USE_52WEEK_PRICES]:!1,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_USE_52WEEK_PRICES,type:"bool"},{id:Ci.AT_LINE,type:"line"},{id:Ci.AT_LINE_2,type:"line"},{id:Ci.AT_SHOW_PRICES,type:"bool"}],numPoints:2},FibonacciRetracement:{editable:rn,defaults:an(1),types:ln,numPoints:2},TrendBasedFibExtension:{editable:rn,defaults:an(5),types:ln,numPoints:3},FibonacciFan:{editable:[...Qs,Ci.AT_SHOW_LEVELS,Ci.AT_LABELS,Ci.AT_FACTORS,Ci.AT_REVERSE,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_REVERSE]:!1,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2,[Ci.AT_FACTORS]:Ws(on.slice(2),((e,t)=>t>=0&&t<=6))},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_LEVELS,type:"bool"},{id:Ci.AT_LABELS,type:"string",enum:[Ci.AT_LABELS_LEFT,Ci.AT_LABELS_CENTER,Ci.AT_LABELS_RIGHT]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_REVERSE,type:"bool"}],numPoints:2},FibonacciArcs:{editable:[...Qs,Ci.AT_LINE_2,Ci.AT_SHOW_TRENDLINE,Ci.AT_FACTORS,Ci.AT_SHOW_LEVELS,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_TRENDLINE]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2,[Ci.AT_FACTORS]:Ws(on.slice(2),((e,t)=>t>=0&&t<=6))},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_SHOW_TRENDLINE,type:"bool"},{id:Ci.AT_LINE_2,type:"line",enabledIf:Ci.AT_SHOW_TRENDLINE},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},FibonacciChannel:{editable:[...Qs,Ci.AT_SHOW_PRICES,Ci.AT_SHOW_LEVELS,Ci.AT_LEVELS_KIND,Ci.AT_LABELS,Ci.AT_EXTEND_PT_1,Ci.AT_EXTEND_PT_2,Ci.AT_FACTORS,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LEVELS_KIND]:Ci.AT_LEVELS_PERCENTS,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_EXTEND_PT_1]:!1,[Ci.AT_EXTEND_PT_2]:!1,[Ci.AT_FACTORS]:Ws(on.slice(2),Us),[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_EXTEND_PT_1,type:"bool"},{id:Ci.AT_EXTEND_PT_2,type:"bool"},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_SHOW_PRICES,type:"bool"},{id:Ci.AT_SHOW_LEVELS,type:"bool"},{id:Ci.AT_LEVELS_KIND,type:"string",enum:[Ci.AT_LEVELS_PERCENTS,Ci.AT_LEVELS_VALUES],enabledIf:Ci.AT_SHOW_LEVELS},{id:Ci.AT_LABELS,type:"string",enum:[Ci.AT_LABELS_LEFT,Ci.AT_LABELS_CENTER,Ci.AT_LABELS_RIGHT]}],numPoints:3},GannFan:{editable:[...Qs,Ci.AT_ANGLES,Ci.AT_SHOW_LEVELS,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2,[Ci.AT_ANGLES]:Ws(dn,Us)},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_ANGLES,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"string",editable:!1,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_SHOW_LEVELS,type:"bool"}],numPoints:2},SymbolArrowUp:{editable:en,types:yn,numPoints:1},SymbolArrowDown:{editable:en,types:yn,numPoints:1},SymbolArrowRight:{editable:en,types:yn,numPoints:1},SymbolArrowLeft:{editable:en,types:yn,numPoints:1},SymbolArrowHorizontal:{editable:en,types:yn,numPoints:1},SymbolArrowVertical:{editable:en,types:yn,numPoints:1},SymbolArcDown:{editable:en,types:yn,numPoints:1},SymbolArcUp:{editable:en,types:yn,numPoints:1},SymbolThumbsUp:{editable:en,types:yn,numPoints:1},SymbolThumbsDown:{editable:en,types:yn,numPoints:1},SymbolZero:{editable:en,types:yn,numPoints:1},SymbolOne:{editable:en,types:yn,numPoints:1},SymbolTwo:{editable:en,types:yn,numPoints:1},SymbolThree:{editable:en,types:yn,numPoints:1},SymbolFour:{editable:en,types:yn,numPoints:1},SymbolFive:{editable:en,types:yn,numPoints:1},SymbolSix:{editable:en,types:yn,numPoints:1},SymbolSeven:{editable:en,types:yn,numPoints:1},SymbolEight:{editable:en,types:yn,numPoints:1},SymbolNine:{editable:en,types:yn,numPoints:1},SymbolQuestion:{editable:en,types:yn,numPoints:1},SymbolFishHook:{editable:en,types:yn,numPoints:1},SymbolBuy:{editable:en,types:yn,numPoints:1},SymbolSell:{editable:en,types:yn,numPoints:1},FibonacciTimeZones:{editable:[...Qs,Ci.AT_FACTORS,Ci.AT_SHOW_LEVELS,Ci.AT_LABELS,Ci.AT_SINGLE_STYLE,Ci.AT_SHOW_BACKGROUND,Ci.AT_BACKGROUND_OPACITY],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!0,[Ci.AT_FACTORS]:Ws([0,1,2,3,5,8,13,21,34,55,89,144],Us),[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_SINGLE_STYLE]:!1,[Ci.AT_SHOW_BACKGROUND]:!0,[Ci.AT_BACKGROUND_OPACITY]:.2},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_SINGLE_STYLE,type:"bool"},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SINGLE_STYLE},{id:Ci.AT_FACTORS,type:"array",items:{ref:Ci.AT_FACTOR_ITEM}},{id:Ci.AT_FACTOR_ITEM,type:"object",properties:[{id:Ci.AT_SHOWN,type:"bool",label:!1},{id:Ci.AT_VALUE,type:"number",editable:!0,enabledIf:Ci.AT_SHOWN},{id:Ci.AT_LINE,type:"line",enabledIf:Ci.AT_SHOWN}]},{id:Ci.AT_SHOW_BACKGROUND,type:"bool"},{id:Ci.AT_BACKGROUND_OPACITY,type:"number",min:0,max:1,enabledIf:Ci.AT_SHOW_BACKGROUND},{id:Ci.AT_SHOW_LEVELS,type:"bool"},{id:Ci.AT_LABELS,type:"string",enum:[Ci.AT_LABELS_LEFT,Ci.AT_LABELS_CENTER,Ci.AT_LABELS_RIGHT]}],numPoints:2},Text:{editable:nn,types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_TEXT_LINES,type:"array",items:{ref:Ci.AT_TEXT_ITEM}},{id:Ci.AT_TEXT_ITEM,type:"string"},{id:Ci.AT_FILL,type:"color"}],numPoints:2},ProfitLoss:{editable:[...tn,Ci.AT_SHOW_PRICES,Ci.AT_NUM_CONTRACTS,Ci.AT_POSITION,Ci.AT_PROFIT_LOSS],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!1,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_NUM_CONTRACTS]:1,[Ci.AT_POSITION]:Ci.AT_POSITION_LONG,[Ci.AT_PROFIT_LOSS]:void 0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_PROFIT_LOSS,type:"number",editable:!1},{id:Ci.AT_NUM_CONTRACTS,type:"number"},{id:Ci.AT_POSITION,type:"string",enum:[Ci.AT_POSITION_SHORT,Ci.AT_POSITION_LONG]},...mn,{id:Ci.AT_SHOW_PRICES,type:"bool"}],numPoints:2},RewardRisk:{editable:[...tn,Ci.AT_SHOW_PRICES,Ci.AT_NUM_CONTRACTS,Ci.AT_POSITION,Ci.AT_RISK,Ci.AT_REWARD,Ci.AT_RATIO],defaults:{[Ci.AT_ALLOW_PRICES_CHANGE_UI]:!1,[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_NUM_CONTRACTS]:1,[Ci.AT_POSITION]:Ci.AT_POSITION_LONG,[Ci.AT_RISK]:void 0,[Ci.AT_REWARD]:void 0,[Ci.AT_RATIO]:void 0},types:[{id:Ci.AT_ALLOW_PRICES_CHANGE_UI,type:"bool",hidden:!0},{id:Ci.AT_REWARD,type:"number",editable:!1},{id:Ci.AT_RISK,type:"number",editable:!1},{id:Ci.AT_RATIO,type:"number",editable:!1},{id:Ci.AT_NUM_CONTRACTS,type:"number"},{id:Ci.AT_POSITION,type:"string",enum:[Ci.AT_POSITION_SHORT,Ci.AT_POSITION_LONG]},...mn,{id:Ci.AT_SHOW_PRICES,type:"bool"}],numPoints:2}};function vn(e){return e?An[e].editable:An}var Pn;Pn=JSON.parse('{"$schema":"http://json-schema.org/draft-04/schema#","title":"JSON schema for Barchart HTML5 Charts","definitions":{"color":{"type":"string","pattern":"^(#([0-9a-fA-F]{3}){1,2})|(rgba\\\\((\\\\s*\\\\d{1,3}\\\\s*,){3}\\\\s*[01]+(\\\\.\\\\d+)?\\\\))|(rgb\\\\((\\\\s*\\\\d{1,3}\\\\s*)(,\\\\s*\\\\d{1,3}\\\\s*){2}\\\\))$"},"orientationChoice":{"type":"string","enum":["vertical","horizontal","both","none"]},"dashStyle":{"type":"string","enum":["Solid","ShortDash","ShortDot","ShortDashDot","ShortDashDotDot","SparseDot","Dot","Dash","LongDash","DashDot","LongDashDot","LongDashDotDot"]},"aggUnit":{"type":"string","enum":["Tick","Intraday","Day","Week","Month","Quarter","Year"]},"aggSpec":{"type":"string","enum":["None","Nearest","Continue","PerCount","PerVolume","PerRange","PerSeconds"]},"period":{"type":"string","pattern":"^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$"},"density":{"type":"integer","minimum":5},"precision":{"type":"integer","minimum":0},"curveAttr":{"type":"string","enum":["ChangeBased","OpenVsClose"]},"paddingPercent":{"type":"number","minimum":0.001,"maximum":0.999},"fundamental":{"type":"string","enum":["AccountsPayable","AccruedExpenses","Cash","CommonShares","DeferredIncomeTax","DeferredLongRevenues","EquityOtherInvestments","IncomeTaxPayable","Intangibles","Inventories","LongTermDebt","MarketableSec","OtherCurrentAssets","OtherCurrentLiabilities","OtherEquity","OtherNonCurrentAssets","OtherNonCurrentLiabilities","PpeNet","PrepaidExpenses","Receivables","RetainedEarnings","ShorttermDebt","TotalAssets","TotalCurrentAssets","TotalCurrentLiabilities","TotalLiabilities","TotalLiabilitiesAndEquity","TotalNonCurrentAssets","TotalNonCurrentLiabilities","TotalShareholdersEquity","BasicEpsContOp","BasicEpsTotalOp","CostGoods","DilutedEpsContOp","DilutedEpsTotalOp","Ebitda","GrossProfit","IncomeTax","InterestExpense","NetIncome","OperatingExpenses","OperatingIncome","OtherIncomeExpenses","PreTaxIncome","Sales"]},"studyField":{"type":"string","enum":["HL/2","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","ENVU","ENVD","ENVEXPU","ENVEXPD","ENVSMOU","ENVSMOD","SMA","TMA","WMA","VOLMA","OSC","VOSC","RSI","RSIAVG","STORSI","STORSIAVG","HH","LL","PercK","PercD","PercR","WGCL","BOLLBU","BOLLBL","BOLLBM","BOLLBW","BOLLBP","OBVOL","OBVOLAVG","ATR","ATRP","PDI","MDI","ADX","ADXM","ADL","ADWM","ADWMMA","CHAOSC","TP","KCUP","KCMID","KCLOW","KBUP","KBMID","KBLOW","KCEUP","KCEMID","KCELOW","DONUP","DONMID","DONLOW","DONW","PVT","ROC","TRIX","PVPT","PVPTR","PVPTS","ARNUP","ARNLOW","ARNOSC","TCHNUP","TCHNLOW","ALJAW","ALTEETH","ALLIPS","PLTLN","AWOS","AWOSMA","MFMUL","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","EMVMA","ERBLPOW","ERBRPOW","FI","MI","MOM","MOMMA","MFI","MSD","NVI","NVIEMA","PVI","PVIEMA","PPO","PPOS","PPOH","PVO","PVOS","PVOH","HV","PERF","WASI","WWVSARU","WWVSARD","PARSARS","PARSARL","MOVLR","TRSP1","TRSP2","PPTPIV","PPTR1","PPTR2","PPTR3","PPTS1","PPTS2","PPTS3","COTLCCMSP","COTLCLGSP","COTLCSMSP","COTDAGPRO","COTDAGSPD","COTDAGMNM","COTDAGOTH","COTFTRDLI","COTFTRASM","COTFTRLVF","COTFTROTH","TR","IMPVOL","CTM","CPMI","CTLTM","CTLTMF","DEMA","TEMA","TSI","TSISIG","ADJATR","COTR","GMMA3","GMMA5","GMMA8","GMMA10","GMMA12","GMMA15","GMMA30","GMMA35","GMMA40","GMMA45","GMMA50","GMMA60","MCGD","HMA","COPP","CPPH4","CPPH3","CPPH2","CPPH1","CPPL1","CPPL2","CPPL3","CPPL4","REATRHI","REATRLO","BREL","LINRUP","LINRMID","LINRLOW","CSHO","CSHB","CTPI","TCHRE","PCTCHG","ATRMA","STOMOMIX","CHDMOMOSC","VSTOPUP","VSTOPLOW","SUPTR","BARCOLIX","BARKIND","CONVLN","BASELN","LEADSP1","LEADSP2","LAGGSP","VWAP","VWAPSD1U","VWAPSD1L","VWAPSD2U","VWAPSD2L","PLVI","MNVI","DIFA","DOSCH","DOSCS","BOLLSQ","TTMSQZON","TTMSQZOFF","TTMSQZOSC","CRS","CRSAVG","JPIB","JPIS","DRS","MRS","PMO","PMOS","RVOL","WGALPH","UPVOL","DNVOL","TOTVOL","AVWAP","KST","KSTSIG","STC","MCCLO","NHLAI","CMBCI","CMBCIF","CMBCIS","COTI","CHEXL","CHEXS","MBBUO","MBBUI","MBBM","MBBLI","MBBLO","CHOP","MACLD1","MACLD2","BTI","PCUP1","PCDN1","PCUP2","PCDN2","PCUP3","PCDN3","PCTD","PCTP"]},"generalField":{"type":"string","enum":["DateTime","Open","High","Low","Close","TradeSize","Volume","OpenInterest","Last","Symbol","Change","PercentChange","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","VOL","MAENV","MAENVEXP","MAENVSMO","MASMO","MATRI","MAWEI","MAVOL","OSCI","OSCIVOL","RSI","RSIMOD","RSISTO","STOCHF","STOCHS","WPERCR","HHLL","WGCL","BBANDS","BWIDTH","BPERC","BSQUEEZE","OBVOL","ATR","ATRP","ADX","ADXMOD","ADL","ADWM","CHAOSC","TP","KELCHN","KELEXP","KELBND","DONCHN","DONWIDTH","PVT","ROC","TRIX","PPMOV","ARNUPDW","ARNOSC","TCHN","ALLG","PLTLN","AWEOSC","CLV","CHAMF","CHAVOL","DPO","CCI","EMV","ERBLPOW","ERBRPOW","FI","MI","MOM","MFI","MSD","NVI","PVI","PPO","PVO","HV","PERF","WASI","WWVOL","PARTP","MOVLR","TRSP","COTLC","COTDAG","COTFTR","PIVPTS","IMPVOL","CTM","CPMI","DEMA","TEMA","TSI","ADJATR","COTR","GMMA","MCGD","HMA","COPP","CPP","REATRHI","REATRLO","LINRCHN","CSHO","CSHB","CTPI","TCHRE","PCTCHG","OPINT","STOMOMIX","CHDMOMOSC","VSTOP","SUPTR","ICHCLD","VWAP","VOIN","DIFA","DOSC","MARIB","HASMO","TTMSQZ","CRS","JPI","CTTP","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"]},"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"}}}]},"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"]},"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"}},"required":["value","line"]},"studyBands":{"type":"array","items":{"$ref":"#/definitions/studyBand"}},"studyBand":{"type":"object","additionalProperties":false,"properties":{"range":{"$ref":"#/definitions/range"},"fill":{"$ref":"#/definitions/fillTrait"}},"required":["range","fill"]},"studyType":{"type":"string","pattern":"Study"},"studyPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves"},"basis":{"type":"string","default":"$main"},"study":{"$ref":"#/definitions/study"},"source":{"$ref":"#/definitions/curveField"},"inputs":{"$ref":"#/definitions/inputs"},"type":{"$ref":"#/definitions/studyType"},"levels":{"$ref":"#/definitions/studyLevels"},"bands":{"$ref":"#/definitions/studyBands"},"detachedScale":{"type":"boolean"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["study","type"]},"exprType":{"type":"string","pattern":"Expression"},"exprPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"expression":{"type":"string"},"type":{"$ref":"#/definitions/exprType"},"main":{"type":"boolean","default":false},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["expression","type"]},"forwardType":{"type":"string","pattern":"Forward"},"intOffset":{"type":"integer","minimum":0,"multipleOf":1},"intOffsets":{"type":"array","minItems":1,"items":{"$ref":"#/definitions/intOffset"}},"forwardPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"forward":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/forwardType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["forward","type"]},"seasonalType":{"type":"string","pattern":"Seasonal"},"seasonalPlot":{"type":"object","additionalProperties":false,"properties":{"curves":{"$ref":"#/definitions/curves","default":[{"fields":["Close"],"style":"Line","lineWidth":2,"visible":true,"colors":["#888"],"varyColorPerBar":false}]},"seasonal":{"type":"string"},"offsets":{"$ref":"#/definitions/intOffsets","default":[0]},"usesInAverage":{"type":"array","minItems":0,"items":{"type":"boolean"},"default":[]},"main":{"type":"boolean","default":true},"type":{"$ref":"#/definitions/seasonalType"},"precision":{"$ref":"#/definitions/precision"},"visible":{"type":"boolean","default":true}},"required":["seasonal","type"]},"annPoint":{"type":"object","additionalProperties":false,"properties":{"price":{"type":"number"},"time":{"type":"number"}},"required":["price","time"]},"lineTrait":{"type":"object","additionalProperties":false,"properties":{"width":{"type":"number","minimum":0,"default":1},"color":{"$ref":"#/definitions/color","default":"#000"},"dashStyle":{"$ref":"#/definitions/dashStyle","default":"Solid"}}},"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":135,"multipleOf":1}},"required":["panes","version"]}');var Cn;Cn=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 bn;bn=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 En;En=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 _n;function Mn(t){switch(t){case Ci.CHART_SCHEMA:return e(Pn);case Ci.STUDIES_SCHEMA:return e(Cn);case Ci.FIELDS_SCHEMA:return e(bn);case Ci.ACCESSOR_SCHEMA:return e(En);default:throw new Error(`Unknown schema name: ${t}`)}}_n=JSON.parse('[{"id":"MA","meta":{"title":"Moving Average","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#808080"],"fields":["MA"]}]}},{"id":"CSHO","meta":{"title":"Cash Overlay","overlay":true},"defaults":{"source":"Symbol","curves":[{"colors":["#834c3f"],"fields":["CSHO"]}]}},{"id":"CSHB","meta":{"title":"Cash Basis","overlay":false},"defaults":{"source":"Symbol","curves":[{"colors":["#b2b900"],"fields":["CSHB"]}]}},{"id":"MAVOL","meta":{"title":"Volume Moving Average","overlay":false,"enumerations":[{"input":"BarColoring","values":["LikeMain","OpenToClose","CloseToClose"]}]},"defaults":{"source":"Volume","inputs":[{"name":"Period","value":10},{"name":"BarColoring","value":"LikeMain"}],"curves":[{"colors":["#9075d6"],"fields":["VOLMA"]},{"colors":["#ef4226","#00b04b","#1f4bb6"],"fields":["Volume"],"style":"Column","varyColorPerBar":true}]}},{"id":"OSCI","meta":{"title":"Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#ae272d"],"fields":["OSC"]}]}},{"id":"OSCIVOL","meta":{"title":"Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":5},{"name":"Period2","value":10}],"curves":[{"colors":["#9326ff"],"fields":["VOSC"]}]}},{"id":"MAENV","meta":{"title":"Moving Average Envelope","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVU"]},{"colors":["#25329b"],"fields":["ENVD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVU","ENVD"],"style":"Ribbon","lineWidth":0}]}},{"id":"LINRCHN","meta":{"title":"Linear Regression Channel","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":100},{"name":"Width","value":2}],"curves":[{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRUP"]},{"colors":["rgba(255, 0, 0, 0.3)"],"fields":["LINRMID"]},{"colors":["rgba(0, 0, 255, 0.3)"],"fields":["LINRLOW"]},{"colors":["rgba(0, 0, 255, 0.1)"],"fields":["LINRUP","LINRMID"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 0, 0, 0.1)"],"fields":["LINRMID","LINRLOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVEXP","meta":{"title":"Moving Average Envelope Exponential","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVEXPU"]},{"colors":["#25329b"],"fields":["ENVEXPD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVEXPU","ENVEXPD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAENVSMO","meta":{"title":"Moving Average Envelope Smoothed","overlay":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Percent","value":3}],"curves":[{"colors":["#2284dd"],"fields":["ENVSMOU"]},{"colors":["#25329b"],"fields":["ENVSMOD"]},{"colors":["rgba(37, 50, 155, 0.1)"],"fields":["ENVSMOU","ENVSMOD"],"style":"Ribbon","lineWidth":0}]}},{"id":"MAEXP","meta":{"title":"Moving Average Exponential","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","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","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","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","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":"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":"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","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Width","value":2},{"name":"Offset","value":0},{"name":"Source","value":"Close"}],"curves":[{"colors":["#9075d6"],"fields":["BOLLBU"]},{"colors":["#89211e"],"fields":["BOLLBM"]},{"colors":["#00aaab"],"fields":["BOLLBL"]},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["BOLLBU","BOLLBL"],"style":"Ribbon","lineWidth":0}]}},{"id":"MBBANDS","meta":{"title":"Modified Bollinger Bands","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"MultInside","value":3},{"name":"MultOutside","value":4},{"name":"Offset","value":0},{"name":"Source","value":"Close"}],"curves":[{"colors":["#9075d6"],"fields":["MBBUO"],"lineWidth":2},{"colors":["#9075d6"],"fields":["MBBUI"],"lineWidth":1},{"colors":["#89211e"],"fields":["MBBM"],"lineWidth":1},{"colors":["#00aaab"],"fields":["MBBLI"],"lineWidth":1},{"colors":["#00aaab"],"fields":["MBBLO"],"lineWidth":2},{"colors":["rgba(0, 170, 171, 0.1)"],"fields":["MBBUI","MBBLI"],"style":"Ribbon","lineWidth":0}]}},{"id":"BWIDTH","meta":{"title":"Bollinger Width","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#f18900"],"fields":["BOLLBW"]}]}},{"id":"BPERC","meta":{"title":"Bollinger Bands %B","decimals":4,"overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#138484"],"fields":["BOLLBP"]}],"levels":[{"value":0,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":1,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(19, 132, 132, 0.1)"},"range":{"from":0,"to":1}}]}},{"id":"OBVOL","meta":{"title":"On Balance Volume","overlay":false,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Average","value":"MA"},{"name":"Period","value":20}],"curves":[{"colors":["#2284dd"],"fields":["OBVOL"]},{"colors":["#896fc3"],"fields":["OBVOLAVG"]}]}},{"id":"ATR","meta":{"title":"Average True Range","overlay":false,"enumerations":[{"input":"Smoothing","values":["SMA","MA","EMA","WMA"]}]},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Smoothing","value":"SMA"},{"name":"Period2","value":20}],"curves":[{"colors":["#ffaf1c"],"fields":["ATR"]},{"colors":["#1c6cff"],"fields":["ATRMA"]}]}},{"id":"ATRP","meta":{"title":"Average True Range Percent","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","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"]}]}},{"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"]}]}},{"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},"defaults":{"inputs":[{"name":"Period","value":20}],"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":"KELEXP","meta":{"title":"Keltner Channel Exponential","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"colors":["#f18900"],"fields":["KCEUP"]},{"colors":["#2284dd"],"fields":["KCEMID"]},{"colors":["#480048"],"fields":["KCELOW"]},{"colors":["rgba(72, 0, 72, 0.1)"],"fields":["KCEUP","KCELOW"],"style":"Ribbon","lineWidth":0}]}},{"id":"KELBND","meta":{"title":"Keltner Bands","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Multiplier","value":2.5}],"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","HLC/3","OHLC/4","HLCC/4"]}]},"defaults":{"inputs":[{"name":"Period","value":15},{"name":"Source","value":"Close"},{"name":"Offset","value":0}],"curves":[{"colors":["#743800"],"fields":["DEMA"]}]}},{"id":"TEMA","meta":{"title":"Moving Average Exponential TEMA","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","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","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","overlay":false},"defaults":{"inputs":[{"name":"Period","value":20}],"curves":[{"style":"Area","colors":["rgba(252, 13, 27, 0.3)","rgba(0,0,0,0)","#7f8000","rgba(12, 50, 255, 0.3)"],"fields":["CCI"],"zones":[{"value":-100,"colors":1},{"value":100,"colors":2},{"colors":1}]}],"levels":[{"value":-100,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":0,"name":"Center","line":{"color":"#606060","dashStyle":"DashDot"}},{"value":100,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(127, 128, 0, 0)"},"range":{"from":-100,"to":100}}]}},{"id":"EMV","meta":{"title":"Ease Of Movement","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#9326ff"],"fields":["EMV"]},{"colors":["#808080"],"fields":["EMVMA"]}]}},{"id":"ERBLPOW","meta":{"title":"Elder Ray Bull Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#005716"],"fields":["ERBLPOW"],"style":"Column"}]}},{"id":"ERBRPOW","meta":{"title":"Elder Ray Bear Power","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#ae272d"],"fields":["ERBRPOW"],"style":"Column"}]}},{"id":"FI","meta":{"title":"Force Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":13}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","rgba(0, 176, 75, 0.3)"],"fields":["FI"],"style":"Area","zones":[{"value":0,"colors":1},{"colors":1}]}]}},{"id":"MI","meta":{"title":"Mass Index","overlay":false},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["MI"]}]}},{"id":"MOM","meta":{"title":"Momentum","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10},{"name":"Movement","value":20}],"curves":[{"colors":["#808080"],"fields":["MOM"]},{"colors":["#505050"],"fields":["MOMMA"]}],"levels":[{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"MFI","meta":{"title":"Money Flow Index","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#543daa"],"fields":["MFI"]}],"levels":[{"value":20,"name":"Oversold","line":{"color":"#787878","dashStyle":"Dash"}},{"value":50,"name":"Center","line":{"color":"rgba(120, 120, 120, 0.5)","dashStyle":"Dash"}},{"value":80,"name":"Overbought","line":{"color":"#787878","dashStyle":"Dash"}}],"bands":[{"fill":{"color":"rgba(126, 87, 194, 0.1)"},"range":{"from":20,"to":80}}]}},{"id":"MSD","meta":{"title":"Moving Standard Deviation","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":10}],"curves":[{"colors":["#0c32ff"],"fields":["MSD"]}]}},{"id":"PCTCHG","meta":{"title":"Percent Change","overlay":false},"defaults":{"source":"Close","curves":[{"colors":["#037d27"],"fields":["PCTCHG"]}]}},{"id":"NVI","meta":{"title":"Negative Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#480048"],"fields":["NVI"]},{"colors":["#7f8000"],"fields":["NVIEMA"]}]}},{"id":"PVI","meta":{"title":"Positive Volume Index","overlay":false},"defaults":{"inputs":[{"name":"Period","value":255}],"curves":[{"colors":["#00b04b"],"fields":["PVI"]},{"colors":["#005716"],"fields":["PVIEMA"]}]}},{"id":"PPO","meta":{"title":"Percentage Price Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"curves":[{"colors":["#808080"],"fields":["PPO"]},{"colors":["#bc41ce"],"fields":["PPOS"]},{"colors":["rgba(252, 13, 27, 0.3)","#fc0d1b","rgba(0, 176, 75, 0.3)","#00b04b"],"fields":["PPOH"],"style":"Column","varyColorPerBar":true}]}},{"id":"PVO","meta":{"title":"Percentage Volume Oscillator","overlay":false},"defaults":{"source":"Volume","inputs":[{"name":"Period1","value":12},{"name":"Period2","value":26},{"name":"Period3","value":9}],"curves":[{"colors":["#808080"],"fields":["PVO"]},{"colors":["#bc41ce"],"fields":["PVOS"]},{"colors":["#9075d6"],"fields":["PVOH"],"style":"Column"}]}},{"id":"HV","meta":{"title":"Historical Volatility","overlay":false,"decimals":2},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#7f8000"],"fields":["HV"]}]}},{"id":"PERF","meta":{"title":"Price Performance","overlay":false,"decimals":2,"enumerations":[{"input":"Anchor","values":["SeriesStart","VisibleStart"]}]},"defaults":{"source":"Close","inputs":[{"name":"Anchor","value":"SeriesStart"}],"curves":[{"colors":["#00aaab"],"fields":["PERF"]}]}},{"id":"WASI","meta":{"title":"Wilder Accumulative Swing Index","overlay":false},"defaults":{"inputs":[{"name":"Limit","value":3}],"curves":[{"colors":["#bc41ce"],"fields":["WASI"]}]}},{"id":"WWVOL","meta":{"title":"Welles Wilder Volatility","overlay":true},"defaults":{"inputs":[{"name":"Period","value":14},{"name":"Constant","value":3}],"curves":[{"colors":["#9326ff"],"fields":["WWVSARD"],"style":"Dots"},{"colors":["#f18900"],"fields":["WWVSARU"],"style":"Dots"}]}},{"id":"PARTP","meta":{"title":"Parabolic Time/Price (SAR)","overlay":true},"defaults":{"inputs":[{"name":"Acceleration","value":50},{"name":"Limit","value":5}],"curves":[{"colors":["#25329b"],"fields":["PARSARS"],"style":"Dots"},{"colors":["#00aaab"],"fields":["PARSARL"],"style":"Dots"}]}},{"id":"REATRHI","meta":{"title":"Retracement ATR High","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["High","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"High"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#25329b"],"fields":["REATRHI"],"style":"Dots"}]}},{"id":"REATRLO","meta":{"title":"Retracement ATR Low","overlay":true,"enumerations":[{"input":"TurtleChnField","values":["Low","Close"]}]},"defaults":{"source":"Close","inputs":[{"name":"PeriodAdjATR","value":20},{"name":"PeriodTurtleChn","value":100},{"name":"TurtleChnField","value":"Low"},{"name":"FactorAdjATR","value":15},{"name":"FactorATR","value":2}],"curves":[{"colors":["#b25900"],"fields":["REATRLO"],"style":"Dots"}]}},{"id":"MOVLR","meta":{"title":"Moving Linear Regression","overlay":true,"shiftable":true},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Offset","value":0}],"curves":[{"colors":["#480048"],"fields":["MOVLR"]}]}},{"id":"TRSP","meta":{"title":"Trend Seeker®","overlay":true,"enumerations":[{"input":"VelocityUpTrend","values":["1","2","3","4","5","6","7","8","9"]},{"input":"VelocitySideTrend","values":["1","2","3","4","5","6","7","8","9"]},{"input":"VelocityDownTrend","values":["1","2","3","4","5","6","7","8","9"]}]},"defaults":{"inputs":[{"name":"VelocityUpTrend","value":"3"},{"name":"VelocitySideTrend","value":"3"},{"name":"VelocityDownTrend","value":"3"}],"curves":[{"colors":["#24ad54"],"fields":["TRSP1"],"style":"Dots"},{"colors":["#ec4533"],"fields":["TRSP2"],"style":"Dots"}]}},{"id":"COTLC","meta":{"title":"Commitment of Traders (COT) Chart","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTLCCMSP"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTLCLGSP"],"style":"Step"},{"colors":["#403daf"],"fields":["COTLCSMSP"],"style":"Step"}]}},{"id":"COTDAG","meta":{"title":"Commitment of Traders (COT) Disaggregated","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTDAGPRO"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTDAGSPD"],"style":"Step"},{"colors":["#403daf"],"fields":["COTDAGMNM"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTDAGOTH"],"style":"Step"}]}},{"id":"COTFTR","meta":{"title":"Commitment of Traders (COT) Financial","overlay":false,"decimals":0},"defaults":{"curves":[{"colors":["#dc4041"],"fields":["COTFTRDLI"],"style":"Step"},{"colors":["#3a8d45"],"fields":["COTFTRASM"],"style":"Step"},{"colors":["#403daf"],"fields":["COTFTRLVF"],"style":"Step"},{"colors":["#ffb34c"],"fields":["COTFTROTH"],"style":"Step"}]}},{"id":"PIVPTS","meta":{"title":"Pivot Points","overlay":true,"enumerations":[{"input":"Previous","values":["Day","Week","Month"]}]},"defaults":{"inputs":[{"name":"Previous","value":"Day"}],"curves":[{"colors":["#79a2e3"],"fields":["PPTR3"]},{"colors":["#f08f4c"],"fields":["PPTR2"]},{"colors":["#492c6e"],"fields":["PPTR1"]},{"colors":["#28adcc"],"fields":["PPTPIV"]},{"colors":["#8f040a"],"fields":["PPTS1"]},{"colors":["#8cba32"],"fields":["PPTS2"]},{"colors":["#0e2339"],"fields":["PPTS3"]}]}},{"id":"CPP","meta":{"title":"Camarilla Pivot Points","overlay":true},"defaults":{"curves":[{"colors":["#00b04b"],"fields":["CPPH4"]},{"colors":["#00b04b"],"fields":["CPPH3"]},{"colors":["#00b04b"],"fields":["CPPH2"]},{"colors":["#00b04b"],"fields":["CPPH1"]},{"colors":["#d47928"],"fields":["CPPL1"]},{"colors":["#d47928"],"fields":["CPPL2"]},{"colors":["#d47928"],"fields":["CPPL3"]},{"colors":["#d47928"],"fields":["CPPL4"]}]}},{"id":"IMPVOL","meta":{"title":"Implied Volatility (Futures)","overlay":false,"decimals":2},"defaults":{"curves":[{"colors":["#ffc270"],"fields":["IMPVOL"]}]}},{"id":"CTM","meta":{"title":"CommodityTrends Cycle Trading Momentum","overlay":false},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#2642ef"],"fields":["CTM"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]},{"colors":["#9326ff"],"fields":["CTLTM"]}]}},{"id":"CPMI","meta":{"title":"CommodityTrends Principal Momentum Indicator","overlay":false},"defaults":{"source":"Close","curves":[{"style":"Step","colors":["#fc0d1b","#2642ef"],"fields":["CPMI"],"zones":[{"value":0,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}]}},{"id":"CTPI","meta":{"title":"CommodityTrends Turning Point Indicator","overlay":false,"decimals":2,"range":{"min":0,"max":100}},"defaults":{"curves":[{"colors":["#ef4226","#2642ef"],"fields":["CTPI"],"zones":[{"value":50,"colors":1,"gradient":"linDarken"},{"colors":1,"gradient":"linLighten"}]}],"levels":[{"value":25,"name":"Oversold","line":{"color":"#3a45a2"}},{"value":50,"name":"Center","line":{"color":"#3a45a2","dashStyle":"DashDot"}},{"value":75,"name":"Overbought","line":{"color":"#3a45a2"}}]}},{"id":"GMMA","meta":{"title":"Guppy Multiple Moving Average","overlay":true},"defaults":{"inputs":[{"name":"Period1","value":3},{"name":"Period2","value":5},{"name":"Period3","value":8},{"name":"Period4","value":10},{"name":"Period5","value":12},{"name":"Period6","value":15},{"name":"Period7","value":30},{"name":"Period8","value":35},{"name":"Period9","value":40},{"name":"Period10","value":45},{"name":"Period11","value":50},{"name":"Period12","value":60}],"curves":[{"colors":["#008ae6"],"fields":["GMMA3"]},{"colors":["#008ae6"],"fields":["GMMA5"]},{"colors":["#008ae6"],"fields":["GMMA8"]},{"colors":["#008ae6"],"fields":["GMMA10"]},{"colors":["#008ae6"],"fields":["GMMA12"]},{"colors":["#008ae6"],"fields":["GMMA15"]},{"colors":["#b32400"],"fields":["GMMA30"]},{"colors":["#b32400"],"fields":["GMMA35"]},{"colors":["#b32400"],"fields":["GMMA40"]},{"colors":["#b32400"],"fields":["GMMA45"]},{"colors":["#b32400"],"fields":["GMMA50"]},{"colors":["#b32400"],"fields":["GMMA60"]}]}},{"id":"STOMOMIX","meta":{"title":"Stochastic Momentum Index","overlay":false},"defaults":{"inputs":[{"name":"Period1","value":10},{"name":"Period2","value":3}],"curves":[{"colors":["#3bb4e5"],"fields":["STOMOMIX"]}],"levels":[{"value":-40,"name":"Oversold","line":{"color":"#606060","dashStyle":"Dash"}},{"value":40,"name":"Overbought","line":{"color":"#606060","dashStyle":"Dash"}}]}},{"id":"CHDMOMOSC","meta":{"title":"Chande Momentum Oscillator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":9}],"curves":[{"colors":["#27c6da"],"fields":["CHDMOMOSC"]}],"levels":[{"value":-50,"name":"Oversold","line":{"color":"#606060"}},{"value":0,"name":"Zero","line":{"color":"#606060","dashStyle":"Dash"}},{"value":50,"name":"Overbought","line":{"color":"#606060"}}]}},{"id":"VSTOP","meta":{"title":"Volatility Stop","overlay":true},"defaults":{"inputs":[{"name":"Period","value":20},{"name":"Multiplier","value":2}],"curves":[{"colors":["#50cc52"],"fields":["VSTOPUP"],"style":"Dots"},{"colors":["#d46757"],"fields":["VSTOPLOW"],"style":"Dots"}]}},{"id":"SUPTR","meta":{"title":"Supertrend","overlay":true},"defaults":{"inputs":[{"name":"Period","value":7},{"name":"Multiplier","value":4}],"curves":[{"colors":["#ff5252","#4cb050"],"fields":["SUPTR"],"style":"Line","varyColorPerBar":true}]}},{"id":"ICHCLD","meta":{"title":"Ichimoku Clouds","overlay":true},"defaults":{"inputs":[{"name":"PeriodConversionLine","value":9},{"name":"PeriodBaseLine","value":26},{"name":"PeriodLaggingSpan2","value":52},{"name":"Displacement","value":26}],"curves":[{"colors":["#0080cd"],"fields":["CONVLN"],"style":"Line"},{"colors":["#cd0000"],"fields":["BASELN"],"style":"Line"},{"colors":["#009900"],"fields":["LAGGSP"],"style":"Line"},{"colors":["#00cd00"],"fields":["LEADSP1"],"style":"Line"},{"colors":["#ff0000"],"fields":["LEADSP2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["LEADSP1","LEADSP2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"VWAP","meta":{"title":"Volume Weighted Average Price (VWAP)","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","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","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","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","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period","value":20}],"curves":[{"colors":["#ffb347"],"fields":["AVG"]}]}},{"id":"VOIN","meta":{"title":"Vortex Indicator","overlay":false},"defaults":{"inputs":[{"name":"Period","value":14}],"curves":[{"colors":["#60b1df"],"fields":["PLVI"]},{"colors":["#ea336f"],"fields":["MNVI"]}]}},{"id":"DIFA","meta":{"title":"Distance From Average","overlay":false,"decimals":2,"enumerations":[{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]},{"input":"Distance","values":["Amount","Percentage"]}]},"defaults":{"source":"Close","inputs":[{"name":"Period","value":200},{"name":"Average","value":"MA"},{"name":"Distance","value":"Percentage"}],"curves":[{"colors":["rgba(252, 13, 27, 0.3)","#fc0d1b","rgba(0, 176, 75, 0.3)","#00b04b"],"fields":["DIFA"],"style":"Column","varyColorPerBar":true}]}},{"id":"DOSC","meta":{"title":"Derivative Oscillator","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"PeriodRsi","value":14},{"name":"PeriodEma1","value":5},{"name":"PeriodEma2","value":3},{"name":"PeriodMa","value":9},{"name":"PeriodSig","value":9}],"curves":[{"colors":["#ef5350","#26a69a"],"fields":["DOSCH"],"style":"Column","zones":[{"value":0,"colors":1},{"colors":1}]},{"colors":["#cc66ff"],"fields":["DOSCS"]}]}},{"id":"BSQUEEZE","meta":{"title":"Bollinger Bands Squeeze","overlay":false},"defaults":{"source":"Close","inputs":[{"name":"Period","value":20},{"name":"Width","value":2}],"curves":[{"colors":["#3d8283"],"fields":["BOLLSQ"]}]}},{"id":"MARIB","meta":{"title":"Moving Average Ribbon","overlay":true,"shiftable":true,"enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/2","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":"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"]}]},"defaults":{"source":"Close","inputs":[{"name":"Bars","value":24},{"name":"Volume","value":"Up/Down"},{"name":"BarColoring","value":"LikeMain"},{"name":"Position","value":"Left"},{"name":"WidthPercent","value":40}],"curves":[{"colors":["rgba(239, 65, 38, 0.3)","rgba(0, 176, 76, 0.3)","rgba(31, 74, 182, 0.3)","rgba(226,49,240, 0.8)"],"fields":["DNVOL","UPVOL","TOTVOL"],"style":"Column","varyColorPerBar":true}]}},{"id":"KST","meta":{"title":"Know Sure Thing","enumerations":[{"input":"Source","values":["Open","High","Low","Close","HL/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","HLC/3","OHLC/4","HLCC/4"]},{"input":"Average","values":["MA","EMA","SMA","WMA","HMA"]}]},"defaults":{"inputs":[{"name":"Source","value":"Close"},{"name":"Average","value":"MA"},{"name":"Period1","value":21},{"name":"Period2","value":34}],"curves":[{"colors":["#00cd00"],"fields":["MACLD1"],"style":"Line"},{"colors":["#ff0000"],"fields":["MACLD2"],"style":"Line"},{"colors":["rgba(255, 0, 0, 0.2)","rgba(0, 255, 0, 0.2)"],"fields":["MACLD1","MACLD2"],"style":"Ribbon","varyColorPerBar":true}]}},{"id":"PC","meta":{"title":"Probability Cones","overlay":true,"enumerations":[{"input":"Volatility","values":["HV 30","HV 60","HV 90","HV 180","Custom"]},{"input":"StandardDeviations","values":["1","2","3"]}]},"defaults":{"inputs":[{"name":"Volatility","value":"HV 90"},{"name":"VolatilityPercent","value":20},{"name":"StandardDeviations","value":"3"},{"name":"PeriodForecast","value":45},{"name":"PeriodTarget","value":30},{"name":"TargetPrice1","value":0},{"name":"TargetPrice2","value":0}],"curves":[{"colors":["#5db660"],"fields":["PCUP1"],"style":"Line","dashStyle":"Dash"},{"colors":["#5db660"],"fields":["PCDN1"],"style":"Line","dashStyle":"Dash"},{"colors":["#4a7bfe"],"fields":["PCUP2"],"style":"Line","dashStyle":"Dash"},{"colors":["#4a7bfe"],"fields":["PCDN2"],"style":"Line","dashStyle":"Dash"},{"colors":["#ff5e5e"],"fields":["PCUP3"],"style":"Line","dashStyle":"Dash"},{"colors":["#ff5e5e"],"fields":["PCDN3"],"style":"Line","dashStyle":"Dash"},{"colors":["rgba(93, 182, 96, 0.1)"],"fields":["PCUP1","PCDN1"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(74, 123, 254, 0.1)"],"fields":["PCUP2","PCUP1"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(74, 123, 254, 0.1)"],"fields":["PCDN1","PCDN2"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 94, 94, 0.1)"],"fields":["PCUP3","PCUP2"],"style":"Ribbon","lineWidth":0},{"colors":["rgba(255, 94, 94, 0.1)"],"fields":["PCDN2","PCDN3"],"style":"Ribbon","lineWidth":0},{"colors":["#ff54e2"],"fields":["PCTD"],"lineWidth":2,"dashStyle":"Solid"},{"colors":["#ffaf2c"],"fields":["PCTP"],"lineWidth":2,"dashStyle":"Solid"}]}},{"id":"GREEKS","meta":{"title":"Greeks","overlay":false,"decimals":4},"defaults":{"curves":[{"colors":["#7ca685"],"fields":["Delta"]},{"colors":["#c16a6a"],"fields":["Gamma"]},{"colors":["#5a7ca9"],"fields":["Theta"]},{"colors":["#e4a76b"],"fields":["Vega"]}]}}]');let Ln=[],On=!1,wn=!0;function In(e){wn=e}function xn(e){Ln=Ln.concat(_o(e,Ci.STUDIES_SCHEMA))}const Dn=new Map;function Nn(){On||(xn(e(_n)),On=!0);const t=te[SP()?.config.mode??"Unspecified"];if(!wn)return Ln;if(!Dn.has(t)){const e=me(kn,t);Dn.set(t,Ln.filter(e))}return Dn.get(t)}function Rn(e){return rt(Vn(e))}function Hn(e){return qs(AP().display,e)}function Vn(e){return Nn().find((t=>t.id===e))}function Fn(e){return void 0!==Vn(e)}function Bn(e){const t=[Do.Open,Do.High,Do.Low,Do.Close,Do.Volume].map((e=>e.id));return e.defaults.source&&!t.includes(e.defaults.source)}function kn(e,t){const i=t.id,s=[te.GBE,te.cmdtyView];return!(["CPMI","CTPI","CTM","JPI","CTTP"].includes(i)&&!s.includes(e))}let Un=null,Wn=!1;function $n(){if(!Wn){const e=[D.Study,D.BalanceSheet,D.IncomeStatement],t=e.reduce(((e,t)=>(e[t]=[],e)),{});Object.values(Do).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(v).filter((e=>{const t=parseInt(e);if(Number.isFinite(t))return v[t]})),s=rt(Nn()).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=vn(),r=Object.entries(n).map((([e,t])=>({id:e,options:t.editable,types:t.types,numPoints:t.numPoints})));Un={studies:s,incomeStatements:t[D.IncomeStatement],balanceSheets:t[D.BalanceSheet],studyFields:t[D.Study],curveStyles:i,annotations:r},Wn=!0}return Un}var Gn;function zn(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=>zn(e,t,i))).filter((e=>e!==Ci.NULL_OBJECT));{let s=t.indexOf(e);if(-1!==s)return i[s];let n={};for(let s in e){const r=e[s];n[s]=zn(r,t,i)}return n}}function Yn(e,t,i){return[].concat((0,Gn.apply)(t,e,i))}function jn(e,t,i){let s=rt(e),n=Yn(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 zn(s,n,r)}Gn=n("3DQaT");const Kn=["1D","5D","1M","3M","6M","1Y","5Y","Max"];function qn(e){return 1===e.length}function Xn(e){return 1===e.length}const Zn={ATRLTR:"REATRHI",ATRSTR:"REATRLO",PeriodMARng:"PeriodAdjATR",PeriodAdjATR:"FactorAdjATR"};const Jn={BBANDS:{colors:["#89211e"],fields:["BOLLBM"],visible:!1},DONCHN:{colors:["#ff6a00"],fields:["DONMID"],visible:!1}};const Qn={[Ci.AT_SINGLE_STYLE]:!0,[Ci.AT_SHOW_BACKGROUND]:!1,[Ci.AT_BACKGROUND_OPACITY]:.2},er={[Ci.AT_SHOW_PRICES]:!0,[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LEVELS_KIND]:Ci.AT_LEVELS_PERCENTS,[Ci.AT_LABELS]:Ci.AT_LABELS_LEFT,[Ci.AT_EXTEND_LEFT]:!1,[Ci.AT_EXTEND_RIGHT]:!0,[Ci.AT_REVERSE]:!1,...Qn},tr={FibonacciFan:{[Ci.AT_SHOW_LEVELS]:!1,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,[Ci.AT_REVERSE]:!1,...Qn},FibonacciArcs:{[Ci.AT_SHOW_LEVELS]:!1,...Qn},FibonacciRetracement:{...er},TrendBasedFibExtension:{...er},FibonacciChannel:{[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LEVELS_KIND]:Ci.AT_LEVELS_PERCENTS,[Ci.AT_LABELS]:Ci.AT_LABELS_LEFT,...Qn},FibonacciTimeZones:{[Ci.AT_SHOW_LEVELS]:!0,[Ci.AT_LABELS]:Ci.AT_LABELS_RIGHT,...Qn},GannFan:{[Ci.AT_SHOW_LEVELS]:!1,...Qn},GannBox:{...Qn,[Ci.AT_SHOW_BACKGROUND]:!0},GannSquare:{...Qn,[Ci.AT_SHOW_BACKGROUND]:!0}},ir=["FibonacciFan","FibonacciArcs","FibonacciChannel","FibonacciTimeZones","FibonacciRetracement","TrendBasedFibExtension"],sr=[...ir,"GannFan","GannBox","GannSquare"],nr=["Line","Ray","GannLine"],rr=["ComputedText","ProfitLoss","RewardRisk"];function or(e){return ir.includes(e)?["factors"]:"GannFan"===e?["angles"]:"GannBox"===e?["priceLevels","timeLevels"]:"GannSquare"===e?["levels","fans","arcs"]:[]}function ar(e,t,i){const s=!st(e,t)||!Array.isArray(e[t]),n=!s&&e[t].some((e=>!Ze(e.value)));if(s||n)return e[t]=i[t],!0}function lr(e,t){if(!Ze(t))return;const i=or(e),s=qs(null,e);for(const e of i)if(!ar(t,e,s))for(const i of t[e])Number.isFinite(i.value)&&(i.value=Je(i.value,6))}function cr(e,t,i=!1){const s="FibonacciFan"===e,n=Ze(t);if(sr.includes(e)&&n){if(i){lt(t,tr[e])}const n=or(e),r=qs(null,e);for(const e of n)if(!ar(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)));Ze(i.line)||(i.line=t?t.line:{width:1,color:$s(Math.floor(100*Math.random())),dashStyle:"Solid"}),s&&0===i.value&&!Ze(i.shown)&&(i.shown=!0)}"FibonacciChannel"===e&&t[Ci.AT_SHOW_LABELS]?(t[Ci.AT_SHOW_LEVELS]=t[Ci.AT_SHOW_LABELS],delete t[Ci.AT_SHOW_LABELS]):"FibonacciArcs"!==e||t[Ci.AT_SHOW_TRENDLINE]||(t[Ci.AT_SHOW_TRENDLINE]=!0)}nr.includes(e)&&n&&!Ze(t[Ci.AT_MARKER])&&(t[Ci.AT_MARKER]={...Tn}),n&&(t[Ci.AT_ALLOW_PRICES_CHANGE_UI]=!rr.includes(e))}const ur=[3,4,5,6,7,8,9,10,11],hr=[12,13,14,15,16,17,18,19,20];const dr=[{name:"Source",value:"Close"},{name:"Average",value:"MA"}];function pr(e){return function(t){return t.version=e,t}}const fr={_3to4:function(e){const t=e.data.period;if(null!==t){const i="Max"===t?Ci.AUTOFIT_PERIOD:`P${t}`,s=Kn.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=Yn(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=rt(Ci.COLOR_DEFAULT_VARY)}return e.version=5,e},_5to6:function(e){const t=Yn(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=Yn(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=gs(e.curves[t].colors[0]);i.a=.1,e.curves.push({colors:[Ss(i)],fields:e.curves[0].fields.concat(e.curves[t].fields),lineWidth:0,style:"Ribbon"})}})),e.version=7,e},_7to8:function(e){const t=Yn(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===Ci.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=Yn(e,t);if(qn(s)){if(!qn(Yn(s,i))){const e=Yn(SP().template,t+i);qn(e)&&(s[0].minorGridLines=e[0])}}return e.version=9,e},_9to10:function(e){const t=".display.navigator",i=".enabled",s=Yn(e,t);if(Xn(s)){if(!Xn(Yn(s,i))){const e=Yn(SP().template,t+i);Xn(e)&&(s[0].enabled=e[0])}}return e.version=10,e},_10to11:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === "TCHN"}');return t.length>0&&t.forEach((e=>{if(e.inputs&&1===e.inputs.length&&e.inputs[0].name===Ci.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=Yn(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 Yn(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=Yn(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["ATRLTR","ATRSTR"]}),i=e=>st(Zn,e)?Zn[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=Yn(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(Ze(t)&&Ze(t.factors)){const e=qs(null,i).factors,s=t.factors.map(((t,i)=>{const s=!Ze(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHM","STOCHS"]});return t.length>0&&t.forEach((e=>{const t="STOCHM"===e.study,i=Rn(t?"STOCHS":e.study);Ze(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["BBANDS","DONCHN"]});return t.length>0&&t.forEach((e=>{if(Ze(e.curves)&&3===e.curves?.length){const t=rt(Jn[e.study]);e.curves.push(t)}})),e.version=18,e},_18to19:function(e){const t=Yn(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=Yn(e,".display.yAxis");if(1===t.length){const e=t[0];Ze(e.showLastValue)&&(e.showLastValue=e.showLastValue?"All":"None")}return e.version=20,e},_20to21:function(e){const t=Yn(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=Yn(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=Yn(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=Yn(e,'..plots{.type === "Study" && .study === "MOM"}');if(t.length>0){const e=Rn("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=Yn(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=Rn(e.study).defaults.inputs})),e.version=26,e},_26to27:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === "ATR"}');if(t.length>0){const e=Rn("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=Yn(e,'..plots{.type === "Study"}'),i=Rn("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(Ze(t))return t.shift})(e);Ze(t)&&(e.shift=t)}))})),e.version=28,e},_28to29:function(e){const t=Mo(jn(e,'..plots{.type === "Study" && .study === "DEMARK"}',(e=>Ci.NULL_OBJECT)));return t.version=29,t},_29to30:function(e){const t=Mo(jn(e,'..plots{.type === "Study" && .study === "ULTOSC"}',(e=>Ci.NULL_OBJECT)));return t.version=30,t},_30to31:function(e){const t=Yn(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(Ze(n)){const e=qs(null,i);n.line2=e.line2}}})),e.version=31,e},_31to32:function(e){return e.version=32,e},_32to33:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:Nn().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=Yn(e,'..plots{.type === "Study" && .study === "VWAP"}'),i=Rn("VWAP");return t.length>0&&t.forEach((e=>{Ze(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=Yn(e,`..plots{.type === "Study" && .study === "${t}"}`);if(i.length>0){const e=Rn(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 Yn(e,"..annotations").forEach((e=>{e.uid=yt()})),e.version=36,e},_36to37:function(e){return e.version=37,e},_37to38:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === "CRS"}'),i=Rn("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=Yn(e,'..plots{.type === "Study" && .study === "PERF"}'),i=Rn("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=Yn(e,"..annotations"),i=["FibonacciTimeZones","FibonacciFan","FibonacciArcs"],s=vn();return t.forEach((e=>{const t=e.id;i.includes(t)?e.traits.factors=rt(s[t].defaults.factors):"GannFan"===t&&(e.traits.angles=rt(s[t].defaults.angles))})),e.version=43,e},_43to44:pr(44),_44to45:pr(45),_45to46:pr(46),_46to47:pr(47),_47to48:pr(48),_48to49:pr(49),_49to50:pr(50),_50to51:pr(51),_51to52:pr(52),_52to53:pr(53),_53to54:pr(54),_54to55:pr(55),_55to56:pr(56),_56to57:function(e){const t=Yn(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:pr(58),_58to59:pr(59),_59to60:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["VOL","MAVOL"]}),i=Rn("MAVOL"),s=e=>{if(!Ze(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(!Ze(e.curves))return;const t="VOL"===e.study?0:1;var n;Ze(e.inputs)||(e.inputs=[]),1===t&&1===e.curves?.length&&e.curves.push(rt(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:pr(61),_61to62:pr(62),_62to63:pr(63),_63to64:pr(64),_64to65:function(e){const t="DIFA",i=Yn(e,`..plots{.type === "Study" && .study === "${t}"}`),s=Rn(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 Yn(e,"..annotations").forEach((e=>{if("FibonacciTimeZones"===e.id){const t=e.points;if(1===t.length){const e=rt(t[0]);e.time+=1,t.push(e)}}})),e.version=66,e},_66to67:pr(67),_67to68:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === "DPO"}'),i=Rn("DPO");return t.length>0&&t.forEach((e=>{if(Ze(e.curves)&&1===e.curves?.length&&!Ze(e.levels)){const t=e.curves[0];if(1===t.colors?.length&&!Ze(t.zones)){e.levels=i.defaults.levels,t.zones=i.defaults.curves[0].zones;const s=hs(t.colors[0],.3);t.colors=[s,s]}}})),e.version=68,e},_68to69:pr(69),_69to70:function(e){const t="RSISTO",i=Yn(e,`..plots{.type === "Study" && .study === "${t}"}`),s=Rn(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 Yn(e,"..annotations").forEach((e=>cr(e.id,e.traits,!0))),e.version=71,e},_71to72:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["GTPI","GPMI","CBMI"]}),i=Rn("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:ur[Number(e.value)-1]}:"SlowNumber"===e.name?{name:"SlowPeriod",value:hr[Number(e.value)-1]}:e)),e.inputs.splice(2,0,i.defaults.inputs[2])))})),e.version=72,e},_72to73:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["JPI"]}),i=Rn("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:pr(74),_74to75:pr(75),_75to76:pr(76),_76to77:function(e){const t="COPP",i=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:[`${t}`]}),s=Rn(t);return i.length>0&&i.forEach((e=>{Ze(e.inputs)&&(e.curves=s.defaults.curves,e.levels=s.defaults.levels)})),e.version=77,e},_77to78:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MFI"]}),i=Rn("MFI");return t.length>0&&t.forEach((e=>{Ze(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t,i]}),n=Rn(t),r=Rn(i);return s.length>0&&s.forEach((e=>{if(Ze(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CCI"]}),i=Rn("CCI");return t.length>0&&t.forEach((e=>{if(Xe(e.inputs)){const t=e.curves[0].colors[0],s=hs(t,.3);e.curves=i.defaults.curves;const n=e.curves[0].colors;n[0]=n[3]=s,n[2]=t,Xe(e.levels)?e.levels.splice(1,0,i.defaults.levels[1]):e.levels=i.defaults.levels,Xe(e.bands)||(e.bands=i.defaults.bands)}})),e.version=80,e},_80to81:pr(81),_81to82:pr(82),_82to83:pr(83),_83to84:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP"]}),i=Rn("MACD");return t.length>0&&t.forEach((e=>{Ze(e.inputs)&&(e.levels=i.defaults.levels)})),e.version=84,e},_84to85:pr(85),_85to86:pr(86),_86to87:function(e){const t="BBANDS",i=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Rn(t);return i.length>0&&i.forEach((e=>{3===e.inputs?.length&&e.inputs.push(s.defaults.inputs[3])})),e.version=87,e},_87to88:pr(88),_88to89:pr(89),_89to90:function(e){const t=Yn(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=Yn(e,`..plots{.type === "Study" && .study === "${t}" }`),s=Rn(t);return i.length>0&&i.forEach((e=>{3===e.inputs?.length&&e.inputs.push(s.defaults.inputs[3])})),e.version=91,e},_91to92:pr(92),_92to93:pr(93),_93to94:pr(94),_94to95:pr(95),_95to96:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PMO"]}),i=Rn("PMO");return t.length>0&&t.forEach((e=>{Ze(e.inputs)&&(e.levels=i.defaults.levels)})),e.version=96,e},_96to97:pr(97),_97to98:pr(98),_98to99:pr(99),_99to100:pr(100),_100to101:pr(101),_101to102:function(e){return Yn(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[Ci.AT_SHOW_PRICES]=e.traits[Ci.AT_DRAW_LINES]??!0,delete e.traits[Ci.AT_DRAW_LINES],e.traits[Ci.AT_POSITION]=e.traits.pos??"Long",delete e.traits.pos,delete e.traits.kind,delete e.traits.points,e.traits[Ci.AT_ALLOW_PRICES_CHANGE_UI]=!1}})),e.version=102,e},_102to103:pr(103),_103to104:function(e){const t="UseAllFields";return Yn(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:pr(105),_105to106:function(e){const t=Yn(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(Xe(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:pr(107),_107to108:pr(108),_108to109:function(e){const t=Yn(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;Xe(i)&&i.splice(0,0,...dr);const s=e.curves;Xe(s)&&t&&(s[0].fields[0]="AVG")})),e.version=109,e},_109to110:pr(110),_110to111:function(e){return Yn(e,"..annotations").forEach((e=>{"LongPosition"!==e.id&&"ShortPosition"!==e.id||(e.traits[Ci.AT_ALLOW_PRICES_CHANGE_UI]=!0)})),e.version=111,e},_111to112:pr(112),_112to113:function(e){const t="CHEXI",i=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:[t]}),s=Rn(t).defaults;return i.length>0&&i.forEach((e=>{Xe(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=Yn(e,"..plots{.detachedScale}");return t.length>0&&t.forEach((e=>{e.detachedScale=!0})),e.version=114,e},_114to115:pr(115),_115to116:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["STOCHF","STOCHS"]});return t.length>0&&t.forEach((e=>{const t=Rn(e.study).defaults;Xe(e.inputs)&&Xe(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=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHAMF"]});return t.length>0&&t.forEach((e=>{const t=Rn(e.study).defaults;Xe(e.inputs)&&Xe(e.curves)&&(e.curves[0]=t.curves[0])})),e.version=117,e},_117to118:pr(118),_118to119:pr(119),_119to120:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CHDMOMOSC","TSI","DIFA"]});return t.length>0&&t.forEach((e=>{const t=Rn(e.study).defaults;if(Xe(e.inputs)&&Xe(e.curves))switch(e.study){case"CHDMOMOSC":case"TSI":{const i=e.levels[0];e.levels=t.levels,e.levels[1]=i;break}case"DIFA":{const[i,s]=e.curves[0].colors;e.curves=t.curves,e.curves[0].colors=[i,us(i),s,us(s)];break}}})),e.version=120,e},_120to121:pr(121),_121to122:pr(122),_122to123:pr(123),_123to124:pr(124),_124to125:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["MACD","MACDEXP","PPO"]});return t.length>0&&t.forEach((e=>{const t=Rn(e.study).defaults;if(Xe(e.inputs)&&Xe(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=>hs(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:pr(126),_126to127:pr(127),_127to128:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["CRS"]}),i=Rn("CRS");return t.length>0&&t.forEach((e=>{Ze(e.inputs)&&(e.levels=i.defaults.levels)})),e.version=128,e},_128to129:pr(129),_129to130:pr(130),_130to131:function(e){const t=Yn(e,'..plots{.type === "Study" && .study === $studies}',{studies:["PC"]}),i=Rn("PC");return t.length>0&&t.forEach((e=>{if(Xe(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:pr(132),_132to133:pr(133),_133to134:pr(134),_134to135:pr(135)};function mr(e,t){if(t===Ci.CHART_SCHEMA){const i=Yn(Mn(t),".properties.version.minimum")[0],s=e.version;if(s<i)return function(e,t,i){let s=e;try{for(In(!1);t<i;)s=(0,fr[`_${t}to${t+1}`])(s),t+=1}finally{In(!0)}return s}(e,s,i)}return e}function gr(e,t){Mt(2,arguments);var i=Nt(e),s=Nt(t);return i.getTime()===s.getTime()}function yr(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getFullYear()===s.getFullYear()&&i.getMonth()===s.getMonth()}function Tr(e){Mt(1,arguments);var t=Ot(e),i=t.getMonth(),s=i-i%3;return t.setMonth(s,1),t.setHours(0,0,0,0),t}function Sr(e,t){Mt(2,arguments);var i=Tr(e),s=Tr(t);return i.getTime()===s.getTime()}var Ar={};function vr(){return Ar}function Pr(e,t){var i,s,n,r,o,a,l,c;Mt(1,arguments);var u=vr(),h=_t(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=Ot(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 Cr(e,t,i){Mt(2,arguments);var s=Pr(e,i),n=Pr(t,i);return s.getTime()===n.getTime()}function br(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getFullYear()===s.getFullYear()}function Er(e){return{unit:nt(e,"Day","unit"),size:nt(e,1,"size"),spec:nt(e,"None","spec"),isContractVolume:nt(e,!1,"isContractVolume"),dividendsAdjust:nt(e,!1,"dividendsAdjust"),backAdjust:nt(e,!1,"backAdjust"),daysToExpiration:nt(e,1,"daysToExpiration"),contractRoll:nt(e,"combined","contractRoll")}}function _r(e){const t=Er(e);return new Dr(C[t.unit],t.size,E[t.spec],t.isContractVolume,t.dividendsAdjust,t.backAdjust,t.daysToExpiration,t.contractRoll)}function Mr(e){switch(e.unit){case C.Tick:return xr;case C.Intraday:case C.Day:return Lr;case C.Week:return Or;case C.Month:return wr;case C.Quarter:return Ir;case C.Year:return br;default:return xr}}function Lr(e,t){return gr(e,t)&&wr(e,t)}function Or(e,t){return Cr(e,t)&&wr(e,t)}function wr(e,t){return yr(e,t)&&br(e,t)}function Ir(e,t){return Sr(e,t)&&br(e,t)}function xr(e,t){return+e==+t}class Dr{constructor(e=C.Day,t=1,i=E.None,s=!1,n=!1,r=!1,o=1,a="combined"){this.unit=e,this.size=t,this.spec=i,this.isContractVolume=s,this.dividendsAdjust=n,this.backAdjust=r,this.daysToExpiration=o,this.contractRoll=a}duplicate(){return new Dr(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===C.Tick){let e="T",t=!0;switch(this.spec){case E.PerCount:e="Tpb";break;case E.PerVolume:e="Vpb";break;case E.PerRange:e="Rpb";break;case E.PerSeconds:e="Spb";break;default:t=!1}return`${t?this.size:""}${e}`}if(this.unit===C.Intraday)return this.size%60==0?this.size/60+"h":`${this.size}`;{let e="";return this.spec===E.Nearest?e="n":this.spec===E.Continue&&(e="c"),`${this.size}${this.unitToString().substring(0,1)}${e}`}}unitToString(){let e="";switch(this.unit){case C.Tick:e="Tick";break;case C.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 C.Day:e="Daily";break;case C.Week:e="Weekly";break;case C.Month:e="Monthly";break;case C.Quarter:e="Quarterly";break;case C.Year:e="Yearly"}return e}describe(){let e=this.unitToString();switch(this.spec){case E.Nearest:e+=" Nearest";break;case E.Continue:e+=" Continue";break;case E.PerCount:e="Ticks Per Bar";break;case E.PerVolume:e="Volume Per Bar";break;case E.PerRange:e="Range Per Bar";break;case E.PerSeconds:e="Seconds Per Bar";case E.None:}return e}get hasSpec(){return this.spec!==E.None}get isEndOfDay(){return!this.isTick&&!this.isIntraday}get isTick(){return this.unit===C.Tick}get isIntraday(){return this.unit===C.Intraday}get isMultiContract(){const e=this.spec===E.Nearest,t=this.spec===E.Continue;return this.isEndOfDay&&(e||t)||this.isIntraday&&e}}function Nr(e){delete e.display.chart.bar}function Rr(e){Ze(e.display.xAxis.visibleRange)&&delete e.display.xAxis.visibleRange,Ze(e.data.range)&&delete e.data.range,delete e.data.checkRange}function Hr(e){Po(e.display.period)&&delete e.display.period}function Vr(e){Ze(e.display.density)&&delete e.display.density}function Fr(e){switch(v[e]){case v.OHLC:case v.HLC:case v.Candlestick:case v.HollowCandles:case v.HeikinAshi:case v.ElderImpulseSystem:case v.Range:case v.MultiColumn:return!0;default:return!1}}function Br(e){switch(v[e]){case v.Candlestick:case v.HollowCandles:case v.HeikinAshi:case v.ElderImpulseSystem:case v.Column:case v.Renko:case v.Range:case v.Kagi:case v.PointAndFigure:case v.LineBreak:case v.HLC:return!0;default:return!1}}function kr(e,t){const i=SP().getDefaultMultiFieldCurve();if(null!==i&&i.style===e)return i;const s=e=>e.id,n=[Do.Open,Do.High,Do.Low,Do.Close,Do.Change].map(s);v[e]===v.HLC&&n.splice(0,1);const r=[Do.Close].map(s),o=rt(Ci.COLOR_DEFAULT_AREA),a=rt(Ci.COLOR_DEFAULT_OHLC),l=rt(Ci.COLOR_DEFAULT_VARY),c={fields:n,colors:l,lineWidth:1,visible:!0,varyColorPerBar:t,style:e};switch(v[e]){case v.OHLC:case v.HLC:case v.Renko:case v.LineBreak:case v.Range:case v.Kagi:case v.PointAndFigure:c.colors=t?l:[a];break;case v.Candlestick:case v.HollowCandles:case v.HeikinAshi:case v.MultiColumn:break;case v.ElderImpulseSystem:c.colors=l.concat(o);break;case v.Line:case v.PercentChange:c.fields=r,c.colors=[a];break;case v.Area:c.fields=r,c.colors=[hs(o,.5),o];break;case v.Baseline:c.fields=r,c.colors=l.map((e=>hs(e,.5))),c.zones=[{value:0,colors:1},{colors:1}];break;case v.Column:c.fields=r;break;default:throw new Error(`Curve style "${e}" is not supported here.`)}return c}function Ur(e,t){var i;Object.keys(e).length>0&&(e.varyColorPerBar=e.varyColorPerBar||Br(e.style)||void 0!==(i=e.attributes)&&i.length>0&&i.some((e=>e===S[S.ChangeBased]||e===S[S.OpenVsClose])));const s=function(e,t){switch(e){case U.Symbol:case U.Expression:{const e=t.style||"Candlestick";return kr(e,t.varyColorPerBar||Br(e))}case U.Forward:case U.Seasonal:return{fields:["Close","Change"],style:"Line",lineWidth:2,visible:!0,colors:["#888"],varyColorPerBar:!1};default:throw new Error(`Unexpected plot type '${U[e]}', don't know its default curve.`)}}(U[t],e);return dt(s,e),"None"===e.lineMarker&&delete s.lineMarker,s}const Wr=["Renko","Kagi","PointAndFigure","LineBreak","Baseline"];function $r(e,t){const i=t.curves[0],s=oo(e),n=Ur(i,t.type);if(s.curves=[n],t.isMultiCurveMain&&t.curves.length>1&&s.curves.push(...t.curves.slice(1)),"Symbol"===t.type&&Ze(i)&&Wr.includes(i.style)){const e=s;Ze(t.inputs)?e.inputs=t.inputs:delete e.inputs}return e}function Gr(e,t,i){return i=i||" ",e.length>t?e:(t-=e.length,e+(i+=i.repeat(t)).slice(0,t))}class zr 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}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,zr.prototype):this.__proto__=zr.prototype,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,zr)}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=Gr("",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+" | "+Gr("",n.column-1," ")+Gr("",a-n.column,"^")}else t+="\n at "+r}return t}}const Yr=function(e,t){const i={},s=(t=void 0!==t?t:{}).grammarSource,n={expr:F};let r=F;const o=x("+",!1),a=x("-",!1),l=function(e,t){return function(e,t){return e.reduce((function(e,t){var i=t.filter((e=>"ws"!==e.op));return{op:i[0],left:e,right:i[1]}}),t)}(t,e)},c=x("*",!1),u=x("/",!1),h=x("^",!1),d=x("(",!1),p=x(")",!1),f=/^[0-9]/,m=D([["0","9"]],!1,!1),g=".",y=x(".",!1),T=x("{",!1),S=/^[A-Za-z0-9\^*$-.|:_]/,A=D([["A","Z"],["a","z"],["0","9"],"^","*",["$","."],"|",":","_"],!1,!1),v=x("}",!1),P=/^[A-Za-z]/,C=D([["A","Z"],["a","z"]],!1,!1),b=/^[ \t\r\n]/,E=D([" ","\t","\r","\n"],!1,!1);let _=0,M=0;const L=[{line:1,column:1}];let O,w=0,I=[];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 x(e,t){return{type:"literal",text:e,ignoreCase:t}}function D(e,t,i){return{type:"class",parts:e,inverted:t,ignoreCase:i}}function N(t){let i,s=L[t];if(s)return s;for(i=t-1;!L[i];)i--;for(s=L[i],s={line:s.line,column:s.column};i<t;)10===e.charCodeAt(i)?(s.line++,s.column=1):s.column++,i++;return L[t]=s,s}function R(e,t){const i=N(e),n=N(t);return{source:s,start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:n.line,column:n.column}}}function H(e){_<w||(_>w&&(w=_,I=[]),I.push(e))}function V(e,t,i){return new zr(zr.buildMessage(e,t),e,t,i)}function F(){let e;return e=B(),e}function B(){let t,s,n,r,c,u,h;if(t=_,s=k(),s!==i){if(n=[],r=_,c=G(),c!==i?(43===e.charCodeAt(_)?(u="+",_++):(u=i,H(o)),u===i&&(45===e.charCodeAt(_)?(u="-",_++):(u=i,H(a))),u!==i?(h=k(),h!==i?(c=[c,u,h],r=c):(_=r,r=i)):(_=r,r=i)):(_=r,r=i),r!==i)for(;r!==i;)n.push(r),r=_,c=G(),c!==i?(43===e.charCodeAt(_)?(u="+",_++):(u=i,H(o)),u===i&&(45===e.charCodeAt(_)?(u="-",_++):(u=i,H(a))),u!==i?(h=k(),h!==i?(c=[c,u,h],r=c):(_=r,r=i)):(_=r,r=i)):(_=r,r=i);else n=i;n!==i?(M=t,s=l(s,n),t=s):(_=t,t=i)}else _=t,t=i;return t===i&&(t=k()),t}function k(){let t,s,n,r,o,a,h;if(t=_,s=$(),s!==i){if(n=[],r=_,o=G(),o!==i?(42===e.charCodeAt(_)?(a="*",_++):(a=i,H(c)),a===i&&(47===e.charCodeAt(_)?(a="/",_++):(a=i,H(u))),a!==i?(h=$(),h!==i?(o=[o,a,h],r=o):(_=r,r=i)):(_=r,r=i)):(_=r,r=i),r!==i)for(;r!==i;)n.push(r),r=_,o=G(),o!==i?(42===e.charCodeAt(_)?(a="*",_++):(a=i,H(c)),a===i&&(47===e.charCodeAt(_)?(a="/",_++):(a=i,H(u))),a!==i?(h=$(),h!==i?(o=[o,a,h],r=o):(_=r,r=i)):(_=r,r=i)):(_=r,r=i);else n=i;n!==i?(M=t,s=l(s,n),t=s):(_=t,t=i)}else _=t,t=i;return t===i&&(t=$()),t}function U(){let t,s,n,r,o,a;return t=_,s=W(),s!==i?(n=G(),n!==i?(94===e.charCodeAt(_)?(r="^",_++):(r=i,H(h)),r!==i?(o=G(),o!==i?(a=W(),a!==i?(M=t,s={op:"^",left:s,right:a},t=s):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i),t===i&&(t=W()),t}function W(){let t,s,n,r,o,a,l;return t=function(){let t,s,n,r,o,a,l,c;if(t=_,s=G(),s!==i){if(n=_,r=[],f.test(e.charAt(_))?(o=e.charAt(_),_++):(o=i,H(m)),o!==i)for(;o!==i;)r.push(o),f.test(e.charAt(_))?(o=e.charAt(_),_++):(o=i,H(m));else r=i;if(r!==i){if(o=_,46===e.charCodeAt(_)?(a=".",_++):(a=i,H(y)),a===i&&(a=null),a!==i){for(l=[],f.test(e.charAt(_))?(c=e.charAt(_),_++):(c=i,H(m));c!==i;)l.push(c),f.test(e.charAt(_))?(c=e.charAt(_),_++):(c=i,H(m));l!==i?(a=[a,l],o=a):(_=o,o=i)}else _=o,o=i;o===i&&(o=null),o!==i?(r=[r,o],n=r):(_=n,n=i)}else _=n,n=i;n!==i?(M=t,s={op:"num",left:parseFloat(e.substring(M,_))},t=s):(_=t,t=i)}else _=t,t=i;return t}(),t===i&&(t=function(){let t,s,n,r,o,a,l,c,u;if(t=_,s=G(),s!==i)if(123===e.charCodeAt(_)?(n="{",_++):(n=i,H(T)),n!==i){if(r=[],S.test(e.charAt(_))?(o=e.charAt(_),_++):(o=i,H(A)),o!==i)for(;o!==i;)r.push(o),S.test(e.charAt(_))?(o=e.charAt(_),_++):(o=i,H(A));else r=i;if(r!==i)if(125===e.charCodeAt(_)?(o="}",_++):(o=i,H(v)),o!==i){if(a=_,46===e.charCodeAt(_)?(l=g,_++):(l=i,H(y)),l!==i){if(c=[],P.test(e.charAt(_))?(u=e.charAt(_),_++):(u=i,H(C)),u!==i)for(;u!==i;)c.push(u),P.test(e.charAt(_))?(u=e.charAt(_),_++):(u=i,H(C));else c=i;c!==i?(l=[l,c],a=l):(_=a,a=i)}else _=a,a=i;a===i&&(a=null),a!==i?(M=t,h=a,s={op:"sym",left:r.join(""),right:null==h?null:h[1].join("")},t=s):(_=t,t=i)}else _=t,t=i;else _=t,t=i}else _=t,t=i;else _=t,t=i;var h;return t}(),t===i&&(t=_,s=G(),s!==i?(40===e.charCodeAt(_)?(n="(",_++):(n=i,H(d)),n!==i?(r=G(),r!==i?(o=B(),o!==i?(a=G(),a!==i?(41===e.charCodeAt(_)?(l=")",_++):(l=i,H(p)),l!==i?(M=t,s={op:"grp",left:o},t=s):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i))),t}function $(){let t,s,n,r,o;return t=_,s=G(),s!==i?(45===e.charCodeAt(_)?(n="-",_++):(n=i,H(a)),n!==i?(r=G(),r!==i?(o=U(),o!==i?(M=t,s={op:n,left:o},t=s):(_=t,t=i)):(_=t,t=i)):(_=t,t=i)):(_=t,t=i),t===i&&(t=U()),t}function G(){let t,s,n;for(t=_,s=[],b.test(e.charAt(_))?(n=e.charAt(_),_++):(n=i,H(E));n!==i;)s.push(n),b.test(e.charAt(_))?(n=e.charAt(_),_++):(n=i,H(E));return s!==i&&(M=t,s={op:"ws"}),t=s,t}if(O=r(),O!==i&&_===e.length)return O;throw O!==i&&_<e.length&&H({type:"end"}),V(I,w<e.length?e.charAt(w):null,w<e.length?R(w,w+1):R(w,w))},jr=new Map,Kr=/\w[:]\w/;function qr(e){return"error"in e}function Xr(e,t=!1,i=!0){const s=e.trim();if(t&&jr.has(s))return rt(jr.get(s));try{const n=Yr(s);io(n,(e=>e.toUpperCase()),!0,!0);let r=eo(n);i&&function(e,t){if(e.some((e=>e.includes(":"))))return Jr(t,((e,t,i)=>{const s=(e,t=null,i="sym")=>({op:i,left:e,right:t}),n=e;if("sym"!==n.op||!Kr.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=eo(n));const o={text:e,model:n,clean:Qr(n),symbols:r};return t&&jr.set(s,o),o}catch(t){const i=t.location.start;return{text:e,error:`${t.message} \nLocation: line ${i.line}, column ${i.column}.`}}}function Zr(e,t){const i=function(e){const t=(t,i,s)=>{const n=t;if(so(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 Jr(e,i)}function Jr(e,t){if(!Ze(e))return null;const i=typeof e;if("number"===i||"string"===i)return e;const s=e;return t(s,Jr(s.left,t),Jr(s.right,t))}function Qr(e){return Jr(e,no)}function eo(e){const t=new Set;return Jr(e,((e,i,s)=>("sym"===e.op&&t.add(i),null))),Array.from(t)}function to(e){let t=0;const i=["+","-","*","/","^"];return Jr(e,((e,s,n)=>(i.includes(e.op)&&t++,null))),t>0}function io(e,t,i=!1,s=!1){const n=i?e:rt(e);return Jr(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 so(e){return!Ze(e.right)}function no(e,t,i){const s=e;if(so(s))switch(s.op){case"-":return`${s.op}${t}`;case"grp":return`(${t})`;case"sym":return`{${t}}`;case"num":return t.toString();default:throw new Error(`Unrecognized unary operator ${s.op}`)}else switch(s.op){case"+":case"-":case"*":case"/":case"^":return`${t} ${s.op} ${i}`;case"sym":return`{${t}}.${i}`;default:throw new Error(`Unrecognized binary operator ${s.op}`)}}const ro="..plots{.main === true}";function oo(e){return Yn(e,ro)[0]}function ao(e){const t=Yn(e,`..panes{${ro}}`)[0];return{mainPane:t,mainAxis:Yn(t,`..axes{${ro}}`)[0]}}function lo(e,t,i){const s=oo(t),n=s.type.toLowerCase();if(s[n]===Ci.PLACEHOLDER_SYMBOL_NAME){const s=oo(e),{mainAxis:n}=ao(t),r=n.annotations,o=go(t,s);if(i){const{mainAxis:e}=ao(o);e.annotations=r}return o}return t}const co="Symbol",uo="Expression",ho="Forward",po="Seasonal",fo=[co,uo,ho,po];function mo(e){const t=Xr(e),i=qr(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 go(e,t){const i=oo(e),s=e=>i.type===e,n=e=>Ze(t[e.toLowerCase()]),r=fo.find((e=>n(e))),o=r.toLowerCase();let a=t[o];const l=a===Ci.PLACEHOLDER_SYMBOL_NAME,c=n(uo)||n(ho)||n(po),u=fo.some((e=>n(e)&&!s(e))),h=SP().config.cachedAnnotationsCount||0,d=h>0,{mainAxis:p}=ao(e);u&&(p.comparison="None");const f=mo(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===Ci.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},T=(e,t)=>{const i=t.annCache||[],s=g(i,e);-1!==s&&(t.annotations=i[s].annotations)},S=e=>{const r=i;if(s(co))y(r.symbol,e);else if(s(uo))y(r.expression,e);else if(s(po)){const t=mo(r.seasonal);1===t.symbolCount&&y(t.firstSymbol,e)}delete e.annotations,n(co)?T(t.symbol,e):n(uo)?T(t.expression,e):n(po)&&1===f.symbolCount&&T(t.seasonal,e)};if(d){const t=Yn(e,"..axes");for(const e of t)S(e)}const A=n(uo)&&s(co)||n(co)&&s(uo);let v=jn(e,ro,(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=[{}]),(n(ho)||n(po))&&(e.offsets=[0])),e[o]=a,e)));if(u)if(n(ho))v.data.aggregation={unit:"Month"},v.display.period="P10Y";else if(n(po)&&!v.data.aggregation.isEndOfDay)v.data.aggregation={unit:"Day"},v.display.period=n(po)?"P9M":"P1Y10D";else if(s(ho)||s(po)){v.data.aggregation=SP().getDefaultAggregation(),v.data.maxDataPoints=Ci.DEFAULT_MAX_RECORDS;const e=SP().getDefaultPeriod();Ze(e)&&(v.display.period=e)}else n(uo)&&s(co)&&(Wr.includes(i.curves[0].style)&&(v=jn(v,ro,(e=>(delete e.inputs,e)))),"PerRange"===v.data.aggregation.spec&&(v.data.aggregation={unit:"Day"}));const P=new Map([['..plots{.type === "Study"}',e=>{const t=Rn(e.study);if(!Xe(t))return Ci.NULL_OBJECT;const i=Bn(t);return n(ho)||n(po)||n(uo)&&i?Ci.NULL_OBJECT:e}],['..plots{.type === "BalanceSheet" || .type === "IncomeStatement"}',e=>n(co)?(e.symbol=a,e):Ci.NULL_OBJECT],["..plots{..events}",e=>(n(co)||delete e.events,e)]]);for(const[e,t]of P)v=jn(v,e,t);return u&&!A&&(v=$r(v,{type:r,curves:[{}]})),v=Mo(v),v}function yo(e){const t=SP().getDefaultDensity();Ze(t)&&(e.display.density=t)}function To(e,t){return jn(e,'..plots{.type === "Study" && (.study === "VOL" || .study === "MAVOL")}.curves{.fields === "TradeSize" || .fields === "Volume"}',(e=>(e.fields=t?[Do.TradeSize.id]:[Do.Volume.id],e)))}function So(e,t){const i=_r(e.data.aggregation),s=i.isTick&&!i.hasSpec,n=_r(t),r=n.isTick&&!n.hasSpec,o=e=>e.isIntraday&&e.hasSpec&&e.spec===E.PerRange,a=o(i),l=o(n);let c=jn(e,`${ro}.curves[0]`,(e=>{const t=[Do.Open.id,Do.High.id,Do.Low.id,Do.Close.id,Do.Change.id].slice();if(!a&&l)return kr("Range",!0);if(a&&!l&&(e.style="OHLC"),!r&&s){const i=SP().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=[Do.Last.id,Do.Change.id],e.style="Line",e.colors=["#0055cc"],e.varyColorPerBar=!1);return e}));return c=c=To(c,r),dt(c.data.aggregation,t),i.unit===n.unit&&i.size===n.size||(Hr(c),Rr(c),yo(c),Nr(c)),c}function Ao(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getTime()<s.getTime()}function vo(e,t){Mt(2,arguments);var i=_t(t);return wt(e,-i)}function Po(e){return Ze(e)&&e!==Ci.AUTOFIT_PERIOD}function Co(e){const t=Yn(e,"..axes{.annotations{.points{!.price || !.time}}}");t.length>0&&t.forEach((e=>{const t=e.annotations.map((e=>{const t=e.points.find((e=>Ze(e.price))),i=e.points.find((e=>Ze(e.time)));return Ze(t)&&Ze(i)?(e.points.forEach((e=>{Ze(e.price)||(e.price=t.price),Ze(e.time)||(e.time=i.time)})),e):null})).filter((e=>Ze(e)));t.length>0?e.annotations=t:delete e.annotations}));const i=Yn(e,"..panes"),s=e=>Ze(e.height)?e.height:1,n=i.map((e=>s(e))),r=Math.min(...n),o=r<.01?5/r:1;i.forEach((e=>e.height=Je(o*s(e),4)));const a=SP().config.showResizeHandles||!1;e.display.xAxis.resizeHandles=a;const l="wheel+shift";let c=SP().config.scrollBehavior||l;Object.values(re).filter((e=>"string"==typeof e)).includes(c)||(c=l),e.display.scrollBehavior=c;const u=Yn(e,'..plots{.type === "Study" && .study === "RSI"}');var h;return u.length>0&&u.forEach((e=>{if(Ze(e.bands)&&e.bands.length>0){const t=e.inputs&&1===e.inputs.length&&e.inputs[0].name===Ci.INPUT_PERIOD?e.inputs[0].value:null,i=Rn("RSI").defaults;e.curves=i.curves,e.inputs=i.inputs,Ze(t)&&(e.inputs[0].value=t),delete e.bands,e.levels=i.levels}})),(h=e).display?.density?(Hr(h),Rr(h)):Po(h.display?.period)&&Rr(h),function(e){const t=nt(e.display,null,"chart","bar");if(Ze(t)){const[e,i]=gt(t.width||0,t.spacing||0,Ci.MINIMUM_BAR_WIDTH,Ci.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=Yn(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=Yn(e,"..panes[0].axes[0].scale");if(1===t.length){const i=t[0],s=Yn(e,"..panes[0]..axes");s.length>0&&s.forEach((e=>e.scale=i))}}(e),function(e){const[t]=Yn(e,ro);Ze(t)&&t.type===U[U.Symbol]&&!Wr.includes(t.curves[0].style)&&Ze(t.inputs)&&delete t.inputs}(e),function(e){const[t]=Yn(e,ro);Ze(t)&&t.type===U[U.Symbol]&&t.curves[0].style===v[v.Renko]&&Ze(t.inputs)&&t.inputs.map((e=>e.value)).some((e=>void 0===e))&&(t.inputs=rt(Ci.DEFAULT_RENKO_INPUTS))}(e),function(e){const[t]=Yn(e,ro);if(Ze(t)&&t.type===U[U.Expression]){const i=t.curves[0].style,s=i===v[v.Range],n=i===v[v.Baseline],r=Wr.includes(i);s&&e.data?.aggregation.spec===E[E.PerRange]&&(e.data.aggregation={unit:"Day"}),n||!r&&!s||(delete t.inputs,t.curves[0]=kr("Candlestick",!0))}}(e),function(e){Yn(e,"..annotations").forEach((e=>{const{id:t,traits:i}=e;cr(t,i),lr(t,i)}))}(e),function(e){try{In(!1),Yn(e,'..plots{.type === "Study" && .curves.zones}').forEach((e=>{const t=Rn(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{In(!0)}}(e),function(e){const[t]=Yn(e,ro);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=Yn(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"===SP()?.config?.mode&&(delete e.data?.extendedHours,delete e.data?.buildContinuation)}(e),function(e){const t=e.data?.aggregation,i=e.data?.extendedHours,s=Xe(i);t&&"FormT"===t.spec&&(t.spec="None",s||(e.data.extendedHours=!0))}(e),function(e){const t=e.data?.buildContinuation,i=Xe(t),s=e.data?.aggregation;i&&s&&("Continue"!==s.spec||t||(s.spec="None"),t&&(s.spec="Continue"))}(e),function(e){try{In(!1),Yn(e,'..plots{.type === "Study" && .curves.varyColorPerBar}').forEach((e=>{const t=Rn(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{In(!0)}}(e),function(e){try{In(!1),Yn(e,'..plots{.type === "Study"}').forEach((e=>{const t=Rn(e.study).defaults;Xe(e.inputs)&&e.inputs.forEach(((e,i)=>{const s=t.inputs?.[i]?.value;!Xe(e.value)&&Xe(s)&&(e.value=s)})),Xe(e.levels)&&e.levels.forEach(((e,i)=>{const s=t.levels?.[i]?.value;!Xe(e.value)&&Xe(s)&&(e.value=s)})),Xe(e.bands)&&e.bands.forEach(((e,i)=>{const s=t.bands?.[i]?.range;!Xe(e.range.from)&&Xe(s?.from)&&(e.range.from=s.from),!Xe(e.range.to)&&Xe(s?.to)&&(e.range.to=s.to)}))}))}finally{In(!0)}}(e),function(e){let t=jn(e,"..annCache{!.annotations}",(e=>Ci.NULL_OBJECT));t=jn(t,"..annCache",(e=>{const t=ri(e.symbol);return null===t?e:Ao(t,vo(new Date,3))?Ci.NULL_OBJECT:e})),t=jn(t,"..annotations{.id === 'ComputedText' && !.traits.textLines}",(e=>Ci.NULL_OBJECT));const i=t.data.aggregation;return To(t,"Tick"===i.unit&&"None"===i.spec)}(e)}var bo;bo=n("2nrEA");let Eo=null;function _o(t,i){null===Eo&&(Eo=e(bo)(),Eo.defaultOptions.useDefault=!0,[Ci.CHART_SCHEMA,Ci.STUDIES_SCHEMA,Ci.FIELDS_SCHEMA,Ci.ACCESSOR_SCHEMA].forEach((e=>{Eo.addSchema(e,Mn(e))})));let s=mr(t,i);(function(e){return e===Ci.CHART_SCHEMA})(i)&&(Yn(s,`..plots{.type==="${U[U.Study]}"}`).forEach((e=>{const t=Rn(e.study);Ze(t)&<(e,t.defaults)})),s=Co(s));const n=Eo.validate(i,s);if(!!n){const e=JSON.stringify(n,null,4);throw new Error(`Document not valid according to schema ${i}; error is ${e}`)}return function(e){return e===Ci.ACCESSOR_SCHEMA}(i)&&function(e){const{id:t,context:i}=e,s=e=>Ze(i[e]),n=(e,t)=>{if(!Ze(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(!Ze(i.forward)){if(!Ze(i.curves)||!Ze(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(!Ze(i.seasonal)){if(!Ze(i.curves)||!Ze(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=Rn(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(!Ze(i.curves)||i.curves.length!==t.defaults.curves.length)throw new Error(s("curves"));const a=e(i.curves);if(0!==Me(e(t.defaults.curves),a).length)throw new Error(o("fields"));break}}}}(s),s}function Mo(e){const t=jn(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 jn(t,"..panes{!.axes}",(e=>Ci.NULL_OBJECT))}var Lo;Lo=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":"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":"(H+L)/2","shortName":"HL/2"},{"id":"HLC/3","category":"Study","name":"(H+L+C)/3","shortName":"HLC/3"},{"id":"OHLC/4","category":"Study","name":"(O+H+L+C)/4","shortName":"OHLC/4"},{"id":"HLCC/4","category":"Study","name":"(H+L+C+C)/4","shortName":"HLCC/4"},{"id":"AVG","category":"Study","name":"Average","shortName":"AVG"},{"id":"MA","category":"Study","name":"MA-Simple","shortName":"MA"},{"id":"MACLD1","category":"Study","name":"MA-Cloud-Fast","shortName":"MACLD1"},{"id":"MACLD2","category":"Study","name":"MA-Cloud-Slow","shortName":"MACLD2"},{"id":"MA1","category":"Study","name":"MA1-Simple","shortName":"MA1"},{"id":"MA2","category":"Study","name":"MA2-Simple","shortName":"MA2"},{"id":"MA3","category":"Study","name":"MA3-Simple","shortName":"MA3"},{"id":"MA4","category":"Study","name":"MA4-Simple","shortName":"MA4"},{"id":"MA5","category":"Study","name":"MA5-Simple","shortName":"MA5"},{"id":"MA6","category":"Study","name":"MA6-Simple","shortName":"MA6"},{"id":"MA7","category":"Study","name":"MA7-Simple","shortName":"MA7"},{"id":"MA8","category":"Study","name":"MA8-Simple","shortName":"MA8"},{"id":"MA9","category":"Study","name":"MA9-Simple","shortName":"MA9"},{"id":"MA10","category":"Study","name":"MA10-Simple","shortName":"MA10"},{"id":"MAS","category":"Study","name":"MA-Shorter","shortName":"MAS"},{"id":"MAL","category":"Study","name":"MA-Longer","shortName":"MAL"},{"id":"CMBCI","category":"Study","name":"Composite Index","shortName":"CMBCI"},{"id":"CMBCIF","category":"Study","name":"Fast Ma","shortName":"CMBCIF"},{"id":"CMBCIS","category":"Study","name":"Slow Ma","shortName":"CMBCIS"},{"id":"COTI","category":"Study","name":"COT Index","shortName":"COTI"},{"id":"CHEXL","category":"Study","name":"ChandelierExitLong","shortName":"CHEXL"},{"id":"CHEXS","category":"Study","name":"ChandelierExitShort","shortName":"CHEXS"},{"id":"SUPTR","category":"Study","name":"Supertrend","shortName":"SUPTR"},{"id":"BARCOLIX","category":"Study","name":"BarColorIndex","shortName":"BARCOLIX"},{"id":"BARKIND","category":"Study","name":"BarKind","shortName":"BARKIND"},{"id":"BREL","category":"Study","name":"BarRelation","shortName":"BREL"},{"id":"EMA","category":"Study","name":"MA-Exp","shortName":"MA(EXP)"},{"id":"MAHI","category":"Study","name":"MA-High","shortName":"MA(HI)"},{"id":"MALO","category":"Study","name":"MA-Low","shortName":"MA(LO)"},{"id":"MACD","category":"Study","name":"MACD","shortName":"MACD"},{"id":"MACDS","category":"Study","name":"MACD-Signal","shortName":"MACD(S)"},{"id":"MACDH","category":"Study","name":"MACD-Histogram","shortName":"MACD(H)"},{"id":"ENVU","category":"Study","name":"Envelope-Up","shortName":"ENV(UP)"},{"id":"ENVD","category":"Study","name":"Envelope-Down","shortName":"ENV(DN)"},{"id":"ENVEXPU","category":"Study","name":"Envelope-Exponential-Up","shortName":"ENVEXP(UP)"},{"id":"ENVEXPD","category":"Study","name":"Envelope-Exponential-Down","shortName":"ENVEXP(DN)"},{"id":"ENVSMOU","category":"Study","name":"Envelope-Smoothed-Up","shortName":"ENVSMO(UP)"},{"id":"ENVSMOD","category":"Study","name":"Envelope-Smoothed-Down","shortName":"ENVSMO(DN)"},{"id":"SMA","category":"Study","name":"MA-Smoothed","shortName":"MA(S)"},{"id":"CSHO","category":"Study","name":"Cash-Overlay","shortName":"CSHO"},{"id":"CSHB","category":"Study","name":"Cash-Basis","shortName":"CSHB"},{"id":"TMA","category":"Study","name":"MA-Triangular","shortName":"MA(TRI)"},{"id":"WMA","category":"Study","name":"MA-Weighted","shortName":"MA(W)"},{"id":"VOLMA","category":"Study","format":"UseMetricUnit","name":"MA-Volume","shortName":"VOLMA"},{"id":"OSC","category":"Study","name":"OSC","shortName":"OSC"},{"id":"VOSC","category":"Study","format":"UseMetricUnit","name":"OSC-Volume","shortName":"VOLOSC"},{"id":"RSI","category":"Study","name":"RSI","shortName":"RSI"},{"id":"RSIAVG","category":"Study","name":"RSI-Average","shortName":"RSIAVG"},{"id":"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":"BOLLBU","category":"Study","name":"Bollinger-Upper","shortName":"BOLL(U)"},{"id":"BOLLBL","category":"Study","name":"Bollinger-Lower","shortName":"BOLL(L)"},{"id":"BOLLBM","category":"Study","name":"Bollinger-Mid","shortName":"BOLL(M)"},{"id":"BOLLBW","category":"Study","name":"Bollinger-Width","shortName":"BOLLW"},{"id":"BOLLBP","category":"Study","name":"Bollinger-Percent","shortName":"%B"},{"id":"BOLLSQ","category":"Study","name":"Bollinger-Squeeze","shortName":"BOLL(S)"},{"id":"PCUP1","category":"Study","name":"ProbCone-Up1","shortName":"PCUP1"},{"id":"PCDN1","category":"Study","name":"ProbCone-Down1","shortName":"PCDN1"},{"id":"PCUP2","category":"Study","name":"ProbCone-Up2","shortName":"PCUP2"},{"id":"PCDN2","category":"Study","name":"ProbCone-Down2","shortName":"PCDN2"},{"id":"PCUP3","category":"Study","name":"ProbCone-Up3","shortName":"PCUP3"},{"id":"PCDN3","category":"Study","name":"ProbCone-Down3","shortName":"PCDN3"},{"id":"PCTD","category":"Study","name":"ProbCone-TgtDate","shortName":"PCTD"},{"id":"PCTP","category":"Study","name":"ProbCone-TgtPrice","shortName":"PCTP"},{"id":"MBBUO","category":"Study","name":"ModifiedBoll-UppOut","shortName":"MBOLL(UO)"},{"id":"MBBUI","category":"Study","name":"ModifiedBoll-UppIn","shortName":"MBOLL(UI)"},{"id":"MBBM","category":"Study","name":"ModifiedBoll-Mid","shortName":"MBOLL(M)"},{"id":"MBBLI","category":"Study","name":"ModifiedBoll-LowIn","shortName":"MBOLL(LI)"},{"id":"MBBLO","category":"Study","name":"ModifiedBoll-LowOut","shortName":"MBOLL(LO)"},{"id":"OBVOL","category":"Study","format":"UseMetricUnit","name":"OnBalanceVol","shortName":"OBVOL"},{"id":"OBVOLAVG","category":"Study","format":"UseMetricUnit","name":"OnBalanceVolAvg","shortName":"OBVOL"},{"id":"TR","category":"Study","name":"TrueRange","shortName":"TR"},{"id":"ATR","category":"Study","name":"AvgTrueRange","shortName":"ATR"},{"id":"ATRMA","category":"Study","name":"MA-ATR","shortName":"MA(ATR)"},{"id":"ADJATR","category":"Study","name":"AdjAvgTrueRange","shortName":"ADJATR"},{"id":"COTR","category":"Study","name":"ChgOverTrueRange","shortName":"COTR"},{"id":"ATRP","category":"Study","name":"AvgTrueRangePerc","shortName":"ATRP"},{"id":"STOMOMIX","category":"Study","name":"StochMomIndex","shortName":"STOMOMIX"},{"id":"CHDMOMOSC","category":"Study","name":"ChandeMomOsc","shortName":"CHDMOMOSC"},{"id":"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":"KCEUP","category":"Study","name":"KeltChanExp-Up","shortName":"KELE(UP)"},{"id":"KCEMID","category":"Study","name":"KeltChanExp-Mid","shortName":"KELE(MID)"},{"id":"KCELOW","category":"Study","name":"KeltChanExp-Low","shortName":"KELE(LO)"},{"id":"DONUP","category":"Study","name":"Donchian-Up","shortName":"DON(U)"},{"id":"DONMID","category":"Study","name":"Donchian-Mid","shortName":"DON(M)"},{"id":"DONLOW","category":"Study","name":"Donchian-Low","shortName":"DON(L)"},{"id":"DONW","category":"Study","name":"Donchian-Width","shortName":"DON(W)"},{"id":"PVT","category":"Study","format":"UseMetricUnit","name":"PriceVolChange","shortName":"PVOL"},{"id":"TRIX","category":"Study","name":"Triple-MA-Exp","shortName":"TRIX"},{"id":"ROC","category":"Study","name":"RateOfChange","shortName":"ROC"},{"id":"PVPT","category":"Study","name":"PivotPoint","shortName":"PVMOV"},{"id":"PVPTR","category":"Study","name":"PvtPt-Resistance","shortName":"PVMOV(R)"},{"id":"PVPTS","category":"Study","name":"PvtPt-Support","shortName":"PVMOV(S)"},{"id":"ARNUP","category":"Study","name":"Aroon-Up","shortName":"ARN(UP)"},{"id":"ARNLOW","category":"Study","name":"Aroon-Down","shortName":"ARN(DN)"},{"id":"VSTOPUP","category":"Study","name":"VolaStop-Up","shortName":"VSTOP(UP)"},{"id":"VSTOPLOW","category":"Study","name":"VolaStop-Down","shortName":"VSTOP(DN)"},{"id":"ARNOSC","category":"Study","name":"Aroon-Osci","shortName":"ARNOSC"},{"id":"TCHNUP","category":"Study","name":"TurtleChn-Up","shortName":"TCH(UP)"},{"id":"TCHNLOW","category":"Study","name":"TurtleChn-Low","shortName":"TCH(LO)"},{"id":"TCHRE","category":"Study","name":"TurtleChnRetrace","shortName":"TCHRE"},{"id":"ALJAW","category":"Study","name":"Alligator-Jaw","shortName":"AL(J)"},{"id":"ALTEETH","category":"Study","name":"Alligator-Teeth","shortName":"AL(T)"},{"id":"ALLIPS","category":"Study","name":"Alligator-Lips","shortName":"AL(L)"},{"id":"PLTLN","category":"Study","name":"PlotLine","shortName":"LINE"},{"id":"AWOS","category":"Study","name":"AwesomeOsc","shortName":"AWOSC"},{"id":"AWOSMA","category":"Study","name":"AwesomeOsc-MA","shortName":"AWOSC(MA)"},{"id":"MFMUL","category":"Study","name":"MoneyFlowMul"},{"id":"CLV","category":"Study","name":"CloseLocationValue","shortName":"CLV"},{"id":"CHOP","category":"Study","name":"ChoppinessIndex","shortName":"ChopIx"},{"id":"CHAMF","category":"Study","name":"ChaikinMoneyFlow","shortName":"CHAIKMF"},{"id":"CHAVOL","category":"Study","name":"ChaikinVolatility","shortName":"CHAIKVOL"},{"id":"DPO","category":"Study","name":"DetrendedPriceOsc","shortName":"DPO"},{"id":"CCI","category":"Study","name":"CommodityChannelIndex","shortName":"CCI"},{"id":"EMV","category":"Study","name":"EaseOfMovement","shortName":"EOM"},{"id":"EMVMA","category":"Study","name":"EaseOfMovementMA","shortName":"EOM(MA)"},{"id":"ERBLPOW","category":"Study","name":"ElderRayBullPow","shortName":"ER(BULL)"},{"id":"ERBRPOW","category":"Study","name":"ElderRayBearPow","shortName":"ER(BEAR)"},{"id":"FI","category":"Study","format":"UseMetricUnit","name":"ForceIndex","shortName":"FORCE"},{"id":"MI","category":"Study","name":"MassIndex","shortName":"MASS"},{"id":"MOM","category":"Study","name":"Momentum","shortName":"MOM"},{"id":"MOMMA","category":"Study","name":"MA-Momentum","shortName":"MA(MOM)"},{"id":"MFI","category":"Study","name":"MoneyFlowIndex","shortName":"MFI"},{"id":"MSD","category":"Study","name":"MovingStdDev","shortName":"MSD"},{"id":"PCTCHG","category":"Study","name":"PercentChange","shortName":"PCTCHG"},{"id":"LINRUP","category":"Study","name":"LinRegUpper","shortName":"LINRUP"},{"id":"LINRMID","category":"Study","name":"LinRegMiddle","shortName":"LINRMID"},{"id":"LINRLOW","category":"Study","name":"LinRegLower","shortName":"LINRLOW"},{"id":"NVI","category":"Study","name":"NegativeVolIndex","shortName":"NVI"},{"id":"NVIEMA","category":"Study","name":"NegativeVolIndexEMA","shortName":"NVI(EMA)"},{"id":"PVI","category":"Study","name":"PositiveVolIndex","shortName":"PVI"},{"id":"PVIEMA","category":"Study","name":"PositiveVolIndexEMA","shortName":"PVI(EMA)"},{"id":"PPO","category":"Study","name":"PercPriceOsc","shortName":"PPO"},{"id":"PPOS","category":"Study","name":"PPO-Signal","shortName":"PPO(S)"},{"id":"PPOH","category":"Study","name":"PPO-Histogram","shortName":"PPO(H)"},{"id":"PVO","category":"Study","name":"PercVolOsc","shortName":"PVO"},{"id":"PVOS","category":"Study","name":"PVO-Signal","shortName":"PVO(S)"},{"id":"PVOH","category":"Study","name":"PVO-Histogram","shortName":"PVO(H)"},{"id":"HV","category":"Study","name":"HistVolatility","shortName":"HISTVOL"},{"id":"PERF","category":"Study","name":"Performance","shortName":"PERF"},{"id":"STC","category":"Study","name":"SchaffTrendCycle","shortName":"STC"},{"id":"MCCLO","category":"Study","name":"McClellanOsc","shortName":"MCCLO"},{"id":"BTI","category":"Study","name":"BreadthThrust","shortName":"BTI"},{"id":"NHLAI","category":"Study","name":"NewHiLoAccIx","shortName":"NHLAI"},{"id":"KST","category":"Study","name":"KnowSureThing","shortName":"KST"},{"id":"KSTSIG","category":"Study","name":"KST-Signal","shortName":"KSTSIG"},{"id":"WASI","category":"Study","name":"WilderAccSwingIndex","shortName":"WACCSW"},{"id":"WWVSARU","category":"Study","name":"WilderVolSarUp","shortName":"WVOL-UP"},{"id":"WWVSARD","category":"Study","name":"WilderVolSarDown","shortName":"WVOL-DN"},{"id":"PARSARS","category":"Study","name":"ParabolicSarShort","shortName":"SHORT"},{"id":"PARSARL","category":"Study","name":"ParabolicSarLong","shortName":"LONG"},{"id":"REATRHI","category":"Study","name":"RetraceATRHigh","shortName":"REATRHI"},{"id":"REATRLO","category":"Study","name":"RetraceATRLow","shortName":"REATRLO"},{"id":"MOVLR","category":"Study","name":"MovingLinRegression","shortName":"MOVLINREG"},{"id":"TRSP1","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"TRSP2","category":"Study","name":"TrendSeeker®","shortName":"TREND"},{"id":"COTLCCMSP","category":"Study","name":"Comm Spec","shortName":"COT(C)"},{"id":"COTLCLGSP","category":"Study","name":"Large Spec","shortName":"COT(L)"},{"id":"COTLCSMSP","category":"Study","name":"Small Spec","shortName":"COT(S)"},{"id":"COTDAGPRO","category":"Study","name":"Producers","shortName":"COTDIS(P)"},{"id":"COTDAGSPD","category":"Study","name":"Swap Dealers","shortName":"COTDIS(S)"},{"id":"COTDAGMNM","category":"Study","name":"Managed Money","shortName":"COTDIS(M)"},{"id":"COTDAGOTH","category":"Study","name":"Other Report","shortName":"COTDIS(O)"},{"id":"COTFTRDLI","category":"Study","name":"Dealer Intermediary","shortName":"COTFIN(D)"},{"id":"COTFTRASM","category":"Study","name":"Asset Manager","shortName":"COTFIN(A)"},{"id":"COTFTRLVF","category":"Study","name":"Leveraged Funds","shortName":"COTFIN(L)"},{"id":"COTFTROTH","category":"Study","name":"Other Report","shortName":"COTFIN(O)"},{"id":"PPTPIV","category":"Study","name":"Pivot Point","shortName":"PPT(P)"},{"id":"PPTR1","category":"Study","name":"1st Resistance","shortName":"PPT(R1)"},{"id":"PPTR2","category":"Study","name":"2nd Resistance","shortName":"PPT(R2)"},{"id":"PPTR3","category":"Study","name":"3rd Resistance","shortName":"PPT(R3)"},{"id":"PPTS1","category":"Study","name":"1st Support","shortName":"PPT(S1)"},{"id":"PPTS2","category":"Study","name":"2nd Support","shortName":"PPT(S2)"},{"id":"PPTS3","category":"Study","name":"3rd Support","shortName":"PPT(S3)"},{"id":"CPPH4","category":"Study","name":"4th Camarilla Res","shortName":"CPP(H4)"},{"id":"CPPH3","category":"Study","name":"3rd Camarilla Res","shortName":"CPP(H3)"},{"id":"CPPH2","category":"Study","name":"2nd Camarilla Res","shortName":"CPP(H2)"},{"id":"CPPH1","category":"Study","name":"1st Camarilla Res","shortName":"CPP(H1)"},{"id":"CPPL1","category":"Study","name":"1st Camarilla Supp","shortName":"CPP(L1)"},{"id":"CPPL2","category":"Study","name":"2nd Camarilla Supp","shortName":"CPP(L2)"},{"id":"CPPL3","category":"Study","name":"3rd Camarilla Supp","shortName":"CPP(L3)"},{"id":"CPPL4","category":"Study","name":"4th Camarilla Supp","shortName":"CPP(L4)"},{"id":"IMPVOL","category":"Study","name":"Implied Volatility","shortName":"IV"},{"id":"CTM","category":"Study","name":"Cycle Trading Momentum","shortName":"CTM"},{"id":"CPMI","category":"Study","name":"Principal Momentum","shortName":"CPMI"},{"id":"CTPI","category":"Study","name":"Turning Point","shortName":"CTPI"},{"id":"CTLTM","category":"Study","name":"Long-Term Momentum","shortName":"LTM"},{"id":"CTLTMF","category":"Study","name":"Long-Term Momentum, Fast","shortName":"LTM(F)"},{"id":"DEMA","category":"Study","name":"Double EMA","shortName":"DEMA"},{"id":"TEMA","category":"Study","name":"Triple EMA","shortName":"TEMA"},{"id":"TSI","category":"Study","name":"True Strength Index","shortName":"Tsi"},{"id":"TSISIG","category":"Study","name":"True Strength Index Signal","shortName":"TsiSig"},{"id":"GMMA3","category":"Study","name":"GMMA-EMA3","shortName":"GMMA(3)"},{"id":"GMMA5","category":"Study","name":"GMMA-EMA5","shortName":"GMMA(5)"},{"id":"GMMA8","category":"Study","name":"GMMA-EMA8","shortName":"GMMA(8)"},{"id":"GMMA10","category":"Study","name":"GMMA-EMA10","shortName":"GMMA(10)"},{"id":"GMMA12","category":"Study","name":"GMMA-EMA12","shortName":"GMMA(12)"},{"id":"GMMA15","category":"Study","name":"GMMA-EMA15","shortName":"GMMA(15)"},{"id":"GMMA30","category":"Study","name":"GMMA-EMA30","shortName":"GMMA(30)"},{"id":"GMMA35","category":"Study","name":"GMMA-EMA35","shortName":"GMMA(35)"},{"id":"GMMA40","category":"Study","name":"GMMA-EMA40","shortName":"GMMA(40)"},{"id":"GMMA45","category":"Study","name":"GMMA-EMA45","shortName":"GMMA(45)"},{"id":"GMMA50","category":"Study","name":"GMMA-EMA50","shortName":"GMMA(50)"},{"id":"GMMA60","category":"Study","name":"GMMA-EMA60","shortName":"GMMA(60)"},{"id":"CONVLN","category":"Study","name":"ConversionLine","shortName":"ConvLn"},{"id":"BASELN","category":"Study","name":"BaseLine","shortName":"BaseLn"},{"id":"LEADSP1","category":"Study","name":"LeadingSpanA","shortName":"LeadSpA"},{"id":"LEADSP2","category":"Study","name":"LeadingSpanB","shortName":"LeadSpB"},{"id":"LAGGSP","category":"Study","name":"LaggingSpan","shortName":"LaggSp"},{"id":"VWAP","category":"Study","name":"VWAP","shortName":"VWAP"},{"id":"AVWAP","category":"Study","name":"Anchored VWAP","shortName":"Anch-VWAP"},{"id":"VWAPSD1U","category":"Study","name":"VWAP Stdev1 Upper","shortName":"VWAP-Std1-Up"},{"id":"VWAPSD1L","category":"Study","name":"VWAP Stdev1 Lower","shortName":"VWAP-Std1-Lo"},{"id":"VWAPSD2U","category":"Study","name":"VWAP Stdev2 Upper","shortName":"VWAP-Std2-Up"},{"id":"VWAPSD2L","category":"Study","name":"VWAP Stdev2 Lower","shortName":"VWAP-Std2-Lo"},{"id":"DIFA","category":"Study","name":"Distance From Average","shortName":"DistAvg"},{"id":"DOSCH","category":"Study","name":"Derivative Oscillator","shortName":"DerOsc"},{"id":"DOSCS","category":"Study","name":"Derivative Oscillator Signal","shortName":"DerOscSig"},{"id":"TTMSQZON","category":"Study","name":"TTM Squeeze On","shortName":"TtmSqzOn"},{"id":"TTMSQZOFF","category":"Study","name":"TTM Squeeze Off","shortName":"TtmSqzOff"},{"id":"TTMSQZOSC","category":"Study","name":"TTM Squeeze Osc","shortName":"TtmSqzOsc"},{"id":"CRS","category":"Study","name":"CompRelStrength","shortName":"CRS"},{"id":"CRSAVG","category":"Study","name":"CompRelStrengthAvg","shortName":"CRS-Avg"},{"id":"DRS","category":"Study","name":"DorseyRelStrength","shortName":"DRS"},{"id":"MRS","category":"Study","name":"MansfieldRelStrength","shortName":"MRS"},{"id":"PMO","category":"Study","name":"PriceMomOsc","shortName":"PMO"},{"id":"PMOS","category":"Study","name":"PriceMomOscSig","shortName":"PMOS"},{"id":"RVOL","category":"Study","name":"Relative Volume","shortName":"RVOL"},{"id":"AccountsPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Accounts Payable","shortName":"AcctsPay"},{"id":"AccruedExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Accrued Expenses","shortName":"AccrdExp"},{"id":"Cash","category":"BalanceSheet","format":"UseMetricUnit","name":"Cash & Cash Equivalents","shortName":"Cash&CashEqv"},{"id":"CommonShares","category":"BalanceSheet","format":"UseMetricUnit","name":"Common Shares","shortName":"CommonShares"},{"id":"DeferredIncomeTax","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Income Tax","shortName":"DefIncTax"},{"id":"DeferredLongRevenues","category":"BalanceSheet","format":"UseMetricUnit","name":"Deferred Revenues","shortName":"DefRev"},{"id":"EquityOtherInvestments","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity Investments","shortName":"OthEquityInvest"},{"id":"IncomeTaxPayable","category":"BalanceSheet","format":"UseMetricUnit","name":"Income Tax Payable","shortName":"IncTaxPayble"},{"id":"Intangibles","category":"BalanceSheet","format":"UseMetricUnit","name":"Intangibles","shortName":"Intangibles"},{"id":"Inventories","category":"BalanceSheet","format":"UseMetricUnit","name":"Inventories","shortName":"Inventory"},{"id":"LongTermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Long Term Debt","shortName":"LTDebt"},{"id":"MarketableSec","category":"BalanceSheet","format":"UseMetricUnit","name":"Liquid Securities","shortName":"LiqSecurities"},{"id":"OtherCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Miscellaneous Current Assets","shortName":"MiscCurrAssets"},{"id":"OtherCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Current Liabilities","shortName":"OthCurrLiab"},{"id":"OtherEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Equity","shortName":"OthEquity"},{"id":"OtherNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Assets","shortName":"OthNonCurrAssets"},{"id":"OtherNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Other Non-Current Liabilities","shortName":"OthNonCurrLiab"},{"id":"PpeNet","category":"BalanceSheet","format":"UseMetricUnit","name":"PPE Net","shortName":"PPENet"},{"id":"PrepaidExpenses","category":"BalanceSheet","format":"UseMetricUnit","name":"Prepaid Expenses","shortName":"PpdExp"},{"id":"Receivables","category":"BalanceSheet","format":"UseMetricUnit","name":"Receivables","shortName":"Receivables"},{"id":"RetainedEarnings","category":"BalanceSheet","format":"UseMetricUnit","name":"Retained Earnings","shortName":"RetEarnings"},{"id":"ShorttermDebt","category":"BalanceSheet","format":"UseMetricUnit","name":"Short-Term Debt","shortName":"ShortTermDebt"},{"id":"TotalAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Assets","shortName":"TotAssets"},{"id":"TotalCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Assets","shortName":"TotCurrAssets"},{"id":"TotalCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Current Liabilities","shortName":"TotCurrLiab"},{"id":"TotalLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities","shortName":"TotalLiab"},{"id":"TotalLiabilitiesAndEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Liabilities & Equity","shortName":"TotLiab&Equity"},{"id":"TotalNonCurrentAssets","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Assets","shortName":"TotNonCurrAssets"},{"id":"TotalNonCurrentLiabilities","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Non-Current Liabilities","shortName":"TotNonCurrLiabs"},{"id":"TotalShareholdersEquity","category":"BalanceSheet","format":"UseMetricUnit","name":"Total Shareholders Equity","shortName":"TotShareEquity"},{"id":"BasicEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Continued Operations","shortName":"EPSContOps"},{"id":"BasicEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Basic EPS Total Operations","shortName":"EPSTotOps"},{"id":"CostGoods","category":"IncomeStatement","format":"UseMetricUnit","name":"Cost of Goods","shortName":"COGS"},{"id":"DilutedEpsContOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Continued Operations","shortName":"DilutedEPSContOps"},{"id":"DilutedEpsTotalOp","category":"IncomeStatement","format":"UseMetricUnit","name":"Diluted EPS Total Operations","shortName":"DilutedEPSTotOps"},{"id":"Ebitda","category":"IncomeStatement","format":"UseMetricUnit","name":"EBITDA","shortName":"EBITDA"},{"id":"GrossProfit","category":"IncomeStatement","format":"UseMetricUnit","name":"Gross Profit","shortName":"GrProfit"},{"id":"IncomeTax","category":"IncomeStatement","format":"UseMetricUnit","name":"Income Tax","shortName":"IncomeTax"},{"id":"InterestExpense","category":"IncomeStatement","format":"UseMetricUnit","name":"Interest Expense","shortName":"IntExp"},{"id":"NetIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Net Income Less Expenses & Tax","shortName":"NetIncome"},{"id":"OperatingExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Expenses","shortName":"OpExpense"},{"id":"OperatingIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Operating Income","shortName":"OpIncome"},{"id":"OtherIncomeExpenses","category":"IncomeStatement","format":"UseMetricUnit","name":"Other Income","shortName":"OthInc"},{"id":"PreTaxIncome","category":"IncomeStatement","format":"UseMetricUnit","name":"Pretax Income","shortName":"PretaxInc"},{"id":"Sales","category":"IncomeStatement","format":"UseMetricUnit","name":"Sales","shortName":"Sales"},{"id":"JPIB","category":"Study","name":"JPI-Buy","shortName":"Buy"},{"id":"JPIS","category":"Study","name":"JPI-Sell","shortName":"Sell"}]');class Oo{constructor(e,t=O.Number,i=D.Common,s,n=I.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 wo={};let Io=!1;function xo(e){_o(e,Ci.FIELDS_SCHEMA).map((e=>{wo[e.id]=new Oo(e.id,O[e.type],D[e.category],e.name,I[e.format],e.shortName)}))}const Do=(Io||(xo(e(Lo)),Io=!0),wo),No={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",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"},Ro=[Do.Open,Do.High,Do.Low,Do.Close,Do.Volume,Do.Change,Do.PercentChange,Do.PreviousClose].reduce(((e,t,i)=>(e.set(t.id,1<<i),e)),new Map);function Ho(...e){return e.reduce(((e,t)=>Ro.has(t.id)?e|Ro.get(t.id):e),0)}class Vo{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){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&&Ro.has(i)&&(this._updated=this._updated|Ro.get(i)),n}}computeWellKnown(){const e=this.getValue(Do.Close),t=this.getValue(Do.PreviousClose);Ze(e,t)&&(this.hasField(Do.Change)&&this.update(Do.Change,e-t),this.hasField(Do.PercentChange)&&this.update(Do.PercentChange,(e-t)/t))}hasField(e){return Ze(this.fields)&&this.fields.includes(e)}hasSymbol(e){return!1}getValue(e){return this.hasField(e)?this.storage.get(e.id):null}shutdown(){}async ready(){return!1}}class Fo extends Vo{constructor(e){super(),this.symbol=e,this.translated=xi(this.symbol)}hasSymbol(e){return this.symbol===e}}class Bo extends Vo{constructor(e){super(Ci.PLACEHOLDER_SYMBOL_NAME),this.actual=e}async ready(){return!1}}class ko extends Vo{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 Uo={previousOpen:Do.PreviousOpen,previousClose:Do.PreviousClose,previousHigh:Do.PreviousHigh,previousLow:Do.PreviousLow,weeklyPreviousClose:Do.WeekPreviousClose,weeklyPreviousHigh:Do.WeekPreviousHigh,weeklyPreviousLow:Do.WeekPreviousLow,monthlyPreviousClose:Do.MonthPreviousClose,monthlyPreviousHigh:Do.MonthPreviousHigh,monthlyPreviousLow:Do.MonthPreviousLow,fiftyTwoWkHigh:Do.YearHigh,fiftyTwoWkLow:Do.YearLow},Wo=Object.values(Uo),$o=Object.keys(Uo);class Go extends Fo{triedFetchingExtraValues=!1;async ready(){return Ai.call(this,(async()=>{const e=SP().getMetaDataSource().getMetaData(this.symbol);return this.isValid=await e.ready(),this.isValid}))}shutdown(){}getValue(e){return this.hasField(e)&&Wo.includes(e)&&null===super.getValue(e)&&!this.triedFetchingExtraValues&&this.supplementPreviousValues(),super.getValue(e)}supplementPreviousValues(){this.triedFetchingExtraValues=!0,fP("ondemand",`/getQuote.json?symbols=${this.translated}&fields=${$o.join(",")}`).then((e=>{try{const t=JSON.parse(e);if(200===t.status.code&&1===t.results.length){const e=t.results[0];$o.forEach((t=>this.update(Uo[t],e[t]))),SP().getRecordSource().subject.next({topic:No.RT_QUOTE,data:{symbol:this.symbol}})}}catch(e){dP(`Failed to fetch extra values for ${this.translated}`,"error")}}))}}class zo extends Fo{isValid=!1;constructor(e){super(e)}addOptionalField(e,t){Ze(t)&&(this.addFields(e),this.update(e,t))}async ready(){return Ai.call(this,(async()=>{const e=SP().config.environment===r[r.NodeJs]?null:ui(`#${Ci.INLINE_DATA_ELEMENT_ID}`);if(Ze(e)){const t=JSON.parse(e);if(this.translated in t){const e=t[this.translated].quote;this.update(Do.Open,e.open),this.update(Do.High,e.high),this.update(Do.Low,e.low),this.update(Do.Close,e.close),this.update(Do.PreviousClose,e.previousClose),this.update(Do.Volume,e.volume),$o.filter((e=>"previousClose"!==e)).forEach((t=>{this.addOptionalField(Uo[t],e[t])})),this.isValid=!0}else this.isValid=!1}else this.isValid=!1;return this.isValid}))}}const Yo=[Do.Open,Do.High,Do.Low,Do.Close,Do.PreviousClose];class jo extends Vo{constructor(e,t){super();this.resolved=e.map((([e,t])=>t)),this.mapping=new Map(e.map((([e,t])=>{return[e,(i=t,SP().getRecordSource().getRecord(i))];var i}))),this.model=t;const i=Yo.concat(Do.Change,Do.PercentChange);this.addFields(...i.filter((e=>e!==Do.Volume)))}async ready(){return Ai.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(){Yo.forEach((e=>{const t=Zr(this.model,this.getOneValue(e));this.update(e,Number.isFinite(t)?t:null)})),this.computeWellKnown()}}function Ko(e,t){return i=>i.topic===e&&i.data.symbol===t}var qo=function(e,t){return qo=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])},qo(e,t)};function Xo(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}qo(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function Zo(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{l(s.next(e))}catch(e){r(e)}}function a(e){try{l(s.throw(e))}catch(e){r(e)}}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 Jo(e,t){var i,s,n,r,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(l){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(o=0)),o;)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 o.label++,{value:a[1],done:!1};case 5:o.label++,s=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],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])}}}Object.create;function Qo(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 ea(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(e){n={error:e}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return o}function ta(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 ia(e){return this instanceof ia?(this.v=e,this):new ia(e)}function sa(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s,n=i.apply(e,t||[]),r=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(e){n[e]&&(s[e]=function(t){return new Promise((function(i,s){r.push([e,t,i,s])>1||a(e,t)}))})}function a(e,t){try{(i=n[e](t)).value instanceof ia?Promise.resolve(i.value.v).then(l,c):u(r[0][2],i)}catch(e){u(r[0][3],e)}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 na(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=Qo(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)}))}}}Object.create;function ra(e){return"function"==typeof e}function oa(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}var aa=oa((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 la(e,t){if(e){var i=e.indexOf(t);0<=i&&e.splice(i,1)}}var ca=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=Qo(r),a=o.next();!a.done;a=o.next()){a.value.remove(this)}}catch(t){e={error:t}}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(ra(l))try{l()}catch(e){n=e instanceof aa?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=Qo(c),h=u.next();!h.done;h=u.next()){var d=h.value;try{da(d)}catch(e){n=null!=n?n:[],e instanceof aa?n=ta(ta([],ea(n)),ea(e.errors)):n.push(e)}}}catch(e){i={error:e}}finally{try{h&&!h.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}if(n)throw new aa(n)}},e.prototype.add=function(t){var i;if(t&&t!==this)if(this.closed)da(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)&&la(t,e)},e.prototype.remove=function(t){var i=this._finalizers;i&&la(i,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),ua=ca.EMPTY;function ha(e){return e instanceof ca||e&&"closed"in e&&ra(e.remove)&&ra(e.add)&&ra(e.unsubscribe)}function da(e){ra(e)?e():e.unsubscribe()}var pa=function(e){function t(t,i){return e.call(this)||this}return Xo(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(ca),fa={setInterval:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var n=fa.delegate;return(null==n?void 0:n.setInterval)?n.setInterval.apply(n,ta([e,t],ea(i))):setInterval.apply(void 0,ta([e,t],ea(i)))},clearInterval:function(e){var t=fa.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},ma=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 Xo(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),fa.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&&fa.clearInterval(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(e){s=!0,i=e||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,la(s,this),null!=t&&(this.id=this.recycleAsyncId(i,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(pa),ga={now:function(){return(ga.delegate||Date).now()},delegate:void 0},ya=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=ga.now,e}(),Ta=new(function(e){function t(t,i){void 0===i&&(i=ya.now);var s=e.call(this,t,i)||this;return s.actions=[],s._active=!1,s}return Xo(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}(ya))(ma),Sa=Ta,Aa={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},va={setTimeout:function(e,t){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var n=va.delegate;return(null==n?void 0:n.setTimeout)?n.setTimeout.apply(n,ta([e,t],ea(i))):setTimeout.apply(void 0,ta([e,t],ea(i)))},clearTimeout:function(e){var t=va.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Pa(e){va.setTimeout((function(){var t=Aa.onUnhandledError;if(!t)throw e;t(e)}))}function Ca(){}var ba=_a("C",void 0,void 0);function Ea(e){return _a("N",e,void 0)}function _a(e,t,i){return{kind:e,value:t,error:i}}var Ma=null;function La(e){if(Aa.useDeprecatedSynchronousErrorHandling){var t=!Ma;if(t&&(Ma={errorThrown:!1,error:null}),e(),t){var i=Ma,s=i.errorThrown,n=i.error;if(Ma=null,s)throw n}}else e()}var Oa=function(e){function t(t){var i=e.call(this)||this;return i.isStopped=!1,t?(i.destination=t,ha(t)&&t.add(i)):i.destination=Ha,i}return Xo(t,e),t.create=function(e,t,i){return new Da(e,t,i)},t.prototype.next=function(e){this.isStopped?Ra(Ea(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Ra(_a("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Ra(ba,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}(ca),wa=Function.prototype.bind;function Ia(e,t){return wa.call(e,t)}var xa=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){Na(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Na(e)}else Na(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Na(e)}},e}(),Da=function(e){function t(t,i,s){var n,r,o=e.call(this)||this;ra(t)||!t?n={next:null!=t?t:void 0,error:null!=i?i:void 0,complete:null!=s?s:void 0}:o&&Aa.useDeprecatedNextContext?((r=Object.create(t)).unsubscribe=function(){return o.unsubscribe()},n={next:t.next&&Ia(t.next,r),error:t.error&&Ia(t.error,r),complete:t.complete&&Ia(t.complete,r)}):n=t;return o.destination=new xa(n),o}return Xo(t,e),t}(Oa);function Na(e){var t;Aa.useDeprecatedSynchronousErrorHandling?(t=e,Aa.useDeprecatedSynchronousErrorHandling&&Ma&&(Ma.errorThrown=!0,Ma.error=t)):Pa(e)}function Ra(e,t){var i=Aa.onStoppedNotification;i&&va.setTimeout((function(){return i(e,t)}))}var Ha={closed:!0,next:Ca,error:function(e){throw e},complete:Ca},Va="function"==typeof Symbol&&Symbol.observable||"@@observable";function Fa(e){return e}function Ba(e){return 0===e.length?Fa:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var ka=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 Oa||function(e){return e&&ra(e.next)&&ra(e.error)&&ra(e.complete)}(s)&&ha(s)?e:new Da(e,t,i);return La((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=Ua(t))((function(t,s){var n=new Da({next:function(t){try{e(t)}catch(e){s(e),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[Va]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ba(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Ua(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 Ua(e){var t;return null!==(t=null!=e?e:Aa.Promise)&&void 0!==t?t:Promise}function Wa(e){return e&&ra(e.schedule)}function $a(e,t,i){void 0===e&&(e=0),void 0===i&&(i=Sa);var s=-1;return null!=t&&(Wa(t)?i=t:s=t),new ka((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 Ga(e,t){return void 0===e&&(e=0),void 0===t&&(t=Ta),e<0&&(e=0),$a(e,e,t)}var za=oa((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Ya=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 Xo(t,e),t.prototype.lift=function(e){var t=new ja(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new za},t.prototype.next=function(e){var t=this;La((function(){var i,s;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var n=Qo(t.currentObservers),r=n.next();!r.done;r=n.next()){r.value.next(e)}}catch(e){i={error:e}}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;La((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;La((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?ua:(this.currentObservers=null,r.push(e),new ca((function(){t.currentObservers=null,la(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 ka;return e.source=this,e},t.create=function(e,t){return new ja(e,t)},t}(ka),ja=function(e){function t(t,i){var s=e.call(this)||this;return s.destination=t,s.source=i,s}return Xo(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:ua},t}(Ya);function Ka(e){return function(t){if(function(e){return ra(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function qa(e,t,i,s,n){return new Xa(e,t,i,s,n)}var Xa=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(e){t.error(e)}}:e.prototype._next,a._error=n?function(e){try{n(e)}catch(e){t.error(e)}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 Xo(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}(Oa);function Za(e){return ra(e[Va])}function Ja(e){return Symbol.asyncIterator&&ra(null==e?void 0:e[Symbol.asyncIterator])}function Qa(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.")}var el="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function tl(e){return ra(null==e?void 0:e[el])}function il(e){return ra(null==e?void 0:e.getReader)}function sl(e){if(e instanceof ka)return e;if(null!=e){if(Za(e))return o=e,new ka((function(e){var t=o[Va]();if(ra(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 ka((function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()}));if(ra(null==(s=e)?void 0:s.then))return i=e,new ka((function(e){i.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Pa)}));if(Ja(e))return nl(e);if(tl(e))return t=e,new ka((function(e){var i,s;try{for(var n=Qo(t),r=n.next();!r.done;r=n.next()){var o=r.value;if(e.next(o),e.closed)return}}catch(e){i={error:e}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}}e.complete()}));if(il(e))return nl(function(e){return sa(this,arguments,(function(){var t,i,s;return Jo(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,ia(t.read())];case 3:return i=n.sent(),s=i.value,i.done?[4,ia(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,ia(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 Qa(e)}function nl(e){return new ka((function(t){(function(e,t){var i,s,n,r;return Zo(this,void 0,void 0,(function(){var o,a;return Jo(this,(function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),i=na(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 rl(e,t){return Ka((function(i,s){var n=0;i.subscribe(qa(s,(function(i){return e.call(t,i,n++)&&s.next(i)})))}))}function ol(e){return ol="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},ol(e)}function al(e){return Mt(1,arguments),e instanceof Date||"object"===ol(e)&&"[object Date]"===Object.prototype.toString.call(e)}function ll(e){if(Mt(1,arguments),!al(e)&&"number"!=typeof e)return!1;var t=Ot(e);return!isNaN(Number(t))}function cl(e,t){Mt(2,arguments);var i=Ot(e).getTime(),s=_t(t);return new Date(i+s)}function ul(e,t){Mt(2,arguments);var i=_t(t);return cl(e,-i)}var hl=864e5;function dl(e){Mt(1,arguments);var t=Ot(e),i=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var s=t.getTime(),n=i-s;return Math.floor(n/hl)+1}function pl(e){Mt(1,arguments);var t=1,i=Ot(e),s=i.getUTCDay(),n=(s<t?7:0)+s-t;return i.setUTCDate(i.getUTCDate()-n),i.setUTCHours(0,0,0,0),i}function fl(e){Mt(1,arguments);var t=Ot(e),i=t.getUTCFullYear(),s=new Date(0);s.setUTCFullYear(i+1,0,4),s.setUTCHours(0,0,0,0);var n=pl(s),r=new Date(0);r.setUTCFullYear(i,0,4),r.setUTCHours(0,0,0,0);var o=pl(r);return t.getTime()>=n.getTime()?i+1:t.getTime()>=o.getTime()?i:i-1}function ml(e){Mt(1,arguments);var t=fl(e),i=new Date(0);i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0);var s=pl(i);return s}var gl=6048e5;function yl(e){Mt(1,arguments);var t=Ot(e),i=pl(t).getTime()-ml(t).getTime();return Math.round(i/gl)+1}function Tl(e,t){var i,s,n,r,o,a,l,c;Mt(1,arguments);var u=vr(),h=_t(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=Ot(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 Sl(e,t){var i,s,n,r,o,a,l,c;Mt(1,arguments);var u=Ot(e),h=u.getUTCFullYear(),d=vr(),p=_t(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=new Date(0);f.setUTCFullYear(h+1,0,p),f.setUTCHours(0,0,0,0);var m=Tl(f,t),g=new Date(0);g.setUTCFullYear(h,0,p),g.setUTCHours(0,0,0,0);var y=Tl(g,t);return u.getTime()>=m.getTime()?h+1:u.getTime()>=y.getTime()?h:h-1}function Al(e,t){var i,s,n,r,o,a,l,c;Mt(1,arguments);var u=vr(),h=_t(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=Sl(e,t),p=new Date(0);p.setUTCFullYear(d,0,h),p.setUTCHours(0,0,0,0);var f=Tl(p,t);return f}var vl=6048e5;function Pl(e,t){Mt(1,arguments);var i=Ot(e),s=Tl(i,t).getTime()-Al(i,t).getTime();return Math.round(s/vl)+1}function Cl(e,t){for(var i=e<0?"-":"",s=Math.abs(e).toString();s.length<t;)s="0"+s;return i+s}var bl={y:function(e,t){var i=e.getUTCFullYear(),s=i>0?i:1-i;return Cl("yy"===t?s%100:s,t.length)},M:function(e,t){var i=e.getUTCMonth();return"M"===t?String(i+1):Cl(i+1,2)},d:function(e,t){return Cl(e.getUTCDate(),t.length)},a:function(e,t){var i=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return i.toUpperCase();case"aaa":return i;case"aaaaa":return i[0];default:return"am"===i?"a.m.":"p.m."}},h:function(e,t){return Cl(e.getUTCHours()%12||12,t.length)},H:function(e,t){return Cl(e.getUTCHours(),t.length)},m:function(e,t){return Cl(e.getUTCMinutes(),t.length)},s:function(e,t){return Cl(e.getUTCSeconds(),t.length)},S:function(e,t){var i=t.length,s=e.getUTCMilliseconds();return Cl(Math.floor(s*Math.pow(10,i-3)),t.length)}},El="midnight",_l="noon",Ml="morning",Ll="afternoon",Ol="evening",wl="night";function Il(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+Cl(r,2)}function xl(e,t){return e%60==0?(e>0?"-":"+")+Cl(Math.abs(e)/60,2):Dl(e,t)}function Dl(e,t){var i=t||"",s=e>0?"-":"+",n=Math.abs(e);return s+Cl(Math.floor(n/60),2)+i+Cl(n%60,2)}var Nl={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 bl.y(e,t)},Y:function(e,t,i,s){var n=Sl(e,s),r=n>0?n:1-n;return"YY"===t?Cl(r%100,2):"Yo"===t?i.ordinalNumber(r,{unit:"year"}):Cl(r,t.length)},R:function(e,t){return Cl(fl(e),t.length)},u:function(e,t){return Cl(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 Cl(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 Cl(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 bl.M(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 Cl(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=Pl(e,s);return"wo"===t?i.ordinalNumber(n,{unit:"week"}):Cl(n,t.length)},I:function(e,t,i){var s=yl(e);return"Io"===t?i.ordinalNumber(s,{unit:"week"}):Cl(s,t.length)},d:function(e,t,i){return"do"===t?i.ordinalNumber(e.getUTCDate(),{unit:"date"}):bl.d(e,t)},D:function(e,t,i){var s=dl(e);return"Do"===t?i.ordinalNumber(s,{unit:"dayOfYear"}):Cl(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 Cl(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 Cl(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 Cl(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?_l:0===n?El: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?Ol:n>=12?Ll:n>=4?Ml:wl,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 bl.h(e,t)},H:function(e,t,i){return"Ho"===t?i.ordinalNumber(e.getUTCHours(),{unit:"hour"}):bl.H(e,t)},K:function(e,t,i){var s=e.getUTCHours()%12;return"Ko"===t?i.ordinalNumber(s,{unit:"hour"}):Cl(s,t.length)},k:function(e,t,i){var s=e.getUTCHours();return 0===s&&(s=24),"ko"===t?i.ordinalNumber(s,{unit:"hour"}):Cl(s,t.length)},m:function(e,t,i){return"mo"===t?i.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):bl.m(e,t)},s:function(e,t,i){return"so"===t?i.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):bl.s(e,t)},S:function(e,t){return bl.S(e,t)},X:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();if(0===n)return"Z";switch(t){case"X":return xl(n);case"XXXX":case"XX":return Dl(n);default:return Dl(n,":")}},x:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"x":return xl(n);case"xxxx":case"xx":return Dl(n);default:return Dl(n,":")}},O:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Il(n,":");default:return"GMT"+Dl(n,":")}},z:function(e,t,i,s){var n=(s._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Il(n,":");default:return"GMT"+Dl(n,":")}},t:function(e,t,i,s){var n=s._originalDate||e;return Cl(Math.floor(n.getTime()/1e3),t.length)},T:function(e,t,i,s){return Cl((s._originalDate||e).getTime(),t.length)}},Rl=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"})}},Hl=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"})}},Vl={p:Hl,P:function(e,t){var i,s=e.match(/(P+)(p+)?/)||[],n=s[1],r=s[2];if(!r)return Rl(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}}",Rl(n,t)).replace("{{time}}",Hl(r,t))}},Fl=["D","DD"],Bl=["YY","YYYY"];function kl(e){return-1!==Fl.indexOf(e)}function Ul(e){return-1!==Bl.indexOf(e)}function Wl(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 $l={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"}},Gl=function(e,t,i){var s,n=$l[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};function zl(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.width?String(t.width):e.defaultWidth,s=e.formats[i]||e.formats[e.defaultWidth];return s}}var Yl={date:zl({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:zl({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:zl({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},jl={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Kl(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 ql(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)?Zl(l,(function(e){return e.test(a)})):Xl(l,(function(e){return e.test(a)}));o=e.valueCallback?e.valueCallback(c):c,o=i.valueCallback?i.valueCallback(o):o;var u=t.slice(a.length);return{value:o,rest:u}}}function Xl(e,t){for(var i in e)if(e.hasOwnProperty(i)&&t(e[i]))return i}function Zl(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i}function Jl(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];o=i.valueCallback?i.valueCallback(o):o;var a=t.slice(n.length);return{value:o,rest:a}}}var Ql={code:"en-US",formatDistance:Gl,formatLong:Yl,formatRelative:function(e,t,i,s){return jl[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:Kl({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Kl({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:Kl({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:Kl({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:Kl({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:Jl({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:ql({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:ql({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:ql({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:ql({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:ql({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}},ec=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tc=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ic=/^'([^]*?)'?$/,sc=/''/g,nc=/[a-zA-Z]/;function rc(e,t,i){var s,n,r,o,a,l,c,u,h,d,p,f,m,g,y,T,S,A;Mt(2,arguments);var v=String(t),P=vr(),C=null!==(s=null!==(n=null==i?void 0:i.locale)&&void 0!==n?n:P.locale)&&void 0!==s?s:Ql,b=_t(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=_t(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===(T=y.options)||void 0===T?void 0:T.weekStartsOn)&&void 0!==m?m:P.weekStartsOn)&&void 0!==f?f:null===(S=P.locale)||void 0===S||null===(A=S.options)||void 0===A?void 0:A.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 _=Ot(e);if(!ll(_))throw new RangeError("Invalid time value");var M=Dt(_),L=ul(_,M),O={firstWeekContainsDate:b,weekStartsOn:E,locale:C,_originalDate:_},w=v.match(tc).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Vl[t])(e,C.formatLong):e})).join("").match(ec).map((function(s){if("''"===s)return"'";var n=s[0];if("'"===n)return oc(s);var r=Nl[n];if(r)return null!=i&&i.useAdditionalWeekYearTokens||!Ul(s)||Wl(s,t,String(e)),null!=i&&i.useAdditionalDayOfYearTokens||!kl(s)||Wl(s,t,String(e)),r(L,s,C.localize,O);if(n.match(nc))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return s})).join("");return w}function oc(e){var t=e.match(ic);return t?t[1].replace(sc,"'"):e}function ac(e,t){var i=function(e){if(!cc[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")),i="06/25/2014, 00:00:00"===t||"06/25/2014 00:00:00"===t;cc[e]=i?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 cc[e]}(t);return i.formatToParts?function(e,t){try{for(var i=e.formatToParts(t),s=[],n=0;n<i.length;n++){var r=lc[i[n].type];r>=0&&(s[r]=parseInt(i[n].value,10))}return s}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(i,e):function(e,t){var i=e.format(t).replace(/\u200E/g,""),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 lc={year:0,month:1,day:2,hour:3,minute:4,second:5};var cc={};function uc(e,t,i,s,n,r,o){var a=new Date(0);return a.setUTCFullYear(e,t,i),a.setUTCHours(s,n,r,o),a}var hc=36e5,dc={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function pc(e,t,i){var s,n,r;if(!e)return 0;if(s=dc.timezoneZ.exec(e))return 0;if(s=dc.timezoneHH.exec(e))return mc(r=parseInt(s[1],10))?-r*hc:NaN;if(s=dc.timezoneHHMM.exec(e)){r=parseInt(s[1],10);var o=parseInt(s[2],10);return mc(r,o)?(n=Math.abs(r)*hc+6e4*o,r>0?-n:n):NaN}if(function(e){if(gc[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),gc[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var a=i?t:function(e){return uc(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=fc(a,e),c=i?l:function(e,t,i){var s=e.getTime(),n=s-t,r=fc(new Date(n),i);if(t===r)return t;n-=r-t;var o=fc(new Date(n),i);return r===o?r:Math.max(r,o)}(t,l,e);return-c}return NaN}function fc(e,t){var i=ac(e,t),s=uc(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 mc(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var gc={};var yc={};Object.defineProperty(yc,"__esModule",{value:!0}),yc.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)},yc=yc.default;var Tc={};Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.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()},Tc=Tc.default;var Sc=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Ac=36e5,vc={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Sc};function Pc(t,i){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===t)return new Date(NaN);var s=i||{},n=null==s.additionalDigits?2:e(yc)(s.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new 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 r=Cc(t),o=bc(r.date,n),a=o.year,l=o.restDateString,c=Ec(l,a);if(isNaN(c))return new Date(NaN);if(c){var u,h=c.getTime(),d=0;if(r.time&&(d=_c(r.time),isNaN(d)))return new Date(NaN);if(r.timeZone||s.timeZone){if(u=pc(r.timeZone||s.timeZone,new Date(h+d)),isNaN(u))return new Date(NaN)}else u=e(Tc)(new Date(h+d)),u=e(Tc)(new Date(h+d+u));return new Date(h+d+u)}return new Date(NaN)}function Cc(e){var t,i={},s=vc.dateTimePattern.exec(e);if(s?(i.date=s[1],t=s[3]):(s=vc.datePattern.exec(e))?(i.date=s[1],t=s[2]):(i.date=null,t=e),t){var n=vc.timeZone.exec(t);n?(i.time=t.replace(n[1],""),i.timeZone=n[1].trim()):i.time=t}return i}function bc(e,t){var i,s=vc.YYY[t],n=vc.YYYYY[t];if(i=vc.YYYY.exec(e)||n.exec(e)){var r=i[1];return{year:parseInt(r,10),restDateString:e.slice(r.length)}}if(i=vc.YY.exec(e)||s.exec(e)){var o=i[1];return{year:100*parseInt(o,10),restDateString:e.slice(o.length)}}return{year:null}}function Ec(e,t){if(null===t)return null;var i,s,n,r;if(0===e.length)return(s=new Date(0)).setUTCFullYear(t),s;if(i=vc.MM.exec(e))return s=new Date(0),Ic(t,n=parseInt(i[1],10)-1)?(s.setUTCFullYear(t,n),s):new Date(NaN);if(i=vc.DDD.exec(e)){s=new Date(0);var o=parseInt(i[1],10);return function(e,t){if(t<1)return!1;var i=wc(e);return!(i&&t>366)&&!(!i&&t>365)}(t,o)?(s.setUTCFullYear(t,0,o),s):new Date(NaN)}if(i=vc.MMDD.exec(e)){s=new Date(0),n=parseInt(i[1],10)-1;var a=parseInt(i[2],10);return Ic(t,n,a)?(s.setUTCFullYear(t,n,a),s):new Date(NaN)}if(i=vc.Www.exec(e))return xc(t,r=parseInt(i[1],10)-1)?Mc(t,r):new Date(NaN);if(i=vc.WwwD.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return xc(t,r,l)?Mc(t,r,l):new Date(NaN)}return null}function _c(e){var t,i,s;if(t=vc.HH.exec(e))return Dc(i=parseFloat(t[1].replace(",",".")))?i%24*Ac:NaN;if(t=vc.HHMM.exec(e))return Dc(i=parseInt(t[1],10),s=parseFloat(t[2].replace(",",".")))?i%24*Ac+6e4*s:NaN;if(t=vc.HHMMSS.exec(e)){i=parseInt(t[1],10),s=parseInt(t[2],10);var n=parseFloat(t[3].replace(",","."));return Dc(i,s,n)?i%24*Ac+6e4*s+1e3*n:NaN}return null}function Mc(e,t,i){t=t||0,i=i||0;var s=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 Lc=[31,28,31,30,31,30,31,31,30,31,30,31],Oc=[31,29,31,30,31,30,31,31,30,31,30,31];function wc(e){return e%400==0||e%4==0&&e%100!=0}function Ic(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var s=wc(e);if(s&&i>Oc[t])return!1;if(!s&&i>Lc[t])return!1}return!0}function xc(e,t,i){return!(t<0||t>52)&&(null==i||!(i<0||i>6))}function Dc(e,t,i){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==i||!(i<0||i>=60)))}function Nc(e,t,i){var s=Pc(e,i),n=pc(t,s,!0),r=new Date(s.getTime()-n),o=new Date(0);return o.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),o.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),o}var Rc={};Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.default=function(e){return(0,Vc.default)({},e)};var Hc,Vc=(Hc=n("eG07G"))&&Hc.__esModule?Hc:{default:Hc};function Fc(t,i,s){if("string"==typeof t&&!t.match(Sc)){var n=e(Rc)(s);return n.timeZone=i,Pc(t,n)}var r=Pc(t,s),o=uc(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()).getTime(),a=pc(i,new Date(o));return new Date(o+a)}Rc=Rc.default;const Bc=[Do.Open,Do.High,Do.Low,Do.Last,Do.Close,Do.PreviousClose,Do.PreviousHigh,Do.PreviousLow,Do.PreviousOpen,Do.Volume,Do.Change,Do.PercentChange,Do.YearHigh,Do.YearLow,Do.WeekPreviousClose,Do.WeekPreviousHigh,Do.WeekPreviousLow,Do.MonthPreviousClose,Do.MonthPreviousHigh,Do.MonthPreviousLow];class kc{constructor(){this.recordCache=new Map,this.translateSymbolBack=new Map}get subject(){if(!Ze(this._subject)){const t=Ga(Math.max(Ci.MINIMUM_THROTTLE,SP().config.throttleMillis||0)),i=Ga(Ci.BACKGROUND_TAB_THROTTLE),s=()=>globalThis.document?.hidden?i:t;this._subject=(new Ya).pipe((e=s,Ka((function(t,i){var s=null,n=null,r=function(){null==n||n.unsubscribe();var t=s;s=[],t&&i.next(t),sl(e()).subscribe(n=qa(i,r,Ca))};r(),t.subscribe(qa(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})))}))),rl((e=>e.length>0)))}var e;return this._subject}addRecordForSymbol(e,t){const i=xi(e);i!==e&&this.translateSymbolBack.set(i,e),this.recordCache.set(e,t)}removeRecordForSymbol(e){this.recordCache.delete(e);const t=xi(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 Bc}makeAndCacheRecord(e,t){if(e===Ci.PLACEHOLDER_SYMBOL_NAME)return new Bo(Ci.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 Uc extends kc{getRecord(e){return this.makeAndCacheRecord(e,(()=>new zo(e)))}evictUnused(e){super.evictUnused(e,(e=>e.shutdown()))}}class Wc extends kc{constructor(){super(),this.onMarketUpdate=this.onMarketUpdate.bind(this)}evictUnused(e){super.evictUnused(e,(e=>{e.shutdown(),SP().connection.off("marketUpdate",this.onMarketUpdate,e.translated)}))}getRecord(e){return this.makeAndCacheRecord(e,(()=>new Go(e)))}postInit(e,t){e&&SP().connection.on("marketUpdate",this.onMarketUpdate,t.translated)}onMarketUpdate(e){if(e.type===Ci.REALTIME_INITIAL_QUOTE){const t=this.updateFromQuote(e,!0);this.subject.next({topic:No.RT_QUOTE,data:e,updated:t})}else if(e.type===Ci.REALTIME_TRADE){const t=SP().connection.getMarketState().getQuote(e.symbol),i=this.updateFromQuote(t);this.subject.next({topic:No.RT_TRADE,data:e,updated:i}),e.symbol===Ci.DEBUG_SYMBOL&&console.log(`Trade\nSymbol: ${e.symbol} \t%cPrice: ${e.tradePrice} \t%cSize: ${e.tradeSize} \t%cTime: ${rc(e.time,Ci.DEBUG_TIME_FORMAT)} \t%cSession: ${e.session}`,"color:#0f0","color:#a7a","color:#f96","color:#bee")}else if(e.type===Ci.REALTIME_VOLUME){const t=this.updateFromVolume(e);0!==t&&(this.subject.next({topic:No.RT_VOLUME,data:e,updated:t}),e.symbol===Ci.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(Do.Open,e.openPrice),i.update(Do.High,e.highPrice),i.update(Do.Low,e.lowPrice),i.update(Do.Last,e.lastPrice),i.update(Do.Close,e.lastPrice);const s=(e,t)=>{Ze(t)&&i.update(e,t)};return s(Do.Volume,e.volume),i.update(Do.PreviousClose,e.previousPrice),t&&(s(Do.PreviousOpen,e.previousOpenPrice),s(Do.PreviousHigh,e.previousHighPrice),s(Do.PreviousLow,e.previousLowPrice)),i.computeWellKnown(),i.updated}updateFromVolume(e){const t=this.findRecordForSymbol(e.symbol);return t.resetUpdated(),t.update(Do.Volume,e.value),t.updated}}class $c extends kc{constructor(){super(),this.localTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone}get feed(){return SP()}evictUnused(e){super.evictUnused(e,(e=>{e.shutdown(),this.feed.unsubscribe(e.translated)}))}getRecord(e){return this.makeAndCacheRecord(e,(()=>new Go(e)))}postInit(e,t){e&&this.feed.subscribe(t.translated)}onSnapshot(e,t){const i=this.findRecordForSymbol(t),s=SP().metaDataSource.getMetaData(t);if(!s.isReady)return;const n=(e,t)=>{if(Xe(t)){const n=s.asPrice(t);return i.update(e,n),n}};i.resetUpdated();const r=n(Do.Open,e.open?.price),o=n(Do.High,e.high?.price),a=n(Do.Low,e.low?.price),l=n(Do.Last,e.last?.price);Xe(n(Do.Close,e.close?.price))||n(Do.Close,e.settlement?.price),e.volume?.volume&&i.update(Do.Volume,s.asQuantity(e.volume.volume));const c=this.toExchangeTime(e.transactionTime,s.timeZone);Xe(n(Do.PreviousClose,e.prevClose?.price))||n(Do.PreviousClose,e.previousSession?.settlement?.price),n(Do.PreviousOpen,e.previousSession?.open?.price),n(Do.PreviousHigh,e.previousSession?.high?.price),n(Do.PreviousLow,e.previousSession?.low?.price),n(Do.YearHigh,e.yearHigh?.price),n(Do.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!Xe(e)||e.isZero()?null:new Date(e.div(1e6).toNumber())}toExchangeTime(e,t){const i=this.asDate(e);if(null===i)return null;return Nc(Fc(i,this.localTimeZone),t)}onUpdate(e,t){if(!this.recordCache.has(t))return void dP(`[OpenFeed] update for unsubscribed symbol: ${t}`,"warn");const i=SP().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),r=i.asQuantity(n.quantity);if(null===e||0===r)continue;const o=this.toExchangeTime(n.transactionTime,i.timeZone),a=this.findRecordForSymbol(t),l=["High","Low","Volume"].map((e=>Do[e])),[c,u,h]=l.map((e=>a.getValue(e)));(!Xe(u)||e<u)&&a.update(Do.Low,e),(!Xe(c)||e>c)&&a.update(Do.High,e),a.update(Do.Last,e),a.update(Do.Close,e),a.update(Do.Volume,(Xe(h)?h:0)+r),a.computeWellKnown();const d={data:{symbol:t,tradePrice:e,tradeSize:r,session:"",time:o??s},topic:"rt.trade",updated:a.updated};this.subject.next(d)}}}function Gc(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 zc(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t),n=Gc(i,s),r=Math.abs(Ht(i,s));i.setDate(i.getDate()-n*r);var o=Number(Gc(i,s)===-n),a=n*(r-o);return 0===a?0:a}function Yc(e){Mt(1,arguments);var t=Ot(e);return t.setHours(23,59,59,999),t}function jc(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getTime()===s.getTime()}function Kc(e,t){Mt(2,arguments);var i=Ot(e),s=_t(t);return isNaN(s)?new Date(NaN):s?(i.setDate(i.getDate()+s),i):i}function qc(e,t){Mt(2,arguments);var i=_t(t);return Kc(e,-i)}function Xc(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 Xc(e,t,i.concat(n))}}var Zc=Xc(Kc,2);function Jc(e,t){Mt(2,arguments);var i=_t(t);return cl(e,6e4*i)}var Qc=Xc(Jc,2),eu=Xc(wt,2);var tu=Xc((function(e,t){Mt(2,arguments);var i=_t(t),s=3*i;return wt(e,s)}),2);function iu(e,t){Mt(2,arguments);var i=_t(t);return cl(e,1e3*i)}var su=Xc(iu,2);var nu=Xc((function(e,t){Mt(2,arguments);var i=_t(t),s=7*i;return Kc(e,s)}),2),ru=Xc(It,2),ou=Xc(rc,2);function au(e){return e.size-1}class lu{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(Do.DateTime)}prepend(e){this.base.prepend(e),this.processRetrieved()}append(e){this.base.append(e),this.processRetrieved()}}class cu extends lu{constructor(e){super(),this.container=e,this.retryCountForChunk=Ci.FETCH_TICK_CHUNK_RETRY_COUNT}getFirstDate(e){const t=super.getFirstDate(0);return e>0&&e<this.retryCountForChunk?Yc(qc(t,e)):t}process(e){const t=this.container,i=t.size>0?t.getLastDataPoint(Do.Last):null,s=t.getLastDataPoint(Do.DateTime);let n=e.time;return void 0!==s&&n<=s&&(n=cl(s,1)),t.addDataPoint(Do.DateTime,n),t.addDataPoint(Do.Last,e.tradePrice),t.addDataPoint(Do.TradeSize,e.tradeSize),t.addDataPoint(Do.Change,Ze(i)?e.tradePrice-i:null),{isUpdate:!1,time:n.getTime(),index:au(t)}}}class uu extends lu{constructor(e,t){super(),this.agg=t,this.container=e,this.durationAdd=this.getBarDurationAdder()}isSameBar(e,t){switch(this.agg.unit){case C.Tick:case C.Intraday:case C.Day:return Ao(t,this.durationAdd(e));case C.Week:return Cr(e,t);case C.Month:return yr(e,t);case C.Quarter:return Sr(e,t);case C.Year:return br(e,t);default:throw new Error(`Unexpected aggregation unit ${C[this.agg.unit]}`)}}getBarDurationAdder(){switch(this.agg.unit){case C.Tick:return su(this.agg.size);case C.Intraday:return Qc(this.agg.size);case C.Day:return Zc(this.agg.size);case C.Week:return nu(1);case C.Month:return eu(1);case C.Quarter:return tu(1);case C.Year:return ru(1);default:throw new Error(`Unexpected aggregation unit ${C[this.agg.unit]}`)}}fixupTimeBasedAggregationTimestamp(e){return e}isCorrection(e,t){const i=Ao(t,e);return i&&dP("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 jc(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(Do.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){const o=this.container,a=o.size>0?o.getLastDataPoint(Do.Close):null;o.addDataPoint(Do.DateTime,r),o.addDataPoint(Do.Open,e),o.addDataPoint(Do.High,t),o.addDataPoint(Do.Low,i),o.addDataPoint(Do.Close,s),o.addDataPoint(Do.Change,Ze(a)?s-a:null),o.addDataPoint(Do.Volume,n),o.hasField(Do.OpenInterest)&&o.addDataPoint(Do.OpenInterest,null)}addBar(e,t){const{nextTimestamp:i}=t,s=e.tradePrice;return this.createBar(s,s,s,s,e.tradeSize,i),{isUpdate:!1,time:i.getTime(),index:au(this.container)}}updateLastBar(e,t,i,s){const n=this.container,r=e=>n.getLastDataPoint(e);if(Ze(e)&&e>r(Do.High)&&n.setLastDataPoint(Do.High,e),Ze(t)&&t<r(Do.Low)&&n.setLastDataPoint(Do.Low,t),Ze(i)){n.setLastDataPoint(Do.Close,i);const e=n.getData(Do.Close)[n.size-2];n.setLastDataPoint(Do.Change,i-e)}if(Ze(s)){const e=n.getLastDataPoint(Do.Volume)+s;n.setLastDataPoint(Do.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:au(this.container)}}process(e){const t=this.getPosition(e);if(null===t)return null;const i=ou(Ci.DEBUG_TIME_FORMAT);return t.isUpdate?(e.symbol===Ci.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)):Ze(e.tradePrice)?(e.symbol===Ci.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(Ze(e.lastPrice,e.time))return this.updateLastBar(e.highPrice,e.lowPrice,e.lastPrice,void 0),{isUpdate:!0,time:e.time.getTime(),index:au(this.container)}}}class hu extends uu{constructor(e,t,i){super(t,i),this.innerBuilder=e,this.processRetrieved()}get base(){return this.innerBuilder.container}fixupTimeBasedAggregationTimestamp(e){return qc(e,zc(e,Ci.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(Do.DateTime)[e],tradeSize:0,tradePrice:0};[Do.Open,Do.High,Do.Low].forEach((i=>{t.tradePrice=this.base.getData(i)[e],super.process(t)})),t.tradePrice=this.base.getData(Do.Close)[e],t.tradeSize=this.base.getData(Do.Volume)[e],super.process(t)}}process(e){return this.innerBuilder.process(e),super.process(e)}}class du{storage={};constructor(e){this.fields=e,this.clear()}clear(){this.storage={},this.fields.forEach((e=>{this.storage[e.id]=[]}))}fixupTransition(e,t){if(e!==Do.Change||!this.hasField(Do.Close)||t<1)return;const i=this.storage[e.id],s=this.storage[Do.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(Do.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(Do.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(Do.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 Oe(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 pu extends du{constructor(){super([])}get size(){return 0}}class fu extends du{constructor(e,t){super(e),this.wrapper=t}isWrapped(e){return st(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 mu=Ci.RENKO_KAGI_NAMES;function gu(e){const{Method:t,Period:i,Source:s,BrickSize:n}=ct(e);return{method:tt(t,[mu.ATR,mu.TRD,mu.PCT],mu.ATR),period:Number.isFinite(i)?i:14,source:tt(s,[mu.CLS,mu.HL],mu.CLS),brickSize:Number.isFinite(n)?n:10}}function yu(e,t,i){return e.getData(t)[i]}function Tu(e,t){const[i,s]=[Do.High,Do.Low].map((i=>yu(e,i,t))),n=yu(e,Do.Close,t-1);return Math.max(i-s,Math.abs(i-n),Math.abs(s-n))}function Su(e,t){if(e.size<t)return null;const i=t-1,s=[];s.push(yu(e,Do.High,0)-yu(e,Do.Low,0));for(let i=1;i<t;++i)s.push(Tu(e,i));let n=ve(s);for(let s=t;s<e.size;++s){n=(n*i+Tu(e,s))/t}return n}const Au=e=>Do[e],vu=["DateTime","Open","High","Low","Close","Volume"].map(Au),Pu=vu.concat(["Change","Projection","BarIndex"].map(Au));class Cu extends lu{constructor(e,t){super(),this.supportsChunks=!1,this.innerBuilder=e,this.inputs=rt(t.inputs),this.brickSize=null,this.container=new du(Pu),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,Je(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*Ci.RENKO_MAX_BARS;for(;t>0&&e<i;){const i=Tu(this.base,t);e+=Math.floor(i/this.brickSize),t--}return t}processRetrieved(){const e=gu(this.inputs),{method:t,period:i,source:s}=e;if(this.brickSize=e.brickSize,t===mu.ATR)this.brickSize=Su(this.base,i);else if(t===mu.PCT)if((this.base?.size??0)>0){const e=this.base.getLastDataPoint(Do.Close);this.brickSize=e*this.brickSize/100}else this.brickSize=null;if(!Ze(this.brickSize))return;this.refPrices=s===mu.HL?(e,t,i)=>[t,i]:(e,t,i)=>[e,e];const n={},r=this.findSafeStartIndex();for(let e=r;e<this.base.size;e++){const t=this.getBarAt(e);if(e===r){this.initFirstBrick(n,t);continue}const i=this.isLastBase(e),{climbing:s,falling:o,moveUp:a,moveDown:l}=this.getMove(n,t,i);if(!s&&!o){n.volume+=t.volume;continue}n.proj=Number(i),n.barIndex=e;const c=t.date.getTime();if(s){const e=this.getBricksCount(a);for(let t=0;t<e;++t)this.constructClimbing(n,c,t,this.brickSize);i&&(this.constructClimbing(n,c,e,a%this.brickSize),this.projectionCount=e+1)}else if(o){const e=this.getBricksCount(l);for(let t=0;t<e;++t)this.constructFalling(n,c,t,this.brickSize);i&&(this.constructFalling(n,c,e,l%this.brickSize),this.projectionCount=e+1)}i||(this.lastFinalBrick=this.container.size-1,n.volume=0)}this.container.keepOnlyLast(Ci.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(Do.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(Do.DateTime,e.date),t.addDataPoint(Do.Open,e.open),t.addDataPoint(Do.Close,e.close),t.addDataPoint(Do.High,e.high),t.addDataPoint(Do.Low,e.low),t.addDataPoint(Do.Change,e.change),t.addDataPoint(Do.Volume,e.volume),t.addDataPoint(Do.Projection,e.proj),t.addDataPoint(Do.BarIndex,e.barIndex)}updateLastDataPoint(e){const t=this.container;t.setLastDataPoint(Do.DateTime,e.date),t.setLastDataPoint(Do.Open,e.open),t.setLastDataPoint(Do.Close,e.close),t.setLastDataPoint(Do.High,e.high),t.setLastDataPoint(Do.Low,e.low),t.setLastDataPoint(Do.Change,e.change),t.setLastDataPoint(Do.Volume,e.volume),t.setLastDataPoint(Do.Projection,e.proj),t.setLastDataPoint(Do.BarIndex,e.barIndex)}}const bu=[Do.DateTime,Do.Last,Do.TradeSize,Do.Change],Eu=[Do.DateTime,Do.Open,Do.High,Do.Low,Do.Close,Do.Volume,Do.Change],_u=[...Eu,Do.OpenInterest],Mu=[..._u,Do.Symbol],Lu=[Do.Open,Do.High,Do.Low,Do.Close,Do.Change];function Ou(e,t){const i=ii(e);return t.isTick?bu:t.isMultiContract?Mu:i||t.isEndOfDay?_u:Eu}function wu(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getTime()>s.getTime()}function Iu(e,t){const{unit:i}=e;return i===C.Year?xt(t):i===C.Quarter?Tr(t):i===C.Month?Bt(t):i===C.Week?Pr(t):i===C.Day?Nt(t):t}function xu(e,t){return t.getFullYear()-1-(t.getFullYear()-1)%e}function Du(e){return xu(10,e)}function Nu(e,t){return Du(e)===Du(t)}function Ru(e,t){return xu(100,e)===Du(t)}function Hu(e){return new Date(e*Ci.OPTIONS_DATA_INCREMENT+Ci.OPTIONS_DATA_BASE)}function Vu(e){return(e.valueOf()-Ci.OPTIONS_DATA_BASE)/Ci.OPTIONS_DATA_INCREMENT}function Fu(e,t=Ci.ZERO_DATE){const i=new Date(`${e}T00:00:00`);return ll(i)?i:t}function Bu(e,t=Ci.ZERO_DATE){const i=new Date(e.replace(" ","T"));return ll(i)?i:t}class ku{constructor(e,t,i=0){this.symbol=e,this.aggregation=t,this.offset=i||0,this.previousTime=new Date(0),this.timeZone=this.getTimeZone(),this.isFuture=Yt(e),this.needsResolution=ti(e),this.hasOpenInterest=ii(e)}makeContainer(){return new du(Ou(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(Do.DateTime,this.parseDate(e[0+t])),this.container.addDataPoint(Do.Last,parseFloat(e[3+t])),this.container.addDataPoint(Do.TradeSize,parseInt(e[4+t])),this.container.addDataPoint(Do.Change,this.calculateChange(Do.Last)))}nullify(e){return 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(Do.Symbol)&&this.container.addDataPoint(Do.Symbol,t?e[0]:this.symbol),this.container.addDataPoint(Do.DateTime,this.parseDate(e[0+i])),this.container.addDataPoint(Do.Open,parseFloat(e[2+i])),this.container.addDataPoint(Do.High,parseFloat(e[3+i])),this.container.addDataPoint(Do.Low,parseFloat(e[4+i])),this.container.addDataPoint(Do.Close,parseFloat(e[5+i])),this.container.addDataPoint(Do.Volume,this.nullify(parseInt(e[6+i]))),this.container.addDataPoint(Do.Change,this.calculateChange()))}parseEod(e){const t=this.aggregation.isMultiContract,i=7+(this.hasOpenInterest?1:0);e.length===i&&(t&&this.container.addDataPoint(Do.Symbol,e[0]),this.container.addDataPoint(Do.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Do.Open,parseFloat(e[2])),this.container.addDataPoint(Do.High,parseFloat(e[3])),this.container.addDataPoint(Do.Low,parseFloat(e[4])),this.container.addDataPoint(Do.Close,parseFloat(e[5])),this.container.addDataPoint(Do.Volume,this.nullify(parseInt(e[6]))),this.hasOpenInterest&&this.container.addDataPoint(Do.OpenInterest,this.nullify(parseInt(e[7]))),this.container.addDataPoint(Do.Change,this.calculateChange()))}calculateChange(e=Do.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 C.Tick:case C.Intraday:return Bu(e);default:return Fu(e)}}parseDate(e){const t=this.parseTimestamp(e);return this.aggregation.isEndOfDay?It(t,this.offset):(wu(t,this.previousTime)?this.previousTime=t:this.previousTime=cl(this.previousTime,1),this.previousTime)}getTimeZone(){return si(this.symbol)}}const{BARCHART_HIST_SRV_NEAREST_INTRADAY_PAGE_NAME:Uu,BARCHART_HIST_SRV_INTRADAY_PAGE_NAME:Wu}=Ci;class $u{constructor(){this.supportsChunks=!0}getPageNameFor(e,t){switch(e.unit){case C.Tick:return Ci.BARCHART_HIST_SRV_TICKS_PAGE_NAME;case C.Intraday:return t&&e.spec===E.Nearest?Uu:Wu;case C.Day:case C.Week:case C.Month:case C.Quarter:case C.Year:return Ci.BARCHART_HIST_SRV_EOD_PAGE_NAME;default:return""}}addExtraParams(e){}makeUrl(e){const t={},i=xi(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===C.Intraday){const e=s.spec===E.PerRange?1:s.size;t.interval=e.toString()}const[r,o]=e.range,a=null!==r,l=null!==o;if(a&&(t.start=this.toHistoricalFeedDate(r,s)),!a||e.alwaysUseBarsToFetch){let i=e.barsToFetch||Ci.DEFAULT_MAX_RECORDS;s.unit===C.Tick&&s.spec!==E.None&&(i*=Ci.TICK_CUSTOM_AGG_MULTIPLIER),t.maxrecords=i.toString()}l&&(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"),this.addExtraParams(t);const c=ht(t),u=Yt(i);return`/${this.getPageNameFor(s,u)}?${c}`}toHistoricalFeedDate(e,t){return rc(e,t.isTick||t.isIntraday?Ci.FMT_HIST_FEED_PARAM_DATE_TIME:Ci.FMT_HIST_FEED_PARAM_DATE_ONLY)}getDataParam(e){let t="";const i=this.getSpecPart(e);switch(e.unit){case C.Tick:case C.Intraday:break;case C.Day:t=`daily${i}`;break;case C.Week:t=`weekly${i}`;break;case C.Month:t=`monthly${i}`;break;case C.Quarter:t=`quarterly${i}`;break;case C.Year:t=`yearly${i}`}return t}getSpecPart(e){return e.isMultiContract?e.spec===E.Continue?"continue":"nearest":""}getParser(e){const t=xi(e.symbol);return new ku(t,e.aggregation,e.offset)}async retrieve(e){const t=this.makeUrl(e),i=e.aggregation.unit===C.Tick?"timeseriesNew":"timeseries",s=await fP(i,t);return this.getParser(e).parse(s)}}class Gu{constructor(){this.supportsChunks=!1}addExtraParams(e){}async retrieve(e){const t=xi(e.symbol),i=this.emptyContainer(t,e.aggregation);if(e.aggregation.unit!==C.Day)return i;const s={symbol:t};this.addExtraParams(s);const n=`/${this.getPageName()}.json?${ht(s)}`,r=await fP("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(e){dP(`Failed parsing the JSON result from OnDemand, error is ${e.message}`)}return i}}class zu extends Gu{emptyContainer(e,t){return new du(Ou(e,t))}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){const s=i.hasField(Do.Symbol),n=t>0?i.getLastDataPoint(Do.Close):null;i.addDataPoint(Do.DateTime,Fu(e.date)),s&&i.addDataPoint(Do.Symbol,e.symbol),i.addDataPoint(Do.Open,e.open),i.addDataPoint(Do.High,e.high),i.addDataPoint(Do.Low,e.low),i.addDataPoint(Do.Close,e.close),i.addDataPoint(Do.Volume,e.volume),i.addDataPoint(Do.OpenInterest,e.openInterest);const r=null===n?null:Je(e.close-n,2);i.addDataPoint(Do.Change,r)}}const Yu={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{constructor(){this.supportsChunks=!1}async retrieve(e){const t=xi(e.symbol).replace(/\.bz$/i,""),i=e.fields.concat(Do.DateTime),s=()=>new du(i);if(e.aggregation.unit!==C.Day)return s();const n=`/get?${ht({symbol:t,apiKey:"default",fields:i.map((e=>Yu[e.id])).join(",")})}`,r=await fP("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===Do.DateTime?t.addDataPoint(Do.DateTime,Fu(e.date)):t.addDataPoint(i,n(e[Yu[i.id]]))}))})),t}catch(e){dP(`Failed parsing options JSON historical data result, error is ${e.message}`)}return s()}}function Ku(e,t){return Ka((function(i,s){var n=0;i.subscribe(qa(s,(function(i){s.next(e.call(t,i,n++))})))}))}var qu=Xc(qc,2);function Xu(e,t){return Mt(2,arguments),Ot(e).getTime()-Ot(t).getTime()}var Zu={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function Ju(e){return e?Zu[e]:Zu.trunc}function Qu(e,t,i){Mt(2,arguments);var s=Xu(e,t)/1e3;return Ju(null==i?void 0:i.roundingMethod)(s)}function eh(e,t){Mt(2,arguments);var i=_t(t);return iu(e,-i)}class th extends uu{constructor(e,t,i){super(t,i),this.innerBuilder=e,this.isBuildingBars=!1,this.retryCountForChunk=Ci.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=[Do.DateTime,Do.TradeSize,Do.Last],[t,i,s]=e.map((e=>this.base.getData(e)));for(let e=this.startFromIndex;e<this.base.size;e++){const n={isTrade:!0,time:t[e],tradeSize:i[e],tradePrice:s[e]};super.process(n)}this.isBuildingBars=!1}process(e){const t=this.innerBuilder.process(e);return e.time=new Date(t.time),super.process(e)}}class ih extends th{constructor(e,t,i){super(e,t,i)}fixupTimeBasedAggregationTimestamp(e){return eh(e,Qu(e,Bt(vo(e,1)))%this.agg.size)}}class sh extends th{constructor(e,t,i,s){super(e,i,s),this.series=t}computeNextStamp(e,t){return this.isCorrection(e,t)?null:t}}const nh=new Oo("_TICK_COUNT");class rh extends sh{anchorTimestamp=null;constructor(e,t,i,s){super(e,t,i,s)}get startFromIndex(){let e=0;const t=this.base.getTimeData();if(Ze(this.anchorTimestamp))e=Ie(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(nh,1),i}changeLastBar(e,t){const i=super.changeLastBar(e,t),s=this.container.getLastDataPoint(nh);return this.container.setLastDataPoint(nh,s+1),i}isUpdate(e,t,i,s){return this.container.getLastDataPoint(nh)<this.agg.size}}const oh=new Oo("_VOLUME_TALLY");class ah extends sh{constructor(e,t,i,s){super(e,t,i,s)}addBar(e,t){const i=this.container,s=(i.getLastDataPoint(oh)||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(Do.Volume,o?1:n),i.setLastDataPoint(oh,s));const a=super.addBar(e,t);return i.setLastDataPoint(Do.Volume,1),i.addDataPoint(oh,o?0:r),a}changeLastBar(e,t){const i=this.container,s=super.changeLastBar(e,t);i.setLastDataPoint(Do.Volume,1);const n=i.getLastDataPoint(oh)??0;return i.setLastDataPoint(oh,n+e.tradeSize),s}isUpdate(e,t,i,s){if(!gr(e,t))return!1;const n=this.container.getLastDataPoint(oh)??0;return s.tradeSize+n<this.agg.size}}class lh extends uu{constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.range=i.size,this.step=1;let n=SP().getMetaDataSource();this.metadata=n.getMetaData(s)}get priceRange(){return this.step*this.range}get base(){return this.innerBuilder.container}ready(){return Ai.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++){const t=this.base.getData(Do.Volume)[e],i=this.useHighOrLow(e);if(!Ze(i)){this.updateLastBar(void 0,void 0,void 0,t);continue}const s={isTrade:!0,time:this.base.getData(Do.DateTime)[e],tradeSize:t,tradePrice:i};super.process(s)}}useHighOrLow(e){const t=this.base.getData(Do.Close)[e];if(0==this.container.size)return t;const i=this.container.getLastDataPoint(Do.High),s=this.container.getLastDataPoint(Do.High),n=this.base.getData(Do.High)[e],r=this.base.getData(Do.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(Do.Low)+this.priceRange;if(i>s)return this.changeAndAddBar(s,e,t);const n=this.container.getLastDataPoint(Do.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(Do.Projection,0),this.addBar(t,i)}addBar(e,t){return this.container.addDataPoint(Do.Projection,1),super.addBar(e,t)}}const ch=[Do.Open,Do.High,Do.Low,Do.Close],uh=[Do.BARCOLIX,Do.High,Do.Low],hh=Ci.RENKO_KAGI_NAMES;function dh(e){const{BoxSizeMethod:t,Period:i,ReversalAmount:s}=ct(e);return{method:tt(t,[hh.ATR,hh.TRD],hh.ATR),period:Number.isFinite(i)?i:14,reversal:Number.isFinite(s)?s:30}}class ph extends uu{isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=rt(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(Do.BARCOLIX,null),this.container.size>1){const e=this.dataAt(Do.Close,this.container.size-2);this.setLast(Do.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(Do.Close),a=r(o),l=Math.abs(o)>=this.reversal,[c,u,h,d]=ch.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(Do.Close,e)>this.dataAt(Do.Open,e),t=this.container.size;if(t>1){const i=e(t-1),[s,n,r]=uh.map((e=>this.dataAt(e,t-2))),[,o,a]=uh.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(Do.BARCOLIX,l)}else this.setLast(Do.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=dh(this.inputs),{method:t,period:i,reversal:s}=e;if(this.reversal=s,t===hh.ATR&&(this.reversal=Su(this.base,i)),Ze(this.reversal)){this.container.clear(),this.isProcessingRetrieved=!0;for(let e=0;e<this.base.size;e++){const t={isTrade:!0,time:this.baseAt(Do.DateTime,e),tradePrice:this.baseAt(Do.Close,e),tradeSize:this.baseAt(Do.Volume,e)};this.process(t)}this.isProcessingRetrieved=!1}}}function fh(e){let{LineCount:t}=ct(e);return{lineBreak:Number.isFinite(t)?t:3}}class mh extends uu{constructor(e,t,i,s){super(t,i),this.innerBuilder=e,this.inputs=rt(s.inputs);const n=fh(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(Do.DateTime)[e],tradeSize:this.base.getData(Do.Volume)[e],tradePrice:this.base.getData(Do.Close)[e]}}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(Do.Open,n),this.container.setLastDataPoint(Do.Low,Math.min(n,i)),this.container.setLastDataPoint(Do.High,Math.max(n,i))):this.resetProjection()}resetProjection(){const e=this.container;e.setLastDataPoint(Do.High,null),e.setLastDataPoint(Do.Low,null),e.setLastDataPoint(Do.Open,null),e.setLastDataPoint(Do.Close,null),e.setLastDataPoint(Do.Change,null)}isProjection(e){return this.agg.isIntraday||this.durationAdd(e).getTime()>Date.now()}updateProjection(e,t){this.container.setLastDataPoint(Do.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(Do.Projection)){const s=i.getLastDataPoint(Do.Close);if(null===this.findOpen(s,this.lineBreak,1))return this.updateProjection(e,t);i.setLastDataPoint(Do.Projection,0),i.setLastDataPoint(Do.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(Do.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(Do.Projection,1),!0)}findOpen(e,t,i=0){if(!Ze(e))return null;const s=this.container,n=s.size-1-i,r=s.getData(Do.Close)[n],o=s.getData(Do.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(Do.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(Do.High)[n-i])return null}return o}return r}startLine(e){this.container.addDataPoint(Do.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 gh=Ci.RENKO_KAGI_NAMES,yh=1,Th=2,Sh=3;function Ah(e){switch(e){case Ci.BARKIND_O:case Ci.BARKIND_XO:return!0;default:return!1}}function vh(e){switch(e){case Ci.BARKIND_X:case Ci.BARKIND_OX:return!0;default:return!1}}function Ph(e){const t=ct(e),{Source:i,BoxSizeMethod:s,Period:n}=t,{ReversalAmount:r,BoxSize:o,OneStepBack:a}=t,l=tt(i,[gh.CLS,gh.HL],gh.CLS),c=tt(s,[gh.ATR,gh.TRD],gh.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 Ch extends uu{isProcessingRetrieved=!1;constructor(e,t,i){super(t,i.aggregation),this.innerBuilder=e,this.inputs=rt(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===gh.CLS}get currentKind(){return this.getLast(Do.BARKIND)}getTrendField(e){return this.closeBased?Do.Close:e?Do.Low:Do.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(Do.Close),o=this.getTrendPrice(e,!s),a=i?this.roundToBox(this.baseAt(Do.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(Do.BARKIND,null),this.computeBarColor(),null}inplaceReverse(){const e=Ah(this.currentKind)?Ci.BARKIND_OX:Ci.BARKIND_XO;this.setLast(Do.BARKIND,e)}canInplaceReverse(){return!function(e){switch(e){case Ci.BARKIND_OX:case Ci.BARKIND_XO:return!0;default:return!1}}(this.currentKind)&&this.getLast(Do.High)===this.getLast(Do.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(Do.Close),c=a(l),u=Math.abs(l)>=this.boxSize,h=o-this.getLast(Do.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(Do.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===yh&&s>0)return[n,Ci.BARKIND_X];if(t===Th&&s<0)return[n,Ci.BARKIND_O];if(t===Sh)return[n,s>0?Ci.BARKIND_X:Ci.BARKIND_O]}}return[null,null]}findFirstBarTrend(){if(this.innerBuilder.container.size<2)return null;if(this.closeBased){const[,e]=this.findFirstDiffLargerThanBox(Do.Close,Sh);return e}{const[e,t]=this.findFirstDiffLargerThanBox(Do.High,yh),[i,s]=this.findFirstDiffLargerThanBox(Do.Low,Th);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(Do.BARKIND,e-2))?Ci.BARKIND_X:Ci.BARKIND_O}this.setLast(Do.BARKIND,t)}process(e){return this.isProcessingRetrieved||this.innerBuilder.process(e),null===this.firstTrend?null:super.process(e)}processRetrieved(){const e=Ph(this.inputs),{method:t,period:i,reversal:s,source:n,boxSize:r,oneStepBack:o}=e;if(this.reversal=s,this.source=n,t===gh.ATR?this.boxSize=Su(this.base,i):this.boxSize=r,Ze(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(Do.DateTime,e),tradePrice:this.baseAt(Do.Close,e),_highPrice:this.baseAt(Do.High,e),_lowPrice:this.baseAt(Do.Low,e),tradeSize:this.baseAt(Do.Volume,e)};this.process(t)}this.isProcessingRetrieved=!1}}}const bh=new Dr(C.Intraday,0);class Eh{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 Bo(e.symbol)}getHasVisible(e){return null!=this.query.visibleRange&&null!=this.query.visibleRange[e]}get hasVisibleFrom(){return this.getHasVisible("from")}get hasVisibleTo(){return this.getHasVisible("to")}refresh(){this.query.aggregation.isEndOfDay?this.alignToQuote=!0:this.loadMoreData(!1)}makeInnerBuilder(e){const t=this.query.aggregation;if(!t.isTick)return new uu(e,t);switch(t.spec){case E.None:case E.PerSeconds:case E.PerCount:case E.PerVolume:return new cu(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 du(Ou(this.query.symbol,e).concat(t)),n=t;switch(this.query.curveStyle){case v.Renko:return new Cu(n,this.query);case v.Kagi:{const e=s(bh,[Do.BARCOLIX]);return new ph(n,e,this.query)}case v.PointAndFigure:{const e=s(bh,[Do.BARKIND]);return new Ch(n,e,this.query)}case v.LineBreak:{const e=s(i,[Do.Projection]);return new mh(n,e,i,this.query)}}if(i.isIntraday&&i.spec===E.PerRange){const e=s(bh,[Do.Projection]);return new lh(n,e,i,this.query.symbol)}const r=t;if(i.isTick)switch(i.spec){case E.PerSeconds:return new ih(r,s(bh),i);case E.PerCount:{const e=s(bh,[nh]);return new rh(r,this,e,i)}case E.PerVolume:{const e=s(bh,[oh]);return new ah(r,this,e,i)}}return i.unit===C.Day&&i.size>1?new hu(n,s(i),i):t}onStreamingUpdates(e){if(this.isLoading)return;e.map((e=>{if(e.isTrade)return this.builder.process(e);if(e.isQuote&&this.alignToQuote){const t=this.builder.alignToQuote(e);return this.alignToQuote=!1,t}return null})).filter((e=>Ze(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)je(No.TS_MANYCHANGED,{series:this,part:se.Unspecified});else{const t={series:this,index:e.index};je(e.isUpdate?No.TS_DATAPOINTCHANGED:No.TS_DATAPOINTADDED,t)}e.timeCorrection&&je(No.TS_TIMELINECORRECTION,{...e.timeCorrection,series:this})}))}get hasData(){return null!==this.container}getRetriever(){return Zt(this.query.symbol)&&this.query.aggregation.isEndOfDay?new zu:new $u}getStreamingSubscription(){return SP().getRecordSource().subject.pipe(Ku((e=>{const t=this.query.aggregation.isEndOfDay,i=Ko(No.RT_TRADE,this.record.symbol),s=e.filter(i).filter((e=>Ze(e.data.time))).filter((e=>t||"T"!==e.data.session)).map((e=>{const i={isTrade:!0,tradePrice:e.data.tradePrice,tradeSize:e.data.tradeSize,time:e.data.time};return(e=>t&&"T"===e.data.session)(e)&&delete i.tradePrice,i})).reduce(((e,t)=>{const i=Oe(e);var s;return Ze(i)&&Ze(i.tradePrice)&&Ze(t.tradePrice)&&i.tradePrice===t.tradePrice&&i.time.getTime()===t.time.getTime()?i.tradeSize+=t.tradeSize:e.push((s=t,Object.assign({},s))),e}),[]),n=Ko(No.RT_QUOTE,this.record.symbol);return s.concat(e.filter(n).map((e=>({isQuote:!0,openPrice:e.data.openPrice,highPrice:e.data.highPrice,lowPrice:e.data.lowPrice,lastPrice:e.data.lastPrice,time:e.data.tradeTime}))))})),rl((e=>e.length>0))).subscribe(this.onStreamingUpdates.bind(this))}async loadMoreData(e=!0){if(this.isLoading||!this.builder.supportsChunks||!this.retriever.supportsChunks||!this.canLoadMoreData)return Promise.resolve();this.isLoading=!0,e?await this.loadHeadChunk():await this.loadTailChunk(),this.isLoading=!1}async loadTailChunk(){const e=this.query.duplicate();let t=this.builder.getLastDate();Ze(e.offset)&&0!==e.offset&&(t=It(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;je(No.TS_MANYCHANGED,{series:this,part:se.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);Ze(s.offset)&&0!==s.offset&&(n=It(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),je(No.TS_MANYCHANGED,{series:this,part:se.Head}))}async applyNearbyFixup(e){const t=this.query.aggregation,i=t.spec===E.Nearest,s=this.query.symbol,n=Yt(s);return!n||!t.isMultiContract||!i||e.size<1||this.serverComputedSeries?n&&ti(s)?await Gt(s):s:e.getLastDataPoint(Do.Symbol)}async ready(){return Ai.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=SP().getRecordSource().getRecord(t)),this.canLoadMoreData=!this.hasVisibleFrom&&e.size>0,this.builder=this.makeBuilder(e),await this.builder.ready(),this.container=this.builder.container,this.query.disableStreamingUpdates||(this.streamingSubscription=this.getStreamingSubscription()),!0}))}getCacheableEntities(e){e.add(this)}shutdown(){Ze(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class _h{constructor(e,t=!1){this._pretendEmpty=t,this.query=e,this.container=new pu}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 Mh{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.canLoadMoreData=!0,this.isLoading=!0,this.container=null,this.supplyCustomDemoData="DemoSite"===SP().config.mode}refresh(){}loadMoreData(e){throw new Error("Should not be called.")}get hasData(){return null!==this.container}shutdown(){}parseEvents(e){const t=new du([Do.DateTime,Do.Dividends,Do.Earnings,Do.Splits,Do.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=Fu(i[1]);t.addDataPoint(Do.DateTime,n),s(Do.Dividends,"Dividend",i[2],i[3]),s(Do.Earnings,"Earnings",i[2],i[3]),s(Do.Splits,"Split",i[2],i[3]),this.supplyCustomDemoData?s(Do.Custom,"Custom","Custom",Ci.FAKE_CUSTOM_EVENT):s(Do.Custom,"Custom",i[2],i[3])})),t}makeUrl(){const e={};e.symbols=this.query.symbol,e.start="19700102",e.end="20501230",Ci.EVENTS_BUILT_IN.forEach((t=>e[t]=this.query[t]));return`/queryevents.ashx?${ht(e)}`}async retrieve(){const e=this.makeUrl(),t=await fP("timeseries",e);return this.parseEvents(t)}async ready(){return Ai.call(this,(async()=>(this.container=await this.retrieve(),this.isLoading=this.canLoadMoreData=!1,!0)))}getCacheableEntities(e){e.add(this)}}class Oh{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 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 du(this.query.fields.concat(Do.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(Do.DateTime,Fu(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===C.Quarter?"Quarter":"Annual";const t=ht(e);return`/${this.query.seriesKind===$.BalanceSheet?"getBalanceSheets":"getIncomeStatements"}.json?${t}`}async retrieve(){const e=this.makeUrl(),t=await fP("ondemand",e);return this.parseFundamental(t)}async ready(){return Ai.call(this,(async()=>(this.container=await this.retrieve(),!0)))}getCacheableEntities(e){e.add(this)}}function wh(e,t){const i=e.findIndex((e=>e>t));return Math.max(i<0?e.length:i,0)}class Ih{setSymbols(e){const t=SP().getRecordSource();this.records=e.reduce(((e,i)=>{const s=t.getRecord(i);return this.addFieldsToRecord(s,i),e[i]=s,e}),{})}getStreamingSubscription(){return SP().getRecordSource().subject.pipe(rl((e=>e.length>0))).subscribe(this.onStreamingUpdates.bind(this))}onStreamingUpdates(e){e.forEach((e=>{const t=e.data,i=this.records[t.symbol];Ze(i)&&this.process(i)})),this.notifyAboutUpdates()}async retrieve(){const e=Object.values(this.records);return(await Promise.all(e.map((e=>e.ready())))).every(Te)&&(this.onRecordsReady(),e.forEach((e=>this.process(e))),this.streamingSubscription=this.getStreamingSubscription()),this.hasData}async ready(){return Ai.call(this,(async()=>await this.retrieve()))}shutdown(){Ze(this.streamingSubscription)&&this.streamingSubscription.unsubscribe()}}class xh extends Ih{symbols=[];constructor(e){super(),this.symbols=e,this.setSymbols(e)}addFieldsToRecord(e,t){e.addFields(Do.Symbol),e.update(Do.Symbol,t)}notifyAboutUpdates(){je(No.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(Do.Close)}}class Dh extends Ih{canLoadMoreData=!1;isLoading=!1;constructor(e){super(),this.query=e,this.setSymbols(e.symbols),this.dataPoints=e.symbols.length,this.container=null,this.fields=[Do.DateTime,Do.Close,Do.Symbol]}addFieldsToRecord(e,t){e.addFields(Do.DateTime,Do.Symbol),e.update(Do.DateTime,ri(t)),e.update(Do.Symbol,t)}refresh(){}loadMoreData(e){throw new Error("Should not be called.")}get hasData(){return null!==this.container&&this.container.size===this.dataPoints}notifyAboutUpdates(){je(No.TS_MANYCHANGED,{series:this,part:se.Unspecified})}onRecordsReady(){this.container=new du(this.fields)}findOrAddIndex(e){let t=this.container.getData(Do.Symbol).indexOf(e.symbol);if(t<0){const i=this.container.getData(Do.DateTime),s=ri(e.symbol);t=wh(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(Do.Last)??i}));if(!Pe(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 Nh{canLoadMoreData=!1;isLoading=!1;constructor(e){this.query=e,this.fields=[Do.DateTime,Do.Close,Do.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(Do.DateTime),r=ri(t),o=wh(n,r);s(o,Do.DateTime,r),s(o,Do.Close,i),s(o,Do.Symbol,t)}parseHistoricalForward(e){const t=new du(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=ye(qu(this.query.offset),ou(Ci.FMT_HIST_FEED_PARAM_DATE_ONLY))(new Date);return`/querylatesteod.ashx?${ht(e)}`}async retrieve(){const e=this.makeUrl(),t=await fP("timeseries",e);return this.parseHistoricalForward(t)}async ready(){return Ai.call(this,(async()=>(this.container=await this.retrieve(),!0)))}getCacheableEntities(e){e.add(this)}}class Rh extends Eh{constructor(e){super(e)}getRetriever(){return new ju}onStreamingUpdates(e){}}class Hh{constructor(e=!1){this.cacheSeries=e,this.seriesCache=new Map}getTimeSeries(e){return Ze(e.symbol)&&e.symbol===Ci.PLACEHOLDER_SYMBOL_NAME?new _h(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,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 $.Normal:return new Eh(e);case $.BalanceSheet:case $.IncomeStatement:return new Oh(e);case $.Events:return new Lh(e);case $.Forward:return new Dh(e);case $.HistoricalForward:return new Nh(e);default:case $.Options:return new Rh(e);case $.Study:throw new Error(`The series kind '${$[e.seriesKind]}' is not supported yet.`)}}}var Vh={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"}},Fh=function(e,t,i){var s,n=Vh[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},Bh={date:zl({formats:{full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:zl({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:zl({formats:{full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},kh={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},Uh={code:"fr",formatDistance:Fh,formatLong:Bh,formatRelative:function(e,t,i,s){return kh[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:Kl({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:Kl({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:Kl({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:Kl({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:Kl({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:Jl({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e)}}),era:ql({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:ql({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:ql({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:ql({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:ql({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 Wh(e){Mt(1,arguments);var t=Ot(e),i=t.getDay();return i}function $h(e){Mt(1,arguments);var t=Ot(e),i=t.getMinutes();return i}function Gh(e){Mt(1,arguments);var t=Ot(e);return t.setMinutes(0,0,0),t}function zh(e,t){Mt(2,arguments);var i=Gh(e),s=Gh(t);return i.getTime()===s.getTime()}function Yh(e){Mt(1,arguments);var t=Ot(e);return t.setSeconds(0,0),t}function jh(e,t){Mt(2,arguments);var i=Yh(e),s=Yh(t);return i.getTime()===s.getTime()}const Kh=/{value:([^}]+)}/,qh=/%([aAdewbBmyYHkIlMpPSL])+/g;let Xh;var Zh;(Zh=Xh||(Xh={}))[Zh.Second=0]="Second",Zh[Zh.Minute=1]="Minute",Zh[Zh.Hour=2]="Hour",Zh[Zh.Day=3]="Day",Zh[Zh.Week=4]="Week",Zh[Zh.Month=5]="Month",Zh[Zh.Year=6]="Year";const Jh={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]}};function Qh(){const e=Object.keys(Jh);return 1===Jh.Day.Multipliers[0]&&e.forEach((e=>{const t=Jh[e],i=mt(t.Period);t.One=1*i,t.Multipliers=t.Multipliers.map((e=>e*i))})),Jh}function ed(e){switch(e.agg.unit){case C.Tick:return new ld(e);case C.Intraday:return new cd(e,e.agg.size);case C.Day:return new ud(e);case C.Week:return new hd(e);case C.Month:case C.Quarter:return new dd(e);case C.Year:return new pd(e);default:throw new Error(`Aggregation unit ${C[e.agg.unit]} not supported.`)}}const td=new Map;function id(e){if(!Ze(e))return null;if(!td.has(e)){const i=Ze(t=e)?t.replace(Kh,((e,t)=>t.replace(qh,((e,t)=>Ci.PHP_TO_UNICODE_TS_35_MAP[t])))):t;td.set(e,i)}var t;return td.get(e)}class sd{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=id(i),this.prevDate=null}get noPrevDate(){return!Ze(this.prevDate)}formatDate(e,t){return vd(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 nd="yyyy",rd="LLL ''yy",od=()=>Ad()?"d LLL":"LLL d",ad="HH:mm";class ld extends sd{constructor(e){super(e),this.repeatEach=Ci.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(!gr(this.prevDate,e))return this.asTick(e,1,"EEE");if(!zh(this.prevDate,e))return this.asTick(e,2,ad);this.repeatCounter++;const t=this.repeatCounter===this.repeatEach;return!jh(this.prevDate,e)||t?this.asTick(e,t?4:3,ad):null}}class cd extends sd{getTick(e){const t=this.checkPrev(e),i=0===this.minTickInterval||0==(e=>Qu(e,Nt(e)))(e)%(this.minTickInterval/1e3),s=!gr(this.prevDate,e),n=$h(e),r=!zh(this.prevDate,e)||t&&0===n;if(i){if(s)return this.asTick(e,1,od());if(r)return this.asTick(e,2,ad);if(0==n%30&&this.size<15)return this.asTick(e,3,ad);if(0==n%15&&this.size<=5)return this.asTick(e,4,ad)}return null}}class ud extends sd{constructor(e){super(e),this.monthDay=this.duration<22*Jh.Day.One,this.monthYear=this.duration>22*Jh.Day.One&&this.duration<7*Jh.Month.One,this.year=this.duration>7*Jh.Month.One}useTuesday(e){return!!this.noPrevDate||2===Wh(e)&&Xu(e,this.prevDate)>1728e5}getTick(e){this.checkPrev(e);const t=!yr(e,this.prevDate),i=!br(e,this.prevDate);return this.monthDay?1===Wh(e)||this.useTuesday(e)?this.asTick(e,1,od()):null:this.monthYear?t?this.asTick(e,1,rd):null:this.year&&i?this.asTick(e,1,nd):null}}class hd extends sd{constructor(e){super(e),this.monthDay=this.duration<4*Jh.Week.One,this.monthYear=this.duration>4*Jh.Week.One&&this.duration<6*Jh.Month.One,this.year=this.duration>6*Jh.Month.One}getTick(e){this.checkPrev(e);const t=!yr(e,this.prevDate),i=!br(e,this.prevDate);return this.monthDay?this.asTick(e,1,od()):this.monthYear?t?this.asTick(e,1,rd):null:this.year&&i?this.asTick(e,1,nd):null}}class dd extends sd{constructor(e){super(e),this.showMonths=this.duration<7*Jh.Month.One}getTick(e){this.checkPrev(e);const t=!br(e,this.prevDate);return this.showMonths?this.asTick(e,1,rd):t?this.asTick(e,1,nd):null}}class pd extends sd{constructor(e){super(e)}getTick(e){this.checkPrev(e);return!br(e,this.prevDate)?this.asTick(e,1,nd):null}}function fd(e){return Vu(e).toString()}function md(e){return Ze(e)?`${e.toFixed(2)}%`:""}function gd(e,t,i=!1){const s=e.plots[0],n=s.curves[0],r=Ze(n)&&n.fields.length>0?n.fields[0]:null;if(!Ze(r))return"";const o={range:e.fullDomain,allDigits:!1,forceTrailingZeros:i};return $d(s,e.pane.presenter,o),s.metaData.format(t,r,o)}function yd(e,t,i=!1){return e.comparison===V.Percent?md(t):gd(e,t,i)}function Td(e,t,i){const s=e.view?.xAxis?.overrideFormatter;if(s)return s(t);if(Ze(e.display.xAxis.isOrdinal))return fd(t);const n=i||e.display.xAxis.format;if(Ze(n)){return vd(t,id(n))}const r=e.data.aggregation,o=e.display?.xAxis?.nonEodLabelWithDate??!1;return r.isEndOfDay?Pd(r,t):Cd(r,t,o)}function Sd(){const e=nt(SP().config,null,"overrides","xAxis","getLocaleName");if(Ze(e)&&"function"==typeof e)try{return e()}catch(e){dP(`Failed retrieving the locale name, error is ${e.message}`,"warn")}}function Ad(){return"fr"===Sd()}function vd(e,t){return rc(e,t,function(){if("fr"===Sd())return{locale:Uh}}())}function Pd(e,t){if(!ll(t))return"";switch(e.unit){case C.Tick:case C.Intraday:case C.Day:case C.Week:default:return vd(t,"P");case C.Month:return vd(t,"LLL yyyy");case C.Quarter:return vd(t,"qqq yyyy");case C.Year:return vd(t,"yyyy")}}function Cd(e,t,i){if(!ll(t))return"";return vd(t,`${i?"P ":""} ${e.isTick?"pp":"p"}`)}const bd=(e,t)=>e.at(t);class Ed{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+Ci.TIMELINE_PROLOG_PADDING_BARS}get withPrologEpilogLength(){return this.withPrologLength+Ci.TIMELINE_EPILOG_PADDING_BARS}get firstSeriesIndex(){return Ci.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<Ci.TIMELINE_PROLOG_PADDING_BARS){const t=we(this._dates),i=e-Ci.TIMELINE_PROLOG_PADDING_BARS;return this.applyDateShift(t,i)}if(e>=this.withPrologLength){const t=Oe(this._dates),i=e-this.withPrologLength+1;return this.applyDateShift(t,i)}return this._dates[e-Ci.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=De(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=De(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 e=t.length-1;e>=0;e--)this._dates[e]=t[e];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 C.Year:return wt(e,12*t);case C.Quarter:return wt(e,3*t);case C.Month:return wt(e,t);case C.Week:return Kc(e,7*t);case C.Day:return Kc(e,t);case C.Intraday:return cl(e,s*t*Ci.ONE_MINUTE_MILLIS);case C.Tick:return cl(e,1e3*t)}}}const _d={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 Md(e){return!0===SP().config.useAllFieldsForComparison&&e.mainPlot.mainCurve.isOhlc&&e.mainAxis.comparison===V.None&&e.mainPane.axes.map((e=>e.plots)).flat().reduce(((e,t)=>e+(t.isSymbol?1:0)),0)>1}function Ld(e){const t=yi(e,"div");fi(t,{class:Ci.SVG_ICONS_DOM_NODE});const i=Object.keys(_d).map((e=>`<symbol id="${xd(e)}" viewBox="0 0 1024 1024">${_d[e]}</symbol>`)).join("");t.innerHTML=`<svg style="display:none" xmlns="http://www.w3.org/2000/svg" version="1.1"><defs>${i}</defs></svg>`}const Od=new Dr;function wd({plots:e,isMultiSymbol:t,isMultiContract:i,date:s,time:n,dateFieldName:r,hideSymbols:o,revealingClose:a}){const l=o&&a,c=[Rd(r,s,null,"heading"),n?Rd("Time",n,null,"heading"):""],u=e.map((e=>{if(0===e.values.length)return null;const s=(e=>!o&&((t||i)&&e.type===U.Symbol||t&&e.type===U.Expression&&e.isMain))(e)?Hd(U[e.type],e.name,e.values[0].color):"",n=e.values.map((t=>Rd(t.id===Do.Close.id&&l?e.description:t.longName,t.value,t.color)));if(e.events&&e.events.length){const t=e.events.map((e=>Hd(`${e.field.name} (${Pd(Od,e.date)})`,e.value,e.color)));n.push(...t)}return n.unshift(s),Ze(e.unalignedDate)&&n.unshift(Rd("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 Id(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)),f=e.mainPlot.axis.pane.id===h.id,m=a&&f?`<span class="field-name" style="padding-right:5px">${i} ${s||""}</span>`:"",g=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:f,isMain:m}=e,g=a.display.tooltip,y=h||d,T="value-title"+(m?" value-main":""),S=U[u],A=["Study","BalanceSheet","IncomeStatement"].includes(S)||"Expression"===S&&!i,v=!A||a.hasLegend&&i?"":Fd(l),P=function(e,t){const i=Dd(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),C=o?function(e){const t=Dd("moreActions");return`<a class="more-actions" data-plot-id="${e}" data-act="Menu" title="Actions">${t}</a>`}(l):"",b=Md(a)&&e.type===U.Symbol,E=(m||b)&&(!s||e.values.length>1),_=e=>E?e.abbreviation:"Close"===e.id&&r?d+" ":null,M=t?p.map((e=>Vd(_(e),e.value,e.color))).join(" ")+function(e){if(e&&e.length){return`Event ${e.map((e=>Vd(`${e.field.name} (${Pd(Od,e.date)})`,e.value,e.color))).join(" ")}`}return""}(f):"",L=p.length>0?`<div class="box" style="background-color:${e.values[0].color}"></div>`:"",O=t?"":L,w="Name"===g.mainTitle?c:d,I=n?e.visible&&t?"":`${d}`:`${w}`;let x=s&&b?`${d} (${I})`:I;g.showMainTitle||(x="");const D=()=>{const e=a.data?.aggregation.toShortString(),t=a.data?.aggregation.describe();return`<span class="value-main" title="${t}">·${e}·</span>`},N=e.isMain?D():"";return`\n <div class="plot">\n ${v} ${P} ${C} ${O}\n <a class="${T}" ${y?`title="${y}" `:""}data-plot-id="${l}">${x}</a>\n ${N} ${M}\n </div>\n `.trim()}(t,o,f,n,l,c,u,e))),y=`${m}${g.join("")}`,T=function(e,t){const i=e>0,s=e<t-1;return[`${i?Nd(!0,e):""}`,`${s?Nd(!1,e):""}`].join(" ").trim()}(d,t.length);return{id:`bc-tip-${h.id.substring(0,8)}`,isMainPane:f,content:y,moveContent:T,bounds:h.bounds}}))}function xd(e){return`bchart-icon-${e}`}function Dd(e,t=null,i=10){return`<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="${i}px" height="${i}px" ${Ze(t)?`style="fill:${t}"`:""}><use xlink:href="#${xd(e)}"></use></svg>`}function Nd(e,t){const i=e?"Up":"Down";return`<span data-pane="${t}" data-dir="${i}" title="Move ${i}" class="move-pane">${Dd(`chevron${i}`)}</span>`}function Rd(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 Hd(e,t,i=null){return Rd(e,t,i,"value-title")}function Vd(e,t,i){const s="string"==typeof i?` style="color: ${i}"`:"";return`${Ze(e)?`<span class="field-name">${e}</span>`:""}<span${s} class="field-value">${t}</span>`}function Fd(e){return`<a class="delete-plot" data-plot-id="${e}" title="Delete plot">${Dd("delete")}</a>`}function Bd(e,t){Mt(2,arguments);var i=_t(t);return It(e,-i)}function kd(e,t,i,s,n,r){const o=function(e,t){const i=e.data.aggregation,s=e.display.xAxis,n=s.isOrdinal,r=Xe(n)&&n,o=r?s.ordinalName??"Value":"Date";return{date:r?fd(t):Pd(i,t),time:i.isEndOfDay||r?null:Cd(i,t,!1),isMultiSymbol:Gd(e),isMultiContract:i.isMultiContract,dateFieldName:o}}(e,t);o.offset=i,o.lastBarRefresh=!!s||!1,o.chartId=e.elementId;const a=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 o=n.timeSeries.container,a=n.type===U.Expression,l=n.axis.comparison!==V.None,c=n.axis.comparison===V.Percent,u=(e,s)=>n.customPlotValues&&s!==Do.DateTime?[n.getValueAt(s,t,i),0]:Wd(e,s,t,l),h=n,d=r?`${Vn(h.model.study).meta.title} ${h.fullParams}`:n.metaData.name||"",p={isMain:n.main,type:n.type,typeName:U[n.type],name:n.title,description:d,exchange:n.metaData.exchange||"",error:h.errorText,id:n.id,visible:n.visible};if(Ze(h.yearOffset)&&0!=h.yearOffset){const i=e.data.aggregation,s=Bd(t,h.yearOffset);p.unalignedDate=Pd(i,s)}const f=n.curves[0];s&&n.type===U.Symbol&&o.hasField(Do.Symbol)&&(t.valueOf()===Ci.ZERO_DATE.valueOf()?p.name=n.timeSeries.container?.getLastDataPoint(Do.Symbol):p.name=u(f,Do.Symbol)[0]);const m={},g={range:n.axis.yScale.domain(),allDigits:!0};$d(n,e,g);const y=(e,t)=>{const i=(t===Do.Change||t===Do.PercentChange)&&e>0?"+":"";return c?i+md(e):i+n.metaData.format(e,t,g)},T=Md(e),S=new Set;return p.values=n.curves.filter((e=>e.visible)).map((e=>(!n.main&&n.isSymbol&&T?Lu:e.fields).map((t=>{if(S.has(t))return null;S.add(t);const[i,s]=u(e,t),o=n.axis.yScale.priceToY(i);m[t.id]=!0;const l=n.customPlotValues?h.getColorOf(t):e.getColor(s,e.style!==v.HollowCandles,t);let c=y(i,t).trim();if(Ze(i)&&t===Do.Change){const[t]=u(e,Do.PercentChange);Ze(t)&&(c+=` (${y(t,Do.PercentChange)})`)}return{abbreviation:zd(t),shortName:t.shortName,id:t.id,name:t.name,longName:a&&!p.isMain?n.title:`${t.shortName} ${r?h.params:""}`.trim(),color:us(l),val:i,y:o,value:c}})).filter((e=>null!==e)))).flat(),p.events=n.findEvents(u(f,Do.DateTime)).filter((e=>e.field!==Do.Custom)),p}(e,t,r,o,i))).filter((e=>null!==e));return o.panes=e.panes.map((e=>({bounds:Ud(e),id:e.id,plots:a(e)}))),o}function Ud(e){const t=e.getBounds();if(!Ze(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 Wd(e,t,i,s=!1){const n=e.plot,r=n.timeSeries.container,o=n.axis.pane.presenter.timeline,a=De(o,+i,Number,bd),l=o.at(a-e.shift);if(null===l)return[null,0];const c=r.getTimeData(),u=De(c,+l,Number);return[!c[u]||c[u].getTime()!==l.getTime()?null:e.dataAt(t,u,!s),u]}function $d(e,t,i){Ze(e.precision)?i.overridePrecision=e.precision:e.isStudy&&Ze(t.mainPlot?.precision)&&!Ze(Vn(e.model.study).meta.decimals)&&(i.overridePrecision=t.mainPlot.precision)}function Gd(e){const t=e.mainPlot.symbol;return e.allPlots.some((e=>e.type===U.Symbol&&e.symbol!==t))}function zd(e){return e.id===Do.Change.id?"Δ":e.id.substring(0,1)}class Yd{fields=[];colors=[];style=v.Line;attributes=[];_shift=0;lineWidth=1;dashStyle="Solid";varyColorPerBar=!1;visible=!0;constructor(){this.id=yt(),this.plot=null}get shift(){return this._shift}set shift(e){this._shift=Ze(e)?e:0}get isOhlc(){return(this.isOhlcStyle||this.isCandle||this.isHlcStyle||this.isElderImpulseSystemStyle||this.isRangeStyle)&&this.fields.includes(Do.Close)}get name(){return this.isOhlc?"":this.fields[0].name}get isHeikinAshiStyle(){return this.style===v.HeikinAshi}get isCandle(){return this.style===v.Candlestick||this.style===v.HollowCandles||this.style===v.HeikinAshi}get isHollowCandles(){return this.style===v.HollowCandles}get isElderImpulseSystemStyle(){return this.style===v.ElderImpulseSystem}get isPercentChangeStyle(){return this.style===v.PercentChange}get isOhlcStyle(){return this.style===v.OHLC}get isHlcStyle(){return this.style===v.HLC}get isRangeStyle(){return this.style===v.Range}get isRenko(){return this.style===v.Renko}get isKagi(){return this.style===v.Kagi}get isPointAndFigure(){return this.style===v.PointAndFigure}get isLineBreak(){return this.style===v.LineBreak}get isBaseline(){return this.style===v.Baseline}get isLineLike(){return[v.Line,v.Area,v.Baseline,v.PercentChange].includes(this.style)}get isColumn(){return this.style===v.Column}get isMultiColumn(){return this.style===v.MultiColumn}get isStackedColumn(){return this.style===v.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=>S[e]))),this.colors=e.colors,this.fields=e.fields.map((e=>Do[e])),this.style=v[e.style],this.lineWidth=e.lineWidth,this.dashStyle=e.dashStyle,this.lineMarker=e.lineMarker,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(V.None),n=e===Do.PercentChange,r=e===Do.Change,o=n||(!i||s)&&r,a=this.timeSeries.container.hasField(Do.Last)?Do.Last:Do.Close,l=o?a:e,c=(e,t)=>{const i=this.timeSeries.container.getData(e)[t];return e.type!==O.Number?i:this.plot.priceMapper(i,t,e)},u=c(l,t);if(!o)return u;if(t<=1)return 0;const h=c(l,t-1),d=u-h;return n?0===h?0:d/h:d}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(!Ze(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(!Ze(t))return null;const i=this.yScale.domain();if(!Ze(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]=Wd(this,this.pickMainField(),t);if(!Ze(s))return;e.save(),As(e,this.plot.axis.pane.getBoundsWithoutScales()),e.fillStyle=us(this.getColor(n)),e.beginPath();ap(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 o=i.container.getTimeData(),a=this.shiftedTimeDomain[0],l={bar:this.view.xAxis.xScale.bar,domain:n,range:r,slice:s,start:De(o,+a,Number)||0},c=Ze(this.zones);this.isOhlc?rp.call(this,e,l):this.isRenko||this.isLineBreak?Qd.call(this,e,l):this.style===v.Ribbon?this.varyColorPerBar?mp.call(this,e,l):fp.call(this,e,l,this.colors[0]):this.style===v.Area?c?Xd.call(this,e,l,Kd,!0):Kd.call(this,e,l,this.colors,!0):this.isColumn||this.isMultiColumn?c?Xd.call(this,e,l,tp,!0):tp.call(this,e,{...l,range:[null,null]}):this.isStackedColumn?ep.call(this,e,l):this.isBaseline?Jd.call(this,e,l):this.style===v.Step?c?Xd.call(this,e,l,sp):sp.call(this,e,l,this.colors[0]):this.isKagi?dp.call(this,e,l):this.isPointAndFigure?pp.call(this,e,l):this.style===v.Dots?ip.call(this,e,l):this.style===v.Line||this.isPercentChangeStyle?c?Xd.call(this,e,l,lp):this.varyColorPerBar?up.call(this,e,l):lp.call(this,e,l):dP(`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(Do.Last)?Do.Last:this.fields.includes(Do.Close)?Do.Close:this.fields[0]}get zoneColors(){if(!Ze(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?us(e[0]):e[1]}getComputedColor(e){if(!this.timeSeries.container.hasField(Do.BARCOLIX))return null;const t=this.dataAt(Do.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(Do.Open,e),s=this.dataAt(Do.High,e),n=this.dataAt(Do.Low,e),r=this.dataAt(Do.Close,e),o=this.dataAt(Do.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=Ze(s),o=Ze(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===E.None||(i.open=this.dataAt(Do.Open,e),i.close=this.dataAt(Do.Close,e)),i.change=this.dataAt(Do.Change,e)}let s;const n=function(e,{open:t,close:i,change:s},n){const r=n.length>2&&e!==v.HLC,o=Ze(t,i),a=o&&i>t,l=o&&i===t,c=s>0,u=0===s;return{useSame:r,isUp:a,isSame:l,isUpPrev:c,isSamePrev:u,isDown:!a&&!l,isDownPrev:!c&&!u}}(this.style,i,this.colors),r=this.getComputedColor(e);switch(this.style){case v.Candlestick:case v.Renko:case v.LineBreak:case v.Range:case v.HeikinAshi:case v.OHLC:case v.HLC:case v.Column:{if(Ze(r)){s=r;break}let t=n.useSame?n.isUp:n.isUp||n.isSame,i=n.isSame;const o=this.attributes||[],a=this.plot.isStudy&&!["HASMO","VOL","MAVOL"].includes(this.plot.model.study);if((o.includes(S.ChangeBased)||a)&&(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(Do.Projection,e)&&(s=fs(.5,!0)(s))}break}case v.ElderImpulseSystem:s=this.colors[this.dataAt(Do.BREL,e)];break;case v.HollowCandles:{const e=this.colors[n.isUpPrev||n.isSamePrev?1:0];s=t&&(n.isUp||n.isSame)?Ci.COLOR_TRANSPARENT:e;break}case v.Line:case v.PercentChange:case v.Ribbon:case v.Kagi:if(Ze(r)){s=r;break}s=this.colors[0];break;case v.PointAndFigure:{const t=vh(this.dataAt(Do.BARKIND,e))?1:0;s=this.colors[t];break}default:throw new Error(`Unexpected style ${v[this.style]} for a curve with varying colors`)}return Ze(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===v.Area?this.pickAreaStroke(s):s.length>0?s[0]:this.colors[0]}{const e=e=>e===i;return(this.isMultiColumn||this.isStackedColumn)&&Ze(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 jd([e,t],i,s){let n=i;const r=this.timeSeries.container.size;for(let i=e;i<=t;i++){for(;this.timeSeriesAt(n)<this.timelineAt(i-this.shift)&&n<r;)++n;if(n===r)break;const e=this.timeSeriesAt(n)>this.timelineAt(i-this.shift);s.call(this,n,e)}}function Kd(e,t,i,s=!1){lp.call(this,e,t,this.pickAreaStroke(i)),gp.call(this,e,t,i[0],s)}function qd(e,t){const i=Ze(e),s=Ze(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 vs(o.x,s,o.width,i-s)}else n=this.priceToY(e),r=new vs(o.x,o.y,o.width,n-o.y);else n=this.priceToY(t),r=new vs(o.x,n,o.width,o.y+o.height-n);return[n,r]}function Xd(e,t,i,s=!1,n){let r;this.zones.forEach(((o,a)=>{const l=o.value,[c,u]=qd.call(this,r,l);e.save(),As(e,u),s&&(t.range=[null,c]);let h=this.zoneColors[a];if(o.gradient){const t=((e,t)=>{const i=fs(.6)(e),s=ms(.6)(e),n="linLighten"===t;return[n?s:i,e,n?i:s]})(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 Ze(n)&&(h=n(a,h));i.call(this,e,t,h),e.restore(),r=l}))}function Zd(e,t){const{x:i,width:s}=this.pane.getBoundsWithoutScales();e.save(),e.lineWidth=1,e.strokeStyle="#888",e.setLineDash(cs("dot")),Rs(e,t,i,i+s),e.restore()}function Jd(e,t){const[i,s]=t.range,{baseLevel:n}=function(e){const{BaseLevel:t}=ct(e);return{baseLevel:Number.isFinite(t)?Tt(0,100,t):50}}(this.plot.inputs),r=(i-s)*n/100+s;this.zones[0].value=this.yToPrice(r),Zd.call(this,e,r);Xd.call(this,e,t,Kd,!0,((t,n)=>{const o=1===t,a=hs(n,0),l=e.createLinearGradient(0,o?i:s,0,r);return l.addColorStop(0,n),l.addColorStop(1,a),[l,hs(n,1)]}))}function Qd(e,{bar:t,slice:i,start:s}){let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;jd.call(this,i,s,((i,s)=>{if(!s){const[s,r]=[Do.Open,Do.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 ep(e,{bar:t,slice:i,start:s}){if(!this.isFirstVisibleOfStyle())return!1;let n=this.view.xAxis.xScale.range()[0]+t.offset;const r=ks();r.prolog(e);const o=this.plot.curves.filter((e=>e.isStackedColumn));jd.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),Ze(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 tp(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=ks();u.prolog(e),jd.call(this,i,s,((i,s)=>{s||l.forEach(((t,s)=>{const n=this.dataAt(t,i);if(Ze(n)){Ze(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 ip(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||Ci.CURVE_STYLE_DOTS_RADIUS),o=2*Math.PI;e.beginPath(),jd.call(this,i,s,((i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(Ze(s)){const t=this.priceToY(s);e.moveTo(n+r,t),e.arc(n,t,r,0,o)}}n+=t.totalWidth})),e.fill()}function sp(e,{bar:t,slice:i,start:s},n){let r=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2;const o=ks();o.prolog(e),e.strokeStyle=n,e.lineWidth=this.lineWidth,this.dashStyle&&e.setLineDash(cs(this.dashStyle)),e.beginPath();let a=!1,l=null;jd.call(this,i,s,((i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(Ze(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(Ze(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 np=[Do.Open,Do.High,Do.Low,Do.Close];function rp(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=ks();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===gs(l).a;e.strokeStyle=m?c:l,op(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(),op(e,c,u,t,o,r,p)}(e,t,this.lineWidth,!this.isHlcStyle)};jd.call(this,i,s,((e,i)=>{if(!i){const i=np.map((t=>this.dataAt(t,e))),[s,n,d,p]=i;if(Ze(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);(!Ze(a)||m<a)&&(a=m,c=f),(!Ze(l)||g>l)&&(l=g,u=f),h(f)}}r+=t.totalWidth})),n&&(Ze(c)&&(c.isMin=!0,h(c)),Ze(u)&&(u.isMax=!0,h(u))),o.epilog(e)}function op(e,t,i,s,n,r,o,a=3){t&&xs(e,{x:s,y:n+a},o,0,Math.PI),i&&xs(e,{x:s,y:r-a},o,0,Math.PI,!0)}function ap(e,t,i,s,n=1){const r=Ci.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 lp(e,{bar:t,slice:i,start:s},n=null){const r=n||this.getColor(0),o=Xe(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();jd.call(this,i,s,((i,s)=>{if(!s){const t=this.dataAt(c,i);if(Ze(t)){const i=this.priceToY(t);o&&ap(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(cs(this.dashStyle)),cp(e,l,r)}function cp(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 up(e,{bar:t,slice:i,start:s}){e.lineWidth=this.lineWidth,e.lineCap="square",this.dashStyle&&e.setLineDash(cs(this.dashStyle));let n=this.view.xAxis.xScale.range()[0]+t.offset+t.width/2,r=null,o=null,a=[];jd.call(this,i,s,((i,s)=>{if(!s){const t=this.pickMainField(),s=this.dataAt(t,i);if(Ze(s)){const t=this.priceToY(s);o=this.getColor(i),r!==o&&(cp(e,a,r),a.length>0&&(a=[a.pop()]),r=o),a.push({x:n,y:t})}}n+=t.totalWidth})),cp(e,a,o)}const hp=[null,null,null,null];function dp(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=ks();r.prolog(e);let o=null,a=null,l=[];jd.call(this,i,s,((i,s)=>{if(!s){const s=e=>np.map((t=>this.dataAt(t,e))),[c,u,h,d]=s(i),[,p,f]=i<0?hp:s(i-1);if(Ze(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 T=Ze(o)&&o!==a,S=c===u?1:2,A=c===u?2:1;l.push({x:m,y:g[0]}),l.push({x:s,y:g[S]}),T&&(l.push({x:s,y:y}),cp(e,l,o),l=[]),T&&l.push({x:s,y:y}),l.push({x:s,y:g[A]}),o=a}}n+=t.totalWidth})),cp(e,l,a),r.epilog(e)}function pp(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=ks();a.prolog(e);const l=this.plot.timeSeries.builder.boxSize,c=l/2;jd.call(this,i,s,((i,s)=>{if(!s){const[t,s]=[Do.High,Do.Low].map((e=>this.dataAt(e,i))),n=this.colors[0],u=this.colors[1],h=this.dataAt(Do.BARKIND,i),d=vh(h),p=h===Ci.BARKIND_XO,f=h===Ci.BARKIND_OX;if(Ze(t,s))for(let i=t;i>=s;i-=l){const l=a.adjust(o),[h,m]=[l-r,l+r],[g,y,T]=[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,T),e.moveTo(h,T),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 fp(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(jd.call(this,i,s,((e,i)=>{if(!i){const t=this.dataAt(r,e),i=this.dataAt(o,e);Ze(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 t=1;t<l.length;++t)e.lineTo(l[t].x,l[t].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 mp(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;jd.call(this,i,s,((e,i)=>{if(!i){const t=this.dataAt(n,e),i=this.dataAt(r,e);if(Ze(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 gp(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,hs(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;jd.call(this,i,s,((i,s)=>{if(!s){const t=this.dataAt(c,i);if(Ze(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 yp{fields=[];inputs=[];constructor(e,t,i=$.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}getBuilderKey(){if(!Ze(this.curveStyle)||!Ci.SPECIAL_BUILDER_REQUIRED.includes(this.curveStyle))return"Standard";switch(this.curveStyle){case v.Renko:{const{method:e,period:t,source:i,brickSize:s}=gu(this.inputs);return`Renko;${"ATR"===e?`ATR;${t}`:`${e};${s}`};${i}`}case v.Kagi:{const{method:e,period:t,reversal:i}=dh(this.inputs);return`Kagi;${"ATR"===e?`ATR;${t}`:`User;${i}`}`}case v.PointAndFigure:{const e=Ph(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 v.LineBreak:{const{lineBreak:e}=fh(this.inputs);return`LineBreak;${e}`}default:return v[this.curveStyle]}}get needsExtraKey(){return[$.Options,$.BalanceSheet,$.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}|${i}`}duplicate(){const e=new yp(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=rt(this.fields),e}}var Tp=n("c15IW");function Sp(e,t){const i=e.query?.duplicate();if(Ze(i)&&i.symbol!==Ci.PLACEHOLDER_SYMBOL_NAME&&"Standard"===i.getBuilderKey()){0!==i.barsToFetch&&(i.barsToFetch=i.barsToFetch*Ci.SERVER_COMPUTED_STUDY_BAR_MULTIPLIER);const e=t(i);return e.serverComputedSeries=!0,e}return new _h}function Ap(e){return new Oo(e,O.Number,D.Study,e)}class vp{studyFields={};calculable=!0;useNotifications=!1;initialNotification=!1;computedServerSide=!1;usedAsStyle=!1;recalcTriggers=new Set;basisChangedToken=null;_canLoadMoreData=!1;isLoading=!1;sourceNeedsCompute=!1;allowEmptyValues=!1;constructor(e,...t){this.container=this._source=null,this.inputs=e.inputs,this.setOptions(e),this.innerSeries=t,this.id=yt(),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){lt(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 Ci.EMPTY_ARRAY}get hasData(){return null!==this.container}get source(){if(Ze(this._source))return this._source;const e=Ze(this.inputs)?this.inputs[Ci.INPUT_SOURCE]:null;return Ze(e)?Do[e]:null}set source(e){this._source=e}async ready(){return Ai.call(this,(async()=>{this.basisChangedToken=this.useNotifications?e(Tp).subscribe(No.TS_ALL,this.onBasisChanged.bind(this)):null;const t={tag:yt(),src:null},i=(await Promise.all(this.innerSeries.map((e=>e.ready())))).every(Te);return i&&this.calculate(t),i}))}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onBasisChanged(e,t){if(e===No.TS_EVENTSCHANGED||e===No.TS_LOADING||this.innerSeries.some((e=>!e.hasData)))return;if(!this.shouldTriggerOurRecalc(t.series)||null===this.base||this===t.series)return;const i={tag:yt(),src:t.series};switch(e){case No.TS_MANYCHANGED:this.calculate(i);break;case No.TS_DATAPOINTCHANGED:case No.TS_DATAPOINTADDED:{const s=this.innerSeries[this.baseIndex].calculable?this.base.size-1:t.index;this.recalculateAt(i,s,e===No.TS_DATAPOINTADDED);break}case No.TS_TIMELINECORRECTION:break;default:throw new Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.useNotifications&&this.basisChangedToken&&e(Tp).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){je(e,{series:this,index:t})}calculateCommon(e,t=null,i=-1,s=!0){const n=-1===i,r=n?t=>{!Ze(e.src)&&Ze(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&&(Ze(e.src)||this.initialNotification)&&this.notify(t,i)}calculate(e){this.calculateCommon(e,No.TS_MANYCHANGED,-1,!0)}recalculateAt(e,t,i){this.computedServerSide||(!i&&Xe(this.container)&&t>this.container.size-1&&(t=this.container.size-1),this.calculateCommon(e,i?No.TS_DATAPOINTADDED:No.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 Ze(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(Do.DateTime,Do.Symbol)}makeContainer(){const e=this.defaultWrappers.concat(this.getWrappers()),t=Object.keys(this.studyFields).map((e=>this.studyFields[e]),this);return new fu(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 Pp extends vp{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 Cp extends Pp{constructor(e,t){super(e,t),this.query=t.query,this.useNotifications=!0}calculateAt(e){const[t,i,s,n]=[Do.Open,Do.High,Do.Low,Do.Close].map((t=>this.baseVal(t,e)),this);let r=null,o=null,a=null,l=null;const c=ve([t,i,s,n]);if(e<1)r=ve([t,n]),o=i,a=s,l=0;else{const[t,n]=[Do.Open,Do.Close].map((t=>this.container.getData(t)[e-1]),this);r=ve([t,n]),o=Math.max(i,r,c),a=Math.min(s,r,c),l=c-n}return{[Do.Open.id]:r,[Do.High.id]:o,[Do.Low.id]:a,[Do.Close.id]:c,[Do.Change.id]:l}}getWrappers(){return this.wrapBaseFields(Do.Volume,Do.OpenInterest)}}class bp extends vp{constructor(e,t){super(e,t),Ly(this)}calculateAt(e){let t=null;const i=this.period,[,s]=Oy(this);if(this.atLeast(e,i)&&s.hasField(this.source)){const n=this.past(e,i,this.source,s);this.allowEmptyValues?t=ve(n.filter(Se)):Pe(n)&&(t=ve(n))}return{[this.target.id]:t}}getWrappers(){return this.source===Do.Volume?this.wrapBaseFields(Do.Volume,Do.TradeSize,Do.Change,Do.Open,Do.Close):[]}}class Ep extends vp{constructor(e,t,i){super(e,t),this.multiplier=i(this.period),Ly(this)}calculateAt(e){let t=null;const[i,s]=Oy(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=ve(n.filter(Se)):Pe(n)&&(t=ve(n))}}}return{[this.target.id]:t}}}class _p extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=Do.OpenInterest;return this.base.hasField(i)&&(t=this.baseVal(i,e)),{[i.id]:t}}}const Mp={inField:Do.MA,outFields:[Do.ENVU,Do.ENVD],func:Qg},Lp={inField:Do.EMA,outFields:[Do.ENVEXPU,Do.ENVEXPD],func:ey},Op={inField:Do.SMA,outFields:[Do.ENVSMOU,Do.ENVSMOD],func:ty};class wp extends vp{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 Ip extends vp{constructor(e,t){super(e,t);const i=Qg(t,this.inputs.Period1,this.source),s=Qg(t,this.inputs.Period2,this.source),n=Ey(this.target,((e,t,i)=>t-i),i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}}const xp={fields:[Do.MACD,Do.MACDS,Do.MACDH],avgFunc:Qg,mapFunc:_y,histogramVaryColor:!0},Dp={fields:[Do.MACD,Do.MACDS,Do.MACDH],avgFunc:ey,mapFunc:_y,histogramVaryColor:!0},Np={fields:[Do.MACD,Do.CTLTM,Do.CTM],avgFunc:ey,mapFunc:_y,histogramVaryColor:!1},Rp={fields:[Do.MACD,Do.CTLTMF,Do.CPMI],avgFunc:ey,mapFunc:_y,histogramVaryColor:!1},Hp={fields:[Do.PPO,Do.PPOS,Do.PPOH],avgFunc:ey,mapFunc:My,histogramVaryColor:!0},Vp={fields:[Do.PVO,Do.PVOS,Do.PVOH],avgFunc:ey,mapFunc:My,histogramVaryColor:!1};class Fp extends vp{get helpers(){return[Do.BARCOLIX]}constructor(e,t,i){super(e,i),this.fields=t.fields,this.histogramVaryColor=t.histogramVaryColor;const s=t.avgFunc(i,e.inputs.Period1,e.source,void 0),n=t.avgFunc(i,e.inputs.Period2,e.source,void 0),r=Ey(this.fields[0],t.mapFunc,s,n),o=t.avgFunc(r,e.inputs.Period3,r.target,this.fields[1]),a=Ey(this.fields[2],_y,r,o);this.addInner(r,o,a)}calculateAt(e){let t=-1;if(this.histogramVaryColor&&e>0){const i=this.fields[2],s=this.container.getData(i)[e],n=this.container.getData(i)[e-1];if(Ze(s,n)){const i=s<=0;t=i?1:3,e>0&&(i&&s>n&&(t=0),!i&&s<n&&(t=2))}}return{[Do.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(this.fields[0],1),this.wrapInner(this.fields[1],2),this.wrapInner(this.fields[2],3)]}}const Bp=Ap("_AVG_GAIN"),kp=Ap("_AVG_LOSS");class Up extends vp{constructor(e,t,i){super(e,i);const s=fy(i,this.inputs.Period,this.source,Do.RSI,t),n=Dy(e,"MA","Average")(s,this.inputs.PeriodAvg,Do.RSI,Do.RSIAVG);this.addInner(s,n)}getWrappers(){return[this.wrapInner(Do.RSI,1),this.wrapInner(Do.RSIAVG,2)]}}class Wp extends vp{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);Pe(s)&&(t=this.highest?Math.max(...s):Math.min(...s),this.index&&(t=i-s.indexOf(t)-1))}return{[this.target.id]:t}}}class $p extends vp{constructor(e,t,i){super(e,i),this.toHighest=t;const s=Ze(e.source),n=e.source,r=s?n:Do.Close;this.field=r;const o=s?n:Do.High;this.highField=o;const a=s?n:Do.Low;this.lowField=a;const l=ry(i,e.inputs.Period,this.highField,Do.HH,!0),c=ry(i,e.inputs.Period,this.lowField,Do.LL,!1);this.addInner(l,c)}calculateAt(e){let t=null;const i=this.baseVal(this.field,e),s=this.innVal(1,Do.HH,e),n=this.innVal(2,Do.LL,e);if(Pe([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 Gp=Ap("RawPercK");class zp extends vp{constructor(e,t,i,s){super(e,s);const n=oy(s,this.inputs.Period1,t?Gp:i,!1),r=Dy(e,"MA"),o=r(n,this.inputs.Period2,n.target,t?i:Do.PercD),a=t?r(o,this.inputs.Period3,o.target,Do.PercD):o;this.kField=i,t?this.addInner(o,a):this.addInner(n,o)}getWrappers(){return[this.wrapInner(this.kField,1),this.wrapInner(Do.PercD,2)]}}class Yp extends vp{constructor(e,t,i){super(e,i),this.kind=t;const s=this.inputs.Period,n=this.source,r=Qg(i,s,n),o="Modified"===t,a=gy(o?ay(i,n):i,s,o?Do.PCTCHG:n);this.addInner(r,a)}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null;const a=this.innVal(2,Do.MSD,e),l=null!==a;if(l){r=this.innVal(1,Do.MA,e);const l=this.inputs.Width*a;t=r+l,i=r-l,s=2*l,o=s/r*100,n=(this.baseVal(Do.Close,e)-i)/(t-i)}switch(this.kind){case"Regular":return{[Do.BOLLBU.id]:t,[Do.BOLLBL.id]:i,[Do.BOLLBM.id]:r};case"Width":return{[Do.BOLLBW.id]:s};case"Percent":return{[Do.BOLLBP.id]:n};case"Squeeze":return{[Do.BOLLSQ.id]:o};case"Modified":{let e=null,t=null,i=null,s=null;if(l){const n=this.inputs.MultInside,o=this.inputs.MultOutside;e=r+n*a,i=r-n*a,t=r+o*a,s=r-o*a}return{[Do.MBBUI.id]:e,[Do.MBBLI.id]:i,[Do.MBBUO.id]:t,[Do.MBBLO.id]:s,[Do.MBBM.id]:r}}default:return null}}}const jp=Ap("_ABS_CHG"),Kp=Ap("_MA_ABS_CHG"),qp=Ap("_CHG");const Xp=Ap("_PDM"),Zp=Ap("_MDM"),Jp=Ap("_TRS"),Qp=Ap("_PDS"),ef=Ap("_MDS"),tf=Ap("_DX");class sf extends vp{constructor(e,t,i,s){super(e,s),this.useEma=t,this.adxField=i,this.multiplier=2/(this.inputs.AdxSmoothing+1);const n=cy(s,Do.TR);this.addInner(n)}get helpers(){return[Xp,Zp,Jp,Qp,ef,tf]}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),Pe(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,Do.High),h=this.past(e,2,Do.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(Do.TR)[e];n=this.smooth1(e,Xp,Qp,t),r=this.smooth1(e,Zp,ef,i),s=this.smooth1(e,Do.TR,Jp,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,tf,this.adxField,l))}return{[Xp.id]:t,[Zp.id]:i,[Jp.id]:s,[Qp.id]:n,[ef.id]:r,[Do.PDI.id]:o,[Do.MDI.id]:a,[tf.id]:l,[this.adxField.id]:c}}getWrappers(){return[this.wrapInner(Do.TR,1)]}}class nf extends vp{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(!Ze(n)){n=s.container.hasField(Do.Close)?Do.Close:s.container.fields[0]}return this.innVal(i,n,e)})),i=null;return Pe(t)&&(i=this.calculateAtFunc(e,...t)),{[this.target.id]:i}}}function rf(e,t){const i=this.baseVal(Do.High,t),s=this.baseVal(Do.Low,t);return{[e.id]:(i+s)/2}}function of(e,t){const i=this.baseVal(Do.High,t),s=this.baseVal(Do.Low,t);return{[e.id]:i-s}}class af extends vp{constructor(e,t,i){super(e,i),this.calculateAtFunc=t}calculateAt(e){return this.calculateAtFunc.call(this,e)}}const lf=Ap("_RANGE"),cf=Ap("_MOV_RANGE"),uf=e=>dy(e,Do.TP),hf=e=>by(lf,me(of,lf),e),df={fields:[Do.KCUP,Do.KCLOW,Do.KCMID],midSeries:uf,midTarget:Do.TP,rangeSeries:hf,rangeTarget:lf,func:Qg,useMultiplier:!1},pf={fields:[Do.KCEUP,Do.KCELOW,Do.KCEMID],midSeries:uf,midTarget:Do.TP,rangeSeries:hf,rangeTarget:lf,func:ey,useMultiplier:!1},ff={fields:[Do.KBUP,Do.KBLOW,Do.KBMID],midSeries:e=>e,midTarget:Do.Close,rangeSeries:e=>cy(e,Do.TR),rangeTarget:Do.TR,func:ey,useMultiplier:!0};class mf extends vp{constructor(e,t,i){super(e,i),this.kind=t;const s=t.midSeries(i),n=t.func(s,this.inputs.Period,t.midTarget,t.fields[2]),r=t.rangeSeries(i),o=t.func(r,this.inputs.Period,t.rangeTarget,cf);this.addInner(n,o)}calculateAt(e){const t=this.innVal(1,this.kind.fields[2],e),i=this.innVal(2,cf,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 gf extends vp{constructor(e,t,i){super(e,i),this.isWidth=t;const s=ry(i,this.inputs.Period,Do.High,Do.DONUP,!0),n=ry(i,this.inputs.Period,Do.Low,Do.DONLOW,!1);this.addInner(s,n)}calculateAt(e){const t=this.innVal(1,Do.DONUP,e),i=this.innVal(2,Do.DONLOW,e),s=null===t&&null===i;return this.isWidth?{[Do.DONW.id]:s?null:t-i}:{[Do.DONMID.id]:s?null:(t+i)/2}}getWrappers(){return[this.wrapInner(Do.DONUP,1),this.wrapInner(Do.DONLOW,2)]}}const yf=Ap("_HIND"),Tf=Ap("_LIND");class Sf extends vp{constructor(e,t,i){super(e,i),this.justWidth=t,this.justWidth=t;const s=this.inputs.Period,n=ry(i,s,Do.High,yf,!0,!0),r=ry(i,s,Do.Low,Tf,!1,!0);this.addInner(n,r)}calculateAt(e){let t=null,i=null,s=null;const n=this.innVal(1,yf,e),r=this.innVal(2,Tf,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?{[Do.ARNOSC.id]:s}:{[Do.ARNUP.id]:t,[Do.ARNLOW.id]:i}}}const Af=Ap("_MIDPOINT");const vf=Ap("_MIDPOINT");class Pf extends vp{constructor(e,t,i){super(e,i),this.multiplyVol=t}calculateAt(e){const t=[Do.High,Do.Low,Do.Close,Do.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 Cf=Ap("_RANGE");const bf=Ap("_MATP");class Ef extends vp{constructor(e,t,i){super(e,i),this.isBull=t;const s=ey(i,this.inputs.Period,this.source);this.addInner(s)}calculateAt(e){let t=null;const i=this.innVal(1,Do.EMA,e);return null!==i&&(t=this.isBull?this.baseVal(Do.High,e)-i:this.baseVal(Do.Low,e)-i),{[this.isBull?Do.ERBLPOW.id:Do.ERBRPOW.id]:t}}}const _f=Ap("_FORCE");const Mf=Ap("_RANGE"),Lf=Ap("_EMA1"),Of=Ap("_EMA2"),wf=Ap("_RATIO");const If={isNegative:!1,fields:[Do.PVI,Do.PVIEMA]},xf={isNegative:!0,fields:[Do.NVI,Do.NVIEMA]};class Df extends vp{constructor(e,t,i){super(e,i),this.kind=t;const s=by(this.kind.fields[0],me((function(e,t){let i=1e3;if(t>0){const s=[Do.Close,Do.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=ey(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 Nf=Ap("_LOGPC");const Rf=Ap("_SWING_INDEX");const Hf=Ap("_MIN_CLOSE"),Vf=Ap("_MAX_CLOSE");const Ff=Ap("_EP"),Bf=Ap("_AF"),kf=Ap("_POS");const Uf=Ap("_IDY"),Wf=[0,0,0,1,1,1,5,5,2,1,1,0,50,50,0,1,1,1,5,0,0],$f=e=>Array(e).fill(0);function Gf(e,t,i){let s=e[i-1];return 0===t&&(s=e[i]),t<0&&(s=e[i+1]),s}function zf(e,t,i,s,n){const r=n[18];let o=s+1,a=0;for(let i=0;i<r;++i){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 Gf(e,t,4)}(n,i[s]),a}function Yf(e,t,i,s,n){let r=s;const o=function(e,t){return Gf(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 jf(e,t,i,s,n,r,o,a,l,c){const u=function(e,t){return Gf(e,t,10)}(n,i[s]),h=function(e,t){return Gf(e,t,13)}(n,i[s]),d=function(e,t){return Gf(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,T=e[s]+(p-p*m),S=[r,o];return(1===a||1!==d||y>r)&&(S[0]=y),(1===a||1!==d||T<o)&&(S[1]=T),S}function Kf(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 qf={1:{param:"cot",func:"parseCotLineChart",fields:[Do.DateTime,Do.COTLCCMSP,Do.COTLCLGSP,Do.COTLCSMSP]},2:{param:"cotadv",func:"parseDisaggregated",fields:[Do.DateTime,Do.COTDAGPRO,Do.COTDAGSPD,Do.COTDAGMNM,Do.COTDAGOTH]},3:{param:"cotfin",func:"parseFinancialTradersReport",fields:[Do.DateTime,Do.COTFTRDLI,Do.COTFTRASM,Do.COTFTRLVF,Do.COTFTROTH]}};class Xf extends vp{constructor(e,t,i){super(e,Sp(i,(e=>new Zf(t,e)))),this.computedServerSide=!0,this.initialNotification=!0,this.wrappers=qf[t].fields.slice(1).map((e=>this.wrapInner(e,0)))}getWrappers(){return this.wrappers}}class Zf extends Eh{constructor(e,t){super(t),this.kind=e}getRetriever(){return new Jf(this.kind)}onStreamingUpdates(e){}}class Jf extends $u{constructor(e){super(),this.kind=e}addExtraParams(e){e[qf[this.kind].param]="y"}getParser(e){return new Qf(e.symbol,e.aggregation,this.kind)}}class Qf extends ku{constructor(e,t,i){super(e,t,0),this.kind=i}makeContainer(){return new du(qf[this.kind].fields)}getParseFunc(){return this.aggregation.isEndOfDay?this[qf[this.kind].func]:null}parseCotLineChart(e){this.container.addDataPoint(Do.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Do.COTLCCMSP,parseInt(e[2])),this.container.addDataPoint(Do.COTLCLGSP,parseInt(e[3])),this.container.addDataPoint(Do.COTLCSMSP,parseInt(e[4]))}parseDisaggregated(e){this.container.addDataPoint(Do.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Do.COTDAGPRO,parseInt(e[2])),this.container.addDataPoint(Do.COTDAGSPD,parseInt(e[3])),this.container.addDataPoint(Do.COTDAGMNM,parseInt(e[4])),this.container.addDataPoint(Do.COTDAGOTH,parseInt(e[5]))}parseFinancialTradersReport(e){this.container.addDataPoint(Do.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Do.COTFTRDLI,parseInt(e[2])),this.container.addDataPoint(Do.COTFTRASM,parseInt(e[3])),this.container.addDataPoint(Do.COTFTRLVF,parseInt(e[4])),this.container.addDataPoint(Do.COTFTROTH,parseInt(e[5]))}}class em extends Xf{constructor(e,t){super(e,1,t)}}const tm={Day:[Do.PreviousHigh,Do.PreviousLow,Do.PreviousClose],Week:[Do.WeekPreviousHigh,Do.WeekPreviousLow,Do.WeekPreviousClose],Month:[Do.MonthPreviousHigh,Do.MonthPreviousLow,Do.MonthPreviousClose]};class im extends vp{constructor(e,t,i){super(e,i),this.disabled=!Ze(i.query)||!Ze(i.query.symbol),this.disabled||(this.record=SP().getRecordSource().getRecord(i.query.symbol),this.record.addFields(...t),this.streamingSubscription=this.getStreamingSubscription()),this.initialNotification=!0}getStreamingSubscription(){return SP().getRecordSource().subject.pipe(Ku((e=>{const t=Ko(No.RT_QUOTE,this.record.symbol);return e.filter(t)})),rl((e=>e.length>0))).subscribe(this.onStreamingUpdates.bind(this))}async ready(){return Ai.call(this,(async()=>Ze(this.record)?await this.record.ready()&&await super.ready():await super.ready()),"asyncReadyWork2")}onStreamingUpdates(e){if(this.record){const e={tag:yt(),src:null};this.calculate(e)}}shutdown(){super.shutdown(),this.disabled||this.streamingSubscription.unsubscribe()}getValues(e){return tm[e].map((e=>this.record.getValue(e)))}}class sm extends Eh{constructor(e){super(e)}getRetriever(){return zt(this.query.symbol)?new am:new nm}onStreamingUpdates(e){}}class nm extends $u{addExtraParams(e){e.impl="y"}getParser(e){return new om(e.symbol,e.aggregation)}}function rm(){return new du([Do.DateTime,Do.IMPVOL])}class om extends ku{constructor(e,t){super(e,t)}makeContainer(){return rm()}getParseFunc(){return this.parseImpVol}parseImpVol(e){!this.aggregation.isEndOfDay||e.length<9||(this.container.addDataPoint(Do.DateTime,this.parseDate(e[1])),this.container.addDataPoint(Do.IMPVOL,parseFloat(e[8])))}}class am extends Gu{emptyContainer(e,t){return rm()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(Do.DateTime,Fu(e.date.substring(0,10)));const s=Xe(e.impliedVolatility);i.addDataPoint(Do.IMPVOL,s?100*e.impliedVolatility:null)}}const lm=Ap("_ABS_CHG"),cm=Ap("_DS1_EMA1"),um=Ap("_DS1_EMA2"),hm=Ap("_DS2_EMA1"),dm=Ap("_DS2_EMA2");const pm=Ap("_DIFF");const fm=Ap("_SUM");const mm=Ap("_ABS_CHG"),gm=Ap("_HH_LL"),ym=Ap("_MULMA");class Tm extends vp{constructor(e,t,i){super(e,i);const s="Close"===e.inputs.TurtleChnField,n=Vy(i);if(!s&&n){const e=by(this.target,((e,t)=>null),i);this.addInner(e)}else{const e=Qg(by(mm,me(((e,t)=>({[mm.id]:t>0?e*Math.abs(this.baseVal(Do.Change,t)):null})),this.inputs.FactorATR),i),this.inputs.PeriodAdjATR,mm,Do.MA),n=t?Do.High:Do.Low,r=ry(i,this.inputs.PeriodTurtleChn,s?Do.Close:n,gm,t),o=Ey(ym,((e,t)=>this.inputs.FactorAdjATR*t),e),a=t?-1:1,l=(e,t,i)=>t+a*i,c=Ey(this.target,l,r,o);this.addInner(c)}}getWrappers(){return[this.wrapInner(this.target,1)]}}const Sm=Ap("_DIFF");class Am extends Pp{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=[Do.Open,Do.High,Do.Low,Do.Close],n=s.map((t=>i(t,e)));if(Pe(n)){const r=s.map((t=>i(t,e-1)));if(Pe(r)){t=n.map(((e,t)=>100*(e-r[t])/r[t]));const[i,s]=Ne(t);if(t[1]=s,t[2]=i,e>1){const i=this.container.getData(Do.Close)[e-1];t[4]=t[3]-i}}}}return{[Do.Open.id]:t[0],[Do.High.id]:t[1],[Do.Low.id]:t[2],[Do.Close.id]:t[3],[Do.Change.id]:t[4]}}getWrappers(){return this.wrapBaseFields(Do.Volume,Do.OpenInterest)}}const vm=Ap("_DIST"),Pm=Ap("_EMA_DIST1"),Cm=Ap("_EMA_DIST2"),bm=Ap("_DIFF"),Em=Ap("_EMA_DIFF1"),_m=Ap("_EMA_DIFF2");const Mm=Ap("_CHG"),Lm=Ap("_M1"),Om=Ap("_M2");const wm=Ap("_MAX"),Im=Ap("_MIN"),xm=Ap("_ISUPTREND");const Dm=Ap("_TRENDUP"),Nm=Ap("_TRENDDOWN"),Rm=Ap("_TREND");const Hm=Ap("_CUM_PRICE"),Vm=Ap("_CUM_VOL"),Fm=Ap("_PER_CHG");class Bm extends vp{constructor(e,t){super(e,t);const i=this.source,s=by(i,me(wy,i),t);this.addInner(s)}valueAt(e,t){return this.container.getData(e)[t]}dateAt(e){return this.container.getTimeData()[e]}}const km=Ap("_DIFF"),Um=[km,Do.Buy,Do.Sell];function Wm(e,t,i,s){let n=null,r=null,o=null;Ze(i,s)&&(o=i-s);const a=t>0?e.getData(km)[t-1]:null;return Ze(o,a)&&(n=o>0&&a<=0?1:null,r=o<0&&a>=0?-1:null),{[km.id]:o,[Do.Buy.id]:n,[Do.Sell.id]:r}}const $m=Ap("_PVM"),Gm=Ap("_NVM");Tp=n("c15IW");function zm(e,t,i){return new Ym(e,t,i)}class Ym{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=eo(e),this.valueSymbols=this.exprSymbols.filter((e=>void 0===this.innerLookup[e])),this.onlyForTimeline=Me(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;const t=this.innerSeries.filter((e=>e.canLoadMoreData)).map((t=>t.loadMoreData(e)));await Promise.all(t),this.isLoading=!1}get isExprInError(){return!Ze(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 Ai.call(this,(async()=>{this.basisChangedToken=e(Tp).subscribe(No.TS_ALL,this.onBasisChanged.bind(this)),this.quoteGroupToken=e(Tp).subscribe(No.RT_QUOTEGROUP,this.onQuoteGroup.bind(this));const t=this.innerSeries.map((e=>e.ready()));void 0!==this.policy.valueProvider&&t.push(this.policy.valueProvider.ready());const i=(await Promise.all(t)).every(Te);return i&&this.calculate(),i}))}shouldTriggerOurRecalc(e){return this.recalcTriggers.has(e)}onQuoteGroup(e,t){t.source===this.policy.valueProvider&&this.innerSeries.every((e=>Ze(e.container)))&&this.calculateCommon(No.TS_MANYCHANGED)}onBasisChanged(e,t){if(this.policy.recompute===p.Manual)return;if(e===No.TS_EVENTSCHANGED||e===No.TS_LOADING)return;if(!this.shouldTriggerOurRecalc(t.series)||this.innerSeries.some((e=>!Ze(e.container))))return;const i=this.policy.mapper(t.series);if(e===No.TS_DATAPOINTCHANGED&&this.onlyForTimeline?.includes(i))return;switch(this.policy.recompute===p.Everything?No.TS_MANYCHANGED:e){case No.TS_MANYCHANGED:this.calculate();break;case No.TS_DATAPOINTCHANGED:case No.TS_DATAPOINTADDED:this.recalculate(e===No.TS_DATAPOINTADDED);break;default:throw new Error("Unknown time series message, likely forgot to handle it")}}shutdown(){this.basisChangedToken&&e(Tp).unsubscribe(this.basisChangedToken),this.quoteGroupToken&&(e(Tp).unsubscribe(this.quoteGroupToken),this.policy.valueProvider?.shutdown())}calculateAt(e){return e.isNull?null:this.sourceFields.map(((t,i)=>{if(t===Do.Volume)return Ae(this.exprSymbols.map((t=>e.inn[t].values[i]??0)));return Zr(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===Do.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];Ze(s,n)&&e.setLastDataPoint(Do.Change,n-s)}calculateDataPoint(e,t){const i=this.calculateAt(e);if(null===i)return;e.atLeastOne=!0;const[s,n]=Ne(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(Do.Change,null),this.container.addDataPoint(Do.DateTime,new Date(e.timeStamp))),this.calculateLastChange()}notify(e){je(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,Do.DateTime)}timeline(e){return e.container.getData(Do.DateTime)}getRangeHelper(){switch(this.policy.missing){case h.UseNext:case h.UseNone:return Math.min;case h.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=>we(this.timeline(this.innerLookup[e])))))),end:new Date(e(...this.symbols.map((e=>Oe(this.timeline(this.innerLookup[e]))))))}}getFirstPos(){return this.getPos(this.getRange().begin)}getLastPos(){return this.getPos(this.getRange().end)}findIndex(e,t){const i=this.timeline(this.innerLookup[e]);switch(this.policy.missing){case h.UseNext:case h.UseNone:return i.findIndex((e=>e.valueOf()>=t.valueOf()));case h.UsePrevious:return Ie(i,(e=>e.valueOf()<=t.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=>!(Ze(e.timeStamp)||this.policy.stretch(e.symbol)&&1!==t)))}fillPosSymbolAt(e,t,i){e.index=t,e.timeStamp=this.timeStampAt(e.symbol,t);const s=(this.policy.missing===h.UseNone||this.policy.skipLeadingEmpty&&!i.atLeastOne)&&e.timeStamp&&e.timeStamp.valueOf()!==i.timeStamp.valueOf();return e.values=this.sourceFields.map((i=>s?null:this.fieldValueAt(e.symbol,t,i))),e}skippable(e){return!!this.innerLookup[e].container.isEmpty&&(this.policy.noDataApproach===m.IgnoreTimelineOnly&&this.onlyForTimeline.includes(e)||this.policy.noDataApproach===m.ModelTransformRequired)}get symbols(){const e=Object.keys(this.innerLookup);return Ze(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: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(;Ze(t.timeStamp)&&t.timeStamp.valueOf()<=e.timeStamp.valueOf();)this.fillPosSymbolAt(t,t.index+1,e)})),this.checkPos(e),e.isNull||(e.timeStamp=new Date(Math.min(...this.getInner(e).filter((e=>null!==e.timeStamp)).map((e=>e.timeStamp.valueOf())))),this.policy.missing===h.UsePrevious?this.getInner(e).forEach((t=>{const i=Ze(t.timeStamp);(i&&t.timeStamp.valueOf()>e.timeStamp.valueOf()||!i&&this.policy.stretch(t.symbol))&&this.fillPosSymbolAt(t,t.index-1,e)})):this.policy.missing===h.UseNone&&this.getInner(e).forEach((t=>this.fillPosSymbolAt(t,t.index,e)))))}shouldAdd(e){return this.container.getLastDataPoint(Do.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(e){this.crashedComputationReported||(dP(e,"error"),this.crashedComputationReported=!0)}}calculate(){const{yes:e,no:t}=be(this.innerSeries,(e=>!e.container.isEmpty));if(t.length>0&&this.policy.noDataApproach===m.ModelTransformRequired){const i=e=>e.map(this.policy.mapper),s=this.policy.modelTransform(i(e),i(t));null!==s&&(this.exprModel=s)}this.calculateCommon(No.TS_MANYCHANGED)}recalculate(e){if(this.isExprInError)return;const t=this.getLastPos(),i=this.shouldAdd(t);this.calculateCommon(i?No.TS_DATAPOINTADDED:No.TS_DATAPOINTCHANGED,t,i)}recalculateAt(e,t,i){return this.recalculate(i)}makeContainer(){const e=[Do.DateTime,Do.Change].concat(this.targetFields);return new du(e)}getCacheableEntities(e){this.innerSeries.forEach((t=>{t.getCacheableEntities(e)}))}}const jm=Ap("_AVG");const Km=Ap("_HAO"),qm=Ap("_HAH"),Xm=Ap("_HAL"),Zm=Ap("_HAC");const Jm=Ap("_DELTA");const Qm=Ap("_DIFF"),eg=Ap("_RANK"),tg=Ap("_CHG"),ig=Ap("_AVG"),sg=Ap("_HBRAKE_CHG"),ng=Ap("_HEIGHT_DELTA"),rg=Ap("_ACTION"),og=Ap("_REVERSAL"),ag=10,lg=e=>[e>0,e<0],cg=[null,null,null],ug=0,hg=1,dg=2;function pg([e,t],i){let s=null;if(i>0){const t=this.baseVal(e,i-1);Ze(t)&&(s=this.baseVal(e,i)-t)}return{[t.id]:s}}class fg extends vp{constructor(e,t){super(e,t);const i=Dy(e,"MA","Average"),s=i(t,Tt(1,999,this.inputs.FastPeriod),Do.Close),n=Tt(0,999,this.inputs.SlowPeriod),r=n>0,o=r?i(t,n,Do.Close):t,a=Ey(Qm,r?(e,t,i)=>t-i:(e,t,i)=>i-t,s,o),l=by(tg,me(pg,[Do.Close,tg]),t),c=by(eg,(function(e){const t=Math.abs(this.baseVal(Qm,e));let i=null,s=0,n=0;for(let i=e-1;i>=0&&s<200;--i){s++,Math.abs(this.baseVal(Qm,i))<t&&n++}return s>0&&(i=Math.floor(n/s*ag)),i===ag&&i--,{[eg.id]:i}}),a),u=Tt(0,999,this.inputs.HandbrakePeriod);this.useHandbrake=u>0;const h=i(t,u,Do.Close,ig),d=by(sg,me(pg,[ig,sg]),h);this.addInner(l,a,c,d)}get helpers(){return[ng,Do.BARCOLIX,rg,og]}getStateAt(e){const t=this.innVal(2,Qm,e);return Ze(t)?lg(t):cg}findPreviousKnownState(e){for(let t=e-1;t>0;t--){const e=this.getStateAt(t);if(e===cg)return cg;const[i,s]=e;if(i||s)return e}return cg}getBuySell(e){const t=this.getStateAt(e);if(t===cg)return cg;const[i,s]=t,n=this.findPreviousKnownState(e),[r,o]=n;if(!i&&!s)return n===cg?cg:[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=ug;const[o,a,l]=this.getBuySell(e),[c,u]=[og,rg].map((t=>this.getPrev(t,e))),[h,d]=[0,-1].map((t=>this.innVal(4,sg,e+t)));if(n=l?ag:this.innVal(3,eg,e),this.useHandbrake&&Ze(h,d)){const t=!o&&h>0||!a&&h<0;l?(n=t?ag:12,r=u):!0!==c&&u!==hg||(o&&d>0||a&&d<0?(n=this.innVal(3,eg,e),r=dg):(n=t?11:13,r=hg))}if(Ze(this.innVal(2,Qm,e))){const t=this.innVal(1,tg,e),[i,n]=lg(t),r=Math.abs(t);(o&&i||a&&n)&&(s=r),(o&&n||a&&i)&&(s=-r)}return o?t=1:a&&(i=1),{[Do.JPIB.id]:t,[Do.JPIS.id]:i,[Do.BARCOLIX.id]:n,[ng.id]:s,[rg.id]:r,[og.id]:l}}}const mg=Ap("_SMTH_ROC"),gg=Ap("_TEN_SMTH_ROC");function yg(e,t,i,s,n){return new Ep({source:s,target:n,outFields:[n],aggregation:i,inputs:jg(t)},e,(e=>2/e))}const Tg=Ap("_VOL_AVG");const Sg=(()=>{const e=(t=51,Je(Math.pow(.5,1/t),6));var t;const i=Re(52,(t=>Math.pow(e,t))),s=52/Ae(i);return i.map((e=>e*s))})(),Ag=["Renko","Kagi","PointAndFigure","LineBreak"];const vg=Ap("_EMA1"),Pg=Ap("_EMA2"),Cg=Ap("_MACD"),bg=Ap("_PCTK"),Eg=Ap("_PCTD"),_g=Ap("_PCTK2");const Mg=Ap("_EMA1"),Lg=Ap("_EMA2"),Og=Ap("_CORE");class wg extends vp{constructor(e,t){if(super(e,t),Fy(t)){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{const e=by(Do.Close,((e,t)=>null),t),i=by(Do.Close,((e,t)=>null),t),s=by(this.target,((e,t)=>null),t);this.addInner(e,i,s),this.canLoadMoreData=!1}}get baseIndex(){return 1}getSeries(e,t){const i=e.duplicate();i.symbol=t;return SP().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 Ig=Ap("_INN_HL_ACC_IX"),xg=new Dr;class Dg extends vp{isWeekly=!1;constructor(e,t){if(super(e,t),t instanceof _h)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===C.Week,this.isWeekly){const e=this.getSeries(t.query,r,xg),o=(i=e,s=this.inputs,new Dg({aggregation:xg,source:null,target:n=Ig,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*Ci.US_TRADING_DAYS_PER_YEAR);return SP().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,Do.Close);Pe(s)&&(t=Ae(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(Ig);else{const t=this.container.getTimeData()[e],n=s.getTimeData();let r=De(n,t),o=n[r],a=null;for(;r<s.size&&Cr(t,o);)a=r,r+=1,o=n[r];null!==a&&(i=s.getData(Ig)[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 Ng=Ap("_RSI1"),Rg=Ap("_RSI1_MOM"),Hg=Ap("_RSI2"),Vg=Ap("_RSI2_MA");const Fg=Ap("_MUL_ATR");class Bg extends vp{constructor(e,t){super(e,Sp(t,(t=>{const i=SP().getTimeSeriesDataSource();return t.seriesKind=$.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 kg=Ap("_CORE");class Ug extends Eh{constructor(e){super(e)}getRetriever(){return zt(this.query.symbol)?new Gg:Zt(this.query.symbol)?new zg:new $g}}function Wg(){const e=[Do.DateTime,Do.Delta,Do.Gamma,Do.Theta,Do.Vega];return new du(e)}class $g{constructor(){this.supportsChunks=!1}async retrieve(e){return Wg()}}class Gg extends Gu{emptyContainer(e,t){return Wg()}get iterateForward(){return!1}getPageName(){return"getFuturesOptionsHistory"}processRow(e,t,i){i.addDataPoint(Do.DateTime,Fu(e.date.substring(0,10))),i.addDataPoint(Do.Delta,e.delta),i.addDataPoint(Do.Gamma,e.gamma),i.addDataPoint(Do.Theta,e.theta),i.addDataPoint(Do.Vega,e.vega)}}class zg extends Gu{emptyContainer(e,t){return Wg()}addExtraParams(e){e.fields="delta,gamma,theta,vega"}get iterateForward(){return!0}getPageName(){return"getEquityOptionsHistory"}processRow(e,t,i){i.addDataPoint(Do.DateTime,Fu(e.date)),i.addDataPoint(Do.Delta,e.delta),i.addDataPoint(Do.Gamma,e.gamma),i.addDataPoint(Do.Theta,e.theta),i.addDataPoint(Do.Vega,e.vega)}}const Yg={_TR:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=this.baseVal(Do.High,e),s=this.baseVal(Do.Low,e);if(e>0){const n=this.baseVal(Do.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 vp{constructor(e,t){super(e,t);const i=e.inputs.Modified;this.isModified=i}get helpers(){return[Bp,kp]}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(Pe(t)){const e=Ce(1,n),r=e.map((e=>this.gain(e,t))),o=e.map((e=>this.loss(e,t)));i=ve(r),s=ve(o)}}else{const t=this.container.getData(Bp)[e-1],r=this.container.getData(kp)[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{[Bp.id]:i,[kp.id]:s,[this.target.id]:t}}},MA:bp,MAEXP:class extends Ep{constructor(e,t){super(e,t,(e=>2/(e+1)))}},MAHLC:class extends vp{constructor(e,t){super(e,t);const i=Qg(t,this.inputs.Period1,Do.High,Do.MAHI),s=Qg(t,this.inputs.Period2,Do.Low,Do.MALO);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Do.MAHI,1),this.wrapInner(Do.MALO,2)]}},VOL:class extends _p{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(Do.Volume,Do.TradeSize,Do.Change,Do.Open,Do.Close)}},MAENV:class extends wp{constructor(e,t){super(e,Mp,t)}},MAENVEXP:class extends wp{constructor(e,t){super(e,Lp,t)}},MAENVSMO:class extends wp{constructor(e,t){super(e,Op,t)}},MATRI:class extends vp{constructor(e,t){super(e,t);const i=Qg(t,this.inputs.Period,this.source),s=Qg(i,this.inputs.Period,Do.MA,Do.TMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Do.TMA,2)]}},MAWEI:class extends vp{constructor(e,t){super(e,t);const i=this.period;this.triangle=i*(i+1)/2,Ly(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]=Oy(this);if(this.atLeast(e,i)){const n=this.past(e,i,this.source,s);this.allowEmptyValues?t=this.weightedAverage(n.filter(Se)):Pe(n)&&(t=this.weightedAverage(n))}return{[this.target.id]:t}}},MAVOL:bp,MASMO:class extends Ep{constructor(e,t){super(e,t,(e=>1/e))}},MACD:class extends Fp{constructor(e,t){super(e,xp,t)}},MACDEXP:class extends Fp{constructor(e,t){super(e,Dp,t)}},GMMA:class extends vp{constructor(e,t){super(e,t);for(let i=1;i<=12;++i){const s=e.inputs[`Period${i}`];this.addInner(ey(t,s,Do.Close,e.outFields[i-1]))}}getWrappers(){return Ce(1,12).map((e=>this.wrapInner(this.outFields[e-1],e)))}},OSCI:Ip,OSCIVOL:Ip,RSI:class extends Up{constructor(e,t){super(e,!1,t)}},RSIMOD:class extends Up{constructor(e,t){super(e,!0,t)}},RSISTO:class extends vp{constructor(e,t){super(e,t);const i=fy(t,this.inputs.Period,this.source),s=this.inputs.Range,n=by(Do.STORSI,(function(e){let t=null;if(this.atLeast(e,s)){const i=this.past(e,s,Do.RSI,this.base),n=Ne(i),r=n[0],o=n[1];t=(Oe(i)-r)/(o-r)}return{[Do.STORSI.id]:t}}),i),r=Dy(e,"MA","Average")(n,this.inputs.PeriodAvg,Do.STORSI,Do.STORSIAVG);this.addInner(n,r)}getWrappers(){return[this.wrapInner(Do.STORSI,1),this.wrapInner(Do.STORSIAVG,2)]}},WPERCR:class extends $p{constructor(e,t){super(e,!0,t)}},HHLL:class extends vp{constructor(e,t){super(e,t);const i=ry(t,this.inputs.Period1,Do.High,Do.HH,!0),s=ry(t,this.inputs.Period2,Do.Low,Do.LL,!1);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Do.HH,1),this.wrapInner(Do.LL,2)]}},WGCL:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;const i=[Do.Close,Do.High,Do.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 zp{constructor(e,t){super(e,!1,Do.PercK,t)}},STOCHS:class extends zp{constructor(e,t){super(e,!0,Do.PercK,t)}},BBANDS:class extends Yp{constructor(e,t){super(e,"Regular",t)}},BWIDTH:class extends Yp{constructor(e,t){super(e,"Width",t)}},BPERC:class extends Yp{constructor(e,t){super(e,"Percent",t)}},OBVOL:class extends vp{constructor(e,t){super(e,t);const i=by(Do.OBVOL,(function(e){let t=null;if(e>0){const i=this.baseVal(Do.Close,e),s=this.baseVal(Do.Volume,e),n=this.baseVal(Do.Close,e-1);let r=this.container.getData(this.target)[e-1];Ze(r)||(r=0),t=i>n?r+s:i<n?r-s:r}return{[this.target.id]:t}}),t),s=Dy(e,"MA","Average")(i,this.period,Do.OBVOL,Do.OBVOLAVG);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Do.OBVOL,1),this.wrapInner(Do.OBVOLAVG,2)]}},ATR:class extends vp{constructor(e,t){super(e,t);const i=cy(t,Do.TR),s=Dy(e,"SMA")(i,this.inputs.Period,Do.TR,this.target),n=Qg(s,this.inputs.Period2,Do.ATR,Do.ATRMA);this.addInner(s,n)}getWrappers(){return[this.wrapInner(this.target,1),this.wrapInner(Do.ATRMA,2)]}},ATRP:class extends vp{constructor(e,t){super(e,t);const i=uy(t,e.inputs.Period,e.inputs.Smoothing);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(1,Do.ATR,e),s=this.baseVal(Do.Close,e);return Ze(i,s)&&s>0&&(t=i/s*100),{[Do.ATRP.id]:t}}},ADX:class extends sf{constructor(e,t){super(e,!1,Do.ADX,t)}},ADXMOD:class extends sf{constructor(e,t){super(e,!0,Do.ADXM,t)}},ADL:class extends vp{constructor(e,t){super(e,t);const i=my(t);this.addInner(i)}calculateAt(e){let t=null;return t=(e>0?this.container.getData(this.target)[e-1]:0)+this.innVal(1,Do.MFMUL,e),{[this.target.id]:t}}},ADWM:class extends vp{constructor(e,t){super(e,t);const i=by(Do.ADWM,(function(e){let t=null,i=null;if(e>0){const s=this.baseVal(Do.Close,e-1),n=Math.max(s,this.baseVal(Do.High,e)),r=Math.min(s,this.baseVal(Do.Low,e)),o=this.baseVal(Do.Close,e);if(t=o>s?o-r:o<s?o-n:0,e>1){i=(e>2?this.container.getData(Do.ADWM)[e-1]:0)+t}}return{[Do.ADWM.id]:i}}),t),s=Qg(i,this.inputs.Period,Do.ADWM,Do.ADWMMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Do.ADWM,1),this.wrapInner(Do.ADWMMA,2)]}},CHAOSC:class extends vp{constructor(e,t){super(e,t);const i=Do.ADL;let s=hy(t,i),n=ey(s,3,i),r=ey(s,10,i),o=Ey(e.target,((e,t,i)=>t-i),n,r);this.addInner(o)}getWrappers(){return[this.wrapInner(this.target,1)]}},TP:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;return t=ve([Do.Close,Do.High,Do.Low].map((t=>this.baseVal(t,e)))),{[this.target.id]:t}}},KELCHN:class extends mf{constructor(e,t){super(e,df,t)}},KELEXP:class extends mf{constructor(e,t){super(e,pf,t)}},KELBND:class extends mf{constructor(e,t){super(e,ff,t)}},DONCHN:class extends gf{constructor(e,t){super(e,!1,t)}},DONWIDTH:class extends gf{constructor(e,t){super(e,!0,t)}},PVT:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){let t=null;if(e>0){const i=this.baseVal(Do.Close,e),s=this.baseVal(Do.Volume,e),n=this.baseVal(Do.Close,e-1);let r=this.container.getData(this.target)[e-1];Ze(r)||(r=0);t=r+(i-n)/n*s}return{[this.target.id]:t}}},ROC:class extends vp{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 vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.Period,this.source),s=ey(i,this.inputs.Period,i.target),n=ey(s,this.inputs.Period,s.target),r=py(n,1,n.target,this.target);this.addInner(r)}getWrappers(){return[this.wrapInner(this.target,1)]}},PPMOV:class extends vp{constructor(e,t){super(e,t);const i=dy(t,Do.PVPT);this.addInner(i)}calculateAt(e){const t=this.innVal(1,Do.PVPT,e),i=this.baseVal(Do.High,e),s=this.baseVal(Do.Low,e);return{[Do.PVPTR.id]:t+i-s,[Do.PVPTS.id]:t-i+s}}getWrappers(){return[this.wrapInner(Do.PVPT,1)]}},PIVPTS:class extends im{constructor(e,t){super(e,tm[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(Pe(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{[Do.PPTPIV.id]:t,[Do.PPTR1.id]:i,[Do.PPTR2.id]:n,[Do.PPTR3.id]:o,[Do.PPTS1.id]:s,[Do.PPTS2.id]:r,[Do.PPTS3.id]:a}}},CPP:class extends im{constructor(e,t){super(e,tm.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(Pe(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{[Do.CPPH4.id]:a,[Do.CPPH3.id]:r,[Do.CPPH2.id]:s,[Do.CPPH1.id]:t,[Do.CPPL1.id]:i,[Do.CPPL2.id]:n,[Do.CPPL3.id]:o,[Do.CPPL4.id]:l}}},ARNUPDW:class extends Sf{constructor(e,t){super(e,!1,t)}},ARNOSC:class extends Sf{constructor(e,t){super(e,!0,t)}},TCHN:class extends vp{constructor(e,t){super(e,t);const i="Close"===e.inputs.Range,s=Vy(t);if(!i&&s){const e=by(Do.TCHNUP,((e,t)=>null),t),i=by(Do.TCHNLOW,((e,t)=>null),t);this.addInner(e,i)}else{let s=ry(t,e.inputs.PeriodUpper,i?Do.Close:Do.High,Do.TCHNUP,!0),n=ry(t,e.inputs.PeriodLower,i?Do.Close:Do.Low,Do.TCHNLOW,!1);this.addInner(s,n)}}getWrappers(){return[this.wrapInner(Do.TCHNUP,1),this.wrapInner(Do.TCHNLOW,2)]}},TCHRE:class extends vp{constructor(e,t){super(e,t);const i=Sy(t,e.inputs.Period,e.inputs.Range);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(1,Do.TCHNUP,e),s=this.innVal(1,Do.TCHNLOW,e),n=this.inputs.Adjustment,r=this.inputs.Retracement;return"Long"===r?t=Ze(i)?i-n:null:"Short"===r&&(t=Ze(s)?s+n:null),{[this.target.id]:t}}},ALLG:class extends vp{constructor(e,t){super(e,t);const i=by(Af,me(rf,Af),t),s=ty(i,e.inputs.Period1,Af,Do.ALJAW),n=ty(i,e.inputs.Period2,Af,Do.ALTEETH),r=ty(i,e.inputs.Period3,Af,Do.ALLIPS);this.addInner(s,n,r)}calculateAt(e){return{[Do.ALJAW.id]:this.innVal(1,Do.ALJAW,e),[Do.ALTEETH.id]:this.innVal(2,Do.ALTEETH,e),[Do.ALLIPS.id]:this.innVal(3,Do.ALLIPS,e)}}},PLTLN:class extends vp{constructor(e,t){super(e,t)}calculateAt(e){return{[Do.PLTLN.id]:this.inputs.Position}}},AWEOSC:class extends vp{constructor(e,t){super(e,t);const i=by(vf,me(rf,vf),t),s=Qg(i,this.inputs.Period1,vf),n=Qg(i,this.inputs.Period2,vf),r=Ey(Do.AWOS,((e,t,i)=>t-i),s,n),o=Qg(r,this.inputs.Period3,r.target,Do.AWOSMA);this.addInner(r,o)}getWrappers(){return[this.wrapInner(Do.AWOS,1),this.wrapInner(Do.AWOSMA,2)]}},MFV:class extends Pf{constructor(e,t){super(e,!0,t)}},CLV:class extends Pf{constructor(e,t){super(e,!1,t)}},CHAMF:class extends vp{constructor(e,t){super(e,t);const i=my(t);this.addInner(i)}calculateAt(e){let t=null;const i=this.period;if(this.atLeast(e,i)){const s=this.past(e,i,Do.Volume),n=this.past(e,i,Do.MFMUL,this.innCont(1));if(Pe(s)&&Pe(n)){const e=Ae(s);0!==e&&(t=Ae(n)/e)}}return{[this.target.id]:t}}},CHAVOL:class extends vp{constructor(e,t){super(e,t);const i=py(ey(by(Cf,me(of,Cf),t),this.inputs.Period1,Cf),this.inputs.Period2,Do.EMA,this.target);this.addInner(i)}getWrappers(){return[this.wrapInner(this.target,1)]}},DPO:class extends vp{constructor(e,t){super(e,t);const i=this.inputs.Period;this.shift=Math.floor(i/2)+1;const s=Qg(t,i,e.source);this.addInner(s)}calculateAt(e){let t=null;const i=this.shift,s=this.innVal(1,Do.MA,e-i);return null!==s&&(t=this.baseVal(this.source,e)-s),{[this.target.id]:t}}},CCI:class extends vp{constructor(e,t){super(e,t);const i=dy(t),s=Qg(i,this.inputs.Period,i.target,bf);this.addInner(i,s)}calculateAt(e){let t=null;const i=this.period;if(this.atLeast(e,i)){let s=this.past(e,i,Do.TP,this.innCont(1));if(Pe(s)){const i=this.innVal(2,bf,e);if(null!==i){const n=s.reduce(((e,t,s)=>e+Math.abs(i-t)),0)/this.period;t=(this.innVal(1,Do.TP,e)-i)/(.015*n)}}}return{[this.target.id]:t}}},EMV:class extends vp{constructor(e,t){super(e,t);const i=by(Do.EMV,(function(e){let t=null;if(e>0){const i=[Do.High,Do.Low,Do.Volume],[s,n,r]=i.map((t=>this.baseVal(t,e))),o=[Do.High,Do.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=Qg(i,this.inputs.Period,Do.EMV,Do.EMVMA);this.addInner(i,s)}getWrappers(){return[this.wrapInner(Do.EMV,1),this.wrapInner(Do.EMVMA,2)]}},ERBRPOW:class extends Ef{constructor(e,t){super(e,!1,t)}},ERBLPOW:class extends Ef{constructor(e,t){super(e,!0,t)}},FI:class extends vp{constructor(e,t){super(e,t);const i=ey(by(_f,(function(e){let t=null;if(e>0){const i=this.baseVal(Do.Close,e),s=this.baseVal(Do.Volume,e);t=(i-this.baseVal(Do.Close,e-1))*s}return{[this.target.id]:t}}),t),this.inputs.Period,_f,Do.FI);this.addInner(i)}getWrappers(){return[this.wrapInner(Do.FI,1)]}},MI:class extends vp{constructor(e,t){super(e,t);const i=ey(by(Mf,me(of,Mf),t),9,Mf,Lf),s=ey(i,9,Lf,Of),n=Ey(wf,((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,wf,this.innCont(1));Pe(i)&&(t=Ae(i))}return{[this.target.id]:t}}},MOM:class extends vp{constructor(e,t){super(e,t);const i=this.inputs.Period,s=by(Do.MOM,ge(Iy,i,Do.Close),t),n=Qg(s,this.inputs.Movement,Do.MOM,Do.MOMMA);this.addInner(s,n)}getWrappers(){return[this.wrapInner(Do.MOM,1),this.wrapInner(Do.MOMMA,2)]}},MFI:class extends vp{constructor(e,t){super(e,t);const i=dy(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,Do.TP,this.innCont(1)),n=this.past(e,i,Do.Volume).map((e=>null!=e?e:0));if(Pe(s)&&Pe(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 vp{constructor(e,t){super(e,t),Ly(this);const i=Qg(t,this.inputs.Period,this.source);this.addInner(i)}calculateAt(e){let t=null;const[i,s]=Oy(this),n=this.innVal(i+1,Do.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(ve(r))}return{[this.target.id]:t}}getWrappers(){const[e]=Oy(this);return[this.wrapInner(Do.MA,e+1)]}},NVI:class extends Df{constructor(e,t){super(e,xf,t)}},PVI:class extends Df{constructor(e,t){super(e,If,t)}},PPO:class extends Fp{constructor(e,t){super(e,Hp,t)}},PVO:class extends Fp{constructor(e,t){super(e,Vp,t)}},HV:class extends vp{constructor(e,t){super(e,t);const i=Math.sqrt(Hy(e.aggregation));if(0===i){const e=by(this.target,((e,t)=>null),t);this.addInner(e)}else{const s=function(e,t){let i=null;const s=this.baseVal(Do.MSD,t);return null!==s&&(i=100*s*e),{[Do.HV.id]:i}},n=gy(by(Nf,me((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{[Nf.id]:i}}),Do.Close),t),e.inputs.Period,Nf,Do.MSD),r=by(Do.HV,me(s,i),n);this.addInner(r)}}getWrappers(){return[this.wrapInner(this.target,1)]}},PERF:class extends vp{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 vp{constructor(e,t){super(e,t)}get helpers(){return[Rf]}ohlcVals(e){return[Do.Open,Do.High,Do.Low,Do.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(Rf)[e-1];Ze(s)||(s=0);const[n,r,o,a]=this.ohlcVals(e),[l,c,u,h]=this.ohlcVals(e-1);if(Pe([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{[Rf.id]:t,[this.target.id]:i}}},WWVOL:class extends vp{constructor(e,t){super(e,t);const i=uy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[Vf,Hf]}calculateAt(e){let t=null,i=null,s=null,n=null,r=this.innVal(1,Do.ATR,e);if(null!==r){const o=this.baseVal(Do.Close,e),a=this.baseVal(Do.Close,e-1),l=this.period;s=Math.max(...this.past(e,l,Do.Close)),n=Math.min(...this.past(e,l,Do.Close));const c=r*this.inputs.Constant;if(null===this.innVal(1,Do.ATR,e-1)){o>a?t=s-c:i=n+c}else{const r=[Do.WWVSARU,Do.WWVSARD,Vf,Hf],[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{[Vf.id]:s,[Hf.id]:n,[Do.WWVSARU.id]:t,[Do.WWVSARD.id]:i}}},PARTP:class extends vp{constructor(e,t){super(e,t)}get helpers(){return[Ff,Bf,kf]}hlcVals(e){return[Do.High,Do.Low,Do.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=[kf,Do.PARSARS,Do.PARSARL,Ff,Bf],[d,m,g,y,T]=c.map((t=>this.me(t,e-1))),S=1===d,A=S?g:m,v=T*Math.abs(y-A);r=S?A+v>l?-1:1:A-v<a?1:-1;const P=d===r;if(o=P?S?Math.min(A+v,h,this.baseVal(Do.Low,e-2)):Math.max(A-v,u,this.baseVal(Do.High,e-2)):y,s=P?S?Math.max(a,y):Math.min(l,y):1===r?a:l,n=T,P){(S?s>y:s<y)&&T<f&&(n=T+p)}else n=p;1===r?t=o:i=o}}return{[Ff.id]:s,[Bf.id]:n,[kf.id]:r,[Do.PARSARS.id]:i,[Do.PARSARL.id]:t}}},MOVLR:class extends vp{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(Pe(s)){const e=Ae(s),n=(i*Ae(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 vp{haveEnoughData=!1;firstUsefulIndex=0;constructor(e,t){super(e,t),this.s3=this.itr=[];const i=["VelocityUpTrend","VelocitySideTrend","VelocityDownTrend"].map((t=>e.inputs[t]||"3")).map(Number);Wf.splice(6,3,...i)}get helpers(){return[Uf]}prepareComputation(){const e=this.base.getData(Do.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=$f(s),this.itr=$f(s),this.haveEnoughData&&Kf(e,this.s3,s)}us(e,t){return this.container.getData(e)[t]}recalculateAt(e,t,i){const s=this.base.getData(Do.Close),n=s.length;this.haveEnoughData&&Kf(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(Do.Close,e)){let r=n(Do.TRSP1),o=n(Do.TRSP2);s=n(Uf),null===r&&null===o&&(r=o=this.baseVal(Do.Close,this.firstUsefulIndex)),null===s&&(s=1);const a=this.base.getData(Do.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=Yf(a,this.s3,this.itr,e,Wf),c=zf(a,this.s3,this.itr,e,Wf);[r,o]=jf(a,this.s3,this.itr,e,Wf,r,o,s,l,c),this.itr[e]>=0&&(t=r),this.itr[e]<=0&&(i=o)}return{[Uf.id]:s,[Do.TRSP1.id]:t,[Do.TRSP2.id]:i}}},COTLC:em,COTDAG:class extends Xf{constructor(e,t){super(e,2,t)}},COTFTR:class extends Xf{constructor(e,t){super(e,3,t)}},IMPVOL:class extends vp{constructor(e,t){super(e,Sp(t,(e=>new sm(e)))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(Do.IMPVOL,0)]}},CTM:class extends Fp{constructor(e,t){e.inputs={Period1:5,Period2:21,Period3:34},super(e,Np,t)}},CPMI:class extends Fp{constructor(e,t){e.inputs={Period1:3,Period2:5,Period3:8},super(e,Rp,t)}},DEMA:class extends vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.Period,this.source),s=ey(i,this.inputs.Period,i.target),n=Ey(Do.DEMA,((e,t,i)=>2*t-i),i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(Do.DEMA,1)]}},TEMA:class extends vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.Period,this.source),s=ey(i,this.inputs.Period,i.target),n=ey(s,this.inputs.Period,s.target),r=Ey(Do.TEMA,((e,t,i,s)=>3*(t-i)+s),i,s,n);this.addInner(r)}getWrappers(){return[this.wrapInner(Do.TEMA,1)]}},TSI:class extends vp{constructor(e,t){super(e,t);const i=(e,t,i,s,n,r)=>{const o=ey(e,t,i,s);return ey(o,n,s,r)},s=by(lm,me(((e,t)=>({[e.id]:Math.abs(this.baseVal(Do.Change,t))})),lm),t),n=i(t,e.inputs.Period1,Do.Change,cm,e.inputs.Period2,um),r=i(s,e.inputs.Period1,lm,hm,e.inputs.Period2,dm),o=Ey(Do.TSI,((e,t,i)=>100*t/i),n,r),a=ey(o,e.inputs.Period3,Do.TSI,Do.TSISIG);this.addInner(o,a)}getWrappers(){return[this.wrapInner(Do.TSI,1),this.wrapInner(Do.TSISIG,2)]}},ADJATR:class extends vp{constructor(e,t){super(e,t);const i=by(jp,me(((e,t)=>{let i=0;return t>0&&(i=this.baseVal(e,t)-this.baseVal(e,t-1)),{[jp.id]:Math.abs(i)}}),this.source),t),s=Dy(e,"MA")(i,this.inputs.Period,jp,Kp),n=Ey(Do.ADJATR,((e,t)=>2*t),s);this.addInner(n)}getWrappers(){return[this.wrapInner(Do.ADJATR,1)]}},COTR:class extends vp{constructor(e,t){super(e,t);const i=by(qp,(e=>{let t=0;return e>0&&(t=this.baseVal(Do.Close,e)-this.baseVal(Do.Close,e-1)),{[qp.id]:t}}),t),s=Ry(e)(t,this.inputs.Period,this.inputs.Smoothing),n=Ey(this.target,((e,t,i)=>Ze(t)&&Ze(i)?t/i:null),i,s);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCGD:class extends vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.Period,Do.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,Do.EMA,e);if(Xe(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 vp{constructor(e,t){super(e,t);const i=this.inputs.Period,s=Math.floor(i/2),n=this.allowEmptyValues,r=iy(t,s,this.source,Do.WMA,n),o=iy(t,i,this.source,Do.WMA,n),a=iy(Ey(pm,((e,t,i)=>2*t-i),r,o),Math.floor(Math.sqrt(i)),pm,this.target,n);this.addInner(a)}getWrappers(){return[this.wrapInner(this.target,1)]}},COPP:class extends vp{constructor(e,t){super(e,t);const i=py(t,this.inputs.PeriodRocLong),s=py(t,this.inputs.PeriodRocShort),n=iy(Ey(fm,((e,t,i)=>t+i),i,s),this.inputs.PeriodWma,fm,this.target);this.addInner(n)}getWrappers(){return[this.wrapInner(this.target,1)]}},REATRHI:class extends Tm{constructor(e,t){super(e,!0,t)}},REATRLO:class extends Tm{constructor(e,t){super(e,!1,t)}},LINRCHN:class extends vp{constructor(e,t){super(e,t);const i=this.inputs.Period,s=by(Do.LINRMID,me((function(e,t){let i=null;if(t>=this.base.size-e){const s=e*(e+1)/2,n=s*s,r=e*(e+1)*(2*e+1)/6;let o=0,a=0,l=1;for(let t=e-1;t>=0;--t){const e=this.baseVal(Do.Close,this.base.size-1-t);o+=e,a+=l*e,l+=1}const c=(e*a-s*o)/(e*r-n);i=o/e-c*s/e+c*(t-this.base.size+e+1)}return{[Do.LINRMID.id]:i}}),i),t),n=by(this.source,(function(e){return{[this.target.id]:this.baseVal(this.target,e)}}),t),r=gy(Ey(Sm,((e,t,i)=>t-i),n,s),i,Sm);this.addInner(s,r)}calculateAt(e){const t=this.innVal(1,Do.LINRMID,e),i=Oe(this.innCont(2).getData(Do.MSD));let s=null,n=null;if(Ze(t,i)){const e=this.inputs.Width;s=t+e*i,n=t-e*i}return{[Do.LINRUP.id]:s,[Do.LINRLOW.id]:n}}getWrappers(){return[this.wrapInner(Do.LINRMID,1)]}},CSHO:class extends vp{constructor(e,t){super(e,t,Sp(t,(e=>{const t=rt(e);t.symbol=Jt(e.symbol);return Ze(t.symbol)?new Eh(t):new _h(t,!0)}))),this.computedServerSide=!0,this.initialNotification=!0,this.computeDone=!1}alignCashTimelineWithUnderlying(){const e=this.innCont(0);if(!Ze(e)||0===e.size)return;const t=this.innCont(1),i=e.getTimeData(),s=t.getTimeData(),n=t.getData(Do.Close),r=Array(i.length).fill(null);if(!(this.innerSeries[1]instanceof _h)){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(No.TS_MANYCHANGED,-1))}},CSHB:class extends vp{constructor(e,t){super(e,t,Ty(t))}shouldTriggerOurRecalc(e){return!!super.shouldTriggerOurRecalc(e)||e===this.innerSeries[1]&&this.innHasData(0)&&this.innHasData(1)}calculateAt(e){const t=(t,i)=>Ze(this.innCont(t))?this.innVal(t,i,e):null,i=t(0,Do.Close),s=t(1,Do.CSHO);return{[this.target.id]:Ze(s)&&Ze(i)?s-i:null}}},CTPI:class extends zp{constructor(e,t){e.inputs={Period1:5,Period2:3,Period3:3},super(e,!0,Do.CTPI,t)}},PCTCHG:class extends vp{constructor(e,t){super(e,t),Ly(this)}calculateAt(e){let t=null;const[i]=Oy(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 _p{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(Do.TradeSize,Do.Change)}},STOMOMIX:class extends vp{constructor(e,t){super(e,t);const i=ry(t,e.inputs.Period1,Do.High,Do.HH,!0),s=ry(t,e.inputs.Period1,Do.Low,Do.LL,!1),n=ey(Ey(vm,((e,t,i)=>this.baseVal(Do.Close,e)-(t+i)/2),i,s),e.inputs.Period2,vm,Pm),r=ey(n,e.inputs.Period2,Pm,Cm),o=ey(Ey(bm,((e,t,i)=>t-i),i,s),e.inputs.Period2,bm,Em),a=ey(o,e.inputs.Period2,Em,_m),l=Ey(Do.STOMOMIX,((e,t,i)=>100*t/i),r,a);this.addInner(l)}getWrappers(){return[this.wrapInner(this.target,1)]}},CHDMOMOSC:class extends vp{constructor(e,t){super(e,t);const i=by(Mm,(function(e){const t=Do.Close,i=e>0?this.baseVal(t,e)-this.baseVal(t,e-1):0;return{[Mm.id]:i}}),t),s=Ey(Lm,((e,t)=>t>=0?t:0),i),n=Ey(Om,((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,Lm,this.innCont(1)),n=this.past(e,i,Om,this.innCont(2));if(Pe(s)&&Pe(n)){const e=Ae(s),i=Ae(n);t=this.perc(e-i,e+i)}}return{[this.target.id]:t}}},VSTOP:class extends vp{constructor(e,t){super(e,t);const i=uy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[wm,Im,xm]}calculateAt(e){let t=null,i=null,s=null,n=null,r=null,o=null,a=1;const l=this.baseVal(Do.Close,e),c=e=>((e,t)=>Ze(e)?e:t)(e,0),u=(e,t)=>this.container.getData(e)[t];e>0&&(s=Math.max(c(u(wm,e-1)),l),r=Math.min(c(u(Im,e-1)),l),a=u(xm,e-1));const h=this.inputs.Multiplier,d=this.innVal(1,Do.ATR,e);if(Ze(d)){const c=1===a,p=c?s-h*d:r+h*d;let f=u(c?Do.VSTOPUP:Do.VSTOPLOW,e-1);Ze(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{[Do.VSTOPUP.id]:1===o?t:null,[Do.VSTOPLOW.id]:1===o?null:t,[wm.id]:i,[Im.id]:n,[xm.id]:o}}},SUPTR:class extends vp{constructor(e,t){super(e,t);const i=uy(t,e.inputs.Period);this.addInner(i)}get helpers(){return[Dm,Nm,Rm,Do.BARCOLIX]}calculateAt(e){let t=0,i=0,s=0,n=null,r=0;const o=this.innVal(1,Do.ATR,e);if(Ze(o)){const a=(e,t)=>Ze(e)?e:t,l=[Do.Close,Do.High,Do.Low],[c,u,h]=l.map((t=>this.baseVal(t,e))),d=(u+h)/2,p=this.baseVal(Do.Close,e-1),f=this.inputs.Multiplier,m=d-f*o,g=d+f*o,y=[Dm,Nm,Rm],[T,S,A]=y.map((t=>this.container.getData(t)[e-1]));t=p>T?Math.max(m,T):m,i=p<S?Math.min(g,S):g,s=c>S?1:c<T?-1:a(A,1);const v=1===s;n=v?t:i,r=v?1:0}return{[Dm.id]:t,[Nm.id]:i,[Rm.id]:s,[Do.SUPTR.id]:n,[Do.BARCOLIX.id]:r}}},ICHCLD:class extends vp{constructor(e,t){super(e,t);const i=(e,t,i)=>Ey(i,((e,t,i)=>(t+i)/2),e,t),s=(e,s)=>i((e=>ry(t,e,Do.Low,Do.LL,!1))(e),(e=>ry(t,e,Do.High,Do.HH,!0))(e),s),n=s(e.inputs.PeriodConversionLine,Do.CONVLN),r=s(e.inputs.PeriodBaseLine,Do.BASELN),o=i(n,r,Do.LEADSP1),a=s(e.inputs.PeriodLaggingSpan2,Do.LEADSP2);this.addInner(n,r,o,a)}get helpers(){return[Do.BARCOLIX]}calculateAt(e){const t=this.innVal(3,Do.LEADSP1,e)>this.innVal(4,Do.LEADSP2,e)?1:0;return{[Do.LAGGSP.id]:this.baseVal(Do.Close,e),[Do.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(Do.CONVLN,1),this.wrapInner(Do.BASELN,2),this.wrapInner(Do.LEADSP1,3),this.wrapInner(Do.LEADSP2,4)]}},VWAP:class extends Bm{constructor(e,t){super(e,t)}get helpers(){return[Hm,Vm,Fm]}isSame(e,t){switch(this.inputs.AnchorPeriod){case"Session":default:return gr(e,t);case"Week":return Cr(e,t);case"Month":return yr(e,t);case"Quarter":return Sr(e,t);case"Year":return br(e,t);case"Decade":return Nu(e,t);case"Century":return Ru(e,t)}}findPrevPeriodChange(e){for(let t=e;t>0;t--)if(1===this.valueAt(Fm,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):Ci.ZERO_DATE,l=this.dateAt(e),c=o&&this.isSame(a,l),u=c?this.valueAt(Hm,e-1):0,h=c?this.valueAt(Vm,e-1):0,d=this.innVal(0,Do.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(Do.VWAP).slice(o,e);a.push(t);const l=ve(a),c=a.map((e=>(e-l)*(e-l))),u=Math.sqrt(ve(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{[Hm.id]:p,[Vm.id]:f,[Fm.id]:c?0:1,[Do.VWAP.id]:t,[Do.VWAPSD1U.id]:i,[Do.VWAPSD1L.id]:s,[Do.VWAPSD2U.id]:n,[Do.VWAPSD2L.id]:r}}},MACROSS:class extends vp{constructor(e,t){super(e,t);const i=Dy(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,Do.MAS),n=i(t,e.inputs.Period2,this.source,Do.MAL);this.addInner(s,n)}get helpers(){return Um}calculateAt(e){const t=this.innVal(1,Do.MAS,e),i=this.innVal(2,Do.MAL,e);return Wm(this.container,e,t,i)}getWrappers(){return[this.wrapInner(Do.MAS,1),this.wrapInner(Do.MAL,2)]}},PACROSS:class extends vp{constructor(e,t){super(e,t),Ly(this);const i=Dy(e,"MA","Average")(t,e.inputs.Period,this.source);this.addInner(i);const[s]=Oy(this);this._maIndex=s+1,this._maTarget=i.target}get helpers(){return Um}calculateAt(e){const t=this.innVal(this._maIndex,this._maTarget,e),[,i]=Oy(this),s=i.getData(this.source)[e],n=Wm(this.container,e,s,t);return n[this.target.id]=t,n}},VOIN:class extends vp{constructor(e,t){super(e,t);const i=by($m,(function(e){return{[$m.id]:e>0?Math.abs(this.baseVal(Do.High,e)-this.baseVal(Do.Low,e-1)):null}}),t),s=by(Gm,(function(e){return{[Gm.id]:e>0?Math.abs(this.baseVal(Do.Low,e)-this.baseVal(Do.High,e-1)):null}}),t),n=cy(t,Do.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,$m,this.innCont(1)),r=this.past(e,s,Gm,this.innCont(2)),o=this.past(e,s,Do.TR,this.innCont(3));if(Pe(n)&&Pe(r)&&Pe(o)){const e=Ae(n),s=Ae(r),a=Ae(o);t=e/a,i=s/a}}return{[Do.PLVI.id]:t,[Do.MNVI.id]:i}}},DIFA:class extends vp{constructor(e,t){super(e,t);const i=Dy(e,"MA","Average")(t,this.period,this.source,jm);this.isPercent="Percentage"===e.inputs.Distance,this.addInner(i)}get helpers(){return[Do.BARCOLIX]}calculateAt(e){let t=null,i=null;const s=this.innVal(1,jm,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,[Do.BARCOLIX.id]:i}}},DOSC:class extends vp{constructor(e,t){super(e,t);const i=ey(fy(t,this.inputs.PeriodRsi,this.source,Do.RSI),this.inputs.PeriodEma1,Do.RSI,Do.EMA),s=ey(i,this.inputs.PeriodEma2,Do.EMA,Do.EMA),n=Qg(s,this.inputs.PeriodMa,Do.EMA,Do.MA);const r=Ey(Do.DOSCH,((e,t,i)=>t-i),s,n),o=Qg(r,this.inputs.PeriodSig,Do.DOSCH,Do.DOSCS);this.addInner(r,o)}getWrappers(){return[this.wrapInner(Do.DOSCH,1),this.wrapInner(Do.DOSCS,2)]}},BSQUEEZE:class extends Yp{constructor(e,t){super(e,"Squeeze",t)}},MARIB:class extends vp{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 e=0;e<n;++e){const n=Qg(t,i+e*s,this.source,this.outFields[e]);this.addInner(n)}}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 vp{constructor(e,t){super(e,t);const i=Dy(e,"EMA","Smoothing1"),s=e.inputs.Period1,n=i(t,s,Do.Open),r=i(t,s,Do.High),o=i(t,s,Do.Low),a=i(t,s,Do.Close),l=Ey(Zm,((e,t,i,s,n)=>(t+i+s+n)/4),n,r,o,a);const c=Ey(Km,(function(e,t,i,s){let n=null;if(e>0){const s=this.container.getData(Km)[e-1],r=this.innVal(2,Zm,e-1);Ze(s,r)?n=(s+r)/2:Ze(t,i)&&(n=(t+i)/2)}return n}),n,a,l),u=Ey(qm,((e,t,i,s)=>Ze(t,i,s)?Math.max(t,Math.max(i,s)):null),r,c,l),h=Ey(Xm,((e,t,i,s)=>Ze(t,i,s)?Math.min(t,Math.min(i,s)):null),o,c,l),d=Dy(e,"EMA","Smoothing2"),p=e.inputs.Period2,f=d(c,p,Km,Do.Open),m=d(u,p,qm,Do.High),g=d(h,p,Xm,Do.Low),y=d(l,p,Zm,Do.Close),T=by(Do.Change,(function(e){let t=null;if(e>0){const i=this.baseVal(Do.Close,e),s=this.baseVal(Do.Close,e-1);Ze(i,s)?t=i-s:Ze(i)&&!Ze(s)&&(t=0)}return{[Do.Change.id]:t}}),y);this.addInner(f,m,g,y,T)}getWrappers(){return[this.wrapInner(Do.Open,1),this.wrapInner(Do.High,2),this.wrapInner(Do.Low,3),this.wrapInner(Do.Close,4),this.wrapInner(Do.Change,5)]}},TTMSQZ:class extends vp{constructor(e,t){super(e,t);const i=e.inputs,s=ey(t,i.PeriodEmaKeltner,Do.Close),n=uy(t,i.PeriodAtrKeltner);function r(e,t,i,s){return Ze(i,s)?i+e*s:null}const o=i.MultiplierKeltner,a=Ey(Do.KCUP,me(r,o),s,n),l=Ey(Do.KCLOW,me(r,-o),s,n),c=Ay(t,i.PeriodBollinger,i.WidthBollinger),u=vy(t,i.PeriodMomentum),h=Qg(t,i.PeriodMomentum,Do.Close);const d=Py(Ey(Jm,(function(e,t,i,s){let n=null;const r=this.innVal(1,Do.DONMID,e);return Ze(r,s)&&(n=t-(r+s)/2),n}),t,u,h),i.PeriodMomentum,Jm,Do.TTMSQZOSC);this.addInner(a,l,c,d)}get helpers(){return[Do.BARCOLIX]}calculateAt(e){let t=null,i=null,s=-1;const n=this.innVal(1,Do.KCUP,e),r=this.innVal(2,Do.KCLOW,e),[o,a]=[Do.BOLLBU,Do.BOLLBL].map((t=>this.innVal(3,t,e)));o<n&&a>r?t=0:i=0;const l=this.innVal(4,Do.TTMSQZOSC,e),c=e>0?this.innVal(4,Do.TTMSQZOSC,e-1):null;if(Ze(l))if(Ze(c)){const e=c<l;s=l>=0?e?3:2:e?1:0}else s=2;return{[Do.TTMSQZON.id]:t,[Do.TTMSQZOFF.id]:i,[Do.BARCOLIX.id]:s}}getWrappers(){return[this.wrapInner(Do.TTMSQZOSC,4)]}},CRS:class extends vp{constructor(e,t){if(super(e,t),Fy(t)){const i=SP().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.inputs.Symbol.toUpperCase();const n=i.getTimeSeries(s),r=e=>e.query?.symbol,o=(e,t)=>`{${r(e)}} / {${r(t)}}`,{model:a}=Xr(o(t,n),!1),l=(e=>{const t=e.unit===C.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:p.Manual,missing:t?h.UseNext:h.UsePrevious,stretch:e=>!1,fieldMap:new Map([[Do.Close,Do.CRS]]),noDataApproach:m.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation),c=new Ym(a,[t,n],l),u=Dy(e,"MA","Average")(c,this.period,Do.CRS,Do.CRSAVG);this.addInner(n,c,u),this.canLoadMoreData=!0,this.initialNotification=!0}else{const e=by(Do.Close,((e,t)=>null),t),i=by(Do.CRS,((e,t)=>null),t),s=by(Do.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(Do.CRS,2),this.wrapInner(Do.CRSAVG,3)]}},JPI:fg,CTTP:class extends fg{constructor(e,t){const i=Rn("JPI");e.inputs=ct(i.defaults.inputs.filter((e=>"HandbrakePeriod"!==e.name))),super(e,t)}},DRS:class extends vp{get indexSymbol(){return this.inputs[Ci.INPUT_SYMBOL]}constructor(e,t){if(super(e,t),Fy(t)){const i=SP().getTimeSeriesDataSource(),s=t.query.duplicate();s.symbol=this.indexSymbol;const n=i.getTimeSeries(s),r=`{${t.query.symbol}} / {${n.query.symbol}} * 100`,{model:o}=Xr(r,!1),a=(e=>{const t=e.unit===C.Month;return{mapper:e=>e.query.symbol,loadMoreData:!1,recompute:p.Manual,missing:t?h.UseNext:h.UsePrevious,stretch:e=>!1,fieldMap:new Map([[Do.Close,Do.DRS]]),noDataApproach:m.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1}})(e.aggregation),l=new Ym(o,[t,n],a);this.addInner(n,l),this.canLoadMoreData=!0,this.initialNotification=!0}else{const e=by(Do.Close,((e,t)=>null),t),i=by(Do.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(Do.DRS,2)]}},MRS:class extends vp{get indexSymbol(){return this.inputs[Ci.INPUT_SYMBOL]}constructor(e,t){super(e,t);const i=yy(t,this.indexSymbol,e.aggregation),s=Qg(i,this.period,Do.DRS);this.addInner(i,s),this.canLoadMoreData=!0,this.initialNotification=!0}calculateAt(e){const t=this.innVal(1,Do.DRS,e),i=this.innVal(2,Do.MA,e);let s=null;return Ze(t,i)&&0!==i&&(s=100*(t/i-1)),{[Do.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 vp{constructor(e,t){super(e,t);const i=py(t,1),s=e.aggregation,n=yg(i,this.inputs.Period1,s,Do.ROC,mg),r=yg(Ey(gg,((e,t)=>10*t),n),this.inputs.Period2,s,gg,Do.PMO),o=ey(r,this.inputs.Period3,Do.PMO,Do.PMOS);this.addInner(r,o)}getWrappers(){return[this.wrapInner(Do.PMO,1),this.wrapInner(Do.PMOS,2)]}},RVOL:class extends vp{constructor(e,t){super(e,t);const i=Dy(e,"MA")(t,this.period,Do.Volume,Tg,!0);this.addInner(i)}calculateAt(e){let t=null;const i=this.innVal(0,Do.Volume,e),s=this.innVal(1,Tg,e);return Ze(i,s)&&0!==s&&(t=i/s),{[this.target.id]:t}}},WGALPH:class extends vp{isFeasible=!0;constructor(e,t){super(e,t),this.isFeasible=!(t instanceof _h||Ag.includes(v[t.query.curveStyle])),this.isDaily=e.aggregation.unit===C.Day}acceptable(e,t,i,s){if(!this.isDaily)return e>0&&i-t>=5;if(0===s)return!0;return!Cr(this.baseVal(Do.DateTime,t),this.baseVal(Do.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*Sg[e]+1,i*=t}t=100*(i-1)}return{[this.target.id]:t}}},VOLAP:class extends vp{constructor(e,t){super(e,t)}getWrappers(){return this.wrapBaseFields(Do.Change,Do.Open,Do.Close)}},AVWAP:class extends Bm{constructor(e,t){super(e,t)}get helpers(){return[Hm,Vm]}isSameOhlcBar(e,t){const{unit:i,size:s}=this.aggregation;switch(i){case C.Tick:return e===t;case C.Intraday:return Ao(t,Jc(e,s));case C.Day:return Ao(t,Kc(e,s));case C.Week:return Cr(e,t);case C.Month:return yr(e,t);case C.Quarter:return Sr(e,t);case C.Year:return br(e,t);default:throw new Error(`Unexpected aggregation unit ${C[i]}`)}}calculateAt(e){let t=null,i=null,s=null;const n=this.inputs.Anchor,r=this.dateAt(e);if(Ao(n,r)||this.isSameOhlcBar(r,n)){const n=e>0,r=n?this.valueAt(Hm,e-1):0,o=n?this.valueAt(Vm,e-1):0,a=this.innVal(0,Do.Volume,e);i=r+this.innVal(1,this.source,e)*a,s=o+a,t=i/s}return{[Hm.id]:i,[Vm.id]:s,[Do.AVWAP.id]:t}}},KST:class extends vp{constructor(e,t){super(e,t);const i=this.source,s=by(i,me(wy,i),t),n=py(s,this.inputs.PeriodRoc1,i),r=py(s,this.inputs.PeriodRoc2,i),o=py(s,this.inputs.PeriodRoc3,i),a=py(s,this.inputs.PeriodRoc4,i),l=Qg(n,this.inputs.PeriodMa1,Do.ROC,Do.MA1),c=Qg(r,this.inputs.PeriodMa2,Do.ROC,Do.MA2),u=Qg(o,this.inputs.PeriodMa3,Do.ROC,Do.MA3),h=Qg(a,this.inputs.PeriodMa4,Do.ROC,Do.MA4),d=Ey(Do.KST,((e,t,i,s,n)=>t+2*i+3*s+4*n),l,c,u,h),p=Qg(d,this.inputs.PeriodSig,Do.KST,Do.KSTSIG);this.addInner(d,p)}getWrappers(){return[this.wrapInner(Do.KST,1),this.wrapInner(Do.KSTSIG,2)]}},STC:class extends vp{constructor(e,t){super(e,t);const i=ey(t,this.inputs.PeriodShort,Do.Close,vg),s=ey(t,this.inputs.PeriodLong,Do.Close,Pg),n=Ey(Cg,((e,t,i)=>t-i),i,s),r=this.inputs.PeriodStoch1,o=this.inputs.PeriodStoch2,a=Dy(e,"EMA"),l=a(oy(n,r,bg,!1,Cg),o,bg,Eg),c=a(oy(l,r,_g,!1,Eg),o,_g,this.target);this.addInner(c)}getWrappers(){return[this.wrapInner(this.target,1)]}},MCCLO:class extends wg{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){const s=(e,t,i)=>t-i,n="Yes"===this.inputs.RatioAdjusted,r=Ey(Og,n?(e,t,i)=>(t-i)/(t+i)*1e3:s,t,i),o=ey(r,this.inputs.Period1,Og,Mg),a=ey(r,this.inputs.Period2,Og,Lg);return Ey(this.target,s,o,a)}},NHLAI:Dg,CMBCI:class extends vp{constructor(e,t){super(e,t);const i=fy(t,this.inputs.Period1Rsi,Do.Close,Ng),s=by(Rg,ge(Iy,this.inputs.Period1Mom,Ng),i),n=Qg(fy(t,this.inputs.Period2Rsi,Do.Close,Hg),this.inputs.Period2Ma,Hg,Vg),r=Ey(Do.CMBCI,((e,t,i)=>t+i),s,n),o=Qg(r,this.inputs.PeriodFastMa,Do.CMBCI,Do.CMBCIF),a=Qg(r,this.inputs.PeriodSlowMa,Do.CMBCI,Do.CMBCIS);this.addInner(r,o,a)}getWrappers(){return[this.wrapInner(Do.CMBCI,1),this.wrapInner(Do.CMBCIF,2),this.wrapInner(Do.CMBCIS,3)]}},COTI:class extends vp{constructor(e,t){super(e,function(e){return new em({source:Do.Close,inputs:{},outFields:Zg("COTLC")},e)}(t));const i=Number.parseInt(this.inputs.History),s=6===i?26:52*i,n=oy(this.innerSeries[0],s,Do.COTI,!1,Do.COTLCCMSP);this.initialNotification=!0,this.computedServerSide=!0,this.addInner(n)}getWrappers(){return[this.wrapInner(Do.COTI,1)]}},CHEXI:class extends vp{constructor(e,t){super(e,t),this.isLong="Long"===this.inputs.Direction;const i=this.period,s=uy(t,i),n=this.inputs.Multiplier,r=Ey(Fg,((e,t)=>null===t?null:n*t),s),o=ry(t,i,Do.High,Do.HH,!0),a=ry(t,i,Do.Low,Do.LL,!1);this.addInner(r,o,a)}calculateAt(e){let t=null,i=null;const s=this.innVal(1,Fg,e);if(null!==s)if(this.isLong){t=this.innVal(2,Do.HH,e)-s}else{i=this.innVal(3,Do.LL,e)+s}return{[Do.CHEXL.id]:t,[Do.CHEXS.id]:i}}},MBBANDS:class extends Yp{constructor(e,t){super(e,"Modified",t)}},OPTIV:class extends Bg{},IVRANK:class extends Bg{},IVPCTL:class extends Bg{},OPTVOLPC:class extends Bg{},OPTOIPC:class extends Bg{},OPTVOL:class extends Bg{},OPTOI:class extends Bg{},CHOP:class extends vp{constructor(e,t){super(e,t);const i=uy(t,1),s=this.inputs.Period,n=ry(t,s,Do.High,Do.HH,!0),r=ry(t,s,Do.Low,Do.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,Do.ATR,this.innCont(1));if(Pe(s)){const n=Ae(s)/(this.innVal(2,Do.HH,e)-this.innVal(3,Do.LL,e));t=100*Math.log10(n)/Math.log10(i)}}return{[this.target.id]:t}}},MACLD:class extends vp{constructor(e,t){super(e,t);const i=Dy(e,"MA","Average"),s=i(t,e.inputs.Period1,this.source,Do.MACLD1),n=i(t,e.inputs.Period2,this.source,Do.MACLD2);this.addInner(s,n)}get helpers(){return[Do.BARCOLIX]}calculateAt(e){const t=this.innVal(1,Do.MACLD1,e)>this.innVal(2,Do.MACLD2,e)?1:0;return{[Do.BARCOLIX.id]:t}}getWrappers(){return[this.wrapInner(Do.MACLD1,1),this.wrapInner(Do.MACLD2,2)]}},BTI:class extends wg{constructor(e,t){super(e,t)}getTargetSeries(e,t,i){const s=Ey(kg,((e,t,i)=>t/(t+i)),t,i);return Dy(e,"MA","Average")(s,this.inputs.Period,kg,this.target)}},PC:class extends vp{constructor(e,t){super(e,t),this.unitsPerYear=Hy(e.aggregation),this.stdDevs=this.toInt("StandardDeviations"),this.periodForecast=this.toInt("PeriodForecast");const i=this.getHistVolPeriod();if(null!==i){const s=Cy(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(Do.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(Do.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{[Do.PCUP1.id]:t,[Do.PCDN1.id]:i,[Do.PCUP2.id]:s,[Do.PCDN2.id]:n,[Do.PCUP3.id]:r,[Do.PCDN3.id]:o}}recalculateAt(e,t,i){const s={tag:yt(),src:this.innerSeries[0]};i&&this.calculate(s)}},GREEKS:class extends vp{constructor(e,t){super(e,Sp(t,(e=>new Ug(e)))),this.computedServerSide=!0,this.initialNotification=!0}getWrappers(){return[this.wrapInner(Do.Delta,0),this.wrapInner(Do.Gamma,0),this.wrapInner(Do.Theta,0),this.wrapInner(Do.Vega,0)]}}};function jg(e){return{[Ci.INPUT_PERIOD]:e}}function Kg(e){return{[Ci.INPUT_SYMBOL]:e}}function qg(e){return{target:e,source:null,inputs:ly}}function Xg(e,t,i){if(st(Yg,e))return new Yg[e](t,i);const s=SP()?.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 Zg(e){return Rn(e).defaults.curves.reduce(((e,t)=>e.concat(t.fields.filter((t=>!e.includes(t))))),[]).map((e=>Do[e]))}function Jg(e,t,i,s){return{source:t,target:i,inputs:jg(e),allowEmptyValues:s}}function Qg(e,t,i,s=Do.MA,n=!1){return Xg("MA",Jg(t,i,s,n),e)}function ey(e,t,i,s=Do.EMA,n=!1){return Xg("MAEXP",Jg(t,i,s,n),e)}function ty(e,t,i,s=Do.SMA,n=!1){return Xg("MASMO",Jg(t,i,s,n),e)}function iy(e,t,i,s=Do.WMA,n=!1){return Xg("MAWEI",Jg(t,i,s,n),e)}function sy(e,t,i,s=Do.HMA,n=!1){return Xg("HMA",Jg(t,i,s,n),e)}function ny(e,t,i,s,n=Do.Close){return Xg("MACDEXP",{source:n,inputs:{Period1:t,Period2:i,Period3:s},outFields:[Do.MACD,Do.MACDS,Do.MACDH]},e)}function ry(e,t,i,s,n,r=!1){return new Wp({source:i,target:s,inputs:jg(t)},n,r,e)}function oy(e,t,i,s,n=null){return new $p({source:n,target:i,inputs:jg(t)},s,e)}function ay(e,t,i=Do.PCTCHG){return Xg("PCTCHG",{source:t,target:i,inputs:ly},e)}const ly={};function cy(e,t=Do.TR){return Xg("_TR",qg(t),e)}function uy(e,t,i="SMA",s=Do.ATR){return Xg("ATR",{target:s,inputs:{[Ci.INPUT_PERIOD]:t,[Ci.INPUT_SMOOTHING]:i},source:null},e)}function hy(e,t=Do.ADL){return Xg("ADL",qg(t),e)}function dy(e,t=Do.TP){return Xg("TP",qg(t),e)}function py(e,t,i=Do.Close,s=Do.ROC){return Xg("ROC",{source:i,target:s,inputs:jg(t)},e)}function fy(e,t,i,s=Do.RSI,n=!1){return Xg("_RSI",{source:i,target:s,inputs:{...jg(t),Modified:n}},e)}function my(e,t=Do.MFMUL){return Xg("MFV",qg(t),e)}function gy(e,t,i,s=Do.MSD){return Xg("MSD",{source:i,target:s,inputs:jg(t)},e)}function yy(e,t,i,s=Do.DRS){return Xg("DRS",{target:s,inputs:Kg(t),aggregation:i,source:null},e)}function Ty(e,t=Do.CSHO){return Xg("CSHO",qg(t),e)}function Sy(e,t,i){const s="TCHN";return Xg(s,{inputs:{PeriodUpper:t,PeriodLower:t,Range:i},outFields:Zg(s),source:null},e)}function Ay(e,t,i,s=Do.Close){const n="BBANDS",r=Zg(n);return Xg(n,{source:s,inputs:{[Ci.INPUT_PERIOD]:t,[Ci.INPUT_WIDTH]:i},outFields:r},e)}function vy(e,t){const i="DONCHN",s=Zg(i);return Xg(i,{inputs:jg(t),outFields:s,source:null},e)}function Py(e,t,i,s=Do.MOVLR){return Xg("MOVLR",{source:i,inputs:jg(t),target:s},e)}function Cy(e,t,i,s=Do.Close,n=Do.HV){return Xg("HV",{source:s,target:n,aggregation:i,inputs:jg(t)},e)}function by(e,t,i){return new af(qg(e),t,i)}function Ey(e,t,...i){return new nf(qg(e),t,...i)}function _y(e,t,i){return t-i}function My(e,t,i){return(t-i)/i*100}function Ly(e){const t=e.source;if(e.sourceNeedsCompute=function(e){switch(e.id){case"HL/2":case"HLC/3":case"OHLC/4":case"HLCC/4":return!0;default:return!1}}(t),e.sourceNeedsCompute){const i=by(t,me(wy,t),e.innerSeries[0]);e.addInner(i)}}function Oy(e){const t=e.sourceNeedsCompute?1:0;return[t,e.innCont(t)]}const wy=function(e,t){const i=[Do.Open,Do.High,Do.Low,Do.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"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}},xy={sma:ty,ma:Qg,ema:ey,wma:iy,hma:sy};function Dy(e,t,i="Smoothing"){const s=(e.inputs[i]??t).toLowerCase();return xy[s]}const Ny={atr:uy,adjatr:function(e,t,i="MA",s=Do.Close,n=Do.ADJATR){return Xg("ADJATR",{source:s,target:n,inputs:{[Ci.INPUT_PERIOD]:t,[Ci.INPUT_SMOOTHING]:i}},e)}};function Ry(e){const t=e.inputs.TypeOfATR.toLowerCase();return Ny[t]}function Hy(e){switch(e.unit){case C.Day:return 252;case C.Week:return 52;case C.Month:return 12;default:return 0}}function Vy(e){const t=[Do.High,Do.Low];return e instanceof Ym&&2!==Le(e.targetFields,t).length}function Fy(e){return!(e instanceof _h)&&e.query instanceof yp}class By extends Pp{constructor(e,t){super(e,t,ey(t,13,Do.Close),ny(t,12,26,9,Do.Close)),this.query=t.query,this.useNotifications=!0}calculateAt(e){let t=y.Same;const i=this.innVal(1,Do.EMA,e),s=this.innVal(1,Do.EMA,e-1),n=this.innVal(2,Do.MACDH,e),r=this.innVal(2,Do.MACDH,e-1);return Ze(i,s,n,r)&&(i>s&&n>r?t=y.Up:i<s&&n<r&&(t=y.Down)),{[Do.BREL.id]:t}}getWrappers(){return this.wrapBaseFields(Do.Open,Do.High,Do.Low,Do.Close,Do.Change,Do.Volume,Do.OpenInterest)}}function ky(e,t){return Ze(t)?(this[e]=t,null):this[e]}class Uy{constructor(){this._domain=this._range=this._extent=null,this._padding=[0,0]}domain(e){return ky.call(this,"_domain",e)}range(e){return ky.call(this,"_range",e)}padding(e){return ky.call(this,"_padding",e)}get ready(){return Ze(this._domain,this._range)}}const Wy=1/Math.log2(10);function $y(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 Gy(e){return Math.sign(e)*Math.log10(1+Math.abs(e/Wy))}function zy(e){return Math.sign(e)*Wy*(-1+Math.pow(10,Math.abs(e)))}const Yy=[[0,1],[1,10],[10,100],[100,1e3],[1e3,1e4],[1e4,1e5]];class jy extends Uy{constructor(e,t){super(),this.scaleType=e,this.axis=t}domain(e){return this.axis&&e&&!Ee(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=Te,s=Te;switch(this.scaleType){case B.Linear:break;case B.Logarithmic:i=Gy,s=zy;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?$y(r,n):$y(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===B.Linear||s<0||n>1e5)return Ky(t,i,e);const r=this.findLogBand(s),o=this.findLogBand(n),a=2*e;return o-r==0?Ky(t,i,a):this.getLogTicks(r,o,a,i<t)}findLogBand(e){return Yy.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]=Yy[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=Ky(c,u,i);r=s?h.concat(r):r.concat(h)}}finally{this.domain(n)}return Fe(r,s?(e,t)=>e>t:(e,t)=>e<t),r}checkTicks(){return this.scaleType===B.Logarithmic}}function Ky(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 qy={color:Ci.COLOR_TRANSPARENT},Xy={color:Ci.COLOR_TRANSPARENT,width:0,dashStyle:"Solid"},Zy=[Do.Open,Do.High,Do.Low,Do.Close],Jy=new Set(Zy.map((e=>e.id))),Qy=new vs(0,0,0,0);class eT{notifyAboutPriceDomains=!1;customPlotValues=!1;_firstVisibleDate=null;_lastVisibleDate=null;main=!1;curves=[];type=U.Symbol;isShutDown=!1;targetFields=[];yScale=null;visible=!0;constructor(){this.axis=null,this.id=yt(),this.record=new Bo(""),this.metaData=new Yi,this.timeSeries=new _h,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&&Ze(this.eventsSeries)&&this.eventsSeries.hasData&&this.eventsSeries.container.size>0}getEventFor(e){return null}get isSymbol(){return this.is(U.Symbol)}get isExpression(){return this.is(U.Expression)}get isStudy(){return this.is(U.Study)}get isForward(){return this.is(U.Forward)}get isSeasonal(){return this.is(U.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 Cp(i(Lu.slice()),e);else if(this.mainCurve.isElderImpulseSystemStyle){const s=Lu.slice().concat(Do.BREL);t=new By(i(s),e)}else this.mainCurve.isPercentChangeStyle&&(t=new Am(i(Lu.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=U[e.type];const t=e;this.main=t.main,t.levels&&(this.levels=t.levels),t.bands&&(this.bands=t.bands),Ze(t.precision)&&(this.precision=t.precision),this.curves=e.curves.map((e=>{const t=new Yd;return t.plot=this,t.fromModel(e),t})),t.detachedScale&&(this.detachedScale=t.detachedScale,this.yScale=new jy(B.Linear,null)),this.visible=t.visible??!0}initialize(){}shutdown(){Ze(this.timeSeries)&&Ze(this.timeSeries.shutdown)&&!this.timeSeries.isCached&&this.timeSeries.shutdown(),this.isShutDown=!0}makeQuery(){const e=this.axis.pane.presenter,t=new yp(null,e.data.aggregation,$.Normal,[ut(nt(e.data,null,"range","from")),ut(nt(e.data,null,"range","to"))]);return t.barsToFetch=e.data.maxDataPoints||Ci.DEFAULT_MAX_RECORDS,t.aggregation.backAdjust&&(t.barsToFetch=4*t.barsToFetch),t.chartId=e.elementId,t.curveStyle=this.curves[0].style,t.visibleRange=nt(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 Ze(this.detachedScale,this.yScale)&&this.detachedScale}getDetachedScaleMargins(){return Ci.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=Ci.OUT_OF_SCREEN;for(const i of this.levels){const s=this.priceToY(i.value);Xs(e,Zs({line:i.line,fill:qy})),Ds(e,{x:-1,y:s},{x:t,y:s})}e.restore()}drawBands(e){e.save();const t=Ci.OUT_OF_SCREEN;for(const i of this.bands){const s=this.priceToY(i.range.to),n=this.priceToY(i.range.from);Xs(e,Zs({fill:i.fill,line:Xy}));Is(e,new vs(-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!==Do.DateTime)):[]}getEventsAt(e){const t=this.eventsSeries.container,i=i=>t.getData(i)[e];return this.getEventFields().map((t=>{const s=i(t);if(!Ze(s))return null;const n=this.getEventFor(t);if(!Ze(n))return null;const r={field:t,value:s,date:i(Do.DateTime),text:n.title,color:n.color};if(t===Do.Custom&&s===Ci.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?Do.High:i.isTick?Do.Last:Do.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(!Ze(n)||!Ze(n[0],n[1]))return;const r=(e,t=Do.DateTime)=>e.container.getData(t),o=r(this.eventsSeries),a=this.getRefPlot(i),l=a.timeSeries,c=r(l),u=i.data.aggregation,h=a===i.mainPlot,d=r(l,this.getRefEventField(a.mainCurve,h,u)),{chart:{fontFamily:p}}=this.axis.pane.presenter.display,f=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=Iu(u,e.date),r=De(c,+n,Number),o=d[r];t.has(r)||t.set(r,-1);let a=t.get(r);t.set(r,++a);const l=s.timeToX(n),h=i.view.getEventRadius(),p=this.axis.yScale.priceToY(o)-a*(h+h+h);return{visible:!0,...e,x:l,y:p,r:h,rect:Qy}}))})).flat();e.save();let m=!0;f.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 vs(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,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){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===Do.Custom?t:null}hitTestCustomEvent(e){return null!==this.getCustomEventDataAt(e)}tryHandleCustomEventClick(e){const t=this.getCustomEventDataAt(e);return!!Ze(t)&&(this.showCustomEventPopup(t),!0)}isEmpty(){const e=this.timeSeries;return Ze(e)&&e.hasData&&e.container.isEmpty}draw(e){if(this.visible){Ze(this.levels)&&this.drawLevels(e),Ze(this.bands)&&this.drawBands(e);for(const t of this.curves)t.draw(e);Ze(this.annotations)&&this.drawAnnotations(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(!Ze(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(!Ze(n)||!ll(n))return e;if(this._firstVisibleDate!==n){this._firstVisibleDate=n;const e=this.timeSeries.container.getTimeData(),t=t=>De(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,Jy.has(t.id));var t}getRefPriceMapField(e){return this.isOhlcMapping(e)||e===Do.PreviousClose?Do.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=V.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(V.Percent)||n===V.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 Ze(t)?t!==V.None:this.isComparison(V.Percent)||this.isComparison(V.Value)}onPriceDomainsUpdated(){}get presenter(){return this.axis?.pane?.presenter}}class tT extends eT{resolved=null;inputs=[];get symbol(){return this._symbol}get title(){return this.symbol}get showPrevious(){return this._showPrevious}getPreviousValue(){if(!Ze(this.timeSeries)||!Ze(this.timeSeries.record))return null;const e=this.axis.pane.presenter.display.chart.previous.field;return this.timeSeries.record.getValue(Do[e])}getTimeSeries(){const e=SP().getTimeSeriesDataSource(),t=this.makeQuery();switch(t.symbol=this.resolved,this.mainCurve.style){case v.Renko:case v.Kagi:case v.PointAndFigure:t.barsToFetch=10100,t.inputs=this.inputs;break;case v.Range:t.barsToFetch=4e3;break;case v.LineBreak:t.inputs=this.inputs}const i=this.axis.pane;if(Ze(i.alignedToYear)){const e=ri(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:se.Unspecified};this.presenter?.notifyHost(No.TS_MANYCHANGED,e),this.getEvents()}}))}getMetaData(){const e=SP().getMetaDataSource();this.metaData=e.getMetaData(this.resolved),this.metaData.ready().then((e=>{e&&this.presenter?.notifyHost(No.MD_CHANGED,{plot:this})}))}getEvents(){if(!this.hasEvents)return;const e=SP().getTimeSeriesDataSource(),t={symbol:this.symbol,seriesKind:$.Events,getHashKey:function(){return Object.values(this).filter((e=>"function"!=typeof e)).join("|")}};Ci.EVENTS.forEach((e=>{t[e]=nt(this.events,!1,e,"show")})),this._eventsSeries=e.getTimeSeries(t),this._eventsSeries.ready().then((e=>{e&&this.presenter?.notifyHost(No.TS_EVENTSCHANGED,{series:this.eventsSeries})}))}get eventsSeries(){return this._eventsSeries??null}get hasEvents(){return!!Ze(this.events)&&Ci.EVENTS.some((e=>nt(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=Mr(this.axis.pane.presenter.data.aggregation),this._symbol=t.symbol}getEventFor(e){const t=this.events[e.id.toLowerCase()];return Ze(t)&&t.show?t:null}async initialize(){return Ai.call(this,(async()=>(this.resolved=await Gt(this.symbol),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0))))}}class iT extends tT{constructor(e){super(),this.seriesKind=e}get showPrevious(){return!1}get title(){return`${this.curves[0].fields[0].name}(${C[this.fundamental].substring(0,1)})`}fromModel(e){this.fundamental=C[e.fundamental],super.fromModel(e)}makeQuery(){let e=new yp(this.symbol,new Dr(this.fundamental),this.seriesKind);return e.fields=this.curves[0].fields,e}}class sT{constructor(){this.longPressTimeout=null}getTouchCrosshairDelayMillis(){const e=SP().config.touchCrosshairDelayMillis;return Ze(e)&&Number.isFinite(e)?e:Ci.LONG_PRESS_DELAY_MILLIS}startLongPress(e,t,i){Ue()&&(this.longPressTimeout=setTimeout((()=>this.longPressTriggered(e,t,i)),this.getTouchCrosshairDelayMillis()))}longPressTriggered(e,t,i){this.cancelLongPress(),this.performLongPress(e,t,i)}cancelLongPress(){Ue()&&Ze(this.longPressTimeout)&&(clearTimeout(this.longPressTimeout),this.longPressTimeout=null)}performLongPress(e,t,i){}}function nT(e){return e.locked||e.axis.pane.presenter.display.allAnnotationsLocked}class rT extends sT{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){JT(this.annotation,i)}onMouseMove(e){if(this.cancelLongPress(),this.annotation.axis.pane.presenter.enableTooltip(!1),nT(this.annotation))return;const{point:t,view:i,offset:s}=e;if(!Xe(t)||t.axis!==this.annotation.axis)return;i.drawCrosshair({ap:t,offset:s}),this.cursorSet||(this.previous.axis.pane.presenter.view.setCursor(j.Move),this.cursorSet=!0);const n=rs(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(),fA(this.annotation,this.moved,he.Moved)}}class oT{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(Z.Shift),this.annotation.axis.pane.presenter.enableTooltip(!1),nT(this.annotation))return;const{point:t,view:i,offset:s}=e;if(i.drawCrosshair({ap:t,offset:s}),Ze(t)){const e=this.annotation.points[this.pointIndex],i=rs(t.point,e.point);switch(e.moveDirection){case Q.Both:e.update(t.price,t.time);break;case Q.Horizontal:e.update(e.price,t.time);break;case Q.Vertical:e.update(t.price,e.time)}this.moved=e.moveDirection!==Q.None,this.moved&&this.annotation.wasPointMovedByTool(e,i)}this.annotation.requestRedraw()}onMouseUp(e){fA(this.annotation,this.moved,he.PointMoved)}}class aT{constructor(e,t,i){this.anchor=e,this.isVertical=t,this.axis=i}hitTest(e){return!!Ze(this.anchor)&&(this.isVertical?Math.abs(e.x-this.anchor.x)<=Ci.HIT_TEST_TOLERANCE:Math.abs(e.y-this.anchor.y)<=Ci.HIT_TEST_TOLERANCE)}draw(e){const t=Ci.OUT_OF_SCREEN;this.isVertical?Ns(e,this.anchor.x,-t,t):Rs(e,this.anchor.y,-t,t)}}class lT{passive=!1;moveDirection=Q.Both;visible=!0;constructor(e,t,i){this.id=yt(),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!==Q.None}get presenter(){return this.pane.presenter}get pane(){return this.axis.pane}toPoint(){const e=this.axis.toPoint(this);Ze(e)&&Qe(e.x)&&Qe(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)<=Ci.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)-Ci.HALF_ANN_POINT_DIMENSION)}draw(e,t){if(Ze(this.point)){let i=Ci.HALF_ANN_POINT_DIMENSION;Ze(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 cT(e){return 0===gs(e.fill.color).a?e.line.color:e.fill.color}function uT(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 hT(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 dT{points=[];isSelected=!1;drawn=!0;alignPointsSupported=!1;visible=!0;locked=!1;computed=!1;constructor(e,t){this.axis=e,this.name=t,this.uid=yt()}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 Ci.EMPTY_ARRAY}getTimeScaleAdornments(){return Ci.EMPTY_ARRAY}extractTraits(e=!0){const t=rt(this.traits),i=vn(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:Je(+e.time,4)})))}offset(e){this.points.filter((e=>e.movable)).forEach((t=>{t.updateFromPoint(os(t.point,e))}))}get traits(){return this._traits||(this._traits=rt(this.defaultTraits)),this.adjustFill&&(this._traits.fill.color=cT(this._traits),this.adjustFill=!1),this._traits}set traits(e){void 0!==e&&dt(this.traits,e)}get activePoints(){return this.points.filter((e=>!e.passive))}get style(){return Zs(this.traits)}get defaultTraits(){return qs(this.axis.pane.presenter.display,this.name)}get defaultStyle(){return Zs(this.defaultTraits)}get adornStyle(){const e=rt(this.defaultTraits);return e.fill.color=this.traits.line.color,e.line.width=0,e.line.color=Ci.COLOR_TRANSPARENT,Zs(e)}get pointsStyle(){const e=rt(this.defaultTraits);return e.line.dashStyle="Solid",Zs(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=Ze(e);!t||!s&&n||i.toPoint(),n&&s&&(this.isSelected||this.drawn)&&(Xs(e,this.pointsStyle),i.draw(e,this))}))}addPoints(e){for(let t=0;t<e;t++)this.points.push(new lT(this.axis))}toModel(){const e=this.extractPoints();return{id:this.name,uid:this.uid,visible:this.visible,locked:this.locked,points:e,traits:rt(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=Ze(e)?rt(e):{};Ze(t)&&dt(r,t),this.traits=r,Ze(i)&&this.updatePoints(i)}priceMap(e){return this.axis.priceMap(e)}flip(e){const t=this.getFlipAnchorIndices();if(!Xe(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 pT(e,t,i,s){return function(n,r=!0){const o=new t(n,e,i);return r?n.appendAnnotation(o):o.drawn=!1,Ze(s)&&(o.traits=s),o}}class fT{constructor(e,t,i,s,n){this.axis=n,Ze(e,t)&&(this.angle=as(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)+Ci.OUT_OF_SCREEN}hitTest(e){return!!Ze(this.p1,this.p2)&&ls([this.p1,this.p2],e,Ci.HIT_TEST_TOLERANCE)}draw(e){Ze(this.p1,this.p2)&&(Ds(e,this.p1,this.p2),this.extended)}getAdornOffset(e){const t=Ls(e),i=_s(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 mT{constructor(e,t,i,s){this.axis=s,this.rect=new vs(e.x,e.y,t,i)}hitTest(e){return this.rect.contains(e)}draw(e,t){Is(e,this.rect)}}class gT extends dT{constructor(e,t){super(e,t)}draw(e,t){if(this.prepareDraw(e,t)&&!this.drawn){const t=this.getElements();Xs(e,this.style),t.forEach(((t,i)=>{Xs(e,this.getStyleForElement(t,i)),t.draw(e)})),Xs(e,this.adornStyle),this.adornElements(t,e);const i=this.getMarkers();Xs(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 it(this.traits?.singleStyle,!0)}get showBackground(){return it(this.traits?.showBackground,!1)}get backgroundOpacity(){return it(this.traits?.backgroundOpacity,0)}fillOnlyStyle(e){return Zs({line:{color:Ci.COLOR_TRANSPARENT,dashStyle:"Solid",width:0},fill:this.traits[e]})}lineOnlyStyle(e){return Zs({fill:{color:Ci.COLOR_TRANSPARENT},line:this.traits[e]})}makeLine(e,t){return new fT(e,t,!1,!1,this.axis)}applyBackgroundOpacity(e){return hs(us(e),this.backgroundOpacity)}getTraitsFor(e){const t={fill:{color:Ci.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 yT extends gT{constructor(e,t){super(e,t)}get factorsPropName(){return Ci.AT_FACTORS}get factors(){return Gs(this._factors??this.traits[this.factorsPropName])}getStyleForElement(e,t){return e.style??super.getStyleForElement(e,t)}get showLevels(){return this.traits[Ci.AT_SHOW_LEVELS]}get levelsKind(){return this.traits[Ci.AT_LEVELS_KIND]}get labels(){return this.traits[Ci.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[Ci.AT_PRICES_ON_SCALE]}formatLevelPrice(e,t){const i=this.levelsKind===Ci.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+` (${yd(this.axis,e)})`).trim()}return s}getAdornPointAndAlign(e,t){const i=this.labels,s=e instanceof fT,n=(e,t,i)=>({pt:e,align:t,offset:i});switch(i){case Ci.AT_LABELS_LEFT:return n(s?e.anchor1:e,z.Right,-t);default:case Ci.AT_LABELS_RIGHT:return n(s?e.anchor2:e,z.Left,t);case Ci.AT_LABELS_CENTER:return n(s?ss(e.anchor1,e.anchor2):e,z.Center,0)}}getColoredElements(e){const t=this.singleStyle;return this.factors.map((i=>{const s=e(i);return null===s?null:(t||(s.style=Zs(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 i of e){if(!Ze(i._data))continue;const{factor:e}=i._data,{ref:n,spacing:l,offsetY:c,text:u}=s(o,i,e),{pt:h,align:d,offset:p}=this.getAdornPointAndAlign(n,l);if(Os(r,u,this.getAdornTextPoint(r,c,h,p),d).contains(t)){a=!0;break}o=i}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(!Ze(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;ws(s,a,f,d,m)}c=e}))}getAdornTextPoint(e,t,i,s){const n=_s(e,.75);return os(i,{x:s,y:!0===t?n/2:t})}}class TT extends gT{constructor(e,t){super(e,t),this.resetComputedState()}get rectStyle(){return this.fillOnlyStyle(Ci.AT_FILL)}get rect(){const[e,t]=this.getScreenPoints(),i={x:e.x,y:Math.min(e.y,t.y)},s=new mT(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=De(l,+i.time,Number,bd),u=De(l,+s.time,Number,bd)-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=Zs(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 ST extends lT{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 AT{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 Ze(this.points[0].point,this.points[1].point)?new vs(this.left,this.top,this.width,this.height):null}}function vT(e){const t=new lT(e),i=new lT(e);return[t,i,new ST(e,t,i),new ST(e,i,t)]}class PT extends dT{constructor(e,t){super(e,t),this.points=vT(e),this.helper=new AT(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)&&(Xs(e,this.style),!0)}updatePoints(e){this.allowPricesChangeUI&&2===e.length&&e.forEach(((e,t)=>this.points[t].update(e.price,e.time)))}}class CT{constructor(e,t,i){this.points=e,this.lines=t,this.axis=i,this._actualWidth=0,this._fontSizeForWidth=0,this.helper=new AT(this.points)}hitTest(e){const t=this.getRect();return!!Xe(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 bT extends gT{constructor(e,t){super(e,t),this.textEditable=!0,this.points=vT(e),this.adjustFill=!0}get textLines(){return this.traits[Ci.AT_TEXT_LINES]}set textLines(e){this.traits[Ci.AT_TEXT_LINES]=e,this._textAnnElement=void 0}get textElement(){return!Ze(this._textAnnElement)&&this.visible&&(this._textAnnElement=new CT(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 ET extends bT{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 lT(this.axis,t,e)))}updateFrom(e,t,i,s,n){super.updateFrom(e,t,i,s,n),Ze(e?.textLines)&&(this.textLines=e.textLines)}getElements(){const e=super.getElements(),t=this.pricesPoints.map((e=>new aT(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 _T{constructor(e){this.annId=e}onKeyDown(e){if(null==this.annId)return;const{key:t,code:i,presenter:s}=e;if($e(t,i)){if(Ze(this.annotation)){this.annotation.axis.deleteAnnotation(this.annotation,!1),s.view.redraw()}pA(s,{toolChange:he.Cancelled,annId:this.annId})}}}class MT extends _T{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){const{point:t,button:i}=e;if(void 0===t)return;const s=Xe(this.annotation);return i===q.Left&&(s&&!this.dragged&&this.thirdPoint?(this.annotation.points[2].update(t.price,t.time),this.signalChange(),this.finish()):s&&this.dragged&&!this.thirdPoint?(this.annotation.points[1].update(t.price,t.time),this.signalChange(),this.finish()):(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())),!0}onMouseMove(e){const{point:t,view:i,offset:s}=e;return i.drawCrosshair({ap:t,offset:s}),Ze(this.annotation,t)&&(this.alignPointsMode=this.forceAlignPoints||e.getModifier(Z.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(){fA(this.annotation,!0,he.Created)}isAccidentalMouseUp(e){const{point:t}=e,i=this.annotation.points[0].point;return ns(t.point,i)<Ci.HIT_TEST_TOLERANCE}onMouseUp(e){void 0!==this.annotation?this.thirdPoint||!this.isAccidentalMouseUp(e)?(this.dragged=!1,this.thirdPoint||this.finish()):this.dragged=!0:gA(e)}}class LT extends MT{constructor(e,t=!1){super(e,t),this.forceAlignPoints=!0}}class OT extends MT{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}),Ze(this.annotation)&&this.dragged){const[e,i]=this.annotation.points;i.update(t.price,t.time);const s=rs(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 wT extends _T{constructor(e,t){super(e?e.annName:null),this.factory=e,this.existing=t,this.clicks=0,this.snapToSupported=!1,this.isNew=!Ze(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:cT(qs(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[Ci.AT_FILL].color}}}onMouseDown(e){const{point:t}=e;if(this.isNew)if(0===this.clicks){if(void 0===t)return void gA(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();pi(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(),fA(t,!0,this.isNew?he.Created:he.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 t=0;t<e.length;t++){const i=r.measureText(e[t]).width;i>s&&(s=i)}return r.restore(),{actualWidth:s,actualHeight:i}}}function IT(e){return SP().config.tooltipMovement===e}function xT(){return IT("Draggable")}function DT(){return IT("Auto")}const NT=Ci.TOOLTIP_STD_LEGACY_CLASS,RT=Ci.TOOLTIP_STD_CLASS,HT=Ci.TOOLTIP_BUBBLE_CLASS;class VT{constructor(e){this.view=e,this.isDrag=!1,this.tooltipElem=yi(e.el,"div"),fi(this.tooltipElem,{id:`${e.presenter.elementId}-global-tooltip`,class:`${RT} ${NT}`}),this.leftSide=!0,pi(this.tooltipElem,{visibility:"hidden",position:"absolute",cursor:xT()?"move":"default",zIndex:20,top:`${Ci.TOOLTIP_Y_OFFSET}px`,left:`${Ci.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===Ci.TOOLTIP_BUBBLE)this.canDrag=!1,this.tooltipElem.style.transition="none",this.tooltipElem.classList.remove(RT,NT),this.tooltipElem.classList.add(HT),pi(this.tooltipElem,{pointerEvents:"none"});else if(e===Ci.TOOLTIP_STD){this.canDrag=xT(),this.tooltipElem.classList.remove(HT),this.tooltipElem.classList.add(RT,NT);const e=Ci.TOOLTIP_TOGGLE_SIDE_ANIM_MS;pi(this.tooltipElem,{pointerEvents:"all",top:`${Ci.TOOLTIP_Y_OFFSET}px`,left:`${Ci.TOOLTIP_X_OFFSET}px`,transition:DT()?`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*Ci.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"),Si(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),hi(this.tooltipElem)}reposition(e,t){pi(this.tooltipElem,{left:`${e}px`,top:`${t}px`})}isAutoMove(){return this.mode===Ci.TOOLTIP_STD&&DT()}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=Ci.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?Ci.TOOLTIP_X_OFFSET:e.width-this.tooltipElem.offsetWidth-Ci.TOOLTIP_X_OFFSET);this.reposition(i,t)}}toggleSide(){this.isToggling||(this.isToggling=!0,setTimeout((()=>this.isToggling=!1),Ci.TOOLTIP_TOGGLE_SIDE_ANIM_MS),this.leftSide=!this.leftSide,this.repositionAuto())}}function FT(e){e.showTooltip&&BT(e,{time:Ci.ZERO_DATE,offset:Ci.OFFSCREEN_OFFSET,price:0,lastBarRefresh:void 0,justMain:void 0})}function BT(e,{time:t,lastBarRefresh:i,justMain:s,offset:n,price:r}){const o=kd(e,t,n,i,s,r),{mode:a,showMainPlot:l,hideSymbols:c,revealingClose:u}=e.display.tooltip,{includeTimestamp:h,showMainPlot:d,showPlotActions:p}=SP().config.tooltipHeaders||{},f=Ze(d)?d:l,m=!!Ze(h)&&h,g=!!Ze(c)&&c,y=!!Ze(u)&&u,T=!!Ze(p)&&p,S=t.valueOf()===Ci.ZERO_DATE.valueOf();switch(a){case Ci.TOOLTIP_CARDS:s||UT(e,o,f,!S,m&&!S,!1,g,y,T,e.hasLegend?e.view?.legend?.getLegendElem().clientHeight:0);break;case Ci.TOOLTIP_BUBBLE:if(!S){const t=o.panes.find((e=>{const{top:t,left:i,width:s,height:r}=e.bounds;return new vs(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">${wd({...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)})}UT(e,o,f,!1,!1,e.hasLegend,g,y,T);break;case Ci.TOOLTIP_STD:if(!S){const t=wd({...o,hideSymbols:g,revealingClose:y,plots:o.panes.map((e=>e.plots)).flat()});e.view.tooltip.show(t)}UT(e,o,f,!1,!1,e.hasLegend,g,y,T);break;case Ci.TOOLTIP_EXTERNAL:e.notifyHost(No.CH_TOOLTIPCHANGED,o);break;default:console.warn(`Unknown tooltip mode requested: ${a}`)}}function kT(e,t,i,s,n,r){pi(e,{position:"absolute",display:"flex","flex-direction":t,"flex-wrap":"wrap",left:`${i+Ci.CARDS_X_OFFSET}px`,top:`${n+Ci.CARDS_Y_OFFSET}px`,maxWidth:r-s-2*Ci.CARDS_X_OFFSET+"px"})}function UT(e,t,i=!1,s=!1,n=!1,r=!1,o=!1,a=!1,l=!1,c=0){const u=e.view.el,h=Id(e,t,i,s,n,o,a,l);h.some((e=>!Ze(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=mi(t,u,"div");kT(n,i&&Md(e)?"column":"row",o,a,l+c,h),gi(n,{"bcharts-card":!0,"bcharts-card-main":i,"bcharts-card-first":0===d}),n.innerHTML=s}let p=di(`#right-${t}`,u);Ze(p)||(p=document.createElement("div"),p.id=`right-${t}`,u.appendChild(p),gi(p,"bcharts-card bcharts-card-move")),pi(p,{position:"absolute",display:"block",right:`${a+Ci.CARDS_X_OFFSET}px`,top:`${l+c+Ci.CARDS_Y_OFFSET}px`}),p.innerHTML=n}))}let WT=null;function $T(){return null===WT&&(WT=SP().config.hostingModel===ce[ce.Application]),WT}class GT extends sT{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();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=$T();if(Ue()&&!h&&this.warmUp)return(a>7||u>7)&&(this.warmUp=!1,this.preventDefault=a>u),!1;if(this.preventDefault||!Ue()||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(j.Grabbing)}return h||this.preventDefault}finished(){pA(this.presenter)}onMouseLeave(){this.finished()}onMouseUp(){this.finished()}onMouseDblClick({presenter:e,offset:t,originalEvent:i}){Ue()&&QT(e,t,i)}performLongPress(e,t,i){e.enableTooltip(!0),e.resetActiveTool(),e.activeTool.startTouchCrosshairMode(e,t,i)}}let zT=null;function YT(e,t){const i=(new DOMParser).parseFromString(e,"image/svg+xml"),s=i.querySelector("svg")?.getAttribute("viewBox"),n=i.querySelector("path")?.getAttribute("d");if(Xe(s)&&Xe(n)){const e=s.split(" ").map(Number);4===e.length&&e.every(Number.isFinite)&&(zT={path:new Path2D(n),width:e[2],height:e[3],rect:new vs(0,0,0,0),logoClickable:t})}}function jT(e,{x:t,y:i,height:s,width:n}){if(!Xe(zT))return;const{path:r,width:o,height:a,rect:l}=zT,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()}class KT extends PT{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)&&(Is(e,this.getRect()),!0)}}function qT(e,t){return e<t?[e,t]:[t,e]}const XT={line:{width:1,color:"rgba(127, 127, 127, 0.3)",dashStyle:"LongDash"},fill:{color:"rgba(127, 127, 127, 0.1)"}};class ZT extends MT{snapToSupported=!1;preventDefault=!1;constructor(){super(pT("Rectangle",KT,null,XT),!1)}activated(){}deactivated(){Ze(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(Ze(this.axis,this.presenter)){pA(this.presenter,{toolChange:he.Executed,annId:"ZoomIn"});const e=this.annotation.points,t=qT(e[0].price,e[1].price),i=qT(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=Ci.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 JT(e,t){const i=hT(e);i.offset={x:t.x,y:t.y},i.canFlip=null!==e.getFlipAnchorIndices();const s=e.axis.pane.presenter;s.clearSelection(),s.notifyHost(No.CH_ANNNEEDSCONTEXTMENU,i)}function QT(e,t,i){const s={offset:{x:t.x,y:t.y},chart:e.accessor,originalEvent:i};e.notifyHost(No.CH_CHTNEEDSCONTEXTMENU,s)}class eS extends _T{constructor(e,t){super(e.annName),this.factory=e,this.maxClicks=t,this.clicks=0,this.snapToSupported=!0,this.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 gA(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),fA(this.annotation,!0,he.Created)):this.annotation.requestRedraw()}applyToPoints(e){this.annotation.points[this.clicks].update(e.price,e.time)}}class tS{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(),fA(i,!0,he.None)}}const iS=Ci.MARKER_ARROW_ANGLE*Math.PI/180/2;function sS(e,t){return nS(e.map((e=>e.point)),t)}function nS(e,t,i=Ci.MARKER_ARROW_LENGTH){return new rS(e,t,i)}class rS{constructor(e,t,i=Ci.MARKER_ARROW_LENGTH){this.vertex=t,this.arrowLen=i,this.p1=e[0],this.p2=e[1]}hitTest(e){const{anchor:t,p1:i,p2:s}=this.getArrowPoints();return ls([t,i],e,Ci.HIT_TEST_TOLERANCE)||ls([t,s],e,Ci.HIT_TEST_TOLERANCE)}draw(e){const{anchor:t,p1:i,p2:s}=this.getArrowPoints();Ds(e,t,i),Ds(e,t,s)}getArrowPoints(){const e=as(this.p1,this.p2),t="start"===this.vertex?0:Math.PI,i=e-iS+t,s=e+iS+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 oS{hitTest(){return!1}draw(){}}class aS extends gT{constructor(e,t){super(e,t),this.addPoints(2),this.alignPointsSupported=!0}get extend1(){return this.traits[Ci.AT_EXTEND_PT_1]}get extend2(){return this.traits[Ci.AT_EXTEND_PT_2]}get showPercentDiff(){return this.traits[Ci.AT_SHOW_PERCENTDIFF]}get showBarCount(){return this.traits[Ci.AT_SHOW_BARCOUNT]}get showRatio(){return this.traits[Ci.AT_RATIO]}getElements(){const e=this.points[0].point,t=this.points[1].point,i=new fT(e,t,this.extend1,this.extend2,this.axis),s=[];return this.extend1&&s.push(new fT(i.p1,e,!0,!1,this.axis)),s.push(new fT(e,t,!1,!1,this.axis)),this.extend2&&s.push(new fT(t,i.p2,!1,!0,this.axis)),s}formatRatio(e,t){return` (${Je(e/t,3)})`}formatPercDiff(e,t){const i=(t-e)/e*100;return` (${i>0?"+":""}${Je(i,2)}%)`}formatPrice(e){return yd(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=os(ss(i.point,s.point),n);ws(t,this.getBarCount(i.time,s.time).toFixed(0),e,z.Right)}const r=this.showRatio?this.formatRatio(i.price,s.price):"",o=`${this.showPrices?this.formatPrice(i.price):""}${r}`.trim();""!==o&&ws(t,o,os(i.point,n),z.Right);const a=this.showPercentDiff?this.formatPercDiff(i.price,s.price):"",l=`${this.showPrices?this.formatPrice(s.price):""}${a}`.trim();""!==l&&ws(t,l,os(s.point,n),z.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?sS(this.points,e):(console.warn(`There is no marker of ${i} kind`),new oS)))}}class lS extends gT{constructor(e,t){super(e,t),this.addPoints(1)}get showTimestamps(){return this.traits[Ci.AT_SHOW_TIMESTAMPS]}getElements(){return[new aT(this.points[0].point,!0,this.axis)]}getTimeScaleAdornments(){return this.showTimestamps?[{time:this.points[0].time,color:this.traits.line.color}]:super.getTimeScaleAdornments()}}class cS extends gT{constructor(e,t){super(e,t),this.addPoints(1)}getElements(){return[new aT(this.points[0].point,!1,this.axis)]}getPriceScaleAdornments(){return this.showPrices?[{price:this.points[0].price,color:this.traits.line.color}]:super.getPriceScaleAdornments()}}class uS extends gT{constructor(e,t,i){super(e,t),this.addPoints(2),Ze(i)&&Ze(i.points)&&i.points.forEach(((e,t)=>this.points[t].update(e.price,e.time)))}allPoints(){const[e,t]=this.points;return Ze(e,e.point,t,t.point)?[e,this.axis.toAnnotationPoint(ss(e.point,t.point)),t]:Ci.EMPTY_ARRAY}line2(){return this.traits[Ci.AT_LINE_2]}use52WeekPrices(){return this.traits[Ci.AT_USE_52WEEK_PRICES]}getElements(){const e=this.allPoints();return e===Ci.EMPTY_ARRAY?Ci.EMPTY_ARRAY:e.map((e=>new fT({x:-Ci.OUT_OF_SCREEN,y:e.point.y},{x:Ci.OUT_OF_SCREEN,y:e.point.y},!1,!1,this.axis)))}wasPointMovedByTool(e,t){Ze(this.use52WeekPrices())&&(this.traits[Ci.AT_USE_52WEEK_PRICES]=!1)}getStyleForElement(e,t){const i=this.line2();if(1!==t||!Ze(i))return super.getStyleForElement(e,t);const s=rt(this.traits);return s.line=i,Zs(s)}getPriceScaleAdornments(){const e=this.allPoints();if(!this.showPrices||e===Ci.EMPTY_ARRAY)return super.getPriceScaleAdornments();const t=this.traits.line,i=e.map((e=>({price:e.price,color:t.color}))),s=this.line2();return Ze(s)&&(i[1].color=s.color),i}getFlipAnchorIndices(){return null}}class hS extends yT{constructor(e,t,i){super(e,t),this.addPoints(i),this.helper=new lT(e)}get showTrendLine(){return this.traits[Ci.AT_SHOW_TRENDLINE]}get hasAllPoints(){return Ze(...this.points.map((e=>e.point)))}get line2(){return this.traits[Ci.AT_LINE_2]}get extendLeft(){return this.traits[Ci.AT_EXTEND_LEFT]}get extendRight(){return this.traits[Ci.AT_EXTEND_RIGHT]}get reverse(){return this.traits[Ci.AT_REVERSE]}get levelsRespectLogScale(){return this.traits[Ci.AT_LEVELS_RESPECT_LOG_SCALE]}getStyleForElement(e,t){if(e.isTrend){const e=rt(this.traits);return e.line=this.line2,Zs(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 fT(e,t,!i&&r,!i&&o,this.axis);return s.isTrend=i,s},u=this.levelsRespectLogScale&&this.axis.scale===B.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 Ci.AT_LABELS_LEFT:return this.extendLeft?s({x:n.x,y:e.anchor1.y},z.Left,t):super.getAdornPointAndAlign(e,t);default:case Ci.AT_LABELS_RIGHT:return this.extendRight?s({x:n.x+n.width,y:e.anchor2.y},z.Right,-t):super.getAdornPointAndAlign(e,t);case Ci.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||(Cs(i,e.p1),i.lineTo(t.p2.x,e.p1.y),bs(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 dS extends hS{constructor(e,t){super(e,t,2)}}class pS extends hS{constructor(e,t){super(e,t,3)}}const fS=(e,t)=>{const i=new Path2D;return null===e||(Cs(i,e.p1),bs(i,e.p2),bs(i,t.p2)),i};class mS extends yT{constructor(e,t){super(e,t),this.addPoints(2)}get reverse(){return this.traits[Ci.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 fT(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 fT({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,fS,this.getTextRef(),t)}}class gS extends mS{constructor(e,t){super(e,t)}}function yS(e,t,i){const s=ns(e,t);return new SS(e,t,s,0,Math.PI,null,i)}function TS(e,t,i,s,n,r){return new SS(e,null,t,i,s,n,r)}class SS{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,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){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(ns(this.left,e),ns(this.right,e));else{const i=this.hasScale?this.inverseScale(e):e,{x:s,y:n}=rs(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<=Ci.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),xs(e,this.center,this.radius,this.startAngle,this.endAngle,this.isAntiClockwise??!1),e.restore()}}const AS=(e,t)=>{const i=new Path2D,{center:s}=t;if(Cs(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 Cs(n,r),n.arc(r.x,r.y,e.radius,e.endAngle,e.startAngle,!e.isAntiClockwise),i.addPath(n),i};class vS extends yT{constructor(e,t){super(e,t),this.addPoints(2)}getElements(){const[e,t]=this.getScreenPoints();if(!Ze(e,t))return[];const i=ns(e,t),s=rs(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 yS(e,l,this.axis)}));if(this.showTrendLine){const i=new fT(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,AS,this.getTextRef(),t)}}class PS extends vS{constructor(e,t){super(e,t)}getStyleForElement(e,t){if(e.isTrend){let e=rt(this.traits);return e.line=this.line2,Zs(e)}return super.getStyleForElement(e,t)}get showTrendLine(){return this.traits[Ci.AT_SHOW_TRENDLINE]}get line2(){return this.traits[Ci.AT_LINE_2]}}class CS extends yT{constructor(e,t){super(e,t),this.addPoints(2)}get factorsPropName(){return Ci.AT_ANGLES}getElements(){const[e,t]=this.getScreenPoints(),{x:i,y:s}=rs(t,e);return this.getColoredElements((({value:n})=>{const r=(t,i)=>new fT(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,fS,this.getTextRef(),t)}}class bS extends mS{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 fT(e,t,!1,!1,this.axis)].concat(super.getElements())}}class ES extends vS{constructor(e,t){super(e,t),this._factors=[{shown:!0,value:1/3},{shown:!0,value:2/3}]}}class _S extends gT{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 fT(t,{x:t.x+s,y:t.y+n},!1,!0,this.axis)),r.push(new fT(e,{x:e.x+s,y:e.y+n},!1,!0,this.axis)),r.push(new fT(i,{x:i.x+s,y:i.y+n},!1,!0,this.axis)),r.push(new fT(t,i,!1,!1,this.axis)),r}}class MS extends PT{constructor(e,t){super(e,t)}getEllipse(){const e=this.getRect();return null===e?null:new Ps(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 LS extends gT{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[Ci.AT_EXTEND_PT_1]}get extend2(){return this.traits[Ci.AT_EXTEND_PT_2]}getLastPoint(){const[e,t,i]=this.points;var s=ns(e.point,t.point),n=as(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 fT(e.point,t.point,this.extend1,this.extend2,this.axis)),Ze(i?.price)){var n=this.getLastPoint();s.push(new fT(i.point,n,this.extend1,this.extend2,this.axis))}return s}}class OS extends PT{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 Ci.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=De(t,s,Number,bd);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=os(this.points[0].point,{x:0,y:-e/2}),a=os(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),Hs(e,this.kind,i),!0}}class wS extends yT{constructor(e,t){super(e,t),this.addPoints(2),this.helper=new lT(e)}getElements(){const e=this.axis.pane.presenter.timeline,{price:t,time:i}=this.points[0],s=De(e,i,Number,bd),n=De(e,this.points[1].time,Number,bd),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 aT(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 IS{snapToSupported=!0;isDrawingAnnotation=!0;constructor(){}onMouseMove(e){const{point:t,view:i,offset:s}=e;i.drawCrosshair({ap:t,offset:s})}onMouseDown(e){if(Ue()&&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(No.CH_ANNPOINTPICKED,s),pA(i,void 0)}}const xS="Open",DS="Closed";class NS extends gT{constructor(e,t,i){super(e,t),this.isLong=i,this.isHit=!1,this.addPoints(4);const s=(e,t)=>this.points[e].moveDirection=t;s(1,Q.Vertical),s(2,Q.Vertical),s(3,Q.Horizontal),this.twoDecMeta=new zi(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){const n=this.data(Do.DateTime),r=De(n,+e,Number),o=De(n,+t,Number),a={refIndex:-1,highestIndex:-1,lowestIndex:-1,highest:null,lowest:null,data:[]},[l,c,u]=[Do.High,Do.Low,Do.Close].map((e=>this.data(e))),h=e=>e-r;for(let e=r;e<=o;e++)i&&-1===a.refIndex&&Ze(this.entryPrice)&&this.entryPrice>=c[e]&&this.entryPrice<=l[e]&&(a.refIndex=h(e)),(!i||a.refIndex>=0&&h(e)>=a.refIndex)&&((!Ze(a.highest)||l[e]>a.highest)&&(a.highest=l[e]),(!Ze(a.lowest)||c[e]<a.lowest)&&(a.lowest=c[e])),i&&-1!==a.refIndex&&(-1===a.highestIndex&&l[e]>this.upperPrice&&(a.highestIndex=h(e)),-1===a.lowestIndex&&c[e]<this.lowerPrice&&(a.lowestIndex=h(e))),s&&a.data.push({high:l[e],low:c[e],close:u[e],time:n[e]});if(s&&a.data&&a.data.length>0){a.state=Ze(a.highest,a.lowest)&&(this.upperPrice<a.highest||this.lowerPrice>a.lowest)?DS:xS,a.special=-1===a.highestIndex&&-1===a.lowestIndex||a.highestIndex===a.lowestIndex;const e=Oe(a.data);if(a.toPrice=e.close,a.toTime=e.time,a.state===DS)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=Je(t,2)}return a}get dataWindow(){return Ze(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=De(e,+this.points[0].time,Number,bd),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[Ci.AT_ACCOUNT_SIZE]}get risk(){const e=this.traits[Ci.AT_RISK_IS_PERCENT],t=this.traits[Ci.AT_RISK];return Je(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 Ci.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 Je(this.upperPrice-this.entryPrice,2)}get amountMultiplier(){return this.isLong?1:-1}get upperAmount(){return Je(this.accountSize+this.amountMultiplier*this.qty*this.upperDiff,2)}get upperPandL(){return Je(this.amountMultiplier*this.upperDiff*this.pointValue,2)}get isCompact(){return this.traits[Ci.AT_COMPACT]}get upper(){const e=yd(this.axis,this.priceMap(this.upperPrice)),t=`(${Je(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 Je(this.entryPrice-this.lowerPrice,2)}get lowerAmount(){return Je(this.accountSize-this.amountMultiplier*this.qty*this.lowerDiff,2)}get lowerPandL(){return Je(-this.amountMultiplier*this.lowerDiff*this.pointValue,2)}get lower(){const e=yd(this.axis,this.priceMap(this.lowerPrice)),t=`(${Je(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 Je(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(Ci.AT_FILL2)}get upperStyle(){return this.fillOnlyStyle(Ci.AT_FILL)}get textStyle(){return this.fillOnlyStyle(Ci.AT_FILL_TEXT)}get secondaryLineStyle(){return Zs({line:{color:this.traits.line.color,dashStyle:"ShortDash"},fill:{color:Ci.COLOR_TRANSPARENT}})}wasModifiedByTool(){Ze(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 fT(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 mT(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 mT(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 lT(this.axis,this.entryPrice,e.time),i=new lT(this.axis,a.toPrice,a.toTime),s=new fT(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 mT({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=>us(this.traits[e].color);return[{price:this.upperPrice,color:e(Ci.AT_FILL)},{price:this.entryPrice,color:e(Ci.AT_LINE)},{price:this.lowerPrice,color:e(Ci.AT_FILL2)}]}adornElements(e,t){const[i,s,n]=e;if(this.showTextAdornments){const[e,r]=[!0,!1].map((e=>Ms(t,e))),{x:o,y:a,width:l}=s.rect,c={x:o+l/2,y:a+e},u=this.textStyle.fillStyle;ws(t,this.upperText,c,z.Center,u,us(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)};ws(t,this.lowerText,m,z.Center,u,us(this.lowerStyle.fillStyle));const{p1:g,p2:y}=i,{x:T,y:S}=g,{x:A}=y,v=this.state||Ci.NOT_APPLICABLE,P=this.isCompact?`${this.formatDollarValue(this.pAndLValue)}`:`${v} P&L: ${this.formatDollarValue(this.pAndLValue)}, Qty: ${this.qty}`,C=this.isCompact?`${this.riskReward.toFixed(2)}`:`Risk/Reward Ratio: ${this.riskReward.toFixed(2)}`,b=e=>t.measureText(e).width,E=Math.max(b(P),b(C)),_={x:T+(A-T)/2,y:Math.abs(A-T)<1.25*E?S+Math.abs(r)+5:S+e+10},M=us(this.isUpperPerPAndL?this.upperStyle.fillStyle:this.lowerStyle.fillStyle);ws(t,[P,C],_,z.Center,u,M)}}updatePoints(e){super.updatePoints(e),this.wasModifiedByTool()}}var RS=["years","months","weeks","days","hours","minutes","seconds"];function HS(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=vr(),l=null!==(i=null!==(s=null==t?void 0:t.locale)&&void 0!==s?s:a.locale)&&void 0!==i?i:Ql,c=null!==(n=null==t?void 0:t.format)&&void 0!==n?n:RS,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:" ";if(!l.formatDistance)return"";var d=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);return d}function VS(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t),n=i.getTime()-s.getTime();return n<0?-1:n>0?1:n}function FS(e){return FS="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},FS(e)}function BS(e,t){if(Mt(2,arguments),!t||"object"!==FS(t))return new Date(NaN);var i=t.years?_t(t.years):0,s=t.months?_t(t.months):0,n=t.weeks?_t(t.weeks):0,r=t.days?_t(t.days):0,o=t.hours?_t(t.hours):0,a=t.minutes?_t(t.minutes):0,l=t.seconds?_t(t.seconds):0,c=Ot(e),u=s||i?wt(c,s+12*i):c,h=r||n?Kc(u,r+7*n):u,d=a+60*o,p=l+60*d,f=1e3*p,m=new Date(h.getTime()+f);return m}Math.pow(10,8);var kS=36e5;function US(e,t,i){Mt(2,arguments);var s=Xu(e,t)/kS;return Ju(null==i?void 0:i.roundingMethod)(s)}function WS(e,t,i){Mt(2,arguments);var s=Xu(e,t)/6e4;return Ju(null==i?void 0:i.roundingMethod)(s)}function $S(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t),n=i.getFullYear()-s.getFullYear(),r=i.getMonth()-s.getMonth();return 12*n+r}function GS(e){Mt(1,arguments);var t=Ot(e),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t}function zS(e){Mt(1,arguments);var t=Ot(e);return Yc(t).getTime()===GS(t).getTime()}function YS(e,t){Mt(2,arguments);var i,s=Ot(e),n=Ot(t),r=VS(s,n),o=Math.abs($S(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=VS(s,n)===-r;zS(Ot(e))&&1===o&&1===VS(e,n)&&(a=!1),i=r*(o-Number(a))}return 0===i?0:i}function jS(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t);return i.getFullYear()-s.getFullYear()}function KS(e,t){Mt(2,arguments);var i=Ot(e),s=Ot(t),n=VS(i,s),r=Math.abs(jS(i,s));i.setFullYear(1584),s.setFullYear(1584);var o=VS(i,s)===-n,a=n*(r-Number(o));return 0===a?0:a}function qS(e){Mt(1,arguments);var t=Ot(e.start),i=Ot(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(KS(i,t));var n=VS(i,t),r=BS(t,{years:n*s.years});s.months=Math.abs(YS(i,r));var o=BS(r,{months:n*s.months});s.days=Math.abs(zc(i,o));var a=BS(o,{days:n*s.days});s.hours=Math.abs(US(i,a));var l=BS(a,{hours:n*s.hours});s.minutes=Math.abs(WS(i,l));var c=BS(l,{minutes:n*s.minutes});return s.seconds=Math.abs(Qu(i,c)),s}class XS extends TT{display=null;constructor(e,t){super(e,t),this.points=vT(e),this.points[2].visible=!1,this.points[3].visible=!1,this.markers=[new oS]}isPointDrawn(e){return!!super.isPointDrawn(e)&&e.visible}makeLineArrow(e,t,i,s){const n=[ss(e,t),ss(i,s)];return[this.makeLine(n[0],n[1]),nS(n,"end",10)]}get rectColor(){return this.traits[Ci.AT_FILL].color}get textColor(){return this.traits[Ci.AT_FILL_TEXT].color}getMarkers(){return this.markers}formatDateDifference(e,t){if(this.presenter.data.aggregation.isEndOfDay)return`${zc(t,e)}d`;return HS(qS({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){const i=this.points[0].price<this.points[1].price,s=Ms(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){ws(t,this.text,this.getTextCoord(e[0],t),z.Center,this.textColor,us(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(Do.DateTime),r=De(n,+i,Number),o=De(n,+s,Number),a=Ae(this.data(Do.Volume).slice(r,o+1)),l=this.formatter.format(a,Do.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,Do.Close)} (${this.formatter.format(s,Do.PercentChange)})`]}resetComputedState(){this.display=null}getFlipAnchorIndices(){return[0,1]}}class ZS 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 JS 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 QS extends XS{get drawBorder(){return this.traits[Ci.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 eA extends TT{constructor(e,t){super(e,t),this.points=vT(e)}get priceLevels(){return Gs(this.traits[Ci.AT_PRICE_LEVELS])}get timeLevels(){return Gs(this.traits[Ci.AT_TIME_LEVELS])}get showAngles(){return this.traits[Ci.AT_SHOW_ANGLES]}get reverse(){return this.traits[Ci.AT_REVERSE]}get showLeftLabels(){return this.traits[Ci.AT_SHOW_LEFT_LABELS]}get showRightLabels(){return this.traits[Ci.AT_SHOW_RIGHT_LABELS]}get showTopLabels(){return this.traits[Ci.AT_SHOW_TOP_LABELS]}get showBottomLabels(){return this.traits[Ci.AT_SHOW_BOTTOM_LABELS]}getAngles(e,t){const i=this.getScreenPoints(),s=this.lineOnlyStyle(Ci.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=_s(t,1)/2,{x:o,y:a}=Ci.DEFAULT_ADORN_OFFSET,l=(e,i,s,n,r)=>{const o=os(e,i);ws(t,Number(s.toFixed(4)).toString(),o,n,r)},c=(e,i)=>{const s=new Path2D;Es(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,z.Right,d),this.showRightLabels&&l(e.p2,{x:-o,y:r},t,z.Left,d),p&&c(u,e)):(this.showTopLabels&&l(e.p1,{x:0,y:a},t,z.Center,d),this.showBottomLabels&&l(e.p2,{x:0,y:2*-a},t,z.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();Es(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 tA=e=>e.map((e=>({...e,dimensions:e.value.split("x").map(Number)}))),iA=(e,t)=>Math.abs(e-t)<1e-7;class sA extends TT{_parsedFans=null;_parsedArcs=null;constructor(e,t){super(e,t),this.points=vT(e),this._parsedFans=this._parsedArcs=null}get levels(){return Gs(this.traits[Ci.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[Ci.AT_SHOW_RANGES_RATIO]}get arcs(){return Gs(this.traits[Ci.AT_ARCS])}get fans(){return Gs(this.traits[Ci.AT_FANS])}get reverse(){return this.traits[Ci.AT_REVERSE]}get parsedFans(){return null===this._parsedFans&&(this._parsedFans=tA(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=tA(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[Ci.AT_PRICE_BAR_RATIO]}set priceBarRatio(e){this.traits[Ci.AT_PRICE_BAR_RATIO]=e}makeStyledLine(e,t,i){const s=this.makeLine(e,t);return this.singleStyle||(s.style=Zs(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=iA(n,r)?null:{x:1,y:r/n},a=this.getClipPath();return this.computedArcs.map((({computed:n,traits:r})=>{const l=TS(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=Zs(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 Es(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=Oe(s),t=AS(null,e),n=this.applyBackgroundOpacity(this.traits.line.color);i(t,e,n)}else{let e=null;s.forEach((t=>{const s=AS(e,t),n=t.style.fillStyle;i(s,t,n),e=t}))}t.restore()}if(this.showRangesRatio&&null!==this.unit){const e=Oe(this.computedLevels),i=(this.singleStyle?this:e).traits.line.color,[,s,n,r]=this.getReversedScreenPoints(),{x:o,y:a}=Ci.DEFAULT_ADORN_OFFSET,{flipX:l,signX:c,signY:u}=this.getOrientation(),h=os(n,{x:-o*c,y:a*u}),{priceDiff:d,barsDiff:p}=this.getLinesDataAtLevels(null,null),f=l?z.Right:z.Left;ws(t,p.toFixed(0),h,f,i);const m=os(r,{x:2*o*c,y:-a*u}),g=l?z.Left:z.Right;ws(t,this.formatter.format(d,Do.Close),m,g,i);const y=os(s,{x:-o*c,y:-a*u});ws(t,this.priceBarRatio.toFixed(6),y,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,!iA(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]}}class nA extends yT{constructor(e,t){super(e,t),this.addPoints(3)}get extend1(){return this.traits[Ci.AT_EXTEND_PT_1]}get extend2(){return this.traits[Ci.AT_EXTEND_PT_2]}getElements(){const[e,t,i]=this.getScreenPoints(),{x:s,y:n}=rs(i,e),r=i=>{const[s,n]=[e,t].map((e=>os(e,i)));return new fT(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,((e,t)=>{const i=new Path2D;return null===e||(Cs(i,e.p1),bs(i,e.p2),bs(i,t.p2),bs(i,t.p1)),i}),this.getTextRef(),t)}}class rA extends gT{constructor(e,t,i){super(e,t),this.computed=!0,this.bars=[],this.studyPlotId=i,this.invalidate()}setOptions(e){switch(this.numBars=Tt(2,1e3,e.Bars),this.alignLeft="Left"===e.Position,this.totalVolume="Total"===e.Volume,this.screenWidth=Tt(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(S.ChangeBased)}}}invalidate(){this.gotData=!1}getBarWidth(e,t){const i=this.bars[this.maxVolumeIndex];return e/(i[0]+i[1])*t}getElements(){if(this.gotData||this.getData(),!this.gotData||!this.studyPlot.mainCurve.visible)return[];const{x:e,width:t}=this.axis.pane.getBoundsWithoutScales(),i=t*this.screenWidth;return this.bars.map((([s,n],r)=>{if(0===s&&0===n)return null;const o=this.axis.toY(this.min+r*this.zone),a=this.axis.toY(this.min+(r+1)*this.zone),l=Math.abs(o-a),c=(i,s,n=0)=>{const r=this.alignLeft?e+n:e+t-i-n,o=new mT({x:r,y:a},i,l,this.axis);return o.style=s,o};let u=null;if(this.totalVolume){u=[c(this.getBarWidth(s+n,i),this.totalStyle)]}else{const e=this.getBarWidth(s,i),t=this.getBarWidth(n,i);u=[c(t,this.upStyle),c(e,this.downStyle,t)]}if(r===this.maxVolumeIndex){const i=u[u.length-1].rect,s=this.alignLeft?i.x+i.width:e,n=(a+o)/2,r=this.alignLeft?e+t:i.x;u.push(new fT({x:s,y:n},{x:r,y:n},!1,!1,this.axis))}return u})).filter((e=>Ze(e))).flat()}getStyleForElement(e,t){return e.style||super.getStyleForElement(e,t)}get presenter(){return this.axis.pane.presenter}get downStyle(){return this.fillOnlyStyle(Ci.AT_FILL)}get upStyle(){return this.fillOnlyStyle(Ci.AT_FILL2)}get totalStyle(){return this.fillOnlyStyle(Ci.AT_FILL_TEXT)}get lineStyle(){return this.lineOnlyStyle(Ci.AT_LINE)}getData(){if(this.axis.pane.presenter.data.aggregation.isTick)return;const[e,t]=this.presenter.view.xAxis.xScale.domain()||[];ll(e)&&ll(t)&&(this._firstVisibleDate!==e||this._lastVisibleDate!==t?([this._firstVisibleDate,this._lastVisibleDate]=[e,t],this.dataFromVisibleRange()):this.gotData=!0)}getBarIndex(e,t=!1){if(0===this.bars.length)return-1;const i=Math.floor((e-this.min)/this.zone);return t?Math.min(this.numBars-1,i):i}get studyPlot(){return this.presenter.allPlots.find((e=>e.id===this.studyPlotId))}dataFromVisibleRange(){const e=this.presenter.mainPlot.timeSeries.container,t=e?.getTimeData();if(!Ze(t))return;const i=e=>De(t,+e,Number),s=i(this._firstVisibleDate),n=i(this._lastVisibleDate);if(s>=n)return;const[r,o,a,l]=["Open","Close","Change","Volume"].map((t=>{return i=Do[t],e.getData(i).slice(s,n+1);var i}));[this.min,this.max]=Ne(o),this.zone=(this.max-this.min)/this.numBars,this.bars=Re(this.numBars,(e=>[0,0])),o.forEach(((e,t)=>{const i=this.getBarIndex(e,!0),s=l[t];let n=null;n=this.useChange?a[t]>=0:r[t]<=o[t],this.bars[i][n?1:0]+=s}));let c=null;this.maxVolumeIndex=-1,this.bars.map((([e,t])=>e+t)).forEach(((e,t)=>{e>c&&(c=e,this.maxVolumeIndex=t)})),this.gotData=!0}}function oA(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 aA extends gT{periodTarget=0;targetPrice1=0;targetPrice2=0;pricesCount=0;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(Ci.AT_LINE),t=this.lineOnlyStyle(Ci.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 Xe(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 lT(this.axis,this.targetPrice,this.targetDate)],this.pricesCount>1&&this.points.push(new lT(this.axis,this.targetPrice2,this.targetDate)),this.unitsPerYear=Hy(this.presenter.data.aggregation),this.anchorPrice=this.mainCont.getLastDataPoint(Do.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=oA(t(this.targetPrice));if(this.pricesCount>1){const e=oA(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 aT(this.points[0].point,!0,this.axis)),e.push(new aT(this.points[0].point,!1,this.axis)),this.pricesCount>1&&e.push(new aT(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(Ms(t,e)))),s=this.pricesCount>1,n=this.points[0].point,r=s?this.points[1].point:n,o=this.traits.line2.color,a=Ts(o),l=_s(t),c=["Above","Below","Between"],u=(e,t)=>`${Je(100*e,2).toFixed(2)}% Probability ${c[t]}`,h=(e,i)=>ws(t,e,i,z.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 lA=new class{resizingPanes=!1;snapToSupported=!1;touchCrosshairMode=!1;previousTouchTimestamp=null;resizingScale=!1;resizingScaleId=null;lastScaleResizingOffset=null;touchCrosshairTimeout=null;lastResizingOffset=null;prevPinchDistance=null;constructor(){this.stopResizingScale(),this.notifyZoomChanged=Ke(No.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 Ci.EVENT_PIN_HIT;const t=e.presenter.selectedAnnotation;let i;void 0!==t&&(i=t.points.find((t=>t.hitTest(e.point))));let s=Oe(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(Ze(e))this.resetVerticalAxis(e),r=!0;else if(n)this.resetHorizontalAxis(i),r=!0;else if(Ue()){const e=i.selectedAnnotation;null!=e?JT(e,t):QT(i,t)}r&&s.redraw()}onMouseEnter(){this.previousTouchTimestamp=null}computePreviousTouchStartDuration(){if(!Ue())return null;const e=(new Date).getTime(),t=Ze(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?Z.Meta:Z.Control,u=i===q.Right||l&&i===q.Left&&e.getModifier(Z.Control);this.touchCrosshairMode&&Ze(this.touchCrosshairTimeout)&&(clearTimeout(this.touchCrosshairTimeout),this.touchCrosshairTimeout=null);const h=this.computePreviousTouchStartDuration();if(Ze(h)&&h<Ci.DOUBLE_CLICK_DURATION_MILLIS)return this.onMouseDblClick(e),!0;if(!u&&this.isLogoLink(n)&&o.notifyHost(No.CH_LOGOCLICKED,{chart:o.accessor}),Ze(t)&&o.allPlots.some((e=>e.tryHandleCustomEventClick(t.point))))return!0;if(Ze(s))return this.resizingPanes=!0,this.lastResizingOffset=n,this.splitter=s,o.enableTooltip(!1),!0;if(Ze(r)){return et(o.display.chart.zooming)[0]&&this.startAxisScaling(r,n),!0}if(null!=t){if(e.getModifier(c))return o.activeTool=new ZT,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?(null==i?QT(o,n,a):i?.locked&&JT(i,n),!0):!!this.touchCrosshairMode||(o.activeTool=new GT(t),o.activeTool.startPan(n),$T());const r=null!=s;if(u)return JT(i,n),Ue();{if(r&&!s.movable||!r&&!i.canMove(t.point))return!1;const e=r&&-1!==i.points.indexOf(s);return o.activeTool=e?new oT(i,s):new rT(i,t,n),Ue()}}return this.prevZoomingOffset=n,!1}onContextMenu(e){return!0}isLogoLink(e){const t=Xe(zT)&&zT.logoClickable?zT.rect:null;return Ze(t)&&t.contains(e)}onMouseMove(e){const{point:t,splitter:i,priceAxis:s,view:n,presenter:r,offset:o}=e;if(Ze(e.pinchZoom)&&e.pinchZoom&&Ze(e.pinchDistance))return Ze(this.prevPinchDistance)&&(e.delta=this.prevPinchDistance-e.pinchDistance,this.onWheel(e)),this.prevPinchDistance=e.pinchDistance,Ue();if(null!=i||this.resizingPanes)n.setCursor(j.ResizeVertical),this.resizingPanes&&this.resizePanes(n,o);else if(Ze(t)){const[e,i]=this.findHit(t);Ze(i)?t.presenter.view.setCursor(j.Crosshair):Ze(e)?e.isSelected?t.presenter.view.setCursor(j.Move):t.presenter.view.setCursor(j.Hand):t.presenter.view.setCursor(j.Arrow)}else if(Ze(s)){et(r.display.chart.zooming)[0]&&(n.setCursor(j.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(j.ResizeHorizontal)}return!t||this.resizingPanes?(this.hideCrosshairAndTooltips(n),Ue()):(this.isLogoLink(o)&&n.setCursor(j.Hand),this.showCrosshairAndTooltips(n,t,o),Ue())}showCrosshairAndTooltips(e,t,i){if(t.time&&(!Ue()||this.touchCrosshairMode)){e.drawCrosshair({ap:t,offset:i})&&e.presenter.showTooltip&&BT(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&&FT(e.presenter)}onMouseLeave(e){const{view:t,offset:i}=e,s=t.presenter.accessor.getPaneBounds()?.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}));s&&(this.hideCrosshairAndTooltips(t,!0),this.stopResizeZoom(t.presenter)),t.setCursor(j.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),Ue()){const t=function(){const e=SP().config.touchCrosshairTimeoutMillis;return Ze(e)&&Number.isFinite(e)?e:Ci.LONG_PRESS_TIMEOUT_MILLIS}();this.touchCrosshairTimeout=window.setTimeout((()=>{this.hideCrosshairAndTooltips(e.view,!0),this.touchCrosshairMode=!1}),t)}}applyZoom(e,t,i=!0){if(!et(e.display.chart.zooming)[1])return;const s=Math.sign(t)*(Ue()?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!(!(Ue()?"none"!==n:"wheel"===n||"wheel+shift"===n&&i(Z.Shift))||0===s)&&(e.drawCrosshair({ap:void 0}),e.tooltip.hide(),e.presenter.hideCards(),this.applyZoom(t,s),!0)}get useKeyboardShortcuts(){return SP().config.hostingModel!==ce[ce.Application]}onKeyDown(e){const{key:t,code:i,presenter:s}=e;if(Ze(s.selectedAnnotation)&&We(t,i)){const e=s.selectedAnnotation;e.axis.deleteAnnotation(e),s.onAnnotationModifiedByTool(e,he.Deleted)}if(Ze(s.selectedAnnotation)&&($e(t,i)?s.clearSelection():Ge(t,i)&&s.selectedAnnotation instanceof bT&&s.selectedAnnotation.textEditable&&(s.activeTool=new wT(null,s.selectedAnnotation),s.activeTool.startEditing())),ze(t,i)||Ye(t,i)){const e=ze(t,i)?1:-1,n=s.view;n.xAxis.pan(e*n.xAxis.xScale.bar.totalWidth),n.redraw()}const n=window.navigator.platform.toLowerCase().startsWith("mac")?Z.Meta:Z.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(Z.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<Ci.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=Je(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=Ue()?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()}}},cA=e=>mA(eS,OS,1,e),uA=e=>mA(eS,ET,1,e),hA={Default:()=>function(){return lA},Line:()=>mA(MT,aS,!1),DateRange:()=>mA(MT,ZS,!1),PriceRange:()=>mA(MT,JS,!1),DatePriceRange:()=>mA(MT,QS,!1),GannBox:()=>mA(MT,eA,!1),GannSquare:()=>mA(OT,sA),Ray:()=>mA(MT,aS,!1),GannLine:()=>mA(LT,aS,!1),VerticalLine:()=>mA(eS,lS,1),HorizontalLine:()=>mA(eS,cS,1),LongPosition:()=>mA(eS,NS,1,!0),ShortPosition:()=>mA(eS,NS,1,!1),FiftyPercentLine:function(e,t){return Ze(e)?mA(tS,uS,e.axis||t.mainAxis,e):mA(eS,uS,2)},FibonacciRetracement:()=>mA(MT,dS,!1),TrendBasedFibExtension:()=>mA(MT,pS,!0),FibonacciFan:()=>mA(MT,gS,!1),FibonacciArcs:()=>mA(MT,PS,!1),FibonacciChannel:()=>mA(MT,nA,!0),GannFan:()=>mA(MT,CS,!1),SpeedResistanceFan:()=>mA(MT,bS,!1),SpeedResistanceArcs:()=>mA(MT,ES,!1),AndrewsPitchfork:()=>mA(eS,_S,3),Rectangle:()=>mA(MT,KT,!1),Ellipse:()=>mA(MT,MS,!1),TrendChannel:()=>mA(MT,LS,!0),SymbolArrowUp:()=>cA("arrow_up"),SymbolArrowDown:()=>cA("arrow_down"),SymbolArrowRight:()=>cA("arrow_right"),SymbolArrowLeft:()=>cA("arrow_left"),SymbolArrowHorizontal:()=>cA("arrow_horizontal"),SymbolArrowVertical:()=>cA("arrow_vertical"),SymbolArcDown:()=>cA("arc_down"),SymbolArcUp:()=>cA("arc_up"),SymbolThumbsUp:()=>cA("thumbs_up"),SymbolThumbsDown:()=>cA("thumbs_down"),SymbolZero:()=>cA("zero"),SymbolOne:()=>cA("one"),SymbolTwo:()=>cA("two"),SymbolThree:()=>cA("three"),SymbolFour:()=>cA("four"),SymbolFive:()=>cA("five"),SymbolSix:()=>cA("six"),SymbolSeven:()=>cA("seven"),SymbolEight:()=>cA("eight"),SymbolNine:()=>cA("nine"),SymbolQuestion:()=>cA("question"),SymbolFishHook:()=>cA("fish_hook"),SymbolBuy:()=>cA("buy"),SymbolSell:()=>cA("sell"),FibonacciTimeZones:()=>mA(MT,wS,!1),Text:()=>mA(wT,bT,null),PickPoint:()=>function(){return new IS},ZoomIn:()=>function(){return new ZT},ProfitLoss:uA,RewardRisk:uA,VolumeAtPrice:function(e){return mA(eS,rA,2,e)},ProbabilityCones:function(e){return mA(eS,aA,2,e)}};function dA(e,t=!1,i=null,s=null,n=null){let r=hA[e];return r=r(s,n),r(e,t,i)}function pA(e,t={}){e.enableTooltip(!0),e.resetActiveTool();const{axis:i,annotation:s,toolChange:n,annId:r}=t;Ze(i)&&e.onAnnotationsUpdated(i),Ze(s)&&e.onAnnotationModifiedByTool(s,n),[he.Cancelled,he.Executed,he.TextChanged].includes(n)&&e.onAnnotationDone(r,n)}function fA(e,t=!0,i=he.None){e.wasModifiedByTool();const s=e.axis,n={axis:s,annotation:e,toolChange:i};pA(s.pane.presenter,t?n:void 0)}function mA(e,t,i,s){return function(n,r,o){const a=pT(n,t,s,o);return a.annName=n,r?a:new e(a,i)}}function gA(e){e.button===q.Right&&pA(e.presenter)}function yA(e,t,i){const s={};s.source=Do[e.source],s.inputs=ct(e.inputs);const n=void 0!==e.target,r=Ze(i)?i:e.curves,o=n?[Do[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?Do[e.target]:s.outFields[0],s.aggregation=t,s}class TA extends eT{#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 Ze(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(!Ze(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(!Ze(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=Rn(this.model.study),t=e.meta.decimals;this.metaData=void 0!==t?new zi(t):this.basePlot.metaData,Ze(e.meta.range)&&(this.range=e.meta.range)}getDetachedScaleMargins(){const e=this.model?.study;return"VOL"===e&&this.axis?.pane.isMain?Ci.VOLUME_DETACHED_SCALE_MARGINS:super.getDetachedScaleMargins()}applySpecifics(e){const t=this.model.study;!0===Rn(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?V.Percent:V.None;break}case"PERF":{const t="VisibleStart"===e.inputs.Anchor;this.axis.comparison=t?V.Percent:V.None;break}case"JPI":case"CTTP":{const t=Re(10,(e=>.025*(e+1))),i=e=>t.map((t=>ms(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,Ze(this.annotations)||(this.annotations=[]);const t=dA("VolumeAtPrice",!0,{[Ci.AT_LINE]:{color:this.curves[0].colors[3],width:2},[Ci.AT_FILL]:{color:this.curves[0].colors[0]},[Ci.AT_FILL2]:{color:this.curves[0].colors[1]},[Ci.AT_FILL_TEXT]:{color:this.curves[0].colors[2]}},this.id)(this.axis,!1);t.setOptions(e.inputs),this.annIndex=this.annotations.push(t)-1;break}case"IVRANK":{let t=Do.ImplVolRank1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=Do.ImplVolRank5D;break;case"1-Month":t=Do.ImplVolRank1M;break;case"3-Month":t=Do.ImplVolRank3M;break;case"6-Month":t=Do.ImplVolRank6M;break;case"YTD":t=Do.ImplVolRankYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"IVPCTL":{let t=Do.ImplVolPerc1Y;switch(e.inputs.TimeFrame){case"1-Year":default:break;case"5-Day":t=Do.ImplVolPerc5D;break;case"1-Month":t=Do.ImplVolPerc1M;break;case"3-Month":t=Do.ImplVolPerc3M;break;case"6-Month":t=Do.ImplVolPerc6M;break;case"YTD":t=Do.ImplVolPercYTD}this.curves[0].fields[0]=t,e.outFields[0]=t;break}case"OPTIV":{let t=[Do.WeighImplVolHigh,Do.WeighImplVol,Do.WeighImplVolLow];switch(e.inputs.TimeFrame){case"1-Day":default:break;case"5-Day":t=[Do.WeighImplVolHigh5D,Do.WeighImplVol5D,Do.WeighImplVolLow5D];break;case"1-Month":t=[Do.WeighImplVolHigh1M,Do.WeighImplVol1M,Do.WeighImplVolLow1M];break;case"3-Month":t=[Do.WeighImplVolHigh3M,Do.WeighImplVol3M,Do.WeighImplVolLow3M];break;case"6-Month":t=[Do.WeighImplVolHigh6M,Do.WeighImplVol6M,Do.WeighImplVolLow6M];break;case"1-Year":t=[Do.WeighImplVolHigh1Y,Do.WeighImplVol1Y,Do.WeighImplVolLow1Y];break;case"YTD":t=[Do.WeighImplVolHighYTD,Do.WeighImplVolYTD,Do.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)),Ze(this.annotations)||(this.annotations=[]);const i=this.curves[11],s=this.curves[12],n=dA("ProbabilityCones",!0,{[Ci.AT_LINE]:{color:i.colors[0],width:i.lineWidth,dashStyle:i.dashStyle},[Ci.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);const s=this.annotations[this.annIndex],n=s.getBarIndex(i);if(n<0||n>=s.bars.length)return null;const[r,o]=s.bars[n];switch(e){case Do.UPVOL:return o;case Do.DNVOL:return r;case Do.TOTVOL:return r+o;default:throw new Error("Unexpected Volume At Price field")}}getColorOf(e){if(!this.isVolAP)return null;const t=this.curves[0].colors;switch(e){case Do.UPVOL:return t[1];case Do.DNVOL:return t[0];case Do.TOTVOL:return t[2];default:throw new Error("Unexpected Volume At Price field")}}isEmpty(){return!this.isVolAP&&super.isEmpty()}setCurveAttributes(e,t){const i=t=>this.curves[e].attributes=[S[t]];switch(t){case"LikeMain":{const t=this.axis.pane.presenter.mainPlot.curves[0].attributes,s=SP().config.defaultVolumeBarColoring;if(Ze(t))this.curves[e].attributes=[t[0]];else if(Ze(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(Do.Buy)||e.includes(Do.Sell)}getEventFor(e){switch(e){case Do.Buy:return{show:!0,title:"B",color:"#03c03c"};case Do.Sell:return{show:!0,title:"S",color:"#c23b22"};default:return null}}getEventFields(){return this.hasEvents?[Do.Buy,Do.Sell]:[]}async initialize(){if(this.model.basis!==Ci.BASIS_MAIN)throw new Error("Studies can currently only be based on the main (symbol) plot");return Ai.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=yA(this.model,e,this.curves);this.applySpecifics(t);let i=this.basePlot.timeSeries;i instanceof Cp&&(i=i.actual),this.timeSeries=Xg(this.model.study,t,i),this._hasEvents=this.doesSeriesEmitEvents(),this.timeSeries.useNotifications=!0;const s=this.title,n=this.basePlot.timeSeries instanceof _h;return this.timeSeries.ready().then((e=>{e||n||this.timeSeries.computedServerSide||dP(`Unable to calculate study values for ${s}`,"error")})),!0}))}get isJpi(){return"JPI"===this.model.study||"CTTP"===this.model.study}get isVolAP(){return"VOLAP"===this.model.study}onPriceDomainsUpdated(){this.isVolAP&&this.annotations[this.annIndex].invalidate()}shouldPriceMap(e){return this.isJpi?!!this.shouldMaybePriceMap&&(e.id===Do.JPIB.id||e.id===Do.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(Do.JPIB,t),r=s(Do.JPIS,t);if(null===n&&i.id===Do.JPIB.id||null===r&&i.id===Do.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 SA=[Do.Open,Do.High,Do.Low,Do.Close,Do.Volume];class AA extends eT{exprModel=null;symbols=null;get title(){return this.expression}get expression(){return this._expression}async parseExpression(){const e=Xr(this._expression);if(this.exprModel=null,this.symbols=null,qr(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!Ze(this.errorText)}#t(e){return{mapper:e=>e.query.symbol,loadMoreData:!0,recompute:p.Minimum,missing:h.UseNext,stretch:e=>!1,fieldMap:new Map(SA.map((e=>[e,e]))),noDataApproach:m.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:e}}getTimeSeries(){const e=this.getInnerSeries(),t=this.axis?.pane.presenter.data?.exprSkipLeadingEmpty??!1,i=new Ym(this.exprModel,e,this.#t(t));this.timeSeries=this.wrapIfAdvancedStyle(i);const s=this.title;this.timeSeries.ready().then((e=>{e||dP(`Unable to calculate expression: ${s}`,"error")}))}getInnerSeries(){const e=eo(this.exprModel),t=SP().getTimeSeriesDataSource();return e.map((e=>{const i=this.makeQuery();return i.symbol=e,t.getTimeSeries(i)}))}getRecord(){if(Ze(this.errorText))return;const e=this.metaData.inner.map((e=>[e.symbol,e.resolved]));this.record=new jo(e,rt(this.exprModel)),this.record.ready().then((e=>e))}getMetaData(){this.isValid&&(this.metaData=new ji(this.symbols),this.metaData.ready().then((e=>{e&&(this.getRecord(),this.presenter?.notifyHost(No.MD_CHANGED,{plot:this}))})))}fromModel(e){super.fromModel(e),this._expression=e.expression}async initialize(){return Ai.call(this,(async()=>(await this.parseExpression(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0))))}}class vA extends eT{fwdModel=null;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=Xr(this.forward),t=qr(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=` (${ye(qu(this.offset),ou(Ci.FMT_US_DATE_ONLY))(new Date)})`,this.outField=new Oo(`Close_${this.offset}`,O.Number,D.Forward,`Close (${this.offset})`),this.curves[0].fields[0]=this.outField):(this.suffix="",this.outField=Do.Close);const t=e=>Yt(`${e}*1`),{yes:i,no:s}=be(e.symbols,t),n=(await Promise.all(i.map((e=>ni(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!Ze(this.errorText)}getMetaData(){if(this.isValid){const e=Object.values(this.roots).flat();this.metaData=new ji(e),this.metaData.ready().then((e=>{e&&this.presenter?.notifyHost(No.MD_CHANGED,{plot:this})}))}}getForwardPolicy(e){return{mapper:e=>e.query.root,loadMoreData:!1,recompute:p.Everything,missing:h.UseNext,stretch:e=>!1,fieldMap:new Map([[Do.Close,this.outField]]),noDataApproach:m.NoAction,modelTransform:(e,t)=>null,skipLeadingEmpty:!1,valueProvider:e}}getTimeSeries(){const e=SP().getTimeSeriesDataSource(),t=Object.keys(this.roots),i=0===this.offset?$.Forward:$.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 xh(this.symbols):void 0;this.timeSeries=new Ym(this.fwdModel,s,this.getForwardPolicy(n)),this.timeSeries.ready().then((e=>{if(e){const e={series:this.timeSeries,part:se.Unspecified};this.presenter?.notifyHost(No.TS_MANYCHANGED,e)}}))}async initialize(){return Ai.call(this,(async()=>(await this.parseForward(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0))))}}function PA(e){Mt(1,arguments);var t=Ot(e),i=t.getFullYear();return t.setFullYear(i+1,0,0),t.setHours(23,59,59,999),t}const CA=e=>e.substr(0,e.lastIndexOf("::"));class bA extends eT{seaModel=null;isPlain=!1;isFutures=!1;suffix="";get title(){return this.isAverage?"Average":!this.hasComputation&&(this.symbols?.length??0)>0?this.outField.name:`${this.seasonal}${this.suffix}`}get seasonal(){return this._seasonal}fromModel(e){super.fromModel(e);const t=e;this.offset=t.offset,this.offsets=t.offsets,this.useInAverage=t.useInAverage,this.usesInAverage=t.usesInAverage,this.isAverage=!Ze(t.offset),this._seasonal=t.seasonal}constructSeasonal(e,t){return Qr(io(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,t)=>{const n=!!s||i.includes(e),r=this.usesInAverage[t];return n&&r})).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 Oo(`Close_${t}`,O.Number,D.Seasonal,`Close${this.suffix}`),this.curves[0].fields[0]=this.outField}applyOffset(e,t){return`${this.isPlain?e:ai(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=Xr(this.seasonal,!0),t=e=>(this.errorText=e,this.seaModel=null,null);if(qr(e))return t(e.error);let{model:i,symbols:s}=e;this.prepareFields();const n=new Map;for(const e of s){const t=ei(await Gt(e));n.set(e,t)}i=io(i,(e=>n.get(e))),s=Array.from(n.values());const r=s.every((e=>Yt(e)||Kt(e))),o=s.every((e=>Xt(e))),a=s.every((e=>!Yt(e)&&!Xt(e)&&!Kt(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=to(i);const l=this.isAverage?this.constructAverage(i):this.constructSeasonal(i,this.offset),{model:c,symbols:u}=Xr(l,!0);this.seaModel=c,this.hasComputation=to(c),this._seasonal=Qr(io(c,CA)),this.symbols=u,this.outField.name=this.outField.shortName=this.fixupFieldDescription()}get isValid(){return!Ze(this.errorText)}getActualSymbols(){return[...new Set(this.symbols.map(CA))]}fixupFieldDescription(){if(!this.hasComputation&&!this.isAverage){const e=CA(this.symbols[0]);if(this.isPlain)return`${e} ${(new Date).getFullYear()-this.offset}`;if(this.isFutures)return ei(e,!0)}return this.title}getMetaData(){if(this.isValid){const e=this.getActualSymbols(),t=1===e.length&&!this.hasComputation&&!this.isAverage,i=SP().getMetaDataSource();this.metaData=t?i.getMetaData(e[0]):new ji(e),this.metaData.ready().then((e=>{e&&this.presenter?.notifyHost(No.MD_CHANGED,{plot:this})}))}}getNoDataApproach(){return this.isAverage&&!this.coreHasComputation?m.ModelTransformRequired:this.hasComputation?m.NoAction:m.IgnoreTimelineOnly}get seasonalPolicy(){return{mapper:e=>e.query.surrogate||e.query.symbol,loadMoreData:!1,recompute:p.Everything,missing:this.hasComputation||this.useInAverage?h.UsePrevious:h.UseNone,stretch:e=>this.shouldStretch(e),fieldMap:new Map([[Do.Close,this.outField]]),noDataApproach:this.getNoDataApproach(),modelTransform:(e,t)=>{if(0===t.length)return this.seaModel;return Xr(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 It(new Date,-e)}yearFromOffset(e){return Ft(this.shiftYears(e))}getCmdtyRange(e){const t=this.shiftYears(e);return[xt(t),PA(t)]}getTimeSeries(){if(!this.isValid)return;const e=SP().getTimeSeriesDataSource(),t=Object.keys(this.symbolToOffset).map((t=>{const i=this.makeQuery();return i.surrogate=t,i.symbol=CA(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&&Ze(...i.range)&&(i.range=i.range.map((e=>It(e,-i.offset)))),i.offset>0&&(i.disableStreamingUpdates=!0),e.getTimeSeries(i)}));this.timeSeries=new Ym(this.seaModel,t,this.seasonalPolicy),this.timeSeries.ready().then((e=>{if(e){const e={series:this.timeSeries,part:se.Unspecified};this.presenter?.notifyHost(No.TS_MANYCHANGED,e)}}))}async initialize(){return Ai.call(this,(async()=>(await this.parseSeasonal(),!this.isShutDown&&(this.getMetaData(),this.getTimeSeries(),!0))))}}const EA=["bottom","right","left"],_A={bottom:"center",right:"start",left:"end"};class MA{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=Ze(n);if(r=r||this.fontSize+this.padding+this.padding+(o?this.padding:0),!EA.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=_A[this.position],e.strokeStyle=this.strokeColor,e.fillStyle=us(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+_s(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 LA=({y:e,halfHeight:t})=>e+t;function OA(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=LA(n);r<o&&(e.y=o+1+e.halfHeight);LA(e)>t.y+t.height&&(e.y=t.y+t.height-e.halfHeight-1)}}))}const wA=({x:e,halfWidth:t})=>e-t-4,IA=({x:e,halfWidth:t})=>e+t+4,xA=(e,t)=>e-1-t-4,DA=(e,t)=>e+1+t+4;function NA(e,t){const i=e.length-1;e.forEach(((e,s,n)=>{const r=0===s,o=r?null:n[s-1],a=wA(e),l=r?t.x:IA(o);if(e.x-e.halfWidth<t.x&&(e.x=DA(t.x,e.halfWidth)),a<l)e.x=DA(l,e.halfWidth+4);else{const t=IA(e),r=s<i?wA(n[s+1]):Number.MAX_SAFE_INTEGER;if(t>r){const i=xA(e.x,t-r),s=xA(e.x,e.halfWidth-2),n=DA(l,o?.halfWidth??0);e.x=Math.max(s,i,n)}}IA(e)>t.x+t.width&&(e.x=xA(t.x+t.width,e.halfWidth))}))}const RA=Array.from(Array(6),((e,t)=>++t)).reverse();function HA(e){const t=e.plot.timeSeries.container;return null===t||t.size<1?null:e.getColor(t.size-1)}function VA(e){return e.curves.filter((t=>t.visible&&(e.type!==U.Study||t.style!==v.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===U.Study&&("JPI"===e.model.study||"CTTP"===e.model.study);return null!=s||o||(r=_e(n,(e=>null!==e)),s=-1!==r?n[r]:null),[s,r]}(e,i);return{value:s,color:HA(t),field:i,index:n}}))}class FA{constructor(e){this.pane=e,this.annotations=[],this.isCustomDomain=!1,this.primary=!1,this.onTheRight=!0,this.plots=[],this.label="",this.id=yt(),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 MA({fontSize:this.config.fontSize,arrowLength:this.config.innerTickSize})}makePlot(e){let t=null;switch(U[e.type]){case U.Symbol:t=new tT;break;case U.Expression:t=new AA;break;case U.Study:t=new TA;break;case U.IncomeStatement:t=new iT($.IncomeStatement);break;case U.BalanceSheet:t=new iT($.BalanceSheet);break;case U.Forward:t=new vA;break;case U.Seasonal:t=new bA;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!==V.None?this.pane.presenter.mainPlot.priceMap(t,void 0,Do.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 lT(this,t,i||void 0)}toX(e){return this.pane.presenter.view.toX(e)}priceMap(e){return this.comparison!==V.None?this.pane.presenter.mainPlot.priceMap(e,void 0,Do.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!==Q.Both&&e.moveDirection!==Q.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=De(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<=Ci.SNAP_PROXIMITY_PIXELS)).reduce(((e,t)=>null===e||t.dist<e.dist?t:e),null);Ze(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*-as(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(Ze(this.pane.presenter.view))return this.snapTo(e)}makeAnnotation(e,t=!0){const i=dA(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];Qe(s.price)&&Qe(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,n=e.usesInAverage??[],r=s.map(((e,t)=>n[t]??!0));delete e.curves,delete e.offsets,delete e.usesInAverage;const o=s.length;for(let n=0;n<i.length;n++){const a=Object.assign({},e);a.curves=[i[n]],a.offsets=s;const l=a;l.offset=n===o?null:s[n];const c=!Ze(l.offset);l.useInAverage=!c&&(r[n]??!0),l.usesInAverage=r,(!c||o>1)&&t.push(a)}break}default:t.push(e)}return t}fromModel(e){this.comparison=V[e.comparison??"None"],this.scale=B[e.scale??"Linear"],this.yScale=new jy(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:ms(.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:Ci.ANN_DUPLICATE_OFFSET,y:Ci.ANN_DUPLICATE_OFFSET}),t.appendAnnotation(i),i.requestRedraw(),this.fireAnnotationsChanged()}updateAnnotation(e,t){e.isSelected&&this.pane.presenter.clearSelection(),lr(e.name,t.traits),e.updateFrom(t.traits,t.extras,t.isUndoRedo?null:t.points,t.visible,t.locked),t.isUndoRedo&&Ze(t.points)&&e.updateActivePoints(t.points),t.isUndoRedo||this.pane.presenter.undoRedoManager.done(uT(e,he.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 Ze(this._fullDomain)||(this._fullDomain=this.getDataDomain().domain),this._fullDomain}updateFullDomain(e=null){if(null===e&&this.comparison!==V.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(),o=e=>De(r,+e,Number),a=Ze(t),l=a?o(t):0,c=Ze(i),u=c?o(i):r.length-1,h=e.curves.map((e=>e.fields)).flat().filter((e=>e.id!==Do.Change.id)),d=Ze(e.targetFields);d&&h.push(...e.targetFields);const p={},f=t=>{const[i,s]=(t=>{const i=d?e.curves[0]:e.curves.find((e=>e.fields.includes(t)));if(!Ze(i)||0===i.shift)return[l,u];if(!Ze(p[i.id])){const e=i.shiftedTimeDomain;if(!Ze(e))return[l,u];p[i.id]=[o(e[0]),o(e[1])]}return p[i.id]})(t),r=n.getData(t),a=Math.max(i,0),c=Math.min(r.length-1,s);return r.slice(a,c+1).map(((i,s)=>e.priceMapper(i,s,t)))},m=[null,null],g=e=>e.id,y=new Set(Le(n.fields,h,g).map(g));e.curves.filter((e=>e.visible)).map((e=>{const t=e.fields.filter((e=>y.has(e.id)));if(e.isStackedColumn){He(Ne(t.map((e=>f(e))).reduce(((e,t)=>t.map(((t,i)=>(e[i]||0)+(t||0)))),[])),m)}else t.map((e=>{const t=(e=>Ne(f(e)))(e);He(t,m)}))}));let T=pe.None;const S=[v.Column,v.MultiColumn,v.StackedColumn];if(a&&c&&!e.main&&e.curves.some((e=>S.includes(e.style)))){const e=m[0]>0,t=m[1]<0;e?(T=pe.Min,m[0]=0):t&&(T=pe.Max,m[1]=0)}return{domain:m,clamped:T}}getDataDomain([e,t]=[null,null],i=[null,null]){const s=rt(i);let n=!1;for(const i of this.plots.filter((e=>!e.hasDetachedScale))){const{domain:r,clamped:o}=this.getPlotDataDomain(i,e,t);Ze(r)&&(He(r,s),n=n||o!==pe.None)}if(!Ze(s))return{domain:null};const[r,o]=s;if(!Ze(r,o))return{domain:null};const a=[Number(r),Number(o)];a[0]===a[1]&&(a[0]-=1,a[1]+=1);let l=pe.None;return n&&(0===a[0]?l=pe.Min:0===a[1]&&(l=pe.Max)),{domain:a,clamped:l}}setDomain(){const e=this.pane.presenter,t=e.view.xAxis.xScale.domain();if(!Ze(t))return;for(const e of this.plots.filter((e=>e.hasDetachedScale))){const{domain:i}=this.getPlotDataDomain(e,t[0],t[1]);Ze(i)&&e.yScale.domain(i)}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=nt(e.display,!1,"chart","previous","forceVisible");Ze(t,i)&&s&&(i[0]=Math.min(i[0],t),i[1]=Math.max(i[1],t))}if(this.yScale.domain(i),Ze(i)){const e=this.getPadding(s);Ze(e)&&this.yScale.padding(e)}}getInitialPadding(){const e=ci(this.pane.presenter.hostElement);let t=di(`#${Ci.HEADER_SIZE_PLACEHOLDER_ID}`,e);if(!Ze(t)){t=yi(e,"div"),pi(t,{display:"none"}),fi(t,{id:Ci.HEADER_SIZE_PLACEHOLDER_ID,class:"bcharts-card bcharts-card-first"});const{lineHeight:i}=getComputedStyle(t);isNaN(Number.parseFloat(i))&&pi(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)+Ci.CARDS_Y_OFFSET}getPadding(e){const t=this.pane.presenter,i=t.display,s=nt(i,null,"yAxis","minPaddingPercent"),n=nt(i,null,"yAxis","maxPaddingPercent"),r=Ze(s),o=Ze(n),a=r||o?0:this.getInitialPadding(),l=o?n:Ci.PANE_CAP_MAX_PADDING_PERCENT,c=(r?s:Ci.PANE_CAP_MIN_PADDING_PERCENT)*this.viewBox.height,u=[o?l*this.viewBox.height:Math.max(c,Math.min(l*this.viewBox.height,a)),c];e===pe.Max?u[0]=Ci.PANE_TINY_PADDING_PIXELS:e===pe.Min&&(u[1]=Ci.PANE_TINY_PADDING_PIXELS);const h=t.mainPlot;return h&&h.hasEvents&&(u[0]+=3*t.view.getEventRadius()),u}clearTicks(){this.ticks=null}getTicks(e,t=0){const{height:i}=this.viewBox,s=_s(e,1.3),n={height:i,approxLineHeight:s,domain:this.yScale.domain()};if(Ze(this.ticks)&&Ze(n.domain)&&Ze(this.lastUsedOptions)&&Ze(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=nt(SP().config,null,"overrides","yAxis","tickProvider");if(Ze(a)&&"function"==typeof a&&n.height>0&&Ze(n.domain)){const e=rt(n);e.autoTicks=rt(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=yd(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(!Ze(this.fullDomain))return Ci.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(yd(this,t,!0)).width))),{innerTickSize:r,tickPadding:o}=this.config,a=n+r+2*o+(Ze(this.label)?_s(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(As(e,this.viewBox),e.font=`${c} ${u}px ${t}`,e.lineWidth=2,e.strokeStyle=i.color,e.textAlign="end",Ze(this.label)){e.save();const t=fs(.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=_s(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([]),Ns(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=yd(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(U.Symbol)||e.is(U.Expression);if(o&&u){const t=e.axis.comparison===V.Percent?V.None:V.Percent;c=e.priceMapper(a,r,n,t)}const h=e.hasDetachedScale?e.metaData.format(t,n):void 0,d=Ze(c)?1:2;l.push({y:e.priceToY(t),formattedValue:h,value:t,auxValue:c,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){const t=e.main?1:3;VA(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,Do.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&&OA(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=Ts(r),d=new MA({position:this.onTheRight?"right":"left",fontSize:this.config.fontSize,padding:this.config.indicatorPadding,fontFamily:i,textColor:h,strokeColor:r,backgroundColor:r}),p=n||yd(this,s);let f;const m=this.comparison===V.Percent;Xe(o)&&(f=m?gd(this,o):md(o)),d.draw(e,u,t,p,f)};r?l.forEach(u):RA.forEach((e=>l.filter((t=>t.priority===e)).forEach(u)))}}const BA=Symbol.for("__dloacip__");class kA{constructor(e){this.presenter=e,this.axes=[],this.height=0,this.alignedToYear=null,this.id=yt()}fromModel(e){this.height=e.height,!0===e.alignOnExpirations&&(this.alignedToYear=function(e){const t=e.map((e=>e.plots)).flat().filter((e=>U[e.type]==U.Symbol)).map((e=>e.symbol)).map((e=>ri(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 FA(this);return i.primary=0===t,i.fromModel(e),i}),this)}getBounds(){return this.viewBox}setViewBox(e){this.viewBox=e}draw(e){Ze(this.viewBox)&&(this.drawAxes(e),e.save(),this.clipToNoScales(e),this.drawPrevious(e),this.drawGrid(e),this.drawPlots(e),this.drawAnnotations(e),this.drawLogo(e),e.restore())}drawLogo(e){this.isMain&&!1!==this.presenter[BA]&&jT(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,Do.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=cs(c);e.save(),e.strokeStyle=l,e.lineWidth=u,e.setLineDash(h),Rs(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){As(e,this.getBoundsWithoutScales())}drawAnnotations(e){e.save();const{chart:{fontFamily:t},yAxis:{fontSize:i}}=this.presenter.display;e.font=`${i??12}px ${t}`,this.axes.forEach((t=>{t.annotations.forEach((t=>t.draw(e,!0)))})),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=this.axes[0],{fontWeight:c,fontSize:u}=l.config;e.font=`${c} ${u}px ${t}`;const h=l.getTicks(e),{leftOffset:d,rightOffset:p}=this.presenter.view,f=d,m=this.viewBox.width-p,g=(t,i,s)=>{e.lineWidth=t,e.strokeStyle=i,e.setLineDash(cs(s)),e.beginPath()};if(g(r,o,a),h.forEach((t=>{e.moveTo(f,t.y1),e.lineTo(m,t.y2)})),e.stroke(),n&&n.visible&&h.length>=2){const{lineWidth:t,color:i,dashStyle:s}=n,r=(h[0].y1-h[1].y1)/5;g(t,i,s),h.forEach((t=>{for(let i=1;i<5;i++){const s=Math.ceil(t.y1+i*r);e.moveTo(f,s),e.lineTo(m,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=cs(r);e.strokeStyle=n,e.setLineDash(o);const a=this.presenter.view.leftOffset,l=this.viewBox.width-this.presenter.view.rightOffset,c=ks();c.prolog(e),Rs(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";ws(e,SP().config.noDataText||Ci.NO_DATA_TEXT,{x:this.viewBox.centerX,y:this.viewBox.centerY},z.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=!Ze(i)||i,n=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 UA(e,t){return{width:e,spacing:t,get totalWidth(){return this.width+this.spacing},offset:0}}class WA extends Uy{constructor(e,t){super(),this.timeline=e,this.aggregation=t;const i=e.presenter.display;this.marginBars=i.xAxis.marginBars||0,this.bar=UA(nt(i,Ci.DEFAULT_BAR_WIDTH,"chart","bar","width"),nt(i,Ci.DEFAULT_BAR_SPACING,"chart","bar","spacing")),this._extent=null,this.wasZoomed=!1,this.fitAllData=!1}extent(e){return ky.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.scaleBarToFitDensity(this.timeline.withoutPrologEpilogLength);const e=this.display.xAxis.visibleRange;if(Ze(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(!Ze(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=De(this.timeline,+r,Number,bd));return[n-s+1,n]}adjustDomain(){if(!Ze(this._range))return;this.scaleBarToFit();const e=this.deriveExtentsFromBarWidth(this.bar);Ze(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,De(this.timeline,e,Number,bd)):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>Ci.MAXIMUM_BAR_WIDTH||s<Ci.MINIMUM_BAR_WIDTH)return!1;const r=UA(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)=>Ze(e)?De(this.timeline,e,Number,bd,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(Ci.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;let i=this.timeline.at(t),s=i,n=t;const r=this.presenter.data.aggregation;if(r.isEndOfDay||r.isIntraday&&e>=Ci.INTRA_THRESHOLD)for(;n>0&&Xu(i,s)<e;)n--,s=this.timeline.at(n);else if(!r.isTick){let t=Math.floor(e/Ci.ONE_DAY_MILLIS);const s=e=>WS(e,Nt(e)),r=s(i);let o=i;for(;n>0;){let e=this.timeline.at(n);const i=gr(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]=gt(e,t,Ci.MINIMUM_BAR_WIDTH,Ci.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(){Ze(this.resetBar)?(this.bar.width=this.resetBar.width,this.bar.spacing=this.resetBar.spacing):(this.bar.width=Ci.DEFAULT_BAR_WIDTH,this.bar.spacing=Ci.DEFAULT_BAR_SPACING),delete this.presenter.model.display.chart.bar,this.adjustDomain()}isUsableExtent(e){return Ze(e)&&Ze(e[0],e[1])&&e[0]>=0&&e[1]<this.timeline.withPrologEpilogLength&&e[1]-e[0]>=Ci.MINIMUM_BARS_VISIBLE}shiftBars(e,t=null){if(!this._extent)return;const i=this._extent.map((t=>t+e));this.isUsableExtent(i)&&(Ze(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(!Ze(e)||!Ze(e[0]))return[];const t=e[0].getTime();return this.timeline.presenter.allPlots.map((e=>e.timeSeries)).filter((e=>!(!Ze(e)||!e.hasData||0===e.container.size||!0!==e.canLoadMoreData)&&t<=e.container.getTimeData()[0].getTime()))}}function $A(e){return{date:e,priority:1,text:fd(e)}}class GA{constructor(e){this.view=e,this.xScale=new WA(e.presenter.timeline,e.presenter.data.aggregation),this.ticks=null,this.lastUsedOptions=null,this.wasPanned=!1,this.panningXAxisAllowed=nt(e.presenter.display,!0,"xAxis","panning"),this.updateConfigFromModel();const t=e.presenter.renderTo.id,i=nt(SP().config,null,"overrides","xAxis","tickProvider");Ze(i)&&"function"==typeof i&&(this.overrideTickGetter=me(i,t));const s=nt(SP().config,null,"overrides","xAxis","formatter");Ze(s)&&"function"==typeof s&&(this.overrideFormatter=me(s,t))}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 MA({position:"bottom",fontSize:this.config.fontSize,fontFamily:e,padding:this.config.indicatorPadding,strokeColor:o,textColor:s,backgroundColor:ms(.15)(t),arrowLength:this.config.innerTickSize})}setDomain(){this.xScale.adjustDomain();const e=this.view.presenter.display.period===Ci.FIFTY_YEARS_MILLIS;Ze(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!!Ze(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=_s(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=ed(e);return t?$A:e=>i.getTick(e)}getTicks(e){if(Ze(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&&Ze(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(!Ze(e)||Number.isNaN(e.getTime()))return null;const i=s(e);return Ze(i)&&(i.index=n+t),i})).filter((e=>Ze(e))),this.ticks}normalizeDuration(e){const t=Qh();let i=t.Year;const s=Object.keys(t);for(let n=0;n<s.length-1;++n){const r=t[s[n]].Multipliers,o=t[s[n+1]].Multipliers,a=(Oe(r)+we(o))/2;if(e<=a){i=t[s[n]];break}}const n=i.Multipliers,r=n.findIndex((t=>e<t));let o=-1===r?Oe(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,T=cs(y);e.textAlign="center",e.font=`${l} ${c}px ${a}`,e.lineWidth=1,e.strokeStyle=g,e.fillStyle=i,e.setLineDash([]),Rs(e,p,d,d+f);const S=this.xScale.extent(),A=e=>!Ze(e)||!Ze(e[0],e[1]);if(A(S))return;const v=t=>e.measureText(t).width,P=n>0?n:120,C=this.xScale.domain();if(A(C))return;const b=(C[1].getTime()-C[0].getTime())*P*.6/f,E=this.normalizeDuration(b),_=this.view.presenter.data.aggregation.isEndOfDay,M=(e,t)=>{if(e.date.valueOf()===Ci.ZERO_DATE.valueOf())return!0;if(i=e.date,n=t.date,(Ze(i)?Xu(n,i):Ci.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||!!_&&o)},L=d+f,O=({text:i,x:s,date:n,forced:r})=>{Ze(n)&&(r||Ns(e,s,p,p+u),e.fillText(i,s,p+u+h+.71*c),t.visible&&!r&&(e.save(),e.lineWidth=m,e.setLineDash(T),Ns(e,s,0,p),e.restore()))},w={agg:this.view.presenter.data.aggregation,unitWidth:v("M"),barWidth:this.xScale.bar.width,extent:S,formatString:r,minTickInterval:s||0,duration:b},I=this.getTicks(w);let x={date:Ci.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),(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>L?L-n:s,e.x=s,e.forced=t!==s}else e.forced=!1})(e),M(x,e)?(O(x),x=e):e.priority<x.priority&&(x=e)})),O(x),this.drawTimeAdornments(e)}getAnnXScore(e,t){return[gr,Cr,yr,br].map(((i,s)=>(4-s)*Number(i(e,t)))).reduce(((e,t)=>e+t),0)}annTimeToX(e){const t=this.xScale.timeToIndex(e);if(!Xe(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 vs(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=Td(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&&NA(n,this.viewBox),n.forEach((t=>{const s=Ts(t.color);new MA({position:"bottom",fontSize:this.config.fontSize,fontFamily:i,padding:this.config.indicatorPadding,strokeColor:Ci.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(!(Ze(c)&&ll(c)))return!1;if(!n)return!0;t=this.xScale.timeToX(c);const u=cs(a);e.strokeStyle=o,e.setLineDash(u);const h=ks();if(h.prolog(e),Ns(e,h.adjust(t),0,h.adjust(this.viewBox.y)),h.epilog(e),!r||!s.visible)return!0;const d=Ze(s.format)?l:void 0,p=Td(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 zA={mousedown:"onMouseDown",mousemove:"onMouseMove",mouseup:"onMouseUp",dblclick:"onMouseDblClick",contextmenu:"onContextMenu",mouseover:"onMouseEnter",mouseout:"onMouseLeave",wheel:"onWheel",touchstart:"onMouseDown",touchmove:"onMouseMove",touchend:"onMouseUp",keydown:"onKeyDown"},YA={Shift:"shiftKey",Alt:"altKey",Control:"ctrlKey",Meta:"metaKey"};class jA{constructor(e){this.view=e,this.subscriptions=[]}init(e){const t=Ue();Object.keys(zA).filter((e=>!(e=>e.startsWith("touch"))(e)||t)).forEach((t=>{const i=e=>{const i=zA[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=Ue()&&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:q.Left,offset:n,view:t.view,presenter:t,originalEvent:e,getModifier:t=>e[YA[Z[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(Ze(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(Z[t])}}}}const KA=Lu.concat(Do.PercentChange);class qA{constructor(e){this.view=e,this.isOptionsChart=!1,this.id=`bc-legend-${yt()}`}getLegendElem(){const e=this.view.el;return mi(this.id,e,"div")}update(){const e=this.getLegendElem(),t=Ud(this.presenter.mainPane);if(!Ze(t))return;this.isOptionsChart=this.mainPlot.title.startsWith("CUSTOM-FABRICATED-SYMBOL-PREFIX");const{left:i,right:s,top:n,width:r}=t;kT(e,"row",i,s,n,r),gi(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}`)} ${this.maybeGetAdditionalPlots()}`;e.innerHTML=u}remove(){hi(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){return 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=KA.map((t=>e.getValue(t)));if(Pe(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=KA[t],n=this.format(e,s),r=zd(s);return`${this.spanAsName(r)}${this.spanAsValue(n,i)}`})).join(" ")} ${this.spanAsValue(`(${this.format(Oe(t),Oe(KA))})`,i)}`}return""}maybeGetQuote(){if(this.mainPlot.isSymbol&&this.mainPlot.timeSeries?.record?.isValid){const e=SP().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=SP().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 Dd("rectangle",e.mainCurve.colors[0])}getLastValues(e){return this.isOptionsChart?"":VA(e).filter((e=>Ze(e.value))).map((e=>{const t=this.format(e.value,e.field);return this.spanAsValue(t,null,`color:${e.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)?Fd(e.id):"",r="All"!==t&&!e.isSeasonal?this.getLastValues(e):"";return this.div(`${n} ${i} ${s} ${r}`)})).join(" "):""}}class XA{splitters=[];canvasContainer=null;mouseCanvas=null;mainCanvas=null;leftOffset=0;rightOffset=0;el=null;listeners=[];customEventPopup=null;goToLatestButton=null;resetZoomAndVisibleRange=!1;constructor(){this.legend=new qA(this),this.draw=this.draw.bind(this),this.notifyLayoutChanged=qe(No.CH_CHTLAYOUTCHANGED,Ci.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=>Ze(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(Xe(s))return void t.onMovePaneClicked(s);const n=this.findSvgParentWithClass(i,"delete-plot");if(Xe(n))return void t.deletePlotClicked(n);const r=this.findSvgParentWithClass(i,"show-hide-plot");if(Xe(r))return void t.showHidePlotClicked(r);const o=this.findSvgParentWithClass(i,"more-actions");if(Xe(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),Ze(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))),pi(this.el,{flex:1,display:"flex",position:"relative","flex-direction":"column","touch-action":"pan-x pan-y"}),this.tooltip=new VT(this);const s=SP().config.getCustomEventPopup;this.customEventPopup=s?s(this):null;const{clientHeight:n,clientWidth:r}=this.el;this.width=r,this.height=n,this.canvasContainer=yi(this.el,"div"),fi(this.canvasContainer,{class:"chart-canvas-container"}),pi(this.canvasContainer,{flex:1,display:"flex","flex-direction":"column",position:"relative",height:"100%"}),this.mainCanvas=yi(this.canvasContainer,"canvas");const o={height:`${n}px`,width:`${r}px`,"z-index":2,position:"absolute",top:0,left:0};pi(this.mainCanvas,o),this.mouseCanvas=yi(this.canvasContainer,"canvas"),fi(this.mouseCanvas,{tabIndex:0}),o["z-index"]=3,o.outline="none",pi(this.mouseCanvas,o),this.goToLatestButton=yi(this.el,"button"),Si(this.goToLatestButton,'<svg version="1.1" 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>'),pi(this.goToLatestButton,{position:"absolute",right:0,bottom:0,"z-index":3}),fi(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 GA(this),this.eventCapture=new jA(this),this.eventCapture.init(this.mouseCanvas),this.setChartSize(r,n);const a=ci(this.el);Ze(di(`.${Ci.SVG_ICONS_DOM_NODE}`,a))||Ld(a)}reinitialize(){this.el&&Ti(".bcharts-card",this.el).forEach((e=>e.remove())),this.customEventPopup?.hide(),this.tooltip.hide(),this.tooltip.setMode(this.presenter.display.tooltip.mode),this.resetZoomAndVisibleRange?this.xAxis=new GA(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`};pi(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=>{fi(e,n),pi(e,i)})),this.mainContext.scale(s,s),this.mouseContext.scale(s,s),this.recalculateLayout(),this.presenter&&FT(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=Ae(n.map((e=>e.height))),o=0;const a=Ci.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 vs(0,o,this.width,c);e.setViewBox(u);const h=new vs(this.width-this.rightOffset,o,t,c),d=new vs(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 vs(this.leftOffset,o,this.width-this.rightOffset-this.leftOffset,l);this.splitters.push(e),o+=l}}));const u=new vs(this.leftOffset,o,this.width-this.rightOffset-this.leftOffset,e);this.xAxis.setViewBox(u),pi(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),this.xAxis.draw(this.mainContext);for(const e of this.presenter.panes)e.draw(this.mainContext);this.drawSplitters(this.mainContext),this.presenter.title.draw(this.mainContext);const e=SP().config.showGoToLatest,{showGoToLatest:t}=this.presenter.display.chart,i=Ze(e)?e:t;this.goToLatestButton.style.display=i&&this.xAxis.canGoToLast()?"block":"none",this.mainContext.restore()}get isHostElementVisible(){return Ze(this.el)&&Ze(this.el.offsetParent)}redraw(e=!1){this.isHostElementVisible&&(e?this.draw():SP().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=this.presenter.display.chart.backgroundColor,i=ps(t);e.strokeStyle=i,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 j.Arrow:default:return"default";case j.Crosshair:return"crosshair";case j.Hand:return"pointer";case j.Move:return"move";case j.ResizeVertical:return"ns-resize";case j.Grabbing:return"grabbing";case j.ResizeHorizontal:return"ew-resize"}}(e);pi(this.el,{cursor:t})}shutdown(){this.listeners.forEach((e=>e())),this.eventCapture&&this.eventCapture.shutdown(),this.tooltip&&this.tooltip.remove(),this.el&&Ti(".bcharts-card",this.el).forEach((e=>e.remove())),this.canvasContainer.remove()}getEventRadius(){const e=this.xAxis.xScale.bar.width/2;return Math.max(e,Ci.MIN_EVENT_RADIUS)}}class ZA{constructor(e){this.view=e,this.date=null,this.value=null,this.visible=!1,this._initialized=!1}initialize(){this.popupElement=yi(this.view.el,"div"),fi(this.popupElement,{id:`${this.view.presenter.elementId}-custom-event-host`}),pi(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=yi(this.popupElement,"a");fi(e,{class:"custom-event-close-button"}),pi(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()),pi(this.popupElement,{visibility:"visible",top:`${e.y}px`,left:`${e.x}px`,width:"310px"}),this.visible=!0}hideValue(){}hide(){this.visible&&(this.hideValue(),pi(this.popupElement,{visibility:"hidden"}),this.visible=!1)}}function JA(e,t){if(!function(e){return e.annotations&&e.annotations.length>0}(e))return;let i=t.annotations||[];t.annotations=i.concat(e.annotations)}const QA='..axes{..plots{.type==="Study"}}';function ev(e,t){const{mainAxis:i}=ao(e),{mainAxis:s}=ao(t);JA(i,s);const n=e=>Yn(e,'..plots{.type==="Study"}.study')[0],r=Yn(e,QA).filter((e=>e!==i)),o=Yn(t,QA).filter((e=>e!==s));return r.forEach((e=>{const t=n(e),i=o.find((e=>t===n(e)));Ze(i)&&JA(e,i)})),t}Tp=n("c15IW");function tv(e,t){let i=e;return t.paneHeights.forEach((e=>{i=jn(i,`..panes[${e.index}]`,(t=>(t.height=e.relativeHeight,t)))})),i}const iv={ok:!1,change:void 0,toApply:void 0};class sv{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,uT(e,he.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&&Xe(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(!Ze(e))return!1;switch(t){case he.None:case he.Undo:case he.Redo:dP(`Unexpected tool change ${he[t]} for undo/redo`,"warn");break;case he.Created:i?this.delete(e):this.add(e);break;case he.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?he.Undo:he.Redo;return Ze(s)&&this.presenter.onAnnotationModifiedByTool(s,n),!0}can(e){const t=e?this.undoStack:this.redoStack;if(t.length<1)return iv;const i=Oe(t),s=i.toolChange;if(!(e&&s!==he.Deleted&&s!==he.Created))return{ok:!0,change:s,toApply:i};const n=Ie(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)?iv:{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 nv{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;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 rv(e={}){const t=this.allPlots;if(!t.every((e=>Ze(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=new Map;return e.main&&(t.set(Do.DateTime,0),this.data.aggregation.isMultiContract&&!e.isExpression&&t.set(Do.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?Ci.FMT_ISO_DATE_ONLY:Ci.FMT_EXPORT_ALL_BUT_MILLIS,a=(e,t)=>e===Do.DateTime?rc(t,o):(e=>Ze(s,e)?Je(e,s):e)(t)?.toString()??"",l={},c=this.timeline.lastSeriesIndex,u=we(this.mainPlot.timeSeries.container.getTimeData()),h=De(this.timeline,+u,Number,bd),d=(e,t)=>{const i=this.timeline.at(e),s=t.timeSeries.container,n=s.getTimeData(),c=l[t.id]||0,u=De(n,+i,Number,xe,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===Do.DateTime?rc(i,o):"";{const i=this.timeline.at(e-r),o=De(n,+i,Number,xe,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(",")},f=[];if(!i){const e=e=>{const t=new Array(r(e).length).fill("");return t[0]=(e=>`"${U[e.type]}: ${e.title}"`)(e),t};f.push(p(e)),f.push(p((e=>r(e).map((([e,t])=>`"${e.name}"`)))))}const m=[0,0];this.allCurves.forEach((e=>{e.fields.every((e=>n.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=h+m[0];e<=c+m[1];e++){const t=p(me(d,e));null!==t&&f.push(t)}return f.join("\n")}function ov(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),Xe(o)){const e=new nv(this);e.update(o),e.draw(l)}const u=this.mainPlot?.timeSeries.container?.getLastDataPoint(Do.DateTime);if(Xe(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:Ci.CARDS_X_OFFSET,y:Ci.CARDS_Y_OFFSET},h=kd(this,u,c,void 0,!1,0),d=`${h.date} ${h.time??""}`.trim(),[p,f]=[1,5],m=(e,t)=>l.measureText(e).width+t,g=(e,t,i,s,n)=>(l.fillStyle=s,l.fillText(e,t,i),m(e,n)),y=(e,t)=>e.type===U[t],T=e=>{let t=e.name;return e.isMain&&y(e,"Symbol")?t=`${e.description} (${e.name}) [${e.exchange}]`:y(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-f;let u=i+c.x,h=t+c.y;e.plots.some((e=>e.isMain))&&(u+=g(d,u,h,o,f)),e.plots.forEach(((e,t)=>{const s=T(e),r=!y(e,"Study")&&e.values.length>1;if(!e.isMain&&t>0){let t=u+m(s,f);e.values.forEach((e=>{r&&(t+=m(e.abbreviation,p)),t+=m(e.value,f)})),t>=l&&(u=i+c.x,h+=n)}u+=g(s,u,h,o,f),e.values.forEach((e=>{r&&(u+=g(e.abbreviation,u,h,a,p)),u+=g(e.value,u,h,e.color,f)}))}))}))}const h=e=>({width:n??i,height:r??s,data:e.toDataURL("image/png")});if(Xe(n)&&Xe(r)){const e=a(n,r);return e.drawImage(l.canvas,0,0,n,r),h(e.canvas)}return h(l.canvas)}const av=Symbol.for("__ias__");class lv{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=dA("Default"),this._activeTool=this.defaultTool,this.timeline=new Ed(this),this.undoRedoManager=new sv(this),this.title=new nv(this),this.notifySelectionChanged=Ke(No.CH_ANNSELECTIONCHANGED),this.notifyRecreated=Ke(No.CH_RECREATED),this.notifyDefinitionChanged=Ke(No.CH_DEFINITION_CHANGED)}getModel(){return this.model}get isEmpty(){return!Ze(this.model)}notifyHost(e,t){je(e,t)}async fromModel(e,t){if(this._isShutdown)return;Ze(this.model)&&this.allPlots.forEach((e=>e.shutdown())),this.sentInitialLoadNotification=!1,this.clearSelection(),this.model=e;const i=rt(e);this.data=i.data,this.data.aggregation=_r(i.data.aggregation),this.display=i.display,Ze(this.display.period)&&(this.display.period=mt(this.display.period)),this.panes=i.panes.map((e=>{const t=new kA(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),Ze(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=Er(jv(s,t,i)),r=Er(jv(s,e,i));if(hv(n,r))return!0;if(!cv(e.display?.xAxis?.visibleRange,t.display?.xAxis?.visibleRange)||e.display?.xAxis?.marginBars!==t.display?.xAxis?.marginBars||!cv(e.data?.range,t.data?.range)||e.display?.period!==t.display?.period||e.display?.density!==t.display?.density)return!0;const o=oo(t),a=oo(e);if(function(e,t){const i=e=>e.curves[0],s=i(e),n=i(t),r=uv.includes(s.style),o=uv.includes(n.style);if(r!==o)return!0;if(!o)return!1;if(s.style!==n.style)return!0;if(t.inputs){if(hv(ct(e.inputs),ct(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(){Ze(this.view)&&(this.view.shutdown(),this.view=void 0)}reinitializeView(){this._isShutdown||(Ze(this.view)?this.view.reinitialize():(this.view=new XA,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){Ze(this._activeTool.deactivated)&&this._activeTool.deactivated(this),this._activeTool=e,Ze(this._activeTool.activated)&&this._activeTool.activated(this),this.notifyHost(No.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(!Ze(n))return;const r=Ze(n)&&n.main;let o=!1,a=!1;if(e===No.TS_TIMELINECORRECTION){if(!this.timeline.tryToCorrectLastBar(t.from,t.to))return;o=!0}const l=Ze(t.index)?i.container.getTimeData()[t.index]:null,c=e===No.TS_EVENTSCHANGED,u=this.view.xAxis,h=u.xScale;if(e===No.TS_MANYCHANGED||c){if(r&&this.data.checkRange){if(Ze(this.display.xAxis.visibleRange)){const e={id:"Period",context:{range:this.display.xAxis.visibleRange}};return e[av]=!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))}if((n.isSeasonal&&!u.wasVisibleRangeChanged||this.display?.xAxis?.isOrdinal)&&u.goToLatest(!0),t.part===se.Tail){const e=De(this.timeline,l,Number,bd);u.shouldScrollIntoView(e)&&h.shiftBars(t.count)}this.timeline.invalidate(),this.allPlots.forEach((e=>e.invalidatePriceMappingCache())),o=!0}else if(e===No.TS_DATAPOINTADDED){const e=this.timeline.mergeDateIntoTimeline(l);-1!=e&&u.shouldScrollIntoView(e)?(h.shiftBars(1),o=!0):a=!0}else e===No.TS_DATAPOINTCHANGED&&(a=!0);if(!c&&s(this.mainPlot)&&i.hasData&&0===i.container.size&&this.notifyHost(No.CH_NODATAFORMAINSYMBOL,{chart:this.accessor}),o&&this.view.recalculateLayout(),a){o&&dP("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(),Ze(l)&&e.updateFullDomain(l)}))}if(!this.sentInitialLoadNotification&&e===No.TS_MANYCHANGED){if(this.allPlots.every((e=>e.timeSeries&&e.timeSeries.hasData))){this.sentInitialLoadNotification=!0,this.notifyHost(No.CH_ALL_DATA_PROJECTED,{chart:this.accessor}),FT(this);const e=this.display.period===Ci.FIFTY_YEARS_MILLIS;this.mainPlot&&e&&(h.fitAllData=!0,h.adjustDomain())}}this.view.redraw()}onMetaChanged(e,t){e===No.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(No.CH_AXISSCALECHANGED,s)}get previousMask(){return Ze(this._previousMask)||(this._previousMask=Ho(Do.PreviousClose)),this._previousMask}hasMatch(e,t){return e.some((e=>e.updated&&t))}get hasLegend(){return Ze(this._hasLegend)||(this._hasLegend=SP().config.mode===te[te.cmdtyView]),this._hasLegend}onStreamingUpdates(e){Ze(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 Ze(this._ohlcMask)||(this._ohlcMask=Ho(Do.Open,Do.High,Do.Low,Do.Close,Do.PreviousClose)),this._ohlcMask}updateMatches(e,t){if(0==(e&this.ohlcMask))return!1;const i=(e,t)=>Xe(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 SP().getRecordSource().subject.pipe(Ku((e=>e.filter((e=>this.updateMatches(e.updated,e.data.symbol))))),rl((e=>e.length>0))).subscribe(this.onStreamingUpdates.bind(this))}get hostElement(){return this._hostElement}get elementId(){return Ze(this._hostElement)?this._hostElement.id:null}initialize(t){if(this._hostElement=t instanceof HTMLElement?t:di(`#${t}`),!this._hostElement)throw new Error(`There is no element ${t} in the DOM`);this.renderTo=t,this.seriesChangedToken=e(Tp).subscribe(No.TS_ALL,this.onSeriesChanged.bind(this)),this.metaChangedToken=e(Tp).subscribe(No.MD_ALL,this.onMetaChanged.bind(this)),this.streamingSubscription=this.getStreamingSubscription()}shutdown(){return e(Tp).unsubscribe(this.seriesChangedToken),e(Tp).unsubscribe(this.metaChangedToken),Ze(this.streamingSubscription)&&this.streamingSubscription.unsubscribe(),this.allPlots.forEach((e=>e.shutdown())),this.model=void 0,this.closeView(),this.notifyHost(No.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(){Ze(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(j.Arrow)}print(e={}){const t=yi(document.body,"iframe");t.src="",t.style.display="none",t.onload=()=>{const{title:i}=e,s=ov.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),Ze(this.view)&&this.view.redraw(t)}enableTooltip(e){this.tooltipEnabled=e;const t=this.display.tooltip.mode===Ci.TOOLTIP_CARDS;!e&&t&&this.hideCards()}get showTooltip(){return this.display.tooltip.visible&&this.tooltipEnabled}hideCards(e=!1){const t=this.display.tooltip,i=Ue();!e&&t.visible&&t.mode===Ci.TOOLTIP_CARDS&&Ti(".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 Yn(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,he.Deleted))}throw new Error(`Unknown sub-action ${e.id} for action ${Ci.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:U[i[s].type],index:s}}getSimplePlot(e,t){return this.accessor.change({id:"Plot",context:{id:Ci.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(No.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(No.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(No.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(No.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(No.CH_PANESREORDERED,{chart:this.accessor})}))}onAnnotationsUpdated(e,t=!1){const i=this.allAxes.indexOf(e),s=e.annotations.map((e=>e.toModel())),n=jn(this.model,`..axes[${(r={axisIndex:i,annotations:s}).axisIndex}]`,(e=>(e.annotations=r.annotations,e)));var r;try{this.model=_o(n,Ci.CHART_SCHEMA)}catch(e){dP(`Cannot update annotation (corrupts definition), error is: ${e.message}`,"error")}t&&this.view.draw(),this.notifyHost(No.CH_ANNOTATIONCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}onAnnotationModifiedByTool(e,t,i=!0){if(t!==he.None){if(i&&t!==he.Undo&&t!==he.Redo){const i=uT(e,t);this.undoRedoManager.done(i)}const s=hT(e);s.toolChange=he[t],this.notifyHost(No.CH_ANNMODIFIEDBYTOOL,s)}}onAnnotationDone(e,t){const i={id:e,chart:this.accessor,toolChange:he[t]};this.notifyHost(No.CH_ANNMODIFIEDBYTOOL,i)}onPaneHeightsUpdated(){const e=this.panes.map(((e,t)=>({index:t,relativeHeight:e.height})));this.model=tv(this.model,{paneHeights:e}),this.notifyHost(No.CH_PANEHEIGHTSCHANGED,{chart:this.accessor}),this.notifyDefinitionChanged({chart:this.accessor})}getDataStats(){const e=this.mainPlot.timeSeries.container;if(!Ze(e)||0===e.size)return null;const t=e.getTimeData();return{dataRange:{from:we(t).getTime(),to:Oe(t).getTime()},barCount:e.size}}}function cv(e,t){return e?.from===t?.from&&e?.to===t?.to}const uv=["Renko","Range","LineBreak","Kagi","PointAndFigure"];function hv(e,t){for(const i of Object.keys(e))if(e[i]!==t[i])return!0}const dv="MARKED_FOR_DELETION";function pv(e,t){if(0===t.plots.length)return e;let i=e;return t.plots.forEach((e=>{const t=gv(e.index),s=yv(i,t);Ze(s)&&s.type===e.type&&(i=jn(i,t,(e=>(e[dv]=!0,e))))})),i=jn(i,`..plots{.${dv} === true}`,(e=>Ci.NULL_OBJECT)),Mo(i)}function fv(e,{main:t,type:i,index:s},n){const r="..plots{.main === true}",o=Yn(e,"..panes").map(((e,t)=>{const i=1===Yn(e,r).length;return Yn(e,"..axes").map(((e,s)=>{const o=1===Yn(e,r).length;return Yn(e,"..plots").map((e=>{const r=function(e,t,i,s){const n=U[e.type],r={curves:rt(e.curves),type:e.type};r.precision=e.precision,r.visible=e.visible;const o=(e,t)=>{Ze(e[t])?r[t]=e[t].map((e=>rt(e))):r[t]=[]},a=(e,t,i=!1)=>{!0===t.main&&(e.main=!0,e.showPrevious=t.showPrevious,i&&null!=t.events&&(e.events=rt(t.events)))},l=e=>{Ze(s)&&(e.subtitles=s.allPlots.filter((e=>e.type===n)).map((e=>e.title)))};switch(n){case U.Symbol:{const t=e;r.title=t.symbol;const i=t=>{o(e,"inputs"),0===r.inputs.length&&(r.inputs=rt(t))};switch(r.curves[0].style){case"Renko":i(Ci.DEFAULT_RENKO_INPUTS);break;case"Kagi":i(Ci.DEFAULT_KAGI_INPUTS);break;case"PointAndFigure":i(Ci.DEFAULT_PNF_INPUTS);break;case"LineBreak":i(Ci.DEFAULT_LINEBREAK_INPUTS);break;case"Baseline":i(Ci.DEFAULT_BASELINE_INPUTS);break;case"Line":!0===t.main&&1===e.curves?.length&&(r.curves[0].lineMarker=e.curves[0].lineMarker??"None")}a(r,e,!0);break}case U.Study:{o(e,"inputs");const s=Rn(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 U.BalanceSheet:case U.IncomeStatement:{const t=Do[e.curves[0].fields[0]];r.title=`${t.name} (${e.fundamental.substring(0,1)})`,r.fundamentalId=t.id,r.frequency=e.fundamental;break}case U.Expression:r.title=e.expression,a(r,e);break;case U.Forward:r.title=e.forward,o(e,"offsets"),l(r),a(r,e);break;case U.Seasonal:r.title=e.seasonal,l(r),o(e,"offsets"),o(e,"usesInAverage"),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(Ze(i)){const e=o.filter((e=>e.type===i));return Ze(s)?e.filter((e=>e.index===s)):e}return o}function mv(e,t){"Study"===e.type&&t.curves?.forEach((e=>delete e.varyColorPerBar));const i=e;i.main&&"Symbol"!==e.type&&t.curves?.forEach((e=>delete e.lineMarker)),!function(e){const t=U[e.type];return t===U.Forward||t===U.Seasonal}(e)?Sv(e.curves,t.curves):Ze(t.curves)&&(e.curves=t.curves);const s=U[t.type];if(Ze(t.precision)?i.precision=t.precision:delete i.precision,s===U.Symbol)e.symbol=t.symbol;else if(s===U.Study)Av(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(s!==U.BalanceSheet&&s!==U.IncomeStatement||!t.frequency){if(s===U.Expression){const i=e;Ze(t.expression)&&(i.expression=t.expression)}else if(s===U.Forward){const i=e;Ze(t.offsets)&&(i.offsets=t.offsets),Ze(t.forward)&&(i.forward=t.forward)}else if(s===U.Seasonal){const i=e;Ze(t.offsets)&&(i.offsets=t.offsets),Ze(t.usesInAverage)&&(i.usesInAverage=t.usesInAverage),Ze(t.seasonal)&&(i.seasonal=t.seasonal)}}else e.fundamental=t.frequency}const gv=e=>`..plots[${e}]`;function yv(e,t){const i=Yn(e,t);return 1!==i.length?null:i[0]}const Tv=["withMain","overlay","standalone","clone"];function Sv(e,t){if(void 0!==t&&t.length===e.length)for(let i=0;i<e.length;++i){at(e[i],t[i]);const s=t[i].shift;Ze(s)&&(e[i].shift=s);const n=t[i].dashStyle;Ze(n)&&(e[i].dashStyle=n)}}function Av(e,t,i){const s=ct(e),n=ct(t);at(s,n);const r=(o=n,Object.keys(o).map((e=>({name:e,value:o[e]}))));var o;r.length>0&&(i.inputs=r)}function vv(e){return{axes:[{plots:[]}],height:e.display.chart.newPaneHeight??1}}function Pv(e){const t=vv(e);return e.panes.push(t),t}function Cv(e,t){const i=Xe(t.paneIndex)&&t.paneIndex<e.panes.length?e.panes[t.paneIndex]:Pv(e),s=i.axes[0];return t.oppositeScale??!1?Nv(i,s):s}function bv(e,t,i){let s=null;const{mainPane:n,mainAxis:r}=ao(e);switch(t){case"withMain":s=Nv(n,r);break;case"overlay":s=r;break;case"standalone":s=Pv(e).axes[0];break;case"clone":if("number"==typeof i){const t={main:!1,index:i,type:U[U.Study]},n=fv(e,t).find((e=>e.index===t.index));s=Yn(e,`..panes[${n.paneIndex}]..axes[${n.axisIndex}]`)[0]}}return s}const Ev=[{fields:[Do.Close.id],colors:["#888"],style:"Line",lineWidth:2,varyColorPerBar:!1,visible:!0}];function _v(e){return"Symbol"===e.type}const Mv={attributes:["OpenVsClose"],colors:["#b63400","#007f3e","#1664db"],fields:["Open","High","Low","Close","Change"],style:"Candlestick",varyColorPerBar:!0,lineWidth:1};let Lv=0;const Ov=["#0d223a","#8abc21","#910000","#2f7ed8","#42ccdc","#bf95df","#860262","#e5daa3","#4682e8","#aaa9c1","#fcccdc","#f66b00","#d875be","#e84b46"],wv="Symbol",Iv="Expression";function xv(e,t){let i={curves:[{attributes:[],colors:Ov.slice(Lv,Lv+1),fields:e?[Do.Last.id]:[Do.Close.id],style:"Line",dashStyle:"Solid",varyColorPerBar:!1,lineWidth:2}]};return delete t.oppositeScale,lt(i,t),Ze(t.curves)&&at(i.curves,t.curves),Lv=(Lv+1)%Ov.length,i}const Dv='..plots{(.type === "Symbol" || .type === "Expression") && .main !== true}';function Nv(e,t){let i=e.axes.find((e=>e!==t));return Ze(i)||(i={plots:[]},e.axes.push(i)),i}function Rv(e,t){const i=Yn(e,Dv),s=Yn(t,Dv),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}=ao(t),{mainAxis:l}=ao(e);return r.forEach((e=>{if(l.plots.includes(e))a.plots.push(e);else{Nv(o,a).plots.push(e)}})),t}const Hv=()=>Ci.NULL_OBJECT;function Vv(e){return jn(e,"..axes.annotations",Hv)}function Fv(e){return Mo(jn(e,'..plots{.type === "Symbol" && .main !== true}',Hv))}const Bv=".display.chart.previous";function kv(e,t,i){const s=[],n=i.allPlots[t.index];if(n?.type!==U[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 Uv(e,t,i){const s=[],n=i.allPlots[t.index];if(n?.type!==U[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 Wv(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 $v(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 Gv={MainPlot:go,Aggregation:{Update:So,Get:function(e,t,i){return rt(e.data.aggregation)}},Period:{Update:function(e,t,i){const s=Ze(t.period),n=Ze(t.range),r=Ze(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,Rr(e),Vr(e)),n)if(Ze(e.display.period)&&!Po(e.display.period)||(e.display.xAxis.visibleRange=t.range),Hr(e),Vr(e),Ze(i)){const s=function(e){const t=e.getDataStats();return null===t?null:t.dataRange}(i),n=_r(e.data.aggregation),r=i.data.aggregation,o=(l=r,(a=n).unit!==l.unit||a.size!==l.size||a.spec!==l.spec||!Ze(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,Rr(e),Hr(e)),(s||n||r)&&(Nr(e),i&&(i.forceResetVisibleRange=!0)),e},Delete:function(e,t,i){return Ze(t.period)&&t.period&&(delete e.display.period,yo(e),i&&(i.forceResetVisibleRange=!0)),e}},Crosshair:{Update:function(e,t){let[i,s]=et(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=jn(e,".display.xAxis.crosshair",(e=>(e.enabled=i,l(e,o,a),e)));return c=jn(c,".display.yAxis.crosshair",(e=>(e.enabled=s,l(e,n,r),e))),Ze(t.haloTracking)&&"boolean"==typeof t.haloTracking&&(c=jn(c,".display.chart",(e=>(e.plotHover=t.haloTracking,e)))),c},Get:function(e,t,i){const s=t=>Yn(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 jn(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=Yn(e,".display.tooltip")[0];return{visible:s.visible,mode:s.mode,showMainTitle:s.showMainTitle,mainTitle:s.mainTitle}}},Events:function(e,t){const i=rt(t);return Object.keys(t).forEach((e=>{Ci.EVENTS.includes(e)||delete i[e];let s=t[e];"boolean"==typeof s?s={show:t[e]}:Object.keys(s).forEach((e=>{Ci.EVENT_PROPERTIES.includes(e)||delete s[e]})),i[e]=s})),jn(e,ro,(e=>("Symbol"===e.type&&(e.events=e.events||{},Object.keys(i).forEach((t=>{e.events[t]=e.events[t]||{},ot(e.events[t],i[t],!1)}))),e)))},Scale:{Update:function(e,t){let i=jn(e,"..panes[0]..axes",(e=>(Xe(t.scale)&&(e.scale=t.scale),e)));return i=jn(i,".display.xAxis",(e=>(Xe(t.marginBars)&&(e.marginBars=t.marginBars),Xe(t.nonEodLabelWithDate)&&(e.nonEodLabelWithDate=t.nonEodLabelWithDate),Xe(t.ordinalName)&&(e.ordinalName=t.ordinalName),Xe(t.preventHorizontalLabelOverlap)&&(e.preventLabelOverlap=t.preventHorizontalLabelOverlap),e))),i=jn(i,".display.yAxis",(e=>{(Ze(t.minPadding)||Ze(t.maxPadding))&&dP("The 'minPadding' and 'maxPadding' are deprecated (ignored)","warn");const i=Xe(t.preventLabelOverlap)&&!Xe(t.preventVerticalLabelOverlap);i&&dP("The 'preventLabelOverlap' is deprecated, please use 'preventVerticalLabelOverlap'","warn");const s=i?t.preventLabelOverlap:t.preventVerticalLabelOverlap;return Xe(s)&&(e.preventLabelOverlap=s),Ze(t.includePercentChangeWithLastValue)&&(e.includePercentChangeWithLastValue=t.includePercentChangeWithLastValue),Ze(t.snapAnnotationsToPrices)&&(e.snapAnnotationsToPrices=t.snapAnnotationsToPrices),e})),Ze(t.labels)&&Array.isArray(t.labels)&&t.labels.forEach((e=>{const{axis:t,text:s,index:n}=e;Ze(t,s,n)&&"vertical"===t&&Number.isInteger(n)&&(i=jn(i,`..panes[0]..axes[${n}]`,(e=>(e.label=s,e))))})),i},Get:function(e,t,i){const{mainAxis:s}=ao(e),n=Yn(e,".display.xAxis")[0],r=Yn(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??""}}},Other:{Update:function(e,t,i){let s=e;if(Ze(t.comparisonMode)&&"string"==typeof t.comparisonMode&&st(V,t.comparisonMode)&&(s=jn(s,`..panes{${ro}}.axes`,(e=>(e.comparison=t.comparisonMode,e)))),Ze(t.gridLines)){const[e,i]=et(t.gridLines);s=jn(s,".display.xAxis.gridLines",(t=>(t.visible=e,t))),s=jn(s,".display.yAxis.gridLines",(e=>(e.visible=i,e)))}if(Ze(t.minorGridLines)){const[,e]=et(t.minorGridLines);s=jn(s,".display.yAxis.minorGridLines",(t=>(t.visible=e,t)))}Ze(t.newPaneHeight)&&"number"==typeof t.newPaneHeight&&(s=jn(s,".display.chart{.newPaneHeight > 0}",(e=>(e.newPaneHeight=t.newPaneHeight,e)))),Ze(t.showNavigator)&&"boolean"==typeof t.showNavigator&&(s=jn(s,".display.scrollbar",(e=>(e.visible=t.showNavigator,e)))),Ze(t.plotHover)&&"boolean"==typeof t.plotHover&&(s=jn(s,".display.chart",(e=>(e.plotHover=t.plotHover,e)))),Ze(t.showLastValue)&&"string"==typeof t.showLastValue&&(s=jn(s,".display.yAxis",(e=>(e.showLastValue=t.showLastValue,e)))),Ze(t.showMinMaxArc)&&"boolean"==typeof t.showMinMaxArc&&(s=jn(s,".display.chart",(e=>(e.showMinMaxArc=t.showMinMaxArc,e)))),Ze(t.showGoToLatest)&&"boolean"==typeof t.showGoToLatest&&(s=jn(s,".display.chart",(e=>(e.showGoToLatest=t.showGoToLatest,e)))),Ze(t.showLegend)&&"boolean"==typeof t.showLegend&&(s=jn(s,".display.chart",(e=>(e.showLegend=t.showLegend,e))),t.showLegend||i.view.removeLegend()),Ze(t.allAnnotationsLocked)&&"boolean"==typeof t.allAnnotationsLocked&&(s=jn(s,".display",(e=>(e.allAnnotationsLocked=t.allAnnotationsLocked,e)))),Ze(t.exprSkipLeadingEmpty)&&"boolean"==typeof t.exprSkipLeadingEmpty&&(s=jn(s,".data",(e=>(e.exprSkipLeadingEmpty=t.exprSkipLeadingEmpty,e))));const n=[];if(Ze(t.extendedHours)&&"boolean"==typeof t.extendedHours&&(s=jn(s,".data",(e=>(e.extendedHours=t.extendedHours,e)))),Ze(t.realTimeCboeBzx)&&"boolean"==typeof t.realTimeCboeBzx&&(s=jn(s,".data",(e=>(e.realTimeCboeBzx!==t.realTimeCboeBzx&&n.push("realTimeCboeBzx"),e.realTimeCboeBzx=t.realTimeCboeBzx,e)))),Ze(t.buildContinuation)&&"boolean"==typeof t.buildContinuation&&(s=jn(s,".data",(e=>(e.buildContinuation=t.buildContinuation,e)))),n.length>0){const e={chart:i.accessor,hostPropsChanged:n};i.notifyHost(No.CH_HOST_PROPS_CHANGED,e)}return s},Get:function(e,t,i){const s=Yn(e,`..panes{${ro}}.axes.comparison`)[0],n=e.display,r=(e,t)=>nt(e,!1,t,"visible"),o=e=>function(e,t){const i=e=>Ze(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=nt(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=Rn(t.studyId);if(!Xe(i))return dP(`Unknown or unavailable study with the id '${t.studyId}'`,"error"),e;const s=oo(e),n=Bn(i);if(s.type===U[U.Expression]&&n)return dP(`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};"overlay"===r&&"VOL"===t.studyId&&(o.detachedScale=!0),void 0!==t.curves&&(o.curves=i.defaults.curves),mv(o,t);const a=bv(e,r,t.cloneIndex);Ze(a)&&a.plots.push(o);const l=e.data.aggregation;return To(e,"Tick"===l.unit&&"None"===l.spec)}(e,t);case"IncomeStatement":case"BalanceSheet":return function(e,t){const i=oo(e);if(i.type!==U[U.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:D[Do[t.fundamentalId].category]};return mv(n,t),function(e,t){e.panes.push({axes:[{plots:[t]}]})}(e,n),e}(e,t);case"Expression":return function(e,t){const i=oo(e),s={curves:rt(_v(i)?i.curves:Ev),expression:"",type:"Expression"};return mv(s,t),Cv(e,t).plots.push(s),e}(e,t);case"Symbol":return function(e,t){const i=oo(e),s=SP().getDefaultMultiFieldCurve(),n=Ze(s)?s:Mv,r={curves:rt(_v(i)?i.curves:[n]),symbol:"",type:"Symbol"};return mv(r,t),Cv(e,t).plots.push(r),e}(e,t);default:throw new Error("Unexpected plot type '${type}', not supported currently")}},Get:fv,Delete:pv,Update:function(e,t,i){if(Ze(t.placement)&&!Tv.includes(t.placement))throw new Error(`Unknown placement: ${t.placement}`);const s=t.main?ro:gv(t.index),n=yv(e,s);if(!Xe(n)||Xe(t.type)&&n.type!==t.type)return e;if(Xe(t.visible))return n.visible=t.visible,e;if(n.main&&function(e){const t=U[e.type];return t===U.Symbol||t===U.Expression}(n)){if(t.curves){const i=e=>e.curves[0].style===v[v.Range],[s,r]=[i(n),i(t)],o=!s&&r;s&&!r?e=So(e,{unit:"Day",size:1,spec:"None"}):o&&(e=So(e,{unit:"Intraday",size:100,spec:"PerRange"}))}t.type||(t.type=n.type);const i=n;return Ze(t.precision)?i.precision=t.precision:delete i.precision,Ze(t.showPrevious)&&(e=jn(e,ro,(e=>(e.showPrevious=t.showPrevious,e)))),t.curves?$r(e,t):e}{let n=jn(e,s,(e=>(mv(e,t),e)));const r=fv(n,t,i).find((e=>e.index===t.index));if(!Ze(r))return e;if(!(t.type===U[U.Study]&&Ze(t.placement)&&t.placement!==r.placement))return n;const o=yv(n,s);n=pv(n,{id:"Delete",plots:[{index:t.index,type:t.type}]});const a=bv(n,t.placement);return null!==a&&a.plots.push(o),n}}},Compare:{Update:function(e,t){const i=function(e){return Ze(e.symbols)&&(dP("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=wv,e)))),e.plots?.some((e=>Ze(e.leftScale)))?(dP("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}=be(i,(e=>e.oppositeScale??!1)),{mainPane:r,mainAxis:o}=ao(e);r.alignOnExpirations=t.alignOnExpirations||!1;const a=Nv(r,o),l=e=>![wv,Iv].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;Lv=0;const h=me(xv,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),Mo(e)},Get:function(e,t){const i=Yn(e,Dv),{mainPane:s,mainAxis:n}=ao(e),r=[];for(const e of i){const t=n.plots.includes(e),i=e.type.toLowerCase(),s={curves:rt(e.curves),type:e.type,[i]:e[i],leftScale:!t};r.push(s)}return{plots:r,alignOnExpirations:s.alignOnExpirations}}},Annotation:{Get:function(e,t,i){const s=Yn(e,"..panes").map(((e,t)=>Yn(e,"..axes").map(((e,i)=>Yn(e,".annotations").map((e=>({...e,paneIndex:t,axisIndex:i}))))))).flat(2).map(((e,t)=>({...e,index:t})));return Ze(t.index)&&Number.isFinite(t.index)?t.index<s.length?[s[t.index]]:Ci.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=rt(e);if(t.strip.main){const e=oo(i),t=e.type.toLowerCase();e[t]=Ci.PLACEHOLDER_SYMBOL_NAME}return t.strip.annotations&&(i=Vv(i)),t.strip.compare&&(i=Fv(i)),i=jn(i,".data",(e=>(e.range&&(delete e.range,e.checkRange=!0),e))),i},Outline:function(e,t,i){const s=fv(e,{main:!0},i)[0],n=s.title===Ci.PLACEHOLDER_SYMBOL_NAME,r="Symbol"===s.type,o="Expression"===s.type,a=Xr(s.title);let l=[];return o&&!qr(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:Yn(e,Dv).map((e=>e.symbol)),annotations:Yn(e,"..annotations").map((e=>e.id)),studies:fv(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=jn(e,".display.chart",(e=>(s&&(e.backgroundColor=s),c&&(e.fontSize=c),e)))),n){const e=e=>(e.color=n,e);i=jn(i,".display.xAxis.gridLines",e),i=jn(i,".display.yAxis.gridLines",e),i=jn(i,".display.yAxis.minorGridLines",e)}if(a){const e=e=>(e.dashStyle=a,e);i=jn(i,".display.xAxis.gridLines",e),i=jn(i,".display.yAxis.gridLines",e),i=jn(i,".display.yAxis.minorGridLines",e)}if(r){const e=e=>(e.textColor=r,e);i=jn(i,".display.xAxis",e),i=jn(i,".display.yAxis",e)}if(o){const e=e=>(e.color=o,e);i=jn(i,".display.xAxis.crosshair",e),i=jn(i,".display.yAxis.crosshair",e)}if(u||h){const e=e=>t=>(t.fontSize=e,t);u&&(i=jn(i,".display.xAxis",e(u))),h&&(i=jn(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=>Ci.NULL_OBJECT;if(!0===n){const e=e=>i.onAnnotationModifiedByTool(e,he.Deleted,!1);i.allAnnotations.forEach(e),a=jn(a,`${o}..annotations`,l)}return!0===r&&(a=jn(a,`${o}..plots{.type=="Study"}`,l)),a=Mo(a),a},Previous:{Update:function(e,t,i){return jn(e,Bv,(e=>(at(e,t),e)))},Get:function(e,t,i){return Yn(e,Bv)[0]}},MovePlot:{Update:function(e,t,i){if(!kv(0,t,i).includes(t.targetPane))return e;const s=$v(i,t.index),n=yv(e,gv(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,vv(e)),o=!1;break;case"ExistingBelow":r++;break;case"NewBelow":r++,o=!1,e.panes.splice(r,0,vv(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=Wv(e,s.pane);return u=Wv(u,r),Mo(u)},Get:kv},PinPlot:{Update:function(e,t,i){if(!Uv(0,t,i).includes(t.targetAxis))return e;const s=$v(i,t.index),n=e.panes[s.pane],r=yv(e,gv(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 Mo(Wv(e,s.pane))},Get:Uv}};function zv(e){return"function"==typeof e}function Yv(e,t){const i=Gv[e];if(zv(i))return i;{let e=void 0!==t?i[t]:void 0;if(!zv(e)&&(e=i[Ci.DEFAULT_ACCESSOR_SUBACTION],!zv(e)))throw new Error("Invalid accesor id and/or sub id");return e}}function jv(e,t,i){return Yv(e.id,e.context.id)(t,e.context,i)}function Kv(e){return{id:"MainPlot",context:e}}const qv={keepOldAnnotations:!1,keepNewAnnotations:!0,keepOldCompare:!1,keepNewCompare:!0,keepOldAggregation:!1,keepNewBarWidth:!1},Xv=Symbol.for("__ias__");class Zv{constructor(e=!1){this.headless=e,this.presenter=e?null:new lv(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)console.error("You cannot initialize a headless chart.");else if(this.presenter.initialize(e),Xe(t)){const e="string"==typeof t;e?dP("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(Kv(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(Ze(e)){cr(e,t),lr(e,t);const s=dA(e,!1,t,i,this.presenter);s.isDrawingAnnotation&&this.presenter.view.setCursor(j.Crosshair),this.presenter.activeTool=s,Ue()||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 AP()}get model(){return(this.headless?this._model:this.presenter.getModel())||AP()}asTemplate(e={main:!0,annotations:!1,compare:!1}){return this.change({id:Ci.ACTION_TEMPLATE,context:{strip:e}})}change(...e){const t={chart:this,actions:e.filter((e=>!e[Xv]))};t.actions.length>0&&this.presenter?.notifyHost(No.CH_API_ACTIONS_RECEIVED,t);const i=SP().config.validateInput,s=e.map((e=>i?_o(e,Ci.ACCESSOR_SCHEMA):e));if(1===s.length){const e=s[0];if(e.id===Ci.ACTION_TEMPLATE||e.context.id===Ci.ACTION_GET)return jv(e,this.model,this.presenter);if(!this.headless&&e.id===Ci.ANN_ACTION_ID)return this.presenter.handleAnnotationChange(e.context)}const{yes:n,no:r}=be(s,(e=>e.id===Ci.ACTION_PLOT&&Ze(e.context)&&e.context.id===Ci.ACTION_DELETE)),o=rt(this.model);let a=rt(this.model);const l=r;n.length>0&&l.push({id:Ci.ACTION_PLOT,context:{id:Ci.ACTION_DELETE,plots:n.map((e=>e.context))}}),l.forEach((e=>{if(a=jv(e,a,this.presenter),!Ze(a))throw new Error("Forgot to return model from accessor")})),this.fromModel(a,o)}async fromModel(e,t){const i=_o(e,Ci.CHART_SCHEMA);this.headless?this._model=i:await(this.presenter?.fromModel(i,t))}async load(e,t){const i={...qv,...t};let s=_o(JSON.parse(e),Ci.CHART_SCHEMA);const n=this.model,r=rt(n);if(Ze(n)){if(s=lo(n,s,i.keepNewAnnotations),i.keepNewAnnotations||(s=Vv(s)),i.keepOldAnnotations&&(s=ev(n,s)),i.keepNewCompare||(s=Fv(s)),i.keepOldCompare&&(s=Rv(n,s)),i.keepOldAggregation){const e={id:Ci.ACTION_AGGREGATION,context:n.data.aggregation},t=s.display.density;s=jv(e,s,this.presenter),i.keepNewBarWidth&&Ze(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=AP();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}),Ze(s)){const i=jv({id:"Theme",context:{id:"Get"}},this.model,this.presenter);let n=jv(Kv(s),t,this.presenter);e&&(n=jv({id:"Theme",context:i},n,this.presenter)),this.presenter?.fromModel(n)}}this.clearUndoRedo(),this.presenter?.notifyHost(No.CH_RESET,{elementId:this.elementId})}print(e={}){this.headless||this.presenter.print(e)}getSVGForExport(){dP("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:rv.call(this.presenter,e)}exportImage(e={}){return this.headless?null:ov.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(Ze(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(No.CH_DIDBECOMEACTIVE,{chart:this})}}Tp=n("c15IW");function Jv(e){return e[e.length-1]}function Qv(e){return Wa(Jv(e))?e.pop():void 0}function eP(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 tP(e){for(var t,i,s=[],n=1;n<arguments.length;n++)s[n-1]=arguments[n];var r=null!==(t=Qv(s))&&void 0!==t?t:Ta,o=null!==(i=s[0])&&void 0!==i?i:null,a=s[1]||1/0;return Ka((function(t,i){var s=[],n=!1,l=function(e){var t=e.buffer;e.subs.unsubscribe(),la(s,e),i.next(t),n&&c()},c=function(){if(s){var t=new ca;i.add(t);var n={buffer:[],subs:t};s.push(n),eP(t,r,(function(){return l(n)}),e)}};null!==o&&o>=0?eP(i,r,c,o,!0):n=!0,c();var u=qa(i,(function(e){var t,i,n=s.slice();try{for(var r=Qo(n),o=r.next();!o.done;o=r.next()){var c=o.value,u=c.buffer;u.push(e),a<=u.length&&l(c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}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)}))}function iP(){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 sP(){let e=document.domain;const t=e.split("."),i="__tld"+(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 nP(e,t){!function(e){Object.keys(e).forEach((t=>!Ze(e[t])&&delete e[t]))}(t);return`${e}/?${new URLSearchParams(t).toString()}`}function rP(e,t=""){return nP(atob("aHR0cHM6Ly9iYXJjaGFydHdpZGdldHMud2Vic29sLmJhcmNoYXJ0LmNvbQ=="),{module:atob("YXV0aGVudGljYXRlQ2hhcnRSZWZlcmVy"),secret:t,referer:e})}function oP(e,t){return e+Math.random()*(t-e)}const aP=new Function(atob("Y29uc29sZS5sb2coIlBsZWFzZSBjb250YWN0IEJhcmNoYXJ0IGluIG9yZGVyIHRvIG9idGFpbiB0aGUgbGljZW5zZSBmb3IgdGhlIGNoYXJ0IGNvbXBvbmVudC4iKTsg")),lP=new Function("f",atob("Zi5yZW1vdmVBbGxDaGFydHMoKTsg")),cP=new Function("m",atob("cmV0dXJuIG0gPT09ICJJbnRlcm5hbEZlZWQiIHx8IG0gPT09ICJXaWRnZXQiIHx8IG0gPT09ICJGcmVlV2lkZ2V0IiB8fCBtID09PSAiRGVtb1NpdGUiOw=="));async function uP(e,t){if(t&&!cP(e.mode))return;let i=!1,s=0,n=25;for(;!i&&s<5;){const t=iP()||"FreeWidget"===e.mode,r=t?e.apiKey:"";try{const n=rP(t?"":sP(),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(aP,oP(2e3,3e3)),setTimeout((()=>lP(SP())),oP(4e3,5e3)))}var hP;function dP(e,t="info",i=""){const s=globalThis.console;s[void 0!==s[t]?t:"log"](e,i)}hP=JSON.parse('{"major":2,"minor":312,"patch":3,"prerelease":false}');const pP={environment:"Browser",validateInput:!1,throttleMillis:0,isAlt64:!0,defaultTemplate:`/${Ci.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(cP(this.mode)&&this.knownSite){const{username:n,password:r}=this.credentials||{},o=Ze(n,r),a="timeseries"===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 fP(e,t){const i=SP()?.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 mP=!1,gP=null;function yP(e){const t=e.extensions?.studyProvider;if(!Ze(t))return;const i=t.getFields(),s=t.getStudies(),n=rt(Mn(Ci.CHART_SCHEMA)),r=n.definitions,o=r.studyField.enum,a=r.study.enum;for(const e of i)if(o.includes(e.id))throw new Error(`Field with id ${e.id} already exists`);for(const e of s)if(a.includes(e.id))throw new Error(`Study with id ${e.id} already exists`);var l,c;o.push(...i.map((e=>e.id))),a.push(...s.map((e=>e.id))),l=Ci.CHART_SCHEMA,c=n,Eo.addSchema(l,c),xo(i),xn(s)}function TP(t,i={}){if(mP)throw new Error("You should only call initFeed once during page's lifetime");mP=!0;const s=Object.assign(pP);return at(s,i),Xe(s.logo)&&YT(s.logo,s.logoClickable??!1),yP(s),gP=new t(s),gP.version=function(){const t=e(hP),i=t.prerelease?`-${t.prerelease.identifier}.${t.prerelease.ordinal}`:"";return`${t.major}.${t.minor}.${t.patch}${i}`}(),dP(`%cBarchart Chart version ${gP.version}`,"info","font-size: larger"),gP.cachesData&&(gP.subject?.subscribe(gP.onPerformInternalGc.bind(gP)),e(Tp).subscribe(No.CH_ALL,gP.onChartChanged.bind(gP))),gP}function SP(){return gP}function AP(){return rt(SP()?.template)}function vP(){Xe(gP)&&(gP.shutdown(),mP=!1,gP=null)}function PP(){return new Zv(!0)}function CP(e){const t=PP();return t.load(e),t.change({id:"Outline",context:{id:"Get"}})}function bP(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 EP{constructor(e){this.config=e,this.timeSeriesSource=this.metaDataSource=this.recordSource=null,this.charts=new Map,this.pendingRedraw=new Set,this.ongoingAnimationCallbackId=null,this.drawCharts=this.drawCharts.bind(this),this.template=null,this.cachesData=!1,this._altDataSource=null,this._subject=null}get subject(){return Xe(this._subject)||(this._subject=(new Ya).pipe(tP(Ci.INTERNAL_GC_MILLIS),rl((e=>e.length>0)))),this._subject}setAltDataSource(e){this._altDataSource=e,this.timeSeriesSource=bP(this.timeSeriesSource,"getTimeSeries",e,"symbol"),this.metaDataSource=bP(this.metaDataSource,"getMetaData",e),this.recordSource=bP(this.recordSource,"getRecord",e)}getAltDataSource(){return this._altDataSource}getTimeSeriesDataSource(){if(!Xe(this.timeSeriesSource))throw new Error("No time series source defined");return this.timeSeriesSource}getMetaDataSource(){if(!Xe(this.metaDataSource))throw new Error("No metadata source defined");return this.metaDataSource}getRecordSource(){if(!Xe(this.recordSource))throw new Error("No record source defined");return this.recordSource}async ready(){return Ai.call(this,(async()=>{const e=this instanceof OP||this instanceof _P||this instanceof wP;await uP(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=_o(t,Ci.CHART_SCHEMA),!0}))}getHeadlessChart(){return PP()}fixupRenderTo(e){if(!Xe(e))return null;if(e instanceof HTMLElement)return e;const t=di(`#${e}`);if(Xe(t))return t;const i=[...this.charts.keys()].find((t=>t.id===e));return Xe(i)?i:null}checkChart(e,t){const i=this.fixupRenderTo(e),s=Xe(i)&&this.charts.has(i);return Xe(t)&&t!==s&&dP(`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 Zv;return this.charts.set(i,s),s.initialize(e,t),s}removeChart(e){const t=this.checkChart(e,!0);if(!Xe(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 Xe(t)?this.charts.get(t):null}redraw(e){const t=this.checkChart(e,!0);Xe(this.ongoingAnimationCallbackId)||(this.ongoingAnimationCallbackId=requestAnimationFrame(this.drawCharts)),Xe(t)&&this.pendingRedraw.add(t)}drawCharts(){this.ongoingAnimationCallbackId=null,this.pendingRedraw.forEach((e=>{const t=this.getChart(e);if(!Xe(t?.presenter?.view))return;const i=t.presenter.view;i.isHostElementVisible&&i.draw()})),this.pendingRedraw.clear()}get emptyEntities(){return{metaData:new Set,records:new Set,timeSeries:new Set}}getCacheableEntities(){const e=this.emptyEntities;for(const t of this.charts.values())t.presenter.getCacheableEntities(e);return e.timeSeries.forEach((t=>{Xe(t)&&(Xe(t.record)?e.records.add(t.record):Ze(t.records)&&Object.values(t.records).forEach((t=>e.records.add(t))))})),e}clearCaches(){this.evictUnused(this.emptyEntities)}refreshCaches(){this.getTimeSeriesDataSource().refresh(),je(No.DF_STREAMRECONNECTED,{})}evictUnused(e){this.getMetaDataSource().evictUnused(e.metaData),this.getRecordSource().evictUnused(e.records),this.getTimeSeriesDataSource().evictUnused(e.timeSeries)}onPerformInternalGc(e){const t=this.getCacheableEntities();this.evictUnused(t)}onChartChanged(e,t){e!==No.CH_RECREATED&&e!==No.CH_SHUTDOWN||this.subject.next()}getDefaultMultiFieldCurve(){if(!Xe(this.template))return null;if(!this.knowDefaultCurve){const e=oo(this.template);1===e.curves.length&&Fr(e.curves[0].style)?this.defaultOhlcCurve=rt(e.curves[0]):this.defaultOhlcCurve=null,this.knowDefaultCurve=!0}return this.defaultOhlcCurve}getDefaultAggregation(){return!this.knowDefaultAggregation&&this.template&&(this.defaultAggregation=rt(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.clearCaches(),this.removeAllCharts()}}class _P extends EP{constructor(e){super(e),this.timeSeriesSource=new Hh(!1),this.metaDataSource=new qi,this.recordSource=new Uc}}class MP extends EP{constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new Hh(!0),this.metaDataSource=new qi,this.recordSource=new Uc}}const LP=["drazen.dotlic@barchart.com","princec","b.hebert24@barchart.com"];class OP extends EP{lastStreamingTimestamp=null;_isActivelyStreaming=null;needToResubscribe=!1;constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new Hh(!0),this.metaDataSource=new Xi,this.recordSource=new Wc,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,Xe(e)&&this.initializeStreaming()}addChart(e,t=null){return this.needToResubscribe&&this.initializeStreaming(),super.addChart(e,t)}set isActivelyStreaming(e){Xe(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&&LP.includes(this.connection._username)&&dP(`[chart] Connection ${e}, last timestamp ${this.lastStreamingTimestamp}`)}onEvents({event:e}){e===Ci.BC_EVENT_DISCONNECTED||e===Ci.BC_EVENT_FEED_PAUSED?(this.debug(e),this.isActivelyStreaming=!1):e!==Ci.BC_EVENT_LOGGED_IN&&e!==Ci.BC_EVENT_FEED_RESUMED||(this.debug(e),this.isActivelyStreaming=!0)}shutdown(){super.shutdown(),Xe(this._connection)&&(this.connection.off("timestamp",this.onTimestamp),this.connection.off("events",this.onEvents),this.resetStreamingState(),this.connection.disconnect(),this.connection=null)}}class wP extends EP{_listener=null;_client=null;_subscriptions=new Map;_marketIdToSymbol=new Map;_exchanges=[];constructor(e){super(e),this.cachesData=!0,this.timeSeriesSource=new Hh(!0),this.metaDataSource=new Zi,this.recordSource=new $c}set listener(e){Xe(e)&&(this._listener=e,this._listener.onConnected=this.onConnected.bind(this),this._listener.onMessage=this.onMessage.bind(this))}get client(){return this._client}set client(e){Xe(e)&&(this._client=e)}get exchanges(){return this._exchanges}async ready(){await super.ready();const e=await(this.client?.connection);return this._exchanges=await(e?.getExchanges())??[],!Xe(e)}subscribe(e){if(this._subscriptions.has(e)||!Xe(this._client))return;const t=this._client.subscribe(1,5,0,[e],null,null,null);this._subscriptions.set(e,t)}unsubscribe(e){if(!this._subscriptions.has(e)||!Xe(this._client))return;const t=this._subscriptions.get(e);this._client.unsubscribe(t),this._subscriptions.delete(e)}shutdown(){super.shutdown(),Xe(this._client)&&this._client.dispose(),this._client=this._listener=null}onConnected(e){this.refreshCaches()}get ofRecordSource(){return this.recordSource}findSymbolByMarketId(e){const t=e?.marketId.toNumber();return Xe(t)&&this._marketIdToSymbol.has(t)?this._marketIdToSymbol.get(t):null}onMessage(e){const t=e.subscriptionResponse;t&&this._subscriptions.has(t.symbol)&&this._marketIdToSymbol.set(t.marketId.toNumber(),t.symbol);const i=e.marketSnapshot;let s=this.findSymbolByMarketId(i);Xe(i)&&null!==s&&this.ofRecordSource.onSnapshot(i,s);const n=e.marketUpdate;s=this.findSymbolByMarketId(n),Xe(n)&&null!==s&&this.ofRecordSource.onUpdate(n,s)}}const IP=e(Tp=n("c15IW"));export{IP as PubSub,TP as initFeed,SP as getFeed,vP as shutdownFeed,CP as getChartOutline,EP as BaseDataFeed,_P as BarchartSiteDataFeed,MP as MiniWidgetDataFeed,OP as MarketDataFeed,wP as OpenFeed,uu as OHLCDataPointBuilder,Xr as parseExpression,Zr as evaluateExpression,Ym as ExpressionSeries,zm as makeExpression,Mh as ContainerWrapperTimeSeries,Hi as formatPriceWithDecimals,Vi as getCombinedMetaData,kc as BaseRecordSource,ko as EmptyRecord,Oo as Field,Do as Fields,du as TimeSeriesContainer,yp as TimeSeriesQuery,Dr as Aggregation,Ai as asyncReady,ii as hasOpenInterest,Hu as optionValueToDate,yt as generateUid,$n as getTaxonomies,Fn as doesStudyExist,Hn as getAnnotationTraits,yA as getStudyOptions,vp as StudySeries,Ap as makeHelperField,Xg as makeStudy,by as convertSeries,Ey as mapSeries,Qg as movAvg,ey as movExp,ty as movSmo,iy as movWei,sy as movHul,Py as linReg,cy as trueRange,dy as typical,py as roc,gy as stdDev,No as Topics,ys as getLightness,se as ChunkPart,$ as SeriesKind,E as AggregationSpec,C as AggregationUnit,p as ExpressionRecompute,m as ExpressionNoDataApproach,h as ExpressionMissingBar,O as FieldValueType,D as FieldCategory,I as FieldFormat,ZA as CustomEventPopup,yi as appendDOMElement,pi as styleDOMElement,fi as setAttributesDOMElement};
|
|
2
2
|
//# sourceMappingURL=barchart.chart.js.map
|