import "../../../after-B1IIdH3Y.mjs";
import "../../../object-cache-Bok5j2ae.mjs";
import "../../../content-DhgEth4k.mjs";
import "../../../base64-CmWvODNW.mjs";
import "../../../types-CuW0zWDA.mjs";
import "../../../media-BrXIaMFN.mjs";
import "../../../user-BjAOvU3Z.mjs";
import { t as handleDashboardStats } from "../../../dashboard-EvEKF5en.mjs";
import { a as unwrapResult, r as handleError, t as apiError } from "../../../error-CkAseSqZ.mjs";
import { n as requirePerm } from "../../../authorize-Dz88F_Fw.mjs";

//#region src/astro/routes/api/dashboard.ts
const prerender = false;
const GET = async ({ locals }) => {
	const { emdash, user } = locals;
	const denied = requirePerm(user, "content:read");
	if (denied) return denied;
	if (!emdash?.db) return apiError("NOT_CONFIGURED", "EmDash is not initialized", 500);
	try {
		return unwrapResult(await handleDashboardStats(emdash.db));
	} catch (error) {
		return handleError(error, "Failed to load dashboard", "DASHBOARD_ERROR");
	}
};

//#endregion
export { GET, prerender };
//# sourceMappingURL=dashboard.mjs.map