"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "RenderedColumnsCalculationType", {
    enumerable: true,
    get: function() {
        return RenderedColumnsCalculationType;
    }
});
const _partiallyVisibleColumns = require("./partiallyVisibleColumns");
class RenderedColumnsCalculationType extends _partiallyVisibleColumns.PartiallyVisibleColumnsCalculationType {
    /**
   * Finalizes the calculation.
   *
   * @param {ViewportColumnsCalculator} viewportCalculator The viewport calculator object.
   */ finalize(viewportCalculator) {
        super.finalize(viewportCalculator);
        const { overrideFn, totalColumns, positionCache } = viewportCalculator;
        if (this.startColumn !== null && typeof overrideFn === 'function') {
            const startColumn = this.startColumn;
            const endColumn = this.endColumn;
            overrideFn(this);
            this.columnStartOffset = startColumn - this.startColumn;
            this.columnEndOffset = this.endColumn - endColumn;
        }
        if (this.startColumn < 0) {
            this.startColumn = 0;
        }
        this.startPosition = this.startColumn !== null ? positionCache.getOffset(this.startColumn) : null;
        if (totalColumns < this.endColumn) {
            this.endColumn = totalColumns - 1;
        }
        if (this.startColumn !== null) {
            this.count = this.endColumn - this.startColumn + 1;
        }
    }
    constructor(...args){
        super(...args), /**
   * The property holds the offset applied in the `overrideFn` function to the `startColumn` value.
   *
   * @type {number}
   */ this.columnStartOffset = 0, /**
   * The property holds the offset applied in the `overrideFn` function to the `endColumn` value.
   *
   * @type {number}
   */ this.columnEndOffset = 0;
    }
}
