globalThis.process ??= {};
globalThis.process.env ??= {};
import { r as __exportAll } from "./rolldown-runtime_-UtK6b3T.mjs";
import { d as renderTemplate, i as renderComponent, w as createAstro } from "./server_DAChoow1.mjs";
import { t as createComponent } from "./compiler_CLrjY88v.mjs";
import { n as getFullDb } from "./db_BQ9NAt8x.mjs";
import { p as resolveScreen, r as $$DefaultSearchBody, t as resolveModTheme } from "./registry_CB_IcduS.mjs";
import { t as $$Base } from "./Base_AuO_PBeT.mjs";
import { t as loadAppearanceSelection } from "./appearance-server_BGcx6aOu.mjs";
import { t as loadPublicContentSearch } from "./content-search_7Alj0Jt5.mjs";
import { env } from "cloudflare:workers";
//#region src/pages/search.astro
var search_exports = /* @__PURE__ */ __exportAll({
	default: () => $$Search,
	file: () => $$file,
	prerender: () => false,
	url: () => $$url
});
createAstro("https://astro.build");
var $$Search = createComponent(async ($$result, $$props, $$slots) => {
	const Astro = $$result.createAstro($$props, $$slots);
	Astro.self = $$Search;
	const q = Astro.url.searchParams.get("q") ?? "";
	const cursor = Astro.url.searchParams.get("cursor");
	let page = {
		hasQuery: false,
		hits: [],
		nextCursor: null
	};
	try {
		const { db } = getFullDb(env);
		page = await loadPublicContentSearch(db, q, cursor);
	} catch {}
	const nextHref = page.nextCursor && q.trim() ? `/search?q=${encodeURIComponent(q.trim())}&cursor=${encodeURIComponent(page.nextCursor)}` : null;
	const selection = await loadAppearanceSelection(env);
	const SearchBody = resolveScreen(resolveModTheme(selection.themeId), "search", $$DefaultSearchBody);
	return renderTemplate`${renderComponent($$result, "Base", $$Base, {
		"title": page.hasQuery ? `Search — ${q.trim()}` : "Search",
		"description": "Search published content on this site",
		"selection": selection
	}, { "default": ($$result) => renderTemplate`${renderComponent($$result, "SearchBody", SearchBody, {
		"q": q,
		"hasQuery": page.hasQuery,
		"hits": page.hits,
		"nextHref": nextHref
	})}` })}`;
}, "/home/user/runs/run-20260823T175424Z-2fpke4/repo/apps/mod-cms/src/pages/search.astro", void 0);
var $$file = "/home/user/runs/run-20260823T175424Z-2fpke4/repo/apps/mod-cms/src/pages/search.astro";
var $$url = "/search";
//#endregion
//#region \0virtual:astro:page:src/pages/search@_@astro
var page = () => search_exports;
//#endregion
export { page };
