"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Wrench, Check, X, Loader2 } from "lucide-react";
import { cn } from "@open-mercato/shared/lib/utils";
import { humanizeToolName } from "../../utils/toolMatcher.js";
function ToolCallDisplay({ toolCall }) {
  const displayName = humanizeToolName(toolCall.toolName);
  return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 py-2 px-3 bg-muted/50 rounded-lg my-2", children: [
    /* @__PURE__ */ jsxs(
      "div",
      {
        className: cn(
          "flex items-center justify-center w-6 h-6 rounded shrink-0",
          toolCall.status === "completed" && "bg-green-100 text-green-600",
          toolCall.status === "error" && "bg-red-100 text-red-600",
          toolCall.status === "running" && "bg-blue-100 text-blue-600",
          toolCall.status === "pending" && "bg-gray-100 text-gray-600"
        ),
        children: [
          toolCall.status === "running" && /* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin" }),
          toolCall.status === "completed" && /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }),
          toolCall.status === "error" && /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }),
          toolCall.status === "pending" && /* @__PURE__ */ jsx(Wrench, { className: "h-3 w-3" })
        ]
      }
    ),
    /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 text-xs", children: [
      /* @__PURE__ */ jsx("div", { className: "font-medium text-foreground", children: displayName }),
      Object.keys(toolCall.args).length > 0 && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground mt-1", children: /* @__PURE__ */ jsxs("code", { className: "bg-muted px-1 rounded", children: [
        JSON.stringify(toolCall.args, null, 0).slice(0, 100),
        JSON.stringify(toolCall.args).length > 100 && "..."
      ] }) }),
      toolCall.status === "completed" && toolCall.result !== void 0 && /* @__PURE__ */ jsxs("div", { className: "text-green-600 mt-1", children: [
        "Result: ",
        typeof toolCall.result === "object" ? "Success" : String(toolCall.result)
      ] }),
      toolCall.status === "error" && toolCall.error && /* @__PURE__ */ jsxs("div", { className: "text-red-600 mt-1", children: [
        "Error: ",
        toolCall.error
      ] })
    ] })
  ] });
}
export {
  ToolCallDisplay
};
//# sourceMappingURL=ToolCallDisplay.js.map
