/** URL-safe username: letters, digits, and . _ - @ + */
export const USERNAME_PATTERN = /^[A-Za-z0-9._@+-]+$/;
export const USERNAME_MAX_LENGTH = 64;
export const USERNAME_HINT =
  'Letters, numbers, and . _ - @ + (uppercase and lowercase allowed)';

export function normalizeUsernameInput(value: string): string {
  return value.replace(/[^A-Za-z0-9._@+-]/g, '').slice(0, USERNAME_MAX_LENGTH);
}
