import { g as ea, a as pt, B as ta } from "./HtmlUtils-4c7d14e3.mjs";
import { C as aa } from "./CommonError-67040eba.mjs";
import { z as M } from "zod";
import { U as rt } from "./UrlUtils-45b0efe7.mjs";
import { c as na, e as ct, Y as it, d as Ce, C as ca, I as ia, a as Ot, W as Yt, b as Ge, u as ra, S as la, E as sa } from "./default-item-image-5b912e0f.mjs";
import d from "classnames";
import e, { Component as Na, useCallback as U, useState as W, useRef as lt, useEffect as V, Fragment as Ma } from "react";
import oa from "react-dom";
import { Trans as i } from "react-i18next";
import Be from "react-player";
import je from "react-slick";
import { A as ge, a as re } from "./ArrowIcon-647b10f0.mjs";
import { B as kt, C as ht, g as ua } from "./CommonError-e27d39d7.mjs";
import { C as We, I as Q, a as Ia, F as Da, E as ga, A as jt } from "./FetchUtils-cc53dbb5.mjs";
import { F as y, e as Oe, u as le, f as Ye, W as q, a as xt, b as ye, E as Fe, O as ma } from "./FetchConfigsUtils-476a602b.mjs";
import { DesktopChecker as K, UrlHelper as wt, DecodeError as za } from "@accelbyte/sdk";
import { L as oe } from "./index-0462597a.mjs";
import { Platform as $, PlatformClient as ja, OrderStatus as ve } from "@accelbyte/sdk-platform";
import { a as Je, u as st } from "./useUserInfo-ad7006e5.mjs";
import { R as ee, u as Nt, P as Ze } from "./usePendingOrders-53ca2538.mjs";
import { I as yt, u as Mt, P as ya } from "./PaymentStatusDialog-46916c30.mjs";
import { T as Aa, a as At, b as Ea, R as da } from "./Radio-913d38b8.mjs";
import { u as _e } from "./useDiscoveryConfigs-cf63cd60.mjs";
import { A as ue } from "./Alert-c2425f39.mjs";
import { L as ot, a as La } from "./Loading-16af3910.mjs";
import { B as Ve, S as Ut, a as Qt } from "./Button-c97a7217.mjs";
import { A as ie } from "./Alert-1277e378.mjs";
import { isValid as bt, isBefore as ft, formatDistanceToNow as Ta, parseISO as Sa } from "date-fns";
import { D as Ae, a as Ee, b as de } from "./Dialog-b2e1c8bb.mjs";
import { p as Pt, m as Ca, q as vt, r as Rt } from "./MockVars-8f827f39.mjs";
import { IamHelper as Ke, IamUserAuthorizationClient as pa } from "@accelbyte/sdk-iam";
import { d as Oa } from "./numbers-4344265e.mjs";
import { t as Xe, g as Ya } from "./i18n-c7e26598.mjs";
import { L as Gt } from "./LauncherDownloadButton-080a25e6.mjs";
import { E as ka } from "./Env-161a418e.mjs";
import { L as ha } from "./LoadingPage-37f53f05.mjs";
M.enum([
  "image/png",
  "image/jpeg",
  "image/bmp",
  "image/gif",
  "image/vnd.microsoft.icon",
  "image/jpeg",
  "image/png",
  "image/svg+xml",
  "image/tiff",
  "image/webp",
  "text/markdown",
  "text/html",
  "audio/aac",
  "audio/midi audio/x-midi",
  "audio/mpeg",
  "audio/ogg",
  "audio/wav",
  "audio/webm",
  "video/x-msvideo",
  "video/mpeg",
  "video/ogg",
  "video/webm",
  "video/3gpp",
  "video/3gpp2"
]);
const ut = M.object({
  contentType: M.string(),
  fileName: M.string(),
  url: M.string()
}), He = M.object({
  type: M.string(),
  content: M.string()
}), xa = M.object({
  title: M.string(),
  tags: M.string(),
  content: He.optional(),
  media: ut.optional()
});
M.object({
  id: M.string(),
  appId: M.record(M.string(), M.union([M.string(), M.undefined()])),
  locale: M.record(M.string(), xa)
});
const B = Object.freeze({
  URL_IMAGE: "url:image",
  URL_VIDEO: "url:video",
  YOUTUBE_VIDEO: "youtube:video"
}), wa = M.enum([
  B.URL_IMAGE,
  B.URL_VIDEO,
  B.YOUTUBE_VIDEO
]), Ie = M.object({
  type: wa,
  content: M.string()
}), Ua = M.object({
  title: M.string(),
  media: M.array(ut),
  excerpt: He.optional(),
  content: He.optional(),
  tags: M.string().optional()
}), Qa = M.object({
  id: M.string(),
  locale: M.record(M.string(), Ua),
  publishedAt: M.string(),
  lastUpdatedAt: M.string(),
  authorId: M.string().optional()
}), ba = M.object({
  authorName: M.string().optional()
}), fa = M.object({
  id: M.string(),
  locale: M.record(M.string(), ba)
}), Pa = M.intersection(
  Qa,
  M.object({
    author: fa.optional()
  })
);
M.object({
  data: M.array(Pa),
  paging: M.object({
    totalPage: M.number()
  })
});
M.object({
  itemId: M.string(),
  mainBackground: M.union([Ie, M.null()]).optional(),
  medias: M.array(Ie).optional(),
  miniLauncherUrl: M.string().optional(),
  launcherMainBackground: M.union([Ie, M.null()]).optional()
});
const va = M.object({
  title: M.string(),
  subtitle: M.string().optional(),
  content: He.optional(),
  icon: ut.optional()
}), pe = M.object({
  path: M.string(),
  locale: M.record(M.string(), va)
}), Bt = M.object({
  support: M.union([pe, M.null()]),
  subPaths: M.array(M.string())
});
M.object({
  support: M.union([pe, M.null()]),
  sub: M.record(M.string(), Bt),
  parents: M.array(pe)
});
const Ra = M.object({
  support: pe,
  sub: M.record(M.string(), Bt),
  parents: M.array(pe)
});
M.object({
  data: M.array(Ra),
  paging: M.object({
    totalPage: M.number()
  })
});
class It extends Error {
  constructor(a) {
    super(a), Object.setPrototypeOf(this, It.prototype);
  }
}
class De {
  static getYoutubeScreenshot(a) {
    const n = De.extractYoutubeId(a);
    return n && De.getYoutubeScreenshotLinkFromVideoId(n) || null;
  }
  static getMediaScreenshot(a) {
    return a.type === B.YOUTUBE_VIDEO ? De.getYoutubeScreenshot(a.content) : a.content;
  }
  static extractYoutubeId(a) {
    const n = a.match(
      /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/
    );
    return n && n[1] || null;
  }
  static getYoutubeScreenshotLinkFromVideoId(a) {
    return `https://img.youtube.com/vi/${a}/maxresdefault.jpg`;
  }
}
const Ga = typeof je == "object" ? je.default : Be, at = typeof Be == "object" ? Be.default : je;
function Ba() {
  const t = "lightboxWrapper";
  let a = document.getElementById(t);
  return a || (a = document.createElement("div"), a.id = t, document.body.appendChild(a)), a;
}
const Wt = class extends Na {
  constructor(t) {
    super(t), this.sliderRef = e.createRef(), this.onClickImageGallery = (a) => {
      const n = this.sliderRef.current;
      n && (n.slickGoTo(a), this.pauseVideo());
    }, this.onClickPrev = () => {
      const a = this.sliderRef.current;
      a && (a.slickPrev(), this.pauseVideo());
    }, this.onClickNext = () => {
      const a = this.sliderRef.current;
      a && (a.slickNext(), this.pauseVideo());
    }, this.pauseVideo = () => this.setState({ playingVideo: null }), this.renderSliderContentsItemMedias = () => {
      const { itemMedias: a } = this.props, { playingVideo: n } = this.state;
      return !Array.isArray(a) || !a.length ? null : Ie.safeParse(a[0]).success ? a.map((c) => {
        switch (c.type) {
          case B.YOUTUBE_VIDEO:
          case B.URL_VIDEO:
            return /* @__PURE__ */ e.createElement(
              at,
              {
                key: c.content,
                className: "lightboxSlideItems",
                controls: !0,
                url: c.content,
                width: "100%",
                playing: n === c.content,
                onPlay: () => this.setState({ playingVideo: c.content }),
                onPause: this.pauseVideo
              }
            );
          default:
            return /* @__PURE__ */ e.createElement("img", { key: c.content, alt: c.content, src: c.content, className: "lightboxSlideItems", loading: "lazy" });
        }
      }) : na.safeParse(a[0]).success ? a.map((c, l) => {
        const r = ct.safeParse(c);
        if (r.success)
          return /* @__PURE__ */ e.createElement("div", { key: r.data.value.imageUrl, className: "mediumCodecContainer", onClick: () => this.onClickImageGallery(l) }, /* @__PURE__ */ e.createElement("img", { src: r.data.value.imageUrl, className: "mediumCodecItem", loading: "lazy" }), l !== this.state.currentPosition ? /* @__PURE__ */ e.createElement("div", { className: "overlayImage" }) : "");
        const s = it.safeParse(c);
        return s.success ? /* @__PURE__ */ e.createElement(
          at,
          {
            key: s.data.value.youtubeId,
            className: "lightboxSlideItems",
            controls: !0,
            url: ea(s.data.value.youtubeId),
            width: "100%",
            playing: n === s.data.value.youtubeId,
            onPlay: () => this.setState({ playingVideo: s.data.value.youtubeId }),
            onPause: this.pauseVideo
          }
        ) : null;
      }) : null;
    }, this.renderSliderContentsFromImageUrls = () => {
      const { imageUrls: a } = this.props, { playingVideo: n } = this.state;
      return Array.isArray(a) && a.map((c) => rt.isImageURL(c) ? /* @__PURE__ */ e.createElement("img", { key: c, src: c, className: "lightboxSlideItems", alt: c, loading: "lazy" }) : /* @__PURE__ */ e.createElement(
        at,
        {
          key: c,
          className: "lightboxSlideItems",
          controls: !0,
          url: c,
          width: "100%",
          playing: n === c,
          onPlay: () => this.setState({ playingVideo: c }),
          onPause: this.pauseVideo
        }
      ));
    }, this.renderGalleryFromItemMedias = () => {
      const { itemMedias: a } = this.props;
      return !Array.isArray(a) || !a.length ? null : Ie.safeParse(a[0]).success ? Ie.safeParse(a[0]).success && a.map((n, c) => {
        const l = De.getMediaScreenshot(n);
        return /* @__PURE__ */ e.createElement("div", { key: c, className: "mediaContainer", onClick: () => this.onClickImageGallery(c) }, n.type === B.URL_VIDEO && /* @__PURE__ */ e.createElement("video", { src: n.content, className: "mediaItem" }), n.type !== B.URL_VIDEO && /* @__PURE__ */ e.createElement("img", { src: l || Ce, className: "mediaItem", loading: "lazy" }), c !== this.state.currentPosition ? /* @__PURE__ */ e.createElement("div", { className: "overlayImage" }) : "");
      }) : a.map((n, c) => {
        let l = Ce;
        const r = it.safeParse(n), s = ct.safeParse(n);
        return r.success ? l = pt(r.data.value.youtubeId) : s.success && (l = s.data.value.imageUrl), /* @__PURE__ */ e.createElement("div", { key: c, className: "mediaContainer", onClick: () => this.onClickImageGallery(c) }, /* @__PURE__ */ e.createElement("img", { src: l, className: "mediaItem", loading: "lazy" }), c !== this.state.currentPosition ? /* @__PURE__ */ e.createElement("div", { className: "overlayImage" }) : "");
      });
    }, this.renderGalleryFromImageUrls = () => {
      const { imageUrls: a } = this.props;
      return Array.isArray(a) && a.map((n, c) => /* @__PURE__ */ e.createElement("div", { key: n, className: "mediaContainer", onClick: () => this.onClickImageGallery(c) }, /* @__PURE__ */ e.createElement("img", { src: De.getYoutubeScreenshot(n) || n, className: "mediaItem", loading: "lazy" }), c !== this.state.currentPosition ? /* @__PURE__ */ e.createElement("div", { className: "overlayImage" }) : ""));
    }, this.modalRoot = Ba(), this.modalContainer = document.createElement("div"), this.state = {
      currentPosition: t.selectedPosition,
      playingVideo: null
    };
  }
  componentDidMount() {
    if (!this.modalRoot)
      return;
    this.modalRoot.appendChild(this.modalContainer);
    const { currentPosition: t } = this.state, a = this.sliderRef.current;
    a && a.slickGoTo(t, !1);
  }
  componentWillUnmount() {
    this.modalRoot && this.modalRoot.removeChild(this.modalContainer);
  }
  renderLightbox() {
    const { onClose: t, className: a, itemMedias: n, imageUrls: c } = this.props, { currentPosition: l } = this.state, r = l + 1, s = Array.isArray(n) ? n.length : Array.isArray(c) ? c.length : 0;
    return /* @__PURE__ */ e.createElement("section", { className: d("lightbox", a) }, /* @__PURE__ */ e.createElement(
      "button",
      {
        className: "closeButton",
        onClick: () => {
          t && t();
        }
      },
      /* @__PURE__ */ e.createElement(ca, null)
    ), /* @__PURE__ */ e.createElement("div", { className: "lightboxContent" }, /* @__PURE__ */ e.createElement("div", { className: "lightboxSliderContainer" }, /* @__PURE__ */ e.createElement("button", { className: "arrowButtonContainer", onClick: this.onClickPrev }, /* @__PURE__ */ e.createElement("div", { className: "arrowLeftButton" }, /* @__PURE__ */ e.createElement(ge, { className: re.left }))), /* @__PURE__ */ e.createElement("div", { className: "lightboxSlider" }, /* @__PURE__ */ e.createElement(
      Ga,
      {
        ...Wt.sliderSetting,
        ref: this.sliderRef,
        initialSlide: l,
        beforeChange: (o, u) => this.setState({ currentPosition: u })
      },
      this.renderSliderContentsItemMedias() || this.renderSliderContentsFromImageUrls()
    )), /* @__PURE__ */ e.createElement("button", { className: "arrowButtonContainer", onClick: this.onClickNext }, /* @__PURE__ */ e.createElement("div", { className: "arrowRightButton" }, /* @__PURE__ */ e.createElement(ge, { className: re.right })))), /* @__PURE__ */ e.createElement("p", { className: "lightboxCounter" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "Lightbox.counter" }, { realCurrenPosition: r }, " of ", { totalImage: s })), /* @__PURE__ */ e.createElement("div", { className: "lightboxGallery" }, this.renderGalleryFromItemMedias() || this.renderGalleryFromImageUrls())));
  }
  renderLightboxOverlay() {
    return /* @__PURE__ */ e.createElement("div", { className: "lightboxOverlay" }, this.renderLightbox());
  }
  render() {
    const { isOpen: t } = this.props;
    return t ? oa.createPortal(this.renderLightboxOverlay(), this.modalContainer) : null;
  }
};
let Dt = Wt;
Dt.defaultProps = {
  className: "",
  isOpen: !1,
  onClose: () => null,
  currentPosition: 0
};
Dt.sliderSetting = {
  dots: !1,
  infinite: !1,
  speed: 300,
  slideToShow: 1,
  slideToScroll: 1,
  arrows: !1,
  adaptiveHeight: !0
};
const Wa = {
  itemLocale: null,
  itemLocaleFetchStatus: y.IDLE,
  itemLocaleError: null
}, Fa = () => Oe(Wa);
function Za(t) {
  const [a] = le(), [n, c] = Ye(t), l = U(
    async ({
      itemId: r,
      language: s,
      country: o
    }) => {
      if (!r)
        return;
      let u = null, I = null;
      try {
        return c({
          itemLocaleFetchStatus: y.FETCHING,
          itemLocaleError: null
        }), u = await $.ItemApi(a).getLocale_ByItemId(r, {
          region: o,
          language: s
        }), { data: null };
      } catch (N) {
        return I = q.getErrorType(N), { error: N };
      } finally {
        c({
          itemLocale: u,
          itemLocaleFetchStatus: y.IDLE,
          itemLocaleError: I
        });
      }
    },
    [a]
  );
  return {
    state: n,
    mutations: {
      fetchItemLocale: l
    }
  };
}
const Ft = {
  useAppInfo: () => {
    const [t] = le(), [a, n] = W({
      appInfo: null,
      appInfoError: null,
      appInfoFetchStatus: y.IDLE
    }), c = U(
      async (l) => {
        if (!l)
          return;
        let r = null, s = null;
        try {
          n((o) => ({
            ...o,
            appInfoError: null,
            appInfoFetchStatus: y.FETCHING
          })), r = await $.ItemApi(t).getAppLocale_ByItemId(l);
        } catch (o) {
          s = q.getErrorType(o);
        } finally {
          n({
            appInfo: r,
            appInfoError: s,
            appInfoFetchStatus: y.IDLE
          });
        }
      },
      [t]
    );
    return {
      state: a,
      mutations: { requestAdditionalAppInfo: c }
    };
  }
}, Zt = {
  currencyMap: null,
  currencyMapFetchStatus: y.IDLE,
  currencyMapError: null
}, Va = Oe(Zt);
function qe() {
  const [t] = le(), [a, n] = Ye(Va), c = U(async () => {
    let r = null, s = null;
    try {
      return n({
        currencyMapFetchStatus: y.FETCHING,
        currencyMapError: null
      }), r = await ja.getCurrencyMap(t), { data: r };
    } catch (o) {
      return s = q.getErrorType(o), { error: s };
    } finally {
      n({
        currencyMap: r,
        currencyMapError: s,
        currencyMapFetchStatus: y.IDLE
      });
    }
  }, [t]), l = U(() => {
    n(Zt);
  }, []);
  return {
    state: a,
    mutations: {
      fetchCurrencyMap: c,
      resetState: l
    }
  };
}
const Ka = (t) => {
  const { additionalAppInfo: a } = t, { platforms: n, releaseDate: c, primaryGenre: l, genres: r, developer: s, publisher: o, websiteUrl: u, forumUrl: I } = a;
  return !n && !c && !r && !s && !o && !u && !I ? null : /* @__PURE__ */ e.createElement("div", { className: "gameDetailInfo" }, /* @__PURE__ */ e.createElement("ul", null, n && n.length > 0 && /* @__PURE__ */ e.createElement("li", { className: "infoWrapper" }, /* @__PURE__ */ e.createElement("h2", { className: "infoTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.platform" }, "Platform")), /* @__PURE__ */ e.createElement("p", { className: "infoContent" }, n.join(", "))), c && /* @__PURE__ */ e.createElement("li", { className: "infoWrapper" }, /* @__PURE__ */ e.createElement("h2", { className: "infoTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.releaseDate" }, "Release Date")), /* @__PURE__ */ e.createElement("p", { className: "infoContent" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.releaseDateValue" }, { releaseDate: new Date(c) }))), l && /* @__PURE__ */ e.createElement("li", { className: "infoWrapper" }, /* @__PURE__ */ e.createElement("h2", { className: "infoTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.primaryGenre" }, "Primary Genre")), /* @__PURE__ */ e.createElement("p", { className: "infoContent" }, l)), r && r.length > 0 && /* @__PURE__ */ e.createElement("li", { className: "infoWrapper" }, /* @__PURE__ */ e.createElement("h2", { className: "infoTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.genre" }, "Genre")), /* @__PURE__ */ e.createElement("p", { className: "infoContent" }, r.join(", "))), s && /* @__PURE__ */ e.createElement("li", { className: "infoWrapper" }, /* @__PURE__ */ e.createElement("h2", { className: "infoTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.developer" }, "Developer")), /* @__PURE__ */ e.createElement("p", { className: "infoContent" }, s)), o && /* @__PURE__ */ e.createElement("li", { className: "infoWrapper" }, /* @__PURE__ */ e.createElement("h2", { className: "infoTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.publisher" }, "Publisher")), /* @__PURE__ */ e.createElement("p", { className: "infoContent" }, o)), u && /* @__PURE__ */ e.createElement("li", { className: "infoWrapper" }, /* @__PURE__ */ e.createElement("h2", { className: "infoTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.websiteUrl" }, "Website URL")), /* @__PURE__ */ e.createElement("p", { className: "infoContent" }, u)), I && /* @__PURE__ */ e.createElement("li", { className: "infoWrapper" }, /* @__PURE__ */ e.createElement("h2", { className: "infoTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "GameDetailViewPage.detailInfo.forumUrl" }, "Forum URL")), /* @__PURE__ */ e.createElement("p", { className: "infoContent" }, I))));
};
const Ha = typeof je == "object" ? je.default : je, Ja = {
  dots: !1,
  infinite: !0,
  speed: 500,
  variableWidth: !0,
  swipe: !0,
  arrows: !1,
  touchThreshold: 100,
  swipeToSlide: !0,
  initialSlide: 0,
  slidesToShow: 4
};
function _a({ itemMedias: t, openLightbox: a }) {
  const [n, c] = W({
    lastMousePos: null,
    isSliderEnabled: !1
  }), l = lt(null);
  V(() => {
    function z() {
      const S = 288 * t.length;
      c((T) => ({ ...T, isSliderEnabled: S > window.innerWidth - 260 }));
    }
    return z(), window.addEventListener("resize", z), () => {
      window.removeEventListener("resize", z);
    };
  }, [t.length]);
  const r = () => {
    const z = l.current;
    z && z.slickPrev();
  }, s = () => {
    const z = l.current;
    z && z.slickNext();
  }, o = (z) => {
    c((g) => ({ ...g, lastMousePos: z.clientX }));
  }, u = (z) => (g) => {
    g.clientX === n.lastMousePos && a && a(z);
  }, I = (z, g) => {
    let j = Ce;
    const S = it.safeParse(z), T = ct.safeParse(z);
    return S.success ? j = pt(S.data.value.youtubeId) : T.success && (j = T.data.value.imageUrl), /* @__PURE__ */ e.createElement("div", { key: g, className: "imageContainer", onMouseDown: o, onMouseUp: u(g) }, /* @__PURE__ */ e.createElement("img", { src: j, loading: "lazy" }), /* @__PURE__ */ e.createElement("div", { className: "overlayImage" }));
  }, N = (z, g) => {
    const j = De.getMediaScreenshot(z);
    return /* @__PURE__ */ e.createElement("div", { key: g, className: "imageContainer", onMouseDown: o, onMouseUp: u(g) }, z.type === B.URL_VIDEO && /* @__PURE__ */ e.createElement("video", { src: z.content, width: 288 }), z.type !== B.URL_VIDEO && /* @__PURE__ */ e.createElement("img", { src: j || Ce, loading: "lazy" }), /* @__PURE__ */ e.createElement("div", { className: "overlayImage" }));
  }, { isSliderEnabled: D } = n;
  if (!t.length)
    return null;
  const m = Xa(t);
  return /* @__PURE__ */ e.createElement("div", { className: "appDetailGalleryContainer" }, /* @__PURE__ */ e.createElement("div", { className: "galleryDesktop" }, D ? /* @__PURE__ */ e.createElement("div", { className: "galleryWithSlider" }, /* @__PURE__ */ e.createElement(Ha, { ...Ja, ref: l, className: "sliderContainer" }, m && t.map(N), !m && t.map(I)), /* @__PURE__ */ e.createElement("button", { className: "btnPrev", onClick: r }, /* @__PURE__ */ e.createElement(ge, { className: d(re.left, "p-3") })), /* @__PURE__ */ e.createElement("button", { className: "btnNext", onClick: s }, /* @__PURE__ */ e.createElement(ge, { className: d(re.right, "p-3") }))) : /* @__PURE__ */ e.createElement(e.Fragment, null, m && t.map(N), !m && t.map(I))), /* @__PURE__ */ e.createElement("div", { className: "galleryMobile" }, t.length > 4 && /* @__PURE__ */ e.createElement(e.Fragment, null, m && t.slice(0, 4).map(N), !m && t.slice(0, 4).map(I), /* @__PURE__ */ e.createElement("div", { className: "btnSeeMore", onClick: () => a(0) }, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailGallery.seeMoreScreenshot" }, "See more screenshots"))), m && t.length <= 4 && t.map(N), !m && t.length <= 4 && t.map(I)));
}
const Xa = (t) => {
  let a = !0;
  return t.length && (a = Ie.safeParse(t[0]).success), a;
};
const qa = (t) => {
  const { requirements: a } = t;
  return /* @__PURE__ */ e.createElement("div", { className: "requirementItemList" }, a.map((n, c) => /* @__PURE__ */ e.createElement("div", { key: `${c} ${n.label}` }, /* @__PURE__ */ e.createElement("div", { className: "itemLabel" }, n.label), /* @__PURE__ */ e.createElement("ul", null, /* @__PURE__ */ e.createElement(
    ce,
    {
      title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.requirements.osVersion" }, "OS Version"),
      value: n.osVersion
    }
  ), /* @__PURE__ */ e.createElement(
    ce,
    {
      title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.requirements.processor" }, "Processor"),
      value: n.processor
    }
  ), /* @__PURE__ */ e.createElement(ce, { title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.requirements.ram" }, "RAM"), value: n.ram }), /* @__PURE__ */ e.createElement(
    ce,
    {
      title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.requirements.graphics" }, "Graphics Card"),
      value: n.graphics
    }
  ), /* @__PURE__ */ e.createElement(
    ce,
    {
      title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.requirements.directXVersion" }, "Direct X Version"),
      value: n.directXVersion
    }
  ), /* @__PURE__ */ e.createElement(
    ce,
    {
      title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.requirements.diskSpace" }, "Disk Space"),
      value: n.diskSpace
    }
  ), /* @__PURE__ */ e.createElement(
    ce,
    {
      title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.requirements.soundCard" }, "Sound Card"),
      value: n.soundCard
    }
  ), n.additionals && /* @__PURE__ */ e.createElement(
    ce,
    {
      title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.requirements.additionals" }, "Additional Requirements"),
      value: n.additionals
    }
  )))));
}, ce = (t) => {
  const { title: a, value: n } = t;
  return /* @__PURE__ */ e.createElement("li", { className: "requirementItem" }, /* @__PURE__ */ e.createElement("span", { className: "itemTitle" }, a), /* @__PURE__ */ e.createElement("span", { className: "itemContent" }, n || "-"));
}, Et = ({ additionalAppInfo: t, className: a }) => {
  const [n, c] = W({
    selectedRequirementKey: Object.keys((t == null ? void 0 : t.platformRequirements) || {})[0] || null
  }), l = t == null ? void 0 : t.platformRequirements;
  if (!l)
    return null;
  const r = Object.keys(l);
  if (!n.selectedRequirementKey)
    return null;
  const s = l[n.selectedRequirementKey];
  return s ? /* @__PURE__ */ e.createElement("div", { className: d("gamePlatformRequirements", a) }, /* @__PURE__ */ e.createElement("h3", { className: "requirementTitle" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "PlatformRequirements.systemRequirement" }, "System Requirements")), /* @__PURE__ */ e.createElement(Aa, null, r.map((o) => /* @__PURE__ */ e.createElement(
    "span",
    {
      className: d(At.tab, o === n.selectedRequirementKey && At.active),
      onClick: () => c((u) => ({
        ...u,
        selectedPlatformKey: o
      })),
      key: o
    },
    o
  ))), /* @__PURE__ */ e.createElement(qa, { requirements: s })) : null;
}, $a = "data:image/svg+xml;base64, ", en = "catalogItemBanner _catalogItemBanner_ef777", tn = "separator _separator_103f0", dt = {
  catalogItemBanner: en,
  separator: tn
}, an = (t) => {
  switch (t.type) {
    case B.YOUTUBE_VIDEO:
    case B.URL_VIDEO:
      return /* @__PURE__ */ e.createElement("div", { className: "banner-video-wrapper" }, /* @__PURE__ */ e.createElement(
        Be,
        {
          key: t.content,
          className: "media react-player",
          controls: !1,
          url: t.content,
          playing: !0,
          loop: !0,
          volume: 0
        }
      ));
    default:
      return /* @__PURE__ */ e.createElement("img", { key: t.content, alt: t.content, src: t.content, className: "media", loading: "lazy" });
  }
}, nn = (t) => {
  const { item: a, itemPublishingContent: n, isPreviewMode: c, children: l } = t, { state: r } = _e(), s = a.title, o = a.description || "", u = r.isSingleGame || c;
  return /* @__PURE__ */ e.createElement("div", { className: dt.catalogItemBanner }, n && n.mainBackground && n.mainBackground.content && rt.isValidUrl(n.mainBackground.content) ? an(n.mainBackground) : /* @__PURE__ */ e.createElement(
    "img",
    {
      className: "media",
      src: ia.getFilteredImageUrlByTag(a.images, Ot.productBanner) || $a,
      alt: ""
    }
  ), /* @__PURE__ */ e.createElement(
    "div",
    {
      className: "media overlay",
      style: {
        backgroundImage: "radial-gradient(736.50px at 50% 50%, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.73) 100%)",
        backgroundSize: "cover",
        backgroundPosition: "center"
      }
    },
    !u && /* @__PURE__ */ e.createElement("div", { className: "bannerContainer" }, /* @__PURE__ */ e.createElement("div", { className: "bannerUpperSpace" }, l), /* @__PURE__ */ e.createElement("div", { className: "bannerContent" }, /* @__PURE__ */ e.createElement("h1", { className: "bannerTitle" }, s), /* @__PURE__ */ e.createElement("div", { className: "bannerDescription" }, o), /* @__PURE__ */ e.createElement("div", { className: d(dt.separator) }))),
    u && /* @__PURE__ */ e.createElement("div", { className: "bannerContainer", style: { justifyContent: "center" } }, /* @__PURE__ */ e.createElement("div", { className: "bannerContent" }, /* @__PURE__ */ e.createElement("h1", { className: "bannerTitle" }, s), /* @__PURE__ */ e.createElement("div", { className: "bannerDescription" }, o), /* @__PURE__ */ e.createElement("div", null, l)))
  ));
};
const Lt = 643;
function cn({ item: t }) {
  const [a, n] = W(!1), c = t.longDescription || "", l = (c || "").length > Lt;
  return /* @__PURE__ */ e.createElement("section", { className: "catalogOverview" }, /* @__PURE__ */ e.createElement("h2", { className: "overviewHeading" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "CatalogOverview.heading" }, "Overview")), /* @__PURE__ */ e.createElement("div", { className: "overviewContent" }, a ? c : c.slice(0, Lt), !c && /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "CatalogOverview.noContent" }, "No Overview")), /* @__PURE__ */ e.createElement("div", null, l && /* @__PURE__ */ e.createElement(
    "button",
    {
      onClick: () => {
        n(!a);
      }
    },
    a ? /* @__PURE__ */ e.createElement(i, { i18nKey: "CatalogOverview.readless" }, "Read less") : /* @__PURE__ */ e.createElement(i, { i18nKey: "CatalogOverview.readmore" }, "Read more")
  ))));
}
const rn = (t) => /* @__PURE__ */ e.createElement("div", { className: "catalogTitleWidget" }, t.tag && /* @__PURE__ */ e.createElement("span", { className: "tag" }, t.tag), /* @__PURE__ */ e.createElement("h2", { className: "title" }, t.item.title), t.children);
const ln = (t) => {
  const { onClickPlay: a, isDisabled: n } = t;
  return /* @__PURE__ */ e.createElement("button", { className: "btn big btn-primary text-uppercase", onClick: () => a(), disabled: n }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.button.play" }, "PLAY"));
};
const sn = ({ className: t, paymentOptions: a }) => {
  const n = ee.isFree(a.map((c) => c.regionData));
  return /* @__PURE__ */ e.createElement("div", { className: d(t, "priceList") }, n && /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.freeItem" }, "FREE")), !n && a.map(({ regionData: c, currencySymbol: l, finalPrice: r, currencyType: s, originalPrice: o }, u) => /* @__PURE__ */ e.createElement("div", { className: "price", key: `${c.currencyCode}-${u}` }, /* @__PURE__ */ e.createElement("div", { className: d("payablePrice ", s === We.enum.VIRTUAL && "virtual") }, /* @__PURE__ */ e.createElement("div", null, `${l} ${r}`), r !== o && /* @__PURE__ */ e.createElement("div", { className: "discountPercentage" }, ee.calculateDiscountPercentage(c), "%")), r !== o && /* @__PURE__ */ e.createElement("s", { className: "originalPriceStrikethrough" }, /* @__PURE__ */ e.createElement("div", { className: "originalPrice" }, `${l} ${o}`)))));
};
const Nn = (t) => {
  const { item: a, onClose: n, onBuy: c } = t, l = a.title;
  return /* @__PURE__ */ e.createElement(
    Ae,
    {
      isOpen: !0,
      title: /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseAccessibleItemDialog.title" }, "Buy Game"),
      onClose: () => n(),
      className: "purchaseAccessibleItemDialog"
    },
    /* @__PURE__ */ e.createElement(Ee, null, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseAccessibleItemDialog.content" }, /* @__PURE__ */ e.createElement("p", null, "Do you want to buy permanent access to ", /* @__PURE__ */ e.createElement("strong", null, { itemTitle: l }), " ?"), /* @__PURE__ */ e.createElement("p", null, "You can access this game with your Prime subscription"))),
    /* @__PURE__ */ e.createElement(de, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { className: "btn big btnCancel", onClick: () => n() }, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseAccessibleItemDialog.buttons.cancel" }, "CANCEL")), /* @__PURE__ */ e.createElement(Ve, { className: "btn big btnContinuePayment", onClick: () => c() }, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseAccessibleItemDialog.buttons.buy" }, "BUY")))
  );
};
function Mn({ isPurchasing: t, onPurchase: a, paymentOptions: n, className: c, disabled: l }) {
  const [r, s] = W(!1), o = lt(null);
  V(() => {
    const D = (m) => {
      m.composedPath().includes(o.current) || r && s(!1);
    };
    return window.addEventListener("click", D), () => {
      window.removeEventListener("click", D);
    };
  }, []);
  const u = () => /* @__PURE__ */ e.createElement("div", { className: d("purchaseButtonContainer", c) }, /* @__PURE__ */ e.createElement(
    "button",
    {
      ref: o,
      className: d("purchaseButton btn big btn-primary"),
      disabled: l,
      onClick: () => s(!r)
    },
    /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.purchaseButton" }, "Buy Now")),
    /* @__PURE__ */ e.createElement(ge, { className: d("arrow", r ? re.up : re.down) })
  ), /* @__PURE__ */ e.createElement("ul", { className: d("purchaseDropdown", r && "open") }, n.map((D) => /* @__PURE__ */ e.createElement(
    "li",
    {
      className: "purchaseDropdownOption",
      onClick: () => a(D.regionData),
      key: D.regionData.currencyCode
    },
    /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.purchaseDropdownOption" }, "Buy for..."),
    /* @__PURE__ */ e.createElement("span", null, D.currencySymbol, " ", D.finalPrice)
  )))), I = () => /* @__PURE__ */ e.createElement(
    "button",
    {
      className: d(c, "purchaseButton btn big btn-primary"),
      disabled: l,
      onClick: () => a(n[0].regionData)
    },
    /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.purchaseButton" }, "Buy Now")
  ), N = () => /* @__PURE__ */ e.createElement("button", { className: d(c, "purchaseButton btn big btn-primary"), disabled: !0 }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.purchaseButtonPurchasing" }, "Purchasing..."), /* @__PURE__ */ e.createElement(Ut, { className: d(Qt.inline, "purchaseButtonSpinner") }));
  return t ? N() : n.length === 1 ? I() : n.length > 1 ? u() : null;
}
const on = () => /* @__PURE__ */ e.createElement("div", { className: "userBannedAlert" }, /* @__PURE__ */ e.createElement("span", { className: "alertIcon" }, /* @__PURE__ */ e.createElement(Yt, { type: "danger" })), /* @__PURE__ */ e.createElement("span", { className: "alertDescription" }, /* @__PURE__ */ e.createElement(kt, null))), Vt = {
  subscriptionItems: null,
  subscriptionItemsFetchStatus: y.IDLE,
  subscriptionItemsError: null,
  subscriptions: null,
  subscriptionsFetchStatus: y.IDLE,
  subscriptionsError: null,
  entitledSku: /* @__PURE__ */ new Map(),
  entitledSkuFetchStatus: y.IDLE,
  entitledSkuError: null
}, fe = 100, un = Oe(Vt);
function In() {
  const [t] = le(), [a, n] = Ye(un), c = U(
    async (u, I) => {
      const N = /* @__PURE__ */ new Map();
      let D = null;
      try {
        if (!u)
          return;
        n({ entitledSkuError: null, entitledSkuFetchStatus: y.FETCHING });
        for (const m of u) {
          if (!m.sku)
            continue;
          const g = !!(await $.EntitlementApi(t).getEntitlementsOwnershipAny_ByUserId(I, { skus: [m.sku] })).owned;
          N.set(m.sku, g);
        }
        return { data: N };
      } catch (m) {
        return D = q.getErrorType(m), { error: m };
      } finally {
        n({
          entitledSku: N,
          entitledSkuError: D,
          entitledSkuFetchStatus: y.IDLE
        });
      }
    },
    [t]
  ), l = U(
    async ({ country: u, language: I }) => {
      var m;
      let N = [], D = null;
      try {
        n({ subscriptionItemsError: null, subscriptionItemsFetchStatus: y.FETCHING });
        let z = !1, g = 0;
        do {
          const j = await $.ItemApi(t).getItemsByCriteria({
            region: u,
            language: I,
            offset: g,
            itemType: Q.enum.SUBSCRIPTION,
            limit: fe,
            sortBy: [yt.DISPLAY_ORDER_ASC, yt.NAME_ASC]
          });
          z = !!((m = j.paging) != null && m.next), g += fe, N = N.concat(j.data);
        } while (z);
        return { data: null };
      } catch (z) {
        return D = q.getErrorType(z), { error: z };
      } finally {
        n({
          subscriptionItems: N,
          subscriptionItemsError: D,
          subscriptionItemsFetchStatus: y.IDLE
        });
      }
    },
    [t]
  ), r = U(
    async (u) => {
      var D;
      let I = [], N = null;
      try {
        n({ subscriptionsError: null, subscriptionsFetchStatus: y.FETCHING });
        let m = !1, z = 0;
        do {
          const g = await $.SubscriptionApi(t).getSubscriptions_ByUserId(u, {
            offset: z,
            limit: fe
          });
          m = !!((D = g.paging) != null && D.next), z += fe, I = I.concat(g.data);
        } while (m);
        return { data: null };
      } catch (m) {
        return N = q.getErrorType(m), { error: m };
      } finally {
        n({
          subscriptions: I,
          subscriptionsError: N,
          subscriptionsFetchStatus: y.IDLE
        });
      }
    },
    [t]
  ), s = U(
    async (u, I, N) => {
      let D = null;
      try {
        return n({ subscriptionsError: null, subscriptionsFetchStatus: y.CREATING }), await $.SubscriptionApi(t).createSubscription_ByUserId(u, {
          itemId: I.itemId,
          region: I.region,
          currencyCode: N.currencyCode
        }), { data: null };
      } catch (m) {
        return D = q.getErrorType(m), { error: m };
      } finally {
        n({ subscriptionsError: D, subscriptionsFetchStatus: y.IDLE });
      }
    },
    [t]
  ), o = U(() => {
    n(Vt);
  }, []);
  return {
    state: a,
    mutations: {
      fetchSkuOwnerships: c,
      fetchSubscriptionItem: l,
      fetchUserSubscriptions: r,
      createSubscription: s,
      resetState: o
    }
  };
}
const Dn = "logo";
class gn {
  static getItemByItemId(a, n) {
    return (a || []).find((c) => c.itemId === n) || null;
  }
  static getSubscriptionByItemId(a, n) {
    return (a || []).find((c) => c.itemId === n) || null;
  }
  static getSubscriptionItemBySKU(a, n) {
    return (a || []).find((c) => c.sku === n) || null;
  }
  static hasSubscriptions(a, n) {
    return !!(Array.isArray(n) ? n : [n]).find((l) => a.get(l));
  }
  static getSubscriptionImagesBySKUs(a, n) {
    if (!a)
      return [];
    const c = [];
    for (const l of a) {
      if (!l.sku || !n.includes(l.sku))
        continue;
      const r = Ge.getFilteredImageUrlByTag(l.images, Dn);
      r && c.push(r);
    }
    return c;
  }
}
class mn {
  static getV2WidgetAppPage(a, n) {
    return `${a}${n ? `?itemId=${n}` : ""}`;
  }
}
const gt = (t) => {
  const {
    state: a,
    mutations: { setActiveGame: n, fetchItemInfo: c }
  } = ra(), { state: l } = Je(), r = async () => {
    const { item: s } = t;
    if (s.appId) {
      const { error: o } = n(a.itemsInfoRecord, s.appId);
      o && await c({ appId: s.appId }), l.push(mn.getV2WidgetAppPage("", s.appId));
    }
  };
  return /* @__PURE__ */ e.createElement("button", { className: "btn big btn-primary btnGoToLibrary", onClick: r }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.button.goToLibrary" }, "GO TO LIBRARY"));
};
class mt {
}
mt.AVOID_REDIRECT_TO_FILE_PROTOCOL = null;
const zn = ({
  item: t,
  onOrderCreated: a,
  title: n,
  customItemNameTransform: c,
  isOpen: l,
  isPreviewMode: r,
  onClose: s,
  onPurchaseError: o,
  preSelectedRegionData: u
}) => {
  var ke;
  const [I, N] = W({
    quantity: 1,
    selectedRegionData: u || (t.regionData || [])[0] || null,
    alert: null
  }), [D] = xt(), {
    state: { user: m }
  } = st(), {
    state: { flags: z }
  } = _e(), { state: g } = Je(), { state: j } = ye(), {
    state: { prepurchaseInformation: S, prepurchaseInformationFetchStatus: T, purchaseProcessFetchStatus: b },
    mutations: { purchase: x, onOrderCreatedHook: f, onOrderFulfilledHook: H }
  } = Mt(), {
    state: { pendingOrders: R }
  } = Nt();
  V(() => {
    Ke.isUserBanned(m) && N((p) => ({
      ...p,
      alert: {
        type: ie.danger,
        element: /* @__PURE__ */ e.createElement(kt, null)
      }
    }));
  }, [m]);
  const J = (p) => {
    o && o(), N((Ne) => ({
      ...Ne,
      alert: {
        type: ie.danger,
        element: /* @__PURE__ */ e.createElement(ht, { error: p })
      }
    }));
  }, G = async () => {
    const { selectedRegionData: p, quantity: Ne } = I;
    if (!p)
      return;
    const { data: Z, error: v } = await x({
      item: t,
      userId: m == null ? void 0 : m.userId,
      regionData: p,
      quantity: Ne,
      returnUrl: K.isDesktopApp() ? mt.AVOID_REDIRECT_TO_FILE_PROTOCOL : wt.combineURLPaths(window.location.origin, D.baseURL)
    });
    Z && (a(Z), f({ createdOrder: Z, user: m, flags: z }), Z.status === ve.enum.FULFILLED && H({ createdOrder: Z, user: m, flags: z })), v && J(v);
  }, { alert: se, selectedRegionData: F, quantity: C } = I, te = T === y.FETCHING, ae = b === y.PURCHASING, O = r ? Pt : S == null ? void 0 : S.purchaseConstraint, E = (ke = O == null ? void 0 : O.paymentConstraints) == null ? void 0 : ke.find(
    (p) => JSON.stringify(p.paymentOption.regionData) === JSON.stringify(F)
  ), ne = O && O.entitlementConstraint, P = E && E.paymentOption, $e = E && E.walletConstraint.maxPurchase < C;
  return /* @__PURE__ */ e.createElement(Ae, { className: "purchaseDialog", title: n, isOpen: l, isPreviewMode: r }, /* @__PURE__ */ e.createElement(Ee, null, $e && /* @__PURE__ */ e.createElement(ue, { type: ie.danger }, /* @__PURE__ */ e.createElement("div", { className: "alertContainer" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.notice.insufficientBalance" }, "Insufficient Balance"))), /* @__PURE__ */ e.createElement("table", null, /* @__PURE__ */ e.createElement("tbody", null, /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("th", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.key.item" }, "Item")), /* @__PURE__ */ e.createElement("td", null, c && c(t) || t.title)), te && /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("td", { colSpan: 2 }, /* @__PURE__ */ e.createElement(ot, null))), O && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("th", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.key.options" }, "Price option")), /* @__PURE__ */ e.createElement("td", null, /* @__PURE__ */ e.createElement(Ea, null, O.paymentConstraints.map((p, Ne) => {
    const { regionData: Z, currencySymbol: v, finalPrice: he } = p.paymentOption, { currencyCode: xe } = Z;
    return /* @__PURE__ */ e.createElement(
      da,
      {
        key: `${xe}-${Ne}`,
        onClick: () => N((A) => ({
          ...A,
          selectedRegionData: Z
        })),
        checked: JSON.stringify(F) === JSON.stringify(Z),
        label: `${v} ${he}`
      }
    );
  })))), ne && /* @__PURE__ */ e.createElement(e.Fragment, null, ne.maxAllowedPurchase > 1 && /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("th", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.key.quantity" }, "Quantity")), /* @__PURE__ */ e.createElement("td", null, /* @__PURE__ */ e.createElement("div", { className: "quantitySelector" }, /* @__PURE__ */ e.createElement(
    "button",
    {
      onClick: () => {
        N((p) => ({
          ...p,
          quantity: C - 1
        }));
      },
      disabled: C <= 1,
      className: "quantityControl",
      type: "button"
    },
    "-"
  ), /* @__PURE__ */ e.createElement("span", { className: "value" }, C), /* @__PURE__ */ e.createElement(
    "button",
    {
      onClick: () => {
        N((p) => ({
          ...p,
          quantity: C + 1
        }));
      },
      disabled: C >= ne.maxAllowedPurchase || C >= Oa,
      className: "quantityControl",
      type: "button"
    },
    "+"
  )))), P && P.finalPrice > 0 && /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("th", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.key.payable" }, "Amount to pay")), /* @__PURE__ */ e.createElement("td", null, `${P.currencySymbol} ${(C * P.finalPrice).toFixed(
    P.decimals
  )}`)), ne.maxAllowedPurchase < 0 && /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("td", { colSpan: 2 }, /* @__PURE__ */ e.createElement("div", { className: "itemUnavailableNotice" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.notice.itemUnavailable" }, "Item Unavailable")))))), R && R.length > 0 && /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("td", { colSpan: 2 }, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.notice.pendingOrders.message" }, "You already have another pending order that contains this item. Please", /* @__PURE__ */ e.createElement(
    oe,
    {
      to: j.orders.detail.makePath({
        params: { orderNo: R[0].orderNo },
        state: { referrer: g.location.pathname }
      })
    },
    "complete"
  ), " ", "that order before making another purchase."))), !!se && /* @__PURE__ */ e.createElement("tr", null, /* @__PURE__ */ e.createElement("td", { colSpan: 2 }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(ue, { type: se.type, onDismiss: () => N((p) => ({ ...p, alert: null })) }, se.element))))))), /* @__PURE__ */ e.createElement(de, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { disabled: ae, onClick: () => s && s(), className: "btn btn-ghost" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.buttons.cancel" }, "CANCEL")), /* @__PURE__ */ e.createElement(
    Ve,
    {
      loadingIndicator: "SPINNER",
      disabled: R && R.length > 0 || ae || !O || O.entitlementConstraint.maxAllowedPurchase < C || E && E.walletConstraint.maxPurchase < C || Ke.isUserBanned(m),
      onClick: G,
      className: "btn btn-primary",
      isLoading: ae || te
    },
    !ae && E && /* @__PURE__ */ e.createElement(e.Fragment, null, E.paymentOption.finalPrice > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, E.paymentOption.regionData.currencyType === We.enum.REAL && /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.buttons.continuePayment" }, "CONTINUE TO PAYMENT"), E.paymentOption.regionData.currencyType === We.enum.VIRTUAL && /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.buttons.payNow" }, "PAY NOW")), E.paymentOption.finalPrice === 0 && /* @__PURE__ */ e.createElement(i, { i18nKey: "PurchaseDialog.buttons.claim" }, "CLAIM"))
  )));
};
class jn {
  static doesUserMeetPurchaseCondition(a, n) {
    var c;
    return a ? (c = n == null ? void 0 : n[0]) == null ? void 0 : c.purchasable : !0;
  }
}
const yn = ({ unmatchedItems: t, onCloseDialog: a }) => /* @__PURE__ */ e.createElement(Ae, { title: Xe("BaseStoreDetailCatalog.dialog.purchasingRequirement.title"), isOpen: !0, className: "purchaseRequirementUnmatchListDialog" }, /* @__PURE__ */ e.createElement(Ee, null, /* @__PURE__ */ e.createElement(i, { i18nKey: "CommonTip.userNotMeetItemPurchaseCondition" }, "To purchase this item, you must first purchase the following item(s):"), /* @__PURE__ */ e.createElement("ul", { className: "item-list" }, t == null ? void 0 : t.map(({ title: n }) => /* @__PURE__ */ e.createElement("li", { key: n }, n)))), /* @__PURE__ */ e.createElement(de, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { onClick: a, className: "btn btnClose uppercase" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "common.close" }, "Close"))));
function An({ item: t, isDialogOpen: a, onCloseDialog: n }) {
  return /* @__PURE__ */ e.createElement(Ae, { title: Xe("BaseStoreDetailCatalog.dialog.downloadLauncher.title"), isOpen: a, className: "downloadLauncherDialog" }, /* @__PURE__ */ e.createElement(Ee, null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.dialog.downloadLauncher.content" }, /* @__PURE__ */ e.createElement("p", { className: "message" }, "You can play this game using Launcher."), /* @__PURE__ */ e.createElement("p", { className: "message bottom" }, "Don't have Launcher? Click here to download and install."))), /* @__PURE__ */ e.createElement(de, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { onClick: () => n(), className: "btn small btn-ghost btnCancel" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.dialog.downloadLauncher.cancel" }, "Cancel")), K.isDesktopApp() && /* @__PURE__ */ e.createElement(gt, { item: t }), !K.isDesktopApp() && /* @__PURE__ */ e.createElement(Gt, null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.download" }, "DOWNLOAD"))));
}
const Re = (t) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimSuccess.content" }, /* @__PURE__ */ e.createElement("p", { className: "claimSuccessMessage" }, "Congratulations! You have successfully claimed")), /* @__PURE__ */ e.createElement("p", { className: "claumSuccessTitle" }, t.title)), En = (t) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(Re, { title: t.title }), /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimSuccess.downloadLauncherMessage" }, /* @__PURE__ */ e.createElement("p", { className: "downloadLauncherMessage" }, "You can play this game using Launcher. Don't have Launcher? Click ", /* @__PURE__ */ e.createElement("strong", null, "here"), " to download and install."))), dn = (t) => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimSuccess.content" }, /* @__PURE__ */ e.createElement("p", { className: "claimSuccessMessage" }, "Congratulations! You have successfully claimed")), /* @__PURE__ */ e.createElement("p", { className: "inline font-medium text-[color:rgb(var(--od-rgba-text))]" }, t.title, "."), " ", /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimSuccess.startShoppingMessage" }, /* @__PURE__ */ e.createElement("p", { className: "startShoppingMessage" }, "Let's start shopping!"))), Ln = () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimCodeMessage.code.description" }, /* @__PURE__ */ e.createElement("p", { className: "claimCodeMessage above" }, "Your product key has been sent to your email. You can also see"), /* @__PURE__ */ e.createElement("p", { className: "claimCodeMessage bottom" }, "the key by clicking the See My Keys button below, or going to")), /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimCodeMessage.code.goToMyPurchasedItem" }, /* @__PURE__ */ e.createElement("p", { className: "goToPurchasedItem" }, /* @__PURE__ */ e.createElement("span", null, "My Account"), /* @__PURE__ */ e.createElement(ge, { className: d("arrow", re.right) }), /* @__PURE__ */ e.createElement("span", null, "Purchased Items"), /* @__PURE__ */ e.createElement(ge, { className: d("arrow", re.right) }), /* @__PURE__ */ e.createElement("span", null, "Product Keys")))), Tn = (t) => /* @__PURE__ */ e.createElement(
  "a",
  {
    className: "btn small btn-primary launcherDownloadButton big",
    title: t.miniLauncherLink,
    target: "_blank",
    rel: "noreferrer",
    download: !0,
    href: t.miniLauncherLink
  },
  t.children
);
function Sn({ item: t, itemPublishingContent: a, onCloseDialog: n, launcherGoToLibraryButton: c }) {
  const { state: l } = ye(), r = t.itemType === Q.enum.COINS, s = t.itemType === Q.enum.APP, o = t.itemType === Q.enum.CODE, u = t.itemType === Q.enum.OPTIONBOX, I = t.title ? t.title : "DEFAULT_ITEM_TITLE", N = a && a.miniLauncherUrl || "";
  return /* @__PURE__ */ e.createElement(Ae, { title: Xe("AppDetailPage.dialog.claimSuccess.title"), isOpen: !0, className: "claimStatusDialog" }, /* @__PURE__ */ e.createElement(Ee, null, /* @__PURE__ */ e.createElement(la, { className: "successIcon" }), s && /* @__PURE__ */ e.createElement(e.Fragment, null, !K.isDesktopApp() && (N && /* @__PURE__ */ e.createElement(Re, { title: I }) || /* @__PURE__ */ e.createElement(En, { title: I })), K.isDesktopApp() && /* @__PURE__ */ e.createElement(Re, { title: I })), r && /* @__PURE__ */ e.createElement(dn, { title: I }), o && /* @__PURE__ */ e.createElement(Ln, null), !(s || r || o) && /* @__PURE__ */ e.createElement(Re, { title: I })), /* @__PURE__ */ e.createElement(de, { className: `dialogFooterSuccess ${!s && !r ? "center" : "end"}` }, /* @__PURE__ */ e.createElement("button", { onClick: n, className: "btn big btnOk" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimSuccess.ok" }, "OK")), !K.isDesktopApp() && s && (N && /* @__PURE__ */ e.createElement(Tn, { miniLauncherLink: N }, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimSuccess.downloadNow" }, "Download Now")) || /* @__PURE__ */ e.createElement(Gt, { className: "big btnGetLauncher" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimSuccess.getLauncherButton" }, "Get Launcher"))), K.isDesktopApp() && s && /* @__PURE__ */ e.createElement(Cn, { item: t, overriderElement: c }), r && /* @__PURE__ */ e.createElement(oe, { to: l.store.index.link, className: "btn big btn-primary btnGoToStore" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "ClaimSuccessDialog.goStore" }, "Go To Store")), o && /* @__PURE__ */ e.createElement(oe, { to: l.account.purchasedItems.keys.link }, /* @__PURE__ */ e.createElement(Ve, { className: "btn big btn-primary btnSeeKeys" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimCodeSuccess.button.seeMyKeys" }, "See My Keys"))), u && /* @__PURE__ */ e.createElement(oe, { to: l.account.purchasedItems.optionboxes.link }, /* @__PURE__ */ e.createElement(Ve, { className: "btn big btn-primary btnSeeKeys" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimOptionboxSuccess.button.seeMyItem" }, "See My Option box")))));
}
function Cn({ item: t, overriderElement: a }) {
  return a || /* @__PURE__ */ e.createElement(gt, { item: t });
}
const pn = ({ className: t }) => /* @__PURE__ */ e.createElement("i", { className: t }, /* @__PURE__ */ e.createElement("svg", { width: "44", height: "44", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 44 44" }, /* @__PURE__ */ e.createElement("path", { fill: "#D75A4A", fillRule: "evenodd", d: "M44 22c0 12.15-9.85 22-22 22S0 34.15 0 22 9.85 0 22 0s22 9.85 22 22z", clipRule: "evenodd" }), /* @__PURE__ */ e.createElement("path", { stroke: "#fff", strokeLinecap: "round", strokeWidth: "2", d: "M14.08 29.92l15.84-15.84M14.08 14.08l15.84 15.84" }))), On = (t) => {
  const a = ka.CONTACT_SUPPORT_EMAIL;
  return /* @__PURE__ */ e.createElement(Ae, { title: Xe("AppDetailPage.dialog.claimFailed.title"), isOpen: !0, className: "claimStatusDialog" }, /* @__PURE__ */ e.createElement(Ee, null, /* @__PURE__ */ e.createElement(pn, { className: "failedIcon" }), !a && /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimFailed.content" }, /* @__PURE__ */ e.createElement("p", { className: "failedMessage" }, "Failed to claim the game. Please contact support for assistance.")), a && /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimFailed.contentWithEmail" }, /* @__PURE__ */ e.createElement("p", { className: "failedMessage" }, "Failed to claim the game. Please contact support at ", /* @__PURE__ */ e.createElement("a", { href: `mailto:${a}` }, { contactSupportEmail: a }), " ", "for assistance."))), /* @__PURE__ */ e.createElement(de, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("button", { onClick: t.onCloseDialog, className: "btn btnClose" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dialog.claimFailed.close" }, "Close"))));
}, Y = M.enum([
  "PURCHASE",
  "DOWNLOAD_LAUNCHER",
  "CLAIM_SUCCESS",
  "CLAIM_FAILED",
  "PAYMENT_SUCCESS",
  "PURCHASE_ACCESSIBLE_ITEM",
  "PURCHASING_REQUIREMENT_ERROR"
]), Pe = 3, Tt = ({
  item: t,
  additionalAppInfo: a,
  previewMode: n,
  itemPublishingContent: c,
  initialActiveDialog: l,
  launcherGoToLibraryButton: r
}) => {
  const [s, o] = W({
    selectedRegionData: null,
    purchaseQuantity: 1,
    createdOrder: null,
    activeDialog: l || null
  }), [u] = le(), [I] = xt(), {
    state: { flags: N }
  } = _e(), {
    state: { user: D }
  } = st(), { state: m } = Je(), { state: z } = ye(), {
    state: { entitledSku: g }
  } = In(), {
    state: { prepurchaseInformation: j, prepurchaseInformationFetchStatus: S, purchaseProcessFetchStatus: T, purchaseProcessError: b },
    mutations: { prepareOrderProcess: x, purchase: f, onOrderCreatedHook: H, onOrderFulfilledHook: R }
  } = Mt(), {
    state: { pendingOrders: J, paymentInfo: G },
    mutations: { fetchPendingOrders: se }
  } = Nt(), {
    state: { currencyMap: F }
  } = qe(), C = fn(j == null ? void 0 : j.itemOwnership), te = (A) => {
    if (!F || !D)
      return;
    const L = ee.isFree(t.regionData || []);
    A.status === ve.enum.INIT && m.push(
      z.orders.detail.makePath({
        params: { orderNo: A.orderNo },
        state: { referrer: m.location.pathname }
      })
    ), A.status === ve.enum.FULFILLED && (x({ currencyMap: F, item: t, userId: D.userId }), se({ itemId: t.itemId, userId: D.userId }), o((k) => ({
      ...k,
      activeDialog: L ? Y.enum.CLAIM_SUCCESS : Y.enum.PAYMENT_SUCCESS
    })));
  }, ae = () => {
    ee.isFree(t.regionData || []) && o((L) => ({ ...L, activeDialog: Y.enum.CLAIM_FAILED }));
  }, O = () => {
    const A = new pa(u).createLoginURL(m.location.pathname);
    window.location.replace(A);
  }, E = (A) => {
    if (!!!D) {
      O();
      return;
    }
    if (!K.isDesktopApp() && bn(g, t) && (N != null && N.isSubscriptionsVisible)) {
      o((k) => ({
        ...k,
        activeDialog: Y.enum.PURCHASE_ACCESSIBLE_ITEM,
        selectedRegionData: A,
        purchaseQuantity: 1
      }));
      return;
    }
    o((k) => ({
      ...k,
      activeDialog: Y.enum.PURCHASE,
      selectedRegionData: A,
      purchaseQuantity: 1
    }));
  }, ne = async () => {
    if (!!!((D == null ? void 0 : D.userId) || null)) {
      O();
      return;
    }
    const _ = ee.getFirstFreeRegionDatum(t.regionData || []);
    if (!_)
      return;
    const { data: h } = await f({
      item: t,
      userId: D == null ? void 0 : D.userId,
      regionData: _,
      quantity: 1,
      returnUrl: K.isDesktopApp() ? mt.AVOID_REDIRECT_TO_FILE_PROTOCOL : wt.combineURLPaths(window.location.origin, I.baseURL)
    });
    h && (o((Le) => ({ ...Le, createdOrder: h })), te(h), H({ createdOrder: h, user: D, flags: N }), h.status === ve.enum.FULFILLED && R({ createdOrder: h, user: D, flags: N }));
  }, P = () => {
    const { activeDialog: A } = s;
    A && o((L) => ({ ...L, activeDialog: null }));
  }, $e = () => {
    const A = n !== void 0;
    return (A ? Ca.userId : D == null ? void 0 : D.userId) ? /* @__PURE__ */ e.createElement(
      zn,
      {
        title: /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.dialog.purchase.title" }, "Checkout"),
        item: t,
        onClose: A ? () => null : P,
        preSelectedRegionData: s.selectedRegionData || void 0,
        isOpen: s.activeDialog === Y.enum.PURCHASE,
        onOrderCreated: te,
        onPurchaseError: ae,
        isPreviewMode: n === "checkout"
      }
    ) : null;
  }, ke = (A) => {
    if (!j)
      return;
    const L = S === y.PURCHASING, k = D == null ? void 0 : D.userId, { availableItemInfo: _, baseAppOwnership: h, purchaseConditionValidation: Le } = j, we = ee.isFree(t.regionData || []), Ue = !!J && J.length > 0, me = !!(_ && _.userPurchaseLimit === 0), w = !jn.doesUserMeetPurchaseCondition(k, Le), Qe = t.itemType === Q.enum.APP, Me = Pn({ item: t }), Te = h == null ? void 0 : h.owned, et = t.itemType === Q.enum.INGAMEITEM && t.entitlementType === Ia.enum.DURABLE, ze = !!k, tt = ze && Me && !Te || !t.purchasable || me;
    switch (!0) {
      case n !== void 0:
        return /* @__PURE__ */ e.createElement(wn, null);
      case (Qe && C && K.isDesktopApp()):
        return /* @__PURE__ */ e.createElement(Yn, { item: t, overriderElement: r });
      case (Qe && C && !K.isDesktopApp()):
        return c && rt.isValidUrl(c.miniLauncherUrl) ? /* @__PURE__ */ e.createElement(kn, { itemPublishingContent: c }) : /* @__PURE__ */ e.createElement(
          ln,
          {
            onClickPlay: () => o((X) => ({
              ...X,
              activeDialog: Y.enum.DOWNLOAD_LAUNCHER
            }))
          }
        );
      case (C && (me || et)):
        return /* @__PURE__ */ e.createElement(xn, null);
      case (!C && t.regionData && we):
        return /* @__PURE__ */ e.createElement(hn, { isDisabled: tt, isPurchasing: L, onClaim: ne });
      case A.length === 0:
        return /* @__PURE__ */ e.createElement(Un, { additionalAppInfo: a });
      default:
        return /* @__PURE__ */ e.createElement(
          Mn,
          {
            className: "purchaseButton",
            isPurchasing: L,
            disabled: ze && (L || Ke.isUserBanned(D) || Ue || me || w || Me && !Te || !t.purchasable),
            onPurchase: (X) => E(X),
            paymentOptions: A.map((X) => X.paymentOption)
          }
        );
    }
  }, p = () => {
    if (!(!J || J.length === 0))
      return G && G.charging ? /* @__PURE__ */ e.createElement("div", { className: "pendingOrderAlertContainer" }, /* @__PURE__ */ e.createElement(ue, { className: "pendingOrderAlert", type: ie.info }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.pendingPaymentExist.message" }, "You already have a pending order for this item.")), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(
        oe,
        {
          to: z.account.orderHistory.detail.makePath({
            params: { orderNo: J[0].orderNo }
          })
        },
        /* @__PURE__ */ e.createElement(i, { i18nKey: "CatalogPurchase.pendingPaymentExist.viewOrderDetail" }, "View Order Detail")
      )))) : /* @__PURE__ */ e.createElement("div", { className: "pendingOrderAlertContainer" }, /* @__PURE__ */ e.createElement(ue, { className: "pendingOrderAlert", type: ie.info }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.pendingOrdersExist.message" }, "You already have another pending order that contains this item. Please complete that order before making another purchase.")), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(
        oe,
        {
          to: z.orders.detail.makePath({
            params: { orderNo: J[0].orderNo },
            state: { referrer: m.location.pathname }
          })
        },
        /* @__PURE__ */ e.createElement(i, { i18nKey: "CatalogPurchaseW.pendingOrdersExist.linkToOrder" }, "Continue to Checkout")
      ))));
  }, Ne = () => {
    var we, Ue, me;
    if (!j)
      return;
    const { unmatchedPurchaseRequirementItems: A, purchaseConditionValidation: L } = j;
    if (!(A != null && A.length))
      return;
    let k = (A == null ? void 0 : A.map((w) => w.itemId)) || [];
    const _ = [], h = [];
    if (L) {
      const w = ((we = L[0]) == null ? void 0 : we.validateDetails) || [], Qe = w.length;
      for (let Me = 0; Me < Qe && k.length !== 0; Me++) {
        const Te = ((Ue = w[Me]) == null ? void 0 : Ue.predicateValidateResults) || [], et = Te.length, ze = (((me = t.purchaseCondition) == null ? void 0 : me.conditionGroups) || [])[Me], tt = (ze == null ? void 0 : ze.predicates) || [];
        for (let X = 0; X < et; X++) {
          const { validated: qt, unmatched: be } = Te[X], { comparison: $t } = tt[X];
          if (!qt && be)
            switch (k = k.filter((Se) => be.includes(Se)), $t) {
              case "includes":
                _.push(
                  ...A.filter((Se) => be.includes(Se.itemId))
                );
                break;
              case "excludes":
                h.push(
                  ...A.filter((Se) => be.includes(Se.itemId))
                );
                break;
            }
        }
      }
    }
    const Le = _.length > Pe || h.length > Pe;
    return /* @__PURE__ */ e.createElement("div", { className: "purchasingRequirementNotMetTip" }, /* @__PURE__ */ e.createElement(Yt, { className: "icon-warning" }), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "CommonTip.userNotMeetItemPurchaseCondition" }, "To purchase this item, you must satisfy the following condition(s):"), !!_.length && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "CommonTip.userNotMeetIncludeItemPurchaseCondition" }, "Must first purchase below item(s):")), /* @__PURE__ */ e.createElement("ul", { className: "item-list" }, _.slice(0, Pe).map(({ title: w }) => /* @__PURE__ */ e.createElement("li", { key: w }, w)))), !!h.length && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "CommonTip.userNotMeetExcludeItemPurchaseCondition" }, "Cannot own below item(s):")), /* @__PURE__ */ e.createElement("ul", { className: "item-list" }, h.slice(0, Pe).map(({ title: w }) => /* @__PURE__ */ e.createElement("li", { key: w }, w)))), Le && /* @__PURE__ */ e.createElement(
      "button",
      {
        className: "button-see-more",
        onClick: () => {
          o((w) => ({
            ...w,
            activeDialog: Y.enum.PURCHASING_REQUIREMENT_ERROR
          }));
        }
      },
      /* @__PURE__ */ e.createElement(i, { i18nKey: "common.seeMore" }, "See More")
    )));
  }, Z = () => {
    const A = n ? Pt : j == null ? void 0 : j.purchaseConstraint;
    if (!A)
      return;
    const { paymentConstraints: L } = A;
    return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "priceListContainer" }, L && L.length > 0 && t.purchasable && /* @__PURE__ */ e.createElement(sn, { className: "priceList", paymentOptions: L.map((k) => k.paymentOption) }), !t.purchasable && /* @__PURE__ */ e.createElement("div", { className: "unpurchasable-info" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.unpurchasable.info" }, "Sorry, this product is not purchaseable.")), ke(L)), Ne());
  }, { activeDialog: v, createdOrder: he } = s, xe = T === y.FETCHING;
  return /* @__PURE__ */ e.createElement("div", { className: "baseStoreDetailCatalog" }, v === Y.enum.PURCHASE && $e(), v === Y.enum.PURCHASE_ACCESSIBLE_ITEM && /* @__PURE__ */ e.createElement(
    Nn,
    {
      item: t,
      onClose: P,
      onBuy: () => o((A) => ({
        ...A,
        activeDialog: Y.enum.PURCHASE
      }))
    }
  ), v === Y.enum.PURCHASING_REQUIREMENT_ERROR && /* @__PURE__ */ e.createElement(
    yn,
    {
      unmatchedItems: j == null ? void 0 : j.unmatchedPurchaseRequirementItems,
      onCloseDialog: P
    }
  ), v === Y.enum.DOWNLOAD_LAUNCHER && /* @__PURE__ */ e.createElement(
    An,
    {
      item: t,
      isDialogOpen: v === Y.enum.DOWNLOAD_LAUNCHER,
      onCloseDialog: P
    }
  ), v === Y.enum.CLAIM_SUCCESS && /* @__PURE__ */ e.createElement(
    Sn,
    {
      item: t,
      itemPublishingContent: c,
      onCloseDialog: P,
      launcherGoToLibraryButton: r
    }
  ), v === Y.enum.CLAIM_FAILED && /* @__PURE__ */ e.createElement(On, { onCloseDialog: P }), v === Y.enum.PAYMENT_SUCCESS && he && /* @__PURE__ */ e.createElement(ya, { orderInfo: he, onCloseDialog: P }), xe ? /* @__PURE__ */ e.createElement("div", { className: "loadingContainer" }, /* @__PURE__ */ e.createElement(ot, null)) : Z(), p(), b && /* @__PURE__ */ e.createElement(Qn, { error: b }), Ke.isUserBanned(D) && !xe && !C && /* @__PURE__ */ e.createElement(on, null));
};
function Yn({ item: t, overriderElement: a }) {
  return a || /* @__PURE__ */ e.createElement(gt, { item: t });
}
function kn({ itemPublishingContent: t }) {
  return t ? /* @__PURE__ */ e.createElement("a", { className: "btn big btn-primary text-uppercase", href: t.miniLauncherUrl }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.button.play" }, "PLAY")) : null;
}
function hn({ isDisabled: t, isPurchasing: a, onClaim: n }) {
  return /* @__PURE__ */ e.createElement("button", { className: "btn btn-primary", onClick: n, disabled: t }, a && /* @__PURE__ */ e.createElement(Ut, { className: Qt.inline }), !a && /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.button.claim" }, "CLAIM NOW"));
}
function xn() {
  return /* @__PURE__ */ e.createElement("button", { className: "btn btn-primary", disabled: !0 }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.button.owned" }, "OWNED"));
}
function wn() {
  return /* @__PURE__ */ e.createElement("button", { className: "btn btn-primary" }, "PURCHASE");
}
function Un({ additionalAppInfo: t }) {
  if (t) {
    const a = new Date(t.releaseDate || "");
    if (bt(a) && ft(new Date(), a))
      return /* @__PURE__ */ e.createElement("div", { className: "paymentUnavailable" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.comingSoonDate" }, "Release on ", { releaseDate: a }));
  }
  return /* @__PURE__ */ e.createElement("div", { className: "paymentUnavailable" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.cantPurchasedYet" }, "Sorry, this item cannot be purchased yet. Please return to the store to continue shopping."));
}
function Qn({ error: t }) {
  return Fe.isAxiosServerError(t) ? /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.fetchError.serverError" }, "Unable to retrieve entitlement and price information. Please refresh or go back and try again.")) : Fe.isAxiosNetworkError(t) ? /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.fetchError.networkError" }, "Looks like you aren`t connected to the internet. Please check your connection and try again.")) : /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.fetchError.unknownError" }, "Something went wrong. Please contact support for assistance."));
}
function bn(t, a) {
  return a.features && gn.hasSubscriptions(t, a.features);
}
function fn(t) {
  return !!(t && t.owned);
}
function Pn({ item: t }) {
  return t.itemType === Q.enum.INGAMEITEM;
}
const vn = ({ className: t, size: a = 16 }) => /* @__PURE__ */ e.createElement("i", { className: d(t) }, /* @__PURE__ */ e.createElement("svg", { width: a, height: a, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement(
  "path",
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M8.00065 13.6668C11.1303 13.6668 13.6673 11.1298 13.6673 8.00016C13.6673 4.87055 11.1303 2.3335 8.00065 2.3335C4.87104 2.3335 2.33398 4.87055 2.33398 8.00016C2.33398 11.1298 4.87104 13.6668 8.00065 13.6668ZM8.00065 14.6668C11.6825 14.6668 14.6673 11.6821 14.6673 8.00016C14.6673 4.31826 11.6825 1.3335 8.00065 1.3335C4.31875 1.3335 1.33398 4.31826 1.33398 8.00016C1.33398 11.6821 4.31875 14.6668 8.00065 14.6668Z",
    fill: "currentColor"
  }
), /* @__PURE__ */ e.createElement(
  "path",
  {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M8 4.5C8.27614 4.5 8.5 4.72386 8.5 5V7.79289L10.3536 9.64645C10.5488 9.84171 10.5488 10.1583 10.3536 10.3536C10.1583 10.5488 9.84171 10.5488 9.64645 10.3536L7.64645 8.35355C7.55268 8.25979 7.5 8.13261 7.5 8V5C7.5 4.72386 7.72386 4.5 8 4.5Z",
    fill: "currentColor"
  }
)));
function Kt({ currencyMap: t, item: a, position: n, showDetail: c }) {
  const [l, r] = W(!1), s = lt(null), o = (g) => {
    g.preventDefault(), r((j) => !j);
  }, u = (g) => {
    g.preventDefault(), r(!1), s.current && window.clearTimeout(s.current);
  }, I = (g, j = 2e3) => {
    g.preventDefault(), s.current = window.setTimeout(() => u(g), j);
  }, N = (g) => {
    g.preventDefault(), s.current && clearTimeout(s.current);
  }, D = n || "bottom", m = a && a.regionData;
  if (!m || !t)
    return null;
  const z = Ze.makePaymentOptionWithExpiryDiscount(m, t);
  return /* @__PURE__ */ e.createElement(e.Fragment, null, z[0] && z[0].regionData.discountExpireAt && /* @__PURE__ */ e.createElement("div", { className: "discountCountdownWrapper", onMouseLeave: I, onMouseEnter: N }, /* @__PURE__ */ e.createElement("span", { className: "discountCountdownWidget", onClick: o }, /* @__PURE__ */ e.createElement(vn, { className: "clockIcon" }), c && /* @__PURE__ */ e.createElement(i, { i18nKey: "DiscountCountdown.end" }, "Discount will end in"), " ", St(z[0].regionData.discountExpireAt), " >"), /* @__PURE__ */ e.createElement(
    "div",
    {
      className: d("tooltipCountdownWidget", D, {
        open: l
      })
    },
    /* @__PURE__ */ e.createElement("div", { className: "tooltipTextWrapper" }, z.map((g) => /* @__PURE__ */ e.createElement("div", { key: g.currencySymbol, className: "tooltipText" }, /* @__PURE__ */ e.createElement("b", null, ee.calculateDiscountPercentage(g.regionData), "%"), " ", /* @__PURE__ */ e.createElement(i, { i18nKey: "DiscountCountdown.for" }, "off for"), " ", /* @__PURE__ */ e.createElement("b", null, g.currencySymbol, " ", g.finalPrice), " ", /* @__PURE__ */ e.createElement(i, { i18nKey: "DiscountCountdown.expire" }, "will expire in"), " ", /* @__PURE__ */ e.createElement("b", null, St(g.regionData.discountExpireAt))))),
    /* @__PURE__ */ e.createElement("div", { className: "tooltipCloseButton", onClick: u }, "×")
  )));
}
function St(t) {
  return t ? Ta(Sa(t), { addSuffix: !0 }) : null;
}
function Rn({ user: t, isPreviewMode: a, prepurchaseInformation: n, pendingOrders: c }) {
  var N;
  const {
    state: { location: l }
  } = Je(), { state: r } = ye();
  if (a || !l)
    return null;
  const s = !!(t && ((N = n == null ? void 0 : n.itemOwnership) != null && N.owned)), o = Ze.purchaseUnavailable(n == null ? void 0 : n.purchaseConstraint), u = c && c.length > 0, I = l.pathname.includes(r.store.index.link);
  return u && I ? /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(ue, { type: ie.warning, className: "headerAlert rounded-none" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BundleItemDetailPage.itemAlreadyOrdered" }, "You already ordered this item. Please complete your order."))) : s && o && I ? /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(ue, { type: ie.warning, className: "headerAlert rounded-none" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BundleItemDetailPage.itemAlreadyOwned" }, "You already own this item."))) : /* @__PURE__ */ e.createElement("div", null, o && !s && !u && /* @__PURE__ */ e.createElement(ue, { type: ie.danger, className: "headerAlert rounded-none" }, /* @__PURE__ */ e.createElement(i, { i18nKey: "BundleItemDetailPage.itemNotAvailable" }, "This item is unavailable.")));
}
const Gn = {
  useStoreDetailCommonStates: Bn,
  useBundleInformation: Fn
};
function Bn() {
  const [t, a] = W({
    isLightboxOpen: !1,
    selectedImagePosition: 0
  });
  return { state: t, openLightbox: (l) => {
    a((r) => ({ ...r, isLightboxOpen: !0, selectedImagePosition: l }));
  }, closeLightbox: () => {
    a((l) => ({ ...l, isLightboxOpen: !1 }));
  } };
}
const Wn = {
  items: null,
  baseApp: null,
  bundleInfoFetchStatus: y.IDLE,
  bundleInfoError: null
};
function Fn() {
  const [t] = le(), [a, n] = W(Wn), c = U(
    async ({
      baseAppId: l,
      itemIds: r,
      country: s,
      language: o
    }) => {
      let u = null, I = null, N = null;
      try {
        n((m) => ({ ...m, bundleInfoFetchStatus: y.FETCHING, bundleInfoError: null }));
        const D = await $.ItemApi(t).getItemsLocaleByIds({
          language: o,
          region: s,
          itemIds: r.toString()
        });
        return u = D, l && (I = D.find((m) => l === m.appId) || null, I || (I = await $.ItemApi(t).getItemsByAppId({
          appId: l,
          region: s,
          language: o
        }))), { error: null, data: { baseApp: I, items: u } };
      } catch (D) {
        return N = q.getErrorType(D), { error: N, data: null };
      } finally {
        n({
          baseApp: I,
          items: u,
          bundleInfoError: N,
          bundleInfoFetchStatus: y.IDLE
        });
      }
    },
    []
  );
  return {
    state: a,
    mutations: {
      fetchBundleContents: c
    }
  };
}
const Zn = () => /* @__PURE__ */ e.createElement(ha, { className: "mt-3 md:mt-7" });
const Ct = 100, Ht = {
  items: null,
  itemsFetchStatus: y.IDLE,
  itemsError: null
}, zt = () => Oe(Ht);
function Vn(t) {
  const [a] = le(), [n, c] = Ye(t), l = U(
    async ({
      baseItemId: s,
      queryParams: o
    }) => {
      var N;
      let u = null, I = null;
      try {
        c({
          itemsFetchStatus: y.FETCHING,
          itemsError: null
        });
        const { baseAppId: D, itemType: m, appType: z, country: g, language: j } = o, S = [Q.enum.OPTIONBOX, Q.enum.CODE], T = [];
        let b = !1, x = 0;
        if (D || m && S.includes(m))
          do {
            const f = await $.ItemApi(a).getItemsByCriteria({
              baseAppId: D,
              itemType: m,
              appType: z,
              region: g,
              language: j,
              offset: x,
              limit: Ct
            });
            T.push(...f.data.filter((H) => H.itemId !== s)), b = !!((N = f.paging) != null && N.next), x += Ct;
          } while (b);
        return u = T, { data: u };
      } catch (D) {
        return I = q.getErrorType(D), { error: D };
      } finally {
        c({ items: u, itemsError: I, itemsFetchStatus: y.IDLE });
      }
    },
    [a]
  ), r = U(() => {
    c(Ht);
  }, []);
  return {
    state: n,
    mutations: {
      fetchItemsByCriteriaExhaustive: l,
      resetState: r
    }
  };
}
function Kn({ item: t, currencyMap: a, disableHref: n }) {
  const { state: c, mutations: l } = Ft.useAppInfo(), { state: r } = ye();
  V(() => {
    Ze.makePaymentOptionList(t.regionData || [], a).length === 0 && l.requestAdditionalAppInfo(t.itemId);
  }, [l.requestAdditionalAppInfo, t, a]);
  const s = Ze.makePaymentOptionList(t.regionData || [], a), o = Ge.getFilteredImageUrlByTag(t.images, Ot.productCover) || Ce, u = ee.isFree(t.regionData || []), I = n ? "javascript:void(0)" : Ge.getItemDetailRoute(r, t);
  return /* @__PURE__ */ e.createElement(sa, { className: "storeGridItem", to: I, isExternal: n }, /* @__PURE__ */ e.createElement(
    "div",
    {
      className: "imageContainer",
      style: {
        backgroundImage: o ? `linear-gradient(180deg, rgba(0, 0, 0, 0.53) 9.44%, rgba(44, 61, 71, 0) 46.17%), url('${o}')` : void 0
      }
    },
    /* @__PURE__ */ e.createElement("div", { className: "discountCountdownWrapper" }, /* @__PURE__ */ e.createElement(Kt, { item: t, currencyMap: a }))
  ), /* @__PURE__ */ e.createElement("div", { className: d("title", ma.TITLE_FONT) }, t.title), /* @__PURE__ */ e.createElement("div", { className: "paymentOptions" }, s.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, u && /* @__PURE__ */ e.createElement(i, { i18nKey: "StoreGridItem.freeItem" }, "FREE"), !u && s.map((N, D) => /* @__PURE__ */ e.createElement(Jn, { key: `${N.regionData.currencyCode}-${D}`, paymentOption: N }))), s.length === 0 && /* @__PURE__ */ e.createElement(Hn, { appInfo: c.appInfo })));
}
function Hn({ appInfo: t }) {
  if (t) {
    const a = new Date(t.releaseDate || "");
    if (bt(a) && ft(new Date(), a))
      return /* @__PURE__ */ e.createElement(i, { i18nKey: "BaseStoreDetailCatalog.comingSoonDate" }, "Release on ", { releaseDate: a });
  }
  return /* @__PURE__ */ e.createElement(i, { i18nKey: "StoreGridItem.unavailable" }, "Unavailable");
}
function Jn({ paymentOption: t }) {
  const { currencySymbol: a, finalPrice: n, regionData: c, currencyType: l, originalPrice: r } = t, s = ee.calculateDiscountPercentage(c);
  return /* @__PURE__ */ e.createElement(
    "div",
    {
      className: d("paymentOption", l === We.enum.REAL ? "realCurrency" : "virtualCurrency"),
      key: t.regionData.currencyCode
    },
    /* @__PURE__ */ e.createElement("div", { className: "discountedPrice" }, a, " ", n),
    ee.isDiscounted(c) && /* @__PURE__ */ e.createElement(Ma, null, /* @__PURE__ */ e.createElement("s", { className: "priceStrikethrough" }, /* @__PURE__ */ e.createElement("div", { className: "price" }, a, " ", r)), /* @__PURE__ */ e.createElement("div", { className: "discountLabel" }, "-", s, "%"))
  );
}
const Jt = {
  items: null,
  itemsFetchStatus: y.IDLE,
  itemsError: null
}, Rc = () => Oe(Jt);
function _n(t) {
  const [a] = le(), [n, c] = Ye(t), l = U(
    async ({
      queryParams: s
    }) => {
      let o = null, u = null;
      try {
        c({
          itemsFetchStatus: y.FETCHING,
          itemsError: null
        });
        const { page: I, pageSize: N, country: D, plan: m, itemType: z, ...g } = s;
        return o = await $.ItemApi(a).getItemsByCriteria({
          offset: Xn(I),
          limit: _t(N),
          region: D,
          features: m || void 0,
          itemType: z || void 0,
          ...g
        }), { data: o };
      } catch (I) {
        return u = q.getErrorType(I), { error: u };
      } finally {
        c({ items: o, itemsError: u, itemsFetchStatus: y.IDLE });
      }
    },
    [a]
  ), r = U(() => {
    c(Jt);
  }, []);
  return {
    state: n,
    mutations: {
      fetchItemsByCriteria: l,
      resetState: r
    }
  };
}
function Xn(t) {
  return t ? (t - 1) * _t() : 0;
}
function _t(t) {
  return t || 16;
}
const qn = 8;
function Gc({
  initialShownItem: t,
  baseItem: a,
  appType: n,
  country: c,
  isPreviewMode: l,
  itemType: r,
  language: s,
  pageSize: o,
  loadingMessage: u,
  noItemMessage: I,
  withWrapper: N,
  store: D
}) {
  var f, H;
  const [m, z] = W(!1), { state: g, mutations: j } = _n(D), {
    state: { currencyMap: S }
  } = qe();
  V(() => {
    const R = a.baseAppId || a.appId;
    !R && r !== Q.enum.OPTIONBOX || j.fetchItemsByCriteria({
      queryParams: {
        appType: n,
        itemType: r,
        baseAppId: R,
        country: c,
        language: s,
        pageSize: o
      }
    });
  }, [r, a, c, s, o]);
  const T = l ? vt.data : (f = g.items) == null ? void 0 : f.data, b = l ? Rt() : S, x = /* @__PURE__ */ e.createElement(
    Xt,
    {
      currencyMap: b,
      fetchStatus: g.itemsFetchStatus,
      error: g.itemsError,
      loadingMessage: u,
      noItemMessage: I,
      initialShownItem: t,
      isShowAll: m,
      setIsShowAll: z,
      items: (H = g.items) == null ? void 0 : H.data
    }
  );
  return N ? /* @__PURE__ */ e.createElement(e.Fragment, null, (T && T.length > 0 || g.itemsError) && N(x)) : /* @__PURE__ */ e.createElement(e.Fragment, null, x);
}
function Xt({
  fetchStatus: t,
  error: a,
  loadingMessage: n,
  noItemMessage: c,
  currencyMap: l,
  initialShownItem: r = qn,
  isShowAll: s,
  setIsShowAll: o,
  items: u
}) {
  return /* @__PURE__ */ e.createElement("div", { className: "inAppStore" }, /* @__PURE__ */ e.createElement("div", { className: "inGameItemData" }, t === y.FETCHING ? /* @__PURE__ */ e.createElement(ot, { className: La.medium }, n) : /* @__PURE__ */ e.createElement(e.Fragment, null, a && /* @__PURE__ */ e.createElement("div", { className: "errorContainer" }, /* @__PURE__ */ e.createElement(ht, { error: a })), u && u.length === 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "my-16 text-center" }, c), !c && /* @__PURE__ */ e.createElement(i, { i18nKey: "InAppStore.grid.empty" }, "No Items Available")), /* @__PURE__ */ e.createElement("div", { className: "inGameItemGrid list" }, u && l && (s ? u : u.slice(0, r)).map((I) => /* @__PURE__ */ e.createElement(Kn, { key: I.itemId, item: I, currencyMap: l }))))), u && u.length > r && !s && /* @__PURE__ */ e.createElement("div", { className: "showMoreButton" }, /* @__PURE__ */ e.createElement("button", { className: "btn btn-primary", type: "button", onClick: () => o(!0) }, /* @__PURE__ */ e.createElement(i, { i18nKey: "InAppStore.showAllButton" }, "Show All"))));
}
function nt({
  initialShownItem: t = 8,
  baseItem: a,
  appType: n,
  country: c,
  isPreviewMode: l,
  itemType: r,
  language: s,
  pageSize: o,
  loadingMessage: u,
  noItemMessage: I,
  withWrapper: N,
  store: D
}) {
  const [m, z] = W(!1), {
    state: g,
    mutations: { fetchItemsByCriteriaExhaustive: j }
  } = Vn(D), {
    state: { currencyMap: S }
  } = qe();
  V(() => {
    const f = a.baseAppId || a.appId;
    j({
      baseItemId: a.itemId,
      queryParams: {
        appType: n,
        itemType: r,
        baseAppId: f,
        country: c,
        language: s,
        pageSize: o
      }
    });
  }, [r, a, c, s, o, j, n]);
  const T = l ? vt.data : g.items, b = l ? Rt() : S, x = /* @__PURE__ */ e.createElement(
    Xt,
    {
      currencyMap: b,
      fetchStatus: g.itemsFetchStatus,
      error: g.itemsError,
      loadingMessage: u,
      noItemMessage: I,
      initialShownItem: t,
      isShowAll: m,
      setIsShowAll: z,
      items: g.items
    }
  );
  return N ? /* @__PURE__ */ e.createElement(e.Fragment, null, (T && T.length > 0 || g.itemsError) && N(x)) : /* @__PURE__ */ e.createElement(e.Fragment, null, x);
}
const $n = ({ error: t }) => {
  const a = () => {
    switch (!0) {
      case t instanceof It:
      case t instanceof za:
        return /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.item.decodeError" }, "The game data from the server is invalid. Please refresh the page.");
      default:
        return /* @__PURE__ */ e.createElement(aa, { error: t });
    }
  };
  return /* @__PURE__ */ e.createElement("div", { className: "error" }, a());
}, ec = zt(), tc = zt(), ac = zt(), nc = Fa();
function Bc({ itemId: t, previewOptions: a }) {
  const { state: n, openLightbox: c, closeLightbox: l } = Gn.useStoreDetailCommonStates(), {
    state: { user: r }
  } = st(), { state: s } = ye(), { state: o } = _e(), u = r == null ? void 0 : r.country, I = Ya(), {
    state: { itemLocale: N, itemLocaleError: D, itemLocaleFetchStatus: m },
    mutations: { fetchItemLocale: z }
  } = Za(nc), {
    state: { appInfo: g, appInfoError: j, appInfoFetchStatus: S },
    mutations: { requestAdditionalAppInfo: T }
  } = Ft.useAppInfo(), {
    state: { prepurchaseInformation: b },
    mutations: { prepareOrderProcess: x, resetState: f }
  } = Mt(), {
    state: { pendingOrders: H },
    mutations: { fetchPendingOrders: R, resetState: J }
  } = Nt(), {
    state: { currencyMap: G },
    mutations: { fetchCurrencyMap: se }
  } = qe();
  V(() => {
    G || se();
  }, [G]), V(() => {
    z({ itemId: t, language: I, country: u });
  }, [t, I, u]), V(() => {
    T(t);
  }, [t]), V(() => {
    !G || !N || (x({ item: N, userId: r == null ? void 0 : r.userId, currencyMap: G }), r != null && r.userId && R({ itemId: N.itemId, userId: r.userId }));
  }, [N, r == null ? void 0 : r.userId, G]), V(() => () => {
    f(), J();
  }, []);
  const F = D || j, C = Da.isMatchStatus([S, m], y.FETCHING), { isLightboxOpen: te, selectedImagePosition: ae } = n, O = Ge.getMedia(N, g), E = a ? a.isSingleGame : o.isSingleGame;
  return F && Fe.extractServiceErrorCode(F) === ga.ITEM_NOT_FOUND && ua({ eventCategory: s.error.err404.link, eventLabel: Fe.errorToString(F) }), /* @__PURE__ */ e.createElement("div", { className: "itemDetailPage" }, /* @__PURE__ */ e.createElement(
    Rn,
    {
      user: r,
      prepurchaseInformation: b,
      pendingOrders: H,
      isPreviewMode: !!a
    }
  ), C && /* @__PURE__ */ e.createElement(Zn, null), F && /* @__PURE__ */ e.createElement($n, { error: F }), N && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(nn, { item: N, itemPublishingContent: g, isPreviewMode: !!a }, !E && /* @__PURE__ */ e.createElement(ta, null, /* @__PURE__ */ e.createElement(oe, { to: s.store.apps.index.link }, /* @__PURE__ */ e.createElement(i, { i18nKey: "Navigation.links.games" }, "Games")), N.title), E && /* @__PURE__ */ e.createElement(
    Tt,
    {
      item: N,
      itemPublishingContent: g,
      additionalAppInfo: g,
      previewMode: a == null ? void 0 : a.mode
    }
  )), O && !E && /* @__PURE__ */ e.createElement(_a, { itemMedias: O, openLightbox: c }), te && O && !E && /* @__PURE__ */ e.createElement(Dt, { itemMedias: O, isOpen: te, onClose: l, selectedPosition: ae }), !E && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "availableBundleContainer" }, /* @__PURE__ */ e.createElement("h2", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.availableBundles.heading" }, "Available Bundles")), /* @__PURE__ */ e.createElement(
    nt,
    {
      store: ac,
      baseItem: N,
      itemType: Q.enum.BUNDLE,
      language: I,
      initialShownItem: 4,
      noItemMessage: /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.availableBundles.noItem" }, "Looks like there are no items for this game yet.")
    }
  )), /* @__PURE__ */ e.createElement("div", { className: "itemDetailContent" }, /* @__PURE__ */ e.createElement("div", { className: "description" }, /* @__PURE__ */ e.createElement(cn, { item: N }), g && /* @__PURE__ */ e.createElement(Et, { className: "requirementsDesktop", additionalAppInfo: g })), /* @__PURE__ */ e.createElement("div", { className: "detailWidget" }, G && /* @__PURE__ */ e.createElement(rn, { item: N }, /* @__PURE__ */ e.createElement(Kt, { item: N, currencyMap: G, position: "right", showDetail: !0 })), /* @__PURE__ */ e.createElement("div", { className: "protruded" }, /* @__PURE__ */ e.createElement(Tt, { item: N, itemPublishingContent: g, additionalAppInfo: g })), g && /* @__PURE__ */ e.createElement(Ka, { additionalAppInfo: g })), g && /* @__PURE__ */ e.createElement(Et, { className: "requirementsMobile", additionalAppInfo: g }))), N.appType === jt.enum.GAME && !E && /* @__PURE__ */ e.createElement(
    nt,
    {
      store: ec,
      baseItem: N,
      itemType: Q.enum.APP,
      appType: jt.enum.DLC,
      language: I,
      withWrapper: (ne) => /* @__PURE__ */ e.createElement("div", { className: "storeContainer" }, /* @__PURE__ */ e.createElement("h2", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dlcStore.heading" }, "Expansions")), ne),
      noItemMessage: /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.inAppStore.noItem" }, "Looks like there are not any items for this game yet.")
    }
  ), !E && /* @__PURE__ */ e.createElement("div", { className: "storeContainer" }, /* @__PURE__ */ e.createElement("h2", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.inAppStore.heading" }, "Game Store")), /* @__PURE__ */ e.createElement(
    nt,
    {
      store: tc,
      baseItem: N,
      itemType: Q.enum.INGAMEITEM,
      language: I,
      noItemMessage: /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.inAppStore.noItem" }, "Looks like there are not any items for this game yet.")
    }
  ))));
}
export {
  Bc as A,
  Zn as B,
  nn as C,
  Kt as D,
  It as F,
  Dt as L,
  gt as O,
  Rn as P,
  Gn as S,
  Ie as U,
  B as a,
  Za as b,
  Fa as c,
  $a as d,
  zt as e,
  _a as f,
  cn as g,
  rn as h,
  Tt as i,
  nt as j,
  Et as k,
  _n as l,
  Kn as m,
  Rc as n,
  Gc as o,
  $n as p,
  qe as u
};
