import e, { useState as m, useEffect as k } from "react";
import { Typography as y } from "./accelbyte-widgets173.mjs";
import { Trans as o } from "react-i18next";
import { UserInfoCard as g } from "./accelbyte-widgets511.mjs";
import { FlatTwitchPrimaryButton as T } from "./accelbyte-widgets585.mjs";
import { ButtonStyle as C } from "./accelbyte-widgets107.mjs";
import { TwitchDropLayout as E } from "./accelbyte-widgets507.mjs";
import { Ctx as L } from "./accelbyte-widgets33.mjs";
import { TwitchCard as M } from "./accelbyte-widgets506.mjs";
import { ClaimModal as R } from "./accelbyte-widgets586.mjs";
import { UnlinkAccountConfirmDialog as P } from "./accelbyte-widgets276.mjs";
import { LinkedPlatformId as b } from "./accelbyte-widgets239.mjs";
import { Alert as I } from "./accelbyte-widgets123.mjs";
import { AlertType as O } from "./accelbyte-widgets128.mjs";
import U from "classnames";
const H = ({
  displayName: c,
  onUnlink: l,
  onClaim: p,
  className: s,
  logo: u,
  configs: a,
  hasDropEntitlements: r,
  isMultipleGame: f
}) => {
  const [d, i] = m(!1), [w, n] = m(!1), t = L.getAppState();
  k(() => {
    r || i(!1);
  }, [r]);
  const h = async () => {
    i(!0);
  };
  return /* @__PURE__ */ e.createElement(
    E,
    {
      backgroundURL: t.linkTwitchManager.getBackgroundURL(a),
      backgroundOverlay: t.linkTwitchManager.getBackgroundOverlay(a),
      logo: u || t.linkTwitchManager.getCompanyLogo(),
      title: "Re-claim Twitch Drops",
      subtitle: "Link your account to Twitch to sync your drops.",
      className: U("reclaimLayout", s)
    },
    /* @__PURE__ */ e.createElement(M, { className: "reclaimPanel", isMultipleGame: f }, !r && /* @__PURE__ */ e.createElement(I, { className: "w-full rounded-none", type: O.info }, /* @__PURE__ */ e.createElement(o, { i18nKey: "LinkTwitchPage.twitchReclaimForm.card.noItem" }, "You have no drop items to claim.")), /* @__PURE__ */ e.createElement(y, { tag: "p" }, /* @__PURE__ */ e.createElement(o, { i18nKey: "LinkTwitchPage.twitchReclaimForm.card.instruction" }, "You have linked your Twitch account. Claim your drops now.")), /* @__PURE__ */ e.createElement(
      g,
      {
        displayName: c,
        bottomCta: /* @__PURE__ */ e.createElement(o, { i18nKey: "LinkTwitchPage.twitchReclaimForm.card.unlink" }, "Not your correct Twitch account?", " ", /* @__PURE__ */ e.createElement(
          "button",
          {
            onClick: () => {
              n(!0);
            }
          },
          "Unlink"
        ))
      }
    ), /* @__PURE__ */ e.createElement(T, { onClick: h, buttonStyle: C.PRIMARY }, /* @__PURE__ */ e.createElement(o, { i18nKey: "LinkTwitchPage.twitchReclaimForm.card.claimButton" }, "Claim Now"))),
    /* @__PURE__ */ e.createElement(
      R,
      {
        visible: d,
        options: t.linkTwitchManager.getGameOptions(a),
        onClaim: p,
        gameData: t.linkTwitchManager.getGamesData(a),
        onCancel: () => i(!1),
        isPreview: !0
      }
    ),
    w && /* @__PURE__ */ e.createElement(
      P,
      {
        platformId: b.Enum.twitch,
        onCancel: () => n(!1),
        onConfirm: l
      }
    )
  );
};
export {
  H as ReclaimPanel
};
