;
! 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] = "1dd1fec4-9e48-c6ff-78e7-d25cee4b35e3")
    } catch (e) {}
}();
(globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push(["object" == typeof document ? document.currentScript : void 0, 324277, e => {
    "use strict";
    var t = e.i(660006),
        n = e.i(53950),
        s = e.i(631222);
    e.s(["executeOptimisticCTFTransaction", 0, ({
        syntheticTxn: e,
        syntheticTxnRef: i,
        transaction: r,
        market: o,
        txnType: a,
        outcome: l,
        quantity: c,
        usdc: d,
        impact: u,
        errorTag: m,
        proxyAddress: h,
        transactionStore: p,
        enqueueTransaction: f,
        gasPreference: g,
        customGasPrice: x,
        onFailure: y
    }) => {
        let v = {
            txnType: a,
            conditionId: e.conditionId,
            txId: e.txId,
            proxyAddress: h,
            quantity: c.toString(),
            usdc: d.toString()
        };
        n.logger.info("[Optimistic CTF] started", v);
        let b = () => f(r, s.Network.Matic, a, l, c, d, o, u, g, x, void 0, void 0, void 0, !1),
            k = () => {
                try {
                    p.removeTransaction(h, s.MATIC_CONFIG.chainId, e.txId, !0)
                } catch {}
            };
        b().then(() => {
            n.logger.info("[Optimistic CTF] confirmed", v), k()
        }).catch(() => (n.logger.warn("[Optimistic CTF] retrying", v), b().then(() => {
            n.logger.info("[Optimistic CTF] confirmed after retry", v), k()
        }))).catch(n => {
            h && e && p.handleFailedTransaction(h, s.MATIC_CONFIG.chainId, e, o), i.current === e && (i.current = null), y(), (0, t.handleError)(n, m, h, t.BUG_CATEGORIES.MISSION_CRITICAL)
        })
    }])
}, 956998, 701447, e => {
    "use strict";
    var t = e.i(416340);
    let n = "numeric",
        s = "ascii",
        i = "alpha",
        r = "asciinumeric",
        o = "alphanumeric",
        a = "domain",
        l = "emoji",
        c = "whitespace";

    function d(e, t, c) {
        for (let d in t[n] && (t[r] = !0, t[o] = !0), t[s] && (t[r] = !0, t[i] = !0), t[r] && (t[o] = !0), t[i] && (t[o] = !0), t[o] && (t[a] = !0), t[l] && (t[a] = !0), t) {
            let t = (d in c || (c[d] = []), c[d]);
            0 > t.indexOf(e) && t.push(e)
        }
    }

    function u(e = null) {
        this.j = {}, this.jr = [], this.jd = null, this.t = e
    }
    u.groups = {}, u.prototype = {
        accepts() {
            return !!this.t
        },
        go(e) {
            let t = this.j[e];
            if (t) return t;
            for (let t = 0; t < this.jr.length; t++) {
                let n = this.jr[t][0],
                    s = this.jr[t][1];
                if (s && n.test(e)) return s
            }
            return this.jd
        },
        has(e, t = !1) {
            return t ? e in this.j : !!this.go(e)
        },
        ta(e, t, n, s) {
            for (let i = 0; i < e.length; i++) this.tt(e[i], t, n, s)
        },
        tr(e, t, n, s) {
            let i;
            return s = s || u.groups, t && t.j ? i = t : (i = new u(t), n && s && d(t, n, s)), this.jr.push([e, i]), i
        },
        ts(e, t, n, s) {
            let i = this,
                r = e.length;
            if (!r) return i;
            for (let t = 0; t < r - 1; t++) i = i.tt(e[t]);
            return i.tt(e[r - 1], t, n, s)
        },
        tt(e, t, n, s) {
            if (s = s || u.groups, t && t.j) return this.j[e] = t, t;
            let i, r = this.go(e);
            return r ? (Object.assign((i = new u).j, r.j), i.jr.push.apply(i.jr, r.jr), i.jd = r.jd, i.t = r.t) : i = new u, t && (s && (i.t && "string" == typeof i.t ? d(t, Object.assign(function(e, t) {
                let n = {};
                for (let s in t) t[s].indexOf(e) >= 0 && (n[s] = !0);
                return n
            }(i.t, s), n), s) : n && d(t, n, s)), i.t = t), this.j[e] = i, i
        }
    };
    let m = (e, t, n, s, i) => e.ta(t, n, s, i),
        h = (e, t, n, s, i) => e.tr(t, n, s, i),
        p = (e, t, n, s, i) => e.ts(t, n, s, i),
        f = (e, t, n, s, i) => e.tt(t, n, s, i),
        g = "WORD",
        x = "UWORD",
        y = "ASCIINUMERICAL",
        v = "ALPHANUMERICAL",
        b = "LOCALHOST",
        k = "UTLD",
        S = "SCHEME",
        C = "SLASH_SCHEME",
        j = "OPENBRACE",
        w = "CLOSEBRACE",
        T = "OPENBRACKET",
        N = "CLOSEBRACKET",
        I = "OPENPAREN",
        E = "CLOSEPAREN",
        O = "OPENANGLEBRACKET",
        M = "CLOSEANGLEBRACKET",
        P = "FULLWIDTHLEFTPAREN",
        A = "FULLWIDTHRIGHTPAREN",
        R = "LEFTCORNERBRACKET",
        z = "RIGHTCORNERBRACKET",
        L = "LEFTWHITECORNERBRACKET",
        D = "RIGHTWHITECORNERBRACKET",
        F = "FULLWIDTHLESSTHAN",
        _ = "FULLWIDTHGREATERTHAN",
        B = "AMPERSAND",
        H = "APOSTROPHE",
        $ = "ASTERISK",
        U = "BACKSLASH",
        q = "BACKTICK",
        W = "CARET",
        K = "COLON",
        V = "COMMA",
        Q = "DOLLAR",
        G = "EQUALS",
        Y = "EXCLAMATION",
        Z = "HYPHEN",
        X = "PERCENT",
        J = "PIPE",
        ee = "PLUS",
        et = "POUND",
        en = "QUERY",
        es = "QUOTE",
        ei = "FULLWIDTHMIDDLEDOT",
        er = "SEMI",
        eo = "SLASH",
        ea = "TILDE",
        el = "UNDERSCORE",
        ec = "EMOJI";
    var ed = Object.freeze({
        __proto__: null,
        ALPHANUMERICAL: v,
        AMPERSAND: B,
        APOSTROPHE: H,
        ASCIINUMERICAL: y,
        ASTERISK: $,
        AT: "AT",
        BACKSLASH: U,
        BACKTICK: q,
        CARET: W,
        CLOSEANGLEBRACKET: M,
        CLOSEBRACE: w,
        CLOSEBRACKET: N,
        CLOSEPAREN: E,
        COLON: K,
        COMMA: V,
        DOLLAR: Q,
        DOT: "DOT",
        EMOJI: ec,
        EQUALS: G,
        EXCLAMATION: Y,
        FULLWIDTHGREATERTHAN: _,
        FULLWIDTHLEFTPAREN: P,
        FULLWIDTHLESSTHAN: F,
        FULLWIDTHMIDDLEDOT: ei,
        FULLWIDTHRIGHTPAREN: A,
        HYPHEN: Z,
        LEFTCORNERBRACKET: R,
        LEFTWHITECORNERBRACKET: L,
        LOCALHOST: b,
        NL: "NL",
        NUM: "NUM",
        OPENANGLEBRACKET: O,
        OPENBRACE: j,
        OPENBRACKET: T,
        OPENPAREN: I,
        PERCENT: X,
        PIPE: J,
        PLUS: ee,
        POUND: et,
        QUERY: en,
        QUOTE: es,
        RIGHTCORNERBRACKET: z,
        RIGHTWHITECORNERBRACKET: D,
        SCHEME: S,
        SEMI: er,
        SLASH: eo,
        SLASH_SCHEME: C,
        SYM: "SYM",
        TILDE: ea,
        TLD: "TLD",
        UNDERSCORE: el,
        UTLD: k,
        UWORD: x,
        WORD: g,
        WS: "WS"
    });
    let eu = /[a-z]/,
        em = /\p{L}/u,
        eh = /\p{Emoji}/u,
        ep = /\d/,
        ef = /\s/,
        eg = null,
        ex = null;

    function ey(e, t) {
        let n = function(e) {
                let t = [],
                    n = e.length,
                    s = 0;
                for (; s < n;) {
                    let i, r = e.charCodeAt(s),
                        o = r < 55296 || r > 56319 || s + 1 === n || (i = e.charCodeAt(s + 1)) < 56320 || i > 57343 ? e[s] : e.slice(s, s + 2);
                    t.push(o), s += o.length
                }
                return t
            }(t.replace(/[A-Z]/g, e => e.toLowerCase())),
            s = n.length,
            i = [],
            r = 0,
            o = 0;
        for (; o < s;) {
            let a = e,
                l = null,
                c = 0,
                d = null,
                u = -1,
                m = -1;
            for (; o < s && (l = a.go(n[o]));)(a = l).accepts() ? (u = 0, m = 0, d = a) : u >= 0 && (u += n[o].length, m++), c += n[o].length, r += n[o].length, o++;
            r -= u, o -= m, c -= u, i.push({
                t: d.t,
                v: t.slice(r - c, r),
                s: r - c,
                e: r
            })
        }
        return i
    }

    function ev(e, t, n, s, i) {
        let r, o = t.length;
        for (let n = 0; n < o - 1; n++) {
            let o = t[n];
            e.j[o] ? r = e.j[o] : ((r = new u(s)).jr = i.slice(), e.j[o] = r), e = r
        }
        return (r = new u(n)).jr = i.slice(), e.j[t[o - 1]] = r, r
    }

    function eb(e) {
        let t = [],
            n = [],
            s = 0;
        for (; s < e.length;) {
            let i = 0;
            for (;
                "0123456789".indexOf(e[s + i]) >= 0;) i++;
            if (i > 0) {
                t.push(n.join(""));
                for (let t = parseInt(e.substring(s, s + i), 10); t > 0; t--) n.pop();
                s += i
            } else n.push(e[s]), s++
        }
        return t
    }
    let ek = {
        defaultProtocol: "http",
        events: null,
        format: eC,
        formatHref: eC,
        nl2br: !1,
        tagName: "a",
        target: null,
        rel: null,
        validate: !0,
        truncate: 1 / 0,
        className: null,
        attributes: null,
        ignoreTags: [],
        render: null
    };

    function eS(e, t = null) {
        let n = Object.assign({}, ek);
        e && (n = Object.assign(n, e instanceof eS ? e.o : e));
        let s = n.ignoreTags,
            i = [];
        for (let e = 0; e < s.length; e++) i.push(s[e].toUpperCase());
        this.o = n, t && (this.defaultRender = t), this.ignoreTags = i
    }

    function eC(e) {
        return e
    }

    function ej(e, t) {
        this.t = "token", this.v = e, this.tk = t
    }

    function ew(e, t) {
        class n extends ej {
            constructor(t, n) {
                super(t, n), this.t = e
            }
        }
        for (let e in t) n.prototype[e] = t[e];
        return n.t = e, n
    }
    eS.prototype = {
        o: ek,
        ignoreTags: [],
        defaultRender: e => e,
        check(e) {
            return this.get("validate", e.toString(), e)
        },
        get(e, t, n) {
            let s = null != t,
                i = this.o[e];
            return i && ("object" == typeof i ? "function" == typeof(i = n.t in i ? i[n.t] : ek[e]) && s && (i = i(t, n)) : "function" == typeof i && s && (i = i(t, n.t, n))), i
        },
        getObj(e, t, n) {
            let s = this.o[e];
            return "function" == typeof s && null != t && (s = s(t, n.t, n)), s
        },
        render(e) {
            let t = e.render(this);
            return (this.get("render", null, e) || this.defaultRender)(t, e.t, e)
        }
    }, ej.prototype = {
        isLink: !1,
        toString() {
            return this.v
        },
        toHref(e) {
            return this.toString()
        },
        toFormattedString(e) {
            let t = this.toString(),
                n = e.get("truncate", t, this),
                s = e.get("format", t, this);
            return n && s.length > n ? s.substring(0, n) + "…" : s
        },
        toFormattedHref(e) {
            return e.get("formatHref", this.toHref(e.get("defaultProtocol")), this)
        },
        startIndex() {
            return this.tk[0].s
        },
        endIndex() {
            return this.tk[this.tk.length - 1].e
        },
        toObject(e = ek.defaultProtocol) {
            return {
                type: this.t,
                value: this.toString(),
                isLink: this.isLink,
                href: this.toHref(e),
                start: this.startIndex(),
                end: this.endIndex()
            }
        },
        toFormattedObject(e) {
            return {
                type: this.t,
                value: this.toFormattedString(e),
                isLink: this.isLink,
                href: this.toFormattedHref(e),
                start: this.startIndex(),
                end: this.endIndex()
            }
        },
        validate(e) {
            return e.get("validate", this.toString(), this)
        },
        render(e) {
            let t = this.toHref(e.get("defaultProtocol")),
                n = e.get("formatHref", t, this),
                s = e.get("tagName", t, this),
                i = this.toFormattedString(e),
                r = {},
                o = e.get("className", t, this),
                a = e.get("target", t, this),
                l = e.get("rel", t, this),
                c = e.getObj("attributes", t, this),
                d = e.getObj("events", t, this);
            return r.href = n, o && (r.class = o), a && (r.target = a), l && (r.rel = l), c && Object.assign(r, c), {
                tagName: s,
                attributes: r,
                content: i,
                eventListeners: d
            }
        }
    };
    let eT = ew("email", {
            isLink: !0,
            toHref() {
                return "mailto:" + this.toString()
            }
        }),
        eN = ew("text"),
        eI = ew("nl"),
        eE = ew("url", {
            isLink: !0,
            toHref(e = ek.defaultProtocol) {
                return this.hasProtocol() ? this.v : `${e}://${this.v}`
            },
            hasProtocol() {
                let e = this.tk;
                return e.length >= 2 && e[0].t !== b && e[1].t === K
            }
        }),
        eO = e => new u(e);

    function eM(e, t, n) {
        let s = n[0].s,
            i = n[n.length - 1].e;
        return new e(t.slice(s, i), n)
    }
    let eP = {
        scanner: null,
        parser: null,
        tokenQueue: [],
        pluginQueue: [],
        customSchemes: [],
        initialized: !1
    };

    function eA(e) {
        return eP.initialized || function() {
                eP.scanner = function(e = []) {
                    let t = {};
                    u.groups = t;
                    let m = new u;
                    null == eg && (eg = eb(" ögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")), null == ex && (ex = eb("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")), f(m, "'", H), f(m, "{", j), f(m, "}", w), f(m, "[", T), f(m, "]", N), f(m, "(", I), f(m, ")", E), f(m, "<", O), f(m, ">", M), f(m, "（", P), f(m, "）", A), f(m, "「", R), f(m, "」", z), f(m, "『", L), f(m, "』", D), f(m, "＜", F), f(m, "＞", _), f(m, "&", B), f(m, "*", $), f(m, "@", "AT"), f(m, "`", q), f(m, "^", W), f(m, ":", K), f(m, ",", V), f(m, "$", Q), f(m, ".", "DOT"), f(m, "=", G), f(m, "!", Y), f(m, "-", Z), f(m, "%", X), f(m, "|", J), f(m, "+", ee), f(m, "#", et), f(m, "?", en), f(m, '"', es), f(m, "/", eo), f(m, ";", er), f(m, "~", ea), f(m, "_", el), f(m, "\\", U), f(m, "・", ei);
                    let ey = h(m, ep, "NUM", {
                        [n]: !0
                    });
                    h(ey, ep, ey);
                    let ek = h(ey, eu, y, {
                            [r]: !0
                        }),
                        eS = h(ey, em, v, {
                            [o]: !0
                        }),
                        eC = h(m, eu, g, {
                            [s]: !0
                        });
                    h(eC, ep, ek), h(eC, eu, eC), h(ek, ep, ek), h(ek, eu, ek);
                    let ej = h(m, em, x, {
                        [i]: !0
                    });
                    h(ej, eu), h(ej, ep, eS), h(ej, em, ej), h(eS, ep, eS), h(eS, eu), h(eS, em, eS);
                    let ew = f(m, "\n", "NL", {
                            [c]: !0
                        }),
                        eT = f(m, "\r", "WS", {
                            [c]: !0
                        }),
                        eN = h(m, ef, "WS", {
                            [c]: !0
                        });
                    f(m, "￼", eN), f(eT, "\n", ew), f(eT, "￼", eN), h(eT, ef, eN), f(eN, "\r"), f(eN, "\n"), h(eN, ef, eN), f(eN, "￼", eN);
                    let eI = h(m, eh, ec, {
                        [l]: !0
                    });
                    f(eI, "#"), h(eI, eh, eI), f(eI, "️", eI);
                    let eE = f(eI, "‍");
                    f(eE, "#"), h(eE, eh, eI);
                    let eO = [
                            [eu, eC],
                            [ep, ek]
                        ],
                        eM = [
                            [eu, null],
                            [em, ej],
                            [ep, eS]
                        ];
                    for (let e = 0; e < eg.length; e++) ev(m, eg[e], "TLD", g, eO);
                    for (let e = 0; e < ex.length; e++) ev(m, ex[e], k, x, eM);
                    d("TLD", {
                        tld: !0,
                        ascii: !0
                    }, t), d(k, {
                        utld: !0,
                        alpha: !0
                    }, t), ev(m, "file", S, g, eO), ev(m, "mailto", S, g, eO), ev(m, "http", C, g, eO), ev(m, "https", C, g, eO), ev(m, "ftp", C, g, eO), ev(m, "ftps", C, g, eO), d(S, {
                        scheme: !0,
                        ascii: !0
                    }, t), d(C, {
                        slashscheme: !0,
                        ascii: !0
                    }, t), e = e.sort((e, t) => e[0] > t[0] ? 1 : -1);
                    for (let t = 0; t < e.length; t++) {
                        let i = e[t][0],
                            o = e[t][1] ? {
                                scheme: !0
                            } : {
                                slashscheme: !0
                            };
                        i.indexOf("-") >= 0 ? o[a] = !0 : eu.test(i) ? ep.test(i) ? o[r] = !0 : o[s] = !0 : o[n] = !0, p(m, i, i, o)
                    }
                    return p(m, "localhost", b, {
                        ascii: !0
                    }), m.jd = new u("SYM"), {
                        start: m,
                        tokens: Object.assign({
                            groups: t
                        }, ed)
                    }
                }(eP.customSchemes);
                for (let e = 0; e < eP.tokenQueue.length; e++) eP.tokenQueue[e][1]({
                    scanner: eP.scanner
                });
                eP.parser = function({
                    groups: e
                }) {
                    let t = e.domain.concat([B, $, "AT", U, q, W, Q, G, Z, "NUM", X, J, ee, et, eo, "SYM", ea, el]),
                        n = [H, K, V, "DOT", Y, X, en, es, er, O, M, j, w, N, T, I, E, P, A, R, z, L, D, F, _],
                        s = [B, H, $, U, q, W, Q, G, Z, j, w, X, J, ee, et, en, eo, "SYM", ea, el],
                        i = eO(),
                        r = f(i, ea);
                    m(r, s, r), m(r, e.domain, r);
                    let o = eO(),
                        a = eO(),
                        l = eO();
                    m(i, e.domain, o), m(i, e.scheme, a), m(i, e.slashscheme, l), m(o, s, r), m(o, e.domain, o);
                    let c = f(o, "AT");
                    f(r, "AT", c), f(a, "AT", c), f(l, "AT", c);
                    let d = f(r, "DOT");
                    m(d, s, r), m(d, e.domain, r);
                    let u = eO();
                    m(c, e.domain, u), m(u, e.domain, u);
                    let h = f(u, "DOT");
                    m(h, e.domain, u);
                    let p = eO(eT);
                    m(h, e.tld, p), m(h, e.utld, p), f(c, b, p);
                    let g = f(u, Z);
                    f(g, Z, g), m(g, e.domain, u), m(p, e.domain, u), f(p, "DOT", h), f(p, Z, g), m(f(p, K), e.numeric, eT);
                    let x = f(o, Z),
                        y = f(o, "DOT");
                    f(x, Z, x), m(x, e.domain, o), m(y, s, r), m(y, e.domain, o);
                    let v = eO(eE);
                    m(y, e.tld, v), m(y, e.utld, v), m(v, e.domain, o), m(v, s, r), f(v, "DOT", y), f(v, Z, x), f(v, "AT", c);
                    let k = f(v, K),
                        S = eO(eE);
                    m(k, e.numeric, S);
                    let C = eO(eE),
                        ei = eO();
                    m(C, t, C), m(C, n, ei), m(ei, t, C), m(ei, n, ei), f(v, eo, C), f(S, eo, C);
                    let ec = f(a, K),
                        eu = f(l, K),
                        em = f(eu, eo),
                        eh = f(em, eo);
                    m(a, e.domain, o), f(a, "DOT", y), f(a, Z, x), m(l, e.domain, o), f(l, "DOT", y), f(l, Z, x), m(ec, e.domain, C), f(ec, eo, C), f(ec, en, C), m(eh, e.domain, C), m(eh, t, C), f(eh, eo, C);
                    let ep = [
                        [j, w],
                        [T, N],
                        [I, E],
                        [O, M],
                        [P, A],
                        [R, z],
                        [L, D],
                        [F, _]
                    ];
                    for (let e = 0; e < ep.length; e++) {
                        let [s, i] = ep[e], r = f(C, s);
                        f(ei, s, r), f(r, i, C);
                        let o = eO(eE);
                        m(r, t, o);
                        let a = eO();
                        m(r, n), m(o, t, o), m(o, n, a), m(a, t, o), m(a, n, a), f(o, i, C), f(a, i, C)
                    }
                    return f(i, b, v), f(i, "NL", eI), {
                        start: i,
                        tokens: ed
                    }
                }(eP.scanner.tokens);
                for (let e = 0; e < eP.pluginQueue.length; e++) eP.pluginQueue[e][1]({
                    scanner: eP.scanner,
                    parser: eP.parser
                });
                eP.initialized = !0
            }(),
            function(e, t, n) {
                let s = n.length,
                    i = 0,
                    r = [],
                    o = [];
                for (; i < s;) {
                    let a = e,
                        l = null,
                        c = null,
                        d = 0,
                        u = null,
                        m = -1;
                    for (; i < s && !(l = a.go(n[i].t));) o.push(n[i++]);
                    for (; i < s && (c = l || a.go(n[i].t));) l = null, (a = c).accepts() ? (m = 0, u = a) : m >= 0 && m++, i++, d++;
                    if (m < 0)(i -= d) < s && (o.push(n[i]), i++);
                    else {
                        o.length > 0 && (r.push(eM(eN, t, o)), o = []), i -= m, d -= m;
                        let e = u.t,
                            s = n.slice(i - d, i);
                        r.push(eM(e, t, s))
                    }
                }
                return o.length > 0 && r.push(eM(eN, t, o)), r
            }(eP.parser.start, e, ey(eP.scanner.start, e))
    }
    eA.scan = ey, e.s(["Options", 0, eS, "find", 0, function(e, t = null, n = null) {
        if (t && "object" == typeof t) {
            if (n) throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);
            n = t, t = null
        }
        let s = new eS(n),
            i = eA(e),
            r = [];
        for (let e = 0; e < i.length; e++) {
            let n = i[e];
            n.isLink && (!t || n.t === t) && s.check(n) && r.push(n.toFormattedObject(s))
        }
        return r
    }, "tokenize", 0, eA], 701447), e.s(["default", 0, e => {
        let n = 0,
            s = {
                key: "__linkify-wrapper"
            };
        for (let t in e) "options" !== t && "as" !== t && "tagName" !== t && "children" !== t && (s[t] = e[t]);
        let i = new eS(e.options, ({
                tagName: e,
                attributes: s,
                content: i
            }) => (s.key = `__linkify-lnk-${n++}`, s.class && (s.className = s.class, delete s.class), t.createElement(e, s, i))),
            r = e.as || e.tagName || t.Fragment || "span",
            o = e.children;
        return function e(n, s, i) {
            if (0 === t.Children.count(n.props.children)) return n;
            let r = [];
            t.Children.forEach(n.props.children, n => {
                "string" == typeof n ? r.push.apply(r, function(e, n, s) {
                    let i = eA(e),
                        r = [];
                    for (let e = 0; e < i.length; e++) {
                        let o = i[e];
                        if ("nl" === o.t && n.get("nl2br")) {
                            let e = `__linkify-el-${s.elementId++}`;
                            r.push(t.createElement("br", {
                                key: e
                            }))
                        } else if (o.isLink && n.check(o)) {
                            let e = n.render(o);
                            if (!("key" in e.props)) {
                                let n = Object.assign({
                                    key: `__linkify-el-${s.elementId++}`
                                }, e.props);
                                e = t.cloneElement(e, n)
                            }
                            r.push(e)
                        } else r.push(o.toString())
                    }
                    return r
                }(n, s, i)) : t.isValidElement(n) ? "string" == typeof n.type && s.ignoreTags.indexOf(n.type.toUpperCase()) >= 0 ? r.push(n) : r.push(e(n, s, i)) : r.push(n)
            });
            let o = Object.assign({
                key: `__linkify-el-${i.elementId++}`
            }, n.props);
            return t.cloneElement(n, o, r)
        }(t.createElement(r, s, o), i, {
            elementId: 0
        })
    }], 956998)
}, 15756, e => {
    "use strict";
    var t = e.i(416340),
        n = e.i(197994);
    e.s(["IconClockFill18", 0, ({ ...e
    }) => t.default.createElement(n.Icon, {
        size: "18px",
        ...e
    }, t.default.createElement("path", {
        d: "M9,1C4.589,1,1,4.589,1,9s3.589,8,8,8,8-3.589,8-8S13.411,1,9,1Zm3.867,10.677c-.146,.21-.379,.323-.617,.323-.147,0-.296-.043-.426-.133l-3.25-2.25c-.203-.14-.323-.371-.323-.617V4.75c0-.414,.336-.75,.75-.75s.75,.336,.75,.75v3.857l2.927,2.026c.341,.236,.426,.703,.19,1.043Z",
        fill: "currentColor"
    }))])
}, 985185, e => {
    "use strict";
    var t = e.i(416340),
        n = e.i(197994);
    e.s(["IconLockFill18", 0, ({ ...e
    }) => t.default.createElement(n.Icon, {
        size: "18px",
        ...e
    }, t.default.createElement("path", {
        d: "M12.25,9c-.414,0-.75-.336-.75-.75v-3.25c0-1.378-1.122-2.5-2.5-2.5s-2.5,1.122-2.5,2.5v3.25c0,.414-.336,.75-.75,.75s-.75-.336-.75-.75v-3.25c0-2.206,1.794-4,4-4s4,1.794,4,4v3.25c0,.414-.336,.75-.75,.75Z",
        fill: "currentColor",
        "data-color": "color-2"
    }), t.default.createElement("path", {
        d: "M12.75,7.5H5.25c-1.517,0-2.75,1.233-2.75,2.75v4c0,1.517,1.233,2.75,2.75,2.75h7.5c1.517,0,2.75-1.233,2.75-2.75v-4c0-1.517-1.233-2.75-2.75-2.75Zm-3,5.25c0,.414-.336,.75-.75,.75s-.75-.336-.75-.75v-1c0-.414,.336-.75,.75-.75s.75,.336,.75,.75v1Z",
        fill: "currentColor"
    }))])
}, 19303, e => {
    "use strict";
    var t = e.i(221628),
        n = e.i(999061),
        s = e.i(23128),
        i = e.i(257656),
        r = e.i(825556),
        o = e.i(416340),
        a = e.i(732799),
        l = e.i(635868);
    e.s(["ClobRefreshButtonWithTooltip", 0, e => {
        let c, d, u, m, h, p = (0, n.c)(12),
            {
                variant: f
            } = e,
            g = void 0 === f ? "ghost" : f;
        p[0] === Symbol.for("react.memo_cache_sentinel") ? (c = ["refetchBook", "isBookRefreshing"], p[0] = c) : c = p[0];
        let {
            refetchBook: x,
            isBookRefreshing: y
        } = (0, l.useBookContext)(c), {
            resetConnection: v
        } = (0, a.useMarketWsContext)(), [b, k] = o.useState(!1);
        p[1] !== x || p[2] !== v ? (d = () => {
            k(!0), setTimeout(() => k(!1), 500), x(), setTimeout(() => v(), 1e3)
        }, p[1] = x, p[2] = v, p[3] = d) : d = p[3];
        let S = d;
        p[4] === Symbol.for("react.memo_cache_sentinel") ? (u = {
            wait: 3e3,
            leading: !0
        }, p[4] = u) : u = p[4];
        let {
            run: C
        } = (0, r.useThrottleFn)(S, u), j = y || b, w = b ? "animate-rotateOnce duration-500" : void 0;
        return p[5] !== w ? (m = (0, t.jsx)(i.IconRefreshClockwiseOutline12, {
            className: w
        }), p[5] = w, p[6] = m) : m = p[6], p[7] !== C || p[8] !== j || p[9] !== m || p[10] !== g ? (h = (0, t.jsx)(s.Button, {
            onClick: C,
            disabled: j,
            variant: g,
            size: "iconSm",
            className: "text-text-secondary w-7 h-7 group",
            children: m
        }), p[7] = C, p[8] = j, p[9] = m, p[10] = g, p[11] = h) : h = p[11], h
    }])
}, 455145, 469870, e => {
    "use strict";
    var t = e.i(740594),
        n = e.i(970863),
        s = e.i(567692),
        i = e.i(416340),
        r = e.i(399336),
        o = e.i(880809),
        a = e.i(196593),
        l = e.i(156591),
        c = e.i(488549),
        d = e.i(458164);
    e.s(["useOnPriceLevelClick", 0, e => {
        let u = (0, r.useEventActiveMarket)(),
            m = (0, s.useBoundBookStore)(),
            h = i.useMemo(() => e && Object.keys(e).length > 0 ? e : u, [e, u]),
            {
                hasTouchedPrice: p,
                orderType: f,
                side: g,
                setHasTouchedPrice: x,
                setOrderType: y,
                setCursorActive: v,
                setPrice: b,
                setPriceUpdateLocation: k,
                setShares: S,
                setAmountUpdateLocation: C
            } = (0, o.useTradeContext)(["hasTouchedPrice", "orderType", "side", "setHasTouchedPrice", "setOrderType", "setCursorActive", "setPrice", "setPriceUpdateLocation", "setShares", "setAmountUpdateLocation"]),
            j = i.useCallback(e => {
                let t = (0, n.getAssetId)(h),
                    s = m.getState().byAsset[t] ? .tickSizes;
                return s ? {
                    activePrecision: (0, l.getPrecisionFromTickSize)(s.active),
                    marketPrecision: (0, l.getPrecisionFromTickSize)(s.market)
                } : {
                    activePrecision: (0, l.getPrecisionFromTickSize)(e ? ? h.orderPriceMinTickSize),
                    marketPrecision: (0, l.getPrecisionFromTickSize)(h.orderPriceMinTickSize)
                }
            }, [h]);
        return i.useCallback(({
            data: e
        }) => {
            p || x(!0), f !== d.OrderType.Limit && y(d.OrderType.Limit);
            let {
                activePrecision: n,
                marketPrecision: s
            } = j(e.tickSize), i = (0, a.showPaddedCentsOnly)(((e, t, n) => {
                if (2 === e && 3 === t) {
                    if ("1.00" === n || "1.0" === n || "1" === n) return "0.999";
                    if ("0.00" === n || "0.0" === n || "0" === n) return "0.001"
                }
                return n
            })(n, s, e.price), s);
            if (k("click"), b(i), e.netSize) {
                let n = (0, c.cleanValueIfNeeded)(e.netSize, 2);
                C("click"), g === t.Side.BUY && "ask" === e.type || g === t.Side.SELL && "bid" === e.type ? S(n) : S("")
            }
            v(!0)
        }, [h ? .orderPriceMinTickSize, g, p])
    }], 455145), e.s(["useOnSpreadClick", 0, () => {
        let {
            setCursorActive: e
        } = (0, o.useTradeContext)(["setCursorActive"]);
        return i.useCallback(t => {
            e(!0)
        }, [])
    }], 469870)
}, 429412, 230078, 912498, 821986, 83638, 219494, 908392, 843340, e => {
    "use strict";
    var t = e.i(416340),
        n = e.i(149285);

    function s(e, t, n) {
        let s, i = n.initialDeps ? ? [],
            r = !0;

        function o() {
            var o, a, l;
            let c, d;
            n.key && (null == (o = n.debug) ? void 0 : o.call(n)) && (c = Date.now());
            let u = e();
            if (!(u.length !== i.length || u.some((e, t) => i[t] !== e))) return s;
            if (i = u, n.key && (null == (a = n.debug) ? void 0 : a.call(n)) && (d = Date.now()), s = t(...u), n.key && (null == (l = n.debug) ? void 0 : l.call(n))) {
                let e = Math.round((Date.now() - c) * 100) / 100,
                    t = Math.round((Date.now() - d) * 100) / 100,
                    s = t / 16,
                    i = (e, t) => {
                        for (e = String(e); e.length < t;) e = " " + e;
                        return e
                    };
                console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`, `
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*s,120))}deg 100% 31%);`, null == n ? void 0 : n.key)
            }
            return (null == n ? void 0 : n.onChange) && !(r && n.skipInitialOnChange) && n.onChange(s), r = !1, s
        }
        return o.updateDeps = e => {
            i = e
        }, o
    }

    function i(e, t) {
        if (void 0 !== e) return e;
        throw Error(`Unexpected undefined${t?`: ${t}`:""}`)
    }
    e.i(284553);
    let r = (e, t, n) => {
            let s;
            return function(...i) {
                e.clearTimeout(s), s = e.setTimeout(() => t.apply(this, i), n)
            }
        },
        o = e => {
            let {
                offsetWidth: t,
                offsetHeight: n
            } = e;
            return {
                width: t,
                height: n
            }
        },
        a = e => e,
        l = e => {
            let t = Math.max(e.startIndex - e.overscan, 0),
                n = Math.min(e.endIndex + e.overscan, e.count - 1),
                s = [];
            for (let e = t; e <= n; e++) s.push(e);
            return s
        },
        c = (e, t) => {
            let n = e.scrollElement;
            if (!n) return;
            let s = e.targetWindow;
            if (!s) return;
            let i = e => {
                let {
                    width: n,
                    height: s
                } = e;
                t({
                    width: Math.round(n),
                    height: Math.round(s)
                })
            };
            if (i(o(n)), !s.ResizeObserver) return () => {};
            let r = new s.ResizeObserver(t => {
                let s = () => {
                    let e = t[0];
                    if (null == e ? void 0 : e.borderBoxSize) {
                        let t = e.borderBoxSize[0];
                        if (t) return void i({
                            width: t.inlineSize,
                            height: t.blockSize
                        })
                    }
                    i(o(n))
                };
                e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(s) : s()
            });
            return r.observe(n, {
                box: "border-box"
            }), () => {
                r.unobserve(n)
            }
        },
        d = {
            passive: !0
        },
        u = "u" < typeof window || "onscrollend" in window,
        m = (e, t) => {
            let n = e.scrollElement;
            if (!n) return;
            let s = e.targetWindow;
            if (!s) return;
            let i = 0,
                o = e.options.useScrollendEvent && u ? () => void 0 : r(s, () => {
                    t(i, !1)
                }, e.options.isScrollingResetDelay),
                a = s => () => {
                    let {
                        horizontal: r,
                        isRtl: a
                    } = e.options;
                    i = r ? n.scrollLeft * (a && -1 || 1) : n.scrollTop, o(), t(i, s)
                },
                l = a(!0),
                c = a(!1);
            n.addEventListener("scroll", l, d);
            let m = e.options.useScrollendEvent && u;
            return m && n.addEventListener("scrollend", c, d), () => {
                n.removeEventListener("scroll", l), m && n.removeEventListener("scrollend", c)
            }
        },
        h = (e, t, n) => {
            if (null == t ? void 0 : t.borderBoxSize) {
                let e = t.borderBoxSize[0];
                if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"])
            }
            return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"]
        },
        p = (e, {
            adjustments: t = 0,
            behavior: n
        }, s) => {
            var i, r;
            null == (r = null == (i = s.scrollElement) ? void 0 : i.scrollTo) || r.call(i, {
                [s.options.horizontal ? "left" : "top"]: e + t,
                behavior: n
            })
        };
    class f {
        constructor(e) {
            this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this.itemSizeCache = new Map, this.laneAssignments = new Map, this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = new Map, this.now = () => {
                var e, t, n;
                return (null == (n = null == (t = null == (e = this.targetWindow) ? void 0 : e.performance) ? void 0 : t.now) ? void 0 : n.call(t)) ? ? Date.now()
            }, this.observer = (() => {
                let e = null,
                    t = () => e || (this.targetWindow && this.targetWindow.ResizeObserver ? e = new this.targetWindow.ResizeObserver(e => {
                        e.forEach(e => {
                            let t = () => {
                                let t = e.target,
                                    n = this.indexFromElement(t);
                                t.isConnected ? this.shouldMeasureDuringScroll(n) && this.resizeItem(n, this.options.measureElement(t, e, this)) : this.observer.unobserve(t)
                            };
                            this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(t) : t()
                        })
                    }) : null);
                return {
                    disconnect: () => {
                        var n;
                        null == (n = t()) || n.disconnect(), e = null
                    },
                    observe: e => {
                        var n;
                        return null == (n = t()) ? void 0 : n.observe(e, {
                            box: "border-box"
                        })
                    },
                    unobserve: e => {
                        var n;
                        return null == (n = t()) ? void 0 : n.unobserve(e)
                    }
                }
            })(), this.range = null, this.setOptions = e => {
                Object.entries(e).forEach(([t, n]) => {
                    void 0 === n && delete e[t]
                }), this.options = {
                    debug: !1,
                    initialOffset: 0,
                    overscan: 1,
                    paddingStart: 0,
                    paddingEnd: 0,
                    scrollPaddingStart: 0,
                    scrollPaddingEnd: 0,
                    horizontal: !1,
                    getItemKey: a,
                    rangeExtractor: l,
                    onChange: () => {},
                    measureElement: h,
                    initialRect: {
                        width: 0,
                        height: 0
                    },
                    scrollMargin: 0,
                    gap: 0,
                    indexAttribute: "data-index",
                    initialMeasurementsCache: [],
                    lanes: 1,
                    isScrollingResetDelay: 150,
                    enabled: !0,
                    isRtl: !1,
                    useScrollendEvent: !1,
                    useAnimationFrameWithResizeObserver: !1,
                    laneAssignmentMode: "estimate",
                    ...e
                }
            }, this.notify = e => {
                var t, n;
                null == (n = (t = this.options).onChange) || n.call(t, this, e)
            }, this.maybeNotify = s(() => (this.calculateRange(), [this.isScrolling, this.range ? this.range.startIndex : null, this.range ? this.range.endIndex : null]), e => {
                this.notify(e)
            }, {
                key: !1,
                debug: () => this.options.debug,
                initialDeps: [this.isScrolling, this.range ? this.range.startIndex : null, this.range ? this.range.endIndex : null]
            }), this.cleanup = () => {
                this.unsubs.filter(Boolean).forEach(e => e()), this.unsubs = [], this.observer.disconnect(), null != this.rafId && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this.scrollElement = null, this.targetWindow = null
            }, this._didMount = () => () => {
                this.cleanup()
            }, this._willUpdate = () => {
                var e;
                let t = this.options.enabled ? this.options.getScrollElement() : null;
                if (this.scrollElement !== t) {
                    if (this.cleanup(), !t) return void this.maybeNotify();
                    this.scrollElement = t, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = (null == (e = this.scrollElement) ? void 0 : e.window) ? ? null, this.elementsCache.forEach(e => {
                        this.observer.observe(e)
                    }), this.unsubs.push(this.options.observeElementRect(this, e => {
                        this.scrollRect = e, this.maybeNotify()
                    })), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => {
                        this.scrollAdjustments = 0, this.scrollDirection = t ? this.getScrollOffset() < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify()
                    })), this._scrollToOffset(this.getScrollOffset(), {
                        adjustments: void 0,
                        behavior: void 0
                    })
                }
            }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ? ? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ? ? ("function" == typeof this.options.initialOffset ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, t) => {
                let n = new Map,
                    s = new Map;
                for (let i = t - 1; i >= 0; i--) {
                    let t = e[i];
                    if (n.has(t.lane)) continue;
                    let r = s.get(t.lane);
                    if (null == r || t.end > r.end ? s.set(t.lane, t) : t.end < r.end && n.set(t.lane, !0), n.size === this.options.lanes) break
                }
                return s.size === this.options.lanes ? Array.from(s.values()).sort((e, t) => e.end === t.end ? e.index - t.index : e.end - t.end)[0] : void 0
            }, this.getMeasurementOptions = s(() => [this.options.count, this.options.paddingStart, this.options.scrollMargin, this.options.getItemKey, this.options.enabled, this.options.lanes, this.options.laneAssignmentMode], (e, t, n, s, i, r, o) => (void 0 !== this.prevLanes && this.prevLanes !== r && (this.lanesChangedFlag = !0), this.prevLanes = r, this.pendingMeasuredCacheIndexes = [], {
                count: e,
                paddingStart: t,
                scrollMargin: n,
                getItemKey: s,
                enabled: i,
                lanes: r,
                laneAssignmentMode: o
            }), {
                key: !1
            }), this.getMeasurements = s(() => [this.getMeasurementOptions(), this.itemSizeCache], ({
                count: e,
                paddingStart: t,
                scrollMargin: n,
                getItemKey: s,
                enabled: i,
                lanes: r,
                laneAssignmentMode: o
            }, a) => {
                if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
                if (this.laneAssignments.size > e)
                    for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
                this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), 0 !== this.measurementsCache.length || this.lanesSettling || (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach(e => {
                    this.itemSizeCache.set(e.key, e.size)
                }));
                let l = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
                this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
                let c = this.measurementsCache.slice(0, l),
                    d = Array(r).fill(void 0);
                for (let e = 0; e < l; e++) {
                    let t = c[e];
                    t && (d[t.lane] = e)
                }
                for (let i = l; i < e; i++) {
                    let e, r, l = s(i),
                        u = this.laneAssignments.get(i),
                        m = "estimate" === o || a.has(l);
                    if (void 0 !== u && this.options.lanes > 1) {
                        let s = d[e = u],
                            i = void 0 !== s ? c[s] : void 0;
                        r = i ? i.end + this.options.gap : t + n
                    } else {
                        let s = 1 === this.options.lanes ? c[i - 1] : this.getFurthestMeasurement(c, i);
                        r = s ? s.end + this.options.gap : t + n, e = s ? s.lane : i % this.options.lanes, this.options.lanes > 1 && m && this.laneAssignments.set(i, e)
                    }
                    let h = a.get(l),
                        p = "number" == typeof h ? h : this.options.estimateSize(i),
                        f = r + p;
                    c[i] = {
                        index: i,
                        start: r,
                        size: p,
                        end: f,
                        key: l,
                        lane: e
                    }, d[e] = i
                }
                return this.measurementsCache = c, c
            }, {
                key: !1,
                debug: () => this.options.debug
            }), this.calculateRange = s(() => [this.getMeasurements(), this.getSize(), this.getScrollOffset(), this.options.lanes], (e, t, n, s) => this.range = e.length > 0 && t > 0 ? function({
                measurements: e,
                outerSize: t,
                scrollOffset: n,
                lanes: s
            }) {
                let i = e.length - 1;
                if (e.length <= s) return {
                    startIndex: 0,
                    endIndex: i
                };
                let r = g(0, i, t => e[t].start, n),
                    o = r;
                if (1 === s)
                    for (; o < i && e[o].end < n + t;) o++;
                else if (s > 1) {
                    let a = Array(s).fill(0);
                    for (; o < i && a.some(e => e < n + t);) {
                        let t = e[o];
                        a[t.lane] = t.end, o++
                    }
                    let l = Array(s).fill(n + t);
                    for (; r >= 0 && l.some(e => e >= n);) {
                        let t = e[r];
                        l[t.lane] = t.start, r--
                    }
                    r = Math.max(0, r - r % s), o = Math.min(i, o + (s - 1 - o % s))
                }
                return {
                    startIndex: r,
                    endIndex: o
                }
            }({
                measurements: e,
                outerSize: t,
                scrollOffset: n,
                lanes: s
            }) : null, {
                key: !1,
                debug: () => this.options.debug
            }), this.getVirtualIndexes = s(() => {
                let e = null,
                    t = null,
                    n = this.calculateRange();
                return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([this.isScrolling, e, t]), [this.options.rangeExtractor, this.options.overscan, this.options.count, e, t]
            }, (e, t, n, s, i) => null === s || null === i ? [] : e({
                startIndex: s,
                endIndex: i,
                overscan: t,
                count: n
            }), {
                key: !1,
                debug: () => this.options.debug
            }), this.indexFromElement = e => {
                let t = this.options.indexAttribute,
                    n = e.getAttribute(t);
                return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1)
            }, this.shouldMeasureDuringScroll = e => {
                var t;
                if (!this.scrollState || "smooth" !== this.scrollState.behavior) return !0;
                let n = this.scrollState.index ? ? (null == (t = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) ? void 0 : t.index);
                if (void 0 !== n && this.range) {
                    let t = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2)),
                        s = Math.max(0, n - t),
                        i = Math.min(this.options.count - 1, n + t);
                    return e >= s && e <= i
                }
                return !0
            }, this.measureElement = e => {
                if (!e) return void this.elementsCache.forEach((e, t) => {
                    e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(t))
                });
                let t = this.indexFromElement(e),
                    n = this.options.getItemKey(t),
                    s = this.elementsCache.get(n);
                s !== e && (s && this.observer.unobserve(s), this.observer.observe(e), this.elementsCache.set(n, e)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(t) && this.resizeItem(t, this.options.measureElement(e, void 0, this))
            }, this.resizeItem = (e, t) => {
                var n;
                let s = this.measurementsCache[e];
                if (!s) return;
                let i = t - (this.itemSizeCache.get(s.key) ? ? s.size);
                0 !== i && ((null == (n = this.scrollState) ? void 0 : n.behavior) !== "smooth" && (void 0 !== this.shouldAdjustScrollPositionOnItemSizeChange ? this.shouldAdjustScrollPositionOnItemSizeChange(s, i, this) : s.start < this.getScrollOffset() + this.scrollAdjustments) && this._scrollToOffset(this.getScrollOffset(), {
                    adjustments: this.scrollAdjustments += i,
                    behavior: void 0
                }), this.pendingMeasuredCacheIndexes.push(s.index), this.itemSizeCache = new Map(this.itemSizeCache.set(s.key, t)), this.notify(!1))
            }, this.getVirtualItems = s(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
                let n = [];
                for (let s = 0, i = e.length; s < i; s++) {
                    let i = t[e[s]];
                    n.push(i)
                }
                return n
            }, {
                key: !1,
                debug: () => this.options.debug
            }), this.getVirtualItemForOffset = e => {
                let t = this.getMeasurements();
                if (0 !== t.length) return i(t[g(0, t.length - 1, e => i(t[e]).start, e)])
            }, this.getMaxScrollOffset = () => {
                if (!this.scrollElement) return 0;
                if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight; {
                    let e = this.scrollElement.document.documentElement;
                    return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight
                }
            }, this.getOffsetForAlignment = (e, t, n = 0) => {
                if (!this.scrollElement) return 0;
                let s = this.getSize(),
                    i = this.getScrollOffset();
                return "auto" === t && (t = e >= i + s ? "end" : "start"), "center" === t ? e += (n - s) / 2 : "end" === t && (e -= s), Math.max(Math.min(this.getMaxScrollOffset(), e), 0)
            }, this.getOffsetForIndex = (e, t = "auto") => {
                e = Math.max(0, Math.min(e, this.options.count - 1));
                let n = this.getSize(),
                    s = this.getScrollOffset(),
                    i = this.measurementsCache[e];
                if (!i) return;
                if ("auto" === t)
                    if (i.end >= s + n - this.options.scrollPaddingEnd) t = "end";
                    else {
                        if (!(i.start <= s + this.options.scrollPaddingStart)) return [s, t];
                        t = "start"
                    }
                if ("end" === t && e === this.options.count - 1) return [this.getMaxScrollOffset(), t];
                let r = "end" === t ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
                return [this.getOffsetForAlignment(r, t, i.size), t]
            }, this.scrollToOffset = (e, {
                align: t = "start",
                behavior: n = "auto"
            } = {}) => {
                let s = this.getOffsetForAlignment(e, t),
                    i = this.now();
                this.scrollState = {
                    index: null,
                    align: t,
                    behavior: n,
                    startedAt: i,
                    lastTargetOffset: s,
                    stableFrames: 0
                }, this._scrollToOffset(s, {
                    adjustments: void 0,
                    behavior: n
                }), this.scheduleScrollReconcile()
            }, this.scrollToIndex = (e, {
                align: t = "auto",
                behavior: n = "auto"
            } = {}) => {
                e = Math.max(0, Math.min(e, this.options.count - 1));
                let s = this.getOffsetForIndex(e, t);
                if (!s) return;
                let [i, r] = s, o = this.now();
                this.scrollState = {
                    index: e,
                    align: r,
                    behavior: n,
                    startedAt: o,
                    lastTargetOffset: i,
                    stableFrames: 0
                }, this._scrollToOffset(i, {
                    adjustments: void 0,
                    behavior: n
                }), this.scheduleScrollReconcile()
            }, this.scrollBy = (e, {
                behavior: t = "auto"
            } = {}) => {
                let n = this.getScrollOffset() + e,
                    s = this.now();
                this.scrollState = {
                    index: null,
                    align: "start",
                    behavior: t,
                    startedAt: s,
                    lastTargetOffset: n,
                    stableFrames: 0
                }, this._scrollToOffset(n, {
                    adjustments: void 0,
                    behavior: t
                }), this.scheduleScrollReconcile()
            }, this.getTotalSize = () => {
                var e;
                let t, n = this.getMeasurements();
                if (0 === n.length) t = this.options.paddingStart;
                else if (1 === this.options.lanes) t = (null == (e = n[n.length - 1]) ? void 0 : e.end) ? ? 0;
                else {
                    let e = Array(this.options.lanes).fill(null),
                        s = n.length - 1;
                    for (; s >= 0 && e.some(e => null === e);) {
                        let t = n[s];
                        null === e[t.lane] && (e[t.lane] = t.end), s--
                    }
                    t = Math.max(...e.filter(e => null !== e))
                }
                return Math.max(t - this.options.scrollMargin + this.options.paddingEnd, 0)
            }, this._scrollToOffset = (e, {
                adjustments: t,
                behavior: n
            }) => {
                this.options.scrollToFn(e, {
                    behavior: n,
                    adjustments: t
                }, this)
            }, this.measure = () => {
                this.itemSizeCache = new Map, this.laneAssignments = new Map, this.notify(!1)
            }, this.setOptions(e)
        }
        scheduleScrollReconcile() {
            if (!this.targetWindow) {
                this.scrollState = null;
                return
            }
            null == this.rafId && (this.rafId = this.targetWindow.requestAnimationFrame(() => {
                this.rafId = null, this.reconcileScroll()
            }))
        }
        reconcileScroll() {
            if (!this.scrollState || !this.scrollElement) return;
            if (this.now() - this.scrollState.startedAt > 5e3) {
                this.scrollState = null;
                return
            }
            let e = null != this.scrollState.index ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0,
                t = e ? e[0] : this.scrollState.lastTargetOffset,
                n = t !== this.scrollState.lastTargetOffset;
            if (!n && 1.01 > Math.abs(t - this.getScrollOffset())) {
                if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
                    this.scrollState = null;
                    return
                }
            } else this.scrollState.stableFrames = 0, n && (this.scrollState.lastTargetOffset = t, this.scrollState.behavior = "auto", this._scrollToOffset(t, {
                adjustments: void 0,
                behavior: "auto"
            }));
            this.scheduleScrollReconcile()
        }
    }
    let g = (e, t, n, s) => {
        for (; e <= t;) {
            let i = (e + t) / 2 | 0,
                r = n(i);
            if (r < s) e = i + 1;
            else {
                if (!(r > s)) return i;
                t = i - 1
            }
        }
        return e > 0 ? e - 1 : 0
    };
    e.s(["Virtualizer", 0, f, "defaultRangeExtractor", 0, l, "elementScroll", 0, p, "observeElementOffset", 0, m, "observeElementRect", 0, c, "observeWindowOffset", 0, (e, t) => {
        let n = e.scrollElement;
        if (!n) return;
        let s = e.targetWindow;
        if (!s) return;
        let i = 0,
            o = e.options.useScrollendEvent && u ? () => void 0 : r(s, () => {
                t(i, !1)
            }, e.options.isScrollingResetDelay),
            a = s => () => {
                i = n[e.options.horizontal ? "scrollX" : "scrollY"], o(), t(i, s)
            },
            l = a(!0),
            c = a(!1);
        n.addEventListener("scroll", l, d);
        let m = e.options.useScrollendEvent && u;
        return m && n.addEventListener("scrollend", c, d), () => {
            n.removeEventListener("scroll", l), m && n.removeEventListener("scrollend", c)
        }
    }, "observeWindowRect", 0, (e, t) => {
        let n = e.scrollElement;
        if (!n) return;
        let s = () => {
            t({
                width: n.innerWidth,
                height: n.innerHeight
            })
        };
        return s(), n.addEventListener("resize", s, d), () => {
            n.removeEventListener("resize", s)
        }
    }, "windowScroll", 0, (e, {
        adjustments: t = 0,
        behavior: n
    }, s) => {
        var i, r;
        null == (r = null == (i = s.scrollElement) ? void 0 : i.scrollTo) || r.call(i, {
            [s.options.horizontal ? "left" : "top"]: e + t,
            behavior: n
        })
    }], 230078);
    let x = "u" > typeof document ? t.useLayoutEffect : t.useEffect;
    e.s(["useVirtualizer", 0, function(e) {
        return function({
            useFlushSync: e = !0,
            ...s
        }) {
            let i = t.useReducer(() => ({}), {})[1],
                r = { ...s,
                    onChange: (t, r) => {
                        var o;
                        e && r ? (0, n.flushSync)(i) : i(), null == (o = s.onChange) || o.call(s, t, r)
                    }
                },
                [o] = t.useState(() => new f(r));
            return o.setOptions(r), x(() => o._didMount(), []), x(() => o._willUpdate()), o
        }({
            observeElementRect: c,
            observeElementOffset: m,
            scrollToFn: p,
            ...e
        })
    }], 429412);
    var y = e.i(999061),
        v = e.i(567692);
    e.s(["useBookContainer", 0, (e, n, s) => {
        let i, r, o, a = (0, y.c)(7),
            l = t.useRef(null),
            c = (0, v.useBoundBookStore)(),
            d = t.useRef(0),
            u = t.useRef(0);
        a[0] === Symbol.for("react.memo_cache_sentinel") ? (i = e => {
            let {
                state: t,
                id: n,
                view: s,
                book: i
            } = e, {
                askTotalValue: r,
                bidTotalValue: o
            } = (({
                state: e,
                id: t,
                view: n,
                book: s
            }) => {
                let i = e.byAsset[t] ? .views[n] ? .[s] ? .asks ? .totalValue,
                    r = e.byAsset[t] ? .views[n] ? .[s] ? .bids ? .totalValue;
                return {
                    askTotalValue: Number.isFinite(i) ? parseFloat(i.toFixed(2)) : void 0,
                    bidTotalValue: Number.isFinite(i) ? parseFloat(r.toFixed(2)) : void 0
                }
            })({
                state: t,
                id: n,
                view: s,
                book: i
            }), a = l.current;
            if (a) {
                let e = d.current,
                    t = u.current;
                void 0 !== r && (d.current = r), void 0 !== o && (u.current = o), void 0 !== r && void 0 !== o && (({
                    container: e,
                    askTotalValue: t,
                    bidTotalValue: n,
                    previousAskTotalValue: s,
                    previousBidTotalValue: i
                }) => {
                    t !== s && e.style.setProperty("--total-ask-value", t.toString()), n !== i && e.style.setProperty("--total-bid-value", n.toString())
                })({
                    container: a,
                    askTotalValue: r,
                    bidTotalValue: o,
                    previousAskTotalValue: e,
                    previousBidTotalValue: t
                })
            }
        }, a[0] = i) : i = a[0];
        let m = i;
        return a[1] !== s || a[2] !== e || a[3] !== c || a[4] !== n ? (r = () => {
            let t;
            return c && (m({
                state: c.getState(),
                id: e,
                view: n,
                book: s
            }), t = c.subscribe(t => {
                m({
                    state: t,
                    id: e,
                    view: n,
                    book: s
                })
            })), () => t ? .()
        }, o = [e, n, s, c], a[1] = s, a[2] = e, a[3] = c, a[4] = n, a[5] = r, a[6] = o) : (r = a[5], o = a[6]), t.useEffect(r, o), l
    }], 912498);
    var b = e.i(221628),
        k = e.i(23128),
        S = e.i(169010),
        C = e.i(180715);
    let j = ({
            strokeWidth: e = 1.5,
            ...n
        }) => t.default.createElement(C.Icon, {
            size: "12px",
            ...n
        }, t.default.createElement("line", {
            x1: ".75",
            y1: ".75",
            x2: "11.25",
            y2: ".75",
            fill: "none",
            stroke: "currentColor",
            strokeLinecap: "round",
            strokeLinejoin: "round",
            strokeWidth: e,
            "data-color": "color-2"
        }), t.default.createElement("line", {
            x1: ".75",
            y1: "11.25",
            x2: "11.25",
            y2: "11.25",
            fill: "none",
            stroke: "currentColor",
            strokeLinecap: "round",
            strokeLinejoin: "round",
            strokeWidth: e,
            "data-color": "color-2"
        }), t.default.createElement("rect", {
            x: "3.75",
            y: "2.25",
            width: "4.5",
            height: "7.5",
            rx: "1",
            ry: "1",
            transform: "translate(12 0) rotate(90)",
            fill: "none",
            stroke: "currentColor",
            strokeLinecap: "round",
            strokeLinejoin: "round",
            strokeWidth: e
        })),
        w = ({
            strokeWidth: e = 1.5,
            ...n
        }) => t.default.createElement(C.Icon, {
            size: "12px",
            ...n
        }, t.default.createElement("line", {
            x1: "5.25",
            y1: "8.25",
            x2: "11",
            y2: "8.25",
            fill: "none",
            stroke: "currentColor",
            strokeLinecap: "round",
            strokeLinejoin: "round",
            strokeWidth: e,
            "data-color": "color-2"
        }), t.default.createElement("polyline", {
            points: "8.75 5.75 11.25 8.25 8.75 10.75",
            fill: "none",
            stroke: "currentColor",
            strokeLinecap: "round",
            strokeLinejoin: "round",
            strokeWidth: e,
            "data-color": "color-2"
        }), t.default.createElement("line", {
            x1: "6.75",
            y1: "3.75",
            x2: "1",
            y2: "3.75",
            fill: "none",
            stroke: "currentColor",
            strokeLinecap: "round",
            strokeLinejoin: "round",
            strokeWidth: e
        }), t.default.createElement("polyline", {
            points: "3.25 1.25 .75 3.75 3.25 6.25",
            fill: "none",
            stroke: "currentColor",
            strokeLinecap: "round",
            strokeLinejoin: "round",
            strokeWidth: e
        }));
    e.s(["IconArrowsOppositeDirectionXOutline12", 0, w], 821986);
    let T = e => {
            let t, n, s, i = (0, y.c)(6),
                {
                    onClick: r,
                    variant: o
                } = e,
                a = void 0 === o ? "ghost" : o;
            return i[0] !== r ? (t = e => {
                e.stopPropagation(), r ? .()
            }, i[0] = r, i[1] = t) : t = i[1], i[2] === Symbol.for("react.memo_cache_sentinel") ? (n = (0, b.jsx)(j, {}), i[2] = n) : n = i[2], i[3] !== t || i[4] !== a ? (s = (0, b.jsx)(S.Tooltip, {
                content: "Recenter Book",
                sideOffset: 4,
                side: "right",
                children: (0, b.jsx)(k.Button, {
                    variant: a,
                    size: "iconSm",
                    className: "text-text-secondary w-6 h-6",
                    onClick: t,
                    children: n
                })
            }), i[3] = t, i[4] = a, i[5] = s) : s = i[5], s
        },
        N = e => {
            let t, n, s, i = (0, y.c)(6),
                {
                    nextLabel: r,
                    onClick: o
                } = e,
                a = `Switch to ${r??"other side"}`;
            return i[0] === Symbol.for("react.memo_cache_sentinel") ? (t = (0, b.jsx)(w, {}), i[0] = t) : t = i[0], i[1] !== o ? (n = (0, b.jsx)(k.Button, {
                variant: "ghost",
                size: "iconSm",
                className: "text-text-secondary w-6 h-6",
                onClick: o,
                children: t
            }), i[1] = o, i[2] = n) : n = i[2], i[3] !== a || i[4] !== n ? (s = (0, b.jsx)(S.Tooltip, {
                content: a,
                sideOffset: 4,
                children: n
            }), i[3] = a, i[4] = n, i[5] = s) : s = i[5], s
        };
    var I = e.i(604777),
        E = e.i(840216),
        O = e.i(668122),
        M = e.i(305457),
        P = e.i(399336),
        A = e.i(891685),
        R = e.i(6204),
        z = e.i(880809),
        L = e.i(909420);
    let D = () => {
        let e, t, n, s, i, r, o = (0, y.c)(15);
        o[0] === Symbol.for("react.memo_cache_sentinel") ? (e = ["selectedOutcomeIdx", "setSelectedOutcomeIdx"], o[0] = e) : e = o[0];
        let {
            selectedOutcomeIdx: a,
            setSelectedOutcomeIdx: l
        } = (0, z.useTradeContext)(e);
        o[1] === Symbol.for("react.memo_cache_sentinel") ? (t = ["activeMarket"], o[1] = t) : t = o[1];
        let {
            activeMarket: c
        } = (0, P.useEventActiveMarketContext)(t);
        o[2] === Symbol.for("react.memo_cache_sentinel") ? (n = ["isNegRiskSportsEvent"], o[2] = n) : n = o[2];
        let {
            isNegRiskSportsEvent: d
        } = (0, A.useEventContext)(n), u = (0, E.useSportsStore)(B), m = (0, M.useAmplitudeAnalytics)(), h = (a + 1) % 2;
        o[3] !== c || o[4] !== d || o[5] !== h ? (s = (0, L.getOutcomeWithLine)({
            market: c,
            outcomeIndex: h,
            includeNegRiskOutcome: !0,
            isNegRisk: d
        }), o[3] = c, o[4] = d, o[5] = h, o[6] = s) : s = o[6];
        let p = s;
        o[7] !== m || o[8] !== u || o[9] !== a || o[10] !== l ? (i = () => {
            l((a + 1) % 2), m.trackEvent(O.Events.SportsToggleSide, {
                location: u ? "in-game" : "card",
                method: "click"
            })
        }, o[7] = m, o[8] = u, o[9] = a, o[10] = l, o[11] = i) : i = o[11];
        let f = i;
        return o[12] !== f || o[13] !== p ? (r = (0, b.jsx)(N, {
            nextLabel: p,
            onClick: f
        }), o[12] = f, o[13] = p, o[14] = r) : r = o[14], r
    };
    D.displayName = "SwitchButtonInternals";
    let F = () => {
        let e, t, n = (0, y.c)(2);
        n[0] === Symbol.for("react.memo_cache_sentinel") ? (e = ["isSportsPage"], n[0] = e) : e = n[0];
        let {
            isSportsPage: s
        } = (0, R.useSportsContext)(e);
        return s ? (n[1] === Symbol.for("react.memo_cache_sentinel") ? (t = (0, b.jsx)(D, {}), n[1] = t) : t = n[1], t) : null
    };
    F.displayName = "SwitchButton";
    let _ = t.default.memo(F);

    function B(e) {
        return !!e.evt
    }
    e.s(["SwitchButton", 0, _], 83638), e.s(["useOrderBookOptions", 0, (e, n) => {
        let s = (0, I.useTranslations)(),
            i = t.useCallback(e => t => {
                e.callback ? .(t), e.recenter && n("smooth")
            }, [n]),
            r = t.useMemo(() => ({
                price: s("trading.orderBook.price"),
                shares: s("trading.orderBook.shares"),
                total: s("trading.orderBook.total")
            }), [s]);
        return t.useMemo(() => {
            let {
                headerOptions: t = {},
                spreadOptions: s = {},
                rowOptions: o = {}
            } = e ? ? {}, {
                label: a,
                recenter: l,
                sideToggle: c,
                className: d
            } = t, {
                enabled: u = !1,
                buttonVariant: m
            } = l ? ? {}, {
                enabled: h = !1
            } = c ? ? {}, p = u || h ? (0, b.jsxs)(b.Fragment, {
                children: [u && (0, b.jsx)(T, {
                    onClick: () => n("smooth"),
                    variant: m
                }), h && (0, b.jsx)(_, {})]
            }) : void 0, {
                recenter: f = !0,
                onClick: g,
                className: x
            } = s, y = {
                onClick: i({
                    recenter: f,
                    callback: g
                }),
                className: x
            }, {
                onClick: v
            } = o;
            return {
                header: {
                    label: a,
                    className: d,
                    leadingContent: p,
                    labels: r
                },
                spread: y,
                row: {
                    onClick: v
                }
            }
        }, [e, n, r])
    }], 219494);
    var H = e.i(233522);
    e.s(["useBookAccessors", 0, (e, t, n) => {
        let s, i = (0, y.c)(4);
        i[0] !== e || i[1] !== n.orderPriceMinTickSize || i[2] !== t ? (s = s => {
            let i = String(s.byAsset[e] ? .tickSizes.active ? ? n.orderPriceMinTickSize);
            return {
                id: e,
                view: i,
                book: 0 === t ? "zero" : "one"
            }
        }, i[0] = e, i[1] = n.orderPriceMinTickSize, i[2] = t, i[3] = s) : s = i[3];
        let r = s;
        return (0, v.useBooksStore)(r, H.shallow)
    }, "useBookExists", 0, (e, t) => {
        let n, s = (0, y.c)(3);
        s[0] !== e || s[1] !== t ? (n = n => !!n.byAsset[e] ? .views[t], s[0] = e, s[1] = t, s[2] = n) : n = s[2];
        let i = n;
        return (0, v.useBooksStore)(i, H.shallow)
    }, "useMidpoint", 0, (e, t, n) => {
        let s, i = (0, y.c)(4);
        i[0] !== n || i[1] !== e || i[2] !== t ? (s = s => {
            let i = s.byAsset[e] ? .views[t] ? .[n] ? .midpoint;
            return `${i??0}`
        }, i[0] = n, i[1] = e, i[2] = t, i[3] = s) : s = i[3];
        let r = s;
        return (0, v.useBooksStore)(r, H.shallow)
    }, "useMinifiedBookState", 0, (e, n) => {
        let s, i, r = (0, y.c)(4);
        r[0] === Symbol.for("react.memo_cache_sentinel") ? (s = {
            minified: !1,
            zero: {
                askCount: 0,
                bidCount: 0
            },
            one: {
                askCount: 0,
                bidCount: 0
            }
        }, r[0] = s) : s = r[0];
        let o = t.useRef(s);
        r[1] !== e || r[2] !== n ? (i = t => {
            let s = !!t.byAsset[e] ? .views[n] ? .minimized,
                i = t.byAsset[e] ? .views[n] ? .zero.totalAskCount,
                r = t.byAsset[e] ? .views[n] ? .zero.totalBidCount,
                a = t.byAsset[e] ? .views[n] ? .one.totalAskCount,
                l = t.byAsset[e] ? .views[n] ? .one.totalBidCount;
            return (s !== o.current.minified || i !== o.current.zero.askCount || r !== o.current.zero.bidCount || a !== o.current.one.askCount || l !== o.current.one.bidCount) && (o.current = {
                minified: s,
                zero: {
                    askCount: i,
                    bidCount: r
                },
                one: {
                    askCount: a,
                    bidCount: l
                }
            }), o.current
        }, r[1] = e, r[2] = n, r[3] = i) : i = r[3];
        let a = i;
        return (0, v.useBooksStore)(a, H.shallow)
    }, "useSideRows", 0, (e, t, n, s) => {
        let i, r = (0, y.c)(5);
        r[0] !== n || r[1] !== e || r[2] !== s || r[3] !== t ? (i = i => i.byAsset[e] ? .views[t] ? .[n] ? .[s] ? .rows ? ? [], r[0] = n, r[1] = e, r[2] = s, r[3] = t, r[4] = i) : i = r[4];
        let o = i;
        return (0, v.useBooksStore)(o, H.shallow)
    }], 908392);
    var $ = e.i(740594),
        U = e.i(436127),
        q = e.i(30704);
    let W = {
            orders: [],
            scoring: !1
        },
        K = e => !!e;
    e.s(["EMPTY_ORDER_BOOK_ROW_USER_STATE", 0, W, "useOrderBookUserState", 0, (e, t) => {
        let n, s, i, r, o = (0, y.c)(10),
            a = e ? .clobTokenIds,
            l = e ? .conditionId,
            c = e ? .orderPriceMinTickSize;
        o[0] !== a || o[1] !== l || o[2] !== c ? (n = {
            clobTokenIds: a,
            conditionId: l,
            orderPriceMinTickSize: c
        }, o[0] = a, o[1] = l, o[2] = c, o[3] = n) : n = o[3];
        let {
            userOrderScoringMap: d,
            userOpenOrdersPriceTotalsMap: u
        } = (0, q.default)(n);
        e ? .clobTokenIds;
        e: {
            if (!Array.isArray(e ? .clobTokenIds) || e.clobTokenIds.length < 2) {
                s = void 0;
                break e
            }
            s = e.clobTokenIds[+!!t]
        }
        let m = s;
        o[4] !== m || o[5] !== u || o[6] !== d ? (i = (e, t) => {
            if (!m) return W;
            let n = (Array.isArray(e.includedLevels) && e.includedLevels.length > 1 ? e.includedLevels.map(e => e) : [e.price]).map(e => (0, U.createPriceMapKey)(e, m, "ask" === t ? $.Side.SELL : $.Side.BUY)),
                s = n.map(e => u[e]).filter(K),
                i = n.some(e => !!d ? .[e]);
            return s.length || i ? {
                orders: s,
                scoring: i
            } : W
        }, o[4] = m, o[5] = u, o[6] = d, o[7] = i) : i = o[7];
        let h = i;
        return o[8] !== h ? (r = {
            getOrderInfoForRow: h
        }, o[8] = h, o[9] = r) : r = o[9], r
    }], 843340)
}, 837754, e => {
    "use strict";
    var t = e.i(196593);
    e.s(["createPriceRewardMap", 0, (e, t, n) => {
        let s = parseFloat(t),
            i = parseFloat(n);
        return !Array.isArray(e) || Number.isNaN(s) || Number.isNaN(i) ? {} : e.reduce((e, t) => {
            let n = parseFloat(t) >= s && parseFloat(t) <= i;
            return !e[t] && n && (e[t] = !0), e
        }, {})
    }, "getMinAndMax", 0, (e, n) => {
        let s = (e ? ? 0) / 100,
            i = "number" == typeof n ? n : parseFloat(n),
            r = Number.isNaN(i) ? 0 : i;
        return {
            max: (0, t.nDecimals)(r + s, 3),
            min: (0, t.nDecimals)(r - s, 3)
        }
    }])
}, 97238, 738086, 538301, 649635, 275546, e => {
    "use strict";
    var t = e.i(999061),
        n = e.i(416340),
        s = e.i(908392),
        i = e.i(843340),
        r = e.i(313305),
        o = e.i(837754);
    let a = (e, n) => {
        let s, i, a, c, d, u, m = (0, t.c)(6),
            {
                rewardMarket: h
            } = (0, r.useMarketRewardContext)(),
            {
                min: p,
                max: f
            } = (c = (0, t.c)(3), u = (d = h ? .maxSpread ? ? 0) > 0 ? Math.floor(d) : 0, c[0] !== u || c[1] !== n ? (a = (0, o.getMinAndMax)(u, n), c[0] = u, c[1] = n, c[2] = a) : a = c[2], a);
        m[0] !== e ? (s = e.map(l), m[0] = e, m[1] = s) : s = m[1];
        let g = s;
        return m[2] !== f || m[3] !== p || m[4] !== g ? (i = (0, o.createPriceRewardMap)([...g], p, f), m[2] = f, m[3] = p, m[4] = g, m[5] = i) : i = m[5], i
    };

    function l(e) {
        return e.price
    }

    function c() {
        return {
            type: "loading-ask"
        }
    }

    function d() {
        return {
            type: "loading-bid"
        }
    }
    e.s(["useOrderBook", 0, (e, n, o, l, u, m, h, p, f, g) => {
        let x, y, v, b, k, S, C = (0, t.c)(65),
            {
                rewardMap: j,
                scoringHovered: w
            } = ((e, n, s) => {
                let i, o, l = (0, t.c)(6),
                    {
                        shouldShowRewardOverlay: c
                    } = (0, r.useMarketRewardContext)(),
                    d = a(e, s),
                    u = a(n, s);
                return l[0] !== d || l[1] !== u ? (i = { ...d,
                    ...u
                }, l[0] = d, l[1] = u, l[2] = i) : i = l[2], l[3] !== c || l[4] !== i ? (o = {
                    rewardMap: i,
                    scoringHovered: c
                }, l[3] = c, l[4] = i, l[5] = o) : o = l[5], o
            })(e, n, (0, s.useMidpoint)(o.id, o.view, o.book)),
            {
                getOrderInfoForRow: T
            } = (0, i.useOrderBookUserState)(m, 1 === u);
        C[0] !== f || C[1] !== p.header || C[2] !== l ? (x = {
            type: "header",
            props: { ...p.header,
                variant: l,
                compactPadding: f
            }
        }, C[0] = f, C[1] = p.header, C[2] = l, C[3] = x) : x = C[3];
        let N = x;
        C[4] !== h || C[5] !== f || C[6] !== m || C[7] !== p.spread || C[8] !== u || C[9] !== l ? (y = {
            type: "spread",
            props: {
                variant: l,
                outcomeIdx: u,
                market: m,
                tickSize: h,
                compactPadding: f,
                ...p.spread
            }
        }, C[4] = h, C[5] = f, C[6] = m, C[7] = p.spread, C[8] = u, C[9] = l, C[10] = y) : y = C[10];
        let I = y;
        e: {
            let t;
            if (!g) {
                let e;
                C[11] === Symbol.for("react.memo_cache_sentinel") ? (e = Array.from({
                    length: 4
                }, c), C[11] = e) : e = C[11], v = e;
                break e
            }
            if (!e.length) {
                let e, t;
                C[12] === Symbol.for("react.memo_cache_sentinel") ? (e = {
                    type: "empty-asks"
                }, C[12] = e) : e = C[12], C[13] === Symbol.for("react.memo_cache_sentinel") ? (t = [e], C[13] = t) : t = C[13], v = t;
                break e
            }
            if (C[14] !== h || C[15] !== e || C[16] !== f || C[17] !== T || C[18] !== m.orderPriceMinTickSize || C[19] !== p.row || C[20] !== j || C[21] !== w || C[22] !== l) {
                let n;
                C[24] !== h || C[25] !== e.length || C[26] !== f || C[27] !== T || C[28] !== m.orderPriceMinTickSize || C[29] !== p.row || C[30] !== j || C[31] !== w || C[32] !== l ? (n = (t, n) => ({
                    type: "ask",
                    props: {
                        variant: l,
                        row: t,
                        tickSize: h,
                        marketTickSize: m.orderPriceMinTickSize ? ? .01,
                        side: "ask",
                        scoringHovered: w && j[t.price],
                        orderInfo: T(t, "ask"),
                        compactPadding: f,
                        includeChip: n === e.length - 1,
                        ...p.row
                    }
                }), C[24] = h, C[25] = e.length, C[26] = f, C[27] = T, C[28] = m.orderPriceMinTickSize, C[29] = p.row, C[30] = j, C[31] = w, C[32] = l, C[33] = n) : n = C[33], t = e.toReversed().map(n), C[14] = h, C[15] = e, C[16] = f, C[17] = T, C[18] = m.orderPriceMinTickSize, C[19] = p.row, C[20] = j, C[21] = w, C[22] = l, C[23] = t
            } else t = C[23];v = t
        }
        let E = v;
        t: {
            let e;
            if (!g) {
                let e;
                C[34] === Symbol.for("react.memo_cache_sentinel") ? (e = Array.from({
                    length: 4
                }, d), C[34] = e) : e = C[34], b = e;
                break t
            }
            if (!n.length) {
                let e, t;
                C[35] === Symbol.for("react.memo_cache_sentinel") ? (e = {
                    type: "empty-bids"
                }, C[35] = e) : e = C[35], C[36] === Symbol.for("react.memo_cache_sentinel") ? (t = [e], C[36] = t) : t = C[36], b = t;
                break t
            }
            if (C[37] !== h || C[38] !== n || C[39] !== f || C[40] !== T || C[41] !== m.orderPriceMinTickSize || C[42] !== p.row || C[43] !== j || C[44] !== w || C[45] !== l) {
                let t;
                C[47] !== h || C[48] !== f || C[49] !== T || C[50] !== m.orderPriceMinTickSize || C[51] !== p.row || C[52] !== j || C[53] !== w || C[54] !== l ? (t = (e, t) => ({
                    type: "bid",
                    props: {
                        variant: l,
                        row: e,
                        tickSize: h,
                        marketTickSize: m.orderPriceMinTickSize ? ? .01,
                        side: "bid",
                        scoringHovered: w && j[e.price],
                        orderInfo: T(e, "bid"),
                        compactPadding: f,
                        includeChip: 0 === t,
                        ...p.row
                    }
                }), C[47] = h, C[48] = f, C[49] = T, C[50] = m.orderPriceMinTickSize, C[51] = p.row, C[52] = j, C[53] = w, C[54] = l, C[55] = t) : t = C[55], e = n.slice().map(t), C[37] = h, C[38] = n, C[39] = f, C[40] = T, C[41] = m.orderPriceMinTickSize, C[42] = p.row, C[43] = j, C[44] = w, C[45] = l, C[46] = e
            } else e = C[46];b = e
        }
        let O = b;
        C[56] !== E || C[57] !== O || C[58] !== N || C[59] !== I ? (k = [N, ...E, I, ...O], C[56] = E, C[57] = O, C[58] = N, C[59] = I, C[60] = k) : k = C[60];
        let M = k;
        return C[61] !== E.length || C[62] !== O.length || C[63] !== M ? (S = {
            rows: M,
            askCount: E.length,
            bidCount: O.length,
            itemCount: M.length
        }, C[61] = E.length, C[62] = O.length, C[63] = M, C[64] = S) : S = C[64], S
    }], 97238);
    var u = e.i(230078);
    e.s(["useRangeExtractor", 0, (e, t, s, i, r) => {
        let o = n.useRef({
                0: {
                    side: "top",
                    styles: {
                        top: "0px"
                    },
                    buffer: 0
                }
            }),
            a = n.useMemo(() => ({
                0: [{
                    side: "top",
                    styles: {
                        top: "0px"
                    },
                    buffer: 0
                }],
                ...r && {
                    [`${e+1}`]: [{
                        side: "top",
                        styles: {
                            top: `${s-1}px`
                        },
                        buffer: 1
                    }, {
                        side: "bottom",
                        styles: {
                            top: `${i-s+1}px`
                        },
                        buffer: 0
                    }]
                }
            }), [e, t, s, i, r]),
            l = n.useCallback(e => {
                let t = !!a[`${e}`],
                    n = o.current[`${e}`];
                return n ? {
                    sticky: t,
                    active: !0,
                    ...n
                } : {
                    sticky: t,
                    active: !1
                }
            }, [a]),
            c = n.useCallback(e => {
                let t = {},
                    n = Object.entries(a).sort((e, t) => parseInt(e[0], 10) - parseInt(t[0], 10)).filter(n => {
                        let s = n[1].find(e => "top" === e.side),
                            i = !!s && parseInt(n[0], 10) <= e.startIndex + s.buffer;
                        return i && (t[n[0]] = s), i
                    }).map(e => parseInt(e[0], 10)),
                    s = Object.entries(a).sort((e, t) => parseInt(e[0], 10) - parseInt(t[0], 10)).filter(n => {
                        let s = n[1].find(e => "bottom" === e.side),
                            i = !!s && parseInt(n[0], 10) >= e.endIndex;
                        return i && (t[n[0]] = s), i
                    }).map(e => parseInt(e[0], 10)) ? ? [];
                return o.current = t, [...new Set([...n, ...(0, u.defaultRangeExtractor)(e), ...s])].sort((e, t) => e - t)
            }, [a]);
        return n.useMemo(() => ({
            getStickyState: l,
            rangeExtractor: c
        }), [l, c])
    }], 738086), e.s(["useSpreadAnchor", 0, (e, t, s, i) => {
        let r = n.useRef(e),
            o = n.useRef(!1),
            a = n.useRef(!1),
            l = n.useCallback(({
                virtualizer: e,
                askCount: t,
                rowHeight: n
            }) => {
                let s = r.current;
                r.current = t;
                let i = e.scrollOffset;
                if (i) {
                    let r = Math.max(i + (t - s) * n, 0);
                    e.scrollToOffset(r, {
                        align: "start",
                        behavior: "auto"
                    })
                }
            }, []),
            c = n.useCallback(e => "end" === e ? (setTimeout(() => {
                o.current = !1, a.current = !1
            }), {
                shouldUpdate: o.current
            }) : (a.current = !0, {
                shouldUpdate: !1
            }), [l, e, t, i]);
        return n.useLayoutEffect(() => {
            s && (a.current ? (r.current = e, o.current = !0) : l({
                virtualizer: i,
                askCount: e,
                rowHeight: t
            }))
        }, [e]), n.useMemo(() => ({
            applyStatus: c
        }), [c])
    }], 538301), e.s(["useSides", 0, e => {
        let i, r, o, a, l, c, d, u, m = (0, t.c)(12),
            h = (0, s.useSideRows)(e.id, e.view, e.book, "asks"),
            p = (0, s.useSideRows)(e.id, e.view, e.book, "bids"),
            [f, g] = n.useState(h),
            [x, y] = n.useState(p),
            v = n.useRef(!1),
            b = n.useRef(null),
            k = n.useRef(null);
        m[0] === Symbol.for("react.memo_cache_sentinel") ? (i = e => {
            g(e)
        }, m[0] = i) : i = m[0];
        let S = i;
        m[1] === Symbol.for("react.memo_cache_sentinel") ? (r = e => {
            y(e)
        }, m[1] = r) : r = m[1];
        let C = r;
        m[2] === Symbol.for("react.memo_cache_sentinel") ? (o = e => {
            v.current = "start" === e, setTimeout(() => {
                v.current = !1
            }, 200)
        }, m[2] = o) : o = m[2];
        let j = o;
        return m[3] !== h ? (a = () => {
            b.current && clearTimeout(b.current), v.current ? b.current = setTimeout(() => {
                S(h)
            }, 300) : S(h)
        }, l = [h], m[3] = h, m[4] = a, m[5] = l) : (a = m[4], l = m[5]), n.useEffect(a, l), m[6] !== p ? (c = () => {
            k.current && clearTimeout(k.current), v.current ? k.current = setTimeout(() => {
                C(p)
            }, 300) : C(p)
        }, d = [p], m[6] = p, m[7] = c, m[8] = d) : (c = m[7], d = m[8]), n.useEffect(c, d), m[9] !== f || m[10] !== x ? (u = {
            asks: f,
            bids: x,
            defer: j
        }, m[9] = f, m[10] = x, m[11] = u) : u = m[11], u
    }], 649635);
    var m = e.i(221628),
        h = e.i(86831);
    e.s(["OrderBookHeaderRow", 0, e => {
        let n, s, i, r, o, a, l, c, d, u, p, f, g, x, y = (0, t.c)(46),
            {
                variant: v,
                label: b,
                leadingContent: k,
                labels: S,
                className: C,
                compactPadding: j
            } = e,
            w = void 0 !== j && j,
            T = "narrow" === (void 0 === v ? "default" : v) && "grid-cols-[28%_24%_24%_24%]";
        y[0] !== C || y[1] !== T ? (n = (0, h.cn)("grid grid-cols-[40%_20%_20%_20%] items-center border-b h-[36px] w-full bg-surface-1 z-[2]", T, C), y[0] = C, y[1] = T, y[2] = n) : n = y[2];
        let N = !0 === w && "px-0.5",
            I = "desktop" === w && "lg:px-0.5",
            E = "mobile" === w && "not-lg:px-0.5";
        y[3] !== N || y[4] !== I || y[5] !== E ? (s = (0, h.cn)("h-full w-full flex items-center justify-start gap-x-1.5 px-2", N, I, E), y[3] = N, y[4] = I, y[5] = E, y[6] = s) : s = y[6], y[7] !== b ? (i = !!b && (0, m.jsx)("p", {
            className: "font-semibold text-[10px] tracking-wider text-text-secondary uppercase whitespace-nowrap",
            children: b
        }), y[7] = b, y[8] = i) : i = y[8], y[9] !== k || y[10] !== s || y[11] !== i ? (r = (0, m.jsxs)("div", {
            className: s,
            children: [i, k]
        }), y[9] = k, y[10] = s, y[11] = i, y[12] = r) : r = y[12];
        let O = !0 === w && "px-0.5",
            M = "desktop" === w && "lg:px-0.5",
            P = "mobile" === w && "not-lg:px-0.5";
        y[13] !== O || y[14] !== M || y[15] !== P ? (o = (0, h.cn)("w-full h-full flex items-center justify-center px-2", O, M, P), y[13] = O, y[14] = M, y[15] = P, y[16] = o) : o = y[16];
        let A = S ? .price ? ? "Price";
        y[17] !== A ? (a = (0, m.jsx)("p", {
            className: "font-semibold text-[10px] tracking-wider text-text-secondary uppercase whitespace-nowrap",
            children: A
        }), y[17] = A, y[18] = a) : a = y[18], y[19] !== o || y[20] !== a ? (l = (0, m.jsx)("div", {
            className: o,
            children: a
        }), y[19] = o, y[20] = a, y[21] = l) : l = y[21];
        let R = !0 === w && "px-0.5",
            z = "desktop" === w && "lg:px-0.5",
            L = "mobile" === w && "not-lg:px-0.5";
        y[22] !== R || y[23] !== z || y[24] !== L ? (c = (0, h.cn)("w-full h-full flex items-center justify-center px-2", R, z, L), y[22] = R, y[23] = z, y[24] = L, y[25] = c) : c = y[25];
        let D = S ? .shares ? ? "Shares";
        y[26] !== D ? (d = (0, m.jsx)("p", {
            className: "font-semibold text-[10px] tracking-wider text-text-secondary uppercase whitespace-nowrap",
            children: D
        }), y[26] = D, y[27] = d) : d = y[27], y[28] !== c || y[29] !== d ? (u = (0, m.jsx)("div", {
            className: c,
            children: d
        }), y[28] = c, y[29] = d, y[30] = u) : u = y[30];
        let F = !0 === w && "px-0.5",
            _ = "desktop" === w && "lg:px-0.5",
            B = "mobile" === w && "not-lg:px-0.5";
        y[31] !== F || y[32] !== _ || y[33] !== B ? (p = (0, h.cn)("w-full h-full flex items-center justify-center", F, _, B), y[31] = F, y[32] = _, y[33] = B, y[34] = p) : p = y[34];
        let H = S ? .total ? ? "Total";
        return y[35] !== H ? (f = (0, m.jsx)("p", {
            className: "font-semibold text-[10px] tracking-wider text-text-secondary uppercase whitespace-nowrap",
            children: H
        }), y[35] = H, y[36] = f) : f = y[36], y[37] !== p || y[38] !== f ? (g = (0, m.jsx)("div", {
            className: p,
            children: f
        }), y[37] = p, y[38] = f, y[39] = g) : g = y[39], y[40] !== r || y[41] !== l || y[42] !== u || y[43] !== g || y[44] !== n ? (x = (0, m.jsxs)("div", {
            className: n,
            children: [r, l, u, g]
        }), y[40] = r, y[41] = l, y[42] = u, y[43] = g, y[44] = n, y[45] = x) : x = y[45], x
    }], 275546)
}, 557033, 9187, e => {
    "use strict";
    var t = e.i(416340),
        n = e.i(196593),
        s = e.i(53950);
    let i = e => {
            if (!e) return null;
            if ("string" == typeof e) {
                let t = parseFloat(e);
                return Number.isNaN(t) ? null : t
            }
            return e
        },
        r = (e, t = 1) => {
            let n = i(e);
            if (!n || Number.isNaN(n)) return null;
            if (0 === n) return "0";
            if (n >= 1) return "-100";
            let s = 100 * n;
            if (s < 50) {
                let e = 100 * (100 - s) / s;
                return e > 0 ? `+${e.toFixed(t)}` : `${e.toFixed(t)}`
            }
            return `-${(100*s/(100-s)).toFixed(t)}`
        },
        o = e => {
            let t = i(e);
            return !t || Number.isNaN(t) ? null : 0 === t ? 0 : 1 / (100 * t)
        },
        a = e => {
            let t = i(e);
            return !t || Number.isNaN(t) || 0 === t ? null : t >= 1 ? 0 : (1 - t) / t
        },
        l = e => {
            let t = a(e);
            return null === t ? null : t >= 1 ? t : 0 === t ? 0 : -1 / t
        },
        c = e => {
            let t = a(e);
            return null === t ? null : t <= 1 ? t : -1 / t
        },
        d = (e, t) => 0 === t ? e : d(t, e % t),
        u = e => {
            let t = i(e);
            if (!t || Number.isNaN(t)) return null;
            if (t >= 1) return "0/1";
            let n = Math.round((1 - t) * 1e4),
                s = Math.round(1e4 * t),
                r = d(n, s);
            return n /= r, s /= r, `${n}/${s}`
        };
    e.s(["calculateAmericanOddsFromPrice", 0, r, "calculateDecimalOddsFromPrice", 0, o, "calculateFractionalOddsFromPrice", 0, u, "calculateHongKongOddsFromPrice", 0, a, "calculateIndonesianOddsFromPrice", 0, l, "calculateMalaysianOddsFromPrice", 0, c], 9187);
    var m = e.i(156591),
        h = e.i(900519);
    let p = ({
            price: e,
            precision: t,
            inputMode: n
        }) => t || ("scaled" === n ? 2 : (0, m.getPrecisionFromPrice)(e)),
        f = ({
            price: e,
            precision: t,
            inputMode: s
        }) => {
            let i = "decimal" === s ? e : e / 100,
                r = p({
                    price: e,
                    precision: t,
                    inputMode: s
                }),
                o = (0, n.showPaddedCentsOnly)(`${i}`, r),
                a = (0, h.formatPaddedCents)(o, r);
            return {
                value: parseFloat(a.replace("¢", "")),
                formatted: a
            }
        },
        g = (e, t = 2) => {
            let s = Math.abs(e),
                i = (0, n.formatToDecimal)(s, t);
            return e < 0 ? `-${i}` : i
        },
        x = ({
            price: e,
            precision: t,
            inputMode: i = "decimal",
            outputMode: d = "price"
        }) => {
            try {
                switch (d) {
                    case "american":
                        {
                            let n = (({
                                price: e,
                                precision: t,
                                inputMode: n
                            }) => {
                                let s = r("scaled" === n ? e / 100 : e, 0);
                                return null === s ? null : {
                                    value: parseFloat(s),
                                    formatted: s
                                }
                            })({
                                price: e,
                                precision: t,
                                inputMode: i
                            });
                            if (!n) break;
                            return n
                        }
                    case "decimal":
                        {
                            let s = (({
                                price: e,
                                precision: t,
                                inputMode: s
                            }) => {
                                let i = o("scaled" === s ? e / 100 : e),
                                    r = p({
                                        price: e,
                                        precision: t,
                                        inputMode: s
                                    });
                                if (null === i) return null;
                                let a = 100 * i;
                                return {
                                    value: a,
                                    formatted: (0, n.formatToDecimal)(a, 3 === r ? 3 : 2)
                                }
                            })({
                                price: e,
                                precision: t,
                                inputMode: i
                            });
                            if (!s) break;
                            return s
                        }
                    case "percentage":
                        return (e => {
                            let {
                                value: t
                            } = f(e);
                            return {
                                value: t,
                                formatted: `${t}%`
                            }
                        })({
                            price: e,
                            precision: t,
                            inputMode: i
                        });
                    case "fractional":
                        {
                            let n = (({
                                price: e,
                                inputMode: t
                            }) => {
                                let n = u("scaled" === t ? e / 100 : e);
                                return null === n ? null : {
                                    value: 0,
                                    formatted: n
                                }
                            })({
                                price: e,
                                precision: t,
                                inputMode: i
                            });
                            if (!n) break;
                            return n
                        }
                    case "hongKong":
                        {
                            let s = (({
                                price: e,
                                inputMode: t
                            }) => {
                                let s = a("scaled" === t ? e / 100 : e);
                                return null === s ? null : {
                                    value: s,
                                    formatted: (0, n.formatToDecimal)(s, 2)
                                }
                            })({
                                price: e,
                                precision: t,
                                inputMode: i
                            });
                            if (!s) break;
                            return s
                        }
                    case "indonesian":
                        {
                            let n = (({
                                price: e,
                                inputMode: t
                            }) => {
                                let n = l("scaled" === t ? e / 100 : e);
                                return null === n ? null : {
                                    value: n,
                                    formatted: g(n)
                                }
                            })({
                                price: e,
                                precision: t,
                                inputMode: i
                            });
                            if (!n) break;
                            return n
                        }
                    case "malaysian":
                        {
                            let n = (({
                                price: e,
                                inputMode: t
                            }) => {
                                let n = c("scaled" === t ? e / 100 : e);
                                return null === n ? null : {
                                    value: n,
                                    formatted: g(n)
                                }
                            })({
                                price: e,
                                precision: t,
                                inputMode: i
                            });
                            if (!n) break;
                            return n
                        }
                    default:
                        return f({
                            price: e,
                            precision: t,
                            inputMode: i
                        })
                }
            } catch (n) {
                s.logger.error("[useConvertPrice > convertPrice] Error converting price", {
                    price: e,
                    precision: t,
                    inputMode: i,
                    e: n
                })
            }
            return f({
                price: e,
                precision: t,
                inputMode: i
            })
        };
    e.s(["convertPrice", 0, x, "useConvertPrice", 0, e => t.default.useMemo(() => x(e), [e])], 557033)
}, 568655, e => {
    "use strict";
    var t = e.i(999061);
    e.i(416340);
    let n = (e, n, s, i, r, o) => {
        let a, l = (0, t.c)(8),
            c = void 0 === r ? 0 : r;
        e: {
            let t, r, d;l[0] !== i || l[1] !== c ? (t = e => {
                let t = Math.max(0, (i ? ? 0) - c);
                return new Intl.NumberFormat(void 0, {
                    minimumFractionDigits: t,
                    maximumFractionDigits: t
                }).format(e)
            }, l[0] = i, l[1] = c, l[2] = t) : t = l[2];
            let u = t;
            if (void 0 === e) {
                a = void 0 === o ? "--" : o;
                break e
            }
            let m = "string" == typeof e ? parseFloat(e) : e;l[3] !== m ? (r = Number.isFinite(m) ? m : 0, l[3] = m, l[4] = r) : r = l[4];
            let h = r * 10 ** c;l[5] !== u || l[6] !== h ? (d = u(h), l[5] = u, l[6] = h, l[7] = d) : d = l[7],
            a = `${n}${d}${s}`
        }
        return a
    };
    e.s(["useFormattedNetValue", 0, e => n(e, "$", "", 2), "useFormattedPrice", 0, (e, s, i, r) => {
        let o, a = (0, t.c)(2);
        return a[0] !== s ? (o = (e => {
            if (null == e) return 2;
            let t = e.toString().split(".");
            return t ? .[1] ? .length ? ? 0
        })(s), a[0] = s, a[1] = o) : o = a[1], n(e, "", "¢", o, void 0 === i ? 2 : i, void 0 === r ? "--" : r)
    }, "useFormattedSize", 0, e => n(e, "", "", 2)])
}, 328951, e => {
    "use strict";
    var t = e.i(221628),
        n = e.i(999061),
        s = e.i(567692),
        i = e.i(188474),
        r = e.i(339393),
        o = e.i(86831),
        a = e.i(429412),
        l = e.i(479399),
        c = e.i(147658),
        d = e.i(416340),
        u = e.i(134709),
        m = e.i(880809),
        h = e.i(488549),
        p = e.i(912498),
        f = e.i(219494),
        g = e.i(908392),
        x = e.i(97238),
        y = e.i(738086),
        v = e.i(538301),
        b = e.i(649635),
        k = e.i(604777),
        S = e.i(275546),
        C = e.i(664318),
        j = e.i(766181),
        w = e.i(557033),
        T = e.i(840216),
        N = e.i(843340),
        I = e.i(568655),
        E = e.i(23128),
        O = e.i(847804),
        M = e.i(406394),
        P = e.i(169010),
        A = e.i(318594),
        R = e.i(831089),
        z = e.i(15756),
        L = e.i(377960),
        D = e.i(249792),
        F = e.i(606572),
        _ = e.i(373898),
        B = e.i(510954),
        H = e.i(57096),
        $ = e.i(502980),
        U = e.i(922445),
        q = e.i(870555),
        W = e.i(399336),
        K = e.i(196593),
        V = e.i(156591),
        Q = e.i(119738);
    let G = ({
            orderDetails: e,
            activeMarket: n,
            color: s,
            marketTickSize: i
        }) => {
            let r = (0, k.useTranslations)(),
                o = (0, A.useQueryClient)(),
                a = (0, _.default)(),
                l = (0, d.useMemo)(() => e ? Math.max((e.totalQty - e.availableQty) / e.totalQty * 100, 2) : 0, [e]),
                c = (0, d.useCallback)(async e => {
                    try {
                        await a(e, n, !1)
                    } finally {
                        o.invalidateQueries({
                            queryKey: B.queryKeys[H.QueryKey.OpenOrders]._def
                        })
                    }
                }, [a, o, n]),
                u = d.default.useMemo(() => {
                    if (!e.orders.length) return;
                    let t = parseFloat(e.orders[0].price),
                        n = (0, V.getPrecisionFromTickSize)(i);
                    return `Order at ${(100*t).toFixed(n-2)}\xa2`
                }, [e, i]);
            return (0, t.jsxs)("div", {
                className: "flex flex-col gap-1 py-4",
                children: [!!u && (0, t.jsxs)("div", {
                    className: "flex items-center mb-1",
                    children: [(0, t.jsx)("div", {
                        className: (0, q.cn)("w-[4px] h-[16px] mr-1", "green" === s && "bg-green-600/50 dark:bg-green-400/50", "red" === s && "bg-red-500/50 dark:bg-red-400/50")
                    }), (0, t.jsx)("p", {
                        className: "font-semibold text-sm",
                        children: u
                    })]
                }), (0, t.jsxs)("div", {
                    className: "flex flex-1 justify-between mb-1 gap-4",
                    children: [(0, t.jsx)("p", {
                        className: "font-medium text-xs",
                        children: r("orders.filled")
                    }), (0, t.jsxs)("p", {
                        className: "font-medium text-xs",
                        children: [(0, K.formatNum)(e.totalQty - e.availableQty, {
                            decimals: 0
                        }), " /", " ", (0, K.formatNum)(e.totalQty, {
                            decimals: 0
                        })]
                    })]
                }), (0, t.jsx)("div", {
                    className: "flex-1 rounded-full overflow-hidden mb-1",
                    children: (0, t.jsx)(M.Progress, {
                        color: s,
                        value: l,
                        children: (0, t.jsx)(M.ProgressIndicator, {
                            color: s,
                            style: {
                                transform: `translateX(-${100-l}%)`
                            }
                        })
                    })
                }), (0, t.jsxs)("div", {
                    className: "flex flex-1 justify-between items-center gap-4",
                    children: [(0, t.jsx)("p", {
                        className: "text-xs text-text-secondary",
                        children: r("orders.remaining").replace("{count}", (0, K.formatNum)(e.availableQty, {
                            decimals: 0
                        }))
                    }), (0, t.jsx)(P.Tooltip, {
                        content: r("tooltips.cancel"),
                        showArrow: !1,
                        sideOffset: 4,
                        children: (0, t.jsx)(E.Button, {
                            variant: "ghost",
                            size: "iconSm",
                            onClick: t => {
                                t.preventDefault(), t.stopPropagation(), e.orders.map(e => c(e))
                            },
                            className: "size-6! text-red-500 dark:text-red-400",
                            children: (0, t.jsx)(L.IconXmarkOutline18, {
                                size: 12
                            })
                        })
                    })]
                })]
            })
        },
        Y = ({
            orderDetails: e,
            color: n = "green",
            iconPadding: s = "36px",
            isEarningRewards: i,
            inline: r,
            marketTickSize: o
        }) => {
            let a = (0, k.useTranslations)(),
                l = (0, A.useQueryClient)(),
                c = (0, D.useToast)(),
                u = (0, _.default)(),
                {
                    activeMarket: m
                } = (0, W.useEventActiveMarketContext)(["activeMarket"]),
                [h, p] = (0, d.useState)(!1),
                [f, g] = (0, d.useState)(!1),
                x = (0, d.useMemo)(() => e ? .flatMap(e => e.orders) ? ? [], [e]),
                y = (0, d.useCallback)(async () => {
                    let e = (0, $.getOrderToastPosition)();
                    if (!x.length) return;
                    let t = x.length > 1;
                    try {
                        for (let e of x) await u(e, m, t);
                        t && c.success(new F.ToastBuilder().position({
                            side: e
                        }).title(a("orders.ordersCancelled")).description(m.question).subtext(a("orders.cancelOrdersCount").replace("{count}", x.length.toString())))
                    } catch {
                        t && c.error(new F.ToastBuilder().position({
                            side: e
                        }).title(a("orders.cancelOrdersError")).description(m.question).subtext(a("orders.cancelOrdersCount").replace("{count}", x.length.toString())))
                    } finally {
                        l.invalidateQueries({
                            queryKey: B.queryKeys[H.QueryKey.OpenOrders]._def
                        })
                    }
                }, [u, l, c, x, m, a]);
            return e && x.length ? (0, t.jsxs)(t.Fragment, {
                children: [(0, t.jsxs)(O.HoverCard, {
                    openDelay: 100,
                    closeDelay: 200,
                    children: [(0, t.jsx)(O.HoverCardTrigger, {
                        onMouseEnter: () => p(!0),
                        onMouseLeave: () => p(!1),
                        style: r ? {
                            position: "static",
                            display: "inline-flex",
                            alignItems: "center",
                            marginRight: "4px"
                        } : {
                            position: "absolute",
                            right: s,
                            display: "flex",
                            alignItems: "center",
                            top: "50%",
                            transform: "translateY(-50%)"
                        },
                        children: (0, t.jsx)("span", {
                            children: h ? (0, t.jsx)("button", {
                                type: "button",
                                className: (0, q.cn)("rounded-full cursor-pointer", r ? "inline-flex items-center" : "", i ? "ring-1 ring-bg-brand" : ""),
                                onClick: e => {
                                    e.stopPropagation(), (0, U.isNarrowViewport)() || y()
                                },
                                children: (0, t.jsx)(R.IconCircleXmarkFill18, {
                                    size: 16,
                                    className: (0, q.cn)("green" === n ? "text-green-600 dark:text-green-400" : "text-red-500")
                                })
                            }) : (0, t.jsx)("button", {
                                type: "button",
                                className: (0, q.cn)("rounded-full cursor-pointer", r ? "inline-flex items-center" : "", i ? "ring-1 ring-bg-brand" : ""),
                                onClick: e => {
                                    e.stopPropagation(), (0, U.isNarrowViewport)() || y()
                                },
                                children: (0, t.jsx)(z.IconClockFill18, {
                                    size: 16,
                                    className: (0, q.cn)("opacity-50", "green" === n ? "text-green-600 dark:text-green-400" : "text-red-500")
                                })
                            })
                        })
                    }), (0, t.jsx)(O.HoverCardContent, {
                        side: "left",
                        sideOffset: 5,
                        className: "p-3",
                        children: (0, t.jsxs)("div", {
                            className: "flex flex-col divide-border/50 divide-y-2",
                            children: [e.map(e => (0, t.jsx)(G, {
                                orderDetails: e,
                                activeMarket: m,
                                color: n,
                                marketTickSize: o
                            }, e.orders[0].tokenID)), i ? (0, t.jsx)("p", {
                                className: "w-fit font-semibold text-xs mt-1 bg-gradient-to-r from-blue-500 to-purple-500 text-transparent bg-clip-text",
                                children: a("orders.earningRewards")
                            }) : null]
                        })
                    })]
                }), (0, t.jsx)(Q.CancelOrdersConfirmModal, {
                    open: f,
                    onOpenChange: g,
                    orderCount: x.length,
                    onConfirm: y
                })]
            }) : null
        };
    var Z = e.i(405473);
    let X = ({
            orderDetails: e,
            activeMarket: n,
            color: s,
            setDialogOpen: i
        }) => {
            let r = (0, k.useTranslations)(),
                o = (0, A.useQueryClient)(),
                a = (0, _.default)(),
                l = (0, d.useMemo)(() => e ? Math.max((e.totalQty - e.availableQty) / e.totalQty * 100, 2) : 0, [e]),
                c = (0, d.useCallback)(async e => {
                    try {
                        await a(e, n, !1)
                    } finally {
                        o.invalidateQueries({
                            queryKey: B.queryKeys[H.QueryKey.OpenOrders]._def
                        })
                    }
                }, [a, o, n]);
            return (0, t.jsxs)("div", {
                className: "flex flex-col gap-1",
                children: [(0, t.jsxs)("div", {
                    className: "flex flex-1 justify-between mb-1 gap-4",
                    children: [(0, t.jsx)("p", {
                        className: "font-medium text-sm",
                        children: r("orders.filled")
                    }), (0, t.jsxs)("p", {
                        className: "font-medium text-sm",
                        children: [(0, K.formatNum)(e.totalQty - e.availableQty, {
                            decimals: 0
                        }), " /", " ", (0, K.formatNum)(e.totalQty, {
                            decimals: 0
                        })]
                    })]
                }), (0, t.jsx)("div", {
                    className: "flex-1 rounded-full overflow-hidden mb-1",
                    children: (0, t.jsx)(M.Progress, {
                        color: s,
                        value: l,
                        children: (0, t.jsx)(M.ProgressIndicator, {
                            color: s,
                            style: {
                                transform: `translateX(-${100-l}%)`
                            }
                        })
                    })
                }), (0, t.jsxs)("div", {
                    className: "flex flex-1 justify-between items-center gap-4",
                    children: [(0, t.jsx)("p", {
                        className: "text-xs text-text-secondary",
                        children: r("orders.remaining").replace("{count}", (0, K.formatNum)(e.availableQty, {
                            decimals: 0
                        }))
                    }), (0, t.jsx)("div", {
                        className: "contents lg:hidden",
                        children: (0, t.jsx)(Z.default, {
                            mode: e.orders.length > 1 ? "multiple" : "single",
                            callback: () => e.orders.length > 1 ? i(!0) : c(e.orders[0])
                        })
                    })]
                })]
            })
        },
        J = ({
            orderDetails: e,
            color: n = "green",
            iconPadding: s = "36px",
            isEarningRewards: i,
            inline: r
        }) => {
            let o = (0, k.useTranslations)(),
                a = (0, A.useQueryClient)(),
                l = (0, D.useToast)(),
                c = (0, _.default)(),
                {
                    activeMarket: u
                } = (0, W.useEventActiveMarketContext)(["activeMarket"]),
                [m, h] = (0, d.useState)(!1),
                [p, f] = (0, d.useState)(!1),
                g = (0, d.useCallback)(async () => {
                    let t = (0, $.getOrderToastPosition)(),
                        n = e ? .orders ? ? [];
                    if (!n.length) return;
                    let s = n.length > 1;
                    try {
                        for (let e of n) await c(e, u, s);
                        s && l.success(new F.ToastBuilder().position({
                            side: t
                        }).title(o("orders.ordersCancelled")).description(u.question).subtext(o("orders.cancelOrdersCount").replace("{count}", n.length.toString())))
                    } catch {
                        s && l.error(new F.ToastBuilder().position({
                            side: t
                        }).title(o("orders.cancelOrdersError")).description(u.question).subtext(o("orders.cancelOrdersCount").replace("{count}", n.length.toString())))
                    } finally {
                        a.invalidateQueries({
                            queryKey: B.queryKeys[H.QueryKey.OpenOrders]._def
                        })
                    }
                }, [c, a, l, e, u, o]);
            return e && e ? .orders.length ? (0, t.jsxs)(t.Fragment, {
                children: [(0, t.jsxs)(O.HoverCard, {
                    openDelay: 100,
                    closeDelay: 200,
                    children: [(0, t.jsx)(O.HoverCardTrigger, {
                        onMouseEnter: () => h(!0),
                        onMouseLeave: () => h(!1),
                        style: r ? {
                            position: "static",
                            display: "inline-flex",
                            alignItems: "center",
                            marginRight: "4px"
                        } : {
                            position: "absolute",
                            right: s,
                            display: "flex",
                            alignItems: "center",
                            top: "50%",
                            transform: "translateY(-50%)"
                        },
                        children: (0, t.jsx)("span", {
                            children: m ? (0, t.jsx)("button", {
                                type: "button",
                                className: (0, q.cn)("rounded-full cursor-pointer", r ? "inline-flex items-center" : "", i ? "ring-1 ring-bg-brand" : ""),
                                onClick: e => {
                                    e.stopPropagation(), (0, U.isNarrowViewport)() || g()
                                },
                                children: (0, t.jsx)(R.IconCircleXmarkFill18, {
                                    size: 16,
                                    className: (0, q.cn)("green" === n ? "text-green-600 dark:text-green-400" : "text-red-500")
                                })
                            }) : (0, t.jsx)("button", {
                                type: "button",
                                className: (0, q.cn)("rounded-full cursor-pointer", r ? "inline-flex items-center" : "", i ? "ring-1 ring-bg-brand" : ""),
                                onClick: e => {
                                    e.stopPropagation(), (0, U.isNarrowViewport)() || g()
                                },
                                children: (0, t.jsx)(z.IconClockFill18, {
                                    size: 16,
                                    className: (0, q.cn)("opacity-50", "green" === n ? "text-green-600 dark:text-green-400" : "text-red-500")
                                })
                            })
                        })
                    }), (0, t.jsx)(O.HoverCardContent, {
                        side: "left",
                        sideOffset: 5,
                        className: "p-3",
                        children: (0, t.jsxs)("div", {
                            className: "flex flex-col gap-1",
                            children: [(0, t.jsx)(X, {
                                orderDetails: e,
                                activeMarket: u,
                                color: n,
                                setDialogOpen: f
                            }), i ? (0, t.jsx)("p", {
                                className: "w-fit font-semibold text-xs mt-1 bg-gradient-to-r from-blue-500 to-purple-500 text-transparent bg-clip-text",
                                children: o("orders.earningRewards")
                            }) : null]
                        })
                    })]
                }), (0, t.jsx)(Q.CancelOrdersConfirmModal, {
                    open: p,
                    onOpenChange: f,
                    orderCount: e.orders.length,
                    onConfirm: g
                })]
            }) : null
        },
        ee = (0, j.cva)("h-full opacity-15", {
            variants: {
                side: {
                    ask: "bg-red-500",
                    bid: "bg-green-600 dark:bg-green-400"
                },
                width: {
                    default: "",
                    narrow: ""
                }
            },
            compoundVariants: [{
                side: "ask",
                width: "default",
                class: "w-[calc(2%+var(--bar-value)/var(--total-ask-value)*98%)]"
            }, {
                side: "ask",
                width: "narrow",
                class: "w-[calc(5%+var(--bar-value)/var(--total-ask-value)*95%)]"
            }, {
                side: "bid",
                width: "default",
                class: "w-[calc(2%+var(--bar-value)/var(--total-bid-value)*98%)]"
            }, {
                side: "bid",
                width: "narrow",
                class: "w-[calc(5%+var(--bar-value)/var(--total-bid-value)*95%)]"
            }]
        }),
        et = e => {
            let s, i, r, a, l = (0, n.c)(12),
                {
                    variant: c,
                    show: d
                } = e,
                u = (0, k.useTranslations)(),
                m = "bids" === c && "bg-green-600 dark:bg-green-400 top-1/2 -translate-y-1/2",
                h = "asks" === c && "bg-red-500 top-1/2 -translate-y-1/2",
                p = !(void 0 === d || d) && "invisible";
            return l[0] !== m || l[1] !== h || l[2] !== p ? (s = (0, o.cn)("flex items-center justify-center h-[20px] px-1.5 absolute left-2 rounded-sm pointer-events-none", m, h, p), l[0] = m, l[1] = h, l[2] = p, l[3] = s) : s = l[3], l[4] !== u || l[5] !== c ? (i = u("asks" === c ? "trading.orderBook.asks" : "trading.orderBook.bids"), l[4] = u, l[5] = c, l[6] = i) : i = l[6], l[7] !== i ? (r = (0, t.jsx)("p", {
                className: "text-white text-[10px] leading-[10px] font-medium whitespace-nowrap capitalize",
                children: i
            }), l[7] = i, l[8] = r) : r = l[8], l[9] !== s || l[10] !== r ? (a = (0, t.jsx)("div", {
                className: s,
                children: r
            }), l[9] = s, l[10] = r, l[11] = a) : a = l[11], a
        },
        en = e => {
            let s, i, r, a, l, c, d, u, m, h = (0, n.c)(49),
                {
                    variant: p,
                    row: f,
                    tickSize: g,
                    marketTickSize: x,
                    side: y,
                    scoringHovered: v,
                    orderInfo: b,
                    onClick: k,
                    compactPadding: S,
                    loading: j,
                    includeChip: E
                } = e,
                O = void 0 === p ? "default" : p,
                M = void 0 === b ? N.EMPTY_ORDER_BOOK_ROW_USER_STATE : b,
                P = void 0 !== S && S,
                A = void 0 !== j && j,
                R = void 0 !== E && E;
            e: {
                if (x < g) {
                    if ("0" === f.price && "bid" === y) {
                        s = "0¢";
                        break e
                    }
                    if ("1" === f.price && "ask" === y) {
                        s = "100¢";
                        break e
                    }
                }
                s = void 0
            }
            let z = s,
                L = (0, I.useFormattedPrice)(f.price, g),
                D = (0, T.useSportsStoreOptional)(es);
            t: {
                let e, t, n = z ? ? L;
                if (z || !D || "price" === D) {
                    let e;
                    h[0] !== n ? (e = {
                        main: n,
                        cents: null
                    }, h[0] = n, h[1] = e) : e = h[1], i = e;
                    break t
                }
                let s = parseFloat(f.price);
                if (!s || Number.isNaN(s)) {
                    let e;
                    h[2] !== n ? (e = {
                        main: n,
                        cents: null
                    }, h[2] = n, h[3] = e) : e = h[3], i = e;
                    break t
                }
                h[4] !== D || h[5] !== s ? (e = (0, w.convertPrice)({
                    price: s,
                    inputMode: "decimal",
                    outputMode: D
                }), h[4] = D, h[5] = s, h[6] = e) : e = h[6];
                let {
                    formatted: r
                } = e;h[7] !== n || h[8] !== r ? (t = {
                    main: r,
                    cents: n
                }, h[7] = n, h[8] = r, h[9] = t) : t = h[9],
                i = t
            }
            let F = i,
                _ = (0, I.useFormattedNetValue)(f.netValue),
                B = (0, I.useFormattedSize)(f.size),
                H = `${f.netValue}`;
            h[10] !== H ? (r = {
                "--bar-value": H
            }, h[10] = H, h[11] = r) : r = h[11];
            let $ = r;
            h[12] !== k || h[13] !== f.includedLevels || h[14] !== f.netSize || h[15] !== f.price || h[16] !== f.size || h[17] !== y || h[18] !== g ? (a = e => {
                let t = f.price;
                if ("1" === t) {
                    let e = Math.max(...f.includedLevels.map(Number));
                    t = `${e.toFixed(3)}`
                }
                "0" === t && Math.min(...f.includedLevels.map(Number)).toFixed(3), k ? .({
                    e,
                    data: {
                        type: y,
                        price: f.price,
                        size: `${f.size}`,
                        netSize: `${f.netSize}`,
                        tickSize: g,
                        includedLevels: f.includedLevels
                    }
                })
            }, h[12] = k, h[13] = f.includedLevels, h[14] = f.netSize, h[15] = f.price, h[16] = f.size, h[17] = y, h[18] = g, h[19] = a) : a = h[19];
            let U = a,
                q = "narrow" === O && "grid-cols-[28%_24%_24%_24%]",
                W = "ask" === y && "hover:bg-red-500/10",
                K = "bid" === y && "hover:bg-green-600/10 hover:dark:bg-green-400/10",
                V = v && "bg-bg-brand/10";
            return h[20] !== q || h[21] !== W || h[22] !== K || h[23] !== V ? (l = (0, o.cn)("grid grid-cols-[40%_20%_20%_20%] h-[36px] w-full border-none outline-none cursor-pointer", "bg-button-ghost-bg transition-colors duration-[50ms] ease-in-out", q, W, K, V), h[20] = q, h[21] = W, h[22] = K, h[23] = V, h[24] = l) : l = h[24], h[25] !== P || h[26] !== F || h[27] !== A || h[28] !== x || h[29] !== _ || h[30] !== M || h[31] !== $ || h[32] !== y || h[33] !== B || h[34] !== O ? (c = !A && (0, t.jsxs)(t.Fragment, {
                children: [(0, t.jsx)("div", {
                    className: "flex w-full h-full items-center",
                    children: (0, t.jsx)("div", {
                        className: "w-full h-full flex items-center",
                        children: (0, t.jsx)("div", {
                            className: (0, o.cn)(ee({
                                side: y,
                                width: O
                            }), A && "invisible"),
                            style: $
                        })
                    })
                }), (0, t.jsx)("div", {
                    className: (0, o.cn)("flex w-full items-center justify-center px-2", !0 === P && "px-0.5", "desktop" === P && "lg:px-0.5", "mobile" === P && "not-lg:px-0.5"),
                    children: (0, t.jsxs)("div", {
                        className: "flex items-center justify-center relative w-[92px]",
                        children: [(0, t.jsxs)("span", {
                            className: (0, o.cn)("absolute top-1/2 translate-y-[calc(-50%+2px)] left-0", "narrow" === O && "-translate-x-1.5"),
                            children: [!A && 1 === M.orders.length && (0, t.jsx)(J, {
                                isEarningRewards: M.scoring,
                                orderDetails: M.orders[0],
                                color: "ask" === y ? "red" : "green",
                                iconPadding: "0px",
                                inline: !0
                            }), !A && M.orders.length > 1 && (0, t.jsx)(Y, {
                                isEarningRewards: M.scoring,
                                orderDetails: M.orders,
                                color: "ask" === y ? "red" : "green",
                                iconPadding: "0px",
                                inline: !0,
                                marketTickSize: x
                            })]
                        }), (0, t.jsx)("p", {
                            className: (0, o.cn)("font-semibold text-sm tabular-nums", "ask" === y && "text-red-500", "bid" === y && "text-green-600 dark:text-green-500"),
                            children: F.main
                        }), F.cents && (0, t.jsxs)("span", {
                            className: "text-text-secondary font-normal text-[11px] tabular-nums ml-1",
                            children: ["(", F.cents, ")"]
                        })]
                    })
                }), (0, t.jsx)("div", {
                    className: (0, o.cn)("flex w-full items-center justify-center px-2", !0 === P && "px-0.5", "desktop" === P && "lg:px-0.5", "mobile" === P && "not-lg:px-0.5"),
                    children: (0, t.jsx)("p", {
                        className: "text-[11px] sm:text-xs lg:text-[13px]",
                        children: B
                    })
                }), (0, t.jsx)("div", {
                    className: (0, o.cn)("flex w-full items-center justify-center px-2", !0 === P && "px-0.5", "desktop" === P && "lg:px-0.5", "mobile" === P && "not-lg:px-0.5"),
                    children: (0, t.jsx)("p", {
                        className: "text-[11px] sm:text-xs lg:text-[13px]",
                        children: _
                    })
                })]
            }), h[25] = P, h[26] = F, h[27] = A, h[28] = x, h[29] = _, h[30] = M, h[31] = $, h[32] = y, h[33] = B, h[34] = O, h[35] = c) : c = h[35], h[36] !== P || h[37] !== A ? (d = A && (0, t.jsxs)(t.Fragment, {
                children: [(0, t.jsx)("div", {
                    className: "w-full h-full"
                }), (0, t.jsx)("div", {
                    className: (0, o.cn)("flex w-full items-center justify-center px-2", !0 === P && "px-0.5", "desktop" === P && "lg:px-0.5", "mobile" === P && "not-lg:px-0.5"),
                    children: (0, t.jsx)(C.Skeleton, {
                        className: "h-5 w-8 rounded-sm"
                    })
                }), (0, t.jsx)("div", {
                    className: (0, o.cn)("flex w-full items-center justify-center px-2", !0 === P && "px-0.5", "desktop" === P && "lg:px-0.5", "mobile" === P && "not-lg:px-0.5"),
                    children: (0, t.jsx)(C.Skeleton, {
                        className: "h-5 w-8 rounded-sm"
                    })
                }), (0, t.jsx)("div", {
                    className: (0, o.cn)("flex w-full items-center justify-center px-2", !0 === P && "px-0.5", "desktop" === P && "lg:px-0.5", "mobile" === P && "not-lg:px-0.5"),
                    children: (0, t.jsx)(C.Skeleton, {
                        className: "h-5 w-8 rounded-sm"
                    })
                })]
            }), h[36] = P, h[37] = A, h[38] = d) : d = h[38], h[39] !== R || h[40] !== A || h[41] !== y ? (u = !A && R && (0, t.jsx)(et, {
                variant: "ask" === y ? "asks" : "bids",
                show: !0
            }), h[39] = R, h[40] = A, h[41] = y, h[42] = u) : u = h[42], h[43] !== U || h[44] !== l || h[45] !== c || h[46] !== d || h[47] !== u ? (m = (0, t.jsxs)("button", {
                type: "button",
                className: l,
                onClick: U,
                children: [c, d, u]
            }), h[43] = U, h[44] = l, h[45] = c, h[46] = d, h[47] = u, h[48] = m) : m = h[48], m
        };

    function es(e) {
        return e.oddsFormat
    }
    var ei = e.i(723823);

    function er(e) {
        let s, i, r, a, l, c, d, u, m, h, p, f, g, x, y = (0, n.c)(37),
            {
                ref: v,
                variant: b,
                outcomeIdx: S,
                market: C,
                tickSize: j,
                className: N,
                onClick: E,
                compactPadding: O
            } = e,
            M = void 0 !== O && O,
            P = (0, k.useTranslations)(),
            A = (0, ei.useLastTradedPrice)(C, S),
            R = (0, ei.useSpread)(C, S),
            z = (0, I.useFormattedPrice)(R.value, C.orderPriceMinTickSize ? ? .01, void 0, "--"),
            L = (0, I.useFormattedPrice)(A.price, C.orderPriceMinTickSize ? ? .01, void 0, "--"),
            D = (0, T.useSportsStoreOptional)(eo);
        e: {
            let e;
            if (!D || "price" === D || !A.price) {
                s = L;
                break e
            }
            let t = parseFloat(`${A.price}`);
            if (!t || Number.isNaN(t)) {
                s = L;
                break e
            }
            y[0] !== D || y[1] !== t ? (e = (0, w.convertPrice)({
                price: t,
                inputMode: "decimal",
                outputMode: D
            }), y[0] = D, y[1] = t, y[2] = e) : e = y[2];
            let {
                formatted: n
            } = e;s = `${n} (${L})`
        }
        let F = s;
        y[3] !== E || y[4] !== j ? (i = e => E ? .({
            e,
            data: {
                type: "spread",
                tickSize: j
            }
        }), y[3] = E, y[4] = j, y[5] = i) : i = y[5];
        let _ = i,
            B = "narrow" === (void 0 === b ? "default" : b) && "grid-cols-[28%_24%_24%_24%]";
        y[6] !== N || y[7] !== B ? (r = (0, o.cn)("border-x-none border-y border-y-border h-[36px] outline-none cursor-pointer bg-background hover:bg-button-ghost-bg-hover transition-colors duration-[50ms] ease-in-out w-full z-[2] overflow-visible bg-background", B, N), y[6] = N, y[7] = B, y[8] = r) : r = y[8];
        let H = !0 === M && "px-0.5",
            $ = "desktop" === M && "lg:px-0.5",
            U = "mobile" === M && "not-lg:px-0.5";
        y[9] !== H || y[10] !== $ || y[11] !== U ? (a = (0, o.cn)("w-full h-full flex justify-start items-center px-2", H, $, U), y[9] = H, y[10] = $, y[11] = U, y[12] = a) : a = y[12], y[13] !== P ? (l = P("trading.orderBook.last"), y[13] = P, y[14] = l) : l = y[14];
        let q = `${l}: ${F}`;
        y[15] !== q ? (c = (0, t.jsx)("p", {
            className: "text-text-secondary text-xs font-semibold whitespace-nowrap",
            children: q
        }), y[15] = q, y[16] = c) : c = y[16], y[17] !== a || y[18] !== c ? (d = (0, t.jsx)("div", {
            className: a,
            children: c
        }), y[17] = a, y[18] = c, y[19] = d) : d = y[19];
        let W = `w-full h-full flex justify-center items-center ${M?"px-0.5":"px-2"}`;
        y[20] !== P ? (u = P("trading.orderBook.spread"), y[20] = P, y[21] = u) : u = y[21];
        let K = `${u}: ${z}`;
        return y[22] !== K ? (m = (0, t.jsx)("p", {
            className: "text-text-secondary text-xs font-semibold whitespace-nowrap",
            children: K
        }), y[22] = K, y[23] = m) : m = y[23], y[24] !== W || y[25] !== m ? (h = (0, t.jsx)("div", {
            className: W,
            children: m
        }), y[24] = W, y[25] = m, y[26] = h) : h = y[26], y[27] === Symbol.for("react.memo_cache_sentinel") ? (p = (0, t.jsx)("div", {
            className: "w-full"
        }), f = (0, t.jsx)("div", {
            className: "w-full"
        }), y[27] = p, y[28] = f) : (p = y[27], f = y[28]), y[29] !== d || y[30] !== h ? (g = (0, t.jsxs)("div", {
            className: "grid grid-cols-[40%_20%_20%_20%] h-full w-full",
            children: [d, h, p, f]
        }), y[29] = d, y[30] = h, y[31] = g) : g = y[31], y[32] !== _ || y[33] !== v || y[34] !== g || y[35] !== r ? (x = (0, t.jsx)("button", {
            ref: v,
            type: "button",
            className: r,
            onClick: _,
            children: g
        }), y[32] = _, y[33] = v, y[34] = g, y[35] = r, y[36] = x) : x = y[36], x
    }

    function eo(e) {
        return e.oddsFormat
    }
    let ea = e => {
            let s, i = (0, n.c)(4),
                {
                    side: r,
                    loading: o
                } = e,
                a = (0, k.useTranslations)();
            return i[0] !== o || i[1] !== r || i[2] !== a ? (s = (0, t.jsx)("div", {
                className: "h-[36px] w-full",
                children: o ? (0, t.jsx)("div", {
                    className: "h-full w-full flex items-center justify-center",
                    children: (0, t.jsx)("p", {
                        className: "text-text-secondary text-xs font-medium",
                        children: a("asks" === r ? "trading.orderBook.loadingAsks" : "trading.orderBook.loadingBids")
                    })
                }) : (0, t.jsx)("div", {
                    className: "h-full w-full flex items-center justify-center",
                    children: (0, t.jsx)("p", {
                        className: "text-text-secondary text-xs font-medium",
                        children: a("asks" === r ? "trading.orderBook.noAsks" : "trading.orderBook.noBids")
                    })
                })
            }), i[0] = o, i[1] = r, i[2] = a, i[3] = s) : s = i[3], s
        },
        el = e => {
            let s, i, r = (0, n.c)(5),
                {
                    type: o,
                    variant: a,
                    compactPadding: l
                } = e;
            return r[0] === Symbol.for("react.memo_cache_sentinel") ? (s = {
                price: "0",
                size: 0,
                value: 0,
                netSize: 0,
                netValue: 0,
                includedLevels: []
            }, r[0] = s) : s = r[0], r[1] !== l || r[2] !== o || r[3] !== a ? (i = (0, t.jsx)(en, {
                variant: a,
                loading: !0,
                row: s,
                tickSize: .01,
                marketTickSize: .01,
                side: o,
                scoringHovered: !1,
                compactPadding: l
            }), r[1] = l, r[2] = o, r[3] = a, r[4] = i) : i = r[4], i
        },
        ec = e => {
            let s, i, r, a, l = (0, n.c)(14),
                {
                    state: c,
                    children: d,
                    style: u
                } = e,
                m = c.sticky && "z-1",
                h = c.active && "sticky",
                p = !c.active && "absolute translate-y-[var(--start)]";
            return l[0] !== m || l[1] !== h || l[2] !== p ? (s = (0, o.cn)("top-0 left-0 w-full h-[36px]", m, h, p), l[0] = m, l[1] = h, l[2] = p, l[3] = s) : s = l[3], l[4] !== c.active || l[5] !== c.styles ? (i = c.active && { ...c.styles
            }, l[4] = c.active, l[5] = c.styles, l[6] = i) : i = l[6], l[7] !== u || l[8] !== i ? (r = { ...u,
                ...i
            }, l[7] = u, l[8] = i, l[9] = r) : r = l[9], l[10] !== d || l[11] !== s || l[12] !== r ? (a = (0, t.jsx)("div", {
                className: s,
                style: r,
                children: d
            }), l[10] = d, l[11] = s, l[12] = r, l[13] = a) : a = l[13], a
        },
        ed = e => {
            let s, i, r, o, a, l, c, d, u, m = (0, n.c)(35),
                {
                    row: h,
                    variant: p,
                    compactPadding: f,
                    style: g,
                    state: x
                } = e;
            return m[0] !== h.props || m[1] !== h.type ? (s = "header" === h.type && (0, t.jsx)(S.OrderBookHeaderRow, { ...h.props
            }), m[0] = h.props, m[1] = h.type, m[2] = s) : s = m[2], m[3] !== h.props || m[4] !== h.type ? (i = "spread" === h.type && (0, t.jsx)(er, { ...h.props
            }), m[3] = h.props, m[4] = h.type, m[5] = i) : i = m[5], m[6] !== h.props || m[7] !== h.type ? (r = "ask" === h.type && (0, t.jsx)(en, { ...h.props
            }), m[6] = h.props, m[7] = h.type, m[8] = r) : r = m[8], m[9] !== h.type ? (o = "empty-asks" === h.type && (0, t.jsx)(ea, {
                side: "asks",
                loading: !1
            }), m[9] = h.type, m[10] = o) : o = m[10], m[11] !== f || m[12] !== h.type || m[13] !== p ? (a = "loading-ask" === h.type && (0, t.jsx)(el, {
                type: "ask",
                variant: p,
                compactPadding: f
            }), m[11] = f, m[12] = h.type, m[13] = p, m[14] = a) : a = m[14], m[15] !== h.props || m[16] !== h.type ? (l = "bid" === h.type && (0, t.jsx)(en, { ...h.props
            }), m[15] = h.props, m[16] = h.type, m[17] = l) : l = m[17], m[18] !== h.type ? (c = "empty-bids" === h.type && (0, t.jsx)(ea, {
                side: "bids",
                loading: !1
            }), m[18] = h.type, m[19] = c) : c = m[19], m[20] !== f || m[21] !== h.type || m[22] !== p ? (d = "loading-bid" === h.type && (0, t.jsx)(el, {
                type: "bid",
                variant: p,
                compactPadding: f
            }), m[20] = f, m[21] = h.type, m[22] = p, m[23] = d) : d = m[23], m[24] !== x || m[25] !== g || m[26] !== s || m[27] !== i || m[28] !== r || m[29] !== o || m[30] !== a || m[31] !== l || m[32] !== c || m[33] !== d ? (u = (0, t.jsxs)(ec, {
                state: x,
                style: g,
                children: [s, i, r, o, a, l, c, d]
            }), m[24] = x, m[25] = g, m[26] = s, m[27] = i, m[28] = r, m[29] = o, m[30] = a, m[31] = l, m[32] = c, m[33] = d, m[34] = u) : u = m[34], u
        },
        eu = ({
            parent: e,
            estimatedHeight: t,
            prefer: n
        }) => e && "parent" === n && e.clientHeight ? e.clientHeight : t,
        em = ({
            askCount: e
        }) => Math.max(e, 1) + 1,
        eh = ({
            spreadIndex: e,
            height: t
        }) => 36 * e - t / 2,
        ep = d.default.memo(({
            className: e,
            compactPadding: n = !1,
            variant: s = "default",
            maxHeight: m,
            exists: h,
            accessors: g,
            options: k = {},
            selectedOutcomeIdx: S,
            market: C,
            activeTick: j,
            onHeightChange: w
        }) => {
            let T = (0, r.useDeferredMounted)({
                    wait: 700
                }),
                N = (0, u.default)(),
                {
                    asks: I,
                    bids: E,
                    defer: O
                } = (0, b.useSides)(g),
                M = (0, p.useBookContainer)(g.id, g.view, g.book),
                [P, A] = (0, c.useAnimate)(),
                R = (0, i.useComposedRefs)(M, P),
                z = d.default.useRef(() => {}),
                {
                    styles: L,
                    height: D
                } = d.default.useMemo(() => {
                    var e, t;
                    let n, s;
                    return e = I.length, t = E.length, s = Math.min(Math.max((Math.max(e, 1) + Math.max(t, 1) + 2) * 36, 144), n = m || 360), {
                        styles: {
                            "--height": `${!h?n:s}px`,
                            "--max-height": `${n}px`,
                            "--min-height": "144px"
                        },
                        height: h ? s : n
                    }
                }, [I.length, E.length, h, m]),
                {
                    getStickyState: F,
                    rangeExtractor: _
                } = (0, y.useRangeExtractor)(Math.max(I.length, 1), Math.max(E.length, 1), 36, D, T),
                B = d.default.useCallback((e = "auto", t = !0) => {
                    z.current(e, t)
                }, []),
                H = (0, f.useOrderBookOptions)(k, B),
                {
                    rows: $,
                    itemCount: U
                } = (0, x.useOrderBook)(I, E, g, s, S, C, j, H, n, h),
                [q] = d.default.useState(() => (({
                    askCount: e,
                    parent: t,
                    height: n
                }) => eh({
                    spreadIndex: em({
                        askCount: e
                    }),
                    height: eu({
                        parent: t,
                        estimatedHeight: n,
                        prefer: "parent"
                    })
                }))({
                    askCount: I.length,
                    parent: M.current,
                    height: D
                })),
                W = (0, a.useVirtualizer)({
                    count: U,
                    estimateSize: () => 36,
                    getScrollElement: () => M.current,
                    initialOffset: q,
                    rangeExtractor: _,
                    overscan: 3,
                    useAnimationFrameWithResizeObserver: !1
                }),
                {
                    applyStatus: K
                } = (0, v.useSpreadAnchor)(I.length, 36, N, W),
                V = d.default.useCallback(({
                    timeout: e = 200,
                    onEnd: t
                }) => {
                    O("start"), K("start"), setTimeout(() => {
                        O("end");
                        let {
                            shouldUpdate: e
                        } = K("end");
                        t(e)
                    }, e)
                }, []),
                Q = d.default.useCallback((e = "auto", t = !0) => {
                    let n = (e = "auto") => {
                        W.scrollToOffset(eh({
                            spreadIndex: em({
                                askCount: I.length
                            }),
                            height: eu({
                                parent: M.current,
                                estimatedHeight: D,
                                prefer: T ? "estimated" : "parent"
                            })
                        }), {
                            align: "start",
                            behavior: e
                        })
                    };
                    t || V({
                        timeout: 200,
                        onEnd: e => {
                            e && n("auto")
                        }
                    }), requestAnimationFrame(() => n(e))
                }, [I.length, D, W, T]);
            return d.default.useEffect(() => {
                z.current = Q
            }, [Q]), d.default.useEffect(() => {
                w ? .(D), A(P.current, {
                    height: `${D}px`
                }, {
                    duration: .125,
                    ease: (0, l.cubicBezier)(.77, 0, .175, 1)
                }).then(() => {
                    B("auto", !1)
                })
            }, [D]), d.default.useEffect(() => {
                requestAnimationFrame(() => {
                    B("auto", !1)
                })
            }, [N]), (0, t.jsx)("div", {
                ref: R,
                className: (0, o.cn)("relative w-full h-full max-h-[var(--max-height)] overflow-y-auto", e),
                style: L,
                children: (0, t.jsx)(ef, {
                    height: W.getTotalSize(),
                    items: W.getVirtualItems(),
                    rows: $,
                    variant: s,
                    compactPadding: n,
                    getStickyState: F
                })
            })
        }),
        ef = e => {
            let s, i, r, o = (0, n.c)(16),
                {
                    height: a,
                    items: l,
                    rows: c,
                    variant: d,
                    compactPadding: u,
                    getStickyState: m
                } = e,
                h = `${a}px`;
            if (o[0] !== h ? (s = {
                    height: h,
                    width: "100%",
                    position: "relative"
                }, o[0] = h, o[1] = s) : s = o[1], o[2] !== u || o[3] !== m || o[4] !== l || o[5] !== c || o[6] !== d) {
                let e;
                o[8] !== u || o[9] !== m || o[10] !== c || o[11] !== d ? (e = e => (0, t.jsx)(ed, {
                    row: c[e.index],
                    variant: d,
                    compactPadding: u,
                    state: m(e.index),
                    style: {
                        "--start": `${e.start}px`,
                        "--size": `${e.size}px`
                    }
                }, e.index), o[8] = u, o[9] = m, o[10] = c, o[11] = d, o[12] = e) : e = o[12], i = l.map(e), o[2] = u, o[3] = m, o[4] = l, o[5] = c, o[6] = d, o[7] = i
            } else i = o[7];
            return o[13] !== s || o[14] !== i ? (r = (0, t.jsx)("div", {
                style: s,
                children: i
            }), o[13] = s, o[14] = i, o[15] = r) : r = o[15], r
        },
        eg = d.default.memo(e => {
            let i, r, o, a, l, c, d, u = (0, n.c)(22);
            u[0] === Symbol.for("react.memo_cache_sentinel") ? (i = ["selectedOutcomeIdx"], u[0] = i) : i = u[0];
            let {
                selectedOutcomeIdx: p
            } = (0, m.useTradeContext)(i);
            u[1] !== e.market ? (r = (0, h.getAssetId)(e.market), u[1] = e.market, u[2] = r) : r = u[2], u[3] !== e.market.orderPriceMinTickSize || u[4] !== r ? (o = {
                assetId: r,
                originalMarketTickSize: e.market.orderPriceMinTickSize
            }, u[3] = e.market.orderPriceMinTickSize, u[4] = r, u[5] = o) : o = u[5];
            let {
                assetId: f,
                originalMarketTickSize: x
            } = o;
            u[6] !== f ? (a = e => e.byAsset[f] ? .tickSizes, u[6] = f, u[7] = a) : a = u[7];
            let y = (0, s.useBooksStore)(a);
            e: {
                if (y) {
                    if (0 !== y.active) {
                        l = y.active;
                        break e
                    }
                    if (y.market && 0 !== y.market && y.market !== x) {
                        l = y.market;
                        break e
                    }
                }
                l = x
            }
            let v = l,
                b = (0, g.useBookAccessors)(f, p, e.market),
                k = (0, g.useMinifiedBookState)(b.id, b.view),
                S = (0, g.useBookExists)(b.id, b.view),
                C = `${k.minified?"minified":"expanded"}-${k.zero.askCount}-${k.zero.bidCount}`;
            u[8] !== b.book || u[9] !== b.id || u[10] !== b.view || u[11] !== S || u[12] !== p || u[13] !== C ? (c = (({
                id: e,
                view: t,
                book: n,
                outcomeIdx: s,
                minified: i,
                exists: r
            }) => `${e}-${t}-${n}-${s}-${i}-${r?"exists":"not-exists"}`)({
                id: b.id,
                view: b.view,
                book: b.book,
                outcomeIdx: p,
                minified: C,
                exists: S
            }), u[8] = b.book, u[9] = b.id, u[10] = b.view, u[11] = S, u[12] = p, u[13] = C, u[14] = c) : c = u[14];
            let j = c;
            return u[15] !== b || u[16] !== v || u[17] !== S || u[18] !== j || u[19] !== e || u[20] !== p ? (d = (0, t.jsx)(ep, {
                exists: S,
                accessors: b,
                selectedOutcomeIdx: p,
                activeTick: v,
                ...e
            }, j), u[15] = b, u[16] = v, u[17] = S, u[18] = j, u[19] = e, u[20] = p, u[21] = d) : d = u[21], d
        });
    e.s(["OrderBook", 0, eg], 328951)
}, 466352, e => {
    "use strict";
    var t = e.i(416340),
        n = e.i(197994);
    e.s(["IconPlusFill18", 0, ({ ...e
    }) => t.default.createElement(n.Icon, {
        size: "18px",
        ...e
    }, t.default.createElement("path", {
        d: "M14.75,9.75H3.25c-.414,0-.75-.336-.75-.75s.336-.75,.75-.75H14.75c.414,0,.75,.336,.75,.75s-.336,.75-.75,.75Z",
        fill: "currentColor",
        "data-color": "color-2"
    }), t.default.createElement("path", {
        d: "M9,15.5c-.414,0-.75-.336-.75-.75V3.25c0-.414,.336-.75,.75-.75s.75,.336,.75,.75V14.75c0,.414-.336,.75-.75,.75Z",
        fill: "currentColor"
    }))])
}, 104310, e => {
    "use strict";
    var t = e.i(416340),
        n = e.i(197994);
    e.s(["IconMinusFill18", 0, ({ ...e
    }) => t.default.createElement(n.Icon, {
        size: "18px",
        ...e
    }, t.default.createElement("path", {
        d: "M14.75,9.75H3.25c-.414,0-.75-.336-.75-.75s.336-.75,.75-.75H14.75c.414,0,.75,.336,.75,.75s-.336,.75-.75,.75Z",
        fill: "currentColor"
    }))])
}, 897535, e => {
    "use strict";
    var t = e.i(999061),
        n = e.i(964974),
        s = e.i(57096),
        i = e.i(655740),
        r = e.i(784521),
        o = e.i(631222),
        a = e.i(510954);
    let l = async e => {
        let [t, n, s, r] = e.queryKey, a = `${o.DATA_API}/other?id=${r}&user=${s}`;
        return await i.axios.get(a).then(({
            data: e
        }) => e)
    };
    e.s(["default", 0, e => {
        let i, o, c, d, u = (0, t.c)(10);
        u[0] === Symbol.for("react.memo_cache_sentinel") ? (i = ["proxyAddress"], u[0] = i) : i = u[0];
        let {
            proxyAddress: m
        } = (0, r.useAccountContext)(i);
        u[1] !== e.id || u[2] !== m ? (o = a.queryKeys[s.QueryKey.Positions].negRiskOther(m, e.id), u[1] = e.id, u[2] = m, u[3] = o) : o = u[3];
        let h = !!e && !0 === e.negRiskAugmented && !!m;
        u[4] !== o.queryKey || u[5] !== h ? (c = {
            queryKey: o.queryKey,
            queryFn: l,
            enabled: h
        }, u[4] = o.queryKey, u[5] = h, u[6] = c) : c = u[6];
        let {
            data: p,
            refetch: f
        } = (0, n.useQuery)(c), g = p ? .[0] ? .size ? ? 0;
        return u[7] !== g || u[8] !== f ? (d = {
            size: g,
            refetch: f
        }, u[7] = g, u[8] = f, u[9] = d) : d = u[9], d
    }])
}, 27235, e => {
    "use strict";
    e.s(["TRADES_TO_SHOW_COUNT", () => j, "default", () => T, "renderHistoryList", () => C], 27235);
    var t = e.i(221628),
        n = e.i(999061),
        s = e.i(23128),
        i = e.i(525962),
        r = e.i(254380),
        o = e.i(169010),
        a = e.i(491636),
        l = e.i(416340),
        c = e.i(16674),
        d = e.i(390960),
        u = e.i(827525),
        m = e.i(415142),
        h = e.i(604777),
        p = e.i(870555),
        f = e.i(98191);
    let g = e => {
        let i, r, o, a, d, g, x, y, v, b, k, S, j, w, T, N, I, E = (0, n.c)(43),
            {
                filledOrders: O,
                activeMarket: M,
                viewAll: P,
                isFetchingNextPage: A,
                hasNextPage: R,
                fetchNextPage: z
            } = e,
            L = (0, h.useTranslations)(),
            [D, F] = l.default.useState(!1);
        E[0] === Symbol.for("react.memo_cache_sentinel") ? (i = {
            threshold: .1
        }, E[0] = i) : i = E[0];
        let {
            ref: _,
            inView: B
        } = (0, c.useInView)(i);
        E[1] !== z || E[2] !== O || E[3] !== R || E[4] !== B || E[5] !== A ? (r = () => {
            B && R && Array.isArray(O) && !A && z && z()
        }, o = [O, R, z, A, B], E[1] = z, E[2] = O, E[3] = R, E[4] = B, E[5] = A, E[6] = r, E[7] = o) : (r = E[6], o = E[7]), l.default.useEffect(r, o);
        let H = P && "hidden";
        return E[8] !== H ? (a = (0, p.cn)("text-text bg-transparent border-none p-0 text-base font-semibold mt-4 underline outline-none hover:opacity-80 hover:cursor-pointer focus:outline-none active:outline-none", H), E[8] = H, E[9] = a) : a = E[9], E[10] !== L ? (d = L("footer.viewMore"), E[10] = L, E[11] = d) : d = E[11], E[12] !== a || E[13] !== d ? (g = (0, t.jsx)(u.Drawer.Trigger, {
            className: a,
            children: d
        }), E[12] = a, E[13] = d, E[14] = g) : g = E[14], E[15] === Symbol.for("react.memo_cache_sentinel") ? (x = (0, t.jsx)(u.Drawer.Overlay, {
            className: "fixed inset-0 bg-black/40 z-[calc(var(--z-drawer)+10)]"
        }), E[15] = x) : x = E[15], E[16] !== L ? (y = L("rewards.trading.tradeHistory"), E[16] = L, E[17] = y) : y = E[17], E[18] !== y ? (v = (0, t.jsx)(m.VisuallyHidden.Root, {
            children: (0, t.jsx)(u.Drawer.Title, {
                children: y
            })
        }), E[18] = y, E[19] = v) : v = E[19], E[20] === Symbol.for("react.memo_cache_sentinel") ? (b = (0, t.jsx)(u.Drawer.Handle, {
            className: "mt-1.5"
        }), E[20] = b) : b = E[20], E[21] !== L ? (k = L("rewards.trading.history"), E[21] = L, E[22] = k) : k = E[22], E[23] !== k ? (S = (0, t.jsx)("div", {
            className: "flex shrink-0 pt-6 pb-3 w-full border-b border-border-secondary",
            children: (0, t.jsx)(u.Drawer.Title, {
                className: "ml-4",
                children: k
            })
        }), E[23] = k, E[24] = S) : S = E[24], E[25] !== M || E[26] !== O ? (j = C(O, M), E[25] = M, E[26] = O, E[27] = j) : j = E[27], E[28] !== R || E[29] !== A || E[30] !== _ ? (w = R ? (0, t.jsx)("div", {
            className: "flex w-full justify-center",
            ref: _,
            children: (0, t.jsx)(s.Button, {
                className: "bg-transparent mx-4 text-text-secondary cursor-pointer text-base",
                children: A && (0, t.jsx)(f.default, {
                    height: "32px",
                    width: "32px"
                })
            })
        }) : null, E[28] = R, E[29] = A, E[30] = _, E[31] = w) : w = E[31], E[32] !== j || E[33] !== w ? (T = (0, t.jsxs)("div", {
            className: "flex-1 min-h-0 overflow-y-auto overscroll-contain px-4 pb-[env(safe-area-inset-bottom)]",
            children: [j, w]
        }), E[32] = j, E[33] = w, E[34] = T) : T = E[34], E[35] !== v || E[36] !== S || E[37] !== T ? (N = (0, t.jsxs)(u.Drawer.Portal, {
            children: [x, (0, t.jsxs)(u.Drawer.Content, {
                "aria-describedby": void 0,
                className: "fixed inset-x-0 bottom-0 top-3.5 z-[calc(var(--z-drawer)+11)] flex flex-col rounded-t-2xl bg-background pt-2",
                children: [v, b, S, T]
            })]
        }), E[35] = v, E[36] = S, E[37] = T, E[38] = N) : N = E[38], E[39] !== D || E[40] !== N || E[41] !== g ? (I = (0, t.jsxs)(u.Drawer.Root, {
            open: D,
            onOpenChange: F,
            shouldScaleBackground: !1,
            direction: "bottom",
            modal: !1,
            preventScrollRestoration: !0,
            children: [g, N]
        }), E[39] = D, E[40] = N, E[41] = g, E[42] = I) : I = E[42], I
    };
    var x = e.i(864006),
        y = e.i(131878),
        v = e.i(781577),
        b = e.i(660006);
    let k = e => {
            let i, r, o, a, d, u = (0, n.c)(13),
                {
                    filledOrders: m,
                    isFetchingNextPage: h,
                    hasNextPage: p,
                    fetchNextPage: g
                } = e;
            u[0] === Symbol.for("react.memo_cache_sentinel") ? (i = {
                threshold: 0
            }, u[0] = i) : i = u[0];
            let {
                ref: x,
                inView: y
            } = (0, c.useInView)(i);
            return (u[1] !== g || u[2] !== m || u[3] !== p || u[4] !== y || u[5] !== h ? (r = () => {
                y && p && Array.isArray(m) && !h && g && g()
            }, o = [m, p, g, h, y], u[1] = g, u[2] = m, u[3] = p, u[4] = y, u[5] = h, u[6] = r, u[7] = o) : (r = u[6], o = u[7]), l.default.useEffect(r, o), Array.isArray(m) && 0 !== m.length && p) ? (u[8] !== h ? (a = h && (0, t.jsx)(f.default, {
                height: "32px",
                width: "32px"
            }), u[8] = h, u[9] = a) : a = u[9], u[10] !== x || u[11] !== a ? (d = (0, t.jsx)("div", {
                className: "w-full flex justify-center",
                children: (0, t.jsx)(s.Button, {
                    variant: "ghost",
                    ref: x,
                    className: "mx-4 text-text-secondary",
                    children: a
                })
            }), u[10] = x, u[11] = a, u[12] = d) : d = u[12], d) : null
        },
        S = e => {
            let s, i, r, c, u, m, h, f, g, k, S, C, j, w, T = (0, n.c)(39),
                {
                    item: N,
                    outcomeIndex: I
                } = e,
                {
                    outcome: E,
                    side: O,
                    price: M,
                    filledSize: P,
                    totalValue: A,
                    match_time: R,
                    transaction_hash: z
                } = N,
                L = (0, x.useLocale)(),
                D = (0, x.useMessages)().time,
                F = new Date(1e3 * Number(R)),
                _ = (e => {
                    let t, s, i, r, o = (0, n.c)(9),
                        a = (0, x.useLocale)();
                    o[0] !== a ? (t = (0, d.getDateFnsLocale)(a), o[0] = a, o[1] = t) : t = o[1];
                    let c = t;
                    o[2] !== c || o[3] !== e ? (s = () => {
                        if (!e) return "";
                        try {
                            let t = new Date,
                                n = new Date(1e3 * e);
                            return (0, v.formatDistanceStrict)(n, t, {
                                locale: c
                            })
                        } catch (t) {
                            return (0, b.handleError)(t, "[useLiveRelativeTime > initial]", "nouser", "", {
                                timestamp: e
                            }), "n/a"
                        }
                    }, o[2] = c, o[3] = e, o[4] = s) : s = o[4];
                    let [u, m] = (0, l.useState)(s);
                    return o[5] !== c || o[6] !== e ? (i = () => {
                        if (!e) return;
                        let t = () => {
                            try {
                                let t = new Date,
                                    n = new Date(1e3 * e),
                                    s = (0, v.formatDistanceStrict)(n, t, {
                                        locale: c
                                    });
                                m(s)
                            } catch (t) {
                                (0, b.handleError)(t, "[useLiveRelativeTime > updateTime]", "nouser", "", {
                                    timestamp: e
                                })
                            }
                        };
                        t();
                        let n = setInterval(t, 1e3);
                        return () => clearInterval(n)
                    }, r = [e, c], o[5] = c, o[6] = e, o[7] = i, o[8] = r) : (i = o[7], r = o[8]), (0, l.useEffect)(i, r), u
                })(Number(R)),
                B = "BUY" === O ? "Bought" : "Sold",
                H = 0 === I ? "text-green-600 dark:text-green-500" : "text-red-500";
            if (T[0] !== H ? (s = (0, p.cn)(H), T[0] = H, T[1] = s) : s = T[1], T[2] !== P ? (i = P.toFixed(2 * (P < 10)), T[2] = P, T[3] = i) : i = T[3], T[4] !== E || T[5] !== s || T[6] !== i ? (r = (0, t.jsxs)("span", {
                    className: s,
                    children: [i, " ", E]
                }), T[4] = E, T[5] = s, T[6] = i, T[7] = r) : r = T[7], T[8] !== M) {
                let e;
                c = Number.isFinite(e = 100 * parseFloat(M)) ? 1e-9 > Math.abs(e - Math.round(e)) ? Math.round(e).toString() : e.toFixed(1) : "NaN", T[8] = M, T[9] = c
            } else c = T[9];
            T[10] !== A ? (u = A.toFixed(2), T[10] = A, T[11] = u) : u = T[11], T[12] !== u ? (m = (0, t.jsxs)("span", {
                className: "text-text-secondary font-normal",
                children: ["($", u, ")"]
            }), T[12] = u, T[13] = m) : m = T[13], T[14] !== m || T[15] !== B || T[16] !== r || T[17] !== c ? (h = (0, t.jsxs)("p", {
                children: [B, " ", r, "  at ", c, "¢ ", m]
            }), T[14] = m, T[15] = B, T[16] = r, T[17] = c, T[18] = h) : h = T[18];
            let $ = o.Tooltip,
                U = (0, a.format)(F, "MMMM d, yyyy", {
                    locale: (0, d.getDateFnsLocale)(L)
                });
            T[19] === Symbol.for("react.memo_cache_sentinel") ? (f = (0, t.jsx)("span", {
                children: ","
            }), T[19] = f) : f = T[19];
            let q = (0, a.format)(F, "p", {
                locale: (0, d.getDateFnsLocale)(L)
            });
            T[20] !== U || T[21] !== f || T[22] !== q ? (g = (0, t.jsxs)("p", {
                children: [U, f, " ", q]
            }), T[20] = U, T[21] = f, T[22] = q, T[23] = g) : g = T[23];
            let W = `https://polygonscan.com/tx/${z}`;
            return T[24] !== _ || T[25] !== D ? (k = (0, y.abbreviateTime)(_, D), T[24] = _, T[25] = D, T[26] = k) : k = T[26], T[27] !== k ? (S = (0, t.jsx)("p", {
                className: "text-text-secondary whitespace-nowrap hover:text-text-primary text-[13px]",
                children: k
            }), T[27] = k, T[28] = S) : S = T[28], T[29] !== W || T[30] !== S ? (C = (0, t.jsx)("a", {
                target: "_blank",
                rel: "noopener noreferrer",
                href: W,
                children: S
            }), T[29] = W, T[30] = S, T[31] = C) : C = T[31], T[32] !== $ || T[33] !== g || T[34] !== C ? (j = (0, t.jsx)($, {
                showArrow: !1,
                sideOffset: 6,
                className: "text-xs font-medium",
                content: g,
                triggerAsChild: !0,
                children: C
            }), T[32] = $, T[33] = g, T[34] = C, T[35] = j) : j = T[35], T[36] !== h || T[37] !== j ? (w = (0, t.jsxs)("div", {
                className: "flex items-center py-4 justify-between w-full font-medium text-sm gap-1",
                children: [h, j]
            }), T[36] = h, T[37] = j, T[38] = w) : w = T[38], w
        },
        C = (e, n) => e.map(e => {
            let s = `${e.outcome}-${e.side}-${e.price}-${e.filledSize}-${e.orderID}-${e.timestamp}-${e.match_time}`,
                i = +(n ? .outcomes[0] !== e.outcome);
            return (0, t.jsx)("div", {
                className: "border-b last:border-b-0",
                children: (0, t.jsx)(S, {
                    item: e,
                    outcomeIndex: i
                })
            }, s)
        }),
        j = 3,
        w = e => {
            let o, a, c, d, u, m, f, g, x, y, v = (0, n.c)(31),
                {
                    filledOrders: b,
                    activeMarket: S,
                    fetchNextPage: w,
                    hasNextPage: T,
                    isFetchingNextPage: N,
                    viewAll: I,
                    omitHeader: E
                } = e,
                O = (0, h.useTranslations)(),
                M = l.default.useRef(null);
            if (b.length <= j) return null;
            let P = E ? "ghost" : "tertiary",
                A = E ? void 0 : "sm",
                R = E ? "mt-2 text-sm text-text-secondary" : "text-[13px]",
                z = I ? "hidden" : "flex";
            return v[0] !== R || v[1] !== z ? (o = (0, p.cn)(R, z), v[0] = R, v[1] = z, v[2] = o) : o = v[2], v[3] !== O ? (a = O("dashboards.viewAll"), v[3] = O, v[4] = a) : a = v[4], v[5] !== P || v[6] !== A || v[7] !== o || v[8] !== a ? (c = (0, t.jsx)(i.ModalTrigger, {
                asChild: !0,
                children: (0, t.jsx)(s.Button, {
                    variant: P,
                    size: A,
                    className: o,
                    children: a
                })
            }), v[5] = P, v[6] = A, v[7] = o, v[8] = a, v[9] = c) : c = v[9], v[10] !== O ? (d = O("events.tabs.history"), v[10] = O, v[11] = d) : d = v[11], v[12] !== d ? (u = (0, t.jsx)(i.ModalHeader, {
                children: (0, t.jsx)(i.ModalTitle, {
                    children: d
                })
            }), v[12] = d, v[13] = u) : u = v[13], v[14] !== S || v[15] !== b ? (m = C(b, S), v[14] = S, v[15] = b, v[16] = m) : m = v[16], v[17] !== w || v[18] !== b || v[19] !== T || v[20] !== N ? (f = (0, t.jsx)(k, {
                fetchNextPage: w,
                hasNextPage: T,
                isFetchingNextPage: N,
                filledOrders: b
            }), v[17] = w, v[18] = b, v[19] = T, v[20] = N, v[21] = f) : f = v[21], v[22] !== m || v[23] !== f ? (g = (0, t.jsxs)(r.ScrollContainer, {
                orientation: "vertical",
                containerRef: M,
                className: "overflow-y-auto max-h-[45vh] px-6",
                wrapperClassName: "-mx-6",
                children: [m, f]
            }), v[22] = m, v[23] = f, v[24] = g) : g = v[24], v[25] !== g || v[26] !== u ? (x = (0, t.jsxs)(i.ModalContent, {
                children: [u, g]
            }), v[25] = g, v[26] = u, v[27] = x) : x = v[27], v[28] !== x || v[29] !== c ? (y = (0, t.jsxs)(i.Modal, {
                children: [c, x]
            }), v[28] = x, v[29] = c, v[30] = y) : y = v[30], y
        },
        T = e => {
            let s, i, r, o, a, l, c, d, u = (0, n.c)(47),
                {
                    filledOrders: m,
                    isAuthenticated: f,
                    omitHeader: x,
                    containerClassName: y,
                    containerStyle: v,
                    activeMarket: b,
                    viewAll: S,
                    fetchNextPage: T,
                    hasNextPage: N,
                    isFetchingNextPage: I
                } = e,
                E = (0, h.useTranslations)();
            if (!f || !m ? .length) return null;
            let O = S && "max-h-[200px] overflow-y-scroll";
            return u[0] !== y || u[1] !== O ? (s = (0, p.cn)(O, y), u[0] = y, u[1] = O, u[2] = s) : s = u[2], u[3] !== b || u[4] !== T || u[5] !== m || u[6] !== N || u[7] !== I || u[8] !== x || u[9] !== E || u[10] !== S ? (i = !x && (0, t.jsxs)("div", {
                className: "flex w-full items-center justify-between border-b pb-3",
                children: [(0, t.jsx)("h3", {
                    className: "font-medium",
                    children: E("events.tabs.history")
                }), (0, t.jsx)("div", {
                    className: "hidden lg:contents",
                    children: (0, t.jsx)(w, {
                        filledOrders: m,
                        activeMarket: b,
                        fetchNextPage: T,
                        hasNextPage: N,
                        isFetchingNextPage: I,
                        viewAll: S,
                        omitHeader: !1
                    })
                })]
            }), u[3] = b, u[4] = T, u[5] = m, u[6] = N, u[7] = I, u[8] = x, u[9] = E, u[10] = S, u[11] = i) : i = u[11], u[12] !== m || u[13] !== S ? (r = S ? m : m.slice(0, j), u[12] = m, u[13] = S, u[14] = r) : r = u[14], u[15] !== b || u[16] !== r ? (o = C(r, b), u[15] = b, u[16] = r, u[17] = o) : o = u[17], u[18] !== T || u[19] !== m || u[20] !== N || u[21] !== I || u[22] !== S ? (a = S ? (0, t.jsx)(k, {
                fetchNextPage: T,
                hasNextPage: N,
                isFetchingNextPage: I,
                filledOrders: m
            }) : null, u[18] = T, u[19] = m, u[20] = N, u[21] = I, u[22] = S, u[23] = a) : a = u[23], u[24] !== b || u[25] !== T || u[26] !== m || u[27] !== N || u[28] !== I || u[29] !== x || u[30] !== S ? (l = x && (0, t.jsx)("div", {
                className: "hidden lg:contents",
                children: (0, t.jsx)(w, {
                    filledOrders: m,
                    activeMarket: b,
                    fetchNextPage: T,
                    hasNextPage: N,
                    isFetchingNextPage: I,
                    viewAll: S,
                    omitHeader: !0
                })
            }), u[24] = b, u[25] = T, u[26] = m, u[27] = N, u[28] = I, u[29] = x, u[30] = S, u[31] = l) : l = u[31], u[32] !== b || u[33] !== T || u[34] !== m || u[35] !== N || u[36] !== I || u[37] !== S ? (c = m.length > j && (0, t.jsx)("div", {
                className: "contents lg:hidden",
                children: (0, t.jsx)(g, {
                    filledOrders: m,
                    activeMarket: b,
                    viewAll: S,
                    isFetchingNextPage: I,
                    hasNextPage: N,
                    fetchNextPage: T
                })
            }), u[32] = b, u[33] = T, u[34] = m, u[35] = N, u[36] = I, u[37] = S, u[38] = c) : c = u[38], u[39] !== v || u[40] !== s || u[41] !== i || u[42] !== o || u[43] !== a || u[44] !== l || u[45] !== c ? (d = (0, t.jsxs)("div", {
                className: s,
                style: v,
                children: [i, o, a, l, c]
            }), u[39] = v, u[40] = s, u[41] = i, u[42] = o, u[43] = a, u[44] = l, u[45] = c, u[46] = d) : d = u[46], d
        }
}, 910059, (e, t, n) => {
    t.exports = [{
        constant: !0,
        inputs: [{
            name: "owner",
            type: "address"
        }, {
            name: "id",
            type: "uint256"
        }],
        name: "balanceOf",
        outputs: [{
            name: "",
            type: "uint256"
        }],
        payable: !1,
        stateMutability: "view",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "interfaceId",
            type: "bytes4"
        }],
        name: "supportsInterface",
        outputs: [{
            name: "",
            type: "bool"
        }],
        payable: !1,
        stateMutability: "view",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "",
            type: "bytes32"
        }, {
            name: "",
            type: "uint256"
        }],
        name: "payoutNumerators",
        outputs: [{
            name: "",
            type: "uint256"
        }],
        payable: !1,
        stateMutability: "view",
        type: "function"
    }, {
        constant: !1,
        inputs: [{
            name: "from",
            type: "address"
        }, {
            name: "to",
            type: "address"
        }, {
            name: "ids",
            type: "uint256[]"
        }, {
            name: "values",
            type: "uint256[]"
        }, {
            name: "data",
            type: "bytes"
        }],
        name: "safeBatchTransferFrom",
        outputs: [],
        payable: !1,
        stateMutability: "nonpayable",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "owners",
            type: "address[]"
        }, {
            name: "ids",
            type: "uint256[]"
        }],
        name: "balanceOfBatch",
        outputs: [{
            name: "",
            type: "uint256[]"
        }],
        payable: !1,
        stateMutability: "view",
        type: "function"
    }, {
        constant: !1,
        inputs: [{
            name: "operator",
            type: "address"
        }, {
            name: "approved",
            type: "bool"
        }],
        name: "setApprovalForAll",
        outputs: [],
        payable: !1,
        stateMutability: "nonpayable",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "",
            type: "bytes32"
        }],
        name: "payoutDenominator",
        outputs: [{
            name: "",
            type: "uint256"
        }],
        payable: !1,
        stateMutability: "view",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "owner",
            type: "address"
        }, {
            name: "operator",
            type: "address"
        }],
        name: "isApprovedForAll",
        outputs: [{
            name: "",
            type: "bool"
        }],
        payable: !1,
        stateMutability: "view",
        type: "function"
    }, {
        constant: !1,
        inputs: [{
            name: "from",
            type: "address"
        }, {
            name: "to",
            type: "address"
        }, {
            name: "id",
            type: "uint256"
        }, {
            name: "value",
            type: "uint256"
        }, {
            name: "data",
            type: "bytes"
        }],
        name: "safeTransferFrom",
        outputs: [],
        payable: !1,
        stateMutability: "nonpayable",
        type: "function"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !0,
            name: "conditionId",
            type: "bytes32"
        }, {
            indexed: !0,
            name: "oracle",
            type: "address"
        }, {
            indexed: !0,
            name: "questionId",
            type: "bytes32"
        }, {
            indexed: !1,
            name: "outcomeSlotCount",
            type: "uint256"
        }],
        name: "ConditionPreparation",
        type: "event"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !0,
            name: "conditionId",
            type: "bytes32"
        }, {
            indexed: !0,
            name: "oracle",
            type: "address"
        }, {
            indexed: !0,
            name: "questionId",
            type: "bytes32"
        }, {
            indexed: !1,
            name: "outcomeSlotCount",
            type: "uint256"
        }, {
            indexed: !1,
            name: "payoutNumerators",
            type: "uint256[]"
        }],
        name: "ConditionResolution",
        type: "event"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !0,
            name: "stakeholder",
            type: "address"
        }, {
            indexed: !1,
            name: "collateralToken",
            type: "address"
        }, {
            indexed: !0,
            name: "parentCollectionId",
            type: "bytes32"
        }, {
            indexed: !0,
            name: "conditionId",
            type: "bytes32"
        }, {
            indexed: !1,
            name: "partition",
            type: "uint256[]"
        }, {
            indexed: !1,
            name: "amount",
            type: "uint256"
        }],
        name: "PositionSplit",
        type: "event"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !0,
            name: "stakeholder",
            type: "address"
        }, {
            indexed: !1,
            name: "collateralToken",
            type: "address"
        }, {
            indexed: !0,
            name: "parentCollectionId",
            type: "bytes32"
        }, {
            indexed: !0,
            name: "conditionId",
            type: "bytes32"
        }, {
            indexed: !1,
            name: "partition",
            type: "uint256[]"
        }, {
            indexed: !1,
            name: "amount",
            type: "uint256"
        }],
        name: "PositionsMerge",
        type: "event"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !0,
            name: "redeemer",
            type: "address"
        }, {
            indexed: !0,
            name: "collateralToken",
            type: "address"
        }, {
            indexed: !0,
            name: "parentCollectionId",
            type: "bytes32"
        }, {
            indexed: !1,
            name: "conditionId",
            type: "bytes32"
        }, {
            indexed: !1,
            name: "indexSets",
            type: "uint256[]"
        }, {
            indexed: !1,
            name: "payout",
            type: "uint256"
        }],
        name: "PayoutRedemption",
        type: "event"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !0,
            name: "operator",
            type: "address"
        }, {
            indexed: !0,
            name: "from",
            type: "address"
        }, {
            indexed: !0,
            name: "to",
            type: "address"
        }, {
            indexed: !1,
            name: "id",
            type: "uint256"
        }, {
            indexed: !1,
            name: "value",
            type: "uint256"
        }],
        name: "TransferSingle",
        type: "event"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !0,
            name: "operator",
            type: "address"
        }, {
            indexed: !0,
            name: "from",
            type: "address"
        }, {
            indexed: !0,
            name: "to",
            type: "address"
        }, {
            indexed: !1,
            name: "ids",
            type: "uint256[]"
        }, {
            indexed: !1,
            name: "values",
            type: "uint256[]"
        }],
        name: "TransferBatch",
        type: "event"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !0,
            name: "owner",
            type: "address"
        }, {
            indexed: !0,
            name: "operator",
            type: "address"
        }, {
            indexed: !1,
            name: "approved",
            type: "bool"
        }],
        name: "ApprovalForAll",
        type: "event"
    }, {
        anonymous: !1,
        inputs: [{
            indexed: !1,
            name: "value",
            type: "string"
        }, {
            indexed: !0,
            name: "id",
            type: "uint256"
        }],
        name: "URI",
        type: "event"
    }, {
        constant: !1,
        inputs: [{
            name: "oracle",
            type: "address"
        }, {
            name: "questionId",
            type: "bytes32"
        }, {
            name: "outcomeSlotCount",
            type: "uint256"
        }],
        name: "prepareCondition",
        outputs: [],
        payable: !1,
        stateMutability: "nonpayable",
        type: "function"
    }, {
        constant: !1,
        inputs: [{
            name: "questionId",
            type: "bytes32"
        }, {
            name: "payouts",
            type: "uint256[]"
        }],
        name: "reportPayouts",
        outputs: [],
        payable: !1,
        stateMutability: "nonpayable",
        type: "function"
    }, {
        constant: !1,
        inputs: [{
            name: "collateralToken",
            type: "address"
        }, {
            name: "parentCollectionId",
            type: "bytes32"
        }, {
            name: "conditionId",
            type: "bytes32"
        }, {
            name: "partition",
            type: "uint256[]"
        }, {
            name: "amount",
            type: "uint256"
        }],
        name: "splitPosition",
        outputs: [],
        payable: !1,
        stateMutability: "nonpayable",
        type: "function"
    }, {
        constant: !1,
        inputs: [{
            name: "collateralToken",
            type: "address"
        }, {
            name: "parentCollectionId",
            type: "bytes32"
        }, {
            name: "conditionId",
            type: "bytes32"
        }, {
            name: "partition",
            type: "uint256[]"
        }, {
            name: "amount",
            type: "uint256"
        }],
        name: "mergePositions",
        outputs: [],
        payable: !1,
        stateMutability: "nonpayable",
        type: "function"
    }, {
        constant: !1,
        inputs: [{
            name: "collateralToken",
            type: "address"
        }, {
            name: "parentCollectionId",
            type: "bytes32"
        }, {
            name: "conditionId",
            type: "bytes32"
        }, {
            name: "indexSets",
            type: "uint256[]"
        }],
        name: "redeemPositions",
        outputs: [],
        payable: !1,
        stateMutability: "nonpayable",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "conditionId",
            type: "bytes32"
        }],
        name: "getOutcomeSlotCount",
        outputs: [{
            name: "",
            type: "uint256"
        }],
        payable: !1,
        stateMutability: "view",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "oracle",
            type: "address"
        }, {
            name: "questionId",
            type: "bytes32"
        }, {
            name: "outcomeSlotCount",
            type: "uint256"
        }],
        name: "getConditionId",
        outputs: [{
            name: "",
            type: "bytes32"
        }],
        payable: !1,
        stateMutability: "pure",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "parentCollectionId",
            type: "bytes32"
        }, {
            name: "conditionId",
            type: "bytes32"
        }, {
            name: "indexSet",
            type: "uint256"
        }],
        name: "getCollectionId",
        outputs: [{
            name: "",
            type: "bytes32"
        }],
        payable: !1,
        stateMutability: "view",
        type: "function"
    }, {
        constant: !0,
        inputs: [{
            name: "collateralToken",
            type: "address"
        }, {
            name: "collectionId",
            type: "bytes32"
        }],
        name: "getPositionId",
        outputs: [{
            name: "",
            type: "uint256"
        }],
        payable: !1,
        stateMutability: "pure",
        type: "function"
    }]
}, 189890, 882078, e => {
    "use strict";
    var t = e.i(999061),
        n = e.i(378876),
        s = e.i(416340),
        i = e.i(873054),
        r = e.i(914640),
        o = e.i(910059),
        a = e.i(784521),
        l = e.i(660006),
        c = e.i(631222);
    let d = r.zeroAddress;

    function u() {
        return 0 n
    }

    function m() {
        return 0 n
    }
    var h = e.i(415013),
        p = e.i(966727);
    let f = 1 n << 254 n;

    function g(e, t) {
        let n = e % t;
        return n < 0 n ? n + t : n
    }
    let x = (e, t, n) => {
            var s;
            let i = function(e, t) {
                let n, s, i = (0, h.keccak256)((0, p.encodePacked)(["bytes32", "uint256"], [e, BigInt(t)])),
                    r = "89abcdef".includes(i[2]),
                    o = BigInt(i);
                do o = g(o + 1 n, 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 n), n = function(e) {
                    var t = e,
                        n = (0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 n + 1 n) / 4 n;
                    let s = 1 n;
                    for (t = g(t, 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 n); n > 0 n;) 1 n & n && (s = g(s * t, 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 n)), n >>= 1 n, t = g(t * t, 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 n);
                    return s
                }(s = g(g(o * o, 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 n) * o + 3 n, 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 n)); while (g(n * n, 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 n) !== s) let a = o;
                return r && (a ^= f), `0x${a.toString(16).padStart(64,"0")}`
            }(n, 1 << t);
            return s = c.USDC_ADDRESS, (0, h.keccak256)((0, p.encodePacked)(["address", "uint256"], [s, BigInt(i)]))
        },
        y = e => {
            let n, s = (0, t.c)(5),
                {
                    conditionId: i,
                    outcomes: r
                } = e;
            if (s[0] !== i || s[1] !== r) {
                let e;
                s[3] !== i ? (e = (e, t) => x(e, t, i), s[3] = i, s[4] = e) : e = s[4], n = r.map(e), s[0] = i, s[1] = r, s[2] = n
            } else n = s[2];
            return n
        };
    e.s(["default", 0, y, "getPoolPositionIds", 0, e => e ? .outcomes.map((t, n) => x(t, n, e.conditionId)) ? ? []], 882078);
    var v = e.i(269101),
        b = e.i(845923);

    function k(e) {
        return e > 0 n
    }

    function S(e) {
        return e > 0 n
    }

    function C(e) {
        return e.toString()
    }
    e.s(["default", 0, (e, r) => {
        let h, p, f, g, x, j = (0, t.c)(32),
            w = y(e);
        j[0] === Symbol.for("react.memo_cache_sentinel") ? (h = ["positions"], j[0] = h) : h = j[0];
        let {
            positions: T
        } = (0, v.useEventPositionsContext)(h), {
            poolBalances: N,
            shareBalances: I,
            refreshPoolBalances: E,
            refreshShareBalances: O
        } = ((e, n) => {
            let r, h, p, f, g, x, y, v, b, k, S, C, j, w, T, N, I, E, O, M = (0, t.c)(64);
            M[0] === Symbol.for("react.memo_cache_sentinel") ? (r = ["authenticated", "proxyAddress"], M[0] = r) : r = M[0];
            let {
                authenticated: P,
                proxyAddress: A
            } = (0, a.useAccountContext)(r);
            if (M[1] !== n || M[2] !== e) {
                let t;
                M[4] !== n ? (t = () => n, M[4] = n, M[5] = t) : t = M[5], h = e.map(t), M[1] = n, M[2] = e, M[3] = h
            } else h = M[3];
            M[6] !== e || M[7] !== h ? (p = [h, e], M[6] = e, M[7] = h, M[8] = p) : p = M[8];
            let R = "string" == typeof n && !!n;
            M[9] !== R ? (f = {
                enabled: R,
                gcTime: 3e5
            }, M[9] = R, M[10] = f) : f = M[10], M[11] !== p || M[12] !== f ? (g = {
                address: c.CONDITIONAL_TOKENS_ADDRESS,
                abi: o.default,
                functionName: "balanceOfBatch",
                args: p,
                chainId: 137,
                query: f
            }, M[11] = p, M[12] = f, M[13] = g) : g = M[13];
            let {
                data: z,
                refetch: L,
                isLoading: D,
                isPending: F,
                isFetching: _,
                error: B,
                isError: H
            } = (0, i.useReadContract)(g);
            M[14] !== n || M[15] !== B || M[16] !== H ? (x = () => {
                H && B && (0, l.handleError)(B, "usePositionsBalance > poolData", n)
            }, M[14] = n, M[15] = B, M[16] = H, M[17] = x) : x = M[17], M[18] !== B || M[19] !== H ? (y = [B, H], M[18] = B, M[19] = H, M[20] = y) : y = M[20], s.default.useEffect(x, y);
            let $ = P && !!A;
            if (M[21] !== e || M[22] !== A) {
                let t;
                M[24] !== A ? (t = () => A ? ? d, M[24] = A, M[25] = t) : t = M[25], v = e.map(t), M[21] = e, M[22] = A, M[23] = v
            } else v = M[23];
            M[26] !== e || M[27] !== v ? (b = [v, e], M[26] = e, M[27] = v, M[28] = b) : b = M[28], M[29] !== $ ? (k = {
                enabled: $,
                gcTime: 3e5
            }, M[29] = $, M[30] = k) : k = M[30], M[31] !== b || M[32] !== k ? (S = {
                address: c.CONDITIONAL_TOKENS_ADDRESS,
                abi: o.default,
                functionName: "balanceOfBatch",
                args: b,
                chainId: 137,
                query: k
            }, M[31] = b, M[32] = k, M[33] = S) : S = M[33];
            let {
                data: U,
                refetch: q,
                isLoading: W,
                isPending: K,
                isFetching: V,
                error: Q,
                isError: G
            } = (0, i.useReadContract)(S);
            M[34] !== A || M[35] !== Q || M[36] !== G ? (C = () => {
                G && Q && (0, l.handleError)(Q, "usePositionsBalance > shareData", A)
            }, M[34] = A, M[35] = Q, M[36] = G, M[37] = C) : C = M[37], M[38] !== Q || M[39] !== G ? (j = [Q, G], M[38] = Q, M[39] = G, M[40] = j) : j = M[40], s.default.useEffect(C, j), M[41] !== z || M[42] !== e ? (w = z || e.map(u), M[41] = z, M[42] = e, M[43] = w) : w = M[43];
            let Y = w;
            M[44] !== e || M[45] !== U ? (T = U || e.map(m), M[44] = e, M[45] = U, M[46] = T) : T = M[46];
            let Z = T;
            M[47] !== L ? (N = async () => {
                await L()
            }, M[47] = L, M[48] = N) : N = M[48];
            let X = N;
            M[49] !== q ? (I = async () => {
                await q()
            }, M[49] = q, M[50] = I) : I = M[50];
            let J = I;
            M[51] !== X || M[52] !== J ? (E = async () => {
                await Promise.all([X(), J()])
            }, M[51] = X, M[52] = J, M[53] = E) : E = M[53];
            let ee = E,
                et = D || _,
                en = W || V;
            return M[54] !== F || M[55] !== K || M[56] !== Y || M[57] !== ee || M[58] !== X || M[59] !== J || M[60] !== Z || M[61] !== et || M[62] !== en ? (O = {
                poolBalances: Y,
                shareBalances: Z,
                arePoolBalancesLoading: et,
                areShareBalancesLoading: en,
                arePoolBalancesPending: F,
                areShareBalancesPending: K,
                refreshPoolBalances: X,
                refreshShareBalances: J,
                refreshPoolAndShareBalances: ee
            }, M[54] = F, M[55] = K, M[56] = Y, M[57] = ee, M[58] = X, M[59] = J, M[60] = Z, M[61] = et, M[62] = en, M[63] = O) : O = M[63], O
        })(Array.isArray(r) ? r : w, e.marketMakerAddress);
        e: {
            let t;
            if (I.some(k) && N.some(S)) {
                let t;
                if (j[1] !== e.closed || j[2] !== e.id || j[3] !== e.negRisk || j[4] !== N || j[5] !== I) {
                    let s;
                    j[7] !== e.closed || j[8] !== e.id || j[9] !== e.negRisk || j[10] !== N ? (s = (t, s) => ({
                        outcomeIndex: s.toString(),
                        netQuantity: t.toString(),
                        quantityBought: t.toString(),
                        market: {
                            id: e.id.toString(),
                            outcomeTokenPrices: (0, n.calcPrice)(N).map(C),
                            conditions: [],
                            negRisk: e.negRisk ? ? !1,
                            closed: e.closed ? ? !1
                        }
                    }), j[7] = e.closed, j[8] = e.id, j[9] = e.negRisk, j[10] = N, j[11] = s) : s = j[11], t = I.map(s), j[1] = e.closed, j[2] = e.id, j[3] = e.negRisk, j[4] = N, j[5] = I, j[6] = t
                } else t = j[6];
                p = t;
                break e
            }
            j[12] === Symbol.for("react.memo_cache_sentinel") ? (t = [], j[12] = t) : t = j[12],
            p = t
        }
        let M = p;
        t: {
            let t;
            if (!Array.isArray(T)) {
                let e;
                j[13] === Symbol.for("react.memo_cache_sentinel") ? (e = [], j[13] = e) : e = j[13], f = e;
                break t
            }
            if (j[14] !== e || j[15] !== T) {
                let n;
                j[17] !== e ? (n = t => (0, b.fromPositionToPortfolioItem)(e, t), j[17] = e, j[18] = n) : n = j[18], t = T.map(n).filter(b.filterSharesQty), j[14] = e, j[15] = T, j[16] = t
            } else t = j[16];f = t
        }
        let P = f;
        if (j[19] !== e || j[20] !== M) {
            let t;
            j[22] !== e ? (t = t => (0, b.fromChainToPortfolioItem)(e, t), j[22] = e, j[23] = t) : t = j[23], g = M.map(t).filter(b.filterSharesQty), j[19] = e, j[20] = M, j[21] = g
        } else g = j[21];
        let A = g,
            R = !!(P.length || A.length);
        return j[24] !== P || j[25] !== A || j[26] !== R || j[27] !== N || j[28] !== E || j[29] !== O || j[30] !== I ? (x = {
            hasAmmPositions: R,
            ammMarketPositions: P,
            ammMarketPositionsFromChain: A,
            poolBalances: N,
            shareBalances: I,
            refreshPoolBalances: E,
            refreshShareBalances: O
        }, j[24] = P, j[25] = A, j[26] = R, j[27] = N, j[28] = E, j[29] = O, j[30] = I, j[31] = x) : x = j[31], x
    }], 189890)
}, 82056, e => {
    "use strict";
    var t = e.i(999061),
        n = e.i(416340);
    e.s(["useTxUnprocessableError", 0, function(e) {
        let s, i, r, o = (0, t.c)(13),
            {
                isTradeLargerThanBalance: a,
                isLossMakingTrade: l,
                hasTooFewShares: c,
                isMaxSlippageExceeded: d,
                cannotCheckout: u,
                hasAnOddsError: m,
                units: h
            } = e,
            p = void 0 === h ? "USDC" : h,
            [f, g] = (0, n.useState)(!1),
            [x, y] = (0, n.useState)(""),
            [v, b] = (0, n.useState)(!1);
        return o[0] !== u || o[1] !== m || o[2] !== c || o[3] !== l || o[4] !== d || o[5] !== a || o[6] !== p ? (s = () => {
            switch (!0) {
                case m:
                    y("Odds must add up to 100%!"), g(!0), b(!0);
                    break;
                case c:
                    y("Please enter a valid amount."), g(!0);
                    break;
                case a:
                    y(`You don't own enough ${p}.`), g(!0), b(!0);
                    break;
                case l:
                    y("This trade is unprofitable."), g(!0), b(!0);
                    break;
                case d:
                    y("Adjust slippage to < 100% to submit trade."), g(!0), b(!0);
                    break;
                case u:
                    y("Please try again"), g(!0);
                    break;
                default:
                    y(""), g(!1)
            }
        }, i = [p, a, l, d, c, u, m], o[0] = u, o[1] = m, o[2] = c, o[3] = l, o[4] = d, o[5] = a, o[6] = p, o[7] = s, o[8] = i) : (s = o[7], i = o[8]), n.default.useEffect(s, i), o[9] !== x || o[10] !== f || o[11] !== v ? (r = {
            hasError: f,
            showImmediateError: v,
            errorText: x
        }, o[9] = x, o[10] = f, o[11] = v, o[12] = r) : r = o[12], r
    }])
}, 679892, e => {
    "use strict";
    e.i(979983);
    var t = e.i(822315),
        n = e.i(618808),
        s = e.i(415013),
        i = e.i(186897),
        r = e.i(600326),
        o = e.i(502980),
        a = e.i(343999),
        l = e.i(631222);
    e.s(["formatSyntheticSplitTransaction", 0, ({
        conditionId: e,
        amount: t,
        outcomePrices: n,
        proxyAddress: c,
        chainId: d = l.MATIC_CONFIG.chainId
    }) => {
        let u = Date.now(),
            m = (0, s.keccak256)((0, i.toHex)(c + e + u.toString())),
            h = (0, o.computeSplitImpact)(t, n);
        return new a.CTFTxnBuilder(m, r.TxnStatus.PENDING).metadata({
            chainId: d,
            outcome: "",
            outcomeIndex: -1,
            quantity: 0 n,
            usdc: t,
            enqueuedAt: u,
            lastUpdatedAt: u,
            ctfTxnType: r.CTFTxnType.Split,
            positionChangeData: h
        }).conditionId(e).build()
    }, "getSplitPositionTransaction", 0, ({
        chainId: e,
        chainConfig: s,
        conditionId: i,
        negRisk: r,
        outcomeCount: o,
        amount: a
    }) => {
        let c = s[e].collateral;
        return r ? n.negRiskCollateralAdapterOperations.splitPosition({
            negRiskCollateralAdapterAddress: l.NEG_RISK_COLLATERAL_ADAPTER_ADDRESS,
            collateralTokenAddress: c,
            conditionId: i,
            outcomeSlotCount: o,
            amount: a
        }) : t.collateralAdapterOperations.splitPosition({
            collateralAdapterAddress: l.COLLATERAL_ADAPTER_ADDRESS,
            collateralTokenAddress: c,
            conditionId: i,
            outcomeSlotCount: o,
            amount: a
        })
    }])
}, 874340, e => {
    "use strict";
    var t = e.i(416340),
        n = e.i(197994);
    e.s(["IconArrowDownFill18", 0, ({ ...e
    }) => t.default.createElement(n.Icon, {
        size: "18px",
        ...e
    }, t.default.createElement("path", {
        d: "M9,15.75c-.414,0-.75-.336-.75-.75V2.75c0-.414,.336-.75,.75-.75s.75,.336,.75,.75V15c0,.414-.336,.75-.75,.75Z",
        fill: "currentColor",
        "data-color": "color-2"
    }), t.default.createElement("path", {
        d: "M9,16c-.192,0-.384-.073-.53-.22l-4.25-4.25c-.293-.293-.293-.768,0-1.061s.768-.293,1.061,0l3.72,3.72,3.72-3.72c.293-.293,.768-.293,1.061,0s.293,.768,0,1.061l-4.25,4.25c-.146,.146-.338,.22-.53,.22Z",
        fill: "currentColor"
    }))])
}, 569080, e => {
    "use strict";
    e.i(369761), e.i(979983);
    var t = e.i(618808),
        n = e.i(631222);
    e.s(["getConvertPositionsTransaction", 0, ({
        chainId: e,
        chainConfig: s,
        marketId: i,
        questionIds: r,
        amount: o
    }) => {
        let a = [...new Set(r.map(e => parseInt(e.slice(-2), 16)))].reduce((e, t) => e + (1 n << BigInt(t)), 0 n);
        return t.negRiskCollateralAdapterOperations.convertPositions({
            negRiskCollateralAdapterAddress: n.NEG_RISK_COLLATERAL_ADAPTER_ADDRESS,
            marketId: i,
            indexSet: a,
            amount: o
        })
    }], 569080)
}, 543078, e => {
    "use strict";
    var t, n = e.i(221628),
        s = e.i(999061),
        i = e.i(882860),
        r = e.i(63238),
        o = e.i(23128),
        a = e.i(417493),
        l = e.i(435894),
        c = e.i(525962),
        d = e.i(766181),
        u = e.i(208956),
        m = e.i(631222),
        h = e.i(874340),
        p = e.i(985185),
        f = e.i(160809),
        g = e.i(416340),
        x = e.i(628684),
        y = e.i(635103),
        v = e.i(67670),
        b = e.i(631503),
        k = e.i(668122),
        S = e.i(870555),
        C = e.i(604777),
        j = e.i(784521),
        w = e.i(305457),
        T = e.i(269101),
        N = e.i(98191),
        I = e.i(196593),
        E = e.i(53950),
        O = e.i(423582),
        M = e.i(569080),
        P = e.i(891685),
        A = e.i(632567),
        R = e.i(660006),
        z = e.i(897535),
        L = e.i(5146),
        D = ((t = D || {}).Select = "select", t.Review = "review", t.Pending = "pending", t.Complete = "complete", t);
    let F = e => e.negRiskMarketID && "00" === e.negRiskMarketID.slice(-2) ? e.negRiskMarketID : null,
        _ = (0, d.cva)("rounded-sm font-medium text-xs py-1 px-1.5", {
            variants: {
                variant: {
                    green: "text-green-600 bg-green-50 dark:text-green-400",
                    red: "text-red-500 bg-red-50"
                }
            }
        });

    function B(e) {
        let t, i, r, o, a, l = (0, s.c)(10);
        return l[0] !== e ? ({
            className: t,
            variant: r,
            ...i
        } = e, l[0] = e, l[1] = t, l[2] = i, l[3] = r) : (t = l[1], i = l[2], r = l[3]), l[4] !== t || l[5] !== r ? (o = (0, S.cn)(_({
            variant: r
        }), t), l[4] = t, l[5] = r, l[6] = o) : o = l[6], l[7] !== i || l[8] !== o ? (a = (0, n.jsx)("span", {
            className: o,
            ...i
        }), l[7] = i, l[8] = o, l[9] = a) : a = l[9], a
    }
    let H = e => {
            let t, i, r, o, a, l, c, d, u, m = (0, s.c)(29),
                {
                    position: h,
                    idx: f,
                    sharesLabel: g
                } = e,
                {
                    isUSDC: x,
                    isOther: y
                } = h,
                v = 0 !== f && "mt-3";
            m[0] !== v ? (t = (0, S.cn)("flex justify-between", v), m[0] = v, m[1] = t) : t = m[1];
            let b = x ? "text-text-brand" : "text-text";
            return m[2] !== b ? (i = (0, S.cn)("font-medium text-sm mr-2", b), m[2] = b, m[3] = i) : i = m[3], m[4] !== x || m[5] !== h.groupItemTitle ? (r = x ? "USDC" : h.groupItemTitle.slice(0, 24), m[4] = x, m[5] = h.groupItemTitle, m[6] = r) : r = m[6], m[7] !== i || m[8] !== r ? (o = (0, n.jsx)("span", {
                className: i,
                children: r
            }), m[7] = i, m[8] = r, m[9] = o) : o = m[9], m[10] !== y || m[11] !== x || m[12] !== h.isConverting || m[13] !== h.outcome ? (a = x ? null : (0, n.jsxs)(B, {
                variant: h.isConverting ? "red" : "green",
                className: "flex items-center",
                children: [y && (0, n.jsx)(p.IconLockFill18, {
                    className: "size-4 mr-1"
                }), h.outcome]
            }), m[10] = y, m[11] = x, m[12] = h.isConverting, m[13] = h.outcome, m[14] = a) : a = m[14], m[15] !== o || m[16] !== a ? (l = (0, n.jsxs)("div", {
                className: "flex items-center",
                children: [o, a]
            }), m[15] = o, m[16] = a, m[17] = l) : l = m[17], m[18] !== x || m[19] !== h.isConverting || m[20] !== h.sharesToConvert || m[21] !== g ? (c = h.isConverting ? `-${x?"$":""}${(0,I.formatShares)(h.sharesToConvert)} ${x?"":g}` : `+${x?"$":""}${(0,I.formatShares)(h.sharesToConvert)} ${x?"":g}`, m[18] = x, m[19] = h.isConverting, m[20] = h.sharesToConvert, m[21] = g, m[22] = c) : c = m[22], m[23] !== c ? (d = (0, n.jsx)("span", {
                className: "text-sm font-normal text-text-tertiary",
                children: c
            }), m[23] = c, m[24] = d) : d = m[24], m[25] !== d || m[26] !== t || m[27] !== l ? (u = (0, n.jsxs)("div", {
                className: t,
                children: [l, d]
            }), m[25] = d, m[26] = t, m[27] = l, m[28] = u) : u = m[28], u
        },
        $ = e => {
            let t, i, r, o, l, c, d, u, m, h, p, f, g = (0, s.c)(35),
                {
                    position: x,
                    idx: y,
                    numPositions: v,
                    conversionState: b,
                    setConversionState: k
                } = e,
                C = 0 === y,
                j = y === v - 1,
                w = !!b && !0 === b[x.conditionId],
                T = C && 1 === v || j ? "border-b" : "",
                N = C ? "rounded-t-lg" : "",
                E = j ? "rounded-b-lg" : "",
                O = w ? "bg-brand/10" : "bg-background";
            return g[0] !== T || g[1] !== N || g[2] !== E || g[3] !== O ? (t = (0, S.cn)("flex justify-between items-center border-t border-l border-r border-border", T, N, E, O), g[0] = T, g[1] = N, g[2] = E, g[3] = O, g[4] = t) : t = g[4], g[5] !== x.conditionId || g[6] !== k ? (i = e => {
                k(t => t ? { ...t,
                    [x.conditionId]: "indeterminate" === e || e
                } : null)
            }, g[5] = x.conditionId, g[6] = k, g[7] = i) : i = g[7], g[8] !== w || g[9] !== i ? (r = (0, n.jsx)(a.CheckboxContainer, {
                className: "justify-between pl-4 pr-2",
                children: (0, n.jsx)(a.Checkbox, {
                    id: "setExpiration",
                    checked: w,
                    onCheckedChange: i
                })
            }), g[8] = w, g[9] = i, g[10] = r) : r = g[10], g[11] !== x.conditionId || g[12] !== k ? (o = () => {
                k(e => e ? { ...e,
                    [x.conditionId]: !e[x.conditionId]
                } : null)
            }, g[11] = x.conditionId, g[12] = k, g[13] = o) : o = g[13], g[14] !== x.groupItemTitle ? (l = x.groupItemTitle.slice(0, 25), g[14] = x.groupItemTitle, g[15] = l) : l = g[15], g[16] !== l ? (c = (0, n.jsx)("span", {
                className: "font-medium text-sm mr-2",
                children: l
            }), g[16] = l, g[17] = c) : c = g[17], g[18] !== x.outcome ? (d = (0, n.jsx)(B, {
                variant: "red",
                children: x.outcome
            }), g[18] = x.outcome, g[19] = d) : d = g[19], g[20] !== c || g[21] !== d ? (u = (0, n.jsxs)("div", {
                className: "flex",
                children: [c, d]
            }), g[20] = c, g[21] = d, g[22] = u) : u = g[22], g[23] !== x.totalSharesOwned ? (m = (0, I.formatShares)(x.totalSharesOwned), g[23] = x.totalSharesOwned, g[24] = m) : m = g[24], g[25] !== m ? (h = (0, n.jsx)("span", {
                className: "text-sm font-normal text-text-tertiary",
                children: m
            }), g[25] = m, g[26] = h) : h = g[26], g[27] !== u || g[28] !== h || g[29] !== o ? (p = (0, n.jsxs)("div", {
                className: "flex flex-1 p-4 pl-0 justify-between cursor-pointer",
                onClick: o,
                children: [u, h]
            }), g[27] = u, g[28] = h, g[29] = o, g[30] = p) : p = g[30], g[31] !== p || g[32] !== t || g[33] !== r ? (f = (0, n.jsxs)("div", {
                className: t,
                children: [r, p]
            }), g[31] = p, g[32] = t, g[33] = r, g[34] = f) : f = g[34], f
        };

    function U() {
        let e = (0, C.useTranslations)(),
            [t, s] = g.default.useState("select"),
            {
                authenticationType: a,
                proxyAddress: d,
                walletMode: p
            } = (0, j.useAccountContext)(["authenticationType", "proxyAddress", "walletMode"]),
            {
                event: S
            } = (0, P.useEventContext)(["event"]),
            {
                positions: D,
                refetchPositions: _
            } = (0, T.useEventPositionsContext)(["positions", "refetchPositions"]),
            {
                refreshTrackedProxyUsdcBalance: B
            } = (0, L.default)(),
            {
                refetchMarketPositionsValue: U
            } = (0, v.useMarketPositionsValue)(d),
            {
                size: q,
                refetch: W
            } = (0, z.default)(S),
            {
                sendTransaction: K
            } = (0, b.default)(),
            {
                nonce: V,
                incrementNonce: Q,
                refreshNonce: G
            } = (0, x.useSafe)(),
            {
                nonce: Y,
                incrementNonce: Z,
                refreshNonce: X
            } = (0, y.useDepositWallet)(),
            J = (0, w.useAmplitudeAnalytics)(),
            {
                setListenersEnabled: ee
            } = (0, A.useHotkeyContext)(),
            [et, en] = (0, g.useState)(null),
            es = (0, g.useMemo)(() => D ? D.filter(e => S.markets.some(t => t.conditionId === e.market.id)).reduce((e, t) => {
                if ("1" !== t.outcomeIndex) return e;
                let n = parseFloat((0, i.formatUnits)(BigInt(t.netQuantity), 6));
                return e[t.market.id] = { ...t,
                    size: n
                }, e
            }, {}) : {}, [D, S.markets]);
        (0, g.useEffect)(() => {
            null === et && D ? .length && Object.keys(es).length && en(D.reduce((e, t) => (e[t.market.id] || (es[t.market.id] ? e[t.market.id] = !0 : e[t.market.id] = !1), e), {}))
        }, [et, D, es]);
        let ei = (0, g.useMemo)(() => S.markets.reduce((e, t) => (e[t.conditionId] || (e[t.conditionId] = t.questionID), e), {}), [S]),
            er = (0, g.useMemo)(() => et ? Object.keys(et).reduce((e, t) => {
                if (et[t]) {
                    let n = ei[t];
                    n && e.push(n)
                }
                return e
            }, []) : [], [et, ei]),
            eo = (0, g.useMemo)(() => {
                let e;
                return et && 0 !== (e = Object.values(et).some(e => !1 === e) ? Object.values(es).filter(e => et[e.market.id]).sort((e, t) => e.size - t.size) : Object.values(es).sort((e, t) => e.size - t.size)).length ? e[0].size : 0
            }, [et, es]),
            [ea, el] = (0, g.useState)("0"),
            ec = (0, g.useMemo)(() => parseFloat(ea), [ea]),
            ed = (0, g.useMemo)(() => Array.isArray(S.markets) && null !== et ? S.markets.filter(e => !!es[e.conditionId]).map(e => {
                let t = !!et[e.conditionId],
                    {
                        size: n
                    } = es[e.conditionId];
                return {
                    conditionId: e.conditionId,
                    groupItemTitle: e.groupItemTitle,
                    isConverting: t,
                    isUSDC: !1,
                    isOther: !1,
                    outcome: e.outcomes[1],
                    questionID: e.questionID,
                    sharesToConvert: ec,
                    totalSharesOwned: n ? ? 0
                }
            }) : [], [et, S, ec, es]),
            eu = (0, g.useMemo)(() => {
                if (!Array.isArray(S.markets) || null === et) return [];
                let e = (er.length - 1) * ec,
                    t = S.markets[0],
                    n = {
                        conditionId: t.conditionId,
                        groupItemTitle: "usdc",
                        isConverting: !1,
                        isUSDC: !0,
                        isOther: !1,
                        outcome: "",
                        questionID: t.questionID,
                        sharesToConvert: e,
                        totalSharesOwned: e
                    },
                    s = {
                        conditionId: t.conditionId,
                        groupItemTitle: "Other",
                        isConverting: !1,
                        isOther: !0,
                        isUSDC: !1,
                        outcome: "Yes",
                        questionID: t.questionID,
                        sharesToConvert: ec,
                        totalSharesOwned: q
                    };
                return S.markets.map(e => {
                    let t = !!et[e.conditionId],
                        n = es[e.conditionId] ? .size ? ? 0;
                    return {
                        conditionId: e.conditionId,
                        groupItemTitle: e.groupItemTitle,
                        isConverting: t,
                        isUSDC: !1,
                        isOther: !1,
                        outcome: t ? e.outcomes[1] : e.outcomes[0],
                        questionID: e.questionID,
                        sharesToConvert: ec,
                        totalSharesOwned: n
                    }
                }).concat(s).concat(n)
            }, [et, S, ec, es, er, q]),
            em = (0, g.useMemo)(() => eu.filter(e => e.isConverting), [eu]),
            eh = (0, g.useMemo)(() => eu.filter(e => !e.isConverting), [eu]),
            ep = (0, g.useMemo)(() => F(S), [S]),
            ef = (0, g.useCallback)(async () => {
                if (ep) {
                    s("pending");
                    try {
                        let e = (0, r.parseUnits)(ec.toString(), 6);
                        J.trackEvent(k.Events.ConvertStart, {
                            proxyAddress: d,
                            authenticationType: a,
                            marketId: ep,
                            amount: ec
                        });
                        let t = {
                            amount: e,
                            chainConfig: m.chainConfig,
                            chainId: 137,
                            marketId: ep,
                            questionIds: er
                        };
                        E.logger.info("[ConvertPositions > handleConversion > payload]", {
                            payload: t,
                            proxyAddress: d,
                            authenticationType: a,
                            marketId: ep,
                            amount: ec
                        });
                        let n = await (0, M.getConvertPositionsTransaction)(t);
                        E.logger.info("[ConvertPositions > handleConversion > txn]", {
                            txn: n,
                            payload: t,
                            proxyAddress: d,
                            authenticationType: a,
                            marketId: ep,
                            amount: ec
                        });
                        let i = (0, b.getTransactionType)(p),
                            o = await K(i, Array.isArray(n) ? n : [n], 0, m.Network.Matic, 0, void 0, i === b.TransactionType.DepositWallet ? Y : i === b.TransactionType.EOA ? V : void 0, b.TransactionMetadata.Convert.valueOf(), i === b.TransactionType.DepositWallet ? d : void 0);
                        E.logger.info("[ConvertPositions > handleConversion > txn response]", {
                            txResponse: o,
                            payload: t,
                            proxyAddress: d,
                            authenticationType: a,
                            marketId: ep,
                            amount: ec
                        }), i === b.TransactionType.EOA ? Q() : i === b.TransactionType.DepositWallet && await Z();
                        let l = await (0, O.waitTillMined)(o);
                        i === b.TransactionType.EOA ? G() : i === b.TransactionType.DepositWallet && X(), E.logger.info("[ConvertPositions > handleConversion > mined]", {
                            mined: l,
                            payload: t,
                            proxyAddress: d,
                            authenticationType: a,
                            marketId: ep,
                            amount: ec
                        }), l && (Promise.all([U(), _(), B(), W()]), J.trackEvent(k.Events.ConvertSuccess, {
                            proxyAddress: d,
                            authenticationType: a,
                            marketId: ep,
                            amount: ec
                        })), s("complete")
                    } catch (e) {
                        (0, b.getTransactionType)(p) === b.TransactionType.DepositWallet && X(), s("review"), (0, R.handleError)(e, "[ConvertPositions > handleConversion > catch]"), J.trackEvent(k.Events.ConvertFail, {
                            proxyAddress: d,
                            authenticationType: a,
                            marketId: ep,
                            amount: ec
                        })
                    }
                }
            }, [ec, J, a, p, Q, G, Y, Z, X, ep, V, d, er, W, _, B, U, K]),
            eg = (0, g.useMemo)(() => "" === ea || 0 === em.length || ec <= 0 || ec > eo, [ec, eo, em, ea]);
        return (0, n.jsxs)(n.Fragment, {
            children: ["select" === t && (0, n.jsxs)(n.Fragment, {
                children: [(0, n.jsx)(c.ModalHeader, {
                    children: (0, n.jsx)(c.ModalTitle, {
                        children: e("events.convertPositions.title")
                    })
                }), (0, n.jsxs)(c.ModalDescription, {
                    children: [e("events.convertPositions.description"), " ", (0, n.jsx)(u.default, {
                        href: `${m.POLYMARKET_DOCS_LINK}/advanced/neg-risk`,
                        target: "_blank",
                        rel: "noopener noreferrer",
                        children: e("events.convertPositions.learnMore")
                    })]
                }), (0, n.jsx)("p", {
                    className: "text-sm text-text-secondary",
                    children: e("events.convertPositions.selectOneOrMore")
                }), ed.length ? (0, n.jsx)("div", {
                    className: "flex flex-col max-h-[133px] overflow-y-scroll",
                    onClick: e => e.stopPropagation(),
                    children: ed.map((e, t, s) => (0, n.jsx)($, {
                        idx: t,
                        numPositions: s.length,
                        position: e,
                        conversionState: et,
                        setConversionState: en
                    }, `conversion-${e.conditionId}`))
                }) : (0, n.jsx)("p", {
                    className: "text-sm",
                    children: e("events.convertPositions.noPositions")
                }), (0, n.jsxs)("div", {
                    className: "flex flex-col",
                    onClick: e => e.stopPropagation(),
                    children: [(0, n.jsxs)("div", {
                        className: "flex justify-between items-center mb-2",
                        children: [(0, n.jsx)("span", {
                            className: "text-sm text-text-secondary",
                            children: e("trading.amount")
                        }), (0, n.jsxs)("div", {
                            className: "flex items-center gap-2",
                            children: [(0, n.jsx)("span", {
                                className: "text-sm text-text-secondary",
                                children: (0, I.formatShares)(eo)
                            }), (0, n.jsx)(o.Button, {
                                variant: "secondary",
                                size: "sm",
                                onClick: () => {
                                    let e = eo.toString();
                                    el(e), J.trackEvent(k.Events.ConvertMax, {
                                        marketId: ep,
                                        authenticationType: a,
                                        proxyAddress: d,
                                        amount: e
                                    })
                                },
                                children: e("trading.max")
                            })]
                        })]
                    }), (0, n.jsx)(l.Input, {
                        variant: "outlined",
                        type: "number",
                        placeholder: e("events.convertPositions.enterAmount"),
                        value: ea,
                        min: 0,
                        onChange: e => el(e.target.value),
                        onFocus: () => ee(!1),
                        onBlur: () => {
                            ee(!0), J.trackEvent(k.Events.ConvertInput, {
                                marketId: ep,
                                authenticationType: a,
                                proxyAddress: d,
                                amount: ea
                            })
                        },
                        max: eo,
                        error: parseFloat(ea) > eo
                    })]
                }), (0, n.jsx)(c.ModalFooter, {
                    children: (0, n.jsx)(o.Button, {
                        disabled: eg,
                        onClick: () => {
                            eg || (s("review"), J.trackEvent(k.Events.ConvertReview, {
                                marketId: ep,
                                authenticationType: a,
                                proxyAddress: d,
                                amount: ea,
                                positionsToConvert: em.length,
                                positionsToGain: eh.length
                            }))
                        },
                        children: e("events.convertPositions.review")
                    })
                })]
            }), ("review" === t || "pending" === t) && (0, n.jsxs)(n.Fragment, {
                children: [(0, n.jsxs)("div", {
                    className: "flex items-center gap-2",
                    children: [(0, n.jsx)("button", {
                        type: "button",
                        className: "shrink-0 cursor-pointer rounded-sm p-1 text-text-secondary hover:text-text-tertiary",
                        "aria-label": "Back",
                        onClick: () => s("select"),
                        children: (0, n.jsx)(f.IconChevronLeftOutline18, {})
                    }), (0, n.jsx)(c.ModalTitle, {
                        children: e("events.convertPositions.review")
                    })]
                }), (0, n.jsxs)("div", {
                    className: "flex items-center bg-surface-2 rounded-lg flex-col max-h-80 overflow-y-scroll p-3",
                    children: [(0, n.jsx)("div", {
                        className: "w-full p-3 pb-4 flex flex-col rounded-lg bg-background mb-2",
                        children: em.map((t, s) => (0, n.jsx)(H, {
                            idx: s,
                            position: t,
                            sharesLabel: e("events.convertPositions.shares")
                        }, `rev-0-${t.conditionId}-${s}`))
                    }), (0, n.jsx)("div", {
                        className: "relative",
                        children: (0, n.jsx)(h.IconArrowDownFill18, {
                            size: 30,
                            className: "absolute -bottom-3 -left-4 bg-background rounded-lg border-4 border-surface-2 text-text"
                        })
                    }), (0, n.jsx)("div", {
                        className: "w-full p-3 pb-4 flex flex-col rounded-lg bg-background",
                        children: eh.map((t, s) => (0, n.jsx)(H, {
                            idx: s,
                            position: t,
                            sharesLabel: e("events.convertPositions.shares")
                        }, `rev-1-${t.conditionId}-${s}`))
                    })]
                }), (0, n.jsx)(c.ModalFooter, {
                    children: (0, n.jsx)(o.Button, {
                        disabled: "pending" === t,
                        onClick: ef,
                        children: "pending" === t ? (0, n.jsx)(N.default, {
                            height: "32px",
                            width: "32px"
                        }) : e("orders.confirm")
                    })
                })]
            }), "complete" === t && (0, n.jsxs)(n.Fragment, {
                children: [(0, n.jsx)(c.ModalHeader, {
                    children: (0, n.jsx)(c.ModalTitle, {
                        children: e("events.convertPositions.completed")
                    })
                }), (0, n.jsx)(c.ModalDescription, {
                    children: e("events.convertPositions.youHaveNewShares")
                }), (0, n.jsx)(c.ModalFooter, {
                    children: (0, n.jsx)(c.ModalClose, {
                        asChild: !0,
                        children: (0, n.jsx)(o.Button, {
                            children: e("events.convertPositions.okay")
                        })
                    })
                })]
            })]
        })
    }
    e.s(["ConvertPositionsDialog", 0, function(e) {
        let t, i, r = (0, s.c)(4),
            {
                open: o,
                onOpenChange: a
            } = e;
        return r[0] === Symbol.for("react.memo_cache_sentinel") ? (t = (0, n.jsx)(c.ModalContent, {
            children: (0, n.jsx)(U, {})
        }), r[0] = t) : t = r[0], r[1] !== a || r[2] !== o ? (i = (0, n.jsx)(c.Modal, {
            open: o,
            onOpenChange: a,
            children: t
        }), r[1] = a, r[2] = o, r[3] = i) : i = r[3], i
    }, "ConvertPositionsInternals", 0, U, "ConvertPositionsTrigger", 0, function(e) {
        let t, i, r, a = (0, s.c)(7),
            {
                onClick: l
            } = e,
            c = (0, C.useTranslations)();
        a[0] === Symbol.for("react.memo_cache_sentinel") ? (t = ["event"], a[0] = t) : t = a[0];
        let {
            event: d
        } = (0, P.useEventContext)(t), u = !1 === d.enableNegRisk;
        return a[1] !== c ? (i = c("events.convertPositions.convert"), a[1] = c, a[2] = i) : i = a[2], a[3] !== l || a[4] !== u || a[5] !== i ? (r = (0, n.jsx)(o.Button, {
            variant: "outline",
            size: "sm",
            disabled: u,
            onClick: l,
            children: i
        }), a[3] = l, a[4] = u, a[5] = i, a[6] = r) : r = a[6], r
    }, "default", 0, e => {
        let t, i, r, a, l, d, u, m, h = (0, s.c)(19),
            {
                onClick: p
            } = e,
            f = (0, C.useTranslations)();
        h[0] === Symbol.for("react.memo_cache_sentinel") ? (t = ["authenticationType", "proxyAddress"], h[0] = t) : t = h[0];
        let {
            authenticationType: g,
            proxyAddress: x
        } = (0, j.useAccountContext)(t);
        h[1] === Symbol.for("react.memo_cache_sentinel") ? (i = ["event"], h[1] = i) : i = h[1];
        let {
            event: y
        } = (0, P.useEventContext)(i), v = (0, w.useAmplitudeAnalytics)();
        h[2] !== y ? (r = F(y), h[2] = y, h[3] = r) : r = h[3];
        let b = r,
            S = !1 === y.enableNegRisk;
        return h[4] !== v || h[5] !== g || h[6] !== b || h[7] !== p || h[8] !== x ? (a = e => {
            p ? .(e), v.trackEvent(k.Events.ConvertOpen, {
                proxyAddress: x,
                authenticationType: g,
                marketId: b
            })
        }, h[4] = v, h[5] = g, h[6] = b, h[7] = p, h[8] = x, h[9] = a) : a = h[9], h[10] !== f ? (l = f("events.convertPositions.convert"), h[10] = f, h[11] = l) : l = h[11], h[12] !== S || h[13] !== a || h[14] !== l ? (d = (0, n.jsx)(c.ModalTrigger, {
            asChild: !0,
            children: (0, n.jsx)(o.Button, {
                variant: "outline",
                size: "sm",
                disabled: S,
                onClick: a,
                children: l
            })
        }), h[12] = S, h[13] = a, h[14] = l, h[15] = d) : d = h[15], h[16] === Symbol.for("react.memo_cache_sentinel") ? (u = (0, n.jsx)(c.ModalContent, {
            children: (0, n.jsx)(U, {})
        }), h[16] = u) : u = h[16], h[17] !== d ? (m = (0, n.jsxs)(c.Modal, {
            children: [d, u]
        }), h[17] = d, h[18] = m) : m = h[18], m
    }])
}, 455466, e => {
    "use strict";
    var t = e.i(749654),
        n = e.i(457706),
        s = e.i(192842);
    e.s(["set", 0, function(e, i, r) {
        let o = (0, s.toDate)(e, r ? .in);
        return isNaN(+o) ? (0, t.constructFrom)(r ? .in || e, NaN) : (null != i.year && o.setFullYear(i.year), null != i.month && (o = (0, n.setMonth)(o, i.month)), null != i.date && o.setDate(i.date), null != i.hours && o.setHours(i.hours), null != i.minutes && o.setMinutes(i.minutes), null != i.seconds && o.setSeconds(i.seconds), null != i.milliseconds && o.setMilliseconds(i.milliseconds), o)
    }])
}, 153698, e => {
    "use strict";
    var t = e.i(416340),
        n = e.i(180715);
    e.s(["IconPlusOutline12", 0, ({
        strokeWidth: e = 1.5,
        ...s
    }) => t.default.createElement(n.Icon, {
        size: "12px",
        ...s
    }, t.default.createElement("line", {
        x1: "10.75",
        y1: "6",
        x2: "1.25",
        y2: "6",
        fill: "none",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: e,
        "data-color": "color-2"
    }), t.default.createElement("line", {
        x1: "6",
        y1: "10.75",
        x2: "6",
        y2: "1.25",
        fill: "none",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: e
    }))])
}, 574778, e => {
    "use strict";
    var t = e.i(221628),
        n = e.i(999061);
    e.i(23128);
    var s = e.i(977324);
    e.i(222163), e.i(980443), e.i(491636), e.i(416340), e.i(86831), e.s(["DatePickerInline", 0, function(e) {
        let i, r, o = (0, n.c)(13),
            {
                value: a,
                onChange: l,
                minDate: c,
                maxDate: d,
                className: u
            } = e;
        if (o[0] !== d || o[1] !== c) {
            if (i = [], c) {
                let e;
                o[3] !== c ? (e = {
                    before: c
                }, o[3] = c, o[4] = e) : e = o[4], i.push(e)
            }
            if (d) {
                let e;
                o[5] !== d ? (e = {
                    after: d
                }, o[5] = d, o[6] = e) : e = o[6], i.push(e)
            }
            o[0] = d, o[1] = c, o[2] = i
        } else i = o[2];
        let m = i.length > 0 ? i : void 0,
            h = a ? ? c;
        return o[7] !== u || o[8] !== m || o[9] !== l || o[10] !== h || o[11] !== a ? (r = (0, t.jsx)(s.Calendar, {
            mode: "single",
            selected: a,
            onSelect: l,
            disabled: m,
            defaultMonth: h,
            className: u
        }), o[7] = u, o[8] = m, o[9] = l, o[10] = h, o[11] = a, o[12] = r) : r = o[12], r
    }])
}, 532766, e => {
    "use strict";
    var t, n = e.i(221628),
        s = e.i(740594),
        i = e.i(723823),
        r = e.i(23128),
        o = e.i(181687),
        a = e.i(53382),
        l = e.i(97271),
        c = e.i(416340),
        d = e.i(466542),
        u = e.i(458164),
        m = e.i(618357),
        h = e.i(333223),
        p = e.i(189890),
        f = e.i(92902),
        g = e.i(168871),
        x = e.i(994345),
        y = e.i(922445),
        v = e.i(604777),
        b = e.i(870555),
        k = e.i(784521),
        S = e.i(891685),
        C = e.i(269101),
        j = e.i(880809),
        w = e.i(196593),
        T = e.i(845923),
        N = e.i(543078),
        I = e.i(999061),
        E = e.i(525962),
        O = e.i(254380),
        M = e.i(986179),
        P = e.i(896414),
        A = e.i(450091);
    let R = e => {
            let t, s, i, r, o, a, l, c, d, u, m = (0, I.c)(27),
                {
                    position: h,
                    payoutLabel: p
                } = e;
            m[0] !== h.updateMaxPayout ? (t = (0, w.formatUSDCUnits)(h.updateMaxPayout), m[0] = h.updateMaxPayout, m[1] = t) : t = m[1];
            let f = parseFloat(t);
            m[2] !== f ? (s = (0, w.formatCurrency)(f, {
                decimals: 2
            }), m[2] = f, m[3] = s) : s = m[3];
            let g = s;
            m[4] !== h.netValue ? (i = (0, w.formatUSDCUnits)(h.netValue), m[4] = h.netValue, m[5] = i) : i = m[5];
            let x = parseFloat(i),
                y = x >= 0,
                v = h.icon;
            m[6] !== h.groupItemTitle || m[7] !== v ? (r = (0, n.jsx)(P.MarketImage, {
                image: v,
                marketName: h.groupItemTitle,
                size: 40,
                containerClassName: "rounded-sm overflow-hidden"
            }), m[6] = h.groupItemTitle, m[7] = v, m[8] = r) : r = m[8], m[9] !== h.groupItemTitle ? (o = (0, n.jsx)("h3", {
                className: "font-medium text-text-primary text-sm leading-tight mb-1 line-clamp-2",
                children: h.groupItemTitle
            }), m[9] = h.groupItemTitle, m[10] = o) : o = m[10];
            let b = y ? "text-green-500" : "text-red-500",
                k = y ? "+" : "";
            return m[11] !== x ? (a = (0, w.formatCurrency)(x, {
                decimals: 2
            }), m[11] = x, m[12] = a) : a = m[12], m[13] !== a || m[14] !== b || m[15] !== k ? (l = (0, n.jsxs)("span", {
                className: b,
                children: ["(", k, a, ")"]
            }), m[13] = a, m[14] = b, m[15] = k, m[16] = l) : l = m[16], m[17] !== g || m[18] !== p || m[19] !== l ? (c = (0, n.jsxs)("p", {
                className: "text-sm text-text-secondary",
                children: [p, " ", g, " ", l]
            }), m[17] = g, m[18] = p, m[19] = l, m[20] = c) : c = m[20], m[21] !== c || m[22] !== o ? (d = (0, n.jsxs)("div", {
                className: "flex-1 min-w-0",
                children: [o, c]
            }), m[21] = c, m[22] = o, m[23] = d) : d = m[23], m[24] !== d || m[25] !== r ? (u = (0, n.jsxs)("div", {
                className: "flex items-center gap-3 p-3 rounded-lg",
                children: [r, d]
            }), m[24] = d, m[25] = r, m[26] = u) : u = m[26], u
        },
        z = e => {
            let t, s, i, o, a, l, d, u, m, h, p = (0, I.c)(29),
                {
                    variant: f,
                    linkClassName: g
                } = e,
                x = void 0 === f ? "button" : f,
                y = (0, v.useTranslations)(),
                [b, k] = (0, c.useState)(!1),
                {
                    cleanNetPositions: j
                } = (() => {
                    let {
                        event: e
                    } = (0, S.useEventContext)(["event"]), {
                        positions: t
                    } = (0, C.useEventPositionsContext)(["positions"]), n = (0, c.useMemo)(() => t && e.markets ? e.markets.flatMap(e => (0, T.fromPositionToPortfolioInjectedPrices)(e, t, !1, [0, 0])) : [], [t, e.markets]), s = (0, c.useMemo)(() => n && 0 !== n.length ? n.reduce((e, t) => e + (0, A.getValuePaidForShares)(t.originalPosition), 0 n) : 0 n, [n]);
                    return {
                        cleanNetPositions: (0, c.useMemo)(() => {
                            if (!n || 0 === n.length) return [];
                            let t = new Map;
                            for (let e of n) {
                                if (0 !== e.outcomeIndex) continue;
                                let i = n.reduce((t, n) => n.slug === e.slug ? t : n.slug !== e.slug && 1 === n.outcomeIndex ? t + (0, M.parseEther)(n.qty ? ? "0") : t, (0, M.parseEther)(e.qty ? ? "0"));
                                t.set(e.slug, { ...e,
                                    updateMaxPayout: i / 10 n ** 12 n,
                                    netValue: i / 10 n ** 12 n - s
                                })
                            }
                            for (let i of e.markets)
                                if (!t.get(i.slug)) {
                                    let e = n.reduce((e, t) => t.slug !== i.slug && 1 === t.outcomeIndex ? e + (0, M.parseEther)(t.qty ? ? "0") : e, 0 n);
                                    t.set(i.slug, {
                                        market: i.slug,
                                        groupItemTitle: i.groupItemTitle,
                                        icon: i.icon,
                                        slug: i.slug,
                                        updateMaxPayout: e / 10 n ** 12 n,
                                        netValue: e / 10 n ** 12 n - s
                                    })
                                }
                            return Array.from(t.values()).sort((e, t) => Number(e.updateMaxPayout) > Number(t.updateMaxPayout) ? -1 : 1)
                        }, [e.markets, n, s])
                    }
                })(),
                w = (0, c.useRef)(null);
            p[0] !== y ? (t = y("events.netPositions.viewNetPositions"), p[0] = y, p[1] = t) : t = p[1];
            let N = t;
            if (p[2] !== g || p[3] !== x || p[4] !== N ? (s = (0, n.jsx)(E.ModalTrigger, {
                    asChild: !0,
                    children: "link" === x ? (0, n.jsx)("button", {
                        type: "button",
                        className: g || "text-xs text-text-secondary hover:underline cursor-pointer",
                        children: N
                    }) : (0, n.jsx)(r.Button, {
                        variant: "outline",
                        size: "sm",
                        className: "text-xs font-medium",
                        children: N
                    })
                }), p[2] = g, p[3] = x, p[4] = N, p[5] = s) : s = p[5], p[6] !== y ? (i = y("events.netPositions.title"), p[6] = y, p[7] = i) : i = p[7], p[8] !== i ? (o = (0, n.jsx)(E.ModalHeader, {
                    children: (0, n.jsx)(E.ModalTitle, {
                        children: i
                    })
                }), p[8] = i, p[9] = o) : o = p[9], p[10] !== y ? (a = y("events.netPositions.description"), p[10] = y, p[11] = a) : a = p[11], p[12] !== a ? (l = (0, n.jsx)(E.ModalDescription, {
                    children: a
                }), p[12] = a, p[13] = l) : l = p[13], p[14] !== j || p[15] !== y) {
                let e;
                p[17] !== y ? (e = e => (0, n.jsx)(R, {
                    position: e,
                    payoutLabel: y("events.netPositions.payout")
                }, e.market), p[17] = y, p[18] = e) : e = p[18], d = j.map(e), p[14] = j, p[15] = y, p[16] = d
            } else d = p[16];
            return p[19] !== d ? (u = (0, n.jsx)(O.ScrollContainer, {
                orientation: "vertical",
                containerRef: w,
                className: "overflow-y-auto max-h-[45vh] px-6",
                wrapperClassName: "-mx-6",
                children: d
            }), p[19] = d, p[20] = u) : u = p[20], p[21] !== o || p[22] !== l || p[23] !== u ? (m = (0, n.jsxs)(E.ModalContent, {
                children: [o, l, u]
            }), p[21] = o, p[22] = l, p[23] = u, p[24] = m) : m = p[24], p[25] !== b || p[26] !== m || p[27] !== s ? (h = (0, n.jsxs)(E.Modal, {
                open: b,
                onOpenChange: k,
                children: [s, m]
            }), p[25] = b, p[26] = m, p[27] = s, p[28] = h) : h = p[28], h
        };
    var L = e.i(169010);
    let D = e => {
            let t, s, i, r, o, a, l, c, d, u, m, h, p, g = (0, I.c)(32),
                {
                    unrealizedProfit: x,
                    realizedProfit: y,
                    totalProfit: v,
                    totalProfitPercent: b,
                    color: k,
                    unrealizedLabel: S,
                    realizedLabel: C,
                    totalLabel: j
                } = e;
            g[0] !== S ? (t = (0, n.jsx)("span", {
                className: "text-text-secondary font-normal text-[13px]",
                children: S
            }), g[0] = S, g[1] = t) : t = g[1], g[2] !== x ? (s = (0, n.jsx)("span", {
                className: "text-text font-normal text-sm",
                children: x
            }), g[2] = x, g[3] = s) : s = g[3], g[4] !== t || g[5] !== s ? (i = (0, n.jsxs)("div", {
                className: "flex justify-between px-3 pt-1",
                children: [t, s]
            }), g[4] = t, g[5] = s, g[6] = i) : i = g[6], g[7] !== C ? (r = (0, n.jsx)("span", {
                className: "text-text font-normal text-sm",
                children: C
            }), g[7] = C, g[8] = r) : r = g[8], g[9] !== y ? (o = (0, n.jsx)("span", {
                className: "text-text font-normal text-sm",
                children: y
            }), g[9] = y, g[10] = o) : o = g[10], g[11] !== r || g[12] !== o ? (a = (0, n.jsxs)("div", {
                className: "flex justify-between px-3",
                children: [r, o]
            }), g[11] = r, g[12] = o, g[13] = a) : a = g[13], g[14] === Symbol.for("react.memo_cache_sentinel") ? (l = (0, n.jsx)("div", {
                className: "border-b border-border my-1"
            }), g[14] = l) : l = g[14], g[15] !== j ? (c = (0, n.jsx)("span", {
                className: "text-text font-semibold text-sm",
                children: j
            }), g[15] = j, g[16] = c) : c = g[16];
            let w = `text-sm font-medium ${"green"===k?"text-green-600 dark:text-green-500":"text-red-500"}`,
                T = b || "0";
            g[17] !== T ? (d = (0, f.formatAsPercent)(T, {
                signDisplay: "never"
            }), g[17] = T, g[18] = d) : d = g[18];
            let N = ` (${d})`;
            return g[19] !== N || g[20] !== w ? (u = (0, n.jsx)("span", {
                className: w,
                children: N
            }), g[19] = N, g[20] = w, g[21] = u) : u = g[21], g[22] !== u || g[23] !== v ? (m = (0, n.jsxs)("span", {
                className: "text-text font-semibold text-sm",
                children: [v, u]
            }), g[22] = u, g[23] = v, g[24] = m) : m = g[24], g[25] !== m || g[26] !== c ? (h = (0, n.jsxs)("div", {
                className: "flex justify-between px-3 pb-1",
                children: [c, m]
            }), g[25] = m, g[26] = c, g[27] = h) : h = g[27], g[28] !== h || g[29] !== i || g[30] !== a ? (p = (0, n.jsx)("div", {
                className: "w-60 rounded-lg",
                children: (0, n.jsxs)("div", {
                    className: "flex flex-col gap-1.5 py-1.5",
                    children: [i, a, l, h]
                })
            }), g[28] = h, g[29] = i, g[30] = a, g[31] = p) : p = g[31], p
        },
        F = e => {
            let t, s, i, r, o, a, l, c, d, u, m = (0, I.c)(30),
                h = (0, v.useTranslations)();
            m[0] !== e.getValue ? (t = e.getValue(), m[0] = e.getValue, m[1] = t) : t = m[1];
            let {
                totalProfit: p,
                unrealizedProfit: f,
                realizedProfit: g,
                totalProfitPercent: x,
                unrealizedProfitPercent: y,
                color: b
            } = t;
            if (!b) {
                let e;
                return m[2] === Symbol.for("react.memo_cache_sentinel") ? (e = (0, n.jsx)("span", {
                    className: "text-sm",
                    children: "-"
                }), m[2] = e) : e = m[2], e
            }
            let k = f || p,
                S = y || x;
            m[3] !== h ? (s = h("events.returnCell.unrealized"), m[3] = h, m[4] = s) : s = m[4], m[5] !== h ? (i = h("events.returnCell.realized"), m[5] = h, m[6] = i) : i = m[6], m[7] !== h ? (r = h("events.returnCell.total"), m[7] = h, m[8] = r) : r = m[8], m[9] !== b || m[10] !== g || m[11] !== s || m[12] !== i || m[13] !== r || m[14] !== p || m[15] !== x || m[16] !== f ? (o = (0, n.jsx)(D, {
                unrealizedProfit: f,
                realizedProfit: g,
                totalProfit: p,
                totalProfitPercent: x,
                color: b,
                unrealizedLabel: s,
                realizedLabel: i,
                totalLabel: r
            }), m[9] = b, m[10] = g, m[11] = s, m[12] = i, m[13] = r, m[14] = p, m[15] = x, m[16] = f, m[17] = o) : o = m[17];
            let C = o;
            m[18] === Symbol.for("react.memo_cache_sentinel") ? (a = {
                border: "none",
                padding: "0",
                background: "none"
            }, m[18] = a) : a = m[18], m[19] !== k ? (l = (0, n.jsx)("button", {
                type: "button",
                style: a,
                children: (0, n.jsx)("span", {
                    className: "text-sm font-medium underline decoration-dotted underline-offset-4 decoration-text-secondary",
                    children: k
                })
            }), m[19] = k, m[20] = l) : l = m[20], m[21] !== l || m[22] !== C ? (c = (0, n.jsx)(L.Tooltip, {
                content: C,
                delayDuration: 100,
                side: "bottom",
                showArrow: !0,
                className: "p-0",
                triggerAsChild: !0,
                children: l
            }), m[21] = l, m[22] = C, m[23] = c) : c = m[23];
            let j = `text-sm font-medium ${"green"===b?"text-green-600 dark:text-green-500":"text-red-500"}`,
                w = ` (${S})`;
            return m[24] !== j || m[25] !== w ? (d = (0, n.jsx)("span", {
                className: j,
                children: w
            }), m[24] = j, m[25] = w, m[26] = d) : d = m[26], m[27] !== d || m[28] !== c ? (u = (0, n.jsxs)(n.Fragment, {
                children: [c, d]
            }), m[27] = d, m[28] = c, m[29] = u) : u = m[29], u
        },
        _ = e => {
            let t, s, i, r, o = (0, I.c)(11);
            o[0] !== e.getValue ? (t = e.getValue(), o[0] = e.getValue, o[1] = t) : t = o[1];
            let {
                unrealizedProfit: a,
                unrealizedProfitPercent: l,
                color: c
            } = t;
            if (!c) {
                let e;
                return o[2] === Symbol.for("react.memo_cache_sentinel") ? (e = (0, n.jsx)("span", {
                    className: "text-sm",
                    children: "-"
                }), o[2] = e) : e = o[2], e
            }
            o[3] !== a ? (s = (0, n.jsxs)("span", {
                className: "text-sm",
                children: [a, " "]
            }), o[3] = a, o[4] = s) : s = o[4];
            let d = `text-sm font-medium ${"green"===c?"text-green-600 dark:text-green-500":"text-red-500"}`,
                u = ` (${l})`;
            return o[5] !== d || o[6] !== u ? (i = (0, n.jsx)("span", {
                className: d,
                children: u
            }), o[5] = d, o[6] = u, o[7] = i) : i = o[7], o[8] !== s || o[9] !== i ? (r = (0, n.jsxs)(n.Fragment, {
                children: [s, i]
            }), o[8] = s, o[9] = i, o[10] = r) : r = o[10], r
        },
        B = e => {
            let t, s, i, r, o = (0, I.c)(9);
            o[0] !== e.getValue ? (t = e.getValue(), o[0] = e.getValue, o[1] = t) : t = o[1];
            let {
                value: a,
                cost: l
            } = t;
            return o[2] !== a ? (s = (0, n.jsx)("span", {
                className: "text-sm font-medium",
                children: a
            }), o[2] = a, o[3] = s) : s = o[3], o[4] !== l ? (i = (0, n.jsxs)("span", {
                className: "text-xs text-text-secondary",
                children: ["Cost ", l]
            }), o[4] = l, o[5] = i) : i = o[5], o[6] !== s || o[7] !== i ? (r = (0, n.jsxs)("div", {
                className: "flex flex-col gap-0.5",
                children: [s, i]
            }), o[6] = s, o[7] = i, o[8] = r) : r = o[8], r
        },
        H = e => {
            let t, s, i = (0, I.c)(4);
            i[0] !== e.getValue ? (t = e.getValue(), i[0] = e.getValue, i[1] = t) : t = i[1];
            let {
                value: r
            } = t;
            return i[2] !== r ? (s = (0, n.jsx)("span", {
                className: "text-sm font-medium",
                children: r
            }), i[2] = r, i[3] = s) : s = i[3], s
        };
    var $ = e.i(196627);
    let U = (0, l.default)(() => e.A(419573), {
        loadableGenerated: {
            modules: [837512]
        },
        ssr: !1
    });
    var q = ((t = q || {}).Outcome = "outcome", t.Quantity = "qty", t.AvgPrice = "avgPrice", t.Value = "value", t.TotalReturn = "totalReturn", t.Share = "share", t.Convert = "convert", t.Sell = "sell", t);
    e.s(["default", 0, ({
        market: e,
        containerVariant: t,
        containerStyles: l,
        headerStyles: I,
        bodyStyles: E,
        tableHeaderItemStyles: O,
        tableBodyItemStyles: M,
        tableBodyRowStyles: P,
        tableHeaderRowStyles: A,
        isOnRewards: R,
        colors: L
    }) => {
        let D = (0, v.useTranslations)(),
            {
                authenticated: q,
                proxyAddress: W
            } = (0, k.useAccountContext)(["authenticated", "proxyAddress"]),
            {
                event: K
            } = (0, S.useEventContext)(["event"]),
            {
                positions: V
            } = (0, C.useEventPositionsContext)(["positions"]),
            {
                ammMarketPositionsFromChain: Q
            } = (0, p.default)(e),
            {
                orderType: G,
                setShares: Y,
                setOrderType: Z,
                setSelectedOutcomeIdx: X,
                setSide: J,
                setOrderExpiration: ee,
                setAmountUpdateLocation: et,
                setSellAmountPrefilled: en
            } = (0, j.useTradeContext)(["orderType", "setShares", "setOrderType", "setSelectedOutcomeIdx", "setSide", "setOrderExpiration", "setAmountUpdateLocation", "setSellAmountPrefilled"]),
            es = (0, i.usePositionValuationPrice)(e, 0),
            ei = (0, i.usePositionValuationPrice)(e, 1),
            {
                accountProfile: er
            } = (0, h.default)(),
            {
                sharePosition: eo,
                isOpen: ea,
                setIsOpen: el,
                openShare: ec
            } = (0, x.useTradeShareDialog)(),
            [ed, eu] = (0, c.useState)(!1),
            {
                portfolioItems: em,
                positionsTableItems: eh
            } = (0, c.useMemo)(() => (({
                positions: e,
                market: t,
                orderType: n,
                isOnRewards: s,
                bestBidZero: i,
                bestBidOne: r
            }) => {
                let o = (0, T.fromPositionToPortfolioInjectedPrices)(t, e ? ? [], n !== u.OrderType.AMM, [i, r]).filter(e => parseFloat(e.qty) > .01);
                if (!Array.isArray(o)) return {
                    portfolioItems: [],
                    positionsTableItems: []
                };
                let a = o.sort((e, t) => Number(e ? .outcomeIndex) - Number(t ? .outcomeIndex)).map(e => ({
                    outcome: e.outcome,
                    isPending: e.isPending,
                    qty: (0, w.formatNum)(e.qty, {
                        decimals: 0
                    }),
                    avgPrice: `${(0,w.formatNum)(100*parseFloat(e.priceAvg),{decimals:1,optionalDecimals:!0,commas:!1})}\xa2`,
                    value: {
                        value: (0, w.toUSCurrency)(e.currentMarketValue),
                        cost: (0, w.toUSCurrency)(e.valueInit)
                    },
                    totalReturn: {
                        totalProfit: (0, w.toUSCurrency)(e.totalProfit, {
                            signDisplay: "always"
                        }),
                        totalProfitPercent: (0, w.formatPercent)(parseFloat(e.totalProfitPercent) / 100, {
                            decimals: 2,
                            sign: !0
                        }),
                        realizedProfit: (0, w.toUSCurrency)(e.realizedProfit, {
                            signDisplay: "always"
                        }),
                        unrealizedProfit: (0, w.toUSCurrency)(e.profit, {
                            signDisplay: s ? "auto" : "always"
                        }),
                        unrealizedProfitPercent: (0, f.formatAsPercent)(e.loss, {
                            signDisplay: "never"
                        }),
                        color: `${0>parseFloat(e.profit)?"red":"green"}`
                    },
                    sell: {
                        qty: e.qty,
                        outcomeIdx: e.outcomeIndex,
                        outcome: e.outcome,
                        isClosed: e.isClosed
                    }
                }));
                return {
                    portfolioItems: o,
                    positionsTableItems: a
                }
            })({
                market: e,
                positions: V,
                isOnRewards: R ? ? !1,
                orderType: G,
                bestBidZero: es,
                bestBidOne: ei
            }), [e, V, R, G, es, ei]),
            {
                positionsTableItems: ep
            } = (0, c.useMemo)(() => (({
                ammMarketPositionsFromChain: e
            }) => ({
                positionsTableItems: e.sort((e, t) => Number(e ? .outcomeIndex) - Number(t ? .outcomeIndex)).map(e => ({
                    outcome: e.outcome,
                    qty: (0, w.formatNum)(e.qty, {
                        decimals: 0
                    }),
                    avgPrice: "-",
                    value: {
                        value: (0, w.toUSCurrency)(e.currentMarketValue),
                        cost: "-"
                    },
                    totalReturn: {
                        totalProfit: "-",
                        totalProfitPercent: void 0,
                        color: void 0,
                        realizedProfit: void 0,
                        unrealizedProfit: void 0,
                        unrealizedProfitPercent: void 0
                    },
                    isPending: e.isPending,
                    sell: {
                        qty: e.qty,
                        outcomeIdx: e.outcomeIndex,
                        outcome: e.outcome,
                        isClosed: e.isClosed
                    }
                }))
            }))({
                ammMarketPositionsFromChain: Q
            }), [Q]),
            ef = (0, c.useMemo)(() => {
                let t = eh.length >= ep.length ? eh : ep;
                return 1 === t.length && t[0].outcome === e.outcomes[1]
            }, [ep, e.outcomes, eh]),
            eg = (0, y.useIsNarrowViewport)("dangerous-ui-flash"),
            ex = (0, c.useCallback)(e => {
                X(e.outcomeIdx), J(s.Side.SELL), Z(u.OrderType.Market), Y(e.qty), ee(void 0), et("click"), en(!0)
            }, [J, Y, X, Z, ee, et, en]),
            ey = (0, c.useCallback)(() => ({
                username: (er ? .displayUsernamePublic ? er.username : er ? .pseudonym) || void 0,
                profileImage: er ? .profile_image || void 0
            }), [er]),
            ev = (0, c.useCallback)(e => {
                let t = em[Number(e)],
                    n = ey();
                ec({ ...t,
                    proxyWallet: W,
                    ownerUsername: n.username,
                    ownerProfileImage: n.profileImage
                })
            }, [em, ec, W, ey]),
            eb = (0, c.useCallback)(e => {
                if (!W) return;
                let t = em[Number(e)];
                t && (0, g.prefetchShareImage)(t, W, ey())
            }, [em, W, ey]),
            ek = e.negRisk && !1 !== K.enableNegRisk,
            eS = (0, c.useMemo)(() => {
                let e = {
                        outcome: 1,
                        qty: 1,
                        avgPrice: .75,
                        value: 1,
                        totalReturn: 1.5
                    },
                    t = Object.values(e).reduce((e, t) => e + t, 0),
                    n = (d.RT_ORDERS_WIDTH - 4) / t;
                return [{
                    id: "outcome",
                    accessorKey: "outcome",
                    cell: e => e.getValue(),
                    header: () => D("trading.outcome").toUpperCase(),
                    size: n * e.outcome
                }, {
                    id: "qty",
                    accessorKey: "qty",
                    cell: e => e.getValue(),
                    header: () => D("trading.shares").toUpperCase(),
                    size: n * e.qty
                }, {
                    id: "avgPrice",
                    accessorKey: "avgPrice",
                    cell: e => e.getValue(),
                    header: () => D("trading.avg").toUpperCase(),
                    size: n * e.avgPrice
                }, {
                    id: "value",
                    accessorKey: "value",
                    cell: H,
                    header: () => D("trading.value").toUpperCase(),
                    size: n * e.value
                }, {
                    id: "totalReturn",
                    accessorKey: "totalReturn",
                    cell: _,
                    header: () => D("trading.return").toUpperCase(),
                    size: n * e.totalReturn
                }]
            }, [D]),
            eC = (0, c.useMemo)(() => [{
                id: "outcome",
                accessorKey: "outcome",
                cell: e => e.getValue(),
                header: () => D("trading.outcome").toUpperCase(),
                minSize: 80
            }, {
                id: "qty",
                accessorKey: "qty",
                cell: e => e.getValue(),
                header: () => D("trading.qty").toUpperCase(),
                minSize: 40
            }, {
                id: "avgPrice",
                accessorKey: "avgPrice",
                cell: e => e.getValue(),
                header: () => D("trading.avg").toUpperCase(),
                minSize: 60
            }, {
                id: "value",
                accessorKey: "value",
                cell: B,
                header: () => D("trading.value").toUpperCase(),
                minSize: 60
            }, {
                id: "totalReturn",
                accessorKey: "totalReturn",
                cell: F,
                header: () => D("trading.return").toUpperCase(),
                minSize: 120
            }, {
                id: "sell",
                accessorKey: "sell",
                header: () => null,
                minSize: ek ? 200 : eg ? 60 : 140,
                cell: e => {
                    let t = e.getValue();
                    if (eg) return (0, n.jsx)("div", {
                        className: "flex flex-col items-center -mt-1.25",
                        children: (0, n.jsx)(m.default, {
                            onClick: () => ev(e.row.id),
                            onMouseEnter: () => eb(e.row.id)
                        })
                    });
                    let s = ek && 1 === t.outcomeIdx;
                    return (0, n.jsxs)("div", {
                        className: "flex justify-end gap-2 items-center",
                        children: [s && (0, n.jsx)(N.ConvertPositionsTrigger, {
                            onClick: () => eu(!0)
                        }), !t.isClosed && (0, n.jsx)(r.Button, {
                            variant: "outline",
                            size: "sm",
                            onClick: () => ex(t),
                            children: D("trading.sell")
                        }), (0, n.jsx)(m.default, {
                            onClick: () => ev(e.row.id),
                            onMouseEnter: () => eb(e.row.id)
                        })]
                    })
                }
            }], [ex, ev, eb, eg, ek, D]),
            ej = (0, c.useMemo)(() => V ? eh : ep, [ep, eh, V]),
            ew = (0, o.useReactTable)({
                data: ej,
                columns: R ? eS : eC,
                getCoreRowModel: (0, a.getCoreRowModel)()
            }),
            eT = ej.length > 0;
        return R || eT && q ? (0, n.jsxs)(n.Fragment, {
            children: [(0, n.jsxs)("div", {
                className: (0, b.cn)("flex flex-col", ("primary" === t || "secondary" === t) && "border border-border bg-surface-1 rounded-xl"),
                style: l,
                children: [(0, n.jsxs)("div", {
                    className: "flex flex-col px-4 pt-5",
                    style: I,
                    children: [(0, n.jsx)("h3", {
                        className: "text-text font-medium",
                        children: D("trading.positions")
                    }), (0, n.jsx)(z, {})]
                }), (0, n.jsxs)("div", {
                    className: "px-4 py-0.5 overflow-x-auto",
                    style: E,
                    children: [ew.getHeaderGroups().map(e => (0, n.jsxs)("div", {
                        className: "flex w-full relative",
                        style: A,
                        children: [e.headers.map(e => (0, n.jsx)("div", {
                            className: "font-semibold text-[10px] tracking-wider text-text-secondary uppercase whitespace-nowrap",
                            style: {
                                flex: "sell" === e.column.id ? "1 1 auto" : `0 1 ${e.getSize()}px`,
                                minWidth: e.column.columnDef.minSize ? ? 60,
                                textAlign: "left",
                                paddingTop: "10px",
                                paddingBottom: "10px",
                                borderBottom: "1px solid var(--color-border)",
                                position: "relative",
                                ...O
                            },
                            children: e.isPlaceholder ? null : (0, o.flexRender)(e.column.columnDef.header, e.getContext())
                        }, e.id)), K.markets && K.markets.length > 1 && I ? .display === "none" && (0, n.jsx)("div", {
                            className: "absolute right-0 top-0 bottom-0 flex items-center",
                            style: {
                                borderBottom: "1px solid var(--color-border)"
                            },
                            children: (0, n.jsx)(z, {
                                variant: "link",
                                linkClassName: "text-xs text-text-secondary hover:underline cursor-pointer"
                            })
                        })]
                    }, e.id)), ew.getRowModel().rows.map((e, t) => (0, n.jsx)("div", {
                        className: "flex w-full h-[50px]",
                        style: P,
                        children: e.getVisibleCells().map(e => (0, n.jsx)("div", {
                            className: "whitespace-nowrap text-sm",
                            style: {
                                flex: "sell" === e.column.id ? "1 1 auto" : `0 1 ${e.column.getSize()}px`,
                                minWidth: e.column.columnDef.minSize ? ? 60,
                                ...M
                            },
                            children: "outcome" === e.getContext().column.id ? (0, n.jsx)($.OutcomeChip, {
                                outcomeIndex: 0 !== t || ef ? 1 : 0,
                                colors: L,
                                className: "font-medium text-sm",
                                children: (0, o.flexRender)(e.column.columnDef.cell, e.getContext())
                            }) : (0, o.flexRender)(e.column.columnDef.cell, e.getContext())
                        }, e.id))
                    }, e.id))]
                })]
            }), eo && (0, n.jsx)(U, {
                open: ea,
                onOpenChange: el,
                sharePosition: eo
            }), ek && (0, n.jsx)(N.ConvertPositionsDialog, {
                open: ed,
                onOpenChange: eu
            })]
        }) : null
    }], 532766)
}]);

//# debugId=1dd1fec4-9e48-c6ff-78e7-d25cee4b35e3