var ut = Object.defineProperty;
var ht = (t, e, n) => e in t ? ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var B = (t, e, n) => ht(t, typeof e != "symbol" ? e + "" : e, n);
import { jsx as i, jsxs as u, Fragment as j } from "react/jsx-runtime";
import Y, { useState as k, useRef as gt, useEffect as T, createContext as bt, useMemo as J, useCallback as M, useContext as yt } from "react";
import { f as R, i as xt, a as St, c as wt, y as vt, e as L, b as E, d as W, a8 as A, H as U, a9 as at, a7 as st } from "./PrizeCard-C2El3VOB.js";
import { P as Ct } from "./Portal-Bjgk7NwD.js";
import "react-dom";
import { y as Rt } from "./index-5MPtbA_r.js";
import { a as _t, K as kt } from "./KeyboardArrowDown-CbtwRxfA.js";
class Lt {
  constructor() {
    B(this, "handler", null);
    B(this, "queue", []);
    B(this, "listeners", /* @__PURE__ */ new Set());
    B(this, "lastState", { selections: [], stake: 0, totalOdds: 0 });
  }
  /** Called by BetslipShell on mount. Replays any queued pre-mount calls. */
  _mount(e) {
    this.handler = e, this.queue.forEach((n) => n()), this.queue = [];
  }
  /** Called by BetslipShell on unmount. */
  _unmount() {
    this.handler = null;
  }
  /** Called by BetslipStateBridge whenever context state changes. */
  _notify(e) {
    this.lastState = e, this.listeners.forEach((n) => n(e));
  }
  setSelection(e) {
    this.handler ? this.handler.setSelection(e) : this.queue.push(() => this.setSelection(e));
  }
  removeSelection(e) {
    var n;
    (n = this.handler) == null || n.removeSelection(e);
  }
  getState() {
    return this.lastState;
  }
  subscribe(e) {
    return this.listeners.add(e), () => this.listeners.delete(e);
  }
}
const N = new Lt();
function $t(t) {
  const e = {}, n = /* @__PURE__ */ new Set();
  return t.forEach((o) => {
    const a = `${o.eventId}::${o.marketId}`;
    e[a] ? (n.add(e[a]), n.add(o.id)) : e[a] = o.id;
  }), n;
}
function lt(t) {
  return t.filter((e) => e.status === "active" || !e.status).reduce((e, n) => e * n.odds, 1);
}
function Tt(t, e, n, o, a, r) {
  const l = o ?? "Away", s = e.toLowerCase(), p = (r == null ? void 0 : r.draw) || a("betslip.outcomes.draw"), c = (r == null ? void 0 : r.yes) || a("betslip.outcomes.yes"), h = (r == null ? void 0 : r.no) || a("betslip.outcomes.no"), m = (r == null ? void 0 : r.over) || a("betslip.outcomes.over"), d = (r == null ? void 0 : r.under) || a("betslip.outcomes.under"), b = (r == null ? void 0 : r.noGoal) || a("betslip.outcomes.noGoal"), f = (r == null ? void 0 : r.nobody) || a("betslip.outcomes.nobody"), g = (r == null ? void 0 : r.or) || a("betslip.outcomes.or");
  switch (t) {
    case "FT_1X2":
    case "HT_1X2":
      if (e === "1") return n;
      if (s === "x") return p;
      if (e === "2") return l;
      break;
    case "DOUBLE_CHANCE": {
      const x = e.toUpperCase();
      if (x === "1X") return `${n} ${g} ${p}`;
      if (x === "12") return `${n} ${g} ${l}`;
      if (x === "X2") return `${p} ${g} ${l}`;
      break;
    }
    case "BOTH_TEAMS_SCORE":
    case "RED_CARD_MATCH":
    case "PENALTY_MATCH":
      if (s === "yes") return c;
      if (s === "no") return h;
      break;
    case "CORRECT_SCORE":
    case "CORRECT_SCORE_ADVANCED":
    case "CORRECT_SCORE_HT": {
      const x = e.split(/[-:]/).map(Number);
      return x.length === 2 && !isNaN(x[0]) && !isNaN(x[1]) ? x[0] > x[1] ? n : x[1] > x[0] ? l : p : e;
    }
    case "HT_FT": {
      const x = e.toUpperCase();
      return (x.includes("/") ? x.split("/") : x.split("")).map((S) => S === "1" ? n : S === "2" ? l : p).join(" / ");
    }
    case "DRAW_NO_BET":
      if (e === "1") return n;
      if (e === "2") return l;
      break;
    case "FIRST_TEAM_TO_SCORE":
    case "LAST_TEAM_TO_SCORE":
      if (e === "1") return n;
      if (e === "2") return l;
      if (s === "none" || s === "no goal") return b;
      break;
    case "PLAYER_SCORE_FIRST_GOAL":
    case "PLAYER_SCORE":
    case "PLAYER_SCORE_TWICE":
    case "PLAYER_SCORE_HATTRICK":
    case "PLAYER_RED_CARD":
    case "PLAYER_YELLOW_CARD":
      return s === "none" || s === "no goal" || s === "nobody" ? f : e;
  }
  const y = t.match(/^(OVER|UNDER)_(GOALS|CORNERS)_(\d+)_(\d+)$/i);
  if (y) {
    const S = y[1].toUpperCase() === "OVER" !== (s === "no" || s === "under") ? m : d, w = `${y[3]}.${y[4]}`;
    return `${S} ${w}`;
  }
  return e;
}
function Et(t) {
  return `${t.eventId}:${t.market}:${t.outcome}`;
}
function It(t) {
  var n;
  const e = (n = t.participantTwo) == null ? void 0 : n.name;
  return e ? `${t.participantOne.name} vs ${e}` : t.participantOne.name;
}
function Ot(t, e, n) {
  return t.map((o) => {
    var a, r, l;
    return {
      id: Et(o),
      eventId: o.eventId,
      marketId: o.market,
      event: It(o),
      market: o.market,
      name: Tt(
        o.market,
        o.outcome,
        o.participantOne.name,
        (a = o.participantTwo) == null ? void 0 : a.name,
        e,
        n
      ),
      odds: 0,
      outcome: o.outcome,
      startAt: o.startAt,
      matchStatus: o.matchStatus,
      participantOne: o.participantOne.name,
      participantTwo: (r = o.participantTwo) == null ? void 0 : r.name,
      participantOneLogo: o.participantOne.logo,
      participantTwoLogo: (l = o.participantTwo) == null ? void 0 : l.logo,
      source: o.source,
      competition: o.competition,
      athlete: o.athlete
    };
  });
}
const zt = {
  HT_FT: ["first_half_and_final_result", "htft", "ht_ft"],
  BOTH_TEAMS_SCORE: ["both_to_score", "btts", "gg"],
  DOUBLE_CHANCE: ["double_chance", "dc"],
  CORRECT_SCORE: ["correct_score", "cs"],
  PLAYER_SCORE_FIRST_GOAL: ["first_goalscorer", "player_score_first_goal"],
  PLAYER_SCORE: ["anytime_goalscorer", "player_score", "anytime_scorer"],
  PLAYER_RED_CARD: ["player_red_card", "red_card"],
  PLAYER_YELLOW_CARD: ["player_yellow_card", "yellow_card"]
};
function At(t) {
  return t.replace(/^FT_/i, "").toLowerCase();
}
const ct = /^(OVER|UNDER)_(GOALS|CORNERS)_(\d+)_(\d+)$/i;
function Bt(t, e) {
  const n = t.toLowerCase();
  if (n === At(e)) return !0;
  const o = zt[e];
  return !!(o !== void 0 && o.includes(n) || ct.test(e) && n === "over_under");
}
function Dt(t) {
  const e = t.split(":");
  return e[e.length - 1];
}
function Wt(t, e) {
  return t.map((n) => {
    var h, m, d, b, f, g, y, x;
    const a = (e.get(n.eventId) ?? [])[0];
    if (!a) return n;
    const r = Dt(n.id), l = n.marketId.match(ct), s = l !== null, p = s ? r.toLowerCase() === "no" ? "under" : r.toLowerCase() === "yes" ? "over" : r.toLowerCase() : null, c = s ? `${l[3]}.${l[4]}` : null;
    for (const v of a.markets ?? [])
      if (Bt(((h = v == null ? void 0 : v.type) == null ? void 0 : h.code) ?? "", n.marketId))
        for (const S of v.selections ?? []) {
          let w;
          if (s) {
            const I = ((m = S.code) == null ? void 0 : m.toLowerCase()) === p || ((d = S.name) == null ? void 0 : d.toLowerCase()) === p, O = c === null || ((b = S.value) == null ? void 0 : b.toString()) === c;
            w = I && O;
          } else
            w = ((f = S.code) == null ? void 0 : f.toLowerCase()) === r.toLowerCase() || ((g = S.name) == null ? void 0 : g.toLowerCase()) === r.toLowerCase();
          if (w)
            return {
              ...n,
              odds: parseFloat(S.odds ?? "0") || 0,
              movement: S.movement === "UP" || S.movement === "DOWN" ? S.movement : void 0,
              selectionId: S.id ?? void 0,
              selectionUrl: ((x = (y = S.urls) == null ? void 0 : y[0]) == null ? void 0 : x.url) ?? void 0
            };
        }
    return n;
  });
}
function Ut(t, e, n) {
  const [o, a] = k(null), [r, l] = k(!1), s = gt(null), p = async (c) => {
    if (!t || c.length === 0) return;
    const h = [...new Set(c.map((b) => b.eventId))], m = [
      ...new Set(c.map((b) => b.market))
    ], d = new Rt({ marketTypes: m });
    l(!0);
    try {
      const b = await t.odds.getByMatchIds(h, d);
      a(b);
    } catch {
    } finally {
      l(!1);
    }
  };
  return T(() => (p(e), s.current && clearInterval(s.current), t && n > 0 && e.length > 0 && (s.current = setInterval(() => p(e), n)), () => {
    s.current && clearInterval(s.current);
  }), [JSON.stringify(e), n]), { oddsMap: o, oddsLoading: r };
}
function Ft(t) {
  var e, n, o;
  for (const a of t.values()) {
    const r = a[0];
    if (!r) continue;
    const l = (o = (n = (e = r.bookmaker) == null ? void 0 : e.assets) == null ? void 0 : n[0]) == null ? void 0 : o.transparentBackgroundUrl;
    if (l) return l;
  }
}
function Ht(t, e) {
  var o;
  const n = e ? "mobile" : "desktop";
  for (const a of t.values()) {
    const r = a[0];
    if (!r) continue;
    const l = ((o = r.bookmaker) == null ? void 0 : o.links) ?? [], s = l.find((p) => p.appType === n) ?? l[0];
    if (s != null && s.homepageUrl) return s.homepageUrl;
  }
}
function Pt(t) {
  var e, n, o, a, r;
  for (const l of t.values()) {
    const s = l[0];
    if (!s) continue;
    const p = ((n = (e = s.bookmaker) == null ? void 0 : e.branding) == null ? void 0 : n.backgroundColor) ?? ((r = (a = (o = s.bookmaker) == null ? void 0 : o.assets) == null ? void 0 : a[0]) == null ? void 0 : r.backgroundColor);
    if (p) return p;
  }
}
const dt = bt(null), Nt = ({
  labels: t = {},
  initialSelections: e = [],
  maxSelections: n,
  currency: o = "€",
  stakePresets: a = [5, 10, 20],
  ctaUrlTemplate: r,
  onExternalRemove: l,
  sharedOddsMap: s,
  children: p
}) => {
  const { t: c } = R(), [h, m] = k(e), [d, b] = k(""), [f, g] = k(!0), y = xt();
  T(() => {
    m(e);
  }, [JSON.stringify(e)]);
  const x = J(() => {
    if (!s) return !1;
    const C = s.values().next().value;
    return Array.isArray(C) && C[0] !== void 0;
  }, [s]), v = J(() => {
    const C = Ot(h, c, t.outcomeLabels);
    return s ? Wt(C, s) : C;
  }, [h, s, c, t.outcomeLabels]), S = $t(v), w = s ? Ft(s) : void 0, I = s ? Ht(s, y) : void 0, O = s ? Pt(s) : void 0, F = M(
    (C) => {
      m(
        (H) => H.filter((z) => `${z.eventId}:${z.market}:${z.outcome}` !== C)
      ), l == null || l(C);
    },
    [l]
  );
  return /* @__PURE__ */ i(
    dt.Provider,
    {
      value: {
        labels: t,
        selectionInputs: h,
        selections: v,
        combStake: d,
        open: f,
        oddsLoading: !1,
        oddsReady: x,
        conflictIds: S,
        currency: o,
        stakePresets: a,
        ctaUrlTemplate: r,
        maxSelections: n,
        bookmakerLogoUrl: w,
        bookmakerHomepageUrl: I,
        bookmakerBackgroundColor: O,
        onRemove: F,
        setCombStake: b,
        setOpen: g
      },
      children: p
    }
  );
}, _ = () => {
  const t = yt(dt);
  if (!t) throw new Error("useBetslip must be used within BetslipProvider");
  return t;
};
function jt(t) {
  const e = St(), n = wt(), a = vt() === "light";
  return {
    primary: t || e.palette.primary.plainColor,
    primaryHover: e.palette.primary.primaryContainer || t || e.palette.primary.plainColor,
    s1: e.surface,
    s2: e.onSurface,
    s3: a ? e.surfaceVariant : e.onSurface,
    bdr: e.outlineEnabledBorder,
    t1: e.textPrimary,
    t2: e.textSecondary,
    t3: e.textDisabled,
    ok: e.palette.success.plainColor,
    bad: e.palette.danger.plainColor,
    badSoftBg: e.palette.danger.softBg,
    warn: e.palette.warning.plainColor,
    warnSoftBg: e.palette.warning.softBg,
    font: n.primary
  };
}
const Q = ({
  tokens: t,
  isSide: e,
  position: n,
  brandingLogoUrl: o
}) => {
  const { labels: a, selections: r, open: l, setOpen: s, maxSelections: p, bookmakerLogoUrl: c } = _(), { t: h } = R(), m = L(), d = E(), g = e ? "0" : n === "bottom-right" || n === "bottom-left" ? `${d.md} ${d.md} 0 0` : n === "top-right" || n === "top-left" ? `0 0 ${d.md} ${d.md}` : "0", y = o || c, x = {
    background: "none",
    border: "none",
    cursor: "pointer",
    color: "#fff",
    padding: "5px 7px",
    fontSize: "1em",
    lineHeight: 1,
    borderRadius: d.xs,
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    transition: "background .15s"
  };
  return /* @__PURE__ */ u(
    "div",
    {
      style: {
        paddingTop: m.sm,
        paddingBottom: m.sm,
        paddingRight: m.xs,
        paddingLeft: y ? m["2xs"] : m.xs,
        background: t.primary,
        display: "flex",
        alignItems: "center",
        justifyContent: "space-between",
        flexShrink: 0,
        color: "#fff",
        borderRadius: g,
        fontFamily: t.font
      },
      children: [
        /* @__PURE__ */ u("div", { style: { display: "flex", alignItems: "center" }, children: [
          y ? /* @__PURE__ */ i(
            "img",
            {
              src: y,
              alt: "brand",
              style: {
                height: "24px",
                maxWidth: "88px",
                width: "auto",
                objectFit: "contain",
                display: "block",
                flexShrink: 0
              }
            }
          ) : /* @__PURE__ */ i(
            "span",
            {
              style: {
                fontSize: "1.0625em",
                fontWeight: 800,
                fontStyle: "italic",
                fontFamily: "'Ubuntu', sans-serif",
                letterSpacing: "-0.5px",
                color: "#fff"
              },
              children: a.title || h("betslip.title")
            }
          ),
          r.length > 0 && p != null && /* @__PURE__ */ u(
            "span",
            {
              style: {
                fontSize: "0.875em",
                fontWeight: 600,
                color: "#fff",
                marginLeft: y ? 0 : m.sm
              },
              children: [
                r.length,
                "/",
                p
              ]
            }
          )
        ] }),
        !e && /* @__PURE__ */ i(
          "button",
          {
            style: x,
            onClick: () => s(!l),
            title: l ? "Collapse" : "Expand",
            onMouseEnter: (v) => v.currentTarget.style.background = "rgba(255,255,255,.18)",
            onMouseLeave: (v) => v.currentTarget.style.background = "none",
            children: l ? /* @__PURE__ */ i(_t, { sx: { fontSize: "1.125em", color: "inherit" } }) : /* @__PURE__ */ i(kt, { sx: { fontSize: "1.125em", color: "inherit" } })
          }
        )
      ]
    }
  );
}, Z = ({ tokens: t }) => {
  const { t: e } = R(), n = L(), o = W();
  return /* @__PURE__ */ u(
    "div",
    {
      style: {
        display: "flex",
        alignItems: "center",
        gap: n.xs,
        padding: "9px 14px",
        background: t.badSoftBg,
        borderBottom: `${o.size} solid ${t.bad}`,
        flexShrink: 0
      },
      children: [
        /* @__PURE__ */ i(
          "div",
          {
            style: {
              width: 18,
              height: 18,
              borderRadius: "50%",
              border: `1.5px solid ${t.bad}`,
              flexShrink: 0,
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              fontSize: "0.6875em",
              fontWeight: 700,
              color: t.bad,
              lineHeight: 1
            },
            children: "i"
          }
        ),
        /* @__PURE__ */ i("span", { style: { fontSize: "0.75em", color: t.t1, lineHeight: 1.4 }, children: e("betslip.conflictMessage") })
      ]
    }
  );
};
function Mt(t, e, n) {
  const o = e.map((s) => s.selectionId).filter(Boolean).join(","), a = e[0], r = encodeURIComponent(
    typeof window < "u" ? window.location.href : ""
  ), l = String(n);
  return t.replace(/\{selectionIds\}/g, encodeURIComponent(o)).replace(/\{currentUrl\}/g, r).replace(/\{stake\}/g, l).replace(/\{eventId\}/g, (a == null ? void 0 : a.eventId) ?? "").replace(/\{oddsDecimal\}/g, a ? String(a.odds) : "").replace(/\{market\}/g, (a == null ? void 0 : a.marketId) ?? "").replace(/\{outcome\}/g, (a == null ? void 0 : a.name) ?? "");
}
const Yt = A.a`
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: ${({ primary: t }) => t};
  color: #fff;
  border: none;
  font-weight: 600;
  text-decoration: none;
  box-sizing: border-box;
  cursor: ${({ disabled: t }) => t ? "not-allowed" : "pointer"};
  pointer-events: ${({ disabled: t }) => t ? "none" : "auto"};
  opacity: ${({ disabled: t }) => t ? 0.4 : 1};
  &:hover {
    background: ${({ primaryHover: t }) => t};
  }
`, pt = ({
  tokens: t,
  brandingLogoUrl: e,
  hasConflicts: n
}) => {
  const {
    labels: o,
    ctaUrlTemplate: a,
    selections: r,
    combStake: l,
    bookmakerLogoUrl: s,
    bookmakerHomepageUrl: p
  } = _(), { t: c } = R(), h = e || s, m = L(), d = E(), b = o.continueLabel || c("betslip.continueLabel"), f = (() => {
    if (a)
      return Mt(
        a,
        r,
        parseFloat(l) || 0
      );
    if (p) return p;
  })(), g = n || !f;
  return /* @__PURE__ */ i("div", { children: /* @__PURE__ */ u(
    Yt,
    {
      href: g ? void 0 : f,
      target: f ? "_blank" : void 0,
      rel: f ? "noopener noreferrer" : void 0,
      primary: t.primary,
      primaryHover: t.primaryHover,
      disabled: g,
      style: {
        padding: `${m.xs} ${m.md}`,
        borderRadius: d.full,
        fontSize: "0.875em",
        fontFamily: t.font
      },
      children: [
        /* @__PURE__ */ i("span", { children: b }),
        h && /* @__PURE__ */ i(
          "img",
          {
            src: h,
            alt: "",
            style: {
              height: "20px",
              maxWidth: "72px",
              width: "auto",
              objectFit: "contain",
              verticalAlign: "middle",
              marginLeft: m.sm,
              flexShrink: 0
            }
          }
        )
      ]
    }
  ) });
}, tt = ({ color: t }) => {
  const e = W();
  return /* @__PURE__ */ i("div", { style: { borderBottom: `${e.size} solid ${t}` } });
}, Vt = ({
  tokens: t,
  brandingLogoUrl: e
}) => {
  const { labels: n, selections: o, combStake: a, conflictIds: r, currency: l } = _(), { t: s } = R(), p = L(), c = o.filter(
    (g) => g.status === "active" || !g.status
  ), h = lt(c), m = parseFloat(a) || 0, d = m * h, b = r.size > 0, f = {
    display: "flex",
    justifyContent: "space-between",
    alignItems: "center",
    padding: "6px 0"
  };
  return /* @__PURE__ */ u(
    "div",
    {
      style: {
        background: t.s1,
        padding: `10px 14px ${p.sm}`,
        fontFamily: t.font
      },
      children: [
        /* @__PURE__ */ u("div", { style: f, children: [
          /* @__PURE__ */ i("span", { style: { fontSize: "0.6875em", color: t.t3 }, children: n.combinedOddsLabel || s("betslip.combinedOddsLabel") }),
          /* @__PURE__ */ u(
            "span",
            {
              style: {
                fontSize: "0.6875em",
                color: t.t1,
                fontWeight: 600,
                display: "flex",
                alignItems: "center",
                gap: 3
              },
              children: [
                /* @__PURE__ */ i("span", { style: { fontSize: "0.5em", color: t.ok }, children: "▲" }),
                h.toFixed(2)
              ]
            }
          )
        ] }),
        /* @__PURE__ */ i(tt, { color: t.bdr }),
        /* @__PURE__ */ u("div", { style: f, children: [
          /* @__PURE__ */ i("span", { style: { fontSize: "0.8125em", fontWeight: 700, color: t.t1 }, children: n.totalStakeLabel || s("betslip.totalStakeLabel") }),
          /* @__PURE__ */ i("span", { style: { fontSize: "0.8125em", fontWeight: 700, color: t.t1 }, children: m > 0 ? `${m.toFixed(2)}${l}` : "—" })
        ] }),
        /* @__PURE__ */ i(tt, { color: t.bdr }),
        /* @__PURE__ */ u("div", { style: { ...f, borderBottom: "none", marginBottom: 10 }, children: [
          /* @__PURE__ */ i("span", { style: { fontSize: "0.8125em", fontWeight: 700, color: t.t1 }, children: n.potentialWinLabel || s("betslip.potentialWinLabel") }),
          /* @__PURE__ */ i(
            "span",
            {
              style: {
                fontSize: "0.8125em",
                fontWeight: 700,
                color: d > 0 ? t.primary : t.t1
              },
              children: d > 0 ? d.toFixed(2) : "—"
            }
          )
        ] }),
        /* @__PURE__ */ i(
          pt,
          {
            tokens: t,
            brandingLogoUrl: e,
            hasConflicts: b
          }
        )
      ]
    }
  );
};
function Gt(t, e, n) {
  if (n != null && n[t]) return n[t];
  const o = `betslip.markets.${t}`, a = e(o);
  if (a !== o) return a;
  const r = t.match(/^(OVER|UNDER)_(GOALS|CORNERS)_(\d+)_(\d+)$/i);
  if (r) {
    const l = r[2].charAt(0) + r[2].slice(1).toLowerCase(), s = `betslip.markets.${r[1].toUpperCase() === "OVER" ? "over" : "under"}${l}`, p = `${r[3]}.${r[4]}`, c = e(s, { line: p });
    if (c !== s) return c;
  }
  return t.replace(/_/g, " ").toLowerCase().replace(/\b\w/g, (l) => l.toUpperCase());
}
const Xt = U`
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
`, Kt = U`
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
`, qt = A.div`
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: ${({ color: t }) => t};
  animation: ${Kt} 0.7s linear infinite;
  flex-shrink: 0;
`, Jt = () => /* @__PURE__ */ i("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ i("path", { d: "M7 4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v1h3a1 1 0 1 1 0 2h-1l-1.4 13.2A2 2 0 0 1 16.6 22H7.4a2 2 0 0 1-2-1.8L4 7H3a1 1 0 1 1 0-2h3V4zm2 0v1h6V4H9zm-3 3 1.4 12h9.2L18 7H6zm4 2a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0v-7a1 1 0 0 1 1-1zm4 0a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0v-7a1 1 0 0 1 1-1z" }) }), Qt = A.div`
  animation: ${Xt} 0.18s ease;
`, Zt = U`
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
`, te = A.span`
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  animation: ${Zt} 1s ease-in-out infinite;
`;
function ee(t, e, n) {
  if (!t) return "";
  const o = new Date(t);
  if (isNaN(o.getTime())) return "";
  const a = /* @__PURE__ */ new Date(), r = a.toDateString(), l = new Date(a.getTime() + 864e5).toDateString(), s = o.toLocaleTimeString(e, {
    hour: "2-digit",
    minute: "2-digit"
  });
  return o.toDateString() === r ? `${n("betslip.today")} ${s}` : o.toDateString() === l ? `${n("betslip.tomorrow")} ${s}` : `${o.toLocaleDateString(e, { month: "short", day: "numeric" })} ${s}`;
}
const et = ({
  logo: t,
  name: e,
  tokens: n,
  size: o = 18
}) => /* @__PURE__ */ i(
  "div",
  {
    style: {
      width: o,
      height: o,
      borderRadius: "50%",
      background: n.s2,
      flexShrink: 0,
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      fontSize: o * 0.55,
      overflow: "hidden"
    },
    children: t ? /* @__PURE__ */ i(
      "img",
      {
        src: t,
        alt: e,
        style: { width: "100%", height: "100%", objectFit: "contain" }
      }
    ) : /* @__PURE__ */ i("span", { style: { color: n.t2, fontWeight: 700 }, children: e.charAt(0) })
  }
), ne = ({ avatar: t, name: e, tokens: n }) => /* @__PURE__ */ i(
  "div",
  {
    style: {
      width: 22,
      height: 22,
      borderRadius: "50%",
      flexShrink: 0,
      background: n.s2,
      overflow: "hidden",
      display: "flex",
      alignItems: "center",
      justifyContent: "center",
      fontSize: "0.6875em",
      fontWeight: 700
    },
    children: t ? /* @__PURE__ */ i(
      "img",
      {
        src: t,
        alt: e,
        style: { width: "100%", height: "100%", objectFit: "cover" }
      }
    ) : /* @__PURE__ */ i("span", { style: { color: n.t2 }, children: e.charAt(0) })
  }
), oe = ({ name: t, logo: e, tokens: n }) => {
  const o = L(), a = E(), [r, l] = Y.useState(!1);
  return e ? /* @__PURE__ */ u(
    "div",
    {
      style: { position: "relative", display: "inline-flex" },
      onMouseEnter: () => l(!0),
      onMouseLeave: () => l(!1),
      children: [
        /* @__PURE__ */ i(
          "div",
          {
            style: {
              width: 20,
              height: 20,
              borderRadius: "50%",
              overflow: "hidden",
              background: n.s2,
              flexShrink: 0
            },
            children: /* @__PURE__ */ i(
              "img",
              {
                src: e,
                alt: t,
                style: { width: "100%", height: "100%", objectFit: "contain" }
              }
            )
          }
        ),
        r && /* @__PURE__ */ i(
          "div",
          {
            style: {
              position: "absolute",
              top: "calc(100% + 5px)",
              right: 0,
              background: "#1e293b",
              color: "#fff",
              fontSize: "0.6875em",
              fontWeight: 500,
              padding: `${o["2xs"]} ${o.xs}`,
              borderRadius: a.xs,
              whiteSpace: "nowrap",
              zIndex: 10,
              pointerEvents: "none",
              boxShadow: "0 2px 8px rgba(0,0,0,.25)"
            },
            children: t
          }
        )
      ]
    }
  ) : /* @__PURE__ */ i(
    "span",
    {
      style: { fontSize: "0.625em", color: n.t3, whiteSpace: "nowrap" },
      children: t
    }
  );
}, nt = ({
  score: t,
  tokens: e
}) => {
  const n = L(), o = E();
  return /* @__PURE__ */ i(
    "span",
    {
      style: {
        background: e.s1,
        color: e.t1,
        fontWeight: 700,
        fontSize: "0.75em",
        borderRadius: o.xs,
        minWidth: 20,
        height: 20,
        display: "inline-flex",
        alignItems: "center",
        justifyContent: "center",
        flexShrink: 0,
        padding: `0 ${n["2xs"]}`
      },
      children: t
    }
  );
}, ie = ({
  sel: t,
  tokens: e
}) => {
  const { labels: n, oddsLoading: o } = _(), { t: a } = R(), { status: r, odds: l, movement: s } = t;
  return r === "settled_won" ? /* @__PURE__ */ u("span", { style: { color: e.ok, fontSize: "0.8125em", fontWeight: 700 }, children: [
    "✓ ",
    a("betslip.settledWon")
  ] }) : r === "settled_lost" ? /* @__PURE__ */ u(
    "span",
    {
      style: { color: e.bad, fontSize: "0.8125em", fontWeight: 700 },
      children: [
        "✗ ",
        a("betslip.settledLost")
      ]
    }
  ) : r === "settled_void" ? /* @__PURE__ */ i("span", { style: { fontSize: "0.8125em", fontWeight: 700, color: e.t3 }, children: a("betslip.settledVoid") }) : r === "suspended" ? /* @__PURE__ */ i("span", { style: { fontSize: "0.75em", fontWeight: 600, color: e.warn }, children: n.suspendedLabel || a("betslip.suspendedLabel") }) : o ? /* @__PURE__ */ i(qt, { color: e.t3 }) : l === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "0.8125em", fontWeight: 600, color: e.t3 }, children: n.oddsUnavailableLabel || a("betslip.oddsUnavailableLabel") }) : /* @__PURE__ */ u("div", { style: { display: "flex", alignItems: "center", gap: 3 }, children: [
    s && /* @__PURE__ */ i(
      "span",
      {
        style: {
          fontSize: "0.5625em",
          color: s === "UP" ? e.ok : e.bad,
          lineHeight: 1
        },
        children: s === "UP" ? "▲" : "▼"
      }
    ),
    /* @__PURE__ */ i("span", { style: { fontSize: "0.875em", fontWeight: 700, color: e.t1 }, children: l.toFixed(2) })
  ] });
}, re = ({ sel: t, tokens: e, isConflict: n }) => {
  const { onRemove: o, labels: a } = _(), { t: r, i18n: l } = R(), s = L(), p = E(), c = W(), [h, m] = Y.useState(!1), d = ee(t.startAt, l.language, r), b = t.marketId === "CORRECT_SCORE" || t.marketId === "CORRECT_SCORE_ADVANCED" || t.marketId === "CORRECT_SCORE_HT", f = b && t.outcome ? t.outcome.split(/[-:]/) : null, g = f == null ? void 0 : f[0], y = f == null ? void 0 : f[1];
  return /* @__PURE__ */ u(
    Qt,
    {
      style: {
        fontFamily: e.font,
        ...n ? {
          padding: "14px 0 0",
          overflow: "hidden",
          background: e.warnSoftBg,
          border: `${c.size} solid ${e.bad}`,
          borderRadius: p.sm,
          margin: "6px 8px"
        } : {
          padding: "14px 12px"
        }
      },
      children: [
        /* @__PURE__ */ u(
          "div",
          {
            style: {
              display: "flex",
              justifyContent: "space-between",
              alignItems: "flex-start",
              gap: s.xs,
              marginBottom: s["3xs"],
              ...n && { paddingLeft: s.xs }
            },
            children: [
              /* @__PURE__ */ u("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
                t.athlete && /* @__PURE__ */ i(
                  ne,
                  {
                    avatar: t.athlete.avatar,
                    name: t.athlete.name,
                    tokens: e
                  }
                ),
                /* @__PURE__ */ i(
                  "span",
                  {
                    style: {
                      fontSize: "0.8125em",
                      fontWeight: 700,
                      color: n ? e.bad : e.t1
                    },
                    children: t.name
                  }
                )
              ] }),
              /* @__PURE__ */ u(
                "div",
                {
                  style: {
                    display: "flex",
                    alignItems: "center",
                    gap: 6,
                    flexShrink: 0
                  },
                  children: [
                    /* @__PURE__ */ i(ie, { sel: t, tokens: e }),
                    /* @__PURE__ */ i(
                      "button",
                      {
                        onClick: () => o(t.id),
                        onMouseEnter: () => m(!0),
                        onMouseLeave: () => m(!1),
                        title: "Remove",
                        style: {
                          background: h ? "rgba(239,68,68,.08)" : "none",
                          border: "none",
                          cursor: "pointer",
                          color: h ? e.bad : e.t2,
                          fontSize: "0.8125em",
                          padding: "3px 5px",
                          borderRadius: p.xs,
                          transition: "color .15s, background .15s",
                          lineHeight: 1,
                          display: "flex",
                          alignItems: "center"
                        },
                        children: /* @__PURE__ */ i(Jt, {})
                      }
                    )
                  ]
                }
              )
            ]
          }
        ),
        /* @__PURE__ */ i(
          "div",
          {
            style: {
              fontSize: "0.6875em",
              color: e.t3,
              marginBottom: 6,
              ...n && { paddingLeft: 8 }
            },
            children: Gt(t.marketId, r, a.marketLabels)
          }
        ),
        /* @__PURE__ */ i(
          "div",
          {
            style: n ? { background: e.s3, paddingTop: 7, paddingBottom: 7 } : {
              background: e.s3,
              borderRadius: p.sm,
              padding: "7px 10px",
              marginTop: 6
            },
            children: /* @__PURE__ */ u(
              "div",
              {
                style: {
                  display: "flex",
                  alignItems: "stretch",
                  gap: 10,
                  padding: n ? `0 ${s.sm}` : 0
                },
                children: [
                  /* @__PURE__ */ i(
                    "div",
                    {
                      style: {
                        flex: "0 1 auto",
                        minWidth: 0,
                        display: "flex",
                        alignItems: "center"
                      },
                      children: /* @__PURE__ */ u(
                        "div",
                        {
                          style: {
                            display: "grid",
                            gridTemplateColumns: b ? "auto minmax(0, auto) auto" : "auto minmax(0, auto)",
                            columnGap: 6,
                            rowGap: s["2xs"],
                            alignItems: "center"
                          },
                          children: [
                            /* @__PURE__ */ i(
                              et,
                              {
                                logo: t.participantOneLogo,
                                name: t.participantOne ?? "",
                                tokens: e
                              }
                            ),
                            /* @__PURE__ */ i(
                              "span",
                              {
                                style: {
                                  fontSize: "0.75em",
                                  color: e.t1,
                                  overflow: "hidden",
                                  textOverflow: "ellipsis",
                                  whiteSpace: "nowrap"
                                },
                                children: t.participantOne
                              }
                            ),
                            b && (g !== void 0 ? /* @__PURE__ */ i(nt, { score: g, tokens: e }) : /* @__PURE__ */ i("span", {})),
                            t.participantTwo && /* @__PURE__ */ i(
                              et,
                              {
                                logo: t.participantTwoLogo,
                                name: t.participantTwo,
                                tokens: e
                              }
                            ),
                            t.participantTwo && /* @__PURE__ */ i(
                              "span",
                              {
                                style: {
                                  fontSize: "0.75em",
                                  color: e.t1,
                                  overflow: "hidden",
                                  textOverflow: "ellipsis",
                                  whiteSpace: "nowrap"
                                },
                                children: t.participantTwo
                              }
                            ),
                            t.participantTwo && b && (y !== void 0 ? /* @__PURE__ */ i(nt, { score: y, tokens: e }) : /* @__PURE__ */ i("span", {}))
                          ]
                        }
                      )
                    }
                  ),
                  (t.matchStatus === "inprogress" || d || t.competition) && /* @__PURE__ */ u(
                    "div",
                    {
                      style: {
                        marginLeft: "auto",
                        flexShrink: 0,
                        display: "flex",
                        flexDirection: "column",
                        justifyContent: "space-between",
                        alignItems: "flex-end"
                      },
                      children: [
                        t.matchStatus === "inprogress" ? /* @__PURE__ */ u(
                          "span",
                          {
                            style: {
                              display: "inline-flex",
                              alignItems: "center",
                              gap: 3,
                              backgroundColor: e.bad,
                              color: "#fff",
                              fontSize: "0.6em",
                              fontWeight: 700,
                              letterSpacing: "0.07em",
                              padding: "2px 5px",
                              borderRadius: 3,
                              textTransform: "uppercase",
                              whiteSpace: "nowrap",
                              fontFamily: e.font
                            },
                            children: [
                              /* @__PURE__ */ i(te, {}),
                              r("betslip.live")
                            ]
                          }
                        ) : d ? /* @__PURE__ */ i(
                          "span",
                          {
                            style: {
                              fontSize: "0.625em",
                              color: e.t3,
                              whiteSpace: "nowrap"
                            },
                            children: d
                          }
                        ) : null,
                        t.competition && /* @__PURE__ */ i(
                          oe,
                          {
                            name: t.competition.name,
                            logo: t.competition.logo,
                            tokens: e
                          }
                        )
                      ]
                    }
                  )
                ]
              }
            )
          }
        )
      ]
    }
  );
}, ot = ({
  tokens: t,
  isSide: e
}) => {
  const { labels: n, selections: o, conflictIds: a } = _(), { t: r } = R();
  return /* @__PURE__ */ u(j, { children: [
    /* @__PURE__ */ i(
      at,
      {
        styles: st`
          .bs-scrollbody::-webkit-scrollbar {
            width: 8px;
          }
          .bs-scrollbody::-webkit-scrollbar-track {
            background: transparent;
            margin: 6px 0;
          }
          .bs-scrollbody::-webkit-scrollbar-thumb {
            background: ${t.s3};
            border-radius: 6px;
            border-right: 4px solid transparent;
            background-clip: padding-box;
          }
        `
      }
    ),
    /* @__PURE__ */ i(
      "div",
      {
        className: "bs-scrollbody",
        style: {
          overflowY: "auto",
          flex: 1,
          minHeight: 0,
          maxHeight: e ? "none" : 300,
          background: t.s1
        },
        children: o.length === 0 ? /* @__PURE__ */ u(
          "div",
          {
            style: {
              padding: "36px 20px",
              textAlign: "center",
              fontFamily: t.font
            },
            children: [
              /* @__PURE__ */ i("div", { style: { fontSize: "2.5em", opacity: 0.25, marginBottom: 14 }, children: "🎯" }),
              /* @__PURE__ */ i(
                "div",
                {
                  style: {
                    fontSize: "0.875em",
                    fontWeight: 600,
                    color: t.t1,
                    marginBottom: 6
                  },
                  children: n.emptyTitle || r("betslip.emptyTitle")
                }
              ),
              /* @__PURE__ */ i("div", { style: { fontSize: "0.75em", color: t.t2, lineHeight: 1.5 }, children: n.emptyDescription || r("betslip.emptyDescription") })
            ]
          }
        ) : o.map((l) => /* @__PURE__ */ i(
          re,
          {
            sel: l,
            tokens: t,
            isConflict: a.has(l.id)
          },
          l.id
        ))
      }
    )
  ] });
}, ae = A.button`
  background: ${({ primary: t }) => t};
  color: #fff;
  border: none;
  width: 44px;
  cursor: pointer;
  flex-shrink: 0;
  &:hover {
    background: ${({ primary: t }) => t};
    opacity: 0.88;
  }
`, it = ({ tokens: t, brandingLogoUrl: e }) => {
  const {
    labels: n,
    selections: o,
    combStake: a,
    setCombStake: r,
    conflictIds: l,
    currency: s,
    stakePresets: p
  } = _(), { t: c } = R(), h = L(), m = E(), d = W(), b = o.filter(
    (w) => w.status === "active" || !w.status
  ), f = lt(b), g = parseFloat(a) || 0, y = g * f, x = l.size > 0, v = (w) => {
    r(String(w));
  }, S = Y.useRef(null);
  return /* @__PURE__ */ u(j, { children: [
    /* @__PURE__ */ i(
      at,
      {
        styles: st`
          .bs-stake-input::-webkit-outer-spin-button,
          .bs-stake-input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
          }
          .bs-stake-input {
            -moz-appearance: textfield;
          }
        `
      }
    ),
    /* @__PURE__ */ i(
      "div",
      {
        style: {
          padding: `${h.sm} 14px`,
          flexShrink: 0,
          borderTop: `${d.size} solid ${t.bdr}`,
          background: t.s3,
          fontFamily: t.font
        },
        children: /* @__PURE__ */ u(j, { children: [
          b.length > 0 && /* @__PURE__ */ u(
            "div",
            {
              style: {
                display: "flex",
                justifyContent: "space-between",
                fontSize: "0.75em",
                color: t.t2,
                padding: "3px 0",
                paddingBottom: h.xs
              },
              children: [
                /* @__PURE__ */ i("span", { children: n.combinedOddsLabel || c("betslip.combinedOddsLabel") }),
                /* @__PURE__ */ u(
                  "span",
                  {
                    style: {
                      display: "flex",
                      alignItems: "center",
                      gap: h["2xs"],
                      fontSize: "0.8125em",
                      fontWeight: 600,
                      color: t.t1
                    },
                    children: [
                      /* @__PURE__ */ i("span", { style: { fontSize: "0.5625em", color: t.ok }, children: "▲" }),
                      f.toFixed(2)
                    ]
                  }
                )
              ]
            }
          ),
          /* @__PURE__ */ u(
            "div",
            {
              style: {
                display: "flex",
                alignItems: "center",
                gap: 6,
                marginBottom: 10
              },
              children: [
                /* @__PURE__ */ i(
                  "span",
                  {
                    style: { fontSize: "0.75em", color: t.t2, flexShrink: 0 },
                    children: n.stakeLabel || c("betslip.stakeLabel")
                  }
                ),
                /* @__PURE__ */ i("div", { style: { flex: 1, position: "relative", marginBottom: 0 }, children: /* @__PURE__ */ i(
                  "input",
                  {
                    ref: S,
                    className: "bs-stake-input",
                    type: "number",
                    min: "0",
                    step: "1",
                    value: a,
                    onChange: (w) => r(w.target.value),
                    placeholder: "0",
                    onFocus: (w) => w.currentTarget.style.borderColor = t.primary,
                    onBlur: (w) => w.currentTarget.style.borderColor = t.bdr,
                    style: {
                      width: "100%",
                      background: t.s1,
                      border: `${d.size} solid ${t.bdr}`,
                      color: t.t1,
                      padding: "10px",
                      borderRadius: m.sm,
                      fontSize: "0.875em",
                      fontFamily: t.font,
                      outline: "none",
                      transition: "border-color .15s",
                      boxSizing: "border-box"
                    }
                  }
                ) }),
                p.map((w) => /* @__PURE__ */ i(
                  ae,
                  {
                    primary: t.primary,
                    onClick: () => v(w),
                    style: {
                      padding: "10px 0",
                      borderRadius: m.sm,
                      fontSize: "0.8125em",
                      fontWeight: 700,
                      fontFamily: t.font,
                      textAlign: "center"
                    },
                    children: w
                  },
                  w
                ))
              ]
            }
          ),
          /* @__PURE__ */ u("div", { style: { marginBottom: 10 }, children: [
            /* @__PURE__ */ u(
              "div",
              {
                style: {
                  display: "flex",
                  justifyContent: "space-between",
                  fontSize: "0.8125em",
                  color: t.t1,
                  fontWeight: 600,
                  padding: "3px 0"
                },
                children: [
                  /* @__PURE__ */ i("span", { children: n.totalStakeLabel || c("betslip.totalStakeLabel") }),
                  /* @__PURE__ */ i("span", { children: g > 0 ? `${g.toFixed(2)}${s}` : "—" })
                ]
              }
            ),
            /* @__PURE__ */ u(
              "div",
              {
                style: {
                  display: "flex",
                  justifyContent: "space-between",
                  fontSize: "0.8125em",
                  color: t.t1,
                  fontWeight: 600,
                  padding: "3px 0",
                  borderTop: `${d.size} solid ${t.bdr}`
                },
                children: [
                  /* @__PURE__ */ i("span", { children: n.potentialWinLabel || c("betslip.potentialWinLabel") }),
                  /* @__PURE__ */ i(
                    "span",
                    {
                      style: {
                        color: y > 0 ? t.primary : void 0
                      },
                      children: y > 0 ? y.toFixed(2) : "—"
                    }
                  )
                ]
              }
            )
          ] }),
          /* @__PURE__ */ i(
            pt,
            {
              tokens: t,
              brandingLogoUrl: e,
              hasConflicts: x
            }
          ),
          n.disclaimer && /* @__PURE__ */ i(
            "div",
            {
              style: {
                fontSize: "0.625em",
                color: t.t3,
                textAlign: "center",
                marginTop: h.xs,
                lineHeight: 1.5,
                padding: `0 ${h["3xs"]}`
              },
              children: n.disclaimer
            }
          )
        ] })
      }
    )
  ] });
};
function se(t, e) {
  const [n, o] = k([]), [a, r] = k((e == null ? void 0 : e.length) > 0);
  return T(() => {
    if (!(e != null && e.length)) {
      o([]), r(!1);
      return;
    }
    const l = e.map((p) => {
      const c = p.split(":"), h = c[c.length - 1], m = c[c.length - 2];
      return { eventId: c.slice(0, c.length - 2).join(":"), market: m, outcome: h };
    }), s = [...new Set(l.map((p) => p.eventId))];
    r(!0), t.football.getMatches({ matchIds: s }).then((p) => {
      const c = new Map(
        p.data.map((m) => [m.id, m])
      ), h = l.flatMap(
        ({ eventId: m, market: d, outcome: b }) => {
          var g, y, x, v, S;
          const f = c.get(m);
          return f ? [
            {
              eventId: m,
              market: d,
              outcome: b,
              participantOne: {
                name: f.homeTeam.name,
                logo: (g = f.homeTeam.assets) == null ? void 0 : g.logo
              },
              participantTwo: {
                name: f.awayTeam.name,
                logo: (y = f.awayTeam.assets) == null ? void 0 : y.logo
              },
              startAt: f.kickoffAt,
              matchStatus: (x = f.status) == null ? void 0 : x.type,
              competition: (v = f.context) != null && v.competition ? {
                name: f.context.competition.name,
                logo: (S = f.context.competition.assets) == null ? void 0 : S.logo
              } : void 0
            }
          ] : [];
        }
      );
      o(h);
    }).catch(() => o([])).finally(() => r(!1));
  }, [JSON.stringify(e)]), { selectionInputs: n, loading: a };
}
const le = U`
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
`, ce = U`
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
`;
function de(t) {
  return t.startsWith("top") ? ce : le;
}
const pe = A.div`
  position: fixed;
  z-index: 999;
  animation: ${({ pos: t }) => de(t)} 0.22s ease;
`, D = 320, rt = 340;
function me(t) {
  return t === "bottom-right" ? { bottom: 16, right: 16, width: D } : t === "bottom-left" ? { bottom: 16, left: 16, width: D } : t === "top-right" ? { top: 16, right: 16, width: D } : t === "top-left" ? { top: 16, left: 16, width: D } : { bottom: 16, right: 16, width: D };
}
const fe = () => {
  const { selectionInputs: t, combStake: e, selections: n } = _(), o = parseFloat(e) || 0, a = n.length ? n.reduce((r, l) => r * l.odds, 1) : 0;
  return T(() => {
    N._notify({ selections: t, stake: o, totalOdds: a });
  }, [t, o, a]), T(() => () => N._notify({ selections: [], stake: 0, totalOdds: 0 }), []), null;
}, ue = ({ props: t }) => {
  var I, O, F, C, H, z, V, G, X, K;
  const { position: e = "bottom-right", brandingLogoUrl: n } = t, {
    open: o,
    setOpen: a,
    conflictIds: r,
    selections: l,
    maxSelections: s,
    bookmakerLogoUrl: p,
    bookmakerBackgroundColor: c,
    oddsReady: h
  } = _(), m = ((H = (C = (F = (O = (I = t.themeOptions) == null ? void 0 : I.colorSchemes) == null ? void 0 : O.light) == null ? void 0 : F.palette) == null ? void 0 : C.primary) == null ? void 0 : H.plainColor) != null || ((K = (X = (G = (V = (z = t.themeOptions) == null ? void 0 : z.colorSchemes) == null ? void 0 : V.dark) == null ? void 0 : G.palette) == null ? void 0 : X.primary) == null ? void 0 : K.plainColor) != null, d = jt(
    m ? void 0 : c
  ), b = E(), f = W(), g = e.startsWith("side"), y = e === "top-right" || e === "top-left", x = r.size > 0, { t: v } = R();
  if (!h) return null;
  if (g) {
    const $ = e === "side-right", P = $ ? "right" : "left", q = n || p, mt = o ? rt : 0, ft = o ? "translateX(0)" : `translateX(${$ ? "100%" : "-100%"})`;
    return /* @__PURE__ */ u(
      "div",
      {
        style: {
          position: "fixed",
          top: 0,
          [P]: 0,
          zIndex: 999,
          height: "100vh",
          width: 0,
          pointerEvents: "none",
          overflow: "visible"
        },
        children: [
          /* @__PURE__ */ u(
            "div",
            {
              style: {
                position: "absolute",
                [P]: mt,
                top: "33%",
                transform: "translateY(-50%)",
                pointerEvents: "all",
                transition: `${P} 0.3s ease`,
                display: "flex",
                flexDirection: "column",
                alignItems: "center",
                gap: 6
              },
              children: [
                /* @__PURE__ */ i(
                  "button",
                  {
                    onClick: () => a(!o),
                    title: v(o ? "betslip.hide" : "betslip.show"),
                    style: {
                      position: "relative",
                      display: "flex",
                      alignItems: "center",
                      justifyContent: "center",
                      width: 32,
                      height: 64,
                      background: d.primary,
                      border: "none",
                      cursor: "pointer",
                      borderRadius: $ ? "8px 0 0 8px" : "0 8px 8px 0",
                      boxShadow: $ ? "-4px 0 12px rgba(0,0,0,.22)" : "4px 0 12px rgba(0,0,0,.22)",
                      overflow: "hidden",
                      padding: 0
                    },
                    children: q ? /* @__PURE__ */ i(
                      "img",
                      {
                        src: q,
                        alt: "brand",
                        style: {
                          position: "absolute",
                          top: "50%",
                          left: "50%",
                          width: 52,
                          height: 22,
                          objectFit: "contain",
                          transform: `translate(-50%, -50%) rotate(${$ ? "-90" : "90"}deg)`
                        }
                      }
                    ) : /* @__PURE__ */ u("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
                      /* @__PURE__ */ i(
                        "div",
                        {
                          style: {
                            width: 12,
                            height: 2,
                            background: "rgba(255,255,255,.7)",
                            borderRadius: 1
                          }
                        }
                      ),
                      /* @__PURE__ */ i(
                        "div",
                        {
                          style: {
                            width: 12,
                            height: 2,
                            background: "rgba(255,255,255,.7)",
                            borderRadius: 1
                          }
                        }
                      ),
                      /* @__PURE__ */ i(
                        "div",
                        {
                          style: {
                            width: 12,
                            height: 2,
                            background: "rgba(255,255,255,.7)",
                            borderRadius: 1
                          }
                        }
                      )
                    ] })
                  }
                ),
                !o && s != null && /* @__PURE__ */ u(
                  "div",
                  {
                    style: {
                      fontSize: "0.625rem",
                      fontWeight: 700,
                      color: "#fff",
                      fontFamily: d.font,
                      background: d.primary,
                      borderRadius: 4,
                      padding: "2px 5px",
                      whiteSpace: "nowrap",
                      boxShadow: $ ? "-2px 2px 6px rgba(0,0,0,.2)" : "2px 2px 6px rgba(0,0,0,.2)"
                    },
                    children: [
                      l.length,
                      "/",
                      s
                    ]
                  }
                )
              ]
            }
          ),
          /* @__PURE__ */ u(
            "div",
            {
              style: {
                position: "absolute",
                top: 0,
                [P]: 0,
                width: rt,
                height: "100%",
                transform: ft,
                transition: "transform 0.3s ease",
                pointerEvents: o ? "all" : "none",
                display: "flex",
                flexDirection: "column",
                background: d.s1,
                boxShadow: $ ? "-6px 0 24px rgba(0,0,0,.18)" : "6px 0 24px rgba(0,0,0,.18)",
                outline: `${f.size} solid ${d.bdr}`
              },
              children: [
                /* @__PURE__ */ i(
                  Q,
                  {
                    tokens: d,
                    isSide: g,
                    position: e,
                    brandingLogoUrl: n
                  }
                ),
                x && /* @__PURE__ */ i(Z, { tokens: d }),
                /* @__PURE__ */ u(
                  "div",
                  {
                    style: {
                      display: "flex",
                      flexDirection: "column",
                      flex: 1,
                      minHeight: 0,
                      overflow: "hidden"
                    },
                    children: [
                      /* @__PURE__ */ i(ot, { tokens: d, isSide: g }),
                      /* @__PURE__ */ i(it, { tokens: d, brandingLogoUrl: n })
                    ]
                  }
                )
              ]
            }
          )
        ]
      }
    );
  }
  const S = y ? `0 0 ${b.md} ${b.md}` : `${b.md} ${b.md} 0 0`, w = me(e);
  return /* @__PURE__ */ i(
    pe,
    {
      pos: e,
      style: {
        fontFamily: d.font,
        borderRadius: S,
        overflow: "hidden",
        boxShadow: y ? "0 4px 16px rgba(0,0,0,.2)" : "0 -4px 16px rgba(0,0,0,.2)",
        outline: `${f.size} solid ${d.primary}`,
        ...w
      },
      children: /* @__PURE__ */ u(
        "div",
        {
          style: {
            display: "flex",
            flexDirection: "column",
            maxHeight: "calc(100vh - 64px)",
            background: d.s1
          },
          children: [
            /* @__PURE__ */ i(
              Q,
              {
                tokens: d,
                isSide: g,
                position: e,
                brandingLogoUrl: n
              }
            ),
            x && /* @__PURE__ */ i(Z, { tokens: d }),
            !o && l.length > 0 && /* @__PURE__ */ i(
              Vt,
              {
                tokens: d,
                brandingLogoUrl: n
              }
            ),
            o && /* @__PURE__ */ u(
              "div",
              {
                style: {
                  display: "flex",
                  flexDirection: "column",
                  flex: 1,
                  minHeight: 0,
                  overflow: "hidden"
                },
                children: [
                  /* @__PURE__ */ i(ot, { tokens: d, isSide: g }),
                  /* @__PURE__ */ i(it, { tokens: d, brandingLogoUrl: n })
                ]
              }
            )
          ]
        }
      )
    }
  );
}, he = (t) => {
  const [e, n] = k([]), { selectionInputs: o, loading: a } = se(
    t.sdk,
    e
  ), r = o.filter(
    (c) => c.matchStatus !== "finished"
  ), { oddsMap: l } = Ut(
    t.sdk,
    r,
    t.oddsPollingInterval || 3e4
  ), s = M((c) => {
    const h = c.split(":"), m = h[h.length - 2], d = h.slice(0, h.length - 2).join(":");
    n((b) => {
      const f = b.findIndex((g) => {
        const y = g.split(":");
        return y.slice(0, y.length - 2).join(":") === d && y[y.length - 2] === m;
      });
      if (f !== -1) {
        const g = [...b];
        return g[f] = c, g;
      }
      return [...b, c];
    });
  }, []), p = M((c) => {
    n((h) => h.filter((m) => m !== c));
  }, []);
  return T(() => {
    o.filter((c) => c.matchStatus === "finished").forEach((c) => p(`${c.eventId}:${c.market}:${c.outcome}`));
  }, [o, p]), T(() => (N._mount({ setSelection: s, removeSelection: p }), () => N._unmount()), [s, p]), !e.length || !r.length && a ? null : /* @__PURE__ */ u(
    Nt,
    {
      labels: t.labels,
      initialSelections: r,
      maxSelections: t.maxSelections,
      currency: t.currency,
      stakePresets: t.stakePresets,
      ctaUrlTemplate: t.ctaUrlTemplate,
      onExternalRemove: p,
      sharedOddsMap: l,
      children: [
        /* @__PURE__ */ i(fe, {}),
        /* @__PURE__ */ i(ue, { props: t })
      ]
    }
  );
}, Re = (t) => /* @__PURE__ */ i(
  Ct,
  {
    packageName: "betslip",
    language: t.language,
    themeOptions: t.themeOptions,
    sdk: t.sdk,
    entityId: "",
    children: /* @__PURE__ */ i(he, { ...t })
  }
);
export {
  Re as M,
  N as b
};
