ohlcv-indicators 3.5.56 → 3.5.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var OHLCV_INDICATORS;(()=>{"use strict";var t={d:(r,e)=>{for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},o:(t,r)=>Object.prototype.hasOwnProperty.call(t,r),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},r={};(()=>{t.r(r),t.d(r,{default:()=>Bn});var e=function(t,r,e){if(0===e.length)return!1;for(var n=t.verticalOhlcv,o=!0,i=0;i<e.length;i++){var a=e[i];if(!n.hasOwnProperty(a)){o=!1;break}var l=n[a][r];if(null==l||Number.isNaN(l)){o=!1;break}}return o};function n(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=o(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return l=t.done,t},e:function(t){u=!0,a=t},f:function(){try{l||null==e.return||e.return()}finally{if(u)throw a}}}}function o(t,r){if(t){if("string"==typeof t)return i(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var a=function(t,r){if(!Array.isArray(t))throw new Error('Property "inputParams" must be an "Array" or "Set".');var e,o=n(t);try{for(o.s();!(e=o.n()).done;){var i,a=n(e.value.params);try{for(a.s();!(i=a.n()).done;){var l=i.value;if("number"==typeof l&&l>r)throw console.log(l,r),new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.")}}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}},l=function(t){if(!0===t.isComputed)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" or "getData" methods are called.')},u=function(t,r,e){if(!Array.isArray(t))throw new Error('Param "'.concat(r,'" must be an array in "').concat(e,'".'));return!0},c=function(t,r,e){if(t instanceof Object==0)throw new Error('Param "'.concat(r,'" must be an object in "').concat(e,'".'));return!0},s=function(t,r,e,n){if(u(t,"arrayOptions","".concat(n,".").concat(e,".validateArrayOptions")),!t.includes(r.toString()))throw new Error('Param "'.concat(e,'" must be any of the following values [').concat(t.join(", "),'] in "').concat(n,'".'));return!0},f=function(t,r,e){if("boolean"!=typeof t)throw new Error('Param "'.concat(r,'" must be an boolean in "').concat(e,'".'));return!0},p=function(t,r,e,n){c(r,"options","".concat(n,".").concat(e,".validateNumber"));var o=r.allowDecimals,i=void 0!==o&&o,a=r.min,l=r.max,u=i?"number":"integer";if("number"!=typeof t||!1===i&&!Number.isInteger(t))throw new Error('Param "'.concat(e,'" must be an ').concat(u,' in "').concat(n,'".'));if(void 0!==a&&"number"!=typeof a)throw new Error('Param "min" must be a valid '.concat(u,' (if provided) in "').concat(n,".").concat(e,'.validateNumber".'));if(void 0!==l&&"number"!=typeof l)throw new Error('Param "max" must be a valid '.concat(u,' (if provided) in "').concat(n,".").concat(e,'.validateNumber".'));if(void 0!==a&&void 0!==l&&a>=l)throw new Error('Param "min" must be less than "max" in "'.concat(n,".").concat(e,'.validateNumber".'));if(void 0!==a&&t<a)throw new Error('Param "'.concat(e,'" must be an ').concat(u," ≥ ").concat(a,' in "').concat(n,'".'));if(void 0!==l&&t>l)throw new Error('Param "'.concat(e,'" must be an ').concat(u," ≤ ").concat(l,' in "').concat(n,'".'));return!0},y=function(t,r,e){if(u(t,r,e),2!==t.length)throw new Error('Invalid "'.concat(r,'" array length: expected 2 items, but got ').concat(t.length,' in "').concat(e,".").concat(r,'".'));var n,i,a=(i=2,function(t){if(Array.isArray(t))return t}(n=t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(n,i)||o(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=a[0],c=a[1];if(p(l,{min:-100,max:c,allowDecimals:!1},"min",e),p(c,{min:l,max:100,allowDecimals:!1},"max",e),l===c)throw new Error('Invalid "min" can not be equal to "max" property in "'.concat(e,".").concat(r,'".'));return!0},h=function(t,r,e){if("string"!=typeof t||!t.length)throw new Error('Invalid "'.concat(r,'" property in "').concat(e,'". Only strings are accepted.'));return!0},v=1e6,d="[big.js] ",m=d+"Invalid ",b=m+"decimal places",g=m+"rounding mode",w=d+"Division by zero",S={},O=void 0,A=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function j(t,r,e,n){var o=t.c;if(e===O&&(e=t.constructor.RM),0!==e&&1!==e&&2!==e&&3!==e)throw Error(g);if(r<1)n=3===e&&(n||!!o[0])||0===r&&(1===e&&o[0]>=5||2===e&&(o[0]>5||5===o[0]&&(n||o[1]!==O))),o.length=1,n?(t.e=t.e-r+1,o[0]=1):o[0]=t.e=0;else if(r<o.length){if(n=1===e&&o[r]>=5||2===e&&(o[r]>5||5===o[r]&&(n||o[r+1]!==O||1&o[r-1]))||3===e&&(n||!!o[0]),o.length=r,n)for(;++o[--r]>9;)if(o[r]=0,0===r){++t.e,o.unshift(1);break}for(r=o.length;!o[--r];)o.pop()}return t}function N(t,r,e){var n=t.e,o=t.c.join(""),i=o.length;if(r)o=o.charAt(0)+(i>1?"."+o.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)o="0"+o;o="0."+o}else if(n>0)if(++n>i)for(n-=i;n--;)o+="0";else n<i&&(o=o.slice(0,n)+"."+o.slice(n));else i>1&&(o=o.charAt(0)+"."+o.slice(1));return t.s<0&&e?"-"+o:o}function P(t){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(t)}function x(t){var r="function"==typeof Map?new Map:void 0;return x=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(r){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return function(t,r,e){if(_())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,r);var o=new(t.bind.apply(t,n));return e&&k(o,e.prototype),o}(t,arguments,E(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),k(e,t)},x(t)}function _(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(_=function(){return!!t})()}function k(t,r){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},k(t,r)}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}S.abs=function(){var t=new this.constructor(this);return t.s=1,t},S.cmp=function(t){var r,e=this,n=e.c,o=(t=new e.constructor(t)).c,i=e.s,a=t.s,l=e.e,u=t.e;if(!n[0]||!o[0])return n[0]?i:o[0]?-a:0;if(i!=a)return i;if(r=i<0,l!=u)return l>u^r?1:-1;for(a=(l=n.length)<(u=o.length)?l:u,i=-1;++i<a;)if(n[i]!=o[i])return n[i]>o[i]^r?1:-1;return l==u?0:l>u^r?1:-1},S.div=function(t){var r=this,e=r.constructor,n=r.c,o=(t=new e(t)).c,i=r.s==t.s?1:-1,a=e.DP;if(a!==~~a||a<0||a>v)throw Error(b);if(!o[0])throw Error(w);if(!n[0])return t.s=i,t.c=[t.e=0],t;var l,u,c,s,f,p=o.slice(),y=l=o.length,h=n.length,d=n.slice(0,l),m=d.length,g=t,S=g.c=[],A=0,N=a+(g.e=r.e-t.e)+1;for(g.s=i,i=N<0?0:N,p.unshift(0);m++<l;)d.push(0);do{for(c=0;c<10;c++){if(l!=(m=d.length))s=l>m?1:-1;else for(f=-1,s=0;++f<l;)if(o[f]!=d[f]){s=o[f]>d[f]?1:-1;break}if(!(s<0))break;for(u=m==l?o:p;m;){if(d[--m]<u[m]){for(f=m;f&&!d[--f];)d[f]=9;--d[f],d[m]+=10}d[m]-=u[m]}for(;!d[0];)d.shift()}S[A++]=s?c:++c,d[0]&&s?d[m]=n[y]||0:d=[n[y]]}while((y++<h||d[0]!==O)&&i--);return S[0]||1==A||(S.shift(),g.e--,N--),A>N&&j(g,N,e.RM,d[0]!==O),g},S.eq=function(t){return 0===this.cmp(t)},S.gt=function(t){return this.cmp(t)>0},S.gte=function(t){return this.cmp(t)>-1},S.lt=function(t){return this.cmp(t)<0},S.lte=function(t){return this.cmp(t)<1},S.minus=S.sub=function(t){var r,e,n,o,i=this,a=i.constructor,l=i.s,u=(t=new a(t)).s;if(l!=u)return t.s=-u,i.plus(t);var c=i.c.slice(),s=i.e,f=t.c,p=t.e;if(!c[0]||!f[0])return f[0]?t.s=-u:c[0]?t=new a(i):t.s=1,t;if(l=s-p){for((o=l<0)?(l=-l,n=c):(p=s,n=f),n.reverse(),u=l;u--;)n.push(0);n.reverse()}else for(e=((o=c.length<f.length)?c:f).length,l=u=0;u<e;u++)if(c[u]!=f[u]){o=c[u]<f[u];break}if(o&&(n=c,c=f,f=n,t.s=-t.s),(u=(e=f.length)-(r=c.length))>0)for(;u--;)c[r++]=0;for(u=r;e>l;){if(c[--e]<f[e]){for(r=e;r&&!c[--r];)c[r]=9;--c[r],c[e]+=10}c[e]-=f[e]}for(;0===c[--u];)c.pop();for(;0===c[0];)c.shift(),--p;return c[0]||(t.s=1,c=[p=0]),t.c=c,t.e=p,t},S.mod=function(t){var r,e=this,n=e.constructor,o=e.s,i=(t=new n(t)).s;if(!t.c[0])throw Error(w);return e.s=t.s=1,r=1==t.cmp(e),e.s=o,t.s=i,r?new n(e):(o=n.DP,i=n.RM,n.DP=n.RM=0,e=e.div(t),n.DP=o,n.RM=i,this.minus(e.times(t)))},S.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},S.plus=S.add=function(t){var r,e,n,o=this,i=o.constructor;if(t=new i(t),o.s!=t.s)return t.s=-t.s,o.minus(t);var a=o.e,l=o.c,u=t.e,c=t.c;if(!l[0]||!c[0])return c[0]||(l[0]?t=new i(o):t.s=o.s),t;if(l=l.slice(),r=a-u){for(r>0?(u=a,n=c):(r=-r,n=l),n.reverse();r--;)n.push(0);n.reverse()}for(l.length-c.length<0&&(n=c,c=l,l=n),r=c.length,e=0;r;l[r]%=10)e=(l[--r]=l[r]+c[r]+e)/10|0;for(e&&(l.unshift(e),++u),r=l.length;0===l[--r];)l.pop();return t.c=l,t.e=u,t},S.pow=function(t){var r=this,e=new r.constructor("1"),n=e,o=t<0;if(t!==~~t||t<-1e6||t>1e6)throw Error(m+"exponent");for(o&&(t=-t);1&t&&(n=n.times(r)),t>>=1;)r=r.times(r);return o?e.div(n):n},S.prec=function(t,r){if(t!==~~t||t<1||t>v)throw Error(m+"precision");return j(new this.constructor(this),t,r)},S.round=function(t,r){if(t===O)t=0;else if(t!==~~t||t<-v||t>v)throw Error(b);return j(new this.constructor(this),t+this.e+1,r)},S.sqrt=function(){var t,r,e,n=this,o=n.constructor,i=n.s,a=n.e,l=new o("0.5");if(!n.c[0])return new o(n);if(i<0)throw Error(d+"No square root");0===(i=Math.sqrt(n+""))||i===1/0?((r=n.c.join("")).length+a&1||(r+="0"),a=((a+1)/2|0)-(a<0||1&a),t=new o(((i=Math.sqrt(r))==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+a)):t=new o(i+""),a=t.e+(o.DP+=4);do{e=t,t=l.times(e.plus(n.div(e)))}while(e.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return j(t,(o.DP-=4)+t.e+1,o.RM)},S.times=S.mul=function(t){var r,e=this,n=e.constructor,o=e.c,i=(t=new n(t)).c,a=o.length,l=i.length,u=e.e,c=t.e;if(t.s=e.s==t.s?1:-1,!o[0]||!i[0])return t.c=[t.e=0],t;for(t.e=u+c,a<l&&(r=o,o=i,i=r,c=a,a=l,l=c),r=new Array(c=a+l);c--;)r[c]=0;for(u=l;u--;){for(l=0,c=a+u;c>u;)l=r[c]+i[u]*o[c-u-1]+l,r[c--]=l%10,l=l/10|0;r[c]=l}for(l?++t.e:r.shift(),u=r.length;!r[--u];)r.pop();return t.c=r,t},S.toExponential=function(t,r){var e=this,n=e.c[0];if(t!==O){if(t!==~~t||t<0||t>v)throw Error(b);for(e=j(new e.constructor(e),++t,r);e.c.length<t;)e.c.push(0)}return N(e,!0,!!n)},S.toFixed=function(t,r){var e=this,n=e.c[0];if(t!==O){if(t!==~~t||t<0||t>v)throw Error(b);for(t=t+(e=j(new e.constructor(e),t+e.e+1,r)).e+1;e.c.length<t;)e.c.push(0)}return N(e,!1,!!n)},S[Symbol.for("nodejs.util.inspect.custom")]=S.toJSON=S.toString=function(){var t=this,r=t.constructor;return N(t,t.e<=r.NE||t.e>=r.PE,!!t.c[0])},S.toNumber=function(){var t=Number(N(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(d+"Imprecise conversion");return t},S.toPrecision=function(t,r){var e=this,n=e.constructor,o=e.c[0];if(t!==O){if(t!==~~t||t<1||t>v)throw Error(m+"precision");for(e=j(new n(e),t,r);e.c.length<t;)e.c.push(0)}return N(e,t<=e.e||e.e<=n.NE||e.e>=n.PE,!!o)},S.valueOf=function(){var t=this,r=t.constructor;if(!0===r.strict)throw Error(d+"valueOf disallowed");return N(t,t.e<=r.NE||t.e>=r.PE,!0)},function t(){function r(e){var n=this;if(!(n instanceof r))return e===O?t():new r(e);if(e instanceof r)n.s=e.s,n.e=e.e,n.c=e.c.slice();else{if("string"!=typeof e){if(!0===r.strict&&"bigint"!=typeof e)throw TypeError(m+"value");e=0===e&&1/e<0?"-0":String(e)}!function(t,r){var e,n,o;if(!A.test(r))throw Error(m+"number");for(t.s="-"==r.charAt(0)?(r=r.slice(1),-1):1,(e=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(e<0&&(e=n),e+=+r.slice(n+1),r=r.substring(0,n)):e<0&&(e=r.length),o=r.length,n=0;n<o&&"0"==r.charAt(n);)++n;if(n==o)t.c=[t.e=0];else{for(;o>0&&"0"==r.charAt(--o););for(t.e=e-n-1,t.c=[],e=0;n<=o;)t.c[e++]=+r.charAt(n++)}}(n,e)}n.constructor=r}return r.prototype=S,r.DP=20,r.RM=1,r.NE=-7,r.PE=21,r.strict=!1,r.roundDown=0,r.roundHalfUp=1,r.roundHalfEven=2,r.roundUp=3,r}();var T=function(t){function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Not enough data";return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r),t=function(t,r,e){return r=E(r),function(t,r){if(r&&("object"==P(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,_()?Reflect.construct(r,e||[],E(t).constructor):r.apply(t,e))}(this,r,[e]),Object.setPrototypeOf(t,(this instanceof r?this.constructor:void 0).prototype),t.name="NotEnoughDataError",t}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&k(t,r)}(r,t),e=r,Object.defineProperty(e,"prototype",{writable:!1}),e;var e}(x(Error));function C(t){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(t)}function M(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,D(n.key),n)}}function I(t,r,e){return(r=D(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function D(t){var r=function(t,r){if("object"!=C(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==C(r)?r:r+""}var R=function(){return t=function t(){(function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),I(this,"previousHighest",void 0),I(this,"highest",void 0),I(this,"previousLowest",void 0),I(this,"lowest",void 0),I(this,"previousResult",void 0),I(this,"result",void 0)},(r=[{key:"isStable",get:function(){return void 0!==this.result}},{key:"getResult",value:function(){if(void 0===this.result)throw new T;return this.result}},{key:"setResult",value:function(t,r){return r&&(this.highest=this.previousHighest,this.lowest=this.previousLowest,this.result=this.previousResult),void 0===this.highest?this.highest=t:t>this.highest?(this.previousHighest=this.highest,this.highest=t):this.previousHighest=this.highest,void 0===this.lowest?this.lowest=t:t<this.lowest?(this.previousLowest=this.lowest,this.lowest=t):this.previousLowest=this.lowest,this.previousResult=this.result,this.result=t}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&M(t.prototype,r),e&&M(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,e}();function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function F(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,V(n.key),n)}}function B(t,r,e){return r=U(r),function(t,r){if(r&&("object"==L(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,z()?Reflect.construct(r,e||[],U(t).constructor):r.apply(t,e))}function z(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(z=function(){return!!t})()}function U(t){return U=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},U(t)}function Y(t,r){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Y(t,r)}function V(t){var r=function(t,r){if("object"!=L(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==L(r)?r:r+""}var q=function(t){function r(t){var e,n,o,i;return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r),n=e=B(this,r),i=void 0,(o=V(o="interval"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,e.interval=t,e}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&Y(t,r)}(r,t),e=r,(n=[{key:"updates",value:function(t){var r=this;return t.forEach((function(t){return r.update(t)})),this.result}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&F(e.prototype,n),o&&F(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(R);function G(t){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(t)}function H(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,W(n.key),n)}}function $(t,r,e){return r=K(r),function(t,r){if(r&&("object"==G(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,X()?Reflect.construct(r,e||[],K(t).constructor):r.apply(t,e))}function X(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(X=function(){return!!t})()}function K(t){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},K(t)}function J(t,r){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},J(t,r)}function W(t){var r=function(t,r){if("object"!=G(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=G(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==G(r)?r:r+""}var Z=function(t){function r(){var t,e,n,o;!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r);for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return e=t=$(this,r,[].concat(a)),o=[],(n=W(n="prices"))in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,t}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&J(t,r)}(r,t),e=r,n=[{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.prices.length&&r?this.prices[this.prices.length-1]=t:this.prices.push(t),this.prices.length>this.interval&&this.prices.shift(),this.prices.length===this.interval){var e=this.prices.reduce((function(t,r){return t+r}),0);return this.setResult(e/this.prices.length,r)}}}],n&&H(e.prototype,n),o&&H(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(q);function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function tt(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,at(n.key),n)}}function rt(t,r,e){return r=nt(r),function(t,r){if(r&&("object"==Q(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,et()?Reflect.construct(r,e||[],nt(t).constructor):r.apply(t,e))}function et(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(et=function(){return!!t})()}function nt(t){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nt(t)}function ot(t,r){return ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},ot(t,r)}function it(t,r,e){return(r=at(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function at(t){var r=function(t,r){if("object"!=Q(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Q(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Q(r)?r:r+""}var lt=function(t){function r(t){var e;return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r),it(e=rt(this,r),"interval",void 0),it(e,"indicator",void 0),it(e,"smoothingFactor",void 0),e.interval=t,e.indicator=new Z(t),e.smoothingFactor=1/e.interval,e}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&ot(t,r)}(r,t),e=r,n=[{key:"updates",value:function(t){var r=this;return t.forEach((function(t){return r.update(t)})),this.result}},{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=this.indicator.update(t);if(r&&void 0!==this.previousResult){var n=(t-this.previousResult)*this.smoothingFactor;return this.setResult(n+this.previousResult,r)}if(!r&&void 0!==this.result){var o=(t-this.result)*this.smoothingFactor;return this.setResult(o+this.result,r)}if(void 0===this.result&&void 0!==e)return this.setResult(e,r)}}],n&&tt(e.prototype,n),o&&tt(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(R);function ut(t){return t.length?t.reduce((function(t,r){return t+r}),0)/t.length:0}function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function st(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,dt(n.key),n)}}function ft(t,r,e){return r=yt(r),function(t,r){if(r&&("object"==ct(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,pt()?Reflect.construct(r,e||[],yt(t).constructor):r.apply(t,e))}function pt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(pt=function(){return!!t})()}function yt(t){return yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yt(t)}function ht(t,r){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},ht(t,r)}function vt(t,r,e){return(r=dt(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function dt(t){var r=function(t,r){if("object"!=ct(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ct(r)?r:r+""}var mt=function(t){function r(){var t;!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r);for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return vt(t=ft(this,r,[].concat(n)),"previousCandle",void 0),vt(t,"twoPreviousCandle",void 0),t}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&ht(t,r)}(r,t),e=r,n=[{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=t.high,n=t.low,o=e-n;if(this.previousCandle&&r&&(this.previousCandle=this.twoPreviousCandle),this.previousCandle){var i=Math.abs(e-this.previousCandle.close),a=Math.abs(n-this.previousCandle.close);return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(Math.max(o,i,a),r)}return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(o,r)}}],n&&st(e.prototype,n),o&&st(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(R);function bt(t){return bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bt(t)}function gt(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Nt(n.key),n)}}function wt(t,r,e){return r=Ot(r),function(t,r){if(r&&("object"==bt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,St()?Reflect.construct(r,e||[],Ot(t).constructor):r.apply(t,e))}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(St=function(){return!!t})()}function Ot(t){return Ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ot(t)}function At(t,r){return At=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},At(t,r)}function jt(t,r,e){return(r=Nt(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Nt(t){var r=function(t,r){if("object"!=bt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bt(r)?r:r+""}var Pt=function(t){function r(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r),jt(e=wt(this,r),"interval",void 0),jt(e,"tr",void 0),jt(e,"smoothing",void 0),e.interval=t,e.tr=new mt,e.smoothing=new n(t),e}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&At(t,r)}(r,t),e=r,n=[{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=this.tr.update(t,r);if(this.smoothing.update(e,r),this.smoothing.isStable)return this.setResult(this.smoothing.getResult(),r)}}],n&&gt(e.prototype,n),o&&gt(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(R);function xt(t){return xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt(t)}function _t(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Et(n.key),n)}}function kt(t,r,e){return(r=Et(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Et(t){var r=function(t,r){if("object"!=xt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xt(r)?r:r+""}var Tt=function(){return t=function t(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;(function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),kt(this,"interval",void 0),kt(this,"deviationMultiplier",void 0),kt(this,"prices",[]),kt(this,"result",void 0),this.interval=r,this.deviationMultiplier=e},(r=[{key:"update",value:function(t){if(this.prices.push(t),this.prices.length>this.interval){this.prices.shift();var r=ut(this.prices),e=function(t,r){var e=r||ut(t),n=ut(t.map((function(t){return t-e})).map((function(t){return t*t})));return Math.sqrt(n)}(this.prices,r);return this.result={lower:r-e*this.deviationMultiplier,middle:r,upper:r+e*this.deviationMultiplier}}}},{key:"getResult",value:function(){if(void 0===this.result)throw new T;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&_t(t.prototype,r),e&&_t(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,e}();function Ct(t){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ct(t)}function Mt(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Bt(n.key),n)}}function It(t,r,e){return r=Rt(r),function(t,r){if(r&&("object"==Ct(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Dt()?Reflect.construct(r,e||[],Rt(t).constructor):r.apply(t,e))}function Dt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dt=function(){return!!t})()}function Rt(t){return Rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rt(t)}function Lt(t,r){return Lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Lt(t,r)}function Ft(t,r,e){return(r=Bt(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Bt(t){var r=function(t,r){if("object"!=Ct(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ct(r)?r:r+""}var zt=function(t){function r(t){var e;return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r),Ft(e=It(this,r,[t]),"interval",void 0),Ft(e,"pricesCounter",0),Ft(e,"weightFactor",void 0),e.interval=t,e.weightFactor=2/(e.interval+1),e}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&Lt(t,r)}(r,t),e=r,n=[{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return r?r&&0===this.pricesCounter&&this.pricesCounter++:this.pricesCounter++,r&&void 0!==this.previousResult?this.setResult(t*this.weightFactor+this.previousResult*(1-this.weightFactor),r):this.setResult(t*this.weightFactor+(void 0!==this.result?this.result:t)*(1-this.weightFactor),r)}},{key:"getResult",value:function(){if(this.pricesCounter<this.interval)throw new T;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&Mt(e.prototype,n),o&&Mt(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(q);function Ut(t){return Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ut(t)}function Yt(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qt(n.key),n)}}function Vt(t,r,e){return(r=qt(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function qt(t){var r=function(t,r){if("object"!=Ut(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ut(r)?r:r+""}var Gt=function(){return t=function t(r,e,n){(function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),Vt(this,"short",void 0),Vt(this,"long",void 0),Vt(this,"signal",void 0),Vt(this,"prices",[]),Vt(this,"result",void 0),this.short=r,this.long=e,this.signal=n},r=[{key:"getResult",value:function(){if(void 0===this.result)throw new T;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.prices.length&&r?this.prices[this.prices.length-1]=t:this.prices.push(t);var e=this.short.update(t,r),n=this.long.update(t,r);if(this.prices.length>this.long.interval&&this.prices.shift(),this.prices.length===this.long.interval){var o=e-n,i=this.signal.update(o,r);return this.result={histogram:o-i,macd:o,signal:i}}}}],r&&Yt(t.prototype,r),e&&Yt(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,e}();function Ht(t){return Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ht(t)}function $t(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Qt(n.key),n)}}function Xt(t,r,e){return r=Jt(r),function(t,r){if(r&&("object"==Ht(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Kt()?Reflect.construct(r,e||[],Jt(t).constructor):r.apply(t,e))}function Kt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Kt=function(){return!!t})()}function Jt(t){return Jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jt(t)}function Wt(t,r){return Wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Wt(t,r)}function Zt(t,r,e){return(r=Qt(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Qt(t){var r=function(t,r){if("object"!=Ht(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ht(r)?r:r+""}var tr=function(t){function r(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r),Zt(e=Xt(this,r),"interval",void 0),Zt(e,"previousPrices",[]),Zt(e,"avgGain",void 0),Zt(e,"avgLoss",void 0),Zt(e,"maxValue",100),e.interval=t,e.avgGain=new n(e.interval),e.avgLoss=new n(e.interval),e}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&Wt(t,r)}(r,t),e=r,n=[{key:"update",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.previousPrices.length&&r?this.previousPrices[this.previousPrices.length-1]=t:this.previousPrices.push(t),!(this.previousPrices.length<2)){var e=t,n=this.previousPrices[this.previousPrices.length-2];if(e>n?(this.avgLoss.update(0,r),this.avgGain.update(t-n,r)):(this.avgLoss.update(n-e,r),this.avgGain.update(0,r)),this.avgGain.isStable){var o=this.avgLoss.getResult();if(0===o)return this.setResult(100,r);var i=this.avgGain.getResult()/o;return this.setResult(this.maxValue-this.maxValue/(i+1),r)}}}}],n&&$t(e.prototype,n),o&&$t(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(R);function rr(t){return rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rr(t)}function er(t){return function(t){if(Array.isArray(t))return nr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(t){if("string"==typeof t)return nr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?nr(t,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function or(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ar(n.key),n)}}function ir(t,r,e){return(r=ar(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function ar(t){var r=function(t,r){if("object"!=rr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=rr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==rr(r)?r:r+""}var lr=function(){return t=function t(r,e,n){(function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")})(this,t),ir(this,"n",void 0),ir(this,"m",void 0),ir(this,"p",void 0),ir(this,"candles",[]),ir(this,"result",void 0),ir(this,"periodM",void 0),ir(this,"periodP",void 0),this.n=r,this.m=e,this.p=n,this.periodM=new Z(e),this.periodP=new Z(n)},(r=[{key:"getResult",value:function(){if(void 0===this.result)throw new T;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){if(this.candles.push(t),this.candles.length>this.n&&this.candles.shift(),this.candles.length===this.n){var r=Math.max.apply(Math,er(this.candles.map((function(t){return t.high})))),e=Math.min.apply(Math,er(this.candles.map((function(t){return t.low})))),n=r-e,o=100*(t.close-e);o/=0===n?1:n;var i=this.periodM.update(o),a=i&&this.periodP.update(i);if(void 0!==i&&void 0!==a)return this.result={stochD:a,stochK:i}}}}])&&or(t.prototype,r),e&&or(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,e}();function ur(t){return ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ur(t)}function cr(t){return function(t){if(Array.isArray(t))return sr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(t){if("string"==typeof t)return sr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?sr(t,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function fr(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=ur(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ur(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ur(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function pr(t){return pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pr(t)}function yr(t){return function(t){if(Array.isArray(t))return hr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(t){if("string"==typeof t)return hr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?hr(t,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function vr(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=pr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=pr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pr(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var dr={ema:zt,sma:Z},mr=function(t,r,e,n,o){var i=o.target,a=o.lag,l=t.verticalOhlcv,u=t.instances,c=t.priceBased,s="close"!==i?"_".concat(i):"",f="".concat(e,"_").concat(n).concat(s);if(0===r){var p=t.len;if(!l.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for ").concat(e,"."));u[f]=new dr[e](n),l[f]=new Float64Array(p).fill(NaN),c.has(i)&&c.add(f),a>0&&t.lag([f],a)}var y=l[i][r],h=u[f];h.update(y);var v=NaN;try{v=h.getResult()}catch(t){}return t.pushToMain({index:r,key:f,value:v}),!0};function br(t){return br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},br(t)}function gr(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function wr(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=br(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=br(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==br(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Sr(t,r){if(t){if("string"==typeof t)return Or(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Or(t,r):void 0}}function Or(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function Ar(t){return function(t){if(Array.isArray(t))return jr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(t){if("string"==typeof t)return jr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?jr(t,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function Nr(t){return Nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nr(t)}function Pr(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=Nr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Nr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Nr(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function xr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var _r="close";function kr(t){return function(t){if(Array.isArray(t))return Cr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Tr(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Er(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Tr(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}function Tr(t,r){if(t){if("string"==typeof t)return Cr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Cr(t,r):void 0}}function Cr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function Mr(t){return Mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mr(t)}function Ir(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function Dr(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=Mr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Mr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mr(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Rr(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return Lr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Lr(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}function Lr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var Fr="close";function Br(t){return Br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Br(t)}function zr(t){return zr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zr(t)}function Ur(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return Yr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Yr(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var Vr=function(t,r){if("string"!=typeof t)throw new Error("addPrecisionExact expects a string when precision=true");var e="-"===t.charAt(0),n=Ur((e?t.slice(1):t).split("."),2),o=n[0],i=n[1],a=void 0===i?"":i,l=String(r),u=1===r?0:l.length-1,c=a.padEnd(u,"0").slice(0,u),s=parseInt(o+c||"0",10);return e&&(s=-s),s};function qr(t){return qr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qr(t)}var Gr={number:function(t){return t},numberCleanString:function(t){return Number(t)},precisionNumberCleanString:function(t,r){return Vr(t,r)}},Hr=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n="number"==typeof t&&!Number.isNaN(t),o="string"==typeof t&&/^-?\d+(\.\d+)?$/.test(t);if(!0===e){if(o)return"precisionNumberCleanString";if(r)throw new Error("Invalid number forma");return qr(t)}if(n)return"number";if(o)return"numberCleanString";if(r)throw new TypeError("Invalid input: expected a number or numeric string");return qr(t)};function $r(t){return $r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$r(t)}var Xr={string:function(t){return t.toISOString()},milliseconds:function(t){return t.getTime()},seconds:function(t){return t.getTime()/1e3},object:function(t){return t}},Kr={dateObject:function(t){return t},dateMilliseconds:function(t){return new Date(t)},dateSeconds:function(t){return new Date(1e3*t)},dateIncompleteDayString:function(t){return new Date("".concat(t," 00:00:00"))},dateCompleteDateString:function(t){return new Date(t)}},Jr=function(t){var r=["Date -> object","Milliseconds Timestamp -> integer","Seconds Timestamp -> integer","UTC Time Format (ISO 8601) -> string","Including a Timezone Offset (ISO 8601) -> string","Local Time Format (ISO 8601) -> string","YYYY/MM/DD or YYYY-MM-DD -> string"],e=function(){throw new Error('Invalid "'.concat($r(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(r.join("\n- ")))};if("object"===$r(t)){if(t instanceof Date&&!isNaN(t.valueOf()))return"dateObject";e()}else{if("number"==typeof t)return Math.abs(t)<1e11?"dateSeconds":"dateMillseconds";if("string"==typeof t){if(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t)&&t.length>10||/^\d{4}\/\d{2}\/\d{2}$/.test(t))return"dateCompleteDateString";if(/^\d{4}-\d{2}-\d{2}$/.test(t))return"dateIncompleteDayString";e()}else e()}};function Wr(t){return Wr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wr(t)}function Zr(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return Qr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Qr(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qr(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var te=function(t,r,e){var n,o={Array,Float64Array,Float32Array,Int32Array,Uint8Array,Int8Array,Int16Array}[t];if(!o||"function"!=typeof o.from)throw new Error("Unsupported array type: ".concat(t));return n=void 0!==e?e:"Array"===t?null:NaN,o.from({length:r},(function(){return n}))},re=function(t,r){if(!r||"object"!==Wr(r))throw new TypeError('Invalid array type: "'.concat(t,'"'));return r.constructor.name};function ee(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return ne(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ne(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}function ne(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function oe(t){return function(t){if(Array.isArray(t))return ae(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ie(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ie(t,r){if(t){if("string"==typeof t)return ae(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ae(t,r):void 0}}function ae(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var le=function(t,r){var e=new Uint8Array(r);return e[t]=1,e},ue=function(t){var r=t.featureCols,e=t.flatFeaturesColLen,n=t.type,o=t.trainingSize,i=r.length!==e?" (including flat one-hot encoded array values) ":"";console.log('---\nInitialized "'.concat(n,'" with ').concat(e," features ").concat(i," and ").concat(o," rows: \n").concat(JSON.stringify(r),"\n\n"))},ce=function(t,r,e,n){var o,i,a=(i=2,function(t){if(Array.isArray(t))return t}(o=n)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(o,i)||ie(o,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=a[0],u=a[1];return(Math.min(Math.max(t,r),e)-r)/(e-r)*(u-l)+l},se=function(t,r){var e=[];if(t.length>0)for(var n=0;n<t.length;n++){var o=t[n],i=o.type,a=o.size,l=void 0===a?null:a,u=o.groupName,c=void 0===u?null:u,s=null!==l?"".concat(i,"_").concat(l):"".concat(i,"_").concat(c);if(!r.hasOwnProperty(s))throw new Error("Scaled group (".concat(s,") not found for regressor.options.findGroups[").concat(n,"]: ").concat(JSON.stringify(o)));e.push.apply(e,oe(r[s]))}return e},fe=function(t,r,e){var n,o=0,i=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=ie(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(t);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(!r.hasOwnProperty(a))throw new Error('Property "'.concat(a,'" not found in "verticalOhlcv".'));var l=r[a][e];if(null==l||Number.isNaN(l))throw new Error('Invalid value of property "'.concat(a,'".'));a.startsWith("one_hot_")||a.startsWith("pca_")?o+=r[a][e].length:o+=1}}catch(t){i.e(t)}finally{i.f()}return o},pe=function(t){var r=t.trainingCols,e=t.findGroups,n=t.verticalOhlcv,o=t.scaledGroups,i=[].concat(oe(r),oe(se(e,o)));if(0===i.length)return[];for(var a=!1,l=0;l<i.length;l++){var u=i[l];if(!n.hasOwnProperty(u)){a=!0;break}}return a?[]:i},ye=function(t){var r=t.metrics,e=t.trueLabel,n=t.predictedLabel;r.total=(r.total||0)+1,r.correct=r.correct||0,r.labels=r.labels||{};var o=n.toString();for(var i in r.labels[o]||(r.labels[o]={total:0,correct:0,accuracy:0}),r.labels[o].total++,n===e&&(r.correct++,r.labels[o].correct++),r.accuracy=r.correct/r.total,r.labels){var a=r.labels[i];a.accuracy=a.correct/a.total}};function he(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function ve(t){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(t)}function de(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,me(n.key),n)}}function me(t){var r=function(t,r){if("object"!=ve(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ve(r)?r:r+""}var be=function(t,r){return t>r},ge=function(t,r){return t<r},we=function(){return t=function t(){!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,{interval:0,prevState:.5,prevFast:NaN,prevSlow:NaN,prevHigh:NaN,prevLow:NaN,areHighAndLowUndefined:!1,crossIndexes:{up:[],down:[]}})},(r=[{key:"update",value:function(t,r){var e=r.fast,n=r.high,o=r.slow,i=r.low,a=this.prevState;this.areHighAndLowUndefined||void 0!==n&&void 0!==i||(this.areHighAndLowUndefined=!0),Number.isNaN(e)||Number.isNaN(o)||function(t,r){return t===r}(e,o)?a=.5:be(e,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&ge(i,o)&&be(this.prevLow,this.prevSlow)?0:1:ge(e,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&be(n,o)&&ge(this.prevHigh,this.prevSlow)?1:0),.5===a?this.interval=0:1===a?this.prevState<=.5?this.interval=1:this.interval++:0===a&&(this.prevState>=.5?this.interval=-1:this.interval--),1===this.interval&&this.crossIndexes.up.push(t),-1===this.interval&&this.crossIndexes.down.push(t),Object.assign(this,{prevState:a,prevFast:e,prevSlow:o,prevHigh:n,prevLow:i})}},{key:"getResult",value:function(){return this.interval}}])&&de(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function Se(t){return Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Se(t)}function Oe(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,r)||Pe(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function je(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?Ae(Object(e),!0).forEach((function(r){Ne(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Ae(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function Ne(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=Se(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Se(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Pe(t,r){if(t){if("string"==typeof t)return xe(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?xe(t,r):void 0}}function xe(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function _e(t){return function(t){if(Array.isArray(t))return Ee(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ke(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ke(t,r){if(t){if("string"==typeof t)return Ee(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ee(t,r):void 0}}function Ee(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function Te(t,r){if(t){if("string"==typeof t)return Ce(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ce(t,r):void 0}}function Ce(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var Me=function(t){var r=t.main,e=t.index,n=r.verticalOhlcv,o=n.close[e],i=n.open[e-1];return{change:(o-i)/i*100}};function Ie(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var De=function(t){var r,e=t.featureCols,n=t.flatFeaturesColLen,o=t.type,i=t.index,a=t.lookbackAbs,l=t.main.verticalOhlcv,u=!1,c=[],s=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return Ie(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ie(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(e);try{for(s.s();!(r=s.n()).done;){var f=r.value;if(f.startsWith("one_hot_")||f.startsWith("pca_"))for(var p=l[f][i].length,y=0;y<p;y++)c.push({key:f,bit:y});else c.push({key:f})}}catch(t){s.e(t)}finally{s.f()}if(c.length!==n)throw new Error("slots (".concat(c.length,") ≠ flatFeaturesColLen (").concat(n,") in ").concat(o," index ").concat(i));for(var h=new Array(n*a).fill(NaN),v=0;v<a;v++){for(var d=i-v,m=0;m<c.length;m++){var b=c[m],g=b.key,w=b.bit,S=l[g][d],O=null!=w?S[w]:S;if(!Number.isFinite(O)){u=!0;break}h[v*n+m]=O}if(u)break}return u?null:h};function Re(t){return function(t){if(Array.isArray(t))return Fe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Le(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Le(t,r){if(t){if("string"==typeof t)return Fe(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Fe(t,r):void 0}}function Fe(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var Be="pca",ze=function(t,r,n){var o=n.prefix,i=n.trainingSize,a=n.findGroups,l=n.trainingCols,u=n.lookbackAbs,c=n.modelArgs,s=n.filterCallback,f=t.verticalOhlcv,p=t.scaledGroups,y=t.len,h=t.instances,v=t.ML,d=t.invalidValueIndex+2,m=v.models;if(r===d)h.hasOwnProperty(Be)||(h[Be]={}),h[Be][o]={flatFeaturesColLen:0,featureCols:[],X:[]},f[o]=new Array(y).fill(null);else{if(r<d||r<u)return;if(!1===s(f,r))return;if(r+1===y){if(0===h[Be][o].featureCols.length){var b=[].concat(Re(l),Re(se(a,p)));throw new Error("Some of the provided features in ".concat(o,' features where not found in "verticalOhlcv": ').concat(JSON.stringify(b)))}var g,w=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Le(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(h[Be][o].featureCols);try{for(w.s();!(g=w.n()).done;){var S=g.value;if(!f.hasOwnProperty(S))throw new Error('Feature "'.concat(S,'" not found in verticalOhlcv for pca.'))}}catch(t){w.e(t)}finally{w.f()}if(h[Be][o].X.length<i){var O=h[Be][o].X.length-i;throw new Error('The current "trainingSize" at "'.concat(o,'" requires at least ').concat(O,' more datapoints. Try adding more input ohlcv rows or reducing the "trainingSize" by ').concat(O,"."))}}}var A=h[Be][o];if(0===A.flatFeaturesColLen){if(A.featureCols=pe({trainingCols:l,findGroups:a,verticalOhlcv:f,scaledGroups:p}),!e(t,r,A.featureCols))return;A.flatFeaturesColLen=fe(A.featureCols,f,r)}if(0!==A.flatFeaturesColLen){var j=A.X,N=A.featureCols,P=A.flatFeaturesColLen,x=De({featureCols:N,flatFeaturesColLen:P,type:Be,index:r,lookbackAbs:u,main:t});if(null!=x){if(m.hasOwnProperty(o)){var _=m[o].predict([x]).to2DArray();f[o][r]=_[0]}j.push(x),j.length>i&&j.shift(),j.length===i&&(m[o]=new v.classes.PCA(j,c))}}};function Ue(t){return Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ue(t)}function Ye(t){return function(t){if(Array.isArray(t))return qe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ve(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ve(t,r){if(t){if("string"==typeof t)return qe(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?qe(t,r):void 0}}function qe(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var Ge=function(t,r,n,o){var i=o.target,a=o.predictions,l=o.retrain,u=o.trainingCols,c=o.findGroups,s=o.type,f=o.modelArgs,p=o.precompute,y=o.filterCallback,h=o.modelConfig,v=o.modelClass,d=p.lookbackAbs,m=p.prefix,b=p.flatX,g=p.flatY,w=t.verticalOhlcv,S=t.len,O=t.instances,A=t.scaledGroups,j=t.invalidValueIndex,N=t.ML.models,P=j+1;if(r===P){O.hasOwnProperty("regressor")||(O.regressor={}),O.regressor.hasOwnProperty(m)||(O.regressor[m]={});var x=g?a:1;O.regressor[m]={expectedLoops:x,trainingSize:n,isTrained:new Array(x).fill(!1),shouldRetrain:l,featureCols:[],flatFeaturesColLen:0,X:[],Y:Array.from({length:x},(function(){return[]}))};for(var _=0;_<a;_++){var k="".concat(m,"_").concat(_+1);w[k]=new Float64Array(S).fill(NaN),N.hasOwnProperty(k)||(N[k]=[])}}else{if(r<P||r<d)return;if(!1===y(w,r))return;if(r+1===S){if(0===O.regressor[m].featureCols.length){var E=[].concat(Ye(u),Ye(se(c,A)));throw new Error("Some of the provided features in ".concat(m,' features where not found in "verticalOhlcv": ').concat(JSON.stringify(E)))}var T,C=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Ve(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(O.regressor[m].featureCols);try{for(C.s();!(T=C.n()).done;){var M=T.value;if(!w.hasOwnProperty(M))throw new Error('Feature "'.concat(M,'" not found in verticalOhlcv for ').concat(m,"."))}}catch(t){C.e(t)}finally{C.f()}if(O.regressor[m].X.length<n){var I=O.regressor[m].X.length-n;throw new Error('The current "trainingSize" at "'.concat(m,'" requires at least ').concat(I,' more datapoints. Try adding more input ohlcv rows or reducing the "trainingSize" by ').concat(I,"."))}}}var D=O.regressor[m];if(0===D.flatFeaturesColLen){if(D.featureCols=pe({trainingCols:u,findGroups:c,verticalOhlcv:w,scaledGroups:A}),!e(t,r,D.featureCols))return;D.flatFeaturesColLen=fe(D.featureCols,w,r),ue({featureCols:D.featureCols,flatFeaturesColLen:D.flatFeaturesColLen,type:s,trainingSize:n})}if(0!==D.flatFeaturesColLen){if(!w.hasOwnProperty(i))throw new Error('Target property "'.concat(i,'" not found in verticalOhlcv for regressor.'));var R=D.expectedLoops,L=D.X,F=D.Y,B=D.flatFeaturesColLen,z=D.featureCols,U=D.shouldRetrain;if(!z.includes(i))throw new Error('Target property "'.concat(i,'" not found in ').concat(s," features: ").concat(JSON.stringify(z)));var Y=b?w[i][r]:De({featureCols:z,flatFeaturesColLen:B,type:s,index:r,lookbackAbs:d,main:t});if(b){if(!Number.isFinite(Y))return}else if(null==Y)return;for(var V=[],q=0;q<a;q++){var G=w[i][r+q+1];if(!Number.isFinite(G))break;V.push(G)}for(var H=h.train,$=h.unsupervised,X=0;X<R;X++){var K="".concat(m,"_").concat(X+1),J=F[X],W=g?void 0===V[X]?null:V[X]:V,Z=D.isTrained[X];if(N.hasOwnProperty(K)&&Z&&N[K].length===R){var Q=N[K][0],tt=$?Q.predict(a)[0]:Q.predict([Y])[0];if(g){if(Number.isNaN(tt))throw new Error("Prediction of ".concat(s," at index ").concat(r," was expecting a number."));t.pushToMain({index:r,key:K,value:tt})}else{if(!Array.isArray(tt)||tt.length!==a)throw new Error('Prediction output of "'.concat(s,'" at index ').concat(r," was expecting an array of values."));for(var rt=0;rt<a;rt++)t.pushToMain({index:r,key:"".concat(m,"_").concat(rt+1),value:tt[rt]})}}if(!(r+a+1>S||V.length<a||null===W)){if(g){if("number"!=typeof W||Number.isNaN(W))throw new Error("currTrainY must return number, got ".concat(Ue(W)," at index ").concat(r))}else{if(!Array.isArray(W))throw new Error("currTrainY must return an array, got ".concat(Ue(W)," at index ").concat(r));if(W.length!==a)throw new Error("currTrainY length (".concat(W.length,') ≠ "options.predictions" (').concat(a,') for regressor "').concat(s,'"'))}if(J.push(W),J.length>n&&J.shift(),0===X&&(L.push(Y),L.length>n&&L.shift()),(U||!Z)&&L.length===n&&J.length===n){var et=H({modelClass:v,xRows:L,yRows:J,modelArgs:f,uniqueLabels:0});$?N[K]=[et]:(N[K].push(et),N[K].length>a&&N[K].shift()),D.isTrained[X]=!0}}}}};function He(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=$e(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}function $e(t,r){if(t){if("string"==typeof t)return Xe(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Xe(t,r):void 0}}function Xe(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var Ke=function(t){if(!Array.isArray(t)||0===t.length)return 1;for(var r=Array.isArray(t[0]),e=r?t[0].length:1,n=0,o=0;o<e;o++){for(var i=new Set,a=0;a<t.length;a++){var l=r?t[a][o]:t[a];i.add(l)}n+=i.size}return n},Je=function(t,r){if(!Array.isArray(t)||!Array.isArray(r))throw new TypeError("Both X and Y must be arrays");if(t.length!==r.length)throw new Error("X and Y must have the same length");if(0===r.length)return{X:[],Y:[]};var e,n=r.reduce((function(r,e,n){return r.has(e)||r.set(e,[]),r.get(e).push(t[n]),r}),new Map),o=0,i=He(n.values());try{for(i.s();!(e=i.n()).done;){var a=e.value;a.length>o&&(o=a.length)}}catch(t){i.e(t)}finally{i.f()}var l,u,c,s=[],f=[],p=He(n.entries());try{for(p.s();!(l=p.n()).done;)for(var y=(u=l.value,c=2,function(t){if(Array.isArray(t))return t}(u)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(u,c)||$e(u,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),h=y[0],v=y[1],d=v.length,m=0;m<o;m++)s.push(v[m%d]),f.push(h)}catch(t){p.e(t)}finally{p.f()}return{X:s,Y:f}};function We(t){return We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},We(t)}function Ze(t){return function(t){if(Array.isArray(t))return en(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||rn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function tn(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,r)||rn(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rn(t,r){if(t){if("string"==typeof t)return en(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?en(t,r):void 0}}function en(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function nn(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ln(n.key),n)}}function on(t,r,e){return r&&nn(t.prototype,r),e&&nn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function an(t,r,e){return(r=ln(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function ln(t){var r=function(t,r){if("object"!=We(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=We(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==We(r)?r:r+""}var un="classifier",cn=on((function t(){var r=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),an(this,"_unwrap",(function(t){return Array.isArray(t)?t[0]:t})),an(this,"_num",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Number(r._unwrap(t));return Number.isFinite(n)?n:e})),an(this,"set",(function(t,e){if("function"==typeof e){var n=e(r._num(r[t],0));return r[t]=n,n}return r[t]=e,e})),an(this,"inc",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return r.set(t,(function(t){return t+e}))})),an(this,"add",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return r.inc(t,e)})),an(this,"getNum",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return r._num(r[t],e)})),an(this,"get",(function(t){return r._unwrap(r[t])})),an(this,"getAll",(function(){for(var t={},e=0,n=Object.entries(r);e<n.length;e++){var o=tn(n[e],2),i=o[0],a=o[1];"function"!=typeof a&&(t[i]=a)}return function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?Qe(Object(e),!0).forEach((function(r){an(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Qe(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}({},t)})),Object.entries(e).forEach((function(t){var e=tn(t,2),n=e[0],o=e[1];r[n]=o}))})),sn=function(t,r,n,o){var i=o.yCallback,a=o.trainingCols,l=o.findGroups,u=void 0===l?[]:l,c=o.retrain,s=o.type,f=o.modelArgs,p=o.horizon,y=o.precompute,h=o.predictions,v=o.filterCallback,d=o.modelConfig,m=o.modelClass,b=y.lookbackAbs,g=y.prefix,w=y.flatY,S=t.verticalOhlcv,O=t.len,A=t.instances,j=t.scaledGroups,N=t.invalidValueIndex,P=t.ML,x=P.models,_=N+1;if(r===_){A.hasOwnProperty(un)||(A[un]={}),A[un].hasOwnProperty(g)||(A[un][g]={});var k=w?h:1;A[un][g]={store:new cn({strategy:null,total:0,win:0,loss:0,strategyGainLoss:0,idx:0,initialBalance:S.close[r]}),expectedLoops:k,isTrained:new Array(k).fill(!1),uniqueLabels:new Array(k).fill(0),shouldRetrain:c,featureCols:[],flatFeaturesColLen:0,X:[],Y:Array.from({length:k},(function(){return[]}))};for(var E=0;E<h;E++){var T="".concat(g,"_").concat(E+1);S[T]="KNN"===s?new Array(O).fill(null):new Float32Array(O).fill(NaN),P.metrics[T]={accuracy:{},total:0,correct:0,labels:{}},x.hasOwnProperty(T)||(x[T]=[])}}else{if(r<_||r<b)return;if(!1===v(S,r,A[un][g].store))return;if(r+1===O){if(0===A[un][g].featureCols.length){var C=[].concat(Ze(a),Ze(se(u,j)));throw new Error("Some of the provided features in ".concat(un,' "').concat(g,'" features where not found in "verticalOhlcv": ').concat(JSON.stringify(C)))}var M,I=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=rn(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(A[un][g].featureCols);try{for(I.s();!(M=I.n()).done;){var D=M.value;if(!S.hasOwnProperty(D))throw new Error('Feature "'.concat(D,'" not found in verticalOhlcv for ').concat(g,"."))}}catch(t){I.e(t)}finally{I.f()}if(A[un][g].X.length<n){var R=A[un][g].X.length-n;throw new Error('The current "trainingSize" at '.concat(un,' "').concat(g,'" requires at least ').concat(R,' more datapoints. Try adding more input ohlcv rows or reducing the "trainingSize" by ').concat(R,"."))}}}var L=A[un][g];if(0===L.flatFeaturesColLen){if(L.featureCols=pe({trainingCols:a,findGroups:u,verticalOhlcv:S,scaledGroups:j}),!e(t,r,L.featureCols))return;L.flatFeaturesColLen=fe(L.featureCols,S,r),ue({featureCols:L.featureCols,flatFeaturesColLen:L.flatFeaturesColLen,type:s,trainingSize:n})}if(0!==L.flatFeaturesColLen){var F=L.uniqueLabels,B=L.expectedLoops,z=L.featureCols,U=L.flatFeaturesColLen,Y=L.shouldRetrain,V=L.X,q=De({featureCols:z,flatFeaturesColLen:U,type:s,index:r,lookbackAbs:b,main:t});if(q){var G=i(r,S,p,A[un][g].store);if(null!==G&&(!Array.isArray(G)||G.length!==h))throw new Error("trainY must be null or an array with ".concat(h,' items, got "').concat(JSON.stringify(G),'" at index ').concat(r," for ").concat(s));for(var H=0;H<B;H++){var $="".concat(g,"_").concat(H+1),X=L.Y[H],K=w?null===G?null:G[H]:G,J=L.isTrained[H];if(x.hasOwnProperty($)&&J&&(!1===Y||x[$].length===p)){var W=x[$][0].predict([q])[0];if(w){if(null==W)throw new Error("Prediction of ".concat(g," at index ").concat(r," was expecting a number."));t.pushToMain({index:r,key:$,value:W}),null!=K&&ye({metrics:P.metrics[$],trueLabel:K,predictedLabel:W})}else{if(!Array.isArray(W)||W.length!==h)throw new Error("Prediction output of ".concat(un,' "').concat(g,'" at index ').concat(r," was expecting an array of values."));for(var Z=0;Z<h;Z++)t.pushToMain({index:r,key:"".concat(g,"_").concat(Z+1),value:W[Z]}),Array.isArray(K)&&K.length===h&&ye({metrics:P.metrics["".concat(g,"_").concat(Z+1)],trueLabel:K[Z],predictedLabel:W[Z]})}}if(!(r+h+1>O)&&null!==K){if(w){if(void 0===K||null==K)throw new Error("currTrainY must return number, string or boolean got ".concat(We(K)," at index ").concat(r))}else if(K.length!==h)throw new Error("The number of label columns returned (".concat(K.length,") doesn’t match the options.predictions (").concat(h,") setting for the ").concat(un,' "').concat(g,'" classifier. ')+"Please update your yCallback function so its output array items align with options.predictions.");if(X.push(K),X.length>n&&X.shift(),0===H&&(V.push(q),V.length>n&&V.shift()),(Y||!J)&&V.length===n&&X.length===n){if(!1===J&&(F[H]=Ke(X),F[H]<1))throw new Error("Invalid number or labels in ".concat(g,'. Check the logic of your "yCallback" function.'));var Q=d.train,tt=Je(V,X),rt=Q({modelClass:m,xRows:tt.X,yRows:tt.Y,modelArgs:f,uniqueLabels:F[H]});x[$].push(rt),x[$].length>p&&x[$].shift(),L.isTrained[H]=!0}}}return!0}}};function fn(t){return function(t){if(Array.isArray(t))return vn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||hn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pn(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=hn(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}function yn(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,r)||hn(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hn(t,r){if(t){if("string"==typeof t)return vn(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?vn(t,r):void 0}}function vn(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var dn={dateTime:function(t,r,e){var n,o=e.lag,i=e.oneHot,a=e.precompute,l=t.instances,u=t.verticalOhlcv,c=a.prefix;if(0===r){var s=t.len;if(!t.dateType)throw Error('dateTime method found and invalid "date" in input ohlcv');var f=u.date[0].getUTCFullYear(),p=(new Date).getUTCFullYear();Object.assign(l,{dateTime:{colKeys:[].concat((n=a.colKeys,function(t){if(Array.isArray(t))return xe(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Pe(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),["".concat(c,"year")]),colKeySizes:je(je({},a.colKeySizes),{},Ne({},"".concat(c,"year"),p-f+1)),startYear:f}});var y,h=l.dateTime.colKeys,v=i?Array:Int16Array,d=i?null:NaN,m=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Pe(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(h);try{for(m.s();!(y=m.n()).done;)u[y.value]=new v(s).fill(d)}catch(t){m.e(t)}finally{m.f()}o>0&&t.lag(h,o)}for(var b=l.dateTime,g=b.colKeySizes,w=b.startYear,S=function(t,r,e,n,o){for(var i=function(t,e){return r?le(t,e):t},a=Ne(Ne(Ne(Ne(Ne(Ne({},"".concat(n,"year"),t.getUTCFullYear()),"".concat(n,"month"),t.getUTCMonth()),"".concat(n,"hour"),t.getUTCHours()),"".concat(n,"minute"),t.getUTCMinutes()),"".concat(n,"day_of_the_week"),t.getUTCDay()),"".concat(n,"day_of_the_month"),t.getUTCDate()-1),l=0,u=Object.entries(e);l<u.length;l++){var c=Oe(u[l],2),s=c[0],f=c[1],p=s==="".concat(n,"year")?a[s]-o:a[s];a[s]=i(p,f)}return a}(u.date[r],i,g,c,w),O=0,A=Object.entries(S);O<A.length;O++){var j=Oe(A[O],2),N=j[0],P=j[1];t.pushToMain({index:r,key:N,value:P})}},heikenAshi:function(t,r,e,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i.lag,l=void 0===a?0:a,u=i.bothNull,c=void 0!==u&&u,s=t.verticalOhlcv,f=t.instances,p=t.len,y=t.priceBased,h=c?"heiken_ashi":"heiken_ashi_".concat(e,"_").concat(n),v=["open","high","low","close"];if(0===r){f[h]={emaPre:c?null:Object.fromEntries(v.map((function(t){return[t,new zt(e)]}))),emaPost:c?null:Object.fromEntries(v.map((function(t){return[t,new zt(n)]}))),prevHaOpen:NaN,prevHaClose:NaN,isTrendUp:!1};var d,m=v.map((function(t){return"".concat(h,"_").concat(t)})),b=Object.fromEntries([].concat((o=m,function(t){if(Array.isArray(t))return Or(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||Sr(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),["".concat(h,"_cross")]).map((function(t){return[t,new Float64Array(p).fill(NaN)]}))),g=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Sr(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(m);try{for(g.s();!(d=g.n()).done;){var w=d.value;y.add(w)}}catch(t){g.e(t)}finally{g.f()}Object.assign(s,function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?gr(Object(e),!0).forEach((function(r){wr(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):gr(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}({},b)),l>0&&t.lag(m,l)}var S,O,A,j,N=s.open[r],P=s.high[r],x=s.low[r],_=s.close[r],k=f[h];if(c)S=N,O=P,A=x,j=_;else{k.emaPre.open.update(N),k.emaPre.high.update(P),k.emaPre.low.update(x),k.emaPre.close.update(_);try{S=k.emaPre.open.getResult(),O=k.emaPre.high.getResult(),A=k.emaPre.low.getResult(),j=k.emaPre.close.getResult()}catch(t){return!0}}var E,T,C,M,I=(S+O+A+j)/4,D=Number.isNaN(k.prevHaOpen)||Number.isNaN(k.prevHaClose)?(S+j)/2:(k.prevHaOpen+k.prevHaClose)/2,R=Math.max(O,D,I),L=Math.min(A,D,I);if(k.prevHaOpen=D,k.prevHaClose=I,c)E=D,T=R,C=L,M=I;else{k.emaPost.open.update(D),k.emaPost.high.update(R),k.emaPost.low.update(L),k.emaPost.close.update(I);try{E=k.emaPost.open.getResult(),T=k.emaPost.high.getResult(),C=k.emaPost.low.getResult(),M=k.emaPost.close.getResult()}catch(t){return!0}}var F=r>0?s["".concat(h,"_cross")][r-1]:0,B=r>0?s["".concat(h,"_open")][r-1]:NaN,z=r>0?s["".concat(h,"_close")][r-1]:NaN,U=!Number.isNaN(z)&&z<=B&&M>E,Y=!Number.isNaN(z)&&z>=B&&M<E;U&&(k.isTrendUp=!0),Y&&(k.isTrendUp=!1);var V=0;return r>0&&(V=k.isTrendUp?F>0?F+1:1:F<0?F-1:-1),t.pushToMain({index:r,key:"".concat(h,"_open"),value:E}),t.pushToMain({index:r,key:"".concat(h,"_high"),value:T}),t.pushToMain({index:r,key:"".concat(h,"_low"),value:C}),t.pushToMain({index:r,key:"".concat(h,"_close"),value:M}),t.pushToMain({index:r,key:"".concat(h,"_cross"),value:V}),!0},rsi:function(t,r,e,n){var o=n.target,i=n.lag,a=n.parser,l=n.prefix,u=n.minmax,c=t.verticalOhlcv,s=t.instances,f="close"===o?"":"_".concat(o),p="".concat(l,"rsi_").concat(e).concat(f),y="".concat(l,"rsi_sma_").concat(e).concat(f);if(0===r){var h=t.len;if(!c.hasOwnProperty(o))throw new Error("Target property ".concat(o," not found in verticalOhlcv for rsi."));Object.assign(s,fr(fr({},p,new tr(e)),y,new Z(e))),Object.assign(c,fr(fr({},p,new Float64Array(h).fill(NaN)),y,new Float64Array(h).fill(NaN)));var v=[p,y];i>0&&t.lag(v,i);var d=i>0?v.flatMap((function(t){return[t].concat(cr(Array.from({length:i},(function(r,e){return"".concat(t,"_lag_").concat(e+1)}))))})):v;if(Array.isArray(u)){var m,b,g=null!==(b=(m=t.scaledGroups).minmax_rsi)&&void 0!==b?b:m.minmax_rsi=[];g.push.apply(g,cr(d))}}var w=c[o][r],S=NaN,O=NaN;s[p].update(w);try{S=s[p].getResult()}catch(t){S=NaN}t.pushToMain({index:r,key:p,value:Number.isNaN(S)?NaN:a(S)}),Number.isNaN(S)||s[y].update(S);try{O=s[y].getResult()}catch(t){O=NaN}t.pushToMain({index:r,key:y,value:Number.isNaN(O)?NaN:a(O)})},stochastic:function(t,r,e,n,o,i){var a=i.minmax,l=i.prefix,u=i.lag,c=i.parser,s=t.verticalOhlcv,f=t.instances,p=14===e&&3===n&&3===o?"":"".concat(e,"_").concat(n,"_").concat(o),y="".concat(l,"stoch_d").concat(p),h="".concat(l,"stoch_k").concat(p),v="".concat(l).concat(p);if(0===r){var d=t.len;Object.assign(f,vr({},v,new lr(e,n,o))),Object.assign(s,vr(vr({},y,new Float64Array(d).fill(NaN)),h,new Float64Array(d).fill(NaN)));var m=[y,h];u>0&&t.lag(m,u);var b=u>0?m.flatMap((function(t){return[t].concat(yr(Array.from({length:u},(function(r,e){return"".concat(t,"_lag_").concat(e+1)}))))})):m;if(Array.isArray(a)){var g,w,S=null!==(w=(g=t.scaledGroups).minmax_rsi)&&void 0!==w?w:g.minmax_rsi=[];S.push.apply(S,yr(b))}}var O=s.close[r],A=s.low[r],j=s.high[r],N=null;f[v].update({close:O,low:A,high:j});try{N=f[v].getResult()}catch(t){N=null}var P=N?c(N.stochK):NaN,x=N?c(N.stochD):NaN;t.pushToMain({index:r,key:h,value:P}),t.pushToMain({index:r,key:y,value:x})},atr:function(t,r,e,n){var o=n.lag,i=n.percentage,a=n.upper,l=n.lower,u=t.verticalOhlcv,c=t.instances,s=t.priceBased,f="atr_".concat(e);if(0===r){var p=t.instances,y=t.verticalOhlcv,h=t.len;p[f]=new Pt(e,lt);var v=[f];i&&v.push("".concat(f,"_percentage")),null!==a&&v.push("".concat(f,"_upper")),null!==l&&v.push("".concat(f,"_lower"));for(var d=0,m=v;d<m.length;d++){var b=m[d];y[b]=new Float64Array(h).fill(NaN),s.add(b)}o>0&&t.lag(v,o)}var g={high:u.high[r],low:u.low[r],close:u.close[r]},w=c[f];w.update(g);var S=NaN;try{S=w.getResult()}catch(t){}if(i){var O=Number.isNaN(S)?NaN:S/g.close;t.pushToMain({index:r,key:"".concat(f,"_percentage"),value:O})}if(null!==a){var A=Number.isNaN(S)?NaN:g.close+S*a;t.pushToMain({index:r,key:"".concat(f,"_upper"),value:A})}if(null!==l){var j=Number.isNaN(S)?NaN:g.close-S*l;t.pushToMain({index:r,key:"".concat(f,"_lower"),value:j})}return t.pushToMain({index:r,key:f,value:S}),!0},ema:mr,sma:mr,vidya:function(t,r,e,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=t.verticalOhlcv,a=t.instances,l=t.len,u=t.priceBased,c=o.target,s=o.lag,f=o.atrLength,p=void 0===f?200:f,y=o.bandDistance,h=void 0===y?2:y,v=o.liquidityLookback,d=void 0===v?5:v,m="".concat(e,"_").concat(n);if(0===r){if(!(c in i))throw new Error('VIDYA could not find target "'.concat(c,'"'));for(var b="vidya_".concat(m),g="close"===c?b:"".concat(b,"_").concat(c),w={vidya:g,upper:"".concat(b,"_upper"),lower:"".concat(b,"_lower"),delta_vol:"".concat(b,"_delta_vol"),cross:"".concat(b,"_cross"),liquidity:"".concat(b,"_liquidity")},S=0,O=[g,w.upper,w.lower,w.liquidity];S<O.length;S++){var A=O[S];u.add(A)}a.vidya||(a.vidya={settings:{}}),a.vidya.settings[m]={momentumBuffer:[],prevVidya:NaN,sma:new Z(15),atrBuffer:[],isTrendUp:!1,upVol:0,downVol:0,liquidity:{high:[],low:[]}},Object.values(w).forEach((function(t){i[t]=new Float64Array(l).fill(NaN)})),s>0&&t.lag(Object.values(w),s)}var j=a.vidya.settings[m],N="vidya_".concat(m),P={vidya:"close"===c?N:"".concat(N,"_").concat(c),upper:"".concat(N,"_upper"),lower:"".concat(N,"_lower"),delta_vol:"".concat(N,"_delta_vol"),cross:"".concat(N,"_cross"),liquidity:"".concat(N,"_liquidity")},x=i[c][r],_=i.high[r],k=i.low[r],E=i.close[r],T=i.open[r],C=i.volume[r],M=r>0?i[P.cross][r-1]:0,I=j.liquidity.high.length===d?Math.max.apply(Math,Ar(j.liquidity.high)):NaN,D=j.liquidity.low.length===d?Math.min.apply(Math,Ar(j.liquidity.low)):NaN;if(r>0){var R=i.close[r-1],L=Math.max(_-k,Math.abs(_-R),Math.abs(k-R));j.atrBuffer.push(L),j.atrBuffer.length>p&&j.atrBuffer.shift()}var F=j.atrBuffer.length===p?j.atrBuffer.reduce((function(t,r){return t+r}),0)/p:NaN,B=NaN,z=NaN;if(r>0&&(z=x-i[c][r-1]),j.momentumBuffer.push(z),j.momentumBuffer.length>n&&j.momentumBuffer.shift(),j.momentumBuffer.length===n){var U=0,Y=0;j.momentumBuffer.forEach((function(t){return t>=0?U+=t:Y+=-t}));var V=U+Y,q=2/(e+1)*((0===V?0:100*Math.abs((U-Y)/V))/100);B=isNaN(j.prevVidya)?x:q*x+(1-q)*j.prevVidya,j.prevVidya=B}j.sma.update(B);var G=NaN;try{G=j.sma.getResult()}catch(t){}var H=isNaN(F)||isNaN(G)?NaN:G+F*h,$=isNaN(F)||isNaN(G)?NaN:G-F*h,X=r>0?i[c][r-1]:NaN,K=r>0?i[P.upper][r-1]:NaN,J=r>0?i[P.lower][r-1]:NaN,W=r>0&&X<=K&&x>H,Q=r>0&&X>=J&&x<$;W&&(j.isTrendUp=!0),Q&&(j.isTrendUp=!1);var tt=0;r>0&&(tt=j.isTrendUp?M>0?M+1:1:M<0?M-1:-1),W||Q?j.upVol=j.downVol=0:(j.upVol+=E>T?C:0,j.downVol+=E<T?C:0);var rt=(j.upVol+j.downVol)/2||1,et=(j.upVol-j.downVol)/rt,nt=j.isTrendUp?$:H,ot=NaN;return tt>0?ot=D:tt<0&&(ot=I),t.pushToMain({index:r,key:P.vidya,value:nt}),t.pushToMain({index:r,key:P.upper,value:H}),t.pushToMain({index:r,key:P.lower,value:$}),t.pushToMain({index:r,key:P.delta_vol,value:et}),t.pushToMain({index:r,key:P.cross,value:tt}),t.pushToMain({index:r,key:P.liquidity,value:ot}),j.liquidity.high.push(_),j.liquidity.low.push(k),j.liquidity.high.length>d&&j.liquidity.high.shift(),j.liquidity.low.length>d&&j.liquidity.low.shift(),!0},macd:function(t,r,e,n,o,i){var a=i.target,l=i.lag,u=i.precomputed,c=t.verticalOhlcv,s=t.instances,f=t.priceBased,p=u.instanceKey;if(0===r){var y=t.inputParams,h=t.len;if(!c.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var v,d=0,m=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return xr(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?xr(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(y);try{for(m.s();!(v=m.n()).done;)"macd"===v.value.key&&d++}catch(t){m.e(t)}finally{m.f()}var b=d>1?"macd_".concat(e,"_").concat(n,"_").concat(o):"macd",g=a===_r?"".concat(b,"_diff"):"".concat(b,"_diff_").concat(a),w=a===_r?"".concat(b,"_dea"):"".concat(b,"_dea_").concat(a),S=a===_r?"".concat(b,"_histogram"):"".concat(b,"_histogram_").concat(a);s.hasOwnProperty("macd")||(s.macd={numberOfIndicators:d,settings:{}}),s.macd.settings[p]=new Gt(new zt(e),new zt(n),new zt(o)),Object.assign(c,Pr(Pr(Pr({},g,new Float64Array(h).fill(NaN)),w,new Float64Array(h).fill(NaN)),S,new Float64Array(h).fill(NaN)));for(var O=[g,w,S],A=0,j=O;A<j.length;A++){var N=j[A];f.add(N)}l>0&&t.lag(O,l)}var P=s.macd,x=P.numberOfIndicators,_=P.settings,k=x>1?"macd_".concat(e,"_").concat(n,"_").concat(o):"macd",E=a===_r?"".concat(k,"_diff"):"".concat(k,"_diff_").concat(a),T=a===_r?"".concat(k,"_dea"):"".concat(k,"_dea_").concat(a),C=a===_r?"".concat(k,"_histogram"):"".concat(k,"_histogram_").concat(a),M=_[p],I=c[a][r];M.update(I);var D={};try{D=M.getResult()}catch(t){}return t.pushToMain({index:r,key:E,value:D?D.macd:NaN}),t.pushToMain({index:r,key:T,value:D?D.signal:NaN}),t.pushToMain({index:r,key:C,value:D?D.histogram:NaN}),!0},volumeDelta:function(t,r,e){var n=e.lag,o=void 0===n?0:n,i=t.verticalOhlcv,a=t.instances,l=t.len,u="volume_delta";if(0===r){a[u]||(a[u]={isBuyVolume:!0,cross:0});for(var c=["".concat(u,"_open"),"".concat(u,"_high"),"".concat(u,"_low"),"".concat(u,"_close"),"".concat(u,"_cross")],s=0,f=c;s<f.length;s++)i[f[s]]=new Float64Array(l).fill(NaN);o>0&&t.lag(c,o)}var p=a[u],y=i.volume[r],h=i.open[r],v=i.close[r],d=r>0?i.close[r-1]:NaN,m=p.isBuyVolume;v>h?m=!0:v<h?m=!1:v>d?m=!0:v<d&&(m=!1),p.isBuyVolume=m,r<1?p.cross=m?1:-1:m?p.cross>0?p.cross=p.cross+1:p.cross=1:p.cross>0?p.cross=-1:p.cross=p.cross-1;var b=Number.isFinite(y)?m?y:-y:NaN,g=Number.isNaN(b)?NaN:0,w=b,S=Number.isNaN(b)?NaN:Math.max(b,0),O=Number.isNaN(b)?NaN:Math.min(b,0);return t.pushToMain({index:r,key:"".concat(u,"_open"),value:g}),t.pushToMain({index:r,key:"".concat(u,"_high"),value:S}),t.pushToMain({index:r,key:"".concat(u,"_low"),value:O}),t.pushToMain({index:r,key:"".concat(u,"_close"),value:w}),t.pushToMain({index:r,key:"".concat(u,"_cross"),value:p.cross}),!0},relativeVolume:function(t,r,e,n){var o=n.lag,i="relative_volume_".concat(e),a=t.instances,l=t.verticalOhlcv;if(0===r){var u=t.len;a[i]={instance:new Z(e),prevRelativeVolumeSma:NaN},l[i]=new Float64Array(u).fill(NaN),o>0&&t.lag([i],o)}var c=l.volume[r],s=a[i].instance;s.update(c);var f=NaN;try{f=s.getResult()}catch(t){}var p=a[i].prevRelativeVolumeSma,y=NaN;return Number.isNaN(f)||Number.isNaN(p)||(y=c/p),t.pushToMain({index:r,key:i,value:y}),a[i].prevRelativeVolumeSma=f,!0},donchianChannels:function(t,r,e,n,o){var i=t.verticalOhlcv,a=t.instances,l=t.len,u=t.inputParams,c=t.lag,s=t.priceBased,f=o.height,p=o.range,y="".concat(e,"_").concat(n);if(0===r){var h=u.filter((function(t){return"donchianChannels"===t.key})).length,v="donchian_channel",d=h>1?"".concat(v,"_").concat(y):v,m=["upper","basis","lower"].map((function(t){return"".concat(d,"_").concat(t)}));f&&m.push("".concat(d,"_height"));var b,g=Er(p);try{for(g.s();!(b=g.n()).done;){var w=b.value;if(!(w in i))throw new Error('Invalid range key "'.concat(w,'".'));m.push("".concat(d,"_range_").concat(w))}}catch(t){g.e(t)}finally{g.f()}var S,O=Er(m);try{for(O.s();!(S=O.n()).done;){var A=S.value;s.add(A)}}catch(t){O.e(t)}finally{O.f()}a.donchian_channel||(a.donchian_channel={numberOfIndicators:h,settings:{}}),a.donchian_channel.numberOfIndicators=h,a.donchian_channel.settings[y]={maxDeque:[],minDeque:[]},Object.assign(i,Object.fromEntries(m.map((function(t){return[t,new Float64Array(l).fill(NaN)]})))),c>0&&t.lag(m,c)}var j=a.donchian_channel,N=j.numberOfIndicators,P=j.settings,x=N>1?"donchian_channel_".concat(y):"donchian_channel",_=P[y],k=_.maxDeque,E=_.minDeque,T=r-n,C=T-e+1,M=["upper","basis","lower"].map((function(t){return"".concat(x,"_").concat(t)}));f&&M.push("".concat(x,"_height"));var I=p.map((function(t){return"".concat(x,"_range_").concat(t)}));if(C<0||T+1>l)return[].concat(kr(M),kr(I)).forEach((function(e){return t.pushToMain({index:r,key:e,value:NaN})})),!0;var D=i.high,R=i.low,L=function(t,r,e){for(;t.length&&t[0]<C;)t.shift();for(;t.length&&e(r[t.at(-1)],r[T]);)t.pop();t.push(T)};L(k,D,(function(t,r){return t<=r})),L(E,R,(function(t,r){return t>=r}));var F=k.length&&E.length,B=F?D[k[0]]:NaN,z=F?R[E[0]]:NaN,U=F?(B+z)/2:NaN;if(t.pushToMain({index:r,key:"".concat(x,"_upper"),value:B}),t.pushToMain({index:r,key:"".concat(x,"_basis"),value:U}),t.pushToMain({index:r,key:"".concat(x,"_lower"),value:z}),f){var Y=F&&z?(B-z)/z:NaN;t.pushToMain({index:r,key:"".concat(x,"_height"),value:Y})}for(var V=F?B-z:NaN,q=0;q<p.length;q++){var G=i[p[q]][r],H=F&&G==G&&V?(G-z)/V:NaN;t.pushToMain({index:r,key:I[q],value:H})}return!0},bollingerBands:function(t,r,e,n,o){var i,a,l,u,c,s,f=o.height,p=o.range,y=void 0===p?[]:p,h=o.target,v=o.lag,d=t.verticalOhlcv,m=t.instances,b="".concat(e,"_").concat(n),g="bollinger_bands";if(0===r){var w=t.inputParams,S=t.verticalOhlcv,O=t.len,A=t.priceBased;if(!(h in S))throw new Error('bollingerBands could not find target "'.concat(h,'"'));var j,N=0,P=Rr(w);try{for(P.s();!(j=P.n()).done;)"bollingerBands"===j.value.key&&N++}catch(t){P.e(t)}finally{P.f()}m.bollinger_bands||(m.bollinger_bands={numberOfIndicators:N,settings:{}}),m.bollinger_bands.settings[b]=new Tt(e,n);var x="";N>1&&(x+="_".concat(b)),h!==Fr&&(x+="_".concat(h));var _=["".concat(g,"_upper"),"".concat(g,"_middle"),"".concat(g,"_lower")].map((function(t){return"".concat(t).concat(x)}));f&&_.push("".concat(g,"_height").concat(x));var k,E=Rr(y);try{for(E.s();!(k=E.n()).done;){var T=k.value;if(!(T in S))throw new Error('Invalid range item value "'.concat(T,'" property for bollingerBands.'));_.push("".concat(g,"_range_").concat(T).concat(x))}}catch(t){E.e(t)}finally{E.f()}if(A.has(h)){var C,M=Rr(_);try{for(M.s();!(C=M.n()).done;){var I=C.value;A.add(I)}}catch(t){M.e(t)}finally{M.f()}}var D=Object.fromEntries(_.map((function(t){return[t,new Float64Array(O).fill(NaN)]})));Object.assign(S,function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?Ir(Object(e),!0).forEach((function(r){Dr(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Ir(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}({},D)),v>0&&t.lag(_,v)}var R="";m.bollinger_bands.numberOfIndicators>1&&(R+="_".concat(b)),h!==Fr&&(R+="_".concat(h));var L=m.bollinger_bands.settings[b],F=d[h][r];L.update(F);var B={};try{B=L.getResult()}catch(t){}var z=null!==(i=null===(a=B)||void 0===a?void 0:a.upper)&&void 0!==i?i:NaN,U=null!==(l=null===(u=B)||void 0===u?void 0:u.middle)&&void 0!==l?l:NaN,Y=null!==(c=null===(s=B)||void 0===s?void 0:s.lower)&&void 0!==c?c:NaN;if(t.pushToMain({index:r,key:"".concat(g,"_upper").concat(R),value:z}),t.pushToMain({index:r,key:"".concat(g,"_middle").concat(R),value:U}),t.pushToMain({index:r,key:"".concat(g,"_lower").concat(R),value:Y}),f){var V=NaN;Number.isNaN(Y)||Number.isNaN(z)||(V=(z-Y)/Y),t.pushToMain({index:r,key:"".concat(g,"_height").concat(R),value:V})}var q,G=Rr(y);try{for(G.s();!(q=G.n()).done;){var H=q.value,$=NaN,X=d[H][r];Number.isNaN(X)||Number.isNaN(Y)||Number.isNaN(z)||($=(X-Y)/(z-Y)),t.pushToMain({index:r,key:"".concat(g,"_range_").concat(H).concat(R),value:$})}}catch(t){G.e(t)}finally{G.f()}return!0},volumeOscillator:function(t,r,e,n,o){var i,a,l,u=o.lag,c=t.verticalOhlcv,s=t.instances,f=c.volume[r],p="volume_oscillator_".concat(e,"_").concat(n);if(0===r){var y=t.len;Object.assign(s,(i={},a=p,l={fastEMA:new zt(e),slowEMA:new zt(n)},(a=function(t){var r=function(t,r){if("object"!=Br(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Br(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Br(r)?r:r+""}(a))in i?Object.defineProperty(i,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):i[a]=l,i)),c[p]=new Float64Array(y).fill(NaN),u>0&&t.lag([p],u)}var h=s[p],v=h.fastEMA,d=h.slowEMA;v.update(f),d.update(f);var m=NaN,b=NaN;try{m=v.getResult()}catch(t){}try{b=d.getResult()}catch(t){}var g=NaN;return Number.isNaN(m)||Number.isNaN(b)||(g=100*(m-b)/b),t.pushToMain({index:r,key:p,value:g}),!0},mapCols:function(t,r,e,n,o){var i=o.lag,a=o.isPriceBased,l=t.verticalOhlcv,u=t.len,c=t.priceBased,s=t.precision;if(0===r){var f,p=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Te(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(e);try{for(p.s();!(f=p.n()).done;){var y=f.value;if(l.hasOwnProperty(y))throw new Error('New property "'.concat(y,'" already exist in "verticalOhlcv" and can not be modified using mapCols.'));l[y]=new Array(u).fill(0),s&&a&&c.add(y)}}catch(t){p.e(t)}finally{p.f()}i>0&&t.lag(e,i)}var h,v,d=n({index:r,main:t});if(null==d)return!0;for(var m=0,b=Object.entries(d);m<b.length;m++){var g=(h=b[m],v=2,function(t){if(Array.isArray(t))return t}(h)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(h,v)||Te(h,v)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),w=g[0],S=g[1];t.pushToMain({index:r,key:w,value:S})}},scaler:function(t,r,e,n,o){var i=o.type,a=o.group,l=o.range,u=o.lag,c=o.precomputed,s=(o.secondaryLoop,c.groupKey),f=c.groupKeyLen,p=t.verticalOhlcv,y=t.instances,h=(t.invalidValueIndex,"".concat(i,"_").concat(e));if(0===r){var v=t.len,d=t.isAlreadyComputed;if(d.has(h))throw new Error('In scaler method can not repeat params "size" and "options.type" together between indicators.');d.add(h),y.hasOwnProperty("scaler")||(y.scaler={}),y.scaler.hasOwnProperty(h)||(y.scaler[h]={windows:{}});var m,b=[],g=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=ke(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(n);try{var w=function(){var r=m.value;if(!p.hasOwnProperty(r))throw new Error('Target property "'.concat(r,'" not found in verticalOhlcv'));var e="".concat(h,"_").concat(r);p[e]=new Float64Array(v).fill(NaN);var n=a?s:r;if(y.scaler[h].windows[n]=[],t.scaledGroups[s]||(t.scaledGroups[s]=[]),t.scaledGroups[s].push(e),u>0){var o,i=Array.from({length:u}).map((function(t,r){return"".concat(e,"_lag_").concat(r+1)}));(o=t.scaledGroups[s]).push.apply(o,_e(i)),b.push(e)}};for(g.s();!(m=g.n()).done;)w()}catch(t){g.e(t)}finally{g.f()}u>0&&t.lag(b,u)}for(var S=y.scaler[h].windows,O=!1,A=0;A<n.length;A++){var j=n[A],N=p[j];if(void 0===N){O=!0;break}var P=N[r];if(Number.isNaN(P)||null===P){O=!0;break}var x=S[a?s:j];x.push(P),x.length>(a?e*f:e)&&x.shift()}if(!O&&r+1>=e)for(var _=function(){var e=n[k],o=p[e];if(void 0===o)return 0;var u=o[r];if(Number.isNaN(u)||null===u)return 0;var c="".concat(h,"_").concat(e),f=null,y=S[a?s:e];if("minmax"===i){var v=Math.min.apply(Math,_e(y)),d=Math.max.apply(Math,_e(y));f=ce(u,v,d,l)}else{if("zscore"!==i)throw new Error('Unknown scaler type "'.concat(i,'"'));var m=y.reduce((function(t,r){return t+r}),0)/y.length,b=y.reduce((function(t,r){return t+Math.pow(r-m,2)}),0)/y.length,g=Math.sqrt(b);f=function(t,r,e){return 0===e?0:(t-r)/e}(u,m,g)}t.pushToMain({index:r,key:c,value:f})},k=0;k<n.length&&0!==_();k++);},crossPairs:function(t,r,e,n){var o,i=n.oneHot,a=n.limit,l=t.verticalOhlcv,u=t.verticalOhlcvTempCols,c=t.instances,s=t.len,f=t.precision,p=t.precisionMultiplier,y=t.priceBased,h=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return he(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?he(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(e);try{for(h.s();!(o=h.n()).done;){var v=o.value,d=v.fast,m=v.slow,b="".concat(d,"_x_").concat(m);if(0===r){if("number"==typeof m){var g=m.toString();u.add(g);var w=f&&("price"===d||y.has(d)),S=w?Vr(g,p):m,O=m>=-125&&m<=125&&!1===w?"Int8Array":"Float64Array";l[g]=te(O,s,S)}c.hasOwnProperty("crossPairs")||(c.crossPairs={}),c.crossPairs[b]={run:new we,min:1/0,max:-1/0};var A=null!==a&&a<=125?"Int8Array":"Float64Array";l[b]=te(A,s,0),i&&(l["one_hot_".concat(b)]=te("Array",s,null))}else if(r+1===s){if("price"!==d&&!l.hasOwnProperty(d))throw new Error('crossPairs invalid param: fast "'.concat(d,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(l))));if(!l.hasOwnProperty(m))throw new Error('crossPairs invalid param: slow "'.concat(m,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(l))))}if("price"!==d&&!l.hasOwnProperty(d))return;if(!l.hasOwnProperty(m))return;var j=c.crossPairs[b].run;if("price"===d){var N=l.close[r],P=l[m][r];j.update(r,{fast:N,slow:P,high:l.high[r],low:l.low[r]})}else{var x=l[d][r],_=l[m][r];j.update(r,{fast:x,slow:_})}var k=j.getResult(),E=null!==a?Math.min(Math.max(k,-a),a):k;if(t.pushToMain({index:r,key:b,value:E}),i){var T=E+a,C=2*a+1;t.pushToMain({index:r,key:"one_hot_".concat(b),value:le(T,C)})}}}catch(t){h.e(t)}finally{h.f()}return!0},lag:function(t,r,e,n){var o=t.verticalOhlcv,i=t.len,a=t.priceBased;if(0===r){var l,u=ee(e);try{for(u.s();!(l=u.n()).done;){var c=l.value;if(!o.hasOwnProperty(c))throw new Error('Lag processing invoked by col "'.concat(c,'" was not found in "verticalOhlcv".'));for(var s=a.has(c),f=1;f<=n;f++){var p="".concat(c,"_lag_").concat(f);s&&a.add(p);var y=re(c,o[c]);o[p]=te(y,i)}}}catch(t){u.e(t)}finally{u.f()}}var h,v=ee(e);try{for(v.s();!(h=v.n()).done;)for(var d=h.value,m=o[d],b=1;b<=n;b++){var g="".concat(d,"_lag_").concat(b),w=r-b,S=w<0||void 0===m[w]?null:m[w];t.pushToMain({index:r,key:g,value:S})}}catch(t){v.e(t)}finally{v.f()}return!0}};function mn(t,r){if(t){if("string"==typeof t)return bn(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?bn(t,r):void 0}}function bn(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var gn=function(t){var r=t.main,e=t.skipNull,n=void 0!==e&&e,o=t.startIndex,i=void 0===o?0:o,a=t.dateFormat,l=r.verticalOhlcv,u=r.invalidValueIndex,c=r.len,s=r.verticalOhlcvKeyNames,f=r.verticalOhlcvTempCols,p=r.priceBased,y=r.precision,h=r.precisionMultiplier;if(0===s.length)return[];var v,d,m,b=n&&u>=0?u+1:0,g=Math.max(b,i),w=c-g,S=Array.from({length:w},(function(){return{}})),O={},A=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=mn(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(s);try{for(A.s();!(v=A.n()).done;){var j=v.value;y&&p.has(j)?O[j]=function(t,r){return function(t,r){if("number"!=typeof t||!Number.isFinite(t))throw new Error("revertPrecisionAsNumber expects a finite number");var e=t<0,n=Math.abs(t);n=Math.trunc(n);var o=1===r?0:String(r).length-1;if(0===o)return e?-n:n;var i=Math.trunc(n/r),a=String(n%r).padStart(o,"0"),l=0===(a=a.replace(/0+$/,"")).length?String(i):"".concat(i,".").concat(a);return Number(e?"-".concat(l):l)}(t,r)}:O[j]=function(t){return t}}}catch(t){A.e(t)}finally{A.f()}for(var N=0,P=Object.entries(l);N<P.length;N++){var x=(d=P[N],m=2,function(t){if(Array.isArray(t))return t}(d)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(d,m)||mn(d,m)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),_=x[0],k=x[1];if(!f.has(_))for(var E=g;E<c;E++)S[E-g][_]="date"===_?Xr[a](k[E]):O[_](k[E],h)}return S},wn=function(t,r){u(t,"arr","getOrderFromArray"),h(r,"methodName","getOrderFromArray");var e=["open","high","low","close","volume","date"],n=["regressor","classifier","pca"].includes(r);if(t.every((function(t){return e.includes(t)}))&&!n)return 0;for(var o=1,i=function(){var r=l[a];t.some((function(t){return t.includes(r)}))&&o++},a=0,l=["_x_","zscore_","minmax_","lag_"];a<l.length;a++)i();if(!n)return o;o=10;for(var c=function(){var r=f[s];t.some((function(t){return t.includes(r)}))&&o++},s=0,f=["prediction_","reg_","cla_","pca_"];s<f.length;s++)c();return o};function Sn(t){return Sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sn(t)}function On(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function An(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?On(Object(e),!0).forEach((function(r){jn(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):On(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function jn(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=Sn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Sn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Sn(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Nn(t,r){if(t){if("string"==typeof t)return Pn(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Pn(t,r):void 0}}function Pn(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var xn=function(t,r,e){if(2!==e)throw new Error('The default "yCallback" function in this classifier requires that "options.horizon" and "options.predictions" are set to "2".');var n=r.close[t],o=Array.from({length:e},(function(e,n){return r.close[n+1+t]}));if(o.some((function(t){return void 0===t})))return null;var i=o[0],a=o[1];return[Number(i>n),Number(a>i)]},_n={KNN:{shortName:"knn",flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){return new(0,t.modelClass)(t.xRows,t.yRows,t.modelArgs)},unsupervised:!1},FeedForwardNeuralNetworks:{shortName:"feed_forward",flatY:!1,exportModel:function(t){return t.toJSON()},train:function(t){var r=t.modelClass,e=t.xRows,n=t.yRows,o=t.modelArgs,i=t.uniqueLabels;o||(o={});var a=new r(o=An(An({},o),{},{activation:2===i?"logistic":"identity"}));return a.train(e,n),a},unsupervised:!1},GaussianNB:{shortName:"naive_bayes",flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){var r=t.modelClass,e=t.xRows,n=t.yRows,o=new r(t.modelArgs);return o.train(e,n),o},unsupervised:!1},MultinomialNB:{shortName:"naive_bayes",flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){var r=t.modelClass,e=t.xRows,n=t.yRows,o=new r(t.modelArgs);return o.train(e,n),o},unsupervised:!1},DecisionTreeClassifier:{shortName:"decision_tree",flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){var r=t.modelClass,e=t.xRows,n=t.yRows,o=new r(t.modelArgs);return o.train(e,n),o},unsupervised:!1},RandomForestClassifier:{shortName:"random_forest",flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){var r=t.modelClass,e=t.xRows,n=t.yRows,o=new r(t.modelArgs);return o.train(e,n),o}},unsupervised:!1},kn={ARIMA:{shortName:"arima",flatX:!0,flatY:!1,exportModel:function(t){return t},train:function(t){var r=t.modelClass,e=t.xRows,n=t.modelArgs;n||(n={});var o=new r(n=An(An({},n),{},{p:2,d:1,q:2,P:0,D:0,Q:0,S:0,verbose:!1}));return o.train(e),o},unsupervised:!0},SimpleLinearRegression:{shortName:"linear",flatX:!0,flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){return new(0,t.modelClass)(t.xRows,t.yRows,t.modelArgs)},unsupervised:!1},PolynomialRegression:{shortName:"polynomial",flatX:!0,flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){return new(0,t.modelClass)(t.xRows,t.yRows,t.modelArgs)},unsupervised:!1},MultivariateLinearRegression:{shortName:"multivariable",flatX:!1,flatY:!1,exportModel:function(t){return t.toJSON()},train:function(t){return new(0,t.modelClass)(t.xRows,t.yRows,t.modelArgs)},unsupervised:!1},DecisionTreeRegression:{shortName:"decision_tree",flatX:!1,flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){var r=t.modelClass,e=t.xRows,n=t.yRows,o=new r(t.modelArgs);return o.train(e,n),o},unsupervised:!1},RandomForestRegression:{shortName:"random_forest",flatX:!1,flatY:!0,exportModel:function(t){return t.toJSON()},train:function(t){var r=t.modelClass,e=t.xRows,n=t.yRows,o=new r(t.modelArgs);return o.train(e,n),o},unsupervised:!1},FeedForwardNeuralNetworks:{shortName:"feed_forward",flatX:!1,flatY:!1,exportModel:function(t){return t.toJSON()},train:function(t){var r=t.modelClass,e=t.xRows,n=t.yRows,o=t.modelArgs;o||(o={});var i=new r(o=An(An({},o),{},{activation:"identity"}));return i.train(e,n),i},unsupervised:!1}};function En(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function Tn(t){return Tn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tn(t)}function Cn(t,r,e){return(r=Fn(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Mn(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Dn(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}function In(t){return function(t){if(Array.isArray(t))return Rn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Dn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dn(t,r){if(t){if("string"==typeof t)return Rn(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Rn(t,r):void 0}}function Rn(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function Ln(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Fn(n.key),n)}}function Fn(t){var r=function(t,r){if("object"!=Tn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Tn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tn(r)?r:r+""}var Bn=function(){return t=function t(r){var e=this,n=r.input,o=r.ticker,i=void 0===o?null:o,l=r.inputParams,s=void 0===l?null:l,y=r.chunkProcess,h=void 0===y?2e3:y,v=r.ML,d=void 0===v?{}:v,m=r.precision,b=void 0!==m&&m;if(function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),u(n,"input",null!==i?"contructor ".concat(i):"constuctor"),0===n.length)throw Error("input OHLCV must not be empty: "+i);p(h,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),c(d,"ML","constructor"),f(b,"precision","contructor"),this.chunkProcess=h,this.input=In(n),this.len=this.input.length,this.firstRow=this.input[0],this.precision=b;var g=["open","high","low","close"];this.initialPriceBased=new Set(g),this.priceBased=new Set(g),this.precisionMultiplier=function(t){var r=t.precision,e=t.firstRow,n=t.initialPriceBased;if(!1===r)return 1;for(var o=1,i=0,a=Object.entries(e);i<a.length;i++){var l=Ur(a[i],2),u=l[0],c=l[1];if(n.has(u)){if("string"!=typeof c||!/^\d+(\.\d+)?$/.test(c))throw new Error('If "precision" is set to true all the "open", "high", "low" and "close" values must be numeric strings like "123.45" with no commas or currency symbols. Property "'.concat(u,'" had the value "').concat(c,'" type ').concat(zr(c),"."));var s=Ur(c.split("."),2),f=s[0],p=s[1],y=void 0===p?"":p,h=Number(f),v=4;if(0===Math.abs(h)){var d=y.length,m=Math.max(4,d),b=y.search(/[1-9]/);if(-1===b)v=m;else{var g=b+1+5;v=Math.max(m,g)}}var w=Math.pow(10,v);w>o&&(o=w)}}return o}(this);var w=function(t){for(var r=t.firstRow,e=t.precision,n=t.initialPriceBased,o={},i={},a=0,l=Object.entries(r);a<l.length;a++){var u=Zr(l[a],2),c=u[0],s=u[1];if("date"===c)o[c]=Jr(s),i[c]="Array";else if("volume"===c)o[c]=Hr(s,!0),i[c]="Int32Array";else if(n.has(c))o[c]=Hr(s,!0,e),i[c]="Float64Array";else{var f=Hr(s,!1,e);o[c]=f,i[c]="number"===f?"Float64Array":"Array"}}return{inputTypes:o,arrayTypes:i}}(this),S=w.inputTypes,O=w.arrayTypes;if(this.inputTypes=S,this.arrayTypes=O,!this.firstRow.hasOwnProperty("close"))throw Error('input OHLCV array objects require at least "close" property: '.concat(i));this.dateType=this.inputTypes.date?this.inputTypes.date:null,this.isComputed=!1,this.instances={},this.verticalOhlcv={},this.verticalOhlcvKeyNames=[],this.verticalOhlcvTempCols=new Set,this.utilities={},this.invalidValueIndex=-1,this.scaledGroups={},this.isAlreadyComputed=new Set;var A=d.classes;return void 0!==A&&c(A,"ML.classes","constructor"),this.ML={models:{},classes:A,metrics:{},featureCols:{}},this.processSecondaryLoop=!1,this.pushToMain=function(t){var r=t.index,n=t.key,o=t.value;return function(t){var r=t.index,e=t.key,n=t.value;return t.main.verticalOhlcv[e][r]=n,!0}({main:e,index:r,key:n,value:o})},null!==s?(a(s,this.len),this.inputParams=s,this.compute()):this.inputParams=[],this},r=[{key:"getData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var r=t.skipNull,e=void 0===r||r,n=t.dateFormat,o=void 0===n?"string":n;return s(Object.keys(Xr),o,"dateFormat","getData"),c(t,"options","getData"),gn({main:this,skipNull:e,startIndex:0,dateFormat:o})}},{key:"getLastValues",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var r=t.dateFormat,e=void 0===r?"string":r;return s(Object.keys(Xr),e,"dateFormat","getData"),gn({skipNull:!1,main:this,startIndex:this.len-1,dateFormat:e})[0]}},{key:"compute",value:function(){return this.isComputed||(this.isComputed=!1,this.len>0&&(function(t,r){var n=r.len,o=r.inputParams,i=r.arrayTypes,l=r.verticalOhlcv,u=r.verticalOhlcvKeyNames,c=r.inputTypes,s=r.chunkProcess,f=r.processSecondaryLoop,p=r.precisionMultiplier;a(o,n);for(var y=0,h=Object.keys(c);y<h.length;y++){var v=h[y];l[v]=te(i[v],n)}for(var d=0;d<n;d+=s)for(var m=Math.min(d+s,n),b=d;b<m;b++){for(var g=t[b],w=0,S=Object.entries(c);w<S.length;w++){var O=yn(S[w],2),A=O[0],j=O[1],N=g[A];if(Gr.hasOwnProperty(j)){void 0===N&&console.log({index:b,formaterKey:j,key:A});var P=Gr[j](N,p);r.pushToMain({index:b,key:A,value:P})}else Kr.hasOwnProperty(j)?r.pushToMain({index:b,key:A,value:Kr[j](N)}):r.pushToMain({index:b,key:A,value:N})}var x,_=pn(o);try{for(_.s();!(x=_.n()).done;)for(var k=x.value,E=k.key,T=k.params,C=k.order,M=0;M<=9;M++){if("number"!=typeof C)throw new Error("order property of ".concat(E," not found: ").concat(T));M===C&&dn[E].apply(dn,[r,b].concat(fn(T)))}}catch(t){_.e(t)}finally{_.f()}t[b]=null;var I=Object.keys(l);e(r,b,I)||(r.invalidValueIndex=b)}(o.some((function(t){var r=t.key;return"regressor"===r||"classifier"===r||"pca"===r}))||f)&&function(t){for(var r=t.inputParams,e=t.len,n=t.invalidValueIndex+1;n<e;n++){var o,i=pn(r);try{for(i.s();!(o=i.n()).done;)for(var a=o.value,l=a.key,u=a.params,c=a.order,s=10;s<=20;s++){if("number"!=typeof c)throw new Error("order property of ".concat(l," not found: ").concat(u));s===c&&("pca"===l&&ze.apply(void 0,[t,n].concat(fn(u))),"classifier"===l&&sn.apply(void 0,[t,n].concat(fn(u))),"regressor"===l&&Ge.apply(void 0,[t,n].concat(fn(u))))}}catch(t){i.e(t)}finally{i.f()}}}(r),u.push.apply(u,fn(Object.keys(l)))}(this.input,this),this.isComputed=!0,this.input=[],this.instances={},this.firstRow=[])),this}},{key:"crossPairs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e="crossPairs";l(this),u(t,"arr",e),c(r,"options",e);var n=r.limit,o=void 0===n?null:n,i=r.oneHot,a=void 0!==i&&i;null!==o&&p(o,{min:2,max:this.len},"options.limit",e),f(a,"options.oneHot",e);var s,y=[],h=Mn(t);try{for(h.s();!(s=h.n()).done;){var v=s.value,d=v.fast,m=void 0===d?"":d,b=v.slow,g=void 0===b?"":b;if(""===m||""===g)throw new Error("Invalid crossPairs[".concat(m,"_").concat(g,"]: Object property “fast” must be a non-null column name and “slow” must be a non-null column name or integer."));y.push(m.toString(),g.toString())}}catch(t){h.e(t)}finally{h.f()}if(this.isAlreadyComputed.has(e))throw new Error('You can only call the "'.concat(e,'" method once.'));this.isAlreadyComputed.add(e);var w=wn(y,e);return this.inputParams.push({key:e,order:w,params:[t,{limit:o,oneHot:a}]}),this}},{key:"lag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["close"],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e="lag";l(this),u(t,"colKeys",e),p(r,{min:1,max:this.len,allowDecimals:!1},"lookback",e);var n=wn(t,e);return this.inputParams.push({key:e,order:n,params:[t,r]}),this}},{key:"relativeVolume",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e="relativeVolume";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",e),c(r,"options",e);var n=r.lag,o=void 0===n?0:n;return p(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),this.inputParams.push({key:e,order:0,params:[t,{lag:o}]}),this}},{key:"volumeDelta",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r="volumeDelta";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeDelta" is called the input ohlcv must contain valid volume properties.');l(this),c(t,"options",r);var e=t.lag,n=void 0===e?0:e;return p(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,order:0,params:[{lag:n}]}),this}},{key:"atr",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e="atr";l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",e),c(r,"options",e);var n=r.lag,o=void 0===n?0:n,i=r.percentage,a=void 0!==i&&i,u=r.upper,s=void 0===u?null:u,y=r.lower,h=void 0===y?null:y;return p(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),f(a,"options.percentage","atr"),null!==s&&p(s,{min:.001,max:100,allowDecimals:!0},"options.upper","atr"),null!==h&&p(h,{min:.001,max:100,allowDecimals:!0},"options.lower","atr"),this.inputParams.push({key:e,order:0,params:[t,{lag:o,percentage:a,upper:s,lower:h}]}),this}},{key:"ema",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e="ema";l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",e),c(r,"options",e);var n=r.target,o=void 0===n?"close":n,i=r.lag,a=void 0===i?0:i;h(o,"options.target",e),p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",e);var u=wn([o],e);return this.inputParams.push({key:e,order:u,params:[e,t,{target:o,lag:a}]}),this}},{key:"sma",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e="sma";l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",e),c(r,"options",e);var n=r.target,o=void 0===n?"close":n,i=r.lag,a=void 0===i?0:i;h(o,"options.target",e),p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",e);var u=wn([o],e);return this.inputParams.push({key:e,order:u,params:[e,t,{target:o,lag:a}]}),this}},{key:"heikenAshi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="heikenAshi";l(this);var o=null===t&&null===r;!1===o&&(p(t,{min:1,max:this.len,allowDecimals:!1},"smoothLength",n),p(r,{min:1,max:this.len,allowDecimals:!1},"afterSmoothLength",n)),c(e,"options",n);var i=e.lag,a=void 0===i?0:i;return p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,order:0,params:[t,r,{lag:a,bothNull:o}]}),this}},{key:"vidya",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="vidya";l(this),p(t,{min:2,max:this.len,allowDecimals:!1},"size",n),p(r,{min:1,max:this.len,allowDecimals:!1},"momentum",n),c(e,"options",n);var o=e.target,i=void 0===o?"close":o,a=e.lag,u=void 0===a?0:a,s=e.atrLength,f=void 0===s?200:s,y=e.bandDistance,v=void 0===y?2:y,d=e.liquidityLookback,m=void 0===d?20:d;h(i,"options.target",n),p(u,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),p(v,{min:.01,max:10,allowDecimals:!0},"options.bandDistance",n),p(f,{min:2,max:this.len,allowDecimals:!1},"options.atrLength",n),p(m,{min:1,max:this.len,allowDecimals:!1},"options.liquidityLookback",n);var b=wn([i],n);return this.inputParams.push({key:n,order:b,params:[t,r,{target:i,lag:u}]}),this}},{key:"stochastic",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o="stochastic",i=this.len;p(t,{min:1,max:i,allowDecimals:!1},"kPeriod",o),p(r,{min:1,max:i,allowDecimals:!1},"kSlowingPeriod",o),p(e,{min:1,max:i,allowDecimals:!1},"dPeriod",o),c(n,"options",o);var a=function(t){return t},l="",u=n.lag,s=void 0===u?0:u;p(s,{min:0,max:i,allowDecimals:!1},"options.lag",o);var h=n.minmax;return(Array.isArray(h)||"boolean"==typeof h&&!0===h)&&(Array.isArray(h)?(y(h,"options.minmax",o),a=function(t){return null!==h?ce(t,0,100,h):t}):(f(h,"options.minmax",o),h=[0,1],a=function(t){return null!==h?ce(t,0,100,h):t}),l="minmax_"),this.inputParams.push({key:o,order:0,params:[t,r,e,{minmax:h,prefix:l,parser:a,lag:s}]}),this}},{key:"macd",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:26,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o="macd";l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"fast",o),p(r,{min:1,max:this.len,allowDecimals:!1},"slow",o),p(e,{min:1,max:this.len,allowDecimals:!1},"signal",o),c(n,"options",o);var i=n.target,a=void 0===i?"close":i,u=n.lag,s=void 0===u?0:u;h(a,"options.target",o),p(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",o);var f={instanceKey:"".concat(t,"_").concat(r,"_").concat(e).concat("close"===a?"":"_".concat(a))},y=wn([a],o);return this.inputParams.push({key:o,order:y,params:[t,r,e,{target:a,lag:s,precomputed:f}]}),this}},{key:"bollingerBands",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="bollingerBands";l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",n),p(r,{min:.01,max:50,allowDecimals:!0},"stdDev",n),c(e,"options",n);var o=e.target,i=void 0===o?"close":o,a=e.height,s=void 0!==a&&a,y=e.range,v=void 0===y?[]:y,d=e.lag,m=void 0===d?0:d;h(i,"options.target",n),u(v,"options.range",n),p(m,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(s,"options.height",n);var b=wn([i],n);return this.inputParams.push({key:n,order:b,params:[t,r,{target:i,height:s,range:v,lag:m}]}),this}},{key:"rsi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e="rsi";l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",e),c(r,"options",e);var n=r.target,o=void 0===n?"close":n,i=r.lag,a=void 0===i?0:i,u=r.minmax;h(o,"options.target",e),p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",e);var s=function(t){return t},v="";(Array.isArray(u)||"boolean"==typeof u&&!0===u)&&(Array.isArray(u)?(y(u,"options.minmax",e),s=function(t){return null!==u?ce(t,0,100,u):t}):(f(u,"options.minmax",e),u=[0,1],s=function(t){return null!==u?ce(t,0,100,u):t}),v="minmax_");var d=wn([o],e);return this.inputParams.push({key:e,order:d,params:[t,{target:o,lag:a,parser:s,prefix:v,minmax:u}]}),this}},{key:"donchianChannels",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="donchianChannels";l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",n),p(r,{min:0,max:this.len,allowDecimals:!1},"offset",n),c(e,"options",n);var o=e.height,i=void 0!==o&&o,a=e.range,s=void 0===a?[]:a,y=e.lag,h=void 0===y?0:y;return u(s,"options.range",n),p(h,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(i,"options.height",n),this.inputParams.push({key:n,order:0,params:[t,r,{height:i,range:s,lag:h}]}),this}},{key:"volumeOscillator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="volumeOscillator";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');l(this),p(t,{min:1,max:this.len,allowDecimals:!1},"fastsize",n),p(r,{min:t,max:this.len,allowDecimals:!1},"slowsize",n),c(e,"options",n);var o=e.lag,i=void 0===o?0:o;return p(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,order:0,params:[t,r,{lag:i}]}),this}},{key:"dateTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r="dateTime";l(this),c(t,"options",r);var e=t.lag,n=void 0===e?0:e,o=t.oneHot,i=void 0!==o&&o;p(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),f(i,"options.oneHot",r);var a=i?"one_hot_":"",u=Cn(Cn(Cn(Cn(Cn({},"".concat(a,"month"),12),"".concat(a,"day_of_the_month"),31),"".concat(a,"day_of_the_week"),7),"".concat(a,"hour"),24),"".concat(a,"minute"),60),s={prefix:a,colKeySizes:u,colKeys:Object.keys(u)};return this.inputParams.push({key:r,order:0,params:[{lag:n,oneHot:i,precompute:s}]}),this}},{key:"scaler",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"zscore",r=arguments.length>1?arguments[1]:void 0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="scaler";l(this),p(r,{min:1,max:this.len,allowDecimals:!1},"size",n),c(e,"options",n);var o=e.group,i=void 0!==o&&o,a=e.range,h=void 0===a?[0,1]:a,v=e.lag,d=void 0===v?0:v,m=e.colKeys,b=void 0===m?[]:m;u(b,"options.colKeys",n),f(i,"options.group",n),y(h,"options.range",n),s(["minmax","zscore"],t,"options.type",n);var g={groupKey:"".concat(t,"_").concat(r),groupKeyLen:b.length},w=!1,S=wn(b,n);return S>=10&&(w=!0),this.inputParams.push({key:n,order:S,params:[r,b,{type:t,group:i,range:h,lag:d,precomputed:g,secondaryLoop:w}]}),this}},{key:"classifier",value:function(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l(this);var n="classifier";p(r,{max:this.len,allowDecimals:!1},"trainingSize",n),c(e,"options",n);var o=e.retrain,i=void 0!==o&&o,a=e.trainingCols,y=void 0===a?[]:a,h=e.type,v=void 0===h?"KNN":h,d=e.lookback,m=void 0===d?0:d,b=e.findGroups,g=void 0===b?[]:b,w=e.predictions,S=void 0===w?2:w,O=e.horizon,A=void 0===O?2:O,j=e.modelArgs,N=void 0===j?void 0:j,P=e.filterCallback,x=void 0===P?function(){return!0}:P;if(void 0!==N&&("object"!==Tn(N)||null===N||Array.isArray(N)))throw new TypeError('"modelArgs" must be either undefined or a plain object in '.concat(v));var _=null!==(t=e.yCallback)&&void 0!==t?t:xn;if("function"!=typeof _)throw new Error('"yCallback" must be a function in the following format:\n\n---\n\nconst yCallback = '.concat(xn.toString(),"\n\n---\n\n"));if(s(Object.keys(_n),v,"options.type",n),!this.ML.classes.hasOwnProperty(v))throw new Error('"'.concat(v,'" isn’t available because its library wasn’t imported into OHLCV_INDICATORS.ML.'));f(i,"options.retrain",n),u(y,"options.trainingCols",n),p(A,{min:1,max:this.len,allowDecimals:!1},"options.horizon",n),p(m,{max:0,allowDecimals:!1},"options.lookback",n),p(S,{min:1,allowDecimals:!1},"options.predictions",n);var k=In(y);if(u(g,"options.findGroups","scaler")&&g.length>0){var E,T=Mn(g);try{for(T.s();!(E=T.n()).done;){var C=E.value,M=C.type,I=void 0===M?"":M,D=C.size,R=C.groupName,L=void 0===R?"":R;if(!I||!D&&!L||D&&L)throw new Error('If "options.findGroups" array is set, each item must be an object that includes the "type" (mandatory) and either "size" or "groupName" (choose 1) used to locate previously scaled (minmax or zscore) groups.');k.push(I.toString(),L.toString())}}catch(t){T.e(t)}finally{T.f()}}else if(0===y.length)throw new Error('"trainingCols" array is empty in '.concat(n));var F=_n[v],B=F.shortName,z=F.flatY,U="cla_".concat(B,"_").concat(r,"_prediction");if(this.isAlreadyComputed.has(U))throw new Error("Each classifier must have a unique pair of “type” and trainingSize.\nThis rule ensures that your output columns are labeled unambiguously.\n"+'You provided a duplicate: type="'.concat(v,'" with trainingSize=').concat(r,"."));var Y={lookbackAbs:Math.abs(m)+1,flatY:z,prefix:U};this.isAlreadyComputed.add(U);var V=wn(k,n),q=_n[v],G=this.ML.classes[v];return this.inputParams.push({key:n,order:V,params:[r,{yCallback:_,predictions:S,lookback:m,retrain:i,trainingCols:y,findGroups:g,horizon:A,type:v,modelArgs:N,precompute:Y,filterCallback:x,modelConfig:q,modelClass:G}]}),this}},{key:"regressor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:200,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l(this);var e="regressor";p(t,{max:this.len,allowDecimals:!1},"trainingSize",e),c(r,"options",e);var n=r.retrain,o=void 0!==n&&n,i=r.target,a=void 0===i?"close":i,y=r.predictions,v=void 0===y?1:y,d=r.trainingCols,m=void 0===d?[]:d,b=r.type,g=void 0===b?"SimpleLinearRegression":b,w=r.lookback,S=void 0===w?0:w,O=r.findGroups,A=void 0===O?[]:O,j=r.modelArgs,N=void 0===j?void 0:j,P=r.filterCallback,x=void 0===P?function(){return!0}:P;if(s(Object.keys(kn),g,"type",e),!this.ML.classes.hasOwnProperty(g))throw new Error('"'.concat(g,'" isn’t available because its library wasn’t imported into OHLCV_INDICATORS.ML.'));f(o,"options.retrain",e),h(a,"options.target",e),p(v,{min:1,allowDecimals:!1},"predictions",e),p(S,{max:0,allowDecimals:!1},"lookback",e),u(m,"options.trainingCols",e);var _=kn[g],k=_.shortName,E=_.flatX,T=_.flatY,C="reg_".concat(k,"_").concat(t,"_").concat(a,"_prediction"),M=In(m);if(u(A,"options.findGroups","scaler")&&A.length>0){var I,D=Mn(A);try{for(D.s();!(I=D.n()).done;){var R=I.value,L=R.type,F=void 0===L?"":L,B=R.size,z=R.groupName,U=void 0===z?"":z;if(!F||!B&&!U||B&&U)throw new Error('If "options.findGroups" array is set, each item must be an object that includes the "type" (mandatory) and either "size" or "groupName" (choose 1) used to locate previously scaled (minmax or zscore) groups.');M.push(F.toString(),U.toString())}}catch(t){D.e(t)}finally{D.f()}}else if(0===m.length&&!1===E)throw new Error('"trainingCols" array is empty in '.concat(e," ").concat(g));if(E){if(m.length>0)throw new Error("If regressor type is ".concat(g,' then leave "options.trainingCols" array empty.'));if(S>0)throw new Error("If regressor type is ".concat(g,' then "options.lookback" must be 0.'));if(A.length>0)throw new Error("If regressor type is ".concat(g,' then "options.findGroups" must be null.'));m.push(a)}if(this.isAlreadyComputed.has(C))throw new Error('Each regressor must have a unique "type", "trainingSize" and "target".\nThis rule ensures that your output columns are labeled unambiguously.\n'+'You provided a duplicate: type="'.concat(g,'", trainingSize=').concat(t," target=").concat(a,"."));var Y={lookbackAbs:Math.abs(S)+1,flatX:E,flatY:T,prefix:C};this.isAlreadyComputed.add(C);var V=wn(M,e),q=kn[g],G=this.ML.classes[g];return this.inputParams.push({key:e,order:V,params:[t,{target:a,predictions:v,retrain:o,lookback:S,trainingCols:m,findGroups:A,type:g,modelArgs:N,precompute:Y,filterCallback:x,modelConfig:q,modelClass:G}]}),this}},{key:"pca",value:function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="pca";p(r,{min:1,max:this.len},"trainingSize",n),h(t,"suffix",n),c(e,"options",n);var o=e.findGroups,i=void 0===o?[]:o,a=e.trainingCols,l=void 0===a?[]:a,y=e.lookback,v=void 0===y?0:y,d=e.filterCallback,m=void 0===d?function(){return!0}:d;u(l,"options.trainigCols",n),p(v,{min:0,max:this.len,allowDecimals:!1},"options.lookback",n),void 0!==e.modelArgs?c(e.modelArgs,"options.modelArgs",n):e.modelArgs={};var b=function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?En(Object(e),!0).forEach((function(r){Cn(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):En(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}({showSource:!1,storeModel:!1,isCovarianceMatrix:!1,method:"NIPALS",center:!0,scale:!1,nCompNIPALS:5,ignoreZeroVariance:!1},e.modelArgs);f(b.showSource,"options.modelArgs.showSource",n),f(b.storeModel,"options.modelArgs.storeModel",n),f(b.isCovarianceMatrix,"options.modelArgs.isCovarianceMatrix",n),f(b.center,"options.modelArgs.center",n),f(b.scale,"options.modelArgs.scale",n),f(b.ignoreZeroVariance,"options.modelArgs.ignoreZeroVariance",n),s(["SVD","NIPALS","covarianceMatrix"],b.method,"options.modelArgs.method",n),p(b.nCompNIPALS,{min:1},"options.modelArgs.nCompNIPALS",n);var g=[];if(u(i,"options.findGroups","pca")&&i.length>0){var w,S=Mn(i);try{for(S.s();!(w=S.n()).done;){var O=w.value,A=O.type,j=void 0===A?"":A,N=O.size,P=O.groupName,x=void 0===P?"":P;if(!j||!N&&!x||N&&x)throw new Error('If "options.findGroups" array is set, each item must be an object that includes the "type" (mandatory) and either "size" or "groupName" (choose 1) used to locate previously scaled (minmax or zscore) groups.');g.push(j.toString(),x.toString())}}catch(t){S.e(t)}finally{S.f()}}var _=wn(g,n),k="pca_".concat(t,"_").concat(r);if(this.isAlreadyComputed.has(k))throw new Error('Each regressor must have a unique "suffix" param.\nThis rule ensures that your output columns are labeled unambiguously.\n'+'You provided a duplicate: type="'.concat(t,'".'));var E=Math.abs(v)+1;return this.isAlreadyComputed.add(k),this.inputParams.push({key:n,order:_,params:[{prefix:k,trainingSize:r,findGroups:i,trainingCols:l,lookbackAbs:E,modelArgs:b,filterCallback:m}]}),this}},{key:"exportTrainedModels",value:function(){return function(t){var r,e,n,o=t.ML,i=t.inputParams,a=o.models,l={},u=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Nn(t))){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(i);try{for(u.s();!(r=u.n()).done;){var c=r.value,s=c.key,f=c.params;if("classifier"===s||"regressor"===s){var p=(n=2,function(t){if(Array.isArray(t))return t}(e=f)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,n)||Nn(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),y=(p[0],p[1]),h=y.type,v=y.predictions,d=y.precompute,m=d.flatY,b=d.prefix,g=m?v:1,w=void 0;"regressor"===s?w=kn[h].exportModel:"classifier"===s&&(w=_n[h].exportModel);for(var S=0;S<g;S++){var O="".concat(b,"_").concat(S+1);l[O]=w(a[O])}}}}catch(t){u.e(t)}finally{u.f()}return l}(this)}},{key:"mapCols",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["change"],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};l(this);var n="mapCols";null==r&&(r=Me),c(e,"options",n);var o=e.lag,i=void 0===o?0:o,a=e.isPriceBased,s=void 0!==a&&a;if(u(t,"newCols",n),p(i,{min:0,allowDecimals:!1},"options.lag",n),f(s,"isPriceBased","mapCols"),!1===this.precision&&s)throw new Error('Invalid param: If "mapCols.options.isPriceBased" is true, the "constructor.precision" param must be also true.');var y=wn(t,n);return this.inputParams.push({key:n,order:y,params:[t,r,{lag:i,isPriceBased:s}]}),this}}],r&&Ln(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}()})(),OHLCV_INDICATORS=r})();
1
+ var OHLCV_INDICATORS;(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{t.r(e),t.d(e,{default:()=>Wr});var r=function(t,e,r){if(0===r.length)return!1;for(var n=t.verticalOhlcv,o=!0,i=0;i<r.length;i++){var a=r[i];if(!n.hasOwnProperty(a)){o=!1;break}var u=n[a][e];if(null==u||Number.isNaN(u)){o=!1;break}}return o};function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){l=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(l)throw a}}}}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var a=function(t,e){if(!Array.isArray(t))throw new Error('Property "inputParams" must be an "Array" or "Set".');var r,o=n(t);try{for(o.s();!(r=o.n()).done;){var i,a=n(r.value.params);try{for(a.s();!(i=a.n()).done;){var u=i.value;if("number"==typeof u&&u>e)throw console.log(u,e),new Error("At least one of the params of the indicator is greater than the input OHLCV length. Make sure to have enough datapoints in the input OHLCV.")}}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}},u=function(t){if(!0===t.isComputed)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" or "getData" methods are called.')},l=function(t,e,r){if(!Array.isArray(t))throw new Error('Param "'.concat(e,'" must be an array in "').concat(r,'".'));return!0},c=function(t,e,r){if(t instanceof Object==0)throw new Error('Param "'.concat(e,'" must be an object in "').concat(r,'".'));return!0},s=function(t,e,r,n){if(l(t,"arrayOptions","".concat(n,".").concat(r,".validateArrayOptions")),!t.includes(e.toString()))throw new Error('Param "'.concat(r,'" must be any of the following values [').concat(t.join(", "),'] in "').concat(n,'".'));return!0},f=function(t,e,r){if("boolean"!=typeof t)throw new Error('Param "'.concat(e,'" must be an boolean in "').concat(r,'".'));return!0},p=function(t,e,r,n){c(e,"options","".concat(n,".").concat(r,".validateNumber"));var o=e.allowDecimals,i=void 0!==o&&o,a=e.min,u=e.max,l=i?"number":"integer";if("number"!=typeof t||!1===i&&!Number.isInteger(t))throw new Error('Param "'.concat(r,'" must be an ').concat(l,' in "').concat(n,'".'));if(void 0!==a&&"number"!=typeof a)throw new Error('Param "min" must be a valid '.concat(l,' (if provided) in "').concat(n,".").concat(r,'.validateNumber".'));if(void 0!==u&&"number"!=typeof u)throw new Error('Param "max" must be a valid '.concat(l,' (if provided) in "').concat(n,".").concat(r,'.validateNumber".'));if(void 0!==a&&void 0!==u&&a>=u)throw new Error('Param "min" must be less than "max" in "'.concat(n,".").concat(r,'.validateNumber".'));if(void 0!==a&&t<a)throw new Error('Param "'.concat(r,'" must be an ').concat(l," ≥ ").concat(a,' in "').concat(n,'".'));if(void 0!==u&&t>u)throw new Error('Param "'.concat(r,'" must be an ').concat(l," ≤ ").concat(u,' in "').concat(n,'".'));return!0},y=function(t,e,r){if(l(t,e,r),2!==t.length)throw new Error('Invalid "'.concat(e,'" array length: expected 2 items, but got ').concat(t.length,' in "').concat(r,".").concat(e,'".'));var n,i,a=(i=2,function(t){if(Array.isArray(t))return t}(n=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(n,i)||o(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=a[0],c=a[1];if(p(u,{min:-100,max:c,allowDecimals:!1},"min",r),p(c,{min:u,max:100,allowDecimals:!1},"max",r),u===c)throw new Error('Invalid "min" can not be equal to "max" property in "'.concat(r,".").concat(e,'".'));return!0},h=function(t,e,r){if("string"!=typeof t||!t.length)throw new Error('Invalid "'.concat(e,'" property in "').concat(r,'". Only strings are accepted.'));return!0},v=1e6,m="[big.js] ",d=m+"Invalid ",b=d+"decimal places",g=d+"rounding mode",w=m+"Division by zero",O={},S=void 0,j=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function N(t,e,r,n){var o=t.c;if(r===S&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(g);if(e<1)n=3===r&&(n||!!o[0])||0===e&&(1===r&&o[0]>=5||2===r&&(o[0]>5||5===o[0]&&(n||o[1]!==S))),o.length=1,n?(t.e=t.e-e+1,o[0]=1):o[0]=t.e=0;else if(e<o.length){if(n=1===r&&o[e]>=5||2===r&&(o[e]>5||5===o[e]&&(n||o[e+1]!==S||1&o[e-1]))||3===r&&(n||!!o[0]),o.length=e,n)for(;++o[--e]>9;)if(o[e]=0,0===e){++t.e,o.unshift(1);break}for(e=o.length;!o[--e];)o.pop()}return t}function _(t,e,r){var n=t.e,o=t.c.join(""),i=o.length;if(e)o=o.charAt(0)+(i>1?"."+o.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)o="0"+o;o="0."+o}else if(n>0)if(++n>i)for(n-=i;n--;)o+="0";else n<i&&(o=o.slice(0,n)+"."+o.slice(n));else i>1&&(o=o.charAt(0)+"."+o.slice(1));return t.s<0&&r?"-"+o:o}function P(t){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(t)}function A(t){var e="function"==typeof Map?new Map:void 0;return A=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(x())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&k(o,r.prototype),o}(t,arguments,T(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),k(r,t)},A(t)}function x(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(x=function(){return!!t})()}function k(t,e){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},k(t,e)}function T(t){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},T(t)}O.abs=function(){var t=new this.constructor(this);return t.s=1,t},O.cmp=function(t){var e,r=this,n=r.c,o=(t=new r.constructor(t)).c,i=r.s,a=t.s,u=r.e,l=t.e;if(!n[0]||!o[0])return n[0]?i:o[0]?-a:0;if(i!=a)return i;if(e=i<0,u!=l)return u>l^e?1:-1;for(a=(u=n.length)<(l=o.length)?u:l,i=-1;++i<a;)if(n[i]!=o[i])return n[i]>o[i]^e?1:-1;return u==l?0:u>l^e?1:-1},O.div=function(t){var e=this,r=e.constructor,n=e.c,o=(t=new r(t)).c,i=e.s==t.s?1:-1,a=r.DP;if(a!==~~a||a<0||a>v)throw Error(b);if(!o[0])throw Error(w);if(!n[0])return t.s=i,t.c=[t.e=0],t;var u,l,c,s,f,p=o.slice(),y=u=o.length,h=n.length,m=n.slice(0,u),d=m.length,g=t,O=g.c=[],j=0,_=a+(g.e=e.e-t.e)+1;for(g.s=i,i=_<0?0:_,p.unshift(0);d++<u;)m.push(0);do{for(c=0;c<10;c++){if(u!=(d=m.length))s=u>d?1:-1;else for(f=-1,s=0;++f<u;)if(o[f]!=m[f]){s=o[f]>m[f]?1:-1;break}if(!(s<0))break;for(l=d==u?o:p;d;){if(m[--d]<l[d]){for(f=d;f&&!m[--f];)m[f]=9;--m[f],m[d]+=10}m[d]-=l[d]}for(;!m[0];)m.shift()}O[j++]=s?c:++c,m[0]&&s?m[d]=n[y]||0:m=[n[y]]}while((y++<h||m[0]!==S)&&i--);return O[0]||1==j||(O.shift(),g.e--,_--),j>_&&N(g,_,r.RM,m[0]!==S),g},O.eq=function(t){return 0===this.cmp(t)},O.gt=function(t){return this.cmp(t)>0},O.gte=function(t){return this.cmp(t)>-1},O.lt=function(t){return this.cmp(t)<0},O.lte=function(t){return this.cmp(t)<1},O.minus=O.sub=function(t){var e,r,n,o,i=this,a=i.constructor,u=i.s,l=(t=new a(t)).s;if(u!=l)return t.s=-l,i.plus(t);var c=i.c.slice(),s=i.e,f=t.c,p=t.e;if(!c[0]||!f[0])return f[0]?t.s=-l:c[0]?t=new a(i):t.s=1,t;if(u=s-p){for((o=u<0)?(u=-u,n=c):(p=s,n=f),n.reverse(),l=u;l--;)n.push(0);n.reverse()}else for(r=((o=c.length<f.length)?c:f).length,u=l=0;l<r;l++)if(c[l]!=f[l]){o=c[l]<f[l];break}if(o&&(n=c,c=f,f=n,t.s=-t.s),(l=(r=f.length)-(e=c.length))>0)for(;l--;)c[e++]=0;for(l=e;r>u;){if(c[--r]<f[r]){for(e=r;e&&!c[--e];)c[e]=9;--c[e],c[r]+=10}c[r]-=f[r]}for(;0===c[--l];)c.pop();for(;0===c[0];)c.shift(),--p;return c[0]||(t.s=1,c=[p=0]),t.c=c,t.e=p,t},O.mod=function(t){var e,r=this,n=r.constructor,o=r.s,i=(t=new n(t)).s;if(!t.c[0])throw Error(w);return r.s=t.s=1,e=1==t.cmp(r),r.s=o,t.s=i,e?new n(r):(o=n.DP,i=n.RM,n.DP=n.RM=0,r=r.div(t),n.DP=o,n.RM=i,this.minus(r.times(t)))},O.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},O.plus=O.add=function(t){var e,r,n,o=this,i=o.constructor;if(t=new i(t),o.s!=t.s)return t.s=-t.s,o.minus(t);var a=o.e,u=o.c,l=t.e,c=t.c;if(!u[0]||!c[0])return c[0]||(u[0]?t=new i(o):t.s=o.s),t;if(u=u.slice(),e=a-l){for(e>0?(l=a,n=c):(e=-e,n=u),n.reverse();e--;)n.push(0);n.reverse()}for(u.length-c.length<0&&(n=c,c=u,u=n),e=c.length,r=0;e;u[e]%=10)r=(u[--e]=u[e]+c[e]+r)/10|0;for(r&&(u.unshift(r),++l),e=u.length;0===u[--e];)u.pop();return t.c=u,t.e=l,t},O.pow=function(t){var e=this,r=new e.constructor("1"),n=r,o=t<0;if(t!==~~t||t<-1e6||t>1e6)throw Error(d+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},O.prec=function(t,e){if(t!==~~t||t<1||t>v)throw Error(d+"precision");return N(new this.constructor(this),t,e)},O.round=function(t,e){if(t===S)t=0;else if(t!==~~t||t<-v||t>v)throw Error(b);return N(new this.constructor(this),t+this.e+1,e)},O.sqrt=function(){var t,e,r,n=this,o=n.constructor,i=n.s,a=n.e,u=new o("0.5");if(!n.c[0])return new o(n);if(i<0)throw Error(m+"No square root");0===(i=Math.sqrt(n+""))||i===1/0?((e=n.c.join("")).length+a&1||(e+="0"),a=((a+1)/2|0)-(a<0||1&a),t=new o(((i=Math.sqrt(e))==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+a)):t=new o(i+""),a=t.e+(o.DP+=4);do{r=t,t=u.times(r.plus(n.div(r)))}while(r.c.slice(0,a).join("")!==t.c.slice(0,a).join(""));return N(t,(o.DP-=4)+t.e+1,o.RM)},O.times=O.mul=function(t){var e,r=this,n=r.constructor,o=r.c,i=(t=new n(t)).c,a=o.length,u=i.length,l=r.e,c=t.e;if(t.s=r.s==t.s?1:-1,!o[0]||!i[0])return t.c=[t.e=0],t;for(t.e=l+c,a<u&&(e=o,o=i,i=e,c=a,a=u,u=c),e=new Array(c=a+u);c--;)e[c]=0;for(l=u;l--;){for(u=0,c=a+l;c>l;)u=e[c]+i[l]*o[c-l-1]+u,e[c--]=u%10,u=u/10|0;e[c]=u}for(u?++t.e:e.shift(),l=e.length;!e[--l];)e.pop();return t.c=e,t},O.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==S){if(t!==~~t||t<0||t>v)throw Error(b);for(r=N(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return _(r,!0,!!n)},O.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==S){if(t!==~~t||t<0||t>v)throw Error(b);for(t=t+(r=N(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return _(r,!1,!!n)},O[Symbol.for("nodejs.util.inspect.custom")]=O.toJSON=O.toString=function(){var t=this,e=t.constructor;return _(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},O.toNumber=function(){var t=Number(_(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(m+"Imprecise conversion");return t},O.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==S){if(t!==~~t||t<1||t>v)throw Error(d+"precision");for(r=N(new n(r),t,e);r.c.length<t;)r.c.push(0)}return _(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},O.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(m+"valueOf disallowed");return _(t,t.e<=e.NE||t.e>=e.PE,!0)},function t(){function e(r){var n=this;if(!(n instanceof e))return r===S?t():new e(r);if(r instanceof e)n.s=r.s,n.e=r.e,n.c=r.c.slice();else{if("string"!=typeof r){if(!0===e.strict&&"bigint"!=typeof r)throw TypeError(d+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!j.test(e))throw Error(d+"number");for(t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),o=e.length,n=0;n<o&&"0"==e.charAt(n);)++n;if(n==o)t.c=[t.e=0];else{for(;o>0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[],r=0;n<=o;)t.c[r++]=+e.charAt(n++)}}(n,r)}n.constructor=e}return e.prototype=O,e.DP=20,e.RM=1,e.NE=-7,e.PE=21,e.strict=!1,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}();var E=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Not enough data";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=function(t,e,r){return e=T(e),function(t,e){if(e&&("object"==P(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,x()?Reflect.construct(e,r||[],T(t).constructor):e.apply(t,r))}(this,e,[r]),Object.setPrototypeOf(t,(this instanceof e?this.constructor:void 0).prototype),t.name="NotEnoughDataError",t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&k(t,e)}(e,t),r=e,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(A(Error));function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}function I(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,C(n.key),n)}}function D(t,e,r){return(e=C(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function C(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:e+""}var R=function(){return t=function t(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),D(this,"previousHighest",void 0),D(this,"highest",void 0),D(this,"previousLowest",void 0),D(this,"lowest",void 0),D(this,"previousResult",void 0),D(this,"result",void 0)},(e=[{key:"isStable",get:function(){return void 0!==this.result}},{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"setResult",value:function(t,e){return e&&(this.highest=this.previousHighest,this.lowest=this.previousLowest,this.result=this.previousResult),void 0===this.highest?this.highest=t:t>this.highest?(this.previousHighest=this.highest,this.highest=t):this.previousHighest=this.highest,void 0===this.lowest?this.lowest=t:t<this.lowest?(this.previousLowest=this.lowest,this.lowest=t):this.previousLowest=this.lowest,this.previousResult=this.result,this.result=t}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&I(t.prototype,e),r&&I(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function F(t){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(t)}function B(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,L(n.key),n)}}function U(t,e,r){return e=H(e),function(t,e){if(e&&("object"==F(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,V()?Reflect.construct(e,r||[],H(t).constructor):e.apply(t,r))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(V=function(){return!!t})()}function H(t){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},H(t)}function q(t,e){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},q(t,e)}function L(t){var e=function(t,e){if("object"!=F(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=F(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==F(e)?e:e+""}var $=function(t){function e(t){var r,n,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=r=U(this,e),i=void 0,(o=L(o="interval"))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i,r.interval=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&q(t,e)}(e,t),r=e,(n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"replace",value:function(t){return this.update(t,!0)}}])&&B(r.prototype,n),o&&B(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(R);function z(t){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},z(t)}function K(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Z(n.key),n)}}function G(t,e,r){return e=J(e),function(t,e){if(e&&("object"==z(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Y()?Reflect.construct(e,r||[],J(t).constructor):e.apply(t,r))}function Y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Y=function(){return!!t})()}function J(t){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},J(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}function Z(t){var e=function(t,e){if("object"!=z(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==z(e)?e:e+""}var Q=function(t){function e(){var t,r,n,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return r=t=G(this,e,[].concat(a)),o=[],(n=Z(n="prices"))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&W(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t),this.prices.length>this.interval&&this.prices.shift(),this.prices.length===this.interval){var r=this.prices.reduce((function(t,e){return t+e}),0);return this.setResult(r/this.prices.length,e)}}}],n&&K(r.prototype,n),o&&K(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}($);function X(t){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X(t)}function tt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,at(n.key),n)}}function et(t,e,r){return e=nt(e),function(t,e){if(e&&("object"==X(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,rt()?Reflect.construct(e,r||[],nt(t).constructor):e.apply(t,r))}function rt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(rt=function(){return!!t})()}function nt(t){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nt(t)}function ot(t,e){return ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ot(t,e)}function it(t,e,r){return(e=at(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function at(t){var e=function(t,e){if("object"!=X(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=X(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==X(e)?e:e+""}var ut=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),it(r=et(this,e),"interval",void 0),it(r,"indicator",void 0),it(r,"smoothingFactor",void 0),r.interval=t,r.indicator=new Q(t),r.smoothingFactor=1/r.interval,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ot(t,e)}(e,t),r=e,n=[{key:"updates",value:function(t){var e=this;return t.forEach((function(t){return e.update(t)})),this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.indicator.update(t);if(e&&void 0!==this.previousResult){var n=(t-this.previousResult)*this.smoothingFactor;return this.setResult(n+this.previousResult,e)}if(!e&&void 0!==this.result){var o=(t-this.result)*this.smoothingFactor;return this.setResult(o+this.result,e)}if(void 0===this.result&&void 0!==r)return this.setResult(r,e)}}],n&&tt(r.prototype,n),o&&tt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(R);function lt(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function st(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mt(n.key),n)}}function ft(t,e,r){return e=yt(e),function(t,e){if(e&&("object"==ct(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,pt()?Reflect.construct(e,r||[],yt(t).constructor):e.apply(t,r))}function pt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(pt=function(){return!!t})()}function yt(t){return yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yt(t)}function ht(t,e){return ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ht(t,e)}function vt(t,e,r){return(e=mt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mt(t){var e=function(t,e){if("object"!=ct(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ct(e)?e:e+""}var dt=function(t){function e(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return vt(t=ft(this,e,[].concat(n)),"previousCandle",void 0),vt(t,"twoPreviousCandle",void 0),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ht(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.high,n=t.low,o=r-n;if(this.previousCandle&&e&&(this.previousCandle=this.twoPreviousCandle),this.previousCandle){var i=Math.abs(r-this.previousCandle.close),a=Math.abs(n-this.previousCandle.close);return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(Math.max(o,i,a),e)}return this.twoPreviousCandle=this.previousCandle,this.previousCandle=t,this.setResult(o,e)}}],n&&st(r.prototype,n),o&&st(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(R);function bt(t){return bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bt(t)}function gt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_t(n.key),n)}}function wt(t,e,r){return e=St(e),function(t,e){if(e&&("object"==bt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ot()?Reflect.construct(e,r||[],St(t).constructor):e.apply(t,r))}function Ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ot=function(){return!!t})()}function St(t){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},St(t)}function jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}function Nt(t,e,r){return(e=_t(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _t(t){var e=function(t,e){if("object"!=bt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bt(e)?e:e+""}var Pt=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Nt(r=wt(this,e),"interval",void 0),Nt(r,"tr",void 0),Nt(r,"smoothing",void 0),r.interval=t,r.tr=new dt,r.smoothing=new n(t),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.tr.update(t,e);if(this.smoothing.update(r,e),this.smoothing.isStable)return this.setResult(this.smoothing.getResult(),e)}}],n&&gt(r.prototype,n),o&&gt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(R);function At(t){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},At(t)}function xt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Tt(n.key),n)}}function kt(t,e,r){return(e=Tt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Tt(t){var e=function(t,e){if("object"!=At(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=At(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==At(e)?e:e+""}var Et=function(){return t=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),kt(this,"interval",void 0),kt(this,"deviationMultiplier",void 0),kt(this,"prices",[]),kt(this,"result",void 0),this.interval=e,this.deviationMultiplier=r},(e=[{key:"update",value:function(t){if(this.prices.push(t),this.prices.length>this.interval){this.prices.shift();var e=lt(this.prices),r=function(t,e){var r=e||lt(t),n=lt(t.map((function(t){return t-r})).map((function(t){return t*t})));return Math.sqrt(n)}(this.prices,e);return this.result={lower:e-r*this.deviationMultiplier,middle:e,upper:e+r*this.deviationMultiplier}}}},{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&xt(t.prototype,e),r&&xt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Mt(t){return Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mt(t)}function It(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ut(n.key),n)}}function Dt(t,e,r){return e=Rt(e),function(t,e){if(e&&("object"==Mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ct()?Reflect.construct(e,r||[],Rt(t).constructor):e.apply(t,r))}function Ct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ct=function(){return!!t})()}function Rt(t){return Rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rt(t)}function Ft(t,e){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ft(t,e)}function Bt(t,e,r){return(e=Ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ut(t){var e=function(t,e){if("object"!=Mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mt(e)?e:e+""}var Vt=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Bt(r=Dt(this,e,[t]),"interval",void 0),Bt(r,"pricesCounter",0),Bt(r,"weightFactor",void 0),r.interval=t,r.weightFactor=2/(r.interval+1),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ft(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?e&&0===this.pricesCounter&&this.pricesCounter++:this.pricesCounter++,e&&void 0!==this.previousResult?this.setResult(t*this.weightFactor+this.previousResult*(1-this.weightFactor),e):this.setResult(t*this.weightFactor+(void 0!==this.result?this.result:t)*(1-this.weightFactor),e)}},{key:"getResult",value:function(){if(this.pricesCounter<this.interval)throw new E;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&It(r.prototype,n),o&&It(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}($);function Ht(t){return Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ht(t)}function qt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$t(n.key),n)}}function Lt(t,e,r){return(e=$t(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $t(t){var e=function(t,e){if("object"!=Ht(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ht(e)?e:e+""}var zt=function(){return t=function t(e,r,n){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),Lt(this,"short",void 0),Lt(this,"long",void 0),Lt(this,"signal",void 0),Lt(this,"prices",[]),Lt(this,"result",void 0),this.short=e,this.long=r,this.signal=n},e=[{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.prices.length&&e?this.prices[this.prices.length-1]=t:this.prices.push(t);var r=this.short.update(t,e),n=this.long.update(t,e);if(this.prices.length>this.long.interval&&this.prices.shift(),this.prices.length===this.long.interval){var o=r-n,i=this.signal.update(o,e);return this.result={histogram:o-i,macd:o,signal:i}}}}],e&&qt(t.prototype,e),r&&qt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Kt(t){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kt(t)}function Gt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Xt(n.key),n)}}function Yt(t,e,r){return e=Wt(e),function(t,e){if(e&&("object"==Kt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Jt()?Reflect.construct(e,r||[],Wt(t).constructor):e.apply(t,r))}function Jt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Jt=function(){return!!t})()}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}function Zt(t,e){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zt(t,e)}function Qt(t,e,r){return(e=Xt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xt(t){var e=function(t,e){if("object"!=Kt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Kt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kt(e)?e:e+""}var te=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Qt(r=Yt(this,e),"interval",void 0),Qt(r,"previousPrices",[]),Qt(r,"avgGain",void 0),Qt(r,"avgLoss",void 0),Qt(r,"maxValue",100),r.interval=t,r.avgGain=new n(r.interval),r.avgLoss=new n(r.interval),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zt(t,e)}(e,t),r=e,n=[{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.previousPrices.length&&e?this.previousPrices[this.previousPrices.length-1]=t:this.previousPrices.push(t),!(this.previousPrices.length<2)){var r=t,n=this.previousPrices[this.previousPrices.length-2];if(r>n?(this.avgLoss.update(0,e),this.avgGain.update(t-n,e)):(this.avgLoss.update(n-r,e),this.avgGain.update(0,e)),this.avgGain.isStable){var o=this.avgLoss.getResult();if(0===o)return this.setResult(100,e);var i=this.avgGain.getResult()/o;return this.setResult(this.maxValue-this.maxValue/(i+1),e)}}}}],n&&Gt(r.prototype,n),o&&Gt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(R);function ee(t){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(t)}function re(t){return function(t){if(Array.isArray(t))return ne(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ne(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ne(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function oe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ae(n.key),n)}}function ie(t,e,r){return(e=ae(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ae(t){var e=function(t,e){if("object"!=ee(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ee(e)?e:e+""}var ue=function(){return t=function t(e,r,n){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),ie(this,"n",void 0),ie(this,"m",void 0),ie(this,"p",void 0),ie(this,"candles",[]),ie(this,"result",void 0),ie(this,"periodM",void 0),ie(this,"periodP",void 0),this.n=e,this.m=r,this.p=n,this.periodM=new Q(r),this.periodP=new Q(n)},(e=[{key:"getResult",value:function(){if(void 0===this.result)throw new E;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){if(this.candles.push(t),this.candles.length>this.n&&this.candles.shift(),this.candles.length===this.n){var e=Math.max.apply(Math,re(this.candles.map((function(t){return t.high})))),r=Math.min.apply(Math,re(this.candles.map((function(t){return t.low})))),n=e-r,o=100*(t.close-r);o/=0===n?1:n;var i=this.periodM.update(o),a=i&&this.periodP.update(i);if(void 0!==i&&void 0!==a)return this.result={stochD:a,stochK:i}}}}])&&oe(t.prototype,e),r&&oe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}function ce(t){return function(t){if(Array.isArray(t))return se(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return se(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?se(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function se(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function fe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==le(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pe(t){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pe(t)}function ye(t){return function(t){if(Array.isArray(t))return he(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return he(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?he(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function he(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function ve(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=pe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var me={ema:Vt,sma:Q},de=function(t,e,r,n,o){var i=o.target,a=o.lag,u=t.verticalOhlcv,l=t.instances,c=t.priceBased,s="close"!==i?"_".concat(i):"",f="".concat(r,"_").concat(n).concat(s);if(0===e){var p=t.len;if(!u.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for ").concat(r,"."));l[f]=new me[r](n),u[f]=new Float64Array(p).fill(NaN),c.has(i)&&c.add(f),a>0&&t.lag([f],a)}var y=u[i][e],h=l[f];h.update(y);var v=NaN;try{v=h.getResult()}catch(t){}return t.pushToMain({index:e,key:f,value:v}),!0};function be(t){return be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},be(t)}function ge(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function we(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=be(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==be(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Oe(t,e){if(t){if("string"==typeof t)return Se(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Se(t,e):void 0}}function Se(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function je(t){return function(t){if(Array.isArray(t))return Ne(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ne(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ne(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ne(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function _e(t){return _e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_e(t)}function Pe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=_e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=_e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_e(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ae(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var xe="close";function ke(t){return function(t){if(Array.isArray(t))return Me(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ee(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Te(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ee(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Ee(t,e){if(t){if("string"==typeof t)return Me(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Me(t,e):void 0}}function Me(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Ie(t){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ie(t)}function De(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ce(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Ie(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ie(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Re(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Fe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Fe(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Fe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Be="close";function Ue(t){return Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ue(t)}function Ve(t){return Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ve(t)}function He(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return qe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qe(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Le=function(t,e){if("string"!=typeof t)throw new Error("addPrecisionExact expects a string when precision=true");var r="-"===t.charAt(0),n=He((r?t.slice(1):t).split("."),2),o=n[0],i=n[1],a=void 0===i?"":i,u=String(e),l=1===e?0:u.length-1,c=a.padEnd(l,"0").slice(0,l),s=parseInt(o+c||"0",10);return r&&(s=-s),s};function $e(t){return $e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$e(t)}var ze={number:function(t){return t},numberCleanString:function(t){return Number(t)},precisionNumberCleanString:function(t,e){return Le(t,e)}},Ke=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n="number"==typeof t&&!Number.isNaN(t),o="string"==typeof t&&/^-?\d+(\.\d+)?$/.test(t);if(!0===r){if(o)return"precisionNumberCleanString";if(e)throw new Error("Invalid number forma");return $e(t)}if(n)return"number";if(o)return"numberCleanString";if(e)throw new TypeError("Invalid input: expected a number or numeric string");return $e(t)};function Ge(t){return Ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(t)}var Ye={string:function(t){return t.toString()},milliseconds:function(t){return t.getTime()},seconds:function(t){return t.getTime()/1e3},object:function(t){return t}},Je={dateObject:function(t){return t},dateMilliseconds:function(t){return new Date(t)},dateSeconds:function(t){return new Date(1e3*t)},dateIncompleteDayString:function(t){return new Date("".concat(t," 00:00:00"))},dateCompleteDateString:function(t){return new Date(t)}},We=function(t){var e=["Date -> object","Milliseconds Timestamp -> integer","Seconds Timestamp -> integer","UTC Time Format (ISO 8601) -> string","Including a Timezone Offset (ISO 8601) -> string","Local Time Format (ISO 8601) -> string","YYYY/MM/DD or YYYY-MM-DD -> string"],r=function(){throw new Error('Invalid "'.concat(Ge(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")))};if("object"===Ge(t)){if(t instanceof Date&&!isNaN(t.valueOf()))return"dateObject";r()}else{if("number"==typeof t)return Math.abs(t)<1e11?"dateSeconds":"dateMillseconds";if("string"==typeof t){if(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/i.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?([+-]\d{2}:\d{2})$/.test(t)||/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t)&&t.length>10||/^\d{4}\/\d{2}\/\d{2}$/.test(t))return"dateCompleteDateString";if(/^\d{4}-\d{2}-\d{2}$/.test(t))return"dateIncompleteDayString";r()}else r()}};function Ze(t){return Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ze(t)}function Qe(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Xe(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xe(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var tr=function(t,e,r){var n,o={Array,Float64Array,Float32Array,Int32Array,Uint8Array,Int8Array,Int16Array}[t];if(!o||"function"!=typeof o.from)throw new Error("Unsupported array type: ".concat(t));return n=void 0!==r?r:"Array"===t?null:NaN,o.from({length:e},(function(){return n}))},er=function(t,e){if(!e||"object"!==Ze(e))throw new TypeError('Invalid array type: "'.concat(t,'"'));return e.constructor.name};function rr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return nr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?nr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function nr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function or(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var ir=function(t,e){var r=new Uint8Array(e);return r[t]=1,r},ar=function(t,e,r,n){var o,i,a=(i=2,function(t){if(Array.isArray(t))return t}(o=n)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(o,i)||function(t,e){if(t){if("string"==typeof t)return or(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?or(t,e):void 0}}(o,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=a[0],l=a[1];return(Math.min(Math.max(t,e),r)-e)/(r-e)*(l-u)+u},ur=function(t,e,r){return 0===r?0:(t-e)/r};function lr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function cr(t){return cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cr(t)}function sr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fr(n.key),n)}}function fr(t){var e=function(t,e){if("object"!=cr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cr(e)?e:e+""}var pr=function(t,e){return t>e},yr=function(t,e){return t<e},hr=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,{interval:0,prevState:.5,prevFast:NaN,prevSlow:NaN,prevHigh:NaN,prevLow:NaN,areHighAndLowUndefined:!1,crossIndexes:{up:[],down:[]}})},(e=[{key:"update",value:function(t,e){var r=e.fast,n=e.high,o=e.slow,i=e.low,a=this.prevState;this.areHighAndLowUndefined||void 0!==n&&void 0!==i||(this.areHighAndLowUndefined=!0),Number.isNaN(r)||Number.isNaN(o)||function(t,e){return t===e}(r,o)?a=.5:pr(r,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&yr(i,o)&&pr(this.prevLow,this.prevSlow)?0:1:yr(r,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&pr(n,o)&&yr(this.prevHigh,this.prevSlow)?1:0),.5===a?this.interval=0:1===a?this.prevState<=.5?this.interval=1:this.interval++:0===a&&(this.prevState>=.5?this.interval=-1:this.interval--),1===this.interval&&this.crossIndexes.up.push(t),-1===this.interval&&this.crossIndexes.down.push(t),Object.assign(this,{prevState:a,prevFast:r,prevSlow:o,prevHigh:n,prevLow:i})}},{key:"getResult",value:function(){return this.interval}}])&&sr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function vr(t){return vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vr(t)}function mr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||wr(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function br(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?dr(Object(r),!0).forEach((function(e){gr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dr(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function gr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=vr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vr(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wr(t,e){if(t){if("string"==typeof t)return Or(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Or(t,e):void 0}}function Or(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Sr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Nr(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Nr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Nr(t,e){if(t){if("string"==typeof t)return _r(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_r(t,e):void 0}}function _r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Pr=function(t){return null==t||!Number.isFinite(t)};function Ar(t,e){if(t){if("string"==typeof t)return xr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?xr(t,e):void 0}}function xr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var kr=function(t){var e=t.main,r=t.index,n=e.verticalOhlcv,o=n.close[r],i=n.open[r-1];return{change:(o-i)/i*100}};function Tr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Er(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Er(t,e){if(t){if("string"==typeof t)return Mr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Mr(t,e):void 0}}function Mr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Ir=function(t,e){return(t-e)/e};function Dr(t){return function(t){if(Array.isArray(t))return Br(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fr(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Fr(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function Rr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Fr(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fr(t,e){if(t){if("string"==typeof t)return Br(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Br(t,e):void 0}}function Br(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Ur={priceFeatures:function(t,e,r){var n=r.lag,o=r.colKeys,i=t.verticalOhlcv;if(0===e){var a,u=t.len,l={ret_change:new Float64Array(u).fill(NaN),ret_upper_wick:new Float64Array(u).fill(NaN),ret_lower_wick:new Float64Array(u).fill(NaN),ret_gap:new Float64Array(u).fill(NaN),ret_body:new Float64Array(u).fill(NaN),ret_range:new Float64Array(u).fill(NaN)},c=Tr(o);try{for(c.s();!(a=c.n()).done;){var s=a.value;if(!i.hasOwnProperty(s))throw new Error("Target property ".concat(s,' not found in verticalOhlcv for "priceFeatures".'));l["ret_".concat(s)]=new Float64Array(u).fill(NaN)}}catch(t){c.e(t)}finally{c.f()}Object.assign(i,l),n&&t.lag(Object.keys(l),n)}var f,p,y=i.close[e-1];if(void 0!==y){var h,v,m=i.open[e],d=i.high[e],b=i.low[e],g=i.close[e],w=Math.max(m,g),O=Math.min(m,g),S={ret_change:Ir(g,y),ret_upper_wick:Ir(d,w),ret_lower_wick:Ir(O,b),ret_gap:Ir(m,y),ret_body:Ir(g,m),ret_range:Ir(d,b)},j=!1,N=Tr(o);try{for(N.s();!(h=N.n()).done;){var _=h.value,P=i[_][e];if(null==(v=P)||!Number.isFinite(v)){j=!0;break}var A=Ir(g,P);S["ret_".concat(_)]=A}}catch(t){N.e(t)}finally{N.f()}if(!j)for(var x=0,k=Object.entries(S);x<k.length;x++){var T=(f=k[x],p=2,function(t){if(Array.isArray(t))return t}(f)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(f,p)||Er(f,p)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),E=T[0],M=T[1];t.pushToMain({index:e,key:E,value:M})}}},dateTime:function(t,e,r){var n,o=r.lag,i=r.oneHot,a=r.precompute,u=t.instances,l=t.verticalOhlcv,c=a.prefix;if(0===e){var s=t.len;if(!t.dateType)throw Error('dateTime method found and invalid "date" in input ohlcv');Object.assign(u,{dateTime:{colKeys:[].concat((n=a.colKeys,function(t){if(Array.isArray(t))return Or(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||wr(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),["".concat(c,"year")]),colKeySizes:br({},a.colKeySizes)}});var f,p=u.dateTime.colKeys,y=i?Array:Int16Array,h=i?null:NaN,v=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=wr(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(p);try{for(v.s();!(f=v.n()).done;)l[f.value]=new y(s).fill(h)}catch(t){v.e(t)}finally{v.f()}o>0&&t.lag(p,o)}for(var m=u.dateTime.colKeySizes,d=function(t,e,r){var n=t.getFullYear(),o=t.getMonth(),i=t.getHours(),a=t.getMinutes(),u=t.getDay(),l=t.getDate()-1;return e?{one_hot_month:ir(o,r.one_hot_month),one_hot_hour:ir(i,r.one_hot_hour),one_hot_minute:ir(a,r.one_hot_minute),one_hot_day_of_the_week:ir(u,r.one_hot_day_of_the_week),one_hot_day_of_the_month:ir(l,r.one_hot_day_of_the_month)}:{year:n,month:o+1,hour:i,minute:a,day_of_the_week:(u+6)%7+1,day_of_the_month:l+1}}(l.date[e],i,m),b=0,g=Object.entries(d);b<g.length;b++){var w=mr(g[b],2),O=w[0],S=w[1];t.pushToMain({index:e,key:O,value:S})}},heikenAshi:function(t,e,r,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i.lag,u=void 0===a?0:a,l=i.bothNull,c=void 0!==l&&l,s=t.verticalOhlcv,f=t.instances,p=t.len,y=t.priceBased,h=c?"heiken_ashi":"heiken_ashi_".concat(r,"_").concat(n),v=["open","high","low","close"];if(0===e){f[h]={emaPre:c?null:Object.fromEntries(v.map((function(t){return[t,new Vt(r)]}))),emaPost:c?null:Object.fromEntries(v.map((function(t){return[t,new Vt(n)]}))),prevHaOpen:NaN,prevHaClose:NaN,isTrendUp:!1};var m,d=v.map((function(t){return"".concat(h,"_").concat(t)})),b=Object.fromEntries([].concat((o=d,function(t){if(Array.isArray(t))return Se(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||Oe(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),["".concat(h,"_cross")]).map((function(t){return[t,new Float64Array(p).fill(NaN)]}))),g=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Oe(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(d);try{for(g.s();!(m=g.n()).done;){var w=m.value;y.add(w)}}catch(t){g.e(t)}finally{g.f()}Object.assign(s,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ge(Object(r),!0).forEach((function(e){we(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ge(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},b)),u>0&&t.lag(d,u)}var O,S,j,N,_=s.open[e],P=s.high[e],A=s.low[e],x=s.close[e],k=f[h];if(c)O=_,S=P,j=A,N=x;else{k.emaPre.open.update(_),k.emaPre.high.update(P),k.emaPre.low.update(A),k.emaPre.close.update(x);try{O=k.emaPre.open.getResult(),S=k.emaPre.high.getResult(),j=k.emaPre.low.getResult(),N=k.emaPre.close.getResult()}catch(t){return!0}}var T,E,M,I,D=(O+S+j+N)/4,C=Number.isNaN(k.prevHaOpen)||Number.isNaN(k.prevHaClose)?(O+N)/2:(k.prevHaOpen+k.prevHaClose)/2,R=Math.max(S,C,D),F=Math.min(j,C,D);if(k.prevHaOpen=C,k.prevHaClose=D,c)T=C,E=R,M=F,I=D;else{k.emaPost.open.update(C),k.emaPost.high.update(R),k.emaPost.low.update(F),k.emaPost.close.update(D);try{T=k.emaPost.open.getResult(),E=k.emaPost.high.getResult(),M=k.emaPost.low.getResult(),I=k.emaPost.close.getResult()}catch(t){return!0}}var B=e>0?s["".concat(h,"_cross")][e-1]:0,U=e>0?s["".concat(h,"_open")][e-1]:NaN,V=e>0?s["".concat(h,"_close")][e-1]:NaN,H=!Number.isNaN(V)&&V<=U&&I>T,q=!Number.isNaN(V)&&V>=U&&I<T;H&&(k.isTrendUp=!0),q&&(k.isTrendUp=!1);var L=0;return e>0&&(L=k.isTrendUp?B>0?B+1:1:B<0?B-1:-1),t.pushToMain({index:e,key:"".concat(h,"_open"),value:T}),t.pushToMain({index:e,key:"".concat(h,"_high"),value:E}),t.pushToMain({index:e,key:"".concat(h,"_low"),value:M}),t.pushToMain({index:e,key:"".concat(h,"_close"),value:I}),t.pushToMain({index:e,key:"".concat(h,"_cross"),value:L}),!0},rsi:function(t,e,r,n){var o=n.target,i=n.lag,a=n.parser,u=n.prefix,l=n.minmax,c=t.verticalOhlcv,s=t.instances,f="close"===o?"":"_".concat(o),p="".concat(u,"rsi_").concat(r).concat(f),y="".concat(u,"rsi_sma_").concat(r).concat(f);if(0===e){var h=t.len;if(!c.hasOwnProperty(o))throw new Error("Target property ".concat(o," not found in verticalOhlcv for rsi."));Object.assign(s,fe(fe({},p,new te(r)),y,new Q(r))),Object.assign(c,fe(fe({},p,new Float64Array(h).fill(NaN)),y,new Float64Array(h).fill(NaN)));var v=[p,y];i>0&&t.lag(v,i);var m=i>0?v.flatMap((function(t){return[t].concat(ce(Array.from({length:i},(function(e,r){return"".concat(t,"_lag_").concat(r+1)}))))})):v;if(Array.isArray(l)){var d,b,g=null!==(b=(d=t.scaledGroups).minmax_rsi)&&void 0!==b?b:d.minmax_rsi=[];g.push.apply(g,ce(m))}}var w=c[o][e],O=NaN,S=NaN;s[p].update(w);try{O=s[p].getResult()}catch(t){O=NaN}t.pushToMain({index:e,key:p,value:Number.isNaN(O)?NaN:a(O)}),Number.isNaN(O)||s[y].update(O);try{S=s[y].getResult()}catch(t){S=NaN}t.pushToMain({index:e,key:y,value:Number.isNaN(S)?NaN:a(S)})},stochastic:function(t,e,r,n,o,i){var a=i.minmax,u=i.prefix,l=i.lag,c=i.parser,s=t.verticalOhlcv,f=t.instances,p=14===r&&3===n&&3===o?"":"".concat(r,"_").concat(n,"_").concat(o),y="".concat(u,"stoch_d").concat(p),h="".concat(u,"stoch_k").concat(p),v="".concat(u).concat(p);if(0===e){var m=t.len;Object.assign(f,ve({},v,new ue(r,n,o))),Object.assign(s,ve(ve({},y,new Float64Array(m).fill(NaN)),h,new Float64Array(m).fill(NaN)));var d=[y,h];l>0&&t.lag(d,l);var b=l>0?d.flatMap((function(t){return[t].concat(ye(Array.from({length:l},(function(e,r){return"".concat(t,"_lag_").concat(r+1)}))))})):d;if(Array.isArray(a)){var g,w,O=null!==(w=(g=t.scaledGroups).minmax_rsi)&&void 0!==w?w:g.minmax_rsi=[];O.push.apply(O,ye(b))}}var S=s.close[e],j=s.low[e],N=s.high[e],_=null;f[v].update({close:S,low:j,high:N});try{_=f[v].getResult()}catch(t){_=null}var P=_?c(_.stochK):NaN,A=_?c(_.stochD):NaN;t.pushToMain({index:e,key:h,value:P}),t.pushToMain({index:e,key:y,value:A})},atr:function(t,e,r,n){var o=n.lag,i=n.percentage,a=n.upper,u=n.lower,l=t.verticalOhlcv,c=t.instances,s=t.priceBased,f="atr_".concat(r);if(0===e){var p=t.instances,y=t.verticalOhlcv,h=t.len;p[f]=new Pt(r,ut);var v=[f];i&&v.push("".concat(f,"_percentage")),null!==a&&v.push("".concat(f,"_upper")),null!==u&&v.push("".concat(f,"_lower"));for(var m=0,d=v;m<d.length;m++){var b=d[m];y[b]=new Float64Array(h).fill(NaN),s.add(b)}o>0&&t.lag(v,o)}var g={high:l.high[e],low:l.low[e],close:l.close[e]},w=c[f];w.update(g);var O=NaN;try{O=w.getResult()}catch(t){}if(i){var S=Number.isNaN(O)?NaN:O/g.close;t.pushToMain({index:e,key:"".concat(f,"_percentage"),value:S})}if(null!==a){var j=Number.isNaN(O)?NaN:g.close+O*a;t.pushToMain({index:e,key:"".concat(f,"_upper"),value:j})}if(null!==u){var N=Number.isNaN(O)?NaN:g.close-O*u;t.pushToMain({index:e,key:"".concat(f,"_lower"),value:N})}return t.pushToMain({index:e,key:f,value:O}),!0},ema:de,sma:de,vidya:function(t,e,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=t.verticalOhlcv,a=t.instances,u=t.len,l=t.priceBased,c=o.target,s=o.lag,f=o.atrLength,p=void 0===f?200:f,y=o.bandDistance,h=void 0===y?2:y,v=o.liquidityLookback,m=void 0===v?5:v,d="".concat(r,"_").concat(n);if(0===e){if(!(c in i))throw new Error('VIDYA could not find target "'.concat(c,'"'));for(var b="vidya_".concat(d),g="close"===c?b:"".concat(b,"_").concat(c),w={vidya:g,upper:"".concat(b,"_upper"),lower:"".concat(b,"_lower"),delta_vol:"".concat(b,"_delta_vol"),cross:"".concat(b,"_cross"),liquidity:"".concat(b,"_liquidity")},O=0,S=[g,w.upper,w.lower,w.liquidity];O<S.length;O++){var j=S[O];l.add(j)}a.vidya||(a.vidya={settings:{}}),a.vidya.settings[d]={momentumBuffer:[],prevVidya:NaN,sma:new Q(15),atrBuffer:[],isTrendUp:!1,upVol:0,downVol:0,liquidity:{high:[],low:[]}},Object.values(w).forEach((function(t){i[t]=new Float64Array(u).fill(NaN)})),s>0&&t.lag(Object.values(w),s)}var N=a.vidya.settings[d],_="vidya_".concat(d),P={vidya:"close"===c?_:"".concat(_,"_").concat(c),upper:"".concat(_,"_upper"),lower:"".concat(_,"_lower"),delta_vol:"".concat(_,"_delta_vol"),cross:"".concat(_,"_cross"),liquidity:"".concat(_,"_liquidity")},A=i[c][e],x=i.high[e],k=i.low[e],T=i.close[e],E=i.open[e],M=i.volume[e],I=e>0?i[P.cross][e-1]:0,D=N.liquidity.high.length===m?Math.max.apply(Math,je(N.liquidity.high)):NaN,C=N.liquidity.low.length===m?Math.min.apply(Math,je(N.liquidity.low)):NaN;if(e>0){var R=i.close[e-1],F=Math.max(x-k,Math.abs(x-R),Math.abs(k-R));N.atrBuffer.push(F),N.atrBuffer.length>p&&N.atrBuffer.shift()}var B=N.atrBuffer.length===p?N.atrBuffer.reduce((function(t,e){return t+e}),0)/p:NaN,U=NaN,V=NaN;if(e>0&&(V=A-i[c][e-1]),N.momentumBuffer.push(V),N.momentumBuffer.length>n&&N.momentumBuffer.shift(),N.momentumBuffer.length===n){var H=0,q=0;N.momentumBuffer.forEach((function(t){return t>=0?H+=t:q+=-t}));var L=H+q,$=2/(r+1)*((0===L?0:100*Math.abs((H-q)/L))/100);U=isNaN(N.prevVidya)?A:$*A+(1-$)*N.prevVidya,N.prevVidya=U}N.sma.update(U);var z=NaN;try{z=N.sma.getResult()}catch(t){}var K=isNaN(B)||isNaN(z)?NaN:z+B*h,G=isNaN(B)||isNaN(z)?NaN:z-B*h,Y=e>0?i[c][e-1]:NaN,J=e>0?i[P.upper][e-1]:NaN,W=e>0?i[P.lower][e-1]:NaN,Z=e>0&&Y<=J&&A>K,X=e>0&&Y>=W&&A<G;Z&&(N.isTrendUp=!0),X&&(N.isTrendUp=!1);var tt=0;e>0&&(tt=N.isTrendUp?I>0?I+1:1:I<0?I-1:-1),Z||X?N.upVol=N.downVol=0:(N.upVol+=T>E?M:0,N.downVol+=T<E?M:0);var et=(N.upVol+N.downVol)/2||1,rt=(N.upVol-N.downVol)/et,nt=N.isTrendUp?G:K,ot=NaN;return tt>0?ot=C:tt<0&&(ot=D),t.pushToMain({index:e,key:P.vidya,value:nt}),t.pushToMain({index:e,key:P.upper,value:K}),t.pushToMain({index:e,key:P.lower,value:G}),t.pushToMain({index:e,key:P.delta_vol,value:rt}),t.pushToMain({index:e,key:P.cross,value:tt}),t.pushToMain({index:e,key:P.liquidity,value:ot}),N.liquidity.high.push(x),N.liquidity.low.push(k),N.liquidity.high.length>m&&N.liquidity.high.shift(),N.liquidity.low.length>m&&N.liquidity.low.shift(),!0},macd:function(t,e,r,n,o,i){var a=i.target,u=i.lag,l=i.precomputed,c=t.verticalOhlcv,s=t.instances,f=t.priceBased,p=l.instanceKey;if(0===e){var y=t.inputParams,h=t.len;if(!c.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var v,m=0,d=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Ae(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ae(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(y);try{for(d.s();!(v=d.n()).done;)"macd"===v.value.key&&m++}catch(t){d.e(t)}finally{d.f()}var b=m>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",g=a===xe?"".concat(b,"_diff"):"".concat(b,"_diff_").concat(a),w=a===xe?"".concat(b,"_dea"):"".concat(b,"_dea_").concat(a),O=a===xe?"".concat(b,"_histogram"):"".concat(b,"_histogram_").concat(a);s.hasOwnProperty("macd")||(s.macd={numberOfIndicators:m,settings:{}}),s.macd.settings[p]=new zt(new Vt(r),new Vt(n),new Vt(o)),Object.assign(c,Pe(Pe(Pe({},g,new Float64Array(h).fill(NaN)),w,new Float64Array(h).fill(NaN)),O,new Float64Array(h).fill(NaN)));for(var S=[g,w,O],j=0,N=S;j<N.length;j++){var _=N[j];f.add(_)}u>0&&t.lag(S,u)}var P=s.macd,A=P.numberOfIndicators,x=P.settings,k=A>1?"macd_".concat(r,"_").concat(n,"_").concat(o):"macd",T=a===xe?"".concat(k,"_diff"):"".concat(k,"_diff_").concat(a),E=a===xe?"".concat(k,"_dea"):"".concat(k,"_dea_").concat(a),M=a===xe?"".concat(k,"_histogram"):"".concat(k,"_histogram_").concat(a),I=x[p],D=c[a][e];I.update(D);var C={};try{C=I.getResult()}catch(t){}return t.pushToMain({index:e,key:T,value:C?C.macd:NaN}),t.pushToMain({index:e,key:E,value:C?C.signal:NaN}),t.pushToMain({index:e,key:M,value:C?C.histogram:NaN}),!0},volumeDelta:function(t,e,r){var n=r.lag,o=void 0===n?0:n,i=t.verticalOhlcv,a=t.instances,u=t.len,l="volume_delta";if(0===e){a[l]||(a[l]={isBuyVolume:!0,cross:0});for(var c=["".concat(l,"_open"),"".concat(l,"_high"),"".concat(l,"_low"),"".concat(l,"_close"),"".concat(l,"_cross")],s=0,f=c;s<f.length;s++)i[f[s]]=new Float64Array(u).fill(NaN);o>0&&t.lag(c,o)}var p=a[l],y=i.volume[e],h=i.open[e],v=i.close[e],m=e>0?i.close[e-1]:NaN,d=p.isBuyVolume;v>h?d=!0:v<h?d=!1:v>m?d=!0:v<m&&(d=!1),p.isBuyVolume=d,e<1?p.cross=d?1:-1:d?p.cross>0?p.cross=p.cross+1:p.cross=1:p.cross>0?p.cross=-1:p.cross=p.cross-1;var b=Number.isFinite(y)?d?y:-y:NaN,g=Number.isNaN(b)?NaN:0,w=b,O=Number.isNaN(b)?NaN:Math.max(b,0),S=Number.isNaN(b)?NaN:Math.min(b,0);return t.pushToMain({index:e,key:"".concat(l,"_open"),value:g}),t.pushToMain({index:e,key:"".concat(l,"_high"),value:O}),t.pushToMain({index:e,key:"".concat(l,"_low"),value:S}),t.pushToMain({index:e,key:"".concat(l,"_close"),value:w}),t.pushToMain({index:e,key:"".concat(l,"_cross"),value:p.cross}),!0},relativeVolume:function(t,e,r,n){var o=n.lag,i="relative_volume_".concat(r),a=t.instances,u=t.verticalOhlcv;if(0===e){var l=t.len;a[i]={instance:new Q(r),prevRelativeVolumeSma:NaN},u[i]=new Float64Array(l).fill(NaN),o>0&&t.lag([i],o)}var c=u.volume[e],s=a[i].instance;s.update(c);var f=NaN;try{f=s.getResult()}catch(t){}var p=a[i].prevRelativeVolumeSma,y=NaN;return Number.isNaN(f)||Number.isNaN(p)||(y=c/p),t.pushToMain({index:e,key:i,value:y}),a[i].prevRelativeVolumeSma=f,!0},donchianChannels:function(t,e,r,n,o){var i=t.verticalOhlcv,a=t.instances,u=t.len,l=t.inputParams,c=t.lag,s=t.priceBased,f=o.height,p=o.range,y="".concat(r,"_").concat(n);if(0===e){var h=l.filter((function(t){return"donchianChannels"===t.key})).length,v="donchian_channel",m=h>1?"".concat(v,"_").concat(y):v,d=["upper","basis","lower"].map((function(t){return"".concat(m,"_").concat(t)}));f&&d.push("".concat(m,"_height"));var b,g=Te(p);try{for(g.s();!(b=g.n()).done;){var w=b.value;if(!(w in i))throw new Error('Invalid range key "'.concat(w,'".'));d.push("".concat(m,"_range_").concat(w))}}catch(t){g.e(t)}finally{g.f()}var O,S=Te(d);try{for(S.s();!(O=S.n()).done;){var j=O.value;s.add(j)}}catch(t){S.e(t)}finally{S.f()}a.donchian_channel||(a.donchian_channel={numberOfIndicators:h,settings:{}}),a.donchian_channel.numberOfIndicators=h,a.donchian_channel.settings[y]={maxDeque:[],minDeque:[]},Object.assign(i,Object.fromEntries(d.map((function(t){return[t,new Float64Array(u).fill(NaN)]})))),c>0&&t.lag(d,c)}var N=a.donchian_channel,_=N.numberOfIndicators,P=N.settings,A=_>1?"donchian_channel_".concat(y):"donchian_channel",x=P[y],k=x.maxDeque,T=x.minDeque,E=e-n,M=E-r+1,I=["upper","basis","lower"].map((function(t){return"".concat(A,"_").concat(t)}));f&&I.push("".concat(A,"_height"));var D=p.map((function(t){return"".concat(A,"_range_").concat(t)}));if(M<0||E+1>u)return[].concat(ke(I),ke(D)).forEach((function(r){return t.pushToMain({index:e,key:r,value:NaN})})),!0;var C=i.high,R=i.low,F=function(t,e,r){for(;t.length&&t[0]<M;)t.shift();for(;t.length&&r(e[t.at(-1)],e[E]);)t.pop();t.push(E)};F(k,C,(function(t,e){return t<=e})),F(T,R,(function(t,e){return t>=e}));var B=k.length&&T.length,U=B?C[k[0]]:NaN,V=B?R[T[0]]:NaN,H=B?(U+V)/2:NaN;if(t.pushToMain({index:e,key:"".concat(A,"_upper"),value:U}),t.pushToMain({index:e,key:"".concat(A,"_basis"),value:H}),t.pushToMain({index:e,key:"".concat(A,"_lower"),value:V}),f){var q=B&&V?(U-V)/V:NaN;t.pushToMain({index:e,key:"".concat(A,"_height"),value:q})}for(var L=B?U-V:NaN,$=0;$<p.length;$++){var z=i[p[$]][e],K=B&&z==z&&L?(z-V)/L:NaN;t.pushToMain({index:e,key:D[$],value:K})}return!0},bollingerBands:function(t,e,r,n,o){var i,a,u,l,c,s,f=o.height,p=o.range,y=void 0===p?[]:p,h=o.target,v=o.lag,m=t.verticalOhlcv,d=t.instances,b="".concat(r,"_").concat(n),g="bollinger_bands";if(0===e){var w=t.inputParams,O=t.verticalOhlcv,S=t.len,j=t.priceBased;if(!(h in O))throw new Error('bollingerBands could not find target "'.concat(h,'"'));var N,_=0,P=Re(w);try{for(P.s();!(N=P.n()).done;)"bollingerBands"===N.value.key&&_++}catch(t){P.e(t)}finally{P.f()}d.bollinger_bands||(d.bollinger_bands={numberOfIndicators:_,settings:{}}),d.bollinger_bands.settings[b]=new Et(r,n);var A="";_>1&&(A+="_".concat(b)),h!==Be&&(A+="_".concat(h));var x=["".concat(g,"_upper"),"".concat(g,"_middle"),"".concat(g,"_lower")].map((function(t){return"".concat(t).concat(A)}));f&&x.push("".concat(g,"_height").concat(A));var k,T=Re(y);try{for(T.s();!(k=T.n()).done;){var E=k.value;if(!(E in O))throw new Error('Invalid range item value "'.concat(E,'" property for bollingerBands.'));x.push("".concat(g,"_range_").concat(E).concat(A))}}catch(t){T.e(t)}finally{T.f()}if(j.has(h)){var M,I=Re(x);try{for(I.s();!(M=I.n()).done;){var D=M.value;j.add(D)}}catch(t){I.e(t)}finally{I.f()}}var C=Object.fromEntries(x.map((function(t){return[t,new Float64Array(S).fill(NaN)]})));Object.assign(O,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?De(Object(r),!0).forEach((function(e){Ce(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},C)),v>0&&t.lag(x,v)}var R="";d.bollinger_bands.numberOfIndicators>1&&(R+="_".concat(b)),h!==Be&&(R+="_".concat(h));var F=d.bollinger_bands.settings[b],B=m[h][e];F.update(B);var U={};try{U=F.getResult()}catch(t){}var V=null!==(i=null===(a=U)||void 0===a?void 0:a.upper)&&void 0!==i?i:NaN,H=null!==(u=null===(l=U)||void 0===l?void 0:l.middle)&&void 0!==u?u:NaN,q=null!==(c=null===(s=U)||void 0===s?void 0:s.lower)&&void 0!==c?c:NaN;if(t.pushToMain({index:e,key:"".concat(g,"_upper").concat(R),value:V}),t.pushToMain({index:e,key:"".concat(g,"_middle").concat(R),value:H}),t.pushToMain({index:e,key:"".concat(g,"_lower").concat(R),value:q}),f){var L=NaN;Number.isNaN(q)||Number.isNaN(V)||(L=(V-q)/q),t.pushToMain({index:e,key:"".concat(g,"_height").concat(R),value:L})}var $,z=Re(y);try{for(z.s();!($=z.n()).done;){var K=$.value,G=NaN,Y=m[K][e];Number.isNaN(Y)||Number.isNaN(q)||Number.isNaN(V)||(G=(Y-q)/(V-q)),t.pushToMain({index:e,key:"".concat(g,"_range_").concat(K).concat(R),value:G})}}catch(t){z.e(t)}finally{z.f()}return!0},volumeOscillator:function(t,e,r,n,o){var i,a,u,l=o.lag,c=t.verticalOhlcv,s=t.instances,f=c.volume[e],p="volume_oscillator_".concat(r,"_").concat(n);if(0===e){var y=t.len;Object.assign(s,(i={},a=p,u={fastEMA:new Vt(r),slowEMA:new Vt(n)},(a=function(t){var e=function(t,e){if("object"!=Ue(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ue(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ue(e)?e:e+""}(a))in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,i)),c[p]=new Float64Array(y).fill(NaN),l>0&&t.lag([p],l)}var h=s[p],v=h.fastEMA,m=h.slowEMA;v.update(f),m.update(f);var d=NaN,b=NaN;try{d=v.getResult()}catch(t){}try{b=m.getResult()}catch(t){}var g=NaN;return Number.isNaN(d)||Number.isNaN(b)||(g=100*(d-b)/b),t.pushToMain({index:e,key:p,value:g}),!0},mapCols:function(t,e,r,n,o){var i=o.lag,a=o.isPriceBased,u=t.verticalOhlcv,l=t.len,c=t.priceBased,s=t.precision;if(0===e){var f,p=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ar(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(r);try{for(p.s();!(f=p.n()).done;){var y=f.value;if(u.hasOwnProperty(y))throw new Error('New property "'.concat(y,'" already exist in "verticalOhlcv" and can not be modified using mapCols.'));u[y]=new Array(l).fill(0),s&&a&&c.add(y)}}catch(t){p.e(t)}finally{p.f()}i>0&&t.lag(r,i)}var h,v,m=n({index:e,main:t});if(null==m)return!0;for(var d=0,b=Object.entries(m);d<b.length;d++){var g=(h=b[d],v=2,function(t){if(Array.isArray(t))return t}(h)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(h,v)||Ar(h,v)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),w=g[0],O=g[1];t.pushToMain({index:e,key:w,value:O})}},scaler:function(t,e,r,n,o){var i=o.type,a=o.range,u=o.lookback,l=o.weights,c=o.euclideanWeights,s=t.verticalOhlcv,f=t.instances,p="".concat(i,"_").concat(r);if(0===e){var y=t.len;if(t.isAlreadyComputed.has(p))throw new Error('In scaler method can not repeat params "size" and "options.type" together between indicators.');f.hasOwnProperty("scaler")||(f.scaler={}),f.scaler.hasOwnProperty(p)||(f.scaler[p]={extectedFeatures:0===u?n.length:n.length+u*n.length});var h,v=[],m=jr(n);try{var d=function(){var e=h.value;if(!s.hasOwnProperty(e))throw new Error('Target property "'.concat(e,'" not found in verticalOhlcv'));var r,n="".concat(p,"_").concat(e);if(s[n]=new Float64Array(y).fill(NaN),t.scaledGroups[p]||(t.scaledGroups[p]=[]),t.scaledGroups[p].push(n),u>0){var o,i,a=Array.from({length:u}).map((function(t,e){return"".concat(n,"_lag_").concat(e+1)})),l=jr(a);try{for(l.s();!(i=l.n()).done;){var c=i.value;s[c]=new Float64Array(y).fill(NaN)}}catch(t){l.e(t)}finally{l.f()}(o=t.scaledGroups[p]).push.apply(o,function(t){if(Array.isArray(t))return _r(t)}(r=a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||Nr(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),v.push(n)}};for(m.s();!(h=m.n()).done;)d()}catch(t){m.e(t)}finally{m.f()}for(var b=0,g=Object.keys(l);b<g.length;b++){var w=g[b];if(!s.hasOwnProperty(w))throw new Error('Target property "'.concat(w,'" not found in verticalOhlcv'))}}for(var O=f.scaler[p].extectedFeatures,S=!1,j={},N=[],_=0,P=0;P<n.length;P++){var A,x,k=n[P],T=s[k],E=null!==(A=null==l||null===(x=l[k])||void 0===x?void 0:x[0])&&void 0!==A?A:1,M=T[e];if(Pr(M)){S=!0;break}if(j[k]={val:M,weight:c?Math.sqrt(E):E},N.push(M),_++,u>0){for(var I=1;I<=u;I++){var D,C,R=null!==(D=null==l||null===(C=l[k])||void 0===C?void 0:C[I])&&void 0!==D?D:1,F=T[e-I];if(Pr(F)){S=!0;break}j["".concat(k,"_lag_").concat(I)]={val:F,weight:c?Math.sqrt(R):R},N.push(F),_++}if(S)break}}if(!S&&_===O){if("minmax"===i)for(var B=Math.min.apply(Math,N),U=Math.max.apply(Math,N),V=0,H=Object.entries(j);V<H.length;V++){var q=Sr(H[V],2),L=q[0],$=q[1],z=$.val,K=$.weight,G=ar(z,B,U,a)*K;t.pushToMain({index:e,key:"".concat(p,"_").concat(L),value:G})}if("zscore"===i)for(var Y=N.length,J=N.reduce((function(t,e){return t+e}),0)/Y,W=N.reduce((function(t,e){return t+Math.pow(e-J,2)}),0)/Y,Z=Math.sqrt(W),Q=0,X=Object.entries(j);Q<X.length;Q++){var tt=Sr(X[Q],2),et=tt[0],rt=tt[1],nt=rt.val,ot=rt.weight,it=ur(nt,J,Z)*ot;t.pushToMain({index:e,key:"".concat(p,"_").concat(et),value:it})}}},crossPairs:function(t,e,r,n){var o,i=n.oneHot,a=n.limit,u=t.verticalOhlcv,l=t.verticalOhlcvTempCols,c=t.instances,s=t.len,f=t.precision,p=t.precisionMultiplier,y=t.priceBased,h=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return lr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(r);try{for(h.s();!(o=h.n()).done;){var v=o.value,m=v.fast,d=v.slow,b="".concat(m,"_x_").concat(d);if(0===e){if("number"==typeof d){var g=d.toString();l.add(g);var w=f&&("price"===m||y.has(m)),O=w?Le(g,p):d,S=d>=-125&&d<=125&&!1===w?"Int8Array":"Float64Array";u[g]=tr(S,s,O)}c.hasOwnProperty("crossPairs")||(c.crossPairs={}),c.crossPairs[b]={run:new hr,min:1/0,max:-1/0};var j=null!==a&&a<=125?"Int8Array":"Float64Array";u[b]=tr(j,s,0),i&&(u["one_hot_".concat(b)]=tr("Array",s,null))}else if(e+1===s){if("price"!==m&&!u.hasOwnProperty(m))throw new Error('crossPairs invalid param: fast "'.concat(m,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(u))));if(!u.hasOwnProperty(d))throw new Error('crossPairs invalid param: slow "'.concat(d,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(u))))}if("price"!==m&&!u.hasOwnProperty(m))return;if(!u.hasOwnProperty(d))return;var N=c.crossPairs[b].run;if("price"===m){var _=u.close[e],P=u[d][e];N.update(e,{fast:_,slow:P,high:u.high[e],low:u.low[e]})}else{var A=u[m][e],x=u[d][e];N.update(e,{fast:A,slow:x})}var k=N.getResult(),T=null!==a?Math.min(Math.max(k,-a),a):k;if(t.pushToMain({index:e,key:b,value:T}),i){var E=T+a,M=2*a+1;t.pushToMain({index:e,key:"one_hot_".concat(b),value:ir(E,M)})}}}catch(t){h.e(t)}finally{h.f()}return!0},lag:function(t,e,r,n){var o=t.verticalOhlcv,i=t.len,a=t.priceBased;if(0===e){var u,l=rr(r);try{for(l.s();!(u=l.n()).done;){var c=u.value;if(!o.hasOwnProperty(c))throw new Error('Lag processing invoked by col "'.concat(c,'" was not found in "verticalOhlcv".'));for(var s=a.has(c),f=1;f<=n;f++){var p="".concat(c,"_lag_").concat(f);s&&a.add(p);var y=er(c,o[c]);o[p]=tr(y,i)}}}catch(t){l.e(t)}finally{l.f()}}var h,v=rr(r);try{for(v.s();!(h=v.n()).done;)for(var m=h.value,d=o[m],b=1;b<=n;b++){var g="".concat(m,"_lag_").concat(b),w=e-b,O=w<0||void 0===d[w]?null:d[w];t.pushToMain({index:e,key:g,value:O})}}catch(t){v.e(t)}finally{v.f()}return!0}};function Vr(t,e){if(t){if("string"==typeof t)return Hr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Hr(t,e):void 0}}function Hr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var qr=function(t){var e=t.main,r=t.skipNull,n=void 0!==r&&r,o=t.startIndex,i=void 0===o?0:o,a=t.dateFormat,u=e.verticalOhlcv,l=e.invalidValueIndex,c=e.len,s=e.verticalOhlcvKeyNames,f=e.verticalOhlcvTempCols,p=e.priceBased,y=e.precision,h=e.precisionMultiplier;if(0===s.length)return[];var v,m,d,b=n&&l>=0?l+1:0,g=Math.max(b,i),w=c-g,O=Array.from({length:w},(function(){return{}})),S={},j=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Vr(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(s);try{for(j.s();!(v=j.n()).done;){var N=v.value;y&&p.has(N)?S[N]=function(t,e){return function(t,e){if("number"!=typeof t||!Number.isFinite(t))throw new Error("revertPrecisionAsNumber expects a finite number");var r=t<0,n=Math.abs(t);n=Math.trunc(n);var o=1===e?0:String(e).length-1;if(0===o)return r?-n:n;var i=Math.trunc(n/e),a=String(n%e).padStart(o,"0"),u=0===(a=a.replace(/0+$/,"")).length?String(i):"".concat(i,".").concat(a);return Number(r?"-".concat(u):u)}(t,e)}:S[N]=function(t){return t}}}catch(t){j.e(t)}finally{j.f()}for(var _=0,P=Object.entries(u);_<P.length;_++){var A=(m=P[_],d=2,function(t){if(Array.isArray(t))return t}(m)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(m,d)||Vr(m,d)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),x=A[0],k=A[1];if(!f.has(x))for(var T=g;T<c;T++)O[T-g][x]="date"===x?Ye[a](k[T]):S[x](k[T],h)}return O};function Lr(t){return Lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lr(t)}function $r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||Kr(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zr(t,e,r){return(e=Jr(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Kr(t,e){if(t){if("string"==typeof t)return Gr(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gr(t,e):void 0}}function Gr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Yr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Jr(n.key),n)}}function Jr(t){var e=function(t,e){if("object"!=Lr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Lr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Lr(e)?e:e+""}var Wr=function(){return t=function t(e){var r=this,n=e.input,o=e.ticker,i=void 0===o?null:o,u=e.inputParams,c=void 0===u?null:u,s=e.chunkProcess,y=void 0===s?2e3:s,h=e.precision,v=void 0!==h&&h;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),l(n,"input",null!==i?"contructor ".concat(i):"constuctor"),0===n.length)throw Error("input OHLCV must not be empty: "+i);p(y,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),f(v,"precision","contructor"),this.chunkProcess=y,this.input=function(t){return function(t){if(Array.isArray(t))return Gr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Kr(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n),this.len=this.input.length,this.firstRow=this.input[0],this.precision=v;var m=["open","high","low","close"];this.initialPriceBased=new Set(m),this.priceBased=new Set(m),this.precisionMultiplier=function(t){var e=t.precision,r=t.firstRow,n=t.initialPriceBased;if(!1===e)return 1;for(var o=1,i=0,a=Object.entries(r);i<a.length;i++){var u=He(a[i],2),l=u[0],c=u[1];if(n.has(l)){if("string"!=typeof c||!/^\d+(\.\d+)?$/.test(c))throw new Error('If "precision" is set to true all the "open", "high", "low" and "close" values must be numeric strings like "123.45" with no commas or currency symbols. Property "'.concat(l,'" had the value "').concat(c,'" type ').concat(Ve(c),"."));var s=He(c.split("."),2),f=s[0],p=s[1],y=void 0===p?"":p,h=Number(f),v=4;if(0===Math.abs(h)){var m=y.length,d=Math.max(4,m),b=y.search(/[1-9]/);if(-1===b)v=d;else{var g=b+1+5;v=Math.max(d,g)}}var w=Math.pow(10,v);w>o&&(o=w)}}return o}(this);var d=function(t){for(var e=t.firstRow,r=t.precision,n=t.initialPriceBased,o={},i={},a=0,u=Object.entries(e);a<u.length;a++){var l=Qe(u[a],2),c=l[0],s=l[1];if("date"===c)o[c]=We(s),i[c]="Array";else if("volume"===c)o[c]=Ke(s,!0),i[c]="Int32Array";else if(n.has(c))o[c]=Ke(s,!0,r),i[c]="Float64Array";else{var f=Ke(s,!1,r);o[c]=f,i[c]="number"===f?"Float64Array":"Array"}}return{inputTypes:o,arrayTypes:i}}(this),b=d.inputTypes,g=d.arrayTypes;if(this.inputTypes=b,this.arrayTypes=g,!this.firstRow.hasOwnProperty("close"))throw Error('input OHLCV array objects require at least "close" property: '.concat(i));return this.dateType=this.inputTypes.date?this.inputTypes.date:null,this.isComputed=!1,this.instances={},this.verticalOhlcv={},this.verticalOhlcvKeyNames=[],this.verticalOhlcvTempCols=new Set,this.utilities={},this.invalidValueIndex=-1,this.scaledGroups={},this.isAlreadyComputed=new Set,this.pushToMain=function(t){var e=t.index,n=t.key,o=t.value;return function(t){var e=t.index,r=t.key,n=t.value;return t.main.verticalOhlcv[r][e]=n,!0}({main:r,index:e,key:n,value:o})},null!==c?(a(c,this.len),this.inputParams=c.sort((function(t,e){return t.order-e.order})),this.compute()):this.inputParams=[],this},e=[{key:"getData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.skipNull,r=void 0===e||e,n=t.dateFormat,o=void 0===n?"string":n;return s(Object.keys(Ye),o,"dateFormat","getData"),c(t,"options","getData"),qr({main:this,skipNull:r,startIndex:0,dateFormat:o})}},{key:"getLastValues",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.compute();var e=t.dateFormat,r=void 0===e?"string":e;return s(Object.keys(Ye),r,"dateFormat","getData"),qr({skipNull:!1,main:this,startIndex:this.len-1,dateFormat:r})[0]}},{key:"compute",value:function(){return this.isComputed||(this.inputParams=this.inputParams.sort((function(t,e){return t.order-e.order})),this.isComputed=!1,this.len>0&&(function(t,e){var n=e.len,o=e.arrayTypes,i=e.verticalOhlcv,u=e.verticalOhlcvKeyNames,l=e.inputTypes,c=e.chunkProcess,s=e.precisionMultiplier,f=e.inputParams;a(f,n);for(var p=0,y=Object.keys(l);p<y.length;p++){var h=y[p];i[h]=tr(o[h],n)}for(var v=0;v<n;v+=c)for(var m=Math.min(v+c,n),d=v;d<m;d++){for(var b=t[d],g=0,w=Object.entries(l);g<w.length;g++){var O=Rr(w[g],2),S=O[0],j=O[1],N=b[S];if(ze.hasOwnProperty(j)){void 0===N&&console.log({index:d,formaterKey:j,key:S});var _=ze[j](N,s);e.pushToMain({index:d,key:S,value:_})}else Je.hasOwnProperty(j)?e.pushToMain({index:d,key:S,value:Je[j](N)}):e.pushToMain({index:d,key:S,value:N})}var P,A=Cr(f);try{for(A.s();!(P=A.n()).done;){var x=P.value,k=x.key,T=x.params;Ur[k].apply(Ur,[e,d].concat(Dr(T)))}}catch(t){A.e(t)}finally{A.f()}t[d]=null;var E=Object.keys(i);r(e,d,E)||(e.invalidValueIndex=d)}u.push.apply(u,Dr(Object.keys(i)))}(this.input,this),this.isComputed=!0,this.input=[],this.instances={},this.firstRow=[])),this}},{key:"crossPairs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="crossPairs";u(this),l(t,"arr",r),c(e,"options",r);var n=e.limit,o=void 0===n?null:n,i=e.oneHot,a=void 0!==i&&i;null!==o&&p(o,{min:2,max:this.len},"options.limit",r),f(a,"options.oneHot",r);var s,y=[],h=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Kr(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t);try{for(h.s();!(s=h.n()).done;){var v=s.value,m=v.fast,d=void 0===m?"":m,b=v.slow,g=void 0===b?"":b;if(""===d||""===g)throw new Error("Invalid crossPairs[".concat(d,"_").concat(g,"]: Object property “fast” must be a non-null column name and “slow” must be a non-null column name or integer."));y.push(d.toString(),g.toString())}}catch(t){h.e(t)}finally{h.f()}if(this.isAlreadyComputed.has(r))throw new Error('You can only call the "'.concat(r,'" method once.'));return this.isAlreadyComputed.add(r),this.inputParams.push({key:r,params:[t,{limit:o,oneHot:a}]}),this}},{key:"lag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["close"],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r="lag";return u(this),l(t,"colKeys",r),p(e,{min:1,max:this.len,allowDecimals:!1},"lookback",r),this.inputParams.push({key:r,params:[t,e]}),this}},{key:"relativeVolume",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="relativeVolume";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "relativeVolume" is called the input ohlcv must contain valid volume properties.');u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.lag,o=void 0===n?0:n;return p(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,order:0,params:[t,{lag:o}]}),this}},{key:"volumeDelta",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="volumeDelta";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeDelta" is called the input ohlcv must contain valid volume properties.');u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r;return p(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),this.inputParams.push({key:e,order:0,params:[{lag:n}]}),this}},{key:"atr",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="atr";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.lag,o=void 0===n?0:n,i=e.percentage,a=void 0!==i&&i,l=e.upper,s=void 0===l?null:l,y=e.lower,h=void 0===y?null:y;return p(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),f(a,"options.percentage","atr"),null!==s&&p(s,{min:.001,max:100,allowDecimals:!0},"options.upper","atr"),null!==h&&p(h,{min:.001,max:100,allowDecimals:!0},"options.lower","atr"),this.inputParams.push({key:r,order:0,params:[t,{lag:o,percentage:a,upper:s,lower:h}]}),this}},{key:"ema",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="ema";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;return h(o,"options.target",r),p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[r,t,{target:o,lag:a}]}),this}},{key:"sma",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="sma";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i;return h(o,"options.target",r),p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[r,t,{target:o,lag:a}]}),this}},{key:"heikenAshi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="heikenAshi";u(this);var o=null===t&&null===e;!1===o&&(p(t,{min:1,max:this.len,allowDecimals:!1},"smoothLength",n),p(e,{min:1,max:this.len,allowDecimals:!1},"afterSmoothLength",n)),c(r,"options",n);var i=r.lag,a=void 0===i?0:i;return p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,order:0,params:[t,e,{lag:a,bothNull:o}]}),this}},{key:"vidya",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="vidya";u(this),p(t,{min:2,max:this.len,allowDecimals:!1},"size",n),p(e,{min:1,max:this.len,allowDecimals:!1},"momentum",n),c(r,"options",n);var o=r.target,i=void 0===o?"close":o,a=r.lag,l=void 0===a?0:a,s=r.atrLength,f=void 0===s?200:s,y=r.bandDistance,v=void 0===y?2:y,m=r.liquidityLookback,d=void 0===m?20:m;return h(i,"options.target",n),p(l,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),p(v,{min:.01,max:10,allowDecimals:!0},"options.bandDistance",n),p(f,{min:2,max:this.len,allowDecimals:!1},"options.atrLength",n),p(d,{min:1,max:this.len,allowDecimals:!1},"options.liquidityLookback",n),this.inputParams.push({key:n,params:[t,e,{target:i,lag:l}]}),this}},{key:"stochastic",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o="stochastic",i=this.len;p(t,{min:1,max:i,allowDecimals:!1},"kPeriod",o),p(e,{min:1,max:i,allowDecimals:!1},"kSlowingPeriod",o),p(r,{min:1,max:i,allowDecimals:!1},"dPeriod",o),c(n,"options",o);var a=function(t){return t},u="",l=n.lag,s=void 0===l?0:l;p(s,{min:0,max:i,allowDecimals:!1},"options.lag",o);var h=n.minmax;return(Array.isArray(h)||"boolean"==typeof h&&!0===h)&&(Array.isArray(h)?(y(h,"options.minmax",o),a=function(t){return null!==h?ar(t,0,100,h):t}):(f(h,"options.minmax",o),h=[0,1],a=function(t){return null!==h?ar(t,0,100,h):t}),u="minmax_"),this.inputParams.push({key:o,order:0,params:[t,e,r,{minmax:h,prefix:u,parser:a,lag:s}]}),this}},{key:"macd",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:26,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o="macd";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"fast",o),p(e,{min:1,max:this.len,allowDecimals:!1},"slow",o),p(r,{min:1,max:this.len,allowDecimals:!1},"signal",o),c(n,"options",o);var i=n.target,a=void 0===i?"close":i,l=n.lag,s=void 0===l?0:l;h(a,"options.target",o),p(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",o);var f={instanceKey:"".concat(t,"_").concat(e,"_").concat(r).concat("close"===a?"":"_".concat(a))};return this.inputParams.push({key:o,params:[t,e,r,{target:a,lag:s,precomputed:f}]}),this}},{key:"bollingerBands",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="bollingerBands";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",n),p(e,{min:.01,max:50,allowDecimals:!0},"stdDev",n),c(r,"options",n);var o=r.target,i=void 0===o?"close":o,a=r.height,s=void 0!==a&&a,y=r.range,v=void 0===y?[]:y,m=r.lag,d=void 0===m?0:m;return h(i,"options.target",n),l(v,"options.range",n),p(d,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(s,"options.height",n),this.inputParams.push({key:n,params:[t,e,{target:i,height:s,range:v,lag:d}]}),this}},{key:"rsi",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="rsi";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",r),c(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,a=void 0===i?0:i,l=e.minmax;h(o,"options.target",r),p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r);var s=function(t){return t},v="";return(Array.isArray(l)||"boolean"==typeof l&&!0===l)&&(Array.isArray(l)?(y(l,"options.minmax",r),s=function(t){return null!==l?ar(t,0,100,l):t}):(f(l,"options.minmax",r),l=[0,1],s=function(t){return null!==l?ar(t,0,100,l):t}),v="minmax_"),this.inputParams.push({key:r,params:[t,{target:o,lag:a,parser:s,prefix:v,minmax:l}]}),this}},{key:"donchianChannels",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="donchianChannels";u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"size",n),p(e,{min:0,max:this.len,allowDecimals:!1},"offset",n),c(r,"options",n);var o=r.height,i=void 0!==o&&o,a=r.range,s=void 0===a?[]:a,y=r.lag,h=void 0===y?0:y;return l(s,"options.range",n),p(h,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(i,"options.height",n),this.inputParams.push({key:n,order:0,params:[t,e,{height:i,range:s,lag:h}]}),this}},{key:"volumeOscillator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="volumeOscillator";if(!this.inputTypes.hasOwnProperty("volume"))throw new Error('If "volumeOscillator" is called the input ohlcv must contain valid volume properties.');u(this),p(t,{min:1,max:this.len,allowDecimals:!1},"fastsize",n),p(e,{min:t,max:this.len,allowDecimals:!1},"slowsize",n),c(r,"options",n);var o=r.lag,i=void 0===o?0:o;return p(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,order:0,params:[t,e,{lag:i}]}),this}},{key:"dateTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="dateTime";u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.oneHot,i=void 0!==o&&o;p(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),f(i,"options.oneHot",e);var a=i?"one_hot_":"",l=zr(zr(zr(zr(zr({},"".concat(a,"month"),12),"".concat(a,"day_of_the_month"),31),"".concat(a,"day_of_the_week"),7),"".concat(a,"hour"),24),"".concat(a,"minute"),60),s={prefix:a,colKeySizes:l,colKeys:Object.keys(l)};return this.inputParams.push({key:e,order:0,params:[{lag:n,oneHot:i,precompute:s}]}),this}},{key:"priceFeatures",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="priceFeatures";u(this),c(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.colKeys,i=void 0===o?[]:o;return p(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),l(i,"options.colKeys",e),this.inputParams.push({key:e,params:[{lag:n,colKeys:i}]}),this}},{key:"scaler",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"zscore",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="scaler";u(this),p(e,{min:1,max:this.len,allowDecimals:!1},"size",n),c(r,"options",n);var o=r.range,i=void 0===o?[0,1]:o,a=r.lag,h=void 0!==a&&a,v=r.colKeys,m=void 0===v?[]:v,d=r.weights,b=void 0===d?{}:d,g=r.euclideanWeights,w=void 0!==g&&g;l(m,"options.colKeys",n),f(h,"options.lag",n),y(i,"options.range",n),s(["minmax","zscore"],t,"options.type",n),c(b,"options.weights",n);for(var O=h?e-1:0,S=0,j=Object.entries(b);S<j.length;S++){var N=$r(j[S],2),_=N[0],P=N[1];if(l(P,"options.weights.".concat(_)),!h&&P.size>0)throw new Error('If "options.lag" is set to false "options.weights.'.concat(_,'" can only contain 1 item (float).'));if(P.length>e)throw new Error('The length of the property "options.weights.'.concat(_,'" can not be longer than "size" in ').concat(n,"."));for(var A=0;A<P.length;A++){var x=P[A];p(x,{min:.01,max:10,allowDecimals:!0},"options.weights.".concat(_,"[").concat(A,"]"),n)}}return this.inputParams.push({key:n,params:[e,m,{type:t,range:i,lookback:O,weights:b,euclideanWeights:w}]}),this}},{key:"mapCols",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["change"],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(this);var n="mapCols";null==e&&(e=kr),c(r,"options",n);var o=r.lag,i=void 0===o?0:o,a=r.isPriceBased,s=void 0!==a&&a;if(l(t,"newCols",n),p(i,{min:0,allowDecimals:!1},"options.lag",n),f(s,"isPriceBased","mapCols"),!1===this.precision&&s)throw new Error('Invalid param: If "mapCols.options.isPriceBased" is true, the "constructor.precision" param must be also true.');return this.inputParams.push({key:n,params:[t,e,{lag:i,isPriceBased:s}]}),this}}],e&&Yr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();