import { jsx as t, jsxs as s, Fragment as O } from "react/jsx-runtime";
import { useState as I, useEffect as G, useCallback as V } from "react";
import { useTranslation as W } from "react-i18next";
import { useSearchParams as Z } from "react-router-dom";
import { a3 as _, a4 as z, P as H, K as X, a5 as q, a6 as J, o as Q } from "./index-CeEMms9z.js";
import { Loader2 as E, AlertTriangle as T, Zap as ee, Users as K, Building as te, Calendar as ae, Server as se, Monitor as re, Layers as ie, ShieldCheck as ne, Key as j, Shield as le, CheckCircle as M, Infinity as ce, Clock as oe, X as F, Unlock as de, Lock as me } from "lucide-react";
function ue(e, a) {
  switch (e) {
    case "green":
      return 5;
    case "yellow":
      return 2;
    case "red":
      return 1;
    case "neutral":
      return "neutral";
    case "blue":
      return a;
  }
}
function pe(e) {
  return e.status === "NoLicense" || e.isReadOnlyMode ? "red" : e.isInGracePeriod || e.isInTrial && e.trialDaysRemaining <= 7 || e.status === "Active" && e.daysUntilExpiration <= 30 ? "yellow" : e.status === "Active" ? "green" : "red";
}
function xe(e) {
  if (e.isPerpetual) return "green";
  const a = e.isInTrial ? e.trialDaysRemaining : e.daysUntilExpiration;
  return a <= 15 ? "red" : a <= 30 ? "yellow" : "green";
}
function R(e) {
  return e ? new Date(e).toLocaleDateString(void 0, {
    year: "numeric",
    month: "long",
    day: "numeric"
  }) : "-";
}
function he(e, a) {
  const r = pe(e), i = e.isInTrial ? e.trialDaysRemaining : e.daysUntilExpiration, n = xe(e);
  return [
    {
      label: a("license.info.edition", "Edition"),
      value: a(`license.edition.${e.edition.toLowerCase()}`, e.edition),
      icon: le,
      color: "blue"
    },
    {
      label: a("license.info.status", "Status"),
      value: e.isInGracePeriod ? a("license.page.gracePeriod", "Grace Period") : a(`license.status.${e.status.toLowerCase()}`, e.status),
      icon: e.isReadOnlyMode ? T : M,
      color: r
    },
    {
      label: a("license.page.daysRemaining", "Days remaining"),
      value: e.isPerpetual ? "∞" : i.toString(),
      icon: e.isPerpetual ? ce : oe,
      color: n
    },
    {
      label: a("license.page.maxUsers", "Max Users"),
      value: e.limits.users > 0 ? e.limits.users.toString() : a("license.page.unlimited", "Unlimited"),
      icon: K,
      color: "blue"
    }
  ];
}
function ge({
  showTrialSuccess: e,
  isInGracePeriod: a,
  validationResult: r,
  gracePeriodDays: i,
  onTrialSuccessClose: n,
  onValidationResultClear: l,
  t: o
}) {
  return /* @__PURE__ */ s(O, { children: [
    e && /* @__PURE__ */ s("div", { className: "flex items-center gap-3 p-4 bg-[var(--success-bg)] border border-[var(--success-border)] rounded-lg animate-in fade-in slide-in-from-top", children: [
      /* @__PURE__ */ t(M, { className: "w-5 h-5 text-[var(--success-text)] flex-shrink-0" }),
      /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t("p", { className: "text-sm font-medium text-[var(--success-text)]", children: o("license.trial.successBanner", "Your 30-day trial is activated!") }) }),
      /* @__PURE__ */ t(
        "button",
        {
          onClick: n,
          className: "text-[var(--success-text)] hover:opacity-80",
          children: /* @__PURE__ */ t(F, { className: "w-4 h-4" })
        }
      )
    ] }),
    a && /* @__PURE__ */ s("div", { className: "flex items-center gap-3 p-4 bg-[var(--warning-bg)] border border-[var(--warning-border)] rounded-lg", children: [
      /* @__PURE__ */ t(T, { className: "w-5 h-5 text-[var(--warning-text)] flex-shrink-0" }),
      /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t("p", { className: "text-sm font-medium text-[var(--warning-text)]", children: o("license.page.gracePeriodBanner", "Your license has expired. You are in a {{days}}-day grace period. Renew to avoid service interruption.", { days: i }) }) })
    ] }),
    r && /* @__PURE__ */ s("div", { className: `flex items-center gap-3 p-4 rounded-lg border ${r.type === "success" ? "bg-[var(--success-bg)] border-[var(--success-border)]" : r.type === "revoked" ? "bg-[var(--error-bg)] border-[var(--error-border)]" : "bg-[var(--warning-bg)] border-[var(--warning-border)]"}`, children: [
      r.type === "success" ? /* @__PURE__ */ t(M, { className: "w-5 h-5 text-[var(--success-text)] flex-shrink-0" }) : /* @__PURE__ */ t(T, { className: `w-5 h-5 flex-shrink-0 ${r.type === "revoked" ? "text-[var(--error-text)]" : "text-[var(--warning-text)]"}` }),
      /* @__PURE__ */ t("p", { className: `text-sm font-medium flex-1 ${r.type === "success" ? "text-[var(--success-text)]" : r.type === "revoked" ? "text-[var(--error-text)]" : "text-[var(--warning-text)]"}`, children: r.message }),
      /* @__PURE__ */ t(
        "button",
        {
          onClick: l,
          className: r.type === "success" ? "text-[var(--success-text)] hover:opacity-80" : r.type === "revoked" ? "text-[var(--error-text)] hover:opacity-80" : "text-[var(--warning-text)] hover:opacity-80",
          children: /* @__PURE__ */ t(F, { className: "w-4 h-4" })
        }
      )
    ] })
  ] });
}
function ve({ hasAllFeatures: e, enabledFeatures: a, availableFeatures: r, t: i }) {
  return !r || r.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[var(--text-secondary)] text-sm italic", children: i("license.page.noFeatures", "No features enabled") }) : /* @__PURE__ */ s(O, { children: [
    e && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 p-3 mb-4 bg-[var(--success-bg)] text-[var(--success-text)] rounded-lg border border-[var(--success-border)]", children: [
      /* @__PURE__ */ t(M, { className: "w-5 h-5" }),
      /* @__PURE__ */ t("span", { className: "font-medium", children: i("license.page.allFeatures", "All features enabled") })
    ] }),
    /* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6", children: r.map(({ group: n, features: l }) => /* @__PURE__ */ s("div", { children: [
      /* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-[var(--text-secondary)] uppercase tracking-wider mb-3", children: i(`license.group.${n}`, n) }),
      /* @__PURE__ */ t("div", { className: "space-y-2", children: l.map((o) => {
        const u = e || a.some(
          (c) => c.toLowerCase() === o.toLowerCase()
        );
        return /* @__PURE__ */ s(
          "div",
          {
            className: `flex items-center gap-2 px-3 py-2 rounded-lg border ${u ? "bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]" : "bg-[var(--bg-secondary)] text-[var(--text-secondary)] border-[var(--border-color)] opacity-60"}`,
            children: [
              u ? /* @__PURE__ */ t(de, { className: "w-4 h-4 flex-shrink-0" }) : /* @__PURE__ */ t(me, { className: "w-4 h-4 flex-shrink-0" }),
              /* @__PURE__ */ t("span", { className: "text-sm font-medium", children: i(`license.module.${o}`, o) })
            ]
          },
          o
        );
      }) })
    ] }, n)) }),
    !e && a.length === 0 && /* @__PURE__ */ t("p", { className: "text-[var(--text-secondary)] text-sm italic mt-3", children: i("license.page.noFeatures", "No features enabled") })
  ] });
}
function be(e, a) {
  const [r, i] = I(!1), [n, l] = I(null), o = V(async () => {
    i(!0), l(null);
    try {
      const c = await Q.post(
        "/api/administration/license/validate-server"
      );
      c.revoked ? (l({ type: "revoked", message: a("license.validationRevoked", "The license has been revoked by the server.") }), await e()) : c.valid ? (l({ type: "success", message: a("license.validationSuccess", "License is valid") }), await e()) : l({ type: "error", message: c.error || a("license.validationError", "Unable to validate the license with the server.") });
    } catch {
      l({ type: "error", message: a("license.validationError", "Unable to validate the license with the server.") });
    } finally {
      i(!1), setTimeout(() => l(null), 5e3);
    }
  }, [a, e]), u = V(() => l(null), []);
  return { isValidating: r, validationResult: n, handleValidate: o, clearValidationResult: u };
}
function Se() {
  const { t: e } = W("admin"), { license: a, usage: r, isLoading: i, error: n, refreshLicense: l, isHalted: o, haltReason: u } = _(), [c, d] = I(!1), [m, h] = Z(), [k, f] = I(!1), { isValidating: p, validationResult: D, handleValidate: S, clearValidationResult: P } = be(l, e);
  if (G(() => {
    l();
  }, [l]), G(() => {
    if (m.get("trial") === "success") {
      f(!0);
      const g = setTimeout(() => {
        f(!1), m.delete("trial"), h(m, { replace: !0 });
      }, 5e3);
      return () => clearTimeout(g);
    }
  }, [m, h]), i)
    return /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ t(E, { className: "w-8 h-8 animate-spin text-[var(--text-secondary)]" }) });
  if (n || !a)
    return /* @__PURE__ */ t("div", { className: "p-6", children: /* @__PURE__ */ s("div", { className: "card p-6 text-center", children: [
      /* @__PURE__ */ t(T, { className: "w-12 h-12 mx-auto mb-4 text-[var(--warning-text)]" }),
      /* @__PURE__ */ t("h2", { className: "text-lg font-semibold mb-2", children: e("license.page.errorTitle", "Unable to load license") }),
      /* @__PURE__ */ t("p", { className: "text-[var(--text-secondary)] mb-4", children: n || e("license.page.errorDesc", "License information is not available.") }),
      /* @__PURE__ */ t(
        "button",
        {
          onClick: () => l(),
          className: "btn-primary px-4 py-2",
          children: e("common.retry", "Retry")
        }
      )
    ] }) });
  const C = z(a.enabledFeatures), $ = he(a, e);
  return /* @__PURE__ */ t(
    H,
    {
      title: e("license.page.title", "License Management"),
      subtitle: e("license.page.subtitle", "View and manage your platform license"),
      icon: /* @__PURE__ */ t(j, { className: "w-6 h-6" }),
      breadcrumbs: [
        { label: e("header.title"), href: "/administration" },
        { label: e("license.page.title", "License Management") }
      ],
      actions: /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ t(J, { showDetails: !0 }),
        /* @__PURE__ */ s(
          "button",
          {
            onClick: S,
            disabled: p,
            className: "btn-secondary px-4 py-2 flex items-center gap-2",
            children: [
              p ? /* @__PURE__ */ t(E, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ t(ne, { className: "w-4 h-4" }),
              p ? e("license.validating", "Validating...") : e("license.validate", "Validate")
            ]
          }
        ),
        /* @__PURE__ */ s(
          "button",
          {
            onClick: () => d(!0),
            className: "btn-primary px-4 py-2 flex items-center gap-2",
            children: [
              /* @__PURE__ */ t(j, { className: "w-4 h-4" }),
              e("license.activate", "Activate")
            ]
          }
        )
      ] }),
      children: /* @__PURE__ */ s("div", { className: "space-y-6", children: [
        o && /* @__PURE__ */ s("div", { className: "flex items-center gap-3 p-4 bg-[var(--error-bg)] border border-[var(--error-border)] rounded-lg", children: [
          /* @__PURE__ */ t(T, { className: "w-5 h-5 text-[var(--error-text)] flex-shrink-0" }),
          /* @__PURE__ */ s("div", { className: "flex-1", children: [
            /* @__PURE__ */ t("p", { className: "text-sm font-medium text-[var(--error-text)]", children: e("license.halted.warning", "Licence suspendue") }),
            u && /* @__PURE__ */ t("p", { className: "text-sm text-[var(--error-text)] opacity-90 mt-1", children: u })
          ] })
        ] }),
        /* @__PURE__ */ t(
          ge,
          {
            showTrialSuccess: k,
            isInGracePeriod: a.isInGracePeriod,
            validationResult: D,
            gracePeriodDays: a.gracePeriodDays,
            onTrialSuccessClose: () => f(!1),
            onValidationResultClear: P,
            t: e
          }
        ),
        /* @__PURE__ */ t("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: $.map((g, y) => {
          const v = g.icon, A = y === 0 ? "primary" : 0;
          return /* @__PURE__ */ t(
            X,
            {
              title: g.label,
              value: g.value,
              icon: /* @__PURE__ */ t(v, { className: "w-5 h-5" }),
              accent: ue(g.color, A)
            },
            g.label
          );
        }) }),
        /* @__PURE__ */ s("div", { className: "card p-6", children: [
          /* @__PURE__ */ s("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
            /* @__PURE__ */ t(ee, { className: "w-5 h-5" }),
            e("license.info.limits", "Limits")
          ] }),
          /* @__PURE__ */ s("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
            /* @__PURE__ */ t(
              B,
              {
                icon: K,
                label: e("license.page.usersLimit", "Users"),
                max: a.limits.users,
                current: r?.activeUsers ?? 0,
                margin: 10,
                t: e
              }
            ),
            /* @__PURE__ */ t(
              B,
              {
                icon: te,
                label: e("license.page.tenantsLimit", "Tenants (B2B)"),
                max: a.limits.tenants,
                current: r?.activeTenants ?? 0,
                margin: 2,
                t: e
              }
            )
          ] }),
          (() => {
            const g = ["users", "tenants", "max_instances", "max_users"], y = Object.entries(a.limits.custom ?? {}).filter(
              ([v]) => !g.includes(v)
            );
            return y.length === 0 ? null : /* @__PURE__ */ s("div", { className: "mt-4 pt-4 border-t border-[var(--border-color)]", children: [
              /* @__PURE__ */ t("h3", { className: "text-sm font-medium text-[var(--text-secondary)] mb-3", children: e("license.page.customLimits", "Custom Limits") }),
              /* @__PURE__ */ t("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-3", children: y.map(([v, A]) => /* @__PURE__ */ s("div", { className: "flex justify-between items-center py-1.5 px-3 bg-[var(--bg-secondary)] rounded-lg", children: [
                /* @__PURE__ */ t("span", { className: "text-sm text-[var(--text-secondary)]", children: v }),
                /* @__PURE__ */ t("span", { className: "text-sm font-medium", children: A })
              ] }, v)) })
            ] });
          })()
        ] }),
        /* @__PURE__ */ s("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
          /* @__PURE__ */ s("div", { className: "card p-6", children: [
            /* @__PURE__ */ s("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
              /* @__PURE__ */ t(ae, { className: "w-5 h-5" }),
              e("license.page.details", "License Details")
            ] }),
            /* @__PURE__ */ s("div", { className: "space-y-3", children: [
              /* @__PURE__ */ t(x, { label: e("license.info.productId", "Product"), value: a.productId }),
              /* @__PURE__ */ t(x, { label: e("license.info.company", "Company"), value: a.companyName || "-" }),
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.info.edition", "Edition"),
                  value: e(`license.edition.${a.edition.toLowerCase()}`, a.edition)
                }
              ),
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.info.status", "Status"),
                  value: e(`license.status.${a.status.toLowerCase()}`, a.status)
                }
              ),
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.info.activatedAt", "Activated At"),
                  value: R(a.activatedAt)
                }
              ),
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.info.expiresAt", "Expires At"),
                  value: a.isPerpetual ? e("license.page.never", "Never (Perpetual)") : R(a.expiresAt)
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ s("div", { className: "card p-6", children: [
            /* @__PURE__ */ s("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
              /* @__PURE__ */ t(se, { className: "w-5 h-5" }),
              e("license.page.subscription", "Subscription")
            ] }),
            /* @__PURE__ */ s("div", { className: "space-y-3", children: [
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.page.licenseType", "License Type"),
                  value: a.isPerpetual ? e("license.page.perpetual", "Perpetual") : a.isInTrial ? e("license.edition.trial", "Trial") : e("license.page.subscription", "Subscription")
                }
              ),
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.page.maxUsers", "Max Users"),
                  value: a.limits.users > 0 ? a.limits.users.toString() : e("license.page.unlimited", "Unlimited")
                }
              ),
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.page.gracePeriodDays", "Grace Period"),
                  value: a.gracePeriodDays > 0 ? e("license.page.gracePeriodValue", "{{days}} days", { days: a.gracePeriodDays }) : e("license.page.noGracePeriod", "None")
                }
              ),
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.page.renewalDate", "Renewal Date"),
                  value: R(a.renewalDate)
                }
              ),
              /* @__PURE__ */ t(
                x,
                {
                  label: e("license.page.mode", "Mode"),
                  value: a.isReadOnlyMode ? e("license.page.readOnly", "Read-only") : a.isInTrial ? e("license.edition.trial", "Trial") : e("license.page.licensed", "Licensed")
                }
              ),
              a.isInGracePeriod && /* @__PURE__ */ t(
                x,
                {
                  label: e("license.page.gracePeriodStatus", "Grace Period Status"),
                  value: e("license.page.inGracePeriod", "Active"),
                  highlight: "yellow"
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ s("div", { className: "card p-6", children: [
            /* @__PURE__ */ s("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
              /* @__PURE__ */ t(re, { className: "w-5 h-5" }),
              e("license.page.machineInfo", "Machine")
            ] }),
            /* @__PURE__ */ s("div", { className: "space-y-3", children: [
              /* @__PURE__ */ s("div", { className: "py-2 border-b border-[var(--border-color)] last:border-b-0", children: [
                /* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-1", children: /* @__PURE__ */ t("span", { className: "text-sm text-[var(--text-secondary)]", children: e("license.page.machineName", "Machine Name") }) }),
                /* @__PURE__ */ t("span", { className: "text-xs font-mono text-[var(--text-primary)] break-all", children: a.machineName || "-" })
              ] }),
              /* @__PURE__ */ s("div", { className: "py-2 border-b border-[var(--border-color)] last:border-b-0", children: [
                /* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-1", children: /* @__PURE__ */ t("span", { className: "text-sm text-[var(--text-secondary)]", children: e("license.page.instanceId", "Instance ID") }) }),
                /* @__PURE__ */ t("span", { className: "text-xs font-mono text-[var(--text-primary)] break-all", children: a.instanceId || "-" })
              ] }),
              /* @__PURE__ */ s("div", { className: "py-2 border-b border-[var(--border-color)] last:border-b-0", children: [
                /* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-1", children: /* @__PURE__ */ t("span", { className: "text-sm text-[var(--text-secondary)]", children: e("license.page.licenseId", "License ID") }) }),
                /* @__PURE__ */ t("span", { className: "text-xs font-mono text-[var(--text-primary)] break-all", children: a.licenseServerId || "-" })
              ] })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ s("div", { className: "card p-6", children: [
          /* @__PURE__ */ s("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
            /* @__PURE__ */ t(ie, { className: "w-5 h-5" }),
            e("license.info.features", "Features")
          ] }),
          /* @__PURE__ */ t(
            ve,
            {
              hasAllFeatures: C,
              enabledFeatures: a.enabledFeatures,
              availableFeatures: a.availableFeatures,
              t: e
            }
          )
        ] }),
        /* @__PURE__ */ t(q, { open: c, onOpenChange: d })
      ] })
    }
  );
}
function x({ label: e, value: a, highlight: r }) {
  return /* @__PURE__ */ s("div", { className: "flex justify-between items-center py-2 border-b border-[var(--border-color)] last:border-b-0", children: [
    /* @__PURE__ */ t("span", { className: "text-sm text-[var(--text-secondary)]", children: e }),
    /* @__PURE__ */ t("span", { className: `text-sm font-medium ${r === "yellow" ? "text-[var(--warning-text)] font-semibold" : r === "red" ? "text-[var(--error-text)] font-semibold" : r === "green" ? "text-[var(--success-text)] font-semibold" : "text-[var(--text-primary)]"}`, children: a })
  ] });
}
function fe(e, a) {
  return e ? "text-[var(--error-text)]" : a ? "text-[var(--warning-text)]" : "text-[var(--info-text)]";
}
function ye(e, a) {
  return e ? "text-[var(--error-text)]" : a ? "text-[var(--warning-text)]" : "text-[var(--text-primary)]";
}
function B({ icon: e, label: a, max: r, current: i, margin: n = 0, t: l }) {
  const o = r <= 0, u = r, c = r + n, d = 140, m = 12, h = (d - m) / 2, k = d / 2, f = 135, p = 270, D = c > 0 ? Math.min(1, i / c) : 0, S = c > 0 ? u / c : 1, P = n > 0 && i > u && i <= c, C = i > c;
  let $ = "var(--info-dot)";
  C ? $ = "var(--error-dot)" : P && ($ = "var(--warning-dot)");
  const g = "var(--warning-border)", y = (N) => {
    const w = N * Math.PI / 180;
    return {
      x: k + h * Math.cos(w),
      y: k + h * Math.sin(w)
    };
  }, v = (N) => {
    if (N <= 0) return "";
    const w = f + N, L = y(f), b = y(w), U = N > 180 ? 1 : 0;
    return `M ${L.x} ${L.y} A ${h} ${h} 0 ${U} 1 ${b.x} ${b.y}`;
  }, A = c > 0 ? Math.round(i / u * 100) : 0;
  return o ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-3 py-4", children: [
    /* @__PURE__ */ s("div", { className: "relative", style: { width: d, height: d }, children: [
      /* @__PURE__ */ s("svg", { width: d, height: d, children: [
        /* @__PURE__ */ t(
          "path",
          {
            d: v(p),
            fill: "none",
            stroke: "var(--bg-tertiary)",
            strokeWidth: m,
            strokeLinecap: "round"
          }
        ),
        /* @__PURE__ */ t(
          "path",
          {
            d: v(p),
            fill: "none",
            stroke: "var(--success-dot)",
            strokeWidth: m,
            strokeLinecap: "round",
            opacity: 0.5
          }
        )
      ] }),
      /* @__PURE__ */ s("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
        /* @__PURE__ */ t(e, { className: "w-6 h-6 text-[var(--success-text)] mb-1" }),
        /* @__PURE__ */ t("span", { className: "text-lg font-bold text-[var(--success-text)]", children: "∞" })
      ] })
    ] }),
    /* @__PURE__ */ t("span", { className: "text-sm font-medium text-[var(--text-primary)]", children: a }),
    /* @__PURE__ */ t("span", { className: "text-xs text-[var(--text-secondary)]", children: l("license.page.unlimited", "Unlimited") })
  ] }) : /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-3 py-4", children: [
    /* @__PURE__ */ s("div", { className: "relative", style: { width: d, height: d }, children: [
      /* @__PURE__ */ s("svg", { width: d, height: d, children: [
        /* @__PURE__ */ t(
          "path",
          {
            d: v(p),
            fill: "none",
            stroke: "var(--bg-tertiary)",
            strokeWidth: m,
            strokeLinecap: "round"
          }
        ),
        n > 0 && (() => {
          const N = p * (1 - S), w = f + p * S, L = y(w), b = y(f + p), U = N > 180 ? 1 : 0, Y = `M ${L.x} ${L.y} A ${h} ${h} 0 ${U} 1 ${b.x} ${b.y}`;
          return /* @__PURE__ */ t(
            "path",
            {
              d: Y,
              fill: "none",
              stroke: g,
              strokeWidth: m,
              strokeLinecap: "round"
            }
          );
        })(),
        /* @__PURE__ */ t(
          "path",
          {
            d: v(p * D),
            fill: "none",
            stroke: $,
            strokeWidth: m,
            strokeLinecap: "round",
            style: { transition: "stroke 0.3s, d 0.3s" }
          }
        ),
        n > 0 && (() => {
          const N = f + p * S, w = h - m / 2 - 2, L = h + m / 2 + 2, b = N * Math.PI / 180;
          return /* @__PURE__ */ t(
            "line",
            {
              x1: k + w * Math.cos(b),
              y1: k + w * Math.sin(b),
              x2: k + L * Math.cos(b),
              y2: k + L * Math.sin(b),
              stroke: "var(--text-secondary)",
              strokeWidth: 2,
              strokeLinecap: "round"
            }
          );
        })()
      ] }),
      /* @__PURE__ */ s("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
        /* @__PURE__ */ t(e, { className: `w-5 h-5 mb-0.5 ${fe(C, P)}` }),
        /* @__PURE__ */ s("span", { className: `text-2xl font-bold ${ye(C, P)}`, children: [
          A,
          "%"
        ] }),
        /* @__PURE__ */ s("span", { className: "text-xs text-[var(--text-secondary)]", children: [
          i,
          " / ",
          u
        ] })
      ] })
    ] }),
    /* @__PURE__ */ t("span", { className: "text-sm font-medium text-[var(--text-primary)]", children: a }),
    n > 0 && /* @__PURE__ */ s("span", { className: `text-xs ${P || C ? "text-[var(--warning-text)]" : "text-[var(--text-secondary)]"}`, children: [
      "+",
      n,
      " ",
      l("license.page.tolerance", "tolerance")
    ] })
  ] });
}
export {
  Se as LicenseManagementPage
};
//# sourceMappingURL=index-BwE29wya.js.map
