import { numberNestedLists } from './numberNestedLists';
export var hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) {
  var tr = _ref.tr,
    maxIndentation = _ref.maxIndentation;
  var initialIndentationLevel = numberNestedLists(tr.selection.$from);
  var currentIndentationLevel;
  var currentPos = tr.selection.$to.pos;
  do {
    var resolvedPos = tr.doc.resolve(currentPos);
    currentIndentationLevel = numberNestedLists(resolvedPos);
    if (currentIndentationLevel > maxIndentation) {
      return false;
    }
    currentPos++;
  } while (currentIndentationLevel >= initialIndentationLevel);
  return true;
};