"use strict";
(self.webpackChunktradingview = self.webpackChunktradingview || []).push([
    [52712, 58722], {
        192784: (t, e, s) => {
            s.r(e), s.d(e, {
                flushDelegate: () => n
            });
            const n = new(s(942634).Delegate)
        },
        62802: (t, e, s) => {
            t = s.nmd(t), s(638456);
            var n = s(702598).fetch,
                i = s(873428).regExpEscape,
                r = s(226722).TVXWindowEvents,
                a = s(49437).TVLocalStorage,
                o = s(942634).Delegate,
                l = s(764829),
                h = s(125226).isFeatureEnabled,
                {
                    flushDelegate: u
                } = s(192784),
                d = s(338619).getLogger("Lib.TVSettings"),
                c = ["s.tradingview.com", "betacdn.tradingview.com"],
                _ = (l.enabled("use_localstorage_for_settings"), window.TVSettings = function() {
                    var t = !1,
                        e = null,
                        s = !1;

                    function m() {
                        return !(e || window.is_authenticated)
                    }
                    try {
                        t = !TradingView.onWidget() && parent && parent !== window && !!parent.IS_DEMO_PAGE
                    } catch (t) {}
                    if (t) {
                        var f = {
                                "widgetbar.layout-settings": {
                                    widgets: {},
                                    settings: {
                                        minimized: !0
                                    }
                                },
                                notShowMainWizard: !0
                            },
                            p = function(t, e, s) {
                                var n = f[t];
                                return null == n ? e : n
                            },
                            g = function() {};
                        return {
                            loaded: !1,
                            loadedModel: !1,
                            getValue: p,
                            getJSON: p,
                            getBool: p,
                            getFloat: p,
                            getInt: p,
                            setValue: g,
                            setJSON: g,
                            remove: g,
                            keys: function() {
                                return Object.keys(f)
                            },
                            keysMask: function() {
                                return []
                            },
                            sync: g,
                            onSync: {
                                subscribe: function() {}
                            }
                        }
                    }
                    var v = 12e4;
                    "local" === window.environment && (v = 5e3);
                    var b, y, w, S = TradingView.onWidget() ? "tradingview-widget" : "tradingview",
                        x = S + ".",
                        I = {},
                        k = [],
                        M = [/^widgetbar\.widget\.watchlist.+/, /.+quicks$/, /^widgetbar\.layout-settings$/, /^ChartSideToolbarWidget\.visible$/, /^onwidget\.watchlist$/, /^chart\.favoriteDrawings$/, /^chart\.favoriteDrawingsPosition$/, /^chart\.favoriteLibraryIndicators$/, /^loadChartDialog.favorites$/, /^ChartFavoriteDrawingToolbarWidget\.visible/, /^trading\.chart\.proterty$/, /^trading_floating_toolbar\.position$/, /^trading\.orderWidgetMode\./, /^symbolWatermark$/, /^pinereference\.size$/, /^pinereference\.position$/, /^hint\.+/, /^ChartDrawingToolbarWidget\.visible/];

                    function C(t) {
                        return x + t
                    }

                    function E(t) {
                        return t.substring(x.length)
                    }

                    function T(t, e) {
                        var s = I[t];
                        return null == s ? e : s
                    }

                    function N(t, e, s) {
                        s = s || {};
                        var n = "" + e;
                        return I[t] !== n && (I[t] = n, D(t)), s.forceFlush && !y && (y = setTimeout((function() {
                            y = void 0, B()
                        }), 10)), _
                    }

                    function P(t, e) {
                        return e = e || {}, null != I[t] && (delete I[t], D(t)), e.forceFlush && B(), _
                    }

                    function R() {
                        b = void 0, k.length && B()
                    }

                    function D(t) {
                        if (e) null == I[t] ? e.removeValue(t) : e.setValue(t, I[t]);
                        else if (m()) try {
                            null == I[t] ? a.removeItem(C(t)) : a.setItem(C(t), I[t])
                        } catch (t) {} else k.push(t), b || (b = setTimeout(R, v));
                        r.emit("settings", JSON.stringify({
                            key: t,
                            value: I[t]
                        }))
                    }

                    function B(t) {
                        if (!s && !w)
                            if (h("disable_save_settings")) d.logWarn("Settings flashing has been skipped because of disable_save_settings featuretoggle");
                            else if (!l.enabled("widget") && !m() && 0 !== k.length) {
                            var e = k;
                            k = [];
                            for (var i = {}, r = e.length; r--;) {
                                var a = e[r],
                                    o = I[a];
                                void 0 === o && (o = null), i[a] = o
                            }
                            var u = new FormData;
                            u.append("delta", JSON.stringify(i)), t && navigator.sendBeacon ? navigator.sendBeacon("/savesettings/", u) : n("/savesettings/", {
                                method: "POST",
                                credentials: "include",
                                body: u
                            }).then((function(s) {
                                if (s.ok || (k = k.concat(e)), [429, 503].includes(s.status)) {
                                    var n = 1e3 * +s.headers.get("retry-after") || 3e5;
                                    w = setTimeout((() => {
                                        w = void 0, B(t)
                                    }), n)
                                }
                            })).catch((function() {
                                k = k.concat(e)
                            }))
                        }
                    }

                    function F() {
                        return Object.keys(I)
                    }

                    function A(t) {
                        for (var e = 0; e < M.length; ++e)
                            if (M[e].exec(t)) return !0;
                        return !1
                    }

                    function L(t) {
                        return t.substring(0, x.length) === x
                    }

                    function V(t) {
                        I = {};
                        const e = 0 === Object.keys(t).length;
                        e || function(t) {
                                Object.keys(t).forEach((function(e) {
                                    I[e] = t[e] + ""
                                }))
                            }(t),
                            function(t) {
                                for (var e = a.length; e--;) {
                                    var s = a.key(e);
                                    s && L(s) && (t && N(E(s), a.getItem(s)), a.removeItem(s))
                                }
                            }(e)
                    }
                    r.on("settings", (function(t) {
                        var e = JSON.parse(t);
                        null == e.value ? delete I[e.key] : I[e.key] = e.value
                    }));
                    var $ = new o;
                    return document.addEventListener("visibilitychange", (function() {
                        "hidden" !== document.visibilityState && !0 !== document.hidden || B()
                    })), window.addEventListener("pagehide", (function() {
                        B(!0)
                    })), window.addEventListener("beforeunload", (function() {
                        B(!0)
                    })), u.subscribe(null, (() => {
                        B()
                    })), {
                        loaded: !1,
                        loadedModel: !1,
                        getValue: T,
                        getJSON: function(t, e) {
                            var s = T(t, void 0);
                            if (null == s) return e;
                            try {
                                return JSON.parse(s)
                            } catch (s) {
                                return P(t), e
                            }
                        },
                        getBool: function(t, e) {
                            var s = T(t);
                            return null == s ? e : !(!s || "false" === s || 0 == +s)
                        },
                        getFloat: function(t, e, s) {
                            var n = T(t, void 0);
                            if (null == n) return e;
                            var i = parseFloat(n);
                            if (!isFinite(i)) throw new TypeError('"' + n + '" is not float (key: "' + t + '")');
                            return i
                        },
                        getInt: function(t, e, s) {
                            var n = T(t, void 0);
                            if (null == n) return e;
                            var i = parseInt(n, 10);
                            if (!isFinite(i)) throw new TypeError('"' + n + '" is not int (key: "' + t + '")');
                            return i
                        },
                        setValue: N,
                        setJSON: function(t, e, s) {
                            return N(t, JSON.stringify(e), s), _
                        },
                        remove: P,
                        keys: F,
                        keysMask: function(t, e) {
                            for (var s = F(), n = [], r = (t = new RegExp("^" + i(t).replace(/\\\*\\\*/gi, ".+").replace(/\\\*/gi, "[^.]+") + "$", "gi"), s.length - 1); r >= 0; r--) t.test(s[r]) && n.push(s[r]), t.lastIndex = 0;
                            return n
                        },
                        sync: function(t) {
                            null !== t ? (e ? V(e.initialSettings || {}) : m() ? (function() {
                                if (TradingView.onWidget() && c.includes(window.location.host))
                                    for (var t = "tradingview.", e = a.length; e--;) {
                                        var s = a.key(e);
                                        if (0 === s.indexOf(t)) {
                                            var n = s.replace(t, S + ".");
                                            a.setItem(n, a.getItem(s)), a.removeItem(s)
                                        }
                                    }
                            }(), function() {
                                I = {};
                                for (var t = !l.enabled("save_chart_properties_to_local_storage"), e = a.length; e--;) {
                                    var s = a.key(e);
                                    if (s && L(s)) {
                                        var n = s.substring(x.length);
                                        t && !A(n) || (I[n] = a.getItem(s))
                                    }
                                }
                            }()) : V(t || {}), $.fire()) : s = !0
                        },
                        onSync: $,
                        setSettingsAdapter: function(t) {
                            e = t
                        }
                    }
                }());
            setTimeout((function() {
                s.e(30362).then(s.bind(s, 276141)).then((t => {
                    t.clearOldSettings()
                }))
            }), 3e4), t && t.exports && (t.exports = _)
        },
        226722: (t, e, s) => {
            s.d(e, {
                TVXWindowEvents: () => a
            });
            s(466281);
            var n = s(338619),
                i = s(49437);
            const r = (0, n.getLogger)("XWindowEvents");
            var a;
            ! function(t) {
                const e = "tvxwevents.",
                    s = {};
                let n;
                window.BroadcastChannel ? (n = new BroadcastChannel("tvxwevents"), n.addEventListener("message", (function(t) {
                    const {
                        data: {
                            event: e,
                            value: n
                        }
                    } = t;
                    s[e] && s[e].forEach((t => {
                        t(n)
                    }))
                })), function() {
                    const t = [],
                        s = performance.now();
                    for (let s = 0; s < i.TVLocalStorage.length; s++) {
                        const n = i.TVLocalStorage.key(s);
                        n.startsWith(e) && t.push(n)
                    }
                    const n = i.TVLocalStorage.length;
                    for (const e of t) i.TVLocalStorage.removeItem(e);
                    const a = performance.now() - s;
                    r.logNormal(`Total keys amount in local storage on operation start: ${n}`), r.logNormal(`Keys amount in local storage to be deleted: ${t.length}`),
                        r.logNormal(`Keys to be deleted from local storage: ${JSON.stringify(t)}`), r.logNormal(`Removing keys from local storage took ${a} ms`)
                }()) : window.addEventListener("storage", (function(t) {
                    const {
                        newValue: n,
                        key: r
                    } = t;
                    if (null === n || !r || !r.startsWith(e)) return;
                    const a = r.substring(e.length);
                    s[a] && s[a].forEach((e => {
                        e(t.newValue)
                    }));
                    i.TVLocalStorage.removeItem(r)
                })), t.on = function(t, e) {
                    s[t] || (s[t] = []), s[t].push(e)
                }, t.off = function(t, e) {
                    if (!s[t]) return;
                    const n = s[t].indexOf(e); - 1 !== n && (1 === s[t].length ? delete s[t] : s[t].splice(n, 1))
                }, t.emit = function(t, s = Date.now()) {
                    try {
                        n ? n.postMessage({
                            event: t,
                            value: s
                        }) : i.TVLocalStorage.setItem(e + t, s.toString())
                    } catch (t) {
                        r.logError(t.message)
                    }
                }
            }(a || (a = {}))
        },
        828473: (t, e, s) => {
            s.d(e, {
                lowerbound: () => n,
                upperbound: () => i
            });
            s(650151);

            function n(t, e, s, n = 0, i = t.length) {
                return function(t, e, s, n, i) {
                    let r = i - n;
                    for (; 0 < r;) {
                        const i = r >> 1,
                            a = n + i;
                        s(t(a), e) ? (n = a + 1, r -= i + 1) : r = i
                    }
                    return n
                }((e => t[e]), e, s, n, i)
            }

            function i(t, e, s, n = 0, i = t.length) {
                let r = i - n;
                for (; 0 < r;) {
                    const i = r >> 1,
                        a = n + i;
                    s(e, t[a]) ? r = i : (n = a + 1, r -= i + 1)
                }
                return n
            }
        },
        643322: (t, e, s) => {
            s.d(e, {
                combine: () => r
            });
            var n = s(375397);

            function i(t, e, ...s) {
                let i = null;
                const r = (...e) => t(...e.map((t => t.value())), null == i ? void 0 : i.value()),
                    a = i = new n.WatchedValue(r(...s)),
                    o = () => {
                        e(...s.map((t => t.value()))) && a.setValue(r(...s))
                    },
                    l = s.map((t => t.spawn()));
                for (const t of l) t.subscribe(o);
                return a.readonly().spawn((() => {
                    l.forEach((t => t.destroy())), s.forEach((t => t.release()))
                }))
            }

            function r(t, ...e) {
                return i(t, (() => !0), ...e)
            }
        },
        339709: (t, e, s) => {
            s.d(e, {
                customFormatters: () => n
            });
            const n = {
                dateFormatter: null,
                timeFormatter: null,
                tickMarkFormatter: null,
                priceFormatterFactory: null,
                studyFormatterFactory: null
            }
        },
        378975: (t, e, s) => {
            s.d(e, {
                Interval: () => u,
                ResolutionKind: () => r
            });
            const n = /^(\d*)([TSHDWMR])$/,
                i = /^(\d+)$/;
            var r, a;
            ! function(t) {
                t.Ticks = "ticks", t.Seconds = "seconds", t.Minutes = "minutes", t.Days = "days", t.Weeks = "weeks", t.Months = "months", t.Range = "range", t.Invalid = "invalid"
            }(r || (r = {})),
            function(t) {
                t.Hours = "hours"
            }(a || (a = {}));
            const o = {};
            o[r.Ticks] = 1e3, o[r.Seconds] = 1e3, o[r.Minutes] = 60 * o[r.Seconds], o[r.Days] = 1440 * o[r.Minutes], o[r.Weeks] = 7 * o[r.Days];
            const l = {
                    T: r.Ticks,
                    S: r.Seconds,
                    D: r.Days,
                    W: r.Weeks,
                    M: r.Months,
                    R: r.Range
                },
                h = new Set([r.Ticks, r.Seconds, r.Minutes]);
            class u {
                constructor(t, e) {
                    this._kind = r.Invalid, this._multiplier = 0, t !== r.Invalid && e > 0 && (this._kind = t, this._multiplier = e)
                }
                kind() {
                    return this._kind
                }
                multiplier() {
                    return this._multiplier
                }
                isValid() {
                    return this.kind() !== r.Invalid && this.multiplier() > 0
                }
                isDWM() {
                    return this.isValid() && !this.isRange() && !this.isIntraday() && !this.isTicks()
                }
                isIntraday() {
                    const t = h.has(this.kind());
                    return this.isValid() && t
                }
                isSeconds() {
                    return this.kind() === r.Seconds
                }
                isMinutes() {
                    return this.kind() === r.Minutes
                }
                isMinuteHours() {
                    return this.kind() === r.Minutes && ((t = this.multiplier()) >= 60 && !(t % 60));
                    var t
                }
                isDays() {
                    return this.kind() === r.Days
                }
                isWeeks() {
                    return this.kind() === r.Weeks
                }
                isMonths() {
                    return this.kind() === r.Months
                }
                isRange() {
                    return this.kind() === r.Range
                }
                isTicks() {
                    return this.kind() === r.Ticks
                }
                is1Tick() {
                    return this.isTicks() && 1 === this.multiplier()
                }
                isTimeBased() {
                    return !this.isRange()
                }
                letter() {
                    return this.isValid() && this.kind() !== r.Minutes ? this.kind()[0].toUpperCase() : ""
                }
                value() {
                    return this.isValid() ? this.kind() === r.Minutes ? this.multiplier() + "" : this.multiplier() + this.letter() : ""
                }
                isEqualTo(t) {
                    if (!(t instanceof u)) throw new Error("Argument is not an Interval");
                    return !(!this.isValid() || !t.isValid()) && (this.kind() === t.kind() && this.multiplier() === t.multiplier())
                }
                inMilliseconds(t = Date.now()) {
                    if (!this.isValid() || this.isRange()) return NaN;
                    if (this.isMonths()) {
                        const e = new Date(t);
                        e.setUTCMonth(e.getUTCMonth() + (this.multiplier() || 1));
                        return +e - t
                    }
                    const e = this.multiplier();
                    return o[this.kind()] * e
                }
                static isEqual(t, e) {
                    return t === e || u.parse(t).isEqualTo(u.parse(e))
                }
                static parseExt(t) {
                    t = (t + "").toUpperCase().split(",")[0];
                    let e = n.exec(t);
                    return null !== e ? "H" === e[2] ? {
                        interval: new u(r.Minutes, 60 * d(e[1])),
                        guiResolutionKind: a.Hours
                    } : {
                        interval: new u(l[e[2]], d(e[1])),
                        guiResolutionKind: l[e[2]]
                    } : (e = i.exec(t), null !== e ? {
                        interval: new u(r.Minutes, d(e[1])),
                        guiResolutionKind: r.Minutes
                    } : {
                        interval: new u(r.Invalid, 0),
                        guiResolutionKind: r.Invalid
                    })
                }
                static parse(t) {
                    return u.parseExt(t).interval
                }
                static kind(t) {
                    return u.parse(t).kind()
                }
                static isValid(t) {
                    return u.parse(t).isValid()
                }
                static isDWM(t) {
                    return u.parse(t).isDWM()
                }
                static isIntraday(t) {
                    return u.parse(t).isIntraday()
                }
                static isSeconds(t) {
                    return u.parse(t).isSeconds()
                }
                static isMinutes(t) {
                    return u.parse(t).isMinutes()
                }
                static isMinuteHours(t) {
                    return u.parse(t).isMinuteHours()
                }
                static isDays(t) {
                    return u.parse(t).isDays()
                }
                static isWeeks(t) {
                    return u.parse(t).isWeeks()
                }
                static isMonths(t) {
                    return u.parse(t).isMonths()
                }
                static isRange(t) {
                    return u.parse(t).isRange()
                }
                static isTicks(t) {
                    return u.parse(t).isTicks()
                }
                static isTimeBased(t) {
                    return u.parse(t).isTimeBased()
                }
                static normalize(t) {
                    const e = u.parse(t);
                    return e.isValid() ? e.value() : null
                }
            }

            function d(t) {
                return 0 === t.length ? 1 : parseInt(t, 10)
            }
        },
        518439: (t, e, s) => {
            var n;
            s.d(e, {
                    PlotRowSearchMode: () => n
                }),
                function(t) {
                    t[t.NearestLeft = -1] = "NearestLeft", t[t.Exact = 0] = "Exact", t[t.NearestRight = 1] = "NearestRight"
                }(n || (n = {}))
        },
        979351: (t, e, s) => {
            s.d(e, {
                unpackNonSeriesData: () => o
            });
            var n = s(130551),
                i = s(650151);

            function r(t) {
                if (!(0, n.isObject)(t)) throw new Error("Graphics commands should be wrapped in an object");
                if ((0, n.hasProperty)(t, "create"), (0, n.hasProperty)(t, "erase")) {
                    const e = t.erase;
                    (0, i.assert)(Array.isArray(e), "Collection of erase commands should be array");
                    for (const t of e) {
                        if (!(0, n.isObject)(t) || !(0, n.hasProperty)(t, "action")) throw new Error("Command should be an object with 'action' property");
                        (0, i.assert)("all" === t.action || "one" === t.action, "Erase command action should be 'all' or 'one'")
                    }
                }
                return t
            }
            async function a(t) {
                {
                    const [{
                        inflateZlib: e,
                        inflateRaw: n
                    }, {
                        unpackImpl: i
                    }] = await Promise.all(["function" == typeof DecompressionStream ? s.e(95465).then(s.bind(s, 23536)) : Promise.all([s.e(84069), s.e(82170)]).then(s.bind(s, 458140)), s.e(95465).then(s.bind(s, 532152))]);
                    return i(e, n, t)
                }
            }
            async function o(t) {
                if ("" === t) return null;
                const e = JSON.parse(t);
                if (!(0, n.isObject)(e) || "function" == typeof e) throw new Error("Non-object content in the non-series envelope");
                if ((0,
                        n.hasProperty)(e, "indexes_replace")) return {
                    indexes_replace: !0
                };
                const s = {
                    indexes_replace: !1
                };
                if ((0, n.hasProperty)(e, "offsets") && (s.offsets = e.offsets), (0, n.hasProperty)(e, "isUpdate")) {
                    if ("boolean" != typeof e.isUpdate) throw new Error('Invalid type of "isUpdate" field');
                    s.isUpdate = e.isUpdate
                }
                return (0, n.hasProperty)(e, "data") && (s.data = e.data), (0, n.hasProperty)(e, "graphicsCmds") && (s.graphicsCmds = r(e.graphicsCmds)), (0, n.hasProperty)(e, "dataCompressed") && (s.data = await a(e.dataCompressed)), (0, n.hasProperty)(e, "graphicsCmdsCompressed") && (s.graphicsCmds = r(await a(e.graphicsCmdsCompressed))), s
            }
        },
        55243: (t, e, s) => {
            s.d(e, {
                PlotList: () => c
            });
            var n = s(650151),
                i = s(828473),
                r = s(501571),
                a = s(338619),
                o = s(518439);
            const l = (0, a.getLogger)("Chart.PlotList"),
                h = 30;

            function u(t) {
                return t.index
            }

            function d(t) {
                return t.value[0]
            }
            class c {
                constructor(t = null, e = null) {
                    this._items = [], this._start = 0, this._end = 0, this._shareRead = !1, this._minMaxCache = new Map, this._rowSearchCacheByIndex = new Map, this._rowSearchCacheByIndexWithoutEmptyValues = new Map, this._rowSearchCacheByTime = new Map, this._rowSearchCacheByTimeWithoutEmptyValues = new Map, this._plotFunctions = t || new Map, this._emptyValuePredicate = e
                }
                clear() {
                    this._items = [], this._start = 0, this._end = 0, this._shareRead = !1, this._minMaxCache.clear(), this._invalidateSearchCaches()
                }
                first() {
                    return this.size() > 0 ? this._items[this._start] : null
                }
                last() {
                    return this.size() > 0 ? this._items[this._end - 1] : null
                }
                firstIndex() {
                    return this.size() > 0 ? this._indexAt(this._start) : null
                }
                lastIndex() {
                    return this.size() > 0 ? this._indexAt(this._end - 1) : null
                }
                clone() {
                    const t = this.firstIndex(),
                        e = this.lastIndex();
                    return null === t || null === e ? new c : this.range(t, e)
                }
                size() {
                    return this._end - this._start
                }
                isEmpty() {
                    return 0 === this.size()
                }
                contains(t) {
                    return null !== this.search(t, o.PlotRowSearchMode.Exact)
                }
                valueAt(t) {
                    const e = this.search(t);
                    return null !== e ? e.value : null
                }
                add(t, e) {
                    if (this._shareRead) return l.logDebug("add: readonly collection modification attempt"), !1;
                    const s = {
                            index: t,
                            value: e
                        },
                        n = this._nonCachedSearch(t, o.PlotRowSearchMode.Exact, u);
                    return this._invalidateSearchCaches(), null === n ? (this._items.splice(this._lowerbound(t, u), 0, s), this._start = 0, this._end = this._items.length, !0) : (this._items[n] = s, !1)
                }
                search(t, e = o.PlotRowSearchMode.Exact, s) {
                    return this._searchImpl(t, e, this._rowSearchCacheByIndex, this._rowSearchCacheByIndexWithoutEmptyValues, u, s)
                }
                searchByTime(t, e = o.PlotRowSearchMode.Exact, s) {
                    return this._searchImpl(t, e, this._rowSearchCacheByTime, this._rowSearchCacheByTimeWithoutEmptyValues, d, s)
                }
                fold(t, e) {
                    let s = e;
                    for (let e = this._start; e < this._end; ++e) {
                        s = t(this._indexAt(e), this._valueAt(e), s)
                    }
                    return s
                }
                findFirst(t, e) {
                    const s = void 0 !== e && Math.min(this._start + e, this._end) || this._end;
                    for (let e = this._start; e < s; ++e) {
                        const s = this._indexAt(e),
                            n = this._valueAt(e);
                        if (t(s, n)) return {
                            index: s,
                            value: n
                        }
                    }
                    return null
                }
                findLast(t, e) {
                    const s = void 0 !== e && Math.max(this._end - e, this._start) || this._start;
                    for (let e = this._end - 1; e >= s; --e) {
                        const s = this._indexAt(e),
                            n = this._valueAt(e);
                        if (t(s, n)) return {
                            index: s,
                            value: n
                        }
                    }
                    return null
                }
                each(t) {
                    for (let e = this._start; e < this._end; ++e) {
                        if (t(this._indexAt(e), this._valueAt(e))) break
                    }
                }
                reduce(t, e) {
                    let s = e;
                    for (let e = this._start; e < this._end; ++e) {
                        s = t(s, this._indexAt(e), this._valueAt(e))
                    }
                    return s
                }
                range(t, e) {
                    const s = new c(this._plotFunctions, this._emptyValuePredicate);
                    return s._items = this._items, s._start = this._lowerbound(t, u), s._end = this._upperbound(e), s._shareRead = !0, s
                }
                plottableRange(t) {
                    const e = new c(this._plotFunctions, this._emptyValuePredicate);
                    return e._items = this._items, e._start = this._upperbound(r.UNPLOTTABLE_TIME_POINT_INDEX), e._end = this._end, e._shareRead = !0, !0 === t && e._start > this._start && (e._start -= 1), e
                }
                rangeCountback(t, e) {
                    if (null === this.firstIndex()) return new c;
                    const s = new c(this._plotFunctions, this._emptyValuePredicate);
                    return s._items = this._items, s._end = this._upperbound(t), s._start = Math.max(this._start, s._end - e), s._shareRead = !0, s
                }
                rangeIterator(t, e) {
                    const s = this._lowerbound(t, u),
                        n = this._upperbound(e);
                    return this._rangeIteratorImpl(s, n)
                }
                fullRangeIterator() {
                    return this._rangeIteratorImpl(this._start, this._end)
                }
                minMaxOnRangeCached(t, e, s) {
                    if (this.isEmpty()) return null;
                    let n = null;
                    for (const i of s) {
                        n = _(n, this._minMaxOnRangeCachedImpl(t - i.offset, e - i.offset, i.name))
                    }
                    return n
                }
                minMaxOnRange(t, e, s) {
                    if (this.isEmpty()) return null;
                    let n = null;
                    for (const i of s) {
                        n = _(n, this._minMaxOnRange(t - i.offset, e - i.offset, i.name))
                    }
                    return n
                }
                merge(t) {
                    return this._shareRead ? (l.logDebug("merge: readonly collection modification attempt"), null) : 0 === t.length ? null : this.isEmpty() || t[t.length - 1].index < this._items[0].index ? this._prepend(t) : t[0].index > this._items[this._items.length - 1].index ? this._append(t) : 1 === t.length && t[0].index === this._items[this._items.length - 1].index ? (this._updateLast(t[0]), t[0]) : this._merge(t)
                }
                addTail(t, e = !1) {
                    if (0 === t.length) return;
                    let s = 0;
                    e && this._end - this._start > 0 && (s = 1, this._items[this._end - this._start - 1].value = t[0].value);
                    for (let e = s; e < t.length; ++e) {
                        const s = t[e],
                            n = this.lastIndex();
                        if (null === n) {
                            l.logError("Can't add tail to the empty plotlist");
                            break
                        }
                        this.add(n + 1, s.value)
                    }
                    this._invalidateSearchCaches()
                }
                move(t) {
                    if (this._shareRead) return void l.logDebug("move: readonly collection modification attempt");
                    if (0 === t.length) return;
                    const e = this._items.slice();
                    for (const s of t) {
                        const t = this._bsearch(s.old, u);
                        if (null !== t && void 0 !== e[t])
                            if (s.new === r.INVALID_TIME_POINT_INDEX) e[t] = void 0;
                            else {
                                e[t] = {
                                    index: s.new,
                                    value: e[t].value
                                };
                                const n = this._bsearch(s.new, u);
                                if (null !== n) {
                                    const t = e[n];
                                    void 0 !== t && t.index === s.new && (e[n] = void 0)
                                }
                            }
                    }
                    this._items = e.filter((t => void 0 !== t)).sort(((t, e) => t.index - e.index)), this._invalidateSearchCaches(), this._minMaxCache.clear(), this._start = 0, this._end = this._items.length
                }
                remove(t) {
                    if (this._shareRead) return l.logDebug("remove: readonly collection modification attempt"), null;
                    const e = this._nonCachedSearch(t, o.PlotRowSearchMode.NearestRight, u);
                    if (null === e) return null;
                    const s = this._items.splice(e);
                    return this._end = this._items.length, this._minMaxCache.clear(), this._invalidateSearchCaches(), s.length > 0 ? s[0] : null
                }
                state() {
                    const t = this._items.slice(this._start, this._end);
                    return {
                        start: 0,
                        end: t.length,
                        data: t
                    }
                }
                restoreState(t) {
                    t ? (this._start = t.start, this._end = t.end,
                        this._shareRead = !1, this._items = t.data, this._minMaxCache.clear(), this._invalidateSearchCaches()) : this.clear()
                }
                _indexAt(t) {
                    return this._items[t].index
                }
                _valueAt(t) {
                    return this._items[t].value
                }
                _length() {
                    return this._items.length
                }
                _searchImpl(t, e, s, n, i, r) {
                    const a = void 0 !== r ? s : n,
                        o = void 0 !== r ? 1e4 * (e + 1) + r : e;
                    let l = a.get(t);
                    if (void 0 !== l) {
                        const t = l.get(o);
                        if (void 0 !== t) return t
                    }
                    const h = this._nonCachedSearch(t, e, i, r);
                    if (null === h) return null;
                    const u = {
                        index: this._indexAt(h),
                        value: this._valueAt(h)
                    };
                    return void 0 === l && (l = new Map, a.set(t, l)), l.set(o, u), u
                }
                _nonCachedSearch(t, e, s, n) {
                    const i = this._lowerbound(t, s),
                        r = i === this._end || t !== s(this._items[i]);
                    if (r && e !== o.PlotRowSearchMode.Exact) switch (e) {
                        case o.PlotRowSearchMode.NearestLeft:
                            return this._searchNearestLeft(i, n);
                        case o.PlotRowSearchMode.NearestRight:
                            return this._searchNearestRight(i, n);
                        default:
                            throw new TypeError("Unknown search mode")
                    }
                    if (void 0 === n || r || e === o.PlotRowSearchMode.Exact) return r ? null : i;
                    switch (e) {
                        case o.PlotRowSearchMode.NearestLeft:
                            return this._nonEmptyNearestLeft(i, n);
                        case o.PlotRowSearchMode.NearestRight:
                            return this._nonEmptyNearestRight(i, n);
                        default:
                            throw new TypeError("Unknown search mode")
                    }
                }
                _nonEmptyNearestRight(t, e) {
                    const s = (0, n.ensure)(this._emptyValuePredicate),
                        i = (0, n.ensure)(e);
                    for (; t < this._end && s(this._valueAt(t), i);) t += 1;
                    return t === this._end ? null : t
                }
                _nonEmptyNearestLeft(t, e) {
                    const s = (0, n.ensureNotNull)(this._emptyValuePredicate),
                        i = (0, n.ensure)(e);
                    for (; t >= this._start && s(this._valueAt(t), i);) t -= 1;
                    return t < this._start ? null : t
                }
                _searchNearestLeft(t, e) {
                    if (t === this._start) return null;
                    const s = t - 1,
                        n = s !== this._end ? s : null;
                    return void 0 !== e && null !== n ? this._nonEmptyNearestLeft(n, e) : n
                }
                _searchNearestRight(t, e) {
                    const s = t,
                        n = s !== this._end ? s : null;
                    return void 0 !== e && null !== n ? this._nonEmptyNearestRight(n, e) : n
                }
                _bsearch(t, e) {
                    const s = this._lowerbound(t, e);
                    return s !== this._end && t === e(this._items[s]) ? s : null
                }
                _lowerbound(t, e) {
                    return (0, i.lowerbound)(this._items, t, ((t, s) => e(t) < s), this._start, this._end)
                }
                _upperbound(t) {
                    return (0, i.upperbound)(this._items, t, ((t, e) => e.index > t), this._start, this._end)
                }
                _plotMinMax(t, e, s) {
                    let n = null;
                    const i = this._plotFunctions.get(s);
                    if (void 0 === i) throw new Error(`Plot "${s}" is not registered`);
                    for (let s = t; s < e; s++) {
                        const t = i(this._items[s].value);
                        null == t || Number.isNaN(t) || (null === n ? n = {
                            min: t,
                            max: t
                        } : (t < n.min && (n.min = t), t > n.max && (n.max = t)))
                    }
                    return n
                }
                _invalidateCacheForRow(t) {
                    const e = Math.floor(t.index / h);
                    this._minMaxCache.forEach((t => t.delete(e)))
                }
                _prepend(t) {
                    return (0, n.assert)(!this._shareRead, "collection should not be readonly"), (0, n.assert)(0 !== t.length, "plotRows should not be empty"), this._invalidateSearchCaches(), this._minMaxCache.clear(), this._items = t.concat(this._items), this._start = 0, this._end = this._items.length, t[0]
                }
                _append(t) {
                    return (0, n.assert)(!this._shareRead, "collection should not be readonly"), (0, n.assert)(0 !== t.length, "plotRows should not be empty"), this._invalidateSearchCaches(), this._minMaxCache.clear(), this._items = this._items.concat(t), this._start = 0, this._end = this._items.length, t[0]
                }
                _updateLast(t) {
                    (0,
                        n.assert)(!this.isEmpty(), "plot list should not be empty");
                    const e = this._items[this._end - 1];
                    (0, n.assert)(e.index === t.index, "last row index should match new row index"), this._invalidateCacheForRow(t), this._invalidateSearchCaches(), this._items[this._end - 1] = t
                }
                _merge(t) {
                    return (0, n.assert)(0 !== t.length, "plot rows should not be empty"), this._invalidateSearchCaches(), this._minMaxCache.clear(), this._items = function(t, e) {
                        const s = function(t, e) {
                                const s = t.length,
                                    n = e.length;
                                let i = s + n,
                                    r = 0,
                                    a = 0;
                                for (; r < s && a < n;) t[r].index < e[a].index ? r++ : t[r].index > e[a].index ? a++ : (r++, a++, i--);
                                return i
                            }(t, e),
                            n = new Array(s);
                        let i = 0,
                            r = 0;
                        const a = t.length,
                            o = e.length;
                        let l = 0;
                        for (; i < a && r < o;) t[i].index < e[r].index ? (n[l] = t[i], i++) : t[i].index > e[r].index ? (n[l] = e[r], r++) : (n[l] = e[r], i++, r++), l++;
                        for (; i < a;) n[l] = t[i], i++, l++;
                        for (; r < o;) n[l] = e[r], r++, l++;
                        return n
                    }(this._items, t), this._start = 0, this._end = this._items.length, t[0]
                }
                _minMaxOnRangeCachedImpl(t, e, s) {
                    if (this.isEmpty()) return null;
                    let i = null;
                    const r = (0, n.ensureNotNull)(this.firstIndex()),
                        a = (0, n.ensureNotNull)(this.lastIndex()),
                        o = Math.max(t, r),
                        l = Math.min(e, a),
                        u = Math.ceil(o / h) * h,
                        d = Math.max(u, Math.floor(l / h) * h);
                    i = _(i, this._minMaxOnRange(o, Math.min(u, e, l), s));
                    let c = this._minMaxCache.get(s);
                    void 0 === c && (c = new Map, this._minMaxCache.set(s, c));
                    for (let t = Math.max(u + 1, o); t < d; t += h) {
                        const e = Math.floor(t / h);
                        let n = c.get(e);
                        if (void 0 === n) {
                            const t = e * h,
                                i = (e + 1) * h - 1;
                            n = this._minMaxOnRange(t, i, s), c.set(e, n)
                        }
                        i = _(i, n)
                    }
                    i = _(i, this._minMaxOnRange(d, l, s));
                    return i
                }
                _minMaxOnRange(t, e, s) {
                    return this._plotMinMax(this._lowerbound(t, u), this._upperbound(e), s)
                }
                _rangeIteratorImpl(t, e) {
                    let s = t - 1;
                    return {
                        [Symbol.iterator]() {
                            return this
                        },
                        next: () => (s += 1, s >= e ? {
                            done: !0,
                            value: void 0
                        } : {
                            done: !1,
                            value: this._items[s]
                        })
                    }
                }
                _invalidateSearchCaches() {
                    this._rowSearchCacheByIndex.clear(), this._rowSearchCacheByIndexWithoutEmptyValues.clear(), this._rowSearchCacheByTime.clear(), this._rowSearchCacheByTimeWithoutEmptyValues.clear()
                }
            }

            function _(t, e) {
                if (null === t) return e;
                if (null === e) return t;
                return {
                    min: Math.min(t.min, e.min),
                    max: Math.max(t.max, e.max)
                }
            }
        },
        998418: (t, e, s) => {
            s(658843)
        },
        848292: (t, e, s) => {
            s(998418)
        },
        331613: (t, e, s) => {
            s(998418)
        },
        272933: (t, e, s) => {
            s(523965), s(203918), s(874145), s(331613), s(848292)
        },
        523965: (t, e, s) => {
            s(375397)
        },
        203918: (t, e, s) => {
            s(375397)
        },
        874145: (t, e, s) => {
            s(523965)
        },
        658843: (t, e, s) => {
            s(650151), s(942634)
        },
        368628: (t, e, s) => {
            s.d(e, {
                SeriesData: () => c
            });
            var n, i = s(650151),
                r = s(55243),
                a = s(828473);
            ! function(t) {
                t[t.FromLeft = -1] = "FromLeft", t[t.FromRight = 1] = "FromRight"
            }(n || (n = {}));
            const o = {
                    open: t => t[1],
                    high: t => t[2],
                    low: t => t[3],
                    close: t => t[4],
                    hl2: t => (t[2] + t[3]) / 2,
                    hlc3: t => (t[2] + t[3] + t[4]) / 3,
                    ohlc4: t => (t[1] + t[2] + t[3] + t[4]) / 4
                },
                l = ["open", "high", "low", "close", "hl2", "hlc3", "ohlc4"];

            function h() {
                const t = new Map;
                return l.forEach(((e, s) => {
                    t.set(e, function(t, e, s) {
                        const n = o[null != e ? e : t],
                            i = o[t],
                            r = o[null != s ? s : t];
                        return (t, e) => {
                            switch (e) {
                                case 0:
                                    return n(t);
                                case 2:
                                    return r(t);
                                default:
                                    return i(t)
                            }
                        }
                    }(e))
                })), t
            }

            function u(t, e) {
                return null == t[e]
            }
            const d = [{
                barsToMerge: 10,
                forBarspacingLargerThen: .03
            }, {
                barsToMerge: 30,
                forBarspacingLargerThen: .01
            }, {
                barsToMerge: 100,
                forBarspacingLargerThen: .003
            }, {
                barsToMerge: 500,
                forBarspacingLargerThen: 0
            }];
            class c {
                constructor() {
                    this._pressedChunks = {
                        chunks: new Map,
                        priceSource: "uninitialized"
                    }, this.m_bars = new r.PlotList(h(), u), this.m_nsBars = new r.PlotList(h(), u), this._clearPressedChunks()
                }
                bars() {
                    return this.m_bars
                }
                nsBars() {
                    return this.m_nsBars
                }
                pressedChunks(t, e) {
                    if (e !== this._pressedChunks.priceSource) {
                        this._pressedChunks.priceSource = e;
                        const t = this.m_bars.first();
                        t && (this._clearPressedChunks(), this._rebuildPressedChunks(t))
                    }
                    const s = (0, i.ensureDefined)(d.find((e => e.forBarspacingLargerThen <= t)));
                    return (0, i.ensureDefined)(this._pressedChunks.chunks.get(s.barsToMerge))
                }
                mergeRegularBars(t) {
                    const e = this.m_bars.size(),
                        s = this.m_bars.merge(t);
                    return s && "uninitialized" !== this._pressedChunks.priceSource && (e === this.m_bars.size() && s.index === this.m_bars.lastIndex() ? this._updateLatestChunks() : this._rebuildPressedChunks(s)), s
                }
                size() {
                    return this.m_bars.size() + this.m_nsBars.size()
                }
                each(t) {
                    this.m_bars.each(t), this.m_nsBars.each(t)
                }
                clear() {
                    this.m_bars.clear(), this.m_nsBars.clear(), this.lastProjectionPrice = void 0, this._clearPressedChunks()
                }
                clone() {
                    const t = new c;
                    return t.lastProjectionPrice = this.lastProjectionPrice, t.boxSize = this.boxSize, t.reversalAmount = this.reversalAmount, t.m_bars = this.m_bars.clone(), t.m_nsBars = this.m_bars.clone(), t
                }
                isEmpty() {
                    return this.m_bars.isEmpty() && this.m_nsBars.isEmpty()
                }
                first() {
                    return this.m_bars.isEmpty() ? this.m_nsBars.first() : this.m_bars.first()
                }
                last() {
                    return this.m_nsBars.isEmpty() ? this.m_bars.last() : this.m_nsBars.last()
                }
                search(t, e, s) {
                    return this.nsBars().isEmpty() ? this.bars().search(t, e, s) : this.bars().isEmpty() || (0, i.ensureNotNull)(this.nsBars().firstIndex()) <= t ? this.nsBars().search(t, e, s) : this.bars().search(t, e, s)
                }
                valueAt(t) {
                    const e = this.search(t);
                    return null !== e ? e.value : null
                }
                plotValueToTimePointIndex(t, e, s) {
                    if (s === n.FromRight) {
                        const s = (s, n) => {
                                const i = n[e];
                                return null != i && t >= i
                            },
                            n = this.m_bars.findLast(s);
                        if (null !== n) return n.index;
                        const i = this.m_nsBars.findLast(s);
                        return null !== i ? i.index : this.m_bars.firstIndex()
                    }
                    if (s === n.FromLeft) {
                        const s = (s, n) => {
                                const i = n[e];
                                return null != i && t <= i
                            },
                            n = this.m_bars.findFirst(s);
                        if (null !== n) return n.index;
                        const i = this.m_nsBars.findFirst(s);
                        return null !== i ? i.index : this.m_bars.lastIndex()
                    }
                    throw new Error("plotValueToTimePointIndex: unsupported search mode")
                }
                moveData(t) {
                    this.m_bars.move(t), this.m_nsBars.move(t), this.m_bars.size() > 0 && this._rebuildPressedChunks((0, i.ensureNotNull)(this.m_bars.first()))
                }
                _rebuildPressedChunks(t) {
                    const e = this._pressedChunks.priceSource;
                    if ("uninitialized" === e) return;
                    const s = t.index,
                        n = o[e],
                        r = (t, e, s) => {
                            let i = null;
                            for (const r of t) {
                                const t = n(r.value);
                                i && r.index - i.startTime >= s.barsToMerge && (e.push(i), i = null), i ? (i.endTime = r.index, i.high = Math.max(i.high, t), i.low = Math.min(i.low, t), i.close = t) : i = {
                                    startTime: r.index,
                                    endTime: r.index,
                                    open: t,
                                    high: t,
                                    low: t,
                                    close: t
                                }
                            }
                            i && e.push(i)
                        };
                    d.forEach((t => {
                        const e = (0, i.ensureDefined)(this._pressedChunks.chunks.get(t.barsToMerge)),
                            n = (0, a.lowerbound)(e, s, ((t, e) => t.endTime < e));
                        if (0 === n && e.length > 0) {
                            const s = e[0].startTime - 1,
                                n = (0,
                                    i.ensureNotNull)(this.m_bars.firstIndex()),
                                a = this.m_bars.rangeIterator(n, s),
                                o = [];
                            r(a, o, t);
                            const l = o.concat(e);
                            this._pressedChunks.chunks.set(t.barsToMerge, l)
                        } else {
                            const s = (0, i.ensureNotNull)(this.m_bars.lastIndex());
                            e.splice(n);
                            let a = (0, i.ensureNotNull)(this.m_bars.firstIndex());
                            e.length && (a = e[e.length - 1].endTime + 1);
                            const o = this.m_bars.rangeIterator(a, s);
                            r(o, e, t)
                        }
                    }))
                }
                _updateLatestChunks() {
                    const t = (0, i.ensureNotNull)(this.m_bars.last());
                    d.forEach((e => {
                        const s = (0, i.ensureDefined)(this._pressedChunks.chunks.get(e.barsToMerge)),
                            n = t.value[4],
                            r = s[s.length - 1];
                        r.high = Math.max(r.high, n), r.low = Math.min(r.low, n), r.close = n, r.endTime = t.index
                    }))
                }
                _clearPressedChunks() {
                    d.forEach((t => this._pressedChunks.chunks.set(t.barsToMerge, [])))
                }
            }
        },
        975179: (t, e, s) => {
            s.d(e, {
                createSeriesFormatter: () => d,
                extractSymbolNameFromSymbolInfo: () => c
            });
            s(444372), s(62802), s(638456), s(540519), s(378975);
            var n = s(735211),
                i = s(764829),
                r = s(957365),
                a = s(142567);
            s(643322), s(272933);
            const o = i.enabled("pay_attention_to_ticker_not_symbol"),
                l = i.enabled("uppercase_instrument_names"),
                h = i.enabled("charting_library_single_symbol_request"),
                u = i.enabled("use_ticker_on_symbol_info_update");
            i.enabled("hide_object_tree_and_price_scale_exchange_label");

            function d(t, e, s = !1) {
                const {
                    priceScale: i,
                    minMove: o,
                    fractional: l,
                    minMove2: h,
                    variableMinTick: u
                } = function(t, e = "default", s = !1) {
                    let n, i, r, a = 100,
                        o = 1;
                    if ("default" === e) null != t && (({
                        pricescale: a,
                        minmov: o,
                        minmove2: i,
                        fractional: n
                    } = t), r = t.variable_tick_size || void 0);
                    else {
                        let t = e.split(",");
                        3 !== t.length && (t = ["100", "1", "false"]), a = parseInt(t[0]), o = parseInt(t[1]), n = "true" === t[2]
                    }
                    return s && (o = 1), {
                        priceScale: a,
                        minMove: o,
                        fractional: n,
                        minMove2: i,
                        variableMinTick: r,
                        ignoreMinMove: s
                    }
                }(t, e, s);
                if (null != t) {
                    const n = t.format;
                    if ("default" === e && "volume" === n) return new r.VolumeFormatter({
                        precision: 2
                    });
                    if ("percent" === n) return new a.PercentageFormatter({
                        priceScale: i,
                        minMove: o,
                        fractional: l,
                        minMove2: h,
                        variableMinTick: u,
                        ignoreMinMove: s
                    })
                }
                return new n.PriceFormatter({
                    priceScale: i,
                    minMove: o,
                    fractional: l,
                    minMove2: h,
                    variableMinTick: u,
                    ignoreMinMove: s
                })
            }

            function c(t, e, s, n) {
                let i = t && (s && t.pro_name || t.full_name || t.name);
                return h && e ? i = e : (u || !n && o) && t && t.ticker && (i = t.ticker), l && i && (i = i.toUpperCase()), i
            }
        },
        501372: (t, e, s) => {
            s.d(e, {
                SeriesDataSource: () => w
            });
            var n = s(650151),
                i = s(124829),
                r = s(882782),
                a = s(378975),
                o = s(368628),
                l = s(979351),
                h = s(124066),
                u = s(320771),
                d = s(338619),
                c = s(975179),
                _ = s(61625);
            const m = (0, d.getLogger)("Chart.SeriesDataSource");
            var f;
            ! function(t) {
                t[t.Idle = 0] = "Idle", t[t.AwaitingConnection = 1] = "AwaitingConnection", t[t.AwaitingFirstDataUpdate = 2] = "AwaitingFirstDataUpdate", t[t.Active = 3] = "Active"
            }(f || (f = {}));
            let p = 1;
            let g = 1;

            function v(t) {
                return t.startDate ? t.endDate || t.count ? t.endDate ? ["from_to", t.startDate, t.endDate] : ["bar_count", t.startDate, (0, n.ensure)(t.count)] : ["from_to", t.startDate] : t.count || 300
            }

            function b(t) {
                return (0, i.isString)(t.symbol) ? t.symbol : t.symbol.symbol
            }

            function y(t, e) {
                (0, i.isString)(t.symbol) ? t.symbol = e: t.symbol.symbol = e
            }
            class w {
                constructor(t, e, s, n) {
                    this._extSymbol = null, this._lastResolvedSymbol = "", this._createSeriesOverriddenParams = 0, this._instanceId = null,
                        this._symbolInstanceId = null, this._resolution = null, this._timeFrame = null, this._data = new o.SeriesData, this._dataEvents = new u.SeriesDataEvents, this._status = f.Idle, this._turnaroundCounter = 1, this._boundOnGatewayIsConnectedChanged = this._onGatewayIsConnectedChanged.bind(this), this._ongoingDataUpdate = Promise.resolve(), this._gateway = t, this._turnaroundPrefix = e, this._createSeriesParams = v(null != s ? s : {
                            count: 300
                        }), this._timeFrame = n || null, this._gateway.isConnected().subscribe(this._boundOnGatewayIsConnectedChanged)
                }
                destroy() {
                    this.stop(), this._gateway.isConnected().unsubscribe(this._boundOnGatewayIsConnectedChanged)
                }
                modifySeries(t, e, s = null, r = !1, o = null) {
                    r && (m.logNormal("Due to force flag clearing symbol & resolution to force re-requesting data."), this._extSymbol = null, this._resolution = null);
                    const l = b(t),
                        h = !this.symbolSameAsResolved(l);
                    if (h && (this._lastResolvedSymbol = ""), this._extSymbol && !h) {
                        y(t, b(this._extSymbol))
                    }
                    const u = this._extSymbol,
                        d = this._resolution;
                    if (this._extSymbol = t, this._resolution = e, null === this._instanceId) return void(this._timeFrame = s);
                    const c = !(0, i.deepEquals)(u, t)[0];
                    c && y(this._extSymbol, l);
                    const _ = null === d || !a.Interval.isEqual(d, e);
                    (c || _ || null !== s) && (this._timeFrame = null, (c || _) && this._turnaroundCounter++, c && this._resolveSymbol(), this._gateway.modifySeries(this._instanceId, this.turnaround(), (0, n.ensureNotNull)(this._symbolInstanceId), this._resolution, o, s, this._onMessage.bind(this)), this._dataEvents.fireModified())
                }
                requestMoreData(t) {
                    null !== this._instanceId && this._gateway.requestMoreData(this._instanceId, t, this._onMessage.bind(this))
                }
                requestMoreTickmarks(t) {
                    null !== this._instanceId && this._gateway.requestMoreTickmarks(this._instanceId, t, this._onMessage.bind(this))
                }
                setFutureTickmarksMode(t) {
                    null !== this._instanceId && this._gateway.setFutureTickmarksMode(t)
                }
                isStarted() {
                    return this._status !== f.Idle
                }
                isActive() {
                    return this._status === f.Active
                }
                resolution() {
                    return this._resolution
                }
                start() {
                    this.isStarted() ? m.logNormal("start: data source is already started, nothing to do") : ((0, n.assert)(null !== this._extSymbol, "symbol must be set before start"), (0, n.assert)(null !== this._resolution, "resolution must be set before start"), this._gateway.isConnected().value() ? this._createSeries() : this._changeStatusTo(f.AwaitingConnection))
                }
                stop() {
                    this.isStarted() ? (null !== this._instanceId && (this._gateway.removeSeries(this._instanceId), this._instanceId = null), this._symbolInstanceId = null, this._changeStatusTo(f.Idle)) : m.logNormal("stop: data source is already stopped, nothing to do")
                }
                instanceId() {
                    return this._instanceId
                }
                data() {
                    return this._data
                }
                setData(t) {
                    this._data = t
                }
                clearData() {
                    this.isStarted() ? this._enqueueUpdate((() => this._clearDataImpl())) : this._clearDataImpl()
                }
                dataEvents() {
                    return this._dataEvents
                }
                turnaround() {
                    return `${this._turnaroundPrefix}${this._turnaroundCounter}`
                }
                symbolInstanceId() {
                    return this._symbolInstanceId
                }
                symbol() {
                    return this._extSymbol
                }
                moveData(t) {
                    this._enqueueUpdate((() => this._data.moveData(t)))
                }
                setInitialRequestOptions(t) {
                    this._createSeriesOverriddenParams = v(t)
                }
                symbolSameAsResolved(t) {
                    return null !== this._extSymbol && (0,
                        _.symbolSameAsResolved)(t, b(this._extSymbol), this._lastResolvedSymbol)
                }
                resolvedSymbol() {
                    return null === this._extSymbol ? null : b(this._extSymbol)
                }
                _resolveSymbol() {
                    null !== this._extSymbol && (this._symbolInstanceId = this._gateway.resolveSymbol("sds_sym_" + p++, (0, r.encodeExtendedSymbolOrGetSimpleSymbolString)(this._extSymbol), this._onMessage.bind(this)))
                }
                _clearDataImpl() {
                    this._data.clear()
                }
                _changeStatusTo(t) {
                    (0, n.assert)(this._status !== t, "Source and destination status should be distinct"), m.logNormal(`Status changed from ${f[this._status]} to ${f[t]}`), this._status = t
                }
                _createSeries() {
                    (0, n.assert)(this._status !== f.Active, 'Status should not be "Active" when creating a study'), this._instanceId = "sds_" + g++, this._resolveSymbol();
                    const t = this._createSeriesOverriddenParams || this._createSeriesParams;
                    this._createSeriesOverriddenParams && (this._createSeriesOverriddenParams = 0), this._gateway.createSeries(this._instanceId, this.turnaround(), (0, n.ensureNotNull)(this._symbolInstanceId), (0, n.ensureNotNull)(this._resolution), t, this._timeFrame, this._onMessage.bind(this)), this._timeFrame = null, this._changeStatusTo(f.AwaitingFirstDataUpdate), this._dataEvents.fireCreated(this._instanceId)
                }
                _onGatewayIsConnectedChanged(t) {
                    t ? this._onGatewayConnected() : this._onGatewayDisconnected()
                }
                _onGatewayConnected() {
                    this._status === f.AwaitingConnection && this._createSeries()
                }
                _onGatewayDisconnected() {
                    this._status !== f.Idle && this._status !== f.AwaitingConnection && (this._instanceId = null, this._changeStatusTo(f.AwaitingConnection)), this._turnaroundCounter = 1
                }
                _onMessage(t) {
                    this._enqueueUpdate((() => this._onMessageImpl(t)))
                }
                async _onMessageImpl(t) {
                    switch (t.method) {
                        case "symbol_resolved":
                            {
                                const [e, s] = t.params;
                                if (e !== this._symbolInstanceId) {
                                    null !== this._symbolInstanceId && m.logNormal(`Resolve for old symbol, expected: ${this._symbolInstanceId}, actual ${t.params[0]}`);
                                    break
                                }
                                this._onSymbolResolved(s);
                                break
                            }
                        case "symbol_error":
                            if (t.params[0] !== this._symbolInstanceId) {
                                null !== this._symbolInstanceId && m.logNormal(`Symbol error for old symbol, expected: ${this._symbolInstanceId}, actual ${t.params[0]}`);
                                break
                            }
                            this._onSymbolError(t);
                            break;
                        case "series_timeframe":
                            {
                                const [e, s, n, i, r, a, o] = t.params;
                                if (!this._checkTurnaround(e, s)) {
                                    m.logNormal(`Time frame for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${e} (${s})`);
                                    break
                                }
                                this._onSeriesTimeFrame(n, i, r, a, o);
                                break
                            }
                        case "series_error":
                            {
                                const [e, s] = t.params;
                                if (!this._checkTurnaround(e, s)) {
                                    m.logNormal(`Series error for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${e} (${s})`);
                                    break
                                }
                                this._onSeriesError(t.params[2]);
                                break
                            }
                        case "series_loading":
                            {
                                const [e, s] = t.params;
                                if (!this._checkTurnaround(e, s)) break;this._onSeriesLoading(t.time);
                                break
                            }
                        case "series_completed":
                            {
                                const [e, s, n, i] = t.params;
                                if (!this._checkTurnaround(e, n)) {
                                    m.logNormal(`Series completed for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${e} (${n})`);
                                    break
                                }
                                this._onSeriesCompleted(s, t.time, i);
                                break
                            }
                        case "data_update":
                            if (!this._checkTurnaround(t.params.customId, t.params.turnaround)) {
                                m.logNormal(`Data update for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t.params.customId} (${t.params.turnaround})`);
                                break
                            }
                            await this._onDataUpdate(t.params.plots, t.params.nonseries, t.params.lastBar);
                            break;
                        case "clear_data":
                            if (t.params.turnaround !== this.turnaround()) {
                                m.logNormal(`Clear data for old data, expected: ${this.turnaround()}, actual ${t.params.turnaround}`);
                                break
                            }
                            this._clearDataImpl(), this._dataEvents.fireDataUpdated(void 0, !1, null, !1)
                    }
                }
                _onSeriesError(t) {
                    let e, s;
                    if ("string" == typeof t) s = {
                        error: t
                    }, e = t;
                    else if (s = t, t.ctx) {
                        const s = {};
                        Object.entries(t.ctx).forEach((([t, e]) => {
                            s[t] = e.toString()
                        })), e = t.error.format(s)
                    } else e = t.error;
                    if (e.startsWith("study_not_auth:")) {
                        const t = e.split(":", 2)[1].split("@", 2)[0];
                        if (["BarSetRenko", "BarSetPriceBreak", "BarSetKagi", "BarSetPnF"].includes(t)) this._dataEvents.fireChartTypeNotPermitted(t);
                        else if ("BarSetSpread" === t) this._dataEvents.fireIntradaySpreadNotPermitted();
                        else if ("BarSetRange" === t) {
                            const t = `${(0,n.ensureNotNull)(this._extSymbol).inputs.range}R`;
                            this._dataEvents.fireCustomIntervalNotPermitted(t)
                        }
                    } else {
                        if (e.startsWith("unsupported")) return void this._dataEvents.fireUnsupportedResolutionRequested();
                        "resolution_not_entitled" === e ? this._dataEvents.fireIntradayExchangeNotPermitted() : "custom_resolution" === e ? this._dataEvents.fireCustomIntervalNotPermitted((0, n.ensureNotNull)(this._resolution)) : "seconds_not_entitled" === e ? this._dataEvents.fireSecondsIntervalNotPermitted() : "ticks_not_entitled" === e && this._dataEvents.fireTicksIntervalNotPermitted()
                    }
                    this._dataEvents.fireSeriesError(s)
                }
                _onSeriesTimeFrame(t, e, s, n, i) {
                    this._dataEvents.fireSeriesTimeFrame(t, e, s, null == n || n, i)
                }
                _onSymbolError(t) {
                    if (t.params[1] === h.permissionDenied) switch (t.params[2]) {
                        case h.SymbolErrorPermissionDeniedReason.Symbol:
                            this._dataEvents.fireSymbolNotPermitted(t.params[3]);
                            break;
                        case h.SymbolErrorPermissionDeniedReason.GroupPermission:
                            this._dataEvents.fireSymbolGroupNotPermitted(t.params[3]);
                            break;
                        default:
                            this._dataEvents.fireSymbolNotPermitted(t.params[2])
                    } else t.params[1] === h.invalidSymbol && this._dataEvents.fireSymbolInvalid();
                    this._dataEvents.fireSymbolError(t.params[1])
                }
                _onSymbolResolved(t) {
                    this._lastResolvedSymbol = (0, n.ensureNotNull)((0, c.extractSymbolNameFromSymbolInfo)(t, "")), this._dataEvents.fireSymbolResolved(t)
                }
                async _onDataUpdate(t, e, s) {
                    this._onDataUnpacked(t, s, await async function(t) {
                        if (void 0 === t) return {
                            projectionPlots: [],
                            boxSize: null
                        };
                        if ("" === t.d || "nochange" === t.indexes) return null;
                        const e = await (0, l.unpackNonSeriesData)(t.d);
                        if (null === e || e.indexes_replace) return null;
                        const s = t.indexes,
                            {
                                bars: n,
                                price: i,
                                boxSize: r,
                                reversalAmount: a
                            } = e.data,
                            o = (n || []).map((t => {
                                let e;
                                return "factor" in t ? e = t.factor : "additionalPrice" in t && (e = t.additionalPrice), {
                                    index: s[t.time],
                                    value: [0, t.open, t.high, t.low, t.close, t.volume, e]
                                }
                            }));
                        return {
                            lastPrice: i,
                            projectionPlots: o,
                            reversalAmount: a,
                            boxSize: r
                        }
                    }(e))
                }
                _enqueueUpdate(t) {
                    return this._ongoingDataUpdate = this._ongoingDataUpdate.then(t, t), this._ongoingDataUpdate
                }
                _onDataUnpacked(t, e, s) {
                    if (this._status === f.Idle) return;
                    this._status === f.AwaitingFirstDataUpdate && (this._changeStatusTo(f.Active), this._clearDataImpl());
                    const n = this._data.bars().size(),
                        i = this._data.bars().firstIndex(),
                        r = this._data.mergeRegularBars(t);
                    null !== s && (this._data.nsBars().clear(), this._data.nsBars().merge(s.projectionPlots), this._data.lastProjectionPrice = s.lastPrice, null !== s.boxSize && (this._data.boxSize = s.boxSize), this._data.reversalAmount = s.reversalAmount);
                    const a = null === i,
                        o = a || null !== r && r.index < i;
                    this._dataEvents.fireDataUpdated(e, o, r, a), n !== this._data.bars().size() && null !== r && this._dataEvents.fireBarReceived(r)
                }
                _onSeriesLoading(t) {
                    this._dataEvents.fireLoading(t)
                }
                _onSeriesCompleted(t, e, s) {
                    this._dataEvents.fireCompleted({
                        updateMode: t,
                        time: e,
                        flags: s
                    })
                }
                _checkTurnaround(t, e) {
                    return this._instanceId === t && (void 0 === e || e === this.turnaround())
                }
            }
        },
        873428: (t, e, s) => {
            function n(t) {
                return t.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")
            }
            s.d(e, {
                regExpEscape: () => n
            })
        }
    }
]);