import "../../../../../after-B1IIdH3Y.mjs";
import "../../../../../object-cache-Bok5j2ae.mjs";
import "../../../../../base64-CmWvODNW.mjs";
import "../../../../../types-CuW0zWDA.mjs";
import "../../../../../comment-CzeatwBV.mjs";
import { a as unwrapResult, i as requireDb, r as handleError } from "../../../../../error-CkAseSqZ.mjs";
import { n as requirePerm } from "../../../../../authorize-Dz88F_Fw.mjs";
import { r as handleCommentCounts } from "../../../../../comments-BLE-jv5k.mjs";

//#region src/astro/routes/api/admin/comments/counts.ts
const prerender = false;
const GET = async ({ locals }) => {
	const { emdash, user } = locals;
	const dbErr = requireDb(emdash?.db);
	if (dbErr) return dbErr;
	const denied = requirePerm(user, "comments:moderate");
	if (denied) return denied;
	try {
		return unwrapResult(await handleCommentCounts(emdash.db));
	} catch (error) {
		return handleError(error, "Failed to get comment counts", "COMMENT_COUNTS_ERROR");
	}
};

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