import * as z from 'zod';
export const firstErrors = (error: z.ZodError) =>
Object.fromEntries(
Object.entries(z.flattenError(error).fieldErrors).map(([field, messages]) => [field, (messages as string[])[0]])
) as Record<string, string>;
export const email = z.email('Enter an email address like you@company.com').trim().toLowerCase();
// Mirrors the server's lists: a handle may not be a top-level page, and a repository may not be an owner page.
export const reservedHandles = ['about', 'account', 'admin', 'api', 'assets', 'benchmarks', 'caissons', 'contact', 'demo', 'explore', 'forgot-password', 'help', 'login', 'logout', 'migrate', 'new', 'platform', 'reset-password', 'search', 'settings', 'sign-in', 'sign-out', 'sign-up', 'static'];
export const reservedRepoNames = ['caissons', 'inbox', 'llms.txt', 'migration', 'repositories', 'settings'];