import { __require as requireImmutable } from '../../../../immutable@3.7.6/node_modules/immutable/dist/immutable.js';

/**
 * 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 modifyBlockForContentState_1;
var hasRequiredModifyBlockForContentState;

function requireModifyBlockForContentState () {
	if (hasRequiredModifyBlockForContentState) return modifyBlockForContentState_1;
	hasRequiredModifyBlockForContentState = 1;

	var Immutable = requireImmutable();

	var Map = Immutable.Map;

	function modifyBlockForContentState(contentState, selectionState, operation) {
	  var startKey = selectionState.getStartKey();
	  var endKey = selectionState.getEndKey();
	  var blockMap = contentState.getBlockMap();
	  var newBlocks = blockMap.toSeq().skipUntil(function (_, k) {
	    return k === startKey;
	  }).takeUntil(function (_, k) {
	    return k === endKey;
	  }).concat(Map([[endKey, blockMap.get(endKey)]])).map(operation);
	  return contentState.merge({
	    blockMap: blockMap.merge(newBlocks),
	    selectionBefore: selectionState,
	    selectionAfter: selectionState
	  });
	}

	modifyBlockForContentState_1 = modifyBlockForContentState;
	return modifyBlockForContentState_1;
}

export { requireModifyBlockForContentState as __require };
//# sourceMappingURL=modifyBlockForContentState.js.map
