import "../../../../../../base64-CmWvODNW.mjs";
import "../../../../../../types-CuW0zWDA.mjs";
import { a as unwrapResult, t as apiError } from "../../../../../../error-CkAseSqZ.mjs";
import { n as requirePerm } from "../../../../../../authorize-Dz88F_Fw.mjs";

//#region src/astro/routes/api/content/[collection]/[id]/revisions.ts
const prerender = false;
const GET = async ({ params, url, locals }) => {
	const { emdash, user } = locals;
	const denied = requirePerm(user, "content:read_drafts");
	if (denied) return denied;
	const collection = params.collection;
	const id = params.id;
	if (!emdash?.handleRevisionList) return apiError("NOT_CONFIGURED", "EmDash is not initialized", 500);
	const limitParam = url.searchParams.get("limit");
	const parsedLimit = limitParam ? parseInt(limitParam, 10) : void 0;
	return unwrapResult(await emdash.handleRevisionList(collection, id, { limit: parsedLimit ? Math.max(1, Math.min(parsedLimit, 100)) : void 0 }));
};

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