import { useChildWorkflows as e } from "../../../hooks/useWorkflows.js";
import t from "./WorkflowHistoryItem.js";
import { useMemo as n } from "react";
import { jsx as r, jsxs as i } from "react/jsx-runtime";
import { Clock as a, Loader2 as o } from "lucide-react";
//#region src/features/workbench/components/WorkflowHistoryList.tsx
var s = ({ workflow: s }) => {
	let c = e(s?.id), l = n(() => c.data ?? [], [c.data]);
	return s ? c.isLoading ? /* @__PURE__ */ r("div", {
		className: "flex items-center justify-center py-8",
		children: /* @__PURE__ */ r(o, { className: "text-muted-foreground h-5 w-5 animate-spin" })
	}) : c.error ? /* @__PURE__ */ r("div", {
		className: "text-destructive px-2 py-4 text-sm",
		children: "Failed to load history"
	}) : l.length === 0 ? /* @__PURE__ */ i("div", {
		className: "text-muted-foreground flex flex-col items-center justify-center gap-2 py-8",
		children: [/* @__PURE__ */ r(a, { className: "h-6 w-6" }), /* @__PURE__ */ r("span", {
			className: "text-sm",
			children: "No workflow history"
		})]
	}) : /* @__PURE__ */ r("div", {
		className: "flex flex-col gap-1 py-2",
		children: l.map((e) => /* @__PURE__ */ r(t, {
			workflowId: e.id,
			workflow: e
		}, e.id))
	}) : /* @__PURE__ */ r("div", {
		className: "text-muted-foreground flex items-center justify-center py-8 text-sm",
		children: "No workflow selected"
	});
};
//#endregion
export { s as default };
