import { __require as requireContentBlockNode } from './ContentBlockNode.js';

var getNextDelimiterBlockKey_1;
var hasRequiredGetNextDelimiterBlockKey;

function requireGetNextDelimiterBlockKey () {
	if (hasRequiredGetNextDelimiterBlockKey) return getNextDelimiterBlockKey_1;
	hasRequiredGetNextDelimiterBlockKey = 1;

	/**
	 * 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
	 *
	 * This is unstable and not part of the public API and should not be used by
	 * production systems. This file may be update/removed without notice.
	 */
	var ContentBlockNode = requireContentBlockNode();

	var getNextDelimiterBlockKey = function getNextDelimiterBlockKey(block, blockMap) {
	  var isExperimentalTreeBlock = block instanceof ContentBlockNode;

	  if (!isExperimentalTreeBlock) {
	    return null;
	  }

	  var nextSiblingKey = block.getNextSiblingKey();

	  if (nextSiblingKey) {
	    return nextSiblingKey;
	  }

	  var parent = block.getParentKey();

	  if (!parent) {
	    return null;
	  }

	  var nextNonDescendantBlock = blockMap.get(parent);

	  while (nextNonDescendantBlock && !nextNonDescendantBlock.getNextSiblingKey()) {
	    var parentKey = nextNonDescendantBlock.getParentKey();
	    nextNonDescendantBlock = parentKey ? blockMap.get(parentKey) : null;
	  }

	  if (!nextNonDescendantBlock) {
	    return null;
	  }

	  return nextNonDescendantBlock.getNextSiblingKey();
	};

	getNextDelimiterBlockKey_1 = getNextDelimiterBlockKey;
	return getNextDelimiterBlockKey_1;
}

export { requireGetNextDelimiterBlockKey as __require };
//# sourceMappingURL=getNextDelimiterBlockKey.js.map
