ohlcv-indicators 3.5.77 → 3.5.78

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:(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:()=>yn});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},"".concat(e,"[0] (min)"),r),p(c,{min:u,max:100,allowDecimals:!1},"".concat(e,"[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",S={},O=void 0,j=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function P(t,e,r,n){var o=t.c;if(r===O&&(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]!==O))),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]!==O||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 N(t){return N="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},N(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(k())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&x(o,r.prototype),o}(t,arguments,E(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),x(r,t)},A(t)}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(k=function(){return!!t})()}function x(t,e){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},x(t,e)}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 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},S.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,S=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()}S[j++]=s?c:++c,m[0]&&s?m[d]=n[y]||0:m=[n[y]]}while((y++<h||m[0]!==O)&&i--);return S[0]||1==j||(S.shift(),g.e--,_--),j>_&&P(g,_,r.RM,m[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 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},S.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)))},S.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},S.plus=S.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},S.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},S.prec=function(t,e){if(t!==~~t||t<1||t>v)throw Error(d+"precision");return P(new this.constructor(this),t,e)},S.round=function(t,e){if(t===O)t=0;else if(t!==~~t||t<-v||t>v)throw Error(b);return P(new this.constructor(this),t+this.e+1,e)},S.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 P(t,(o.DP-=4)+t.e+1,o.RM)},S.times=S.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},S.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==O){if(t!==~~t||t<0||t>v)throw Error(b);for(r=P(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return _(r,!0,!!n)},S.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==O){if(t!==~~t||t<0||t>v)throw Error(b);for(t=t+(r=P(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return _(r,!1,!!n)},S[Symbol.for("nodejs.util.inspect.custom")]=S.toJSON=S.toString=function(){var t=this,e=t.constructor;return _(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},S.toNumber=function(){var t=Number(_(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(m+"Imprecise conversion");return t},S.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==O){if(t!==~~t||t<1||t>v)throw Error(d+"precision");for(r=P(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)},S.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===O?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=S,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 T=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=E(e),function(t,e){if(e&&("object"==N(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,k()?Reflect.construct(e,r||[],E(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&&x(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,R(n.key),n)}}function D(t,e,r){return(e=R(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function R(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 C=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 T;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,q(n.key),n)}}function L(t,e,r){return e=V(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,U()?Reflect.construct(e,r||[],V(t).constructor):e.apply(t,r))}function U(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(U=function(){return!!t})()}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(t)}function H(t,e){return H=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},H(t,e)}function q(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=L(this,e),i=void 0,(o=q(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&&H(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}(C);function K(t){return K="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},K(t)}function z(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"==K(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"!=K(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=K(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==K(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&&z(r.prototype,n),o&&z(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}(C);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}(C);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=Ot(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,St()?Reflect.construct(e,r||[],Ot(t).constructor):e.apply(t,r))}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 jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}function Pt(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 Nt=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),Pt(r=wt(this,e),"interval",void 0),Pt(r,"tr",void 0),Pt(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}(C);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 kt(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,Dt(n.key),n)}}function xt(t,e,r){return e=Tt(e),function(t,e){if(e&&("object"==At(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,Et()?Reflect.construct(e,r||[],Tt(t).constructor):e.apply(t,r))}function Et(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Et=function(){return!!t})()}function Tt(t){return Tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tt(t)}function Mt(t,e){return Mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Mt(t,e)}function It(t,e,r){return(e=Dt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Dt(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 Rt=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),It(r=xt(this,e),"interval",void 0),It(r,"movesUp",void 0),It(r,"movesDown",void 0),It(r,"previousCandle",void 0),It(r,"atr",void 0),It(r,"mdi",void 0),It(r,"pdi",void 0),r.interval=t,r.atr=new Nt(r.interval,n),r.movesDown=new n(r.interval),r.movesUp=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&&Mt(t,e)}(e,t),r=e,n=[{key:"updateState",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.atr.update(t),this.movesUp.update(e),this.movesDown.update(r),this.previousCandle=t}},{key:"update",value:function(t){if(this.previousCandle){var e=t.high,r=this.previousCandle.high,n=t.low,o=e-r,i=this.previousCandle.low-n,a=o<0||o<i?0:o,u=i<0||i<o?0:i;if(this.updateState(t,a,u),this.movesUp.isStable){this.pdi=this.movesUp.getResult()/this.atr.getResult(),this.mdi=this.movesDown.getResult()/this.atr.getResult();var l=Math.abs(this.pdi-this.mdi),c=this.pdi+this.mdi;return 0===c?this.setResult(0,!1):this.setResult(l/c*100,!1)}}else this.updateState(t)}}],n&&kt(r.prototype,n),o&&kt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);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 Ft(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,qt(n.key),n)}}function Bt(t,e,r){return e=Ut(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,Lt()?Reflect.construct(e,r||[],Ut(t).constructor):e.apply(t,r))}function Lt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lt=function(){return!!t})()}function Ut(t){return Ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ut(t)}function Vt(t,e){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vt(t,e)}function Ht(t,e,r){return(e=qt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qt(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 $t=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),Ht(r=Bt(this,e),"interval",void 0),Ht(r,"dx",void 0),Ht(r,"adx",void 0),r.interval=t,r.adx=new n(r.interval),r.dx=new Rt(t,n),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&&Vt(t,e)}(e,t),r=e,n=[{key:"mdi",get:function(){return this.dx.mdi}},{key:"pdi",get:function(){return this.dx.pdi}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.dx.update(t);if(void 0!==r&&this.adx.update(r),this.adx.isStable)return this.setResult(this.adx.getResult(),e)}}],n&&Ft(r.prototype,n),o&&Ft(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);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 zt(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,Yt(n.key),n)}}function Gt(t,e,r){return(e=Yt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yt(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 Jt=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),Gt(this,"interval",void 0),Gt(this,"deviationMultiplier",void 0),Gt(this,"prices",[]),Gt(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 T;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}}])&&zt(t.prototype,e),r&&zt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Wt(t){return Wt="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},Wt(t)}function Zt(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,ne(n.key),n)}}function Qt(t,e,r){return e=te(e),function(t,e){if(e&&("object"==Wt(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,Xt()?Reflect.construct(e,r||[],te(t).constructor):e.apply(t,r))}function Xt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xt=function(){return!!t})()}function te(t){return te=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},te(t)}function ee(t,e){return ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ee(t,e)}function re(t,e,r){return(e=ne(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ne(t){var e=function(t,e){if("object"!=Wt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wt(e)?e:e+""}var oe=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),re(r=Qt(this,e,[t]),"interval",void 0),re(r,"pricesCounter",0),re(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&&ee(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 T;return this.result}},{key:"isStable",get:function(){try{return this.getResult(),!0}catch(t){return!1}}}],n&&Zt(r.prototype,n),o&&Zt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}($);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 ae(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,le(n.key),n)}}function ue(t,e,r){return(e=le(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function le(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+""}var ce=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),ue(this,"short",void 0),ue(this,"long",void 0),ue(this,"signal",void 0),ue(this,"prices",[]),ue(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 T;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&&ae(t.prototype,e),r&&ae(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function se(t){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},se(t)}function fe(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,de(n.key),n)}}function pe(t,e,r){return e=he(e),function(t,e){if(e&&("object"==se(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,ye()?Reflect.construct(e,r||[],he(t).constructor):e.apply(t,r))}function ye(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ye=function(){return!!t})()}function he(t){return he=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},he(t)}function ve(t,e){return ve=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ve(t,e)}function me(t,e,r){return(e=de(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function de(t){var e=function(t,e){if("object"!=se(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==se(e)?e:e+""}var be=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),me(r=pe(this,e),"interval",void 0),me(r,"previousPrices",[]),me(r,"avgGain",void 0),me(r,"avgLoss",void 0),me(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&&ve(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&&fe(r.prototype,n),o&&fe(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(C);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)}function we(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 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,Pe(n.key),n)}}function je(t,e,r){return(e=Pe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pe(t){var e=function(t,e){if("object"!=ge(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ge(e)?e:e+""}var _e=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),je(this,"n",void 0),je(this,"m",void 0),je(this,"p",void 0),je(this,"candles",[]),je(this,"result",void 0),je(this,"periodM",void 0),je(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 T;return this.result}},{key:"isStable",get:function(){return void 0!==this.result}},{key:"update",value:function(t){if(this.candles.push(t),this.candles.length>this.n&&this.candles.shift(),this.candles.length===this.n){var e=Math.max.apply(Math,we(this.candles.map((function(t){return t.high})))),r=Math.min.apply(Math,we(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}(),Ne=function(t,e){var r,n=Math.log(t/e);if(null==(r=n)||!Number.isFinite(r))throw new Error("[BUG] Invalid params passed to mathLog a=".concat(t," b=").concat(e,"."));return n};function Ae(t){return Ae="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},Ae(t)}function ke(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Ae(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ae(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xe(t){return xe="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},xe(t)}function Ee(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=xe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Te={ema:oe,sma:Q},Me=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 Te[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 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){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)||Ce(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 Re(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 Ce(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}}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=function(t){return null==t||!Number.isFinite(t)};function Le(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)||function(t,e){if(t){if("string"==typeof t)return Ue(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)?Ue(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 Ue(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){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,r){return(e=function(t){var e=function(t,e){if("object"!=Ve(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ve(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}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 $e="close";function Ke(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 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 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 Ye(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=ze(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ze(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ze(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Je(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 We(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)?We(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 We(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 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){return Qe="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},Qe(t)}function Xe(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 tr(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)?tr(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 tr(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 er=function(t,e){if("string"!=typeof t)throw new Error("addPrecisionExact expects a string when precision=true");var r="-"===t.charAt(0),n=Xe((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 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)}var nr={number:function(t){return t},numberCleanString:function(t){return Number(t)},precisionNumberCleanString:function(t,e){return er(t,e)}},or=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 rr(t)}if(n)return"number";if(o)return"numberCleanString";if(e)throw new TypeError("Invalid input: expected a number or numeric string");return rr(t)};function ir(t){return ir="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},ir(t)}var ar={toString:function(t){return t.toString()},string:function(t){return t.toString()},toISOString:function(t){return t.toISOString()},iso:function(t){return t.toISOString()},toUTCString:function(t){return t.toUTCString()},milliseconds:function(t){return t.getTime()},seconds:function(t){return t.getTime()/1e3},object:function(t){return t}},ur={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)}},lr=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(ir(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")))};if("object"===ir(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 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){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 pr(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)?pr(t,e):void 0}}function pr(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 yr=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}))},hr=function(t,e){if(!e||"object"!==cr(e))throw new TypeError('Invalid array type: "'.concat(t,'"'));return e.constructor.name};function vr(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 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}}(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 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}function dr(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 br=function(t,e){var r=new Uint8Array(e);return r[t]=1,r},gr=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 dr(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)?dr(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},wr=function(t,e,r){return 0===r?0:(t-e)/r};function Sr(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){return Or="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},Or(t)}function jr(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,Pr(n.key),n)}}function Pr(t){var e=function(t,e){if("object"!=Or(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Or(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Or(e)?e:e+""}var _r=function(t,e){return t>e},Nr=function(t,e){return t<e},Ar=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:_r(r,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&Nr(i,o)&&_r(this.prevLow,this.prevSlow)?0:1:Nr(r,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&_r(n,o)&&Nr(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}}])&&jr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function kr(t){return kr="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},kr(t)}function xr(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)||Ir(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 Er(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 Tr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Er(Object(r),!0).forEach((function(e){Mr(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Er(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Mr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=kr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=kr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==kr(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ir(t,e){if(t){if("string"==typeof t)return Dr(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)?Dr(t,e):void 0}}function Dr(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 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 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 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 Lr=function(t){return null==t||!Number.isFinite(t)};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 Vr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Ur(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Hr(t,e){if(t){if("string"==typeof t)return qr(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)?qr(t,e):void 0}}function qr(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 $r=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 Kr(t){return Kr="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},Kr(t)}function zr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Gr(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 Gr(t,e){if(t){if("string"==typeof t)return Yr(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)?Yr(t,e):void 0}}function Yr(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 Jr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Kr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Kr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kr(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){return function(t){if(Array.isArray(t))return tn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Xr(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 Zr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Xr(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 Qr(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)||Xr(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 Xr(t,e){if(t){if("string"==typeof t)return tn(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)?tn(t,e):void 0}}function tn(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 en={priceFeatures:function(t,e,r){var n=r.lag,o=r.colKeys,i=r.retLogs,a=t.verticalOhlcv,u=t.priceBased,l=t.scaledGroups,c=function(t,e){return i?Math.log(t/e):(t-e)/e},s=i?"ret_log_":"ret_";if(0===e){var f,p=t.len,y=Jr(Jr(Jr(Jr(Jr(Jr(Jr({},"".concat(s,"change"),new Float64Array(p).fill(NaN)),"".concat(s,"mid_price_change"),new Float64Array(p).fill(NaN)),"".concat(s,"upper_wick"),new Float64Array(p).fill(NaN)),"".concat(s,"lower_wick"),new Float64Array(p).fill(NaN)),"".concat(s,"gap"),new Float64Array(p).fill(NaN)),"".concat(s,"body"),new Float64Array(p).fill(NaN)),"".concat(s,"range"),new Float64Array(p).fill(NaN)),h=zr(o);try{for(h.s();!(f=h.n()).done;){var v=f.value;if(!a.hasOwnProperty(v))throw new Error('Target property in "options.colKey" array "'.concat(v,'" not found in verticalOhlcv for "priceFeatures".'));if(!u.has(v))throw new Error('Target property in "options.colKey" array "'.concat(v,'" not found in priceBased for "priceFeatures".'));y["".concat(s).concat(v)]=new Float64Array(p).fill(NaN)}}catch(t){h.e(t)}finally{h.f()}Object.assign(a,y),l.priceFeatures=Object.keys(y),n&&t.lag(Object.keys(y),n)}var m,d,b=a.close[e-1],g=a.open[e-1];if(void 0!==b){var w,S,O=a.open[e],j=a.high[e],P=a.low[e],_=a.close[e],N=(b+g)/2,A=(O+_)/2,k=Math.max(O,_),x=Math.min(O,_),E=Jr(Jr(Jr(Jr(Jr(Jr(Jr({},"".concat(s,"change"),c(_,b)),"".concat(s,"mid_price_change"),c(A,N)),"".concat(s,"upper_wick"),c(j,k)),"".concat(s,"lower_wick"),c(x,P)),"".concat(s,"gap"),c(O,b)),"".concat(s,"body"),c(_,O)),"".concat(s,"range"),c(j,P)),T=!1,M=zr(o);try{for(M.s();!(w=M.n()).done;){var I=w.value,D=a[I][e];if(null==(S=D)||!Number.isFinite(S)){T=!0;break}var R=c(_,D);E["".concat(s).concat(I)]=R}}catch(t){M.e(t)}finally{M.f()}if(!T)for(var C=0,F=Object.entries(E);C<F.length;C++){var B=(m=F[C],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)||Gr(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.")}()),L=B[0],U=B[1];t.pushToMain({index:e,key:L,value:U})}}},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 Dr(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Ir(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")]).filter((function(t){return"one_hot_year"!==t})),colKeySizes:Tr({},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=Ir(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:br(o,r.one_hot_month),one_hot_hour:br(i,r.one_hot_hour),one_hot_minute:br(a,r.one_hot_minute),one_hot_day_of_the_week:br(u,r.one_hot_day_of_the_week),one_hot_day_of_the_month:br(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=xr(g[b],2),S=w[0],O=w[1];t.pushToMain({index:e,key:S,value:O})}},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=i.retLogs,f=void 0===s||s,p=t.verticalOhlcv,y=t.instances,h=t.len,v=t.scaledGroups,m="".concat(r,"_").concat(n),d=["open","high","low","close"],b=function(t,e){return f?Math.log(t/e):(t-e)/e},g=f?"ret_log_":"ret_",w=c?"":"_".concat(m),S=function(t){return"".concat(g,"heiken_ashi_").concat(t).concat(w)},O=c?"heiken_ashi_cross":"heiken_ashi_cross_".concat(m),j=c?"heiken_ashi":"heiken_ashi_".concat(m);if(0===e){y[j]={emaPre:c?null:Object.fromEntries(d.map((function(t){return[t,new oe(r)]}))),emaPost:c?null:Object.fromEntries(d.map((function(t){return[t,new oe(n)]}))),prevHaOpen:NaN,prevHaClose:NaN,prevSmOpen:NaN,prevSmClose:NaN,isTrendUp:!1};var P=["body","upper_wick","lower_wick","range"].map(S),_=Object.fromEntries([].concat((o=P,function(t){if(Array.isArray(t))return Fe(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||Ce(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.")}()),[O]).map((function(t){return[t,new Float64Array(h).fill(NaN)]})));Object.assign(p,_),v&&(v.heikenAshi=P),u>0&&t.lag(P,u)}var N,A,k,x,E=p.open[e],T=p.high[e],M=p.low[e],I=p.close[e],D=y[j];if(Be(E)||Be(T)||Be(M)||Be(I))return!0;if(c)N=E,A=T,k=M,x=I;else{D.emaPre.open.update(E),D.emaPre.high.update(T),D.emaPre.low.update(M),D.emaPre.close.update(I);try{N=D.emaPre.open.getResult(),A=D.emaPre.high.getResult(),k=D.emaPre.low.getResult(),x=D.emaPre.close.getResult()}catch(t){return!0}}if(Be(N)||Be(A)||Be(k)||Be(x))return!0;var R,C,F,B,L=(N+A+k+x)/4,U=Number.isNaN(D.prevHaOpen)||Number.isNaN(D.prevHaClose)?(N+x)/2:(D.prevHaOpen+D.prevHaClose)/2,V=Math.max(A,U,L),H=Math.min(k,U,L);if(D.prevHaOpen=U,D.prevHaClose=L,c)R=U,C=V,F=H,B=L;else{D.emaPost.open.update(U),D.emaPost.high.update(V),D.emaPost.low.update(H),D.emaPost.close.update(L);try{R=D.emaPost.open.getResult(),C=D.emaPost.high.getResult(),F=D.emaPost.low.getResult(),B=D.emaPost.close.getResult()}catch(t){return!0}}if(Be(R)||Be(C)||Be(F)||Be(B)||R<=0||C<=0||F<=0||B<=0)return!0;var q=e>0?p[O][e-1]:0,$=D.prevSmOpen,K=D.prevSmClose,z=Number.isFinite($)&&Number.isFinite(K)&&K<=$&&B>R,G=Number.isFinite($)&&Number.isFinite(K)&&K>=$&&B<R;z&&(D.isTrendUp=!0),G&&(D.isTrendUp=!1);var Y=0;e>0&&(Y=D.isTrendUp?q>0?q+1:1:q<0?q-1:-1),D.prevSmOpen=R,D.prevSmClose=B;for(var J=Math.max(R,B),W=Math.min(R,B),Z=Re(Re(Re(Re({},S("body"),b(B,R)),S("upper_wick"),b(C,J)),S("lower_wick"),b(W,F)),S("range"),b(C,F)),Q=0,X=Object.entries(Z);Q<X.length;Q++){var tt=De(X[Q],2),et=tt[0],rt=tt[1];Be(rt)||t.pushToMain({index:e,key:et,value:rt})}return t.pushToMain({index:e,key:O,value:Y}),!0},rsi:function(t,e,r,n){var o=n.target,i=n.lag,a=n.retLogs,u=t.verticalOhlcv,l=t.instances,c="close"===o?"":"_".concat(o),s=a?"ret_log_rsi_".concat(r).concat(c):"rsi_".concat(r).concat(c),f=a?"ret_log_rsi_sma_".concat(r).concat(c):"rsi_sma_".concat(r).concat(c);if(0===e){var p=t.len;if(!u.hasOwnProperty(o))throw new Error("Target property ".concat(o," not found in verticalOhlcv for rsi."));Object.assign(l,ke(ke({},s,new be(r)),f,new Q(r))),Object.assign(u,ke(ke({},s,new Float64Array(p).fill(NaN)),f,new Float64Array(p).fill(NaN)));var y=[s,f];i>0&&t.lag(y,i)}var h=u[o][e],v=NaN,m=NaN;l[s].update(h);try{v=l[s].getResult()}catch(t){v=NaN}var d=Number.isNaN(v)?NaN:a?Ne(v,50):v;t.pushToMain({index:e,key:s,value:d}),Number.isNaN(v)||l[f].update(v);try{m=l[f].getResult()}catch(t){m=NaN}var b=Number.isNaN(m)?NaN:a?Ne(m,50):m;t.pushToMain({index:e,key:f,value:b})},stochastic:function(t,e,r,n,o,i){var a=i.lag,u=i.retLogs,l=t.verticalOhlcv,c=t.instances,s=t.useFullNames,f=14!==r||3!==n||3!==o||s?"_".concat(r,"_").concat(n,"_").concat(o):"",p=u?"ret_log_stochastic_d".concat(f):"stochastic_d".concat(f),y=u?"ret_log_stochastic_k".concat(f):"stochastic_k".concat(f),h=f;if(0===e){var v=t.len;Object.assign(c,Ee({},h,new _e(r,n,o))),Object.assign(l,Ee(Ee({},p,new Float64Array(v).fill(NaN)),y,new Float64Array(v).fill(NaN)));var m=[p,y];a>0&&t.lag(m,a)}var d=l.close[e],b=l.low[e],g=l.high[e],w=null;c[h].update({close:d,low:b,high:g});try{w=c[h].getResult()}catch(t){w=null}var S=w?u?Ne(w.stochK,50):w.stochK:NaN,O=w?u?Ne(w.stochD,50):w.stochD:NaN;t.pushToMain({index:e,key:y,value:S}),t.pushToMain({index:e,key:p,value:O})},atr:function(t,e,r,n){var o=n.lag,i=n.retLogs,a=t.verticalOhlcv,u=t.instances,l=t.priceBased,c=i?"ret_log_atr_".concat(r):"atr_".concat(r);if(0===e){var s=t.instances,f=t.verticalOhlcv,p=t.len;s[c]=new Nt(r,ut);for(var y=[c],h=0,v=y;h<v.length;h++){var m=v[h];f[m]=new Float64Array(p).fill(NaN),l.add(m)}o>0&&t.lag(y,o)}var d={high:a.high[e],low:a.low[e],close:a.close[e]},b=u[c];b.update(d);var g=NaN;try{g=b.getResult()}catch(t){}return t.pushToMain({index:e,key:c,value:Number.isNaN(g)?NaN:i?Ne(g,d.close):g}),!0},adx:function(t,e,r,n){var o=n.lag,i=n.retLogs,a=t.verticalOhlcv,u=t.instances,l=(t.useFullNames,i?"ret_log_adx_".concat(r):"adx_".concat(r)),c="adx_".concat(r);if(0===e){var s=t.len;if(!a.hasOwnProperty("high"))throw new Error("Property high not found in verticalOhlcv for adx.");if(!a.hasOwnProperty("low"))throw new Error("Property low not found in verticalOhlcv for adx.");if(!a.hasOwnProperty("close"))throw new Error("Property close not found in verticalOhlcv for adx.");Object.assign(u,Vr({},c,new $t(r))),Object.assign(a,Vr({},l,new Float64Array(s).fill(NaN))),o>0&&t.lag([l],o)}var f=a.high[e],p=a.low[e],y=a.close[e],h=NaN;u[c].update({high:f,low:p,close:y});try{h=u[c].getResult(),u[c].get}catch(t){h=NaN}var v=Number.isNaN(h)?NaN:i?Ne(h,20):h;t.pushToMain({index:e,key:l,value:v})},ema:Me,sma:Me,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")},S=0,O=[g,w.upper,w.lower,w.liquidity];S<O.length;S++){var j=O[S];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 P=a.vidya.settings[d],_="vidya_".concat(d),N={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],k=i.high[e],x=i.low[e],E=i.close[e],T=i.open[e],M=i.volume[e],I=e>0?i[N.cross][e-1]:0,D=P.liquidity.high.length===m?Math.max.apply(Math,Le(P.liquidity.high)):NaN,R=P.liquidity.low.length===m?Math.min.apply(Math,Le(P.liquidity.low)):NaN;if(e>0){var C=i.close[e-1],F=Math.max(k-x,Math.abs(k-C),Math.abs(x-C));P.atrBuffer.push(F),P.atrBuffer.length>p&&P.atrBuffer.shift()}var B=P.atrBuffer.length===p?P.atrBuffer.reduce((function(t,e){return t+e}),0)/p:NaN,L=NaN,U=NaN;if(e>0&&(U=A-i[c][e-1]),P.momentumBuffer.push(U),P.momentumBuffer.length>n&&P.momentumBuffer.shift(),P.momentumBuffer.length===n){var V=0,H=0;P.momentumBuffer.forEach((function(t){return t>=0?V+=t:H+=-t}));var q=V+H,$=2/(r+1)*((0===q?0:100*Math.abs((V-H)/q))/100);L=isNaN(P.prevVidya)?A:$*A+(1-$)*P.prevVidya,P.prevVidya=L}P.sma.update(L);var K=NaN;try{K=P.sma.getResult()}catch(t){}var z=isNaN(B)||isNaN(K)?NaN:K+B*h,G=isNaN(B)||isNaN(K)?NaN:K-B*h,Y=e>0?i[c][e-1]:NaN,J=e>0?i[N.upper][e-1]:NaN,W=e>0?i[N.lower][e-1]:NaN,Z=e>0&&Y<=J&&A>z,X=e>0&&Y>=W&&A<G;Z&&(P.isTrendUp=!0),X&&(P.isTrendUp=!1);var tt=0;e>0&&(tt=P.isTrendUp?I>0?I+1:1:I<0?I-1:-1),Z||X?P.upVol=P.downVol=0:(P.upVol+=E>T?M:0,P.downVol+=E<T?M:0);var et=(P.upVol+P.downVol)/2||1,rt=(P.upVol-P.downVol)/et,nt=P.isTrendUp?G:z,ot=NaN;return tt>0?ot=R:tt<0&&(ot=D),t.pushToMain({index:e,key:N.vidya,value:nt}),t.pushToMain({index:e,key:N.upper,value:z}),t.pushToMain({index:e,key:N.lower,value:G}),t.pushToMain({index:e,key:N.delta_vol,value:rt}),t.pushToMain({index:e,key:N.cross,value:tt}),t.pushToMain({index:e,key:N.liquidity,value:ot}),P.liquidity.high.push(k),P.liquidity.low.push(x),P.liquidity.high.length>m&&P.liquidity.high.shift(),P.liquidity.low.length>m&&P.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=t.useFullNames,y=l.instanceKey;if(0===e){var h=t.inputParams,v=t.len;if(!c.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var m,d=0,b=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 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&&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}}}}(h);try{for(b.s();!(m=b.n()).done;)"macd"===m.value.key&&d++}catch(t){b.e(t)}finally{b.f()}var g=d>1||p,w="".concat(r,"_").concat(n,"_").concat(o),S=function(t){return a===$e?g?"macd_".concat(t,"_").concat(w):"macd_".concat(t):g?"macd_".concat(t,"_").concat(a,"_").concat(w):"macd_".concat(t,"_").concat(a)},O=S("diff"),j=S("dea"),P=S("histogram");s.hasOwnProperty("macd")||(s.macd={numberOfIndicators:d,settings:{}}),s.macd.settings[y]=new ce(new oe(r),new oe(n),new oe(o)),Object.assign(c,He(He(He({},O,new Float64Array(v).fill(NaN)),j,new Float64Array(v).fill(NaN)),P,new Float64Array(v).fill(NaN)));for(var _=[O,j,P],N=0,A=_;N<A.length;N++){var k=A[N];f.add(k)}u>0&&t.lag(_,u)}var x=s.macd,E=x.numberOfIndicators,T=x.settings,M=E>1||p,I="".concat(r,"_").concat(n,"_").concat(o),D=function(t){return a===$e?M?"macd_".concat(t,"_").concat(I):"macd_".concat(t):M?"macd_".concat(t,"_").concat(a,"_").concat(I):"macd_".concat(t,"_").concat(a)},R=D("diff"),C=D("dea"),F=D("histogram"),B=T[y],L=c[a][e];B.update(L);var U={};try{U=B.getResult()}catch(t){}return t.pushToMain({index:e,key:R,value:U?U.macd:NaN}),t.pushToMain({index:e,key:C,value:U?U.signal:NaN}),t.pushToMain({index:e,key:F,value:U?U.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,S=Number.isNaN(b)?NaN:Math.max(b,0),O=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:S}),t.pushToMain({index:e,key:"".concat(l,"_low"),value:O}),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.priceBased,s=t.useFullNames,f=o.lag,p=void 0===f?0:f,y="".concat(r,"_").concat(n);if(0===e){var h,v=l.filter((function(t){return"donchianChannels"===t.key})).length,m=v>1||s,d=["upper","basis","lower"].map((function(t){return m?"donchian_channel_".concat(t,"_").concat(y):"donchian_channel_".concat(t)})),b=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 Ke(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)?Ke(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}}}}(d);try{for(b.s();!(h=b.n()).done;){var g=h.value;c.add(g)}}catch(t){b.e(t)}finally{b.f()}a.donchian_channel||(a.donchian_channel={numberOfIndicators:v,settings:{}}),a.donchian_channel.numberOfIndicators=v,a.donchian_channel.settings[y]={maxDeque:[],minDeque:[]},Object.assign(i,Object.fromEntries(d.map((function(t){return[t,new Float64Array(u).fill(NaN)]})))),p>0&&t.lag(d,p)}var w=a.donchian_channel,S=w.numberOfIndicators,O=w.settings,j=S>1||s,P=function(t){return j?"donchian_channel_".concat(t,"_").concat(y):"donchian_channel_".concat(t)},_=O[y],N=_.maxDeque,A=_.minDeque,k=e-n,x=k-r+1,E=["upper","basis","lower"].map(P);if(x<0||k+1>u)return E.forEach((function(r){return t.pushToMain({index:e,key:r,value:NaN})})),!0;var T=i.high,M=i.low,I=function(t,e,r){for(;t.length&&t[0]<x;)t.shift();for(;t.length&&r(e[t.at(-1)],e[k]);)t.pop();t.push(k)};I(N,T,(function(t,e){return t<=e})),I(A,M,(function(t,e){return t>=e}));var D=N.length&&A.length,R=D?T[N[0]]:NaN,C=D?M[A[0]]:NaN,F=D?(R+C)/2:NaN;return t.pushToMain({index:e,key:P("upper"),value:R}),t.pushToMain({index:e,key:P("basis"),value:F}),t.pushToMain({index:e,key:P("lower"),value:C}),!0},bollingerBands:function(t,e,r,n){var o,i,a,u,l,c,s=(arguments.length>4&&void 0!==arguments[4]?arguments[4]:{}).lag,f=t.verticalOhlcv,p=t.instances,y=t.useFullNames,h="".concat(r,"_").concat(n),v="bollinger_bands",m="close";if(0===e){var d=t.inputParams,b=t.verticalOhlcv,g=t.len,w=t.priceBased;if(!(m in b))throw new Error('bollingerBands could not find target "'.concat(m,'"'));var S,O=0,j=Je(d);try{for(j.s();!(S=j.n()).done;)"bollingerBands"===S.value.key&&O++}catch(t){j.e(t)}finally{j.f()}p.bollinger_bands||(p.bollinger_bands={numberOfIndicators:O,settings:{}}),p.bollinger_bands.settings[h]=new Jt(r,n);var P=O>1||y?"_".concat(h):"",_=["".concat(v,"_upper").concat(P),"".concat(v,"_middle").concat(P),"".concat(v,"_lower").concat(P)];if(w.has(m)){var N,A=Je(_);try{for(A.s();!(N=A.n()).done;){var k=N.value;w.add(k)}}catch(t){A.e(t)}finally{A.f()}}var x=Object.fromEntries(_.map((function(t){return[t,new Float64Array(g).fill(NaN)]})));Object.assign(b,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){Ye(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}({},x)),s>0&&t.lag(_,s)}var E=p.bollinger_bands.numberOfIndicators>1||y?"_".concat(h):"",T=p.bollinger_bands.settings[h],M=f[m][e];T.update(M);var I={};try{I=T.getResult()}catch(t){}var D=null!==(o=null===(i=I)||void 0===i?void 0:i.upper)&&void 0!==o?o:NaN,R=null!==(a=null===(u=I)||void 0===u?void 0:u.middle)&&void 0!==a?a:NaN,C=null!==(l=null===(c=I)||void 0===c?void 0:c.lower)&&void 0!==l?l:NaN;return t.pushToMain({index:e,key:"".concat(v,"_upper").concat(E),value:D}),t.pushToMain({index:e,key:"".concat(v,"_middle").concat(E),value:R}),t.pushToMain({index:e,key:"".concat(v,"_lower").concat(E),value:C}),!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 oe(r),slowEMA:new oe(n)},(a=function(t){var e=function(t,e){if("object"!=Ze(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ze(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ze(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=Hr(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)||Hr(h,v)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),w=g[0],S=g[1];t.pushToMain({index:e,key:w,value:S})}},scaler:function(t,e,r,n,o){var i=o.type,a=o.minMaxRange,u=o.lookback,l=o.weights,c=o.euclideanWeights,s=o.byFeatureRange,f=o.offset,p=t.verticalOhlcv,y=t.instances,h="".concat(i,"_").concat(r);if(0===e){var v=t.len;if(t.isAlreadyComputed.has(h))throw new Error('In scaler method can not repeat params "size" and "options.type" together between indicators.');y.hasOwnProperty("scaler")||(y.scaler={}),y.scaler.hasOwnProperty(h)||(y.scaler[h]={extectedFeatures:0===u?n.length:n.length+u*n.length});var m,d=[],b=Cr(n);try{var g=function(){var e=m.value;if(!p.hasOwnProperty(e))throw new Error('Target property "'.concat(e,'" not found in verticalOhlcv'));var r,n="".concat(h,"_").concat(e);if(p[n]=new Float64Array(v).fill(NaN),t.scaledGroups[h]||(t.scaledGroups[h]=[]),t.scaledGroups[h].push(n),u>0){var o,i,a=Array.from({length:u}).map((function(t,e){return"".concat(n,"_lag_").concat(e+1)})),l=Cr(a);try{for(l.s();!(i=l.n()).done;){var c=i.value;p[c]=new Float64Array(v).fill(NaN)}}catch(t){l.e(t)}finally{l.f()}(o=t.scaledGroups[h]).push.apply(o,function(t){if(Array.isArray(t))return Br(t)}(r=a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||Fr(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.")}()),d.push(n)}};for(b.s();!(m=b.n()).done;)g()}catch(t){b.e(t)}finally{b.f()}for(var w=0,S=Object.keys(l);w<S.length;w++){var O=S[w];if(!p.hasOwnProperty(O))throw new Error('Target property "'.concat(O,'" not found in verticalOhlcv'))}}var j=y.scaler[h].extectedFeatures,P=!1,_={},N=[],A=0,k=e-f;if(!(k<0)){for(var x=0;x<n.length;x++){var E,T,M=n[x],I=p[M],D=null!==(E=null==l||null===(T=l[M])||void 0===T?void 0:T[0])&&void 0!==E?E:1,R=I[k];if(Lr(R)){P=!0;break}if(_[M]={val:R,weight:c?Math.sqrt(D):D},N.push(R),A++,u>0){for(var C=1;C<=u;C++){var F,B,L=null!==(F=null==l||null===(B=l[M])||void 0===B?void 0:B[C])&&void 0!==F?F:1,U=I[k-C];if(Lr(U)){P=!0;break}_["".concat(M,"_lag_").concat(C)]={val:U,weight:c?Math.sqrt(L):L},N.push(U),A++}if(P)break}}if(!P&&A===j){if("minmax"===i)for(var V=Math.min.apply(Math,N),H=Math.max.apply(Math,N),q=0,$=Object.entries(_);q<$.length;q++){var K=Rr($[q],2),z=K[0],G=K[1],Y=G.val,J=G.weight,W=gr(Y,V,H,a),Z=0===W?0:W*J;t.pushToMain({index:e,key:"".concat(h,"_").concat(z),value:Z})}if("zscore"===i)for(var Q=N.length,X=N.reduce((function(t,e){return t+e}),0)/Q,tt=N.reduce((function(t,e){return t+Math.pow(e-X,2)}),0)/Q,et=Math.sqrt(tt),rt=0,nt=Object.entries(_);rt<nt.length;rt++){var ot=Rr(nt[rt],2),it=ot[0],at=ot[1],ut=at.val,lt=at.weight,ct=wr(ut,X,et),st=0===ct?0:ct*lt;t.pushToMain({index:e,key:"".concat(h,"_").concat(it),value:st})}if("byfeature"===i)for(var ft=Rr(s,2),pt=ft[0],yt=ft[1],ht=0,vt=Object.entries(_);ht<vt.length;ht++){var mt=Rr(vt[ht],2),dt=mt[0],bt=mt[1],gt=bt.val,wt=bt.weight,St=gr(gt,pt,yt,a),Ot=0===St?0:St*wt;t.pushToMain({index:e,key:"".concat(h,"_").concat(dt),value:Ot})}}}},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 Sr(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)?Sr(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)),S=w?er(g,p):d,O=d>=-125&&d<=125&&!1===w?"Int8Array":"Float64Array";u[g]=yr(O,s,S)}c.hasOwnProperty("crossPairs")||(c.crossPairs={}),c.crossPairs[b]={run:new Ar,min:1/0,max:-1/0};var j=null!==a&&a<=125?"Int8Array":"Float64Array";u[b]=yr(j,s,0),i&&(u["one_hot_".concat(b)]=yr("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 P=c.crossPairs[b].run;if("price"===m){var _=u.close[e],N=u[d][e];P.update(e,{fast:_,slow:N,high:u.high[e],low:u.low[e]})}else{var A=u[m][e],k=u[d][e];P.update(e,{fast:A,slow:k})}var x=P.getResult(),E=null!==a?Math.min(Math.max(x,-a),a):x;if(t.pushToMain({index:e,key:b,value:E}),i){var T=E+a,M=2*a+1;t.pushToMain({index:e,key:"one_hot_".concat(b),value:br(T,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=vr(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=hr(c,o[c]);o[p]=yr(y,i)}}}catch(t){l.e(t)}finally{l.f()}}var h,v=vr(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,S=w<0||void 0===d[w]?null:d[w];t.pushToMain({index:e,key:g,value:S})}}catch(t){v.e(t)}finally{v.f()}return!0}};function rn(t,e){if(t){if("string"==typeof t)return nn(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)?nn(t,e):void 0}}function nn(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 on=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,S=Array.from({length:w},(function(){return{}})),O={},j=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=rn(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 P=v.value;y&&p.has(P)?O[P]=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)}:O[P]=function(t){return t}}}catch(t){j.e(t)}finally{j.f()}for(var _=0,N=Object.entries(u);_<N.length;_++){var A=(m=N[_],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)||rn(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.")}()),k=A[0],x=A[1];if(!f.has(k))for(var E=g;E<c;E++)S[E-g][k]="date"===k?ar[a](x[E]):O[k](x[E],h)}return S};function an(t){return an="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},an(t)}function un(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)||cn(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 ln(t,e,r){return(e=pn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function cn(t,e){if(t){if("string"==typeof t)return sn(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)?sn(t,e):void 0}}function sn(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 fn(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,pn(n.key),n)}}function pn(t){var e=function(t,e){if("object"!=an(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=an(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==an(e)?e:e+""}var yn=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,m=e.useFullNames,d=void 0!==m&&m;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"),f(v,"useFullNames","contructor"),this.chunkProcess=y,this.input=function(t){return function(t){if(Array.isArray(t))return sn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||cn(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,this.useFullNames=d;var b=["open","high","low","close","mid_price"];this.initialPriceBased=new Set(b),this.priceBased=new Set(b),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=Xe(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(Qe(c),"."));var s=Xe(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 g=function(t){for(var e=t.firstRow,r=t.precision,n=t.initialPriceBased,o={},i={},a=new Map,u=0,l=Object.entries(e);u<l.length;u++){var c=sr(l[u],2),s=c[0],f=c[1];if("date"===s)o[s]=lr(f),i[s]="Array";else if("volume"===s)o[s]=or(f,!0),i[s]="Int32Array";else if(n.has(s))o[s]=or(f,!0,r),i[s]="Float64Array",a.set(s,o[s]);else{var p=or(f,!1,r);o[s]=p,i[s]="number"===p?"Float64Array":"Array"}}if(new Set(a.values()).size>1){var y=function(t){return function(t){if(Array.isArray(t))return pr(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.")}()}(a.entries()).map((function(t){var e=sr(t,2),r=e[0],n=e[1];return"".concat(r,': "').concat(n,'"')})).join(", ");throw new Error("Inconsistent types among price-based columns — ".concat(y,". ")+"All initialPriceBased columns must share the same numeric type.")}return i.hasOwnProperty("open")&&i.hasOwnProperty("close")&&(i.mid_price=i.open,o.mid_price=o.open),{inputTypes:o,arrayTypes:i}}(this),w=g.inputTypes,S=g.arrayTypes;if(this.inputTypes=w,this.arrayTypes=S,!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?"milliseconds":n;return s(Object.keys(ar),o,"dateFormat","getData"),c(t,"options","getData"),on({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?"milliseconds":e;return s(Object.keys(ar),r,"dateFormat","getData"),on({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]=yr(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 S=Qr(w[g],2),O=S[0],j=S[1],P=b[O];if(void 0!==P)if(nr.hasOwnProperty(j)){var _=nr[j](P,s);e.pushToMain({index:d,key:O,value:_})}else ur.hasOwnProperty(j)?e.pushToMain({index:d,key:O,value:ur[j](P)}):e.pushToMain({index:d,key:O,value:P})}var N=(i.open[d]+i.close[d])/2;e.pushToMain({index:d,key:"mid_price",value:N});var A,k=Zr(f);try{for(k.s();!(A=k.n()).done;){var x=A.value,E=x.key,T=x.params;en[E].apply(en,[e,d].concat(Wr(T)))}}catch(t){k.e(t)}finally{k.f()}t[d]=null;var M=Object.keys(i);r(e,d,M)||(e.invalidValueIndex=d)}u.push.apply(u,Wr(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=cn(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.retLogs,a=void 0!==i&&i;return p(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),f(a,"options.retLogs",r),this.inputParams.push({key:r,order:0,params:[t,{lag:o,retLogs:a}]}),this}},{key:"adx",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="adx";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.retLogs,a=void 0!==i&&i;return p(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),f(a,"options.retLogs",r),this.inputParams.push({key:r,order:0,params:[t,{lag:o,retLogs:a}]}),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,l=r.retLogs,s=void 0!==l&&l;return p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(s,"option.retLogs",n),this.inputParams.push({key:n,order:0,params:[t,e,{lag:a,bothNull:o,retLogs:s}]}),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=n.lag,u=void 0===a?0:a,l=n.retLogs;return p(u,{min:0,max:i,allowDecimals:!1},"options.lag",o),f(l,"retLogs",o),this.inputParams.push({key:o,params:[t,e,r,{lag:u,retLogs:l}]}),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.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,params:[t,e,{lag:i}]}),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.retLogs,s=void 0!==l&&l;return h(o,"options.target",r),p(a,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),f(s,"retLogs",r),this.inputParams.push({key:r,params:[t,{target:o,lag:a,retLogs:s}]}),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.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:"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=ln(ln(ln(ln(ln({},"".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,a=t.retLogs,s=void 0!==a&&a;return p(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),l(i,"options.colKeys",e),f(s,"retLogs",e),this.inputParams.push({key:e,params:[{lag:n,colKeys:i,retLogs:s}]}),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),s(["minmax","zscore","byfeature"],t,"options.type",n),p(e,{min:1,max:this.len,allowDecimals:!1},"size",n);var o="".concat(n,"(").concat(t,", ").concat(e,", options = {})");c(r,"options",o);var i=r.minMaxRange,a=void 0===i?null:i,h=r.lag,v=void 0!==h&&h,m=r.colKeys,d=void 0===m?[]:m,b=r.weights,g=void 0===b?{}:b,w=r.euclideanWeights,S=void 0!==w&&w,O=r.byFeatureRange,j=void 0===O?null:O,P=r.offset,_=void 0===P?0:P;p(_,{min:0,max:this.len,allowDecimals:!1},"offset",n),l(d,"options.colKeys",o),f(v,"options.lag",o),c(g,"options.weights",o);var N=v?e-1:0;if(0===d.length)throw new Error('The property "options.colKeys" must be an array with target keys in '.concat(o,"."));for(var A=0,k=Object.entries(g);A<k.length;A++){var x=un(k[A],2),E=x[0],T=x[1];if(l(T,"options.weights.".concat(E)),!v&&T.size>0)throw new Error('If "options.lag" is set to false "options.weights.'.concat(E,'" can only contain 1 item (float) in ').concat(o,"."));if(T.length>e)throw new Error('The length of the property "options.weights.'.concat(E,'" can not be longer than "size" in ').concat(o,"."));for(var M=0;M<T.length;M++){var I=T[M];p(I,{min:.01,max:10,allowDecimals:!0},"options.weights.".concat(E,"[").concat(M,"]"),o)}}if("byfeature"!==t){if(null==!j)throw new Error('"options.byFeatureRange" is only valid when "type" is "byfeature".')}else y(j,"options.byFeatureRange",o);return["minmax","byfeature"].includes(t)&&y(a,"options.minMaxRange",o),this.inputParams.push({key:n,params:[e,d,{type:t,minMaxRange:a,lookback:N,weights:g,euclideanWeights:S,byFeatureRange:j,offset:_}]}),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=$r),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&&fn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();
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:()=>en});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=function(t,e){if(t){if("string"==typeof t)return o(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)?o(t,e):void 0}}(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){(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 i=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()}},a=function(t){if(!0===t.isComputed)throw Error('ohlcv is already computed, you can not add new indicators after "compute", "getLastValues" or "getData" methods are called.')},u=function(t,e,r){if(!Array.isArray(t))throw new Error('Param "'.concat(e,'" must be an array in "').concat(r,'".'));return!0},l=function(t,e,r){if(t instanceof Object==0)throw new Error('Param "'.concat(e,'" must be an object in "').concat(r,'".'));return!0},c=function(t,e,r,n){if(u(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},s=function(t,e,r){if("boolean"!=typeof t)throw new Error('Param "'.concat(e,'" must be an boolean in "').concat(r,'".'));return!0},f=function(t,e,r,n){l(e,"options","".concat(n,".").concat(r,".validateNumber"));var o=e.allowDecimals,i=void 0!==o&&o,a=e.min,u=e.max,c=i?"number":"integer";if("number"!=typeof t||!1===i&&!Number.isInteger(t))throw new Error('Param "'.concat(r,'" must be an ').concat(c,' in "').concat(n,'".'));if(void 0!==a&&"number"!=typeof a)throw new Error('Param "min" must be a valid '.concat(c,' (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(c,' (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(c," ≥ ").concat(a,' in "').concat(n,'".'));if(void 0!==u&&t>u)throw new Error('Param "'.concat(r,'" must be an ').concat(c," ≤ ").concat(u,' in "').concat(n,'".'));return!0},p=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},y=1e6,h="[big.js] ",v=h+"Invalid ",m=v+"decimal places",d=v+"rounding mode",b=h+"Division by zero",g={},w=void 0,S=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function O(t,e,r,n){var o=t.c;if(r===w&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(d);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]!==w))),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]!==w||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 j(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 _(t){var e="function"==typeof Map?new Map:void 0;return _=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(N())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&A(o,r.prototype),o}(t,arguments,k(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),A(r,t)},_(t)}function N(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(N=function(){return!!t})()}function A(t,e){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},A(t,e)}function k(t){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},k(t)}g.abs=function(){var t=new this.constructor(this);return t.s=1,t},g.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},g.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>y)throw Error(m);if(!o[0])throw Error(b);if(!n[0])return t.s=i,t.c=[t.e=0],t;var u,l,c,s,f,p=o.slice(),h=u=o.length,v=n.length,d=n.slice(0,u),g=d.length,S=t,j=S.c=[],P=0,_=a+(S.e=e.e-t.e)+1;for(S.s=i,i=_<0?0:_,p.unshift(0);g++<u;)d.push(0);do{for(c=0;c<10;c++){if(u!=(g=d.length))s=u>g?1:-1;else for(f=-1,s=0;++f<u;)if(o[f]!=d[f]){s=o[f]>d[f]?1:-1;break}if(!(s<0))break;for(l=g==u?o:p;g;){if(d[--g]<l[g]){for(f=g;f&&!d[--f];)d[f]=9;--d[f],d[g]+=10}d[g]-=l[g]}for(;!d[0];)d.shift()}j[P++]=s?c:++c,d[0]&&s?d[g]=n[h]||0:d=[n[h]]}while((h++<v||d[0]!==w)&&i--);return j[0]||1==P||(j.shift(),S.e--,_--),P>_&&O(S,_,r.RM,d[0]!==w),S},g.eq=function(t){return 0===this.cmp(t)},g.gt=function(t){return this.cmp(t)>0},g.gte=function(t){return this.cmp(t)>-1},g.lt=function(t){return this.cmp(t)<0},g.lte=function(t){return this.cmp(t)<1},g.minus=g.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},g.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(b);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)))},g.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t},g.plus=g.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},g.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(v+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},g.prec=function(t,e){if(t!==~~t||t<1||t>y)throw Error(v+"precision");return O(new this.constructor(this),t,e)},g.round=function(t,e){if(t===w)t=0;else if(t!==~~t||t<-y||t>y)throw Error(m);return O(new this.constructor(this),t+this.e+1,e)},g.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(h+"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 O(t,(o.DP-=4)+t.e+1,o.RM)},g.times=g.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},g.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==w){if(t!==~~t||t<0||t>y)throw Error(m);for(r=O(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return j(r,!0,!!n)},g.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==w){if(t!==~~t||t<0||t>y)throw Error(m);for(t=t+(r=O(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return j(r,!1,!!n)},g[Symbol.for("nodejs.util.inspect.custom")]=g.toJSON=g.toString=function(){var t=this,e=t.constructor;return j(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},g.toNumber=function(){var t=Number(j(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(h+"Imprecise conversion");return t},g.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==w){if(t!==~~t||t<1||t>y)throw Error(v+"precision");for(r=O(new n(r),t,e);r.c.length<t;)r.c.push(0)}return j(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},g.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(h+"valueOf disallowed");return j(t,t.e<=e.NE||t.e>=e.PE,!0)},function t(){function e(r){var n=this;if(!(n instanceof e))return r===w?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(v+"value");r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!S.test(e))throw Error(v+"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=g,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=k(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,N()?Reflect.construct(e,r||[],k(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&&A(t,e)}(e,t),r=e,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(_(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 x(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,I(n.key),n)}}function M(t,e,r){return(e=I(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function I(t){var e=function(t,e){if("object"!=T(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}var D=function(){return t=function t(){(function(t,e){if(!(t instanceof e))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)},(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)}}])&&x(t.prototype,e),r&&x(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();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)}function C(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,V(n.key),n)}}function F(t,e,r){return e=L(e),function(t,e){if(e&&("object"==R(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,B()?Reflect.construct(e,r||[],L(t).constructor):e.apply(t,r))}function B(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(B=function(){return!!t})()}function L(t){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},L(t)}function U(t,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},U(t,e)}function V(t){var e=function(t,e){if("object"!=R(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==R(e)?e:e+""}var H=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=F(this,e),i=void 0,(o=V(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&&U(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)}}])&&C(r.prototype,n),o&&C(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);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 $(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,J(n.key),n)}}function K(t,e,r){return e=G(e),function(t,e){if(e&&("object"==q(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,z()?Reflect.construct(e,r||[],G(t).constructor):e.apply(t,r))}function z(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(z=function(){return!!t})()}function G(t){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},G(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}function J(t){var e=function(t,e){if("object"!=q(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}var Z=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=K(this,e,[].concat(a)),o=[],(n=J(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&&Y(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&&$(r.prototype,n),o&&$(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(H);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 W(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,ot(n.key),n)}}function X(t,e,r){return e=et(e),function(t,e){if(e&&("object"==Q(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,tt()?Reflect.construct(e,r||[],et(t).constructor):e.apply(t,r))}function tt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(tt=function(){return!!t})()}function et(t){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},et(t)}function rt(t,e){return rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rt(t,e)}function nt(t,e,r){return(e=ot(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ot(t){var e=function(t,e){if("object"!=Q(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}var it=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),nt(r=X(this,e),"interval",void 0),nt(r,"indicator",void 0),nt(r,"smoothingFactor",void 0),r.interval=t,r.indicator=new Z(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&&rt(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&&W(r.prototype,n),o&&W(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function at(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function ut(t){return ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ut(t)}function lt(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,ht(n.key),n)}}function ct(t,e,r){return e=ft(e),function(t,e){if(e&&("object"==ut(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,st()?Reflect.construct(e,r||[],ft(t).constructor):e.apply(t,r))}function st(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(st=function(){return!!t})()}function ft(t){return ft=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ft(t)}function pt(t,e){return pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pt(t,e)}function yt(t,e,r){return(e=ht(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ht(t){var e=function(t,e){if("object"!=ut(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ut(e)?e:e+""}var vt=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 yt(t=ct(this,e,[].concat(n)),"previousCandle",void 0),yt(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&&pt(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&&lt(r.prototype,n),o&&lt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);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 dt(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,jt(n.key),n)}}function bt(t,e,r){return e=wt(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,gt()?Reflect.construct(e,r||[],wt(t).constructor):e.apply(t,r))}function gt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gt=function(){return!!t})()}function wt(t){return wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wt(t)}function St(t,e){return St=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},St(t,e)}function Ot(t,e,r){return(e=jt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jt(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 Pt=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ot(r=bt(this,e),"interval",void 0),Ot(r,"tr",void 0),Ot(r,"smoothing",void 0),r.interval=t,r.tr=new vt,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&&St(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&&dt(r.prototype,n),o&&dt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);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 Nt(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 At(t,e,r){return e=Et(e),function(t,e){if(e&&("object"==_t(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,kt()?Reflect.construct(e,r||[],Et(t).constructor):e.apply(t,r))}function kt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(kt=function(){return!!t})()}function Et(t){return Et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Et(t)}function Tt(t,e){return Tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tt(t,e)}function xt(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"!=_t(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}var It=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),xt(r=At(this,e),"interval",void 0),xt(r,"movesUp",void 0),xt(r,"movesDown",void 0),xt(r,"previousCandle",void 0),xt(r,"atr",void 0),xt(r,"mdi",void 0),xt(r,"pdi",void 0),r.interval=t,r.atr=new Pt(r.interval,n),r.movesDown=new n(r.interval),r.movesUp=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&&Tt(t,e)}(e,t),r=e,n=[{key:"updateState",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.atr.update(t),this.movesUp.update(e),this.movesDown.update(r),this.previousCandle=t}},{key:"update",value:function(t){if(this.previousCandle){var e=t.high,r=this.previousCandle.high,n=t.low,o=e-r,i=this.previousCandle.low-n,a=o<0||o<i?0:o,u=i<0||i<o?0:i;if(this.updateState(t,a,u),this.movesUp.isStable){this.pdi=this.movesUp.getResult()/this.atr.getResult(),this.mdi=this.movesDown.getResult()/this.atr.getResult();var l=Math.abs(this.pdi-this.mdi),c=this.pdi+this.mdi;return 0===c?this.setResult(0,!1):this.setResult(l/c*100,!1)}}else this.updateState(t)}}],n&&Nt(r.prototype,n),o&&Nt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function Dt(t){return Dt="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},Dt(t)}function Rt(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,Vt(n.key),n)}}function Ct(t,e,r){return e=Bt(e),function(t,e){if(e&&("object"==Dt(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,Ft()?Reflect.construct(e,r||[],Bt(t).constructor):e.apply(t,r))}function Ft(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ft=function(){return!!t})()}function Bt(t){return Bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bt(t)}function Lt(t,e){return Lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lt(t,e)}function Ut(t,e,r){return(e=Vt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Vt(t){var e=function(t,e){if("object"!=Dt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Dt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Dt(e)?e:e+""}var Ht=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ut(r=Ct(this,e),"interval",void 0),Ut(r,"dx",void 0),Ut(r,"adx",void 0),r.interval=t,r.adx=new n(r.interval),r.dx=new It(t,n),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&&Lt(t,e)}(e,t),r=e,n=[{key:"mdi",get:function(){return this.dx.mdi}},{key:"pdi",get:function(){return this.dx.pdi}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.dx.update(t);if(void 0!==r&&this.adx.update(r),this.adx.isStable)return this.setResult(this.adx.getResult(),e)}}],n&&Rt(r.prototype,n),o&&Rt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function qt(t){return qt="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},qt(t)}function $t(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,zt(n.key),n)}}function Kt(t,e,r){return(e=zt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zt(t){var e=function(t,e){if("object"!=qt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=qt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qt(e)?e:e+""}var Gt=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=at(this.prices),r=function(t,e){var r=e||at(t),n=at(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}}])&&$t(t.prototype,e),r&&$t(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();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 Jt(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,ee(n.key),n)}}function Zt(t,e,r){return e=Wt(e),function(t,e){if(e&&("object"==Yt(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,Qt()?Reflect.construct(e,r||[],Wt(t).constructor):e.apply(t,r))}function Qt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qt=function(){return!!t})()}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wt(t)}function Xt(t,e){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xt(t,e)}function te(t,e,r){return(e=ee(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ee(t){var e=function(t,e){if("object"!=Yt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}var re=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),te(r=Zt(this,e,[t]),"interval",void 0),te(r,"pricesCounter",0),te(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&&Xt(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&&Jt(r.prototype,n),o&&Jt(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(H);function ne(t){return ne="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},ne(t)}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"!=ne(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ne(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,"short",void 0),ie(this,"long",void 0),ie(this,"signal",void 0),ie(this,"prices",[]),ie(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&&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,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,ve(n.key),n)}}function se(t,e,r){return e=pe(e),function(t,e){if(e&&("object"==le(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,fe()?Reflect.construct(e,r||[],pe(t).constructor):e.apply(t,r))}function fe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(fe=function(){return!!t})()}function pe(t){return pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pe(t)}function ye(t,e){return ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ye(t,e)}function he(t,e,r){return(e=ve(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ve(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+""}var me=function(t){function e(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),he(r=se(this,e),"interval",void 0),he(r,"previousPrices",[]),he(r,"avgGain",void 0),he(r,"avgLoss",void 0),he(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&&ye(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&&ce(r.prototype,n),o&&ce(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(D);function de(t){return de="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},de(t)}function be(t){return function(t){if(Array.isArray(t))return ge(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 ge(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)?ge(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 ge(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 we(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,Oe(n.key),n)}}function Se(t,e,r){return(e=Oe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Oe(t){var e=function(t,e){if("object"!=de(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==de(e)?e:e+""}var je=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),Se(this,"n",void 0),Se(this,"m",void 0),Se(this,"p",void 0),Se(this,"candles",[]),Se(this,"result",void 0),Se(this,"periodM",void 0),Se(this,"periodP",void 0),this.n=e,this.m=r,this.p=n,this.periodM=new Z(r),this.periodP=new Z(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,be(this.candles.map((function(t){return t.high})))),r=Math.min.apply(Math,be(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}}}}])&&we(t.prototype,e),r&&we(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}(),Pe=function(t,e){if(0===t&&(t=.001),0===e&&(e=.001),Math.sign(t)!==Math.sign(e))throw new Error("[BUG] Params must have the same sign in mathLog a=".concat(t," b=").concat(e,"."));t<0&&(t=-t,e=-e);var r,n=Math.log(t/e);if(null==(r=n)||!Number.isFinite(r))throw new Error("[BUG] Invalid params passed to mathLog a=".concat(t," b=").concat(e,"."));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 Ne(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){return Ae="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},Ae(t)}function ke(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Ae(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ae(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Ee={ema:re,sma:Z},Te=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 Ee[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 xe(t){return xe="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},xe(t)}function Me(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)||De(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 Ie(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=xe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function De(t,e){if(t){if("string"==typeof t)return Re(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)?Re(t,e):void 0}}function Re(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 Ce=function(t){return null==t||!Number.isFinite(t)};function Fe(t){return function(t){if(Array.isArray(t))return Be(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 Be(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)?Be(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 Be(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 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 Ue(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 Ve(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 He="close";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}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 Ke(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 ze(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 Ge(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 Ye(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)?Ye(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 Ye(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 Je="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},Je(t)}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 We(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)?We(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 We(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=function(t,e){if("string"!=typeof t)throw new Error("addPrecisionExact expects a string when precision=true");var r="-"===t.charAt(0),n=Qe((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 tr(t){return tr="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},tr(t)}var er={number:function(t){return t},numberCleanString:function(t){return Number(t)},precisionNumberCleanString:function(t,e){return Xe(t,e)}},rr=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 tr(t)}if(n)return"number";if(o)return"numberCleanString";if(e)throw new TypeError("Invalid input: expected a number or numeric string");return tr(t)};function nr(t){return nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nr(t)}var or={toString:function(t){return t.toString()},string:function(t){return t.toString()},toISOString:function(t){return t.toISOString()},iso:function(t){return t.toISOString()},toUTCString:function(t){return t.toUTCString()},milliseconds:function(t){return t.getTime()},seconds:function(t){return t.getTime()/1e3},object:function(t){return t}},ir={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)}},ar=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(nr(t),'" date value passed in selectDateFormatter. Supported formats: \n-').concat(e.join("\n- ")))};if("object"===nr(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 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 lr(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)||cr(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 cr(t,e){if(t){if("string"==typeof t)return sr(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)?sr(t,e):void 0}}function sr(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 fr=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}))},pr=function(t,e){if(!e||"object"!==ur(e))throw new TypeError('Invalid array type: "'.concat(t,'"'));return e.constructor.name};function yr(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 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}}(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 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 vr=function(t,e){var r=new Uint8Array(e);return r[t]=1,r};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}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 br(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,gr(n.key),n)}}function gr(t){var e=function(t,e){if("object"!=dr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}var wr=function(t,e){return t>e},Sr=function(t,e){return t<e},Or=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:wr(r,o)?a=this.areHighAndLowUndefined?1:[i,o,this.prevLow,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&Sr(i,o)&&wr(this.prevLow,this.prevSlow)?0:1:Sr(r,o)&&(a=this.areHighAndLowUndefined?0:[n,o,this.prevHigh,this.prevSlow].every((function(t){return!Number.isNaN(t)}))&&wr(n,o)&&Sr(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}}])&&br(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();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 Pr(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 _r(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 Nr(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?_r(Object(r),!0).forEach((function(e){Ar(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_r(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ar(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=jr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}(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 Er(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)?Er(t,e):void 0}}function Er(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 Tr(t){return Tr="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},Tr(t)}function xr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Tr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Tr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Tr(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Mr(t,e){if(t){if("string"==typeof t)return Ir(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)?Ir(t,e):void 0}}function Ir(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 Dr=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 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 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 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}function Lr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=Rr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ur(t){return function(t){if(Array.isArray(t))return $r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||qr(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 Vr(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=qr(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 Hr(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)||qr(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 qr(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 Kr={candleFeatures:function(t,e,r){var n=r.lag,o=r.colKeys,i=r.retLogs,a=t.verticalOhlcv,u=t.priceBased,l=t.scaledGroups,c=function(t,e){return i?Math.log(t/e):(t-e)/e},s=i?"ret_log_":"ret_";if(0===e){var f,p=t.len,y=Lr(Lr(Lr(Lr(Lr(Lr(Lr({},"".concat(s,"change"),new Float64Array(p).fill(NaN)),"".concat(s,"mid_price_change"),new Float64Array(p).fill(NaN)),"".concat(s,"upper_wick"),new Float64Array(p).fill(NaN)),"".concat(s,"lower_wick"),new Float64Array(p).fill(NaN)),"".concat(s,"gap"),new Float64Array(p).fill(NaN)),"".concat(s,"body"),new Float64Array(p).fill(NaN)),"".concat(s,"range"),new Float64Array(p).fill(NaN)),h=Cr(o);try{for(h.s();!(f=h.n()).done;){var v=f.value;if(!a.hasOwnProperty(v))throw new Error('Target property in "options.colKey" array "'.concat(v,'" not found in verticalOhlcv for "candleFeatures".'));if(!u.has(v))throw new Error('Target property in "options.colKey" array "'.concat(v,'" not found in priceBased for "candleFeatures".'));y["".concat(s).concat(v)]=new Float64Array(p).fill(NaN)}}catch(t){h.e(t)}finally{h.f()}Object.assign(a,y),l.candleFeatures=Object.keys(y),n&&t.lag(Object.keys(y),n)}var m,d,b=a.close[e-1],g=a.open[e-1];if(void 0!==b){var w,S,O=a.open[e],j=a.high[e],P=a.low[e],_=a.close[e],N=(b+g)/2,A=(O+_)/2,k=Math.max(O,_),E=Math.min(O,_),T=Lr(Lr(Lr(Lr(Lr(Lr(Lr({},"".concat(s,"change"),c(_,b)),"".concat(s,"mid_price_change"),c(A,N)),"".concat(s,"upper_wick"),c(j,k)),"".concat(s,"lower_wick"),c(E,P)),"".concat(s,"gap"),c(O,b)),"".concat(s,"body"),c(_,O)),"".concat(s,"range"),c(j,P)),x=!1,M=Cr(o);try{for(M.s();!(w=M.n()).done;){var I=w.value,D=a[I][e];if(null==(S=D)||!Number.isFinite(S)){x=!0;break}var R=c(_,D);T["".concat(s).concat(I)]=R}}catch(t){M.e(t)}finally{M.f()}if(!x)for(var C=0,F=Object.entries(T);C<F.length;C++){var B=(m=F[C],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)||Fr(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.")}()),L=B[0],U=B[1];t.pushToMain({index:e,key:L,value:U})}}},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 Er(t)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||kr(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")]).filter((function(t){return"one_hot_year"!==t})),colKeySizes:Nr({},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=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}}}}(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:vr(o,r.one_hot_month),one_hot_hour:vr(i,r.one_hot_hour),one_hot_minute:vr(a,r.one_hot_minute),one_hot_day_of_the_week:vr(u,r.one_hot_day_of_the_week),one_hot_day_of_the_month:vr(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=Pr(g[b],2),S=w[0],O=w[1];t.pushToMain({index:e,key:S,value:O})}},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=i.retLogs,f=void 0===s||s,p=t.verticalOhlcv,y=t.instances,h=t.len,v=t.scaledGroups,m="".concat(r,"_").concat(n),d=["open","high","low","close"],b=function(t,e){return f?Math.log(t/e):(t-e)/e},g=f?"ret_log_":"ret_",w=c?"":"_".concat(m),S=function(t){return"".concat(g,"heiken_ashi_").concat(t).concat(w)},O=c?"heiken_ashi_cross":"heiken_ashi_cross_".concat(m),j=c?"heiken_ashi":"heiken_ashi_".concat(m);if(0===e){y[j]={emaPre:c?null:Object.fromEntries(d.map((function(t){return[t,new re(r)]}))),emaPost:c?null:Object.fromEntries(d.map((function(t){return[t,new re(n)]}))),prevHaOpen:NaN,prevHaClose:NaN,prevSmOpen:NaN,prevSmClose:NaN,isTrendUp:!1};var P=["body","upper_wick","lower_wick","range"].map(S),_=Object.fromEntries([].concat((o=P,function(t){if(Array.isArray(t))return Re(t)}(o)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||De(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.")}()),[O]).map((function(t){return[t,new Float64Array(h).fill(NaN)]})));Object.assign(p,_),v&&(v.heikenAshi=P),u>0&&t.lag(P,u)}var N,A,k,E,T=p.open[e],x=p.high[e],M=p.low[e],I=p.close[e],D=y[j];if(Ce(T)||Ce(x)||Ce(M)||Ce(I))return!0;if(c)N=T,A=x,k=M,E=I;else{D.emaPre.open.update(T),D.emaPre.high.update(x),D.emaPre.low.update(M),D.emaPre.close.update(I);try{N=D.emaPre.open.getResult(),A=D.emaPre.high.getResult(),k=D.emaPre.low.getResult(),E=D.emaPre.close.getResult()}catch(t){return!0}}if(Ce(N)||Ce(A)||Ce(k)||Ce(E))return!0;var R,C,F,B,L=(N+A+k+E)/4,U=Number.isNaN(D.prevHaOpen)||Number.isNaN(D.prevHaClose)?(N+E)/2:(D.prevHaOpen+D.prevHaClose)/2,V=Math.max(A,U,L),H=Math.min(k,U,L);if(D.prevHaOpen=U,D.prevHaClose=L,c)R=U,C=V,F=H,B=L;else{D.emaPost.open.update(U),D.emaPost.high.update(V),D.emaPost.low.update(H),D.emaPost.close.update(L);try{R=D.emaPost.open.getResult(),C=D.emaPost.high.getResult(),F=D.emaPost.low.getResult(),B=D.emaPost.close.getResult()}catch(t){return!0}}if(Ce(R)||Ce(C)||Ce(F)||Ce(B)||R<=0||C<=0||F<=0||B<=0)return!0;var q=e>0?p[O][e-1]:0,$=D.prevSmOpen,K=D.prevSmClose,z=Number.isFinite($)&&Number.isFinite(K)&&K<=$&&B>R,G=Number.isFinite($)&&Number.isFinite(K)&&K>=$&&B<R;z&&(D.isTrendUp=!0),G&&(D.isTrendUp=!1);var Y=0;e>0&&(Y=D.isTrendUp?q>0?q+1:1:q<0?q-1:-1),D.prevSmOpen=R,D.prevSmClose=B;for(var J=Math.max(R,B),Z=Math.min(R,B),Q=Ie(Ie(Ie(Ie({},S("body"),b(B,R)),S("upper_wick"),b(C,J)),S("lower_wick"),b(Z,F)),S("range"),b(C,F)),W=0,X=Object.entries(Q);W<X.length;W++){var tt=Me(X[W],2),et=tt[0],rt=tt[1];Ce(rt)||t.pushToMain({index:e,key:et,value:rt})}return t.pushToMain({index:e,key:O,value:Y}),!0},rsi:function(t,e,r,n){var o=n.target,i=n.lag,a=n.retLogs,u=t.verticalOhlcv,l=t.instances,c="close"===o?"":"_".concat(o),s=a?"ret_log_rsi_".concat(r).concat(c):"rsi_".concat(r).concat(c),f=a?"ret_log_rsi_sma_".concat(r).concat(c):"rsi_sma_".concat(r).concat(c);if(0===e){var p=t.len;if(!u.hasOwnProperty(o))throw new Error("Target property ".concat(o," not found in verticalOhlcv for rsi."));Object.assign(l,Ne(Ne({},s,new me(r)),f,new Z(r))),Object.assign(u,Ne(Ne({},s,new Float64Array(p).fill(NaN)),f,new Float64Array(p).fill(NaN)));var y=[s,f];i>0&&t.lag(y,i)}var h=u[o][e],v=NaN,m=NaN;l[s].update(h);try{v=l[s].getResult()}catch(t){v=NaN}var d=Number.isNaN(v)?NaN:a?Pe(v,50):v;t.pushToMain({index:e,key:s,value:d}),Number.isNaN(v)||l[f].update(v);try{m=l[f].getResult()}catch(t){m=NaN}var b=Number.isNaN(m)?NaN:a?Pe(m,50):m;t.pushToMain({index:e,key:f,value:b})},stochastic:function(t,e,r,n,o,i){var a=i.lag,u=i.retLogs,l=t.verticalOhlcv,c=t.instances,s=t.useFullNames,f=14!==r||3!==n||3!==o||s?"_".concat(r,"_").concat(n,"_").concat(o):"",p=u?"ret_log_stochastic_d".concat(f):"stochastic_d".concat(f),y=u?"ret_log_stochastic_k".concat(f):"stochastic_k".concat(f),h=f;if(0===e){var v=t.len;Object.assign(c,ke({},h,new je(r,n,o))),Object.assign(l,ke(ke({},p,new Float64Array(v).fill(NaN)),y,new Float64Array(v).fill(NaN)));var m=[p,y];a>0&&t.lag(m,a)}var d=l.close[e],b=l.low[e],g=l.high[e],w=null;c[h].update({close:d,low:b,high:g});try{w=c[h].getResult()}catch(t){w=null}var S=w?u?Pe(w.stochK,50):w.stochK:NaN,O=w?u?Pe(w.stochD,50):w.stochD:NaN;t.pushToMain({index:e,key:y,value:S}),t.pushToMain({index:e,key:p,value:O})},atr:function(t,e,r,n){var o=n.lag,i=n.retLogs,a=t.verticalOhlcv,u=t.instances,l=t.priceBased,c=i?"ret_log_atr_".concat(r):"atr_".concat(r);if(0===e){var s=t.instances,f=t.verticalOhlcv,p=t.len;s[c]=new Pt(r,it);for(var y=[c],h=0,v=y;h<v.length;h++){var m=v[h];f[m]=new Float64Array(p).fill(NaN),l.add(m)}o>0&&t.lag(y,o)}var d={high:a.high[e],low:a.low[e],close:a.close[e]},b=u[c];b.update(d);var g=NaN;try{g=b.getResult()}catch(t){}return t.pushToMain({index:e,key:c,value:Number.isNaN(g)?NaN:i?Pe(g,d.close):g}),!0},adx:function(t,e,r,n){var o=n.lag,i=n.retLogs,a=t.verticalOhlcv,u=t.instances,l=(t.useFullNames,i?"ret_log_adx_".concat(r):"adx_".concat(r)),c="adx_".concat(r);if(0===e){var s=t.len;if(!a.hasOwnProperty("high"))throw new Error("Property high not found in verticalOhlcv for adx.");if(!a.hasOwnProperty("low"))throw new Error("Property low not found in verticalOhlcv for adx.");if(!a.hasOwnProperty("close"))throw new Error("Property close not found in verticalOhlcv for adx.");Object.assign(u,xr({},c,new Ht(r))),Object.assign(a,xr({},l,new Float64Array(s).fill(NaN))),o>0&&t.lag([l],o)}var f=a.high[e],p=a.low[e],y=a.close[e],h=NaN;u[c].update({high:f,low:p,close:y});try{h=u[c].getResult(),u[c].get}catch(t){h=NaN}var v=Number.isNaN(h)?NaN:i?Pe(h,20):h;t.pushToMain({index:e,key:l,value:v})},ema:Te,sma:Te,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")},S=0,O=[g,w.upper,w.lower,w.liquidity];S<O.length;S++){var j=O[S];l.add(j)}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(w).forEach((function(t){i[t]=new Float64Array(u).fill(NaN)})),s>0&&t.lag(Object.values(w),s)}var P=a.vidya.settings[d],_="vidya_".concat(d),N={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],k=i.high[e],E=i.low[e],T=i.close[e],x=i.open[e],M=i.volume[e],I=e>0?i[N.cross][e-1]:0,D=P.liquidity.high.length===m?Math.max.apply(Math,Fe(P.liquidity.high)):NaN,R=P.liquidity.low.length===m?Math.min.apply(Math,Fe(P.liquidity.low)):NaN;if(e>0){var C=i.close[e-1],F=Math.max(k-E,Math.abs(k-C),Math.abs(E-C));P.atrBuffer.push(F),P.atrBuffer.length>p&&P.atrBuffer.shift()}var B=P.atrBuffer.length===p?P.atrBuffer.reduce((function(t,e){return t+e}),0)/p:NaN,L=NaN,U=NaN;if(e>0&&(U=A-i[c][e-1]),P.momentumBuffer.push(U),P.momentumBuffer.length>n&&P.momentumBuffer.shift(),P.momentumBuffer.length===n){var V=0,H=0;P.momentumBuffer.forEach((function(t){return t>=0?V+=t:H+=-t}));var q=V+H,$=2/(r+1)*((0===q?0:100*Math.abs((V-H)/q))/100);L=isNaN(P.prevVidya)?A:$*A+(1-$)*P.prevVidya,P.prevVidya=L}P.sma.update(L);var K=NaN;try{K=P.sma.getResult()}catch(t){}var z=isNaN(B)||isNaN(K)?NaN:K+B*h,G=isNaN(B)||isNaN(K)?NaN:K-B*h,Y=e>0?i[c][e-1]:NaN,J=e>0?i[N.upper][e-1]:NaN,Q=e>0?i[N.lower][e-1]:NaN,W=e>0&&Y<=J&&A>z,X=e>0&&Y>=Q&&A<G;W&&(P.isTrendUp=!0),X&&(P.isTrendUp=!1);var tt=0;e>0&&(tt=P.isTrendUp?I>0?I+1:1:I<0?I-1:-1),W||X?P.upVol=P.downVol=0:(P.upVol+=T>x?M:0,P.downVol+=T<x?M:0);var et=(P.upVol+P.downVol)/2||1,rt=(P.upVol-P.downVol)/et,nt=P.isTrendUp?G:z,ot=NaN;return tt>0?ot=R:tt<0&&(ot=D),t.pushToMain({index:e,key:N.vidya,value:nt}),t.pushToMain({index:e,key:N.upper,value:z}),t.pushToMain({index:e,key:N.lower,value:G}),t.pushToMain({index:e,key:N.delta_vol,value:rt}),t.pushToMain({index:e,key:N.cross,value:tt}),t.pushToMain({index:e,key:N.liquidity,value:ot}),P.liquidity.high.push(k),P.liquidity.low.push(E),P.liquidity.high.length>m&&P.liquidity.high.shift(),P.liquidity.low.length>m&&P.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=t.useFullNames,y=l.instanceKey;if(0===e){var h=t.inputParams,v=t.len;if(!c.hasOwnProperty(a))throw new Error("Target property ".concat(a," not found in verticalOhlcv for macd."));var m,d=0,b=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 Ve(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)?Ve(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}}}}(h);try{for(b.s();!(m=b.n()).done;)"macd"===m.value.key&&d++}catch(t){b.e(t)}finally{b.f()}var g=d>1||p,w="".concat(r,"_").concat(n,"_").concat(o),S=function(t){return a===He?g?"macd_".concat(t,"_").concat(w):"macd_".concat(t):g?"macd_".concat(t,"_").concat(a,"_").concat(w):"macd_".concat(t,"_").concat(a)},O=S("diff"),j=S("dea"),P=S("histogram");s.hasOwnProperty("macd")||(s.macd={numberOfIndicators:d,settings:{}}),s.macd.settings[y]=new ue(new re(r),new re(n),new re(o)),Object.assign(c,Ue(Ue(Ue({},O,new Float64Array(v).fill(NaN)),j,new Float64Array(v).fill(NaN)),P,new Float64Array(v).fill(NaN)));for(var _=[O,j,P],N=0,A=_;N<A.length;N++){var k=A[N];f.add(k)}u>0&&t.lag(_,u)}var E=s.macd,T=E.numberOfIndicators,x=E.settings,M=T>1||p,I="".concat(r,"_").concat(n,"_").concat(o),D=function(t){return a===He?M?"macd_".concat(t,"_").concat(I):"macd_".concat(t):M?"macd_".concat(t,"_").concat(a,"_").concat(I):"macd_".concat(t,"_").concat(a)},R=D("diff"),C=D("dea"),F=D("histogram"),B=x[y],L=c[a][e];B.update(L);var U={};try{U=B.getResult()}catch(t){}return t.pushToMain({index:e,key:R,value:U?U.macd:NaN}),t.pushToMain({index:e,key:C,value:U?U.signal:NaN}),t.pushToMain({index:e,key:F,value:U?U.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,S=Number.isNaN(b)?NaN:Math.max(b,0),O=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:S}),t.pushToMain({index:e,key:"".concat(l,"_low"),value:O}),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 Z(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.priceBased,s=t.useFullNames,f=o.lag,p=void 0===f?0:f,y="".concat(r,"_").concat(n);if(0===e){var h,v=l.filter((function(t){return"donchianChannels"===t.key})).length,m=v>1||s,d=["upper","basis","lower"].map((function(t){return m?"donchian_channel_".concat(t,"_").concat(y):"donchian_channel_".concat(t)})),b=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 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&&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}}}}(d);try{for(b.s();!(h=b.n()).done;){var g=h.value;c.add(g)}}catch(t){b.e(t)}finally{b.f()}a.donchian_channel||(a.donchian_channel={numberOfIndicators:v,settings:{}}),a.donchian_channel.numberOfIndicators=v,a.donchian_channel.settings[y]={maxDeque:[],minDeque:[]},Object.assign(i,Object.fromEntries(d.map((function(t){return[t,new Float64Array(u).fill(NaN)]})))),p>0&&t.lag(d,p)}var w=a.donchian_channel,S=w.numberOfIndicators,O=w.settings,j=S>1||s,P=function(t){return j?"donchian_channel_".concat(t,"_").concat(y):"donchian_channel_".concat(t)},_=O[y],N=_.maxDeque,A=_.minDeque,k=e-n,E=k-r+1,T=["upper","basis","lower"].map(P);if(E<0||k+1>u)return T.forEach((function(r){return t.pushToMain({index:e,key:r,value:NaN})})),!0;var x=i.high,M=i.low,I=function(t,e,r){for(;t.length&&t[0]<E;)t.shift();for(;t.length&&r(e[t.at(-1)],e[k]);)t.pop();t.push(k)};I(N,x,(function(t,e){return t<=e})),I(A,M,(function(t,e){return t>=e}));var D=N.length&&A.length,R=D?x[N[0]]:NaN,C=D?M[A[0]]:NaN,F=D?(R+C)/2:NaN;return t.pushToMain({index:e,key:P("upper"),value:R}),t.pushToMain({index:e,key:P("basis"),value:F}),t.pushToMain({index:e,key:P("lower"),value:C}),!0},bollingerBands:function(t,e,r,n){var o,i,a,u,l,c,s=(arguments.length>4&&void 0!==arguments[4]?arguments[4]:{}).lag,f=t.verticalOhlcv,p=t.instances,y=t.useFullNames,h="".concat(r,"_").concat(n),v="bollinger_bands",m="close";if(0===e){var d=t.inputParams,b=t.verticalOhlcv,g=t.len,w=t.priceBased;if(!(m in b))throw new Error('bollingerBands could not find target "'.concat(m,'"'));var S,O=0,j=Ge(d);try{for(j.s();!(S=j.n()).done;)"bollingerBands"===S.value.key&&O++}catch(t){j.e(t)}finally{j.f()}p.bollinger_bands||(p.bollinger_bands={numberOfIndicators:O,settings:{}}),p.bollinger_bands.settings[h]=new Gt(r,n);var P=O>1||y?"_".concat(h):"",_=["".concat(v,"_upper").concat(P),"".concat(v,"_middle").concat(P),"".concat(v,"_lower").concat(P)];if(w.has(m)){var N,A=Ge(_);try{for(A.s();!(N=A.n()).done;){var k=N.value;w.add(k)}}catch(t){A.e(t)}finally{A.f()}}var E=Object.fromEntries(_.map((function(t){return[t,new Float64Array(g).fill(NaN)]})));Object.assign(b,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ke(Object(r),!0).forEach((function(e){ze(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ke(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},E)),s>0&&t.lag(_,s)}var T=p.bollinger_bands.numberOfIndicators>1||y?"_".concat(h):"",x=p.bollinger_bands.settings[h],M=f[m][e];x.update(M);var I={};try{I=x.getResult()}catch(t){}var D=null!==(o=null===(i=I)||void 0===i?void 0:i.upper)&&void 0!==o?o:NaN,R=null!==(a=null===(u=I)||void 0===u?void 0:u.middle)&&void 0!==a?a:NaN,C=null!==(l=null===(c=I)||void 0===c?void 0:c.lower)&&void 0!==l?l:NaN;return t.pushToMain({index:e,key:"".concat(v,"_upper").concat(T),value:D}),t.pushToMain({index:e,key:"".concat(v,"_middle").concat(T),value:R}),t.pushToMain({index:e,key:"".concat(v,"_lower").concat(T),value:C}),!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 re(r),slowEMA:new re(n)},(a=function(t){var e=function(t,e){if("object"!=Je(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Je(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=Mr(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)||Mr(h,v)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),w=g[0],S=g[1];t.pushToMain({index:e,key:w,value:S})}},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 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}}(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)),S=w?Xe(g,p):d,O=d>=-125&&d<=125&&!1===w?"Int8Array":"Float64Array";u[g]=fr(O,s,S)}c.hasOwnProperty("crossPairs")||(c.crossPairs={}),c.crossPairs[b]={run:new Or,min:1/0,max:-1/0};var j=null!==a&&a<=125?"Int8Array":"Float64Array";u[b]=fr(j,s,0),i&&(u["one_hot_".concat(b)]=fr("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 P=c.crossPairs[b].run;if("price"===m){var _=u.close[e],N=u[d][e];P.update(e,{fast:_,slow:N,high:u.high[e],low:u.low[e]})}else{var A=u[m][e],k=u[d][e];P.update(e,{fast:A,slow:k})}var E=P.getResult(),T=null!==a?Math.min(Math.max(E,-a),a):E;if(t.pushToMain({index:e,key:b,value:T}),i){var x=T+a,M=2*a+1;t.pushToMain({index:e,key:"one_hot_".concat(b),value:vr(x,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=yr(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=pr(c,o[c]);o[p]=fr(y,i)}}}catch(t){l.e(t)}finally{l.f()}}var h,v=yr(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,S=w<0||void 0===d[w]?null:d[w];t.pushToMain({index:e,key:g,value:S})}}catch(t){v.e(t)}finally{v.f()}return!0}};function zr(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}var Yr=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,S=Array.from({length:w},(function(){return{}})),O={},j=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=zr(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 P=v.value;y&&p.has(P)?O[P]=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)}:O[P]=function(t){return t}}}catch(t){j.e(t)}finally{j.f()}for(var _=0,N=Object.entries(u);_<N.length;_++){var A=(m=N[_],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)||zr(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.")}()),k=A[0],E=A[1];if(!f.has(k))for(var T=g;T<c;T++)S[T-g][k]="date"===k?or[a](E[T]):O[k](E[T],h)}return S};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 Zr(t,e,r){return(e=tn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qr(t,e){if(t){if("string"==typeof t)return Wr(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)?Wr(t,e):void 0}}function Wr(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 Xr(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,tn(n.key),n)}}function tn(t){var e=function(t,e){if("object"!=Jr(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.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(e)?e:e+""}var en=function(){return t=function t(e){var r=this,n=e.input,o=e.ticker,a=void 0===o?null:o,l=e.inputParams,c=void 0===l?null:l,p=e.chunkProcess,y=void 0===p?2e3:p,h=e.precision,v=void 0!==h&&h,m=e.useFullNames,d=void 0!==m&&m;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),u(n,"input",null!==a?"contructor ".concat(a):"constuctor"),0===n.length)throw Error("input OHLCV must not be empty: "+a);f(y,{min:100,max:5e4,allowDecimals:!1},"chunkProcess","constructor"),s(v,"precision","contructor"),s(v,"useFullNames","contructor"),this.chunkProcess=y,this.input=function(t){return function(t){if(Array.isArray(t))return Wr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Qr(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,this.useFullNames=d;var b=["open","high","low","close","mid_price"];this.initialPriceBased=new Set(b),this.priceBased=new Set(b),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=Qe(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(Ze(c),"."));var s=Qe(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 g=function(t){for(var e=t.firstRow,r=t.precision,n=t.initialPriceBased,o={},i={},a=new Map,u=0,l=Object.entries(e);u<l.length;u++){var c=lr(l[u],2),s=c[0],f=c[1];if("date"===s)o[s]=ar(f),i[s]="Array";else if("volume"===s)o[s]=rr(f,!0),i[s]="Int32Array";else if(n.has(s))o[s]=rr(f,!0,r),i[s]="Float64Array",a.set(s,o[s]);else{var p=rr(f,!1,r);o[s]=p,i[s]="number"===p?"Float64Array":"Array"}}if(new Set(a.values()).size>1){var y=function(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)||cr(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.")}()}(a.entries()).map((function(t){var e=lr(t,2),r=e[0],n=e[1];return"".concat(r,': "').concat(n,'"')})).join(", ");throw new Error("Inconsistent types among price-based columns — ".concat(y,". ")+"All initialPriceBased columns must share the same numeric type.")}return i.hasOwnProperty("open")&&i.hasOwnProperty("close")&&(i.mid_price=i.open,o.mid_price=o.open),{inputTypes:o,arrayTypes:i}}(this),w=g.inputTypes,S=g.arrayTypes;if(this.inputTypes=w,this.arrayTypes=S,!this.firstRow.hasOwnProperty("close"))throw Error('input OHLCV array objects require at least "close" property: '.concat(a));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?(i(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?"milliseconds":n;return c(Object.keys(or),o,"dateFormat","getData"),l(t,"options","getData"),Yr({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?"milliseconds":e;return c(Object.keys(or),r,"dateFormat","getData"),Yr({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,a=e.verticalOhlcv,u=e.verticalOhlcvKeyNames,l=e.inputTypes,c=e.chunkProcess,s=e.precisionMultiplier,f=e.inputParams;i(f,n);for(var p=0,y=Object.keys(l);p<y.length;p++){var h=y[p];a[h]=fr(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 S=Hr(w[g],2),O=S[0],j=S[1],P=b[O];if(void 0!==P)if(er.hasOwnProperty(j)){var _=er[j](P,s);e.pushToMain({index:d,key:O,value:_})}else ir.hasOwnProperty(j)?e.pushToMain({index:d,key:O,value:ir[j](P)}):e.pushToMain({index:d,key:O,value:P})}var N=(a.open[d]+a.close[d])/2;e.pushToMain({index:d,key:"mid_price",value:N});var A,k=Vr(f);try{for(k.s();!(A=k.n()).done;){var E=A.value,T=E.key,x=E.params;Kr[T].apply(Kr,[e,d].concat(Ur(x)))}}catch(t){k.e(t)}finally{k.f()}t[d]=null;var M=Object.keys(a);r(e,d,M)||(e.invalidValueIndex=d)}u.push.apply(u,Ur(Object.keys(a)))}(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";a(this),u(t,"arr",r),l(e,"options",r);var n=e.limit,o=void 0===n?null:n,i=e.oneHot,c=void 0!==i&&i;null!==o&&f(o,{min:2,max:this.len},"options.limit",r),s(c,"options.oneHot",r);var p,y=[],h=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Qr(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();!(p=h.n()).done;){var v=p.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:c}]}),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 a(this),u(t,"colKeys",r),f(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.');a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),l(e,"options",r);var n=e.lag,o=void 0===n?0:n;return f(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.');a(this),l(t,"options",e);var r=t.lag,n=void 0===r?0:r;return f(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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),l(e,"options",r);var n=e.lag,o=void 0===n?0:n,i=e.retLogs,u=void 0!==i&&i;return f(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),s(u,"options.retLogs",r),this.inputParams.push({key:r,order:0,params:[t,{lag:o,retLogs:u}]}),this}},{key:"adx",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="adx";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),l(e,"options",r);var n=e.lag,o=void 0===n?0:n,i=e.retLogs,u=void 0!==i&&i;return f(o,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),s(u,"options.retLogs",r),this.inputParams.push({key:r,order:0,params:[t,{lag:o,retLogs:u}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),l(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,u=void 0===i?0:i;return p(o,"options.target",r),f(u,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[r,t,{target:o,lag:u}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),l(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,u=void 0===i?0:i;return p(o,"options.target",r),f(u,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),this.inputParams.push({key:r,params:[r,t,{target:o,lag:u}]}),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";a(this);var o=null===t&&null===e;!1===o&&(f(t,{min:1,max:this.len,allowDecimals:!1},"smoothLength",n),f(e,{min:1,max:this.len,allowDecimals:!1},"afterSmoothLength",n)),l(r,"options",n);var i=r.lag,u=void 0===i?0:i,c=r.retLogs,p=void 0!==c&&c;return f(u,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),s(p,"option.retLogs",n),this.inputParams.push({key:n,order:0,params:[t,e,{lag:u,bothNull:o,retLogs:p}]}),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";a(this),f(t,{min:2,max:this.len,allowDecimals:!1},"size",n),f(e,{min:1,max:this.len,allowDecimals:!1},"momentum",n),l(r,"options",n);var o=r.target,i=void 0===o?"close":o,u=r.lag,c=void 0===u?0:u,s=r.atrLength,y=void 0===s?200:s,h=r.bandDistance,v=void 0===h?2:h,m=r.liquidityLookback,d=void 0===m?20:m;return p(i,"options.target",n),f(c,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),f(v,{min:.01,max:10,allowDecimals:!0},"options.bandDistance",n),f(y,{min:2,max:this.len,allowDecimals:!1},"options.atrLength",n),f(d,{min:1,max:this.len,allowDecimals:!1},"options.liquidityLookback",n),this.inputParams.push({key:n,params:[t,e,{target:i,lag:c}]}),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;f(t,{min:1,max:i,allowDecimals:!1},"kPeriod",o),f(e,{min:1,max:i,allowDecimals:!1},"kSlowingPeriod",o),f(r,{min:1,max:i,allowDecimals:!1},"dPeriod",o),l(n,"options",o);var a=n.lag,u=void 0===a?0:a,c=n.retLogs;return f(u,{min:0,max:i,allowDecimals:!1},"options.lag",o),s(c,"retLogs",o),this.inputParams.push({key:o,params:[t,e,r,{lag:u,retLogs:c}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"fast",o),f(e,{min:1,max:this.len,allowDecimals:!1},"slow",o),f(r,{min:1,max:this.len,allowDecimals:!1},"signal",o),l(n,"options",o);var i=n.target,u=void 0===i?"close":i,c=n.lag,s=void 0===c?0:c;p(u,"options.target",o),f(s,{min:0,max:this.len,allowDecimals:!1},"options.lag",o);var y={instanceKey:"".concat(t,"_").concat(e,"_").concat(r).concat("close"===u?"":"_".concat(u))};return this.inputParams.push({key:o,params:[t,e,r,{target:u,lag:s,precomputed:y}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",n),f(e,{min:.01,max:50,allowDecimals:!0},"stdDev",n),l(r,"options",n);var o=r.lag,i=void 0===o?0:o;return f(i,{min:0,max:this.len,allowDecimals:!1},"options.lag",n),this.inputParams.push({key:n,params:[t,e,{lag:i}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",r),l(e,"options",r);var n=e.target,o=void 0===n?"close":n,i=e.lag,u=void 0===i?0:i,c=e.retLogs,y=void 0!==c&&c;return p(o,"options.target",r),f(u,{min:0,max:this.len,allowDecimals:!1},"options.lag",r),s(y,"retLogs",r),this.inputParams.push({key:r,params:[t,{target:o,lag:u,retLogs:y}]}),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";a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"size",n),f(e,{min:0,max:this.len,allowDecimals:!1},"offset",n),l(r,"options",n);var o=r.lag,i=void 0===o?0:o;return f(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:"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.');a(this),f(t,{min:1,max:this.len,allowDecimals:!1},"fastsize",n),f(e,{min:t,max:this.len,allowDecimals:!1},"slowsize",n),l(r,"options",n);var o=r.lag,i=void 0===o?0:o;return f(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";a(this),l(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.oneHot,i=void 0!==o&&o;f(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),s(i,"options.oneHot",e);var u=i?"one_hot_":"",c=Zr(Zr(Zr(Zr(Zr({},"".concat(u,"month"),12),"".concat(u,"day_of_the_month"),31),"".concat(u,"day_of_the_week"),7),"".concat(u,"hour"),24),"".concat(u,"minute"),60),p={prefix:u,colKeySizes:c,colKeys:Object.keys(c)};return this.inputParams.push({key:e,order:0,params:[{lag:n,oneHot:i,precompute:p}]}),this}},{key:"candleFeatures",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="candleFeatures";a(this),l(t,"options",e);var r=t.lag,n=void 0===r?0:r,o=t.colKeys,i=void 0===o?[]:o,c=t.retLogs,p=void 0!==c&&c;return f(n,{min:0,max:this.len,allowDecimals:!1},"options.lag",e),u(i,"options.colKeys",e),s(p,"retLogs",e),this.inputParams.push({key:e,params:[{lag:n,colKeys:i,retLogs:p}]}),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]:{};a(this);var n="mapCols";null==e&&(e=Dr),l(r,"options",n);var o=r.lag,i=void 0===o?0:o,c=r.isPriceBased,p=void 0!==c&&c;if(u(t,"newCols",n),f(i,{min:0,allowDecimals:!1},"options.lag",n),s(p,"isPriceBased","mapCols"),!1===this.precision&&p)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:p}]}),this}}],e&&Xr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()})(),OHLCV_INDICATORS=e})();
package/index.js CHANGED
@@ -6,7 +6,6 @@ import {
6
6
  validateArrayOptions,
7
7
  validateBoolean,
8
8
  validateNumber,
9
- validateArrayOfRanges,
10
9
  validateInputParams,
11
10
  validateString
12
11
  } from './src/utilities/validators.js'
@@ -534,8 +533,8 @@ export default class OHLCV_INDICATORS {
534
533
  return this
535
534
  }
536
535
 
537
- priceFeatures(options = {}) {
538
- let methodName = 'priceFeatures'
536
+ candleFeatures(options = {}) {
537
+ let methodName = 'candleFeatures'
539
538
 
540
539
  isAlreadyComputed(this)
541
540
 
@@ -553,74 +552,6 @@ export default class OHLCV_INDICATORS {
553
552
  return this
554
553
  }
555
554
 
556
- scaler(type = 'zscore', size, options = {})
557
- {
558
- let methodName = 'scaler'
559
-
560
- isAlreadyComputed(this)
561
-
562
- validateArrayOptions(['minmax', 'zscore', 'byfeature'], type, 'options.type', methodName)
563
- validateNumber(size, {min: 1, max: this.len, allowDecimals: false}, 'size', methodName)
564
-
565
- const longName = `${methodName}(${type}, ${size}, options = {})`
566
-
567
- validateObject(options, 'options', longName)
568
-
569
- const {minMaxRange = null, lag = false, colKeys = [], weights = {}, euclideanWeights = false, byFeatureRange = null, offset = 0} = options
570
-
571
- validateNumber(offset, {min: 0, max: this.len, allowDecimals: false}, 'offset', methodName)
572
-
573
-
574
- validateArray(colKeys, 'options.colKeys', longName)
575
- validateBoolean(lag, 'options.lag', longName)
576
-
577
-
578
- validateObject(weights, 'options.weights', longName)
579
-
580
- const lookback = lag ? size - 1 : 0
581
-
582
- if(colKeys.length === 0) {
583
- throw new Error(`The property "options.colKeys" must be an array with target keys in ${longName}.`)
584
- }
585
-
586
-
587
-
588
- for(const [key, arr] of Object.entries(weights)) {
589
- validateArray(arr, `options.weights.${key}`)
590
-
591
- if(!lag && arr.size > 0) {
592
- throw new Error(`If "options.lag" is set to false "options.weights.${key}" can only contain 1 item (float) in ${longName}.`)
593
- }
594
-
595
- if(arr.length > size) {
596
- throw new Error(`The length of the property "options.weights.${key}" can not be longer than "size" in ${longName}.`)
597
- }
598
-
599
- for(let x = 0; x < arr.length; x++) {
600
- const val = arr[x]
601
- validateNumber(val, {min: 0.01, max: 10, allowDecimals: true}, `options.weights.${key}[${x}]`, longName)
602
- }
603
-
604
- }
605
-
606
- if (type !== 'byfeature') {
607
-
608
- if(!byFeatureRange == null) {
609
- throw new Error('"options.byFeatureRange" is only valid when "type" is "byfeature".')
610
- }
611
- }
612
- else {
613
- validateArrayOfRanges(byFeatureRange, 'options.byFeatureRange', longName)
614
- }
615
-
616
- if(['minmax', 'byfeature'].includes(type)) {
617
- validateArrayOfRanges(minMaxRange, 'options.minMaxRange', longName)
618
- }
619
-
620
- this.inputParams.push({key: methodName, params: [size, colKeys, {type, minMaxRange, lookback, weights, euclideanWeights, byFeatureRange, offset}]})
621
- return this
622
- }
623
-
624
555
  mapCols(newCols = ['change'], callback = null, options = {}) {
625
556
 
626
557
  isAlreadyComputed(this)
@@ -648,4 +579,4 @@ export default class OHLCV_INDICATORS {
648
579
 
649
580
  return this
650
581
  }
651
- }
582
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohlcv-indicators",
3
- "version": "3.5.77",
3
+ "version": "3.5.78",
4
4
  "description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}]. This library is optimized for backtesting and trading bot development.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -14,7 +14,6 @@ import { volumeDelta } from "../oscillators/volumeDelta.js";
14
14
  import { lag } from "../studies/lag.js";
15
15
  import { crossPairs } from "../studies/findCrosses.js";
16
16
  import { dateTime } from "../studies/dateTime.js";
17
- import { scaler } from "../machine-learning/scaler.js";
18
17
  import { atr } from "../volatility/atr.js";
19
18
  import { adx } from "../volatility/adx.js";
20
19
  import { mapCols } from "../studies/mapCols.js";
@@ -22,12 +21,12 @@ import { mapCols } from "../studies/mapCols.js";
22
21
  import { buildArray } from "../utilities/assignTypes.js";
23
22
  import { inputNumberFormatter } from "../utilities/numberUtilities.js";
24
23
  import { dateFormaters } from "../utilities/dateUtilities.js";
25
- import { priceFeatures } from "../studies/priceFeatures.js";
24
+ import { candleFeatures } from "../studies/candleFeatures.js";
26
25
 
27
26
 
28
27
  // Map indicator keys to their respective functions
29
28
  const mainFunctions = {
30
- priceFeatures,
29
+ candleFeatures,
31
30
  dateTime,
32
31
  heikenAshi,
33
32
  rsi,
@@ -44,7 +43,6 @@ const mainFunctions = {
44
43
  bollingerBands,
45
44
  volumeOscillator,
46
45
  mapCols,
47
- scaler,
48
46
  crossPairs,
49
47
  lag
50
48
  };
@@ -3,12 +3,3 @@ export const oneHotEncode = (idx, size) => {
3
3
  vec[idx] = 1
4
4
  return vec
5
5
  }
6
-
7
- export const normalizeMinMax = (value, min, max, [validMin, validMax]) => {
8
- const clamped = Math.min(Math.max(value, min), max)
9
- return ((clamped - min) / (max - min)) * (validMax - validMin) + validMin
10
- }
11
-
12
- export const normalizeZScore = (value, mean, std) => {
13
- return std === 0 ? 0 : (value - mean) / std
14
- }
@@ -2,7 +2,7 @@
2
2
 
3
3
  const isBadNumber = (v) => v == null || !Number.isFinite(v)
4
4
 
5
- export const priceFeatures = (main, index, {lag, colKeys, retLogs}) => {
5
+ export const candleFeatures = (main, index, {lag, colKeys, retLogs}) => {
6
6
  const { verticalOhlcv, priceBased, scaledGroups } = main
7
7
 
8
8
  const getRet = (next, prev) => (retLogs) ? Math.log(next / prev) : (next - prev) / prev
@@ -24,13 +24,13 @@ export const priceFeatures = (main, index, {lag, colKeys, retLogs}) => {
24
24
  for(const target of colKeys) {
25
25
  if(!verticalOhlcv.hasOwnProperty(target)) {
26
26
  throw new Error(
27
- `Target property in "options.colKey" array "${target}" not found in verticalOhlcv for "priceFeatures".`
27
+ `Target property in "options.colKey" array "${target}" not found in verticalOhlcv for "candleFeatures".`
28
28
  );
29
29
  }
30
30
 
31
31
  else if(!priceBased.has(target)) {
32
32
  throw new Error(
33
- `Target property in "options.colKey" array "${target}" not found in priceBased for "priceFeatures".`
33
+ `Target property in "options.colKey" array "${target}" not found in priceBased for "candleFeatures".`
34
34
  );
35
35
  }
36
36
 
@@ -39,7 +39,7 @@ export const priceFeatures = (main, index, {lag, colKeys, retLogs}) => {
39
39
 
40
40
  Object.assign(verticalOhlcv, newCols)
41
41
 
42
- scaledGroups.priceFeatures = Object.keys(newCols)
42
+ scaledGroups.candleFeatures = Object.keys(newCols)
43
43
 
44
44
  if(lag) {
45
45
  main.lag(Object.keys(newCols), lag)
@@ -111,32 +111,9 @@ export const validateNumber = (value, options, paramName, callerName) => {
111
111
  };
112
112
 
113
113
 
114
- export const validateArrayOfRanges = (range, paramName, callerName) => {
115
-
116
- validateArray(range, paramName, callerName)
117
-
118
- if (range.length !== 2) {
119
- throw new Error(
120
- `Invalid "${paramName}" array length: expected 2 items, but got ${range.length} in "${callerName}.${paramName}".`
121
- );
122
- }
123
-
124
- const [min, max] = range
125
-
126
- validateNumber(min, {min: -100, max, allowDecimals: false}, `${paramName}[0] (min)`, callerName)
127
- validateNumber(max, {min: min, max: 100, allowDecimals: false}, `${paramName}[1] (max)`, callerName)
128
-
129
- if(min === max)
130
- {
131
- throw new Error(`Invalid "min" can not be equal to "max" property in "${callerName}.${paramName}".`)
132
- }
133
-
134
- return true
135
- }
136
-
137
114
  export const validateString = (txt, paramName, callerName) => {
138
115
 
139
116
  if(typeof txt !== 'string' || !txt.length) throw new Error(`Invalid "${paramName}" property in "${callerName}". Only strings are accepted.`)
140
117
 
141
118
  return true
142
- }
119
+ }
@@ -1,165 +0,0 @@
1
- import { normalizeMinMax, normalizeZScore } from "./ml-utilities.js";
2
-
3
- const isBadNumber = (v) => v == null || !Number.isFinite(v)
4
-
5
- //rowWiseScaler
6
-
7
- export const scaler = (main, index, size, colKeys, {type, minMaxRange, lookback, weights, euclideanWeights, byFeatureRange, offset}) => {
8
-
9
- //this function performs scaling row by row "row wise scaling"
10
-
11
- const { verticalOhlcv, instances } = main
12
- const prefix = `${type}_${size}`
13
-
14
- if(index === 0) {
15
- const { len, isAlreadyComputed } = main
16
-
17
- if(isAlreadyComputed.has(prefix))
18
- {
19
- throw new Error(`In scaler method can not repeat params "size" and "options.type" together between indicators.`)
20
- }
21
-
22
- if(!instances.hasOwnProperty('scaler')) {
23
- instances.scaler = {}
24
- }
25
-
26
- if(!instances.scaler.hasOwnProperty(prefix))
27
- {
28
- instances.scaler[prefix] = {
29
- extectedFeatures: (lookback === 0) ? colKeys.length : colKeys.length + (lookback * colKeys.length)
30
- }
31
- }
32
-
33
- const features = []
34
-
35
- for (const target of colKeys) {
36
- if (!verticalOhlcv.hasOwnProperty(target)) {
37
- throw new Error(`Target property "${target}" not found in verticalOhlcv`);
38
- }
39
-
40
- const key = `${prefix}_${target}`;
41
- verticalOhlcv[key] = new Float64Array(len).fill(NaN)
42
-
43
- if (!main.scaledGroups[prefix]) main.scaledGroups[prefix] = [];
44
-
45
- main.scaledGroups[prefix].push(key);
46
-
47
- if (lookback > 0) {
48
- const laggedKeys = Array.from({ length: lookback }).map((_, i) => `${key}_lag_${i + 1}`)
49
-
50
- for(const lKey of laggedKeys) {
51
- verticalOhlcv[lKey] = new Float64Array(len).fill(NaN)
52
- }
53
-
54
- main.scaledGroups[prefix].push(...laggedKeys)
55
- features.push(key)
56
- }
57
- }
58
-
59
- for(const weKey of Object.keys(weights)) {
60
- if (!verticalOhlcv.hasOwnProperty(weKey)) {
61
- throw new Error(`Target property "${weKey}" not found in verticalOhlcv`);
62
- }
63
- }
64
-
65
- }
66
-
67
- const { extectedFeatures } = instances.scaler[prefix]
68
-
69
- let hasInvalidVal = false
70
- const row = {}
71
- const rowValues = []
72
- let countFeatures = 0
73
-
74
- const sourceIndex = index - offset
75
-
76
- if(sourceIndex < 0) return
77
-
78
-
79
-
80
- for (let x = 0; x < colKeys.length; x++) {
81
- const target = colKeys[x]
82
- const col = verticalOhlcv[target]
83
- const currWeight = weights?.[target]?.[0] ?? 1
84
- const currVal = col[sourceIndex]
85
-
86
- if(isBadNumber(currVal))
87
- {
88
- hasInvalidVal = true
89
- break
90
- }
91
-
92
- row[target] = {
93
- val: currVal,
94
- weight: (euclideanWeights) ? Math.sqrt(currWeight) : currWeight
95
- }
96
-
97
- rowValues.push(currVal)
98
- countFeatures++
99
-
100
- if(lookback > 0) {
101
- for (let step = 1; step <= lookback; step++) {
102
-
103
- const laggedWeight = weights?.[target]?.[step] ?? 1
104
- const laggedVal = col[sourceIndex - step]
105
-
106
- if(isBadNumber(laggedVal))
107
- {
108
- hasInvalidVal = true
109
- break
110
- }
111
-
112
- row[`${target}_lag_${step}`] = {
113
- val: laggedVal,
114
- weight: (euclideanWeights) ? Math.sqrt(laggedWeight) : laggedWeight
115
- }
116
-
117
- rowValues.push(laggedVal)
118
- countFeatures++
119
- }
120
-
121
- if(hasInvalidVal) break
122
- }
123
- }
124
-
125
- if(hasInvalidVal || countFeatures !== extectedFeatures) return
126
-
127
- if (type === "minmax") {
128
- const mn = Math.min(...rowValues);
129
- const mx = Math.max(...rowValues);
130
-
131
- for (const [key, { val, weight }] of Object.entries(row)) {
132
- const scaled = normalizeMinMax(val, mn, mx, minMaxRange)
133
- const weigthed = scaled === 0 ? 0 : scaled * weight
134
- main.pushToMain({ index, key: `${prefix}_${key}`, value: weigthed });
135
- }
136
- }
137
-
138
- if (type === "zscore") {
139
- const n = rowValues.length;
140
- const mean = rowValues.reduce((s, x) => s + x, 0) / n;
141
- const variance = rowValues.reduce((s, x) => s + (x - mean) ** 2, 0) / n;
142
- const std = Math.sqrt(variance);
143
-
144
- for (const [key, { val, weight }] of Object.entries(row)) {
145
- const scaled = normalizeZScore(val, mean, std)
146
- const weigthed = scaled === 0 ? 0 : scaled * weight
147
- main.pushToMain({ index, key: `${prefix}_${key}`, value: weigthed });
148
- }
149
- }
150
-
151
- if(type === "byfeature") {
152
-
153
- const [mn, mx] = byFeatureRange
154
-
155
- for (const [key, { val, weight }] of Object.entries(row)) {
156
-
157
- const scaled = normalizeMinMax(val, mn, mx, minMaxRange)
158
- const weigthed = scaled === 0 ? 0 : scaled * weight
159
-
160
- main.pushToMain({ index, key: `${prefix}_${key}`, value: weigthed });
161
- }
162
-
163
- }
164
- }
165
-