"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { useRegisteredComponent } from "@open-mercato/ui/backend/injection/useRegisteredComponent";
import { Tag } from "@open-mercato/ui/primitives/tag";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { DefaultStepper } from "./Stepper.js";
import { DefaultStatusBadge } from "./StatusBadgeSection.js";
import { DefaultDnsConfig } from "./DnsConfig.js";
import { DefaultActions } from "./Actions.js";
import { DnsDiagnostics, TlsDiagnostics } from "./Diagnostics.js";
function DomainPanel(props) {
  const t = useT();
  const Stepper = useRegisteredComponent(
    "section:customer_accounts.domain-settings:stepper",
    DefaultStepper
  );
  const StatusBadgeSection = useRegisteredComponent(
    "section:customer_accounts.domain-settings:status",
    DefaultStatusBadge
  );
  const DnsConfig = useRegisteredComponent(
    "section:customer_accounts.domain-settings:dns-config",
    DefaultDnsConfig
  );
  const Actions = useRegisteredComponent(
    "section:customer_accounts.domain-settings:actions",
    DefaultActions
  );
  const { mapping, isReplacement, cnameTarget, aRecordTarget } = props;
  const showDnsConfig = mapping.status !== "active";
  return /* @__PURE__ */ jsxs("section", { className: "space-y-4 rounded-xl border bg-card p-6 shadow-sm", children: [
    /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-start justify-between gap-3", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold tracking-tight", children: mapping.hostname }),
        isReplacement ? /* @__PURE__ */ jsx(Tag, { variant: "info", dot: true, children: t("customer_accounts.domainMapping.replacement.label", "Replacement (waiting to activate)") }) : null
      ] }),
      /* @__PURE__ */ jsx(StatusBadgeSection, { mapping })
    ] }) }),
    /* @__PURE__ */ jsx(Stepper, { status: mapping.status }),
    /* @__PURE__ */ jsx(DnsDiagnostics, { mapping }),
    /* @__PURE__ */ jsx(TlsDiagnostics, { mapping }),
    showDnsConfig ? /* @__PURE__ */ jsx(
      DnsConfig,
      {
        hostname: mapping.hostname,
        cnameTarget: mapping.cnameTarget ?? cnameTarget,
        aRecordTarget: mapping.aRecordTarget ?? aRecordTarget
      }
    ) : null,
    /* @__PURE__ */ jsx(
      Actions,
      {
        mapping,
        isReplacement,
        busy: props.busy,
        onCheckNow: props.onCheckNow,
        onRetryTls: props.onRetryTls,
        onChangeDomain: props.onChangeDomain,
        onRemove: props.onRemove
      }
    )
  ] });
}
var DomainPanel_default = DomainPanel;
export {
  DomainPanel,
  DomainPanel_default as default
};
//# sourceMappingURL=DomainPanel.js.map
