import { jsx as e, jsxs as c, Fragment as d } from "react/jsx-runtime";
import i from "../../features/icons/NoShieldSecondaryIcon.js";
import u from "../../features/icons/ShieldPrimaryIcon.js";
import g from "../../features/icons/ShieldSecondaryIcon.js";
import { Flex as m } from "@chakra-ui/react";
import { useMemo as s } from "react";
import { useTranslation as a } from "react-i18next";
import "../Typography.js";
import { usePasswordStrengthIndicatorContext as l } from "./context.js";
import { L1Bold as f, L2Bold as p } from "../typography.generated.js";
const L = ({ ...n }) => {
  const t = l(), { t: o } = a(), r = s(() => t === null ? null : t < 3 ? {
    bgColor: "surface-danger-default",
    textColor: "text-danger",
    label: o("passwordStrengthIndicator.tooWeak"),
    icon: /* @__PURE__ */ e(i, { w: 4, h: 4 })
  } : t === 3 ? {
    bgColor: "surface-success-default",
    textColor: "text-success",
    label: o("passwordStrengthIndicator.good"),
    icon: /* @__PURE__ */ e(g, { w: 4, h: 4 })
  } : {
    bgColor: "surface-success-default",
    textColor: "text-success",
    label: o("passwordStrengthIndicator.excellent"),
    icon: /* @__PURE__ */ e(u, { w: 4, h: 4 })
  }, [t, o]);
  return r ? /* @__PURE__ */ c(m, { px: 2, py: 1, bg: r.bgColor, color: r.textColor, rounded: "md", width: "fit-content", alignItems: "center", ...n, children: [
    r.icon,
    /* @__PURE__ */ e(f, { ml: 1, children: r.label })
  ] }) : null;
}, k = ({ ...n }) => {
  const t = l(), { t: o } = a(), r = s(() => {
    if (t === null)
      return {
        label: o("passwordStrengthIndicator.passwordMustContainAtLeast8Characters"),
        bgColor: "surface-transparent",
        textColor: "text-secondary"
      };
    if (t < 3)
      return {
        label: o("passwordStrengthIndicator.thisIsAWweakPasswordTryAStrongerOne"),
        bgColor: "surface-danger-default",
        textColor: "text-danger-accessible"
      };
    if (t === 3)
      return {
        label: o("passwordStrengthIndicator.makeYourPasswordStrongerWithAFewMoreCharacters"),
        bgColor: "surface-transparent",
        textColor: "text-secondary"
      };
  }, [t, o]);
  return /* @__PURE__ */ e(d, { children: r && /* @__PURE__ */ e(p, { bg: r.bgColor, color: r.textColor, px: 4, py: 3, rounded: "md", ...n, children: r.label }) });
};
export {
  k as PasswordStrengthIndicatorComment,
  L as PasswordStrengthIndicatorLabel
};
