import * as E from "react";
import n, { useCallback as G, useState as be, createRef as ge, useEffect as L, Fragment as ve } from "react";
import { L as j, a as Ie } from "./common-d9f1808a.mjs";
import { N as he } from "./CommonError-67040eba.mjs";
import { L as q } from "./LoadingPage-37f53f05.mjs";
import { A as Ne } from "./Alert-1277e378.mjs";
import { Trans as T } from "react-i18next";
import { F as y, e as J, u as Q, f as Z, W as ee, b as te, O as Se, a as Le } from "./FetchConfigsUtils-476a602b.mjs";
import { u as Te } from "./useHeaderAlerts-15020c2b.mjs";
import { u as re } from "./useDiscoveryConfigs-cf63cd60.mjs";
import { I as ne, a as ae, b as ie, d as ke, u as Re } from "./default-item-image-5b912e0f.mjs";
import { u as se, a as oe } from "./useUserInfo-ad7006e5.mjs";
import { U as _e, a as W, d as Ge, A as Oe } from "./AppStoreDetail-5e836fd3.mjs";
import { C as ce } from "./CommonError-e27d39d7.mjs";
import { A, a as B } from "./ArrowIcon-647b10f0.mjs";
import O from "classnames";
import P from "react-lines-ellipsis";
import { _ as we, a as Pe, i as Fe, b as me } from "./isObjectLike-34a37633.mjs";
import { L as le } from "./index-0462597a.mjs";
import F from "react-slick";
import { Platform as C, PlatformClient as Me } from "@accelbyte/sdk-platform";
import Ae from "react-player";
import { P as ue, R as v } from "./usePendingOrders-53ca2538.mjs";
import { u as Be } from "./useAppConfigs-0fb5df89.mjs";
import { U as Ce } from "./UrlUtils-45b0efe7.mjs";
import "./starBgGradient-589e5185.mjs";
import "./Loading-16af3910.mjs";
import "./RouteUtils-f2d71427.mjs";
import "zod";
import "uuid";
import "@accelbyte/sdk";
import "axios";
import "@accelbyte/sdk-iam";
import "./FetchUtils-cc53dbb5.mjs";
import "@accelbyte/sdk-basic";
import "./HtmlUtils-4c7d14e3.mjs";
import "dompurify";
import "react-dom";
import "./PaymentStatusDialog-46916c30.mjs";
import "./Env-161a418e.mjs";
import "./Button-c97a7217.mjs";
import "react-feather";
import "./Dialog-b2e1c8bb.mjs";
import "./SSRHelper-8eb361ff.mjs";
import "./i18n-c7e26598.mjs";
import "flat";
import "i18next";
import "date-fns";
import "./Radio-913d38b8.mjs";
import "./Alert-c2425f39.mjs";
import "./InfoIcon-c86fd057.mjs";
import "./MockVars-8f827f39.mjs";
import "./numbers-4344265e.mjs";
import "./LauncherDownloadButton-080a25e6.mjs";
import "./widget-ctx-5e46828e.mjs";
var $e = we, xe = function() {
  return $e.Date.now();
}, De = xe, Ue = /\s/;
function He(e) {
  for (var t = e.length; t-- && Ue.test(e.charAt(t)); )
    ;
  return t;
}
var je = He, We = je, ze = /^\s+/;
function Ke(e) {
  return e && e.slice(0, We(e) + 1).replace(ze, "");
}
var Ve = Ke, Ye = Pe, Xe = Fe, qe = "[object Symbol]";
function Je(e) {
  return typeof e == "symbol" || Xe(e) && Ye(e) == qe;
}
var Qe = Je, Ze = Ve, z = me, et = Qe, K = 0 / 0, tt = /^[-+]0x[0-9a-f]+$/i, rt = /^0b[01]+$/i, nt = /^0o[0-7]+$/i, at = parseInt;
function it(e) {
  if (typeof e == "number")
    return e;
  if (et(e))
    return K;
  if (z(e)) {
    var t = typeof e.valueOf == "function" ? e.valueOf() : e;
    e = z(t) ? t + "" : t;
  }
  if (typeof e != "string")
    return e === 0 ? e : +e;
  e = Ze(e);
  var r = rt.test(e);
  return r || nt.test(e) ? at(e.slice(2), r ? 2 : 8) : tt.test(e) ? K : +e;
}
var st = it, ot = me, M = De, V = st, ct = "Expected a function", mt = Math.max, lt = Math.min;
function ut(e, t, r) {
  var a, i, o, c, s, m, l = 0, p = !1, d = !1, I = !0;
  if (typeof e != "function")
    throw new TypeError(ct);
  t = V(t) || 0, ot(r) && (p = !!r.leading, d = "maxWait" in r, o = d ? mt(V(r.maxWait) || 0, t) : o, I = "trailing" in r ? !!r.trailing : I);
  function h(f) {
    var g = a, S = i;
    return a = i = void 0, l = f, c = e.apply(S, g), c;
  }
  function k(f) {
    return l = f, s = setTimeout(u, t), p ? h(f) : c;
  }
  function R(f) {
    var g = f - m, S = f - l, H = t - g;
    return d ? lt(H, o - S) : H;
  }
  function N(f) {
    var g = f - m, S = f - l;
    return m === void 0 || g >= t || g < 0 || d && S >= o;
  }
  function u() {
    var f = M();
    if (N(f))
      return b(f);
    s = setTimeout(u, R(f));
  }
  function b(f) {
    return s = void 0, I && a ? h(f) : (a = i = void 0, c);
  }
  function Ee() {
    s !== void 0 && clearTimeout(s), l = 0, a = m = i = s = void 0;
  }
  function ye() {
    return s === void 0 ? c : b(M());
  }
  function w() {
    var f = M(), g = N(f);
    if (a = arguments, i = this, m = f, g) {
      if (s === void 0)
        return k(m);
      if (d)
        return clearTimeout(s), s = setTimeout(u, t), h(m);
    }
    return s === void 0 && (s = setTimeout(u, t)), c;
  }
  return w.cancel = Ee, w.flush = ye, w;
}
var ft = ut;
function _(e) {
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? _ = function(r) {
    return typeof r;
  } : _ = function(r) {
    return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
  }, _(e);
}
function $() {
  return $ = Object.assign || function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var r = arguments[t];
      for (var a in r)
        Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a]);
    }
    return e;
  }, $.apply(this, arguments);
}
function dt(e, t) {
  if (e == null)
    return {};
  var r = pt(e, t), a, i;
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(e);
    for (i = 0; i < o.length; i++)
      a = o[i], !(t.indexOf(a) >= 0) && Object.prototype.propertyIsEnumerable.call(e, a) && (r[a] = e[a]);
  }
  return r;
}
function pt(e, t) {
  if (e == null)
    return {};
  var r = {}, a = Object.keys(e), i, o;
  for (o = 0; o < a.length; o++)
    i = a[o], !(t.indexOf(i) >= 0) && (r[i] = e[i]);
  return r;
}
function Et(e, t) {
  if (!(e instanceof t))
    throw new TypeError("Cannot call a class as a function");
}
function Y(e, t) {
  for (var r = 0; r < t.length; r++) {
    var a = t[r];
    a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(e, a.key, a);
  }
}
function yt(e, t, r) {
  return t && Y(e.prototype, t), r && Y(e, r), e;
}
function bt(e, t) {
  return t && (_(t) === "object" || typeof t == "function") ? t : fe(e);
}
function x(e) {
  return x = Object.setPrototypeOf ? Object.getPrototypeOf : function(r) {
    return r.__proto__ || Object.getPrototypeOf(r);
  }, x(e);
}
function fe(e) {
  if (e === void 0)
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e;
}
function gt(e, t) {
  if (typeof t != "function" && t !== null)
    throw new TypeError("Super expression must either be null or a function");
  e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), t && D(e, t);
}
function D(e, t) {
  return D = Object.setPrototypeOf || function(a, i) {
    return a.__proto__ = i, a;
  }, D(e, t);
}
var X = n, vt = ft, It = typeof window < "u";
function ht() {
  var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 150, t = arguments.length > 1 ? arguments[1] : void 0;
  return function(r) {
    var a = /* @__PURE__ */ function(i) {
      gt(o, i);
      function o(c) {
        var s;
        return Et(this, o), s = bt(this, x(o).call(this, c)), s.state = {
          winWidth: It ? window.innerWidth : 0
        }, s.onResize = vt(s.onResize.bind(fe(s)), e, t), s;
      }
      return yt(o, [{
        key: "componentDidMount",
        value: function() {
          window.addEventListener("resize", this.onResize);
        }
      }, {
        key: "componentWillUnmount",
        value: function() {
          window.removeEventListener("resize", this.onResize), this.onResize.cancel();
        }
      }, {
        key: "onResize",
        value: function() {
          this.setState({
            winWidth: window.innerWidth
          });
        }
      }, {
        key: "render",
        value: function() {
          var s = this.props, m = s.innerRef, l = dt(s, ["innerRef"]);
          return X.createElement(r, $({
            ref: m
          }, l, this.state));
        }
      }]), o;
    }(X.Component);
    return a.displayName = "Responsive(".concat(r.displayName || r.name, ")"), a.defaultProps = {
      innerRef: function() {
      }
    }, a;
  };
}
var Nt = ht;
const de = {
  bannerItemList: null,
  bannerContentList: null,
  currencyMap: null,
  bannerError: null,
  bannerFetchStatus: y.IDLE
}, St = J(de);
function Lt() {
  const [e] = Q(), [t, r] = Z(St), a = G(() => {
    r(de);
  }, []), i = G(
    async (c) => {
      let s = null, m = null, l = null, p = null;
      try {
        return r({ bannerError: l, bannerFetchStatus: y.FETCHING }), s = await C.ItemApi(e).getItemsByCriteria({
          limit: 5,
          tags: "banner",
          region: c
        }), m = await Me.getCurrencyMap(e), p = await o(s), {
          data: {
            bannerItemList: s,
            currencyMap: m,
            bannerContentList: p
          }
        };
      } catch (d) {
        return l = ee.getErrorType(d), { error: l };
      } finally {
        r({
          bannerItemList: s,
          currencyMap: m,
          bannerContentList: p,
          bannerError: l,
          bannerFetchStatus: y.IDLE
        });
      }
    },
    [e]
  ), o = async (c) => {
    let s = c.data.map(async (m) => {
      const l = ne.getFilteredImageUrlByTag(m.images, ae.heroBanner) || null;
      return {
        bannerItem: m,
        mainBackground: l
      };
    });
    return s = await Promise.all(s), s;
  };
  return {
    state: t,
    mutations: {
      resetState: a,
      fetchBennerItems: i
    }
  };
}
const Tt = (e) => {
  const { mainBackground: t } = e, r = _e.safeParse(t);
  if (t && r.success)
    switch (r.data.type) {
      case W.YOUTUBE_VIDEO:
      case W.URL_VIDEO:
        return /* @__PURE__ */ n.createElement("div", { className: "banner-video-wrapper" }, /* @__PURE__ */ n.createElement(
          Ae,
          {
            key: r.data.content,
            className: "react-player",
            controls: !1,
            url: r.data.content,
            playing: !0,
            loop: !0,
            volume: 0
          }
        ));
      default:
        return /* @__PURE__ */ n.createElement(
          "img",
          {
            key: r.data.content,
            alt: r.data.content,
            src: r.data.content,
            className: "bannerImage"
          }
        );
    }
  let a;
  switch (typeof t) {
    case "string": {
      a = t;
      break;
    }
    case "object": {
      a = t == null ? void 0 : t.content;
      break;
    }
  }
  return /* @__PURE__ */ n.createElement("img", { className: "bannerImage", src: a || Ge, alt: "" });
}, kt = (e) => {
  const { regionData: t, currencyMap: r } = e;
  if (!r)
    return null;
  const a = ue.makePaymentOptionList(t, r), i = v.isFree(a.map((o) => o.regionData));
  return /* @__PURE__ */ n.createElement("div", { className: "bannerPriceContainer" }, a.map(({ finalPrice: o, originalPrice: c, regionData: s, currencySymbol: m }) => /* @__PURE__ */ n.createElement("div", { key: s.currencyCode, className: "bannerPrice" }, i && /* @__PURE__ */ n.createElement(T, { i18nKey: "BannerPrice.freeItem" }, "FREE"), !i && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
    "span",
    {
      className: O("finalPrice", {
        virtual: v.isCurrencyTypeVirtual(s)
      })
    },
    `${m} ${o}`
  ), v.isDiscounted(s) && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("s", { className: "priceStrikethrough" }, /* @__PURE__ */ n.createElement("span", { className: "beforeDiscount" }, `${m} ${c}`)), /* @__PURE__ */ n.createElement("span", { className: "discountPercentage" }, `-${v.calculateDiscountPercentage(s)}%`))))));
}, Rt = typeof P == "object" ? P.default : P, _t = typeof F == "object" ? F.default : F, Gt = Nt()(Rt), Ot = () => {
  var R, N;
  const e = {
    dots: !1,
    infinite: !0,
    speed: 500,
    slideToShow: 1,
    slideToScroll: 1,
    arrows: !1,
    adaptiveHeight: !0
  }, [t, r] = be(0), { state: a, mutations: i } = Lt(), { state: o } = te(), c = ge(), { state: s } = se(), m = (R = s.user) == null ? void 0 : R.country, l = a.bannerItemList && a.bannerItemList.data, p = l ? t % l.length : 0, d = a.bannerFetchStatus === y.FETCHING;
  L(() => {
    i.fetchBennerItems(m);
  }, []);
  const I = () => {
    const u = c.current;
    u && u.slickPrev(), r(t - 1);
  }, h = () => {
    const u = c.current;
    u && u.slickNext(), r(t + 1);
  }, k = (u) => {
    const b = c.current;
    b && b.slickPrev(), r(u);
  };
  return /* @__PURE__ */ n.createElement("section", { className: "banner bannerHeight" }, d && /* @__PURE__ */ n.createElement(q, { className: "mt-3 md:mt-7" }), !d && a.bannerError && /* @__PURE__ */ n.createElement("div", { className: "bannerError" }, /* @__PURE__ */ n.createElement("div", { className: "errorContainer" }, /* @__PURE__ */ n.createElement(ce, { error: a.bannerError }))), !d && a.bannerItemList && a.currencyMap && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement(_t, { ref: c, ...e, afterChange: (u) => k(u) }, (N = a.bannerContentList) == null ? void 0 : N.map((u) => /* @__PURE__ */ n.createElement("div", { key: u.bannerItem.itemId, className: "bannerHeight" }, /* @__PURE__ */ n.createElement(Tt, { mainBackground: u.mainBackground }), /* @__PURE__ */ n.createElement(
    le,
    {
      to: ie.getItemDetailRoute(o, u.bannerItem),
      className: "bannerItemContainer bannerGradient"
    },
    /* @__PURE__ */ n.createElement("div", { className: "bannerDetail" }, /* @__PURE__ */ n.createElement("p", { className: O("title", Se.TITLE_FONT) }, u.bannerItem.title), /* @__PURE__ */ n.createElement("div", { className: "description" }, /* @__PURE__ */ n.createElement(
      Gt,
      {
        text: u.bannerItem.description,
        maxLine: 2,
        ellipsis: "...",
        trimRight: !0,
        basedOn: "letters"
      }
    )), /* @__PURE__ */ n.createElement("div", { className: "price" }, u.bannerItem.regionData && a.currencyMap && /* @__PURE__ */ n.createElement(kt, { regionData: u.bannerItem.regionData, currencyMap: a.currencyMap })), /* @__PURE__ */ n.createElement("div", { className: "btn big btn-primary ctaButton" }, /* @__PURE__ */ n.createElement(T, { i18nKey: "HomePage.banner.learnMore" }, "Learn more")))
  ))))), l && l.length > 1 && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("div", { className: "pagination" }, l.map((u, b) => b !== p ? /* @__PURE__ */ n.createElement("div", { key: u.itemId, className: "carouselBullet", onClick: () => k(b) }) : /* @__PURE__ */ n.createElement("div", { key: u.itemId, className: "carouselBullet active" }))), /* @__PURE__ */ n.createElement("button", { className: "bannerHeight arrowLeftButton", onClick: I, "aria-label": "Arrow Left" }, /* @__PURE__ */ n.createElement("div", { className: "arrowIconContainer" }, /* @__PURE__ */ n.createElement(A, { className: B.left }))), /* @__PURE__ */ n.createElement("button", { className: "bannerHeight arrowRightButton", onClick: h, "aria-label": "Arrow Right" }, /* @__PURE__ */ n.createElement("div", { className: "arrowIconContainer" }, /* @__PURE__ */ n.createElement(A, { className: B.right }))))));
};
const wt = (e) => {
  const { regionData: t, currencyMap: r } = e;
  if (!r)
    return null;
  const a = ue.makePaymentOptionList(t, r), i = v.isFree(t || []);
  return /* @__PURE__ */ n.createElement(n.Fragment, null, i && /* @__PURE__ */ n.createElement(T, { i18nKey: "FeaturedGamesPrice.freeItem" }, "FREE"), !i && a.map(({ finalPrice: o, originalPrice: c, regionData: s, currencySymbol: m }, l) => {
    const p = v.isCurrencyTypeVirtual(s);
    return /* @__PURE__ */ n.createElement(n.Fragment, { key: `${s.currencyCode}-${l}` }, p && /* @__PURE__ */ n.createElement("span", { className: "divider" }, "/"), /* @__PURE__ */ n.createElement("span", { key: s.currencyCode, className: "featuredGamePriceItem" }, /* @__PURE__ */ n.createElement(
      "div",
      {
        className: O({
          virtual: p
        })
      },
      m,
      " ",
      o
    ), v.isDiscounted(s) && /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("s", { className: "priceStrikethrough" }, /* @__PURE__ */ n.createElement("span", { className: "beforeDiscount" }, `${m} ${c}`)))));
  }));
}, U = (e) => {
  const { gameList: t, currencyMap: r } = e, { state: a } = te();
  return /* @__PURE__ */ E.createElement("div", { className: "featuredGamesItemContainer" }, t && t.map((i) => {
    const o = ne.getFilteredImageUrlByTag(i.images, ae.productCover) || ke;
    return /* @__PURE__ */ E.createElement(
      le,
      {
        to: ie.getItemDetailRoute(a, i),
        className: "featuredGamesItem",
        style: {
          backgroundImage: `url(${o})`
        },
        key: i.itemId
      },
      /* @__PURE__ */ E.createElement("div", { className: "featuredGamesOverlayBackground" }, /* @__PURE__ */ E.createElement("div", { className: "featuredGamesContent" }, /* @__PURE__ */ E.createElement("h2", { className: "featuredGamesTitle" }, i.title), /* @__PURE__ */ E.createElement("div", { className: "featuredGamesPrice" }, i && i.regionData && /* @__PURE__ */ E.createElement(wt, { regionData: i.regionData, currencyMap: r }))), /* @__PURE__ */ E.createElement("div", { className: "featuredGameLearnMoreText" }, /* @__PURE__ */ E.createElement("div", { className: "featuredGameLearnMoreTextContainer" }, /* @__PURE__ */ E.createElement("span", { className: "learnMoreText" }, /* @__PURE__ */ E.createElement(T, { i18nKey: "FeaturedGames.learnMore" }, "Learn more")), /* @__PURE__ */ E.createElement(A, { className: O(B.right, "arrowSize") }))))
    );
  }));
}, pe = {
  featuredGameList: null,
  currencyMap: null,
  featuredGameError: null,
  featuredGameFetchStatus: y.IDLE
}, Pt = J(pe);
function Ft() {
  const [e] = Q(), [t, r] = Z(Pt), a = G(() => {
    r(pe);
  }, []), i = G(
    async (o) => {
      let c = null, s = null, m = null;
      try {
        r({ featuredGameError: m, featuredGameFetchStatus: y.FETCHING });
        const [l, p] = await Promise.all([
          C.CurrencyApi(e).getCurrencies(),
          C.ItemApi(e).getItemsByCriteria({
            tags: "featured",
            limit: 5,
            region: o
          })
        ]);
        s = /* @__PURE__ */ new Map();
        for (const d of l)
          s.set(d.currencyCode, d);
        return c = p, {
          data: {
            currencyMap: s,
            featuredGameList: c
          }
        };
      } catch (l) {
        return m = ee.getErrorType(l), { error: l };
      } finally {
        r({ featuredGameList: c, currencyMap: s, featuredGameError: m, featuredGameFetchStatus: y.IDLE });
      }
    },
    [e]
  );
  return {
    state: t,
    mutations: {
      resetState: a,
      fetchFeaturedGames: i
    }
  };
}
const Mt = () => {
  var m, l;
  const { state: e } = se(), t = (m = e.user) == null ? void 0 : m.country, { state: r, mutations: a } = Ft(), i = r.featuredGameFetchStatus === y.FETCHING, o = r.featuredGameError, c = (l = r.featuredGameList) == null ? void 0 : l.data, s = 4;
  return L(() => {
    a.fetchFeaturedGames(t);
  }, []), /* @__PURE__ */ n.createElement("section", { className: "featuredGames" }, !i && o && /* @__PURE__ */ n.createElement("div", { className: "errorContainer" }, /* @__PURE__ */ n.createElement(ce, { error: o })), !i && !!c && /* @__PURE__ */ n.createElement(n.Fragment, null, (() => c.length >= s ? /* @__PURE__ */ n.createElement(At, { gameList: c, currencyMap: r.currencyMap }) : /* @__PURE__ */ n.createElement(U, { gameList: c, currencyMap: r.currencyMap }))()));
}, At = ({
  gameList: e,
  currencyMap: t
}) => /* @__PURE__ */ n.createElement(ve, null, /* @__PURE__ */ n.createElement(U, { gameList: e.slice(0, 2), currencyMap: t }), /* @__PURE__ */ n.createElement(U, { gameList: e.slice(2), currencyMap: t }));
const Bt = () => {
  const { state: e } = oe(), {
    state: { isSingleGame: t }
  } = re(), { mutations: r } = Te();
  L(() => {
    var c;
    const i = new URLSearchParams((c = e.location) == null ? void 0 : c.search), o = i.get(j);
    o && o === Ie.success && (a(), i.delete(j), e.replace(`${e.location.pathname}?${i.toString()}`));
  }, [e.location]);
  const a = () => {
    r.push({
      type: Ne.success,
      element: /* @__PURE__ */ n.createElement(T, { i18nKey: "LinkPlatformAccountPage.notification.accountLinked" }, "Account linked"),
      autoDismiss: !0
    });
  };
  return /* @__PURE__ */ n.createElement("main", { className: "homePage" }, !t && /* @__PURE__ */ n.createElement(Ct, null), t && /* @__PURE__ */ n.createElement($t, null));
}, Ct = () => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(Ot, null), /* @__PURE__ */ n.createElement(Mt, null)), $t = () => {
  var o, c;
  const {
    state: { discoveryConfigData: e }
  } = re(), { state: t, mutations: r } = Re();
  if (L(() => {
    const s = e == null ? void 0 : e.appId.data.value;
    s && r.fetchItemInfo({ appId: s });
  }, [e == null ? void 0 : e.appId.data.value]), t.itemsInfoRecordFetchStatus === y.FETCHING)
    return /* @__PURE__ */ n.createElement(q, null);
  const a = (e == null ? void 0 : e.appId.data.value) || "", i = a && t.itemsInfoRecordError[a];
  return !((o = t.activeGame) != null && o.itemId) && i ? /* @__PURE__ */ n.createElement(he, { appId: a, error: i }) : /* @__PURE__ */ n.createElement(Oe, { itemId: (c = t.activeGame) == null ? void 0 : c.itemId });
};
function xr({ basePath: e }) {
  const {
    state: { playerPortalConfigData: t }
  } = Be(), { state: r } = oe(), [a] = Le(), i = t == null ? void 0 : t.homepage.data;
  return L(() => {
    if (i != null && i.isDisabled && i.redirectionURL) {
      const o = Ce.getRouterRedirection(i == null ? void 0 : i.redirectionURL, a.baseURL);
      if (o && o !== "/") {
        const c = e ? o.replace(e, "") : o;
        r.replace(c);
      } else
        window.location.href = i.redirectionURL;
    }
  }, [i == null ? void 0 : i.isDisabled, i == null ? void 0 : i.redirectionURL]), i != null && i.isDisabled && i.redirectionURL ? null : /* @__PURE__ */ n.createElement(Bt, null);
}
export {
  xr as HomePageWidget
};
