import { a as m, ad as c, ab as s, F as l, t as u, L as d, R as g, T as h, i as S } from "./index-162fd1aa.mjs";
import { P as E } from "./Pagination-a353297b.mjs";
import { w as p } from "./WithPropsGuard-9dd19ecc.mjs";
import { I as L, S as f } from "./StorePage-6e44d537.mjs";
import r from "react";
import { H as y } from "./Helmet-ed6d5573.mjs";
import { S as B } from "./ItemDetailPurchaseAlert-3cdb1ea7.mjs";
import "./dateFns-2367ee5b.mjs";
import "./validator-61879ab7.mjs";
import "./reactPlayer-2f69f369.mjs";
import "react-router-dom";
import "./reactSlick-cb4a2d39.mjs";
import "./CommonError-0ae83068.mjs";
import "./starBgGradient-589e5185.mjs";
import "./CommonError-4ed993c7.mjs";
import "./Tabs-8498653e.mjs";
import "./NavItemPlaceholder-0cfc6c3b.mjs";
import "./AppDetailPage-d989694b.mjs";
import "./ItemHelper-37a12c2c.mjs";
import "./PlatformRequirements-fc8525b3.mjs";
import "./MockVars-1cf2eb0a.mjs";
import "./default-item-image-9aab0e29.mjs";
import "./SuccessFlatIcon-54f5f907.mjs";
import "./WarningIcon-c5874dd2.mjs";
import "./PendingOrdersAppManager-4782fef4.mjs";
import "./PaymentStatusDialog-3afb3b20.mjs";
import "./Radio-b897ba55.mjs";
class I extends r.Component {
  constructor(e) {
    super(e), this.appStoreLogic = new L(m.getAppState().getSdk()), this.appStoreLogic.subscribe(() => this.setState({}));
  }
  componentDidMount() {
    const { page: e, pageSize: t, country: a, language: i } = this.props;
    this.appStoreLogic.getItemsByCriteria({ page: e, pageSize: t, country: a, language: i, itemType: c.enum.BUNDLE }), this.appStoreLogic.getCurrencyMap();
  }
  renderBundleItems() {
    const { platformItemsList: e, currencyMap: t } = this.appStoreLogic.state;
    return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "bundlesList" }, !t && /* @__PURE__ */ r.createElement(f, { numberOfCards: e == null ? void 0 : e.data.length }), !!e && t && e.data.map((a) => /* @__PURE__ */ r.createElement(B, { key: a.itemId, item: a, currencyMap: t }))));
  }
  renderGamePagination() {
    const { platformItemsList: e } = this.appStoreLogic.state;
    if (!e)
      return;
    const { paging: t } = e, a = !!(t != null && t.next), i = !!(t != null && t.previous), n = this.props.page;
    return /* @__PURE__ */ r.createElement("div", { className: "pagination" }, /* @__PURE__ */ r.createElement(
      E,
      {
        next: a && s.BundleList.withSearchParams({ page: n + 1 }),
        prev: i && s.BundleList.withSearchParams({ page: n - 1 })
      }
    ));
  }
  render() {
    const { error: e, isFetching: t, platformItemsList: a } = this.appStoreLogic.state;
    return /* @__PURE__ */ r.createElement("div", { className: "storeContainer" }, /* @__PURE__ */ r.createElement(y, null, /* @__PURE__ */ r.createElement("title", null, l.makeTitleWithAppName(u("BundleStore.title")))), t && /* @__PURE__ */ r.createElement(d, { className: g.medium }, /* @__PURE__ */ r.createElement(h, { i18nKey: "InitialUserFetchPage.notice" })), !t && e && /* @__PURE__ */ r.createElement("div", null, /* @__PURE__ */ r.createElement(S, { error: e })), !t && a && this.renderBundleItems(), !t && a && this.renderGamePagination());
  }
}
const P = p(I, (o, e) => o.country !== e.country), X = p(
  ({ page: o, pageSize: e, language: t }) => {
    const a = m.getAppState().getUser(), i = a && a.country || void 0;
    return /* @__PURE__ */ r.createElement(P, { page: o, pageSize: e, country: i, language: t });
  },
  (o, e) => e.page !== o.page || e.language !== o.language
);
export {
  I as BundleStore,
  X as default
};
