;
! function() {
    try {
        var e = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof global ? global : "undefined" != typeof window ? window : "undefined" != typeof self ? self : {},
            n = (new e.Error).stack;
        n && ((e._debugIds || (e._debugIds = {}))[n] = "59d6946d-c94e-a353-9437-a366c3a6f35c")
    } catch (e) {}
}();
(globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push(["object" == typeof document ? document.currentScript : void 0, 804599, t => {
    "use strict";

    function i(t) {
        var i = t.width,
            e = t.height;
        if (i < 0) throw Error("Negative width is not allowed for Size");
        if (e < 0) throw Error("Negative height is not allowed for Size");
        return {
            width: i,
            height: e
        }
    }

    function e(t, i) {
        return t.width === i.width && t.height === i.height
    }
    var s, h, n, l, r, o, a, u, c, d, f, m, p, v, g, w, b, M, y, x, _ = function() {
            function t(t) {
                var i = this;
                this._resolutionListener = function() {
                    return i._onResolutionChanged()
                }, this._resolutionMediaQueryList = null, this._observers = [], this._window = t, this._installResolutionListener()
            }
            return t.prototype.dispose = function() {
                this._uninstallResolutionListener(), this._window = null
            }, Object.defineProperty(t.prototype, "value", {
                get: function() {
                    return this._window.devicePixelRatio
                },
                enumerable: !1,
                configurable: !0
            }), t.prototype.subscribe = function(t) {
                var i = this,
                    e = {
                        next: t
                    };
                return this._observers.push(e), {
                    unsubscribe: function() {
                        i._observers = i._observers.filter(function(t) {
                            return t !== e
                        })
                    }
                }
            }, t.prototype._installResolutionListener = function() {
                if (null !== this._resolutionMediaQueryList) throw Error("Resolution listener is already installed");
                var t = this._window.devicePixelRatio;
                this._resolutionMediaQueryList = this._window.matchMedia("all and (resolution: ".concat(t, "dppx)")), this._resolutionMediaQueryList.addListener(this._resolutionListener)
            }, t.prototype._uninstallResolutionListener = function() {
                null !== this._resolutionMediaQueryList && (this._resolutionMediaQueryList.removeListener(this._resolutionListener), this._resolutionMediaQueryList = null)
            }, t.prototype._reinstallResolutionListener = function() {
                this._uninstallResolutionListener(), this._installResolutionListener()
            }, t.prototype._onResolutionChanged = function() {
                var t = this;
                this._observers.forEach(function(i) {
                    return i.next(t._window.devicePixelRatio)
                }), this._reinstallResolutionListener()
            }, t
        }(),
        S = function() {
            function t(t, e, s) {
                var h;
                this._canvasElement = null, this._bitmapSizeChangedListeners = [], this._suggestedBitmapSize = null, this._suggestedBitmapSizeChangedListeners = [], this._devicePixelRatioObservable = null, this._canvasElementResizeObserver = null, this._canvasElement = t, this._canvasElementClientSize = i({
                    width: this._canvasElement.clientWidth,
                    height: this._canvasElement.clientHeight
                }), this._transformBitmapSize = null != e ? e : function(t) {
                    return t
                }, this._allowResizeObserver = null == (h = null == s ? void 0 : s.allowResizeObserver) || h, this._chooseAndInitObserver()
            }
            return t.prototype.dispose = function() {
                var t, i;
                if (null === this._canvasElement) throw Error("Object is disposed");
                null == (t = this._canvasElementResizeObserver) || t.disconnect(), this._canvasElementResizeObserver = null, null == (i = this._devicePixelRatioObservable) || i.dispose(), this._devicePixelRatioObservable = null, this._suggestedBitmapSizeChangedListeners.length = 0, this._bitmapSizeChangedListeners.length = 0, this._canvasElement = null
            }, Object.defineProperty(t.prototype, "canvasElement", {
                get: function() {
                    if (null === this._canvasElement) throw Error("Object is disposed");
                    return this._canvasElement
                },
                enumerable: !1,
                configurable: !0
            }), Object.defineProperty(t.prototype, "canvasElementClientSize", {
                get: function() {
                    return this._canvasElementClientSize
                },
                enumerable: !1,
                configurable: !0
            }), Object.defineProperty(t.prototype, "bitmapSize", {
                get: function() {
                    return i({
                        width: this.canvasElement.width,
                        height: this.canvasElement.height
                    })
                },
                enumerable: !1,
                configurable: !0
            }), t.prototype.resizeCanvasElement = function(t) {
                this._canvasElementClientSize = i(t), this.canvasElement.style.width = "".concat(this._canvasElementClientSize.width, "px"), this.canvasElement.style.height = "".concat(this._canvasElementClientSize.height, "px"), this._invalidateBitmapSize()
            }, t.prototype.subscribeBitmapSizeChanged = function(t) {
                this._bitmapSizeChangedListeners.push(t)
            }, t.prototype.unsubscribeBitmapSizeChanged = function(t) {
                this._bitmapSizeChangedListeners = this._bitmapSizeChangedListeners.filter(function(i) {
                    return i !== t
                })
            }, Object.defineProperty(t.prototype, "suggestedBitmapSize", {
                get: function() {
                    return this._suggestedBitmapSize
                },
                enumerable: !1,
                configurable: !0
            }), t.prototype.subscribeSuggestedBitmapSizeChanged = function(t) {
                this._suggestedBitmapSizeChangedListeners.push(t)
            }, t.prototype.unsubscribeSuggestedBitmapSizeChanged = function(t) {
                this._suggestedBitmapSizeChangedListeners = this._suggestedBitmapSizeChangedListeners.filter(function(i) {
                    return i !== t
                })
            }, t.prototype.applySuggestedBitmapSize = function() {
                if (null !== this._suggestedBitmapSize) {
                    var t = this._suggestedBitmapSize;
                    this._suggestedBitmapSize = null, this._resizeBitmap(t), this._emitSuggestedBitmapSizeChanged(t, this._suggestedBitmapSize)
                }
            }, t.prototype._resizeBitmap = function(t) {
                var i = this.bitmapSize;
                e(i, t) || (this.canvasElement.width = t.width, this.canvasElement.height = t.height, this._emitBitmapSizeChanged(i, t))
            }, t.prototype._emitBitmapSizeChanged = function(t, i) {
                var e = this;
                this._bitmapSizeChangedListeners.forEach(function(s) {
                    return s.call(e, t, i)
                })
            }, t.prototype._suggestNewBitmapSize = function(t) {
                var s = this._suggestedBitmapSize,
                    h = i(this._transformBitmapSize(t, this._canvasElementClientSize)),
                    n = e(this.bitmapSize, h) ? null : h;
                null === s && null === n || null !== s && null !== n && e(s, n) || (this._suggestedBitmapSize = n, this._emitSuggestedBitmapSizeChanged(s, n))
            }, t.prototype._emitSuggestedBitmapSizeChanged = function(t, i) {
                var e = this;
                this._suggestedBitmapSizeChangedListeners.forEach(function(s) {
                    return s.call(e, t, i)
                })
            }, t.prototype._chooseAndInitObserver = function() {
                var t = this;
                this._allowResizeObserver ? new Promise(function(t) {
                    var i = new ResizeObserver(function(e) {
                        t(e.every(function(t) {
                            return "devicePixelContentBoxSize" in t
                        })), i.disconnect()
                    });
                    i.observe(document.body, {
                        box: "device-pixel-content-box"
                    })
                }).catch(function() {
                    return !1
                }).then(function(i) {
                    return i ? t._initResizeObserver() : t._initDevicePixelRatioObservable()
                }) : this._initDevicePixelRatioObservable()
            }, t.prototype._initDevicePixelRatioObservable = function() {
                var t = this;
                if (null !== this._canvasElement) {
                    var i = C(this._canvasElement);
                    if (null === i) throw Error("No window is associated with the canvas");
                    this._devicePixelRatioObservable = new _(i), this._devicePixelRatioObservable.subscribe(function() {
                        return t._invalidateBitmapSize()
                    }), this._invalidateBitmapSize()
                }
            }, t.prototype._invalidateBitmapSize = function() {
                if (null !== this._canvasElement) {
                    var t, e, s = C(this._canvasElement);
                    if (null !== s) {
                        var h, n, l = null != (e = null == (t = this._devicePixelRatioObservable) ? void 0 : t.value) ? e : s.devicePixelRatio,
                            r = this._canvasElement.getClientRects(),
                            o = void 0 !== r[0] ? (h = r[0], n = l, i({
                                width: Math.round(h.left * n + h.width * n) - Math.round(h.left * n),
                                height: Math.round(h.top * n + h.height * n) - Math.round(h.top * n)
                            })) : i({
                                width: this._canvasElementClientSize.width * l,
                                height: this._canvasElementClientSize.height * l
                            });
                        this._suggestNewBitmapSize(o)
                    }
                }
            }, t.prototype._initResizeObserver = function() {
                var t = this;
                null !== this._canvasElement && (this._canvasElementResizeObserver = new ResizeObserver(function(e) {
                    var s = e.find(function(i) {
                        return i.target === t._canvasElement
                    });
                    if (s && s.devicePixelContentBoxSize && s.devicePixelContentBoxSize[0]) {
                        var h = s.devicePixelContentBoxSize[0],
                            n = i({
                                width: h.inlineSize,
                                height: h.blockSize
                            });
                        t._suggestNewBitmapSize(n)
                    }
                }), this._canvasElementResizeObserver.observe(this._canvasElement, {
                    box: "device-pixel-content-box"
                }))
            }, t
        }();

    function C(t) {
        return t.ownerDocument.defaultView
    }
    var E = function() {
        function t(t, i, e) {
            if (0 === i.width || 0 === i.height) throw TypeError("Rendering target could only be created on a media with positive width and height");
            if (this._mediaSize = i, 0 === e.width || 0 === e.height) throw TypeError("Rendering target could only be created using a bitmap with positive integer width and height");
            this._bitmapSize = e, this._context = t
        }
        return t.prototype.useMediaCoordinateSpace = function(t) {
            try {
                return this._context.save(), this._context.setTransform(1, 0, 0, 1, 0, 0), this._context.scale(this._horizontalPixelRatio, this._verticalPixelRatio), t({
                    context: this._context,
                    mediaSize: this._mediaSize
                })
            } finally {
                this._context.restore()
            }
        }, t.prototype.useBitmapCoordinateSpace = function(t) {
            try {
                return this._context.save(), this._context.setTransform(1, 0, 0, 1, 0, 0), t({
                    context: this._context,
                    mediaSize: this._mediaSize,
                    bitmapSize: this._bitmapSize,
                    horizontalPixelRatio: this._horizontalPixelRatio,
                    verticalPixelRatio: this._verticalPixelRatio
                })
            } finally {
                this._context.restore()
            }
        }, Object.defineProperty(t.prototype, "_horizontalPixelRatio", {
            get: function() {
                return this._bitmapSize.width / this._mediaSize.width
            },
            enumerable: !1,
            configurable: !0
        }), Object.defineProperty(t.prototype, "_verticalPixelRatio", {
            get: function() {
                return this._bitmapSize.height / this._mediaSize.height
            },
            enumerable: !1,
            configurable: !0
        }), t
    }();

    function z(t, i) {
        var e = t.canvasElementClientSize;
        if (0 === e.width || 0 === e.height) return null;
        var s = t.bitmapSize;
        if (0 === s.width || 0 === s.height) return null;
        var h = t.canvasElement.getContext("2d", i);
        return null === h ? null : new E(h, e, s)
    }
    let k = {
        title: "",
        visible: !0,
        hitTestTolerance: 3,
        lastValueVisible: !0,
        priceLineVisible: !0,
        priceLineSource: 0,
        priceLineWidth: 1,
        priceLineColor: "",
        priceLineStyle: 2,
        baseLineVisible: !0,
        baseLineWidth: 1,
        baseLineColor: "#B2B5BE",
        baseLineStyle: 0,
        priceFormat: {
            type: "price",
            precision: 2,
            minMove: .01
        }
    };

    function R(t, i) {
        let e = function(t, i) {
            switch (t) {
                case 0:
                default:
                    return [];
                case 1:
                    return [i, i];
                case 2:
                    return [2 * i, 2 * i];
                case 3:
                    return [6 * i, 6 * i];
                case 4:
                    return [i, 4 * i]
            }
        }(i, t.lineWidth);
        return t.setLineDash(e), e
    }

    function L(t, i, e, s) {
        t.beginPath();
        let h = t.lineWidth % 2 ? .5 : 0;
        t.moveTo(e, i + h), t.lineTo(s, i + h), t.stroke()
    }

    function T(t, i) {
        if (!t) throw Error("Assertion failed" + (i ? ": " + i : ""))
    }

    function N(t) {
        if (void 0 === t) throw Error("Value is undefined");
        return t
    }

    function P(t) {
        if (null === t) throw Error("Value is null");
        return t
    }

    function Q(t) {
        return P(N(t))
    }(s = f || (f = {}))[s.Simple = 0] = "Simple", s[s.WithSteps = 1] = "WithSteps", s[s.Curved = 2] = "Curved", (h = m || (m = {}))[h.Solid = 0] = "Solid", h[h.Dotted = 1] = "Dotted", h[h.Dashed = 2] = "Dashed", h[h.LargeDashed = 3] = "LargeDashed", h[h.SparseDotted = 4] = "SparseDotted";
    class W {
        constructor() {
            this.t = []
        }
        i(t, i, e) {
            this.t.push({
                h: t,
                l: i,
                o: !0 === e
            })
        }
        _(t) {
            let i = this.t.findIndex(i => t === i.h);
            i > -1 && this.t.splice(i, 1)
        }
        u(t) {
            this.t = this.t.filter(i => i.l !== t)
        }
        p(t, i, e) {
            let s = [...this.t];
            this.t = this.t.filter(t => !t.o), s.forEach(s => s.h(t, i, e))
        }
        v() {
            return this.t.length > 0
        }
        m() {
            this.t = []
        }
    }

    function I(t, ...i) {
        for (let e of i)
            for (let i in e) void 0 !== e[i] && Object.prototype.hasOwnProperty.call(e, i) && !["__proto__", "constructor", "prototype"].includes(i) && ("object" != typeof e[i] || void 0 === t[i] || Array.isArray(e[i]) ? t[i] = e[i] : I(t[i], e[i]));
        return t
    }

    function B(t) {
        return "number" == typeof t && isFinite(t)
    }

    function F(t) {
        return "number" == typeof t && t % 1 == 0
    }

    function D(t) {
        return "string" == typeof t
    }

    function K(t) {
        return "boolean" == typeof t
    }

    function O(t) {
        let i, e, s;
        if (!t || "object" != typeof t) return t;
        for (e in i = Array.isArray(t) ? [] : {}, t) t.hasOwnProperty(e) && (s = t[e], i[e] = s && "object" == typeof s ? O(s) : s);
        return i
    }

    function q(t) {
        return null !== t
    }

    function $(t) {
        return null === t ? void 0 : t
    }
    let V = "-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";

    function Z(t, i, e) {
        return void 0 === i && (i = V), `${e=void 0!==e?`${e} `:""}${t}px ${i}`
    }
    class A {
        constructor(t) {
            this.M = {
                S: 1,
                C: 5,
                k: NaN,
                P: "",
                T: "",
                R: "",
                D: "",
                I: 0,
                V: 0,
                B: 0,
                A: 0,
                L: 0
            }, this.O = t
        }
        N() {
            let t = this.M,
                i = this.F(),
                e = this.W();
            return t.k === i && t.T === e || (t.k = i, t.T = e, t.P = Z(i, e), t.A = 2.5 / 12 * i, t.I = t.A, t.V = i / 12 * t.C, t.B = i / 12 * t.C, t.L = 0), t.R = this.H(), t.D = this.U(), this.M
        }
        H() {
            return this.O.N().layout.textColor
        }
        U() {
            return this.O.$()
        }
        F() {
            return this.O.N().layout.fontSize
        }
        W() {
            return this.O.N().layout.fontFamily
        }
    }

    function H(t) {
        return t < 0 ? 0 : t > 255 ? 255 : Math.round(t) || 0
    }

    function G(t) {
        return .199 * t[0] + .687 * t[1] + .114 * t[2]
    }
    class U {
        constructor(t, i) {
            this.j = new Map, this.q = t, i && (this.j = i)
        }
        Y(t, i) {
            if ("transparent" === t) return t;
            let e = this.K(t),
                s = e[3];
            return `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${i*s})`
        }
        Z(t) {
            let i = this.K(t);
            return {
                G: `rgb(${i[0]}, ${i[1]}, ${i[2]})`,
                X: G(i) > 160 ? "black" : "white"
            }
        }
        J(t) {
            return G(this.K(t))
        }
        tt(t, i, e) {
            var s;
            let [h, n, l, r] = this.K(t), [o, a, u, c] = this.K(i), d = [H(h + e * (o - h)), H(n + e * (a - n)), H(l + e * (u - l)), (s = r + e * (c - r)) <= 0 || s > 1 ? Math.min(Math.max(s, 0), 1) : Math.round(1e4 * s) / 1e4];
            return `rgba(${d[0]}, ${d[1]}, ${d[2]}, ${d[3]})`
        }
        K(t) {
            let i, e, s = this.j.get(t);
            if (s) return s;
            let h = ((i = document.createElement("div")).style.display = "none", document.body.appendChild(i), i.style.color = t, e = window.getComputedStyle(i).color, document.body.removeChild(i), e).match(/^rgba?\s*\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d+))?\)$/);
            if (!h) {
                if (this.q.length)
                    for (let i of this.q) {
                        let e = i(t);
                        if (e) return this.j.set(t, e), e
                    }
                throw Error(`Failed to parse color: ${t}`)
            }
            let n = [parseInt(h[1], 10), parseInt(h[2], 10), parseInt(h[3], 10), h[4] ? parseFloat(h[4]) : 1];
            return this.j.set(t, n), n
        }
    }
    class Y {
        constructor() {
            this.it = []
        }
        nt(t) {
            this.it = t
        }
        st(t, i, e) {
            this.it.forEach(s => {
                s.st(t, i, e)
            })
        }
    }
    class j {
        st(t, i, e) {
            t.useBitmapCoordinateSpace(t => this.et(t, i, e))
        }
    }
    class X extends j {
        constructor() {
            super(...arguments), this.rt = null
        }
        ht(t) {
            this.rt = t
        }
        et({
            context: t,
            horizontalPixelRatio: i,
            verticalPixelRatio: e
        }) {
            if (null === this.rt || null === this.rt.lt) return;
            let s = this.rt.lt,
                h = this.rt,
                n = Math.max(1, Math.floor(i)) % 2 / 2,
                l = l => {
                    t.beginPath();
                    for (let r = s.to - 1; r >= s.from; --r) {
                        let s = h.ot[r],
                            o = Math.round(s._t * i) + n,
                            a = s.ut * e,
                            u = l * e + n;
                        t.moveTo(o, a), t.arc(o, a, u, 0, 2 * Math.PI)
                    }
                    t.fill()
                };
            h.ct > 0 && (t.fillStyle = h.dt, l(h.ft + h.ct)), t.fillStyle = h.vt, l(h.ft)
        }
    }

    function J() {
        return {
            ot: [{
                _t: 0,
                ut: 0,
                wt: 0,
                Mt: 0
            }],
            vt: "",
            dt: "",
            ft: 0,
            ct: 0,
            lt: null
        }
    }
    let tt = {
        from: 0,
        to: 1
    };
    class ti {
        constructor(t, i, e) {
            this.gt = new Y, this.bt = [], this.St = [], this.xt = !0, this.O = t, this.Ct = i, this.yt = e, this.gt.nt(this.bt)
        }
        kt(t) {
            this.Pt(), this.xt = !0
        }
        Tt() {
            return this.xt && (this.Rt(), this.xt = !1), this.gt
        }
        Pt() {
            let t = this.yt.Dt();
            t.length !== this.bt.length && (this.St = t.map(J), this.bt = this.St.map(t => {
                let i = new X;
                return i.ht(t), i
            }), this.gt.nt(this.bt))
        }
        Rt() {
            let t = 2 === this.Ct.N().mode || !this.Ct.It(),
                i = this.yt.Vt(),
                e = this.Ct.Bt(),
                s = this.O.Et();
            this.Pt(), i.forEach((i, h) => {
                let n = this.St[h],
                    l = i.At(e),
                    r = i.Lt();
                !t && null !== l && i.It() && null !== r ? (n.vt = l.zt, n.ft = l.ft, n.ct = l.Ot, n.ot[0].Mt = l.Mt, n.ot[0].ut = i.Ft().Nt(l.Mt, r.Wt), n.dt = l.Ht ? ? this.O.Ut(n.ot[0].ut / i.Ft().$t()), n.ot[0].wt = e, n.ot[0]._t = s.jt(e), n.lt = tt) : n.lt = null
            })
        }
    }
    class te extends j {
        constructor(t) {
            super(), this.qt = t
        }
        et({
            context: t,
            bitmapSize: i,
            horizontalPixelRatio: e,
            verticalPixelRatio: s
        }) {
            var h;
            let n;
            if (null === this.qt) return;
            let l = this.qt.Yt.It,
                r = this.qt.Kt.It;
            if (!l && !r) return;
            let o = Math.round(this.qt._t * e),
                a = Math.round(this.qt.ut * s);
            t.lineCap = "butt", l && o >= 0 && (t.lineWidth = Math.floor(this.qt.Yt.ct * e), t.strokeStyle = this.qt.Yt.R, t.fillStyle = this.qt.Yt.R, R(t, this.qt.Yt.Zt), h = i.height, t.beginPath(), n = t.lineWidth % 2 ? .5 : 0, t.moveTo(o + n, 0), t.lineTo(o + n, h), t.stroke()), r && a >= 0 && (t.lineWidth = Math.floor(this.qt.Kt.ct * s), t.strokeStyle = this.qt.Kt.R, t.fillStyle = this.qt.Kt.R, R(t, this.qt.Kt.Zt), L(t, a, 0, i.width))
        }
    }
    class ts {
        constructor(t, i) {
            this.xt = !0, this.Gt = {
                Yt: {
                    ct: 1,
                    Zt: 0,
                    R: "",
                    It: !1
                },
                Kt: {
                    ct: 1,
                    Zt: 0,
                    R: "",
                    It: !1
                },
                _t: 0,
                ut: 0
            }, this.Xt = new te(this.Gt), this.Jt = t, this.yt = i
        }
        kt() {
            this.xt = !0
        }
        Tt(t) {
            return this.xt && (this.Rt(), this.xt = !1), this.Xt
        }
        Rt() {
            let t = this.Jt.It(),
                i = this.yt.Qt().N().crosshair,
                e = this.Gt;
            2 === i.mode ? (e.Kt.It = !1, e.Yt.It = !1) : (e.Kt.It = t && this.Jt.ti(this.yt), e.Yt.It = t && this.Jt.ii(), e.Kt.ct = i.horzLine.width, e.Kt.Zt = i.horzLine.style, e.Kt.R = i.horzLine.color, e.Yt.ct = i.vertLine.width, e.Yt.Zt = i.vertLine.style, e.Yt.R = i.vertLine.color, e._t = this.Jt.ni(), e.ut = this.Jt.si())
        }
    }

    function th(t, i, e, s, h, n) {
        t.save(), t.globalCompositeOperation = "copy", t.fillStyle = n, t.fillRect(i, e, s, h), t.restore()
    }

    function tn(t, i, e, s, h, n) {
        t.beginPath(), t.roundRect ? t.roundRect(i, e, s, h, n) : (t.lineTo(i + s - n[1], e), 0 !== n[1] && t.arcTo(i + s, e, i + s, e + n[1], n[1]), t.lineTo(i + s, e + h - n[2]), 0 !== n[2] && t.arcTo(i + s, e + h, i + s - n[2], e + h, n[2]), t.lineTo(i + n[3], e + h), 0 !== n[3] && t.arcTo(i, e + h, i, e + h - n[3], n[3]), t.lineTo(i, e + n[0]), 0 !== n[0] && t.arcTo(i, e, i + n[0], e, n[0]))
    }

    function tl(t, i, e, s, h, n, l = 0, r = [0, 0, 0, 0], o = "") {
        var a;
        if (t.save(), !l || !o || o === n) return tn(t, i, e, s, h, r), t.fillStyle = n, t.fill(), void t.restore();
        let u = l / 2;
        tn(t, i + u, e + u, s - l, h - l, (a = -u, r.map(t => 0 === t ? t : t + a))), "transparent" !== n && (t.fillStyle = n, t.fill()), "transparent" !== o && (t.lineWidth = l, t.strokeStyle = o, t.closePath(), t.stroke()), t.restore()
    }

    function tr(t, i, e, s, h, n, l) {
        t.save(), t.globalCompositeOperation = "copy";
        let r = t.createLinearGradient(0, 0, 0, h);
        r.addColorStop(0, n), r.addColorStop(1, l), t.fillStyle = r, t.fillRect(i, e, s, h), t.restore()
    }
    class to {
        constructor(t, i) {
            this.ht(t, i)
        }
        ht(t, i) {
            this.qt = t, this.ei = i
        }
        $t(t, i) {
            return this.qt.It ? t.k + t.A + t.I : 0
        }
        st(t, i, e, s) {
            if (!this.qt.It || 0 === this.qt.ri.length) return;
            let h = this.qt.R,
                n = this.ei.G,
                l = t.useBitmapCoordinateSpace(t => {
                    let l = t.context;
                    l.font = i.P;
                    let r = this.hi(t, i, e, s),
                        o = r.ai;
                    return r.li ? tl(l, o.oi, o._i, o.ui, o.ci, n, o.di, [o.ft, 0, 0, o.ft], n) : tl(l, o.fi, o._i, o.ui, o.ci, n, o.di, [0, o.ft, o.ft, 0], n), this.qt.pi && (l.fillStyle = h, l.fillRect(o.fi, o.mi, o.wi - o.fi, o.Mi)), this.qt.gi && (l.fillStyle = i.D, l.fillRect(r.li ? o.bi - o.di : 0, o._i, o.di, o.Si - o._i)), r
                });
            t.useMediaCoordinateSpace(({
                context: t
            }) => {
                let e = l.xi;
                t.font = i.P, t.textAlign = l.li ? "right" : "left", t.textBaseline = "middle", t.fillStyle = h, t.fillText(this.qt.ri, e.Ci, (e._i + e.Si) / 2 + e.yi)
            })
        }
        hi(t, i, e, s) {
            let h, n, l, {
                    context: r,
                    bitmapSize: o,
                    mediaSize: a,
                    horizontalPixelRatio: u,
                    verticalPixelRatio: c
                } = t,
                d = this.qt.pi || !this.qt.ki ? i.C : 0,
                f = this.qt.Pi ? i.S : 0,
                m = i.A + this.ei.Ti,
                p = i.I + this.ei.Ri,
                v = i.V,
                g = i.B,
                w = this.qt.ri,
                b = i.k,
                M = e.Di(r, w),
                y = Math.ceil(e.Ii(r, w)),
                x = i.S + v + g + y + d,
                _ = Math.max(1, Math.floor(c)),
                S = Math.round((b + m + p) * c);
            S % 2 != _ % 2 && (S += 1);
            let C = f > 0 ? Math.max(1, Math.floor(f * u)) : 0,
                E = Math.round(x * u),
                z = Math.round(d * u),
                k = Math.round((this.ei.Vi ? ? this.ei.Bi ? ? this.ei.Ei) * c) - Math.floor(.5 * c),
                R = Math.floor(k + _ / 2 - S / 2),
                L = R + S,
                T = "right" === s,
                N = T ? a.width - f : f,
                P = T ? o.width - C : C;
            return T ? (h = P - E, n = P - z, l = N - d - v - f) : (h = P + E, n = P + z, l = N + d + v), {
                li: T,
                ai: {
                    _i: R,
                    mi: k,
                    Si: L,
                    ui: E,
                    ci: S,
                    ft: 2 * u,
                    di: C,
                    oi: h,
                    fi: P,
                    wi: n,
                    Mi: _,
                    bi: o.width
                },
                xi: {
                    _i: R / c,
                    Si: L / c,
                    Ci: l,
                    yi: M
                }
            }
        }
    }
    class ta {
        constructor(t) {
            this.Ai = {
                Ei: 0,
                G: "#000",
                Ri: 0,
                Ti: 0
            }, this.Li = {
                ri: "",
                It: !1,
                pi: !0,
                ki: !1,
                Ht: "",
                R: "#FFF",
                gi: !1,
                Pi: !1
            }, this.zi = {
                ri: "",
                It: !1,
                pi: !1,
                ki: !0,
                Ht: "",
                R: "#FFF",
                gi: !0,
                Pi: !0
            }, this.xt = !0, this.Oi = new(t || to)(this.Li, this.Ai), this.Ni = new(t || to)(this.zi, this.Ai)
        }
        ri() {
            return this.Fi(), this.Li.ri
        }
        Ei() {
            return this.Fi(), this.Ai.Ei
        }
        kt() {
            this.xt = !0
        }
        $t(t, i = !1) {
            return Math.max(this.Oi.$t(t, i), this.Ni.$t(t, i))
        }
        Wi() {
            return this.Ai.Vi ? ? null
        }
        Hi() {
            return this.Ai.Vi ? ? this.Ai.Bi ? ? this.Ei()
        }
        Ui(t) {
            this.Ai.Bi = t ? ? void 0
        }
        $i() {
            return this.Fi(), this.Li.It || this.zi.It
        }
        ji() {
            return this.Fi(), this.Li.It
        }
        Tt(t) {
            return this.Fi(), this.Li.pi = this.Li.pi && t.N().ticksVisible, this.zi.pi = this.zi.pi && t.N().ticksVisible, this.Oi.ht(this.Li, this.Ai), this.Ni.ht(this.zi, this.Ai), this.Oi
        }
        qi() {
            return this.Fi(), this.Oi.ht(this.Li, this.Ai), this.Ni.ht(this.zi, this.Ai), this.Ni
        }
        Fi() {
            this.xt && (this.Li.pi = !0, this.zi.pi = !1, this.Yi(this.Li, this.zi, this.Ai))
        }
    }
    class tu extends ta {
        constructor(t, i, e) {
            super(), this.Jt = t, this.Ki = i, this.Zi = e
        }
        Yi(t, i, e) {
            if (t.It = !1, 2 === this.Jt.N().mode) return;
            let s = this.Jt.N().horzLine;
            if (!s.labelVisible) return;
            let h = this.Ki.Lt();
            if (!this.Jt.It() || this.Ki.Gi() || null === h) return;
            let n = this.Ki.Xi().Z(s.labelBackgroundColor);
            e.G = n.G, t.R = n.X;
            let l = 2 / 12 * this.Ki.k();
            e.Ti = l, e.Ri = l;
            let r = this.Zi(this.Ki);
            e.Ei = r.Ei, t.ri = this.Ki.Ji(r.Mt, h), t.It = !0
        }
    }
    let tc = /[1-9]/g;
    class td {
        constructor() {
            this.qt = null
        }
        ht(t) {
            this.qt = t
        }
        st(t, i) {
            if (null === this.qt || !1 === this.qt.It || 0 === this.qt.ri.length) return;
            let e = t.useMediaCoordinateSpace(({
                context: t
            }) => (t.font = i.P, Math.round(i.Qi.Ii(t, P(this.qt).ri, tc))));
            if (e <= 0) return;
            let s = i.tn,
                h = e + 2 * s,
                n = h / 2,
                l = this.qt.nn,
                r = this.qt.Ei,
                o = Math.floor(r - n) + .5;
            o < 0 ? (r += Math.abs(0 - o), o = Math.floor(r - n) + .5) : o + h > l && (r -= Math.abs(l - (o + h)), o = Math.floor(r - n) + .5);
            let a = o + h,
                u = Math.ceil(0 + i.S + i.C + i.A + i.k + i.I);
            t.useBitmapCoordinateSpace(({
                context: t,
                horizontalPixelRatio: e,
                verticalPixelRatio: s
            }) => {
                let h = P(this.qt);
                t.fillStyle = h.G;
                let n = Math.round(o * e),
                    l = Math.round(0 * s),
                    r = Math.round(a * e),
                    c = Math.round(u * s),
                    d = Math.round(2 * e);
                if (t.beginPath(), t.moveTo(n, l), t.lineTo(n, c - d), t.arcTo(n, c, n + d, c, d), t.lineTo(r - d, c), t.arcTo(r, c, r, c - d, d), t.lineTo(r, l), t.fill(), h.pi) {
                    let n = Math.round(h.Ei * e),
                        r = Math.round((l + i.C) * s);
                    t.fillStyle = h.R;
                    let o = Math.max(1, Math.floor(e)),
                        a = Math.floor(.5 * e);
                    t.fillRect(n - a, l, o, r - l)
                }
            }), t.useMediaCoordinateSpace(({
                context: t
            }) => {
                let e = P(this.qt),
                    h = 0 + i.S + i.C + i.A + i.k / 2;
                t.font = i.P, t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = e.R;
                let n = i.Qi.Di(t, "Apr0");
                t.translate(o + s, h + n), t.fillText(e.ri, 0, 0)
            })
        }
    }
    class tf {
        constructor(t, i, e) {
            this.xt = !0, this.Xt = new td, this.Gt = {
                It: !1,
                G: "#4c525e",
                R: "white",
                ri: "",
                nn: 0,
                Ei: NaN,
                pi: !0
            }, this.Ct = t, this.sn = i, this.Zi = e
        }
        kt() {
            this.xt = !0
        }
        Tt() {
            return this.xt && (this.Rt(), this.xt = !1), this.Xt.ht(this.Gt), this.Xt
        }
        Rt() {
            let t = this.Gt;
            if (t.It = !1, 2 === this.Ct.N().mode) return;
            let i = this.Ct.N().vertLine;
            if (!i.labelVisible) return;
            let e = this.sn.Et();
            if (e.Gi()) return;
            t.nn = e.nn();
            let s = this.Zi();
            if (null === s) return;
            t.Ei = s.Ei;
            let h = e.en(this.Ct.Bt());
            t.ri = e.rn(P(h)), t.It = !0;
            let n = this.sn.Xi().Z(i.labelBackgroundColor);
            t.G = n.G, t.R = n.X, t.pi = e.N().ticksVisible
        }
    }
    class tm {
        constructor() {
            this.hn = null, this.an = 0
        }
        ln() {
            return this.an
        }
        _n(t) {
            this.an = t
        }
        Ft() {
            return this.hn
        }
        un(t) {
            this.hn = t
        }
        cn(t) {
            return []
        }
        dn() {
            return []
        }
        It() {
            return !0
        }
    }(n = p || (p = {}))[n.Normal = 0] = "Normal", n[n.Magnet = 1] = "Magnet", n[n.Hidden = 2] = "Hidden", n[n.MagnetOHLC = 3] = "MagnetOHLC";
    class tp extends tm {
        constructor(t, i) {
            let e, s, h, n;
            super(), this.yt = null, this.fn = NaN, this.pn = 0, this.vn = !1, this.mn = new Map, this.wn = !1, this.Mn = new WeakMap, this.gn = new WeakMap, this.bn = NaN, this.Sn = NaN, this.xn = NaN, this.Cn = NaN, this.sn = t, this.yn = i, this.kn = (e = () => this.fn, s = () => this.Sn, t => {
                let i = s(),
                    h = e();
                if (t === P(this.yt).Pn()) return {
                    Mt: h,
                    Ei: i
                }; {
                    let e = P(t.Lt());
                    return {
                        Mt: t.Tn(i, e),
                        Ei: i
                    }
                }
            });
            const l = (h = () => this.pn, n = () => this.ni(), () => {
                let t = this.sn.Et().Rn(h()),
                    i = n();
                return t && Number.isFinite(i) ? {
                    wt: t,
                    Ei: i
                } : null
            });
            this.Dn = new tf(this, t, l)
        }
        N() {
            return this.yn
        }
        In(t, i) {
            this.xn = t, this.Cn = i
        }
        Vn() {
            this.xn = NaN, this.Cn = NaN
        }
        Bn() {
            return this.xn
        }
        En() {
            return this.Cn
        }
        An(t, i, e) {
            this.wn || (this.wn = !0), this.vn = !0, this.Ln(t, i, e)
        }
        Bt() {
            return this.pn
        }
        ni() {
            return this.bn
        }
        si() {
            return this.Sn
        }
        It() {
            return this.vn
        }
        zn() {
            this.vn = !1, this.On(), this.fn = NaN, this.bn = NaN, this.Sn = NaN, this.yt = null, this.Vn(), this.Nn()
        }
        Fn(t) {
            if (!this.yn.doNotSnapToHiddenSeriesIndices) return t;
            let i = this.sn,
                e = i.Et(),
                s = null,
                h = null;
            for (let e of i.Wn()) {
                let i = e.Un().Hn(t, -1);
                if (i) {
                    if (i.$n === t) return t;
                    (null === s || i.$n > s) && (s = i.$n)
                }
                let n = e.Un().Hn(t, 1);
                if (n) {
                    if (n.$n === t) return t;
                    (null === h || n.$n < h) && (h = n.$n)
                }
            }
            let n = [s, h].filter(q);
            if (0 === n.length) return t;
            let l = e.jt(t),
                r = n.map(t => Math.abs(l - e.jt(t)));
            return n[r.indexOf(Math.min(...r))]
        }
        jn(t) {
            let i = this.Mn.get(t);
            i || (i = new ts(this, t), this.Mn.set(t, i));
            let e = this.gn.get(t);
            return e || (e = new ti(this.sn, this, t), this.gn.set(t, e)), [i, e]
        }
        ti(t) {
            return t === this.yt && this.yn.horzLine.visible
        }
        ii() {
            return this.yn.vertLine.visible
        }
        qn(t, i) {
            this.vn && this.yt === t || this.mn.clear();
            let e = [];
            return this.yt === t && e.push(this.Yn(this.mn, i, this.kn)), e
        }
        dn() {
            return this.vn ? [this.Dn] : []
        }
        Kn() {
            return this.yt
        }
        Nn() {
            this.sn.Zn().forEach(t => {
                this.Mn.get(t) ? .kt(), this.gn.get(t) ? .kt()
            }), this.mn.forEach(t => t.kt()), this.Dn.kt()
        }
        Gn(t) {
            return t && !t.Pn().Gi() ? t.Pn() : null
        }
        Ln(t, i, e) {
            this.Xn(t, i, e) && this.Nn()
        }
        Xn(t, i, e) {
            let s = this.bn,
                h = this.Sn,
                n = this.fn,
                l = this.pn,
                r = this.yt,
                o = this.Gn(e);
            this.pn = t, this.bn = isNaN(t) ? NaN : this.sn.Et().jt(t), this.yt = e;
            let a = null !== o ? o.Lt() : null;
            return null !== o && null !== a ? (this.fn = i, this.Sn = o.Nt(i, a)) : (this.fn = NaN, this.Sn = NaN), s !== this.bn || h !== this.Sn || l !== this.pn || n !== this.fn || r !== this.yt
        }
        On() {
            let t = this.sn.Jn().map(t => t.Un().Qn()).filter(q),
                i = 0 === t.length ? null : Math.max(...t);
            this.pn = null !== i ? i : NaN
        }
        Yn(t, i, e) {
            let s = t.get(i);
            return void 0 === s && (s = new tu(this, i, e), t.set(i, s)), s
        }
    }

    function tv(t) {
        return "left" === t || "right" === t
    }
    class tg {
        constructor(t) {
            this.ts = new Map, this.ns = [], this.ss = t
        }
        es(t, i) {
            var e;
            let s = (e = this.ts.get(t), void 0 === e ? i : {
                rs: Math.max(e.rs, i.rs),
                hs: e.hs || i.hs
            });
            this.ts.set(t, s)
        }
        ls() {
            return this.ss
        }
        _s(t) {
            let i = this.ts.get(t);
            return void 0 === i ? {
                rs: this.ss
            } : {
                rs: Math.max(this.ss, i.rs),
                hs: i.hs
            }
        }
        us() {
            this.cs(), this.ns = [{
                ds: 0
            }]
        }
        fs(t) {
            this.cs(), this.ns = [{
                ds: 1,
                Wt: t
            }]
        }
        ps(t) {
            this.vs(), this.ns.push({
                ds: 5,
                Wt: t
            })
        }
        cs() {
            this.vs(), this.ns.push({
                ds: 6
            })
        }
        ws() {
            this.cs(), this.ns = [{
                ds: 4
            }]
        }
        Ms(t) {
            this.cs(), this.ns.push({
                ds: 2,
                Wt: t
            })
        }
        gs(t) {
            this.cs(), this.ns.push({
                ds: 3,
                Wt: t
            })
        }
        bs() {
            return this.ns
        }
        Ss(t) {
            for (let i of t.ns) this.xs(i);
            this.ss = Math.max(this.ss, t.ss), t.ts.forEach((t, i) => {
                this.es(i, t)
            })
        }
        static Cs() {
            return new tg(2)
        }
        static ys() {
            return new tg(3)
        }
        xs(t) {
            switch (t.ds) {
                case 0:
                    this.us();
                    break;
                case 1:
                    this.fs(t.Wt);
                    break;
                case 2:
                    this.Ms(t.Wt);
                    break;
                case 3:
                    this.gs(t.Wt);
                    break;
                case 4:
                    this.ws();
                    break;
                case 5:
                    this.ps(t.Wt);
                    break;
                case 6:
                    this.vs()
            }
        }
        vs() {
            let t = this.ns.findIndex(t => 5 === t.ds); - 1 !== t && this.ns.splice(t, 1)
        }
    }
    class tw {
        formatTickmarks(t) {
            return t.map(t => this.format(t))
        }
    }

    function tb(t, i) {
        if (!B(t)) return "n/a";
        if (!F(i) || i < 0 || i > 16) throw TypeError("invalid length");
        return 0 === i ? t.toString() : ("0000000000000000" + t.toString()).slice(-i)
    }
    class tM extends tw {
        constructor(t, i) {
            if (super(), i || (i = 1), B(t) && F(t) || (t = 100), t < 0) throw TypeError("invalid base");
            this.Ki = t, this.ks = i, this.Ps()
        }
        format(t) {
            let i = t < 0 ? "−" : "";
            return t = Math.abs(t), i + this.Ts(t)
        }
        Ps() {
            if (this.Rs = 0, this.Ki > 0 && this.ks > 0) {
                let t = this.Ki;
                for (; t > 1;) t /= 10, this.Rs++
            }
        }
        Ts(t) {
            let i = this.Ki / this.ks,
                e = Math.floor(t),
                s = "",
                h = void 0 !== this.Rs ? this.Rs : NaN;
            if (i > 1) {
                let n = +(Math.round(t * i) - e * i).toFixed(this.Rs);
                n >= i && (n -= i, e += 1), s = "." + tb(n.toFixed(this.Rs) * this.ks, h)
            } else e = Math.round(e * i) / i, h > 0 && (s = "." + tb(0, h));
            return e.toFixed(0) + s
        }
    }
    class ty extends tM {
        constructor(t = 100) {
            super(t)
        }
        format(t) {
            return `${super.format(t)}%`
        }
    }
    class tx extends tw {
        constructor(t) {
            super(), this.Ds = t
        }
        format(t) {
            let i = "";
            return t < 0 && (i = "-", t = -t), t < 995 ? i + this.Is(t) : t < 999995 ? i + this.Is(t / 1e3) + "K" : t < 0x3b9ac9fb ? (t = 1e3 * Math.round(t / 1e3), i + this.Is(t / 1e6) + "M") : (t = 1e6 * Math.round(t / 1e6), i + this.Is(t / 1e9) + "B")
        }
        Is(t) {
            let i = Math.pow(10, this.Ds);
            return ((t = Math.round(t * i) / i) >= 1e-15 && t < 1 ? t.toFixed(this.Ds).replace(/\.?0+$/, "") : String(t)).replace(/(\.[1-9]*)0+$/, (t, i) => i)
        }
    }
    let t_ = /[2-9]/g;
    class tS {
        constructor(t = 50) {
            this.Vs = 0, this.Bs = 1, this.Es = 1, this.As = {}, this.Ls = new Map, this.zs = t
        }
        Os() {
            this.Vs = 0, this.Ls.clear(), this.Bs = 1, this.Es = 1, this.As = {}
        }
        Ii(t, i, e) {
            return this.Ns(t, i, e).width
        }
        Di(t, i, e) {
            let s = this.Ns(t, i, e);
            return ((s.actualBoundingBoxAscent || 0) - (s.actualBoundingBoxDescent || 0)) / 2
        }
        Ns(t, i, e) {
            let s = String(i).replace(e || t_, "0");
            if (this.Ls.has(s)) return N(this.Ls.get(s)).Fs;
            if (this.Vs === this.zs) {
                let t = this.As[this.Es];
                delete this.As[this.Es], this.Ls.delete(t), this.Es++, this.Vs--
            }
            t.save(), t.textBaseline = "middle";
            let h = t.measureText(s);
            return t.restore(), 0 === h.width && i.length || (this.Ls.set(s, {
                Fs: h,
                Ws: this.Bs
            }), this.As[this.Bs] = s, this.Vs++, this.Bs++), h
        }
    }
    class tC {
        constructor(t) {
            this.Hs = null, this.M = null, this.Us = "right", this.$s = t
        }
        js(t, i, e) {
            this.Hs = t, this.M = i, this.Us = e
        }
        st(t) {
            null !== this.M && null !== this.Hs && this.Hs.st(t, this.M, this.$s, this.Us)
        }
    }
    class tE {
        constructor(t, i, e) {
            this.qs = t, this.$s = new tS(50), this.Ys = i, this.O = e, this.F = -1, this.Xt = new tC(this.$s)
        }
        Tt() {
            let t = this.O.Ks(this.Ys);
            if (null === t) return null;
            let i = t.Zs(this.Ys) ? t.Gs() : this.Ys.Ft();
            if (null === i) return null;
            let e = t.Xs(i);
            if ("overlay" === e) return null;
            let s = this.O.Js();
            return s.k !== this.F && (this.F = s.k, this.$s.Os()), this.Xt.js(this.qs.qi(), s, e), this.Xt
        }
    }
    class tz extends j {
        constructor() {
            super(...arguments), this.qt = null
        }
        ht(t) {
            this.qt = t
        }
        Qs(t, i) {
            if (!this.qt ? .It) return null;
            let {
                ut: e,
                ct: s,
                te: h
            } = this.qt;
            return i >= e - s - 7 && i <= e + s + 7 ? {
                ie: this.qt,
                ne: Math.abs(i - e),
                se: 2,
                ee: "price-line",
                te: h
            } : null
        }
        et({
            context: t,
            bitmapSize: i,
            horizontalPixelRatio: e,
            verticalPixelRatio: s
        }) {
            if (null === this.qt || !1 === this.qt.It) return;
            let h = Math.round(this.qt.ut * s);
            h < 0 || h > i.height || (t.lineCap = "butt", t.strokeStyle = this.qt.R, t.lineWidth = Math.floor(this.qt.ct * e), R(t, this.qt.Zt), L(t, h, 0, i.width))
        }
    }
    class tk {
        constructor(t) {
            this.re = {
                ut: 0,
                R: "rgba(0, 0, 0, 0)",
                ct: 1,
                Zt: 0,
                It: !1
            }, this.he = new tz, this.xt = !0, this.ae = t, this.le = t.Qt(), this.he.ht(this.re)
        }
        kt() {
            this.xt = !0
        }
        Tt() {
            return this.ae.It() ? (this.xt && (this.oe(), this.xt = !1), this.he) : null
        }
    }
    class tR extends tk {
        constructor(t) {
            super(t)
        }
        oe() {
            this.re.It = !1;
            let t = this.ae.Ft(),
                i = t._e()._e;
            if (2 !== i && 3 !== i) return;
            let e = this.ae.N();
            if (!e.baseLineVisible || !this.ae.It()) return;
            let s = this.ae.Lt();
            null !== s && (this.re.It = !0, this.re.ut = t.Nt(s.Wt, s.Wt), this.re.R = e.baseLineColor, this.re.ct = e.baseLineWidth, this.re.Zt = e.baseLineStyle)
        }
    }
    class tL extends j {
        constructor() {
            super(...arguments), this.qt = null
        }
        ht(t) {
            this.qt = t
        }
        ue() {
            return this.qt
        }
        et({
            context: t,
            horizontalPixelRatio: i,
            verticalPixelRatio: e
        }) {
            let s = this.qt;
            if (null === s) return;
            let h = Math.max(1, Math.floor(i)),
                n = h % 2 / 2,
                l = Math.round(s.ce.x * i) + n,
                r = s.ce.y * e;
            t.fillStyle = s.de, t.beginPath();
            let o = Math.max(2, 1.5 * s.fe) * i;
            t.arc(l, r, o, 0, 2 * Math.PI, !1), t.fill(), t.fillStyle = s.pe, t.beginPath(), t.arc(l, r, s.ft * i, 0, 2 * Math.PI, !1), t.fill(), t.lineWidth = h, t.strokeStyle = s.ve, t.beginPath(), t.arc(l, r, s.ft * i + h / 2, 0, 2 * Math.PI, !1), t.stroke()
        }
    }
    let tT = [{
        me: 0,
        we: .25,
        Me: 4,
        ge: 10,
        be: .25,
        Se: 0,
        xe: .4,
        Ce: .8
    }, {
        me: .25,
        we: .525,
        Me: 10,
        ge: 14,
        be: 0,
        Se: 0,
        xe: .8,
        Ce: 0
    }, {
        me: .525,
        we: 1,
        Me: 14,
        ge: 14,
        be: 0,
        Se: 0,
        xe: 0,
        Ce: 0
    }];
    class tN {
        constructor(t) {
            this.Xt = new tL, this.xt = !0, this.ye = !0, this.ke = performance.now(), this.Pe = this.ke - 1, this.Te = t
        }
        Re() {
            this.Pe = this.ke - 1, this.kt()
        }
        De() {
            if (this.kt(), 2 === this.Te.N().lastPriceAnimation) {
                let t = performance.now(),
                    i = this.Pe - t;
                if (i > 0) return void(i < 650 && (this.Pe += 2600));
                this.ke = t, this.Pe = t + 2600
            }
        }
        kt() {
            this.xt = !0
        }
        Ie() {
            this.ye = !0
        }
        It() {
            return 0 !== this.Te.N().lastPriceAnimation
        }
        Ve() {
            switch (this.Te.N().lastPriceAnimation) {
                case 0:
                    return !1;
                case 1:
                    return !0;
                case 2:
                    return performance.now() <= this.Pe
            }
        }
        Tt() {
            return this.xt ? (this.Rt(), this.xt = !1, this.ye = !1) : this.ye && (this.Be(), this.ye = !1), this.Xt
        }
        Rt() {
            this.Xt.ht(null);
            let t = this.Te.Qt().Et(),
                i = t.Ee(),
                e = this.Te.Lt();
            if (null === i || null === e) return;
            let s = this.Te.Ae(!0);
            if (s.Le || !i.ze(s.$n)) return;
            let h = {
                    x: t.jt(s.$n),
                    y: this.Te.Ft().Nt(s.Mt, e.Wt)
                },
                n = s.R,
                l = this.Te.N().lineWidth,
                r = this.Oe(this.Ne(), n);
            this.Xt.ht({
                de: n,
                fe: l,
                pe: r.pe,
                ve: r.ve,
                ft: r.ft,
                ce: h
            })
        }
        Be() {
            let t = this.Xt.ue();
            if (null !== t) {
                let i = this.Oe(this.Ne(), t.de);
                t.pe = i.pe, t.ve = i.ve, t.ft = i.ft
            }
        }
        Ne() {
            return this.Ve() ? performance.now() - this.ke : 2599
        }
        Fe(t, i, e, s) {
            return this.Te.Qt().Xi().Y(t, e + (s - e) * i)
        }
        Oe(t, i) {
            var e;
            let s, h = t % 2600 / 2600;
            for (let t of tT)
                if (h >= t.me && h <= t.we) {
                    s = t;
                    break
                }
            T(void 0 !== s, "Last price animation internal logic error");
            let n = (h - s.me) / (s.we - s.me);
            return {
                pe: this.Fe(i, n, s.be, s.Se),
                ve: this.Fe(i, n, s.xe, s.Ce),
                ft: (e = s.Me) + (s.ge - e) * n
            }
        }
    }
    class tP extends tk {
        constructor(t) {
            super(t)
        }
        oe() {
            let t = this.re;
            t.It = !1;
            let i = this.ae.N();
            if (!i.priceLineVisible || !this.ae.It()) return;
            let e = this.ae.Ae(0 === i.priceLineSource);
            e.Le || (t.It = !0, t.ut = e.Ei, t.R = this.ae.We(e.R), t.ct = i.priceLineWidth, t.Zt = i.priceLineStyle)
        }
    }
    class tQ extends ta {
        constructor(t) {
            super(), this.Jt = t
        }
        Yi(t, i, e) {
            t.It = !1, i.It = !1;
            let s = this.Jt;
            if (!s.It()) return;
            let h = s.N(),
                n = h.lastValueVisible,
                l = "" !== s.He(),
                r = 0 === h.seriesLastValueMode,
                o = s.Ae(!1);
            if (o.Le) return;
            n && (t.ri = this.Ue(o, n, r), t.It = 0 !== t.ri.length), (l || r) && (i.ri = this.$e(o, n, l, r), i.It = i.ri.length > 0);
            let a = s.We(o.R),
                u = this.Jt.Qt().Xi().Z(a);
            e.G = u.G, e.Ei = o.Ei, i.Ht = s.Qt().Ut(o.Ei / s.Ft().$t()), t.Ht = a, t.R = u.X, i.R = u.X
        }
        $e(t, i, e, s) {
            let h = "",
                n = this.Jt.He();
            return e && 0 !== n.length && (h += `${n} `), i && s && (h += this.Jt.Ft().je() ? t.qe : t.Ye), h.trim()
        }
        Ue(t, i, e) {
            return i ? e ? this.Jt.Ft().je() ? t.Ye : t.qe : t.ri : ""
        }
    }

    function tW(t, i, e, s) {
        let h = Number.isFinite(i),
            n = Number.isFinite(e);
        return h && n ? t(i, e) : h || n ? h ? i : e : s
    }
    class tI {
        constructor(t, i) {
            this.Ke = t, this.Ze = i
        }
        Ge(t) {
            return null !== t && this.Ke === t.Ke && this.Ze === t.Ze
        }
        Xe() {
            return new tI(this.Ke, this.Ze)
        }
        Je() {
            return this.Ke
        }
        Qe() {
            return this.Ze
        }
        tr() {
            return this.Ze - this.Ke
        }
        Gi() {
            return this.Ze === this.Ke || Number.isNaN(this.Ze) || Number.isNaN(this.Ke)
        }
        Ss(t) {
            return null === t ? this : new tI(tW(Math.min, this.Je(), t.Je(), -1 / 0), tW(Math.max, this.Qe(), t.Qe(), 1 / 0))
        }
        ir(t) {
            if (!B(t) || 0 == this.Ze - this.Ke) return;
            let i = .5 * (this.Ze + this.Ke),
                e = this.Ze - i,
                s = this.Ke - i;
            e *= t, s *= t, this.Ze = i + e, this.Ke = i + s
        }
        nr(t) {
            B(t) && (this.Ze += t, this.Ke += t)
        }
        sr() {
            return {
                minValue: this.Ke,
                maxValue: this.Ze
            }
        }
        static er(t) {
            return null === t ? null : new tI(t.minValue, t.maxValue)
        }
    }
    class tB {
        constructor(t, i) {
            this.rr = t, this.hr = i || null
        }
        ar() {
            return this.rr
        }
        lr() {
            return this.hr
        }
        sr() {
            return {
                priceRange: null === this.rr ? null : this.rr.sr(),
                margins: this.hr || void 0
            }
        }
        static er(t) {
            return null === t ? null : new tB(tI.er(t.priceRange), t.margins)
        }
    }
    let tF = [2, 4, 8, 16, 32, 64, 128, 256, 512];
    class tD extends tk {
        constructor(t, i) {
            super(t), this._r = i
        }
        oe() {
            let t = this.re;
            t.It = !1;
            let i = this._r.N();
            if (!this.ae.It() || !i.lineVisible) return;
            let e = this._r.ur();
            null !== e && (t.It = !0, t.ut = e, t.R = i.color, t.ct = i.lineWidth, t.Zt = i.lineStyle, t.te = this._r.N().id)
        }
    }
    class tK extends ta {
        constructor(t, i) {
            super(), this.Te = t, this._r = i
        }
        Yi(t, i, e) {
            t.It = !1, i.It = !1;
            let s = this._r.N(),
                h = s.axisLabelVisible,
                n = "" !== s.title,
                l = this.Te;
            if (!h || !l.It()) return;
            let r = this._r.ur();
            if (null === r) return;
            n && (i.ri = s.title, i.It = !0), i.Ht = l.Qt().Ut(r / l.Ft().$t()), t.ri = this.cr(s.price), t.It = !0;
            let o = this.Te.Qt().Xi().Z(s.axisLabelColor || s.color);
            e.G = o.G;
            let a = s.axisLabelTextColor || o.X;
            t.R = a, i.R = a, e.Ei = r
        }
        cr(t) {
            let i = this.Te.Lt();
            return null === i ? "" : this.Te.Ft().Ji(t, i.Wt)
        }
    }
    class tO {
        constructor(t, i) {
            this.Te = t, this.yn = i, this.dr = new tD(t, this), this.qs = new tK(t, this), this.pr = new tE(this.qs, t, t.Qt())
        }
        vr(t) {
            I(this.yn, t), this.kt(), this.Te.Qt().mr()
        }
        N() {
            return this.yn
        }
        wr() {
            return this.dr
        }
        Mr() {
            return this.pr
        }
        gr() {
            return this.qs
        }
        kt() {
            this.dr.kt(), this.qs.kt()
        }
        ur() {
            let t = this.Te,
                i = t.Ft();
            if (t.Qt().Et().Gi() || i.Gi()) return null;
            let e = t.Lt();
            return null === e ? null : i.Nt(this.yn.price, e.Wt)
        }
    }
    class tq {
        constructor() {
            this.br = new WeakMap
        }
        Sr(t, i, e) {
            let s = 1 / i * e;
            return t >= s ? 1 : Math.min(Math.pow(2, Math.floor(Math.log2(s / t))), 512)
        }
        Cr(t, i, e, s = !1, h) {
            if (0 === t.length || i <= 1) return t;
            let n = this.yr(i);
            if (n <= 1) return t;
            let l = this.kr(t),
                r = l.Pr.get(n);
            return void 0 !== r || (r = this.Tr(t, n, e, s, h, l.Pr), l.Pr.set(n, r)), r
        }
        Rr(t, i, e, s, h = !1, n) {
            if (e < 1 || 0 === t.length) return t;
            let l = this.kr(t),
                r = l.Pr.get(e);
            if (!r) return this.Cr(t, e, s, h, n);
            let o = this.Dr(t, i, e, r, h, s, n);
            return l.Pr.set(e, o), o
        }
        yr(t) {
            if (t <= 2) return 2;
            for (let i of tF)
                if (t <= i) return i;
            return 512
        }
        Ir(t) {
            if (0 === t.length) return 0;
            let i = t[0],
                e = t[t.length - 1];
            return 31 * t.length + 17 * i.$n + 13 * e.$n
        }
        Tr(t, i, e, s = !1, h, n = new Map) {
            if (2 === i) return this.Vr(t, 2, e, s, h);
            let l = i / 2,
                r = n.get(l);
            return r || (r = this.Tr(t, l, e, s, h, n), n.set(l, r)), this.Br(r, e, s, h)
        }
        Vr(t, i, e, s = !1, h) {
            let n = this.Er(t, i, e, s, h);
            return this.Ar(n, s)
        }
        Br(t, i, e = !1, s) {
            let h = this.Er(t, 2, i, e, s);
            return this.Ar(h, e)
        }
        Er(t, i, e, s = !1, h) {
            let n = [];
            for (let l = 0; l < t.length; l += i)
                if (t.length - l >= i) {
                    let i = this.Lr(t[l], t[l + 1], e, s, h);
                    i.zr = !1, n.push(i)
                } else if (0 === n.length) n.push(this.Or(t[l], !0));
            else {
                let i = n[n.length - 1];
                n[n.length - 1] = this.Nr(i, t[l], e, s, h)
            }
            return n
        }
        Fr(t, i) {
            return (t ? ? 1) + (i ? ? 1)
        }
        Lr(t, i, e, s = !1, h) {
            if (!s || !e || !h) {
                let e = t.Wt[1] > i.Wt[1] ? t.Wt[1] : i.Wt[1],
                    s = t.Wt[2] < i.Wt[2] ? t.Wt[2] : i.Wt[2];
                return {
                    Wr: t.$n,
                    Hr: i.$n,
                    Ur: t.wt,
                    $r: i.wt,
                    jr: t.Wt[0],
                    qr: e,
                    Yr: s,
                    Kr: i.Wt[3],
                    Zr: this.Fr(t.Zr, i.Zr),
                    Gr: void 0,
                    zr: !1
                }
            }
            let n = e(this.Xr(t, h), this.Xr(i, h)),
                l = h(n),
                r = l.length ? l[l.length - 1] : 0;
            return {
                Wr: t.$n,
                Hr: i.$n,
                Ur: t.wt,
                $r: i.wt,
                jr: t.Wt[0],
                qr: Math.max(t.Wt[1], r),
                Yr: Math.min(t.Wt[2], r),
                Kr: r,
                Zr: this.Fr(t.Zr, i.Zr),
                Gr: n,
                zr: !1
            }
        }
        Nr(t, i, e, s = !1, h) {
            if (!s || !e || !h) return {
                Wr: t.Wr,
                Hr: i.$n,
                Ur: t.Ur,
                $r: i.wt,
                jr: t.jr,
                qr: t.qr > i.Wt[1] ? t.qr : i.Wt[1],
                Yr: t.Yr < i.Wt[2] ? t.Yr : i.Wt[2],
                Kr: i.Wt[3],
                Zr: t.Zr + (i.Zr ? ? 1),
                Gr: t.Gr,
                zr: !1
            };
            let n = t.Gr,
                l = this.Xr(i, h),
                r = n ? {
                    data: n,
                    index: t.Wr,
                    originalTime: t.Ur,
                    time: t.Ur,
                    priceValues: h(n)
                } : null,
                o = r ? e(r, l) : l.data,
                a = r ? h(o) : l.priceValues,
                u = a.length ? a[a.length - 1] : 0;
            return {
                Wr: t.Wr,
                Hr: i.$n,
                Ur: t.Ur,
                $r: i.wt,
                jr: t.jr,
                qr: Math.max(t.qr, u),
                Yr: Math.min(t.Yr, u),
                Kr: u,
                Zr: t.Zr + (i.Zr ? ? 1),
                Gr: o,
                zr: !1
            }
        }
        Jr(t, i, e, s, h, n, l = !1, r) {
            let o = i === s ? h : t[i];
            if (e - i == 1) return this.Or(o, !0);
            let a = i + 1 === s ? h : t[i + 1],
                u = this.Lr(o, a, n, l, r);
            for (let o = i + 2; o < e; o++) {
                let i = o === s ? h : t[o];
                u = this.Nr(u, i, n, l, r)
            }
            return u
        }
        Xr(t, i) {
            let e = t.ue ? ? {};
            return {
                data: t.ue,
                index: t.$n,
                originalTime: t.Qr,
                time: t.wt,
                priceValues: i(e)
            }
        }
        th(t, i = !1) {
            let e = !0 === i,
                s = !!t.Gr;
            return { ...{
                    $n: t.Wr,
                    wt: t.Ur,
                    Qr: t.Ur,
                    Wt: [e ? t.Kr : t.jr, t.qr, t.Yr, t.Kr],
                    Zr: t.Zr
                },
                ue: e ? s ? t.Gr : {
                    wt: t.Ur
                } : void 0
            }
        }
        Ar(t, i = !1) {
            return t.map(t => this.th(t, i))
        }
        Dr(t, i, e, s, h = !1, n, l) {
            if (0 === s.length) return s;
            let r = t.length - 1,
                o = Math.floor(r / e) * e;
            if (Math.min(o + e, t.length) - o < e && t.length > e) {
                let s = t.slice();
                return s[s.length - 1] = i, this.Cr(s, e, n, h, l)
            }
            if (Math.floor((r - 1) / e) === Math.floor(r / e) || 1 === s.length) {
                let a = Math.min(o + e, t.length),
                    u = a - o;
                if (u <= 0) return s;
                let c = 1 === u ? this.Or(o === r ? i : t[o], !0) : this.Jr(t, o, a, r, i, n, h, l);
                return s[s.length - 1] = this.th(c, h), s
            } {
                let s = t.slice();
                return s[s.length - 1] = i, this.Cr(s, e, n, h, l)
            }
        }
        Or(t, i = !1) {
            return {
                Wr: t.$n,
                Hr: t.$n,
                Ur: t.wt,
                $r: t.wt,
                jr: t.Wt[0],
                qr: t.Wt[1],
                Yr: t.Wt[2],
                Kr: t.Wt[3],
                Zr: t.Zr ? ? 1,
                Gr: t.ue,
                zr: i
            }
        }
        kr(t) {
            let i = this.ih(t),
                e = this.Ir(t);
            return i.nh !== e && (i.Pr.clear(), i.nh = e), i
        }
        ih(t) {
            let i = this.br.get(t);
            return void 0 === i && (i = {
                nh: this.Ir(t),
                Pr: new Map
            }, this.br.set(t, i)), i
        }
    }
    class t$ extends tm {
        constructor(t) {
            super(), this.sn = t
        }
        Qt() {
            return this.sn
        }
    }
    let tV = {
        Bar: (t, i, e, s) => {
            let h = i.upColor,
                n = i.downColor,
                l = P(t(e, s)),
                r = Q(l.Wt[0]) <= Q(l.Wt[3]);
            return {
                sh: l.R ? ? (r ? h : n)
            }
        },
        Candlestick: (t, i, e, s) => {
            let h = i.upColor,
                n = i.downColor,
                l = i.borderUpColor,
                r = i.borderDownColor,
                o = i.wickUpColor,
                a = i.wickDownColor,
                u = P(t(e, s)),
                c = Q(u.Wt[0]) <= Q(u.Wt[3]);
            return {
                sh: u.R ? ? (c ? h : n),
                eh: u.Ht ? ? (c ? l : r),
                rh: u.hh ? ? (c ? o : a)
            }
        },
        Custom: (t, i, e, s) => ({
            sh: P(t(e, s)).R ? ? i.color
        }),
        Area: (t, i, e, s) => {
            let h = P(t(e, s));
            return {
                sh: h.vt ? ? i.lineColor,
                vt: h.vt ? ? i.lineColor,
                ah: h.ah ? ? i.topColor,
                oh: h.oh ? ? i.bottomColor
            }
        },
        Baseline: (t, i, e, s) => {
            let h = P(t(e, s));
            return {
                sh: h.Wt[3] >= i.baseValue.price ? i.topLineColor : i.bottomLineColor,
                _h: h._h ? ? i.topLineColor,
                uh: h.uh ? ? i.bottomLineColor,
                dh: h.dh ? ? i.topFillColor1,
                fh: h.fh ? ? i.topFillColor2,
                ph: h.ph ? ? i.bottomFillColor1,
                mh: h.mh ? ? i.bottomFillColor2
            }
        },
        Line: (t, i, e, s) => {
            let h = P(t(e, s));
            return {
                sh: h.R ? ? i.color,
                vt: h.R ? ? i.color
            }
        },
        Histogram: (t, i, e, s) => ({
            sh: P(t(e, s)).R ? ? i.color
        })
    };
    class tZ {
        constructor(t) {
            this.wh = (t, i) => void 0 !== i ? i.Wt : this.Te.Un().Mh(t), this.Te = t, this.gh = tV[t.bh()]
        }
        Sh(t, i) {
            return this.gh(this.wh, this.Te.N(), t, i)
        }
    }

    function tA(t, i, e, s, h = 0, n = i.length) {
        let l = n - h;
        for (; 0 < l;) {
            let n = l >> 1,
                r = h + n;
            s(i[r], e) === t ? (h = r + 1, l -= n + 1) : l = n
        }
        return h
    }
    let tH = tA.bind(null, !0),
        tG = tA.bind(null, !1);
    (l = v || (v = {}))[l.NearestLeft = -1] = "NearestLeft", l[l.None = 0] = "None", l[l.NearestRight = 1] = "NearestRight";
    class tU {
        constructor() {
            this.xh = [], this.Ch = new Map, this.yh = new Map, this.kh = []
        }
        Ph() {
            return this.Th() > 0 ? this.xh[this.xh.length - 1] : null
        }
        Rh() {
            return this.Th() > 0 ? this.Dh(0) : null
        }
        Qn() {
            return this.Th() > 0 ? this.Dh(this.xh.length - 1) : null
        }
        Th() {
            return this.xh.length
        }
        Gi() {
            return 0 === this.Th()
        }
        ze(t) {
            return null !== this.Ih(t, 0)
        }
        Mh(t) {
            return this.Hn(t)
        }
        Hn(t, i = 0) {
            let e = this.Ih(t, i);
            return null === e ? null : { ...this.Vh(e),
                $n: this.Dh(e)
            }
        }
        Bh() {
            return this.xh
        }
        Eh(t, i, e) {
            if (this.Gi()) return null;
            let s = null;
            for (let h of e) s = tY(s, this.Ah(t, i, h));
            return s
        }
        ht(t) {
            this.yh.clear(), this.Ch.clear(), this.xh = t, this.kh = t.map(t => t.$n)
        }
        Lh() {
            return this.kh
        }
        Dh(t) {
            return this.xh[t].$n
        }
        Vh(t) {
            return this.xh[t]
        }
        Ih(t, i) {
            let e = this.zh(t);
            if (null === e && 0 !== i) switch (i) {
                case -1:
                    return this.Oh(t);
                case 1:
                    return this.Nh(t);
                default:
                    throw TypeError("Unknown search mode")
            }
            return e
        }
        Oh(t) {
            let i = this.Fh(t);
            return i > 0 && (i -= 1), i !== this.xh.length && this.Dh(i) < t ? i : null
        }
        Nh(t) {
            let i = this.Wh(t);
            return i !== this.xh.length && t < this.Dh(i) ? i : null
        }
        zh(t) {
            let i = this.Fh(t);
            return i === this.xh.length || t < this.xh[i].$n ? null : i
        }
        Fh(t) {
            return tH(this.xh, t, (t, i) => t.$n < i)
        }
        Wh(t) {
            return tG(this.xh, t, (t, i) => t.$n > i)
        }
        Hh(t, i, e) {
            let s = null;
            for (let h = t; h < i; h++) {
                let t = this.xh[h].Wt[e];
                Number.isNaN(t) || (null === s ? s = {
                    Uh: t,
                    $h: t
                } : (t < s.Uh && (s.Uh = t), t > s.$h && (s.$h = t)))
            }
            return s
        }
        Ah(t, i, e) {
            if (this.Gi()) return null;
            let s = null,
                h = P(this.Rh()),
                n = P(this.Qn()),
                l = Math.max(t, h),
                r = Math.min(i, n),
                o = 30 * Math.ceil(l / 30),
                a = Math.max(o, 30 * Math.floor(r / 30)); {
                let t = this.Fh(l),
                    h = this.Wh(Math.min(r, o, i));
                s = tY(s, this.Hh(t, h, e))
            }
            let u = this.Ch.get(e);
            void 0 === u && (u = new Map, this.Ch.set(e, u));
            for (let t = Math.max(o + 1, l); t < a; t += 30) {
                let i = Math.floor(t / 30),
                    h = u.get(i);
                if (void 0 === h) {
                    let t = this.Fh(30 * i),
                        s = this.Wh((i + 1) * 30 - 1);
                    h = this.Hh(t, s, e), u.set(i, h)
                }
                s = tY(s, h)
            } {
                let t = this.Fh(a),
                    i = this.Wh(r);
                s = tY(s, this.Hh(t, i, e))
            }
            return s
        }
    }

    function tY(t, i) {
        return null === t ? i : null === i ? t : {
            Uh: Math.min(t.Uh, i.Uh),
            $h: Math.max(t.$h, i.$h)
        }
    }
    let tj = {
        setLineStyle: R
    };
    class tX {
        constructor(t) {
            this.jh = t
        }
        st(t, i, e) {
            this.jh.draw(t, tj)
        }
        qh(t, i, e) {
            this.jh.drawBackground ? .(t, tj)
        }
    }
    class tJ {
        constructor(t) {
            this.Ls = null, this.Yh = t
        }
        Tt() {
            let t = this.Yh.renderer();
            if (null === t) return null;
            if (this.Ls ? .Kh === t) return this.Ls.Zh;
            let i = new tX(t);
            return this.Ls = {
                Kh: t,
                Zh: i
            }, i
        }
        Gh() {
            return this.Yh.zOrder ? .() ? ? "normal"
        }
    }
    class t0 {
        constructor(t) {
            this.Xh = null, this.Jh = t
        }
        Qh() {
            return this.Jh
        }
        Nn() {
            this.Jh.updateAllViews ? .()
        }
        jn() {
            let t = this.Jh.paneViews ? .() ? ? [];
            if (this.Xh ? .Kh === t) return this.Xh.Zh;
            let i = t.map(t => new tJ(t));
            return this.Xh = {
                Kh: t,
                Zh: i
            }, i
        }
        Qs(t, i) {
            return this.Jh.hitTest ? .(t, i) ? ? null
        }
    }
    let t1 = class extends t0 {
        cn() {
            return []
        }
    };
    class t2 {
        constructor(t) {
            this.jh = t
        }
        st(t, i, e) {
            this.jh.draw(t, tj)
        }
        qh(t, i, e) {
            this.jh.drawBackground ? .(t, tj)
        }
    }
    class t3 {
        constructor(t) {
            this.Ls = null, this.Yh = t
        }
        Tt() {
            let t = this.Yh.renderer();
            if (null === t) return null;
            if (this.Ls ? .Kh === t) return this.Ls.Zh;
            let i = new t2(t);
            return this.Ls = {
                Kh: t,
                Zh: i
            }, i
        }
        Gh() {
            return this.Yh.zOrder ? .() ? ? "normal"
        }
    }

    function t5(t) {
        return {
            ri: t.text(),
            Ei: t.coordinate(),
            Vi: t.fixedCoordinate ? .(),
            R: t.textColor(),
            G: t.backColor(),
            It: t.visible ? .() ? ? !0,
            pi: t.tickVisible ? .() ? ? !0
        }
    }
    class t6 {
        constructor(t, i) {
            this.Xt = new td, this.ta = t, this.ia = i
        }
        Tt() {
            return this.Xt.ht({
                nn: this.ia.nn(),
                ...t5(this.ta)
            }), this.Xt
        }
    }
    class t4 extends ta {
        constructor(t, i) {
            super(), this.ta = t, this.Ki = i
        }
        Yi(t, i, e) {
            let s = t5(this.ta);
            e.G = s.G, t.R = s.R;
            let h = 2 / 12 * this.Ki.k();
            e.Ti = h, e.Ri = h, e.Ei = s.Ei, e.Vi = s.Vi, t.ri = s.ri, t.It = s.It, t.pi = s.pi
        }
    }
    class t9 extends t0 {
        constructor(t, i) {
            super(t), this.na = null, this.sa = null, this.ea = null, this.ra = null, this.Te = i
        }
        dn() {
            let t = this.Jh.timeAxisViews ? .() ? ? [];
            if (this.na ? .Kh === t) return this.na.Zh;
            let i = this.Te.Qt().Et(),
                e = t.map(t => new t6(t, i));
            return this.na = {
                Kh: t,
                Zh: e
            }, e
        }
        qn() {
            let t = this.Jh.priceAxisViews ? .() ? ? [];
            if (this.sa ? .Kh === t) return this.sa.Zh;
            let i = this.Te.Ft(),
                e = t.map(t => new t4(t, i));
            return this.sa = {
                Kh: t,
                Zh: e
            }, e
        }
        ha() {
            let t = this.Jh.priceAxisPaneViews ? .() ? ? [];
            if (this.ea ? .Kh === t) return this.ea.Zh;
            let i = t.map(t => new t3(t));
            return this.ea = {
                Kh: t,
                Zh: i
            }, i
        }
        aa() {
            let t = this.Jh.timeAxisPaneViews ? .() ? ? [];
            if (this.ra ? .Kh === t) return this.ra.Zh;
            let i = t.map(t => new t3(t));
            return this.ra = {
                Kh: t,
                Zh: i
            }, i
        }
        la(t, i) {
            return this.Jh.autoscaleInfo ? .(t, i) ? ? null
        }
    }

    function t7(t, i, e, s) {
        t.forEach(t => {
            i(t).forEach(t => {
                t.Gh() === e && s.push(t)
            })
        })
    }

    function t8(t) {
        return t.jn()
    }

    function it(t) {
        return t.ha()
    }

    function ii(t) {
        return t.aa()
    }
    let ie = ["Area", "Line", "Baseline"];
    class is extends t$ {
        constructor(t, i, e, s, h) {
            super(t), this.qt = new tU, this.dr = new tP(this), this.oa = [], this._a = new tR(this), this.ua = null, this.ca = null, this.da = null, this.fa = [], this.pa = new tq, this.va = new Map, this.ma = null, this.yn = e, this.wa = i;
            const n = new tQ(this);
            if (this.mn = [n], this.pr = new tE(n, this, t), ie.includes(this.wa) && (this.ua = new tN(this)), this.Ma(), this.Yh = s(this, this.Qt(), h), "Custom" === this.wa) {
                const t = this.Yh;
                t.ga && this.ba(t.ga)
            }
        }
        m() {
            null !== this.da && clearTimeout(this.da)
        }
        We(t) {
            return this.yn.priceLineColor || t
        }
        Ae(t) {
            let i, e, s = {
                    Le: !0
                },
                h = this.Ft();
            if (this.Qt().Et().Gi() || h.Gi() || this.qt.Gi()) return s;
            let n = this.Qt().Et().Ee(),
                l = this.Lt();
            if (null === n || null === l) return s;
            if (t) {
                let t = this.qt.Ph();
                if (null === t) return s;
                i = t, e = t.$n
            } else {
                let t = this.qt.Hn(n.bi(), -1);
                if (null === t || null === (i = this.qt.Mh(t.$n))) return s;
                e = t.$n
            }
            let r = i.Wt[3],
                o = this.Sa().Sh(e, {
                    Wt: i
                }),
                a = h.Nt(r, l.Wt);
            return {
                Le: !1,
                Mt: r,
                ri: h.Ji(r, l.Wt),
                qe: h.xa(r),
                Ye: h.Ca(r, l.Wt),
                R: o.sh,
                Ei: a,
                $n: e
            }
        }
        Sa() {
            return null !== this.ca || (this.ca = new tZ(this)), this.ca
        }
        N() {
            return this.yn
        }
        vr(t) {
            let i = this.Qt(),
                {
                    priceScaleId: e,
                    visible: s,
                    priceFormat: h
                } = t;
            void 0 !== e && e !== this.yn.priceScaleId && i.ya(this, e), void 0 !== s && s !== this.yn.visible && i.ka();
            let n = void 0 !== t.conflationThresholdFactor;
            I(this.yn, t), n && (this.va.clear(), this.Qt().mr()), void 0 !== h && (this.Ma(), i.Pa()), i.Ta(this), i.Ra(), this.Yh.kt("options")
        }
        ht(t, i) {
            this.qt.ht(t), this.va.clear();
            let e = this.Qt().Et().N();
            e.enableConflation && e.precomputeConflationOnInit && this.Da(e.precomputeConflationPriority), this.Yh.kt("data"), null !== this.ua && (i && i.Ia ? this.ua.De() : 0 === t.length && this.ua.Re());
            let s = this.Qt().Ks(this);
            this.Qt().Va(s), this.Qt().Ta(this), this.Qt().Ra(), this.Qt().mr()
        }
        Ba(t) {
            let i = new tO(this, t);
            return this.oa.push(i), this.Qt().Ta(this), i
        }
        Ea(t) {
            let i = this.oa.indexOf(t); - 1 !== i && this.oa.splice(i, 1), this.Qt().Ta(this)
        }
        Aa() {
            return this.oa
        }
        bh() {
            return this.wa
        }
        Lt() {
            let t = this.La();
            return null === t ? null : {
                Wt: t.Wt[3],
                za: t.wt
            }
        }
        La() {
            let t = this.Qt().Et().Ee();
            if (null === t) return null;
            let i = t.Oa();
            return this.qt.Hn(i, 1)
        }
        Un() {
            return this.qt
        }
        ba(t) {
            this.ma = t, this.va.clear()
        }
        Na() {
            return !!this.Qt().Et().N().enableConflation && this.Fa() > 1
        }
        Rr(t) {
            if (!this.Na()) return;
            let i = this.Fa();
            if (!this.va.has(i)) return;
            let e = "Custom" === this.wa,
                s = e && this.ma || void 0,
                h = e && this.Yh.Wa ? t => {
                    let i = this.Yh.Wa(t);
                    return Array.isArray(i) ? i : ["number" == typeof i ? i : 0]
                } : void 0,
                n = this.pa.Rr(this.qt.Bh(), t, i, s, e, h),
                l = new tU;
            l.ht(n), this.va.set(i, l)
        }
        Ha() {
            let t = this.Qt().Et().N().enableConflation;
            if ("Custom" === this.wa && null === this.ma || !t) return this.qt;
            let i = this.Fa(),
                e = this.va.get(i);
            return e || (this.Ua(i), this.va.get(i) ? ? this.qt)
        }
        $a(t) {
            let i = this.qt.Mh(t);
            return null === i ? null : "Bar" === this.wa || "Candlestick" === this.wa || "Custom" === this.wa ? {
                jr: i.Wt[0],
                qr: i.Wt[1],
                Yr: i.Wt[2],
                Kr: i.Wt[3]
            } : i.Wt[3]
        }
        ja(t) {
            let i = [];
            t7(this.fa, t8, "top", i);
            let e = this.ua;
            return null !== e && e.It() && (null === this.da && e.Ve() && (this.da = setTimeout(() => {
                this.da = null, this.Qt().qa()
            }, 0)), e.Ie(), i.unshift(e)), i
        }
        jn() {
            let t = [];
            this.Ya() || t.push(this._a), t.push(this.Yh, this.dr);
            let i = this.oa.map(t => t.wr());
            return t.push(...i), t7(this.fa, t8, "normal", t), t
        }
        Ka() {
            return this.Za(t8, "bottom")
        }
        Ga(t) {
            return this.Za(it, t)
        }
        Xa(t) {
            return this.Za(ii, t)
        }
        Ja(t, i) {
            return this.fa.map(e => e.Qs(t, i)).filter(t => null !== t)
        }
        cn() {
            return [this.pr, ...this.oa.map(t => t.Mr())]
        }
        qn(t, i) {
            if (i !== this.hn && !this.Ya()) return [];
            let e = [...this.mn];
            for (let t of this.oa) e.push(t.gr());
            return this.fa.forEach(t => {
                e.push(...t.qn())
            }), e
        }
        dn() {
            let t = [];
            return this.fa.forEach(i => {
                t.push(...i.dn())
            }), t
        }
        la(t, i) {
            if (void 0 !== this.yn.autoscaleInfoProvider) {
                let e = this.yn.autoscaleInfoProvider(() => {
                    let e = this.Qa(t, i);
                    return null === e ? null : e.sr()
                });
                return tB.er(e)
            }
            return this.Qa(t, i)
        }
        Kh() {
            let t = this.yn.priceFormat;
            return t.base ? ? 1 / t.minMove
        }
        tl() {
            return this.il
        }
        Nn() {
            for (let t of (this.Yh.kt(), this.mn)) t.kt();
            for (let t of this.oa) t.kt();
            this.dr.kt(), this._a.kt(), this.ua ? .kt(), this.fa.forEach(t => t.Nn())
        }
        Ft() {
            return P(super.Ft())
        }
        At(t) {
            if (!(("Line" === this.wa || "Area" === this.wa || "Baseline" === this.wa) && this.yn.crosshairMarkerVisible)) return null;
            let i = this.qt.Mh(t);
            return null === i ? null : {
                Mt: i.Wt[3],
                ft: this.nl(),
                Ht: this.sl(),
                Ot: this.el(),
                zt: this.rl(t)
            }
        }
        He() {
            return this.yn.title
        }
        It() {
            return this.yn.visible
        }
        hl(t) {
            this.fa.push(new t9(t, this))
        }
        al(t) {
            this.fa = this.fa.filter(i => i.Qh() !== t)
        }
        ll() {
            if ("Custom" === this.wa) return t => this.Yh.Wa(t)
        }
        ol() {
            if ("Custom" === this.wa) return t => this.Yh._l(t)
        }
        ul() {
            return this.qt.Lh()
        }
        Ya() {
            return !tv(this.Ft().cl())
        }
        Qa(t, i) {
            if (!F(t) || !F(i) || this.qt.Gi()) return null;
            let e = "Line" === this.wa || "Area" === this.wa || "Baseline" === this.wa || "Histogram" === this.wa ? [3] : [2, 1],
                s = this.qt.Eh(t, i, e),
                h = null !== s ? new tI(s.Uh, s.$h) : null,
                n = null;
            if ("Histogram" === this.bh()) {
                let t = this.yn.base,
                    i = new tI(t, t);
                h = null !== h ? h.Ss(i) : i
            }
            return this.fa.forEach(e => {
                let s = e.la(t, i);
                if (s ? .priceRange) {
                    let t = new tI(s.priceRange.minValue, s.priceRange.maxValue);
                    h = null !== h ? h.Ss(t) : t
                }
                s ? .margins && (n = s.margins)
            }), new tB(h, n)
        }
        nl() {
            switch (this.wa) {
                case "Line":
                case "Area":
                case "Baseline":
                    return this.yn.crosshairMarkerRadius
            }
            return 0
        }
        sl() {
            switch (this.wa) {
                case "Line":
                case "Area":
                case "Baseline":
                    {
                        let t = this.yn.crosshairMarkerBorderColor;
                        if (0 !== t.length) return t
                    }
            }
            return null
        }
        el() {
            switch (this.wa) {
                case "Line":
                case "Area":
                case "Baseline":
                    return this.yn.crosshairMarkerBorderWidth
            }
            return 0
        }
        rl(t) {
            switch (this.wa) {
                case "Line":
                case "Area":
                case "Baseline":
                    {
                        let t = this.yn.crosshairMarkerBackgroundColor;
                        if (0 !== t.length) return t
                    }
            }
            return this.Sa().Sh(t).sh
        }
        Ma() {
            switch (this.yn.priceFormat.type) {
                case "custom":
                    {
                        let t = this.yn.priceFormat.formatter;this.il = {
                            format: t,
                            formatTickmarks: this.yn.priceFormat.tickmarksFormatter ? ? (i => i.map(t))
                        };
                        break
                    }
                case "volume":
                    this.il = new tx(this.yn.priceFormat.precision);
                    break;
                case "percent":
                    this.il = new ty(this.yn.priceFormat.precision);
                    break;
                default:
                    {
                        let t = Math.pow(10, this.yn.priceFormat.precision);this.il = new tM(t, this.yn.priceFormat.minMove * t)
                    }
            }
            null !== this.hn && this.hn.dl()
        }
        Za(t, i) {
            let e = [];
            return t7(this.fa, t, i, e), e
        }
        Fa() {
            let {
                fl: t,
                pl: i,
                vl: e
            } = this.ml();
            return this.pa.Sr(t, i, e)
        }
        ml() {
            let t = this.Qt().Et(),
                i = t.fl(),
                e = window.devicePixelRatio || 1,
                s = t.N().conflationThresholdFactor;
            return {
                fl: i,
                pl: e,
                vl: this.yn.conflationThresholdFactor ? ? s ? ? 1
            }
        }
        wl(t) {
            let i, e = this.qt.Bh();
            if ("Custom" === this.wa && null !== this.ma) {
                let s = this.ll();
                if (!s) throw Error("Custom series with conflation reducer must have a priceValueBuilder method");
                i = this.pa.Cr(e, t, this.ma, !0, t => s(t))
            } else i = this.pa.Cr(e, t);
            let s = new tU;
            return s.ht(i), s
        }
        Ua(t) {
            let i = this.wl(t);
            this.va.set(t, i)
        }
        Da(t) {
            if ("Custom" !== this.wa || null !== this.ma && this.ll())
                for (let i of (this.va.clear(), this.Qt().Et().Ml())) {
                    let e = () => {
                            this.gl(i)
                        },
                        s = "object" == typeof window && window || "object" == typeof self && self;
                    s ? .Sl ? .bl ? s.Sl.bl(() => {
                        e()
                    }, {
                        se: t
                    }) : Promise.resolve().then(() => e())
                }
        }
        gl(t) {
            if (this.va.has(t) || 0 === this.qt.Bh().length) return;
            let i = this.wl(t);
            this.va.set(t, i)
        }
    }
    let ih = [3],
        il = [0, 1, 2, 3];
    class ir {
        constructor(t) {
            this.yn = t
        }
        xl(t, i, e) {
            if (0 === this.yn.mode) return t;
            let s = e.Pn(),
                h = s.Lt();
            if (null === h) return t;
            let n = s.Nt(t, h),
                l = e.Cl().filter(t => t instanceof is).reduce((t, s) => {
                    if (e.Zs(s) || !s.It()) return t;
                    let h = s.Ft(),
                        n = s.Un();
                    if (h.Gi() || !n.ze(i)) return t;
                    let l = n.Mh(i);
                    if (null === l) return t;
                    let r = Q(s.Lt()),
                        o = 3 === this.yn.mode ? il : ih;
                    return t.concat(o.map(t => h.Nt(l.Wt[t], r.Wt)))
                }, []);
            if (0 === l.length) return t;
            l.sort((t, i) => Math.abs(t - n) - Math.abs(i - n));
            let r = l[0];
            return s.Tn(r, h)
        }
    }

    function io(t, i, e) {
        return Math.min(Math.max(t, i), e)
    }
    class ia extends j {
        constructor() {
            super(...arguments), this.qt = null
        }
        ht(t) {
            this.qt = t
        }
        et({
            context: t,
            bitmapSize: i,
            horizontalPixelRatio: e,
            verticalPixelRatio: s
        }) {
            var h;
            if (null === this.qt) return;
            let n = Math.max(1, Math.floor(e));
            t.lineWidth = n, h = () => {
                let h = P(this.qt);
                if (h.yl) {
                    for (let s of (t.strokeStyle = h.kl, R(t, h.Pl), t.beginPath(), h.Tl)) {
                        let h = Math.round(s.Rl * e);
                        t.moveTo(h, -n), t.lineTo(h, i.height + n)
                    }
                    t.stroke()
                }
                if (h.Dl) {
                    for (let e of (t.strokeStyle = h.Il, R(t, h.Vl), t.beginPath(), h.Bl)) {
                        let h = Math.round(e.Rl * s);
                        t.moveTo(-n, h), t.lineTo(i.width + n, h)
                    }
                    t.stroke()
                }
            }, t.save(), t.lineWidth % 2 && t.translate(.5, .5), h(), t.restore()
        }
    }
    class iu {
        constructor(t) {
            this.Xt = new ia, this.xt = !0, this.yt = t
        }
        kt() {
            this.xt = !0
        }
        Tt() {
            if (this.xt) {
                let t = this.yt.Qt().N().grid,
                    i = {
                        Dl: t.horzLines.visible,
                        yl: t.vertLines.visible,
                        Il: t.horzLines.color,
                        kl: t.vertLines.color,
                        Vl: t.horzLines.style,
                        Pl: t.vertLines.style,
                        Bl: this.yt.Pn().El(),
                        Tl: (this.yt.Qt().Et().El() || []).map(t => ({
                            Rl: t.coord
                        }))
                    };
                this.Xt.ht(i), this.xt = !1
            }
            return this.Xt
        }
    }
    class ic {
        constructor(t) {
            this.Yh = new iu(t)
        }
        wr() {
            return this.Yh
        }
    }
    let id = {
        Al: 4,
        Ll: 1e-4
    };

    function im(t, i) {
        let e = 100 * (t - i) / i;
        return i < 0 ? -e : e
    }

    function ip(t, i) {
        let e = 100 * (t - i) / i + 100;
        return i < 0 ? -e : e
    }

    function iv(t, i) {
        let e = Math.abs(t);
        if (e < 1e-15) return 0;
        let s = Math.log10(e + i.Ll) + i.Al;
        return t < 0 ? -s : s
    }

    function ig(t, i) {
        let e = Math.abs(t);
        if (e < 1e-15) return 0;
        let s = Math.pow(10, e - i.Al) - i.Ll;
        return t < 0 ? -s : s
    }

    function iw(t, i) {
        return null === t ? null : new tI(iv(t.Je(), i), iv(t.Qe(), i))
    }

    function ib(t, i) {
        return null === t ? null : new tI(ig(t.Je(), i), ig(t.Qe(), i))
    }

    function iM(t) {
        if (null === t) return id;
        let i = Math.abs(t.Qe() - t.Je());
        if (i >= 1 || i < 1e-15) return id;
        let e = Math.ceil(Math.abs(Math.log10(i))),
            s = id.Al + e;
        return {
            Al: s,
            Ll: 1 / Math.pow(10, s)
        }
    }
    class iy {
        constructor(t, i) {
            if (this.zl = t, this.Ol = i, function(t) {
                    if (t < 0) return !1;
                    if (t > 1e18) return !0;
                    for (let i = t; i > 1; i /= 10)
                        if (i % 10 != 0) return !1;
                    return !0
                }(this.zl)) this.Nl = [2, 2.5, 2];
            else {
                this.Nl = [];
                for (let t = this.zl; 1 !== t;) {
                    if (t % 2 == 0) this.Nl.push(2), t /= 2;
                    else {
                        if (t % 5 != 0) throw Error("unexpected base");
                        this.Nl.push(2, 2.5), t /= 5
                    }
                    if (this.Nl.length > 100) throw Error("something wrong with base")
                }
            }
        }
        Fl(t, i, e) {
            let s = 0 === this.zl ? 0 : 1 / this.zl,
                h = Math.pow(10, Math.max(0, Math.ceil(Math.log10(t - i)))),
                n = 0,
                l = this.Ol[0];
            for (;;) {
                let t = s - h <= 1e-14 && h > s + 1e-14,
                    i = e * l - h <= 1e-14,
                    r = 1 - h <= 1e-14;
                if (!(t && i && r)) break;
                h /= l, l = this.Ol[++n % this.Ol.length]
            }
            if (h <= s + 1e-14 && (h = s), h = Math.max(1, h), this.Nl.length > 0 && 1e-14 > Math.abs(h - 1))
                for (n = 0, l = this.Nl[0]; e * l - h <= 1e-14 && h > s + 1e-14;) h /= l, l = this.Nl[++n % this.Nl.length];
            return h
        }
    }
    class ix {
        constructor(t, i, e, s) {
            this.Wl = [], this.Ki = t, this.zl = i, this.Hl = e, this.Ul = s
        }
        Fl(t, i) {
            if (t < i) throw Error("high < low");
            let e = this.Ki.$t(),
                s = (t - i) * this.$l() / e,
                h = new iy(this.zl, [2, 2.5, 2]),
                n = new iy(this.zl, [2, 2, 2.5]),
                l = new iy(this.zl, [2.5, 2, 2]),
                r = [];
            return r.push(h.Fl(t, i, s), n.Fl(t, i, s), l.Fl(t, i, s)),
                function(t) {
                    if (t.length < 1) throw Error("array is empty");
                    let i = t[0];
                    for (let e = 1; e < t.length; ++e) t[e] < i && (i = t[e]);
                    return i
                }(r)
        }
        jl() {
            let t = this.Ki,
                i = t.Lt();
            if (null === i) return void(this.Wl = []);
            let e = t.$t(),
                s = this.Hl(e - 1, i),
                h = this.Hl(0, i),
                n = this.Ki.N().entireTextOnly ? this.ql() / 2 : 0,
                l = e - 1 - n,
                r = Math.max(s, h),
                o = Math.min(s, h);
            if (r === o) return void(this.Wl = []);
            let a = this.Fl(r, o);
            if (this.Yl(i, a, r, o, n, l), t.Kl() && this.Zl(a, o, r)) {
                let t = this.Ki.Gl();
                this.Xl(i, a, n, l, t, 2 * t)
            }
            let u = this.Wl.map(t => t.Jl),
                c = this.Ki.Ql(u);
            for (let t = 0; t < this.Wl.length; t++) this.Wl[t].io = c[t]
        }
        El() {
            return this.Wl
        }
        ql() {
            return this.Ki.k()
        }
        $l() {
            return Math.ceil(this.ql() * this.Ki.N().tickMarkDensity)
        }
        Yl(t, i, e, s, h, n) {
            let l = this.Wl,
                r = this.Ki,
                o = e % i;
            o += o < 0 ? i : 0;
            let a = e >= s ? 1 : -1,
                u = null,
                c = 0;
            for (let d = e - o; d > s; d -= i) {
                let e = this.Ul(d, t, !0);
                null !== u && Math.abs(e - u) < this.$l() || e < h || e > n || (c < l.length ? (l[c].Rl = e, l[c].io = r.no(d), l[c].Jl = d) : l.push({
                    Rl: e,
                    io: r.no(d),
                    Jl: d
                }), c++, u = e, r.so() && (i = this.Fl(d * a, s)))
            }
            l.length = c
        }
        Xl(t, i, e, s, h, n) {
            let l = this.Wl,
                r = this.eo(t, e, h, n),
                o = this.eo(t, s, -n, -h),
                a = this.Ul(0, t, !0) - this.Ul(i, t, !0);
            l.length > 0 && l[0].Rl - r.Rl < a / 2 && l.shift(), l.length > 0 && o.Rl - l[l.length - 1].Rl < a / 2 && l.pop(), l.unshift(r), l.push(o)
        }
        eo(t, i, e, s) {
            let h = this.Hl(i + e, t),
                n = this.Hl(i + s, t),
                l = Math.min(h, n),
                r = Math.max(h, n),
                o = Math.max(.1, this.Fl(r, l)),
                a = this.Hl(i + (e + s) / 2, t),
                u = a - a % o,
                c = this.Ul(u, t, !0);
            return {
                io: this.Ki.no(u),
                Rl: c,
                Jl: u
            }
        }
        Zl(t, i, e) {
            let s = Q(this.Ki.ar());
            return this.Ki.so() && (s = ib(s, this.Ki.ro())), s.Je() - i < t && e - s.Qe() < t
        }
    }

    function i_(t) {
        return t.slice().sort((t, i) => P(t.ln()) - P(i.ln()))
    }(r = g || (g = {}))[r.Normal = 0] = "Normal", r[r.Logarithmic = 1] = "Logarithmic", r[r.Percentage = 2] = "Percentage", r[r.IndexedTo100 = 3] = "IndexedTo100";
    let iS = new ty,
        iC = new tM(100, 1);
    class iE {
        constructor(t, i, e, s, h) {
            this.ho = 0, this.ao = null, this.rr = null, this.lo = null, this.oo = {
                _o: !1,
                uo: null
            }, this.co = !1, this.do = 0, this.fo = 0, this.po = new W, this.vo = new W, this.mo = [], this.wo = null, this.Mo = null, this.bo = null, this.So = null, this.xo = null, this.il = iC, this.Co = iM(null), this.yo = t, this.yn = i, this.ko = e, this.Po = s, this.To = h, this.Ro = new ix(this, 100, this.Do.bind(this), this.Io.bind(this))
        }
        cl() {
            return this.yo
        }
        N() {
            return this.yn
        }
        vr(t) {
            if (I(this.yn, t), this.dl(), void 0 !== t.mode && this.Vo({
                    _e: t.mode
                }), void 0 !== t.scaleMargins) {
                let i = N(t.scaleMargins.top),
                    e = N(t.scaleMargins.bottom);
                if (i < 0 || i > 1) throw Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);
                if (e < 0 || e > 1) throw Error(`Invalid bottom margin - expect value between 0 and 1, given=${e}`);
                if (i + e > 1) throw Error(`Invalid margins - sum of margins must be less than 1, given=${i+e}`);
                this.Bo(), this.bo = null
            }
        }
        Eo() {
            return this.yn.autoScale
        }
        Ao() {
            return this.co
        }
        so() {
            return 1 === this.yn.mode
        }
        je() {
            return 2 === this.yn.mode
        }
        Lo() {
            return 3 === this.yn.mode
        }
        ro() {
            return this.Co
        }
        _e() {
            return {
                hs: this.yn.autoScale,
                zo: this.yn.invertScale,
                _e: this.yn.mode
            }
        }
        Vo(t) {
            let i = this._e(),
                e = null;
            void 0 !== t.hs && (this.yn.autoScale = t.hs), void 0 !== t._e && (this.yn.mode = t._e, 2 !== t._e && 3 !== t._e || (this.yn.autoScale = !0), this.oo._o = !1), 1 === i._e && t._e !== i._e && (function(t, i) {
                if (null === t) return !1;
                let e = ig(t.Je(), i),
                    s = ig(t.Qe(), i);
                return isFinite(e) && isFinite(s)
            }(this.rr, this.Co) ? null !== (e = ib(this.rr, this.Co)) && this.Oo(e) : this.yn.autoScale = !0), 1 === t._e && t._e !== i._e && null !== (e = iw(this.rr, this.Co)) && this.Oo(e);
            let s = i._e !== this.yn.mode;
            s && (2 === i._e || this.je()) && this.dl(), s && (3 === i._e || this.Lo()) && this.dl(), void 0 !== t.zo && i.zo !== t.zo && (this.yn.invertScale = t.zo, this.No()), this.vo.p(i, this._e())
        }
        Fo() {
            return this.vo
        }
        k() {
            return this.ko.fontSize
        }
        $t() {
            return this.ho
        }
        Wo(t) {
            this.ho !== t && (this.ho = t, this.Bo(), this.bo = null)
        }
        Ho() {
            if (this.ao) return this.ao;
            let t = this.$t() - this.Uo() - this.$o();
            return this.ao = t, t
        }
        ar() {
            return this.jo(), this.rr
        }
        Oo(t, i) {
            let e = this.rr;
            (i || null === e && null !== t || null !== e && !e.Ge(t)) && (this.bo = null, this.rr = t)
        }
        qo(t) {
            this.Oo(t), this.Yo(null !== t)
        }
        Gi() {
            return this.jo(), 0 === this.ho || !this.rr || this.rr.Gi()
        }
        Ko(t) {
            return this.zo() ? t : this.$t() - 1 - t
        }
        Nt(t, i) {
            return this.je() ? t = im(t, i) : this.Lo() && (t = ip(t, i)), this.Io(t, i)
        }
        Zo(t, i, e) {
            this.jo();
            let s = this.$o(),
                h = P(this.ar()),
                n = h.Je(),
                l = h.Qe(),
                r = this.Ho() - 1,
                o = this.zo(),
                a = r / (l - n),
                u = void 0 === e ? 0 : e.from,
                c = void 0 === e ? t.length : e.to,
                d = this.Go();
            for (let e = u; e < c; e++) {
                let h = t[e],
                    l = h.Mt;
                if (isNaN(l)) continue;
                let r = l;
                null !== d && (r = d(h.Mt, i));
                let u = s + a * (r - n);
                h.ut = o ? u : this.ho - 1 - u
            }
        }
        Xo(t, i, e) {
            this.jo();
            let s = this.$o(),
                h = P(this.ar()),
                n = h.Je(),
                l = h.Qe(),
                r = this.Ho() - 1,
                o = this.zo(),
                a = r / (l - n),
                u = void 0 === e ? 0 : e.from,
                c = void 0 === e ? t.length : e.to,
                d = this.Go();
            for (let e = u; e < c; e++) {
                let h = t[e],
                    l = h.jr,
                    r = h.qr,
                    u = h.Yr,
                    c = h.Kr;
                null !== d && (l = d(h.jr, i), r = d(h.qr, i), u = d(h.Yr, i), c = d(h.Kr, i));
                let f = s + a * (l - n),
                    m = o ? f : this.ho - 1 - f;
                h.Jo = m, f = s + a * (r - n), h.Qo = m = o ? f : this.ho - 1 - f, f = s + a * (u - n), h.t_ = m = o ? f : this.ho - 1 - f, f = s + a * (c - n), h.i_ = m = o ? f : this.ho - 1 - f
            }
        }
        Tn(t, i) {
            let e = this.Do(t, i);
            return this.n_(e, i)
        }
        n_(t, i) {
            var e, s;
            let h = t;
            return this.je() ? (e = h, i < 0 && (e = -e), h = e / 100 * i + i) : this.Lo() && (s = h - 100, i < 0 && (s = -s), h = s / 100 * i + i), h
        }
        Cl() {
            return this.mo
        }
        Dt() {
            return this.Mo || (this.Mo = i_(this.mo)), this.Mo
        }
        s_(t) {
            -1 === this.mo.indexOf(t) && (this.mo.push(t), this.dl(), this.e_())
        }
        r_(t) {
            let i = this.mo.indexOf(t);
            if (-1 === i) throw Error("source is not attached to scale");
            this.mo.splice(i, 1), 0 === this.mo.length && (this.Vo({
                hs: !0
            }), this.Oo(null)), this.dl(), this.e_()
        }
        Lt() {
            let t = null;
            for (let i of this.mo) {
                let e = i.Lt();
                null !== e && (null === t || e.za < t.za) && (t = e)
            }
            return null === t ? null : t.Wt
        }
        zo() {
            return this.yn.invertScale
        }
        El() {
            let t = null === this.Lt();
            if (null !== this.bo && (t || this.bo.h_ === t)) return this.bo.El;
            this.Ro.jl();
            let i = this.Ro.El();
            return this.bo = {
                El: i,
                h_: t
            }, this.po.p(), i
        }
        a_() {
            return this.po
        }
        l_(t) {
            this.je() || this.Lo() || null === this.So && null === this.lo && (this.Gi() || (this.So = this.ho - t, this.lo = P(this.ar()).Xe()))
        }
        o_(t) {
            if (this.je() || this.Lo() || null === this.So) return;
            this.Vo({
                hs: !1
            }), (t = this.ho - t) < 0 && (t = 0);
            let i = (this.So + .2 * (this.ho - 1)) / (t + .2 * (this.ho - 1)),
                e = P(this.lo).Xe();
            i = Math.max(i, .1), e.ir(i), this.Oo(e)
        }
        __() {
            this.je() || this.Lo() || (this.So = null, this.lo = null)
        }
        u_(t) {
            this.Eo() || null === this.xo && null === this.lo && (this.Gi() || (this.xo = t, this.lo = P(this.ar()).Xe()))
        }
        c_(t) {
            if (this.Eo() || null === this.xo) return;
            let i = P(this.ar()).tr() / (this.Ho() - 1),
                e = t - this.xo;
            this.zo() && (e *= -1);
            let s = e * i,
                h = P(this.lo).Xe();
            h.nr(s), this.Oo(h, !0), this.bo = null
        }
        d_() {
            this.Eo() || null !== this.xo && (this.xo = null, this.lo = null)
        }
        tl() {
            return this.il || this.dl(), this.il
        }
        Ji(t, i) {
            switch (this.yn.mode) {
                case 2:
                    return this.f_(im(t, i));
                case 3:
                    return this.tl().format(ip(t, i));
                default:
                    return this.cr(t)
            }
        }
        no(t) {
            switch (this.yn.mode) {
                case 2:
                    return this.f_(t);
                case 3:
                    return this.tl().format(t);
                default:
                    return this.cr(t)
            }
        }
        Ql(t) {
            switch (this.yn.mode) {
                case 2:
                    return this.p_(t);
                case 3:
                    return this.tl().formatTickmarks(t);
                default:
                    return this.v_(t)
            }
        }
        xa(t) {
            return this.cr(t, P(this.wo).tl())
        }
        Ca(t, i) {
            return t = im(t, i), this.f_(t, iS)
        }
        m_() {
            return this.mo
        }
        w_(t) {
            this.oo = {
                uo: t,
                _o: !1
            }
        }
        Nn() {
            this.mo.forEach(t => t.Nn())
        }
        Kl() {
            return this.yn.ensureEdgeTickMarksVisible && this.Eo()
        }
        Gl() {
            return this.k() / 2
        }
        dl() {
            this.bo = null;
            let t = 1 / 0;
            for (let i of (this.wo = null, this.mo)) i.ln() < t && (t = i.ln(), this.wo = i);
            let i = 100;
            null !== this.wo && (i = Math.round(this.wo.Kh())), this.il = iC, this.je() ? (this.il = iS, i = 100) : this.Lo() ? (this.il = new tM(100, 1), i = 100) : null !== this.wo && (this.il = this.wo.tl()), this.Ro = new ix(this, i, this.Do.bind(this), this.Io.bind(this)), this.Ro.jl()
        }
        e_() {
            this.Mo = null
        }
        M_() {
            return null === this.wo || this.je() || this.Lo() ? 1 : 1 / this.wo.Kh()
        }
        Xi() {
            return this.To
        }
        Yo(t) {
            this.co = t
        }
        Uo() {
            return this.zo() ? this.yn.scaleMargins.bottom * this.$t() + this.fo : this.yn.scaleMargins.top * this.$t() + this.do
        }
        $o() {
            return this.zo() ? this.yn.scaleMargins.top * this.$t() + this.do : this.yn.scaleMargins.bottom * this.$t() + this.fo
        }
        jo() {
            this.oo._o || (this.oo._o = !0, this.g_())
        }
        Bo() {
            this.ao = null
        }
        Io(t, i) {
            if (this.jo(), this.Gi()) return 0;
            t = this.so() && t ? iv(t, this.Co) : t;
            let e = P(this.ar()),
                s = this.$o() + (this.Ho() - 1) * (t - e.Je()) / e.tr();
            return this.Ko(s)
        }
        Do(t, i) {
            if (this.jo(), this.Gi()) return 0;
            let e = this.Ko(t),
                s = P(this.ar()),
                h = s.Je() + s.tr() * ((e - this.$o()) / (this.Ho() - 1));
            return this.so() ? ig(h, this.Co) : h
        }
        No() {
            this.bo = null, this.Ro.jl()
        }
        g_() {
            var t, i, e, s, h;
            if (this.Ao() && !this.Eo()) return;
            let n = this.oo.uo;
            if (null === n) return;
            let l = null,
                r = this.m_(),
                o = 0,
                a = 0;
            for (let t of r) {
                if (!t.It()) continue;
                let r = t.Lt();
                if (null === r) continue;
                let u = t.la(n.Oa(), n.bi()),
                    c = u && u.ar();
                if (null !== c) {
                    switch (this.yn.mode) {
                        case 1:
                            c = iw(c, this.Co);
                            break;
                        case 2:
                            i = c, e = r.Wt, c = new tI(im(i.Je(), e), im(i.Qe(), e));
                            break;
                        case 3:
                            s = c, h = r.Wt, c = new tI(ip(s.Je(), h), ip(s.Qe(), h))
                    }
                    if (l = null === l ? c : l.Ss(P(c)), null !== u) {
                        let t = u.lr();
                        null !== t && (o = Math.max(o, t.above), a = Math.max(a, t.below))
                    }
                }
            }
            if (this.Kl() && (o = Math.max(o, this.Gl()), a = Math.max(a, this.Gl())), o === this.do && a === this.fo || (this.do = o, this.fo = a, this.bo = null, this.Bo()), null !== l) {
                if (l.Je() === l.Qe()) {
                    let t = 5 * this.M_();
                    this.so() && (l = ib(l, this.Co)), l = new tI(l.Je() - t, l.Qe() + t), this.so() && (l = iw(l, this.Co))
                }
                if (this.so()) {
                    let i = ib(l, this.Co),
                        e = iM(i);
                    if (t = this.Co, e.Al !== t.Al || e.Ll !== t.Ll) {
                        let t = null !== this.lo ? ib(this.lo, this.Co) : null;
                        this.Co = e, l = iw(i, e), null !== t && (this.lo = iw(t, e))
                    }
                }
                this.Oo(l)
            } else null === this.rr && (this.Oo(new tI(-.5, .5)), this.Co = iM(null))
        }
        Go() {
            return this.je() ? im : this.Lo() ? ip : this.so() ? t => iv(t, this.Co) : null
        }
        b_(t, i, e) {
            return void 0 === i ? (void 0 === e && (e = this.tl()), e.format(t)) : i(t)
        }
        S_(t, i, e) {
            return void 0 === i ? (void 0 === e && (e = this.tl()), e.formatTickmarks(t)) : i(t)
        }
        cr(t, i) {
            return this.b_(t, this.Po.priceFormatter, i)
        }
        v_(t, i) {
            let e = this.Po.priceFormatter;
            return this.S_(t, this.Po.tickmarksPriceFormatter ? ? (e ? t => t.map(e) : void 0), i)
        }
        f_(t, i) {
            return this.b_(t, this.Po.percentageFormatter, i)
        }
        p_(t, i) {
            let e = this.Po.percentageFormatter;
            return this.S_(t, this.Po.tickmarksPercentageFormatter ? ? (e ? t => t.map(e) : void 0), i)
        }
    }

    function iz(t) {
        return t instanceof is
    }
    class ik {
        constructor(t, i) {
            this.mo = [], this.x_ = new Map, this.ho = 0, this.C_ = 0, this.y_ = 1, this.Mo = null, this.k_ = null, this.P_ = !1, this.T_ = new W, this.fa = [], this.ia = t, this.sn = i, this.R_ = new ic(this);
            const e = i.N();
            this.D_ = this.I_("left", e.leftPriceScale), this.V_ = this.I_("right", e.rightPriceScale), this.D_.Fo().i(this.B_.bind(this, this.D_), this), this.V_.Fo().i(this.B_.bind(this, this.V_), this), this.E_(e)
        }
        E_(t) {
            if (t.leftPriceScale && this.D_.vr(t.leftPriceScale), t.rightPriceScale && this.V_.vr(t.rightPriceScale), t.localization && (this.D_.dl(), this.V_.dl()), t.overlayPriceScales)
                for (let i of Array.from(this.x_.values())) {
                    let e = P(i[0].Ft());
                    e.vr(t.overlayPriceScales), t.localization && e.dl()
                }
        }
        A_(t) {
            switch (t) {
                case "left":
                    return this.D_;
                case "right":
                    return this.V_
            }
            return this.x_.has(t) ? N(this.x_.get(t))[0].Ft() : null
        }
        m() {
            this.Qt().L_().u(this), this.D_.Fo().u(this), this.V_.Fo().u(this), this.mo.forEach(t => {
                t.m && t.m()
            }), this.fa = this.fa.filter(t => {
                let i = t.Qh();
                return i.detached && i.detached(), !1
            }), this.T_.p()
        }
        z_() {
            return this.y_
        }
        O_(t) {
            this.y_ = t
        }
        Qt() {
            return this.sn
        }
        nn() {
            return this.C_
        }
        $t() {
            return this.ho
        }
        N_(t) {
            this.C_ = t, this.F_()
        }
        Wo(t) {
            this.ho = t, this.D_.Wo(t), this.V_.Wo(t), this.mo.forEach(i => {
                if (this.Zs(i)) {
                    let e = i.Ft();
                    null !== e && e.Wo(t)
                }
            }), this.F_()
        }
        W_(t) {
            this.P_ = t
        }
        H_() {
            return this.P_
        }
        U_() {
            return this.mo.filter(iz)
        }
        Cl() {
            return this.mo
        }
        Zs(t) {
            let i = t.Ft();
            return null === i || this.D_ !== i && this.V_ !== i
        }
        s_(t, i, e) {
            this.j_(t, i, e ? t.ln() : this.mo.length)
        }
        r_(t, i) {
            let e = this.mo.indexOf(t);
            T(-1 !== e, "removeDataSource: invalid data source"), this.mo.splice(e, 1), i || this.mo.forEach((t, i) => t._n(i));
            let s = P(t.Ft()).cl();
            if (this.x_.has(s)) {
                let i = N(this.x_.get(s)),
                    e = i.indexOf(t); - 1 !== e && (i.splice(e, 1), 0 === i.length && this.x_.delete(s))
            }
            let h = t.Ft();
            h && h.Cl().indexOf(t) >= 0 && (h.r_(t), this.q_(h)), this.Y_()
        }
        Xs(t) {
            return t === this.D_ ? "left" : t === this.V_ ? "right" : "overlay"
        }
        K_() {
            return this.D_
        }
        Z_() {
            return this.V_
        }
        G_(t, i) {
            t.l_(i)
        }
        X_(t, i) {
            t.o_(i), this.F_()
        }
        J_(t) {
            t.__()
        }
        Q_(t, i) {
            t.u_(i)
        }
        tu(t, i) {
            t.c_(i), this.F_()
        }
        iu(t) {
            t.d_()
        }
        F_() {
            this.mo.forEach(t => {
                t.Nn()
            })
        }
        Pn() {
            let [t, i] = this.nu(), e = null;
            return t.N().visible && 0 !== t.Cl().length ? e = t : i.N().visible && 0 !== i.Cl().length ? e = i : 0 !== this.mo.length && (e = this.mo[0].Ft()), null === e && (e = this.Gs() ? ? t), e
        }
        Gs() {
            let [t, i] = this.nu();
            return t.N().visible ? t : i.N().visible ? i : null
        }
        q_(t) {
            null !== t && t.Eo() && this.su(t)
        }
        eu(t) {
            let i = this.ia.Ee();
            t.Vo({
                hs: !0
            }), null !== i && t.w_(i), this.F_()
        }
        ru() {
            this.su(this.D_), this.su(this.V_)
        }
        hu() {
            this.q_(this.D_), this.q_(this.V_), this.mo.forEach(t => {
                this.Zs(t) && this.q_(t.Ft())
            }), this.F_(), this.sn.mr()
        }
        Dt() {
            return null === this.Mo && (this.Mo = i_(this.mo)), this.Mo
        }
        au() {
            let t = this.Dt(),
                i = this.sn.ou() ? .lu,
                e = this.sn.N().hoveredSeriesOnTop,
                s = this.k_;
            if (null !== s && s.Kh === t && s._u === i && s.uu === e) return s.cu;
            let h = function(t, i, e) {
                if (!e) return t;
                let s = t.indexOf(i);
                if (-1 === s || s === t.length - 1) return t;
                let h = [];
                for (let i = 0; i < t.length; i++) i !== s && h.push(t[i]);
                return h.push(t[s]), h
            }(t, i, e);
            return this.k_ = {
                Kh: t,
                _u: i,
                uu: e,
                cu: h
            }, h
        }
        du(t, i) {
            i = io(i, 0, this.mo.length - 1);
            let e = this.mo.indexOf(t);
            for (let s of (T(-1 !== e, "setSeriesOrder: invalid data source"), this.mo.splice(e, 1), this.mo.splice(i, 0, t), this.mo.forEach((t, i) => t._n(i)), this.Y_(), [this.D_, this.V_])) s.e_(), s.dl();
            this.sn.mr()
        }
        Vt() {
            return this.Dt().filter(iz)
        }
        fu() {
            return this.T_
        }
        pu() {
            return this.R_
        }
        hl(t) {
            this.fa.push(new t1(t))
        }
        al(t) {
            this.fa = this.fa.filter(i => i.Qh() !== t), t.detached && t.detached(), this.sn.mr()
        }
        vu() {
            return this.fa
        }
        Ja(t, i) {
            return this.fa.map(e => e.Qs(t, i)).filter(t => null !== t)
        }
        su(t) {
            let i = t.m_();
            if (i && i.length > 0 && !this.ia.Gi()) {
                let i = this.ia.Ee();
                null !== i && t.w_(i)
            }
            t.Nn()
        }
        j_(t, i, e) {
            let s = this.A_(i);
            if (null === s && (s = this.I_(i, this.sn.N().overlayPriceScales)), this.mo.splice(e, 0, t), !tv(i)) {
                let e = this.x_.get(i) || [];
                e.push(t), this.x_.set(i, e)
            }
            t._n(e), s.s_(t), t.un(s), this.q_(s), this.Y_()
        }
        Y_() {
            this.Mo = null, this.k_ = null
        }
        nu() {
            return "left" === this.sn.N().defaultVisiblePriceScaleId ? [this.D_, this.V_] : [this.V_, this.D_]
        }
        B_(t, i, e) {
            i._e !== e._e && this.su(t)
        }
        I_(t, i) {
            let e = new iE(t, {
                visible: !0,
                autoScale: !0,
                ...O(i)
            }, this.sn.N().layout, this.sn.N().localization, this.sn.Xi());
            return e.Wo(this.$t()), e
        }
    }

    function iR(t, i) {
        return null === i || 2 === t.se && 2 !== i.se || (2 !== i.se || 2 === t.se) && t.ne !== i.ne && t.ne < i.ne
    }

    function iL(t) {
        return {
            te: t.te,
            ie: t.ie
        }
    }

    function iT(t) {
        return {
            lu: t.lu,
            wu: iL(t.Mu),
            mu: t.Mu.mu,
            ee: t.Mu.ee ? ? "primitive"
        }
    }

    function iN(t, i, e) {
        let s = [t, ...t.Dt()].reverse(),
            h = function(t, i, e) {
                var s, h;
                let n, l, r;
                for (let o of t)
                    for (let t of o.Ja ? .(i, e) ? ? []) {
                        let i = {
                            ne: t.distance ? ? 0,
                            se: t.hitTestPriority ? ? 2 * ("marker" === t.itemType),
                            ee: t.itemType ? ? "primitive",
                            mu: t.cursorStyle,
                            te: t.externalId
                        };
                        s = t.zOrder, (!(h = n ? .zOrder) || "top" === s && "top" !== h || "normal" === s && "bottom" === h || t.zOrder === n ? .zOrder && void 0 !== l && iR(i, l) || t.zOrder === n ? .zOrder && void 0 === l) && (n = t, l = i, r = o)
                    }
                return n && r && l ? {
                    Mu: l,
                    bu: n,
                    lu: r
                } : null
            }(s, i, e);
        if ("top" === h ? .bu.zOrder) return iT(h);
        let n = null,
            l = null;
        for (let r of s) {
            if (h && h.lu === r && "bottom" !== h.bu.zOrder && !h.bu.isBackground) return n ? ? iT(h);
            if (void 0 !== r.jn) {
                let s = function(t, i, e, s) {
                    let h = null;
                    for (let n of t) {
                        let t = n.Qs ? .(i, e, s) ? ? null;
                        if (null === t) {
                            let h = n.Tt(s);
                            t = null !== h && h.Qs ? h.Qs(i, e) : null
                        }
                        if (null !== t) {
                            let i = {
                                gu: n,
                                Mu: t
                            };
                            (null === h || iR(i.Mu, h.Mu)) && (h = i)
                        }
                    }
                    return h
                }(r.jn(t), i, e, t);
                if (null !== s) {
                    let t = {
                        lu: r,
                        gu: s.gu,
                        wu: iL(s.Mu),
                        mu: s.Mu.mu,
                        ee: s.Mu.ee ? ? "primitive"
                    };
                    (null === n || iR(s.Mu, l)) && (n = t, l = s.Mu)
                }
            }
            if (h && h.lu === r && "bottom" !== h.bu.zOrder && h.bu.isBackground) return n ? ? iT(h)
        }
        return null !== n ? n : h ? .bu ? iT(h) : null
    }
    class iP {
        constructor(t, i, e = 50) {
            this.Vs = 0, this.Bs = 1, this.Es = 1, this.Ls = new Map, this.As = new Map, this.Su = t, this.xu = i, this.zs = e
        }
        Cu(t) {
            let i = t.time,
                e = this.xu.cacheKey(i),
                s = this.Ls.get(e);
            if (void 0 !== s) return s.yu;
            if (this.Vs === this.zs) {
                let t = this.As.get(this.Es);
                this.As.delete(this.Es), this.Ls.delete(N(t)), this.Es++, this.Vs--
            }
            let h = this.Su(t);
            return this.Ls.set(e, {
                yu: h,
                Ws: this.Bs
            }), this.As.set(this.Bs, e), this.Vs++, this.Bs++, h
        }
    }
    class iQ {
        constructor(t, i) {
            T(t <= i, "right should be >= left"), this.ku = t, this.Pu = i
        }
        Oa() {
            return this.ku
        }
        bi() {
            return this.Pu
        }
        Tu() {
            return this.Pu - this.ku + 1
        }
        ze(t) {
            return this.ku <= t && t <= this.Pu
        }
        Ge(t) {
            return this.ku === t.Oa() && this.Pu === t.bi()
        }
    }

    function iW(t, i) {
        return null === t || null === i ? t === i : t.Ge(i)
    }
    class iI {
        constructor() {
            this.Ru = new Map, this.Ls = null, this.Du = !1
        }
        Iu(t) {
            this.Du = t, this.Ls = null
        }
        Vu(t, i) {
            this.Bu(i), this.Ls = null;
            for (let e = i; e < t.length; ++e) {
                let i = t[e],
                    s = this.Ru.get(i.timeWeight);
                void 0 === s && (s = [], this.Ru.set(i.timeWeight, s)), s.push({
                    index: e,
                    time: i.time,
                    weight: i.timeWeight,
                    originalTime: i.originalTime
                })
            }
        }
        Eu(t, i, e, s, h) {
            let n = Math.ceil(i / t);
            return null !== this.Ls && this.Ls.Au === n && h === this.Ls.Lu && e === this.Ls.zu || (this.Ls = {
                Lu: h,
                zu: e,
                El: this.Ou(n, e, s),
                Au: n
            }), this.Ls.El
        }
        Bu(t) {
            if (0 === t) return void this.Ru.clear();
            let i = [];
            for (let e of (this.Ru.forEach((e, s) => {
                    t <= e[0].index ? i.push(s) : e.splice(tH(e, t, i => i.index < t), 1 / 0)
                }), i)) this.Ru.delete(e)
        }
        Ou(t, i, e) {
            let s = [],
                h = t => !i || e.has(t.index);
            for (let i of Array.from(this.Ru.keys()).sort((t, i) => i - t)) {
                if (!this.Ru.get(i)) continue;
                let e = s;
                s = [];
                let n = e.length,
                    l = 0,
                    r = N(this.Ru.get(i)),
                    o = r.length,
                    a = 1 / 0,
                    u = -1 / 0;
                for (let i = 0; i < o; i++) {
                    let o = r[i],
                        c = o.index;
                    for (; l < n;) {
                        let t = e[l],
                            i = t.index;
                        if (!(i < c && h(t))) {
                            a = i;
                            break
                        }
                        l++, s.push(t), u = i, a = 1 / 0
                    }
                    if (a - c >= t && c - u >= t && h(o)) s.push(o), u = c;
                    else if (this.Du) return e
                }
                for (; l < n; l++) h(e[l]) && s.push(e[l])
            }
            return s
        }
    }
    class iB {
        constructor(t) {
            this.Nu = t
        }
        Fu() {
            return null === this.Nu ? null : new iQ(Math.floor(this.Nu.Oa()), Math.ceil(this.Nu.bi()))
        }
        Wu() {
            return this.Nu
        }
        static Hu() {
            return new iB(null)
        }
    }

    function iF(t, i) {
        return t.weight > i.weight ? t : i
    }
    class iD {
        constructor(t, i, e, s) {
            this.C_ = 0, this.Uu = null, this.$u = [], this.xo = null, this.So = null, this.ju = new iI, this.qu = new Map, this.Yu = iB.Hu(), this.Ku = !0, this.Zu = new W, this.Gu = new W, this.Xu = new W, this.Ju = null, this.Qu = null, this.tc = new Map, this.nc = -1, this.sc = [], this.ec = 1, this.yn = i, this.Po = e, this.rc = i.rightOffset, this.hc = i.barSpacing, this.sn = t, this.ac(i), this.xu = s, this.lc(), this.ju.Iu(i.uniformDistribution), this.oc(), this._c()
        }
        N() {
            return this.yn
        }
        uc(t) {
            I(this.Po, t), this.cc(), this.lc()
        }
        vr(t, i) {
            I(this.yn, t), this.yn.fixLeftEdge && this.dc(), this.yn.fixRightEdge && this.fc(), void 0 !== t.barSpacing && this.sn.Ms(t.barSpacing), void 0 !== t.rightOffset && this.sn.gs(t.rightOffset), this.ac(t), void 0 === t.minBarSpacing && void 0 === t.maxBarSpacing || this.sn.Ms(t.barSpacing ? ? this.hc), void 0 !== t.ignoreWhitespaceIndices && t.ignoreWhitespaceIndices !== this.yn.ignoreWhitespaceIndices && this._c(), this.cc(), this.lc(), void 0 === t.enableConflation && void 0 === t.conflationThresholdFactor || this.oc(), this.Xu.p()
        }
        Rn(t) {
            return this.$u[t] ? .time ? ? null
        }
        en(t) {
            return this.$u[t] ? ? null
        }
        vc(t, i) {
            if (this.$u.length < 1) return null;
            if (this.xu.key(t) > this.xu.key(this.$u[this.$u.length - 1].time)) return i ? this.$u.length - 1 : null;
            let e = tH(this.$u, this.xu.key(t), (t, i) => this.xu.key(t.time) < i);
            return this.xu.key(t) < this.xu.key(this.$u[e].time) ? i ? e : null : e
        }
        Gi() {
            return 0 === this.C_ || 0 === this.$u.length || null === this.Uu
        }
        mc() {
            return this.$u.length > 0
        }
        Ee() {
            return this.wc(), this.Yu.Fu()
        }
        Mc() {
            return this.wc(), this.Yu.Wu()
        }
        gc() {
            let t = this.Ee();
            if (null === t) return null;
            let i = {
                from: t.Oa(),
                to: t.bi()
            };
            return this.bc(i)
        }
        bc(t) {
            let i = Math.round(t.from),
                e = Math.round(t.to),
                s = P(this.Sc()),
                h = P(this.xc());
            return {
                from: P(this.en(Math.max(s, i))),
                to: P(this.en(Math.min(h, e)))
            }
        }
        Cc(t) {
            return {
                from: P(this.vc(t.from, !0)),
                to: P(this.vc(t.to, !0))
            }
        }
        nn() {
            return this.C_
        }
        N_(t) {
            if (!isFinite(t) || t <= 0 || this.C_ === t) return;
            let i = this.Mc(),
                e = this.C_;
            if (this.C_ = t, this.Ku = !0, this.yn.lockVisibleTimeRangeOnResize && 0 !== e) {
                let i = this.hc * t / e;
                this.hc = i
            }
            this.yn.fixLeftEdge && null !== i && 0 >= i.Oa() && (this.rc -= Math.round((e - t) / this.hc) + 1, this.Ku = !0), this.yc(), this.kc()
        }
        jt(t) {
            if (this.Gi() || !F(t)) return 0;
            let i = this.Pc() + this.rc - t;
            return this.C_ - (i + .5) * this.hc - 1
        }
        Tc(t, i) {
            let e = this.Pc(),
                s = void 0 === i ? 0 : i.from,
                h = void 0 === i ? t.length : i.to;
            for (let i = s; i < h; i++) {
                let s = t[i].wt,
                    h = e + this.rc - s,
                    n = this.C_ - (h + .5) * this.hc - 1;
                t[i]._t = n
            }
        }
        Rc(t, i) {
            let e = Math.ceil(this.Dc(t));
            return i && this.yn.ignoreWhitespaceIndices && !this.Ic(e) ? this.Vc(e) : e
        }
        gs(t) {
            this.Ku = !0, this.rc = t, this.kc(), this.sn.Bc(), this.sn.mr()
        }
        fl() {
            return this.hc
        }
        Ms(t) {
            let i = this.hc;
            if (this.Ec(t), void 0 !== this.yn.rightOffsetPixels && 0 !== i) {
                let t = this.rc * i / this.hc;
                this.rc = t
            }
            this.kc(), this.sn.Bc(), this.sn.mr()
        }
        Ac() {
            return this.rc
        }
        El() {
            if (this.Gi()) return null;
            if (null !== this.Qu) return this.Qu;
            let t = this.hc,
                i = 5 * (this.sn.N().layout.fontSize + 4) / 8 * (this.yn.tickMarkMaxCharacterLength || 8),
                e = Math.round(i / t),
                s = P(this.Ee()),
                h = Math.max(s.Oa(), s.Oa() - e),
                n = Math.max(s.bi(), s.bi() - e),
                l = this.ju.Eu(t, i, this.yn.ignoreWhitespaceIndices, this.tc, this.nc),
                r = this.Sc() + e,
                o = this.xc() - e,
                a = this.Lc(),
                u = this.yn.fixLeftEdge || a,
                c = this.yn.fixRightEdge || a,
                d = 0;
            for (let t of l) {
                let e;
                h <= t.index && t.index <= n && (d < this.sc.length ? ((e = this.sc[d]).coord = this.jt(t.index), e.label = this.zc(t), e.weight = t.weight) : (e = {
                    needAlignCoordinate: !1,
                    coord: this.jt(t.index),
                    label: this.zc(t),
                    weight: t.weight
                }, this.sc.push(e)), this.hc > i / 2 && !a ? e.needAlignCoordinate = !1 : e.needAlignCoordinate = u && t.index <= r || c && t.index >= o, d++)
            }
            return this.sc.length = d, this.Qu = this.sc, this.sc
        }
        Oc() {
            let t;
            this.Ku = !0, this.Ms(this.yn.barSpacing), t = void 0 !== this.yn.rightOffsetPixels ? this.yn.rightOffsetPixels / this.fl() : this.yn.rightOffset, this.gs(t)
        }
        Nc(t) {
            this.Ku = !0, this.Uu = t, this.kc(), this.dc()
        }
        Fc(t, i) {
            let e = this.Dc(t),
                s = this.fl();
            this.Ms(s + s / 10 * i), this.yn.rightBarStaysOnScroll || this.gs(this.Ac() + (e - this.Dc(t)))
        }
        l_(t) {
            this.xo && this.d_(), null === this.So && null === this.Ju && (this.Gi() || (this.So = t, this.Wc()))
        }
        o_(t) {
            if (null === this.Ju) return;
            let i = io(this.C_ - t, 0, this.C_),
                e = io(this.C_ - P(this.So), 0, this.C_);
            0 !== i && 0 !== e && this.Ms(this.Ju.fl * i / e)
        }
        __() {
            null !== this.So && (this.So = null, this.Hc())
        }
        u_(t) {
            null === this.xo && null === this.Ju && (this.Gi() || (this.xo = t, this.Wc()))
        }
        c_(t) {
            if (null === this.xo) return;
            let i = (this.xo - t) / this.fl();
            this.rc = P(this.Ju).Ac + i, this.Ku = !0, this.kc()
        }
        d_() {
            null !== this.xo && (this.xo = null, this.Hc())
        }
        Uc() {
            this.$c(this.yn.rightOffset)
        }
        $c(t, i = 400) {
            if (!isFinite(t)) throw RangeError("offset is required and must be finite number");
            if (!isFinite(i) || i <= 0) throw RangeError("animationDuration (optional) must be finite positive number");
            let e = this.rc,
                s = performance.now();
            this.sn.ps({
                jc: t => (t - s) / i >= 1,
                qc: h => {
                    let n = (h - s) / i;
                    return n >= 1 ? t : e + (t - e) * n
                }
            })
        }
        kt(t, i) {
            this.Ku = !0, this.$u = t, this.ju.Vu(t, i), this.kc()
        }
        Yc() {
            return this.Zu
        }
        Kc() {
            return this.Gu
        }
        Zc() {
            return this.Xu
        }
        Pc() {
            return this.Uu || 0
        }
        Gc(t, i) {
            let e = t.Tu(),
                s = i && this.yn.rightOffsetPixels || 0;
            this.Ec((this.C_ - s) / e), this.rc = t.bi() - this.Pc(), i && (this.rc = s ? s / this.fl() : this.yn.rightOffset), this.kc(), this.Ku = !0, this.sn.Bc(), this.sn.mr()
        }
        Xc() {
            let t = this.Sc(),
                i = this.xc();
            if (null === t || null === i) return;
            let e = !this.yn.rightOffsetPixels && this.yn.rightOffset || 0;
            this.Gc(new iQ(t, i + e), !0)
        }
        Jc(t) {
            let i = new iQ(t.from, t.to);
            this.Gc(i)
        }
        rn(t) {
            return void 0 !== this.Po.timeFormatter ? this.Po.timeFormatter(t.originalTime) : this.xu.formatHorzItem(t.time)
        }
        _c() {
            if (this.yn.ignoreWhitespaceIndices) {
                for (let t of (this.tc.clear(), this.sn.Jn()))
                    for (let i of t.ul()) this.tc.set(i, !0);
                this.nc++
            }
        }
        Qc() {
            return this.ec
        }
        Ml() {
            let t = 1 / (window.devicePixelRatio || 1),
                i = this.yn.minBarSpacing;
            if (i >= t) return [1];
            let e = [1],
                s = 2;
            for (; s <= 512;) i < t / s && e.push(s), s *= 2;
            return e
        }
        Lc() {
            let t = this.sn.N().handleScroll,
                i = this.sn.N().handleScale;
            return !(t.horzTouchDrag || t.mouseWheel || t.pressedMouseMove || t.vertTouchDrag || i.axisDoubleClickReset.time || i.axisPressedMouseMove.time || i.mouseWheel || i.pinch)
        }
        Sc() {
            return 0 === this.$u.length ? null : 0
        }
        xc() {
            return 0 === this.$u.length ? null : this.$u.length - 1
        }
        td(t) {
            return (this.C_ - 1 - t) / this.hc
        }
        Dc(t) {
            let i = this.td(t);
            return Math.round(1e6 * (this.Pc() + this.rc - i)) / 1e6
        }
        Ec(t) {
            let i = this.hc;
            this.hc = t, this.yc(), i !== this.hc && (this.Ku = !0, this.nd(), this.oc())
        }
        wc() {
            if (!this.Ku) return;
            if (this.Ku = !1, this.Gi()) return void this.sd(iB.Hu());
            let t = this.Pc(),
                i = this.C_ / this.hc,
                e = this.rc + t,
                s = new iQ(e - i + 1, e);
            this.sd(new iB(s))
        }
        yc() {
            let t = io(this.hc, this.ed(), this.rd());
            this.hc !== t && (this.hc = t, this.Ku = !0)
        }
        rd() {
            return this.yn.maxBarSpacing > 0 ? this.yn.maxBarSpacing : .5 * this.C_
        }
        ed() {
            return this.yn.fixLeftEdge && this.yn.fixRightEdge && 0 !== this.$u.length ? this.C_ / this.$u.length : this.yn.minBarSpacing
        }
        oc() {
            if (!this.yn.enableConflation) return void(this.ec = 1);
            let t = 1 / (window.devicePixelRatio || 1) * (this.yn.conflationThresholdFactor ? ? 1);
            if (this.hc >= t) return void(this.ec = 1);
            let i = Math.pow(2, Math.floor(Math.log2(t / this.hc)));
            this.ec = Math.min(i, 512)
        }
        kc() {
            let t = this.hd();
            null !== t && this.rc < t && (this.rc = t, this.Ku = !0);
            let i = this.ad();
            this.rc > i && (this.rc = i, this.Ku = !0)
        }
        hd() {
            let t = this.Sc(),
                i = this.Uu;
            return null === t || null === i ? null : t - i - 1 + (this.yn.fixLeftEdge ? this.C_ / this.hc : Math.min(2, this.$u.length))
        }
        ad() {
            return this.yn.fixRightEdge ? 0 : this.C_ / this.hc - Math.min(2, this.$u.length)
        }
        Wc() {
            this.Ju = {
                fl: this.fl(),
                Ac: this.Ac()
            }
        }
        Hc() {
            this.Ju = null
        }
        zc(t) {
            let i = this.qu.get(t.weight);
            return void 0 === i && (i = new iP(t => this.ld(t), this.xu), this.qu.set(t.weight, i)), i.Cu(t)
        }
        ld(t) {
            return this.xu.formatTickmark(t, this.Po)
        }
        sd(t) {
            let i = this.Yu;
            this.Yu = t, iW(i.Fu(), this.Yu.Fu()) || this.Zu.p(), iW(i.Wu(), this.Yu.Wu()) || this.Gu.p(), this.nd()
        }
        nd() {
            this.Qu = null
        }
        cc() {
            this.nd(), this.qu.clear()
        }
        lc() {
            this.xu.updateFormatter(this.Po)
        }
        dc() {
            if (!this.yn.fixLeftEdge) return;
            let t = this.Sc();
            if (null === t) return;
            let i = this.Ee();
            if (null === i) return;
            let e = i.Oa() - t;
            if (e < 0) {
                let t = this.rc - e - 1;
                this.gs(t)
            }
            this.yc()
        }
        fc() {
            this.kc(), this.yc()
        }
        Ic(t) {
            return !this.yn.ignoreWhitespaceIndices || this.tc.get(t) || !1
        }
        Vc(t) {
            let i = function*(t) {
                    let i = Math.round(t),
                        e = i < t,
                        s = 1;
                    for (;;) e ? (yield i + s, yield i - s) : (yield i - s, yield i + s), s++
                }(t),
                e = this.xc();
            for (; e;) {
                let t = i.next().value;
                if (this.tc.get(t)) return t;
                if (t < 0 || t > e) break
            }
            return t
        }
        ac(t) {
            if (void 0 !== t.rightOffsetPixels) {
                let i = t.rightOffsetPixels / (t.barSpacing || this.hc);
                this.sn.gs(i)
            }
        }
    }(o = w || (w = {}))[o.OnTouchEnd = 0] = "OnTouchEnd", o[o.OnNextTap = 1] = "OnNextTap";
    class iK {
        constructor(t, i, e) {
            this.od = [], this._d = [], this.ud = null, this.C_ = 0, this.dd = null, this.fd = new W, this.pd = new W, this.vd = null, this.md = t, this.yn = i, this.xu = e, this.To = new U(this.yn.layout.colorParsers), this.wd = new A(this), this.ia = new iD(this, i.timeScale, this.yn.localization, e), this.Ct = new tp(this, i.crosshair), this.Md = new ir(i.crosshair), i.addDefaultPane && (this.gd(0), this.od[0].O_(2)), this.bd = this.Sd(0), this.xd = this.Sd(1)
        }
        Pa() {
            this.Cd(tg.ys())
        }
        mr() {
            this.Cd(tg.Cs())
        }
        qa() {
            this.Cd(new tg(1))
        }
        Ta(t) {
            let i = this.yd(t);
            this.Cd(i)
        }
        ou() {
            return this.dd
        }
        kd(t) {
            if (this.dd ? .lu === t ? .lu && this.dd ? .wu ? .te === t ? .wu ? .te && this.dd ? .wu ? .ie === t ? .wu ? .ie && this.dd ? .mu === t ? .mu && this.dd ? .ee === t ? .ee) return;
            let i = this.dd;
            this.dd = t, null !== i && this.Ta(i.lu), null !== t && t.lu !== i ? .lu && this.Ta(t.lu)
        }
        N() {
            return this.yn
        }
        vr(t) {
            I(this.yn, t), this.od.forEach(i => i.E_(t)), void 0 !== t.timeScale && this.ia.vr(t.timeScale), void 0 !== t.localization && this.ia.uc(t.localization), (t.leftPriceScale || t.rightPriceScale) && this.fd.p(), this.bd = this.Sd(0), this.xd = this.Sd(1), this.Pa()
        }
        Pd(t, i, e = 0) {
            let s = this.od[e];
            if (void 0 === s) return;
            if ("left" === t) return I(this.yn, {
                leftPriceScale: i
            }), s.E_({
                leftPriceScale: i
            }), this.fd.p(), void this.Pa();
            if ("right" === t) return I(this.yn, {
                rightPriceScale: i
            }), s.E_({
                rightPriceScale: i
            }), this.fd.p(), void this.Pa();
            let h = this.Td(t, e);
            null !== h && (h.Ft.vr(i), this.fd.p())
        }
        Td(t, i) {
            let e = this.od[i];
            if (void 0 === e) return null;
            let s = e.A_(t);
            return null !== s ? {
                Kn: e,
                Ft: s
            } : null
        }
        Et() {
            return this.ia
        }
        Zn() {
            return this.od
        }
        Rd() {
            return this.Ct
        }
        Dd() {
            return this.pd
        }
        Id(t, i) {
            t.Wo(i), this.Bc()
        }
        N_(t) {
            this.C_ = t, this.ia.N_(this.C_), this.od.forEach(i => i.N_(t)), this.Bc()
        }
        Vd(t) {
            1 !== this.od.length && (T(t >= 0 && t < this.od.length, "Invalid pane index"), this.od.splice(t, 1), this.Pa())
        }
        Bd(t, i) {
            if (this.od.length < 2) return;
            T(t >= 0 && t < this.od.length, "Invalid pane index");
            let e = this.od[t],
                s = this.od.reduce((t, i) => t + i.z_(), 0),
                h = this.od.reduce((t, i) => t + i.$t(), 0),
                n = h - 30 * (this.od.length - 1);
            i = Math.min(n, Math.max(30, i));
            let l = s / h,
                r = e.$t();
            e.O_(i * l);
            let o = i - r,
                a = this.od.length - 1;
            for (let t of this.od)
                if (t !== e) {
                    let i = Math.min(n, Math.max(30, t.$t() - o / a));
                    o -= t.$t() - i, a -= 1;
                    let e = i * l;
                    t.O_(e)
                }
            this.Pa()
        }
        Ed(t, i) {
            T(t >= 0 && t < this.od.length && i >= 0 && i < this.od.length, "Invalid pane index");
            let e = this.od[t],
                s = this.od[i];
            this.od[t] = s, this.od[i] = e, this.Pa()
        }
        Ad(t, i) {
            if (T(t >= 0 && t < this.od.length && i >= 0 && i < this.od.length, "Invalid pane index"), t === i) return;
            let [e] = this.od.splice(t, 1);
            this.od.splice(i, 0, e), this.Pa()
        }
        G_(t, i, e) {
            t.G_(i, e)
        }
        X_(t, i, e) {
            t.X_(i, e), this.Ra(), this.Cd(this.Ld(t, 2))
        }
        J_(t, i) {
            t.J_(i), this.Cd(this.Ld(t, 2))
        }
        Q_(t, i, e) {
            i.Eo() || t.Q_(i, e)
        }
        tu(t, i, e) {
            i.Eo() || (t.tu(i, e), this.Ra(), this.Cd(this.Ld(t, 2)))
        }
        iu(t, i) {
            i.Eo() || (t.iu(i), this.Cd(this.Ld(t, 2)))
        }
        eu(t, i) {
            t.eu(i), this.Cd(this.Ld(t, 2))
        }
        zd(t) {
            this.ia.l_(t)
        }
        Od(t, i) {
            let e = this.Et();
            if (e.Gi() || 0 === i) return;
            let s = e.nn();
            t = Math.max(1, Math.min(t, s)), e.Fc(t, i), this.Bc()
        }
        Nd(t) {
            this.Fd(0), this.Wd(t), this.Hd()
        }
        Ud(t) {
            this.ia.o_(t), this.Bc()
        }
        $d() {
            this.ia.__(), this.mr()
        }
        Fd(t) {
            this.ia.u_(t)
        }
        Wd(t) {
            this.ia.c_(t), this.Bc()
        }
        Hd() {
            this.ia.d_(), this.mr()
        }
        Jn() {
            return this._d
        }
        Wn() {
            return null === this.ud && (this.ud = this._d.filter(t => t.It())), this.ud
        }
        ka() {
            this.ud = null
        }
        jd(t, i, e, s, h) {
            this.Ct.In(t, i);
            let n = NaN,
                l = this.ia.Rc(t, !0),
                r = this.ia.Ee();
            null !== r && (l = Math.min(Math.max(r.Oa(), l), r.bi())), l = this.Ct.Fn(l);
            let o = s.Pn(),
                a = o.Lt();
            if (null !== a && (n = o.Tn(i, a)), n = this.Md.xl(n, l, s), this.Ct.An(l, n, s), this.qa(), !h) {
                let h = iN(s, t, i);
                this.kd(h && {
                    lu: h.lu,
                    wu: h.wu,
                    mu: h.mu || null,
                    ee: h.ee
                }), this.pd.p(this.Ct.Bt(), {
                    x: t,
                    y: i
                }, e)
            }
        }
        qd(t, i, e) {
            let s = e.Pn(),
                h = s.Lt(),
                n = s.Nt(t, P(h)),
                l = this.ia.vc(i, !0),
                r = this.ia.jt(P(l));
            this.jd(r, n, null, e, !0)
        }
        Yd(t) {
            this.Rd().zn(), this.qa(), t || this.pd.p(null, null, null)
        }
        Ra() {
            let t = this.Ct.Kn();
            if (null !== t) {
                let i = this.Ct.Bn(),
                    e = this.Ct.En();
                this.jd(i, e, null, t)
            }
            this.Ct.Nn()
        }
        Kd(t, i, e) {
            let s = this.ia.Rn(0);
            void 0 !== i && void 0 !== e && this.ia.kt(i, e);
            let h = this.ia.Rn(0),
                n = this.ia.Pc(),
                l = this.ia.Ee();
            if (null !== l && null !== s && null !== h) {
                let i = l.ze(n),
                    r = this.xu.key(s) > this.xu.key(h),
                    o = null !== t && t > n && !r,
                    a = this.ia.N().allowShiftVisibleRangeOnWhitespaceReplacement,
                    u = i && (void 0 !== e || a) && this.ia.N().shiftVisibleRangeOnNewBar;
                if (o && !u) {
                    let i = t - n;
                    this.ia.gs(this.ia.Ac() - i)
                }
            }
            this.ia.Nc(t)
        }
        Va(t) {
            null !== t && t.hu()
        }
        Ks(t) {
            if (t instanceof ik) return t;
            let i = this.od.find(i => i.Dt().includes(t));
            return void 0 === i ? null : i
        }
        Bc() {
            this.od.forEach(t => t.hu()), this.Ra()
        }
        m() {
            this.od.forEach(t => t.m()), this.od.length = 0, this.yn.localization.priceFormatter = void 0, this.yn.localization.percentageFormatter = void 0, this.yn.localization.timeFormatter = void 0
        }
        Zd() {
            return this.wd
        }
        Js() {
            return this.wd.N()
        }
        L_() {
            return this.fd
        }
        Gd(t, i) {
            let e = this.gd(i);
            this.Xd(t, e), this._d.push(t), this.ka(), 1 === this._d.length ? this.Pa() : this.mr()
        }
        Jd(t) {
            let i = this.Ks(t),
                e = this._d.indexOf(t);
            T(-1 !== e, "Series not found");
            let s = P(i);
            this._d.splice(e, 1), s.r_(t), t.m && t.m(), this.ka(), this.ia._c(), this.Qd(s)
        }
        ya(t, i) {
            let e = P(this.Ks(t));
            e.r_(t, !0), e.s_(t, i, !0)
        }
        Xc() {
            let t = tg.Cs();
            t.us(), this.Cd(t)
        }
        tf(t) {
            let i = tg.Cs();
            i.fs(t), this.Cd(i)
        }
        ws() {
            let t = tg.Cs();
            t.ws(), this.Cd(t)
        }
        Ms(t) {
            let i = tg.Cs();
            i.Ms(t), this.Cd(i)
        }
        gs(t) {
            let i = tg.Cs();
            i.gs(t), this.Cd(i)
        }
        ps(t) {
            let i = tg.Cs();
            i.ps(t), this.Cd(i)
        }
        cs() {
            let t = tg.Cs();
            t.cs(), this.Cd(t)
        }
        if () {
            let t = this.yn.defaultVisiblePriceScaleId,
                i = this.yn.leftPriceScale.visible;
            return i !== this.yn.rightPriceScale.visible ? i ? "left" : "right" : t
        }
        nf(t, i) {
            if (T(i >= 0, "Index should be greater or equal to 0"), i === this.sf(t)) return;
            let e = P(this.Ks(t));
            e.r_(t);
            let s = this.gd(i);
            this.Xd(t, s);
            let h = !1;
            0 === e.Cl().length && (h = this.Qd(e)), h || this.Pa()
        }
        ef() {
            return this.xd
        }
        $() {
            return this.bd
        }
        Ut(t) {
            let i = this.xd,
                e = this.bd;
            if (i === e) return i;
            if (t = Math.max(0, Math.min(100, Math.round(100 * t))), null === this.vd || this.vd.ah !== e || this.vd.oh !== i) this.vd = {
                ah: e,
                oh: i,
                rf: new Map
            };
            else {
                let i = this.vd.rf.get(t);
                if (void 0 !== i) return i
            }
            let s = this.To.tt(e, i, t / 100);
            return this.vd.rf.set(t, s), s
        }
        hf(t) {
            return this.od.indexOf(t)
        }
        Xi() {
            return this.To
        }
        af() {
            return this.lf()
        }
        lf(t) {
            let i = new ik(this.ia, this);
            this.od.push(i);
            let e = t ? ? this.od.length - 1,
                s = tg.ys();
            return s.es(e, {
                rs: 0,
                hs: !0
            }), this.Cd(s), i
        }
        gd(t) {
            return T(t >= 0, "Index should be greater or equal to 0"), (t = Math.min(this.od.length, t)) < this.od.length ? this.od[t] : this.lf(t)
        }
        sf(t) {
            return this.od.findIndex(i => i.U_().includes(t))
        }
        Ld(t, i) {
            let e = new tg(i);
            if (null !== t) {
                let s = this.od.indexOf(t);
                e.es(s, {
                    rs: i
                })
            }
            return e
        }
        yd(t, i) {
            return void 0 === i && (i = 2), this.Ld(this.Ks(t), i)
        }
        Cd(t) {
            this.md && this.md(t), this.od.forEach(t => t.pu().wr().kt())
        }
        Xd(t, i) {
            let e = t.N().priceScaleId,
                s = void 0 !== e ? e : this.if();
            i.s_(t, s), tv(s) || t.vr(t.N())
        }
        Sd(t) {
            let i = this.yn.layout;
            return "gradient" === i.background.type ? 0 === t ? i.background.topColor : i.background.bottomColor : i.background.color
        }
        Qd(t) {
            return !t.H_() && 0 === t.Cl().length && this.od.length > 1 && (this.od.splice(this.hf(t), 1), this.Pa(), !0)
        }
    }

    function iO(t) {
        if (t >= 1) return 0;
        let i = 0;
        for (; i < 8 && !(1e-8 > Math.abs(Math.round(t) - t)); i++) t *= 10;
        return i
    }

    function iq(t) {
        return !B(t) && !D(t)
    }

    function i$(t) {
        return B(t)
    }(a = b || (b = {}))[a.Disabled = 0] = "Disabled", a[a.Continuous = 1] = "Continuous", a[a.OnDataUpdate = 2] = "OnDataUpdate", (u = M || (M = {}))[u.LastBar = 0] = "LastBar", u[u.LastVisible = 1] = "LastVisible", (c = y || (y = {})).Solid = "solid", c.VerticalGradient = "gradient", (d = x || (x = {}))[d.Year = 0] = "Year", d[d.Month = 1] = "Month", d[d.DayOfMonth = 2] = "DayOfMonth", d[d.Time = 3] = "Time", d[d.TimeWithSeconds = 4] = "TimeWithSeconds";
    class iV {
        constructor(t = "yyyy-MM-dd", i = "default") {
            this._f = t, this.uf = i
        }
        Cu(t) {
            return function(t, i, e) {
                return i.replace(/yyyy/g, tb(t.getUTCFullYear(), 4)).replace(/yy/g, tb(t.getUTCFullYear() % 100, 2)).replace(/MMMM/g, new Date(t.getUTCFullYear(), t.getUTCMonth(), 1).toLocaleString(e, {
                    month: "long"
                })).replace(/MMM/g, new Date(t.getUTCFullYear(), t.getUTCMonth(), 1).toLocaleString(e, {
                    month: "short"
                })).replace(/MM/g, tb(t.getUTCMonth() + 1, 2)).replace(/dd/g, tb(t.getUTCDate(), 2))
            }(t, this._f, this.uf)
        }
    }
    class iZ {
        constructor(t) {
            this.cf = t || "%h:%m:%s"
        }
        Cu(t) {
            return this.cf.replace("%h", tb(t.getUTCHours(), 2)).replace("%m", tb(t.getUTCMinutes(), 2)).replace("%s", tb(t.getUTCSeconds(), 2))
        }
    }
    let iA = {
        df: "yyyy-MM-dd",
        ff: "%h:%m:%s",
        pf: " ",
        vf: "default"
    };
    class iH {
        constructor(t = {}) {
            const i = { ...iA,
                ...t
            };
            this.mf = new iV(i.df, i.vf), this.wf = new iZ(i.ff), this.Mf = i.pf
        }
        Cu(t) {
            return `${this.mf.Cu(t)}${this.Mf}${this.wf.Cu(t)}`
        }
    }

    function iG(t) {
        return 60 * t * 6e4
    }

    function iU(t) {
        return 60 * t * 1e3
    }
    let iY = [{
        gf: 1e3,
        bf: 10
    }, {
        gf: iU(1),
        bf: 20
    }, {
        gf: iU(5),
        bf: 21
    }, {
        gf: iU(30),
        bf: 22
    }, {
        gf: iG(1),
        bf: 30
    }, {
        gf: iG(3),
        bf: 31
    }, {
        gf: iG(6),
        bf: 32
    }, {
        gf: iG(12),
        bf: 33
    }];

    function ij(t, i) {
        if (t.getUTCFullYear() !== i.getUTCFullYear()) return 70;
        if (t.getUTCMonth() !== i.getUTCMonth()) return 60;
        if (t.getUTCDate() !== i.getUTCDate()) return 50;
        for (let e = iY.length - 1; e >= 0; --e)
            if (Math.floor(i.getTime() / iY[e].gf) !== Math.floor(t.getTime() / iY[e].gf)) return iY[e].bf;
        return 0
    }

    function iX(t) {
        let i = t;
        if (D(t) && (i = i0(t)), !iq(i)) throw Error("time must be of type BusinessDay");
        return {
            Sf: Math.round(new Date(Date.UTC(i.year, i.month - 1, i.day, 0, 0, 0, 0)).getTime() / 1e3),
            xf: i
        }
    }

    function iJ(t) {
        if (!i$(t)) throw Error("time must be of type isUTCTimestamp");
        return {
            Sf: t
        }
    }

    function i0(t) {
        let i = new Date(t);
        if (isNaN(i.getTime())) throw Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);
        return {
            day: i.getUTCDate(),
            month: i.getUTCMonth() + 1,
            year: i.getUTCFullYear()
        }
    }

    function i1(t) {
        D(t.time) && (t.time = i0(t.time))
    }
    class i2 {
        options() {
            return this.yn
        }
        setOptions(t) {
            this.yn = t, this.updateFormatter(t.localization)
        }
        preprocessData(t) {
            Array.isArray(t) ? t.forEach(i1) : i1(t)
        }
        createConverterToInternalObj(t) {
            return P(0 === t.length ? null : iq(t[0].time) || D(t[0].time) ? iX : iJ)
        }
        key(t) {
            return "object" == typeof t && "Sf" in t ? t.Sf : this.key(this.convertHorzItemToInternal(t))
        }
        cacheKey(t) {
            return void 0 === t.xf ? new Date(1e3 * t.Sf).getTime() : new Date(Date.UTC(t.xf.year, t.xf.month - 1, t.xf.day)).getTime()
        }
        convertHorzItemToInternal(t) {
            return i$(t) ? iJ(t) : iq(t) ? iX(t) : iX(i0(t))
        }
        updateFormatter(t) {
            if (!this.yn) return;
            let i = t.dateFormat;
            this.yn.timeScale.timeVisible ? this.Cf = new iH({
                df: i,
                ff: this.yn.timeScale.secondsVisible ? "%h:%m:%s" : "%h:%m",
                pf: "   ",
                vf: t.locale
            }) : this.Cf = new iV(i, t.locale)
        }
        formatHorzItem(t) {
            return this.Cf.Cu(new Date(1e3 * t.Sf))
        }
        formatTickmark(t, i) {
            let e = function(t, i, e) {
                    switch (t) {
                        case 0:
                        case 10:
                            return i ? e ? 4 : 3 : 2;
                        case 20:
                        case 21:
                        case 22:
                        case 30:
                        case 31:
                        case 32:
                        case 33:
                            return i ? 3 : 2;
                        case 50:
                            return 2;
                        case 60:
                            return 1;
                        case 70:
                            return 0
                    }
                }(t.weight, this.yn.timeScale.timeVisible, this.yn.timeScale.secondsVisible),
                s = this.yn.timeScale;
            if (void 0 !== s.tickMarkFormatter) {
                let h = s.tickMarkFormatter(t.originalTime, e, i.locale);
                if (null !== h) return h
            }
            return function(t, i, e) {
                let s = {};
                switch (i) {
                    case 0:
                        s.year = "numeric";
                        break;
                    case 1:
                        s.month = "short";
                        break;
                    case 2:
                        s.day = "numeric";
                        break;
                    case 3:
                        s.hour12 = !1, s.hour = "2-digit", s.minute = "2-digit";
                        break;
                    case 4:
                        s.hour12 = !1, s.hour = "2-digit", s.minute = "2-digit", s.second = "2-digit"
                }
                let h = new Date(void 0 === t.xf ? 1e3 * t.Sf : Date.UTC(t.xf.year, t.xf.month - 1, t.xf.day));
                return new Date(h.getUTCFullYear(), h.getUTCMonth(), h.getUTCDate(), h.getUTCHours(), h.getUTCMinutes(), h.getUTCSeconds(), h.getUTCMilliseconds()).toLocaleString(e, s)
            }(t.time, e, i.locale)
        }
        maxTickMarkWeight(t) {
            let i = t.reduce(iF, t[0]).weight;
            return i > 30 && i < 50 && (i = 30), i
        }
        fillWeightsForPoints(t, i) {
            ! function(t, i = 0) {
                if (0 === t.length) return;
                let e = 0 === i ? null : t[i - 1].time.Sf,
                    s = null !== e ? new Date(1e3 * e) : null,
                    h = 0;
                for (let n = i; n < t.length; ++n) {
                    let i = t[n],
                        l = new Date(1e3 * i.time.Sf);
                    null !== s && (i.timeWeight = ij(l, s)), h += i.time.Sf - (e || i.time.Sf), e = i.time.Sf, s = l
                }
                if (0 === i && t.length > 1) {
                    let i = Math.ceil(h / (t.length - 1)),
                        e = new Date(1e3 * (t[0].time.Sf - i));
                    t[0].timeWeight = ij(new Date(1e3 * t[0].time.Sf), e)
                }
            }(t, i)
        }
        static yf(t) {
            return I({
                localization: {
                    dateFormat: "dd MMM 'yy"
                }
            }, t ? ? {})
        }
    }
    let i3 = "u" > typeof window;

    function i5() {
        return !!i3 && window.navigator.userAgent.toLowerCase().indexOf("firefox") > -1
    }

    function i6() {
        return !!i3 && /iPhone|iPad|iPod/.test(window.navigator.platform)
    }
    class i4 {
        constructor(t, i, e) {
            this.kf = 0, this.Pf = null, this.Tf = {
                _t: -1 / 0,
                ut: 1 / 0
            }, this.Rf = 0, this.Df = null, this.If = {
                _t: -1 / 0,
                ut: 1 / 0
            }, this.Vf = null, this.Bf = !1, this.Ef = null, this.Af = null, this.Lf = !1, this.zf = !1, this.Of = !1, this.Nf = null, this.Ff = null, this.Wf = null, this.Hf = null, this.Uf = null, this.$f = null, this.jf = null, this.qf = 0, this.Yf = !1, this.Kf = !1, this.Zf = !1, this.Gf = 0, this.Xf = null, this.Jf = !i6(), this.Qf = t => {
                this.tp(t)
            }, this.ip = t => {
                if (this.np(t)) {
                    let i = this.sp(t);
                    if (++this.Rf, this.Df && this.Rf > 1) {
                        let {
                            ep: e
                        } = this.rp(i8(t), this.If);
                        e < 30 && !this.Of && this.hp(i, this.lp.ap), this.op()
                    }
                } else {
                    let i = this.sp(t);
                    if (++this.kf, this.Pf && this.kf > 1) {
                        let {
                            ep: e
                        } = this.rp(i8(t), this.Tf);
                        e < 5 && !this.zf && this._p(i, this.lp.up), this.cp()
                    }
                }
            }, this.dp = t, this.lp = i, this.yn = e, this.fp()
        }
        m() {
            null !== this.Nf && (this.Nf(), this.Nf = null), null !== this.Ff && (this.Ff(), this.Ff = null), null !== this.Hf && (this.Hf(), this.Hf = null), null !== this.Uf && (this.Uf(), this.Uf = null), null !== this.$f && (this.$f(), this.$f = null), null !== this.Wf && (this.Wf(), this.Wf = null), this.pp(), this.cp()
        }
        vp(t) {
            this.Hf && this.Hf();
            let i = this.mp.bind(this);
            if (this.Hf = () => {
                    this.dp.removeEventListener("mousemove", i)
                }, this.dp.addEventListener("mousemove", i), this.np(t)) return;
            let e = this.sp(t);
            this._p(e, this.lp.wp), this.Jf = !0
        }
        cp() {
            null !== this.Pf && clearTimeout(this.Pf), this.kf = 0, this.Pf = null, this.Tf = {
                _t: -1 / 0,
                ut: 1 / 0
            }
        }
        op() {
            null !== this.Df && clearTimeout(this.Df), this.Rf = 0, this.Df = null, this.If = {
                _t: -1 / 0,
                ut: 1 / 0
            }
        }
        mp(t) {
            if (this.Zf || null !== this.Af || this.np(t)) return;
            let i = this.sp(t);
            this._p(i, this.lp.Mp), this.Jf = !0
        }
        gp(t) {
            let i = ei(t.changedTouches, P(this.Xf));
            if (null === i || (this.Gf = et(t), null !== this.jf) || this.Kf) return;
            this.Yf = !0;
            let {
                bp: e,
                Sp: s,
                ep: h
            } = this.rp(i8(i), P(this.Af));
            if (this.Lf || !(h < 5)) {
                if (!this.Lf) {
                    let t = .5 * e,
                        i = s >= t && !this.yn.xp(),
                        h = t > s && !this.yn.Cp();
                    i || h || (this.Kf = !0), this.Lf = !0, this.Of = !0, this.pp(), this.op()
                }
                if (!this.Kf) {
                    let e = this.sp(t, i);
                    this.hp(e, this.lp.yp), i7(t)
                }
            }
        }
        kp(t) {
            if (0 !== t.button) return;
            let {
                ep: i
            } = this.rp(i8(t), P(this.Ef));
            if (i >= 5 && (this.zf = !0, this.cp()), this.zf) {
                let i = this.sp(t);
                this._p(i, this.lp.Pp)
            }
        }
        rp(t, i) {
            let e = Math.abs(i._t - t._t),
                s = Math.abs(i.ut - t.ut);
            return {
                bp: e,
                Sp: s,
                ep: e + s
            }
        }
        Tp(t) {
            let i = ei(t.changedTouches, P(this.Xf));
            if (null === i && 0 === t.touches.length && (i = t.changedTouches[0]), null === i) return;
            this.Xf = null, this.Gf = et(t), this.pp(), this.Af = null, this.$f && (this.$f(), this.$f = null);
            let e = this.sp(t, i);
            if (this.hp(e, this.lp.Rp), ++this.Rf, this.Df && this.Rf > 1) {
                let {
                    ep: t
                } = this.rp(i8(i), this.If);
                t < 30 && !this.Of && this.hp(e, this.lp.ap), this.op()
            } else this.Of || (this.hp(e, this.lp.Dp), this.lp.Dp && i7(t));
            0 === this.Rf && i7(t), 0 === t.touches.length && this.Bf && (this.Bf = !1, i7(t))
        }
        tp(t) {
            if (0 !== t.button) return;
            let i = this.sp(t);
            if (this.Ef = null, this.Zf = !1, this.Uf && (this.Uf(), this.Uf = null), i5() && this.dp.ownerDocument.documentElement.removeEventListener("mouseleave", this.Qf), !this.np(t))
                if (this._p(i, this.lp.Ip), ++this.kf, this.Pf && this.kf > 1) {
                    let {
                        ep: e
                    } = this.rp(i8(t), this.Tf);
                    e < 5 && !this.zf && this._p(i, this.lp.up), this.cp()
                } else this.zf || this._p(i, this.lp.Vp)
        }
        pp() {
            null !== this.Vf && (clearTimeout(this.Vf), this.Vf = null)
        }
        Bp(t) {
            if (null !== this.Xf) return;
            let i = t.changedTouches[0];
            this.Xf = i.identifier, this.Gf = et(t);
            let e = this.dp.ownerDocument.documentElement;
            this.Of = !1, this.Lf = !1, this.Kf = !1, this.Af = i8(i), this.$f && (this.$f(), this.$f = null); {
                let i = this.gp.bind(this),
                    s = this.Tp.bind(this);
                this.$f = () => {
                    e.removeEventListener("touchmove", i), e.removeEventListener("touchend", s)
                }, e.addEventListener("touchmove", i, {
                    passive: !1
                }), e.addEventListener("touchend", s, {
                    passive: !1
                }), this.pp(), this.Vf = setTimeout(this.Ep.bind(this, t), 240)
            }
            let s = this.sp(t, i);
            this.hp(s, this.lp.Ap), this.Df || (this.Rf = 0, this.Df = setTimeout(this.op.bind(this), 500), this.If = i8(i))
        }
        Lp(t) {
            if (0 !== t.button) return;
            let i = this.dp.ownerDocument.documentElement;
            i5() && i.addEventListener("mouseleave", this.Qf), this.zf = !1, this.Ef = i8(t), this.Uf && (this.Uf(), this.Uf = null); {
                let t = this.kp.bind(this),
                    e = this.tp.bind(this);
                this.Uf = () => {
                    i.removeEventListener("mousemove", t), i.removeEventListener("mouseup", e)
                }, i.addEventListener("mousemove", t), i.addEventListener("mouseup", e)
            }
            if (this.Zf = !0, this.np(t)) return;
            let e = this.sp(t);
            this._p(e, this.lp.zp), this.Pf || (this.kf = 0, this.Pf = setTimeout(this.cp.bind(this), 500), this.Tf = i8(t))
        }
        fp() {
            var t;
            this.dp.addEventListener("mouseenter", this.vp.bind(this)), this.dp.addEventListener("touchcancel", this.pp.bind(this)); {
                let t = this.dp.ownerDocument,
                    i = t => {
                        this.lp.Op && (t.composed && this.dp.contains(t.composedPath()[0]) || t.target && this.dp.contains(t.target) || this.lp.Op())
                    };
                this.Ff = () => {
                    t.removeEventListener("touchstart", i)
                }, this.Nf = () => {
                    t.removeEventListener("mousedown", i)
                }, t.addEventListener("mousedown", i), t.addEventListener("touchstart", i, {
                    passive: !0
                })
            }
            i6() && (this.Wf = () => {
                this.dp.removeEventListener("dblclick", this.ip)
            }, this.dp.addEventListener("dblclick", this.ip)), this.dp.addEventListener("mouseleave", this.Np.bind(this)), this.dp.addEventListener("touchstart", this.Bp.bind(this), {
                passive: !0
            }), t = this.dp, i3 && void 0 !== window.chrome && t.addEventListener("mousedown", t => {
                if (1 === t.button) return t.preventDefault(), !1
            }), this.dp.addEventListener("mousedown", this.Lp.bind(this)), this.Fp(), this.dp.addEventListener("touchmove", () => {}, {
                passive: !1
            })
        }
        Fp() {
            void 0 === this.lp.Wp && void 0 === this.lp.Hp && void 0 === this.lp.Up || (this.dp.addEventListener("touchstart", t => this.$p(t.touches), {
                passive: !0
            }), this.dp.addEventListener("touchmove", t => {
                if (2 === t.touches.length && null !== this.jf && void 0 !== this.lp.Hp) {
                    let i = i9(t.touches[0], t.touches[1]) / this.qf;
                    this.lp.Hp(this.jf, i), i7(t)
                }
            }, {
                passive: !1
            }), this.dp.addEventListener("touchend", t => {
                this.$p(t.touches)
            }))
        }
        $p(t) {
            1 === t.length && (this.Yf = !1), 2 !== t.length || this.Yf || this.Bf ? this.jp() : this.qp(t)
        }
        qp(t) {
            let i = this.dp.getBoundingClientRect() || {
                left: 0,
                top: 0
            };
            this.jf = {
                _t: (t[0].clientX - i.left + (t[1].clientX - i.left)) / 2,
                ut: (t[0].clientY - i.top + (t[1].clientY - i.top)) / 2
            }, this.qf = i9(t[0], t[1]), void 0 !== this.lp.Wp && this.lp.Wp(), this.pp()
        }
        jp() {
            null !== this.jf && (this.jf = null, void 0 !== this.lp.Up && this.lp.Up())
        }
        Np(t) {
            if (this.Hf && this.Hf(), this.np(t) || !this.Jf) return;
            let i = this.sp(t);
            this._p(i, this.lp.Yp), this.Jf = !i6()
        }
        Ep(t) {
            let i = ei(t.touches, P(this.Xf));
            if (null === i) return;
            let e = this.sp(t, i);
            this.hp(e, this.lp.Kp), this.Of = !0, this.Bf = !0
        }
        np(t) {
            return t.sourceCapabilities && void 0 !== t.sourceCapabilities.firesTouchEvents ? t.sourceCapabilities.firesTouchEvents : et(t) < this.Gf + 500
        }
        hp(t, i) {
            i && i.call(this.lp, t)
        }
        _p(t, i) {
            i && i.call(this.lp, t)
        }
        sp(t, i) {
            let e = i || t,
                s = this.dp.getBoundingClientRect() || {
                    left: 0,
                    top: 0
                };
            return {
                clientX: e.clientX,
                clientY: e.clientY,
                pageX: e.pageX,
                pageY: e.pageY,
                screenX: e.screenX,
                screenY: e.screenY,
                localX: e.clientX - s.left,
                localY: e.clientY - s.top,
                ctrlKey: t.ctrlKey,
                altKey: t.altKey,
                shiftKey: t.shiftKey,
                metaKey: t.metaKey,
                Zp: !t.type.startsWith("mouse") && "contextmenu" !== t.type && "click" !== t.type,
                Gp: t.type,
                Xp: e.target,
                gu: t.view,
                Jp: () => {
                    "touchstart" !== t.type && i7(t)
                }
            }
        }
    }

    function i9(t, i) {
        let e = t.clientX - i.clientX,
            s = t.clientY - i.clientY;
        return Math.sqrt(e * e + s * s)
    }

    function i7(t) {
        t.cancelable && t.preventDefault()
    }

    function i8(t) {
        return {
            _t: t.pageX,
            ut: t.pageY
        }
    }

    function et(t) {
        return t.timeStamp || performance.now()
    }

    function ei(t, i) {
        for (let e = 0; e < t.length; ++e)
            if (t[e].identifier === i) return t[e];
        return null
    }
    class ee {
        constructor(t, i, e) {
            this.Qp = null, this.tv = null, this.iv = !0, this.nv = null, this.sv = t, this.ev = t.rv()[i], this.hv = t.rv()[e], this.av = document.createElement("tr"), this.av.style.height = "1px", this.lv = document.createElement("td"), this.lv.style.position = "relative", this.lv.style.padding = "0", this.lv.style.margin = "0", this.lv.setAttribute("colspan", "3"), this.ov(), this.av.appendChild(this.lv), this.iv = this.sv.N().layout.panes.enableResize, this.iv ? this._v() : (this.Qp = null, this.tv = null)
        }
        m() {
            null !== this.tv && this.tv.m()
        }
        uv() {
            return this.av
        }
        cv() {
            return i({
                width: this.ev.cv().width,
                height: 1
            })
        }
        dv() {
            return i({
                width: this.ev.dv().width,
                height: +window.devicePixelRatio
            })
        }
        fv(t, i, e) {
            let s = this.dv();
            t.fillStyle = this.sv.N().layout.panes.separatorColor, t.fillRect(i, e, s.width, s.height)
        }
        kt() {
            this.ov(), this.sv.N().layout.panes.enableResize !== this.iv && (this.iv = this.sv.N().layout.panes.enableResize, this.iv ? this._v() : (null !== this.Qp && (this.lv.removeChild(this.Qp.pv), this.lv.removeChild(this.Qp.vv), this.Qp = null), null !== this.tv && (this.tv.m(), this.tv = null)))
        }
        _v() {
            let t = document.createElement("div"),
                i = t.style;
            i.position = "fixed", i.display = "none", i.zIndex = "49", i.top = "0", i.left = "0", i.width = "100%", i.height = "100%", i.cursor = "row-resize", this.lv.appendChild(t);
            let e = document.createElement("div"),
                s = e.style;
            s.position = "absolute", s.zIndex = "50", s.top = "-4px", s.height = "9px", s.width = "100%", s.backgroundColor = "", s.cursor = "row-resize", this.lv.appendChild(e);
            let h = {
                wp: this.mv.bind(this),
                Yp: this.wv.bind(this),
                zp: this.Mv.bind(this),
                Ap: this.Mv.bind(this),
                Pp: this.gv.bind(this),
                yp: this.gv.bind(this),
                Ip: this.bv.bind(this),
                Rp: this.bv.bind(this)
            };
            this.tv = new i4(e, h, {
                xp: () => !1,
                Cp: () => !0
            }), this.Qp = {
                vv: e,
                pv: t
            }
        }
        ov() {
            this.lv.style.background = this.sv.N().layout.panes.separatorColor
        }
        mv(t) {
            null !== this.Qp && (this.Qp.vv.style.backgroundColor = this.sv.N().layout.panes.separatorHoverColor)
        }
        wv(t) {
            null !== this.Qp && null === this.nv && (this.Qp.vv.style.backgroundColor = "")
        }
        Mv(t) {
            if (null === this.Qp) return;
            let i = this.ev.Sv().z_() + this.hv.Sv().z_(),
                e = i / (this.ev.cv().height + this.hv.cv().height),
                s = 30 * e;
            i <= 2 * s || (this.nv = {
                xv: t.pageY,
                Cv: this.ev.Sv().z_(),
                yv: i - s,
                kv: i,
                Pv: e,
                Tv: s
            }, this.Qp.pv.style.display = "block")
        }
        gv(t) {
            let i = this.nv;
            if (null === i) return;
            let e = (t.pageY - i.xv) * i.Pv,
                s = io(i.Cv + e, i.Tv, i.yv);
            this.ev.Sv().O_(s), this.hv.Sv().O_(i.kv - s), this.sv.Qt().Pa()
        }
        bv(t) {
            null !== this.nv && null !== this.Qp && (this.nv = null, this.Qp.pv.style.display = "none")
        }
    }

    function es(t, i, e) {
        let s = (t.Rv - i.Rv) / (t.wt - i.wt);
        return Math.sign(s) * Math.min(Math.abs(s), e)
    }
    class eh {
        constructor(t, i, e, s) {
            this.Dv = null, this.Iv = null, this.Vv = null, this.Bv = null, this.Ev = null, this.Av = 0, this.Lv = 0, this.zv = t, this.Ov = i, this.Nv = e, this.ks = s
        }
        Fv(t, i) {
            if (null !== this.Dv) {
                if (this.Dv.wt === i) return void(this.Dv.Rv = t);
                if (Math.abs(this.Dv.Rv - t) < this.ks) return
            }
            this.Bv = this.Vv, this.Vv = this.Iv, this.Iv = this.Dv, this.Dv = {
                wt: i,
                Rv: t
            }
        }
        me(t, i) {
            var e, s, h, n, l, r, o;
            let a;
            if (null === this.Dv || null === this.Iv || i - this.Dv.wt > 50) return;
            let u = 0,
                c = es(this.Dv, this.Iv, this.Ov),
                d = (e = this.Dv, s = this.Iv, e.Rv - s.Rv),
                f = [c],
                m = [d];
            if (u += d, null !== this.Vv) {
                let t = es(this.Iv, this.Vv, this.Ov);
                if (Math.sign(t) === Math.sign(c)) {
                    let i = (h = this.Iv, n = this.Vv, h.Rv - n.Rv);
                    if (f.push(t), m.push(i), u += i, null !== this.Bv) {
                        let t = es(this.Vv, this.Bv, this.Ov);
                        if (Math.sign(t) === Math.sign(c)) {
                            let i = (l = this.Vv, r = this.Bv, l.Rv - r.Rv);
                            f.push(t), m.push(i), u += i
                        }
                    }
                }
            }
            let p = 0;
            for (let t = 0; t < f.length; ++t) p += m[t] / u * f[t];
            Math.abs(p) < this.zv || (this.Ev = {
                Rv: t,
                wt: i
            }, this.Lv = p, this.Av = (o = Math.abs(p), Math.log(-((a = Math.log(this.Nv)) / o)) / a))
        }
        qc(t) {
            let i = P(this.Ev),
                e = t - i.wt;
            return i.Rv + this.Lv * (Math.pow(this.Nv, e) - 1) / Math.log(this.Nv)
        }
        jc(t) {
            return null === this.Ev || this.Wv(t) === this.Av
        }
        Wv(t) {
            return Math.min(t - P(this.Ev).wt, this.Av)
        }
    }
    class en {
        constructor(t, i) {
            this.Hv = void 0, this.Uv = void 0, this.$v = void 0, this.vn = !1, this.jv = t, this.qv = i, this.Yv()
        }
        kt() {
            this.Yv()
        }
        Kv() {
            this.Hv && this.jv.removeChild(this.Hv), this.Uv && this.jv.removeChild(this.Uv), this.Hv = void 0, this.Uv = void 0
        }
        Zv() {
            return this.vn !== this.Gv() || this.$v !== this.Xv()
        }
        Xv() {
            return this.qv.Qt().Xi().J(this.qv.N().layout.textColor) > 160 ? "dark" : "light"
        }
        Gv() {
            return this.qv.N().layout.attributionLogo
        }
        Jv() {
            let t = new URL(location.href);
            return t.hostname ? "&utm_source=" + t.hostname + t.pathname : ""
        }
        Yv() {
            this.Zv() && (this.Kv(), this.vn = this.Gv(), this.vn && (this.$v = this.Xv(), this.Uv = document.createElement("style"), this.Uv.innerText = "a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}", this.Hv = document.createElement("a"), this.Hv.href = `https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.Jv()}`, this.Hv.title = "Charting by TradingView", this.Hv.id = "tv-attr-logo", this.Hv.target = "_blank", this.Hv.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>', this.Hv.toggleAttribute("data-dark", "dark" === this.$v), this.jv.appendChild(this.Uv), this.jv.appendChild(this.Hv)))
        }
    }

    function el(t, i) {
        let e = P(t.ownerDocument).createElement("canvas");
        t.appendChild(e);
        let s = function(t, i) {
            if ("device-pixel-content-box" === i.type) return new S(t, i.transform, i.options);
            throw Error("Unsupported binding target")
        }(e, {
            type: "device-pixel-content-box",
            options: {
                allowResizeObserver: !0
            },
            transform: (t, i) => ({
                width: Math.max(t.width, i.width),
                height: Math.max(t.height, i.height)
            })
        });
        return s.resizeCanvasElement(i), s
    }

    function er(t) {
        t.width = 1, t.height = 1, t.getContext("2d") ? .clearRect(0, 0, 1, 1)
    }

    function eo(t, i, e, s) {
        t.qh && t.qh(i, e, s)
    }

    function ea(t, i, e, s) {
        t.st(i, e, s)
    }

    function eu(t, i, e, s) {
        for (let h of t(e, s)) {
            let t = h.Tt(s);
            null !== t && i(t)
        }
    }

    function ec(t, i) {
        return e => void 0 === e.Ft || (e.Ft() ? .cl() ? ? "") !== i ? [] : e.Ga ? .(t) ? ? []
    }

    function ed(t, i, e, s) {
        if (!t.length) return;
        let h = 0,
            n = t[0].$t(s, !0),
            l = 1 === i ? e / 2 - (t[0].Hi() - n / 2) : t[0].Hi() - n / 2 - e / 2;
        l = Math.max(0, l);
        for (let n = 1; n < t.length; n++) {
            let r = t[n],
                o = t[n - 1],
                a = o.$t(s, !1),
                u = r.Hi(),
                c = o.Hi();
            if (1 === i ? u > c - a : u < c + a) {
                let s = c - a * i;
                r.Ui(s);
                let n = s - i * a / 2;
                if ((1 === i ? n < 0 : n > e) && l > 0) {
                    let s = Math.min(1 === i ? -1 - n : n - e, l);
                    for (let e = h; e < t.length; e++) t[e].Ui(t[e].Hi() + i * s);
                    l -= s
                }
            } else h = n, l = 1 === i ? c - a - u : u - (c + a)
        }
    }
    class ef {
        constructor(t, e, s, h) {
            this.Ki = null, this.Qv = null, this.tm = !1, this.im = new tS(200), this.nm = null, this.sm = 0, this.rm = !1, this.hm = () => {
                this.rm || this.yt.am().Qt().mr()
            }, this.lm = () => {
                this.rm || this.yt.am().Qt().mr()
            }, this.yt = t, this.yn = e, this.ko = e.layout, this.wd = s, this.om = "left" === h, this._m = ec("normal", h), this.um = ec("top", h), this.dm = ec("bottom", h), this.lv = document.createElement("div"), this.lv.style.height = "100%", this.lv.style.overflow = "hidden", this.lv.style.width = "25px", this.lv.style.left = "0", this.lv.style.position = "relative", this.fm = el(this.lv, i({
                width: 16,
                height: 16
            })), this.fm.subscribeSuggestedBitmapSizeChanged(this.hm);
            const n = this.fm.canvasElement;
            n.style.position = "absolute", n.style.zIndex = "1", n.style.left = "0", n.style.top = "0", this.pm = el(this.lv, i({
                width: 16,
                height: 16
            })), this.pm.subscribeSuggestedBitmapSizeChanged(this.lm);
            const l = this.pm.canvasElement;
            l.style.position = "absolute", l.style.zIndex = "2", l.style.left = "0", l.style.top = "0";
            const r = {
                zp: this.Mv.bind(this),
                Ap: this.Mv.bind(this),
                Pp: this.gv.bind(this),
                yp: this.gv.bind(this),
                Op: this.vm.bind(this),
                Ip: this.bv.bind(this),
                Rp: this.bv.bind(this),
                up: this.wm.bind(this),
                ap: this.wm.bind(this),
                wp: this.Mm.bind(this),
                Yp: this.wv.bind(this)
            };
            this.tv = new i4(this.pm.canvasElement, r, {
                xp: () => !this.yn.handleScroll.vertTouchDrag,
                Cp: () => !0
            })
        }
        m() {
            this.tv.m(), this.pm.unsubscribeSuggestedBitmapSizeChanged(this.lm), er(this.pm.canvasElement), this.pm.dispose(), this.fm.unsubscribeSuggestedBitmapSizeChanged(this.hm), er(this.fm.canvasElement), this.fm.dispose(), null !== this.Ki && this.Ki.a_().u(this), this.Ki = null
        }
        uv() {
            return this.lv
        }
        k() {
            return this.ko.fontSize
        }
        gm() {
            let t = this.wd.N();
            return this.nm !== t.P && (this.im.Os(), this.nm = t.P), t
        }
        bm() {
            var t, i;
            if (null === this.Ki) return 0;
            let e = 0,
                s = this.gm(),
                h = P(this.fm.canvasElement.getContext("2d", {
                    colorSpace: this.yt.am().N().layout.colorSpace
                }));
            h.save();
            let n = this.Ki.El();
            h.font = this.Sm(), n.length > 0 && (e = Math.max(this.im.Ii(h, n[0].io), this.im.Ii(h, n[n.length - 1].io)));
            let l = this.xm();
            for (let t = l.length; t--;) {
                let i = this.im.Ii(h, l[t].ri());
                i > e && (e = i)
            }
            let r = this.Ki.Lt();
            if (null !== r && null !== this.Qv && 2 !== (t = this.yn.crosshair).mode && t.horzLine.visible && t.horzLine.labelVisible) {
                let t = this.Ki.Tn(1, r),
                    i = this.Ki.Tn(this.Qv.height - 2, r);
                e = Math.max(e, this.im.Ii(h, this.Ki.Ji(Math.floor(Math.min(t, i)) + .11111111111111, r)), this.im.Ii(h, this.Ki.Ji(Math.ceil(Math.max(t, i)) - .11111111111111, r)))
            }
            h.restore();
            let o = e || 34;
            return (i = Math.ceil(s.S + s.C + s.V + s.B + 5 + o)) + i % 2
        }
        Cm(t) {
            null !== this.Qv && e(this.Qv, t) || (this.Qv = t, this.rm = !0, this.fm.resizeCanvasElement(t), this.pm.resizeCanvasElement(t), this.rm = !1, this.lv.style.width = `${t.width}px`, this.lv.style.height = `${t.height}px`)
        }
        ym() {
            return P(this.Qv).width
        }
        un(t) {
            this.Ki !== t && (null !== this.Ki && this.Ki.a_().u(this), this.Ki = t, t.a_().i(this.po.bind(this), this))
        }
        Ft() {
            return this.Ki
        }
        Os() {
            let t = this.yt.Sv();
            this.yt.am().Qt().eu(t, P(this.Ft()))
        }
        km(t) {
            if (null === this.Qv) return;
            let i = {
                colorSpace: this.yt.am().N().layout.colorSpace
            };
            if (1 !== t) {
                this.Pm(), this.fm.applySuggestedBitmapSize();
                let t = z(this.fm, i);
                null !== t && (t.useBitmapCoordinateSpace(t => {
                    this.Tm(t), this.Rm(t)
                }), this.yt.Dm(t, this.dm), this.Im(t), this.yt.Dm(t, this._m), this.Vm(t))
            }
            this.pm.applySuggestedBitmapSize();
            let e = z(this.pm, i);
            null !== e && (e.useBitmapCoordinateSpace(({
                context: t,
                bitmapSize: i
            }) => {
                t.clearRect(0, 0, i.width, i.height)
            }), this.Bm(e), this.yt.Dm(e, this.um))
        }
        dv() {
            return this.fm.bitmapSize
        }
        fv(t, i, e, s) {
            let h = this.dv();
            if (h.width > 0 && h.height > 0 && (t.drawImage(this.fm.canvasElement, i, e), s)) {
                let s = this.pm.canvasElement;
                t.drawImage(s, i, e)
            }
        }
        kt() {
            this.Ki ? .El()
        }
        Mv(t) {
            if (null === this.Ki || this.Ki.Gi() || !this.yn.handleScale.axisPressedMouseMove.price) return;
            let i = this.yt.am().Qt(),
                e = this.yt.Sv();
            this.tm = !0, i.G_(e, this.Ki, t.localY)
        }
        gv(t) {
            if (null === this.Ki || !this.yn.handleScale.axisPressedMouseMove.price) return;
            let i = this.yt.am().Qt(),
                e = this.yt.Sv(),
                s = this.Ki;
            i.X_(e, s, t.localY)
        }
        vm() {
            if (null === this.Ki || !this.yn.handleScale.axisPressedMouseMove.price) return;
            let t = this.yt.am().Qt(),
                i = this.yt.Sv(),
                e = this.Ki;
            this.tm && (this.tm = !1, t.J_(i, e))
        }
        bv(t) {
            if (null === this.Ki || !this.yn.handleScale.axisPressedMouseMove.price) return;
            let i = this.yt.am().Qt(),
                e = this.yt.Sv();
            this.tm = !1, i.J_(e, this.Ki)
        }
        wm(t) {
            this.yn.handleScale.axisDoubleClickReset.price && this.Os()
        }
        Mm(t) {
            null !== this.Ki && (!this.yt.am().Qt().N().handleScale.axisPressedMouseMove.price || this.Ki.je() || this.Ki.Lo() || this.Em(1))
        }
        wv(t) {
            this.Em(0)
        }
        xm() {
            let t = [],
                i = null === this.Ki ? void 0 : this.Ki;
            return (e => {
                for (let s = 0; s < e.length; ++s) {
                    let h = e[s].qn(this.yt.Sv(), i);
                    for (let i = 0; i < h.length; i++) t.push(h[i])
                }
            })(this.yt.Sv().Dt()), t
        }
        Tm({
            context: t,
            bitmapSize: i
        }) {
            let {
                width: e,
                height: s
            } = i, h = this.yt.Sv().Qt(), n = h.$(), l = h.ef();
            n === l ? th(t, 0, 0, e, s, n) : tr(t, 0, 0, e, s, n, l)
        }
        Rm({
            context: t,
            bitmapSize: i,
            horizontalPixelRatio: e
        }) {
            let s;
            if (null === this.Qv || null === this.Ki || !this.Ki.N().borderVisible) return;
            t.fillStyle = this.Ki.N().borderColor;
            let h = Math.max(1, Math.floor(this.gm().S * e));
            s = this.om ? i.width - h : 0, t.fillRect(s, 0, h, i.height)
        }
        Im(t) {
            if (null === this.Qv || null === this.Ki) return;
            let i = this.Ki.El(),
                e = this.Ki.N(),
                s = this.gm(),
                h = this.om ? this.Qv.width - s.C : 0;
            e.borderVisible && e.ticksVisible && t.useBitmapCoordinateSpace(({
                context: t,
                horizontalPixelRatio: n,
                verticalPixelRatio: l
            }) => {
                t.fillStyle = e.borderColor;
                let r = Math.max(1, Math.floor(l)),
                    o = Math.floor(.5 * l),
                    a = Math.round(s.C * n);
                for (let e of (t.beginPath(), i)) t.rect(Math.floor(h * n), Math.round(e.Rl * l) - o, a, r);
                t.fill()
            }), t.useMediaCoordinateSpace(({
                context: t
            }) => {
                t.font = this.Sm(), t.fillStyle = e.textColor ? ? this.ko.textColor, t.textAlign = this.om ? "right" : "left", t.textBaseline = "middle";
                let n = this.om ? Math.round(h - s.V) : Math.round(h + s.C + s.V),
                    l = i.map(i => this.im.Di(t, i.io));
                for (let e = i.length; e--;) {
                    let s = i[e];
                    t.fillText(s.io, n, s.Rl + l[e])
                }
            })
        }
        Pm() {
            if (null === this.Qv || null === this.Ki) return;
            let t = this.Qv.height / 2,
                i = [],
                e = this.Ki.Dt().slice(),
                s = this.yt.Sv(),
                h = this.gm();
            this.Ki === s.Gs() && this.yt.Sv().Dt().forEach(t => {
                s.Zs(t) && e.push(t)
            });
            let n = this.Ki.Cl()[0],
                l = this.Ki;
            e.forEach(e => {
                let h = e.qn(s, l);
                h.forEach(t => {
                    t.$i() && null === t.Wi() && (t.Ui(null), i.push(t))
                }), n === e && h.length > 0 && (t = h[0].Ei())
            }), this.Ki.N().alignLabels && this.Am(i, h, t)
        }
        Am(t, i, e) {
            if (null === this.Qv) return;
            let s = t.filter(t => t.Ei() <= e),
                h = t.filter(t => t.Ei() > e);
            for (let e of (s.sort((t, i) => i.Ei() - t.Ei()), s.length && h.length && h.push(s[0]), h.sort((t, i) => t.Ei() - i.Ei()), t)) {
                let t = Math.floor(e.$t(i) / 2),
                    s = e.Ei();
                s > -t && s < t && e.Ui(t), s > this.Qv.height - t && s < this.Qv.height + t && e.Ui(this.Qv.height - t)
            }
            ed(s, 1, this.Qv.height, i), ed(h, -1, this.Qv.height, i)
        }
        Vm(t) {
            if (null === this.Qv) return;
            let i = this.xm(),
                e = this.gm(),
                s = this.om ? "right" : "left";
            i.forEach(i => {
                i.ji() && i.Tt(P(this.Ki)).st(t, e, this.im, s)
            })
        }
        Bm(t) {
            if (null === this.Qv || null === this.Ki) return;
            let i = this.yt.am().Qt(),
                e = [],
                s = this.yt.Sv(),
                h = i.Rd().qn(s, this.Ki);
            h.length && e.push(h);
            let n = this.gm(),
                l = this.om ? "right" : "left";
            e.forEach(i => {
                i.forEach(i => {
                    i.Tt(P(this.Ki)).st(t, n, this.im, l)
                })
            })
        }
        Em(t) {
            this.lv.style.cursor = 1 === t ? "ns-resize" : "default"
        }
        po() {
            let t = this.bm();
            this.sm < t && this.yt.am().Qt().Pa(), this.sm = t
        }
        Sm() {
            return Z(this.ko.fontSize, this.ko.fontFamily)
        }
    }

    function em(t, i) {
        return t.Ka ? .(i) ? ? []
    }

    function ep(t, i) {
        return t.jn ? .(i) ? ? []
    }

    function ev(t, i) {
        return t.cn ? .(i) ? ? []
    }

    function eg(t, i) {
        return t.ja ? .(i) ? ? []
    }
    class ew {
        constructor(t, e) {
            this.Qv = i({
                width: 0,
                height: 0
            }), this.Lm = null, this.zm = null, this.Om = null, this.Nm = null, this.Fm = !1, this.Wm = new W, this.Hm = new W, this.Um = 0, this.$m = !1, this.jm = null, this.qm = !1, this.Ym = null, this.Km = null, this.rm = !1, this.hm = () => {
                this.rm || null === this.Zm || this.sn().mr()
            }, this.lm = () => {
                this.rm || null === this.Zm || this.sn().mr()
            }, this.qv = t, this.Zm = e, this.Zm.fu().i(this.Gm.bind(this), this, !0), this.Xm = document.createElement("td"), this.Xm.style.padding = "0", this.Xm.style.position = "relative";
            const s = document.createElement("div");
            s.style.width = "100%", s.style.height = "100%", s.style.position = "relative", s.style.overflow = "hidden", this.Jm = document.createElement("td"), this.Jm.style.padding = "0", this.Qm = document.createElement("td"), this.Qm.style.padding = "0", this.Xm.appendChild(s), this.fm = el(s, i({
                width: 16,
                height: 16
            })), this.fm.subscribeSuggestedBitmapSizeChanged(this.hm);
            const h = this.fm.canvasElement;
            h.style.position = "absolute", h.style.zIndex = "1", h.style.left = "0", h.style.top = "0", this.pm = el(s, i({
                width: 16,
                height: 16
            })), this.pm.subscribeSuggestedBitmapSizeChanged(this.lm);
            const n = this.pm.canvasElement;
            n.style.position = "absolute", n.style.zIndex = "2", n.style.left = "0", n.style.top = "0", this.av = document.createElement("tr"), this.av.appendChild(this.Jm), this.av.appendChild(this.Xm), this.av.appendChild(this.Qm), this.tw(), this.tv = new i4(this.pm.canvasElement, this, {
                xp: () => null === this.jm && !this.qv.N().handleScroll.vertTouchDrag,
                Cp: () => null === this.jm && !this.qv.N().handleScroll.horzTouchDrag
            })
        }
        m() {
            null !== this.Lm && this.Lm.m(), null !== this.zm && this.zm.m(), this.Om = null, this.pm.unsubscribeSuggestedBitmapSizeChanged(this.lm), er(this.pm.canvasElement), this.pm.dispose(), this.fm.unsubscribeSuggestedBitmapSizeChanged(this.hm), er(this.fm.canvasElement), this.fm.dispose(), null !== this.Zm && (this.Zm.fu().u(this), this.Zm.m()), this.tv.m()
        }
        Sv() {
            return P(this.Zm)
        }
        iw(t) {
            null !== this.Zm && this.Zm.fu().u(this), this.Zm = t, null !== this.Zm && this.Zm.fu().i(ew.prototype.Gm.bind(this), this, !0), this.tw(), this.qv.rv().indexOf(this) === this.qv.rv().length - 1 ? (this.Om = this.Om ? ? new en(this.Xm, this.qv), this.Om.kt()) : (this.Om ? .Kv(), this.Om = null)
        }
        am() {
            return this.qv
        }
        uv() {
            return this.av
        }
        tw() {
            if (null !== this.Zm && (this.nw(), 0 !== this.sn().Jn().length)) {
                if (null !== this.Lm) {
                    let t = this.Zm.K_();
                    this.Lm.un(P(t))
                }
                if (null !== this.zm) {
                    let t = this.Zm.Z_();
                    this.zm.un(P(t))
                }
            }
        }
        sw() {
            null !== this.Lm && this.Lm.kt(), null !== this.zm && this.zm.kt()
        }
        z_() {
            return null !== this.Zm ? this.Zm.z_() : 0
        }
        O_(t) {
            this.Zm && this.Zm.O_(t)
        }
        wp(t) {
            if (!this.Zm) return;
            this.ew();
            let i = t.localX,
                e = t.localY;
            this.rw(i, e, t)
        }
        zp(t) {
            this.ew(), this.hw(), this.rw(t.localX, t.localY, t)
        }
        Mp(t) {
            if (!this.Zm) return;
            this.ew();
            let i = t.localX,
                e = t.localY;
            this.rw(i, e, t)
        }
        Vp(t) {
            null !== this.Zm && (this.ew(), this.rw(t.localX, t.localY, t), this.aw(t))
        }
        up(t) {
            null !== this.Zm && this.lw(this.Hm, t)
        }
        ap(t) {
            this.up(t)
        }
        Pp(t) {
            this.ew(), this.ow(t), this.rw(t.localX, t.localY, t)
        }
        Ip(t) {
            null !== this.Zm && (this.ew(), this.$m = !1, this._w(t))
        }
        Dp(t) {
            null !== this.Zm && this.aw(t)
        }
        Kp(t) {
            if (this.$m = !0, null === this.jm) {
                let i = {
                    x: t.localX,
                    y: t.localY
                };
                this.uw(i, i, t)
            }
        }
        Yp(t) {
            null !== this.Zm && (this.ew(), this.Zm.Qt().kd(null), this.cw())
        }
        dw() {
            return this.Wm
        }
        fw() {
            return this.Hm
        }
        Wp() {
            this.Um = 1, this.sn().cs()
        }
        Hp(t, i) {
            if (!this.qv.N().handleScale.pinch) return;
            let e = 5 * (i - this.Um);
            this.Um = i, this.sn().Od(t._t, e)
        }
        Ap(t) {
            this.$m = !1, this.qm = null !== this.jm, this.hw();
            let i = this.sn().Rd();
            null !== this.jm && i.It() && (this.Ym = {
                x: i.ni(),
                y: i.si()
            }, this.jm = {
                x: t.localX,
                y: t.localY
            })
        }
        yp(t) {
            if (null === this.Zm) return;
            let i = t.localX,
                e = t.localY;
            if (null === this.jm) this.ow(t);
            else {
                this.qm = !1;
                let s = P(this.Ym),
                    h = s.x + (i - this.jm.x),
                    n = s.y + (e - this.jm.y);
                this.rw(h, n, t)
            }
        }
        Rp(t) {
            0 === this.am().N().trackingMode.exitMode && (this.qm = !0), this.pw(), this._w(t)
        }
        Qs(t, i) {
            let e = this.Zm;
            return null === e ? null : iN(e, t, i)
        }
        mw(t, e) {
            P("left" === e ? this.Lm : this.zm).Cm(i({
                width: t,
                height: this.Qv.height
            }))
        }
        cv() {
            return this.Qv
        }
        Cm(t) {
            e(this.Qv, t) || (this.Qv = t, this.rm = !0, this.fm.resizeCanvasElement(t), this.pm.resizeCanvasElement(t), this.rm = !1, this.Xm.style.width = t.width + "px", this.Xm.style.height = t.height + "px")
        }
        ww() {
            let t = P(this.Zm);
            for (let i of (t.q_(t.K_()), t.q_(t.Z_()), t.Cl()))
                if (t.Zs(i)) {
                    let e = i.Ft();
                    null !== e && t.q_(e), i.Nn()
                }
            for (let i of t.vu()) i.Nn()
        }
        dv() {
            return this.fm.bitmapSize
        }
        fv(t, i, e, s) {
            let h = this.dv();
            if (h.width > 0 && h.height > 0 && (t.drawImage(this.fm.canvasElement, i, e), s)) {
                let s = this.pm.canvasElement;
                null !== t && t.drawImage(s, i, e)
            }
        }
        km(t) {
            if (0 === t || null === this.Zm) return;
            t > 1 && this.ww(), null !== this.Lm && this.Lm.km(t), null !== this.zm && this.zm.km(t);
            let i = {
                colorSpace: this.qv.N().layout.colorSpace
            };
            if (1 !== t) {
                this.fm.applySuggestedBitmapSize();
                let t = z(this.fm, i);
                null !== t && (t.useBitmapCoordinateSpace(t => {
                    this.Tm(t)
                }), this.Zm && (this.Mw(t, em), this.gw(t), this.Mw(t, ep), this.Mw(t, ev)))
            }
            this.pm.applySuggestedBitmapSize();
            let e = z(this.pm, i);
            null !== e && (e.useBitmapCoordinateSpace(({
                context: t,
                bitmapSize: i
            }) => {
                t.clearRect(0, 0, i.width, i.height)
            }), this.bw(e), this.Mw(e, eg), this.Mw(e, ev))
        }
        Sw() {
            return this.Lm
        }
        xw() {
            return this.zm
        }
        Dm(t, i) {
            this.Mw(t, i)
        }
        Gm() {
            null !== this.Zm && this.Zm.fu().u(this), this.Zm = null
        }
        aw(t) {
            this.lw(this.Wm, t)
        }
        lw(t, i) {
            let e = i.localX,
                s = i.localY;
            t.v() && t.p(this.sn().Et().Rc(e), {
                x: e,
                y: s
            }, i)
        }
        Tm({
            context: t,
            bitmapSize: i
        }) {
            let {
                width: e,
                height: s
            } = i, h = this.sn(), n = h.$(), l = h.ef();
            n === l ? th(t, 0, 0, e, s, l) : tr(t, 0, 0, e, s, n, l)
        }
        gw(t) {
            let i = P(this.Zm),
                e = i.pu().wr().Tt(i);
            null !== e && e.st(t, !1)
        }
        bw(t) {
            this.Cw(t, ep, ea, this.sn().Rd())
        }
        Mw(t, i) {
            let e = P(this.Zm),
                s = e.au(),
                h = e.vu();
            for (let e of h) this.Cw(t, i, eo, e);
            for (let e of s) this.Cw(t, i, eo, e);
            for (let e of h) this.Cw(t, i, ea, e);
            for (let e of s) this.Cw(t, i, ea, e)
        }
        Cw(t, i, e, s) {
            let h = P(this.Zm),
                n = h.Qt().ou(),
                l = null !== n && n.lu === s,
                r = null !== n && l && void 0 !== n.wu ? n.wu.ie : void 0;
            eu(i, i => e(i, t, l, r), s, h)
        }
        nw() {
            if (null === this.Zm) return;
            let t = this.qv,
                i = this.Zm.K_().N().visible,
                e = this.Zm.Z_().N().visible;
            i || null === this.Lm || (this.Jm.removeChild(this.Lm.uv()), this.Lm.m(), this.Lm = null), e || null === this.zm || (this.Qm.removeChild(this.zm.uv()), this.zm.m(), this.zm = null);
            let s = t.Qt().Zd();
            i && null === this.Lm && (this.Lm = new ef(this, t.N(), s, "left"), this.Jm.appendChild(this.Lm.uv())), e && null === this.zm && (this.zm = new ef(this, t.N(), s, "right"), this.Qm.appendChild(this.zm.uv()))
        }
        yw(t) {
            return t.Zp && this.$m || null !== this.jm
        }
        rw(t, i, e) {
            t = Math.max(0, Math.min(t, this.Qv.width - 1)), i = Math.max(0, Math.min(i, this.Qv.height - 1)), this.sn().jd(t, i, e, P(this.Zm))
        }
        cw() {
            this.sn().Yd()
        }
        pw() {
            this.qm && (this.jm = null, this.cw())
        }
        uw(t, i, e) {
            this.jm = t, this.qm = !1, this.rw(i.x, i.y, e);
            let s = this.sn().Rd();
            this.Ym = {
                x: s.ni(),
                y: s.si()
            }
        }
        sn() {
            return this.qv.Qt()
        }
        _w(t) {
            if (!this.Fm) return;
            let i = this.sn(),
                e = this.Sv();
            if (i.iu(e, e.Pn()), this.Nm = null, this.Fm = !1, i.Hd(), null !== this.Km) {
                let t = performance.now(),
                    e = i.Et();
                this.Km.me(e.Ac(), t), this.Km.jc(t) || i.ps(this.Km)
            }
        }
        ew() {
            this.jm = null
        }
        hw() {
            if (this.Zm) {
                if (this.sn().cs(), document.activeElement !== document.body && document.activeElement !== document.documentElement) P(document.activeElement).blur();
                else {
                    let t = document.getSelection();
                    null !== t && t.removeAllRanges()
                }
                this.Zm.Pn().Gi() || this.sn().Et().Gi()
            }
        }
        ow(t) {
            if (null === this.Zm) return;
            let i = this.sn(),
                e = i.Et();
            if (e.Gi()) return;
            let s = this.qv.N(),
                h = s.handleScroll,
                n = s.kineticScroll;
            if ((!h.pressedMouseMove || t.Zp) && (!h.horzTouchDrag && !h.vertTouchDrag || !t.Zp)) return;
            let l = this.Zm.Pn(),
                r = performance.now();
            if (null !== this.Nm || this.yw(t) || (this.Nm = {
                    x: t.clientX,
                    y: t.clientY,
                    Sf: r,
                    kw: t.localX,
                    Pw: t.localY
                }), null !== this.Nm && !this.Fm && (this.Nm.x !== t.clientX || this.Nm.y !== t.clientY)) {
                if (t.Zp && n.touch || !t.Zp && n.mouse) {
                    let t = e.fl();
                    this.Km = new eh(.2 / t, 7 / t, .997, 15 / t), this.Km.Fv(e.Ac(), this.Nm.Sf)
                } else this.Km = null;
                l.Gi() || i.Q_(this.Zm, l, t.localY), i.Fd(t.localX), this.Fm = !0
            }
            this.Fm && (l.Gi() || i.tu(this.Zm, l, t.localY), i.Wd(t.localX), null !== this.Km && this.Km.Fv(e.Ac(), r))
        }
    }
    class eb {
        constructor(t, e, s, h, n) {
            this.xt = !0, this.Qv = i({
                width: 0,
                height: 0
            }), this.hm = () => this.km(3), this.om = "left" === t, this.wd = s.Zd, this.yn = e, this.Tw = h, this.Rw = n, this.lv = document.createElement("div"), this.lv.style.width = "25px", this.lv.style.height = "100%", this.lv.style.overflow = "hidden", this.fm = el(this.lv, i({
                width: 16,
                height: 16
            })), this.fm.subscribeSuggestedBitmapSizeChanged(this.hm)
        }
        m() {
            this.fm.unsubscribeSuggestedBitmapSizeChanged(this.hm), er(this.fm.canvasElement), this.fm.dispose()
        }
        uv() {
            return this.lv
        }
        cv() {
            return this.Qv
        }
        Cm(t) {
            e(this.Qv, t) || (this.Qv = t, this.fm.resizeCanvasElement(t), this.lv.style.width = `${t.width}px`, this.lv.style.height = `${t.height}px`, this.xt = !0)
        }
        km(t) {
            if (t < 3 && !this.xt || 0 === this.Qv.width || 0 === this.Qv.height) return;
            this.xt = !1, this.fm.applySuggestedBitmapSize();
            let i = z(this.fm, {
                colorSpace: this.yn.layout.colorSpace
            });
            null !== i && i.useBitmapCoordinateSpace(t => {
                this.Tm(t), this.Rm(t)
            })
        }
        dv() {
            return this.fm.bitmapSize
        }
        fv(t, i, e) {
            let s = this.dv();
            s.width > 0 && s.height > 0 && t.drawImage(this.fm.canvasElement, i, e)
        }
        Rm({
            context: t,
            bitmapSize: i,
            horizontalPixelRatio: e,
            verticalPixelRatio: s
        }) {
            if (!this.Tw()) return;
            t.fillStyle = this.yn.timeScale.borderColor;
            let h = Math.floor(this.wd.N().S * e),
                n = Math.floor(this.wd.N().S * s),
                l = this.om ? i.width - h : 0;
            t.fillRect(l, 0, h, n)
        }
        Tm({
            context: t,
            bitmapSize: i
        }) {
            th(t, 0, 0, i.width, i.height, this.Rw())
        }
    }

    function eM(t) {
        return i => i.Xa ? .(t) ? ? []
    }
    let ey = eM("normal"),
        ex = eM("top"),
        e_ = eM("bottom");
    class eS {
        constructor(t, e) {
            this.Dw = null, this.Iw = null, this.M = null, this.Vw = !1, this.Qv = i({
                width: 0,
                height: 0
            }), this.Bw = new W, this.im = new tS(5), this.rm = !1, this.hm = () => {
                this.rm || this.qv.Qt().mr()
            }, this.lm = () => {
                this.rm || this.qv.Qt().mr()
            }, this.qv = t, this.xu = e, this.yn = t.N().layout, this.Hv = document.createElement("tr"), this.Ew = document.createElement("td"), this.Ew.style.padding = "0", this.Aw = document.createElement("td"), this.Aw.style.padding = "0", this.lv = document.createElement("td"), this.lv.style.height = "25px", this.lv.style.padding = "0", this.Lw = document.createElement("div"), this.Lw.style.width = "100%", this.Lw.style.height = "100%", this.Lw.style.position = "relative", this.Lw.style.overflow = "hidden", this.lv.appendChild(this.Lw), this.fm = el(this.Lw, i({
                width: 16,
                height: 16
            })), this.fm.subscribeSuggestedBitmapSizeChanged(this.hm);
            const s = this.fm.canvasElement;
            s.style.position = "absolute", s.style.zIndex = "1", s.style.left = "0", s.style.top = "0", this.pm = el(this.Lw, i({
                width: 16,
                height: 16
            })), this.pm.subscribeSuggestedBitmapSizeChanged(this.lm);
            const h = this.pm.canvasElement;
            h.style.position = "absolute", h.style.zIndex = "2", h.style.left = "0", h.style.top = "0", this.Hv.appendChild(this.Ew), this.Hv.appendChild(this.lv), this.Hv.appendChild(this.Aw), this.zw(), this.qv.Qt().L_().i(this.zw.bind(this), this), this.tv = new i4(this.pm.canvasElement, this, {
                xp: () => !0,
                Cp: () => !this.qv.N().handleScroll.horzTouchDrag
            })
        }
        m() {
            this.tv.m(), null !== this.Dw && this.Dw.m(), null !== this.Iw && this.Iw.m(), this.pm.unsubscribeSuggestedBitmapSizeChanged(this.lm), er(this.pm.canvasElement), this.pm.dispose(), this.fm.unsubscribeSuggestedBitmapSizeChanged(this.hm), er(this.fm.canvasElement), this.fm.dispose()
        }
        uv() {
            return this.Hv
        }
        Ow() {
            return this.Dw
        }
        Nw() {
            return this.Iw
        }
        zp(t) {
            if (this.Vw) return;
            this.Vw = !0;
            let i = this.qv.Qt();
            !i.Et().Gi() && this.qv.N().handleScale.axisPressedMouseMove.time && i.zd(t.localX)
        }
        Ap(t) {
            this.zp(t)
        }
        Op() {
            let t = this.qv.Qt();
            !t.Et().Gi() && this.Vw && (this.Vw = !1, this.qv.N().handleScale.axisPressedMouseMove.time && t.$d())
        }
        Pp(t) {
            let i = this.qv.Qt();
            !i.Et().Gi() && this.qv.N().handleScale.axisPressedMouseMove.time && i.Ud(t.localX)
        }
        yp(t) {
            this.Pp(t)
        }
        Ip() {
            this.Vw = !1;
            let t = this.qv.Qt();
            t.Et().Gi() && !this.qv.N().handleScale.axisPressedMouseMove.time || t.$d()
        }
        Rp() {
            this.Ip()
        }
        up() {
            this.qv.N().handleScale.axisDoubleClickReset.time && this.qv.Qt().ws()
        }
        ap() {
            this.up()
        }
        wp() {
            this.qv.Qt().N().handleScale.axisPressedMouseMove.time && this.Em(1)
        }
        Yp() {
            this.Em(0)
        }
        cv() {
            return this.Qv
        }
        Fw() {
            return this.Bw
        }
        Ww(t, s, h) {
            e(this.Qv, t) || (this.Qv = t, this.rm = !0, this.fm.resizeCanvasElement(t), this.pm.resizeCanvasElement(t), this.rm = !1, this.lv.style.width = `${t.width}px`, this.lv.style.height = `${t.height}px`, this.Bw.p(t)), null !== this.Dw && this.Dw.Cm(i({
                width: s,
                height: t.height
            })), null !== this.Iw && this.Iw.Cm(i({
                width: h,
                height: t.height
            }))
        }
        Hw() {
            let t = this.Uw();
            return Math.ceil(t.S + t.C + t.k + t.A + t.I + t.$w)
        }
        kt() {
            this.qv.Qt().Et().El()
        }
        dv() {
            return this.fm.bitmapSize
        }
        fv(t, i, e, s) {
            let h = this.dv();
            if (h.width > 0 && h.height > 0 && (t.drawImage(this.fm.canvasElement, i, e), s)) {
                let s = this.pm.canvasElement;
                t.drawImage(s, i, e)
            }
        }
        km(t) {
            if (0 === t) return;
            let i = {
                colorSpace: this.yn.colorSpace
            };
            if (1 !== t) {
                this.fm.applySuggestedBitmapSize();
                let e = z(this.fm, i);
                null !== e && (e.useBitmapCoordinateSpace(t => {
                    this.Tm(t), this.Rm(t), this.jw(e, e_)
                }), this.Im(e), this.jw(e, ey)), null !== this.Dw && this.Dw.km(t), null !== this.Iw && this.Iw.km(t)
            }
            this.pm.applySuggestedBitmapSize();
            let e = z(this.pm, i);
            null !== e && (e.useBitmapCoordinateSpace(({
                context: t,
                bitmapSize: i
            }) => {
                t.clearRect(0, 0, i.width, i.height)
            }), this.qw([...this.qv.Qt().Jn(), this.qv.Qt().Rd()], e), this.jw(e, ex))
        }
        jw(t, i) {
            let e = this.qv.Qt().Jn();
            for (let s of e) eu(i, i => eo(i, t, !1, void 0), s, void 0);
            for (let s of e) eu(i, i => ea(i, t, !1, void 0), s, void 0)
        }
        Tm({
            context: t,
            bitmapSize: i
        }) {
            th(t, 0, 0, i.width, i.height, this.qv.Qt().ef())
        }
        Rm({
            context: t,
            bitmapSize: i,
            verticalPixelRatio: e
        }) {
            if (this.qv.N().timeScale.borderVisible) {
                t.fillStyle = this.Yw();
                let s = Math.max(1, Math.floor(this.Uw().S * e));
                t.fillRect(0, 0, i.width, s)
            }
        }
        Im(t) {
            let i = this.qv.Qt().Et(),
                e = i.El();
            if (!e || 0 === e.length) return;
            let s = this.xu.maxTickMarkWeight(e),
                h = this.Uw(),
                n = i.N();
            n.borderVisible && n.ticksVisible && t.useBitmapCoordinateSpace(({
                context: t,
                horizontalPixelRatio: i,
                verticalPixelRatio: s
            }) => {
                t.strokeStyle = this.Yw(), t.fillStyle = this.Yw();
                let n = Math.max(1, Math.floor(i)),
                    l = Math.floor(.5 * i);
                t.beginPath();
                let r = Math.round(h.C * s);
                for (let s = e.length; s--;) {
                    let h = Math.round(e[s].coord * i);
                    t.rect(h - l, 0, n, r)
                }
                t.fill()
            }), t.useMediaCoordinateSpace(({
                context: t
            }) => {
                let i = h.S + h.C + h.A + h.k / 2;
                for (let h of (t.textAlign = "center", t.textBaseline = "middle", t.fillStyle = this.H(), t.font = this.Sm(), e))
                    if (h.weight < s) {
                        let e = h.needAlignCoordinate ? this.Kw(t, h.coord, h.label) : h.coord;
                        t.fillText(h.label, e, i)
                    }
                for (let h of (this.qv.N().timeScale.allowBoldLabels && (t.font = this.Zw()), e))
                    if (h.weight >= s) {
                        let e = h.needAlignCoordinate ? this.Kw(t, h.coord, h.label) : h.coord;
                        t.fillText(h.label, e, i)
                    }
            })
        }
        Kw(t, i, e) {
            let s = this.im.Ii(t, e),
                h = Math.floor(i - s / 2) + .5;
            return h < 0 ? i += Math.abs(0 - h) : h + s > this.Qv.width && (i -= Math.abs(this.Qv.width - (h + s))), i
        }
        qw(t, i) {
            let e = this.Uw();
            for (let s of t)
                for (let t of s.dn()) t.Tt().st(i, e)
        }
        Yw() {
            return this.qv.N().timeScale.borderColor
        }
        H() {
            return this.yn.textColor
        }
        F() {
            return this.yn.fontSize
        }
        Sm() {
            return Z(this.F(), this.yn.fontFamily)
        }
        Zw() {
            return Z(this.F(), this.yn.fontFamily, "bold")
        }
        Uw() {
            null === this.M && (this.M = {
                S: 1,
                L: NaN,
                A: NaN,
                I: NaN,
                tn: NaN,
                C: 5,
                k: NaN,
                P: "",
                Qi: new tS,
                $w: 0
            });
            let t = this.M,
                i = this.Sm();
            if (t.P !== i) {
                let e = this.F();
                t.k = e, t.P = i, t.A = 3 * e / 12, t.I = 3 * e / 12, t.tn = 9 * e / 12, t.L = 0, t.$w = 4 * e / 12, t.Qi.Os()
            }
            return this.M
        }
        Em(t) {
            this.lv.style.cursor = 1 === t ? "ew-resize" : "default"
        }
        zw() {
            let t = this.qv.Qt(),
                i = t.N();
            i.leftPriceScale.visible || null === this.Dw || (this.Ew.removeChild(this.Dw.uv()), this.Dw.m(), this.Dw = null), i.rightPriceScale.visible || null === this.Iw || (this.Aw.removeChild(this.Iw.uv()), this.Iw.m(), this.Iw = null);
            let e = {
                    Zd: this.qv.Qt().Zd()
                },
                s = () => i.leftPriceScale.borderVisible && t.Et().N().borderVisible,
                h = () => t.ef();
            i.leftPriceScale.visible && null === this.Dw && (this.Dw = new eb("left", i, e, s, h), this.Ew.appendChild(this.Dw.uv())), i.rightPriceScale.visible && null === this.Iw && (this.Iw = new eb("right", i, e, s, h), this.Aw.appendChild(this.Iw.uv()))
        }
    }
    let eC = !!i3 && !!navigator.userAgentData && navigator.userAgentData.brands.some(t => t.brand.includes("Chromium")) && !!i3 && (navigator ? .userAgentData ? .platform ? "Windows" === navigator.userAgentData.platform : navigator.userAgent.toLowerCase().indexOf("win") >= 0);
    class eE {
        constructor(t, i, e) {
            var s;
            this.Gw = [], this.Xw = [], this.Jw = 0, this.ho = 0, this.C_ = 0, this.Qw = 0, this.tM = 0, this.iM = null, this.nM = !1, this.Wm = new W, this.Hm = new W, this.pd = new W, this.sM = null, this.eM = null, this.jv = t, this.yn = i, this.xu = e, this.Hv = document.createElement("div"), this.Hv.classList.add("tv-lightweight-charts"), this.Hv.style.overflow = "hidden", this.Hv.style.direction = "ltr", this.Hv.style.width = "100%", this.Hv.style.height = "100%", (s = this.Hv).style.userSelect = "none", s.style.webkitUserSelect = "none", s.style.msUserSelect = "none", s.style.MozUserSelect = "none", s.style.webkitTapHighlightColor = "transparent", this.rM = document.createElement("table"), this.rM.setAttribute("cellspacing", "0"), this.Hv.appendChild(this.rM), this.hM = this.aM.bind(this), ez(this.yn) && this.lM(!0), this.sn = new iK(this.md.bind(this), this.yn, e), this.Qt().Dd().i(this.oM.bind(this), this), this._M = new eS(this, this.xu), this.rM.appendChild(this._M.uv());
            const h = i.autoSize && this.uM();
            let n = this.yn.width,
                l = this.yn.height;
            if (h || 0 === n || 0 === l) {
                const i = t.getBoundingClientRect();
                n = n || i.width, l = l || i.height
            }
            this.cM(n, l), this.dM(), t.appendChild(this.Hv), this.fM(), this.sn.Et().Zc().i(this.sn.Pa.bind(this.sn), this), this.sn.L_().i(this.sn.Pa.bind(this.sn), this)
        }
        Qt() {
            return this.sn
        }
        N() {
            return this.yn
        }
        rv() {
            return this.Gw
        }
        pM() {
            return this._M
        }
        m() {
            for (let t of (this.lM(!1), 0 !== this.Jw && window.cancelAnimationFrame(this.Jw), this.sn.Dd().u(this), this.sn.Et().Zc().u(this), this.sn.L_().u(this), this.sn.m(), this.Gw)) this.rM.removeChild(t.uv()), t.dw().u(this), t.fw().u(this), t.m();
            for (let t of (this.Gw = [], this.Xw)) this.vM(t);
            this.Xw = [], P(this._M).m(), null !== this.Hv.parentElement && this.Hv.parentElement.removeChild(this.Hv), this.pd.m(), this.Wm.m(), this.Hm.m(), this.mM()
        }
        cM(t, e, s = !1) {
            var h;
            let n, l;
            if (this.ho === e && this.C_ === t) return;
            let r = (n = Math.floor((h = i({
                width: t,
                height: e
            })).width), i({
                width: n - n % 2,
                height: (l = Math.floor(h.height)) - l % 2
            }));
            this.ho = r.height, this.C_ = r.width;
            let o = this.ho + "px",
                a = this.C_ + "px";
            if (this.wM() || (P(this.Hv).style.height = o, P(this.Hv).style.width = a), this.rM.style.height = o, this.rM.style.width = a, s) {
                0 !== this.Jw && (window.cancelAnimationFrame(this.Jw), this.Jw = 0), this.nM = !1;
                let t = tg.ys();
                null !== this.iM && (t.Ss(this.iM), this.iM = null), this.MM(t, performance.now())
            } else this.sn.Pa()
        }
        km(t) {
            void 0 === t && (t = tg.ys());
            for (let i = 0; i < this.Gw.length; i++) this.Gw[i].km(t._s(i).rs);
            this.yn.timeScale.visible && this._M.km(t.ls())
        }
        vr(t) {
            let i = ez(this.yn);
            this.sn.vr(t);
            let e = ez(this.yn);
            e !== i && this.lM(e), t.layout ? .panes && this.gM(), this.fM(), this.bM(t)
        }
        dw() {
            return this.Wm
        }
        fw() {
            return this.Hm
        }
        Dd() {
            return this.pd
        }
        SM(t = !1) {
            null !== this.iM && (this.MM(this.iM, performance.now()), this.iM = null);
            let i = this.xM(null),
                e = document.createElement("canvas");
            e.width = i.width, e.height = i.height;
            let s = P(e.getContext("2d"));
            return this.xM(s, t), e
        }
        CM(t) {
            return ("left" !== t || this.yM()) && ("right" !== t || this.kM()) && 0 !== this.Gw.length ? P("left" === t ? this.Gw[0].Sw() : this.Gw[0].xw()).ym() : 0
        }
        wM() {
            return this.yn.autoSize && null !== this.sM
        }
        vv() {
            return this.Hv
        }
        PM(t) {
            this.eM = t, this.eM ? this.vv().style.setProperty("cursor", t) : this.vv().style.removeProperty("cursor")
        }
        TM() {
            return this.eM
        }
        RM(t) {
            return N(this.Gw[t]).cv()
        }
        gM() {
            this.Xw.forEach(t => {
                t.kt()
            })
        }
        bM(t) {
            (void 0 !== t.autoSize || !this.sM || void 0 === t.width && void 0 === t.height) && (t.autoSize && !this.sM && this.uM(), !1 === t.autoSize && null !== this.sM && this.mM(), t.autoSize || void 0 === t.width && void 0 === t.height || this.cM(t.width || this.C_, t.height || this.ho))
        }
        xM(t, e) {
            let s = 0,
                h = 0,
                n = this.Gw[0],
                l = (i, s) => {
                    let h = 0;
                    for (let n = 0; n < this.Gw.length; n++) {
                        let l = this.Gw[n],
                            r = P("left" === i ? l.Sw() : l.xw()),
                            o = r.dv();
                        if (null !== t && r.fv(t, s, h, e), h += o.height, n < this.Gw.length - 1) {
                            let i = this.Xw[n],
                                e = i.dv();
                            null !== t && i.fv(t, s, h), h += e.height
                        }
                    }
                };
            this.yM() && (l("left", 0), s += P(n.Sw()).dv().width);
            for (let i = 0; i < this.Gw.length; i++) {
                let n = this.Gw[i],
                    l = n.dv();
                if (null !== t && n.fv(t, s, h, e), h += l.height, i < this.Gw.length - 1) {
                    let e = this.Xw[i],
                        n = e.dv();
                    null !== t && e.fv(t, s, h), h += n.height
                }
            }
            s += n.dv().width, this.kM() && (l("right", s), s += P(n.xw()).dv().width);
            let r = (i, e, s) => {
                P("left" === i ? this._M.Ow() : this._M.Nw()).fv(P(t), e, s)
            };
            if (this.yn.timeScale.visible) {
                let i = this._M.dv();
                if (null !== t) {
                    let s = 0;
                    this.yM() && (r("left", s, h), s = P(n.Sw()).dv().width), this._M.fv(t, s, h, e), s += i.width, this.kM() && r("right", s, h)
                }
                h += i.height
            }
            return i({
                width: s,
                height: h
            })
        }
        DM() {
            var t, e, s;
            let h = 0,
                n = 0,
                l = 0;
            for (let t of this.Gw) this.yM() && (n = Math.max(n, P(t.Sw()).bm(), this.yn.leftPriceScale.minimumWidth)), this.kM() && (l = Math.max(l, P(t.xw()).bm(), this.yn.rightPriceScale.minimumWidth)), h += t.z_();
            n = (e = n) + e % 2, l = (s = l) + s % 2;
            let r = this.C_,
                o = this.ho,
                a = Math.max(r - n - l, 0),
                u = +this.Xw.length,
                c = this.yn.timeScale.visible,
                d = c ? Math.max(this._M.Hw(), this.yn.timeScale.minimumHeight) : 0,
                f = u + (d = (t = d) + t % 2),
                m = o < f ? 0 : o - f,
                p = m / h,
                v = 0,
                g = window.devicePixelRatio || 1;
            for (let t = 0; t < this.Gw.length; ++t) {
                let e = this.Gw[t];
                e.iw(this.sn.Zn()[t]);
                let s = 0;
                s = Math.max(t === this.Gw.length - 1 ? Math.ceil((m - v) * g) / g : Math.round(e.z_() * p * g) / g, 2), v += s, e.Cm(i({
                    width: a,
                    height: s
                })), this.yM() && e.mw(n, "left"), this.kM() && e.mw(l, "right"), e.Sv() && this.sn.Id(e.Sv(), s)
            }
            this._M.Ww(i({
                width: c ? a : 0,
                height: d
            }), c ? n : 0, c ? l : 0), this.sn.N_(a), this.Qw !== n && (this.Qw = n), this.tM !== l && (this.tM = l)
        }
        lM(t) {
            t ? this.Hv.addEventListener("wheel", this.hM, {
                passive: !1
            }) : this.Hv.removeEventListener("wheel", this.hM)
        }
        IM(t) {
            switch (t.deltaMode) {
                case t.DOM_DELTA_PAGE:
                    return 120;
                case t.DOM_DELTA_LINE:
                    return 32
            }
            return eC ? 1 / window.devicePixelRatio : 1
        }
        aM(t) {
            if (!(0 !== t.deltaX && this.yn.handleScroll.mouseWheel || 0 !== t.deltaY && this.yn.handleScale.mouseWheel)) return;
            let i = this.IM(t),
                e = i * t.deltaX / 100,
                s = -i * t.deltaY / 100;
            if (t.cancelable && t.preventDefault(), 0 !== s && this.yn.handleScale.mouseWheel) {
                let i = Math.sign(s) * Math.min(1, Math.abs(s)),
                    e = t.clientX - this.Hv.getBoundingClientRect().left;
                this.Qt().Od(e, i)
            }
            0 !== e && this.yn.handleScroll.mouseWheel && this.Qt().Nd(-80 * e)
        }
        MM(t, i) {
            let e = t.ls();
            3 === e && this.VM(), 3 !== e && 2 !== e || (this.BM(t), this.EM(t, i), this._M.kt(), this.Gw.forEach(t => {
                t.sw()
            }), 3 === this.iM ? .ls() && (this.iM.Ss(t), this.VM(), this.BM(this.iM), this.EM(this.iM, i), t = this.iM, this.iM = null)), this.km(t)
        }
        EM(t, i) {
            for (let e of t.bs()) this.xs(e, i)
        }
        BM(t) {
            let i = this.sn.Zn();
            for (let e = 0; e < i.length; e++) t._s(e).hs && i[e].ru()
        }
        xs(t, i) {
            let e = this.sn.Et();
            switch (t.ds) {
                case 0:
                    e.Xc();
                    break;
                case 1:
                    e.Jc(t.Wt);
                    break;
                case 2:
                    e.Ms(t.Wt);
                    break;
                case 3:
                    e.gs(t.Wt);
                    break;
                case 4:
                    e.Oc();
                    break;
                case 5:
                    t.Wt.jc(i) || e.gs(t.Wt.qc(i))
            }
        }
        md(t) {
            null !== this.iM ? this.iM.Ss(t) : this.iM = t, this.nM || (this.nM = !0, this.Jw = window.requestAnimationFrame(t => {
                if (this.nM = !1, this.Jw = 0, null !== this.iM) {
                    let i = this.iM;
                    for (let e of (this.iM = null, this.MM(i, t), i.bs()))
                        if (5 === e.ds && !e.Wt.jc(t)) {
                            this.Qt().ps(e.Wt);
                            break
                        }
                }
            }))
        }
        VM() {
            this.dM()
        }
        vM(t) {
            this.rM.removeChild(t.uv()), t.m()
        }
        dM() {
            let t = this.sn.Zn(),
                i = t.length,
                e = this.Gw.length;
            for (let t = i; t < e; t++) {
                let t = N(this.Gw.pop());
                this.rM.removeChild(t.uv()), t.dw().u(this), t.fw().u(this), t.m();
                let i = this.Xw.pop();
                void 0 !== i && this.vM(i)
            }
            for (let s = e; s < i; s++) {
                let i = new ew(this, t[s]);
                if (i.dw().i(this.AM.bind(this, i), this), i.fw().i(this.LM.bind(this, i), this), this.Gw.push(i), s > 0) {
                    let t = new ee(this, s - 1, s);
                    this.Xw.push(t), this.rM.insertBefore(t.uv(), this._M.uv())
                }
                this.rM.insertBefore(i.uv(), this._M.uv())
            }
            for (let e = 0; e < i; e++) {
                let i = t[e],
                    s = this.Gw[e];
                s.Sv() !== i ? s.iw(i) : s.tw()
            }
            this.fM(), this.DM()
        }
        zM(t, i, e, s) {
            var h, n;
            let l, r, o, a = new Map;
            if (null !== t && this.sn.Jn().forEach(i => {
                    let e = i.Un().Hn(t);
                    null !== e && a.set(i, e)
                }), null !== t) {
                let i = this.sn.Et().en(t) ? .originalTime;
                void 0 !== i && (l = i)
            }
            let u = this.Qt().ou(),
                c = this.OM(s),
                d = (r = null !== u && u.lu instanceof is ? u.lu : void 0, o = u ? .wu ? .te, null === u || void 0 === u.ee ? {
                    NM: r,
                    FM: o
                } : {
                    NM: r,
                    FM: o,
                    WM: {
                        ds: u.ee,
                        HM: (h = u.lu, n = u.ee, h instanceof ik ? "pane-primitive" : "marker" === n || "primitive" === n ? "series-primitive" : "series"),
                        UM: function(t, i) {
                            switch (t) {
                                case "custom":
                                    return void 0 !== i ? "custom-object" : "series";
                                case "price-line":
                                    return "custom-price-line";
                                case "marker":
                                    return "series-marker";
                                case "primitive":
                                    return "primitive";
                                default:
                                    return "series"
                            }
                        }(u.ee, o),
                        U_: r,
                        $M: o,
                        jM: void 0 !== c && -1 !== c ? c : void 0
                    }
                });
            return {
                Qr: l,
                $n: t ? ? void 0,
                qM: i ? ? void 0,
                jM: -1 !== c ? c : void 0,
                NM: d.NM,
                YM: a,
                FM: d.FM,
                WM: d.WM,
                KM: e ? ? void 0
            }
        }
        OM(t) {
            let i = -1;
            if (t) i = this.Gw.indexOf(t);
            else {
                let t = this.Qt().Rd().Kn();
                null !== t && (i = this.Qt().Zn().indexOf(t))
            }
            return i
        }
        AM(t, i, e, s) {
            this.Wm.p(() => this.zM(i, e, s, t))
        }
        LM(t, i, e, s) {
            this.Hm.p(() => this.zM(i, e, s, t))
        }
        oM(t, i, e) {
            this.PM(this.Qt().ou() ? .mu ? ? null), this.pd.p(() => this.zM(t, i, e))
        }
        fM() {
            let t = this.yn.timeScale.visible ? "" : "none";
            this._M.uv().style.display = t
        }
        yM() {
            return this.Gw[0].Sv().K_().N().visible
        }
        kM() {
            return this.Gw[0].Sv().Z_().N().visible
        }
        uM() {
            return "ResizeObserver" in window && (this.sM = new ResizeObserver(t => {
                let i = t[t.length - 1];
                if (!i) return;
                let e = i.contentRect.width,
                    s = i.contentRect.height;
                this.cM(e, s, !0)
            }), this.sM.observe(this.jv, {
                box: "border-box"
            }), !0)
        }
        mM() {
            null !== this.sM && this.sM.disconnect(), this.sM = null
        }
    }

    function ez(t) {
        return !!(t.handleScroll.mouseWheel || t.handleScale.mouseWheel)
    }

    function ek(t, i, e, s) {
        let h = e.value,
            n = {
                $n: i,
                wt: t,
                Wt: [h, h, h, h],
                Qr: s
            };
        return void 0 !== e.color && (n.R = e.color), n
    }

    function eR(t, i, e, s) {
        let h = e.value,
            n = {
                $n: i,
                wt: t,
                Wt: [h, h, h, h],
                Qr: s
            };
        return void 0 !== e.lineColor && (n.vt = e.lineColor), void 0 !== e.topColor && (n.ah = e.topColor), void 0 !== e.bottomColor && (n.oh = e.bottomColor), n
    }

    function eL(t, i, e, s) {
        let h = e.value,
            n = {
                $n: i,
                wt: t,
                Wt: [h, h, h, h],
                Qr: s
            };
        return void 0 !== e.topLineColor && (n._h = e.topLineColor), void 0 !== e.bottomLineColor && (n.uh = e.bottomLineColor), void 0 !== e.topFillColor1 && (n.dh = e.topFillColor1), void 0 !== e.topFillColor2 && (n.fh = e.topFillColor2), void 0 !== e.bottomFillColor1 && (n.ph = e.bottomFillColor1), void 0 !== e.bottomFillColor2 && (n.mh = e.bottomFillColor2), n
    }

    function eT(t, i, e, s) {
        let h = {
            $n: i,
            wt: t,
            Wt: [e.open, e.high, e.low, e.close],
            Qr: s
        };
        return void 0 !== e.color && (h.R = e.color), h
    }

    function eN(t, i, e, s) {
        let h = {
            $n: i,
            wt: t,
            Wt: [e.open, e.high, e.low, e.close],
            Qr: s
        };
        return void 0 !== e.color && (h.R = e.color), void 0 !== e.borderColor && (h.Ht = e.borderColor), void 0 !== e.wickColor && (h.hh = e.wickColor), h
    }

    function eP(t, i, e, s, h) {
        let n = N(h)(e),
            l = Math.max(...n),
            r = Math.min(...n),
            o = n[n.length - 1],
            {
                time: a,
                color: u,
                ...c
            } = e;
        return {
            $n: i,
            wt: t,
            Wt: [o, l, r, o],
            Qr: s,
            ue: c,
            R: u
        }
    }

    function eQ(t) {
        return void 0 !== t.Wt
    }

    function eW(t, i) {
        return void 0 !== i.customValues && (t.ZM = i.customValues), t
    }

    function eI(t) {
        return (i, e, s, h, n, l) => (l ? l(s) : void 0 === s.open && void 0 === s.value) ? eW({
            wt: i,
            $n: e,
            Qr: h
        }, s) : eW(t(i, e, s, h, n), s)
    }

    function eB(t) {
        return ({
            Candlestick: eI(eN),
            Bar: eI(eT),
            Area: eI(eR),
            Baseline: eI(eL),
            Histogram: eI(ek),
            Line: eI(ek),
            Custom: eI(eP)
        })[t]
    }

    function eF(t) {
        return {
            $n: 0,
            GM: new Map,
            za: t
        }
    }

    function eD(t, i) {
        if (void 0 !== t && 0 !== t.length) return {
            XM: i.key(t[0].wt),
            JM: i.key(t[t.length - 1].wt)
        }
    }

    function eK(t) {
        let i;
        return t.forEach(t => {
            void 0 === i && (i = t.Qr)
        }), N(i)
    }
    class eO {
        constructor(t) {
            this.QM = new Map, this.tg = new Map, this.ig = new Map, this.ng = [], this.xu = t
        }
        m() {
            this.QM.clear(), this.tg.clear(), this.ig.clear(), this.ng = []
        }
        sg(t, i) {
            let e = 0 !== this.QM.size,
                s = !1,
                h = this.tg.get(t);
            if (void 0 !== h)
                if (1 === this.tg.size) e = !1, s = !0, this.QM.clear();
                else
                    for (let i of this.ng) i.pointData.GM.delete(t) && (s = !0);
            let n = [];
            if (0 !== i.length) {
                let e = i.map(t => t.time),
                    h = this.xu.createConverterToInternalObj(i),
                    l = eB(t.bh()),
                    r = t.ll(),
                    o = t.ol();
                n = i.map((i, n) => {
                    let a = h(i.time),
                        u = this.xu.key(a),
                        c = this.QM.get(u);
                    void 0 === c && (c = eF(a), this.QM.set(u, c), s = !0);
                    let d = l(a, c.$n, i, e[n], r, o);
                    return c.GM.set(t, d), d
                })
            }
            e && this.eg(), this.rg(t, n);
            let l = -1;
            if (s) {
                let t = [];
                this.QM.forEach(i => {
                    t.push({
                        timeWeight: 0,
                        time: i.za,
                        pointData: i,
                        originalTime: eK(i.GM)
                    })
                }), t.sort((t, i) => this.xu.key(t.time) - this.xu.key(i.time)), l = this.hg(t)
            }
            return this.ag(t, l, function(t, i, e) {
                let s = eD(t, e),
                    h = eD(i, e);
                if (void 0 !== s && void 0 !== h) return {
                    lg: !1,
                    Ia: s.JM >= h.JM && s.XM >= h.XM
                }
            }(this.tg.get(t), h, this.xu))
        }
        Jd(t) {
            return this.sg(t, [])
        }
        og(t, i, e) {
            if (e && t.Na()) throw Error("Historical updates are not supported when conflation is enabled. Conflation requires data to be processed in order.");
            void 0 === i.Qr && (i.Qr = i.time), this.xu.preprocessData(i);
            let s = this.xu.createConverterToInternalObj([i])(i.time),
                h = this.ig.get(t);
            if (!e && void 0 !== h && this.xu.key(s) < this.xu.key(h)) throw Error(`Cannot update oldest data, last time=${h}, new time=${s}`);
            let n = this.QM.get(this.xu.key(s));
            if (e && void 0 === n) throw Error("Cannot update non-existing data point when historicalUpdate is true");
            let l = void 0 === n;
            void 0 === n && (n = eF(s), this.QM.set(this.xu.key(s), n));
            let r = eB(t.bh()),
                o = t.ll(),
                a = t.ol(),
                u = r(s, n.$n, i, i.Qr, o, a),
                c = !e && !l && void 0 !== h && this.xu.key(s) === this.xu.key(h);
            n.GM.set(t, u), e ? this._g(t, u, n.$n) : (c && t.Na() && eQ(u) && t.Rr(u), this.ug(t, u));
            let d = {
                Ia: eQ(u),
                lg: e
            };
            if (!l) return this.ag(t, -1, d);
            let f = {
                    timeWeight: 0,
                    time: n.za,
                    pointData: n,
                    originalTime: eK(n.GM)
                },
                m = tH(this.ng, this.xu.key(f.time), (t, i) => this.xu.key(t.time) < i);
            this.ng.splice(m, 0, f);
            for (let t = m; t < this.ng.length; ++t) eq(this.ng[t].pointData, t);
            return this.xu.fillWeightsForPoints(this.ng, m), this.ag(t, m, d)
        }
        cg(t, i) {
            let e = this.tg.get(t);
            if (void 0 === e || i <= 0) return [
                [], this.dg()
            ];
            i = Math.min(i, e.length);
            let s = e.splice(-i).reverse();
            for (let i of (0 === e.length ? this.ig.delete(t) : this.ig.set(t, e[e.length - 1].wt), s)) {
                let e = this.QM.get(this.xu.key(i.wt));
                if (e && (e.GM.delete(t), 0 === e.GM.size)) {
                    this.QM.delete(this.xu.key(e.za)), this.ng.splice(e.$n, 1);
                    for (let t = e.$n; t < this.ng.length; ++t) eq(this.ng[t].pointData, t)
                }
            }
            return [s, this.ag(t, this.ng.length - 1, {
                lg: !1,
                Ia: !1
            })]
        }
        ug(t, i) {
            let e = this.tg.get(t);
            void 0 === e && (e = [], this.tg.set(t, e));
            let s = 0 !== e.length ? e[e.length - 1] : null;
            null === s || this.xu.key(i.wt) > this.xu.key(s.wt) ? eQ(i) && e.push(i) : eQ(i) ? e[e.length - 1] = i : e.splice(-1, 1), this.ig.set(t, i.wt)
        }
        _g(t, i, e) {
            let s = this.tg.get(t);
            if (void 0 === s) return;
            let h = tH(s, e, (t, i) => t.$n < i);
            eQ(i) ? s[h] = i : s.splice(h, 1)
        }
        rg(t, i) {
            0 !== i.length ? (this.tg.set(t, i.filter(eQ)), this.ig.set(t, i[i.length - 1].wt)) : (this.tg.delete(t), this.ig.delete(t))
        }
        eg() {
            for (let t of this.ng) 0 === t.pointData.GM.size && this.QM.delete(this.xu.key(t.time))
        }
        hg(t) {
            let i = -1;
            for (let e = 0; e < this.ng.length && e < t.length; ++e) {
                let s = this.ng[e],
                    h = t[e];
                if (this.xu.key(s.time) !== this.xu.key(h.time)) {
                    i = e;
                    break
                }
                h.timeWeight = s.timeWeight, eq(h.pointData, e)
            }
            if (-1 === i && this.ng.length !== t.length && (i = Math.min(this.ng.length, t.length)), -1 === i) return -1;
            for (let e = i; e < t.length; ++e) eq(t[e].pointData, e);
            return this.xu.fillWeightsForPoints(t, i), this.ng = t, i
        }
        fg() {
            if (0 === this.tg.size) return null;
            let t = 0;
            return this.tg.forEach(i => {
                0 !== i.length && (t = Math.max(t, i[i.length - 1].$n))
            }), t
        }
        ag(t, i, e) {
            let s = this.dg();
            if (-1 !== i) this.tg.forEach((i, h) => {
                s.U_.set(h, {
                    ue: i,
                    pg: h === t ? e : void 0
                })
            }), this.tg.has(t) || s.U_.set(t, {
                ue: [],
                pg: e
            }), s.Et.vg = this.ng, s.Et.mg = i;
            else {
                let i = this.tg.get(t);
                s.U_.set(t, {
                    ue: i || [],
                    pg: e
                })
            }
            return s
        }
        dg() {
            return {
                U_: new Map,
                Et: {
                    Pc: this.fg()
                }
            }
        }
    }

    function eq(t, i) {
        t.$n = i, t.GM.forEach(t => {
            t.$n = i
        })
    }

    function e$(t, i) {
        return t._t < i
    }

    function eV(t, i) {
        return i < t._t
    }

    function eZ(t, i, e) {
        return {
            ne: t,
            se: i,
            ee: e
        }
    }

    function eA(t, i, e, s, h, n) {
        let l = h - e,
            r = n - s;
        if (0 === l && 0 === r) return Math.hypot(t - e, i - s);
        let o = Math.max(0, Math.min(1, ((t - e) * l + (i - s) * r) / (l * l + r * r)));
        return Math.hypot(t - (e + l * o), i - (s + r * o))
    }
    let eH = [0, 0];

    function eG(t, i, e, s, h, n, l) {
        var r;
        if (null === i || i.from >= i.to || 0 === t.length) return null;
        let o = h / 2 + n,
            a = tH(t, e - o, e$, r = i.from, i.to),
            u = tG(t, e + o, eV, a, i.to);
        if (a >= u) return null;
        let c = 1 / 0;
        for (let r = a; r < u; r++) {
            let o = t[r],
                a = r > i.from ? t[r - 1] : void 0,
                u = r < i.to - 1 ? t[r + 1] : void 0,
                d = (void 0 === a || a.wt !== o.wt - 1 ? o._t - h / 2 : (a._t + o._t) / 2) - n,
                f = (void 0 === u || u.wt !== o.wt + 1 ? o._t + h / 2 : (o._t + u._t) / 2) + n;
            if (e < d || e > f) continue;
            l(o, eH);
            let m = eH[0],
                p = eH[1],
                v = Math.min(m, p),
                g = Math.max(m, p),
                w = v - n,
                b = g + n;
            s >= v && s <= g ? c = Math.min(c, 0) : s >= w && s <= b && (c = Math.min(c, Math.min(Math.abs(s - v), Math.abs(g - s))))
        }
        return Number.isFinite(c) ? eZ(c, 0, "series-range") : null
    }

    function eU(t, i) {
        return t.wt < i
    }

    function eY(t, i) {
        return i < t.wt
    }
    class ej {
        constructor(t, i, e) {
            this.wg = !0, this.Mg = !0, this.gg = !0, this.bg = [], this.Sg = null, this.xg = -1, this.ae = t, this.le = i, this.Cg = e
        }
        kt(t) {
            this.wg = !0, "data" === t && (this.Mg = !0), "options" === t && (this.gg = !0)
        }
        Tt() {
            return this.ae.It() ? (this.yg(), null === this.Sg ? null : this.kg) : null
        }
        Qs(t, i) {
            return this.ae.It() ? (this.yg(), null === this.Sg ? null : this.Pg(t, i)) : null
        }
        Pg(t, i) {
            return null
        }
        Tg() {
            this.bg = this.bg.map(t => ({ ...t,
                ...this.ae.Sa().Sh(t.wt)
            }))
        }
        Rg() {
            this.Sg = null
        }
        yg() {
            let t = this.le.Et(),
                i = t.N().enableConflation ? t.Qc() : 0;
            i !== this.xg && (this.Mg = !0, this.xg = i), this.Mg && (this.Dg(), this.Mg = !1), this.gg && (this.Tg(), this.gg = !1), this.wg && (this.Ig(), this.wg = !1)
        }
        Ig() {
            let t = this.ae.Ft(),
                i = this.le.Et();
            if (this.Rg(), i.Gi() || t.Gi()) return;
            let e = i.Ee();
            if (null === e || 0 === this.ae.Un().Th()) return;
            let s = this.ae.Lt();
            null !== s && (this.Sg = function(t, i, e) {
                let s = i.Oa(),
                    h = i.bi(),
                    n = tH(t, s, eU),
                    l = tG(t, h, eY);
                if (!e) return {
                    from: n,
                    to: l
                };
                let r = n,
                    o = l;
                return n > 0 && n < t.length && t[n].wt >= s && (r = n - 1), l > 0 && l < t.length && t[l - 1].wt <= h && (o = l + 1), {
                    from: r,
                    to: o
                }
            }(this.bg, e, this.Cg), this.Vg(t, i, s.Wt), this.Bg())
        }
    }
    class eX {
        constructor(t, i) {
            this.Eg = t, this.Ki = i
        }
        st(t, i, e) {
            this.Eg.draw(t, this.Ki, i, e)
        }
    }
    class eJ extends ej {
        constructor(t, i, e) {
            super(t, i, !1), this.Yh = e, this.Eg = this.Yh.renderer(), this.kg = new eX(this.Eg, t => this.Ag(t))
        }
        get ga() {
            return this.Yh.conflationReducer
        }
        Wa(t) {
            return this.Yh.priceValueBuilder(t)
        }
        _l(t) {
            return this.Yh.isWhitespace(t)
        }
        Pg(t, i) {
            let e = this.Eg.hitTest ? .(t, i, t => this.Ag(t));
            if (null != e) return {
                ne: e.distance,
                se: function(t) {
                    switch (t) {
                        case "point":
                            return 2;
                        case "range":
                            return 0;
                        default:
                            return 1
                    }
                }(e.type),
                ee: "custom",
                mu: e.cursorStyle,
                te: e.objectId,
                ie: e.hitTestData
            };
            let s = eG(this.bg, this.Sg, t, i, this.le.Et().fl(), this.ae.N().hitTestTolerance, (t, i) => {
                let e = t.Lg,
                    s = NaN,
                    h = NaN;
                if (void 0 !== e && !this.Yh.isWhitespace(e))
                    for (let t of this.Yh.priceValueBuilder(e)) {
                        let i = this.Ag(t);
                        null !== i && (s = Number.isNaN(s) ? i : Math.min(s, i), h = Number.isNaN(h) ? i : Math.max(h, i))
                    }
                i[0] = s, i[1] = h
            });
            return null === s ? null : { ...s,
                ee: "custom"
            }
        }
        Dg() {
            let t = this.ae.Sa();
            this.bg = this.ae.Ha().Bh().map(i => ({
                wt: i.$n,
                _t: NaN,
                ...t.Sh(i.$n),
                Lg: i.ue
            }))
        }
        Vg(t, i) {
            i.Tc(this.bg, $(this.Sg))
        }
        Bg() {
            this.Yh.update({
                bars: this.bg.map(e0),
                barSpacing: this.le.Et().fl(),
                visibleRange: this.Sg,
                conflationFactor: this.le.Et().Qc()
            }, this.ae.N())
        }
        Ag(t) {
            let i = this.ae.Lt();
            return null === i ? null : this.ae.Ft().Nt(t, i.Wt)
        }
    }

    function e0(t) {
        return {
            x: t._t,
            time: t.wt,
            originalData: t.Lg,
            barColor: t.sh
        }
    }
    let e1 = {
            color: "#2196f3"
        },
        e2 = (t, i, e) => new eJ(t, i, Q(e));

    function e3(t) {
        let i = {
            value: t.Wt[3],
            time: t.Qr
        };
        return void 0 !== t.ZM && (i.customValues = t.ZM), i
    }

    function e5(t) {
        let i = e3(t);
        return void 0 !== t.R && (i.color = t.R), i
    }

    function e6(t) {
        let i = e3(t);
        return void 0 !== t.vt && (i.lineColor = t.vt), void 0 !== t.ah && (i.topColor = t.ah), void 0 !== t.oh && (i.bottomColor = t.oh), i
    }

    function e4(t) {
        let i = e3(t);
        return void 0 !== t._h && (i.topLineColor = t._h), void 0 !== t.uh && (i.bottomLineColor = t.uh), void 0 !== t.dh && (i.topFillColor1 = t.dh), void 0 !== t.fh && (i.topFillColor2 = t.fh), void 0 !== t.ph && (i.bottomFillColor1 = t.ph), void 0 !== t.mh && (i.bottomFillColor2 = t.mh), i
    }

    function e9(t) {
        let i = {
            open: t.Wt[0],
            high: t.Wt[1],
            low: t.Wt[2],
            close: t.Wt[3],
            time: t.Qr
        };
        return void 0 !== t.ZM && (i.customValues = t.ZM), i
    }

    function e7(t) {
        let i = e9(t);
        return void 0 !== t.R && (i.color = t.R), i
    }

    function e8(t) {
        let i = e9(t),
            {
                R: e,
                Ht: s,
                hh: h
            } = t;
        return void 0 !== e && (i.color = e), void 0 !== s && (i.borderColor = s), void 0 !== h && (i.wickColor = h), i
    }

    function st(t) {
        return ({
            Area: e6,
            Line: e5,
            Baseline: e4,
            Histogram: e5,
            Bar: e7,
            Candlestick: e8,
            Custom: si
        })[t]
    }

    function si(t) {
        let i = t.Qr;
        return { ...t.ue,
            time: i
        }
    }
    let se = {
            vertLine: {
                color: "#9598A1",
                width: 1,
                style: 3,
                visible: !0,
                labelVisible: !0,
                labelBackgroundColor: "#131722"
            },
            horzLine: {
                color: "#9598A1",
                width: 1,
                style: 3,
                visible: !0,
                labelVisible: !0,
                labelBackgroundColor: "#131722"
            },
            mode: 1,
            doNotSnapToHiddenSeriesIndices: !1
        },
        ss = {
            vertLines: {
                color: "#D6DCDE",
                style: 0,
                visible: !0
            },
            horzLines: {
                color: "#D6DCDE",
                style: 0,
                visible: !0
            }
        },
        sh = {
            background: {
                type: "solid",
                color: "#FFFFFF"
            },
            textColor: "#191919",
            fontSize: 12,
            fontFamily: V,
            panes: {
                enableResize: !0,
                separatorColor: "#E0E3EB",
                separatorHoverColor: "rgba(178, 181, 189, 0.2)"
            },
            attributionLogo: !0,
            colorSpace: "srgb",
            colorParsers: []
        },
        sn = {
            autoScale: !0,
            mode: 0,
            invertScale: !1,
            alignLabels: !0,
            borderVisible: !0,
            borderColor: "#2B2B43",
            entireTextOnly: !1,
            visible: !1,
            ticksVisible: !1,
            scaleMargins: {
                bottom: .1,
                top: .2
            },
            minimumWidth: 0,
            ensureEdgeTickMarksVisible: !1,
            tickMarkDensity: 2.5
        },
        sl = {
            rightOffset: 0,
            barSpacing: 6,
            minBarSpacing: .5,
            maxBarSpacing: 0,
            fixLeftEdge: !1,
            fixRightEdge: !1,
            lockVisibleTimeRangeOnResize: !1,
            rightBarStaysOnScroll: !1,
            borderVisible: !0,
            borderColor: "#2B2B43",
            visible: !0,
            timeVisible: !1,
            secondsVisible: !0,
            shiftVisibleRangeOnNewBar: !0,
            allowShiftVisibleRangeOnWhitespaceReplacement: !1,
            ticksVisible: !1,
            uniformDistribution: !1,
            minimumHeight: 0,
            allowBoldLabels: !0,
            ignoreWhitespaceIndices: !1,
            enableConflation: !1,
            conflationThresholdFactor: 1,
            precomputeConflationOnInit: !1,
            precomputeConflationPriority: "background"
        };

    function sr() {
        return {
            addDefaultPane: !0,
            hoveredSeriesOnTop: !0,
            width: 0,
            height: 0,
            autoSize: !1,
            layout: sh,
            crosshair: se,
            grid: ss,
            overlayPriceScales: { ...sn
            },
            leftPriceScale: { ...sn,
                visible: !1
            },
            rightPriceScale: { ...sn,
                visible: !0
            },
            defaultVisiblePriceScaleId: "right",
            timeScale: sl,
            localization: {
                locale: i3 ? navigator.language : "",
                dateFormat: "dd MMM 'yy"
            },
            handleScroll: {
                mouseWheel: !0,
                pressedMouseMove: !0,
                horzTouchDrag: !0,
                vertTouchDrag: !0
            },
            handleScale: {
                axisPressedMouseMove: {
                    time: !0,
                    price: !0
                },
                axisDoubleClickReset: {
                    time: !0,
                    price: !0
                },
                mouseWheel: !0,
                pinch: !0
            },
            kineticScroll: {
                mouse: !1,
                touch: !0
            },
            trackingMode: {
                exitMode: 1
            }
        }
    }
    class so {
        constructor(t, i, e) {
            this.sv = t, this.zg = i, this.Og = e ? ? 0
        }
        applyOptions(t) {
            this.sv.Qt().Pd(this.zg, t, this.Og)
        }
        options() {
            return this.Ki().N()
        }
        width() {
            return tv(this.zg) ? this.sv.CM(this.zg) : 0
        }
        setVisibleRange(t) {
            this.setAutoScale(!1), this.Ki().qo(new tI(t.from, t.to))
        }
        getVisibleRange() {
            let t, i, e = this.Ki().ar();
            if (null === e) return null;
            if (this.Ki().so()) {
                let s = this.Ki().M_(),
                    h = iO(s);
                t = Number((Math.round((e = ib(e, this.Ki().ro())).Je() / s) * s).toFixed(h)), i = Number((Math.round(e.Qe() / s) * s).toFixed(h))
            } else t = e.Je(), i = e.Qe();
            return {
                from: t,
                to: i
            }
        }
        setAutoScale(t) {
            this.applyOptions({
                autoScale: t
            })
        }
        Ki() {
            return P(this.sv.Qt().Td(this.zg, this.Og)).Ft
        }
    }
    class sa {
        constructor(t, i, e, s) {
            this.sv = t, this.yt = e, this.Ng = i, this.Fg = s
        }
        getHeight() {
            return this.yt.$t()
        }
        setHeight(t) {
            let i = this.sv.Qt(),
                e = i.hf(this.yt);
            i.Bd(e, t)
        }
        getStretchFactor() {
            return this.yt.z_()
        }
        setStretchFactor(t) {
            this.yt.O_(t), this.sv.Qt().Pa()
        }
        paneIndex() {
            return this.sv.Qt().hf(this.yt)
        }
        moveTo(t) {
            let i = this.paneIndex();
            i !== t && (T(t >= 0 && t < this.sv.rv().length, "Invalid pane index"), this.sv.Qt().Ad(i, t))
        }
        getSeries() {
            return this.yt.U_().map(t => this.Ng(t)) ? ? []
        }
        getHTMLElement() {
            let t = this.sv.rv();
            return t && 0 !== t.length && t[this.paneIndex()] ? t[this.paneIndex()].uv() : null
        }
        attachPrimitive(t) {
            this.yt.hl(t), t.attached && t.attached({
                chart: this.Fg,
                requestUpdate: () => this.yt.Qt().Pa()
            })
        }
        detachPrimitive(t) {
            this.yt.al(t)
        }
        priceScale(t) {
            if (null === this.yt.A_(t)) throw Error(`Cannot find price scale with id: ${t}`);
            return new so(this.sv, t, this.paneIndex())
        }
        setPreserveEmptyPane(t) {
            this.yt.W_(t)
        }
        preserveEmptyPane() {
            return this.yt.H_()
        }
        addCustomSeries(t, i = {}, e = 0) {
            return this.Fg.addCustomSeries(t, i, e)
        }
        addSeries(t, i = {}) {
            return this.Fg.addSeries(t, i, this.paneIndex())
        }
    }
    let su = {
        color: "#FF0000",
        price: 0,
        lineStyle: 2,
        lineWidth: 1,
        lineVisible: !0,
        axisLabelVisible: !0,
        title: "",
        axisLabelColor: "",
        axisLabelTextColor: ""
    };
    class sc {
        constructor(t) {
            this._r = t
        }
        applyOptions(t) {
            this._r.vr(t)
        }
        options() {
            return this._r.N()
        }
        Wg() {
            return this._r
        }
    }
    class sd {
        constructor(t, i, e, s, h, n) {
            this.Hg = new W, this.ae = t, this.Ug = i, this.$g = e, this.xu = h, this.Fg = s, this.jg = n
        }
        m() {
            this.Hg.m()
        }
        priceFormatter() {
            return this.ae.tl()
        }
        priceToCoordinate(t) {
            let i = this.ae.Lt();
            return null === i ? null : this.ae.Ft().Nt(t, i.Wt)
        }
        coordinateToPrice(t) {
            let i = this.ae.Lt();
            return null === i ? null : this.ae.Ft().Tn(t, i.Wt)
        }
        barsInLogicalRange(t) {
            if (null === t) return null;
            let i = new iB(new iQ(t.from, t.to)).Fu(),
                e = this.ae.Un();
            if (e.Gi()) return null;
            let s = e.Hn(i.Oa(), 1),
                h = e.Hn(i.bi(), -1),
                n = P(e.Rh()),
                l = P(e.Qn());
            if (null !== s && null !== h && s.$n > h.$n) return {
                barsBefore: t.from - n,
                barsAfter: l - t.to
            };
            let r = {
                barsBefore: null === s || s.$n === n ? t.from - n : s.$n - n,
                barsAfter: null === h || h.$n === l ? l - t.to : l - h.$n
            };
            return null !== s && null !== h && (r.from = s.Qr, r.to = h.Qr), r
        }
        setData(t) {
            this.xu, this.ae.bh(), this.Ug.qg(this.ae, t), this.Yg("full")
        }
        update(t, i = !1) {
            this.ae.bh(), this.Ug.Kg(this.ae, t, i), this.Yg("update")
        }
        pop(t = 1) {
            let i = this.Ug.Zg(this.ae, t);
            0 !== i.length && this.Yg("update");
            let e = st(this.seriesType());
            return i.map(t => e(t))
        }
        dataByIndex(t, i) {
            let e = this.ae.Un().Hn(t, i);
            return null === e ? null : st(this.seriesType())(e)
        }
        data() {
            let t = st(this.seriesType());
            return this.ae.Un().Bh().map(i => t(i))
        }
        subscribeDataChanged(t) {
            this.Hg.i(t)
        }
        unsubscribeDataChanged(t) {
            this.Hg._(t)
        }
        applyOptions(t) {
            this.ae.vr(t)
        }
        options() {
            return O(this.ae.N())
        }
        priceScale() {
            return this.$g.priceScale(this.ae.Ft().cl(), this.getPane().paneIndex())
        }
        createPriceLine(t) {
            let i = I(O(su), t);
            return new sc(this.ae.Ba(i))
        }
        removePriceLine(t) {
            this.ae.Ea(t.Wg())
        }
        priceLines() {
            return this.ae.Aa().map(t => new sc(t))
        }
        seriesType() {
            return this.ae.bh()
        }
        lastValueData(t) {
            let i = this.ae.Ae(t);
            return i.Le ? {
                noData: !0
            } : {
                noData: !1,
                price: i.Mt,
                color: i.R
            }
        }
        attachPrimitive(t) {
            this.ae.hl(t), t.attached && t.attached({
                chart: this.Fg,
                series: this,
                requestUpdate: () => this.ae.Qt().Pa(),
                horzScaleBehavior: this.xu
            })
        }
        detachPrimitive(t) {
            this.ae.al(t), t.detached && t.detached(), this.ae.Qt().Pa()
        }
        getPane() {
            let t = this.ae,
                i = P(this.ae.Qt().Ks(t));
            return this.jg(i)
        }
        moveToPane(t) {
            this.ae.Qt().nf(this.ae, t)
        }
        seriesOrder() {
            let t = this.ae.Qt().Ks(this.ae);
            return null === t ? -1 : t.U_().indexOf(this.ae)
        }
        setSeriesOrder(t) {
            let i = this.ae.Qt().Ks(this.ae);
            null !== i && i.du(this.ae, t)
        }
        Yg(t) {
            this.Hg.v() && this.Hg.p(t)
        }
    }
    class sf {
        constructor(t, i, e) {
            this.Gg = new W, this.Gu = new W, this.Bw = new W, this.sn = t, this.ia = t.Et(), this._M = i, this.ia.Yc().i(this.Xg.bind(this)), this.ia.Kc().i(this.Jg.bind(this)), this._M.Fw().i(this.Qg.bind(this)), this.xu = e
        }
        m() {
            this.ia.Yc().u(this), this.ia.Kc().u(this), this._M.Fw().u(this), this.Gg.m(), this.Gu.m(), this.Bw.m()
        }
        scrollPosition() {
            return this.ia.Ac()
        }
        scrollToPosition(t, i) {
            i ? this.ia.$c(t, 1e3) : this.sn.gs(t)
        }
        scrollToRealTime() {
            this.ia.Uc()
        }
        getVisibleRange() {
            let t = this.ia.gc();
            return null === t ? null : {
                from: t.from.originalTime,
                to: t.to.originalTime
            }
        }
        setVisibleRange(t) {
            let i = {
                    from: this.xu.convertHorzItemToInternal(t.from),
                    to: this.xu.convertHorzItemToInternal(t.to)
                },
                e = this.ia.Cc(i);
            this.sn.tf(e)
        }
        getVisibleLogicalRange() {
            let t = this.ia.Mc();
            return null === t ? null : {
                from: t.Oa(),
                to: t.bi()
            }
        }
        setVisibleLogicalRange(t) {
            T(t.from <= t.to, "The from index cannot be after the to index."), this.sn.tf(t)
        }
        resetTimeScale() {
            this.sn.ws()
        }
        fitContent() {
            this.sn.Xc()
        }
        logicalToCoordinate(t) {
            let i = this.sn.Et();
            return i.Gi() ? null : i.jt(t)
        }
        coordinateToLogical(t) {
            return this.ia.Gi() ? null : this.ia.Rc(t)
        }
        timeToIndex(t, i) {
            let e = this.xu.convertHorzItemToInternal(t);
            return this.ia.vc(e, i)
        }
        timeToCoordinate(t) {
            let i = this.timeToIndex(t, !1);
            return null === i ? null : this.ia.jt(i)
        }
        coordinateToTime(t) {
            let i = this.sn.Et(),
                e = i.Rc(t),
                s = i.en(e);
            return null === s ? null : s.originalTime
        }
        width() {
            return this._M.cv().width
        }
        height() {
            return this._M.cv().height
        }
        subscribeVisibleTimeRangeChange(t) {
            this.Gg.i(t)
        }
        unsubscribeVisibleTimeRangeChange(t) {
            this.Gg._(t)
        }
        subscribeVisibleLogicalRangeChange(t) {
            this.Gu.i(t)
        }
        unsubscribeVisibleLogicalRangeChange(t) {
            this.Gu._(t)
        }
        subscribeSizeChange(t) {
            this.Bw.i(t)
        }
        unsubscribeSizeChange(t) {
            this.Bw._(t)
        }
        applyOptions(t) {
            this.ia.vr(t)
        }
        options() {
            return { ...O(this.ia.N()),
                barSpacing: this.ia.fl()
            }
        }
        Xg() {
            this.Gg.v() && this.Gg.p(this.getVisibleRange())
        }
        Jg() {
            this.Gu.v() && this.Gu.p(this.getVisibleLogicalRange())
        }
        Qg(t) {
            this.Bw.p(t.width, t.height)
        }
    }

    function sm(t) {
        return function(t) {
            if (K(t.handleScale)) {
                let i = t.handleScale;
                t.handleScale = {
                    axisDoubleClickReset: {
                        time: i,
                        price: i
                    },
                    axisPressedMouseMove: {
                        time: i,
                        price: i
                    },
                    mouseWheel: i,
                    pinch: i
                }
            } else if (void 0 !== t.handleScale) {
                let {
                    axisPressedMouseMove: i,
                    axisDoubleClickReset: e
                } = t.handleScale;
                K(i) && (t.handleScale.axisPressedMouseMove = {
                    time: i,
                    price: i
                }), K(e) && (t.handleScale.axisDoubleClickReset = {
                    time: e,
                    price: e
                })
            }
            let i = t.handleScroll;
            K(i) && (t.handleScroll = {
                horzTouchDrag: i,
                vertTouchDrag: i,
                mouseWheel: i,
                pressedMouseMove: i
            })
        }(t), t
    }
    class sp {
        constructor(t, i, e) {
            this.tb = new Map, this.ib = new Map, this.nb = new W, this.sb = new W, this.eb = new W, this.od = new WeakMap, this.rb = new eO(i);
            const s = void 0 === e ? O(sr()) : I(O(sr()), sm(e));
            this.hb = i, this.sv = new eE(t, s, i), this.sv.dw().i(t => {
                this.nb.v() && this.nb.p(this.ab(t()))
            }, this), this.sv.fw().i(t => {
                this.sb.v() && this.sb.p(this.ab(t()))
            }, this), this.sv.Dd().i(t => {
                this.eb.v() && this.eb.p(this.ab(t()))
            }, this);
            const h = this.sv.Qt();
            this.lb = new sf(h, this.sv.pM(), this.hb)
        }
        remove() {
            this.sv.dw().u(this), this.sv.fw().u(this), this.sv.Dd().u(this), this.lb.m(), this.sv.m(), this.tb.clear(), this.ib.clear(), this.nb.m(), this.sb.m(), this.eb.m(), this.rb.m()
        }
        resize(t, i, e) {
            this.autoSizeActive() || this.sv.cM(t, i, e)
        }
        addCustomSeries(t, i = {}, e = 0) {
            let s, h = (s = Q(t), {
                type: "Custom",
                isBuiltIn: !1,
                defaultOptions: { ...e1,
                    ...s.defaultOptions()
                },
                ob: e2,
                _b: s
            });
            return this.ub(h, i, e)
        }
        addSeries(t, i = {}, e = 0) {
            return this.ub(t, i, e)
        }
        removeSeries(t) {
            let i = N(this.tb.get(t)),
                e = this.rb.Jd(i);
            this.sv.Qt().Jd(i), this.cb(e), this.tb.delete(t), this.ib.delete(i)
        }
        qg(t, i) {
            this.cb(this.rb.sg(t, i))
        }
        Kg(t, i, e) {
            this.cb(this.rb.og(t, i, e))
        }
        Zg(t, i) {
            let [e, s] = this.rb.cg(t, i);
            return 0 !== e.length && this.cb(s), e
        }
        subscribeClick(t) {
            this.nb.i(t)
        }
        unsubscribeClick(t) {
            this.nb._(t)
        }
        subscribeCrosshairMove(t) {
            this.eb.i(t)
        }
        unsubscribeCrosshairMove(t) {
            this.eb._(t)
        }
        subscribeDblClick(t) {
            this.sb.i(t)
        }
        unsubscribeDblClick(t) {
            this.sb._(t)
        }
        priceScale(t, i = 0) {
            return new so(this.sv, t, i)
        }
        timeScale() {
            return this.lb
        }
        applyOptions(t) {
            this.sv.vr(sm(t))
        }
        options() {
            return this.sv.N()
        }
        takeScreenshot(t = !1, i = !1) {
            let e, s;
            try {
                i || (e = this.sv.Qt().N().crosshair.mode, this.sv.vr({
                    crosshair: {
                        mode: 2
                    }
                })), s = this.sv.SM(t)
            } finally {
                i || void 0 === e || this.sv.Qt().vr({
                    crosshair: {
                        mode: e
                    }
                })
            }
            return s
        }
        addPane(t = !1) {
            let i = this.sv.Qt().af();
            return i.W_(t), this.fb(i)
        }
        removePane(t) {
            this.sv.Qt().Vd(t)
        }
        swapPanes(t, i) {
            this.sv.Qt().Ed(t, i)
        }
        autoSizeActive() {
            return this.sv.wM()
        }
        chartElement() {
            return this.sv.vv()
        }
        panes() {
            return this.sv.Qt().Zn().map(t => this.fb(t))
        }
        paneSize(t = 0) {
            let i = this.sv.RM(t);
            return {
                height: i.height,
                width: i.width
            }
        }
        setCrosshairPosition(t, i, e) {
            let s = this.tb.get(e);
            if (void 0 === s) return;
            let h = this.sv.Qt().Ks(s);
            null !== h && this.sv.Qt().qd(t, i, h)
        }
        clearCrosshairPosition() {
            this.sv.Qt().Yd(!0)
        }
        horzBehaviour() {
            return this.hb
        }
        ub(t, i = {}, e = 0) {
            var s;
            T(void 0 !== t.ob), void 0 === (s = i.priceFormat) || "custom" === s.type || void 0 !== s.minMove && void 0 === s.precision && (s.precision = iO(s.minMove)), "Candlestick" === t.type && (void 0 !== i.borderColor && (i.borderUpColor = i.borderColor, i.borderDownColor = i.borderColor), void 0 !== i.wickColor && (i.wickUpColor = i.wickColor, i.wickDownColor = i.wickColor));
            let h = I(O(k), O(t.defaultOptions), i),
                n = t.ob,
                l = new is(this.sv.Qt(), t.type, h, n, t._b);
            this.sv.Qt().Gd(l, e);
            let r = new sd(l, this, this, this, this.hb, t => this.fb(t));
            return this.tb.set(r, l), this.ib.set(l, r), r
        }
        cb(t) {
            let i = this.sv.Qt();
            i.Kd(t.Et.Pc, t.Et.vg, t.Et.mg), t.U_.forEach((t, i) => i.ht(t.ue, t.pg)), i.Et()._c(), i.Bc()
        }
        pb(t) {
            return N(this.ib.get(t))
        }
        mb(t) {
            return void 0 !== t && this.ib.has(t) ? this.pb(t) : void 0
        }
        ab(t) {
            let i = new Map;
            t.YM.forEach((t, e) => {
                let s = e.bh(),
                    h = st(s)(t);
                if ("Custom" !== s) {
                    var n;
                    T(void 0 !== (n = h).open || void 0 !== n.value)
                } else {
                    let t = e.ol();
                    T(!t || !1 === t(h))
                }
                i.set(this.pb(e), h)
            });
            let e = this.mb(t.NM),
                s = void 0 === t.WM ? void 0 : {
                    type: t.WM.ds,
                    sourceKind: t.WM.HM,
                    objectKind: t.WM.UM,
                    series: this.mb(t.WM.U_),
                    objectId: t.WM.$M,
                    paneIndex: t.WM.jM
                };
            return {
                time: t.Qr,
                logical: t.$n,
                point: t.qM,
                paneIndex: t.jM,
                hoveredInfo: s,
                hoveredSeries: e,
                hoveredObjectId: t.FM,
                seriesData: i,
                sourceEvent: t.KM
            }
        }
        fb(t) {
            let i = this.od.get(t);
            return i || (i = new sa(this.sv, t => this.pb(t), t, this), this.od.set(t, i)), i
        }
    }

    function sv(t, i, e, s) {
        return Math.hypot(e - t, s - i)
    }

    function sg(t, i, e, s, h, n, l, r = 0) {
        if (0 === i.length || s.from >= i.length || s.to <= 0) return;
        let {
            context: o,
            horizontalPixelRatio: a,
            verticalPixelRatio: u
        } = t, c = i[s.from], d = n(t, c), f = c;
        if (s.to - s.from < 2) {
            let i = h / 2;
            o.beginPath();
            let e = {
                    _t: c._t - i,
                    ut: c.ut
                },
                s = {
                    _t: c._t + i,
                    ut: c.ut
                };
            o.moveTo(e._t * a, e.ut * u), o.lineTo(s._t * a, s.ut * u), l(t, d, e, s)
        } else {
            let h = r > 0,
                m = 0,
                p = (i, e) => {
                    if (l(t, d, f, e), o.beginPath(), d = i, f = e, h) {
                        let t = m % r;
                        o.lineDashOffset = t, m = t
                    }
                },
                v = f;
            o.beginPath(), o.moveTo(c._t * a, c.ut * u);
            for (let l = s.from + 1; l < s.to; ++l) {
                let s = (v = i[l])._t * a,
                    r = v.ut * u,
                    c = n(t, v);
                switch (e) {
                    case 0:
                        if (o.lineTo(s, r), h) {
                            let t = i[l - 1],
                                e = t._t * a,
                                h = t.ut * u;
                            m += sv(e, h, s, r)
                        }
                        break;
                    case 1:
                        {
                            let t = i[l - 1],
                                e = t.ut * u;o.lineTo(s, e),
                            h && (m += Math.abs(v._t - t._t) * a),
                            c !== d && (p(c, v), o.lineTo(s, e)),
                            o.lineTo(s, r),
                            h && (m += Math.abs(v.ut - t.ut) * u);
                            break
                        }
                    case 2:
                        {
                            let [t, e] = sM(i, l - 1, l),
                            n = t._t * a,
                            c = t.ut * u,
                            d = e._t * a,
                            f = e.ut * u;
                            if (o.bezierCurveTo(n, c, d, f, s, r), h) {
                                let t = i[l - 1],
                                    e = t._t * a,
                                    h = t.ut * u,
                                    o = sv(e, h, s, r),
                                    p = sv(e, h, n, c) + sv(n, c, d, f) + sv(d, f, s, r);
                                m += (o + p) / 2
                            }
                        }
                }
                1 !== e && c !== d && (p(c, v), o.moveTo(s, r))
            }(f !== v || f === v && 1 === e) && l(t, d, f, v), h && (o.lineDashOffset = 0)
        }
    }

    function sw(t, i) {
        return {
            _t: t._t - i._t,
            ut: t.ut - i.ut
        }
    }

    function sb(t, i) {
        return {
            _t: t._t / i,
            ut: t.ut / i
        }
    }

    function sM(t, i, e) {
        var s, h;
        let n = Math.max(0, i - 1),
            l = Math.min(t.length - 1, e + 1);
        return [(s = t[i], h = sb(sw(t[e], t[n]), 6), {
            _t: s._t + h._t,
            ut: s.ut + h.ut
        }), sw(t[e], sb(sw(t[l], t[i]), 6))]
    }

    function sy(t, i) {
        let e = t.context;
        e.strokeStyle = i, e.stroke()
    }
    class sx extends j {
        constructor() {
            super(...arguments), this.rt = null
        }
        ht(t) {
            this.rt = t
        }
        et(t) {
            if (null === this.rt) return;
            let {
                ot: i,
                lt: e,
                wb: s,
                Mb: h,
                ct: n,
                Zt: l,
                gb: r
            } = this.rt;
            if (null === e) return;
            let o = t.context;
            o.lineCap = "butt", o.lineWidth = n * t.verticalPixelRatio;
            let a = R(o, l);
            o.lineJoin = "round";
            let u = this.bb.bind(this),
                c = a.reduce((t, i) => t + i, 0);
            void 0 !== h && sg(t, i, h, e, s, u, sy, c), r && function(t, i, e, s, h) {
                if (s.to - s.from <= 0) return;
                let {
                    horizontalPixelRatio: n,
                    verticalPixelRatio: l,
                    context: r
                } = t, o = null, a = Math.max(1, Math.floor(n)) % 2 / 2, u = e * l + a;
                for (let e = s.to - 1; e >= s.from; --e) {
                    let s = i[e];
                    if (s) {
                        let i = h(t, s);
                        i !== o && (null !== o && r.fill(), r.beginPath(), r.fillStyle = i, o = i);
                        let e = Math.round(s._t * n) + a,
                            c = s.ut * l;
                        r.moveTo(e, c), r.arc(e, c, u, 0, 2 * Math.PI)
                    }
                }
                r.fill()
            }(t, i, r, e, u)
        }
    }
    class s_ extends sx {
        bb(t, i) {
            return i.vt
        }
    }

    function sS(t, i, e, s, h) {
        let n = 1 - h;
        return n * n * n * t + 3 * n * n * h * i + 3 * n * h * h * e + h * h * h * s
    }
    class sC extends ej {
        constructor(t, i) {
            super(t, i, !0)
        }
        Vg(t, i, e) {
            i.Tc(this.bg, $(this.Sg)), t.Zo(this.bg, e, $(this.Sg))
        }
        Sb(t, i) {
            return {
                wt: t,
                Mt: i,
                _t: NaN,
                ut: NaN
            }
        }
        Dg() {
            let t = this.ae.Sa();
            this.bg = this.ae.Ha().Bh().map(i => {
                let e;
                if ((i.Zr ? ? 1) > 1) {
                    let t = i.Wt[1],
                        s = i.Wt[2],
                        h = i.Wt[3];
                    e = Math.abs(t - h) > Math.abs(s - h) ? t : s
                } else e = i.Wt[3];
                return this.xb(i.$n, e, t)
            })
        }
    }
    class sE extends sC {
        Pg(t, i) {
            let e = this.ae.N();
            return function(t, i, e, s, h, n, l, r = 0, o = 0) {
                var a, u, c, d, f;
                if (null === i || i.from >= i.to || 0 === t.length) return null;
                let m = Math.max(n / 2, l ? ? 0) + o,
                    p = 1 / 0;
                if (void 0 !== l) {
                    let h = l + o,
                        n = tH(t, e - h, e$, a = i.from, i.to),
                        r = tG(t, e + h, eV, n, i.to);
                    for (let i = n; i < r; i++) {
                        let h = t[i];
                        if (u = h._t, c = h._t, !(e >= u - (d = l + o)) || !(e <= c + d)) continue;
                        let n = Math.hypot(e - h._t, s - h.ut);
                        n <= l + o && (p = Math.min(p, n))
                    }
                }
                if (i.to - i.from < 2) {
                    let h = t[i.from],
                        n = Math.max(r / 2, m),
                        l = eA(e, s, h._t - n, h.ut, h._t + n, h.ut);
                    return l <= m && (p = Math.min(p, l)), Number.isFinite(p) ? eZ(p, 2, "series-point") : null
                }
                let v = 1 / 0,
                    g = tH(t, e - m, e$, f = i.from, i.to),
                    w = tG(t, e + m, eV, g, i.to),
                    b = Math.max(i.from + 1, g),
                    M = Math.min(i.to, w + 1);
                for (let i = b; i < M; i++) {
                    let n = t[i - 1],
                        l = t[i],
                        [r, o] = function(t, i, e, s, h) {
                            if (2 === e) {
                                let [e, n] = sM(s, h - 1, h);
                                return [Math.min(t._t, i._t, e._t, n._t), Math.max(t._t, i._t, e._t, n._t)]
                            }
                            return [Math.min(t._t, i._t), Math.max(t._t, i._t)]
                        }(n, l, h, t, i);
                    if (!(e >= r - m) || !(e <= o + m)) continue;
                    let a = function(t, i, e, s, h, n, l, r) {
                        switch (h) {
                            case 1:
                                {
                                    let h = Math.min(eA(t, i, e._t, e.ut, s._t, e.ut), eA(t, i, s._t, e.ut, s._t, s.ut));
                                    return h <= r ? h : null
                                }
                            case 2:
                                {
                                    let [h, o] = sM(n, l - 1, l),
                                    a = function(t, i, e) {
                                        let s = 1 / 0,
                                            h = e[0];
                                        for (let n = 1; n <= 12; n++) {
                                            let l = n / 12,
                                                r = {
                                                    _t: sS(e[0]._t, e[1]._t, e[2]._t, e[3]._t, l),
                                                    ut: sS(e[0].ut, e[1].ut, e[2].ut, e[3].ut, l)
                                                };
                                            s = Math.min(s, eA(t, i, h._t, h.ut, r._t, r.ut)), h = r
                                        }
                                        return s
                                    }(t, i, [e, h, o, s]);
                                    return a <= r ? a : null
                                }
                            default:
                                {
                                    let h = eA(t, i, e._t, e.ut, s._t, s.ut);
                                    return h <= r ? h : null
                                }
                        }
                    }(e, s, n, l, h, t, i, m);
                    null !== a && (v = Math.min(v, a))
                }
                return Number.isFinite(p) ? eZ(p, 2, "series-point") : Number.isFinite(v) ? eZ(v, 1, "series-line") : null
            }(this.bg, this.Sg, t, i, e.lineType, e.lineVisible ? e.lineWidth : 1, e.pointMarkersVisible ? e.pointMarkersRadius || e.lineWidth / 2 + 2 : void 0, this.le.Et().fl(), e.hitTestTolerance)
        }
    }
    class sz extends sE {
        constructor() {
            super(...arguments), this.kg = new s_
        }
        xb(t, i, e) {
            return { ...this.Sb(t, i),
                ...e.Sh(t)
            }
        }
        Bg() {
            let t = this.ae.N(),
                i = {
                    ot: this.bg,
                    Zt: t.lineStyle,
                    Mb: t.lineVisible ? t.lineType : void 0,
                    ct: t.lineWidth,
                    gb: t.pointMarkersVisible ? t.pointMarkersRadius || t.lineWidth / 2 + 2 : void 0,
                    lt: this.Sg,
                    wb: this.le.Et().fl()
                };
            this.kg.ht(i)
        }
    }

    function sk(t, i, e, s, h) {
        let {
            context: n,
            horizontalPixelRatio: l,
            verticalPixelRatio: r
        } = i;
        n.lineTo(h._t * l, t * r), n.lineTo(s._t * l, t * r), n.closePath(), n.fillStyle = e, n.fill()
    }
    class sR extends j {
        constructor() {
            super(...arguments), this.rt = null
        }
        ht(t) {
            this.rt = t
        }
        et(t) {
            if (null === this.rt) return;
            let {
                ot: i,
                lt: e,
                wb: s,
                ct: h,
                Zt: n,
                Mb: l
            } = this.rt, r = this.rt.Db ? ? (this.rt.Ib ? 0 : t.mediaSize.height);
            if (null === e) return;
            let o = t.context;
            o.lineCap = "butt", o.lineJoin = "round", o.lineWidth = h, R(o, n), o.lineWidth = 1, sg(t, i, l, e, s, this.Vb.bind(this), sk.bind(null, r))
        }
    }
    class sL {
        Bb(t, i) {
            let e = this.Eb,
                {
                    Ab: s,
                    Lb: h,
                    zb: n,
                    Ob: l,
                    Db: r,
                    Nb: o,
                    Fb: a
                } = i;
            if (void 0 === this.Wb || void 0 === e || e.Ab !== s || e.Lb !== h || e.zb !== n || e.Ob !== l || e.Db !== r || e.Nb !== o || e.Fb !== a) {
                let {
                    verticalPixelRatio: e
                } = t, u = r || o > 0 ? e : 1, c = o * u, d = a === t.bitmapSize.height ? a : a * u, f = t.context.createLinearGradient(0, c, 0, d);
                if (f.addColorStop(0, s), null != r) {
                    let t = io(((r ? ? 0) * u - c) / (d - c), 0, 1);
                    f.addColorStop(t, h), f.addColorStop(t, n)
                }
                f.addColorStop(1, l), this.Wb = f, this.Eb = i
            }
            return this.Wb
        }
    }
    class sT extends sR {
        constructor() {
            super(...arguments), this.Hb = new sL
        }
        Vb(t, i) {
            return this.Hb.Bb(t, {
                Ab: i.ah,
                Lb: "",
                zb: "",
                Ob: i.oh,
                Nb: this.rt ? .Nb ? ? 0,
                Fb: t.bitmapSize.height
            })
        }
    }
    class sN extends sE {
        constructor(t, i) {
            super(t, i), this.kg = new Y, this.qb = new sT, this.Yb = new s_, this.kg.nt([this.qb, this.Yb])
        }
        xb(t, i, e) {
            return { ...this.Sb(t, i),
                ...e.Sh(t)
            }
        }
        Bg() {
            let t, i = this.ae.N();
            if (null !== this.Sg && 0 !== this.bg.length) {
                if (i.relativeGradient) {
                    t = this.bg[this.Sg.from].ut;
                    for (let i = this.Sg.from; i < this.Sg.to; i++) {
                        let e = this.bg[i];
                        e.ut < t && (t = e.ut)
                    }
                }
                this.qb.ht({
                    Mb: i.lineType,
                    ot: this.bg,
                    Zt: i.lineStyle,
                    ct: i.lineWidth,
                    Db: null,
                    Nb: t,
                    Ib: i.invertFilledArea,
                    lt: this.Sg,
                    wb: this.le.Et().fl()
                }), this.Yb.ht({
                    Mb: i.lineVisible ? i.lineType : void 0,
                    ot: this.bg,
                    Zt: i.lineStyle,
                    ct: i.lineWidth,
                    lt: this.Sg,
                    wb: this.le.Et().fl(),
                    gb: i.pointMarkersVisible ? i.pointMarkersRadius || i.lineWidth / 2 + 2 : void 0
                })
            }
        }
    }
    class sP extends ej {
        constructor(t, i) {
            super(t, i, !1)
        }
        Pg(t, i) {
            return eG(this.bg, this.Sg, t, i, this.le.Et().fl(), this.ae.N().hitTestTolerance, (t, i) => {
                i[0] = t.Qo, i[1] = t.t_
            })
        }
        Vg(t, i, e) {
            i.Tc(this.bg, $(this.Sg)), t.Xo(this.bg, e, $(this.Sg))
        }
        Qb(t, i, e) {
            return {
                wt: t,
                jr: i.Wt[0],
                qr: i.Wt[1],
                Yr: i.Wt[2],
                Kr: i.Wt[3],
                _t: NaN,
                Jo: NaN,
                Qo: NaN,
                t_: NaN,
                i_: NaN
            }
        }
        Dg() {
            let t = this.ae.Sa();
            this.bg = this.ae.Ha().Bh().map(i => this.xb(i.$n, i, t))
        }
    }
    class sQ extends j {
        constructor() {
            super(...arguments), this.qt = null, this.Kb = 0
        }
        ht(t) {
            this.qt = t
        }
        et(t) {
            if (null === this.qt || 0 === this.qt.Un.length || null === this.qt.lt) return;
            let {
                horizontalPixelRatio: i
            } = t;
            this.Kb = function(t, i) {
                if (t >= 2.5 && t <= 4) return Math.floor(3 * i);
                let e = 1 - .2 * Math.atan(Math.max(4, t) - 4) / (.5 * Math.PI),
                    s = Math.min(Math.floor(t * e * i), Math.floor(t * i));
                return Math.max(Math.floor(i), s)
            }(this.qt.fl, i), this.Kb >= 2 && Math.floor(i) % 2 != this.Kb % 2 && this.Kb--;
            let e = this.qt.Un;
            this.qt.tS && this.iS(t, e, this.qt.lt), this.qt.gi && this.Rm(t, e, this.qt.lt);
            let s = this.nS(i);
            (!this.qt.gi || this.Kb > 2 * s) && this.sS(t, e, this.qt.lt)
        }
        iS(t, i, e) {
            if (null === this.qt) return;
            let {
                context: s,
                horizontalPixelRatio: h,
                verticalPixelRatio: n
            } = t, l = "", r = Math.min(Math.floor(h), Math.floor(this.qt.fl * h)), o = Math.floor(.5 * (r = Math.max(Math.floor(h), Math.min(r, this.Kb)))), a = null;
            for (let t = e.from; t < e.to; t++) {
                let e = i[t];
                e.rh !== l && (s.fillStyle = e.rh, l = e.rh);
                let u = Math.round(Math.min(e.Jo, e.i_) * n),
                    c = Math.round(Math.max(e.Jo, e.i_) * n),
                    d = Math.round(e.Qo * n),
                    f = Math.round(e.t_ * n),
                    m = Math.round(h * e._t) - o,
                    p = m + r - 1;
                null !== a && (m = Math.min(m = Math.max(a + 1, m), p));
                let v = p - m + 1;
                s.fillRect(m, d, v, u - d), s.fillRect(m, c + 1, v, f - c), a = p
            }
        }
        nS(t) {
            let i = Math.floor(+t);
            this.Kb <= 2 * i && (i = Math.floor(.5 * (this.Kb - 1)));
            let e = Math.max(Math.floor(t), i);
            return this.Kb <= 2 * e ? Math.max(Math.floor(t), Math.floor(+t)) : e
        }
        Rm(t, i, e) {
            if (null === this.qt) return;
            let {
                context: s,
                horizontalPixelRatio: h,
                verticalPixelRatio: n
            } = t, l = "", r = this.nS(h), o = null;
            for (let t = e.from; t < e.to; t++) {
                let e = i[t];
                e.eh !== l && (s.fillStyle = e.eh, l = e.eh);
                let d = Math.round(e._t * h) - Math.floor(.5 * this.Kb),
                    f = d + this.Kb - 1,
                    m = Math.round(Math.min(e.Jo, e.i_) * n),
                    p = Math.round(Math.max(e.Jo, e.i_) * n);
                if (null !== o && (d = Math.min(d = Math.max(o + 1, d), f)), this.qt.fl * h > 2 * r) {
                    var a, u, c;
                    a = d, u = f - d + 1, c = p - m + 1, s.fillRect(a + r, m, u - 2 * r, r), s.fillRect(a + r, m + c - r, u - 2 * r, r), s.fillRect(a, m, r, c), s.fillRect(a + u - r, m, r, c)
                } else {
                    let t = f - d + 1;
                    s.fillRect(d, m, t, p - m + 1)
                }
                o = f
            }
        }
        sS(t, i, e) {
            if (null === this.qt) return;
            let {
                context: s,
                horizontalPixelRatio: h,
                verticalPixelRatio: n
            } = t, l = "", r = this.nS(h);
            for (let t = e.from; t < e.to; t++) {
                let e = i[t],
                    o = Math.round(Math.min(e.Jo, e.i_) * n),
                    a = Math.round(Math.max(e.Jo, e.i_) * n),
                    u = Math.round(e._t * h) - Math.floor(.5 * this.Kb),
                    c = u + this.Kb - 1;
                if (e.sh !== l) {
                    let t = e.sh;
                    s.fillStyle = t, l = t
                }
                this.qt.gi && (u += r, o += r, c -= r, a -= r), o > a || s.fillRect(u, o, c - u + 1, a - o + 1)
            }
        }
    }
    class sW extends sP {
        constructor() {
            super(...arguments), this.kg = new sQ
        }
        xb(t, i, e) {
            return { ...this.Qb(t, i, e),
                ...e.Sh(t)
            }
        }
        Bg() {
            let t = this.ae.N();
            this.kg.ht({
                Un: this.bg,
                fl: this.le.Et().fl(),
                tS: t.wickVisible,
                gi: t.borderVisible,
                lt: this.Sg
            })
        }
    }
    t.s(["AreaSeries", 0, {
        type: "Area",
        isBuiltIn: !0,
        defaultOptions: {
            topColor: "rgba( 46, 220, 135, 0.4)",
            bottomColor: "rgba( 40, 221, 100, 0)",
            invertFilledArea: !1,
            relativeGradient: !1,
            lineColor: "#33D778",
            lineStyle: 0,
            lineWidth: 3,
            lineType: 0,
            lineVisible: !0,
            crosshairMarkerVisible: !0,
            crosshairMarkerRadius: 4,
            crosshairMarkerBorderColor: "",
            crosshairMarkerBorderWidth: 2,
            crosshairMarkerBackgroundColor: "",
            lastPriceAnimation: 0,
            pointMarkersVisible: !1
        },
        ob: (t, i) => new sN(t, i)
    }, "CandlestickSeries", 0, {
        type: "Candlestick",
        isBuiltIn: !0,
        defaultOptions: {
            upColor: "#26a69a",
            downColor: "#ef5350",
            wickVisible: !0,
            borderVisible: !0,
            borderColor: "#378658",
            borderUpColor: "#26a69a",
            borderDownColor: "#ef5350",
            wickColor: "#737375",
            wickUpColor: "#26a69a",
            wickDownColor: "#ef5350"
        },
        ob: (t, i) => new sW(t, i)
    }, "ColorType", 0, y, "CrosshairMode", 0, p, "LastPriceAnimationMode", 0, b, "LineSeries", 0, {
        type: "Line",
        isBuiltIn: !0,
        defaultOptions: {
            color: "#2196f3",
            lineStyle: 0,
            lineWidth: 3,
            lineType: 0,
            lineVisible: !0,
            crosshairMarkerVisible: !0,
            crosshairMarkerRadius: 4,
            crosshairMarkerBorderColor: "",
            crosshairMarkerBorderWidth: 2,
            crosshairMarkerBackgroundColor: "",
            lastPriceAnimation: 0,
            pointMarkersVisible: !1
        },
        ob: (t, i) => new sz(t, i)
    }, "LineStyle", 0, m, "LineType", 0, f, "PriceLineSource", 0, M, "createChart", 0, function(t, i) {
        var e, s;
        let h;
        return e = new i2, s = i2.yf(i), h = new sp(function(t) {
            if (D(t)) {
                let i = document.getElementById(t);
                return T(null !== i, `Cannot find element in DOM with id=${t}`), i
            }
            return t
        }(t), e, s), e.setOptions(h.options()), h
    }, "isBusinessDay", 0, iq, "isUTCTimestamp", 0, i$], 804599)
}]);

//# debugId=59d6946d-c94e-a353-9437-a366c3a6f35c