// one-session-per-account: a newer sign-in of the same account ended this browser's session. The server leaves this // short-lived marker (not httpOnly: it holds no secret, only "1") so the login page can say why the person is there. // Host-only, like the session cookie. export const SIGNED_IN_ELSEWHERE_COOKIE = "__Host-bb_signed_in_elsewhere"; /** Whether a `document.cookie` string carries the marker. */ export function signedInElsewhere(cookieHeader: string): boolean { return cookieHeader .split(";") .map(part => part.trim()) .some(part => part.startsWith(`${SIGNED_IN_ELSEWHERE_COOKIE}=`) && part.length > SIGNED_IN_ELSEWHERE_COOKIE.length + 1); }