import { jsxs as t, jsx as e, Fragment as I } from "react/jsx-runtime";
import { useState as s } from "react";
import { useTranslation as H } from "react-i18next";
import { Link as z } from "react-router-dom";
import { Layers as S, Shield as A, Zap as M, Users as R, BarChart3 as U, Home as B, CheckCircle2 as Y, AlertCircle as _, User as C, Mail as O, Lock as K, EyeOff as D, Eye as E, Loader2 as Z } from "lucide-react";
import { T as G, l as b, d as J, N as Q } from "./index-CeEMms9z.js";
const V = [
  { icon: A, titleKey: "features.security", descKey: "features.securityDesc" },
  { icon: M, titleKey: "features.performance", descKey: "features.performanceDesc" },
  { icon: R, titleKey: "features.collaboration", descKey: "features.collaborationDesc" },
  { icon: U, titleKey: "features.analytics", descKey: "features.analyticsDesc" }
];
function ae() {
  const { t: r } = H("auth"), [o, p] = s(""), [c, x] = s(""), [d, f] = s(""), [m, v] = s(""), [u, y] = s(""), [h, F] = s(!1), [g, j] = s(!1), [i, w] = s(!1), [N, n] = s(null), [P, k] = s(null), L = () => !o || !c || !d || !m || !u ? (n(r("registerPage.allFieldsRequired")), !1) : c !== d ? (n(r("registerPage.passwordMismatch")), !1) : c.length < 8 ? (n(r("registerPage.passwordTooShort")), !1) : !0, T = async (a) => {
    if (a.preventDefault(), n(null), k(null), !!L()) {
      w(!0);
      try {
        b.logEvent("register_attempt", "auth", { email: o });
        const l = await J.register({
          email: o,
          password: c,
          firstName: m,
          lastName: u
        });
        b.logEvent("register_success", "auth", { email: o }), k(l.message), p(""), x(""), f(""), v(""), y("");
      } catch (l) {
        if (l instanceof Q)
          n(l.message);
        else {
          const q = l instanceof Error ? l.message : "Une erreur inattendue est survenue";
          n(q);
        }
        b.logError(
          l instanceof Error ? l : new Error(String(l)),
          "RegisterPage.handleSubmit",
          { email: o }
        );
      } finally {
        w(!1);
      }
    }
  };
  return /* @__PURE__ */ t("div", { className: "min-h-screen flex", children: [
    /* @__PURE__ */ t("div", { className: "hidden lg:flex lg:w-1/2 xl:w-[55%] relative overflow-hidden", children: [
      /* @__PURE__ */ e("div", { className: "absolute inset-0 animated-gradient" }),
      /* @__PURE__ */ e(
        "div",
        {
          className: "absolute inset-0 opacity-10",
          style: {
            backgroundImage: "radial-gradient(circle at 1px 1px, white 1px, transparent 0)",
            backgroundSize: "40px 40px"
          }
        }
      ),
      /* @__PURE__ */ e("div", { className: "absolute top-20 left-20 w-72 h-72 bg-white/10 rounded-full blur-3xl animate-pulse" }),
      /* @__PURE__ */ e("div", { className: "absolute bottom-20 right-20 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse", style: { animationDelay: "1s" } }),
      /* @__PURE__ */ e("div", { className: "absolute top-1/2 left-1/3 w-64 h-64 bg-white/5 rounded-full blur-2xl animate-pulse", style: { animationDelay: "2s" } }),
      /* @__PURE__ */ t("div", { className: "relative z-10 flex flex-col justify-between p-12 xl:p-16 text-white w-full", children: [
        /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
          /* @__PURE__ */ e("div", { className: "w-12 h-12 bg-white/20 backdrop-blur-sm rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e(S, { className: "w-7 h-7 text-white" }) }),
          /* @__PURE__ */ e("span", { className: "text-2xl font-bold", children: "SmartStack" })
        ] }),
        /* @__PURE__ */ t("div", { className: "max-w-lg", children: [
          /* @__PURE__ */ t("h1", { className: "text-4xl xl:text-5xl font-bold leading-tight mb-6", children: [
            r("registerPage.brandTitle"),
            /* @__PURE__ */ e("br", {}),
            /* @__PURE__ */ e("span", { className: "text-white/80", children: r("registerPage.brandSubtitle") })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-xl text-white/80 mb-12", children: r("registerPage.brandDescription") }),
          /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-6", children: V.map((a) => /* @__PURE__ */ t(
            "div",
            {
              className: "bg-white/10 backdrop-blur-sm rounded-2xl p-5 hover:bg-white/15 transition-colors",
              children: [
                /* @__PURE__ */ e(a.icon, { className: "w-8 h-8 mb-3 text-white/90" }),
                /* @__PURE__ */ e("h3", { className: "font-semibold mb-1", children: r(a.titleKey) }),
                /* @__PURE__ */ e("p", { className: "text-sm text-white/70", children: r(a.descKey) })
              ]
            },
            a.titleKey
          )) })
        ] }),
        /* @__PURE__ */ t("p", { className: "text-sm text-white/60", children: [
          "© ",
          (/* @__PURE__ */ new Date()).getFullYear(),
          " SmartStack — ",
          r("login.tagline")
        ] })
      ] })
    ] }),
    /* @__PURE__ */ t("div", { className: "w-full lg:w-1/2 xl:w-[45%] flex flex-col relative bg-[var(--bg-primary)]", children: [
      /* @__PURE__ */ e("div", { className: "lg:hidden absolute inset-0", children: /* @__PURE__ */ t("div", { className: "absolute inset-0 overflow-hidden", children: [
        /* @__PURE__ */ e("div", { className: "absolute -top-40 -right-40 w-96 h-96 rounded-full bg-primary-500/20 blur-3xl animate-pulse" }),
        /* @__PURE__ */ e("div", { className: "absolute -bottom-40 -left-40 w-96 h-96 rounded-full bg-accent-500/20 blur-3xl animate-pulse", style: { animationDelay: "1s" } })
      ] }) }),
      /* @__PURE__ */ t("div", { className: "absolute top-6 right-6 z-10 flex items-center gap-2", children: [
        /* @__PURE__ */ e(
          "a",
          {
            href: "/",
            className: "p-2 rounded-lg bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-colors",
            title: r("login.backToHome"),
            children: /* @__PURE__ */ e(B, { className: "w-5 h-5 text-[var(--text-secondary)]" })
          }
        ),
        /* @__PURE__ */ e(G, {})
      ] }),
      /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center p-6 sm:p-8 lg:p-12", children: /* @__PURE__ */ t("div", { className: "w-full max-w-md relative", children: [
        /* @__PURE__ */ t("div", { className: "lg:hidden flex flex-col items-center mb-8", children: [
          /* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-2xl animated-gradient flex items-center justify-center mb-4 shadow-lg", children: /* @__PURE__ */ e(S, { className: "w-8 h-8 text-white" }) }),
          /* @__PURE__ */ e("h1", { className: "text-2xl font-bold", children: "SmartStack" })
        ] }),
        /* @__PURE__ */ t("div", { className: "hidden lg:block mb-8", children: [
          /* @__PURE__ */ e("h2", { className: "text-3xl font-bold mb-2", children: r("registerPage.pageTitle") }),
          /* @__PURE__ */ e("p", { className: "text-[var(--text-secondary)]", children: r("registerPage.subtitle") })
        ] }),
        P && /* @__PURE__ */ t("div", { className: "mb-6 p-4 rounded-xl border text-sm flex items-start gap-3 bg-[var(--success-bg)] border-[var(--success-border)] text-[var(--success-text)]", children: [
          /* @__PURE__ */ e(Y, { className: "w-5 h-5 flex-shrink-0" }),
          /* @__PURE__ */ t("div", { className: "flex-1", children: [
            /* @__PURE__ */ e("p", { className: "font-medium", children: P }),
            /* @__PURE__ */ e("p", { className: "text-xs mt-1 opacity-80", children: r("registerPage.successMessage") })
          ] })
        ] }),
        N && /* @__PURE__ */ t("div", { className: "mb-6 p-4 rounded-xl border text-sm flex items-start gap-3 bg-[var(--error-bg)] border-[var(--error-border)] text-[var(--error-text)]", children: [
          /* @__PURE__ */ e(_, { className: "w-5 h-5 flex-shrink-0" }),
          /* @__PURE__ */ e("p", { className: "flex-1 font-medium", children: N })
        ] }),
        /* @__PURE__ */ t("form", { onSubmit: T, className: "space-y-5", children: [
          /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ t("div", { children: [
              /* @__PURE__ */ e("label", { htmlFor: "firstName", className: "block text-sm font-medium mb-2", children: r("registerPage.firstName") }),
              /* @__PURE__ */ t("div", { className: "relative", children: [
                /* @__PURE__ */ e(C, { className: "absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]" }),
                /* @__PURE__ */ e(
                  "input",
                  {
                    id: "firstName",
                    type: "text",
                    value: m,
                    onChange: (a) => v(a.target.value),
                    placeholder: r("registerPage.firstNamePlaceholder"),
                    required: !0,
                    autoComplete: "given-name",
                    disabled: i,
                    className: "w-full pl-12 pr-4 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"
                  }
                )
              ] })
            ] }),
            /* @__PURE__ */ t("div", { children: [
              /* @__PURE__ */ e("label", { htmlFor: "lastName", className: "block text-sm font-medium mb-2", children: r("registerPage.lastName") }),
              /* @__PURE__ */ t("div", { className: "relative", children: [
                /* @__PURE__ */ e(C, { className: "absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]" }),
                /* @__PURE__ */ e(
                  "input",
                  {
                    id: "lastName",
                    type: "text",
                    value: u,
                    onChange: (a) => y(a.target.value),
                    placeholder: r("registerPage.lastNamePlaceholder"),
                    required: !0,
                    autoComplete: "family-name",
                    disabled: i,
                    className: "w-full pl-12 pr-4 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"
                  }
                )
              ] })
            ] })
          ] }),
          /* @__PURE__ */ t("div", { children: [
            /* @__PURE__ */ e("label", { htmlFor: "email", className: "block text-sm font-medium mb-2", children: r("registerPage.email") }),
            /* @__PURE__ */ t("div", { className: "relative", children: [
              /* @__PURE__ */ e(O, { className: "absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]" }),
              /* @__PURE__ */ e(
                "input",
                {
                  id: "email",
                  type: "email",
                  value: o,
                  onChange: (a) => p(a.target.value),
                  placeholder: r("registerPage.emailPlaceholder"),
                  required: !0,
                  autoComplete: "email",
                  disabled: i,
                  className: "w-full pl-12 pr-4 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ t("div", { children: [
            /* @__PURE__ */ e("label", { htmlFor: "password", className: "block text-sm font-medium mb-2", children: r("registerPage.password") }),
            /* @__PURE__ */ t("div", { className: "relative", children: [
              /* @__PURE__ */ e(K, { className: "absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]" }),
              /* @__PURE__ */ e(
                "input",
                {
                  id: "password",
                  type: h ? "text" : "password",
                  value: c,
                  onChange: (a) => x(a.target.value),
                  placeholder: r("registerPage.passwordPlaceholder"),
                  required: !0,
                  autoComplete: "new-password",
                  disabled: i,
                  className: "w-full pl-12 pr-12 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"
                }
              ),
              /* @__PURE__ */ e(
                "button",
                {
                  type: "button",
                  onClick: () => F(!h),
                  className: "absolute right-4 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors",
                  tabIndex: -1,
                  children: h ? /* @__PURE__ */ e(D, { className: "w-5 h-5" }) : /* @__PURE__ */ e(E, { className: "w-5 h-5" })
                }
              )
            ] }),
            /* @__PURE__ */ e("p", { className: "mt-1.5 text-xs text-[var(--text-tertiary)]", children: r("registerPage.passwordHint") })
          ] }),
          /* @__PURE__ */ t("div", { children: [
            /* @__PURE__ */ e("label", { htmlFor: "confirmPassword", className: "block text-sm font-medium mb-2", children: r("registerPage.confirmPassword") }),
            /* @__PURE__ */ t("div", { className: "relative", children: [
              /* @__PURE__ */ e(K, { className: "absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]" }),
              /* @__PURE__ */ e(
                "input",
                {
                  id: "confirmPassword",
                  type: g ? "text" : "password",
                  value: d,
                  onChange: (a) => f(a.target.value),
                  placeholder: r("registerPage.passwordPlaceholder"),
                  required: !0,
                  autoComplete: "new-password",
                  disabled: i,
                  className: "w-full pl-12 pr-12 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"
                }
              ),
              /* @__PURE__ */ e(
                "button",
                {
                  type: "button",
                  onClick: () => j(!g),
                  className: "absolute right-4 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors",
                  tabIndex: -1,
                  children: g ? /* @__PURE__ */ e(D, { className: "w-5 h-5" }) : /* @__PURE__ */ e(E, { className: "w-5 h-5" })
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ e(
            "button",
            {
              type: "submit",
              disabled: i,
              className: "w-full py-3.5 px-4 rounded-xl bg-primary-600 hover:bg-primary-700 disabled:bg-primary-600/50 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40 disabled:shadow-none flex items-center justify-center gap-2",
              children: i ? /* @__PURE__ */ t(I, { children: [
                /* @__PURE__ */ e(Z, { className: "w-5 h-5 animate-spin" }),
                r("registerPage.submitting")
              ] }) : r("registerPage.submitButton")
            }
          )
        ] }),
        /* @__PURE__ */ t("p", { className: "text-center text-[var(--text-secondary)] mt-8", children: [
          r("registerPage.alreadyHaveAccount"),
          " ",
          /* @__PURE__ */ e(z, { to: "/login", className: "text-primary-500 hover:text-primary-600 font-semibold transition-colors", children: r("registerPage.signIn") })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "p-6 text-center", children: /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-tertiary)]", children: r("login.copyright", { year: (/* @__PURE__ */ new Date()).getFullYear() }) }) })
    ] })
  ] });
}
export {
  ae as RegisterPage
};
//# sourceMappingURL=RegisterPage-hSrrIQlk.js.map
