import { isListItemNode, isListNode } from '../utils';
export var countListItemsInSelection = function countListItemsInSelection(tr) {
  var _tr$selection = tr.selection,
    from = _tr$selection.from,
    to = _tr$selection.to;
  if (from === to) {
    return 1;
  }
  var count = 0;
  var listSlice = tr.doc.cut(from, to);
  listSlice.content.nodesBetween(0, listSlice.content.size, function (node, pos, parent, index) {
    if (parent && isListItemNode(parent) && !isListNode(node) && index === 0) {
      count++;
    }
  });
  return count;
};