import { useStudio } from "../providers/StudioProvider.js";
import { Alert } from "../components/ui/alert.js";
import MainLayout_default from "../components/layout/MainLayout.js";
import LoadingCentered_default from "../components/LoadingCentered.js";
import Dashboard from "../features/dashboard/Dashboard.js";
import { useDashboardStats } from "../hooks/useDashboard.js";
import { c } from "react/compiler-runtime";
import { jsx, jsxs } from "react/jsx-runtime";
import { Home } from "lucide-react";
function DashboardPage() {
	let d = c(17), { environment: f } = useStudio(), { data: p, isLoading: m, error: h } = useDashboardStats();
	if (m) {
		let e;
		return d[0] === m ? e = d[1] : (e = /* @__PURE__ */ jsx(LoadingCentered_default, { loading: m }), d[0] = m, d[1] = e), e;
	}
	if (h) {
		let e;
		return d[2] === h.message ? e = d[3] : (e = /* @__PURE__ */ jsxs(Alert, {
			className: "w-full p-4 text-red-500",
			children: ["Error loading dashboard: ", h.message]
		}), d[2] = h.message, d[3] = e), e;
	}
	if (!p) {
		let e;
		return d[4] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
			className: "p-4",
			children: "No data available"
		}), d[4] = e) : e = d[4], e;
	}
	let g;
	d[5] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ jsx(Home, { className: "h-4 w-4" }), d[5] = g) : g = d[5];
	let _;
	d[6] === f.name ? _ = d[7] : (_ = {
		label: f.name,
		href: "#",
		icon: g
	}, d[6] = f.name, d[7] = _);
	let v;
	d[8] === Symbol.for("react.memo_cache_sentinel") ? (v = {
		label: "Dashboard",
		current: !0
	}, d[8] = v) : v = d[8];
	let y;
	d[9] === _ ? y = d[10] : (y = [_, v], d[9] = _, d[10] = y);
	let b = y, x;
	d[11] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ jsx("h1", {
		className: "mb-4 text-3xl font-bold tracking-tight",
		children: "Dashboard"
	}), d[11] = x) : x = d[11];
	let S;
	d[12] === p ? S = d[13] : (S = /* @__PURE__ */ jsx(Dashboard, { dashboardStats: p }), d[12] = p, d[13] = S);
	let C;
	return d[14] !== b || d[15] !== S ? (C = /* @__PURE__ */ jsxs(MainLayout_default, {
		breadcrumbsData: b,
		children: [x, S]
	}), d[14] = b, d[15] = S, d[16] = C) : C = d[16], C;
}
export { DashboardPage as default };
