define(["require", "exports"], function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    /**
     * This task refreshes the position of the validation error markers on the
     * screen.
     */
    class RefreshValidationErrors {
        constructor(controller) {
            this.controller = controller;
            this.errors = [];
            this.resumeAt = 0;
        }
        reset() {
            this.errors = this.controller.copyErrorList();
            this.resumeAt = 0;
        }
        cycle() {
            let ix = this.resumeAt;
            // The figure of 20 is arbitrary.
            const thisMax = Math.min(this.errors.length, this.resumeAt + 20);
            const errors = this.errors;
            while (ix < thisMax) {
                const error = errors[ix];
                // We work only on those that already have a marker.
                if (error.marker != null) {
                    this.controller.processError(error);
                }
                ix++;
            }
            this.resumeAt = ix;
            return ix < errors.length;
        }
    }
    exports.RefreshValidationErrors = RefreshValidationErrors;
});
//  LocalWords:  MPL
//# sourceMappingURL=refresh-validation-errors.js.map