"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Box } from "lucide-react";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { Badge } from "@open-mercato/ui/primitives/badge";
import { resolveRegisteredLucideIcon } from "../icons/lucideRegistry.js";
function resolveIcon(name) {
  return resolveRegisteredLucideIcon(name) ?? Box;
}
function MessageObjectPreview({
  previewData,
  actionRequired,
  actionLabel,
  icon
}) {
  const t = useT();
  const Icon = resolveIcon(icon);
  return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-md border bg-muted/20 p-3", children: [
    /* @__PURE__ */ jsx(Icon, { className: "mt-0.5 h-4 w-4 text-muted-foreground" }),
    /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: previewData?.title || "" }),
        actionRequired ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: actionLabel || t("messages.composer.objectActionRequired", "Action required") }) : null
      ] }),
      previewData?.subtitle ? /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: previewData.subtitle }) : null,
      previewData?.status ? /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-xs", children: previewData.status }) : null,
      previewData?.metadata && Object.keys(previewData.metadata).length > 0 ? /* @__PURE__ */ jsx("dl", { className: "space-y-1 pt-1", children: Object.entries(previewData.metadata).map(([key, value]) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 text-xs text-muted-foreground", children: [
        /* @__PURE__ */ jsxs("dt", { className: "font-medium capitalize", children: [
          key,
          ":"
        ] }),
        /* @__PURE__ */ jsx("dd", { className: "truncate", children: value })
      ] }, key)) }) : null
    ] })
  ] });
}
var MessageObjectPreview_default = MessageObjectPreview;
export {
  MessageObjectPreview,
  MessageObjectPreview_default as default
};
//# sourceMappingURL=MessageObjectPreview.js.map
