/**
 * 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 insertIntoList_1;
var hasRequiredInsertIntoList;

function requireInsertIntoList () {
	if (hasRequiredInsertIntoList) return insertIntoList_1;
	hasRequiredInsertIntoList = 1;

	/**
	 * Maintain persistence for target list when appending and prepending.
	 */
	function insertIntoList(targetListArg, toInsert, offset) {
	  var targetList = targetListArg;

	  if (offset === targetList.count()) {
	    toInsert.forEach(function (c) {
	      targetList = targetList.push(c);
	    });
	  } else if (offset === 0) {
	    toInsert.reverse().forEach(function (c) {
	      targetList = targetList.unshift(c);
	    });
	  } else {
	    var head = targetList.slice(0, offset);
	    var tail = targetList.slice(offset);
	    targetList = head.concat(toInsert, tail).toList();
	  }

	  return targetList;
	}

	insertIntoList_1 = insertIntoList;
	return insertIntoList_1;
}

export { requireInsertIntoList as __require };
//# sourceMappingURL=insertIntoList.js.map
