/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 * 
 * @emails oncall+draft_js
 */

var adjustBlockDepthForContentState_1;
var hasRequiredAdjustBlockDepthForContentState;

function requireAdjustBlockDepthForContentState () {
	if (hasRequiredAdjustBlockDepthForContentState) return adjustBlockDepthForContentState_1;
	hasRequiredAdjustBlockDepthForContentState = 1;

	function adjustBlockDepthForContentState(contentState, selectionState, adjustment, maxDepth) {
	  var startKey = selectionState.getStartKey();
	  var endKey = selectionState.getEndKey();
	  var blockMap = contentState.getBlockMap();
	  var blocks = blockMap.toSeq().skipUntil(function (_, k) {
	    return k === startKey;
	  }).takeUntil(function (_, k) {
	    return k === endKey;
	  }).concat([[endKey, blockMap.get(endKey)]]).map(function (block) {
	    var depth = block.getDepth() + adjustment;
	    depth = Math.max(0, Math.min(depth, maxDepth));
	    return block.set('depth', depth);
	  });
	  blockMap = blockMap.merge(blocks);
	  return contentState.merge({
	    blockMap: blockMap,
	    selectionBefore: selectionState,
	    selectionAfter: selectionState
	  });
	}

	adjustBlockDepthForContentState_1 = adjustBlockDepthForContentState;
	return adjustBlockDepthForContentState_1;
}

export { requireAdjustBlockDepthForContentState as __require };
//# sourceMappingURL=adjustBlockDepthForContentState.js.map
