const Validator = { checks: [], warnings: [], errors: [], _timeout: null, validate(trigger) { if (this._timeout) { clearTimeout(this._timeout); this._timeout = null; } if (!Project) return; this._timeout = setTimeout(() => { this._timeout = null; Validator.warnings.empty(); Validator.errors.empty(); Validator.checks.forEach(check => { try { if (!Condition(check.condition)) return; if (!trigger || check.update_triggers.includes(trigger)) { check.update(); } Validator.warnings.push(...check.warnings); Validator.errors.push(...check.errors); } catch (error) { console.error(error); } }) }, 400) }, openDialog() { if (!Validator.dialog) { Validator.dialog = new Dialog({ id: 'validator', title: 'action.validator_window', singleButton: true, width: 800, component: { data() {return { warnings: Validator.warnings, errors: Validator.errors, }}, computed: { problems() { this.errors.forEach(error => error.error = true); return [...this.errors, ...this.warnings] } }, methods: { getIconNode: Blockbench.getIconNode, marked }, template: `