import { O as escapeRegExp } from "./subsystem-Ci61Iebe.js";

//#region src/auto-reply/tokens.ts
const HEARTBEAT_TOKEN = "HEARTBEAT_OK";
const SILENT_REPLY_TOKEN = "NO_REPLY";
const silentPrefixCache = /* @__PURE__ */ new Map();
const silentSuffixCache = /* @__PURE__ */ new Map();
function isSilentReplyText(text, token = SILENT_REPLY_TOKEN) {
	if (!text) return false;
	const escaped = escapeRegExp(token);
	let prefix = silentPrefixCache.get(escaped);
	if (!prefix) {
		prefix = new RegExp(`^\\s*${escaped}(?=$|\\W)`);
		silentPrefixCache.set(escaped, prefix);
	}
	if (prefix.test(text)) return true;
	let suffix = silentSuffixCache.get(escaped);
	if (!suffix) {
		suffix = new RegExp(`\\b${escaped}\\b\\W*$`);
		silentSuffixCache.set(escaped, suffix);
	}
	return suffix.test(text);
}

//#endregion
export { SILENT_REPLY_TOKEN as n, isSilentReplyText as r, HEARTBEAT_TOKEN as t };