//#region src/auth/email-send-status-store.ts
const DEFAULT_TTL_MS = 300 * 1e3;
const STORE_KEY = Symbol.for("inkeep:email-send-status-store");
const TIMERS_KEY = Symbol.for("inkeep:email-send-status-timers");
function getStore() {
	const g = globalThis;
	if (!g[STORE_KEY]) g[STORE_KEY] = /* @__PURE__ */ new Map();
	return g[STORE_KEY];
}
function getTimers() {
	const g = globalThis;
	if (!g[TIMERS_KEY]) g[TIMERS_KEY] = /* @__PURE__ */ new Map();
	return g[TIMERS_KEY];
}
function setEmailSendStatus(id, status, ttlMs = DEFAULT_TTL_MS) {
	const store = getStore();
	const timers = getTimers();
	const existingTimer = timers.get(id);
	if (existingTimer) clearTimeout(existingTimer);
	store.set(id, status);
	const timer = setTimeout(() => {
		store.delete(id);
		timers.delete(id);
	}, ttlMs);
	timers.set(id, timer);
}
function getEmailSendStatus(id) {
	return getStore().get(id) ?? null;
}

//#endregion
export { getEmailSendStatus, setEmailSendStatus };