// #region Imports
// #endregion
/**
 * Regular expression for validating email addresses according to typical email standards.
 * This regex enforces constraints on both the local and domain parts of the email.
 *
 * - The entire email length is constrained to 1-254 characters, per the maximum allowed.
 * - The local part (before the `@` symbol) can contain:
 *   - Alphanumeric characters.
 *   - Special characters such as `!#$%&'*+/=?^_`{|}~-`.
 *   - Dots (.) between characters, but dots cannot be consecutive or at the beginning/end.
 * - The domain part (after the `@` symbol) must:
 *   - Begin and end with an alphanumeric character.
 *   - Allow alphanumeric characters and hyphens (-) within each subdomain label.
 *   - Allow multiple subdomains separated by dots, with each subdomain label up to 63 characters.
 *
 * This regex does not match every edge case in the email standards (like quoted strings),
 * but is suitable for most typical email validation needs.
 */
const EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
/**
 * Validator that requires the control's value pass an email validation test.
 *
 * State:
 * * patternMismatch
 *
 * @public
 * @param element
 * @returns null if the validation check passes, otherwise an object containing information.
 */
export function emailValidator(element) {
    return isEmailValue(element.value)
        ? null
        : { patternMismatch: true };
}
/**
 * Checks if the value is a valid email address.
 *
 * @param value - The value to check.
 * @returns True if the value is a valid email address, false otherwise.
 */
export function isEmailValue(value) {
    return typeof value === 'string' && EMAIL_REGEXP.test(value);
}
//# sourceMappingURL=EmailElementValidatorFn.js.map