import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import { jsxs, jsx } from 'react/jsx-runtime';

// src/lib/utils.ts
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
function CommerceOrderSummary({
  orderId,
  items,
  totals,
  status,
  meta,
  actions,
  className
}) {
  return /* @__PURE__ */ jsxs("section", { className: cn("flex flex-col gap-6", className), children: [
    /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-3", children: [
      /* @__PURE__ */ jsxs("h2", { className: "text-lg font-semibold text-foreground", children: [
        "Order ",
        orderId
      ] }),
      status ? /* @__PURE__ */ jsx("div", { className: "flex-none", children: status }) : null
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-xl border border-border bg-card text-card-foreground", children: [
      /* @__PURE__ */ jsx("ul", { className: "divide-y divide-border", children: items.map((item, index) => /* @__PURE__ */ jsxs("li", { className: "flex gap-4 p-4", children: [
        item.image ? /* @__PURE__ */ jsx("div", { className: "size-16 flex-none overflow-hidden rounded-lg bg-muted [&_img]:size-full [&_img]:object-cover", children: item.image }) : null,
        /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-1", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
            /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium text-foreground", children: item.name }),
            /* @__PURE__ */ jsx("span", { className: "flex-none text-sm font-medium text-foreground", children: item.price })
          ] }),
          item.meta ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: item.meta }) : null,
          /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
            "Qty ",
            item.quantity
          ] })
        ] })
      ] }, index)) }),
      /* @__PURE__ */ jsx("dl", { className: "flex flex-col gap-2 border-t border-border bg-card p-4", children: totals.map((total, index) => /* @__PURE__ */ jsxs(
        "div",
        {
          className: cn(
            "flex items-center justify-between",
            total.emphasized ? "border-t border-border pt-2 text-base font-semibold text-foreground" : "text-sm text-muted-foreground"
          ),
          children: [
            /* @__PURE__ */ jsx("dt", { children: total.label }),
            /* @__PURE__ */ jsx("dd", { children: total.value })
          ]
        },
        index
      )) })
    ] }),
    meta ? /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-border bg-card p-4 text-sm text-card-foreground", children: meta }) : null,
    actions ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-3", children: actions }) : null
  ] });
}

export { CommerceOrderSummary };
//# sourceMappingURL=commerce-order-summary.js.map
//# sourceMappingURL=commerce-order-summary.js.map