globalThis.process ??= {};
globalThis.process.env ??= {};
import { h as getAllSettings, m as SETTINGS_KEYS } from "./crypto_CY2zBtG3.mjs";
import { n as getFullDb } from "./db_DZJ1iBSP.mjs";
import { o as parseActiveSelection, t as DEFAULT_SELECTION } from "./theme_BaEzwWHZ.mjs";
import "cloudflare:workers";
//#region src/lib/appearance-server.ts
/**
* Read the stored `theme` setting and resolve to an ActiveSelection. ALWAYS resolves
* (availability Hard floor) — a settings read failure falls back to DEFAULT_SELECTION.
* Used by the post page to pick its theme body before wrapping in <Base>.
*/
async function loadAppearanceSelection(env) {
	try {
		const settings = await getAllSettings(getFullDb(env).db);
		return parseActiveSelection(settings[SETTINGS_KEYS.theme]);
	} catch {
		return DEFAULT_SELECTION;
	}
}
//#endregion
export { loadAppearanceSelection as t };
