// #region Imports
import { ElementValidatorBase } from './Abstracts/ElementValidatorBase';
import { maxLengthValidator } from './MaxLengthElementValidatorFn';
/**
 * @public
 */
export class MaxLengthElementValidator extends ElementValidatorBase {
    // #region Ctor
    constructor(host, messageResolver) {
        super(host, messageResolver ?? ((params) => `The value must be less than or equal to ${params.maxLength} characters long.`));
    }
    // #endregion
    // #region Properties
    get attributes() {
        return ['maxlength', 'value'];
    }
    // #endregion
    // #region Methods
    validate() {
        const errors = maxLengthValidator(this.host);
        return this.getMessage(errors);
    }
}
/**
 * A factory function for the `MaxLengthElementValidator`.
 *
 * @public
 * @param resolver - A *optional* message resolver to get the error message that will be displayed. When not provided, a default message will be used.
 */
export function maxlengthElementValidator(resolver) {
    return (host) => {
        return new MaxLengthElementValidator(host, resolver);
    };
}
//# sourceMappingURL=MaxLengthElementValidator.js.map