import { jsx as e, jsxs as r, Fragment as D } from "react/jsx-runtime";
import { useState as j, useCallback as K, useEffect as H } from "react";
import { useTranslation as E } from "react-i18next";
import { useNavigate as q, useLocation as O, Outlet as W, useOutletContext as L } from "react-router-dom";
import { i as Y, B as U } from "./index-Dh9kUeDn.js";
import { Loader2 as G, Info as J, Server as R, Shield as Q, FileText as B, Mail as P, Cloud as V, Database as z, HardDrive as F, CheckCircle2 as k, CircleSlash as S, Key as X, Clock as Z, Monitor as _, BarChart3 as M, Send as ee, RefreshCw as te } from "lucide-react";
const T = [
  { id: "infrastructure", labelKey: "appsettings.tabs.infrastructure", icon: R, route: "/administration/configuration/appsettings/infrastructure" },
  { id: "authentication", labelKey: "appsettings.tabs.authentication", icon: Q, route: "/administration/configuration/appsettings/authentication" },
  { id: "logging", labelKey: "appsettings.tabs.logging", icon: B, route: "/administration/configuration/appsettings/logging" },
  { id: "email", labelKey: "appsettings.tabs.email", icon: P, route: "/administration/configuration/appsettings/email" },
  { id: "entra", labelKey: "appsettings.tabs.entra", icon: V, route: "/administration/configuration/appsettings/entra" }
];
function de() {
  const { t } = E("admin"), y = q(), l = O(), [g, u] = j([]), [h, v] = j(!0), f = K(async () => {
    try {
      v(!0);
      const d = (await Y.settings.getAll()).filter(
        (o) => o.source === "AppSettings" || o.source === "Environment" || o.source === "Computed"
      );
      u(d);
    } catch (a) {
      console.error("Failed to load settings:", a);
    } finally {
      v(!1);
    }
  }, []);
  H(() => {
    f();
  }, [f]);
  const c = () => {
    const a = l.pathname;
    return T.find((o) => a.includes(o.id))?.id || "infrastructure";
  }, i = (a) => {
    const d = T.find((o) => o.id === a);
    d && y(d.route);
  };
  return h ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e(G, { className: "w-8 h-8 animate-spin text-[var(--color-accent-600)]" }) }) : /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ e(
      U,
      {
        items: [
          { label: t("header.title"), href: "/administration" },
          { label: t("appsettings.title", "Application Settings") }
        ]
      }
    ),
    /* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ r("div", { children: [
      /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-[var(--text-primary)]", children: t("appsettings.title") }),
      /* @__PURE__ */ e("p", { className: "text-[var(--text-secondary)] mt-1", children: t("appsettings.subtitle") })
    ] }) }),
    /* @__PURE__ */ e("div", { className: "bg-[var(--info-bg)] border border-[var(--info-border)] rounded-[var(--radius-card)] p-4", children: /* @__PURE__ */ r("div", { className: "flex items-start gap-3", children: [
      /* @__PURE__ */ e(J, { className: "w-5 h-5 text-[var(--info-text)] flex-shrink-0 mt-0.5" }),
      /* @__PURE__ */ r("div", { children: [
        /* @__PURE__ */ e("h4", { className: "font-medium text-[var(--info-text)]", children: t("appsettings.readonlyBannerTitle") }),
        /* @__PURE__ */ e("p", { className: "text-sm text-[var(--info-text)] opacity-90 mt-1", children: t("appsettings.readonlyBannerDescription") })
      ] })
    ] }) }),
    /* @__PURE__ */ e("div", { className: "border-b border-[var(--border-color)]", children: /* @__PURE__ */ e("nav", { className: "-mb-px flex space-x-8", "aria-label": "Tabs", children: T.map((a) => {
      const d = a.icon, o = c() === a.id;
      return /* @__PURE__ */ r(
        "button",
        {
          onClick: () => i(a.id),
          className: `
                  group inline-flex items-center py-4 px-1 border-b-2 font-medium text-sm transition-colors
                  ${o ? "border-[var(--color-accent-500)] text-[var(--color-accent-600)]" : "border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--border-color)]"}
                `,
          children: [
            /* @__PURE__ */ e(d, { className: `mr-2 h-5 w-5 ${o ? "text-[var(--color-accent-500)]" : "text-[var(--text-tertiary)] group-hover:text-[var(--text-secondary)]"}` }),
            t(a.labelKey)
          ]
        },
        a.id
      );
    }) }) }),
    /* @__PURE__ */ e(W, { context: { settings: g, refreshSettings: f } })
  ] });
}
function ge() {
  const { t } = E("admin"), { settings: y } = L(), l = y.filter((s) => s.category === "Database"), g = y.filter((s) => s.category === "Storage"), u = g.filter((s) => s.key.startsWith("Local") || s.key === "Provider"), h = g.filter((s) => s.key.startsWith("Azure")), v = g.find((s) => s.key === "Provider")?.value, f = l.find((s) => s.key === "Server")?.value, c = l.find((s) => s.key === "DatabaseName")?.value, i = v === "Azure", a = v === "Local" || v === "FileSystem", d = (s) => {
    const n = `${s.category}.${s.key}`, p = () => {
      if (s.isSensitive) return "********";
      const m = s.displayValue || s.value;
      return s.valueType === "Bool" ? t(m === "true" || m === "Yes" ? "common.yes" : "common.no") : m;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.${s.category}.${s.key}`, s.key) }),
            s.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.${s.category}.${s.key}`, s.description) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${s.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: p() }) })
        ]
      },
      n
    );
  }, o = (s, n, p, m, x, b, N = "neutral", w) => {
    const $ = m;
    if (p.length === 0) return null;
    const A = N === "inactive", I = N === "active";
    let C = "border-[var(--border-color)]";
    return I ? C = "border-green-500/50 ring-1 ring-green-500/20" : A && (C = "border-gray-400/30"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${C} bg-[var(--bg-card)] overflow-hidden shadow-sm ${A ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${x} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${b}`, children: /* @__PURE__ */ e($, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: s }),
            I && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-green-500/20 text-green-700 dark:text-green-400 border border-green-500/30", children: [
              /* @__PURE__ */ e(k, { className: "w-3 h-3" }),
              t("appsettings.active", "Actif")
            ] }),
            A && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-gray-500/20 text-gray-600 dark:text-gray-400 border border-gray-500/30", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.notUsed", "Non utilisé")
            ] }),
            w && /* @__PURE__ */ r("span", { className: "text-xs text-[var(--text-secondary)] ml-1", children: [
              "(",
              w,
              ")"
            ] })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: n })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: p.map(d) })
    ] });
  };
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: [
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.sections.database", "Database") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(z, { className: "w-5 h-5 text-cyan-500" }),
          c || "N/A"
        ] }),
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] mt-1", children: f })
      ] }),
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Storage.Provider", "Storage Provider") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          i ? /* @__PURE__ */ e(V, { className: "w-5 h-5 text-sky-500" }) : /* @__PURE__ */ e(F, { className: "w-5 h-5 text-blue-500" }),
          v || "N/A"
        ] })
      ] })
    ] }),
    o(
      t("appsettings.sections.database", "Database"),
      t("appsettings.sections.databaseDescription", "SQL Server database configuration"),
      l,
      z,
      "from-cyan-500/10 to-cyan-600/5",
      "bg-cyan-500/20 text-cyan-600",
      "active"
    ),
    o(
      t("appsettings.sections.localStorage", "Local Storage"),
      t("appsettings.sections.localStorageDescription", "File system storage configuration"),
      u.filter((s) => s.key !== "Provider"),
      F,
      a ? "from-green-500/10 to-green-600/5" : "from-gray-500/10 to-gray-600/5",
      a ? "bg-green-500/20 text-green-600" : "bg-gray-500/20 text-gray-500",
      a ? "active" : "inactive",
      a ? v : void 0
    ),
    o(
      t("appsettings.sections.azureStorage", "Azure Blob Storage"),
      t("appsettings.sections.azureStorageDescription", "Cloud storage configuration"),
      h,
      V,
      i ? "from-green-500/10 to-green-600/5" : "from-gray-500/10 to-gray-600/5",
      i ? "bg-green-500/20 text-green-600" : "bg-gray-500/20 text-gray-500",
      i ? "active" : "inactive",
      i ? "Azure" : void 0
    ),
    l.length === 0 && g.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
const re = () => /* @__PURE__ */ e("svg", { className: "w-5 h-5", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M11.4 24H0V12.6h11.4V24zM24 24H12.6V12.6H24V24zM11.4 11.4H0V0h11.4v11.4zm12.6 0H12.6V0H24v11.4z" }) }), ae = () => /* @__PURE__ */ r("svg", { className: "w-5 h-5", viewBox: "0 0 24 24", fill: "currentColor", children: [
  /* @__PURE__ */ e("path", { d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" }),
  /* @__PURE__ */ e("path", { d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" }),
  /* @__PURE__ */ e("path", { d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" }),
  /* @__PURE__ */ e("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" })
] });
function me() {
  const { t } = E("admin"), { settings: y } = L(), l = y.filter((a) => a.category === "Authentication"), g = y.filter((a) => a.category === "Session"), u = l.filter(
    (a) => a.key.startsWith("Jwt") || a.key.includes("Token")
  ), h = l.find((a) => a.key === "MicrosoftOAuth")?.value === "true", v = l.find((a) => a.key === "GoogleOAuth")?.value === "true", f = (a) => {
    const d = `${a.category}.${a.key}`, o = () => {
      if (a.isSensitive) return "********";
      const s = a.displayValue || a.value;
      return a.valueType === "Bool" ? t(s === "true" || s === "Yes" ? "common.yes" : "common.no") : s;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.Authentication.${a.key}`, { defaultValue: a.key }) }),
            a.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.Authentication.${a.key}`, { defaultValue: a.description }) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${a.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: o() }) })
        ]
      },
      d
    );
  }, c = (a, d, o, s, n, p, m = "neutral", x) => {
    const b = s;
    if (o.length === 0) return null;
    const N = m === "inactive", w = m === "active";
    let $ = "border-[var(--border-color)]";
    return w ? $ = "border-green-500/50 ring-1 ring-green-500/20" : N && ($ = "border-gray-400/30"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${$} bg-[var(--bg-card)] overflow-hidden shadow-sm ${N ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${n} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${p}`, children: /* @__PURE__ */ e(b, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: a }),
            w && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-green-500/20 text-green-700 dark:text-green-400 border border-green-500/30", children: [
              /* @__PURE__ */ e(k, { className: "w-3 h-3" }),
              t("appsettings.configured", "Configuré")
            ] }),
            N && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-gray-500/20 text-gray-600 dark:text-gray-400 border border-gray-500/30", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.notConfigured", "Non configuré")
            ] }),
            x
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: d })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: o.map(f) })
    ] });
  }, i = (a, d, o, s) => /* @__PURE__ */ e("div", { className: `rounded-lg border ${d ? "border-green-500/50 ring-1 ring-green-500/20" : "border-gray-400/30 opacity-50"} bg-[var(--bg-card)] p-4`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
    /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${s}`, children: /* @__PURE__ */ e(o, {}) }),
    /* @__PURE__ */ r("div", { className: "flex-1", children: [
      /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ e("span", { className: "font-semibold text-[var(--text-primary)]", children: a }),
        d ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-green-500/20 text-green-700 dark:text-green-400 border border-green-500/30", children: [
          /* @__PURE__ */ e(k, { className: "w-3 h-3" }),
          t("appsettings.configured", "Configuré")
        ] }) : /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-gray-500/20 text-gray-600 dark:text-gray-400 border border-gray-500/30", children: [
          /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
          t("appsettings.notConfigured", "Non configuré")
        ] })
      ] }),
      /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: d ? t("appsettings.oauthConfiguredDesc", "OAuth authentication is enabled") : t("appsettings.oauthNotConfiguredDesc", "ClientId not configured in appsettings.json") })
    ] })
  ] }) });
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { children: [
      /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)] mb-4", children: t("appsettings.sections.oauthProviders", "OAuth Providers") }),
      /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
        i("Microsoft", h, re, "bg-blue-500/20 text-blue-600"),
        i("Google", v, ae, "bg-red-500/20 text-red-600")
      ] })
    ] }),
    c(
      t("appsettings.sections.jwt", "JWT Configuration"),
      t("appsettings.sections.jwtDescription", "JSON Web Token settings for authentication"),
      u,
      X,
      "from-violet-500/10 to-violet-600/5",
      "bg-violet-500/20 text-violet-600",
      "active"
    ),
    c(
      t("appsettings.sections.session", "Session"),
      t("appsettings.sections.sessionDescription", "User session timeout and validation settings"),
      g,
      Z,
      "from-amber-500/10 to-amber-600/5",
      "bg-amber-500/20 text-amber-600",
      "active"
    ),
    l.length === 0 && g.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
function pe() {
  const { t } = E("admin"), { settings: y } = L(), l = y.filter((n) => n.category === "Logging"), g = l.filter(
    (n) => n.key.includes("File") || n.key.includes("Rolling") || n.key.includes("Retention")
  ), u = l.filter((n) => n.key.includes("Seq")), h = l.filter((n) => n.key.includes("AppInsights")), v = l.filter((n) => n.key.includes("Level") || n.key.includes("Minimum")), f = l.find((n) => n.key === "ConsoleEnabled")?.value === "true", c = l.find((n) => n.key === "FileEnabled")?.value === "true", i = l.find((n) => n.key === "SeqEnabled")?.value === "true", a = l.find((n) => n.key === "AppInsightsEnabled")?.value === "true", d = (n) => {
    const p = `${n.category}.${n.key}`, m = () => {
      if (n.isSensitive) return "********";
      const x = n.displayValue || n.value;
      return n.valueType === "Bool" ? t(x === "true" || x === "Yes" ? "common.yes" : "common.no") : x;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.Logging.${n.key}`, n.key) }),
            n.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.Logging.${n.key}`, n.description) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${n.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: m() }) })
        ]
      },
      p
    );
  }, o = (n, p, m, x, b, N, w = "neutral") => {
    const $ = x;
    if (m.length === 0) return null;
    const A = w === "inactive", I = w === "active";
    let C = "border-[var(--border-color)]";
    return I ? C = "border-green-500/50 ring-1 ring-green-500/20" : A && (C = "border-gray-400/30"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${C} bg-[var(--bg-card)] overflow-hidden shadow-sm ${A ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${b} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${N}`, children: /* @__PURE__ */ e($, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: n }),
            I && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-green-500/20 text-green-700 dark:text-green-400 border border-green-500/30", children: [
              /* @__PURE__ */ e(k, { className: "w-3 h-3" }),
              t("appsettings.enabled", "Activé")
            ] }),
            A && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-gray-500/20 text-gray-600 dark:text-gray-400 border border-gray-500/30", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.disabled", "Désactivé")
            ] })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: p })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: m.map(d) })
    ] });
  }, s = (n, p, m, x) => {
    const b = m;
    return /* @__PURE__ */ e("div", { className: `rounded-lg border ${p ? "border-green-500/50" : "border-gray-400/30 opacity-50"} bg-[var(--bg-card)] p-4`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
      /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${x}`, children: /* @__PURE__ */ e(b, { className: "w-5 h-5" }) }),
      /* @__PURE__ */ r("div", { className: "flex-1", children: [
        /* @__PURE__ */ e("span", { className: "font-semibold text-[var(--text-primary)]", children: n }),
        p ? /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-green-500/20 text-green-700 dark:text-green-400", children: [
          /* @__PURE__ */ e(k, { className: "w-3 h-3" }),
          t("appsettings.enabled", "Activé")
        ] }) : /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-gray-500/20 text-gray-600 dark:text-gray-400", children: [
          /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
          t("appsettings.disabled", "Désactivé")
        ] })
      ] })
    ] }) });
  };
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { children: [
      /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)] mb-4", children: t("appsettings.sections.loggingSinks", "Logging Sinks") }),
      /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
        s("Console", f, _, "bg-gray-500/20 text-gray-600"),
        s("File", c, B, "bg-violet-500/20 text-violet-600"),
        s("Seq", i, z, "bg-blue-500/20 text-blue-600"),
        s("App Insights", a, M, "bg-purple-500/20 text-purple-600")
      ] })
    ] }),
    o(
      t("appsettings.sections.logLevels", "Log Levels"),
      t("appsettings.sections.logLevelsDescription", "Minimum log level configuration"),
      v,
      M,
      "from-emerald-500/10 to-emerald-600/5",
      "bg-emerald-500/20 text-emerald-600",
      "neutral"
    ),
    o(
      t("appsettings.sections.fileLogging", "File Logging"),
      t("appsettings.sections.fileLoggingDescription", "File-based log output configuration"),
      g,
      B,
      c ? "from-violet-500/10 to-violet-600/5" : "from-gray-500/10 to-gray-600/5",
      c ? "bg-violet-500/20 text-violet-600" : "bg-gray-500/20 text-gray-500",
      c ? "active" : "inactive"
    ),
    u.length > 0 && o(
      t("appsettings.sections.seqLogging", "Seq"),
      t("appsettings.sections.seqLoggingDescription", "Seq structured logging server"),
      u,
      z,
      i ? "from-blue-500/10 to-blue-600/5" : "from-gray-500/10 to-gray-600/5",
      i ? "bg-blue-500/20 text-blue-600" : "bg-gray-500/20 text-gray-500",
      i ? "active" : "inactive"
    ),
    h.length > 0 && o(
      t("appsettings.sections.appInsights", "Application Insights"),
      t("appsettings.sections.appInsightsDescription", "Azure Application Insights telemetry"),
      h,
      M,
      a ? "from-purple-500/10 to-purple-600/5" : "from-gray-500/10 to-gray-600/5",
      a ? "bg-purple-500/20 text-purple-600" : "bg-gray-500/20 text-gray-500",
      a ? "active" : "inactive"
    ),
    l.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
function xe() {
  const { t } = E("admin"), { settings: y } = L(), l = y.filter((c) => c.category === "Email"), g = l.find((c) => c.key === "Enabled")?.value === "true", u = l.find((c) => c.key === "Provider")?.value, h = l.find((c) => c.key === "FromEmail")?.value, v = (c) => {
    const i = `${c.category}.${c.key}`, a = () => {
      if (c.isSensitive) return "********";
      const d = c.displayValue || c.value;
      return c.valueType === "Bool" ? t(d === "true" || d === "Yes" ? "common.yes" : "common.no") : d;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.Email.${c.key}`, c.key) }),
            c.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.Email.${c.key}`, c.description) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${c.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: a() }) })
        ]
      },
      i
    );
  }, f = (c, i, a, d, o, s, n = "neutral") => {
    const p = d;
    if (a.length === 0) return null;
    const m = n === "inactive", x = n === "active";
    let b = "border-[var(--border-color)]";
    return x ? b = "border-green-500/50 ring-1 ring-green-500/20" : m && (b = "border-gray-400/30"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${b} bg-[var(--bg-card)] overflow-hidden shadow-sm ${m ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${o} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${s}`, children: /* @__PURE__ */ e(p, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: c }),
            x && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-green-500/20 text-green-700 dark:text-green-400 border border-green-500/30", children: [
              /* @__PURE__ */ e(k, { className: "w-3 h-3" }),
              t("appsettings.enabled", "Activé")
            ] }),
            m && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-gray-500/20 text-gray-600 dark:text-gray-400 border border-gray-500/30", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.disabled", "Désactivé")
            ] })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: i })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: a.map(v) })
    ] });
  };
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
      /* @__PURE__ */ r("div", { className: `rounded-lg border ${g ? "border-green-500/50" : "border-gray-400/30 opacity-50"} bg-[var(--bg-card)] p-4`, children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.status", "Status") }),
        /* @__PURE__ */ e("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: g ? /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(k, { className: "w-5 h-5 text-green-500" }),
          t("appsettings.enabled", "Activé")
        ] }) : /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(S, { className: "w-5 h-5 text-gray-500" }),
          t("appsettings.disabled", "Désactivé")
        ] }) })
      ] }),
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Email.Provider", "Provider") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(ee, { className: "w-5 h-5 text-amber-500" }),
          u || "N/A"
        ] })
      ] }),
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Email.FromEmail", "From Email") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(P, { className: "w-5 h-5 text-amber-500" }),
          /* @__PURE__ */ e("span", { className: "truncate", children: h || "N/A" })
        ] })
      ] })
    ] }),
    f(
      t("appsettings.sections.emailConfiguration", "Email Configuration"),
      t("appsettings.sections.emailConfigurationDescription", "SMTP and email provider settings"),
      l,
      P,
      g ? "from-amber-500/10 to-amber-600/5" : "from-gray-500/10 to-gray-600/5",
      g ? "bg-amber-500/20 text-amber-600" : "bg-gray-500/20 text-gray-500",
      g ? "active" : "inactive"
    ),
    l.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
function ve() {
  const { t } = E("admin"), { settings: y } = L(), l = y.filter((i) => i.category === "Entra"), g = l.find((i) => i.key === "SyncEnabled")?.value === "true", u = l.find((i) => i.key === "Configured")?.value === "true", h = l.find((i) => i.key === "SyncIntervalMinutes")?.value, v = l.find((i) => i.key === "UseDeltaSync")?.value === "true", f = (i) => {
    const a = `${i.category}.${i.key}`, d = () => {
      if (i.isSensitive) return "********";
      const o = i.displayValue || i.value;
      return i.valueType === "Bool" ? t(o === "true" || o === "Yes" ? "common.yes" : "common.no") : o;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.Entra.${i.key}`, i.key) }),
            i.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.Entra.${i.key}`, i.description) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${i.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: d() }) })
        ]
      },
      a
    );
  }, c = (i, a, d, o, s, n, p = "neutral") => {
    const m = o;
    if (d.length === 0) return null;
    const x = p === "inactive", b = p === "active";
    let N = "border-[var(--border-color)]";
    return b ? N = "border-green-500/50 ring-1 ring-green-500/20" : x && (N = "border-gray-400/30"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${N} bg-[var(--bg-card)] overflow-hidden shadow-sm ${x ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${s} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${n}`, children: /* @__PURE__ */ e(m, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: i }),
            b && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-green-500/20 text-green-700 dark:text-green-400 border border-green-500/30", children: [
              /* @__PURE__ */ e(k, { className: "w-3 h-3" }),
              t("appsettings.enabled", "Activé")
            ] }),
            x && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-gray-500/20 text-gray-600 dark:text-gray-400 border border-gray-500/30", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.disabled", "Désactivé")
            ] })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: a })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: d.map(f) })
    ] });
  };
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-4 gap-4", children: [
      /* @__PURE__ */ r("div", { className: `rounded-lg border ${u ? "border-green-500/50" : "border-gray-400/30 opacity-50"} bg-[var(--bg-card)] p-4`, children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.configuration", "Configuration") }),
        /* @__PURE__ */ e("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: u ? /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(k, { className: "w-5 h-5 text-green-500" }),
          t("appsettings.configured", "Configuré")
        ] }) : /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(S, { className: "w-5 h-5 text-gray-500" }),
          t("appsettings.notConfigured", "Non configuré")
        ] }) })
      ] }),
      /* @__PURE__ */ r("div", { className: `rounded-lg border ${g ? "border-green-500/50" : "border-gray-400/30 opacity-50"} bg-[var(--bg-card)] p-4`, children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Entra.SyncEnabled", "Sync Status") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(te, { className: `w-5 h-5 ${g ? "text-green-500" : "text-gray-500"}` }),
          g ? t("appsettings.enabled", "Activé") : t("appsettings.disabled", "Désactivé")
        ] })
      ] }),
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Entra.SyncIntervalMinutes", "Sync Interval") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(V, { className: "w-5 h-5 text-sky-500" }),
          h ? `${h} min` : "N/A"
        ] })
      ] }),
      /* @__PURE__ */ r("div", { className: `rounded-lg border ${v ? "border-green-500/50" : "border-[var(--border-color)]"} bg-[var(--bg-card)] p-4`, children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Entra.UseDeltaSync", "Delta Sync") }),
        /* @__PURE__ */ e("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: v ? /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(k, { className: "w-5 h-5 text-green-500" }),
          t("common.yes", "Oui")
        ] }) : /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(S, { className: "w-5 h-5 text-gray-500" }),
          t("common.no", "Non")
        ] }) })
      ] })
    ] }),
    c(
      t("appsettings.sections.entraConfiguration", "Microsoft Entra ID"),
      t("appsettings.sections.entraConfigurationDescription", "Azure AD synchronization settings"),
      l,
      V,
      u ? "from-sky-500/10 to-sky-600/5" : "from-gray-500/10 to-gray-600/5",
      u ? "bg-sky-500/20 text-sky-600" : "bg-gray-500/20 text-gray-500",
      u ? "active" : "inactive"
    ),
    l.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
export {
  de as AppSettingsPage,
  me as AuthenticationSection,
  xe as EmailSection,
  ve as EntraSection,
  ge as InfrastructureSection,
  pe as LoggingSection
};
//# sourceMappingURL=index-DPwJ4VkK.js.map
