@ulachart/pro
Version:
Financial chart built out of the box based on Ula charts.
1,443 lines • 561 kB
JavaScript
var mo = Object.defineProperty;
var _o = (e, t, n) => t in e ? mo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var Kt = (e, t, n) => (_o(e, typeof t != "symbol" ? t + "" : t, n), n);
/**
* @license
* @ula/charts v0.0.2
* Copyright (c) 2025 Exi.
* Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
*/
var Kn = function(e, t) {
return Kn = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
n.__proto__ = r;
} || function(n, r) {
for (var a in r)
Object.prototype.hasOwnProperty.call(r, a) && (n[a] = r[a]);
}, Kn(e, t);
};
function H(e, t) {
if (typeof t != "function" && t !== null)
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
Kn(e, t);
function n() {
this.constructor = e;
}
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}
var z = function() {
return z = Object.assign || function(t) {
for (var n, r = 1, a = arguments.length; r < a; r++) {
n = arguments[r];
for (var i in n)
Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
}
return t;
}, z.apply(this, arguments);
};
function wt(e, t, n, r) {
function a(i) {
return i instanceof n ? i : new n(function(o) {
o(i);
});
}
return new (n || (n = Promise))(function(i, o) {
function s(u) {
try {
c(r.next(u));
} catch (h) {
o(h);
}
}
function l(u) {
try {
c(r.throw(u));
} catch (h) {
o(h);
}
}
function c(u) {
u.done ? i(u.value) : a(u.value).then(s, l);
}
c((r = r.apply(e, t || [])).next());
});
}
function kt(e, t) {
var n = { label: 0, sent: function() {
if (i[0] & 1)
throw i[1];
return i[1];
}, trys: [], ops: [] }, r, a, i, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
return o.next = s(0), o.throw = s(1), o.return = s(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() {
return this;
}), o;
function s(c) {
return function(u) {
return l([c, u]);
};
}
function l(c) {
if (r)
throw new TypeError("Generator is already executing.");
for (; o && (o = 0, c[0] && (n = 0)), n; )
try {
if (r = 1, a && (i = c[0] & 2 ? a.return : c[0] ? a.throw || ((i = a.return) && i.call(a), 0) : a.next) && !(i = i.call(a, c[1])).done)
return i;
switch (a = 0, i && (c = [c[0] & 2, i.value]), c[0]) {
case 0:
case 1:
i = c;
break;
case 4:
return n.label++, { value: c[1], done: !1 };
case 5:
n.label++, a = c[1], c = [0];
continue;
case 7:
c = n.ops.pop(), n.trys.pop();
continue;
default:
if (i = n.trys, !(i = i.length > 0 && i[i.length - 1]) && (c[0] === 6 || c[0] === 2)) {
n = 0;
continue;
}
if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
n.label = c[1];
break;
}
if (c[0] === 6 && n.label < i[1]) {
n.label = i[1], i = c;
break;
}
if (i && n.label < i[2]) {
n.label = i[2], n.ops.push(c);
break;
}
i[2] && n.ops.pop(), n.trys.pop();
continue;
}
c = t.call(e, n);
} catch (u) {
c = [6, u], a = 0;
} finally {
r = i = 0;
}
if (c[0] & 5)
throw c[1];
return { value: c[0] ? c[1] : void 0, done: !0 };
}
}
function yt(e) {
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
if (n)
return n.call(e);
if (e && typeof e.length == "number")
return {
next: function() {
return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e };
}
};
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function We(e, t) {
var n = typeof Symbol == "function" && e[Symbol.iterator];
if (!n)
return e;
var r = n.call(e), a, i = [], o;
try {
for (; (t === void 0 || t-- > 0) && !(a = r.next()).done; )
i.push(a.value);
} catch (s) {
o = { error: s };
} finally {
try {
a && !a.done && (n = r.return) && n.call(r);
} finally {
if (o)
throw o.error;
}
}
return i;
}
function en(e, t, n) {
if (n || arguments.length === 2)
for (var r = 0, a = t.length, i; r < a; r++)
(i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
return e.concat(i || Array.prototype.slice.call(t));
}
var ne;
(function(e) {
e.Dashed = "dashed", e.Solid = "solid";
})(ne || (ne = {}));
var q;
(function(e) {
e.Stroke = "stroke", e.Fill = "fill", e.StrokeFill = "stroke_fill";
})(q || (q = {}));
var Lt;
(function(e) {
e.Always = "always", e.FollowCross = "follow_cross", e.None = "none";
})(Lt || (Lt = {}));
var je;
(function(e) {
e.Standard = "standard", e.Rect = "rect";
})(je || (je = {}));
var Je;
(function(e) {
e.Left = "left", e.Middle = "middle", e.Right = "right";
})(Je || (Je = {}));
var hn;
(function(e) {
e.Fixed = "fixed", e.Pointer = "pointer";
})(hn || (hn = {}));
var Fe;
(function(e) {
e.CandleSolid = "candle_solid", e.CandleStroke = "candle_stroke", e.CandleUpStroke = "candle_up_stroke", e.CandleDownStroke = "candle_down_stroke", e.Ohlc = "ohlc", e.Area = "area";
})(Fe || (Fe = {}));
var ut;
(function(e) {
e.Left = "left", e.Right = "right";
})(ut || (ut = {}));
var xe;
(function(e) {
e.Normal = "normal", e.Percentage = "percentage", e.Log = "log";
})(xe || (xe = {}));
var rn = "#F92855", Fn = "rgba(249, 40, 85, .7)", an = "#2DC08E", Rn = "rgba(45, 192, 142, .7)", pt = "#888888", $n = "#FFFFFF", Me = "#1677FF", mt = "#76808F", Xn = "#DDDDDD";
function Mt(e) {
return "rgba(22, 119, 255, ".concat(e, ")");
}
function yo() {
function e() {
return {
show: !0,
size: 1,
color: "#EDEDED",
style: ne.Dashed,
dashedValue: [2, 2]
};
}
return {
show: !0,
horizontal: e(),
vertical: e()
};
}
function Co() {
var e = {
show: !0,
color: mt,
textOffset: 5,
textSize: 10,
textFamily: "Helvetica Neue",
textWeight: "normal"
};
return {
type: Fe.CandleSolid,
bar: {
upColor: an,
downColor: rn,
noChangeColor: pt,
upBorderColor: an,
downBorderColor: rn,
noChangeBorderColor: pt,
upWickColor: an,
downWickColor: rn,
noChangeWickColor: pt
},
area: {
lineSize: 2,
lineColor: Me,
smooth: !1,
value: "close",
backgroundColor: [{
offset: 0,
color: Mt(0.01)
}, {
offset: 1,
color: Mt(0.2)
}],
point: {
show: !0,
color: Me,
radius: 4,
rippleColor: Mt(0.3),
rippleRadius: 8,
animation: !0,
animationDuration: 1e3
}
},
priceMark: {
show: !0,
high: z({}, e),
low: z({}, e),
last: {
show: !0,
upColor: an,
downColor: rn,
noChangeColor: pt,
line: {
show: !0,
style: ne.Dashed,
dashedValue: [4, 4],
size: 1
},
text: {
show: !0,
style: q.Fill,
size: 12,
paddingLeft: 4,
paddingTop: 4,
paddingRight: 4,
paddingBottom: 4,
borderColor: "transparent",
borderStyle: ne.Solid,
borderSize: 0,
borderDashedValue: [2, 2],
color: $n,
family: "Helvetica Neue",
weight: "normal",
borderRadius: 2
}
}
},
tooltip: {
offsetLeft: 4,
offsetTop: 6,
offsetRight: 4,
offsetBottom: 6,
showRule: Lt.Always,
showType: je.Standard,
custom: [
{ title: "time", value: "{time}" },
{ title: "open", value: "{open}" },
{ title: "high", value: "{high}" },
{ title: "low", value: "{low}" },
{ title: "close", value: "{close}" },
{ title: "volume", value: "{volume}" }
],
defaultValue: "n/a",
rect: {
position: hn.Fixed,
paddingLeft: 4,
paddingRight: 4,
paddingTop: 4,
paddingBottom: 4,
offsetLeft: 4,
offsetTop: 4,
offsetRight: 4,
offsetBottom: 4,
borderRadius: 4,
borderSize: 1,
borderColor: "#F2F3F5",
color: "#FEFEFE"
},
text: {
size: 12,
family: "Helvetica Neue",
weight: "normal",
color: mt,
marginLeft: 8,
marginTop: 4,
marginRight: 8,
marginBottom: 4
},
icons: []
}
};
}
function bo() {
var e = ["#FF9600", "#935EBD", Me, "#E11D74", "#01C5C4"].map(function(t) {
return {
style: ne.Solid,
smooth: !1,
size: 1,
dashedValue: [2, 2],
color: t
};
});
return {
ohlc: {
upColor: Rn,
downColor: Fn,
noChangeColor: pt
},
bars: [{
style: q.Fill,
borderStyle: ne.Solid,
borderSize: 1,
borderDashedValue: [2, 2],
upColor: Rn,
downColor: Fn,
noChangeColor: pt
}],
lines: e,
circles: [{
style: q.Fill,
borderStyle: ne.Solid,
borderSize: 1,
borderDashedValue: [2, 2],
upColor: Rn,
downColor: Fn,
noChangeColor: pt
}],
lastValueMark: {
show: !1,
text: {
show: !1,
style: q.Fill,
color: $n,
size: 12,
family: "Helvetica Neue",
weight: "normal",
borderStyle: ne.Solid,
borderColor: "transparent",
borderSize: 0,
borderDashedValue: [2, 2],
paddingLeft: 4,
paddingTop: 4,
paddingRight: 4,
paddingBottom: 4,
borderRadius: 2
}
},
tooltip: {
offsetLeft: 4,
offsetTop: 6,
offsetRight: 4,
offsetBottom: 6,
showRule: Lt.Always,
showType: je.Standard,
showName: !0,
showParams: !0,
defaultValue: "n/a",
text: {
size: 12,
family: "Helvetica Neue",
weight: "normal",
color: mt,
marginLeft: 8,
marginTop: 4,
marginRight: 8,
marginBottom: 4
},
icons: []
}
};
}
function Fa() {
return {
show: !0,
size: "auto",
axisLine: {
show: !0,
color: Xn,
size: 1
},
tickText: {
show: !0,
color: mt,
size: 12,
family: "Helvetica Neue",
weight: "normal",
marginStart: 4,
marginEnd: 4
},
tickLine: {
show: !0,
size: 1,
length: 3,
color: Xn
}
};
}
function xo() {
var e = Fa();
return e.type = xe.Normal, e.position = ut.Right, e.inside = !1, e.reverse = !1, e;
}
function $o() {
function e() {
return {
show: !0,
line: {
show: !0,
style: ne.Dashed,
dashedValue: [4, 2],
size: 1,
color: mt
},
text: {
show: !0,
style: q.Fill,
color: $n,
size: 12,
family: "Helvetica Neue",
weight: "normal",
borderStyle: ne.Solid,
borderDashedValue: [2, 2],
borderSize: 1,
borderColor: mt,
borderRadius: 2,
paddingLeft: 4,
paddingRight: 4,
paddingTop: 4,
paddingBottom: 4,
backgroundColor: mt
}
};
}
return {
show: !0,
horizontal: e(),
vertical: e()
};
}
function So() {
var e = Mt(0.35), t = Mt(0.25);
function n() {
return {
style: q.Fill,
color: $n,
size: 12,
family: "Helvetica Neue",
weight: "normal",
borderStyle: ne.Solid,
borderDashedValue: [2, 2],
borderSize: 1,
borderRadius: 2,
borderColor: Me,
paddingLeft: 4,
paddingRight: 4,
paddingTop: 4,
paddingBottom: 4,
backgroundColor: Me
};
}
return {
point: {
color: Me,
borderColor: e,
borderSize: 1,
radius: 5,
activeColor: Me,
activeBorderColor: e,
activeBorderSize: 3,
activeRadius: 5
},
line: {
style: ne.Solid,
smooth: !1,
color: Me,
size: 1,
dashedValue: [2, 2]
},
rect: {
style: q.Fill,
color: t,
borderColor: Me,
borderSize: 1,
borderRadius: 0,
borderStyle: ne.Solid,
borderDashedValue: [2, 2]
},
polygon: {
style: q.Fill,
color: Me,
borderColor: Me,
borderSize: 1,
borderStyle: ne.Solid,
borderDashedValue: [2, 2]
},
circle: {
style: q.Fill,
color: t,
borderColor: Me,
borderSize: 1,
borderStyle: ne.Solid,
borderDashedValue: [2, 2]
},
arc: {
style: ne.Solid,
color: Me,
size: 1,
dashedValue: [2, 2]
},
text: n(),
rectText: n()
};
}
function wo() {
return {
size: 1,
color: Xn,
fill: !0,
activeBackgroundColor: Mt(0.08)
};
}
function ko() {
return {
grid: yo(),
candle: Co(),
indicator: bo(),
xAxis: Fa(),
yAxis: xo(),
separator: wo(),
crosshair: $o(),
overlay: So()
};
}
var Mo = process.env.NODE_ENV === "development";
function ir(e, t, n, r, a, i) {
if (Mo) {
var o = r !== "" ? "Call api `".concat(r, "`").concat(a !== "" || i !== "" ? ", " : ".") : "", s = a !== "" ? "invalid parameter `".concat(a, "`").concat(i !== "" ? ", " : ".") : "", l = i !== "" ? i : "";
console.log(e, t, n, o, s, l);
}
}
function ze(e, t, n) {
ir("%c😑 klinecharts warning%c %s%s%s", "padding:3px 4px;border-radius:2px;color:#ffffff;background-color:#FF9600", "color:#FF9600", e, t, n ?? "");
}
function To(e, t, n) {
ir("%c😟 klinecharts error%c %s%s%s", "padding:3px 4px;border-radius:2px;color:#ffffff;background-color:#F92855;", "color:#F92855;", e, t, n);
}
function Lo() {
ir("%c❤️ Welcome to klinecharts. Version is 0.0.2", "border-radius:4px;border:dashed 1px #1677FF;line-height:70px;padding:0 20px;margin:16px 0;font-size:14px;color:#1677FF;", "", "", "", "");
}
function Le(e, t) {
if (!(!Ue(e) && !Ue(t))) {
for (var n in t)
if (Object.prototype.hasOwnProperty.call(t, n)) {
var r = e[n], a = t[n];
Ue(a) && Ue(r) ? Le(r, a) : L(t[n]) && (e[n] = At(t[n]));
}
}
}
function At(e) {
if (!Ue(e))
return e;
var t;
Oe(e) ? t = [] : t = {};
for (var n in e)
if (Object.prototype.hasOwnProperty.call(e, n)) {
var r = e[n];
Ue(r) ? t[n] = At(r) : t[n] = r;
}
return t;
}
function Oe(e) {
return Object.prototype.toString.call(e) === "[object Array]";
}
function Ke(e) {
return typeof e == "function";
}
function Ue(e) {
return typeof e == "object" && L(e);
}
function N(e) {
return typeof e == "number" && !isNaN(e);
}
function L(e) {
return e != null;
}
function lt(e) {
return typeof e == "boolean";
}
function W(e) {
return typeof e == "string";
}
var Ao = /\\(\\)?/g, Io = RegExp(`[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`, "g");
function be(e, t, n) {
if (L(e)) {
var r = [];
t.replace(Io, function(s) {
for (var l = [], c = 1; c < arguments.length; c++)
l[c - 1] = arguments[c];
var u = s;
return L(l[1]) ? u = l[2].replace(Ao, "$1") : L(l[0]) && (u = l[0].trim()), r.push(u), "";
});
for (var a = e, i = 0, o = r.length; L(a) && i < o; )
a = a == null ? void 0 : a[r[i++]];
return L(a) ? a : n ?? "--";
}
return n ?? "--";
}
function Ra(e, t, n) {
var r = {};
return e.formatToParts(new Date(t)).forEach(function(a) {
var i = a.type, o = a.value;
switch (i) {
case "year": {
r.YYYY = o;
break;
}
case "month": {
r.MM = o;
break;
}
case "day": {
r.DD = o;
break;
}
case "hour": {
r.HH = o === "24" ? "00" : o;
break;
}
case "minute": {
r.mm = o;
break;
}
case "second": {
r.ss = o;
break;
}
}
}), n.replace(/YYYY|MM|DD|HH|mm|ss/g, function(a) {
return r[a];
});
}
function he(e, t) {
var n = +e;
return N(n) ? n.toFixed(t ?? 2) : "".concat(e);
}
function Oa(e) {
var t = +e;
if (N(t)) {
if (t > 1e9)
return "".concat(+(t / 1e9).toFixed(3), "B");
if (t > 1e6)
return "".concat(+(t / 1e6).toFixed(3), "M");
if (t > 1e3)
return "".concat(+(t / 1e3).toFixed(3), "K");
}
return "".concat(e);
}
function ge(e, t) {
var n = "".concat(e);
if (t.length === 0)
return n;
if (n.includes(".")) {
var r = n.split(".");
return "".concat(r[0].replace(/(\d)(?=(\d{3})+$)/g, function(a) {
return "".concat(a).concat(t);
}), ".").concat(r[1]);
}
return n.replace(/(\d)(?=(\d{3})+$)/g, function(a) {
return "".concat(a).concat(t);
});
}
function pe(e, t) {
var n = "".concat(e), r = new RegExp("\\.0{" + t + ",}[1-9][0-9]*$");
if (r.test(n)) {
var a = n.split("."), i = a[a.length - 1], o = i.match(/0*/);
if (L(o)) {
var s = o[0].length;
return a[a.length - 1] = i.replace(/0*/, "0{".concat(s, "}")), a.join(".");
}
}
return n;
}
var Xt;
function ct(e) {
var t, n, r;
return (r = (n = (t = e.ownerDocument) === null || t === void 0 ? void 0 : t.defaultView) === null || n === void 0 ? void 0 : n.devicePixelRatio) !== null && r !== void 0 ? r : 1;
}
function Ct(e, t, n) {
return "".concat(t ?? "normal", " ").concat(e ?? 12, "px ").concat(n ?? "Helvetica Neue");
}
function Jt(e, t, n, r) {
if (!L(Xt)) {
var a = document.createElement("canvas"), i = ct(a);
Xt = a.getContext("2d"), Xt.scale(i, i);
}
return Xt.font = Ct(t, n, r), Math.round(Xt.measureText(e).width);
}
var Te;
(function(e) {
e.OnDataReady = "onDataReady", e.OnZoom = "onZoom", e.OnScroll = "onScroll", e.OnVisibleRangeChange = "onVisibleRangeChange", e.OnTooltipIconClick = "onTooltipIconClick", e.OnCrosshairChange = "onCrosshairChange", e.OnCandleBarClick = "onCandleBarClick", e.OnPaneDrag = "onPaneDrag";
})(Te || (Te = {}));
var Eo = (
/** @class */
function() {
function e() {
this._callbacks = [];
}
return e.prototype.subscribe = function(t) {
var n, r = (n = this._callbacks.indexOf(t)) !== null && n !== void 0 ? n : -1;
r < 0 && this._callbacks.push(t);
}, e.prototype.unsubscribe = function(t) {
var n;
if (Ke(t)) {
var r = (n = this._callbacks.indexOf(t)) !== null && n !== void 0 ? n : -1;
r > -1 && this._callbacks.splice(r, 1);
} else
this._callbacks = [];
}, e.prototype.execute = function(t) {
this._callbacks.forEach(function(n) {
n(t);
});
}, e.prototype.isEmpty = function() {
return this._callbacks.length === 0;
}, e;
}()
), Re;
(function(e) {
e.Init = "init", e.Forward = "forward", e.Backward = "backward";
})(Re || (Re = {}));
var Ae;
(function(e) {
e.Normal = "normal", e.Price = "price", e.Volume = "volume";
})(Ae || (Ae = {}));
function or(e, t, n, r, a) {
var i = t.result, o = t.figures, s = t.styles, l = be(s, "circles", r.circles), c = l.length, u = be(s, "bars", r.bars), h = u.length, d = be(s, "lines", r.lines), f = d.length, v = 0, g = 0, p = 0, m, y = 0;
o.forEach(function(C) {
var _;
switch (C.type) {
case "circle": {
y = v;
var b = l[v % c];
m = z(z({}, b), { color: b.noChangeColor }), v++;
break;
}
case "bar": {
y = g;
var x = u[g % h];
m = z(z({}, x), { color: x.noChangeColor }), g++;
break;
}
case "line": {
y = p, m = d[p % f], p++;
break;
}
}
if (L(m)) {
var $ = {
prev: { kLineData: e[n - 1], indicatorData: i[n - 1] },
current: { kLineData: e[n], indicatorData: i[n] },
next: { kLineData: e[n + 1], indicatorData: i[n + 1] }
}, w = (_ = C.styles) === null || _ === void 0 ? void 0 : _.call(C, $, t, r);
a(C, z(z({}, m), w), y);
}
});
}
var Po = (
/** @class */
function() {
function e(t) {
this.result = [], this._precisionFlag = !1;
var n = t.name, r = t.shortName, a = t.series, i = t.calcParams, o = t.figures, s = t.precision, l = t.shouldOhlc, c = t.shouldFormatBigNumber, u = t.visible, h = t.zLevel, d = t.minValue, f = t.maxValue, v = t.styles, g = t.extendData, p = t.regenerateFigures, m = t.createTooltipDataSource, y = t.draw;
this.name = n, this.shortName = r ?? n, this.series = a ?? Ae.Normal, this.precision = s ?? 4, this.calcParams = i ?? [], this.figures = o ?? [], this.shouldOhlc = l ?? !1, this.shouldFormatBigNumber = c ?? !1, this.visible = u ?? !0, this.zLevel = h ?? 0, this.minValue = d ?? null, this.maxValue = f ?? null, this.styles = At(v ?? {}), this.extendData = g, this.regenerateFigures = p ?? null, this.createTooltipDataSource = m ?? null, this.draw = y ?? null;
}
return e.prototype.setShortName = function(t) {
return this.shortName !== t ? (this.shortName = t, !0) : !1;
}, e.prototype.setSeries = function(t) {
return this.series !== t ? (this.series = t, !0) : !1;
}, e.prototype.setPrecision = function(t, n) {
var r = n ?? !1, a = Math.floor(t);
return a !== this.precision && t >= 0 && (!r || r && !this._precisionFlag) ? (this.precision = a, r || (this._precisionFlag = !0), !0) : !1;
}, e.prototype.setCalcParams = function(t) {
var n, r;
return this.calcParams = t, this.figures = (r = (n = this.regenerateFigures) === null || n === void 0 ? void 0 : n.call(this, t)) !== null && r !== void 0 ? r : this.figures, !0;
}, e.prototype.setShouldOhlc = function(t) {
return this.shouldOhlc !== t ? (this.shouldOhlc = t, !0) : !1;
}, e.prototype.setShouldFormatBigNumber = function(t) {
return this.shouldFormatBigNumber !== t ? (this.shouldFormatBigNumber = t, !0) : !1;
}, e.prototype.setVisible = function(t) {
return this.visible !== t ? (this.visible = t, !0) : !1;
}, e.prototype.setZLevel = function(t) {
return this.zLevel !== t ? (this.zLevel = t, !0) : !1;
}, e.prototype.setStyles = function(t) {
return Le(this.styles, t), !0;
}, e.prototype.setExtendData = function(t) {
return this.extendData !== t ? (this.extendData = t, !0) : !1;
}, e.prototype.setFigures = function(t) {
return this.figures !== t ? (this.figures = t, !0) : !1;
}, e.prototype.setMinValue = function(t) {
return this.minValue !== t ? (this.minValue = t, !0) : !1;
}, e.prototype.setMaxValue = function(t) {
return this.maxValue !== t ? (this.maxValue = t, !0) : !1;
}, e.prototype.setRegenerateFigures = function(t) {
return this.regenerateFigures !== t ? (this.regenerateFigures = t, !0) : !1;
}, e.prototype.setCreateTooltipDataSource = function(t) {
return this.createTooltipDataSource !== t ? (this.createTooltipDataSource = t, !0) : !1;
}, e.prototype.setDraw = function(t) {
return this.draw !== t ? (this.draw = t, !0) : !1;
}, e.prototype.calcIndicator = function(t) {
return wt(this, void 0, void 0, function() {
var n;
return kt(this, function(r) {
switch (r.label) {
case 0:
return r.trys.push([0, 2, , 3]), [4, this.calc(t, this)];
case 1:
return n = r.sent(), this.result = n, [2, !0];
case 2:
return r.sent(), [2, !1];
case 3:
return [
2
/*return*/
];
}
});
});
}, e.extend = function(t) {
var n = (
/** @class */
function(r) {
H(a, r);
function a() {
return r.call(this, t) || this;
}
return a.prototype.calc = function(i, o) {
return t.calc(i, o);
}, a;
}(e)
);
return n;
}, e;
}()
), Tt;
(function(e) {
e.Normal = "normal", e.WeakMagnet = "weak_magnet", e.StrongMagnet = "strong_magnet";
})(Tt || (Tt = {}));
function Do() {
return [
"mouseClickEvent",
"mouseDoubleClickEvent",
"mouseRightClickEvent",
"tapEvent",
"doubleTapEvent",
"mouseDownEvent",
"touchStartEvent",
"mouseMoveEvent",
"touchMoveEvent"
];
}
var Or = 1, Yt = -1, Bo = "overlay_", $t = "overlay_figure_", Na = (
/** @class */
function() {
function e(t) {
this.currentStep = Or, this.points = [], this._prevPressedPoint = null, this._prevPressedPoints = [];
var n = t.mode, r = t.modeSensitivity, a = t.extendData, i = t.styles, o = t.name, s = t.totalStep, l = t.lock, c = t.visible, u = t.zLevel, h = t.needDefaultPointFigure, d = t.needDefaultXAxisFigure, f = t.needDefaultYAxisFigure, v = t.createPointFigures, g = t.createXAxisFigures, p = t.createYAxisFigures, m = t.performEventPressedMove, y = t.performEventMoveForDrawing, C = t.onDrawStart, _ = t.onDrawing, b = t.onDrawEnd, x = t.onClick, $ = t.onDoubleClick, w = t.onRightClick, S = t.onPressedMoveStart, k = t.onPressedMoving, M = t.onPressedMoveEnd, I = t.onMouseEnter, D = t.onMouseLeave, B = t.onRemoved, U = t.onSelected, j = t.onDeselected;
this.name = o, this.totalStep = !N(s) || s < 2 ? 1 : s, this.lock = l ?? !1, this.visible = c ?? !0, this.zLevel = u ?? 0, this.needDefaultPointFigure = h ?? !1, this.needDefaultXAxisFigure = d ?? !1, this.needDefaultYAxisFigure = f ?? !1, this.mode = n ?? Tt.Normal, this.modeSensitivity = r ?? 8, this.extendData = a, this.styles = At(i ?? {}), this.createPointFigures = v ?? null, this.createXAxisFigures = g ?? null, this.createYAxisFigures = p ?? null, this.performEventPressedMove = m ?? null, this.performEventMoveForDrawing = y ?? null, this.onDrawStart = C ?? null, this.onDrawing = _ ?? null, this.onDrawEnd = b ?? null, this.onClick = x ?? null, this.onDoubleClick = $ ?? null, this.onRightClick = w ?? null, this.onPressedMoveStart = S ?? null, this.onPressedMoving = k ?? null, this.onPressedMoveEnd = M ?? null, this.onMouseEnter = I ?? null, this.onMouseLeave = D ?? null, this.onRemoved = B ?? null, this.onSelected = U ?? null, this.onDeselected = j ?? null;
}
return e.prototype.setId = function(t) {
return W(this.id) ? !1 : (this.id = t, !0);
}, e.prototype.setGroupId = function(t) {
return W(this.groupId) ? !1 : (this.groupId = t, !0);
}, e.prototype.setPaneId = function(t) {
this.paneId = t;
}, e.prototype.setExtendData = function(t) {
return t !== this.extendData ? (this.extendData = t, !0) : !1;
}, e.prototype.setStyles = function(t) {
return Le(this.styles, t), !0;
}, e.prototype.setPoints = function(t) {
if (t.length > 0) {
var n = void 0;
if (this.points = en([], We(t), !1), t.length >= this.totalStep - 1 ? (this.currentStep = Yt, n = this.totalStep - 1) : (this.currentStep = t.length + 1, n = t.length), this.performEventMoveForDrawing !== null)
for (var r = 0; r < n; r++)
this.performEventMoveForDrawing({
currentStep: r + 2,
mode: this.mode,
points: this.points,
performPointIndex: r,
performPoint: this.points[r]
});
return this.currentStep === Yt && this.performEventPressedMove !== null && this.performEventPressedMove({
currentStep: this.currentStep,
mode: this.mode,
points: this.points,
performPointIndex: this.points.length - 1,
performPoint: this.points[this.points.length - 1]
}), !0;
}
return !1;
}, e.prototype.setLock = function(t) {
return this.lock !== t ? (this.lock = t, !0) : !1;
}, e.prototype.setVisible = function(t) {
return this.visible !== t ? (this.visible = t, !0) : !1;
}, e.prototype.setZLevel = function(t) {
return this.zLevel !== t ? (this.zLevel = t, !0) : !1;
}, e.prototype.setMode = function(t) {
return this.mode !== t ? (this.mode = t, !0) : !1;
}, e.prototype.setModeSensitivity = function(t) {
return this.modeSensitivity !== t ? (this.modeSensitivity = t, !0) : !1;
}, e.prototype.setOnDrawStartCallback = function(t) {
return this.onDrawStart !== t ? (this.onDrawStart = t, !0) : !1;
}, e.prototype.setOnDrawingCallback = function(t) {
return this.onDrawing !== t ? (this.onDrawing = t, !0) : !1;
}, e.prototype.setOnDrawEndCallback = function(t) {
return this.onDrawEnd !== t ? (this.onDrawEnd = t, !0) : !1;
}, e.prototype.setOnClickCallback = function(t) {
return this.onClick !== t ? (this.onClick = t, !0) : !1;
}, e.prototype.setOnDoubleClickCallback = function(t) {
return this.onDoubleClick !== t ? (this.onDoubleClick = t, !0) : !1;
}, e.prototype.setOnRightClickCallback = function(t) {
return this.onRightClick !== t ? (this.onRightClick = t, !0) : !1;
}, e.prototype.setOnPressedMoveStartCallback = function(t) {
return this.onPressedMoveStart !== t ? (this.onPressedMoveStart = t, !0) : !1;
}, e.prototype.setOnPressedMovingCallback = function(t) {
return this.onPressedMoving !== t ? (this.onPressedMoving = t, !0) : !1;
}, e.prototype.setOnPressedMoveEndCallback = function(t) {
return this.onPressedMoveEnd !== t ? (this.onPressedMoveEnd = t, !0) : !1;
}, e.prototype.setOnMouseEnterCallback = function(t) {
return this.onMouseEnter !== t ? (this.onMouseEnter = t, !0) : !1;
}, e.prototype.setOnMouseLeaveCallback = function(t) {
return this.onMouseLeave !== t ? (this.onMouseLeave = t, !0) : !1;
}, e.prototype.setOnRemovedCallback = function(t) {
return this.onRemoved !== t ? (this.onRemoved = t, !0) : !1;
}, e.prototype.setOnSelectedCallback = function(t) {
return this.onSelected !== t ? (this.onSelected = t, !0) : !1;
}, e.prototype.setOnDeselectedCallback = function(t) {
return this.onDeselected !== t ? (this.onDeselected = t, !0) : !1;
}, e.prototype.nextStep = function() {
this.currentStep === this.totalStep - 1 ? this.currentStep = Yt : this.currentStep++;
}, e.prototype.forceComplete = function() {
this.currentStep = Yt;
}, e.prototype.isDrawing = function() {
return this.currentStep !== Yt;
}, e.prototype.isStart = function() {
return this.currentStep === Or;
}, e.prototype.eventMoveForDrawing = function(t) {
var n, r = this.currentStep - 1, a = {};
N(t.timestamp) && (a.timestamp = t.timestamp), N(t.dataIndex) && (a.dataIndex = t.dataIndex), N(t.value) && (a.value = t.value), this.points[r] = a, (n = this.performEventMoveForDrawing) === null || n === void 0 || n.call(this, {
currentStep: this.currentStep,
mode: this.mode,
points: this.points,
performPointIndex: r,
performPoint: a
});
}, e.prototype.eventPressedPointMove = function(t, n) {
var r;
N(t.dataIndex) && (this.points[n].dataIndex = t.dataIndex, this.points[n].timestamp = t.timestamp), N(t.value) && (this.points[n].value = t.value), (r = this.performEventPressedMove) === null || r === void 0 || r.call(this, {
currentStep: this.currentStep,
points: this.points,
mode: this.mode,
performPointIndex: n,
performPoint: this.points[n]
});
}, e.prototype.startPressedMove = function(t) {
this._prevPressedPoint = z({}, t), this._prevPressedPoints = At(this.points);
}, e.prototype.eventPressedOtherMove = function(t, n) {
if (this._prevPressedPoint !== null) {
var r;
N(t.dataIndex) && N(this._prevPressedPoint.dataIndex) && (r = t.dataIndex - this._prevPressedPoint.dataIndex);
var a;
N(t.value) && N(this._prevPressedPoint.value) && (a = t.value - this._prevPressedPoint.value), this.points = this._prevPressedPoints.map(function(i) {
var o;
N(i.timestamp) && (i.dataIndex = n.timestampToDataIndex(i.timestamp));
var s = z({}, i);
return N(r) && N(i.dataIndex) && (s.dataIndex = i.dataIndex + r, s.timestamp = (o = n.dataIndexToTimestamp(s.dataIndex)) !== null && o !== void 0 ? o : void 0), N(a) && N(i.value) && (s.value = i.value + a), s;
});
}
}, e.extend = function(t) {
var n = (
/** @class */
function(r) {
H(a, r);
function a() {
return r.call(this, t) || this;
}
return a;
}(e)
);
return n;
}, e;
}()
), ve;
(function(e) {
e[e.Tooltip = 0] = "Tooltip", e[e.Crosshair = 1] = "Crosshair", e[e.XAxis = 2] = "XAxis";
})(ve || (ve = {}));
function Fo() {
return {
formatDate: Ra,
formatBigNumber: Oa
};
}
var Ro = "en-US", On = -1;
function dn(e) {
return Ke(window.requestAnimationFrame) ? window.requestAnimationFrame(e) : window.setTimeout(e, 20);
}
function Nr(e) {
Ke(window.cancelAnimationFrame) ? window.cancelAnimationFrame(e) : window.clearTimeout(e);
}
var Yn = (
/** @class */
function() {
function e(t) {
this._options = { duration: 500, iterationCount: 1 }, this._currentIterationCount = 0, this._running = !1, this._time = 0, Le(this._options, t);
}
return e.prototype._loop = function() {
var t = this;
this._running = !0;
var n = function() {
var r;
if (t._running) {
var a = (/* @__PURE__ */ new Date()).getTime() - t._time;
a < t._options.duration ? ((r = t._doFrameCallback) === null || r === void 0 || r.call(t, a), dn(n)) : (t.stop(), t._currentIterationCount++, t._currentIterationCount < t._options.iterationCount && t.start());
}
};
dn(n);
}, e.prototype.doFrame = function(t) {
return this._doFrameCallback = t, this;
}, e.prototype.setDuration = function(t) {
return this._options.duration = t, this;
}, e.prototype.setIterationCount = function(t) {
return this._options.iterationCount = t, this;
}, e.prototype.start = function() {
this._running || (this._time = (/* @__PURE__ */ new Date()).getTime(), this._loop());
}, e.prototype.stop = function() {
var t;
this._running && ((t = this._doFrameCallback) === null || t === void 0 || t.call(this, this._options.duration)), this._running = !1;
}, e;
}()
), Nn = 1, Vr = (/* @__PURE__ */ new Date()).getTime();
function Va(e) {
var t = (/* @__PURE__ */ new Date()).getTime();
return t === Vr ? ++Nn : Nn = 1, Vr = t, "".concat(e ?? "").concat(t, "_").concat(Nn);
}
function et(e, t) {
var n, r = document.createElement(e), a = t ?? {};
for (var i in a)
r.style[i] = (n = a[i]) !== null && n !== void 0 ? n : "";
return r;
}
function Hn(e, t, n) {
var r = 0, a = 0;
for (a = e.length - 1; r !== a; ) {
var i = Math.floor((a + r) / 2), o = a - r, s = e[i][t];
if (n === e[r][t])
return r;
if (n === e[a][t])
return a;
if (n === s)
return i;
if (n > s ? r = i : a = i, o <= 2)
break;
}
return r;
}
function Oo(e) {
var t = Math.floor(Zt(e)), n = ft(t), r = e / n, a = 0;
return r < 1.5 ? a = 1 : r < 2.5 ? a = 2 : r < 3.5 ? a = 3 : r < 4.5 ? a = 4 : r < 5.5 ? a = 5 : r < 6.5 ? a = 6 : a = 8, e = a * n, t >= -20 ? +e.toFixed(t < 0 ? -t : 0) : e;
}
function zr(e, t) {
t == null && (t = 10), t = Math.min(Math.max(0, t), 20);
var n = (+e).toFixed(t);
return +n;
}
function No(e) {
var t = e.toString(), n = t.indexOf("e");
if (n > 0) {
var r = +t.slice(n + 1);
return r < 0 ? -r : 0;
} else {
var a = t.indexOf(".");
return a < 0 ? 0 : t.length - 1 - a;
}
}
function za(e, t, n) {
var r = [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER];
return e.forEach(function(a) {
var i, o;
r[0] = Math.max((i = a[t]) !== null && i !== void 0 ? i : a, r[0]), r[1] = Math.min((o = a[n]) !== null && o !== void 0 ? o : a, r[1]);
}), r;
}
function Zt(e) {
return Math.log(e) / Math.log(10);
}
function ft(e) {
return Math.pow(10, e);
}
function Ur() {
return { from: 0, to: 0, realFrom: 0, realTo: 0 };
}
var jr = {
MIN: 1,
MAX: 50
}, Vo = 8, zo = 80, Uo = 0.88, Zn = 10, jo = (
/** @class */
function() {
function e(t) {
this._dateTimeFormat = this._buildDateTimeFormat(), this._zoomEnabled = !0, this._scrollEnabled = !0, this._totalBarSpace = 0, this._barSpace = Vo, this._offsetRightDistance = zo, this._startLastBarRightSideDiffBarCount = 0, this._scrollLimitRole = 0, this._minVisibleBarCount = { left: 2, right: 2 }, this._maxOffsetDistance = { left: 50, right: 50 }, this._visibleRange = Ur(), this._chartStore = t, this._gapBarSpace = this._calcGapBarSpace(), this._lastBarRightSideDiffBarCount = this._offsetRightDistance / this._barSpace;
}
return e.prototype._calcGapBarSpace = function() {
var t;
return this._barSpace > 3 ? t = Math.floor(this._barSpace * Uo) : (t = Math.floor(this._barSpace), t === this._barSpace && t--), t % 2 === 0 && t--, t = Math.max(1, t), t;
}, e.prototype.adjustVisibleRange = function() {
var t, n, r = this._chartStore.getDataList(), a = r.length, i = this._totalBarSpace / this._barSpace, o, s;
this._scrollLimitRole === 1 ? (o = (this._totalBarSpace - this._maxOffsetDistance.right) / this._barSpace, s = (this._totalBarSpace - this._maxOffsetDistance.left) / this._barSpace) : (o = this._minVisibleBarCount.left, s = this._minVisibleBarCount.right), o = Math.max(0, o), s = Math.max(0, s);
var l = i - Math.min(o, a);
this._lastBarRightSideDiffBarCount > l && (this._lastBarRightSideDiffBarCount = l);
var c = -a + Math.min(s, a);
this._lastBarRightSideDiffBarCount < c && (this._lastBarRightSideDiffBarCount = c);
var u = Math.round(this._lastBarRightSideDiffBarCount + a + 0.5), h = u;
u > a && (u = a);
var d = Math.round(u - i) - 1;
d < 0 && (d = 0);
var f = this._lastBarRightSideDiffBarCount > 0 ? Math.round(a + this._lastBarRightSideDiffBarCount - i) - 1 : d;
if (this._visibleRange = { from: d, to: u, realFrom: f, realTo: h }, this._chartStore.getActionStore().execute(Te.OnVisibleRangeChange, this._visibleRange), this._chartStore.adjustVisibleDataList(), d === 0) {
var v = r[0];
this._chartStore.executeLoadMoreCallback((t = v == null ? void 0 : v.timestamp) !== null && t !== void 0 ? t : null), this._chartStore.executeLoadDataCallback({
type: Re.Forward,
data: v ?? null
});
}
u === a && this._chartStore.executeLoadDataCallback({
type: Re.Backward,
data: (n = r[a - 1]) !== null && n !== void 0 ? n : null
});
}, e.prototype.getDateTimeFormat = function() {
return this._dateTimeFormat;
}, e.prototype._buildDateTimeFormat = function(t) {
var n = {
hour12: !1,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
};
W(t) && (n.timeZone = t);
var r = null;
try {
r = new Intl.DateTimeFormat("en", n);
} catch {
ze("", "", "Timezone is error!!!");
}
return r;
}, e.prototype.setTimezone = function(t) {
var n = this._buildDateTimeFormat(t);
n !== null && (this._dateTimeFormat = n);
}, e.prototype.getTimezone = function() {
return this._dateTimeFormat.resolvedOptions().timeZone;
}, e.prototype.getBarSpace = function() {
return {
bar: this._barSpace,
halfBar: this._barSpace / 2,
gapBar: this._gapBarSpace,
halfGapBar: Math.floor(this._gapBarSpace / 2)
};
}, e.prototype.setBarSpace = function(t, n) {
t < jr.MIN || t > jr.MAX || this._barSpace === t || (this._barSpace = t, this._gapBarSpace = this._calcGapBarSpace(), n == null || n(), this.adjustVisibleRange(), this._chartStore.getTooltipStore().recalculateCrosshair(!0), this._chartStore.getChart().adjustPaneViewport(!1, !0, !0, !0));
}, e.prototype.setTotalBarSpace = function(t) {
return this._totalBarSpace !== t && (this._totalBarSpace = t, this.adjustVisibleRange(), this._chartStore.getTooltipStore().recalculateCrosshair(!0)), this;
}, e.prototype.setOffsetRightDistance = function(t, n) {
return this._offsetRightDistance = this._scrollLimitRole === 1 ? Math.min(this._maxOffsetDistance.right, t) : t, this._lastBarRightSideDiffBarCount = this._offsetRightDistance / this._barSpace, (n ?? !1) && (this.adjustVisibleRange(), this._chartStore.getTooltipStore().recalculateCrosshair(!0), this._chartStore.getChart().adjustPaneViewport(!1, !0, !0, !0)), this;
}, e.prototype.resetOffsetRightDistance = function() {
this.setOffsetRightDistance(this._offsetRightDistance);
}, e.prototype.getInitialOffsetRightDistance = function() {
return this._offsetRightDistance;
}, e.prototype.getOffsetRightDistance = function() {
return Math.max(0, this._lastBarRightSideDiffBarCount * this._barSpace);
}, e.prototype.getLastBarRightSideDiffBarCount = function() {
return this._lastBarRightSideDiffBarCount;
}, e.prototype.setLastBarRightSideDiffBarCount = function(t) {
return this._lastBarRightSideDiffBarCount = t, this;
}, e.prototype.setMaxOffsetLeftDistance = function(t) {
return this._scrollLimitRole = 1, this._maxOffsetDistance.left = t, this;
}, e.prototype.setMaxOffsetRightDistance = function(t) {
return this._scrollLimitRole = 1, this._maxOffsetDistance.right = t, this;
}, e.prototype.setLeftMinVisibleBarCount = function(t) {
return this._scrollLimitRole = 0, this._minVisibleBarCount.left = t, this;
}, e.prototype.setRightMinVisibleBarCount = function(t) {
return this._scrollLimitRole = 0, this._minVisibleBarCount.right = t, this;
}, e.prototype.getVisibleRange = function() {
return this._visibleRange;
}, e.prototype.startScroll = function() {
this._startLastBarRightSideDiffBarCount = this._lastBarRightSideDiffBarCount;
}, e.prototype.scroll = function(t) {
if (this._scrollEnabled) {
var n = t / this._barSpace, r = this._lastBarRightSideDiffBarCount * this._barSpace;
this._lastBarRightSideDiffBarCount = this._startLastBarRightSideDiffBarCount - n, this.adjustVisibleRange(), this._chartStore.getTooltipStore().recalculateCrosshair(!0), this._chartStore.getChart().adjustPaneViewport(!1, !0, !0, !0);
var a = Math.round(r - this._lastBarRightSideDiffBarCount * this._barSpace);
a !== 0 && this._chartStore.getActionStore().execute(Te.OnScroll, { distance: a });
}
}, e.prototype.getDataByDataIndex = function(t) {
var n;
return (n = this._chartStore.getDataList()[t]) !== null && n !== void 0 ? n : null;
}, e.prototype.coordinateToFloatIndex = function(t) {
var n = this._chartStore.getDataList().length, r = (this._totalBarSpace - t) / this._barSpace, a = n + this._lastBarRightSideDiffBarCount - r;
return Math.round(a * 1e6) / 1e6;
}, e.prototype.dataIndexToTimestamp = function(t) {
var n, r = this.getDataByDataIndex(t);
return (n = r == null ? void 0 : r.timestamp) !== null && n !== void 0 ? n : null;
}, e.prototype.timestampToDataIndex = function(t) {
var n = this._chartStore.getDataList();
return n.length === 0 ? 0 : Hn(n, "timestamp", t);
}, e.prototype.dataIndexToCoordinate = function(t) {
var n = this._chartStore.getDataList().length, r = n + this._lastBarRightSideDiffBarCount - t;
return Math.floor(this._totalBarSpace - (r - 0.5) * this._barSpace);
}, e.prototype.coordinateToDataIndex = function(t) {
return Math.ceil(this.coordinateToFloatIndex(t)) - 1;
}, e.prototype.zoom = function(t, n) {
var r = this, a;
if (this._zoomEnabled) {
var i = n ?? null;
if (!N(i == null ? void 0 : i.x)) {
var o = this._chartStore.getTooltipStore().getCrosshair();
i = { x: (a = o == null ? void 0 : o.x) !== null && a !== void 0 ? a : this._totalBarSpace / 2 };
}
var s = i.x, l = this.coordinateToFloatIndex(s), c = this._barSpace, u = this._barSpace + t * (this._barSpace / Zn);
this.setBarSpace(u, function() {
r._lastBarRightSideDiffBarCount += l - r.coordinateToFloatIndex(s);
});
var h = this._barSpace / c;
h !== 1 && this._chartStore.getActionStore().execute(Te.OnZoom, { scale: h });
}
}, e.prototype.setZoomEnabled = function(t) {
return this._zoomEnabled = t, this;
}, e.prototype.getZoomEnabled = function() {
return this._zoomEnabled;
}, e.prototype.setScrollEnabled = function(t) {
return this._scrollEnabled = t, this;
}, e.prototype.getScrollEnabled = function() {
return this._scrollEnabled;
}, e.prototype.clear = function() {
this._visibleRange = Ur();
}, e;
}()
), Wo = {
name: "AVP",
shortName: "AVP",
series: Ae.Price,
precision: 2,
figures: [
{ key: "avp", title: "AVP: ", type: "line" }
],
calc: function(e) {
var t = 0, n = 0;
return e.map(function(r) {
var a, i, o = {}, s = (a = r == null ? void 0 : r.turnover) !== null && a !== void 0 ? a : 0, l = (i = r == null ? void 0 : r.volume) !== null && i !== void 0 ? i : 0;
return t += s, n += l, n !== 0 && (o.avp = t / n), o;
});
}
}, Ko = {
name: "AO",
shortName: "AO",
calcParams: [5, 34],
figures: [{
key: "ao",
title: "AO: ",
type: "bar",
baseValue: 0,
styles: function(e, t, n) {
var r, a, i, o, s = e.prev, l = e.current, c = (a = (r = s.indicatorData) === null || r === void 0 ? void 0 : r.ao) !== null && a !== void 0 ? a : Number.MIN_SAFE_INTEGER, u = (o = (i = l.indicatorData) === null || i === void 0 ? void 0 : i.ao) !== null && o !== void 0 ? o : Number.MIN_SAFE_INTEGER, h;
u > c ? h = be(t.styles, "bars[0].upColor", n.bars[0].upColor) : h = be(t.styles, "bars[0].downColor", n.bars[0].downColor);
var d = u > c ? q.Stroke : q.Fill;
return { color: h, style: d, borderColor: h };
}
}],
calc: function(e, t) {
var n = t.calcParams, r = Math.max(n[0], n[1]), a = 0, i = 0, o = 0, s = 0;
return e.map(function(l, c) {
var u = {}, h = (l.low + l.high) / 2;
if (a += h, i += h, c >= n[0] - 1) {
o = a / n[0];
var d = e[c - (n[0] - 1)];
a -= (d.low + d.high) / 2;
}
if (c >= n[1] - 1) {
s = i / n[1];
var d = e[c - (n[1] - 1)];
i -= (d.low + d.high) / 2;
}
return c >= r - 1 && (u.ao = o - s), u;
});
}
}, Xo = {
name: "BIAS",
shortName: "BIAS",
calcParams: [6, 12, 24],
figures: [
{ key: "bias1", title: "BIAS6: ", type: "line" },
{ key: "bias2", title: "BIAS12: ", type: "line" },
{ key: "bias3", title: "BIAS24: ", type: "line" }
],
regenerateFigures: function(e) {
return e.map(function(t, n) {
return { key: "bias".concat(n + 1), title: "BIAS".concat(t, ": "), type: "line" };
});
},
calc: function(e, t) {
var n = t.calcParams, r = t.figures, a = [];
return e.map(function(i, o) {
var s = {}, l = i.close;
return n.forEach(function(c, u) {
var h;
if (a[u] = ((h = a[u]) !== null && h !== void 0 ? h : 0) + l, o >= c - 1) {
var d = a[u] / n[u];
s[r[u].key] = (l - d) / d * 100, a[u] -= e[o - (c - 1)].close;
}
}), s;
});
}
};
function Yo(e, t) {
var n = e.length, r = 0;
return e.forEach(function(a) {
var i = a.close - t;
r += i * i;
}), r = Math.abs(r), Math.sqrt(r / n);
}
var Ho = {
name: "BOLL",
shortName: "BOLL",
series: Ae.Price,
calcParams: [20, 2],
precision: 2,
shouldOhlc: !0,
figures: [
{ key: "up", title: "UP: ", type: "line" },
{ key: "mid", title: "MID: ", type: "line" },
{ key: "dn", title: "DN: ", type: "line" }
],
calc: function(e, t) {
var n = t.calcParams, r = n[0] - 1, a = 0;
return e.map(function(i, o) {
var s = i.close, l = {};
if (a += s, o >= r) {
l.mid = a / n[0];
var c = Yo(e.slice(o - r, o + 1), l.mid);
l.up = l.mid + n[1] * c, l.dn = l.mid - n[1] * c, a -= e[o - r].close;
}
return l;
});
},
styles: {
lineStyles: {
up: { color: "#FF0000", style: "solid", width: 1 },
mid: { color: "#00FF00", style: "dashed", width: 1 },
dn: { color: "#0000FF", style: "solid", width: 1 }
},
band: {
show: !0,
color: "rgba(0, 0, 255, 0.1)"
}
}
}, Zo = {
name: "BRAR",
shortName: "BRAR",
calcParams: [26],
figures: [
{ key: "br", title: "BR: ", type: "line" },
{ key: "ar", title: "AR: ", type: "line" }
],
calc: function(e, t) {
var n = t.calcParams, r = 0, a = 0, i = 0, o = 0;
return e.map(function(s, l) {
var c, u, h = {}, d = s.high, f = s.low, v = s.open, g = ((c = e[l - 1]) !== null && c !== void 0 ? c : s).close;
if (i += d - v, o += v - f, r += d - g, a += g - f, l >= n[0] - 1) {
o !== 0 ? h.ar = i / o * 100 : h.ar = 0, a !== 0 ? h.br = r / a * 100 : h.br = 0;
var p = e[l - (n[0] - 1)], m = p.high, y = p.low, C = p.open, _ = ((u = e[l - n[0]]) !== null && u !== void 0 ? u : e[l - (n[0] - 1)]).close;
r -= m - _, a -= _ - y, i -= m - C, o -= C - y;
}
return h;
});
}
}, Go = {
name: "BBI",
shortName: "BBI",
series: Ae.Price,
precision: 2,
calcParams: [3, 6, 12, 24],
shouldOhlc: !0,
figures: [
{ key: "bbi", title: