globalThis.process ??= {};
globalThis.process.env ??= {};
import { r as __exportAll } from "./rolldown-runtime_-UtK6b3T.mjs";
import { d as renderTemplate, f as maybeRenderHead, i as renderComponent, w as createAstro } from "./server_DAChoow1.mjs";
import { t as createComponent } from "./compiler_CLrjY88v.mjs";
import { i as requireAdmin } from "./auth_B0DWM0G6.mjs";
import { h as require_jsx_runtime } from "./registry_Dp-gIetL.mjs";
import { t as $$Base } from "./Base_HF7wSdag.mjs";
import { n as MediaLibrary, t as createHostMediaClient } from "./media-client_TFMvpJgl.mjs";
import { env } from "cloudflare:workers";
//#region src/components/MediaLibraryIsland.tsx
var import_jsx_runtime = require_jsx_runtime();
var client = createHostMediaClient();
function MediaLibraryIsland({ onSelect }) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MediaLibrary, {
		client,
		onSelect: onSelect ?? (() => {})
	});
}
//#endregion
//#region src/pages/admin/media.astro
var media_exports = /* @__PURE__ */ __exportAll({
	default: () => $$Media,
	file: () => $$file,
	prerender: () => false,
	url: () => $$url
});
createAstro("https://astro.build");
var $$Media = createComponent(async ($$result, $$props, $$slots) => {
	const Astro = $$result.createAstro($$props, $$slots);
	Astro.self = $$Media;
	try {
		await requireAdmin(Astro.request, env, Astro.cookies);
	} catch (error) {
		const name = error.name;
		if (name === "InvalidSessionError" || name === "RoleDeniedError") return Astro.redirect("/admin/login");
		throw error;
	}
	return renderTemplate`${renderComponent($$result, "Base", $$Base, {
		"title": "Media · mod-cms admin",
		"description": "Media library for mod-cms"
	}, { "default": ($$result) => renderTemplate`${maybeRenderHead($$result)}<h1>Media</h1>${renderComponent($$result, "MediaLibraryIsland", MediaLibraryIsland, {
		"client:load": true,
		"client:component-hydration": "load",
		"client:component-path": "/home/user/runs/run-20260823T181157Z-wxvefo/repo/apps/mod-cms/src/components/MediaLibraryIsland.tsx",
		"client:component-export": "default"
	})}` })}`;
}, "/home/user/runs/run-20260823T181157Z-wxvefo/repo/apps/mod-cms/src/pages/admin/media.astro", void 0);
var $$file = "/home/user/runs/run-20260823T181157Z-wxvefo/repo/apps/mod-cms/src/pages/admin/media.astro";
var $$url = "/admin/media";
//#endregion
//#region \0virtual:astro:page:src/pages/admin/media@_@astro
var page = () => media_exports;
//#endregion
export { page };
