"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get AutoRowSize () {
        return AutoRowSize;
    },
    get PLUGIN_KEY () {
        return PLUGIN_KEY;
    },
    get PLUGIN_PRIORITY () {
        return PLUGIN_PRIORITY;
    }
});
const _base = require("../base");
const _feature = require("../../helpers/feature");
const _ghostTable = /*#__PURE__*/ _interop_require_default(require("../../utils/ghostTable"));
const _object = require("../../helpers/object");
const _number = require("../../helpers/number");
const _samplesGenerator = /*#__PURE__*/ _interop_require_default(require("../../utils/samplesGenerator"));
const _string = require("../../helpers/string");
const _translations = require("../../translations");
const _element = require("../../helpers/dom/element");
function _check_private_redeclaration(obj, privateCollection) {
    if (privateCollection.has(obj)) {
        throw new TypeError("Cannot initialize the same private elements twice on an object");
    }
}
function _class_apply_descriptor_get(receiver, descriptor) {
    if (descriptor.get) {
        return descriptor.get.call(receiver);
    }
    return descriptor.value;
}
function _class_apply_descriptor_set(receiver, descriptor, value) {
    if (descriptor.set) {
        descriptor.set.call(receiver, value);
    } else {
        if (!descriptor.writable) {
            throw new TypeError("attempted to set read only private field");
        }
        descriptor.value = value;
    }
}
function _class_extract_field_descriptor(receiver, privateMap, action) {
    if (!privateMap.has(receiver)) {
        throw new TypeError("attempted to " + action + " private field on non-instance");
    }
    return privateMap.get(receiver);
}
function _class_private_field_get(receiver, privateMap) {
    var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
    return _class_apply_descriptor_get(receiver, descriptor);
}
function _class_private_field_init(obj, privateMap, value) {
    _check_private_redeclaration(obj, privateMap);
    privateMap.set(obj, value);
}
function _class_private_field_set(receiver, privateMap, value) {
    var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
    _class_apply_descriptor_set(receiver, descriptor, value);
    return value;
}
function _class_private_method_get(receiver, privateSet, fn) {
    if (!privateSet.has(receiver)) {
        throw new TypeError("attempted to get private field on non-instance");
    }
    return fn;
}
function _class_private_method_init(obj, privateSet) {
    _check_private_redeclaration(obj, privateSet);
    privateSet.add(obj);
}
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
const PLUGIN_KEY = 'autoRowSize';
const PLUGIN_PRIORITY = 40;
const ROW_WIDTHS_MAP_NAME = 'autoRowSize';
const FIRST_COLUMN_NOT_RENDERED_CLASS_NAME = 'htFirstDatasetColumnNotRendered';
const AUTO_ROW_SIZE_CLASS_NAME = 'htAutoRowSize';
var /**
   * An array of row indexes whose height will be recalculated.
   *
   * @type {number[]}
   */ _visualRowsToRefresh = /*#__PURE__*/ new WeakMap(), /**
   * Disposer function for the row heights map observer. Called on disable to clean up.
   *
   * @type {Function|null}
   */ _disposeMapObserver = /*#__PURE__*/ new WeakMap(), /**
   * `true` value indicates that the #onInit() function has been already called.
   *
   * @type {boolean}
   */ _isInitialized = /*#__PURE__*/ new WeakMap(), /**
   * Calculates specific rows height (overwrite cache values).
   *
   * @param {number[]} visualRows List of visual rows to calculate.
   */ _calculateSpecificRowsHeight = /*#__PURE__*/ new WeakSet(), /**
   * Toggles the "first dataset column not rendered" class name.
   * Used to apply special styling when the first column is visible (used only in the classic (legacy) theme, with the AutoRowSize plugin enabled).
   *
   * @param {boolean} [forceState] Force the class to be added or removed (`true` to add, `false` to remove).
   */ _toggleFirstDatasetColumnRenderedClassName = /*#__PURE__*/ new WeakSet(), /**
   * `beforeViewRender` hook listener.
   */ _onBeforeViewRender = /*#__PURE__*/ new WeakSet(), /**
   * `beforeRender` hook listener.
   */ _onBeforeRender = /*#__PURE__*/ new WeakSet(), /**
   * On before row resize listener.
   *
   * @param {number} size The size of the current row index.
   * @param {number} row Current row index.
   * @param {boolean} isDblClick Indicates if the resize was triggered by doubleclick.
   * @returns {number}
   */ _onBeforeRowResize = /*#__PURE__*/ new WeakSet(), /**
   * On after load data listener.
   *
   * @param {Array} sourceData Source data.
   * @param {boolean} isFirstLoad `true` if this is the first load.
   */ _onAfterLoadData = /*#__PURE__*/ new WeakSet(), /**
   * On before change listener.
   *
   * @param {Array} changes 2D array containing information about each of the edited cells.
   */ _onBeforeChange = /*#__PURE__*/ new WeakSet(), /**
   * On after Handsontable init plugin with all necessary values.
   */ _onInit = /*#__PURE__*/ new WeakSet(), /**
   * After formulas values updated listener.
   *
   * @param {Array} changes An array of modified data.
   */ _onAfterFormulasValuesUpdate = /*#__PURE__*/ new WeakSet();
class AutoRowSize extends _base.BasePlugin {
    static get PLUGIN_KEY() {
        return PLUGIN_KEY;
    }
    static get PLUGIN_PRIORITY() {
        return PLUGIN_PRIORITY;
    }
    static get SETTING_KEYS() {
        return true;
    }
    static get DEFAULT_SETTINGS() {
        return {
            useHeaders: true,
            samplingRatio: null,
            allowSampleDuplicates: false
        };
    }
    static get CALCULATION_STEP() {
        return 50;
    }
    static get SYNC_CALCULATION_LIMIT() {
        return 500;
    }
    /**
   * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
   * hook and if it returns `true` then the {@link AutoRowSize#enablePlugin} method is called.
   *
   * @returns {boolean}
   */ isEnabled() {
        const settings = this.hot.getSettings()[PLUGIN_KEY];
        return settings === true || (0, _object.isObject)(settings);
    }
    /**
   * Enables the plugin functionality for this Handsontable instance.
   */ enablePlugin() {
        if (this.enabled) {
            return;
        }
        this.samplesGenerator.setAllowDuplicates(this.getSetting('allowSampleDuplicates'));
        const samplingRatio = this.getSetting('samplingRatio');
        if (samplingRatio && !isNaN(samplingRatio)) {
            this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
        }
        this.addHook('afterLoadData', (...args)=>_class_private_method_get(this, _onAfterLoadData, onAfterLoadData).call(this, ...args));
        this.addHook('beforeChangeRender', (...args)=>_class_private_method_get(this, _onBeforeChange, onBeforeChange).call(this, ...args));
        this.addHook('beforeColumnResize', ()=>this.recalculateAllRowsHeight());
        this.addHook('afterFormulasValuesUpdate', (...args)=>_class_private_method_get(this, _onAfterFormulasValuesUpdate, onAfterFormulasValuesUpdate).call(this, ...args));
        this.addHook('beforeViewRender', ()=>_class_private_method_get(this, _onBeforeViewRender, onBeforeViewRender).call(this));
        this.addHook('beforeRender', ()=>_class_private_method_get(this, _onBeforeRender, onBeforeRender).call(this));
        this.addHook('modifyRowHeight', (height, row)=>this.getRowHeight(row, height));
        this.addHook('init', ()=>_class_private_method_get(this, _onInit, onInit).call(this));
        this.addHook('modifyColumnHeaderHeight', ()=>this.getColumnHeaderHeight());
        _class_private_field_set(this, _disposeMapObserver, this.hot.rowIndexMapper.observeMapChange(this.rowHeightsMap, ()=>{
            this.hot.view?.invalidateRowHeightCache();
        }));
        (0, _element.addClass)(this.hot.rootElement, AUTO_ROW_SIZE_CLASS_NAME);
        super.enablePlugin();
    }
    /**
   * Disables the plugin functionality for this Handsontable instance.
   */ disablePlugin() {
        if (_class_private_field_get(this, _disposeMapObserver)) {
            _class_private_field_get(this, _disposeMapObserver).call(this);
            _class_private_field_set(this, _disposeMapObserver, null);
        }
        this.headerHeight = null;
        (0, _element.removeClass)(this.hot.rootElement, AUTO_ROW_SIZE_CLASS_NAME);
        super.disablePlugin();
        // Remove the "first dataset column not rendered" class name when the plugin is disabled.
        _class_private_method_get(this, _toggleFirstDatasetColumnRenderedClassName, toggleFirstDatasetColumnRenderedClassName).call(this, false);
        // Leave the listener active to allow auto-sizing the rows when the plugin is disabled.
        // This is necessary for height recalculation for resize handler doubleclick (ManualRowResize).
        this.addHook('beforeRowResize', (size, row, isDblClick)=>_class_private_method_get(this, _onBeforeRowResize, onBeforeRowResize).call(this, size, row, isDblClick));
    }
    /**
   * Calculates heights for visible rows in the viewport only.
   */ calculateVisibleRowsHeight() {
        // Keep last row heights unchanged for situation when all columns was deleted or trimmed
        if (!this.hot.countCols()) {
            return;
        }
        const firstVisibleRow = this.getFirstVisibleRow();
        const lastVisibleRow = this.getLastVisibleRow();
        if (firstVisibleRow === -1 || lastVisibleRow === -1) {
            return;
        }
        const overwriteCache = this.hot.forceFullRender;
        this.calculateRowsHeight({
            from: firstVisibleRow,
            to: lastVisibleRow
        }, undefined, overwriteCache);
    }
    /**
   * Calculate a given rows height.
   *
   * @param {number|object} rowRange Row index or an object with `from` and `to` indexes as a range.
   * @param {number|object} colRange Column index or an object with `from` and `to` indexes as a range.
   * @param {boolean} [overwriteCache=false] If `true` the calculation will be processed regardless of whether the width exists in the cache.
   */ calculateRowsHeight(rowRange = {
        from: 0,
        to: this.hot.countRows() - 1
    }, colRange = {
        from: 0,
        to: this.hot.countCols() - 1
    }, overwriteCache = false) {
        const rowsRange = typeof rowRange === 'number' ? {
            from: rowRange,
            to: rowRange
        } : rowRange;
        const columnsRange = typeof colRange === 'number' ? {
            from: colRange,
            to: colRange
        } : colRange;
        if (this.hot.getColHeader(0) !== null) {
            const samples = this.samplesGenerator.generateRowSamples(-1, columnsRange);
            this.ghostTable.addColumnHeadersRow(samples.get(-1));
        }
        (0, _number.rangeEach)(rowsRange.from, rowsRange.to, (visualRow)=>{
            let physicalRow = this.hot.toPhysicalRow(visualRow);
            if (physicalRow === null) {
                physicalRow = visualRow;
            }
            // For rows we must calculate row height even when user had set height value manually.
            // We can shrink column but cannot shrink rows!
            if (overwriteCache || this.rowHeightsMap.getValueAtIndex(physicalRow) === null) {
                const samples = this.samplesGenerator.generateRowSamples(visualRow, columnsRange);
                samples.forEach((sample, row)=>this.ghostTable.addRow(row, sample));
            }
        });
        if (this.ghostTable.rows.length) {
            this.hot.batchExecution(()=>{
                this.ghostTable.getHeights((row, height)=>{
                    if (row < 0) {
                        this.headerHeight = height;
                    } else {
                        this.rowHeightsMap.setValueAtIndex(this.hot.toPhysicalRow(row), height);
                    }
                });
            }, true);
            this.measuredRows = rowsRange.to + 1;
            this.ghostTable.clean();
        }
    }
    /**
   * Calculate all rows heights. The calculated row will be cached in the {@link AutoRowSize#heights} property.
   * To retrieve height for specified row use {@link AutoRowSize#getRowHeight} method.
   *
   * @param {object|number} colRange Row index or an object with `from` and `to` properties which define row range.
   * @param {boolean} [overwriteCache] If `true` the calculation will be processed regardless of whether the width exists in the cache.
   */ calculateAllRowsHeight(colRange = {
        from: 0,
        to: this.hot.countCols() - 1
    }, overwriteCache = false) {
        let current = 0;
        const length = this.hot.countRows() - 1;
        let timer = null;
        this.inProgress = true;
        const loop = ()=>{
            // When hot was destroyed after calculating finished cancel frame
            if (!this.hot) {
                (0, _feature.cancelAnimationFrame)(timer);
                this.inProgress = false;
                return;
            }
            this.calculateRowsHeight({
                from: current,
                to: Math.min(current + AutoRowSize.CALCULATION_STEP, length)
            }, colRange, overwriteCache);
            current = current + AutoRowSize.CALCULATION_STEP + 1;
            if (current < length) {
                timer = (0, _feature.requestAnimationFrame)(loop);
            } else {
                (0, _feature.cancelAnimationFrame)(timer);
                this.inProgress = false;
                // @TODO Should call once per render cycle, currently fired separately in different plugins
                this.hot.view.adjustElementsSize();
            }
        };
        const syncLimit = this.getSyncCalculationLimit();
        // sync
        if (syncLimit >= 0) {
            this.calculateRowsHeight({
                from: 0,
                to: syncLimit
            }, colRange, overwriteCache);
            current = syncLimit + 1;
        }
        // async
        if (current < length) {
            loop();
        } else {
            this.inProgress = false;
            this.hot.view.adjustElementsSize();
        }
    }
    /**
   * Recalculates all rows height (overwrite cache values).
   */ recalculateAllRowsHeight() {
        if (this.hot.view.isVisible()) {
            this.calculateAllRowsHeight({
                from: 0,
                to: this.hot.countCols() - 1
            }, true);
        }
    }
    /**
   * Gets value which tells how many rows should be calculated synchronously (rest of the rows will be calculated
   * asynchronously). The limit is calculated based on `syncLimit` set to autoRowSize option (see {@link Options#autoRowSize}).
   *
   * @returns {number}
   */ getSyncCalculationLimit() {
        const settings = this.hot.getSettings()[PLUGIN_KEY];
        /* eslint-disable no-bitwise */ let limit = AutoRowSize.SYNC_CALCULATION_LIMIT;
        const rowsLimit = this.hot.countRows() - 1;
        if ((0, _object.isObject)(settings)) {
            limit = settings.syncLimit;
            if ((0, _string.isPercentValue)(limit)) {
                limit = (0, _number.valueAccordingPercent)(rowsLimit, limit);
            } else {
                // Force to Number
                limit >>= 0;
            }
        }
        return Math.min(limit, rowsLimit);
    }
    /**
   * Get a row's height, as measured in the DOM.
   *
   * The height returned includes 1 px of the row's bottom border.
   *
   * Mind that this method is different from the
   * [`getRowHeight()`](@/api/core.md#getrowheight) method
   * of Handsontable's [Core](@/api/core.md).
   *
   * @param {number} row A visual row index.
   * @param {number} [defaultHeight] If no height is found, `defaultHeight` is returned instead.
   * @returns {number} The height of the specified row, in pixels.
   */ getRowHeight(row, defaultHeight = this.hot.stylesHandler.getDefaultRowHeight(row)) {
        if (row < 0) {
            return this.headerHeight ?? defaultHeight;
        }
        const physicalRow = this.hot.toPhysicalRow(row);
        if (this.hot.rowIndexMapper.isHidden(physicalRow)) {
            return defaultHeight;
        }
        const cachedHeight = this.rowHeightsMap.getValueAtIndex(physicalRow);
        let height = defaultHeight;
        if (cachedHeight !== null && cachedHeight > defaultHeight) {
            height = cachedHeight;
            if (row === this.hot.view.getFirstRenderedVisibleRow()) {
                // add 1px border-top-width compensation for the first rendered row
                height += 1;
            }
        }
        return height;
    }
    /**
   * Get the calculated column header height.
   *
   * @returns {number|undefined}
   */ getColumnHeaderHeight() {
        return this.headerHeight;
    }
    /**
   * Get the first visible row.
   *
   * @returns {number} Returns row index, -1 if table is not rendered or if there are no rows to base the the calculations on.
   */ getFirstVisibleRow() {
        return this.hot.getFirstRenderedVisibleRow() ?? -1;
    }
    /**
   * Gets the last visible row.
   *
   * @returns {number} Returns row index or -1 if table is not rendered.
   */ getLastVisibleRow() {
        return this.hot.getLastRenderedVisibleRow() ?? -1;
    }
    /**
   * Clears cache of calculated row heights. If you want to clear only selected rows pass an array with their indexes.
   * Otherwise whole cache will be cleared.
   *
   * @param {number[]} [physicalRows] List of physical row indexes to clear.
   */ clearCache(physicalRows) {
        this.headerHeight = null;
        if (Array.isArray(physicalRows)) {
            this.hot.batchExecution(()=>{
                physicalRows.forEach((physicalIndex)=>{
                    this.rowHeightsMap.setValueAtIndex(physicalIndex, null);
                });
            }, true);
        } else {
            this.rowHeightsMap.clear();
        }
    }
    /**
   * Clears cache by range.
   *
   * @param {object|number} range Row index or an object with `from` and `to` properties which define row range.
   */ clearCacheByRange(range) {
        const { from, to } = typeof range === 'number' ? {
            from: range,
            to: range
        } : range;
        this.hot.batchExecution(()=>{
            (0, _number.rangeEach)(Math.min(from, to), Math.max(from, to), (row)=>{
                this.rowHeightsMap.setValueAtIndex(row, null);
            });
        }, true);
    }
    /**
   * Checks if all heights were calculated. If not then return `true` (need recalculate).
   *
   * @returns {boolean}
   */ isNeedRecalculate() {
        return !!this.rowHeightsMap.getValues().slice(0, this.measuredRows).filter((item)=>item === null).length;
    }
    /**
   * Destroys the plugin instance.
   */ destroy() {
        this.ghostTable.clean();
        super.destroy();
    }
    constructor(hotInstance){
        super(hotInstance), _class_private_method_init(this, _calculateSpecificRowsHeight), _class_private_method_init(this, _toggleFirstDatasetColumnRenderedClassName), _class_private_method_init(this, _onBeforeViewRender), _class_private_method_init(this, _onBeforeRender), _class_private_method_init(this, _onBeforeRowResize), _class_private_method_init(this, _onAfterLoadData), _class_private_method_init(this, _onBeforeChange), _class_private_method_init(this, _onInit), _class_private_method_init(this, _onAfterFormulasValuesUpdate), _class_private_field_init(this, _visualRowsToRefresh, {
            writable: true,
            value: void 0
        }), _class_private_field_init(this, _disposeMapObserver, {
            writable: true,
            value: void 0
        }), _class_private_field_init(this, _isInitialized, {
            writable: true,
            value: void 0
        }), /**
   * Columns header's height cache.
   *
   * @private
   * @type {number}
   */ this.headerHeight = null, /**
   * Instance of {@link GhostTable} for rows and columns size calculations.
   *
   * @private
   * @type {GhostTable}
   */ this.ghostTable = new _ghostTable.default(this.hot), /**
   * Instance of {@link SamplesGenerator} for generating samples necessary for rows height calculations.
   *
   * @private
   * @type {SamplesGenerator}
   */ this.samplesGenerator = new _samplesGenerator.default((row, column)=>{
            const physicalColumn = this.hot.toPhysicalColumn(column);
            if (this.hot.columnIndexMapper.isHidden(physicalColumn)) {
                return false;
            }
            let cellMeta;
            if (row >= 0 && column >= 0) {
                cellMeta = this.hot.getCellMeta(row, column);
                if (cellMeta.hidden) {
                    // do not generate samples for cells that are covered by merged cell (null values)
                    return false;
                }
            }
            let cellValue;
            if (row >= 0) {
                cellValue = this.hot.getDataAtCell(row, column);
                if (typeof cellMeta?.valueFormatter === 'function') {
                    cellValue = cellMeta.valueFormatter(cellValue, cellMeta);
                }
            } else if (row === -1) {
                cellValue = this.hot.getColHeader(column);
            }
            return {
                value: cellValue
            };
        }), /**
   * `true` if the size calculation is in progress.
   *
   * @type {boolean}
   */ this.inProgress = false, /**
   * Number of already measured rows (we already know their sizes).
   *
   * @type {number}
   */ this.measuredRows = 0, /**
   * PhysicalIndexToValueMap to keep and track heights for physical row indexes.
   *
   * @private
   * @type {PhysicalIndexToValueMap}
   */ this.rowHeightsMap = new _translations.PhysicalIndexToValueMap(), _class_private_field_set(this, _visualRowsToRefresh, []), _class_private_field_set(this, _disposeMapObserver, null), _class_private_field_set(this, _isInitialized, false);
        this.hot.rowIndexMapper.registerMap(ROW_WIDTHS_MAP_NAME, this.rowHeightsMap);
        // Leave the listener active to allow auto-sizing the rows when the plugin is disabled.
        // This is necessary for height recalculation for resize handler doubleclick (ManualRowResize).
        this.addHook('beforeRowResize', (size, row, isDblClick)=>_class_private_method_get(this, _onBeforeRowResize, onBeforeRowResize).call(this, size, row, isDblClick));
    }
}
function calculateSpecificRowsHeight(visualRows) {
    const columnsRange = {
        from: 0,
        to: this.hot.countCols() - 1
    };
    visualRows.forEach((visualRow)=>{
        // For rows we must calculate row height even when user had set height value manually.
        // We can shrink column but cannot shrink rows!
        const samples = this.samplesGenerator.generateRowSamples(visualRow, columnsRange);
        samples.forEach((sample, row)=>this.ghostTable.addRow(row, sample));
    });
    if (this.ghostTable.rows.length) {
        this.hot.batchExecution(()=>{
            this.ghostTable.getHeights((visualRow, height)=>{
                const physicalRow = this.hot.toPhysicalRow(visualRow);
                this.rowHeightsMap.setValueAtIndex(physicalRow, height);
            });
        }, true);
        this.ghostTable.clean();
    }
}
function toggleFirstDatasetColumnRenderedClassName(forceState) {
    const firstRenderedColumnVisualIndex = this.hot.getFirstRenderedVisibleColumn();
    const firstRenderedColumnPhysicalIndex = this.hot.columnIndexMapper.getPhysicalFromVisualIndex(firstRenderedColumnVisualIndex);
    if (forceState === false || firstRenderedColumnPhysicalIndex === this.hot.columnIndexMapper.getPhysicalFromRenderableIndex(0)) {
        (0, _element.removeClass)(this.hot.rootElement, FIRST_COLUMN_NOT_RENDERED_CLASS_NAME);
    } else {
        (0, _element.addClass)(this.hot.rootElement, FIRST_COLUMN_NOT_RENDERED_CLASS_NAME);
    }
}
function onBeforeViewRender() {
    _class_private_method_get(this, _toggleFirstDatasetColumnRenderedClassName, toggleFirstDatasetColumnRenderedClassName).call(this);
}
function onBeforeRender() {
    this.calculateVisibleRowsHeight();
    if (!this.inProgress) {
        _class_private_method_get(this, _calculateSpecificRowsHeight, calculateSpecificRowsHeight).call(this, _class_private_field_get(this, _visualRowsToRefresh));
        _class_private_field_set(this, _visualRowsToRefresh, []);
    }
}
function onBeforeRowResize(size, row, isDblClick) {
    let newSize = size;
    if (isDblClick) {
        this.calculateRowsHeight(row, undefined, true);
        newSize = this.getRowHeight(row);
    }
    return newSize;
}
function onAfterLoadData(sourceData, isFirstLoad) {
    if (!isFirstLoad) {
        this.recalculateAllRowsHeight();
    }
}
function onBeforeChange(changes) {
    const changedRows = changes.reduce((acc, [row])=>{
        if (acc.indexOf(row) === -1) {
            acc.push(row);
        }
        return acc;
    }, []);
    _class_private_field_get(this, _visualRowsToRefresh).push(...changedRows);
}
function onInit() {
    this.recalculateAllRowsHeight();
    _class_private_field_set(this, _isInitialized, true);
}
function onAfterFormulasValuesUpdate(changes) {
    if (!_class_private_field_get(this, _isInitialized)) {
        return;
    }
    const formulasPlugin = this.hot.getPlugin('formulas');
    const sheetId = formulasPlugin?.sheetId;
    const changedRows = changes.reduce((acc, change)=>{
        if (sheetId !== null && sheetId !== undefined && change.address?.sheet !== sheetId) {
            return acc;
        }
        const physicalRow = change.address?.row;
        if (Number.isInteger(physicalRow)) {
            const visualRow = this.hot.toVisualRow(physicalRow);
            if (acc.indexOf(visualRow) === -1) {
                acc.push(visualRow);
            }
        }
        return acc;
    }, []);
    _class_private_field_get(this, _visualRowsToRefresh).push(...changedRows);
}
