"use strict";

exports.__esModule = true;
exports.command = void 0;
var command = {
  name: 'extendCellsSelectionUpByViewportHeight',
  callback: function callback(hot) {
    var _hot$getSelectedRange = hot.getSelectedRangeLast(),
      to = _hot$getSelectedRange.to;
    var nextRowIndexToSelect = Math.max(to.row - hot.countVisibleRows(), 0);
    var row = hot.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
    if (row !== null) {
      var coords = hot._createCellCoords(row, to.col);
      var scrollPadding = to.row - hot.view.getFirstFullyVisibleRow();
      var nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
      hot.selection.setRangeEnd(coords);
      hot.scrollViewportTo(nextVerticalScroll);
    }
  }
};
exports.command = command;