// Per-viewer UI preferences (theme, sidebar). Storage can be unavailable in // private windows, so every access is guarded and falls back to the default. export const readPreference = (key: string): string | null => { try { return window.localStorage.getItem(key); } catch { return null; } }; export const writePreference = (key: string, value: string) => { try { window.localStorage.setItem(key, value); } catch { // Preference simply isn't remembered. } };