const KICK_RETENTION_MS = 24 * 60 * 60_000; type KickList = { ids: Set; expiresAt: number }; const kickedParticipantIds = new Map(); const kickedClientIds = new Map(); function activeList(map: Map, eventSlug: string): Set | undefined { const entry = map.get(eventSlug); if (!entry) return undefined; if (entry.expiresAt <= Date.now()) { map.delete(eventSlug); return undefined; } return entry.ids; } export function isMeetingParticipantKicked(eventSlug: string, participantId: string, clientId?: string): boolean { return Boolean( activeList(kickedParticipantIds, eventSlug)?.has(participantId) || (clientId && activeList(kickedClientIds, eventSlug)?.has(clientId)), ); } export function markMeetingParticipantKicked(eventSlug: string, participantId: string, clientId?: string): void { const expiresAt = Date.now() + KICK_RETENTION_MS; const participantIds = activeList(kickedParticipantIds, eventSlug) ?? new Set(); participantIds.add(participantId); kickedParticipantIds.set(eventSlug, { ids: participantIds, expiresAt }); if (clientId) { const clientIds = activeList(kickedClientIds, eventSlug) ?? new Set(); clientIds.add(clientId); kickedClientIds.set(eventSlug, { ids: clientIds, expiresAt }); } }