export var command = {
  name: 'moveCellSelectionDownByViewportHeight',
  callback: function callback(hot) {
    var _hot$getSettings = hot.getSettings(),
      navigableHeaders = _hot$getSettings.navigableHeaders;
    var columnHeadersCount = navigableHeaders ? hot.countColHeaders() : 0;
    var row = hot.getSelectedRangeLast().highlight.row;
    var rowsStep = hot.countVisibleRows() + columnHeadersCount;

    // if the last row is currently selected move the focus to the first row (if autoWrap is enabled)
    if (row === hot.countRows() - 1) {
      rowsStep = 1;

      // if the next move would move the focus off the table calculate the delta to move the selection to
      // the last row
    } else if (row + rowsStep > hot.countRows()) {
      rowsStep = hot.countRows() - row - 1;
    }
    hot.selection.transformStart(rowsStep, 0);
    if (hot.getSelectedRangeLast().highlight.row < 0) {
      hot.scrollViewportTo(0);
    }
  }
};