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

// src/components/timeline/timeline.tsx
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
var indicator = cva(
  "relative z-10 inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-[var(--duration-normal,200ms)] ease-out",
  {
    variants: {
      status: {
        default: "bg-background border-input text-muted-foreground",
        success: "bg-background border-primary text-primary",
        warning: "bg-background border-[var(--color-warning,oklch(0.78_0.16_82))] text-[var(--color-warning,oklch(0.78_0.16_82))]",
        error: "bg-destructive border-destructive text-destructive-foreground",
        info: "bg-background border-ring text-ring"
      },
      size: {
        sm: "h-5 w-5 text-[10px]",
        default: "h-7 w-7 text-xs",
        lg: "h-9 w-9 text-sm"
      }
    },
    defaultVariants: { status: "default", size: "default" }
  }
);
function DefaultDot() {
  return /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-current", "aria-hidden": "true" });
}
function Timeline({
  events,
  size = "default",
  "aria-label": ariaLabel,
  className,
  ...rest
}) {
  return /* @__PURE__ */ jsx(
    "ol",
    {
      "aria-label": ariaLabel,
      className: cn("flex flex-col list-none p-0 m-0", className),
      ...rest,
      children: events.map((event, index) => {
        const isLast = index === events.length - 1;
        const status = event.status ?? "default";
        return /* @__PURE__ */ jsxs("li", { className: "relative flex gap-[var(--space-3,0.75rem)]", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
            /* @__PURE__ */ jsx("span", { className: indicator({ status, size }), children: event.icon ?? /* @__PURE__ */ jsx(DefaultDot, {}) }),
            !isLast ? /* @__PURE__ */ jsx(
              "span",
              {
                "aria-hidden": "true",
                className: "w-px flex-1 bg-input min-h-[var(--space-6,1.5rem)]"
              }
            ) : null
          ] }),
          /* @__PURE__ */ jsxs(
            "div",
            {
              className: cn(
                "flex flex-col gap-[var(--space-1,0.25rem)] min-w-0",
                !isLast && "pb-[var(--space-6,1.5rem)]"
              ),
              children: [
                /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-[var(--space-2,0.5rem)]", children: [
                  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: event.title }),
                  event.timestamp ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: event.timestamp }) : null
                ] }),
                event.description ? /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: event.description }) : null
              ]
            }
          )
        ] }, event.id);
      })
    }
  );
}
Timeline.displayName = "Timeline";

export { Timeline };
//# sourceMappingURL=timeline.js.map
//# sourceMappingURL=timeline.js.map