import { r as normalizeChatChannelId } from "./ids-BrhhirfL.js";
import { t as listBundledChannelCatalogEntries } from "./bundled-channel-catalog-read-BhLQH74H.js";
import { c as normalizeGatewayClientName, i as GATEWAY_CLIENT_NAMES, r as GATEWAY_CLIENT_MODES, s as normalizeGatewayClientMode } from "./client-info-BzCrekjX.js";
import { r as getRegisteredChannelPluginMeta } from "./registry-DLBky-D6.js";
import { t as getChatChannelMeta } from "./chat-meta-Db5AASZ0.js";
import { t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-constants-xBuIaJJT.js";
import { i as normalizeMessageChannel } from "./message-channel-normalize-DRgVoRw4.js";
//#region src/utils/message-channel.ts
function isGatewayCliClient(client) {
	return normalizeGatewayClientMode(client?.mode) === GATEWAY_CLIENT_MODES.CLI;
}
function isOperatorUiClient(client) {
	const clientId = normalizeGatewayClientName(client?.id);
	return clientId === GATEWAY_CLIENT_NAMES.CONTROL_UI || clientId === GATEWAY_CLIENT_NAMES.TUI;
}
function isBrowserOperatorUiClient(client) {
	return normalizeGatewayClientName(client?.id) === GATEWAY_CLIENT_NAMES.CONTROL_UI;
}
function isInternalMessageChannel(raw) {
	return normalizeMessageChannel(raw) === INTERNAL_MESSAGE_CHANNEL;
}
function isWebchatClient(client) {
	if (normalizeGatewayClientMode(client?.mode) === GATEWAY_CLIENT_MODES.WEBCHAT) return true;
	return normalizeGatewayClientName(client?.id) === GATEWAY_CLIENT_NAMES.WEBCHAT_UI;
}
function isMarkdownCapableMessageChannel(raw) {
	const channel = normalizeMessageChannel(raw);
	if (!channel) return false;
	if (channel === "webchat" || channel === "tui") return true;
	const builtInChannel = normalizeChatChannelId(channel);
	if (builtInChannel) {
		const builtInMeta = getChatChannelMeta(builtInChannel);
		if (builtInMeta) return builtInMeta.markdownCapable === true;
		const catalogMeta = listBundledChannelCatalogEntries().find((entry) => entry.id === builtInChannel);
		if (catalogMeta) return catalogMeta.channel.markdownCapable === true;
	}
	return getRegisteredChannelPluginMeta(channel)?.markdownCapable === true;
}
//#endregion
export { isOperatorUiClient as a, isMarkdownCapableMessageChannel as i, isGatewayCliClient as n, isWebchatClient as o, isInternalMessageChannel as r, isBrowserOperatorUiClient as t };
