import { useStudio as e } from "../providers/StudioProvider.js";
import { useWorkflowConfigByName as t, useWorkflowSource as n } from "../hooks/useWorkflows.js";
import r from "../components/layout/MainLayout.js";
import { ReactFlowProvider as i } from "../node_modules/@xyflow/react/dist/esm/index.js";
import a from "../features/debug/components/ConfigFlowViewer.js";
import { useMemo as o } from "react";
import { jsx as s, jsxs as c } from "react/jsx-runtime";
import { useParams as l } from "react-router-dom";
import { Home as u, Loader2 as d } from "lucide-react";
import { Prism as f } from "react-syntax-highlighter";
import { vscDarkPlus as p } from "react-syntax-highlighter/dist/esm/styles/prism";
//#region src/pages/DebugWorkflowDetailsPage.tsx
function m() {
	let { workflowId: m } = l(), { router: h } = e(), [g, _] = o(() => {
		if (!m) return ["", ""];
		let e = m.split("::");
		return e.length === 2 ? e : ["default", m];
	}, [m]), { data: v, isLoading: y } = t(_), { data: b, isLoading: x } = n(_), S = y || x;
	return /* @__PURE__ */ s(r, {
		breadcrumbsData: [
			{
				label: "Dashboard",
				href: h.getDashboard(),
				icon: /* @__PURE__ */ s(u, { className: "h-4 w-4" })
			},
			{
				label: "Debug Workflows",
				href: h.getDebugWorkflows()
			},
			{
				label: v?.title || v?.alias || _ || "Workflow Details",
				current: !0
			}
		],
		children: S ? /* @__PURE__ */ c("div", {
			className: "flex items-center space-x-2",
			children: [/* @__PURE__ */ s(d, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ s("span", { children: "Loading..." })]
		}) : v ? /* @__PURE__ */ c("div", {
			className: "flex h-[calc(100vh-8rem)] flex-col gap-4",
			children: [
				/* @__PURE__ */ s("h1", {
					className: "text-3xl font-bold tracking-tight",
					children: v.title || v.alias
				}),
				/* @__PURE__ */ s("p", {
					className: "text-muted-foreground",
					children: v.description
				}),
				/* @__PURE__ */ c("div", {
					className: "flex flex-1 gap-4 overflow-hidden",
					children: [/* @__PURE__ */ c("div", {
						className: "w-1/2 flex flex-col rounded-lg border bg-card text-card-foreground shadow-sm overflow-hidden",
						children: [/* @__PURE__ */ s("div", {
							className: "border-b bg-muted/50 px-4 py-2 font-medium text-sm",
							children: b?.filePath
						}), /* @__PURE__ */ s("div", {
							className: "flex-1 overflow-auto bg-[#1e1e1e]",
							children: /* @__PURE__ */ s(f, {
								language: b?.raw ? "typescript" : "json",
								style: p,
								customStyle: {
									margin: 0,
									padding: "1rem",
									height: "100%",
									fontSize: "13px"
								},
								showLineNumbers: !0,
								children: b?.raw ? b.raw : JSON.stringify(v, null, 2)
							})
						})]
					}), /* @__PURE__ */ c("div", {
						className: "w-1/2 flex flex-col rounded-lg border bg-card text-card-foreground shadow-sm overflow-hidden",
						children: [/* @__PURE__ */ s("div", {
							className: "border-b bg-muted/50 px-4 py-2 font-medium text-sm",
							children: "Diagram"
						}), /* @__PURE__ */ s("div", {
							className: "flex-1 relative bg-background",
							children: /* @__PURE__ */ s(i, { children: /* @__PURE__ */ s(a, { config: v }) })
						})]
					})]
				})
			]
		}) : /* @__PURE__ */ c("div", { children: [
			"Workflow Type not found (Workspace: ",
			g,
			", Workflow: ",
			_,
			")"
		] })
	});
}
//#endregion
export { m as default };
