import { x as head, c as escape_html, e as ensure_array_like, a as attr } from './dev-BNpEUZI3.js';
import { C as Card, B as Badge } from './Tabs-DzG6Bn9a.js';

//#region src/routes/studio/[projectId]/+page.svelte
function _page($$renderer, $$props) {
	$$renderer.component(($$renderer) => {
		let { data } = $$props;
		/** Status → badge tone. */
		function statusTone(status) {
			if (status === "done") return "success";
			if (status === "active") return "info";
			if (status === "blocked") return "danger";
			if (status === "pending") return "warning";
			return "neutral";
		}
		head("nwg4kk", $$renderer, ($$renderer) => {
			$$renderer.title(($$renderer) => {
				$$renderer.push(`<title>${escape_html(data.projectName)} sagas — CLEO Studio</title>`);
			});
			$$renderer.push(`<meta name="robots" content="noindex"/>`);
		});
		$$renderer.push(`<section class="picker svelte-nwg4kk"><header class="picker-head svelte-nwg4kk"><div><span class="eyebrow svelte-nwg4kk">OPERATOR CONSOLE</span> <h1 class="svelte-nwg4kk">${escape_html(data.projectName)} — Sagas</h1> <p class="muted svelte-nwg4kk">Pick a saga to open its workgraph + live dispatcher board.</p></div></header> `);
		if (data.error) {
			$$renderer.push("<!--[0-->");
			Card($$renderer, {
				padding: "cozy",
				children: ($$renderer) => {
					$$renderer.push(`<div class="error svelte-nwg4kk" role="alert">${escape_html(data.error)}</div>`);
				}});
		} else if (data.roots.length === 0) {
			$$renderer.push("<!--[1-->");
			Card($$renderer, {
				padding: "cozy",
				children: ($$renderer) => {
					$$renderer.push(`<p class="muted svelte-nwg4kk">No sagas or standalone epics in this project yet. Create one with <code class="svelte-nwg4kk">cleo saga create</code>.</p>`);
				}});
		} else {
			$$renderer.push("<!--[-1-->");
			$$renderer.push(`<ul class="roots svelte-nwg4kk"><!--[-->`);
			const each_array = ensure_array_like(data.roots);
			for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
				let root = each_array[$$index];
				$$renderer.push(`<li><a class="root svelte-nwg4kk"${attr("href", `/studio/${data.projectId}/${root.id}`)}><span class="root-id svelte-nwg4kk"><code class="svelte-nwg4kk">${escape_html(root.id)}</code></span> <span class="root-title svelte-nwg4kk">${escape_html(root.title)}</span> <span class="root-meta svelte-nwg4kk">`);
				Badge($$renderer, {
					tone: "info",
					size: "sm",
					children: ($$renderer) => {
						$$renderer.push(`<!---->${escape_html(root.type)}`);
					}});
				$$renderer.push(`<!----> `);
				Badge($$renderer, {
					tone: statusTone(root.status),
					size: "sm",
					children: ($$renderer) => {
						$$renderer.push(`<!---->${escape_html(root.status)}`);
					}});
				$$renderer.push(`<!----> <span class="count svelte-nwg4kk">${escape_html(root.descendantCount)} tasks</span></span></a></li>`);
			}
			$$renderer.push(`<!--]--></ul>`);
		}
		$$renderer.push(`<!--]--></section>`);
	});
}

export { _page as default };
//# sourceMappingURL=_page.svelte-bGhsrIjS.js.map
