ohlcv-indicators 3.5.55 → 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:()=>En});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" , "getDataAsCols" 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 C=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 T(t){return T="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},T(t)}function I(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 M(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"!=T(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==T(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),M(this,"previousHighest",void 0),M(this,"highest",void 0),M(this,"previousLowest",void 0),M(this,"lowest",void 0),M(this,"previousResult",void 0),M(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 C;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)}}])&&I(t.prototype,r),e&&I(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 z(t,r,e){return r=Y(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,U()?Reflect.construct(r,e||[],Y(t).constructor):r.apply(t,e))}function U(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(U=function(){return!!t})()}function Y(t){return Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Y(t)}function q(t,r){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},q(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 G=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=z(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&&q(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 H(t){return H="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},H(t)}function B(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"==H(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"!=H(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(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&&B(e.prototype,n),o&&B(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(G);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 Ct=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 C;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 Tt(t){return Tt="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},Tt(t)}function It(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,zt(n.key),n)}}function Mt(t,r,e){return r=Rt(r),function(t,r){if(r&&("object"==Tt(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=zt(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function zt(t){var r=function(t,r){if("object"!=Tt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tt(r)?r:r+""}var Ut=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=Mt(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 C;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&It(e.prototype,n),o&&It(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(G);function Yt(t){return Yt="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},Yt(t)}function qt(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,Gt(n.key),n)}}function Vt(t,r,e){return(r=Gt(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Gt(t){var r=function(t,r){if("object"!=Yt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yt(r)?r:r+""}var Ht=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 C;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&&qt(t.prototype,r),e&&qt(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,e}();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 $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"==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,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"!=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 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 C;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:Ut,sma:Z},mr=function(t,r,e,n,o){var i=o.target,a=o.lag,l=t.verticalOhlcv,u=t.instances,c="close"!==i?"_".concat(i):"",s="".concat(e,"_").concat(n).concat(c);if(0===r){var f=t.len;if(!l.hasOwnProperty(i))throw new Error("Target property ".concat(i," not found in verticalOhlcv for ").concat(e,"."));u[s]=new dr[e](n),l[s]=new Float64Array(f).fill(NaN),a>0&&t.lag([s],a)}var p=l[i][r],y=u[s];y.update(p);var h=NaN;try{h=y.getResult()}catch(t){}return t.pushToMain({index:r,key:s,value:h}),!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){(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){return function(t){if(Array.isArray(t))return Ar(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 Ar(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)?Ar(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 Ar(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 jr(t){return jr="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},jr(t)}function Nr(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=jr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=jr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==jr(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,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 xr="close";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 kr={number:function(t){return t},numberCleanString:function(t){return Number(t)},numberDirtyString:function(t){return Number(t.replace(/(?!^-)[^0-9.]/g,""))}},Er=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("number"==typeof t&&!Number.isNaN(t))return"number";if("string"==typeof t){var e=t.trim(),n=/^-?\d+(\.\d+)?$/;if(n.test(e))return"numberCleanString";var o=e.replace(/[^0-9.]/g,"");if(o&&n.test(o))return"numberDirtyString"}if(r)throw new TypeError("Invalid input: expected a number or numeric string");return _r(t)},Cr=function(t,r){var e=Math.pow(10,r);return Math.round((t+Number.EPSILON)*e)/e};function Tr(t){return function(t){if(Array.isArray(t))return Mr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ir(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 Ir(t,r){if(t){if("string"==typeof t)return Mr(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)?Mr(t,r):void 0}}function Mr(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 Dr(t){return Dr="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},Dr(t)}function Rr(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 Lr(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=Dr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Dr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Dr(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Fr(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 zr(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)?zr(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 zr(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 Ur="close";function Yr(t){return Yr="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},Yr(t)}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 Vr={string:function(t){return t.toISOString()},milliseconds:function(t){return t.getTime()},seconds:function(t){return t.getTime()/1e3},object:function(t){return t}},Gr={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)}},Hr=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(qr(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(r.join("\n- ")))};if("object"===qr(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 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 $r(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 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)||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 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 Kr=new Set(["open","high","low","close"]),Jr=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}))},Wr=function(t,r){if(!r||"object"!==Br(r))throw new TypeError('Invalid array type: "'.concat(t,'"'));return r.constructor.name};function Zr(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 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&&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 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}function te(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)||re(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 re(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}var ne=function(t,r){var e=new Uint8Array(r);return e[t]=1,e},oe=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"))},ie=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)||re(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},ae=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,te(r[s]))}return e},le=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=re(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},ue=function(t){var r=t.trainingCols,e=t.findGroups,n=t.verticalOhlcv,o=t.scaledGroups,i=[].concat(te(r),te(ae(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},ce=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 se(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 fe(t){return fe="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},fe(t)}function pe(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,ye(n.key),n)}}function ye(t){var r=function(t,r){if("object"!=fe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fe(r)?r:r+""}var he=function(t,r){return t>r},ve=function(t,r){return t<r},de=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:he(e,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&ve(i,o)&&he(this.prevLow,this.prevSlow)?0:1:ve(e,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&he(n,o)&&ve(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}}])&&pe(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function me(t){return me="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},me(t)}function be(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)||Oe(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 ge(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 we(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?ge(Object(e),!0).forEach((function(r){Se(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ge(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function Se(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=me(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==me(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Oe(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}function je(t){return function(t){if(Array.isArray(t))return Pe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ne(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,r){if(t){if("string"==typeof t)return Pe(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)?Pe(t,r):void 0}}function Pe(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 xe(t,r){if(t){if("string"==typeof t)return _e(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)?_e(t,r):void 0}}function _e(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){var r=t.main,e=t.index,n=r.verticalOhlcv,o=n.close[e],i=n.close[e-1];return void 0===i?null:{change:(o-i)/i}};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}var Ce=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 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}}(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 Te(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)||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 Me(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)?Me(t,r):void 0}}function Me(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="pca",Re=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(De)||(h[De]={}),h[De][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[De][o].featureCols.length){var b=[].concat(Te(l),Te(ae(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=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}}}}(h[De][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[De][o].X.length<i){var O=h[De][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[De][o];if(0===A.flatFeaturesColLen){if(A.featureCols=ue({trainingCols:l,findGroups:a,verticalOhlcv:f,scaledGroups:p}),!e(t,r,A.featureCols))return;A.flatFeaturesColLen=le(A.featureCols,f,r)}if(0!==A.flatFeaturesColLen){var j=A.X,N=A.featureCols,P=A.flatFeaturesColLen,x=Ce({featureCols:N,flatFeaturesColLen:P,type:De,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 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 Fe(t){return function(t){if(Array.isArray(t))return Ue(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ze(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 ze(t,r){if(t){if("string"==typeof t)return Ue(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)?Ue(t,r):void 0}}function Ue(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 Ye=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(Fe(u),Fe(ae(c,A)));throw new Error("Some of the provided features in ".concat(m,' features where not found in "verticalOhlcv": ').concat(JSON.stringify(E)))}var C,T=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=ze(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(T.s();!(C=T.n()).done;){var I=C.value;if(!w.hasOwnProperty(I))throw new Error('Feature "'.concat(I,'" not found in verticalOhlcv for ').concat(m,"."))}}catch(t){T.e(t)}finally{T.f()}if(O.regressor[m].X.length<n){var M=O.regressor[m].X.length-n;throw new Error('The current "trainingSize" at "'.concat(m,'" requires at least ').concat(M,' more datapoints. Try adding more input ohlcv rows or reducing the "trainingSize" by ').concat(M,"."))}}}var D=O.regressor[m];if(0===D.flatFeaturesColLen){if(D.featureCols=ue({trainingCols:u,findGroups:c,verticalOhlcv:w,scaledGroups:A}),!e(t,r,D.featureCols))return;D.flatFeaturesColLen=le(D.featureCols,w,r),oe({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,z=D.flatFeaturesColLen,U=D.featureCols,Y=D.shouldRetrain;if(!U.includes(i))throw new Error('Target property "'.concat(i,'" not found in ').concat(s," features: ").concat(JSON.stringify(U)));var q=b?w[i][r]:Ce({featureCols:U,flatFeaturesColLen:z,type:s,index:r,lookbackAbs:d,main:t});if(b){if(!Number.isFinite(q))return}else if(null==q)return;for(var V=[],G=0;G<a;G++){var H=w[i][r+G+1];if(!Number.isFinite(H))break;V.push(H)}for(var B=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([q])[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(Le(W)," at index ").concat(r))}else{if(!Array.isArray(W))throw new Error("currTrainY must return an array, got ".concat(Le(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(q),L.length>n&&L.shift()),(Y||!Z)&&L.length===n&&J.length===n){var et=B({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 qe(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Ve(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 Ve(t,r){if(t){if("string"==typeof t)return Ge(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)?Ge(t,r):void 0}}function Ge(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 He=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},Be=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=qe(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=qe(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)||Ve(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 $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 Xe(t){return function(t){if(Array.isArray(t))return Je(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 Je(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)?Je(t,r):void 0}}function Je(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 We="classifier",Ze=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(We)||(A[We]={}),A[We].hasOwnProperty(g)||(A[We][g]={});var k=w?h:1;A[We][g]={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 C="".concat(g,"_").concat(E+1);S[C]="KNN"===s?new Array(O).fill(null):new Float32Array(O).fill(NaN),P.metrics[C]={accuracy:{},total:0,correct:0,labels:{}},x.hasOwnProperty(C)||(x[C]=[])}}else{if(r<_||r<b)return;if(!1===v(S,r))return;if(r+1===O){if(0===A[We][g].featureCols.length){var T=[].concat(Xe(a),Xe(ae(u,j)));throw new Error("Some of the provided features in ".concat(We,' "').concat(g,'" features where not found in "verticalOhlcv": ').concat(JSON.stringify(T)))}var I,M=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}}}}(A[We][g].featureCols);try{for(M.s();!(I=M.n()).done;){var D=I.value;if(!S.hasOwnProperty(D))throw new Error('Feature "'.concat(D,'" not found in verticalOhlcv for ').concat(g,"."))}}catch(t){M.e(t)}finally{M.f()}if(A[We][g].X.length<n){var R=A[We][g].X.length-n;throw new Error('The current "trainingSize" at '.concat(We,' "').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[We][g];if(0===L.flatFeaturesColLen){if(L.featureCols=ue({trainingCols:a,findGroups:u,verticalOhlcv:S,scaledGroups:j}),!e(t,r,L.featureCols))return;L.flatFeaturesColLen=le(L.featureCols,S,r),oe({featureCols:L.featureCols,flatFeaturesColLen:L.flatFeaturesColLen,type:s,trainingSize:n})}if(0!==L.flatFeaturesColLen){var F=L.uniqueLabels,z=L.expectedLoops,U=L.featureCols,Y=L.flatFeaturesColLen,q=L.shouldRetrain,V=L.X,G=Ce({featureCols:U,flatFeaturesColLen:Y,type:s,index:r,lookbackAbs:b,main:t});if(G){var H=i(r,S,p);if(null!==H&&(!Array.isArray(H)||H.length!==h))throw new Error("trainY must be null or an array with ".concat(h,' items, got "').concat(JSON.stringify(H),'" at index ').concat(r," for ").concat(s));for(var B=0;B<z;B++){var $="".concat(g,"_").concat(B+1),X=L.Y[B],K=w?null===H?null:H[B]:H,J=L.isTrained[B];if(x.hasOwnProperty($)&&J&&(!1===q||x[$].length===p)){var W=x[$][0].predict([G])[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&&ce({metrics:P.metrics[$],trueLabel:K,predictedLabel:W})}else{if(!Array.isArray(W)||W.length!==h)throw new Error("Prediction output of ".concat(We,' "').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&&ce({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($e(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(We,' "').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===B&&(V.push(G),V.length>n&&V.shift()),(q||!J)&&V.length===n&&X.length===n){if(!1===J&&(F[B]=He(X),F[B]<2))throw new Error("Invalid number or labels in ".concat(g,'. Check the logic of your "yCallback" function.'));var Q=d.train,tt=Be(V,X),rt=Q({modelClass:m,xRows:tt.X,yRows:tt.Y,modelArgs:f,uniqueLabels:F[B]});x[$].push(rt),x[$].length>p&&x[$].shift(),L.isTrained[B]=!0}}}return!0}}};function Qe(t){return function(t){if(Array.isArray(t))return nn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||en(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 tn(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=en(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 rn(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)||en(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 en(t,r){if(t){if("string"==typeof t)return nn(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)?nn(t,r):void 0}}function nn(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 on={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 Ae(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Oe(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:we(we({},a.colKeySizes),{},Se({},"".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=Oe(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?ne(t,e):t},a=Se(Se(Se(Se(Se(Se({},"".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=be(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=be(A[O],2),N=j[0],P=j[1];t.pushToMain({index:r,key:N,value:P})}},heikenAshi:function(t,r,e,n,o){var i,a=o.lag,l=t.verticalOhlcv,u=t.instances,c=t.len,s="heiken_ashi_".concat(e,"_").concat(n),f=["open","high","low","close"];if(0===r){u[s]={emaPre:Object.fromEntries(f.map((function(t){return[t,new Ut(e)]}))),emaPost:Object.fromEntries(f.map((function(t){return[t,new Ut(n)]}))),prevHaOpen:NaN,prevHaClose:NaN,isTrendUp:!1};var p=f.map((function(t){return"".concat(s,"_").concat(t)})),y=Object.fromEntries([].concat((i=p,function(t){if(Array.isArray(t))return Sr(t)}(i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||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}}(i)||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(s,"_cross")]).map((function(t){return[t,new Float64Array(c).fill(NaN)]})));Object.assign(l,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}({},y)),a>0&&t.lag(p,a)}var h,v,d,m,b=l.open[r],g=l.high[r],w=l.low[r],S=l.close[r],O=u[s];O.emaPre.open.update(b),O.emaPre.high.update(g),O.emaPre.low.update(w),O.emaPre.close.update(S);try{h=O.emaPre.open.getResult(),v=O.emaPre.high.getResult(),d=O.emaPre.low.getResult(),m=O.emaPre.close.getResult()}catch(t){return!0}var A,j,N,P,x=(h+v+d+m)/4,_=Number.isNaN(O.prevHaOpen)||Number.isNaN(O.prevHaClose)?(h+m)/2:(O.prevHaOpen+O.prevHaClose)/2,k=Math.max(v,_,x),E=Math.min(d,_,x);O.prevHaOpen=_,O.prevHaClose=x,O.emaPost.open.update(_),O.emaPost.high.update(k),O.emaPost.low.update(E),O.emaPost.close.update(x);try{A=O.emaPost.open.getResult(),j=O.emaPost.high.getResult(),N=O.emaPost.low.getResult(),P=O.emaPost.close.getResult()}catch(t){return!0}var C=r>0?l["".concat(s,"_cross")][r-1]:0,T=r>0?l["".concat(s,"_open")][r-1]:NaN,I=r>0?l["".concat(s,"_close")][r-1]:NaN,M=!Number.isNaN(I)&&I<=T&&P>A,D=!Number.isNaN(I)&&I>=T&&P<A;M&&(O.isTrendUp=!0),D&&(O.isTrendUp=!1);var R=0;return r>0&&(R=O.isTrendUp?C>0?C+1:1:C<0?C-1:-1),t.pushToMain({index:r,key:"".concat(s,"_open"),value:A}),t.pushToMain({index:r,key:"".concat(s,"_high"),value:j}),t.pushToMain({index:r,key:"".concat(s,"_low"),value:N}),t.pushToMain({index:r,key:"".concat(s,"_close"),value:P}),t.pushToMain({index:r,key:"".concat(s,"_cross"),value:R}),!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="atr_".concat(e);if(0===r){var f=t.instances,p=t.verticalOhlcv,y=t.len;f[s]=new Pt(e,lt);var h=[s];i&&h.push("".concat(s,"_percentage")),null!==a&&h.push("".concat(s,"_upper")),null!==l&&h.push("".concat(s,"_lower"));for(var v=0,d=h;v<d.length;v++)p[d[v]]=new Float64Array(y).fill(NaN);o>0&&t.lag(h,o)}var m={high:u.high[r],low:u.low[r],close:u.close[r]},b=c[s];b.update(m);var g=NaN;try{g=b.getResult()}catch(t){}if(i){var w=Number.isNaN(g)?NaN:g/m.close;t.pushToMain({index:r,key:"".concat(s,"_percentage"),value:w})}if(null!==a){var S=Number.isNaN(g)?NaN:m.close+g*a;t.pushToMain({index:r,key:"".concat(s,"_upper"),value:S})}if(null!==l){var O=Number.isNaN(g)?NaN:m.close-g*l;t.pushToMain({index:r,key:"".concat(s,"_lower"),value:O})}return t.pushToMain({index:r,key:s,value:g}),!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=o.target,c=o.lag,s=o.atrLength,f=void 0===s?200:s,p=o.bandDistance,y=void 0===p?2:p,h=o.liquidityLookback,v=void 0===h?5:h,d="".concat(e,"_").concat(n);if(0===r){if(!(u in i))throw new Error('VIDYA could not find target "'.concat(u,'"'));var m="vidya_".concat(d),b={vidya:"close"===u?m:"".concat(m,"_").concat(u),upper:"".concat(m,"_upper"),lower:"".concat(m,"_lower"),delta_vol:"".concat(m,"_delta_vol"),cross:"".concat(m,"_cross"),liquidity:"".concat(m,"_liquidity")};a.vidya||(a.vidya={settings:{}}),a.vidya.settings[d]={momentumBuffer:[],prevVidya:NaN,sma:new Z(15),atrBuffer:[],isTrendUp:!1,upVol:0,downVol:0,liquidity:{high:[],low:[]}},Object.values(b).forEach((function(t){i[t]=new Float64Array(l).fill(NaN)})),c>0&&t.lag(Object.values(b),c)}var g=a.vidya.settings[d],w="vidya_".concat(d),S={vidya:"close"===u?w:"".concat(w,"_").concat(u),upper:"".concat(w,"_upper"),lower:"".concat(w,"_lower"),delta_vol:"".concat(w,"_delta_vol"),cross:"".concat(w,"_cross"),liquidity:"".concat(w,"_liquidity")},O=i[u][r],A=i.high[r],j=i.low[r],N=i.close[r],P=i.open[r],x=i.volume[r],_=r>0?i[S.cross][r-1]:0,k=g.liquidity.high.length===v?Math.max.apply(Math,Or(g.liquidity.high)):NaN,E=g.liquidity.low.length===v?Math.min.apply(Math,Or(g.liquidity.low)):NaN;if(r>0){var C=i.close[r-1],T=Math.max(A-j,Math.abs(A-C),Math.abs(j-C));g.atrBuffer.push(T),g.atrBuffer.length>f&&g.atrBuffer.shift()}var I=g.atrBuffer.length===f?g.atrBuffer.reduce((function(t,r){return t+r}),0)/f:NaN,M=NaN,D=NaN;if(r>0&&(D=O-i[u][r-1]),g.momentumBuffer.push(D),g.momentumBuffer.length>n&&g.momentumBuffer.shift(),g.momentumBuffer.length===n){var R=0,L=0;g.momentumBuffer.forEach((function(t){return t>=0?R+=t:L+=-t}));var F=R+L,z=2/(e+1)*((0===F?0:100*Math.abs((R-L)/F))/100);M=isNaN(g.prevVidya)?O:z*O+(1-z)*g.prevVidya,g.prevVidya=M}g.sma.update(M);var U=NaN;try{U=g.sma.getResult()}catch(t){}var Y=isNaN(I)||isNaN(U)?NaN:U+I*y,q=isNaN(I)||isNaN(U)?NaN:U-I*y,V=r>0?i[u][r-1]:NaN,G=r>0?i[S.upper][r-1]:NaN,H=r>0?i[S.lower][r-1]:NaN,B=r>0&&V<=G&&O>Y,$=r>0&&V>=H&&O<q;B&&(g.isTrendUp=!0),$&&(g.isTrendUp=!1);var X=0;r>0&&(X=g.isTrendUp?_>0?_+1:1:_<0?_-1:-1),B||$?g.upVol=g.downVol=0:(g.upVol+=N>P?x:0,g.downVol+=N<P?x:0);var K=(g.upVol+g.downVol)/2||1,J=(g.upVol-g.downVol)/K,W=g.isTrendUp?q:Y,Q=NaN;return X>0?Q=E:X<0&&(Q=k),t.pushToMain({index:r,key:S.vidya,value:W}),t.pushToMain({index:r,key:S.upper,value:Y}),t.pushToMain({index:r,key:S.lower,value:q}),t.pushToMain({index:r,key:S.delta_vol,value:J}),t.pushToMain({index:r,key:S.cross,value:X}),t.pushToMain({index:r,key:S.liquidity,value:Q}),g.liquidity.high.push(A),g.liquidity.low.push(j),g.liquidity.high.length>v&&g.liquidity.high.shift(),g.liquidity.low.length>v&&g.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=u.instanceKey;if(0===r){var p=t.inputParams,y=t.len;if(!c.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var h,v=0,d=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 Pr(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)?Pr(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}}}}(p);try{for(d.s();!(h=d.n()).done;)"macd"===h.value.key&&v++}catch(t){d.e(t)}finally{d.f()}var m=v>1?"macd_".concat(e,"_").concat(n,"_").concat(o):"macd",b=a===xr?"".concat(m,"_diff"):"".concat(m,"_diff_").concat(a),g=a===xr?"".concat(m,"_dea"):"".concat(m,"_dea_").concat(a),w=a===xr?"".concat(m,"_histogram"):"".concat(m,"_histogram_").concat(a);s.hasOwnProperty("macd")||(s.macd={numberOfIndicators:v,settings:{}}),s.macd.settings[f]=new Ht(new Ut(e),new Ut(n),new Ut(o)),Object.assign(c,Nr(Nr(Nr({},b,new Float64Array(y).fill(NaN)),g,new Float64Array(y).fill(NaN)),w,new Float64Array(y).fill(NaN)));var S=[b,g,w];l>0&&t.lag(S,l)}var O=s.macd,A=O.numberOfIndicators,j=O.settings,N=A>1?"macd_".concat(e,"_").concat(n,"_").concat(o):"macd",P=a===xr?"".concat(N,"_diff"):"".concat(N,"_diff_").concat(a),x=a===xr?"".concat(N,"_dea"):"".concat(N,"_dea_").concat(a),_=a===xr?"".concat(N,"_histogram"):"".concat(N,"_histogram_").concat(a),k=j[f],E=c[a][r];k.update(E);var C={};try{C=k.getResult()}catch(t){}return t.pushToMain({index:r,key:P,value:C?C.macd:NaN}),t.pushToMain({index:r,key:x,value:C?C.signal:NaN}),t.pushToMain({index:r,key:_,value:C?C.histogram:NaN}),!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=o.height,f=o.range,p=o.decimals,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)}));s&&m.push("".concat(d,"_height"));var b,g=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Ir(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}}}}(f);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()}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 S=a.donchian_channel,O=S.numberOfIndicators,A=S.settings,j=O>1?"donchian_channel_".concat(y):"donchian_channel",N=A[y],P=N.maxDeque,x=N.minDeque,_=r-n,k=_-e+1,E=["upper","basis","lower"].map((function(t){return"".concat(j,"_").concat(t)}));s&&E.push("".concat(j,"_height"));var C=f.map((function(t){return"".concat(j,"_range_").concat(t)}));if(k<0||_+1>l)return[].concat(Tr(E),Tr(C)).forEach((function(e){return t.pushToMain({index:r,key:e,value:NaN})})),!0;var T=i.high,I=i.low,M=function(t,r,e){for(;t.length&&t[0]<k;)t.shift();for(;t.length&&e(r[t.at(-1)],r[_]);)t.pop();t.push(_)};M(P,T,(function(t,r){return t<=r})),M(x,I,(function(t,r){return t>=r}));var D=P.length&&x.length,R=D?T[P[0]]:NaN,L=D?I[x[0]]:NaN,F=D?(R+L)/2:NaN;if(t.pushToMain({index:r,key:"".concat(j,"_upper"),value:R}),t.pushToMain({index:r,key:"".concat(j,"_basis"),value:F}),t.pushToMain({index:r,key:"".concat(j,"_lower"),value:L}),s){var z=D&&L?(R-L)/L:NaN;t.pushToMain({index:r,key:"".concat(j,"_height"),value:null===p?z:Cr(z,p)})}for(var U=D?R-L:NaN,Y=0;Y<f.length;Y++){var q=i[f[Y]][r],V=D&&q==q&&U?(q-L)/U:NaN;t.pushToMain({index:r,key:C[Y],value:null===p?V:Cr(V,p)})}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=o.decimals,m=t.verticalOhlcv,b=t.instances,g="".concat(e,"_").concat(n),w="bollinger_bands";if(0===r){var S=t.inputParams,O=t.verticalOhlcv,A=t.len;if(!(h in O))throw new Error('bollingerBands could not find target "'.concat(h,'"'));var j,N=0,P=Fr(S);try{for(P.s();!(j=P.n()).done;)"bollingerBands"===j.value.key&&N++}catch(t){P.e(t)}finally{P.f()}b.bollinger_bands||(b.bollinger_bands={numberOfIndicators:N,settings:{}}),b.bollinger_bands.settings[g]=new Ct(e,n);var x="";N>1&&(x+="_".concat(g)),h!==Ur&&(x+="_".concat(h));var _=["".concat(w,"_upper"),"".concat(w,"_middle"),"".concat(w,"_lower")].map((function(t){return"".concat(t).concat(x)}));f&&_.push("".concat(w,"_height").concat(x));var k,E=Fr(y);try{for(E.s();!(k=E.n()).done;){var C=k.value;if(!(C in O))throw new Error('Invalid range item value "'.concat(C,'" property for bollingerBands.'));_.push("".concat(w,"_range_").concat(C).concat(x))}}catch(t){E.e(t)}finally{E.f()}var T=Object.fromEntries(_.map((function(t){return[t,new Float64Array(A).fill(NaN)]})));Object.assign(O,function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?Rr(Object(e),!0).forEach((function(r){Lr(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Rr(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}({},T)),v>0&&t.lag(_,v)}var I="";b.bollinger_bands.numberOfIndicators>1&&(I+="_".concat(g)),h!==Ur&&(I+="_".concat(h));var M=b.bollinger_bands.settings[g],D=m[h][r];M.update(D);var R={};try{R=M.getResult()}catch(t){}var L=null!==(i=null===(a=R)||void 0===a?void 0:a.upper)&&void 0!==i?i:NaN,F=null!==(l=null===(u=R)||void 0===u?void 0:u.middle)&&void 0!==l?l:NaN,z=null!==(c=null===(s=R)||void 0===s?void 0:s.lower)&&void 0!==c?c:NaN;if(t.pushToMain({index:r,key:"".concat(w,"_upper").concat(I),value:L}),t.pushToMain({index:r,key:"".concat(w,"_middle").concat(I),value:F}),t.pushToMain({index:r,key:"".concat(w,"_lower").concat(I),value:z}),f){var U=NaN;Number.isNaN(z)||Number.isNaN(L)||(U=(L-z)/z),t.pushToMain({index:r,key:"".concat(w,"_height").concat(I),value:null===d?U:Cr(U,d)})}var Y,q=Fr(y);try{for(q.s();!(Y=q.n()).done;){var V=Y.value,G=NaN,H=m[V][r];Number.isNaN(H)||Number.isNaN(z)||Number.isNaN(L)||(G=(H-z)/(L-z)),t.pushToMain({index:r,key:"".concat(w,"_range_").concat(V).concat(I),value:null===d?G:Cr(G,d)})}}catch(t){q.e(t)}finally{q.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 Ut(e),slowEMA:new Ut(n)},(a=function(t){var r=function(t,r){if("object"!=Yr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yr(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=t.verticalOhlcv,l=t.len;if(0===r){var u,c=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=xe(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(c.s();!(u=c.n()).done;){var s=u.value;if(a.hasOwnProperty(s))throw new Error('New property "'.concat(s,'" already exist in "verticalOhlcv" and can not be modified using mapCols.'));a[s]=new Array(l).fill(0)}}catch(t){c.e(t)}finally{c.f()}i>0&&t.lag(e,i)}var f,p,y=n({index:r,main:t});if(null==y)return!0;for(var h=0,v=Object.entries(y);h<v.length;h++){var d=(f=v[h],p=2,function(t){if(Array.isArray(t))return t}(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}}(f,p)||xe(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.")}()),m=d[0],b=d[1];t.pushToMain({index:r,key:m,value:b})}},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=Ne(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,je(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,je(y)),d=Math.max.apply(Math,je(y));f=ie(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=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 se(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)?se(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(f.s();!(o=f.n()).done;){var p=o.value,y=p.fast,h=p.slow,v="".concat(y,"_x_").concat(h);if(0===r){if("number"==typeof h){var d=h.toString();u.add(d);var m=h>=-125||h<=125?"Int8Array":"Int16Array";l[d]=Jr(m,s,h)}c.hasOwnProperty("crossPairs")||(c.crossPairs={}),c.crossPairs[v]={run:new de,min:1/0,max:-1/0};var b=null!==a&&a<=125?"Int8Array":"Int16Array";l[v]=Jr(b,s,0),i&&(l["one_hot_".concat(v)]=Jr("Array",s,null))}else if(r+1===s){if("price"!==y&&!l.hasOwnProperty(y))throw new Error('crossPairs invalid param: fast "'.concat(y,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(l))));if(!l.hasOwnProperty(h))throw new Error('crossPairs invalid param: slow "'.concat(h,'" not found in "verticalOhlcv": ').concat(JSON.stringify(Object.keys(l))))}if("price"!==y&&!l.hasOwnProperty(y))return;if(!l.hasOwnProperty(h))return;var g=c.crossPairs[v].run;if("price"===y){var w=l.close[r],S=l[h][r];g.update(r,{fast:w,slow:S,high:l.high[r],low:l.low[r]})}else{var O=l[y][r],A=l[h][r];g.update(r,{fast:O,slow:A})}var j=g.getResult(),N=null!==a?Math.min(Math.max(j,-a),a):j;if(t.pushToMain({index:r,key:v,value:N}),i){var P=N+a,x=2*a+1;t.pushToMain({index:r,key:"one_hot_".concat(v),value:ne(P,x)})}}}catch(t){f.e(t)}finally{f.f()}return!0},lag:function(t,r,e,n){var o=t.verticalOhlcv,i=t.len;if(0===r){var a,l=Zr(e);try{for(l.s();!(a=l.n()).done;){var u=a.value;if(!o.hasOwnProperty(u))throw new Error('Lag processing invoked by col "'.concat(u,'" was not found in "verticalOhlcv".'));for(var c=1;c<=n;c++){var s="".concat(u,"_lag_").concat(c),f=Wr(u,o[u]);o[s]=Jr(f,i)}}}catch(t){l.e(t)}finally{l.f()}}var p,y=Zr(e);try{for(y.s();!(p=y.n()).done;)for(var h=p.value,v=o[h],d=1;d<=n;d++){var m="".concat(h,"_lag_").concat(d),b=r-d,g=b<0||void 0===v[b]?null:v[b];t.pushToMain({index:r,key:m,value:g})}}catch(t){y.e(t)}finally{y.f()}return!0}},an=function(t,r){for(var e=t.length,n=new Z(r),o=new Array(e),i=0,a=0,l=0,u=0;u<e;u++)if(n.update(t[u]),n.isStable){var c=n.getResult();o[u]=c,i+=c,a+=c*c,l++}else o[u]=null;var s=i/l,f=a/l-s*s,p=Math.sqrt(f);return o.map((function(t){return null!==t?(t-s)/p:null}))},ln=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(t.length!==r.length)throw new Error("Both arrays must have the same length");for(var n=an(t,e),o=an(r,e),i=t.length,a=[],l=0,u=0,c=0,s=0,f=0,p=0,y=-1,h=0;h<i;h++){if(null!==n[h]&&null!==o[h]){y=h;break}a.push(0)}if(-1===y)return new Array(i).fill(0);for(var v=y;v<i;v++){var d=n[v],m=o[v];if(null!==d&&null!==m)if(l+=d,u+=m,c+=d*m,s+=d*d,f+=m*m,++p<2)a.push(0);else{var b=p*c-l*u,g=Math.sqrt((p*s-l*l)*(p*f-u*u)),w=0===g?0:b/g;a.push(w)}else l=u=c=s=f=p=0,a.push(0)}return a};function un(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 cn=function(t){var r,e,n=t.main,o=t.skipNull,i=void 0!==o&&o,a=t.startIndex,l=void 0===a?0:a,u=t.dateFormat,c=n.verticalOhlcv,s=n.invalidValueIndex,f=n.len,p=n.verticalOhlcvKeyNames,y=n.verticalOhlcvTempCols;if(0===p.length)return[];for(var h=i&&s>=0?s+1:0,v=Math.max(h,l),d=f-v,m=Array.from({length:d},(function(){return{}})),b=0,g=Object.entries(c);b<g.length;b++){var w=(r=g[b],e=2,function(t){if(Array.isArray(t))return t}(r)||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}}(r,e)||function(t,r){if(t){if("string"==typeof t)return un(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)?un(t,r):void 0}}(r,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.")}()),S=w[0],O=w[1];if(!y.has(S))for(var A=v;A<f;A++)m[A-v][S]="date"===S?Vr[u](O[A]):O[A]}return m},sn=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 fn(t){return fn="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},fn(t)}function pn(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 yn(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?pn(Object(e),!0).forEach((function(r){hn(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):pn(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function hn(t,r,e){return(r=function(t){var r=function(t,r){if("object"!=fn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fn(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function vn(t,r){if(t){if("string"==typeof t)return dn(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)?dn(t,r):void 0}}function dn(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 mn=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)]},bn={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=yn(yn({},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},gn={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=yn(yn({},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=yn(yn({},o),{},{activation:"identity"}));return i.train(e,n),i},unsupervised:!1}};function wn(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 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,e){return(r=kn(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function An(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Pn(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 jn(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)||Pn(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 Nn(t){return function(t){if(Array.isArray(t))return xn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Pn(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){if(t){if("string"==typeof t)return xn(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)?xn(t,r):void 0}}function xn(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 _n(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,kn(n.key),n)}}function kn(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+""}var En=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,f=r.chunkProcess,y=void 0===f?2e3:f,h=r.ML,v=void 0===h?{}:h;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(y,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),c(v,"ML","constructor"),this.chunkProcess=y,this.input=Nn(n),this.len=this.input.length,this.firstRow=this.input[0];var d=function(t){for(var r=t.firstRow,e={},n={},o=0,i=Object.entries(r);o<i.length;o++){var a=$r(i[o],2),l=a[0],u=a[1];if("date"===l)e[l]=Hr(u),n[l]="Array";else if("volume"===l)e[l]=Er(u,!0),n[l]="Int32Array";else if(Kr.has(l))e[l]=Er(u,!0),n[l]="Float64Array";else{var c=Er(u,!1);e[l]=c,n[l]="number"===c?"Float64Array":"Array"}}return{inputTypes:e,arrayTypes:n}}(this),m=d.inputTypes,b=d.arrayTypes;if(this.inputTypes=m,this.arrayTypes=b,!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={correlation:ln},this.invalidValueIndex=-1,this.scaledGroups={},this.isAlreadyComputed=new Set;var g=v.classes;return void 0!==g&&c(g,"ML.classes","constructor"),this.ML={models:{},classes:g,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:"getDataAsCols",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;s(Object.keys(Vr),o,"dateFormat","getDataAsCols"),c(t,"options","getDataAsCols");for(var i=this.len,a=this.invalidValueIndex,l=this.verticalOhlcv,u=this.verticalOhlcvTempCols,f={},p=e?a+1:0,y=i-p,h=0,v=Object.entries(l);h<v.length;h++){var d=jn(v[h],2),m=d[0],b=d[1];if(!u.has(m)){var g=Wr(m,l[m]);f[m]=Jr(g,y);for(var w=p;w<i;w++)f[m][w]="date"===m?Vr[o](b[w]):b[w]}}return f}},{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(Vr),o,"dateFormat","getData"),c(t,"options","getData"),cn({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(Vr),e,"dateFormat","getData"),cn({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;a(o,n);for(var p=0,y=Object.keys(c);p<y.length;p++){var h=y[p];l[h]=Jr(i[h],n)}for(var v=0;v<n;v+=s)for(var d=Math.min(v+s,n),m=v;m<d;m++){for(var b=t[m],g=0,w=Object.entries(c);g<w.length;g++){var S=rn(w[g],2),O=S[0],A=S[1],j=b[O];if(kr.hasOwnProperty(A)){var N=kr[A](j);r.pushToMain({index:m,key:O,value:N})}else Gr.hasOwnProperty(A)?r.pushToMain({index:m,key:O,value:Gr[A](j)}):r.pushToMain({index:m,key:O,value:j})}var P,x=tn(o);try{for(x.s();!(P=x.n()).done;)for(var _=P.value,k=_.key,E=_.params,C=_.order,T=0;T<=9;T++){if("number"!=typeof C)throw new Error("order property of ".concat(k," not found: ").concat(E));T===C&&on[k].apply(on,[r,m].concat(Qe(E)))}}catch(t){x.e(t)}finally{x.f()}t[m]=null;var I=Object.keys(l);e(r,m,I)||(r.invalidValueIndex=m)}(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=tn(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&&Re.apply(void 0,[t,n].concat(Qe(u))),"classifier"===l&&Ze.apply(void 0,[t,n].concat(Qe(u))),"regressor"===l&&Ye.apply(void 0,[t,n].concat(Qe(u))))}}catch(t){i.e(t)}finally{i.f()}}}(r),u.push.apply(u,Qe(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=An(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=sn(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=sn(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:"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=sn([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=sn([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]:10,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="heikenAshi";l(this),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 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:"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=sn([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?ie(t,0,100,h):t}):(f(h,"options.minmax",o),h=[0,1],a=function(t){return null!==h?ie(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=sn([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,b=e.decimals,g=void 0===b?null:b;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),null!==g&&p(g,{min:1,max:15,allowDecimals:!1},"decimals",n);var w=sn([i],n);return this.inputParams.push({key:n,order:w,params:[t,r,{target:i,height:s,range:v,lag:m,decimals:g}]}),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?ie(t,0,100,u):t}):(f(u,"options.minmax",e),u=[0,1],s=function(t){return null!==u?ie(t,0,100,u):t}),v="minmax_");var d=sn([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,v=e.decimals,d=void 0===v?null:v;return u(s,"options.range",n),p(h,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(i,"options.height",n),null!==d&&p(d,{min:1,max:15,allowDecimals:!1},"decimals",n),this.inputParams.push({key:n,order:0,params:[t,r,{height:i,range:s,lag:h,decimals:d}]}),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=On(On(On(On(On({},"".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=sn(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"!==Sn(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:mn;if("function"!=typeof _)throw new Error('"yCallback" must be a function in the following format:\n\n---\n\nconst yCallback = '.concat(mn.toString(),"\n\n---\n\n"));if(s(Object.keys(bn),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=Nn(y);if(u(g,"options.findGroups","scaler")&&g.length>0){var E,C=An(g);try{for(C.s();!(E=C.n()).done;){var T=E.value,I=T.type,M=void 0===I?"":I,D=T.size,R=T.groupName,L=void 0===R?"":R;if(!M||!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(M.toString(),L.toString())}}catch(t){C.e(t)}finally{C.f()}}else if(0===y.length)throw new Error('"trainingCols" array is empty in '.concat(n));var F=bn[v],z=F.shortName,U=F.flatY,Y="cla_".concat(z,"_").concat(r,"_prediction");if(this.isAlreadyComputed.has(Y))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 q={lookbackAbs:Math.abs(m)+1,flatY:U,prefix:Y};this.isAlreadyComputed.add(Y);var V=sn(k,n),G=bn[v],H=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:q,filterCallback:x,modelConfig:G,modelClass:H}]}),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(gn),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 _=gn[g],k=_.shortName,E=_.flatX,C=_.flatY,T="reg_".concat(k,"_").concat(t,"_").concat(a,"_prediction"),I=Nn(m);if(u(A,"options.findGroups","scaler")&&A.length>0){var M,D=An(A);try{for(D.s();!(M=D.n()).done;){var R=M.value,L=R.type,F=void 0===L?"":L,z=R.size,U=R.groupName,Y=void 0===U?"":U;if(!F||!z&&!Y||z&&Y)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.');I.push(F.toString(),Y.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(T))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 q={lookbackAbs:Math.abs(S)+1,flatX:E,flatY:C,prefix:T};this.isAlreadyComputed.add(T);var V=sn(I,e),G=gn[g],H=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:q,filterCallback:x,modelConfig:G,modelClass:H}]}),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?wn(Object(e),!0).forEach((function(r){On(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):wn(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=An(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 _=sn(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=vn(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)||vn(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=gn[h].exportModel:"classifier"===s&&(w=bn[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=ke),c(e,"options",n);var o=e.lag,i=void 0===o?0:o;u(t,"newCols",n),p(i,{min:0,allowDecimals:!1},"options.lag",n);var a=sn(t,n);return this.inputParams.push({key:n,order:a,params:[t,r,{lag:i}]}),this}}],r&&_n(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})();