import { s as normalizeOptionalLowercaseString } from "./string-coerce-mnp54Vah.js";
import { r as normalizeChatChannelId } from "./ids-BrhhirfL.js";
import { s as findRegisteredChannelPluginEntry } from "./registry-DLBky-D6.js";
import { t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-constants-xBuIaJJT.js";
//#region src/channels/registry-normalize.ts
function normalizeAnyChannelId(raw) {
	const key = normalizeOptionalLowercaseString(raw);
	if (!key) return null;
	return findRegisteredChannelPluginEntry(key)?.plugin.id ?? null;
}
//#endregion
//#region src/utils/message-channel-core.ts
function normalizeMessageChannel(raw) {
	const normalized = normalizeOptionalLowercaseString(raw);
	if (!normalized) return;
	if (normalized === "webchat") return INTERNAL_MESSAGE_CHANNEL;
	const builtIn = normalizeChatChannelId(normalized);
	if (builtIn) return builtIn;
	return normalizeAnyChannelId(normalized) ?? normalized;
}
function isDeliverableMessageChannel(value) {
	const normalized = normalizeMessageChannel(value);
	return normalized !== void 0 && normalized !== "webchat" && normalized === value;
}
//#endregion
export { normalizeMessageChannel as n, normalizeAnyChannelId as r, isDeliverableMessageChannel as t };
