import type { SubviewUrl } from "../lib/history"; // The sign-in card's sub-view type and its URL mirror, split out of Welcome so that file exports only // components (Fast Refresh). export type Mode = "signin" | "register" | "forgot" | "reset" | "resend"; // The card's sub-views are real history entries, so browser/mouse Back leaves one the way it leaves // any other page — they used to be plain state, and Back silently changed only the address bar. // "signin" is the root (no param) and "reset" is deliberately NOT mirrored: that view is only // reachable with the one-time token from the #reset fragment, so a bookmarked ?m=reset would open a // form that cannot submit. export const MODE_URL: SubviewUrl = { key: "m", encode: (m: Mode) => (m === "signin" || m === "reset" ? null : m), decode: (raw: string) => raw === "register" || raw === "forgot" || raw === "resend" ? (raw as Mode) : null, };