<commit_before>import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.model'

export const USER_USERNAME_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required,
    Validators.minLength(1),
    Validators.maxLength(50),
    Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
  ],
  MESSAGES: {
    'required': $localize`Username is required.`,
    'minlength': $localize`Username must be at least 1 character long.`,
    'maxlength': $localize`Username cannot be more than 50 characters long.`,
    'pattern': $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.`
  }
}

export const USER_CHANNEL_NAME_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required,
    Validators.minLength(1),
    Validators.maxLength(50),
    Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
  ],
  MESSAGES: {
    'required': $localize`Channel name is required.`,
    'minlength': $localize`Channel name must be at least 1 character long.`,
    'maxlength': $localize`Channel name cannot be more than 50 characters long.`,
    'pattern': $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.`
  }
}

export const USER_EMAIL_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [ Validators.required, Validators.email ],
  MESSAGES: {
    'required': $localize`Email is required.`,
    'email': $localize`Email must be valid.`
  }
}

export const USER_HANDLE_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required,
    Validators.pattern(/@.+/)
  ],
  MESSAGES: {
    'required': $localize`Handle is required.`,
    'pattern': $localize`Handle must be valid (<EMAIL>).`
  }
}

export const USER_EXISTING_PASSWORD_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required
  ],
  MESSAGES: {
    'required': $localize`Password is required.`
  }
}

export const USER_PASSWORD_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required,
    Validators.minLength(6),
    Validators.maxLength(255)
  ],
  MESSAGES: {
    'required': $localize`Password is required.`,
    'minlength': $localize`Password must be at least 6 characters long.`,
    'maxlength': $localize`Password cannot be more than 255 characters long.`
  }
}

export const USER_PASSWORD_OPTIONAL_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.minLength(6),
    Validators.maxLength(255)
  ],<commit_msg>Improve validator text, I guess<commit_after>import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.model'

export const USER_USERNAME_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required,
    Validators.minLength(1),
    Validators.maxLength(50),
    Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
  ],
  MESSAGES: {
    'required': $localize`Username is required.`,
    'minlength': $localize`Username must be at least 1 character long.`,
    'maxlength': $localize`Username cannot be more than 50 characters long.`,
    'pattern': $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.`
  }
}

export const USER_CHANNEL_NAME_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required,
    Validators.minLength(1),
    Validators.maxLength(50),
    Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
  ],
  MESSAGES: {
    'required': $localize`Channel name is required.`,
    'minlength': $localize`Channel name must be at least 1 character long.`,
    'maxlength': $localize`Channel name cannot be more than 50 characters long.`,
    'pattern': $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.`
  }
}

export const USER_EMAIL_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [ Validators.required, Validators.email ],
  MESSAGES: {
    'required': $localize`Email is required.`,
    'email': $localize`Email must be valid.`
  }
}

export const USER_HANDLE_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required,
    Validators.pattern(/@.+/)
  ],
  MESSAGES: {
    'required': $localize`Handle is required.`,
    'pattern': $localize`Handle must be valid (eg. <EMAIL>).`
  }
}

export const USER_EXISTING_PASSWORD_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required
  ],
  MESSAGES: {
    'required': $localize`Password is required.`
  }
}

export const USER_PASSWORD_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.required,
    Validators.minLength(6),
    Validators.maxLength(255)
  ],
  MESSAGES: {
    'required': $localize`Password is required.`,
    'minlength': $localize`Password must be at least 6 characters long.`,
    'maxlength': $localize`Password cannot be more than 255 characters long.`
  }
}

export const USER_PASSWORD_OPTIONAL_VALIDATOR: BuildFormValidator = {
  VALIDATORS: [
    Validators.minLength(6),
    Validators.maxLength(255)
  ],
{'fraction_non_alphanumeric': 0.12282828282828283, 'fraction_numerical': 0.01292929292929293, 'mean_word_length': 4.173458725182863, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '976993', 'n_tokens_mistral': 1661, 'n_tokens_neox': 1580, 'n_words': 381}