import { appConfig, type VibeId, type VibePreset } from './config'; import { readBrowserStorage } from './utils/browser-storage'; export { VibeId } from './config'; export type { VibePreset } from './config'; export const VIBE_PRESETS: Array = appConfig.vibes.presets; const VIBE_IDS = new Set(VIBE_PRESETS.map((vibe) => vibe.id)); const isVibeId = (value: unknown): value is VibeId => typeof value === 'string' && VIBE_IDS.has(value as VibeId); export const getInitialVibe = (): VibePreset => { const storedVibeId = readBrowserStorage(appConfig.storage.vibeKey); const initialVibeId = isVibeId(storedVibeId) ? storedVibeId : appConfig.vibes.defaultVibeId; return VIBE_PRESETS.find((vibe) => vibe.id === initialVibeId) ?? VIBE_PRESETS[0]; };