// A position can travel in the URL as ?fen=... so a game or puzzle is shareable // without any account or server. export function fenFromUrl(): string | null { const params = new URLSearchParams(location.search); const fen = params.get("fen"); return fen ? decodeURIComponent(fen) : null; } export function routeFromUrl(): string { const hash = location.hash.replace(/^#\/?/, ""); return hash || "home"; } export function goto(route: string) { location.hash = `/${route}`; }