'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _commonjsHelpers = require('../../../../../../../../_virtual/_commonjsHelpers.js');
require('../../../../../../../../_virtual/mixin-base.js');
require('../../../../../../../../_virtual/preprocessor-mixin.js');
require('../../../../../../../../_virtual/mixin.js');
var mixinBase = require('./mixin-base.js');
var preprocessorMixin$1 = require('../position-tracking/preprocessor-mixin.js');
var mixin = require('../../utils/mixin.js');

'use strict';

const ErrorReportingMixinBase = mixinBase.mixinBase;
const PositionTrackingPreprocessorMixin = preprocessorMixin$1.preprocessorMixin;
const Mixin = mixin.mixin;

class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase {
    constructor(preprocessor, opts) {
        super(preprocessor, opts);

        this.posTracker = Mixin.install(preprocessor, PositionTrackingPreprocessorMixin);
        this.lastErrOffset = -1;
    }

    _reportError(code) {
        //NOTE: avoid reporting error twice on advance/retreat
        if (this.lastErrOffset !== this.posTracker.offset) {
            this.lastErrOffset = this.posTracker.offset;
            super._reportError(code);
        }
    }
}

var preprocessorMixin = ErrorReportingPreprocessorMixin;

var preprocessorMixin_default = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(preprocessorMixin);

exports.default = preprocessorMixin_default;
exports.preprocessorMixin = preprocessorMixin;
//# sourceMappingURL=preprocessor-mixin.js.map
