"use client";
import { j as e } from "../../../node_modules/.pnpm/react@19.1.0/node_modules/react/jsx-runtime.mjs";
import { faRepeat as Q } from "../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.mjs";
import { FontAwesomeIcon as X } from "../../../node_modules/.pnpm/@fortawesome_react-fontawesome@0.2.2_@fortawesome_fontawesome-svg-core@6.7.2_react@19.1.0/node_modules/@fortawesome/react-fontawesome/index.es.mjs";
import { Popover as t } from "@mantine/core";
import { useDisclosure as Y } from "@mantine/hooks";
import q from "../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.mjs";
import J from "../../assets/fallback_card.jpg.mjs";
import "react";
import { ReactComponent as y } from "../../assets/images/BurgerOpenIcon.svg.mjs";
import { ReactComponent as K } from "../../assets/images/CheckmarkCircleOutline.svg.mjs";
import { ReactComponent as V } from "../../assets/images/DownloadIcon.svg.mjs";
import { ReactComponent as Z } from "../../assets/images/PlayIcon.svg.mjs";
import { ReactComponent as ee } from "../../assets/images/PlusCircleOutline.svg.mjs";
import s from "./GameCard.module.scss.mjs";
import l from "./components/ActionBar/index.mjs";
import u from "./components/DownloadBar/index.mjs";
import se from "./components/Image/Image.module.scss.mjs";
import oe from "./components/StoreLogo/index.mjs";
const re = {
  addedToLibrary: "Remove from library",
  notAddedToLibrary: "Add to library",
  logoTextTooltip: {
    hyperplay: {
      installed: "Installed from HyperPlay Store",
      notInstalled: "Will install from HyperPlay Store"
    },
    gog: {
      installed: "Installed from GOG Store",
      notInstalled: "Will install from GOG Store"
    },
    epic: {
      installed: "Installed from Epic Store",
      notInstalled: "Will install from Epic Store"
    }
  }
}, Ae = ({
  image: j,
  imageUrl: f,
  title: x,
  onFavoriteClick: L,
  onDownloadClick: C,
  onUpdateClick: b,
  onRemoveFromQueueClick: D,
  onStopPlayingClick: O,
  onPlayClick: G,
  state: i,
  message: n,
  progress: a,
  onStopDownloadClick: c,
  onPauseClick: m,
  favorited: w,
  settingsItems: B,
  showSettings: h,
  onSettingsClick: R,
  onResumeClick: d,
  actionDisabled: N = !1,
  alwaysShowInColor: U = !1,
  store: v,
  app: p = "client",
  onAddToLibraryClick: g,
  onRemoveFromLibraryClick: I,
  gameIsAddedToLibrary: F,
  notAddedText: A,
  addedText: S,
  enableRemoveButton: _,
  i18n: M = re,
  ...W
}) => {
  const [P, { open: E, close: T }] = Y(!1);
  function $() {
    const o = {
      onFavoriteClick: L,
      onSettingsClick: R,
      title: x,
      favorited: w,
      showSettings: h,
      actionDisabled: N
    };
    switch (i) {
      case "QUEUED":
        return /* @__PURE__ */ e.jsx(
          l,
          {
            ...o,
            onActionClick: D,
            icon: /* @__PURE__ */ e.jsx(y, { width: "22px", height: "22px" })
          }
        );
      case "PLAYING":
        return /* @__PURE__ */ e.jsx(
          l,
          {
            ...o,
            onActionClick: O,
            icon: /* @__PURE__ */ e.jsx(y, { width: "22px", height: "22px" })
          }
        );
      case "INSTALLED":
        return /* @__PURE__ */ e.jsx(
          l,
          {
            ...o,
            onActionClick: G,
            icon: /* @__PURE__ */ e.jsx(Z, { fill: "var(--color-neutral-100)" })
          }
        );
      case "NOT_INSTALLED":
        return /* @__PURE__ */ e.jsx(
          l,
          {
            ...o,
            onActionClick: C,
            icon: /* @__PURE__ */ e.jsx(V, { fill: "var(--color-neutral-100)" }),
            actionDisabled: N
          }
        );
      case "SHOW_MESSAGE":
      case "DOWNLOADING_DISTRIBUTABLES":
      case "PREPARING":
        return /* @__PURE__ */ e.jsx("div", { className: "caption", children: n });
      case "NOT_SUPPORTED":
        return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
          /* @__PURE__ */ e.jsx("div", { className: `${s.title} title-sm`, children: x }),
          /* @__PURE__ */ e.jsx("div", { className: s.actionButtonContainer, children: /* @__PURE__ */ e.jsx("div", { className: "title-sm", children: "Unsupported" }) })
        ] });
      case "UNINSTALLING":
        return /* @__PURE__ */ e.jsx("div", { className: "caption", children: "Uninstalling..." });
      case "INSTALLING":
        return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
          u,
          {
            message: n,
            progress: a,
            onStopDownloadClick: c,
            onPauseClick: m,
            onResumeClick: d,
            isPaused: !1
          }
        ) });
      case "EXTRACTING":
        return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
          u,
          {
            message: n,
            progress: a,
            onStopDownloadClick: c,
            onPauseClick: m,
            onResumeClick: d,
            showPauseButton: !1,
            isPaused: !1,
            hasProgressControls: !1
          }
        ) });
      case "PATCHING":
        return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
          u,
          {
            message: n,
            progress: a,
            onStopDownloadClick: c,
            onPauseClick: m,
            onResumeClick: d,
            showPauseButton: !1,
            isPaused: !1,
            hasProgressControls: !0
          }
        ) });
      case "PAUSED":
        return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
          u,
          {
            message: n,
            progress: a,
            onStopDownloadClick: c,
            onPauseClick: m,
            onResumeClick: d,
            isPaused: !0
          }
        ) });
      case "NEEDS_UPDATE":
        return /* @__PURE__ */ e.jsx(
          l,
          {
            ...o,
            onActionClick: b,
            icon: /* @__PURE__ */ e.jsx(
              X,
              {
                size: "2x",
                fill: "var(--color-neutral-100)",
                icon: Q
              }
            )
          }
        );
      default:
        return null;
    }
  }
  function H() {
    const o = [];
    for (const r of B)
      o.push(
        /* @__PURE__ */ e.jsx("button", { className: "button-sm", onClick: r.onClick, children: r.label }, r.label)
      );
    return o;
  }
  function k() {
    const o = "top", r = { mainAxis: 0 };
    return !F && g !== void 0 ? /* @__PURE__ */ e.jsxs(
      t,
      {
        position: o,
        shadow: "md",
        opened: P,
        offset: r,
        classNames: { dropdown: s.popover },
        unstyled: !0,
        children: [
          /* @__PURE__ */ e.jsx(t.Target, { children: /* @__PURE__ */ e.jsx(
            "button",
            {
              onClick: g,
              className: s.storeActionButton,
              onMouseEnter: E,
              onMouseLeave: T,
              children: /* @__PURE__ */ e.jsx(ee, {})
            }
          ) }),
          /* @__PURE__ */ e.jsx(t.Dropdown, { children: /* @__PURE__ */ e.jsx("div", { className: "caption-sm", children: A || "Add to library" }) })
        ]
      }
    ) : I !== void 0 ? /* @__PURE__ */ e.jsxs(
      t,
      {
        position: o,
        shadow: "md",
        opened: P,
        offset: r,
        classNames: { dropdown: s.popover },
        unstyled: !0,
        children: [
          /* @__PURE__ */ e.jsx(t.Target, { children: /* @__PURE__ */ e.jsx(
            "button",
            {
              onClick: _ ? I : () => {
                console.log("remove button disabled");
              },
              className: q(s.inLibrary),
              onMouseEnter: E,
              onMouseLeave: T,
              children: /* @__PURE__ */ e.jsx(K, {})
            }
          ) }),
          /* @__PURE__ */ e.jsx(t.Dropdown, { children: /* @__PURE__ */ e.jsx("div", { className: "caption-sm", children: S || "Remove from library" }) })
        ]
      }
    ) : null;
  }
  const z = !U && (i === "NOT_INSTALLED" || i === "NOT_SUPPORTED") ? s.grayscaleFilter : "";
  return /* @__PURE__ */ e.jsxs("div", { className: s.root, ...W, children: [
    /* @__PURE__ */ e.jsx("div", { className: s.border }),
    /* @__PURE__ */ e.jsxs("div", { className: `${s.card}`, children: [
      h ? /* @__PURE__ */ e.jsx("div", { className: s.settingsMenu, children: H() }) : null,
      /* @__PURE__ */ e.jsxs("div", { className: s.content, children: [
        /* @__PURE__ */ e.jsx(
          "div",
          {
            className: `${se.proportions} ${z}`,
            children: j || (f ? /* @__PURE__ */ e.jsx("img", { src: f }) : /* @__PURE__ */ e.jsx(
              "img",
              {
                src: J,
                style: { width: "100%", height: "100%" }
              }
            ))
          }
        ),
        /* @__PURE__ */ e.jsx("div", { className: s.bottomContainer, children: p === "client" ? $() : /* @__PURE__ */ e.jsx(
          "div",
          {
            className: `${s.storeTitle} title`,
            "data-testid": "game-title",
            children: x
          }
        ) }),
        /* @__PURE__ */ e.jsx("div", { className: s.storeLogoContainer, children: p === "storeInClient" ? k() : p === "client" && v ? /* @__PURE__ */ e.jsx(oe, { store: v, state: i, i18n: M }) : null })
      ] })
    ] })
  ] });
};
export {
  Ae as default,
  re as i18nDefault
};
//# sourceMappingURL=index.mjs.map
