import { getActuateConfig } from '../config/runtime.js';
const GLOBAL_KEY = '__actuateEmailSender';
function store() {
    return globalThis;
}
/**
 * Register the process-wide transactional email sender. Called once at boot by
 * the email plugin. Pass `null` to clear it (used in tests).
 */
export function setEmailSender(sender) {
    store()[GLOBAL_KEY] = sender;
}
/** The sender registered via {@link setEmailSender}, if any. */
export function getRegisteredEmailSender() {
    return store()[GLOBAL_KEY] ?? null;
}
/**
 * Resolve the active transactional email sender, or `null` when email is not
 * configured. Prefers an explicit `platform.email` adapter, then a
 * plugin-registered sender.
 */
export function resolveEmailSender() {
    return getActuateConfig()?.platform?.email ?? getRegisteredEmailSender();
}
//# sourceMappingURL=sender.js.map