import { t as e } from "../utils-B7XIe3qq.js";
import * as t from "react";
import { jsx as n, jsxs as r } from "react/jsx-runtime";
//#region src/primitives/phase-progress.tsx
function i(e, t, n) {
	if (t === -1) return n === "completed" ? "completed" : "pending";
	if (e < t) return "completed";
	if (e > t) return n === "completed" ? "completed" : "pending";
	switch (n) {
		case "running": return "current-running";
		case "completed": return "completed";
		case "failed": return "current-failed";
		case "cancelled": return "current-cancelled";
		default: return "pending";
	}
}
var a = {
	completed: "bg-primary text-primary-foreground border-primary",
	"current-running": "bg-primary text-primary-foreground border-primary animate-pulse",
	"current-failed": "bg-destructive text-destructive-foreground border-destructive",
	"current-cancelled": "bg-warning text-warning-foreground border-warning",
	pending: "bg-muted text-muted-foreground border-border"
}, o = {
	completed: "bg-primary",
	pending: "bg-border"
}, s = {
	completed: "text-foreground",
	"current-running": "text-foreground font-medium",
	"current-failed": "text-destructive font-medium",
	"current-cancelled": "text-warning font-medium",
	pending: "text-muted-foreground"
};
function c({ phases: c, currentPhase: l, status: u, className: d, ...f }) {
	let p = c.findIndex((e) => e.key === l);
	return /* @__PURE__ */ n("div", {
		"data-slot": "phase-progress",
		"data-status": u,
		className: e("flex w-full items-start", d),
		...f,
		children: c.map((l, d) => {
			let f = i(d, p, u), m = d === c.length - 1, h = u === "completed" || d < p ? "completed" : "pending";
			return /* @__PURE__ */ r(t.Fragment, { children: [/* @__PURE__ */ r("div", {
				className: "flex min-w-0 flex-col items-center gap-1.5",
				children: [/* @__PURE__ */ n("div", {
					"data-slot": "phase-progress-dot",
					"data-state": f,
					"aria-current": f.startsWith("current") ? "step" : void 0,
					className: e("flex h-6 w-6 items-center justify-center rounded-full border text-[10px] font-semibold tabular-nums transition-colors", a[f]),
					children: d + 1
				}), /* @__PURE__ */ n("span", {
					className: e("truncate text-xs", s[f]),
					title: l.label,
					children: l.label
				})]
			}), !m && /* @__PURE__ */ n("div", {
				"aria-hidden": !0,
				"data-slot": "phase-progress-connector",
				"data-state": h,
				className: e("mx-2 mt-3 h-0.5 flex-1 rounded-full transition-colors", o[h])
			})] }, l.key);
		})
	});
}
//#endregion
export { c as PhaseProgress };

//# sourceMappingURL=phase-progress.js.map