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

// src/lib/utils.ts
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
var COLUMN_CLASS = {
  two: "sm:grid-cols-2",
  three: "sm:grid-cols-2 lg:grid-cols-3",
  four: "sm:grid-cols-2 lg:grid-cols-4"
};
var CHANGE_CLASS = {
  increase: "text-primary",
  decrease: "text-destructive",
  neutral: "text-muted-foreground"
};
function Caret({ type }) {
  if (type === "neutral") return null;
  return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", className: "size-3.5", children: type === "increase" ? /* @__PURE__ */ jsx("path", { d: "M8 4l4 5H4l4-5z" }) : /* @__PURE__ */ jsx("path", { d: "M8 12L4 7h8l-4 5z" }) });
}
function AppStats({ stats, columns = "four", className }) {
  return /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-1 gap-4", COLUMN_CLASS[columns], className), children: stats.map((stat, index) => {
    const changeType = stat.changeType ?? "neutral";
    return /* @__PURE__ */ jsxs(
      "div",
      {
        className: "flex flex-col gap-2 rounded-xl border border-border bg-card p-5 text-card-foreground shadow-sm",
        children: [
          /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
            /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-muted-foreground", children: stat.label }),
            stat.icon ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground [&_svg]:size-4", "aria-hidden": "true", children: stat.icon }) : null
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-2", children: [
            /* @__PURE__ */ jsx("span", { className: "text-2xl font-semibold tracking-tight text-foreground", children: stat.value }),
            stat.change ? /* @__PURE__ */ jsxs("span", { className: cn("flex items-center gap-0.5 text-sm font-medium", CHANGE_CLASS[changeType]), children: [
              /* @__PURE__ */ jsx(Caret, { type: changeType }),
              stat.change
            ] }) : null
          ] })
        ]
      },
      index
    );
  }) });
}

export { AppStats };
//# sourceMappingURL=app-stats.js.map
//# sourceMappingURL=app-stats.js.map