. If we allow subsequent keypresses to insert characters\n // natively, they will be inserted into a browser-created text node to the\n // right of that
. This is obviously undesirable.\n //\n // With the `needsRecovery` flag, we inform the caller that it is responsible\n // for manually setting the selection state on the rendered document to\n // ensure proper selection state maintenance.\n\n if (anchorIsTextNode) {\n anchorPoint = {\n key: nullthrows(findAncestorOffsetKey(anchorNode)),\n offset: anchorOffset\n };\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n } else if (focusIsTextNode) {\n focusPoint = {\n key: nullthrows(findAncestorOffsetKey(focusNode)),\n offset: focusOffset\n };\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n } else {\n anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n focusPoint = getPointForNonTextNode(root, focusNode, focusOffset); // If the selection is collapsed on an empty block, don't force recovery.\n // This way, on arrow key selection changes, the browser can move the\n // cursor from a non-zero offset on one block, through empty blocks,\n // to a matching non-zero offset on other text blocks.\n\n if (anchorNode === focusNode && anchorOffset === focusOffset) {\n needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n }\n }\n\n return {\n selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n needsRecovery: needsRecovery\n };\n}\n/**\n * Identify the first leaf descendant for the given node.\n */\n\n\nfunction getFirstLeaf(node) {\n while (node.firstChild && ( // data-blocks has no offset\n isElement(node.firstChild) && node.firstChild.getAttribute('data-blocks') === 'true' || getSelectionOffsetKeyForNode(node.firstChild))) {\n node = node.firstChild;\n }\n\n return node;\n}\n/**\n * Identify the last leaf descendant for the given node.\n */\n\n\nfunction getLastLeaf(node) {\n while (node.lastChild && ( // data-blocks has no offset\n isElement(node.lastChild) && node.lastChild.getAttribute('data-blocks') === 'true' || getSelectionOffsetKeyForNode(node.lastChild))) {\n node = node.lastChild;\n }\n\n return node;\n}\n\nfunction getPointForNonTextNode(editorRoot, startNode, childOffset) {\n var node = startNode;\n var offsetKey = findAncestorOffsetKey(node);\n !(offsetKey != null || editorRoot && (editorRoot === node || editorRoot.firstChild === node)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Unknown node in selection range.') : invariant(false) : void 0; // If the editorRoot is the selection, step downward into the content\n // wrapper.\n\n if (editorRoot === node) {\n node = node.firstChild;\n !isElement(node) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Invalid DraftEditorContents node.') : invariant(false) : void 0;\n var castedNode = node; // assignment only added for flow :/\n // otherwise it throws in line 200 saying that node can be null or undefined\n\n node = castedNode;\n !(node.getAttribute('data-contents') === 'true') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Invalid DraftEditorContents structure.') : invariant(false) : void 0;\n\n if (childOffset > 0) {\n childOffset = node.childNodes.length;\n }\n } // If the child offset is zero and we have an offset key, we're done.\n // If there's no offset key because the entire editor is selected,\n // find the leftmost (\"first\") leaf in the tree and use that as the offset\n // key.\n\n\n if (childOffset === 0) {\n var key = null;\n\n if (offsetKey != null) {\n key = offsetKey;\n } else {\n var firstLeaf = getFirstLeaf(node);\n key = nullthrows(getSelectionOffsetKeyForNode(firstLeaf));\n }\n\n return {\n key: key,\n offset: 0\n };\n }\n\n var nodeBeforeCursor = node.childNodes[childOffset - 1];\n var leafKey = null;\n var textLength = null;\n\n if (!getSelectionOffsetKeyForNode(nodeBeforeCursor)) {\n // Our target node may be a leaf or a text node, in which case we're\n // already where we want to be and can just use the child's length as\n // our offset.\n leafKey = nullthrows(offsetKey);\n textLength = getTextContentLength(nodeBeforeCursor);\n } else {\n // Otherwise, we'll look at the child to the left of the cursor and find\n // the last leaf node in its subtree.\n var lastLeaf = getLastLeaf(nodeBeforeCursor);\n leafKey = nullthrows(getSelectionOffsetKeyForNode(lastLeaf));\n textLength = getTextContentLength(lastLeaf);\n }\n\n return {\n key: leafKey,\n offset: textLength\n };\n}\n/**\n * Return the length of a node's textContent, regarding single newline\n * characters as zero-length. This allows us to avoid problems with identifying\n * the correct selection offset for empty blocks in IE, in which we\n * render newlines instead of break tags.\n */\n\n\nfunction getTextContentLength(node) {\n var textContent = node.textContent;\n return textContent === '\\n' ? 0 : textContent.length;\n}\n\nmodule.exports = getDraftEditorSelectionWithNodes;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar _require = require(\"./draftKeyUtils\"),\n notEmptyKey = _require.notEmptyKey;\n/**\n * Return the entity key that should be used when inserting text for the\n * specified target selection, only if the entity is `MUTABLE`. `IMMUTABLE`\n * and `SEGMENTED` entities should not be used for insertion behavior.\n */\n\n\nfunction getEntityKeyForSelection(contentState, targetSelection) {\n var entityKey;\n\n if (targetSelection.isCollapsed()) {\n var key = targetSelection.getAnchorKey();\n var offset = targetSelection.getAnchorOffset();\n\n if (offset > 0) {\n entityKey = contentState.getBlockForKey(key).getEntityAt(offset - 1);\n\n if (entityKey !== contentState.getBlockForKey(key).getEntityAt(offset)) {\n return null;\n }\n\n return filterKey(contentState.getEntityMap(), entityKey);\n }\n\n return null;\n }\n\n var startKey = targetSelection.getStartKey();\n var startOffset = targetSelection.getStartOffset();\n var startBlock = contentState.getBlockForKey(startKey);\n entityKey = startOffset === startBlock.getLength() ? null : startBlock.getEntityAt(startOffset);\n return filterKey(contentState.getEntityMap(), entityKey);\n}\n/**\n * Determine whether an entity key corresponds to a `MUTABLE` entity. If so,\n * return it. If not, return null.\n */\n\n\nfunction filterKey(entityMap, entityKey) {\n if (notEmptyKey(entityKey)) {\n var entity = entityMap.__get(entityKey);\n\n return entity.getMutability() === 'MUTABLE' ? entityKey : null;\n }\n\n return null;\n}\n\nmodule.exports = getEntityKeyForSelection;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getContentStateFragment = require(\"./getContentStateFragment\");\n\nfunction getFragmentFromSelection(editorState) {\n var selectionState = editorState.getSelection();\n\n if (selectionState.isCollapsed()) {\n return null;\n }\n\n return getContentStateFragment(editorState.getCurrentContent(), selectionState);\n}\n\nmodule.exports = getFragmentFromSelection;","\"use strict\";\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar getNextDelimiterBlockKey = function getNextDelimiterBlockKey(block, blockMap) {\n var isExperimentalTreeBlock = block instanceof ContentBlockNode;\n\n if (!isExperimentalTreeBlock) {\n return null;\n }\n\n var nextSiblingKey = block.getNextSiblingKey();\n\n if (nextSiblingKey) {\n return nextSiblingKey;\n }\n\n var parent = block.getParentKey();\n\n if (!parent) {\n return null;\n }\n\n var nextNonDescendantBlock = blockMap.get(parent);\n\n while (nextNonDescendantBlock && !nextNonDescendantBlock.getNextSiblingKey()) {\n var parentKey = nextNonDescendantBlock.getParentKey();\n nextNonDescendantBlock = parentKey ? blockMap.get(parentKey) : null;\n }\n\n if (!nextNonDescendantBlock) {\n return null;\n }\n\n return nextNonDescendantBlock.getNextSiblingKey();\n};\n\nmodule.exports = getNextDelimiterBlockKey;","\"use strict\";\n/**\n * Copyright 2004-present Facebook. All Rights Reserved.\n *\n * \n * @typechecks\n * @format\n */\n\n/**\n * Retrieve an object's own values as an array. If you want the values in the\n * protoype chain, too, use getObjectValuesIncludingPrototype.\n *\n * If you are looking for a function that creates an Array instance based\n * on an \"Array-like\" object, use createArrayFrom instead.\n *\n * @param {object} obj An object.\n * @return {array} The object's values.\n */\n\nfunction getOwnObjectValues(obj) {\n return Object.keys(obj).map(function (key) {\n return obj[key];\n });\n}\n\nmodule.exports = getOwnObjectValues;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getRangeClientRects = require(\"./getRangeClientRects\");\n/**\n * Like range.getBoundingClientRect() but normalizes for browser bugs.\n */\n\n\nfunction getRangeBoundingClientRect(range) {\n // \"Return a DOMRect object describing the smallest rectangle that includes\n // the first rectangle in list and all of the remaining rectangles of which\n // the height or width is not zero.\"\n // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n var rects = getRangeClientRects(range);\n var top = 0;\n var right = 0;\n var bottom = 0;\n var left = 0;\n\n if (rects.length) {\n // If the first rectangle has 0 width, we use the second, this is needed\n // because Chrome renders a 0 width rectangle when the selection contains\n // a line break.\n if (rects.length > 1 && rects[0].width === 0) {\n var _rects$ = rects[1];\n top = _rects$.top;\n right = _rects$.right;\n bottom = _rects$.bottom;\n left = _rects$.left;\n } else {\n var _rects$2 = rects[0];\n top = _rects$2.top;\n right = _rects$2.right;\n bottom = _rects$2.bottom;\n left = _rects$2.left;\n }\n\n for (var ii = 1; ii < rects.length; ii++) {\n var rect = rects[ii];\n\n if (rect.height !== 0 && rect.width !== 0) {\n top = Math.min(top, rect.top);\n right = Math.max(right, rect.right);\n bottom = Math.max(bottom, rect.bottom);\n left = Math.min(left, rect.left);\n }\n }\n }\n\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n width: right - left,\n height: bottom - top\n };\n}\n\nmodule.exports = getRangeBoundingClientRect;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isChrome = UserAgent.isBrowser('Chrome'); // In Chrome, the client rects will include the entire bounds of all nodes that\n// begin (have a start tag) within the selection, even if the selection does\n// not overlap the entire node. To resolve this, we split the range at each\n// start tag and join the client rects together.\n// https://code.google.com/p/chromium/issues/detail?id=324437\n\n/* eslint-disable consistent-return */\n\nfunction getRangeClientRectsChrome(range) {\n var tempRange = range.cloneRange();\n var clientRects = [];\n\n for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n // If we've climbed up to the common ancestor, we can now use the\n // original start point and stop climbing the tree.\n var atCommonAncestor = ancestor === range.commonAncestorContainer;\n\n if (atCommonAncestor) {\n tempRange.setStart(range.startContainer, range.startOffset);\n } else {\n tempRange.setStart(tempRange.endContainer, 0);\n }\n\n var rects = Array.from(tempRange.getClientRects());\n clientRects.push(rects);\n\n if (atCommonAncestor) {\n var _ref;\n\n clientRects.reverse();\n return (_ref = []).concat.apply(_ref, clientRects);\n }\n\n tempRange.setEndBefore(ancestor);\n }\n\n !false ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}\n/* eslint-enable consistent-return */\n\n/**\n * Like range.getClientRects() but normalizes for browser bugs.\n */\n\n\nvar getRangeClientRects = isChrome ? getRangeClientRectsChrome : function (range) {\n return Array.from(range.getClientRects());\n};\nmodule.exports = getRangeClientRects;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar invariant = require(\"fbjs/lib/invariant\");\n/**\n * Obtain the start and end positions of the range that has the\n * specified entity applied to it.\n *\n * Entity keys are applied only to contiguous stretches of text, so this\n * method searches for the first instance of the entity key and returns\n * the subsequent range.\n */\n\n\nfunction getRangesForDraftEntity(block, key) {\n var ranges = [];\n block.findEntityRanges(function (c) {\n return c.getEntity() === key;\n }, function (start, end) {\n ranges.push({\n start: start,\n end: end\n });\n });\n !!!ranges.length ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Entity key not found in this range.') : invariant(false) : void 0;\n return ranges;\n}\n\nmodule.exports = getRangesForDraftEntity;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isOldIE = UserAgent.isBrowser('IE <= 9'); // Provides a dom node that will not execute scripts\n// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation.createHTMLDocument\n// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/HTML_to_DOM\n\nfunction getSafeBodyFromHTML(html) {\n var doc;\n var root = null; // Provides a safe context\n\n if (!isOldIE && document.implementation && document.implementation.createHTMLDocument) {\n doc = document.implementation.createHTMLDocument('foo');\n !doc.documentElement ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Missing doc.documentElement') : invariant(false) : void 0;\n doc.documentElement.innerHTML = html;\n root = doc.getElementsByTagName('body')[0];\n }\n\n return root;\n}\n\nmodule.exports = getSafeBodyFromHTML;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n/**\n * Get offset key from a node or it's child nodes. Return the first offset key\n * found on the DOM tree of given node.\n */\n\nvar isElement = require(\"./isElement\");\n\nfunction getSelectionOffsetKeyForNode(node) {\n if (isElement(node)) {\n var castedNode = node;\n var offsetKey = castedNode.getAttribute('data-offset-key');\n\n if (offsetKey) {\n return offsetKey;\n }\n\n for (var ii = 0; ii < castedNode.childNodes.length; ii++) {\n var childOffsetKey = getSelectionOffsetKeyForNode(castedNode.childNodes[ii]);\n\n if (childOffsetKey) {\n return childOffsetKey;\n }\n }\n }\n\n return null;\n}\n\nmodule.exports = getSelectionOffsetKeyForNode;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar TEXT_CLIPPING_REGEX = /\\.textClipping$/;\nvar TEXT_TYPES = {\n 'text/plain': true,\n 'text/html': true,\n 'text/rtf': true\n}; // Somewhat arbitrary upper bound on text size. Let's not lock up the browser.\n\nvar TEXT_SIZE_UPPER_BOUND = 5000;\n/**\n * Extract the text content from a file list.\n */\n\nfunction getTextContentFromFiles(files, callback) {\n var readCount = 0;\n var results = [];\n files.forEach(function (\n /*blob*/\n file) {\n readFile(file, function (\n /*string*/\n text) {\n readCount++;\n text && results.push(text.slice(0, TEXT_SIZE_UPPER_BOUND));\n\n if (readCount == files.length) {\n callback(results.join('\\r'));\n }\n });\n });\n}\n/**\n * todo isaac: Do work to turn html/rtf into a content fragment.\n */\n\n\nfunction readFile(file, callback) {\n if (!global.FileReader || file.type && !(file.type in TEXT_TYPES)) {\n callback('');\n return;\n }\n\n if (file.type === '') {\n var _contents = ''; // Special-case text clippings, which have an empty type but include\n // `.textClipping` in the file name. `readAsText` results in an empty\n // string for text clippings, so we force the file name to serve\n // as the text value for the file.\n\n if (TEXT_CLIPPING_REGEX.test(file.name)) {\n _contents = file.name.replace(TEXT_CLIPPING_REGEX, '');\n }\n\n callback(_contents);\n return;\n }\n\n var reader = new FileReader();\n\n reader.onload = function () {\n var result = reader.result;\n !(typeof result === 'string') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'We should be calling \"FileReader.readAsText\" which returns a string') : invariant(false) : void 0;\n callback(result);\n };\n\n reader.onerror = function () {\n callback('');\n };\n\n reader.readAsText(file);\n}\n\nmodule.exports = getTextContentFromFiles;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nfunction getUpdatedSelectionState(editorState, anchorKey, anchorOffset, focusKey, focusOffset) {\n var selection = nullthrows(editorState.getSelection());\n\n if (!anchorKey || !focusKey) {\n // If we cannot make sense of the updated selection state, stick to the current one.\n if (process.env.NODE_ENV !== \"production\") {\n /* eslint-disable-next-line */\n console.warn('Invalid selection state.', arguments, editorState.toJS());\n }\n\n return selection;\n }\n\n var anchorPath = DraftOffsetKey.decode(anchorKey);\n var anchorBlockKey = anchorPath.blockKey;\n var anchorLeafBlockTree = editorState.getBlockTree(anchorBlockKey);\n var anchorLeaf = anchorLeafBlockTree && anchorLeafBlockTree.getIn([anchorPath.decoratorKey, 'leaves', anchorPath.leafKey]);\n var focusPath = DraftOffsetKey.decode(focusKey);\n var focusBlockKey = focusPath.blockKey;\n var focusLeafBlockTree = editorState.getBlockTree(focusBlockKey);\n var focusLeaf = focusLeafBlockTree && focusLeafBlockTree.getIn([focusPath.decoratorKey, 'leaves', focusPath.leafKey]);\n\n if (!anchorLeaf || !focusLeaf) {\n // If we cannot make sense of the updated selection state, stick to the current one.\n if (process.env.NODE_ENV !== \"production\") {\n /* eslint-disable-next-line */\n console.warn('Invalid selection state.', arguments, editorState.toJS());\n }\n\n return selection;\n }\n\n var anchorLeafStart = anchorLeaf.get('start');\n var focusLeafStart = focusLeaf.get('start');\n var anchorBlockOffset = anchorLeaf ? anchorLeafStart + anchorOffset : null;\n var focusBlockOffset = focusLeaf ? focusLeafStart + focusOffset : null;\n var areEqual = selection.getAnchorKey() === anchorBlockKey && selection.getAnchorOffset() === anchorBlockOffset && selection.getFocusKey() === focusBlockKey && selection.getFocusOffset() === focusBlockOffset;\n\n if (areEqual) {\n return selection;\n }\n\n var isBackward = false;\n\n if (anchorBlockKey === focusBlockKey) {\n var anchorLeafEnd = anchorLeaf.get('end');\n var focusLeafEnd = focusLeaf.get('end');\n\n if (focusLeafStart === anchorLeafStart && focusLeafEnd === anchorLeafEnd) {\n isBackward = focusOffset < anchorOffset;\n } else {\n isBackward = focusLeafStart < anchorLeafStart;\n }\n } else {\n var startKey = editorState.getCurrentContent().getBlockMap().keySeq().skipUntil(function (v) {\n return v === anchorBlockKey || v === focusBlockKey;\n }).first();\n isBackward = startKey === focusBlockKey;\n }\n\n return selection.merge({\n anchorKey: anchorBlockKey,\n anchorOffset: anchorBlockOffset,\n focusKey: focusBlockKey,\n focusOffset: focusBlockOffset,\n isBackward: isBackward\n });\n}\n\nmodule.exports = getUpdatedSelectionState;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getRangeBoundingClientRect = require(\"./getRangeBoundingClientRect\");\n/**\n * Return the bounding ClientRect for the visible DOM selection, if any.\n * In cases where there are no selected ranges or the bounding rect is\n * temporarily invalid, return null.\n *\n * When using from an iframe, you should pass the iframe window object\n */\n\n\nfunction getVisibleSelectionRect(global) {\n var selection = global.getSelection();\n\n if (!selection.rangeCount) {\n return null;\n }\n\n var range = selection.getRangeAt(0);\n var boundingRect = getRangeBoundingClientRect(range);\n var top = boundingRect.top,\n right = boundingRect.right,\n bottom = boundingRect.bottom,\n left = boundingRect.left; // When a re-render leads to a node being removed, the DOM selection will\n // temporarily be placed on an ancestor node, which leads to an invalid\n // bounding rect. Discard this state.\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return null;\n }\n\n return boundingRect;\n}\n\nmodule.exports = getVisibleSelectionRect;","\"use strict\";\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n\nfunction getWindowForNode(node) {\n if (!node || !node.ownerDocument || !node.ownerDocument.defaultView) {\n return window;\n }\n\n return node.ownerDocument.defaultView;\n}\n\nmodule.exports = getWindowForNode;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n */\n'use strict';\n\nmodule.exports = function (name) {\n if (typeof window !== 'undefined' && window.__DRAFT_GKX) {\n return !!window.__DRAFT_GKX[name];\n }\n\n return false;\n};","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar BlockMapBuilder = require(\"./BlockMapBuilder\");\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar Immutable = require(\"immutable\");\n\nvar insertIntoList = require(\"./insertIntoList\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar randomizeBlockMapKeys = require(\"./randomizeBlockMapKeys\");\n\nvar List = Immutable.List;\n\nvar updateExistingBlock = function updateExistingBlock(contentState, selectionState, blockMap, fragmentBlock, targetKey, targetOffset) {\n var mergeBlockData = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 'REPLACE_WITH_NEW_DATA';\n var targetBlock = blockMap.get(targetKey);\n var text = targetBlock.getText();\n var chars = targetBlock.getCharacterList();\n var finalKey = targetKey;\n var finalOffset = targetOffset + fragmentBlock.getText().length;\n var data = null;\n\n switch (mergeBlockData) {\n case 'MERGE_OLD_DATA_TO_NEW_DATA':\n data = fragmentBlock.getData().merge(targetBlock.getData());\n break;\n\n case 'REPLACE_WITH_NEW_DATA':\n data = fragmentBlock.getData();\n break;\n }\n\n var type = targetBlock.getType();\n\n if (text && type === 'unstyled') {\n type = fragmentBlock.getType();\n }\n\n var newBlock = targetBlock.merge({\n text: text.slice(0, targetOffset) + fragmentBlock.getText() + text.slice(targetOffset),\n characterList: insertIntoList(chars, fragmentBlock.getCharacterList(), targetOffset),\n type: type,\n data: data\n });\n return contentState.merge({\n blockMap: blockMap.set(targetKey, newBlock),\n selectionBefore: selectionState,\n selectionAfter: selectionState.merge({\n anchorKey: finalKey,\n anchorOffset: finalOffset,\n focusKey: finalKey,\n focusOffset: finalOffset,\n isBackward: false\n })\n });\n};\n/**\n * Appends text/characterList from the fragment first block to\n * target block.\n */\n\n\nvar updateHead = function updateHead(block, targetOffset, fragment) {\n var text = block.getText();\n var chars = block.getCharacterList(); // Modify head portion of block.\n\n var headText = text.slice(0, targetOffset);\n var headCharacters = chars.slice(0, targetOffset);\n var appendToHead = fragment.first();\n return block.merge({\n text: headText + appendToHead.getText(),\n characterList: headCharacters.concat(appendToHead.getCharacterList()),\n type: headText ? block.getType() : appendToHead.getType(),\n data: appendToHead.getData()\n });\n};\n/**\n * Appends offset text/characterList from the target block to the last\n * fragment block.\n */\n\n\nvar updateTail = function updateTail(block, targetOffset, fragment) {\n // Modify tail portion of block.\n var text = block.getText();\n var chars = block.getCharacterList(); // Modify head portion of block.\n\n var blockSize = text.length;\n var tailText = text.slice(targetOffset, blockSize);\n var tailCharacters = chars.slice(targetOffset, blockSize);\n var prependToTail = fragment.last();\n return prependToTail.merge({\n text: prependToTail.getText() + tailText,\n characterList: prependToTail.getCharacterList().concat(tailCharacters),\n data: prependToTail.getData()\n });\n};\n\nvar getRootBlocks = function getRootBlocks(block, blockMap) {\n var headKey = block.getKey();\n var rootBlock = block;\n var rootBlocks = []; // sometimes the fragment head block will not be part of the blockMap itself this can happen when\n // the fragment head is used to update the target block, however when this does not happen we need\n // to make sure that we include it on the rootBlocks since the first block of a fragment is always a\n // fragment root block\n\n if (blockMap.get(headKey)) {\n rootBlocks.push(headKey);\n }\n\n while (rootBlock && rootBlock.getNextSiblingKey()) {\n var lastSiblingKey = rootBlock.getNextSiblingKey();\n\n if (!lastSiblingKey) {\n break;\n }\n\n rootBlocks.push(lastSiblingKey);\n rootBlock = blockMap.get(lastSiblingKey);\n }\n\n return rootBlocks;\n};\n\nvar updateBlockMapLinks = function updateBlockMapLinks(blockMap, originalBlockMap, targetBlock, fragmentHeadBlock) {\n return blockMap.withMutations(function (blockMapState) {\n var targetKey = targetBlock.getKey();\n var headKey = fragmentHeadBlock.getKey();\n var targetNextKey = targetBlock.getNextSiblingKey();\n var targetParentKey = targetBlock.getParentKey();\n var fragmentRootBlocks = getRootBlocks(fragmentHeadBlock, blockMap);\n var lastRootFragmentBlockKey = fragmentRootBlocks[fragmentRootBlocks.length - 1];\n\n if (blockMapState.get(headKey)) {\n // update the fragment head when it is part of the blockMap otherwise\n blockMapState.setIn([targetKey, 'nextSibling'], headKey);\n blockMapState.setIn([headKey, 'prevSibling'], targetKey);\n } else {\n // update the target block that had the fragment head contents merged into it\n blockMapState.setIn([targetKey, 'nextSibling'], fragmentHeadBlock.getNextSiblingKey());\n blockMapState.setIn([fragmentHeadBlock.getNextSiblingKey(), 'prevSibling'], targetKey);\n } // update the last root block fragment\n\n\n blockMapState.setIn([lastRootFragmentBlockKey, 'nextSibling'], targetNextKey); // update the original target next block\n\n if (targetNextKey) {\n blockMapState.setIn([targetNextKey, 'prevSibling'], lastRootFragmentBlockKey);\n } // update fragment parent links\n\n\n fragmentRootBlocks.forEach(function (blockKey) {\n return blockMapState.setIn([blockKey, 'parent'], targetParentKey);\n }); // update targetBlock parent child links\n\n if (targetParentKey) {\n var targetParent = blockMap.get(targetParentKey);\n var originalTargetParentChildKeys = targetParent.getChildKeys();\n var targetBlockIndex = originalTargetParentChildKeys.indexOf(targetKey);\n var insertionIndex = targetBlockIndex + 1;\n var newChildrenKeysArray = originalTargetParentChildKeys.toArray(); // insert fragment children\n\n newChildrenKeysArray.splice.apply(newChildrenKeysArray, [insertionIndex, 0].concat(fragmentRootBlocks));\n blockMapState.setIn([targetParentKey, 'children'], List(newChildrenKeysArray));\n }\n });\n};\n\nvar insertFragment = function insertFragment(contentState, selectionState, blockMap, fragment, targetKey, targetOffset) {\n var isTreeBasedBlockMap = blockMap.first() instanceof ContentBlockNode;\n var newBlockArr = [];\n var fragmentSize = fragment.size;\n var target = blockMap.get(targetKey);\n var head = fragment.first();\n var tail = fragment.last();\n var finalOffset = tail.getLength();\n var finalKey = tail.getKey();\n var shouldNotUpdateFromFragmentBlock = isTreeBasedBlockMap && (!target.getChildKeys().isEmpty() || !head.getChildKeys().isEmpty());\n blockMap.forEach(function (block, blockKey) {\n if (blockKey !== targetKey) {\n newBlockArr.push(block);\n return;\n }\n\n if (shouldNotUpdateFromFragmentBlock) {\n newBlockArr.push(block);\n } else {\n newBlockArr.push(updateHead(block, targetOffset, fragment));\n } // Insert fragment blocks after the head and before the tail.\n\n\n fragment // when we are updating the target block with the head fragment block we skip the first fragment\n // head since its contents have already been merged with the target block otherwise we include\n // the whole fragment\n .slice(shouldNotUpdateFromFragmentBlock ? 0 : 1, fragmentSize - 1).forEach(function (fragmentBlock) {\n return newBlockArr.push(fragmentBlock);\n }); // update tail\n\n newBlockArr.push(updateTail(block, targetOffset, fragment));\n });\n var updatedBlockMap = BlockMapBuilder.createFromArray(newBlockArr);\n\n if (isTreeBasedBlockMap) {\n updatedBlockMap = updateBlockMapLinks(updatedBlockMap, blockMap, target, head);\n }\n\n return contentState.merge({\n blockMap: updatedBlockMap,\n selectionBefore: selectionState,\n selectionAfter: selectionState.merge({\n anchorKey: finalKey,\n anchorOffset: finalOffset,\n focusKey: finalKey,\n focusOffset: finalOffset,\n isBackward: false\n })\n });\n};\n\nvar insertFragmentIntoContentState = function insertFragmentIntoContentState(contentState, selectionState, fragmentBlockMap) {\n var mergeBlockData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'REPLACE_WITH_NEW_DATA';\n !selectionState.isCollapsed() ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`insertFragment` should only be called with a collapsed selection state.') : invariant(false) : void 0;\n var blockMap = contentState.getBlockMap();\n var fragment = randomizeBlockMapKeys(fragmentBlockMap);\n var targetKey = selectionState.getStartKey();\n var targetOffset = selectionState.getStartOffset();\n var targetBlock = blockMap.get(targetKey);\n\n if (targetBlock instanceof ContentBlockNode) {\n !targetBlock.getChildKeys().isEmpty() ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`insertFragment` should not be called when a container node is selected.') : invariant(false) : void 0;\n } // When we insert a fragment with a single block we simply update the target block\n // with the contents of the inserted fragment block\n\n\n if (fragment.size === 1) {\n return updateExistingBlock(contentState, selectionState, blockMap, fragment.first(), targetKey, targetOffset, mergeBlockData);\n }\n\n return insertFragment(contentState, selectionState, blockMap, fragment, targetKey, targetOffset);\n};\n\nmodule.exports = insertFragmentIntoContentState;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n/**\n * Maintain persistence for target list when appending and prepending.\n */\n\nfunction insertIntoList(targetListArg, toInsert, offset) {\n var targetList = targetListArg;\n\n if (offset === targetList.count()) {\n toInsert.forEach(function (c) {\n targetList = targetList.push(c);\n });\n } else if (offset === 0) {\n toInsert.reverse().forEach(function (c) {\n targetList = targetList.unshift(c);\n });\n } else {\n var head = targetList.slice(0, offset);\n var tail = targetList.slice(offset);\n targetList = head.concat(toInsert, tail).toList();\n }\n\n return targetList;\n}\n\nmodule.exports = insertIntoList;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar Immutable = require(\"immutable\");\n\nvar insertIntoList = require(\"./insertIntoList\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar Repeat = Immutable.Repeat;\n\nfunction insertTextIntoContentState(contentState, selectionState, text, characterMetadata) {\n !selectionState.isCollapsed() ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`insertText` should only be called with a collapsed range.') : invariant(false) : void 0;\n var len = null;\n\n if (text != null) {\n len = text.length;\n }\n\n if (len == null || len === 0) {\n return contentState;\n }\n\n var blockMap = contentState.getBlockMap();\n var key = selectionState.getStartKey();\n var offset = selectionState.getStartOffset();\n var block = blockMap.get(key);\n var blockText = block.getText();\n var newBlock = block.merge({\n text: blockText.slice(0, offset) + text + blockText.slice(offset, block.getLength()),\n characterList: insertIntoList(block.getCharacterList(), Repeat(characterMetadata, len).toList(), offset)\n });\n var newOffset = offset + len;\n return contentState.merge({\n blockMap: blockMap.set(key, newBlock),\n selectionAfter: selectionState.merge({\n anchorOffset: newOffset,\n focusOffset: newOffset\n })\n });\n}\n\nmodule.exports = insertTextIntoContentState;","\"use strict\";\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n\nfunction isElement(node) {\n if (!node || !node.ownerDocument) {\n return false;\n }\n\n return node.nodeType === Node.ELEMENT_NODE;\n}\n\nmodule.exports = isElement;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n/**\n * Utility method for determining whether or not the value returned\n * from a handler indicates that it was handled.\n */\n\nfunction isEventHandled(value) {\n return value === 'handled' || value === true;\n}\n\nmodule.exports = isEventHandled;","\"use strict\";\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n\nvar isElement = require(\"./isElement\");\n\nfunction isHTMLAnchorElement(node) {\n if (!node || !node.ownerDocument) {\n return false;\n }\n\n return isElement(node) && node.nodeName === 'A';\n}\n\nmodule.exports = isHTMLAnchorElement;","\"use strict\";\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n\nvar isElement = require(\"./isElement\");\n\nfunction isHTMLBRElement(node) {\n if (!node || !node.ownerDocument) {\n return false;\n }\n\n return isElement(node) && node.nodeName === 'BR';\n}\n\nmodule.exports = isHTMLBRElement;","\"use strict\";\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n\nfunction isHTMLElement(node) {\n if (!node || !node.ownerDocument) {\n return false;\n }\n\n if (!node.ownerDocument.defaultView) {\n return node instanceof HTMLElement;\n }\n\n if (node instanceof node.ownerDocument.defaultView.HTMLElement) {\n return true;\n }\n\n return false;\n}\n\nmodule.exports = isHTMLElement;","\"use strict\";\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n\nvar isElement = require(\"./isElement\");\n\nfunction isHTMLImageElement(node) {\n if (!node || !node.ownerDocument) {\n return false;\n }\n\n return isElement(node) && node.nodeName === 'IMG';\n}\n\nmodule.exports = isHTMLImageElement;","\"use strict\";\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n\nfunction isInstanceOfNode(target) {\n // we changed the name because of having duplicate module provider (fbjs)\n if (!target || !('ownerDocument' in target)) {\n return false;\n }\n\n if ('ownerDocument' in target) {\n var node = target;\n\n if (!node.ownerDocument.defaultView) {\n return node instanceof Node;\n }\n\n if (node instanceof node.ownerDocument.defaultView.Node) {\n return true;\n }\n }\n\n return false;\n}\n\nmodule.exports = isInstanceOfNode;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction isSelectionAtLeafStart(editorState) {\n var selection = editorState.getSelection();\n var anchorKey = selection.getAnchorKey();\n var blockTree = editorState.getBlockTree(anchorKey);\n var offset = selection.getStartOffset();\n var isAtStart = false;\n blockTree.some(function (leafSet) {\n if (offset === leafSet.get('start')) {\n isAtStart = true;\n return true;\n }\n\n if (offset < leafSet.get('end')) {\n return leafSet.get('leaves').some(function (leaf) {\n var leafStart = leaf.get('start');\n\n if (offset === leafStart) {\n isAtStart = true;\n return true;\n }\n\n return false;\n });\n }\n\n return false;\n });\n return isAtStart;\n}\n\nmodule.exports = isSelectionAtLeafStart;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar Keys = require(\"fbjs/lib/Keys\");\n\nfunction isSoftNewlineEvent(e) {\n return e.which === Keys.RETURN && (e.getModifierState('Shift') || e.getModifierState('Alt') || e.getModifierState('Control'));\n}\n\nmodule.exports = isSoftNewlineEvent;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nvar expandRangeToStartOfLine = require(\"./expandRangeToStartOfLine\");\n\nvar getDraftEditorSelectionWithNodes = require(\"./getDraftEditorSelectionWithNodes\");\n\nvar moveSelectionBackward = require(\"./moveSelectionBackward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n\nfunction keyCommandBackspaceToStartOfLine(editorState, e) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n\n if (selection.isCollapsed() && selection.getAnchorOffset() === 0) {\n return moveSelectionBackward(strategyState, 1);\n }\n\n var ownerDocument = e.currentTarget.ownerDocument;\n var domSelection = ownerDocument.defaultView.getSelection(); // getRangeAt can technically throw if there's no selection, but we know\n // there is one here because text editor has focus (the cursor is a\n // selection of length 0). Therefore, we don't need to wrap this in a\n // try-catch block.\n\n var range = domSelection.getRangeAt(0);\n range = expandRangeToStartOfLine(range);\n return getDraftEditorSelectionWithNodes(strategyState, null, range.endContainer, range.endOffset, range.startContainer, range.startOffset).selectionState;\n }, 'backward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n return EditorState.push(editorState, afterRemoval, 'remove-range');\n}\n\nmodule.exports = keyCommandBackspaceToStartOfLine;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftRemovableWord = require(\"./DraftRemovableWord\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar moveSelectionBackward = require(\"./moveSelectionBackward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n/**\n * Delete the word that is left of the cursor, as well as any spaces or\n * punctuation after the word.\n */\n\n\nfunction keyCommandBackspaceWord(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var offset = selection.getStartOffset(); // If there are no words before the cursor, remove the preceding newline.\n\n if (offset === 0) {\n return moveSelectionBackward(strategyState, 1);\n }\n\n var key = selection.getStartKey();\n var content = strategyState.getCurrentContent();\n var text = content.getBlockForKey(key).getText().slice(0, offset);\n var toRemove = DraftRemovableWord.getBackward(text);\n return moveSelectionBackward(strategyState, toRemove.length || 1);\n }, 'backward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n return EditorState.push(editorState, afterRemoval, 'remove-range');\n}\n\nmodule.exports = keyCommandBackspaceWord;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftRemovableWord = require(\"./DraftRemovableWord\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar moveSelectionForward = require(\"./moveSelectionForward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n/**\n * Delete the word that is right of the cursor, as well as any spaces or\n * punctuation before the word.\n */\n\n\nfunction keyCommandDeleteWord(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var offset = selection.getStartOffset();\n var key = selection.getStartKey();\n var content = strategyState.getCurrentContent();\n var text = content.getBlockForKey(key).getText().slice(offset);\n var toRemove = DraftRemovableWord.getForward(text); // If there are no words in front of the cursor, remove the newline.\n\n return moveSelectionForward(strategyState, toRemove.length || 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n return EditorState.push(editorState, afterRemoval, 'remove-range');\n}\n\nmodule.exports = keyCommandDeleteWord;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nfunction keyCommandInsertNewline(editorState) {\n var contentState = DraftModifier.splitBlock(editorState.getCurrentContent(), editorState.getSelection());\n return EditorState.push(editorState, contentState, 'split-block');\n}\n\nmodule.exports = keyCommandInsertNewline;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n/**\n * See comment for `moveSelectionToStartOfBlock`.\n */\n\n\nfunction keyCommandMoveSelectionToEndOfBlock(editorState) {\n var selection = editorState.getSelection();\n var endKey = selection.getEndKey();\n var content = editorState.getCurrentContent();\n var textLength = content.getBlockForKey(endKey).getLength();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: endKey,\n anchorOffset: textLength,\n focusKey: endKey,\n focusOffset: textLength,\n isBackward: false\n }),\n forceSelection: true\n });\n}\n\nmodule.exports = keyCommandMoveSelectionToEndOfBlock;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n/**\n * Collapse selection at the start of the first selected block. This is used\n * for Firefox versions that attempt to navigate forward/backward instead of\n * moving the cursor. Other browsers are able to move the cursor natively.\n */\n\n\nfunction keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}\n\nmodule.exports = keyCommandMoveSelectionToStartOfBlock;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar moveSelectionBackward = require(\"./moveSelectionBackward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n/**\n * Remove the selected range. If the cursor is collapsed, remove the preceding\n * character. This operation is Unicode-aware, so removing a single character\n * will remove a surrogate pair properly as well.\n */\n\n\nfunction keyCommandPlainBackspace(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charBehind = content.getBlockForKey(key).getText()[offset - 1];\n return moveSelectionBackward(strategyState, charBehind ? UnicodeUtils.getUTF16Length(charBehind, 0) : 1);\n }, 'backward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'backspace-character' : 'remove-range');\n}\n\nmodule.exports = keyCommandPlainBackspace;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar moveSelectionForward = require(\"./moveSelectionForward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n/**\n * Remove the selected range. If the cursor is collapsed, remove the following\n * character. This operation is Unicode-aware, so removing a single character\n * will remove a surrogate pair properly as well.\n */\n\n\nfunction keyCommandPlainDelete(editorState) {\n var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n var selection = strategyState.getSelection();\n var content = strategyState.getCurrentContent();\n var key = selection.getAnchorKey();\n var offset = selection.getAnchorOffset();\n var charAhead = content.getBlockForKey(key).getText()[offset];\n return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n }, 'forward');\n\n if (afterRemoval === editorState.getCurrentContent()) {\n return editorState;\n }\n\n var selection = editorState.getSelection();\n return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}\n\nmodule.exports = keyCommandPlainDelete;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar getContentStateFragment = require(\"./getContentStateFragment\");\n/**\n * Transpose the characters on either side of a collapsed cursor, or\n * if the cursor is at the end of the block, transpose the last two\n * characters.\n */\n\n\nfunction keyCommandTransposeCharacters(editorState) {\n var selection = editorState.getSelection();\n\n if (!selection.isCollapsed()) {\n return editorState;\n }\n\n var offset = selection.getAnchorOffset();\n\n if (offset === 0) {\n return editorState;\n }\n\n var blockKey = selection.getAnchorKey();\n var content = editorState.getCurrentContent();\n var block = content.getBlockForKey(blockKey);\n var length = block.getLength(); // Nothing to transpose if there aren't two characters.\n\n if (length <= 1) {\n return editorState;\n }\n\n var removalRange;\n var finalSelection;\n\n if (offset === length) {\n // The cursor is at the end of the block. Swap the last two characters.\n removalRange = selection.set('anchorOffset', offset - 1);\n finalSelection = selection;\n } else {\n removalRange = selection.set('focusOffset', offset + 1);\n finalSelection = removalRange.set('anchorOffset', offset + 1);\n } // Extract the character to move as a fragment. This preserves its\n // styling and entity, if any.\n\n\n var movedFragment = getContentStateFragment(content, removalRange);\n var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward'); // After the removal, the insertion target is one character back.\n\n var selectionAfter = afterRemoval.getSelectionAfter();\n var targetOffset = selectionAfter.getAnchorOffset() - 1;\n var targetRange = selectionAfter.merge({\n anchorOffset: targetOffset,\n focusOffset: targetOffset\n });\n var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n return EditorState.acceptSelection(newEditorState, finalSelection);\n}\n\nmodule.exports = keyCommandTransposeCharacters;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nfunction keyCommandUndo(e, editorState, updateFn) {\n var undoneState = EditorState.undo(editorState); // If the last change to occur was a spellcheck change, allow the undo\n // event to fall through to the browser. This allows the browser to record\n // the unwanted change, which should soon lead it to learn not to suggest\n // the correction again.\n\n if (editorState.getLastChangeType() === 'spellcheck-change') {\n var nativelyRenderedContent = undoneState.getCurrentContent();\n updateFn(EditorState.set(undoneState, {\n nativelyRenderedContent: nativelyRenderedContent\n }));\n return;\n } // Otheriwse, manage the undo behavior manually.\n\n\n e.preventDefault();\n\n if (!editorState.getNativelyRenderedContent()) {\n updateFn(undoneState);\n return;\n } // Trigger a re-render with the current content state to ensure that the\n // component tree has up-to-date props for comparison.\n\n\n updateFn(EditorState.set(editorState, {\n nativelyRenderedContent: null\n })); // Wait to ensure that the re-render has occurred before performing\n // the undo action.\n\n setTimeout(function () {\n updateFn(undoneState);\n }, 0);\n}\n\nmodule.exports = keyCommandUndo;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar Immutable = require(\"immutable\");\n\nvar Map = Immutable.Map;\n\nfunction modifyBlockForContentState(contentState, selectionState, operation) {\n var startKey = selectionState.getStartKey();\n var endKey = selectionState.getEndKey();\n var blockMap = contentState.getBlockMap();\n var newBlocks = blockMap.toSeq().skipUntil(function (_, k) {\n return k === startKey;\n }).takeUntil(function (_, k) {\n return k === endKey;\n }).concat(Map([[endKey, blockMap.get(endKey)]])).map(operation);\n return contentState.merge({\n blockMap: blockMap.merge(newBlocks),\n selectionBefore: selectionState,\n selectionAfter: selectionState\n });\n}\n\nmodule.exports = modifyBlockForContentState;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar getNextDelimiterBlockKey = require(\"./getNextDelimiterBlockKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar OrderedMap = Immutable.OrderedMap,\n List = Immutable.List;\n\nvar transformBlock = function transformBlock(key, blockMap, func) {\n if (!key) {\n return;\n }\n\n var block = blockMap.get(key);\n\n if (!block) {\n return;\n }\n\n blockMap.set(key, func(block));\n};\n\nvar updateBlockMapLinks = function updateBlockMapLinks(blockMap, originalBlockToBeMoved, originalTargetBlock, insertionMode, isExperimentalTreeBlock) {\n if (!isExperimentalTreeBlock) {\n return blockMap;\n } // possible values of 'insertionMode' are: 'after', 'before'\n\n\n var isInsertedAfterTarget = insertionMode === 'after';\n var originalBlockKey = originalBlockToBeMoved.getKey();\n var originalTargetKey = originalTargetBlock.getKey();\n var originalParentKey = originalBlockToBeMoved.getParentKey();\n var originalNextSiblingKey = originalBlockToBeMoved.getNextSiblingKey();\n var originalPrevSiblingKey = originalBlockToBeMoved.getPrevSiblingKey();\n var newParentKey = originalTargetBlock.getParentKey();\n var newNextSiblingKey = isInsertedAfterTarget ? originalTargetBlock.getNextSiblingKey() : originalTargetKey;\n var newPrevSiblingKey = isInsertedAfterTarget ? originalTargetKey : originalTargetBlock.getPrevSiblingKey();\n return blockMap.withMutations(function (blocks) {\n // update old parent\n transformBlock(originalParentKey, blocks, function (block) {\n var parentChildrenList = block.getChildKeys();\n return block.merge({\n children: parentChildrenList[\"delete\"](parentChildrenList.indexOf(originalBlockKey))\n });\n }); // update old prev\n\n transformBlock(originalPrevSiblingKey, blocks, function (block) {\n return block.merge({\n nextSibling: originalNextSiblingKey\n });\n }); // update old next\n\n transformBlock(originalNextSiblingKey, blocks, function (block) {\n return block.merge({\n prevSibling: originalPrevSiblingKey\n });\n }); // update new next\n\n transformBlock(newNextSiblingKey, blocks, function (block) {\n return block.merge({\n prevSibling: originalBlockKey\n });\n }); // update new prev\n\n transformBlock(newPrevSiblingKey, blocks, function (block) {\n return block.merge({\n nextSibling: originalBlockKey\n });\n }); // update new parent\n\n transformBlock(newParentKey, blocks, function (block) {\n var newParentChildrenList = block.getChildKeys();\n var targetBlockIndex = newParentChildrenList.indexOf(originalTargetKey);\n var insertionIndex = isInsertedAfterTarget ? targetBlockIndex + 1 : targetBlockIndex !== 0 ? targetBlockIndex - 1 : 0;\n var newChildrenArray = newParentChildrenList.toArray();\n newChildrenArray.splice(insertionIndex, 0, originalBlockKey);\n return block.merge({\n children: List(newChildrenArray)\n });\n }); // update block\n\n transformBlock(originalBlockKey, blocks, function (block) {\n return block.merge({\n nextSibling: newNextSiblingKey,\n prevSibling: newPrevSiblingKey,\n parent: newParentKey\n });\n });\n });\n};\n\nvar moveBlockInContentState = function moveBlockInContentState(contentState, blockToBeMoved, targetBlock, insertionMode) {\n !(insertionMode !== 'replace') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Replacing blocks is not supported.') : invariant(false) : void 0;\n var targetKey = targetBlock.getKey();\n var blockKey = blockToBeMoved.getKey();\n !(blockKey !== targetKey) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0;\n var blockMap = contentState.getBlockMap();\n var isExperimentalTreeBlock = blockToBeMoved instanceof ContentBlockNode;\n var blocksToBeMoved = [blockToBeMoved];\n var blockMapWithoutBlocksToBeMoved = blockMap[\"delete\"](blockKey);\n\n if (isExperimentalTreeBlock) {\n blocksToBeMoved = [];\n blockMapWithoutBlocksToBeMoved = blockMap.withMutations(function (blocks) {\n var nextSiblingKey = blockToBeMoved.getNextSiblingKey();\n var nextDelimiterBlockKey = getNextDelimiterBlockKey(blockToBeMoved, blocks);\n blocks.toSeq().skipUntil(function (block) {\n return block.getKey() === blockKey;\n }).takeWhile(function (block) {\n var key = block.getKey();\n var isBlockToBeMoved = key === blockKey;\n var hasNextSiblingAndIsNotNextSibling = nextSiblingKey && key !== nextSiblingKey;\n var doesNotHaveNextSiblingAndIsNotDelimiter = !nextSiblingKey && block.getParentKey() && (!nextDelimiterBlockKey || key !== nextDelimiterBlockKey);\n return !!(isBlockToBeMoved || hasNextSiblingAndIsNotNextSibling || doesNotHaveNextSiblingAndIsNotDelimiter);\n }).forEach(function (block) {\n blocksToBeMoved.push(block);\n blocks[\"delete\"](block.getKey());\n });\n });\n }\n\n var blocksBefore = blockMapWithoutBlocksToBeMoved.toSeq().takeUntil(function (v) {\n return v === targetBlock;\n });\n var blocksAfter = blockMapWithoutBlocksToBeMoved.toSeq().skipUntil(function (v) {\n return v === targetBlock;\n }).skip(1);\n var slicedBlocks = blocksToBeMoved.map(function (block) {\n return [block.getKey(), block];\n });\n var newBlocks = OrderedMap();\n\n if (insertionMode === 'before') {\n var blockBefore = contentState.getBlockBefore(targetKey);\n !(!blockBefore || blockBefore.getKey() !== blockToBeMoved.getKey()) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0;\n newBlocks = blocksBefore.concat([].concat(slicedBlocks, [[targetKey, targetBlock]]), blocksAfter).toOrderedMap();\n } else if (insertionMode === 'after') {\n var blockAfter = contentState.getBlockAfter(targetKey);\n !(!blockAfter || blockAfter.getKey() !== blockKey) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0;\n newBlocks = blocksBefore.concat([[targetKey, targetBlock]].concat(slicedBlocks), blocksAfter).toOrderedMap();\n }\n\n return contentState.merge({\n blockMap: updateBlockMapLinks(newBlocks, blockToBeMoved, targetBlock, insertionMode, isExperimentalTreeBlock),\n selectionBefore: contentState.getSelectionAfter(),\n selectionAfter: contentState.getSelectionAfter().merge({\n anchorKey: blockKey,\n focusKey: blockKey\n })\n });\n};\n\nmodule.exports = moveBlockInContentState;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar warning = require(\"fbjs/lib/warning\");\n/**\n * Given a collapsed selection, move the focus `maxDistance` backward within\n * the selected block. If the selection will go beyond the start of the block,\n * move focus to the end of the previous block, but no further.\n *\n * This function is not Unicode-aware, so surrogate pairs will be treated\n * as having length 2.\n */\n\n\nfunction moveSelectionBackward(editorState, maxDistance) {\n var selection = editorState.getSelection(); // Should eventually make this an invariant\n\n process.env.NODE_ENV !== \"production\" ? warning(selection.isCollapsed(), 'moveSelectionBackward should only be called with a collapsed SelectionState') : void 0;\n var content = editorState.getCurrentContent();\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var focusKey = key;\n var focusOffset = 0;\n\n if (maxDistance > offset) {\n var keyBefore = content.getKeyBefore(key);\n\n if (keyBefore == null) {\n focusKey = key;\n } else {\n focusKey = keyBefore;\n var blockBefore = content.getBlockForKey(keyBefore);\n focusOffset = blockBefore.getText().length;\n }\n } else {\n focusOffset = offset - maxDistance;\n }\n\n return selection.merge({\n focusKey: focusKey,\n focusOffset: focusOffset,\n isBackward: true\n });\n}\n\nmodule.exports = moveSelectionBackward;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar warning = require(\"fbjs/lib/warning\");\n/**\n * Given a collapsed selection, move the focus `maxDistance` forward within\n * the selected block. If the selection will go beyond the end of the block,\n * move focus to the start of the next block, but no further.\n *\n * This function is not Unicode-aware, so surrogate pairs will be treated\n * as having length 2.\n */\n\n\nfunction moveSelectionForward(editorState, maxDistance) {\n var selection = editorState.getSelection(); // Should eventually make this an invariant\n\n process.env.NODE_ENV !== \"production\" ? warning(selection.isCollapsed(), 'moveSelectionForward should only be called with a collapsed SelectionState') : void 0;\n var key = selection.getStartKey();\n var offset = selection.getStartOffset();\n var content = editorState.getCurrentContent();\n var focusKey = key;\n var focusOffset;\n var block = content.getBlockForKey(key);\n\n if (maxDistance > block.getText().length - offset) {\n focusKey = content.getKeyAfter(key);\n focusOffset = 0;\n } else {\n focusOffset = offset + maxDistance;\n }\n\n return selection.merge({\n focusKey: focusKey,\n focusOffset: focusOffset\n });\n}\n\nmodule.exports = moveSelectionForward;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar OrderedMap = Immutable.OrderedMap;\n\nvar randomizeContentBlockNodeKeys = function randomizeContentBlockNodeKeys(blockMap) {\n var newKeysRef = {}; // we keep track of root blocks in order to update subsequent sibling links\n\n var lastRootBlock;\n return OrderedMap(blockMap.withMutations(function (blockMapState) {\n blockMapState.forEach(function (block, index) {\n var oldKey = block.getKey();\n var nextKey = block.getNextSiblingKey();\n var prevKey = block.getPrevSiblingKey();\n var childrenKeys = block.getChildKeys();\n var parentKey = block.getParentKey(); // new key that we will use to build linking\n\n var key = generateRandomKey(); // we will add it here to re-use it later\n\n newKeysRef[oldKey] = key;\n\n if (nextKey) {\n var nextBlock = blockMapState.get(nextKey);\n\n if (nextBlock) {\n blockMapState.setIn([nextKey, 'prevSibling'], key);\n } else {\n // this can happen when generating random keys for fragments\n blockMapState.setIn([oldKey, 'nextSibling'], null);\n }\n }\n\n if (prevKey) {\n var prevBlock = blockMapState.get(prevKey);\n\n if (prevBlock) {\n blockMapState.setIn([prevKey, 'nextSibling'], key);\n } else {\n // this can happen when generating random keys for fragments\n blockMapState.setIn([oldKey, 'prevSibling'], null);\n }\n }\n\n if (parentKey && blockMapState.get(parentKey)) {\n var parentBlock = blockMapState.get(parentKey);\n var parentChildrenList = parentBlock.getChildKeys();\n blockMapState.setIn([parentKey, 'children'], parentChildrenList.set(parentChildrenList.indexOf(block.getKey()), key));\n } else {\n // blocks will then be treated as root block nodes\n blockMapState.setIn([oldKey, 'parent'], null);\n\n if (lastRootBlock) {\n blockMapState.setIn([lastRootBlock.getKey(), 'nextSibling'], key);\n blockMapState.setIn([oldKey, 'prevSibling'], newKeysRef[lastRootBlock.getKey()]);\n }\n\n lastRootBlock = blockMapState.get(oldKey);\n }\n\n childrenKeys.forEach(function (childKey) {\n var childBlock = blockMapState.get(childKey);\n\n if (childBlock) {\n blockMapState.setIn([childKey, 'parent'], key);\n } else {\n blockMapState.setIn([oldKey, 'children'], block.getChildKeys().filter(function (child) {\n return child !== childKey;\n }));\n }\n });\n });\n }).toArray().map(function (block) {\n return [newKeysRef[block.getKey()], block.set('key', newKeysRef[block.getKey()])];\n }));\n};\n\nvar randomizeContentBlockKeys = function randomizeContentBlockKeys(blockMap) {\n return OrderedMap(blockMap.toArray().map(function (block) {\n var key = generateRandomKey();\n return [key, block.set('key', key)];\n }));\n};\n\nvar randomizeBlockMapKeys = function randomizeBlockMapKeys(blockMap) {\n var isTreeBasedBlockMap = blockMap.first() instanceof ContentBlockNode;\n\n if (!isTreeBasedBlockMap) {\n return randomizeContentBlockKeys(blockMap);\n }\n\n return randomizeContentBlockNodeKeys(blockMap);\n};\n\nmodule.exports = randomizeBlockMapKeys;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar findRangesImmutable = require(\"./findRangesImmutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nfunction removeEntitiesAtEdges(contentState, selectionState) {\n var blockMap = contentState.getBlockMap();\n var entityMap = contentState.getEntityMap();\n var updatedBlocks = {};\n var startKey = selectionState.getStartKey();\n var startOffset = selectionState.getStartOffset();\n var startBlock = blockMap.get(startKey);\n var updatedStart = removeForBlock(entityMap, startBlock, startOffset);\n\n if (updatedStart !== startBlock) {\n updatedBlocks[startKey] = updatedStart;\n }\n\n var endKey = selectionState.getEndKey();\n var endOffset = selectionState.getEndOffset();\n var endBlock = blockMap.get(endKey);\n\n if (startKey === endKey) {\n endBlock = updatedStart;\n }\n\n var updatedEnd = removeForBlock(entityMap, endBlock, endOffset);\n\n if (updatedEnd !== endBlock) {\n updatedBlocks[endKey] = updatedEnd;\n }\n\n if (!Object.keys(updatedBlocks).length) {\n return contentState.set('selectionAfter', selectionState);\n }\n\n return contentState.merge({\n blockMap: blockMap.merge(updatedBlocks),\n selectionAfter: selectionState\n });\n}\n/**\n * Given a list of characters and an offset that is in the middle of an entity,\n * returns the start and end of the entity that is overlapping the offset.\n * Note: This method requires that the offset be in an entity range.\n */\n\n\nfunction getRemovalRange(characters, entityKey, offset) {\n var removalRange; // Iterates through a list looking for ranges of matching items\n // based on the 'isEqual' callback.\n // Then instead of returning the result, call the 'found' callback\n // with each range.\n // Then filters those ranges based on the 'filter' callback\n //\n // Here we use it to find ranges of characters with the same entity key.\n\n findRangesImmutable(characters, // the list to iterate through\n function (a, b) {\n return a.getEntity() === b.getEntity();\n }, // 'isEqual' callback\n function (element) {\n return element.getEntity() === entityKey;\n }, // 'filter' callback\n function (start, end) {\n // 'found' callback\n if (start <= offset && end >= offset) {\n // this entity overlaps the offset index\n removalRange = {\n start: start,\n end: end\n };\n }\n });\n !(typeof removalRange === 'object') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Removal range must exist within character list.') : invariant(false) : void 0;\n return removalRange;\n}\n\nfunction removeForBlock(entityMap, block, offset) {\n var chars = block.getCharacterList();\n var charBefore = offset > 0 ? chars.get(offset - 1) : undefined;\n var charAfter = offset < chars.count() ? chars.get(offset) : undefined;\n var entityBeforeCursor = charBefore ? charBefore.getEntity() : undefined;\n var entityAfterCursor = charAfter ? charAfter.getEntity() : undefined;\n\n if (entityAfterCursor && entityAfterCursor === entityBeforeCursor) {\n var entity = entityMap.__get(entityAfterCursor);\n\n if (entity.getMutability() !== 'MUTABLE') {\n var _getRemovalRange = getRemovalRange(chars, entityAfterCursor, offset),\n start = _getRemovalRange.start,\n end = _getRemovalRange.end;\n\n var current;\n\n while (start < end) {\n current = chars.get(start);\n chars = chars.set(start, CharacterMetadata.applyEntity(current, null));\n start++;\n }\n\n return block.set('characterList', chars);\n }\n }\n\n return block;\n}\n\nmodule.exports = removeEntitiesAtEdges;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar getNextDelimiterBlockKey = require(\"./getNextDelimiterBlockKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar List = Immutable.List,\n Map = Immutable.Map;\n\nvar transformBlock = function transformBlock(key, blockMap, func) {\n if (!key) {\n return;\n }\n\n var block = blockMap.get(key);\n\n if (!block) {\n return;\n }\n\n blockMap.set(key, func(block));\n};\n/**\n * Ancestors needs to be preserved when there are non selected\n * children to make sure we do not leave any orphans behind\n */\n\n\nvar getAncestorsKeys = function getAncestorsKeys(blockKey, blockMap) {\n var parents = [];\n\n if (!blockKey) {\n return parents;\n }\n\n var blockNode = blockMap.get(blockKey);\n\n while (blockNode && blockNode.getParentKey()) {\n var parentKey = blockNode.getParentKey();\n\n if (parentKey) {\n parents.push(parentKey);\n }\n\n blockNode = parentKey ? blockMap.get(parentKey) : null;\n }\n\n return parents;\n};\n/**\n * Get all next delimiter keys until we hit a root delimiter and return\n * an array of key references\n */\n\n\nvar getNextDelimitersBlockKeys = function getNextDelimitersBlockKeys(block, blockMap) {\n var nextDelimiters = [];\n\n if (!block) {\n return nextDelimiters;\n }\n\n var nextDelimiter = getNextDelimiterBlockKey(block, blockMap);\n\n while (nextDelimiter && blockMap.get(nextDelimiter)) {\n var _block = blockMap.get(nextDelimiter);\n\n nextDelimiters.push(nextDelimiter); // we do not need to keep checking all root node siblings, just the first occurance\n\n nextDelimiter = _block.getParentKey() ? getNextDelimiterBlockKey(_block, blockMap) : null;\n }\n\n return nextDelimiters;\n};\n\nvar getNextValidSibling = function getNextValidSibling(block, blockMap, originalBlockMap) {\n if (!block) {\n return null;\n } // note that we need to make sure we refer to the original block since this\n // function is called within a withMutations\n\n\n var nextValidSiblingKey = originalBlockMap.get(block.getKey()).getNextSiblingKey();\n\n while (nextValidSiblingKey && !blockMap.get(nextValidSiblingKey)) {\n nextValidSiblingKey = originalBlockMap.get(nextValidSiblingKey).getNextSiblingKey() || null;\n }\n\n return nextValidSiblingKey;\n};\n\nvar getPrevValidSibling = function getPrevValidSibling(block, blockMap, originalBlockMap) {\n if (!block) {\n return null;\n } // note that we need to make sure we refer to the original block since this\n // function is called within a withMutations\n\n\n var prevValidSiblingKey = originalBlockMap.get(block.getKey()).getPrevSiblingKey();\n\n while (prevValidSiblingKey && !blockMap.get(prevValidSiblingKey)) {\n prevValidSiblingKey = originalBlockMap.get(prevValidSiblingKey).getPrevSiblingKey() || null;\n }\n\n return prevValidSiblingKey;\n};\n\nvar updateBlockMapLinks = function updateBlockMapLinks(blockMap, startBlock, endBlock, originalBlockMap) {\n return blockMap.withMutations(function (blocks) {\n // update start block if its retained\n transformBlock(startBlock.getKey(), blocks, function (block) {\n return block.merge({\n nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n });\n }); // update endblock if its retained\n\n transformBlock(endBlock.getKey(), blocks, function (block) {\n return block.merge({\n nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n });\n }); // update start block parent ancestors\n\n getAncestorsKeys(startBlock.getKey(), originalBlockMap).forEach(function (parentKey) {\n return transformBlock(parentKey, blocks, function (block) {\n return block.merge({\n children: block.getChildKeys().filter(function (key) {\n return blocks.get(key);\n }),\n nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n });\n });\n }); // update start block next - can only happen if startBlock == endBlock\n\n transformBlock(startBlock.getNextSiblingKey(), blocks, function (block) {\n return block.merge({\n prevSibling: startBlock.getPrevSiblingKey()\n });\n }); // update start block prev\n\n transformBlock(startBlock.getPrevSiblingKey(), blocks, function (block) {\n return block.merge({\n nextSibling: getNextValidSibling(block, blocks, originalBlockMap)\n });\n }); // update end block next\n\n transformBlock(endBlock.getNextSiblingKey(), blocks, function (block) {\n return block.merge({\n prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n });\n }); // update end block prev\n\n transformBlock(endBlock.getPrevSiblingKey(), blocks, function (block) {\n return block.merge({\n nextSibling: endBlock.getNextSiblingKey()\n });\n }); // update end block parent ancestors\n\n getAncestorsKeys(endBlock.getKey(), originalBlockMap).forEach(function (parentKey) {\n transformBlock(parentKey, blocks, function (block) {\n return block.merge({\n children: block.getChildKeys().filter(function (key) {\n return blocks.get(key);\n }),\n nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n });\n });\n }); // update next delimiters all the way to a root delimiter\n\n getNextDelimitersBlockKeys(endBlock, originalBlockMap).forEach(function (delimiterKey) {\n return transformBlock(delimiterKey, blocks, function (block) {\n return block.merge({\n nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n });\n });\n }); // if parent (startBlock) was deleted\n\n if (blockMap.get(startBlock.getKey()) == null && blockMap.get(endBlock.getKey()) != null && endBlock.getParentKey() === startBlock.getKey() && endBlock.getPrevSiblingKey() == null) {\n var prevSiblingKey = startBlock.getPrevSiblingKey(); // endBlock becomes next sibling of parent's prevSibling\n\n transformBlock(endBlock.getKey(), blocks, function (block) {\n return block.merge({\n prevSibling: prevSiblingKey\n });\n });\n transformBlock(prevSiblingKey, blocks, function (block) {\n return block.merge({\n nextSibling: endBlock.getKey()\n });\n }); // Update parent for previous parent's children, and children for that parent\n\n var prevSibling = prevSiblingKey ? blockMap.get(prevSiblingKey) : null;\n var newParentKey = prevSibling ? prevSibling.getParentKey() : null;\n startBlock.getChildKeys().forEach(function (childKey) {\n transformBlock(childKey, blocks, function (block) {\n return block.merge({\n parent: newParentKey // set to null if there is no parent\n\n });\n });\n });\n\n if (newParentKey != null) {\n var newParent = blockMap.get(newParentKey);\n transformBlock(newParentKey, blocks, function (block) {\n return block.merge({\n children: newParent.getChildKeys().concat(startBlock.getChildKeys())\n });\n });\n } // last child of deleted parent should point to next sibling\n\n\n transformBlock(startBlock.getChildKeys().find(function (key) {\n var block = blockMap.get(key);\n return block.getNextSiblingKey() === null;\n }), blocks, function (block) {\n return block.merge({\n nextSibling: startBlock.getNextSiblingKey()\n });\n });\n }\n });\n};\n\nvar removeRangeFromContentState = function removeRangeFromContentState(contentState, selectionState) {\n if (selectionState.isCollapsed()) {\n return contentState;\n }\n\n var blockMap = contentState.getBlockMap();\n var startKey = selectionState.getStartKey();\n var startOffset = selectionState.getStartOffset();\n var endKey = selectionState.getEndKey();\n var endOffset = selectionState.getEndOffset();\n var startBlock = blockMap.get(startKey);\n var endBlock = blockMap.get(endKey); // we assume that ContentBlockNode and ContentBlocks are not mixed together\n\n var isExperimentalTreeBlock = startBlock instanceof ContentBlockNode; // used to retain blocks that should not be deleted to avoid orphan children\n\n var parentAncestors = [];\n\n if (isExperimentalTreeBlock) {\n var endBlockchildrenKeys = endBlock.getChildKeys();\n var endBlockAncestors = getAncestorsKeys(endKey, blockMap); // endBlock has unselected siblings so we can not remove its ancestors parents\n\n if (endBlock.getNextSiblingKey()) {\n parentAncestors = parentAncestors.concat(endBlockAncestors);\n } // endBlock has children so can not remove this block or any of its ancestors\n\n\n if (!endBlockchildrenKeys.isEmpty()) {\n parentAncestors = parentAncestors.concat(endBlockAncestors.concat([endKey]));\n } // we need to retain all ancestors of the next delimiter block\n\n\n parentAncestors = parentAncestors.concat(getAncestorsKeys(getNextDelimiterBlockKey(endBlock, blockMap), blockMap));\n }\n\n var characterList;\n\n if (startBlock === endBlock) {\n characterList = removeFromList(startBlock.getCharacterList(), startOffset, endOffset);\n } else {\n characterList = startBlock.getCharacterList().slice(0, startOffset).concat(endBlock.getCharacterList().slice(endOffset));\n }\n\n var modifiedStart = startBlock.merge({\n text: startBlock.getText().slice(0, startOffset) + endBlock.getText().slice(endOffset),\n characterList: characterList\n }); // If cursor (collapsed) is at the start of the first child, delete parent\n // instead of child\n\n var shouldDeleteParent = isExperimentalTreeBlock && startOffset === 0 && endOffset === 0 && endBlock.getParentKey() === startKey && endBlock.getPrevSiblingKey() == null;\n var newBlocks = shouldDeleteParent ? Map([[startKey, null]]) : blockMap.toSeq().skipUntil(function (_, k) {\n return k === startKey;\n }).takeUntil(function (_, k) {\n return k === endKey;\n }).filter(function (_, k) {\n return parentAncestors.indexOf(k) === -1;\n }).concat(Map([[endKey, null]])).map(function (_, k) {\n return k === startKey ? modifiedStart : null;\n });\n var updatedBlockMap = blockMap.merge(newBlocks).filter(function (block) {\n return !!block;\n }); // Only update tree block pointers if the range is across blocks\n\n if (isExperimentalTreeBlock && startBlock !== endBlock) {\n updatedBlockMap = updateBlockMapLinks(updatedBlockMap, startBlock, endBlock, blockMap);\n }\n\n return contentState.merge({\n blockMap: updatedBlockMap,\n selectionBefore: selectionState,\n selectionAfter: selectionState.merge({\n anchorKey: startKey,\n anchorOffset: startOffset,\n focusKey: startKey,\n focusOffset: startOffset,\n isBackward: false\n })\n });\n};\n/**\n * Maintain persistence for target list when removing characters on the\n * head and tail of the character list.\n */\n\n\nvar removeFromList = function removeFromList(targetList, startOffset, endOffset) {\n if (startOffset === 0) {\n while (startOffset < endOffset) {\n targetList = targetList.shift();\n startOffset++;\n }\n } else if (endOffset === targetList.count()) {\n while (endOffset > startOffset) {\n targetList = targetList.pop();\n endOffset--;\n }\n } else {\n var head = targetList.slice(0, startOffset);\n var tail = targetList.slice(endOffset);\n targetList = head.concat(tail).toList();\n }\n\n return targetList;\n};\n\nmodule.exports = removeRangeFromContentState;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar gkx = require(\"./gkx\");\n\nvar experimentalTreeDataSupport = gkx('draft_tree_data_support');\n/**\n * For a collapsed selection state, remove text based on the specified strategy.\n * If the selection state is not collapsed, remove the entire selected range.\n */\n\nfunction removeTextWithStrategy(editorState, strategy, direction) {\n var selection = editorState.getSelection();\n var content = editorState.getCurrentContent();\n var target = selection;\n var anchorKey = selection.getAnchorKey();\n var focusKey = selection.getFocusKey();\n var anchorBlock = content.getBlockForKey(anchorKey);\n\n if (experimentalTreeDataSupport) {\n if (direction === 'forward') {\n if (anchorKey !== focusKey) {\n // For now we ignore forward delete across blocks,\n // if there is demand for this we will implement it.\n return content;\n }\n }\n }\n\n if (selection.isCollapsed()) {\n if (direction === 'forward') {\n if (editorState.isSelectionAtEndOfContent()) {\n return content;\n }\n\n if (experimentalTreeDataSupport) {\n var isAtEndOfBlock = selection.getAnchorOffset() === content.getBlockForKey(anchorKey).getLength();\n\n if (isAtEndOfBlock) {\n var anchorBlockSibling = content.getBlockForKey(anchorBlock.nextSibling);\n\n if (!anchorBlockSibling || anchorBlockSibling.getLength() === 0) {\n // For now we ignore forward delete at the end of a block,\n // if there is demand for this we will implement it.\n return content;\n }\n }\n }\n } else if (editorState.isSelectionAtStartOfContent()) {\n return content;\n }\n\n target = strategy(editorState);\n\n if (target === selection) {\n return content;\n }\n }\n\n return DraftModifier.removeRange(content, target, direction);\n}\n\nmodule.exports = removeTextWithStrategy;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar REGEX_BLOCK_DELIMITER = new RegExp('\\r', 'g');\n\nfunction sanitizeDraftText(input) {\n return input.replace(REGEX_BLOCK_DELIMITER, '');\n}\n\nmodule.exports = sanitizeDraftText;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftEffects = require(\"./DraftEffects\");\n\nvar DraftJsDebugLogging = require(\"./DraftJsDebugLogging\");\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar containsNode = require(\"fbjs/lib/containsNode\");\n\nvar getActiveElement = require(\"fbjs/lib/getActiveElement\");\n\nvar getCorrectDocumentFromNode = require(\"./getCorrectDocumentFromNode\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isElement = require(\"./isElement\");\n\nvar isIE = UserAgent.isBrowser('IE');\n\nfunction getAnonymizedDOM(node, getNodeLabels) {\n if (!node) {\n return '[empty]';\n }\n\n var anonymized = anonymizeTextWithin(node, getNodeLabels);\n\n if (anonymized.nodeType === Node.TEXT_NODE) {\n return anonymized.textContent;\n }\n\n !isElement(anonymized) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Node must be an Element if it is not a text node.') : invariant(false) : void 0;\n var castedElement = anonymized;\n return castedElement.outerHTML;\n}\n\nfunction anonymizeTextWithin(node, getNodeLabels) {\n var labels = getNodeLabels !== undefined ? getNodeLabels(node) : [];\n\n if (node.nodeType === Node.TEXT_NODE) {\n var length = node.textContent.length;\n return getCorrectDocumentFromNode(node).createTextNode('[text ' + length + (labels.length ? ' | ' + labels.join(', ') : '') + ']');\n }\n\n var clone = node.cloneNode();\n\n if (clone.nodeType === 1 && labels.length) {\n clone.setAttribute('data-labels', labels.join(', '));\n }\n\n var childNodes = node.childNodes;\n\n for (var ii = 0; ii < childNodes.length; ii++) {\n clone.appendChild(anonymizeTextWithin(childNodes[ii], getNodeLabels));\n }\n\n return clone;\n}\n\nfunction getAnonymizedEditorDOM(node, getNodeLabels) {\n // grabbing the DOM content of the Draft editor\n var currentNode = node; // this should only be used after checking with isElement\n\n var castedNode = currentNode;\n\n while (currentNode) {\n if (isElement(currentNode) && castedNode.hasAttribute('contenteditable')) {\n // found the Draft editor container\n return getAnonymizedDOM(currentNode, getNodeLabels);\n } else {\n currentNode = currentNode.parentNode;\n castedNode = currentNode;\n }\n }\n\n return 'Could not find contentEditable parent of node';\n}\n\nfunction getNodeLength(node) {\n return node.nodeValue === null ? node.childNodes.length : node.nodeValue.length;\n}\n/**\n * In modern non-IE browsers, we can support both forward and backward\n * selections.\n *\n * Note: IE10+ supports the Selection object, but it does not support\n * the `extend` method, which means that even in modern IE, it's not possible\n * to programatically create a backward selection. Thus, for all IE\n * versions, we use the old IE API to create our selections.\n */\n\n\nfunction setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n // It's possible that the editor has been removed from the DOM but\n // our selection code doesn't know it yet. Forcing selection in\n // this case may lead to errors, so just bail now.\n var documentObject = getCorrectDocumentFromNode(node);\n\n if (!containsNode(documentObject.documentElement, node)) {\n return;\n }\n\n var selection = documentObject.defaultView.getSelection();\n var anchorKey = selectionState.getAnchorKey();\n var anchorOffset = selectionState.getAnchorOffset();\n var focusKey = selectionState.getFocusKey();\n var focusOffset = selectionState.getFocusOffset();\n var isBackward = selectionState.getIsBackward(); // IE doesn't support backward selection. Swap key/offset pairs.\n\n if (!selection.extend && isBackward) {\n var tempKey = anchorKey;\n var tempOffset = anchorOffset;\n anchorKey = focusKey;\n anchorOffset = focusOffset;\n focusKey = tempKey;\n focusOffset = tempOffset;\n isBackward = false;\n }\n\n var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset; // If the selection is entirely bound within this node, set the selection\n // and be done.\n\n if (hasAnchor && hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n return;\n }\n\n if (!isBackward) {\n // If the anchor is within this node, set the range start.\n if (hasAnchor) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n } // If the focus is within this node, we can assume that we have\n // already set the appropriate start range on the selection, and\n // can simply extend the selection.\n\n\n if (hasFocus) {\n addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n }\n } else {\n // If this node has the focus, set the selection range to be a\n // collapsed range beginning here. Later, when we encounter the anchor,\n // we'll use this information to extend the selection.\n if (hasFocus) {\n selection.removeAllRanges();\n addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n } // If this node has the anchor, we may assume that the correct\n // focus information is already stored on the selection object.\n // We keep track of it, reset the selection range, and extend it\n // back to the focus point.\n\n\n if (hasAnchor) {\n var storedFocusNode = selection.focusNode;\n var storedFocusOffset = selection.focusOffset;\n selection.removeAllRanges();\n addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n }\n }\n}\n/**\n * Extend selection towards focus point.\n */\n\n\nfunction addFocusToSelection(selection, node, offset, selectionState) {\n var activeElement = getActiveElement();\n var extend = selection.extend; // containsNode returns false if node is null.\n // Let's refine the type of this value out here so flow knows.\n\n if (extend && node != null && containsNode(activeElement, node)) {\n // If `extend` is called while another element has focus, an error is\n // thrown. We therefore disable `extend` if the active element is somewhere\n // other than the node we are selecting. This should only occur in Firefox,\n // since it is the only browser to support multiple selections.\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=921444.\n // logging to catch bug that is being reported in t16250795\n if (offset > getNodeLength(node)) {\n // the call to 'selection.extend' is about to throw\n DraftJsDebugLogging.logSelectionStateFailure({\n anonymizedDom: getAnonymizedEditorDOM(node),\n extraParams: JSON.stringify({\n offset: offset\n }),\n selectionState: JSON.stringify(selectionState.toJS())\n });\n } // logging to catch bug that is being reported in t18110632\n\n\n var nodeWasFocus = node === selection.focusNode;\n\n try {\n // Fixes some reports of \"InvalidStateError: Failed to execute 'extend' on\n // 'Selection': This Selection object doesn't have any Ranges.\"\n // Note: selection.extend does not exist in IE.\n if (selection.rangeCount > 0 && selection.extend) {\n selection.extend(node, offset);\n }\n } catch (e) {\n DraftJsDebugLogging.logSelectionStateFailure({\n anonymizedDom: getAnonymizedEditorDOM(node, function (n) {\n var labels = [];\n\n if (n === activeElement) {\n labels.push('active element');\n }\n\n if (n === selection.anchorNode) {\n labels.push('selection anchor node');\n }\n\n if (n === selection.focusNode) {\n labels.push('selection focus node');\n }\n\n return labels;\n }),\n extraParams: JSON.stringify({\n activeElementName: activeElement ? activeElement.nodeName : null,\n nodeIsFocus: node === selection.focusNode,\n nodeWasFocus: nodeWasFocus,\n selectionRangeCount: selection.rangeCount,\n selectionAnchorNodeName: selection.anchorNode ? selection.anchorNode.nodeName : null,\n selectionAnchorOffset: selection.anchorOffset,\n selectionFocusNodeName: selection.focusNode ? selection.focusNode.nodeName : null,\n selectionFocusOffset: selection.focusOffset,\n message: e ? '' + e : null,\n offset: offset\n }, null, 2),\n selectionState: JSON.stringify(selectionState.toJS(), null, 2)\n }); // allow the error to be thrown -\n // better than continuing in a broken state\n\n throw e;\n }\n } else {\n // IE doesn't support extend. This will mean no backward selection.\n // Extract the existing selection range and add focus to it.\n // Additionally, clone the selection range. IE11 throws an\n // InvalidStateError when attempting to access selection properties\n // after the range is detached.\n if (node && selection.rangeCount > 0) {\n var range = selection.getRangeAt(0);\n range.setEnd(node, offset);\n selection.addRange(range.cloneRange());\n }\n }\n}\n\nfunction addPointToSelection(selection, node, offset, selectionState) {\n var range = getCorrectDocumentFromNode(node).createRange(); // logging to catch bug that is being reported in t16250795\n\n if (offset > getNodeLength(node)) {\n // in this case we know that the call to 'range.setStart' is about to throw\n DraftJsDebugLogging.logSelectionStateFailure({\n anonymizedDom: getAnonymizedEditorDOM(node),\n extraParams: JSON.stringify({\n offset: offset\n }),\n selectionState: JSON.stringify(selectionState.toJS())\n });\n DraftEffects.handleExtensionCausedError();\n }\n\n range.setStart(node, offset); // IE sometimes throws Unspecified Error when trying to addRange\n\n if (isIE) {\n try {\n selection.addRange(range);\n } catch (e) {\n if (process.env.NODE_ENV !== \"production\") {\n /* eslint-disable-next-line no-console */\n console.warn('Call to selection.addRange() threw exception: ', e);\n }\n }\n } else {\n selection.addRange(range);\n }\n}\n\nmodule.exports = {\n setDraftEditorSelection: setDraftEditorSelection,\n addFocusToSelection: addFocusToSelection\n};","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar modifyBlockForContentState = require(\"./modifyBlockForContentState\");\n\nvar List = Immutable.List,\n Map = Immutable.Map;\n\nvar transformBlock = function transformBlock(key, blockMap, func) {\n if (!key) {\n return;\n }\n\n var block = blockMap.get(key);\n\n if (!block) {\n return;\n }\n\n blockMap.set(key, func(block));\n};\n\nvar updateBlockMapLinks = function updateBlockMapLinks(blockMap, originalBlock, belowBlock) {\n return blockMap.withMutations(function (blocks) {\n var originalBlockKey = originalBlock.getKey();\n var belowBlockKey = belowBlock.getKey(); // update block parent\n\n transformBlock(originalBlock.getParentKey(), blocks, function (block) {\n var parentChildrenList = block.getChildKeys();\n var insertionIndex = parentChildrenList.indexOf(originalBlockKey) + 1;\n var newChildrenArray = parentChildrenList.toArray();\n newChildrenArray.splice(insertionIndex, 0, belowBlockKey);\n return block.merge({\n children: List(newChildrenArray)\n });\n }); // update original next block\n\n transformBlock(originalBlock.getNextSiblingKey(), blocks, function (block) {\n return block.merge({\n prevSibling: belowBlockKey\n });\n }); // update original block\n\n transformBlock(originalBlockKey, blocks, function (block) {\n return block.merge({\n nextSibling: belowBlockKey\n });\n }); // update below block\n\n transformBlock(belowBlockKey, blocks, function (block) {\n return block.merge({\n prevSibling: originalBlockKey\n });\n });\n });\n};\n\nvar splitBlockInContentState = function splitBlockInContentState(contentState, selectionState) {\n !selectionState.isCollapsed() ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Selection range must be collapsed.') : invariant(false) : void 0;\n var key = selectionState.getAnchorKey();\n var blockMap = contentState.getBlockMap();\n var blockToSplit = blockMap.get(key);\n var text = blockToSplit.getText();\n\n if (!text) {\n var blockType = blockToSplit.getType();\n\n if (blockType === 'unordered-list-item' || blockType === 'ordered-list-item') {\n return modifyBlockForContentState(contentState, selectionState, function (block) {\n return block.merge({\n type: 'unstyled',\n depth: 0\n });\n });\n }\n }\n\n var offset = selectionState.getAnchorOffset();\n var chars = blockToSplit.getCharacterList();\n var keyBelow = generateRandomKey();\n var isExperimentalTreeBlock = blockToSplit instanceof ContentBlockNode;\n var blockAbove = blockToSplit.merge({\n text: text.slice(0, offset),\n characterList: chars.slice(0, offset)\n });\n var blockBelow = blockAbove.merge({\n key: keyBelow,\n text: text.slice(offset),\n characterList: chars.slice(offset),\n data: Map()\n });\n var blocksBefore = blockMap.toSeq().takeUntil(function (v) {\n return v === blockToSplit;\n });\n var blocksAfter = blockMap.toSeq().skipUntil(function (v) {\n return v === blockToSplit;\n }).rest();\n var newBlocks = blocksBefore.concat([[key, blockAbove], [keyBelow, blockBelow]], blocksAfter).toOrderedMap();\n\n if (isExperimentalTreeBlock) {\n !blockToSplit.getChildKeys().isEmpty() ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'ContentBlockNode must not have children') : invariant(false) : void 0;\n newBlocks = updateBlockMapLinks(newBlocks, blockAbove, blockBelow);\n }\n\n return contentState.merge({\n blockMap: newBlocks,\n selectionBefore: selectionState,\n selectionAfter: selectionState.merge({\n anchorKey: keyBelow,\n anchorOffset: 0,\n focusKey: keyBelow,\n focusOffset: 0,\n isBackward: false\n })\n });\n};\n\nmodule.exports = splitBlockInContentState;","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar NEWLINE_REGEX = /\\r\\n?|\\n/g;\n\nfunction splitTextIntoTextBlocks(text) {\n return text.split(NEWLINE_REGEX);\n}\n\nmodule.exports = splitTextIntoTextBlocks;","\"use strict\";\n/**\n * Copyright 2004-present Facebook. All Rights Reserved.\n *\n * @typechecks\n * \n * @format\n */\n\n/*eslint-disable no-bitwise */\n\n/**\n * Based on the rfc4122-compliant solution posted at\n * http://stackoverflow.com/questions/105034\n */\n\nfunction uuid() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0;\n var v = c == 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n}\n\nmodule.exports = uuid;","require(\"core-js/modules/es.array.flat-map.js\");\n\nrequire(\"core-js/modules/es.array.unscopables.flat-map.js\");\n\n/**\n * Copyright (c) 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.Immutable = factory();\n})(this, function () {\n 'use strict';\n\n var SLICE$0 = Array.prototype.slice;\n\n function createClass(ctor, superClass) {\n if (superClass) {\n ctor.prototype = Object.create(superClass.prototype);\n }\n\n ctor.prototype.constructor = ctor;\n }\n\n function Iterable(value) {\n return isIterable(value) ? value : Seq(value);\n }\n\n createClass(KeyedIterable, Iterable);\n\n function KeyedIterable(value) {\n return isKeyed(value) ? value : KeyedSeq(value);\n }\n\n createClass(IndexedIterable, Iterable);\n\n function IndexedIterable(value) {\n return isIndexed(value) ? value : IndexedSeq(value);\n }\n\n createClass(SetIterable, Iterable);\n\n function SetIterable(value) {\n return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n }\n\n function isIterable(maybeIterable) {\n return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n }\n\n function isKeyed(maybeKeyed) {\n return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n }\n\n function isIndexed(maybeIndexed) {\n return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n }\n\n function isAssociative(maybeAssociative) {\n return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n }\n\n function isOrdered(maybeOrdered) {\n return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n }\n\n Iterable.isIterable = isIterable;\n Iterable.isKeyed = isKeyed;\n Iterable.isIndexed = isIndexed;\n Iterable.isAssociative = isAssociative;\n Iterable.isOrdered = isOrdered;\n Iterable.Keyed = KeyedIterable;\n Iterable.Indexed = IndexedIterable;\n Iterable.Set = SetIterable;\n var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; // Used for setting prototype methods that IE8 chokes on.\n\n var DELETE = 'delete'; // Constants describing the size of trie nodes.\n\n var SHIFT = 5; // Resulted in best performance after ______?\n\n var SIZE = 1 << SHIFT;\n var MASK = SIZE - 1; // A consistent shared value representing \"not set\" which equals nothing other\n // than itself, and nothing that could be provided externally.\n\n var NOT_SET = {}; // Boolean references, Rough equivalent of `bool &`.\n\n var CHANGE_LENGTH = {\n value: false\n };\n var DID_ALTER = {\n value: false\n };\n\n function MakeRef(ref) {\n ref.value = false;\n return ref;\n }\n\n function SetRef(ref) {\n ref && (ref.value = true);\n } // A function which returns a value representing an \"owner\" for transient writes\n // to tries. The return value will only ever equal itself, and will not equal\n // the return of any subsequent call of this function.\n\n\n function OwnerID() {} // http://jsperf.com/copy-array-inline\n\n\n function arrCopy(arr, offset) {\n offset = offset || 0;\n var len = Math.max(0, arr.length - offset);\n var newArr = new Array(len);\n\n for (var ii = 0; ii < len; ii++) {\n newArr[ii] = arr[ii + offset];\n }\n\n return newArr;\n }\n\n function ensureSize(iter) {\n if (iter.size === undefined) {\n iter.size = iter.__iterate(returnTrue);\n }\n\n return iter.size;\n }\n\n function wrapIndex(iter, index) {\n // This implements \"is array index\" which the ECMAString spec defines as:\n //\n // A String property name P is an array index if and only if\n // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n // to 2^32−1.\n //\n // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n if (typeof index !== 'number') {\n var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n\n if ('' + uint32Index !== index || uint32Index === 4294967295) {\n return NaN;\n }\n\n index = uint32Index;\n }\n\n return index < 0 ? ensureSize(iter) + index : index;\n }\n\n function returnTrue() {\n return true;\n }\n\n function wholeSlice(begin, end, size) {\n return (begin === 0 || size !== undefined && begin <= -size) && (end === undefined || size !== undefined && end >= size);\n }\n\n function resolveBegin(begin, size) {\n return resolveIndex(begin, size, 0);\n }\n\n function resolveEnd(end, size) {\n return resolveIndex(end, size, size);\n }\n\n function resolveIndex(index, size, defaultIndex) {\n return index === undefined ? defaultIndex : index < 0 ? Math.max(0, size + index) : size === undefined ? index : Math.min(size, index);\n }\n /* global Symbol */\n\n\n var ITERATE_KEYS = 0;\n var ITERATE_VALUES = 1;\n var ITERATE_ENTRIES = 2;\n var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator';\n var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n function Iterator(next) {\n this.next = next;\n }\n\n Iterator.prototype.toString = function () {\n return '[Iterator]';\n };\n\n Iterator.KEYS = ITERATE_KEYS;\n Iterator.VALUES = ITERATE_VALUES;\n Iterator.ENTRIES = ITERATE_ENTRIES;\n\n Iterator.prototype.inspect = Iterator.prototype.toSource = function () {\n return this.toString();\n };\n\n Iterator.prototype[ITERATOR_SYMBOL] = function () {\n return this;\n };\n\n function iteratorValue(type, k, v, iteratorResult) {\n var value = type === 0 ? k : type === 1 ? v : [k, v];\n iteratorResult ? iteratorResult.value = value : iteratorResult = {\n value: value,\n done: false\n };\n return iteratorResult;\n }\n\n function iteratorDone() {\n return {\n value: undefined,\n done: true\n };\n }\n\n function hasIterator(maybeIterable) {\n return !!getIteratorFn(maybeIterable);\n }\n\n function isIterator(maybeIterator) {\n return maybeIterator && typeof maybeIterator.next === 'function';\n }\n\n function getIterator(iterable) {\n var iteratorFn = getIteratorFn(iterable);\n return iteratorFn && iteratorFn.call(iterable);\n }\n\n function getIteratorFn(iterable) {\n var iteratorFn = iterable && (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL] || iterable[FAUX_ITERATOR_SYMBOL]);\n\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n function isArrayLike(value) {\n return value && typeof value.length === 'number';\n }\n\n createClass(Seq, Iterable);\n\n function Seq(value) {\n return value === null || value === undefined ? emptySequence() : isIterable(value) ? value.toSeq() : seqFromValue(value);\n }\n\n Seq.of = function\n /*...values*/\n () {\n return Seq(arguments);\n };\n\n Seq.prototype.toSeq = function () {\n return this;\n };\n\n Seq.prototype.toString = function () {\n return this.__toString('Seq {', '}');\n };\n\n Seq.prototype.cacheResult = function () {\n if (!this._cache && this.__iterateUncached) {\n this._cache = this.entrySeq().toArray();\n this.size = this._cache.length;\n }\n\n return this;\n }; // abstract __iterateUncached(fn, reverse)\n\n\n Seq.prototype.__iterate = function (fn, reverse) {\n return seqIterate(this, fn, reverse, true);\n }; // abstract __iteratorUncached(type, reverse)\n\n\n Seq.prototype.__iterator = function (type, reverse) {\n return seqIterator(this, type, reverse, true);\n };\n\n createClass(KeyedSeq, Seq);\n\n function KeyedSeq(value) {\n return value === null || value === undefined ? emptySequence().toKeyedSeq() : isIterable(value) ? isKeyed(value) ? value.toSeq() : value.fromEntrySeq() : keyedSeqFromValue(value);\n }\n\n KeyedSeq.prototype.toKeyedSeq = function () {\n return this;\n };\n\n createClass(IndexedSeq, Seq);\n\n function IndexedSeq(value) {\n return value === null || value === undefined ? emptySequence() : !isIterable(value) ? indexedSeqFromValue(value) : isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n }\n\n IndexedSeq.of = function\n /*...values*/\n () {\n return IndexedSeq(arguments);\n };\n\n IndexedSeq.prototype.toIndexedSeq = function () {\n return this;\n };\n\n IndexedSeq.prototype.toString = function () {\n return this.__toString('Seq [', ']');\n };\n\n IndexedSeq.prototype.__iterate = function (fn, reverse) {\n return seqIterate(this, fn, reverse, false);\n };\n\n IndexedSeq.prototype.__iterator = function (type, reverse) {\n return seqIterator(this, type, reverse, false);\n };\n\n createClass(SetSeq, Seq);\n\n function SetSeq(value) {\n return (value === null || value === undefined ? emptySequence() : !isIterable(value) ? indexedSeqFromValue(value) : isKeyed(value) ? value.entrySeq() : value).toSetSeq();\n }\n\n SetSeq.of = function\n /*...values*/\n () {\n return SetSeq(arguments);\n };\n\n SetSeq.prototype.toSetSeq = function () {\n return this;\n };\n\n Seq.isSeq = isSeq;\n Seq.Keyed = KeyedSeq;\n Seq.Set = SetSeq;\n Seq.Indexed = IndexedSeq;\n var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n Seq.prototype[IS_SEQ_SENTINEL] = true;\n createClass(ArraySeq, IndexedSeq);\n\n function ArraySeq(array) {\n this._array = array;\n this.size = array.length;\n }\n\n ArraySeq.prototype.get = function (index, notSetValue) {\n return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n };\n\n ArraySeq.prototype.__iterate = function (fn, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n return ii + 1;\n }\n }\n\n return ii;\n };\n\n ArraySeq.prototype.__iterator = function (type, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n var ii = 0;\n return new Iterator(function () {\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++]);\n });\n };\n\n createClass(ObjectSeq, KeyedSeq);\n\n function ObjectSeq(object) {\n var keys = Object.keys(object);\n this._object = object;\n this._keys = keys;\n this.size = keys.length;\n }\n\n ObjectSeq.prototype.get = function (key, notSetValue) {\n if (notSetValue !== undefined && !this.has(key)) {\n return notSetValue;\n }\n\n return this._object[key];\n };\n\n ObjectSeq.prototype.has = function (key) {\n return this._object.hasOwnProperty(key);\n };\n\n ObjectSeq.prototype.__iterate = function (fn, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n\n for (var ii = 0; ii <= maxIndex; ii++) {\n var key = keys[reverse ? maxIndex - ii : ii];\n\n if (fn(object[key], key, this) === false) {\n return ii + 1;\n }\n }\n\n return ii;\n };\n\n ObjectSeq.prototype.__iterator = function (type, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n var ii = 0;\n return new Iterator(function () {\n var key = keys[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ? iteratorDone() : iteratorValue(type, key, object[key]);\n });\n };\n\n ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n createClass(IterableSeq, IndexedSeq);\n\n function IterableSeq(iterable) {\n this._iterable = iterable;\n this.size = iterable.length || iterable.size;\n }\n\n IterableSeq.prototype.__iterateUncached = function (fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n var iterations = 0;\n\n if (isIterator(iterator)) {\n var step;\n\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n }\n\n return iterations;\n };\n\n IterableSeq.prototype.__iteratorUncached = function (type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n\n if (!isIterator(iterator)) {\n return new Iterator(iteratorDone);\n }\n\n var iterations = 0;\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value);\n });\n };\n\n createClass(IteratorSeq, IndexedSeq);\n\n function IteratorSeq(iterator) {\n this._iterator = iterator;\n this._iteratorCache = [];\n }\n\n IteratorSeq.prototype.__iterateUncached = function (fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n\n while (iterations < cache.length) {\n if (fn(cache[iterations], iterations++, this) === false) {\n return iterations;\n }\n }\n\n var step;\n\n while (!(step = iterator.next()).done) {\n var val = step.value;\n cache[iterations] = val;\n\n if (fn(val, iterations++, this) === false) {\n break;\n }\n }\n\n return iterations;\n };\n\n IteratorSeq.prototype.__iteratorUncached = function (type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n return new Iterator(function () {\n if (iterations >= cache.length) {\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n cache[iterations] = step.value;\n }\n\n return iteratorValue(type, iterations, cache[iterations++]);\n });\n }; // # pragma Helper functions\n\n\n function isSeq(maybeSeq) {\n return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n }\n\n var EMPTY_SEQ;\n\n function emptySequence() {\n return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n }\n\n function keyedSeqFromValue(value) {\n var seq = Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : typeof value === 'object' ? new ObjectSeq(value) : undefined;\n\n if (!seq) {\n throw new TypeError('Expected Array or iterable object of [k, v] entries, ' + 'or keyed object: ' + value);\n }\n\n return seq;\n }\n\n function indexedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n\n if (!seq) {\n throw new TypeError('Expected Array or iterable object of values: ' + value);\n }\n\n return seq;\n }\n\n function seqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value) || typeof value === 'object' && new ObjectSeq(value);\n\n if (!seq) {\n throw new TypeError('Expected Array or iterable object of values, or keyed object: ' + value);\n }\n\n return seq;\n }\n\n function maybeIndexedSeqFromValue(value) {\n return isArrayLike(value) ? new ArraySeq(value) : isIterator(value) ? new IteratorSeq(value) : hasIterator(value) ? new IterableSeq(value) : undefined;\n }\n\n function seqIterate(seq, fn, reverse, useKeys) {\n var cache = seq._cache;\n\n if (cache) {\n var maxIndex = cache.length - 1;\n\n for (var ii = 0; ii <= maxIndex; ii++) {\n var entry = cache[reverse ? maxIndex - ii : ii];\n\n if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n return ii + 1;\n }\n }\n\n return ii;\n }\n\n return seq.__iterateUncached(fn, reverse);\n }\n\n function seqIterator(seq, type, reverse, useKeys) {\n var cache = seq._cache;\n\n if (cache) {\n var maxIndex = cache.length - 1;\n var ii = 0;\n return new Iterator(function () {\n var entry = cache[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ? iteratorDone() : iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n });\n }\n\n return seq.__iteratorUncached(type, reverse);\n }\n\n function fromJS(json, converter) {\n return converter ? fromJSWith(converter, json, '', {\n '': json\n }) : fromJSDefault(json);\n }\n\n function fromJSWith(converter, json, key, parentJSON) {\n if (Array.isArray(json)) {\n return converter.call(parentJSON, key, IndexedSeq(json).map(function (v, k) {\n return fromJSWith(converter, v, k, json);\n }));\n }\n\n if (isPlainObj(json)) {\n return converter.call(parentJSON, key, KeyedSeq(json).map(function (v, k) {\n return fromJSWith(converter, v, k, json);\n }));\n }\n\n return json;\n }\n\n function fromJSDefault(json) {\n if (Array.isArray(json)) {\n return IndexedSeq(json).map(fromJSDefault).toList();\n }\n\n if (isPlainObj(json)) {\n return KeyedSeq(json).map(fromJSDefault).toMap();\n }\n\n return json;\n }\n\n function isPlainObj(value) {\n return value && (value.constructor === Object || value.constructor === undefined);\n }\n /**\n * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n *\n * NaN is considered the same as NaN, however -0 and 0 are considered the same\n * value, which is different from the algorithm described by\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n *\n * This is extended further to allow Objects to describe the values they\n * represent, by way of `valueOf` or `equals` (and `hashCode`).\n *\n * Note: because of this extension, the key equality of Immutable.Map and the\n * value equality of Immutable.Set will differ from ES6 Map and Set.\n *\n * ### Defining custom values\n *\n * The easiest way to describe the value an object represents is by implementing\n * `valueOf`. For example, `Date` represents a value by returning a unix\n * timestamp for `valueOf`:\n *\n * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n * var date2 = new Date(1234567890000);\n * date1.valueOf(); // 1234567890000\n * assert( date1 !== date2 );\n * assert( Immutable.is( date1, date2 ) );\n *\n * Note: overriding `valueOf` may have other implications if you use this object\n * where JavaScript expects a primitive, such as implicit string coercion.\n *\n * For more complex types, especially collections, implementing `valueOf` may\n * not be performant. An alternative is to implement `equals` and `hashCode`.\n *\n * `equals` takes another object, presumably of similar type, and returns true\n * if the it is equal. Equality is symmetrical, so the same result should be\n * returned if this and the argument are flipped.\n *\n * assert( a.equals(b) === b.equals(a) );\n *\n * `hashCode` returns a 32bit integer number representing the object which will\n * be used to determine how to store the value object in a Map or Set. You must\n * provide both or neither methods, one must not exist without the other.\n *\n * Also, an important relationship between these methods must be upheld: if two\n * values are equal, they *must* return the same hashCode. If the values are not\n * equal, they might have the same hashCode; this is called a hash collision,\n * and while undesirable for performance reasons, it is acceptable.\n *\n * if (a.equals(b)) {\n * assert( a.hashCode() === b.hashCode() );\n * }\n *\n * All Immutable collections implement `equals` and `hashCode`.\n *\n */\n\n\n function is(valueA, valueB) {\n if (valueA === valueB || valueA !== valueA && valueB !== valueB) {\n return true;\n }\n\n if (!valueA || !valueB) {\n return false;\n }\n\n if (typeof valueA.valueOf === 'function' && typeof valueB.valueOf === 'function') {\n valueA = valueA.valueOf();\n valueB = valueB.valueOf();\n\n if (valueA === valueB || valueA !== valueA && valueB !== valueB) {\n return true;\n }\n\n if (!valueA || !valueB) {\n return false;\n }\n }\n\n if (typeof valueA.equals === 'function' && typeof valueB.equals === 'function' && valueA.equals(valueB)) {\n return true;\n }\n\n return false;\n }\n\n function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (!isIterable(b) || a.size !== undefined && b.size !== undefined && a.size !== b.size || a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || isKeyed(a) !== isKeyed(b) || isIndexed(a) !== isIndexed(b) || isOrdered(a) !== isOrdered(b)) {\n return false;\n }\n\n if (a.size === 0 && b.size === 0) {\n return true;\n }\n\n var notAssociative = !isAssociative(a);\n\n if (isOrdered(a)) {\n var entries = a.entries();\n return b.every(function (v, k) {\n var entry = entries.next().value;\n return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n }) && entries.next().done;\n }\n\n var flipped = false;\n\n if (a.size === undefined) {\n if (b.size === undefined) {\n if (typeof a.cacheResult === 'function') {\n a.cacheResult();\n }\n } else {\n flipped = true;\n var _ = a;\n a = b;\n b = _;\n }\n }\n\n var allEqual = true;\n\n var bSize = b.__iterate(function (v, k) {\n if (notAssociative ? !a.has(v) : flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n allEqual = false;\n return false;\n }\n });\n\n return allEqual && a.size === bSize;\n }\n\n createClass(Repeat, IndexedSeq);\n\n function Repeat(value, times) {\n if (!(this instanceof Repeat)) {\n return new Repeat(value, times);\n }\n\n this._value = value;\n this.size = times === undefined ? Infinity : Math.max(0, times);\n\n if (this.size === 0) {\n if (EMPTY_REPEAT) {\n return EMPTY_REPEAT;\n }\n\n EMPTY_REPEAT = this;\n }\n }\n\n Repeat.prototype.toString = function () {\n if (this.size === 0) {\n return 'Repeat []';\n }\n\n return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n };\n\n Repeat.prototype.get = function (index, notSetValue) {\n return this.has(index) ? this._value : notSetValue;\n };\n\n Repeat.prototype.includes = function (searchValue) {\n return is(this._value, searchValue);\n };\n\n Repeat.prototype.slice = function (begin, end) {\n var size = this.size;\n return wholeSlice(begin, end, size) ? this : new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n };\n\n Repeat.prototype.reverse = function () {\n return this;\n };\n\n Repeat.prototype.indexOf = function (searchValue) {\n if (is(this._value, searchValue)) {\n return 0;\n }\n\n return -1;\n };\n\n Repeat.prototype.lastIndexOf = function (searchValue) {\n if (is(this._value, searchValue)) {\n return this.size;\n }\n\n return -1;\n };\n\n Repeat.prototype.__iterate = function (fn, reverse) {\n for (var ii = 0; ii < this.size; ii++) {\n if (fn(this._value, ii, this) === false) {\n return ii + 1;\n }\n }\n\n return ii;\n };\n\n Repeat.prototype.__iterator = function (type, reverse) {\n var this$0 = this;\n var ii = 0;\n return new Iterator(function () {\n return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone();\n });\n };\n\n Repeat.prototype.equals = function (other) {\n return other instanceof Repeat ? is(this._value, other._value) : deepEqual(other);\n };\n\n var EMPTY_REPEAT;\n\n function invariant(condition, error) {\n if (!condition) throw new Error(error);\n }\n\n createClass(Range, IndexedSeq);\n\n function Range(start, end, step) {\n if (!(this instanceof Range)) {\n return new Range(start, end, step);\n }\n\n invariant(step !== 0, 'Cannot step a Range by 0');\n start = start || 0;\n\n if (end === undefined) {\n end = Infinity;\n }\n\n step = step === undefined ? 1 : Math.abs(step);\n\n if (end < start) {\n step = -step;\n }\n\n this._start = start;\n this._end = end;\n this._step = step;\n this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n\n if (this.size === 0) {\n if (EMPTY_RANGE) {\n return EMPTY_RANGE;\n }\n\n EMPTY_RANGE = this;\n }\n }\n\n Range.prototype.toString = function () {\n if (this.size === 0) {\n return 'Range []';\n }\n\n return 'Range [ ' + this._start + '...' + this._end + (this._step > 1 ? ' by ' + this._step : '') + ' ]';\n };\n\n Range.prototype.get = function (index, notSetValue) {\n return this.has(index) ? this._start + wrapIndex(this, index) * this._step : notSetValue;\n };\n\n Range.prototype.includes = function (searchValue) {\n var possibleIndex = (searchValue - this._start) / this._step;\n return possibleIndex >= 0 && possibleIndex < this.size && possibleIndex === Math.floor(possibleIndex);\n };\n\n Range.prototype.slice = function (begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n\n begin = resolveBegin(begin, this.size);\n end = resolveEnd(end, this.size);\n\n if (end <= begin) {\n return new Range(0, 0);\n }\n\n return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n };\n\n Range.prototype.indexOf = function (searchValue) {\n var offsetValue = searchValue - this._start;\n\n if (offsetValue % this._step === 0) {\n var index = offsetValue / this._step;\n\n if (index >= 0 && index < this.size) {\n return index;\n }\n }\n\n return -1;\n };\n\n Range.prototype.lastIndexOf = function (searchValue) {\n return this.indexOf(searchValue);\n };\n\n Range.prototype.__iterate = function (fn, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(value, ii, this) === false) {\n return ii + 1;\n }\n\n value += reverse ? -step : step;\n }\n\n return ii;\n };\n\n Range.prototype.__iterator = function (type, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n var ii = 0;\n return new Iterator(function () {\n var v = value;\n value += reverse ? -step : step;\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n });\n };\n\n Range.prototype.equals = function (other) {\n return other instanceof Range ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual(this, other);\n };\n\n var EMPTY_RANGE;\n createClass(Collection, Iterable);\n\n function Collection() {\n throw TypeError('Abstract');\n }\n\n createClass(KeyedCollection, Collection);\n\n function KeyedCollection() {}\n\n createClass(IndexedCollection, Collection);\n\n function IndexedCollection() {}\n\n createClass(SetCollection, Collection);\n\n function SetCollection() {}\n\n Collection.Keyed = KeyedCollection;\n Collection.Indexed = IndexedCollection;\n Collection.Set = SetCollection;\n var imul = typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? Math.imul : function imul(a, b) {\n a = a | 0; // int\n\n b = b | 0; // int\n\n var c = a & 0xffff;\n var d = b & 0xffff; // Shift by 0 fixes the sign on the high part.\n\n return c * d + ((a >>> 16) * d + c * (b >>> 16) << 16 >>> 0) | 0; // int\n }; // v8 has an optimization for storing 31-bit signed numbers.\n // Values which have either 00 or 11 as the high order bits qualify.\n // This function drops the highest order bit in a signed number, maintaining\n // the sign bit.\n\n function smi(i32) {\n return i32 >>> 1 & 0x40000000 | i32 & 0xBFFFFFFF;\n }\n\n function hash(o) {\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n\n if (typeof o.valueOf === 'function') {\n o = o.valueOf();\n\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n }\n\n if (o === true) {\n return 1;\n }\n\n var type = typeof o;\n\n if (type === 'number') {\n var h = o | 0;\n\n if (h !== o) {\n h ^= o * 0xFFFFFFFF;\n }\n\n while (o > 0xFFFFFFFF) {\n o /= 0xFFFFFFFF;\n h ^= o;\n }\n\n return smi(h);\n }\n\n if (type === 'string') {\n return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n }\n\n if (typeof o.hashCode === 'function') {\n return o.hashCode();\n }\n\n if (type === 'object') {\n return hashJSObj(o);\n }\n\n if (typeof o.toString === 'function') {\n return hashString(o.toString());\n }\n\n throw new Error('Value type ' + type + ' cannot be hashed.');\n }\n\n function cachedHashString(string) {\n var hash = stringHashCache[string];\n\n if (hash === undefined) {\n hash = hashString(string);\n\n if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n STRING_HASH_CACHE_SIZE = 0;\n stringHashCache = {};\n }\n\n STRING_HASH_CACHE_SIZE++;\n stringHashCache[string] = hash;\n }\n\n return hash;\n } // http://jsperf.com/hashing-strings\n\n\n function hashString(string) {\n // This is the hash from JVM\n // The hash code for a string is computed as\n // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n // where s[i] is the ith character of the string and n is the length of\n // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n // (exclusive) by dropping high bits.\n var hash = 0;\n\n for (var ii = 0; ii < string.length; ii++) {\n hash = 31 * hash + string.charCodeAt(ii) | 0;\n }\n\n return smi(hash);\n }\n\n function hashJSObj(obj) {\n var hash;\n\n if (usingWeakMap) {\n hash = weakMap.get(obj);\n\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = obj[UID_HASH_KEY];\n\n if (hash !== undefined) {\n return hash;\n }\n\n if (!canDefineProperty) {\n hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n\n if (hash !== undefined) {\n return hash;\n }\n\n hash = getIENodeHash(obj);\n\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = ++objHashUID;\n\n if (objHashUID & 0x40000000) {\n objHashUID = 0;\n }\n\n if (usingWeakMap) {\n weakMap.set(obj, hash);\n } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n throw new Error('Non-extensible objects are not allowed as keys.');\n } else if (canDefineProperty) {\n Object.defineProperty(obj, UID_HASH_KEY, {\n 'enumerable': false,\n 'configurable': false,\n 'writable': false,\n 'value': hash\n });\n } else if (obj.propertyIsEnumerable !== undefined && obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n // Since we can't define a non-enumerable property on the object\n // we'll hijack one of the less-used non-enumerable properties to\n // save our hash on it. Since this is a function it will not show up in\n // `JSON.stringify` which is what we want.\n obj.propertyIsEnumerable = function () {\n return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n };\n\n obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n } else if (obj.nodeType !== undefined) {\n // At this point we couldn't get the IE `uniqueID` to use as a hash\n // and we couldn't use a non-enumerable property to exploit the\n // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n // itself.\n obj[UID_HASH_KEY] = hash;\n } else {\n throw new Error('Unable to set a non-enumerable property on object.');\n }\n\n return hash;\n } // Get references to ES5 object methods.\n\n\n var isExtensible = Object.isExtensible; // True if Object.defineProperty works as expected. IE8 fails this test.\n\n var canDefineProperty = function () {\n try {\n Object.defineProperty({}, '@', {});\n return true;\n } catch (e) {\n return false;\n }\n }(); // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n // and avoid memory leaks from the IE cloneNode bug.\n\n\n function getIENodeHash(node) {\n if (node && node.nodeType > 0) {\n switch (node.nodeType) {\n case 1:\n // Element\n return node.uniqueID;\n\n case 9:\n // Document\n return node.documentElement && node.documentElement.uniqueID;\n }\n }\n } // If possible, use a WeakMap.\n\n\n var usingWeakMap = typeof WeakMap === 'function';\n var weakMap;\n\n if (usingWeakMap) {\n weakMap = new WeakMap();\n }\n\n var objHashUID = 0;\n var UID_HASH_KEY = '__immutablehash__';\n\n if (typeof Symbol === 'function') {\n UID_HASH_KEY = Symbol(UID_HASH_KEY);\n }\n\n var STRING_HASH_CACHE_MIN_STRLEN = 16;\n var STRING_HASH_CACHE_MAX_SIZE = 255;\n var STRING_HASH_CACHE_SIZE = 0;\n var stringHashCache = {};\n\n function assertNotInfinite(size) {\n invariant(size !== Infinity, 'Cannot perform this action with an infinite size.');\n }\n\n createClass(Map, KeyedCollection); // @pragma Construction\n\n function Map(value) {\n return value === null || value === undefined ? emptyMap() : isMap(value) && !isOrdered(value) ? value : emptyMap().withMutations(function (map) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v, k) {\n return map.set(k, v);\n });\n });\n }\n\n Map.prototype.toString = function () {\n return this.__toString('Map {', '}');\n }; // @pragma Access\n\n\n Map.prototype.get = function (k, notSetValue) {\n return this._root ? this._root.get(0, undefined, k, notSetValue) : notSetValue;\n }; // @pragma Modification\n\n\n Map.prototype.set = function (k, v) {\n return updateMap(this, k, v);\n };\n\n Map.prototype.setIn = function (keyPath, v) {\n return this.updateIn(keyPath, NOT_SET, function () {\n return v;\n });\n };\n\n Map.prototype.remove = function (k) {\n return updateMap(this, k, NOT_SET);\n };\n\n Map.prototype.deleteIn = function (keyPath) {\n return this.updateIn(keyPath, function () {\n return NOT_SET;\n });\n };\n\n Map.prototype.update = function (k, notSetValue, updater) {\n return arguments.length === 1 ? k(this) : this.updateIn([k], notSetValue, updater);\n };\n\n Map.prototype.updateIn = function (keyPath, notSetValue, updater) {\n if (!updater) {\n updater = notSetValue;\n notSetValue = undefined;\n }\n\n var updatedValue = updateInDeepMap(this, forceIterator(keyPath), notSetValue, updater);\n return updatedValue === NOT_SET ? undefined : updatedValue;\n };\n\n Map.prototype.clear = function () {\n if (this.size === 0) {\n return this;\n }\n\n if (this.__ownerID) {\n this.size = 0;\n this._root = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return emptyMap();\n }; // @pragma Composition\n\n\n Map.prototype.merge = function\n /*...iters*/\n () {\n return mergeIntoMapWith(this, undefined, arguments);\n };\n\n Map.prototype.mergeWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, merger, iters);\n };\n\n Map.prototype.mergeIn = function (keyPath) {\n var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(keyPath, emptyMap(), function (m) {\n return typeof m.merge === 'function' ? m.merge.apply(m, iters) : iters[iters.length - 1];\n });\n };\n\n Map.prototype.mergeDeep = function\n /*...iters*/\n () {\n return mergeIntoMapWith(this, deepMerger, arguments);\n };\n\n Map.prototype.mergeDeepWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n };\n\n Map.prototype.mergeDeepIn = function (keyPath) {\n var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(keyPath, emptyMap(), function (m) {\n return typeof m.mergeDeep === 'function' ? m.mergeDeep.apply(m, iters) : iters[iters.length - 1];\n });\n };\n\n Map.prototype.sort = function (comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator));\n };\n\n Map.prototype.sortBy = function (mapper, comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator, mapper));\n }; // @pragma Mutability\n\n\n Map.prototype.withMutations = function (fn) {\n var mutable = this.asMutable();\n fn(mutable);\n return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n };\n\n Map.prototype.asMutable = function () {\n return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n };\n\n Map.prototype.asImmutable = function () {\n return this.__ensureOwner();\n };\n\n Map.prototype.wasAltered = function () {\n return this.__altered;\n };\n\n Map.prototype.__iterator = function (type, reverse) {\n return new MapIterator(this, type, reverse);\n };\n\n Map.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n var iterations = 0;\n this._root && this._root.iterate(function (entry) {\n iterations++;\n return fn(entry[1], entry[0], this$0);\n }, reverse);\n return iterations;\n };\n\n Map.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n\n return makeMap(this.size, this._root, ownerID, this.__hash);\n };\n\n function isMap(maybeMap) {\n return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n }\n\n Map.isMap = isMap;\n var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n var MapPrototype = Map.prototype;\n MapPrototype[IS_MAP_SENTINEL] = true;\n MapPrototype[DELETE] = MapPrototype.remove;\n MapPrototype.removeIn = MapPrototype.deleteIn; // #pragma Trie Nodes\n\n function ArrayMapNode(ownerID, entries) {\n this.ownerID = ownerID;\n this.entries = entries;\n }\n\n ArrayMapNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n\n return notSetValue;\n };\n\n ArrayMapNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var entries = this.entries;\n var idx = 0;\n\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && entries.length === 1) {\n return; // undefined\n }\n\n if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n return createNodes(ownerID, entries, key, value);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : newEntries[idx] = newEntries.pop();\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new ArrayMapNode(ownerID, newEntries);\n };\n\n function BitmapIndexedNode(ownerID, bitmap, nodes) {\n this.ownerID = ownerID;\n this.bitmap = bitmap;\n this.nodes = nodes;\n }\n\n BitmapIndexedNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK);\n var bitmap = this.bitmap;\n return (bitmap & bit) === 0 ? notSetValue : this.nodes[popCount(bitmap & bit - 1)].get(shift + SHIFT, keyHash, key, notSetValue);\n };\n\n BitmapIndexedNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var bit = 1 << keyHashFrag;\n var bitmap = this.bitmap;\n var exists = (bitmap & bit) !== 0;\n\n if (!exists && value === NOT_SET) {\n return this;\n }\n\n var idx = popCount(bitmap & bit - 1);\n var nodes = this.nodes;\n var node = exists ? nodes[idx] : undefined;\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n }\n\n if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n return nodes[idx ^ 1];\n }\n\n if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n return newNode;\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n var newNodes = exists ? newNode ? setIn(nodes, idx, newNode, isEditable) : spliceOut(nodes, idx, isEditable) : spliceIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.bitmap = newBitmap;\n this.nodes = newNodes;\n return this;\n }\n\n return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n };\n\n function HashArrayMapNode(ownerID, count, nodes) {\n this.ownerID = ownerID;\n this.count = count;\n this.nodes = nodes;\n }\n\n HashArrayMapNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var node = this.nodes[idx];\n return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n };\n\n HashArrayMapNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var removed = value === NOT_SET;\n var nodes = this.nodes;\n var node = nodes[idx];\n\n if (removed && !node) {\n return this;\n }\n\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n var newCount = this.count;\n\n if (!node) {\n newCount++;\n } else if (!newNode) {\n newCount--;\n\n if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n return packNodes(ownerID, nodes, newCount, idx);\n }\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.count = newCount;\n this.nodes = newNodes;\n return this;\n }\n\n return new HashArrayMapNode(ownerID, newCount, newNodes);\n };\n\n function HashCollisionNode(ownerID, keyHash, entries) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entries = entries;\n }\n\n HashCollisionNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n\n return notSetValue;\n };\n\n HashCollisionNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var removed = value === NOT_SET;\n\n if (keyHash !== this.keyHash) {\n if (removed) {\n return this;\n }\n\n SetRef(didAlter);\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n }\n\n var entries = this.entries;\n var idx = 0;\n\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && len === 2) {\n return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : newEntries[idx] = newEntries.pop();\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n };\n\n function ValueNode(ownerID, keyHash, entry) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entry = entry;\n }\n\n ValueNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n };\n\n ValueNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var keyMatch = is(key, this.entry[0]);\n\n if (keyMatch ? value === this.entry[1] : removed) {\n return this;\n }\n\n SetRef(didAlter);\n\n if (removed) {\n SetRef(didChangeSize);\n return; // undefined\n }\n\n if (keyMatch) {\n if (ownerID && ownerID === this.ownerID) {\n this.entry[1] = value;\n return this;\n }\n\n return new ValueNode(ownerID, this.keyHash, [key, value]);\n }\n\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n }; // #pragma Iterators\n\n\n ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function (fn, reverse) {\n var entries = this.entries;\n\n for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n return false;\n }\n }\n };\n\n BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n var nodes = this.nodes;\n\n for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n var node = nodes[reverse ? maxIndex - ii : ii];\n\n if (node && node.iterate(fn, reverse) === false) {\n return false;\n }\n }\n };\n\n ValueNode.prototype.iterate = function (fn, reverse) {\n return fn(this.entry);\n };\n\n createClass(MapIterator, Iterator);\n\n function MapIterator(map, type, reverse) {\n this._type = type;\n this._reverse = reverse;\n this._stack = map._root && mapIteratorFrame(map._root);\n }\n\n MapIterator.prototype.next = function () {\n var type = this._type;\n var stack = this._stack;\n\n while (stack) {\n var node = stack.node;\n var index = stack.index++;\n var maxIndex;\n\n if (node.entry) {\n if (index === 0) {\n return mapIteratorValue(type, node.entry);\n }\n } else if (node.entries) {\n maxIndex = node.entries.length - 1;\n\n if (index <= maxIndex) {\n return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n }\n } else {\n maxIndex = node.nodes.length - 1;\n\n if (index <= maxIndex) {\n var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n\n if (subNode) {\n if (subNode.entry) {\n return mapIteratorValue(type, subNode.entry);\n }\n\n stack = this._stack = mapIteratorFrame(subNode, stack);\n }\n\n continue;\n }\n }\n\n stack = this._stack = this._stack.__prev;\n }\n\n return iteratorDone();\n };\n\n function mapIteratorValue(type, entry) {\n return iteratorValue(type, entry[0], entry[1]);\n }\n\n function mapIteratorFrame(node, prev) {\n return {\n node: node,\n index: 0,\n __prev: prev\n };\n }\n\n function makeMap(size, root, ownerID, hash) {\n var map = Object.create(MapPrototype);\n map.size = size;\n map._root = root;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_MAP;\n\n function emptyMap() {\n return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n }\n\n function updateMap(map, k, v) {\n var newRoot;\n var newSize;\n\n if (!map._root) {\n if (v === NOT_SET) {\n return map;\n }\n\n newSize = 1;\n newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n } else {\n var didChangeSize = MakeRef(CHANGE_LENGTH);\n var didAlter = MakeRef(DID_ALTER);\n newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n\n if (!didAlter.value) {\n return map;\n }\n\n newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n }\n\n if (map.__ownerID) {\n map.size = newSize;\n map._root = newRoot;\n map.__hash = undefined;\n map.__altered = true;\n return map;\n }\n\n return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n }\n\n function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (!node) {\n if (value === NOT_SET) {\n return node;\n }\n\n SetRef(didAlter);\n SetRef(didChangeSize);\n return new ValueNode(ownerID, keyHash, [key, value]);\n }\n\n return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n }\n\n function isLeafNode(node) {\n return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n }\n\n function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n if (node.keyHash === keyHash) {\n return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n }\n\n var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var newNode;\n var nodes = idx1 === idx2 ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : (newNode = new ValueNode(ownerID, keyHash, entry), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n return new BitmapIndexedNode(ownerID, 1 << idx1 | 1 << idx2, nodes);\n }\n\n function createNodes(ownerID, entries, key, value) {\n if (!ownerID) {\n ownerID = new OwnerID();\n }\n\n var node = new ValueNode(ownerID, hash(key), [key, value]);\n\n for (var ii = 0; ii < entries.length; ii++) {\n var entry = entries[ii];\n node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n }\n\n return node;\n }\n\n function packNodes(ownerID, nodes, count, excluding) {\n var bitmap = 0;\n var packedII = 0;\n var packedNodes = new Array(count);\n\n for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n var node = nodes[ii];\n\n if (node !== undefined && ii !== excluding) {\n bitmap |= bit;\n packedNodes[packedII++] = node;\n }\n }\n\n return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n }\n\n function expandNodes(ownerID, nodes, bitmap, including, node) {\n var count = 0;\n var expandedNodes = new Array(SIZE);\n\n for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n }\n\n expandedNodes[including] = node;\n return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n }\n\n function mergeIntoMapWith(map, merger, iterables) {\n var iters = [];\n\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = KeyedIterable(value);\n\n if (!isIterable(value)) {\n iter = iter.map(function (v) {\n return fromJS(v);\n });\n }\n\n iters.push(iter);\n }\n\n return mergeIntoCollectionWith(map, merger, iters);\n }\n\n function deepMerger(existing, value, key) {\n return existing && existing.mergeDeep && isIterable(value) ? existing.mergeDeep(value) : is(existing, value) ? existing : value;\n }\n\n function deepMergerWith(merger) {\n return function (existing, value, key) {\n if (existing && existing.mergeDeepWith && isIterable(value)) {\n return existing.mergeDeepWith(merger, value);\n }\n\n var nextValue = merger(existing, value, key);\n return is(existing, nextValue) ? existing : nextValue;\n };\n }\n\n function mergeIntoCollectionWith(collection, merger, iters) {\n iters = iters.filter(function (x) {\n return x.size !== 0;\n });\n\n if (iters.length === 0) {\n return collection;\n }\n\n if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n return collection.constructor(iters[0]);\n }\n\n return collection.withMutations(function (collection) {\n var mergeIntoMap = merger ? function (value, key) {\n collection.update(key, NOT_SET, function (existing) {\n return existing === NOT_SET ? value : merger(existing, value, key);\n });\n } : function (value, key) {\n collection.set(key, value);\n };\n\n for (var ii = 0; ii < iters.length; ii++) {\n iters[ii].forEach(mergeIntoMap);\n }\n });\n }\n\n function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n var isNotSet = existing === NOT_SET;\n var step = keyPathIter.next();\n\n if (step.done) {\n var existingValue = isNotSet ? notSetValue : existing;\n var newValue = updater(existingValue);\n return newValue === existingValue ? existing : newValue;\n }\n\n invariant(isNotSet || existing && existing.set, 'invalid keyPath');\n var key = step.value;\n var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n var nextUpdated = updateInDeepMap(nextExisting, keyPathIter, notSetValue, updater);\n return nextUpdated === nextExisting ? existing : nextUpdated === NOT_SET ? existing.remove(key) : (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n }\n\n function popCount(x) {\n x = x - (x >> 1 & 0x55555555);\n x = (x & 0x33333333) + (x >> 2 & 0x33333333);\n x = x + (x >> 4) & 0x0f0f0f0f;\n x = x + (x >> 8);\n x = x + (x >> 16);\n return x & 0x7f;\n }\n\n function setIn(array, idx, val, canEdit) {\n var newArray = canEdit ? array : arrCopy(array);\n newArray[idx] = val;\n return newArray;\n }\n\n function spliceIn(array, idx, val, canEdit) {\n var newLen = array.length + 1;\n\n if (canEdit && idx + 1 === newLen) {\n array[idx] = val;\n return array;\n }\n\n var newArray = new Array(newLen);\n var after = 0;\n\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n newArray[ii] = val;\n after = -1;\n } else {\n newArray[ii] = array[ii + after];\n }\n }\n\n return newArray;\n }\n\n function spliceOut(array, idx, canEdit) {\n var newLen = array.length - 1;\n\n if (canEdit && idx === newLen) {\n array.pop();\n return array;\n }\n\n var newArray = new Array(newLen);\n var after = 0;\n\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n after = 1;\n }\n\n newArray[ii] = array[ii + after];\n }\n\n return newArray;\n }\n\n var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n createClass(List, IndexedCollection); // @pragma Construction\n\n function List(value) {\n var empty = emptyList();\n\n if (value === null || value === undefined) {\n return empty;\n }\n\n if (isList(value)) {\n return value;\n }\n\n var iter = IndexedIterable(value);\n var size = iter.size;\n\n if (size === 0) {\n return empty;\n }\n\n assertNotInfinite(size);\n\n if (size > 0 && size < SIZE) {\n return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n }\n\n return empty.withMutations(function (list) {\n list.setSize(size);\n iter.forEach(function (v, i) {\n return list.set(i, v);\n });\n });\n }\n\n List.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n List.prototype.toString = function () {\n return this.__toString('List [', ']');\n }; // @pragma Access\n\n\n List.prototype.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n\n if (index >= 0 && index < this.size) {\n index += this._origin;\n var node = listNodeFor(this, index);\n return node && node.array[index & MASK];\n }\n\n return notSetValue;\n }; // @pragma Modification\n\n\n List.prototype.set = function (index, value) {\n return updateList(this, index, value);\n };\n\n List.prototype.remove = function (index) {\n return !this.has(index) ? this : index === 0 ? this.shift() : index === this.size - 1 ? this.pop() : this.splice(index, 1);\n };\n\n List.prototype.insert = function (index, value) {\n return this.splice(index, 0, value);\n };\n\n List.prototype.clear = function () {\n if (this.size === 0) {\n return this;\n }\n\n if (this.__ownerID) {\n this.size = this._origin = this._capacity = 0;\n this._level = SHIFT;\n this._root = this._tail = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return emptyList();\n };\n\n List.prototype.push = function\n /*...values*/\n () {\n var values = arguments;\n var oldSize = this.size;\n return this.withMutations(function (list) {\n setListBounds(list, 0, oldSize + values.length);\n\n for (var ii = 0; ii < values.length; ii++) {\n list.set(oldSize + ii, values[ii]);\n }\n });\n };\n\n List.prototype.pop = function () {\n return setListBounds(this, 0, -1);\n };\n\n List.prototype.unshift = function\n /*...values*/\n () {\n var values = arguments;\n return this.withMutations(function (list) {\n setListBounds(list, -values.length);\n\n for (var ii = 0; ii < values.length; ii++) {\n list.set(ii, values[ii]);\n }\n });\n };\n\n List.prototype.shift = function () {\n return setListBounds(this, 1);\n }; // @pragma Composition\n\n\n List.prototype.merge = function\n /*...iters*/\n () {\n return mergeIntoListWith(this, undefined, arguments);\n };\n\n List.prototype.mergeWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, merger, iters);\n };\n\n List.prototype.mergeDeep = function\n /*...iters*/\n () {\n return mergeIntoListWith(this, deepMerger, arguments);\n };\n\n List.prototype.mergeDeepWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, deepMergerWith(merger), iters);\n };\n\n List.prototype.setSize = function (size) {\n return setListBounds(this, 0, size);\n }; // @pragma Iteration\n\n\n List.prototype.slice = function (begin, end) {\n var size = this.size;\n\n if (wholeSlice(begin, end, size)) {\n return this;\n }\n\n return setListBounds(this, resolveBegin(begin, size), resolveEnd(end, size));\n };\n\n List.prototype.__iterator = function (type, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n return new Iterator(function () {\n var value = values();\n return value === DONE ? iteratorDone() : iteratorValue(type, index++, value);\n });\n };\n\n List.prototype.__iterate = function (fn, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n var value;\n\n while ((value = values()) !== DONE) {\n if (fn(value, index++, this) === false) {\n break;\n }\n }\n\n return index;\n };\n\n List.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n return this;\n }\n\n return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n };\n\n function isList(maybeList) {\n return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n }\n\n List.isList = isList;\n var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n var ListPrototype = List.prototype;\n ListPrototype[IS_LIST_SENTINEL] = true;\n ListPrototype[DELETE] = ListPrototype.remove;\n ListPrototype.setIn = MapPrototype.setIn;\n ListPrototype.deleteIn = ListPrototype.removeIn = MapPrototype.removeIn;\n ListPrototype.update = MapPrototype.update;\n ListPrototype.updateIn = MapPrototype.updateIn;\n ListPrototype.mergeIn = MapPrototype.mergeIn;\n ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n ListPrototype.withMutations = MapPrototype.withMutations;\n ListPrototype.asMutable = MapPrototype.asMutable;\n ListPrototype.asImmutable = MapPrototype.asImmutable;\n ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n function VNode(array, ownerID) {\n this.array = array;\n this.ownerID = ownerID;\n } // TODO: seems like these methods are very similar\n\n\n VNode.prototype.removeBefore = function (ownerID, level, index) {\n if (index === level ? 1 << level : 0 || this.array.length === 0) {\n return this;\n }\n\n var originIndex = index >>> level & MASK;\n\n if (originIndex >= this.array.length) {\n return new VNode([], ownerID);\n }\n\n var removingFirst = originIndex === 0;\n var newChild;\n\n if (level > 0) {\n var oldChild = this.array[originIndex];\n newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n\n if (newChild === oldChild && removingFirst) {\n return this;\n }\n }\n\n if (removingFirst && !newChild) {\n return this;\n }\n\n var editable = editableVNode(this, ownerID);\n\n if (!removingFirst) {\n for (var ii = 0; ii < originIndex; ii++) {\n editable.array[ii] = undefined;\n }\n }\n\n if (newChild) {\n editable.array[originIndex] = newChild;\n }\n\n return editable;\n };\n\n VNode.prototype.removeAfter = function (ownerID, level, index) {\n if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n return this;\n }\n\n var sizeIndex = index - 1 >>> level & MASK;\n\n if (sizeIndex >= this.array.length) {\n return this;\n }\n\n var newChild;\n\n if (level > 0) {\n var oldChild = this.array[sizeIndex];\n newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n\n if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n return this;\n }\n }\n\n var editable = editableVNode(this, ownerID);\n editable.array.splice(sizeIndex + 1);\n\n if (newChild) {\n editable.array[sizeIndex] = newChild;\n }\n\n return editable;\n };\n\n var DONE = {};\n\n function iterateList(list, reverse) {\n var left = list._origin;\n var right = list._capacity;\n var tailPos = getTailOffset(right);\n var tail = list._tail;\n return iterateNodeOrLeaf(list._root, list._level, 0);\n\n function iterateNodeOrLeaf(node, level, offset) {\n return level === 0 ? iterateLeaf(node, offset) : iterateNode(node, level, offset);\n }\n\n function iterateLeaf(node, offset) {\n var array = offset === tailPos ? tail && tail.array : node && node.array;\n var from = offset > left ? 0 : left - offset;\n var to = right - offset;\n\n if (to > SIZE) {\n to = SIZE;\n }\n\n return function () {\n if (from === to) {\n return DONE;\n }\n\n var idx = reverse ? --to : from++;\n return array && array[idx];\n };\n }\n\n function iterateNode(node, level, offset) {\n var values;\n var array = node && node.array;\n var from = offset > left ? 0 : left - offset >> level;\n var to = (right - offset >> level) + 1;\n\n if (to > SIZE) {\n to = SIZE;\n }\n\n return function () {\n do {\n if (values) {\n var value = values();\n\n if (value !== DONE) {\n return value;\n }\n\n values = null;\n }\n\n if (from === to) {\n return DONE;\n }\n\n var idx = reverse ? --to : from++;\n values = iterateNodeOrLeaf(array && array[idx], level - SHIFT, offset + (idx << level));\n } while (true);\n };\n }\n }\n\n function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n var list = Object.create(ListPrototype);\n list.size = capacity - origin;\n list._origin = origin;\n list._capacity = capacity;\n list._level = level;\n list._root = root;\n list._tail = tail;\n list.__ownerID = ownerID;\n list.__hash = hash;\n list.__altered = false;\n return list;\n }\n\n var EMPTY_LIST;\n\n function emptyList() {\n return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n }\n\n function updateList(list, index, value) {\n index = wrapIndex(list, index);\n\n if (index !== index) {\n return list;\n }\n\n if (index >= list.size || index < 0) {\n return list.withMutations(function (list) {\n index < 0 ? setListBounds(list, index).set(0, value) : setListBounds(list, 0, index + 1).set(index, value);\n });\n }\n\n index += list._origin;\n var newTail = list._tail;\n var newRoot = list._root;\n var didAlter = MakeRef(DID_ALTER);\n\n if (index >= getTailOffset(list._capacity)) {\n newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n } else {\n newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n }\n\n if (!didAlter.value) {\n return list;\n }\n\n if (list.__ownerID) {\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n\n return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n }\n\n function updateVNode(node, ownerID, level, index, value, didAlter) {\n var idx = index >>> level & MASK;\n var nodeHas = node && idx < node.array.length;\n\n if (!nodeHas && value === undefined) {\n return node;\n }\n\n var newNode;\n\n if (level > 0) {\n var lowerNode = node && node.array[idx];\n var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n\n if (newLowerNode === lowerNode) {\n return node;\n }\n\n newNode = editableVNode(node, ownerID);\n newNode.array[idx] = newLowerNode;\n return newNode;\n }\n\n if (nodeHas && node.array[idx] === value) {\n return node;\n }\n\n SetRef(didAlter);\n newNode = editableVNode(node, ownerID);\n\n if (value === undefined && idx === newNode.array.length - 1) {\n newNode.array.pop();\n } else {\n newNode.array[idx] = value;\n }\n\n return newNode;\n }\n\n function editableVNode(node, ownerID) {\n if (ownerID && node && ownerID === node.ownerID) {\n return node;\n }\n\n return new VNode(node ? node.array.slice() : [], ownerID);\n }\n\n function listNodeFor(list, rawIndex) {\n if (rawIndex >= getTailOffset(list._capacity)) {\n return list._tail;\n }\n\n if (rawIndex < 1 << list._level + SHIFT) {\n var node = list._root;\n var level = list._level;\n\n while (node && level > 0) {\n node = node.array[rawIndex >>> level & MASK];\n level -= SHIFT;\n }\n\n return node;\n }\n }\n\n function setListBounds(list, begin, end) {\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n\n if (end !== undefined) {\n end = end | 0;\n }\n\n var owner = list.__ownerID || new OwnerID();\n var oldOrigin = list._origin;\n var oldCapacity = list._capacity;\n var newOrigin = oldOrigin + begin;\n var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n\n if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n return list;\n } // If it's going to end after it starts, it's empty.\n\n\n if (newOrigin >= newCapacity) {\n return list.clear();\n }\n\n var newLevel = list._level;\n var newRoot = list._root; // New origin might need creating a higher root.\n\n var offsetShift = 0;\n\n while (newOrigin + offsetShift < 0) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n newLevel += SHIFT;\n offsetShift += 1 << newLevel;\n }\n\n if (offsetShift) {\n newOrigin += offsetShift;\n oldOrigin += offsetShift;\n newCapacity += offsetShift;\n oldCapacity += offsetShift;\n }\n\n var oldTailOffset = getTailOffset(oldCapacity);\n var newTailOffset = getTailOffset(newCapacity); // New size might need creating a higher root.\n\n while (newTailOffset >= 1 << newLevel + SHIFT) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n newLevel += SHIFT;\n } // Locate or create the new tail.\n\n\n var oldTail = list._tail;\n var newTail = newTailOffset < oldTailOffset ? listNodeFor(list, newCapacity - 1) : newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail; // Merge Tail into tree.\n\n if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n newRoot = editableVNode(newRoot, owner);\n var node = newRoot;\n\n for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n var idx = oldTailOffset >>> level & MASK;\n node = node.array[idx] = editableVNode(node.array[idx], owner);\n }\n\n node.array[oldTailOffset >>> SHIFT & MASK] = oldTail;\n } // If the size has been reduced, there's a chance the tail needs to be trimmed.\n\n\n if (newCapacity < oldCapacity) {\n newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n } // If the new origin is within the tail, then we do not need a root.\n\n\n if (newOrigin >= newTailOffset) {\n newOrigin -= newTailOffset;\n newCapacity -= newTailOffset;\n newLevel = SHIFT;\n newRoot = null;\n newTail = newTail && newTail.removeBefore(owner, 0, newOrigin); // Otherwise, if the root has been trimmed, garbage collect.\n } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n offsetShift = 0; // Identify the new top root node of the subtree of the old root.\n\n while (newRoot) {\n var beginIndex = newOrigin >>> newLevel & MASK;\n\n if (beginIndex !== newTailOffset >>> newLevel & MASK) {\n break;\n }\n\n if (beginIndex) {\n offsetShift += (1 << newLevel) * beginIndex;\n }\n\n newLevel -= SHIFT;\n newRoot = newRoot.array[beginIndex];\n } // Trim the new sides of the new root.\n\n\n if (newRoot && newOrigin > oldOrigin) {\n newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n }\n\n if (newRoot && newTailOffset < oldTailOffset) {\n newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n }\n\n if (offsetShift) {\n newOrigin -= offsetShift;\n newCapacity -= offsetShift;\n }\n }\n\n if (list.__ownerID) {\n list.size = newCapacity - newOrigin;\n list._origin = newOrigin;\n list._capacity = newCapacity;\n list._level = newLevel;\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n\n return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n }\n\n function mergeIntoListWith(list, merger, iterables) {\n var iters = [];\n var maxSize = 0;\n\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = IndexedIterable(value);\n\n if (iter.size > maxSize) {\n maxSize = iter.size;\n }\n\n if (!isIterable(value)) {\n iter = iter.map(function (v) {\n return fromJS(v);\n });\n }\n\n iters.push(iter);\n }\n\n if (maxSize > list.size) {\n list = list.setSize(maxSize);\n }\n\n return mergeIntoCollectionWith(list, merger, iters);\n }\n\n function getTailOffset(size) {\n return size < SIZE ? 0 : size - 1 >>> SHIFT << SHIFT;\n }\n\n createClass(OrderedMap, Map); // @pragma Construction\n\n function OrderedMap(value) {\n return value === null || value === undefined ? emptyOrderedMap() : isOrderedMap(value) ? value : emptyOrderedMap().withMutations(function (map) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v, k) {\n return map.set(k, v);\n });\n });\n }\n\n OrderedMap.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n OrderedMap.prototype.toString = function () {\n return this.__toString('OrderedMap {', '}');\n }; // @pragma Access\n\n\n OrderedMap.prototype.get = function (k, notSetValue) {\n var index = this._map.get(k);\n\n return index !== undefined ? this._list.get(index)[1] : notSetValue;\n }; // @pragma Modification\n\n\n OrderedMap.prototype.clear = function () {\n if (this.size === 0) {\n return this;\n }\n\n if (this.__ownerID) {\n this.size = 0;\n\n this._map.clear();\n\n this._list.clear();\n\n return this;\n }\n\n return emptyOrderedMap();\n };\n\n OrderedMap.prototype.set = function (k, v) {\n return updateOrderedMap(this, k, v);\n };\n\n OrderedMap.prototype.remove = function (k) {\n return updateOrderedMap(this, k, NOT_SET);\n };\n\n OrderedMap.prototype.wasAltered = function () {\n return this._map.wasAltered() || this._list.wasAltered();\n };\n\n OrderedMap.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return this._list.__iterate(function (entry) {\n return entry && fn(entry[1], entry[0], this$0);\n }, reverse);\n };\n\n OrderedMap.prototype.__iterator = function (type, reverse) {\n return this._list.fromEntrySeq().__iterator(type, reverse);\n };\n\n OrderedMap.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n var newMap = this._map.__ensureOwner(ownerID);\n\n var newList = this._list.__ensureOwner(ownerID);\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n this._list = newList;\n return this;\n }\n\n return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n };\n\n function isOrderedMap(maybeOrderedMap) {\n return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n }\n\n OrderedMap.isOrderedMap = isOrderedMap;\n OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n function makeOrderedMap(map, list, ownerID, hash) {\n var omap = Object.create(OrderedMap.prototype);\n omap.size = map ? map.size : 0;\n omap._map = map;\n omap._list = list;\n omap.__ownerID = ownerID;\n omap.__hash = hash;\n return omap;\n }\n\n var EMPTY_ORDERED_MAP;\n\n function emptyOrderedMap() {\n return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n }\n\n function updateOrderedMap(omap, k, v) {\n var map = omap._map;\n var list = omap._list;\n var i = map.get(k);\n var has = i !== undefined;\n var newMap;\n var newList;\n\n if (v === NOT_SET) {\n // removed\n if (!has) {\n return omap;\n }\n\n if (list.size >= SIZE && list.size >= map.size * 2) {\n newList = list.filter(function (entry, idx) {\n return entry !== undefined && i !== idx;\n });\n newMap = newList.toKeyedSeq().map(function (entry) {\n return entry[0];\n }).flip().toMap();\n\n if (omap.__ownerID) {\n newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n }\n } else {\n newMap = map.remove(k);\n newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n }\n } else {\n if (has) {\n if (v === list.get(i)[1]) {\n return omap;\n }\n\n newMap = map;\n newList = list.set(i, [k, v]);\n } else {\n newMap = map.set(k, list.size);\n newList = list.set(list.size, [k, v]);\n }\n }\n\n if (omap.__ownerID) {\n omap.size = newMap.size;\n omap._map = newMap;\n omap._list = newList;\n omap.__hash = undefined;\n return omap;\n }\n\n return makeOrderedMap(newMap, newList);\n }\n\n createClass(ToKeyedSequence, KeyedSeq);\n\n function ToKeyedSequence(indexed, useKeys) {\n this._iter = indexed;\n this._useKeys = useKeys;\n this.size = indexed.size;\n }\n\n ToKeyedSequence.prototype.get = function (key, notSetValue) {\n return this._iter.get(key, notSetValue);\n };\n\n ToKeyedSequence.prototype.has = function (key) {\n return this._iter.has(key);\n };\n\n ToKeyedSequence.prototype.valueSeq = function () {\n return this._iter.valueSeq();\n };\n\n ToKeyedSequence.prototype.reverse = function () {\n var this$0 = this;\n var reversedSequence = reverseFactory(this, true);\n\n if (!this._useKeys) {\n reversedSequence.valueSeq = function () {\n return this$0._iter.toSeq().reverse();\n };\n }\n\n return reversedSequence;\n };\n\n ToKeyedSequence.prototype.map = function (mapper, context) {\n var this$0 = this;\n var mappedSequence = mapFactory(this, mapper, context);\n\n if (!this._useKeys) {\n mappedSequence.valueSeq = function () {\n return this$0._iter.toSeq().map(mapper, context);\n };\n }\n\n return mappedSequence;\n };\n\n ToKeyedSequence.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n var ii;\n return this._iter.__iterate(this._useKeys ? function (v, k) {\n return fn(v, k, this$0);\n } : (ii = reverse ? resolveSize(this) : 0, function (v) {\n return fn(v, reverse ? --ii : ii++, this$0);\n }), reverse);\n };\n\n ToKeyedSequence.prototype.__iterator = function (type, reverse) {\n if (this._useKeys) {\n return this._iter.__iterator(type, reverse);\n }\n\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\n var ii = reverse ? resolveSize(this) : 0;\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n });\n };\n\n ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n createClass(ToIndexedSequence, IndexedSeq);\n\n function ToIndexedSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToIndexedSequence.prototype.includes = function (value) {\n return this._iter.includes(value);\n };\n\n ToIndexedSequence.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n var iterations = 0;\n return this._iter.__iterate(function (v) {\n return fn(v, iterations++, this$0);\n }, reverse);\n };\n\n ToIndexedSequence.prototype.__iterator = function (type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\n var iterations = 0;\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value, step);\n });\n };\n\n createClass(ToSetSequence, SetSeq);\n\n function ToSetSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToSetSequence.prototype.has = function (key) {\n return this._iter.includes(key);\n };\n\n ToSetSequence.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return this._iter.__iterate(function (v) {\n return fn(v, v, this$0);\n }, reverse);\n };\n\n ToSetSequence.prototype.__iterator = function (type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, step.value, step.value, step);\n });\n };\n\n createClass(FromEntriesSequence, KeyedSeq);\n\n function FromEntriesSequence(entries) {\n this._iter = entries;\n this.size = entries.size;\n }\n\n FromEntriesSequence.prototype.entrySeq = function () {\n return this._iter.toSeq();\n };\n\n FromEntriesSequence.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return this._iter.__iterate(function (entry) {\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return fn(indexedIterable ? entry.get(1) : entry[1], indexedIterable ? entry.get(0) : entry[0], this$0);\n }\n }, reverse);\n };\n\n FromEntriesSequence.prototype.__iterator = function (type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\n return new Iterator(function () {\n while (true) {\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n var entry = step.value; // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return iteratorValue(type, indexedIterable ? entry.get(0) : entry[0], indexedIterable ? entry.get(1) : entry[1], step);\n }\n }\n });\n };\n\n ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;\n\n function flipFactory(iterable) {\n var flipSequence = makeSequence(iterable);\n flipSequence._iter = iterable;\n flipSequence.size = iterable.size;\n\n flipSequence.flip = function () {\n return iterable;\n };\n\n flipSequence.reverse = function () {\n var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n\n reversedSequence.flip = function () {\n return iterable.reverse();\n };\n\n return reversedSequence;\n };\n\n flipSequence.has = function (key) {\n return iterable.includes(key);\n };\n\n flipSequence.includes = function (key) {\n return iterable.has(key);\n };\n\n flipSequence.cacheResult = cacheResultThrough;\n\n flipSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n return iterable.__iterate(function (v, k) {\n return fn(k, v, this$0) !== false;\n }, reverse);\n };\n\n flipSequence.__iteratorUncached = function (type, reverse) {\n if (type === ITERATE_ENTRIES) {\n var iterator = iterable.__iterator(type, reverse);\n\n return new Iterator(function () {\n var step = iterator.next();\n\n if (!step.done) {\n var k = step.value[0];\n step.value[0] = step.value[1];\n step.value[1] = k;\n }\n\n return step;\n });\n }\n\n return iterable.__iterator(type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, reverse);\n };\n\n return flipSequence;\n }\n\n function mapFactory(iterable, mapper, context) {\n var mappedSequence = makeSequence(iterable);\n mappedSequence.size = iterable.size;\n\n mappedSequence.has = function (key) {\n return iterable.has(key);\n };\n\n mappedSequence.get = function (key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v === NOT_SET ? notSetValue : mapper.call(context, v, key, iterable);\n };\n\n mappedSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n return iterable.__iterate(function (v, k, c) {\n return fn(mapper.call(context, v, k, c), k, this$0) !== false;\n }, reverse);\n };\n\n mappedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\n return new Iterator(function () {\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n var entry = step.value;\n var key = entry[0];\n return iteratorValue(type, key, mapper.call(context, entry[1], key, iterable), step);\n });\n };\n\n return mappedSequence;\n }\n\n function reverseFactory(iterable, useKeys) {\n var reversedSequence = makeSequence(iterable);\n reversedSequence._iter = iterable;\n reversedSequence.size = iterable.size;\n\n reversedSequence.reverse = function () {\n return iterable;\n };\n\n if (iterable.flip) {\n reversedSequence.flip = function () {\n var flipSequence = flipFactory(iterable);\n\n flipSequence.reverse = function () {\n return iterable.flip();\n };\n\n return flipSequence;\n };\n }\n\n reversedSequence.get = function (key, notSetValue) {\n return iterable.get(useKeys ? key : -1 - key, notSetValue);\n };\n\n reversedSequence.has = function (key) {\n return iterable.has(useKeys ? key : -1 - key);\n };\n\n reversedSequence.includes = function (value) {\n return iterable.includes(value);\n };\n\n reversedSequence.cacheResult = cacheResultThrough;\n\n reversedSequence.__iterate = function (fn, reverse) {\n var this$0 = this;\n return iterable.__iterate(function (v, k) {\n return fn(v, k, this$0);\n }, !reverse);\n };\n\n reversedSequence.__iterator = function (type, reverse) {\n return iterable.__iterator(type, !reverse);\n };\n\n return reversedSequence;\n }\n\n function filterFactory(iterable, predicate, context, useKeys) {\n var filterSequence = makeSequence(iterable);\n\n if (useKeys) {\n filterSequence.has = function (key) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n };\n\n filterSequence.get = function (key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && predicate.call(context, v, key, iterable) ? v : notSetValue;\n };\n }\n\n filterSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n var iterations = 0;\n\n iterable.__iterate(function (v, k, c) {\n if (predicate.call(context, v, k, c)) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n }, reverse);\n\n return iterations;\n };\n\n filterSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\n var iterations = 0;\n return new Iterator(function () {\n while (true) {\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n var entry = step.value;\n var key = entry[0];\n var value = entry[1];\n\n if (predicate.call(context, value, key, iterable)) {\n return iteratorValue(type, useKeys ? key : iterations++, value, step);\n }\n }\n });\n };\n\n return filterSequence;\n }\n\n function countByFactory(iterable, grouper, context) {\n var groups = Map().asMutable();\n\n iterable.__iterate(function (v, k) {\n groups.update(grouper.call(context, v, k, iterable), 0, function (a) {\n return a + 1;\n });\n });\n\n return groups.asImmutable();\n }\n\n function groupByFactory(iterable, grouper, context) {\n var isKeyedIter = isKeyed(iterable);\n var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n\n iterable.__iterate(function (v, k) {\n groups.update(grouper.call(context, v, k, iterable), function (a) {\n return a = a || [], a.push(isKeyedIter ? [k, v] : v), a;\n });\n });\n\n var coerce = iterableClass(iterable);\n return groups.map(function (arr) {\n return reify(iterable, coerce(arr));\n });\n }\n\n function sliceFactory(iterable, begin, end, useKeys) {\n var originalSize = iterable.size; // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n\n if (begin !== undefined) {\n begin = begin | 0;\n }\n\n if (end !== undefined) {\n end = end | 0;\n }\n\n if (wholeSlice(begin, end, originalSize)) {\n return iterable;\n }\n\n var resolvedBegin = resolveBegin(begin, originalSize);\n var resolvedEnd = resolveEnd(end, originalSize); // begin or end will be NaN if they were provided as negative numbers and\n // this iterable's size is unknown. In that case, cache first so there is\n // a known size and these do not resolve to NaN.\n\n if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n } // Note: resolvedEnd is undefined when the original sequence's length is\n // unknown and this slice did not supply an end and should contain all\n // elements after resolvedBegin.\n // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n\n\n var resolvedSize = resolvedEnd - resolvedBegin;\n var sliceSize;\n\n if (resolvedSize === resolvedSize) {\n sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n }\n\n var sliceSeq = makeSequence(iterable); // If iterable.size is undefined, the size of the realized sliceSeq is\n // unknown at this point unless the number of items to slice is 0\n\n sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n sliceSeq.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n return index >= 0 && index < sliceSize ? iterable.get(index + resolvedBegin, notSetValue) : notSetValue;\n };\n }\n\n sliceSeq.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n\n if (sliceSize === 0) {\n return 0;\n }\n\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var skipped = 0;\n var isSkipping = true;\n var iterations = 0;\n\n iterable.__iterate(function (v, k) {\n if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0) !== false && iterations !== sliceSize;\n }\n });\n\n return iterations;\n };\n\n sliceSeq.__iteratorUncached = function (type, reverse) {\n if (sliceSize !== 0 && reverse) {\n return this.cacheResult().__iterator(type, reverse);\n } // Don't bother instantiating parent iterator if taking 0.\n\n\n var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n\n var skipped = 0;\n var iterations = 0;\n return new Iterator(function () {\n while (skipped++ < resolvedBegin) {\n iterator.next();\n }\n\n if (++iterations > sliceSize) {\n return iteratorDone();\n }\n\n var step = iterator.next();\n\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations - 1, undefined, step);\n } else {\n return iteratorValue(type, iterations - 1, step.value[1], step);\n }\n });\n };\n\n return sliceSeq;\n }\n\n function takeWhileFactory(iterable, predicate, context) {\n var takeSequence = makeSequence(iterable);\n\n takeSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var iterations = 0;\n\n iterable.__iterate(function (v, k, c) {\n return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0);\n });\n\n return iterations;\n };\n\n takeSequence.__iteratorUncached = function (type, reverse) {\n var this$0 = this;\n\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\n var iterating = true;\n return new Iterator(function () {\n if (!iterating) {\n return iteratorDone();\n }\n\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n var entry = step.value;\n var k = entry[0];\n var v = entry[1];\n\n if (!predicate.call(context, v, k, this$0)) {\n iterating = false;\n return iteratorDone();\n }\n\n return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);\n });\n };\n\n return takeSequence;\n }\n\n function skipWhileFactory(iterable, predicate, context, useKeys) {\n var skipSequence = makeSequence(iterable);\n\n skipSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var isSkipping = true;\n var iterations = 0;\n\n iterable.__iterate(function (v, k, c) {\n if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n });\n\n return iterations;\n };\n\n skipSequence.__iteratorUncached = function (type, reverse) {\n var this$0 = this;\n\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\n var skipping = true;\n var iterations = 0;\n return new Iterator(function () {\n var step, k, v;\n\n do {\n step = iterator.next();\n\n if (step.done) {\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations++, undefined, step);\n } else {\n return iteratorValue(type, iterations++, step.value[1], step);\n }\n }\n\n var entry = step.value;\n k = entry[0];\n v = entry[1];\n skipping && (skipping = predicate.call(context, v, k, this$0));\n } while (skipping);\n\n return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);\n });\n };\n\n return skipSequence;\n }\n\n function concatFactory(iterable, values) {\n var isKeyedIterable = isKeyed(iterable);\n var iters = [iterable].concat(values).map(function (v) {\n if (!isIterable(v)) {\n v = isKeyedIterable ? keyedSeqFromValue(v) : indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n } else if (isKeyedIterable) {\n v = KeyedIterable(v);\n }\n\n return v;\n }).filter(function (v) {\n return v.size !== 0;\n });\n\n if (iters.length === 0) {\n return iterable;\n }\n\n if (iters.length === 1) {\n var singleton = iters[0];\n\n if (singleton === iterable || isKeyedIterable && isKeyed(singleton) || isIndexed(iterable) && isIndexed(singleton)) {\n return singleton;\n }\n }\n\n var concatSeq = new ArraySeq(iters);\n\n if (isKeyedIterable) {\n concatSeq = concatSeq.toKeyedSeq();\n } else if (!isIndexed(iterable)) {\n concatSeq = concatSeq.toSetSeq();\n }\n\n concatSeq = concatSeq.flatten(true);\n concatSeq.size = iters.reduce(function (sum, seq) {\n if (sum !== undefined) {\n var size = seq.size;\n\n if (size !== undefined) {\n return sum + size;\n }\n }\n }, 0);\n return concatSeq;\n }\n\n function flattenFactory(iterable, depth, useKeys) {\n var flatSequence = makeSequence(iterable);\n\n flatSequence.__iterateUncached = function (fn, reverse) {\n var iterations = 0;\n var stopped = false;\n\n function flatDeep(iter, currentDepth) {\n var this$0 = this;\n\n iter.__iterate(function (v, k) {\n if ((!depth || currentDepth < depth) && isIterable(v)) {\n flatDeep(v, currentDepth + 1);\n } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n stopped = true;\n }\n\n return !stopped;\n }, reverse);\n }\n\n flatDeep(iterable, 0);\n return iterations;\n };\n\n flatSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(type, reverse);\n\n var stack = [];\n var iterations = 0;\n return new Iterator(function () {\n while (iterator) {\n var step = iterator.next();\n\n if (step.done !== false) {\n iterator = stack.pop();\n continue;\n }\n\n var v = step.value;\n\n if (type === ITERATE_ENTRIES) {\n v = v[1];\n }\n\n if ((!depth || stack.length < depth) && isIterable(v)) {\n stack.push(iterator);\n iterator = v.__iterator(type, reverse);\n } else {\n return useKeys ? step : iteratorValue(type, iterations++, v, step);\n }\n }\n\n return iteratorDone();\n });\n };\n\n return flatSequence;\n }\n\n function flatMapFactory(iterable, mapper, context) {\n var coerce = iterableClass(iterable);\n return iterable.toSeq().map(function (v, k) {\n return coerce(mapper.call(context, v, k, iterable));\n }).flatten(true);\n }\n\n function interposeFactory(iterable, separator) {\n var interposedSequence = makeSequence(iterable);\n interposedSequence.size = iterable.size && iterable.size * 2 - 1;\n\n interposedSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n var iterations = 0;\n\n iterable.__iterate(function (v, k) {\n return (!iterations || fn(separator, iterations++, this$0) !== false) && fn(v, iterations++, this$0) !== false;\n }, reverse);\n\n return iterations;\n };\n\n interposedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n\n var iterations = 0;\n var step;\n return new Iterator(function () {\n if (!step || iterations % 2) {\n step = iterator.next();\n\n if (step.done) {\n return step;\n }\n }\n\n return iterations % 2 ? iteratorValue(type, iterations++, separator) : iteratorValue(type, iterations++, step.value, step);\n });\n };\n\n return interposedSequence;\n }\n\n function sortFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n\n var isKeyedIterable = isKeyed(iterable);\n var index = 0;\n var entries = iterable.toSeq().map(function (v, k) {\n return [k, v, index++, mapper ? mapper(v, k, iterable) : v];\n }).toArray();\n entries.sort(function (a, b) {\n return comparator(a[3], b[3]) || a[2] - b[2];\n }).forEach(isKeyedIterable ? function (v, i) {\n entries[i].length = 2;\n } : function (v, i) {\n entries[i] = v[1];\n });\n return isKeyedIterable ? KeyedSeq(entries) : isIndexed(iterable) ? IndexedSeq(entries) : SetSeq(entries);\n }\n\n function maxFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n\n if (mapper) {\n var entry = iterable.toSeq().map(function (v, k) {\n return [v, mapper(v, k, iterable)];\n }).reduce(function (a, b) {\n return maxCompare(comparator, a[1], b[1]) ? b : a;\n });\n return entry && entry[0];\n } else {\n return iterable.reduce(function (a, b) {\n return maxCompare(comparator, a, b) ? b : a;\n });\n }\n }\n\n function maxCompare(comparator, a, b) {\n var comp = comparator(b, a); // b is considered the new max if the comparator declares them equal, but\n // they are not equal and b is in fact a nullish value.\n\n return comp === 0 && b !== a && (b === undefined || b === null || b !== b) || comp > 0;\n }\n\n function zipWithFactory(keyIter, zipper, iters) {\n var zipSequence = makeSequence(keyIter);\n zipSequence.size = new ArraySeq(iters).map(function (i) {\n return i.size;\n }).min(); // Note: this a generic base implementation of __iterate in terms of\n // __iterator which may be more generically useful in the future.\n\n zipSequence.__iterate = function (fn, reverse) {\n /* generic:\n var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n iterations++;\n if (fn(step.value[1], step.value[0], this) === false) {\n break;\n }\n }\n return iterations;\n */\n // indexed:\n var iterator = this.__iterator(ITERATE_VALUES, reverse);\n\n var step;\n var iterations = 0;\n\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n\n return iterations;\n };\n\n zipSequence.__iteratorUncached = function (type, reverse) {\n var iterators = iters.map(function (i) {\n return i = Iterable(i), getIterator(reverse ? i.reverse() : i);\n });\n var iterations = 0;\n var isDone = false;\n return new Iterator(function () {\n var steps;\n\n if (!isDone) {\n steps = iterators.map(function (i) {\n return i.next();\n });\n isDone = steps.some(function (s) {\n return s.done;\n });\n }\n\n if (isDone) {\n return iteratorDone();\n }\n\n return iteratorValue(type, iterations++, zipper.apply(null, steps.map(function (s) {\n return s.value;\n })));\n });\n };\n\n return zipSequence;\n } // #pragma Helper Functions\n\n\n function reify(iter, seq) {\n return isSeq(iter) ? seq : iter.constructor(seq);\n }\n\n function validateEntry(entry) {\n if (entry !== Object(entry)) {\n throw new TypeError('Expected [K, V] tuple: ' + entry);\n }\n }\n\n function resolveSize(iter) {\n assertNotInfinite(iter.size);\n return ensureSize(iter);\n }\n\n function iterableClass(iterable) {\n return isKeyed(iterable) ? KeyedIterable : isIndexed(iterable) ? IndexedIterable : SetIterable;\n }\n\n function makeSequence(iterable) {\n return Object.create((isKeyed(iterable) ? KeyedSeq : isIndexed(iterable) ? IndexedSeq : SetSeq).prototype);\n }\n\n function cacheResultThrough() {\n if (this._iter.cacheResult) {\n this._iter.cacheResult();\n\n this.size = this._iter.size;\n return this;\n } else {\n return Seq.prototype.cacheResult.call(this);\n }\n }\n\n function defaultComparator(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n function forceIterator(keyPath) {\n var iter = getIterator(keyPath);\n\n if (!iter) {\n // Array might not be iterable in this environment, so we need a fallback\n // to our wrapped type.\n if (!isArrayLike(keyPath)) {\n throw new TypeError('Expected iterable or array-like: ' + keyPath);\n }\n\n iter = getIterator(Iterable(keyPath));\n }\n\n return iter;\n }\n\n createClass(Record, KeyedCollection);\n\n function Record(defaultValues, name) {\n var hasInitialized;\n\n var RecordType = function Record(values) {\n if (values instanceof RecordType) {\n return values;\n }\n\n if (!(this instanceof RecordType)) {\n return new RecordType(values);\n }\n\n if (!hasInitialized) {\n hasInitialized = true;\n var keys = Object.keys(defaultValues);\n setProps(RecordTypePrototype, keys);\n RecordTypePrototype.size = keys.length;\n RecordTypePrototype._name = name;\n RecordTypePrototype._keys = keys;\n RecordTypePrototype._defaultValues = defaultValues;\n }\n\n this._map = Map(values);\n };\n\n var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n RecordTypePrototype.constructor = RecordType;\n return RecordType;\n }\n\n Record.prototype.toString = function () {\n return this.__toString(recordName(this) + ' {', '}');\n }; // @pragma Access\n\n\n Record.prototype.has = function (k) {\n return this._defaultValues.hasOwnProperty(k);\n };\n\n Record.prototype.get = function (k, notSetValue) {\n if (!this.has(k)) {\n return notSetValue;\n }\n\n var defaultVal = this._defaultValues[k];\n return this._map ? this._map.get(k, defaultVal) : defaultVal;\n }; // @pragma Modification\n\n\n Record.prototype.clear = function () {\n if (this.__ownerID) {\n this._map && this._map.clear();\n return this;\n }\n\n var RecordType = this.constructor;\n return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n };\n\n Record.prototype.set = function (k, v) {\n if (!this.has(k)) {\n throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n }\n\n var newMap = this._map && this._map.set(k, v);\n\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n\n return makeRecord(this, newMap);\n };\n\n Record.prototype.remove = function (k) {\n if (!this.has(k)) {\n return this;\n }\n\n var newMap = this._map && this._map.remove(k);\n\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n\n return makeRecord(this, newMap);\n };\n\n Record.prototype.wasAltered = function () {\n return this._map.wasAltered();\n };\n\n Record.prototype.__iterator = function (type, reverse) {\n var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function (_, k) {\n return this$0.get(k);\n }).__iterator(type, reverse);\n };\n\n Record.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function (_, k) {\n return this$0.get(k);\n }).__iterate(fn, reverse);\n };\n\n Record.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n var newMap = this._map && this._map.__ensureOwner(ownerID);\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n\n return makeRecord(this, newMap, ownerID);\n };\n\n var RecordPrototype = Record.prototype;\n RecordPrototype[DELETE] = RecordPrototype.remove;\n RecordPrototype.deleteIn = RecordPrototype.removeIn = MapPrototype.removeIn;\n RecordPrototype.merge = MapPrototype.merge;\n RecordPrototype.mergeWith = MapPrototype.mergeWith;\n RecordPrototype.mergeIn = MapPrototype.mergeIn;\n RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n RecordPrototype.setIn = MapPrototype.setIn;\n RecordPrototype.update = MapPrototype.update;\n RecordPrototype.updateIn = MapPrototype.updateIn;\n RecordPrototype.withMutations = MapPrototype.withMutations;\n RecordPrototype.asMutable = MapPrototype.asMutable;\n RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n function makeRecord(likeRecord, map, ownerID) {\n var record = Object.create(Object.getPrototypeOf(likeRecord));\n record._map = map;\n record.__ownerID = ownerID;\n return record;\n }\n\n function recordName(record) {\n return record._name || record.constructor.name || 'Record';\n }\n\n function setProps(prototype, names) {\n try {\n names.forEach(setProp.bind(undefined, prototype));\n } catch (error) {// Object.defineProperty failed. Probably IE8.\n }\n }\n\n function setProp(prototype, name) {\n Object.defineProperty(prototype, name, {\n get: function get() {\n return this.get(name);\n },\n set: function set(value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record.');\n this.set(name, value);\n }\n });\n }\n\n createClass(Set, SetCollection); // @pragma Construction\n\n function Set(value) {\n return value === null || value === undefined ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations(function (set) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v) {\n return set.add(v);\n });\n });\n }\n\n Set.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n Set.fromKeys = function (value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n Set.prototype.toString = function () {\n return this.__toString('Set {', '}');\n }; // @pragma Access\n\n\n Set.prototype.has = function (value) {\n return this._map.has(value);\n }; // @pragma Modification\n\n\n Set.prototype.add = function (value) {\n return updateSet(this, this._map.set(value, true));\n };\n\n Set.prototype.remove = function (value) {\n return updateSet(this, this._map.remove(value));\n };\n\n Set.prototype.clear = function () {\n return updateSet(this, this._map.clear());\n }; // @pragma Composition\n\n\n Set.prototype.union = function () {\n var iters = SLICE$0.call(arguments, 0);\n iters = iters.filter(function (x) {\n return x.size !== 0;\n });\n\n if (iters.length === 0) {\n return this;\n }\n\n if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n return this.constructor(iters[0]);\n }\n\n return this.withMutations(function (set) {\n for (var ii = 0; ii < iters.length; ii++) {\n SetIterable(iters[ii]).forEach(function (value) {\n return set.add(value);\n });\n }\n });\n };\n\n Set.prototype.intersect = function () {\n var iters = SLICE$0.call(arguments, 0);\n\n if (iters.length === 0) {\n return this;\n }\n\n iters = iters.map(function (iter) {\n return SetIterable(iter);\n });\n var originalSet = this;\n return this.withMutations(function (set) {\n originalSet.forEach(function (value) {\n if (!iters.every(function (iter) {\n return iter.includes(value);\n })) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.subtract = function () {\n var iters = SLICE$0.call(arguments, 0);\n\n if (iters.length === 0) {\n return this;\n }\n\n iters = iters.map(function (iter) {\n return SetIterable(iter);\n });\n var originalSet = this;\n return this.withMutations(function (set) {\n originalSet.forEach(function (value) {\n if (iters.some(function (iter) {\n return iter.includes(value);\n })) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.merge = function () {\n return this.union.apply(this, arguments);\n };\n\n Set.prototype.mergeWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return this.union.apply(this, iters);\n };\n\n Set.prototype.sort = function (comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator));\n };\n\n Set.prototype.sortBy = function (mapper, comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator, mapper));\n };\n\n Set.prototype.wasAltered = function () {\n return this._map.wasAltered();\n };\n\n Set.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return this._map.__iterate(function (_, k) {\n return fn(k, k, this$0);\n }, reverse);\n };\n\n Set.prototype.__iterator = function (type, reverse) {\n return this._map.map(function (_, k) {\n return k;\n }).__iterator(type, reverse);\n };\n\n Set.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n var newMap = this._map.__ensureOwner(ownerID);\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n\n return this.__make(newMap, ownerID);\n };\n\n function isSet(maybeSet) {\n return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n }\n\n Set.isSet = isSet;\n var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n var SetPrototype = Set.prototype;\n SetPrototype[IS_SET_SENTINEL] = true;\n SetPrototype[DELETE] = SetPrototype.remove;\n SetPrototype.mergeDeep = SetPrototype.merge;\n SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n SetPrototype.withMutations = MapPrototype.withMutations;\n SetPrototype.asMutable = MapPrototype.asMutable;\n SetPrototype.asImmutable = MapPrototype.asImmutable;\n SetPrototype.__empty = emptySet;\n SetPrototype.__make = makeSet;\n\n function updateSet(set, newMap) {\n if (set.__ownerID) {\n set.size = newMap.size;\n set._map = newMap;\n return set;\n }\n\n return newMap === set._map ? set : newMap.size === 0 ? set.__empty() : set.__make(newMap);\n }\n\n function makeSet(map, ownerID) {\n var set = Object.create(SetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_SET;\n\n function emptySet() {\n return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n }\n\n createClass(OrderedSet, Set); // @pragma Construction\n\n function OrderedSet(value) {\n return value === null || value === undefined ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations(function (set) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v) {\n return set.add(v);\n });\n });\n }\n\n OrderedSet.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n OrderedSet.fromKeys = function (value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n OrderedSet.prototype.toString = function () {\n return this.__toString('OrderedSet {', '}');\n };\n\n function isOrderedSet(maybeOrderedSet) {\n return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n }\n\n OrderedSet.isOrderedSet = isOrderedSet;\n var OrderedSetPrototype = OrderedSet.prototype;\n OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n OrderedSetPrototype.__empty = emptyOrderedSet;\n OrderedSetPrototype.__make = makeOrderedSet;\n\n function makeOrderedSet(map, ownerID) {\n var set = Object.create(OrderedSetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_ORDERED_SET;\n\n function emptyOrderedSet() {\n return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n }\n\n createClass(Stack, IndexedCollection); // @pragma Construction\n\n function Stack(value) {\n return value === null || value === undefined ? emptyStack() : isStack(value) ? value : emptyStack().unshiftAll(value);\n }\n\n Stack.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n Stack.prototype.toString = function () {\n return this.__toString('Stack [', ']');\n }; // @pragma Access\n\n\n Stack.prototype.get = function (index, notSetValue) {\n var head = this._head;\n index = wrapIndex(this, index);\n\n while (head && index--) {\n head = head.next;\n }\n\n return head ? head.value : notSetValue;\n };\n\n Stack.prototype.peek = function () {\n return this._head && this._head.value;\n }; // @pragma Modification\n\n\n Stack.prototype.push = function\n /*...values*/\n () {\n if (arguments.length === 0) {\n return this;\n }\n\n var newSize = this.size + arguments.length;\n var head = this._head;\n\n for (var ii = arguments.length - 1; ii >= 0; ii--) {\n head = {\n value: arguments[ii],\n next: head\n };\n }\n\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pushAll = function (iter) {\n iter = IndexedIterable(iter);\n\n if (iter.size === 0) {\n return this;\n }\n\n assertNotInfinite(iter.size);\n var newSize = this.size;\n var head = this._head;\n iter.reverse().forEach(function (value) {\n newSize++;\n head = {\n value: value,\n next: head\n };\n });\n\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pop = function () {\n return this.slice(1);\n };\n\n Stack.prototype.unshift = function\n /*...values*/\n () {\n return this.push.apply(this, arguments);\n };\n\n Stack.prototype.unshiftAll = function (iter) {\n return this.pushAll(iter);\n };\n\n Stack.prototype.shift = function () {\n return this.pop.apply(this, arguments);\n };\n\n Stack.prototype.clear = function () {\n if (this.size === 0) {\n return this;\n }\n\n if (this.__ownerID) {\n this.size = 0;\n this._head = undefined;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return emptyStack();\n };\n\n Stack.prototype.slice = function (begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n\n var resolvedBegin = resolveBegin(begin, this.size);\n var resolvedEnd = resolveEnd(end, this.size);\n\n if (resolvedEnd !== this.size) {\n // super.slice(begin, end);\n return IndexedCollection.prototype.slice.call(this, begin, end);\n }\n\n var newSize = this.size - resolvedBegin;\n var head = this._head;\n\n while (resolvedBegin--) {\n head = head.next;\n }\n\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return makeStack(newSize, head);\n }; // @pragma Mutability\n\n\n Stack.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n\n return makeStack(this.size, this._head, ownerID, this.__hash);\n }; // @pragma Iteration\n\n\n Stack.prototype.__iterate = function (fn, reverse) {\n if (reverse) {\n return this.reverse().__iterate(fn);\n }\n\n var iterations = 0;\n var node = this._head;\n\n while (node) {\n if (fn(node.value, iterations++, this) === false) {\n break;\n }\n\n node = node.next;\n }\n\n return iterations;\n };\n\n Stack.prototype.__iterator = function (type, reverse) {\n if (reverse) {\n return this.reverse().__iterator(type);\n }\n\n var iterations = 0;\n var node = this._head;\n return new Iterator(function () {\n if (node) {\n var value = node.value;\n node = node.next;\n return iteratorValue(type, iterations++, value);\n }\n\n return iteratorDone();\n });\n };\n\n function isStack(maybeStack) {\n return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n }\n\n Stack.isStack = isStack;\n var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n var StackPrototype = Stack.prototype;\n StackPrototype[IS_STACK_SENTINEL] = true;\n StackPrototype.withMutations = MapPrototype.withMutations;\n StackPrototype.asMutable = MapPrototype.asMutable;\n StackPrototype.asImmutable = MapPrototype.asImmutable;\n StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n function makeStack(size, head, ownerID, hash) {\n var map = Object.create(StackPrototype);\n map.size = size;\n map._head = head;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_STACK;\n\n function emptyStack() {\n return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n }\n /**\n * Contributes additional methods to a constructor\n */\n\n\n function mixin(ctor, methods) {\n var keyCopier = function keyCopier(key) {\n ctor.prototype[key] = methods[key];\n };\n\n Object.keys(methods).forEach(keyCopier);\n Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n return ctor;\n }\n\n Iterable.Iterator = Iterator;\n mixin(Iterable, {\n // ### Conversion to other types\n toArray: function toArray() {\n assertNotInfinite(this.size);\n var array = new Array(this.size || 0);\n\n this.valueSeq().__iterate(function (v, i) {\n array[i] = v;\n });\n\n return array;\n },\n toIndexedSeq: function toIndexedSeq() {\n return new ToIndexedSequence(this);\n },\n toJS: function toJS() {\n return this.toSeq().map(function (value) {\n return value && typeof value.toJS === 'function' ? value.toJS() : value;\n }).__toJS();\n },\n toJSON: function toJSON() {\n return this.toSeq().map(function (value) {\n return value && typeof value.toJSON === 'function' ? value.toJSON() : value;\n }).__toJS();\n },\n toKeyedSeq: function toKeyedSeq() {\n return new ToKeyedSequence(this, true);\n },\n toMap: function toMap() {\n // Use Late Binding here to solve the circular dependency.\n return Map(this.toKeyedSeq());\n },\n toObject: function toObject() {\n assertNotInfinite(this.size);\n var object = {};\n\n this.__iterate(function (v, k) {\n object[k] = v;\n });\n\n return object;\n },\n toOrderedMap: function toOrderedMap() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedMap(this.toKeyedSeq());\n },\n toOrderedSet: function toOrderedSet() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n },\n toSet: function toSet() {\n // Use Late Binding here to solve the circular dependency.\n return Set(isKeyed(this) ? this.valueSeq() : this);\n },\n toSetSeq: function toSetSeq() {\n return new ToSetSequence(this);\n },\n toSeq: function toSeq() {\n return isIndexed(this) ? this.toIndexedSeq() : isKeyed(this) ? this.toKeyedSeq() : this.toSetSeq();\n },\n toStack: function toStack() {\n // Use Late Binding here to solve the circular dependency.\n return Stack(isKeyed(this) ? this.valueSeq() : this);\n },\n toList: function toList() {\n // Use Late Binding here to solve the circular dependency.\n return List(isKeyed(this) ? this.valueSeq() : this);\n },\n // ### Common JavaScript methods and properties\n toString: function toString() {\n return '[Iterable]';\n },\n __toString: function __toString(head, tail) {\n if (this.size === 0) {\n return head + tail;\n }\n\n return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n },\n // ### ES6 Collection methods (ES6 Array and Map)\n concat: function concat() {\n var values = SLICE$0.call(arguments, 0);\n return reify(this, concatFactory(this, values));\n },\n includes: function includes(searchValue) {\n return this.some(function (value) {\n return is(value, searchValue);\n });\n },\n entries: function entries() {\n return this.__iterator(ITERATE_ENTRIES);\n },\n every: function every(predicate, context) {\n assertNotInfinite(this.size);\n var returnValue = true;\n\n this.__iterate(function (v, k, c) {\n if (!predicate.call(context, v, k, c)) {\n returnValue = false;\n return false;\n }\n });\n\n return returnValue;\n },\n filter: function filter(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, true));\n },\n find: function find(predicate, context, notSetValue) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[1] : notSetValue;\n },\n findEntry: function findEntry(predicate, context) {\n var found;\n\n this.__iterate(function (v, k, c) {\n if (predicate.call(context, v, k, c)) {\n found = [k, v];\n return false;\n }\n });\n\n return found;\n },\n findLastEntry: function findLastEntry(predicate, context) {\n return this.toSeq().reverse().findEntry(predicate, context);\n },\n forEach: function forEach(sideEffect, context) {\n assertNotInfinite(this.size);\n return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n },\n join: function join(separator) {\n assertNotInfinite(this.size);\n separator = separator !== undefined ? '' + separator : ',';\n var joined = '';\n var isFirst = true;\n\n this.__iterate(function (v) {\n isFirst ? isFirst = false : joined += separator;\n joined += v !== null && v !== undefined ? v.toString() : '';\n });\n\n return joined;\n },\n keys: function keys() {\n return this.__iterator(ITERATE_KEYS);\n },\n map: function map(mapper, context) {\n return reify(this, mapFactory(this, mapper, context));\n },\n reduce: function reduce(reducer, initialReduction, context) {\n assertNotInfinite(this.size);\n var reduction;\n var useFirst;\n\n if (arguments.length < 2) {\n useFirst = true;\n } else {\n reduction = initialReduction;\n }\n\n this.__iterate(function (v, k, c) {\n if (useFirst) {\n useFirst = false;\n reduction = v;\n } else {\n reduction = reducer.call(context, reduction, v, k, c);\n }\n });\n\n return reduction;\n },\n reduceRight: function reduceRight(reducer, initialReduction, context) {\n var reversed = this.toKeyedSeq().reverse();\n return reversed.reduce.apply(reversed, arguments);\n },\n reverse: function reverse() {\n return reify(this, reverseFactory(this, true));\n },\n slice: function slice(begin, end) {\n return reify(this, sliceFactory(this, begin, end, true));\n },\n some: function some(predicate, context) {\n return !this.every(not(predicate), context);\n },\n sort: function sort(comparator) {\n return reify(this, sortFactory(this, comparator));\n },\n values: function values() {\n return this.__iterator(ITERATE_VALUES);\n },\n // ### More sequential methods\n butLast: function butLast() {\n return this.slice(0, -1);\n },\n isEmpty: function isEmpty() {\n return this.size !== undefined ? this.size === 0 : !this.some(function () {\n return true;\n });\n },\n count: function count(predicate, context) {\n return ensureSize(predicate ? this.toSeq().filter(predicate, context) : this);\n },\n countBy: function countBy(grouper, context) {\n return countByFactory(this, grouper, context);\n },\n equals: function equals(other) {\n return deepEqual(this, other);\n },\n entrySeq: function entrySeq() {\n var iterable = this;\n\n if (iterable._cache) {\n // We cache as an entries array, so we can just return the cache!\n return new ArraySeq(iterable._cache);\n }\n\n var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n\n entriesSequence.fromEntrySeq = function () {\n return iterable.toSeq();\n };\n\n return entriesSequence;\n },\n filterNot: function filterNot(predicate, context) {\n return this.filter(not(predicate), context);\n },\n findLast: function findLast(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n },\n first: function first() {\n return this.find(returnTrue);\n },\n flatMap: function flatMap(mapper, context) {\n return reify(this, flatMapFactory(this, mapper, context));\n },\n flatten: function flatten(depth) {\n return reify(this, flattenFactory(this, depth, true));\n },\n fromEntrySeq: function fromEntrySeq() {\n return new FromEntriesSequence(this);\n },\n get: function get(searchKey, notSetValue) {\n return this.find(function (_, key) {\n return is(key, searchKey);\n }, undefined, notSetValue);\n },\n getIn: function getIn(searchKeyPath, notSetValue) {\n var nested = this; // Note: in an ES6 environment, we would prefer:\n // for (var key of searchKeyPath) {\n\n var iter = forceIterator(searchKeyPath);\n var step;\n\n while (!(step = iter.next()).done) {\n var key = step.value;\n nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n\n if (nested === NOT_SET) {\n return notSetValue;\n }\n }\n\n return nested;\n },\n groupBy: function groupBy(grouper, context) {\n return groupByFactory(this, grouper, context);\n },\n has: function has(searchKey) {\n return this.get(searchKey, NOT_SET) !== NOT_SET;\n },\n hasIn: function hasIn(searchKeyPath) {\n return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n },\n isSubset: function isSubset(iter) {\n iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n return this.every(function (value) {\n return iter.includes(value);\n });\n },\n isSuperset: function isSuperset(iter) {\n iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n return iter.isSubset(this);\n },\n keySeq: function keySeq() {\n return this.toSeq().map(keyMapper).toIndexedSeq();\n },\n last: function last() {\n return this.toSeq().reverse().first();\n },\n max: function max(comparator) {\n return maxFactory(this, comparator);\n },\n maxBy: function maxBy(mapper, comparator) {\n return maxFactory(this, comparator, mapper);\n },\n min: function min(comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n },\n minBy: function minBy(mapper, comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n },\n rest: function rest() {\n return this.slice(1);\n },\n skip: function skip(amount) {\n return this.slice(Math.max(0, amount));\n },\n skipLast: function skipLast(amount) {\n return reify(this, this.toSeq().reverse().skip(amount).reverse());\n },\n skipWhile: function skipWhile(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, true));\n },\n skipUntil: function skipUntil(predicate, context) {\n return this.skipWhile(not(predicate), context);\n },\n sortBy: function sortBy(mapper, comparator) {\n return reify(this, sortFactory(this, comparator, mapper));\n },\n take: function take(amount) {\n return this.slice(0, Math.max(0, amount));\n },\n takeLast: function takeLast(amount) {\n return reify(this, this.toSeq().reverse().take(amount).reverse());\n },\n takeWhile: function takeWhile(predicate, context) {\n return reify(this, takeWhileFactory(this, predicate, context));\n },\n takeUntil: function takeUntil(predicate, context) {\n return this.takeWhile(not(predicate), context);\n },\n valueSeq: function valueSeq() {\n return this.toIndexedSeq();\n },\n // ### Hashable Object\n hashCode: function hashCode() {\n return this.__hash || (this.__hash = hashIterable(this));\n } // ### Internal\n // abstract __iterate(fn, reverse)\n // abstract __iterator(type, reverse)\n\n }); // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n var IterablePrototype = Iterable.prototype;\n IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n IterablePrototype.__toJS = IterablePrototype.toArray;\n IterablePrototype.__toStringMapper = quoteString;\n\n IterablePrototype.inspect = IterablePrototype.toSource = function () {\n return this.toString();\n };\n\n IterablePrototype.chain = IterablePrototype.flatMap;\n IterablePrototype.contains = IterablePrototype.includes; // Temporary warning about using length\n\n (function () {\n try {\n Object.defineProperty(IterablePrototype, 'length', {\n get: function get() {\n if (!Iterable.noLengthWarning) {\n var stack;\n\n try {\n throw new Error();\n } catch (error) {\n stack = error.stack;\n }\n\n if (stack.indexOf('_wrapObject') === -1) {\n console && console.warn && console.warn('iterable.length has been deprecated, ' + 'use iterable.size or iterable.count(). ' + 'This warning will become a silent error in a future version. ' + stack);\n return this.size;\n }\n }\n }\n });\n } catch (e) {}\n })();\n\n mixin(KeyedIterable, {\n // ### More sequential methods\n flip: function flip() {\n return reify(this, flipFactory(this));\n },\n findKey: function findKey(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry && entry[0];\n },\n findLastKey: function findLastKey(predicate, context) {\n return this.toSeq().reverse().findKey(predicate, context);\n },\n keyOf: function keyOf(searchValue) {\n return this.findKey(function (value) {\n return is(value, searchValue);\n });\n },\n lastKeyOf: function lastKeyOf(searchValue) {\n return this.findLastKey(function (value) {\n return is(value, searchValue);\n });\n },\n mapEntries: function mapEntries(mapper, context) {\n var this$0 = this;\n var iterations = 0;\n return reify(this, this.toSeq().map(function (v, k) {\n return mapper.call(context, [k, v], iterations++, this$0);\n }).fromEntrySeq());\n },\n mapKeys: function mapKeys(mapper, context) {\n var this$0 = this;\n return reify(this, this.toSeq().flip().map(function (k, v) {\n return mapper.call(context, k, v, this$0);\n }).flip());\n }\n });\n var KeyedIterablePrototype = KeyedIterable.prototype;\n KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n\n KeyedIterablePrototype.__toStringMapper = function (v, k) {\n return JSON.stringify(k) + ': ' + quoteString(v);\n };\n\n mixin(IndexedIterable, {\n // ### Conversion to other types\n toKeyedSeq: function toKeyedSeq() {\n return new ToKeyedSequence(this, false);\n },\n // ### ES6 Collection methods (ES6 Array and Map)\n filter: function filter(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, false));\n },\n findIndex: function findIndex(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n indexOf: function indexOf(searchValue) {\n var key = this.toKeyedSeq().keyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n lastIndexOf: function lastIndexOf(searchValue) {\n var key = this.toKeyedSeq().reverse().keyOf(searchValue);\n return key === undefined ? -1 : key; // var index =\n // return this.toSeq().reverse().indexOf(searchValue);\n },\n reverse: function reverse() {\n return reify(this, reverseFactory(this, false));\n },\n slice: function slice(begin, end) {\n return reify(this, sliceFactory(this, begin, end, false));\n },\n splice: function splice(index, removeNum\n /*, ...values*/\n ) {\n var numArgs = arguments.length;\n removeNum = Math.max(removeNum | 0, 0);\n\n if (numArgs === 0 || numArgs === 2 && !removeNum) {\n return this;\n } // If index is negative, it should resolve relative to the size of the\n // collection. However size may be expensive to compute if not cached, so\n // only call count() if the number is in fact negative.\n\n\n index = resolveBegin(index, index < 0 ? this.count() : this.size);\n var spliced = this.slice(0, index);\n return reify(this, numArgs === 1 ? spliced : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)));\n },\n // ### More collection methods\n findLastIndex: function findLastIndex(predicate, context) {\n var key = this.toKeyedSeq().findLastKey(predicate, context);\n return key === undefined ? -1 : key;\n },\n first: function first() {\n return this.get(0);\n },\n flatten: function flatten(depth) {\n return reify(this, flattenFactory(this, depth, false));\n },\n get: function get(index, notSetValue) {\n index = wrapIndex(this, index);\n return index < 0 || this.size === Infinity || this.size !== undefined && index > this.size ? notSetValue : this.find(function (_, key) {\n return key === index;\n }, undefined, notSetValue);\n },\n has: function has(index) {\n index = wrapIndex(this, index);\n return index >= 0 && (this.size !== undefined ? this.size === Infinity || index < this.size : this.indexOf(index) !== -1);\n },\n interpose: function interpose(separator) {\n return reify(this, interposeFactory(this, separator));\n },\n interleave: function\n /*...iterables*/\n interleave() {\n var iterables = [this].concat(arrCopy(arguments));\n var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n var interleaved = zipped.flatten(true);\n\n if (zipped.size) {\n interleaved.size = zipped.size * iterables.length;\n }\n\n return reify(this, interleaved);\n },\n last: function last() {\n return this.get(-1);\n },\n skipWhile: function skipWhile(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, false));\n },\n zip: function\n /*, ...iterables */\n zip() {\n var iterables = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, iterables));\n },\n zipWith: function zipWith(zipper\n /*, ...iterables */\n ) {\n var iterables = arrCopy(arguments);\n iterables[0] = this;\n return reify(this, zipWithFactory(this, zipper, iterables));\n }\n });\n IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n mixin(SetIterable, {\n // ### ES6 Collection methods (ES6 Array and Map)\n get: function get(value, notSetValue) {\n return this.has(value) ? value : notSetValue;\n },\n includes: function includes(value) {\n return this.has(value);\n },\n // ### More sequential methods\n keySeq: function keySeq() {\n return this.valueSeq();\n }\n });\n SetIterable.prototype.has = IterablePrototype.includes; // Mixin subclasses\n\n mixin(KeyedSeq, KeyedIterable.prototype);\n mixin(IndexedSeq, IndexedIterable.prototype);\n mixin(SetSeq, SetIterable.prototype);\n mixin(KeyedCollection, KeyedIterable.prototype);\n mixin(IndexedCollection, IndexedIterable.prototype);\n mixin(SetCollection, SetIterable.prototype); // #pragma Helper functions\n\n function keyMapper(v, k) {\n return k;\n }\n\n function entryMapper(v, k) {\n return [k, v];\n }\n\n function not(predicate) {\n return function () {\n return !predicate.apply(this, arguments);\n };\n }\n\n function neg(predicate) {\n return function () {\n return -predicate.apply(this, arguments);\n };\n }\n\n function quoteString(value) {\n return typeof value === 'string' ? JSON.stringify(value) : value;\n }\n\n function defaultZipper() {\n return arrCopy(arguments);\n }\n\n function defaultNegComparator(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n }\n\n function hashIterable(iterable) {\n if (iterable.size === Infinity) {\n return 0;\n }\n\n var ordered = isOrdered(iterable);\n var keyed = isKeyed(iterable);\n var h = ordered ? 1 : 0;\n\n var size = iterable.__iterate(keyed ? ordered ? function (v, k) {\n h = 31 * h + hashMerge(hash(v), hash(k)) | 0;\n } : function (v, k) {\n h = h + hashMerge(hash(v), hash(k)) | 0;\n } : ordered ? function (v) {\n h = 31 * h + hash(v) | 0;\n } : function (v) {\n h = h + hash(v) | 0;\n });\n\n return murmurHashOfSize(size, h);\n }\n\n function murmurHashOfSize(size, h) {\n h = imul(h, 0xCC9E2D51);\n h = imul(h << 15 | h >>> -15, 0x1B873593);\n h = imul(h << 13 | h >>> -13, 5);\n h = (h + 0xE6546B64 | 0) ^ size;\n h = imul(h ^ h >>> 16, 0x85EBCA6B);\n h = imul(h ^ h >>> 13, 0xC2B2AE35);\n h = smi(h ^ h >>> 16);\n return h;\n }\n\n function hashMerge(a, b) {\n return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n }\n\n var Immutable = {\n Iterable: Iterable,\n Seq: Seq,\n Collection: Collection,\n Map: Map,\n OrderedMap: OrderedMap,\n List: List,\n Stack: Stack,\n Set: Set,\n OrderedSet: OrderedSet,\n Record: Record,\n Range: Range,\n Repeat: Repeat,\n is: is,\n fromJS: fromJS\n };\n return Immutable;\n});","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.draftjsToHtml = factory());\n})(this, function () {\n 'use strict';\n /**\n * Utility function to execute callback for eack key->value pair.\n */\n\n function forEach(obj, callback) {\n if (obj) {\n for (var key in obj) {\n // eslint-disable-line no-restricted-syntax\n if ({}.hasOwnProperty.call(obj, key)) {\n callback(key, obj[key]);\n }\n }\n }\n }\n /**\n * The function returns true if the string passed to it has no content.\n */\n\n\n function isEmptyString(str) {\n if (str === undefined || str === null || str.length === 0 || str.trim().length === 0) {\n return true;\n }\n\n return false;\n }\n /**\n * Mapping block-type to corresponding html tag.\n */\n\n\n var blockTypesMapping = {\n unstyled: 'p',\n 'header-one': 'h1',\n 'header-two': 'h2',\n 'header-three': 'h3',\n 'header-four': 'h4',\n 'header-five': 'h5',\n 'header-six': 'h6',\n 'unordered-list-item': 'ul',\n 'ordered-list-item': 'ol',\n blockquote: 'blockquote',\n code: 'pre'\n };\n /**\n * Function will return HTML tag for a block.\n */\n\n function getBlockTag(type) {\n return type && blockTypesMapping[type];\n }\n /**\n * Function will return style string for a block.\n */\n\n\n function getBlockStyle(data) {\n var styles = '';\n forEach(data, function (key, value) {\n if (value) {\n styles += \"\".concat(key, \":\").concat(value, \";\");\n }\n });\n return styles;\n }\n /**\n * The function returns an array of hashtag-sections in blocks.\n * These will be areas in block which have hashtags applicable to them.\n */\n\n\n function getHashtagRanges(blockText, hashtagConfig) {\n var sections = [];\n\n if (hashtagConfig) {\n var counter = 0;\n var startIndex = 0;\n var text = blockText;\n var trigger = hashtagConfig.trigger || '#';\n var separator = hashtagConfig.separator || ' ';\n\n for (; text.length > 0 && startIndex >= 0;) {\n if (text[0] === trigger) {\n startIndex = 0;\n counter = 0;\n text = text.substr(trigger.length);\n } else {\n startIndex = text.indexOf(separator + trigger);\n\n if (startIndex >= 0) {\n text = text.substr(startIndex + (separator + trigger).length);\n counter += startIndex + separator.length;\n }\n }\n\n if (startIndex >= 0) {\n var endIndex = text.indexOf(separator) >= 0 ? text.indexOf(separator) : text.length;\n var hashtag = text.substr(0, endIndex);\n\n if (hashtag && hashtag.length > 0) {\n sections.push({\n offset: counter,\n length: hashtag.length + trigger.length,\n type: 'HASHTAG'\n });\n }\n\n counter += trigger.length;\n }\n }\n }\n\n return sections;\n }\n /**\n * The function returns an array of entity-sections in blocks.\n * These will be areas in block which have same entity or no entity applicable to them.\n */\n\n\n function getSections(block, hashtagConfig) {\n var sections = [];\n var lastOffset = 0;\n var sectionRanges = block.entityRanges.map(function (range) {\n var offset = range.offset,\n length = range.length,\n key = range.key;\n return {\n offset: offset,\n length: length,\n key: key,\n type: 'ENTITY'\n };\n });\n sectionRanges = sectionRanges.concat(getHashtagRanges(block.text, hashtagConfig));\n sectionRanges = sectionRanges.sort(function (s1, s2) {\n return s1.offset - s2.offset;\n });\n sectionRanges.forEach(function (r) {\n if (r.offset > lastOffset) {\n sections.push({\n start: lastOffset,\n end: r.offset\n });\n }\n\n sections.push({\n start: r.offset,\n end: r.offset + r.length,\n entityKey: r.key,\n type: r.type\n });\n lastOffset = r.offset + r.length;\n });\n\n if (lastOffset < block.text.length) {\n sections.push({\n start: lastOffset,\n end: block.text.length\n });\n }\n\n return sections;\n }\n /**\n * Function to check if the block is an atomic entity block.\n */\n\n\n function isAtomicEntityBlock(block) {\n if (block.entityRanges.length > 0 && (isEmptyString(block.text) || block.type === 'atomic')) {\n return true;\n }\n\n return false;\n }\n /**\n * The function will return array of inline styles applicable to the block.\n */\n\n\n function getStyleArrayForBlock(block) {\n var text = block.text,\n inlineStyleRanges = block.inlineStyleRanges;\n var inlineStyles = {\n BOLD: new Array(text.length),\n ITALIC: new Array(text.length),\n UNDERLINE: new Array(text.length),\n STRIKETHROUGH: new Array(text.length),\n CODE: new Array(text.length),\n SUPERSCRIPT: new Array(text.length),\n SUBSCRIPT: new Array(text.length),\n COLOR: new Array(text.length),\n BGCOLOR: new Array(text.length),\n FONTSIZE: new Array(text.length),\n FONTFAMILY: new Array(text.length),\n length: text.length\n };\n\n if (inlineStyleRanges && inlineStyleRanges.length > 0) {\n inlineStyleRanges.forEach(function (range) {\n var offset = range.offset;\n var length = offset + range.length;\n\n for (var i = offset; i < length; i += 1) {\n if (range.style.indexOf('color-') === 0) {\n inlineStyles.COLOR[i] = range.style.substring(6);\n } else if (range.style.indexOf('bgcolor-') === 0) {\n inlineStyles.BGCOLOR[i] = range.style.substring(8);\n } else if (range.style.indexOf('fontsize-') === 0) {\n inlineStyles.FONTSIZE[i] = range.style.substring(9);\n } else if (range.style.indexOf('fontfamily-') === 0) {\n inlineStyles.FONTFAMILY[i] = range.style.substring(11);\n } else if (inlineStyles[range.style]) {\n inlineStyles[range.style][i] = true;\n }\n }\n });\n }\n\n return inlineStyles;\n }\n /**\n * The function will return inline style applicable at some offset within a block.\n */\n\n\n function getStylesAtOffset(inlineStyles, offset) {\n var styles = {};\n\n if (inlineStyles.COLOR[offset]) {\n styles.COLOR = inlineStyles.COLOR[offset];\n }\n\n if (inlineStyles.BGCOLOR[offset]) {\n styles.BGCOLOR = inlineStyles.BGCOLOR[offset];\n }\n\n if (inlineStyles.FONTSIZE[offset]) {\n styles.FONTSIZE = inlineStyles.FONTSIZE[offset];\n }\n\n if (inlineStyles.FONTFAMILY[offset]) {\n styles.FONTFAMILY = inlineStyles.FONTFAMILY[offset];\n }\n\n if (inlineStyles.UNDERLINE[offset]) {\n styles.UNDERLINE = true;\n }\n\n if (inlineStyles.ITALIC[offset]) {\n styles.ITALIC = true;\n }\n\n if (inlineStyles.BOLD[offset]) {\n styles.BOLD = true;\n }\n\n if (inlineStyles.STRIKETHROUGH[offset]) {\n styles.STRIKETHROUGH = true;\n }\n\n if (inlineStyles.CODE[offset]) {\n styles.CODE = true;\n }\n\n if (inlineStyles.SUBSCRIPT[offset]) {\n styles.SUBSCRIPT = true;\n }\n\n if (inlineStyles.SUPERSCRIPT[offset]) {\n styles.SUPERSCRIPT = true;\n }\n\n return styles;\n }\n /**\n * Function returns true for a set of styles if the value of these styles at an offset\n * are same as that on the previous offset.\n */\n\n\n function sameStyleAsPrevious(inlineStyles, styles, index) {\n var sameStyled = true;\n\n if (index > 0 && index < inlineStyles.length) {\n styles.forEach(function (style) {\n sameStyled = sameStyled && inlineStyles[style][index] === inlineStyles[style][index - 1];\n });\n } else {\n sameStyled = false;\n }\n\n return sameStyled;\n }\n /**\n * Function returns html for text depending on inline style tags applicable to it.\n */\n\n\n function addInlineStyleMarkup(style, content) {\n if (style === 'BOLD') {\n return \"
\".concat(content, \" \");\n }\n\n if (style === 'ITALIC') {\n return \"
\".concat(content, \" \");\n }\n\n if (style === 'UNDERLINE') {\n return \"
\".concat(content, \" \");\n }\n\n if (style === 'STRIKETHROUGH') {\n return \"
\".concat(content, \"\");\n }\n\n if (style === 'CODE') {\n return \"
\".concat(content, \"
\");\n }\n\n if (style === 'SUPERSCRIPT') {\n return \"
\".concat(content, \" \");\n }\n\n if (style === 'SUBSCRIPT') {\n return \"
\".concat(content, \" \");\n }\n\n return content;\n }\n /**\n * The function returns text for given section of block after doing required character replacements.\n */\n\n\n function getSectionText(text) {\n if (text && text.length > 0) {\n var chars = text.map(function (ch) {\n switch (ch) {\n case '\\n':\n return '
';\n\n case '&':\n return '&';\n\n case '<':\n return '<';\n\n case '>':\n return '>';\n\n default:\n return ch;\n }\n });\n return chars.join('');\n }\n\n return '';\n }\n /**\n * Function returns html for text depending on inline style tags applicable to it.\n */\n\n\n function addStylePropertyMarkup(styles, text) {\n if (styles && (styles.COLOR || styles.BGCOLOR || styles.FONTSIZE || styles.FONTFAMILY)) {\n var styleString = 'style=\"';\n\n if (styles.COLOR) {\n styleString += \"color: \".concat(styles.COLOR, \";\");\n }\n\n if (styles.BGCOLOR) {\n styleString += \"background-color: \".concat(styles.BGCOLOR, \";\");\n }\n\n if (styles.FONTSIZE) {\n styleString += \"font-size: \".concat(styles.FONTSIZE).concat(/^\\d+$/.test(styles.FONTSIZE) ? 'px' : '', \";\");\n }\n\n if (styles.FONTFAMILY) {\n styleString += \"font-family: \".concat(styles.FONTFAMILY, \";\");\n }\n\n styleString += '\"';\n return \"
\").concat(text, \" \");\n }\n\n return text;\n }\n /**\n * Function will return markup for Entity.\n */\n\n\n function getEntityMarkup(entityMap, entityKey, text, customEntityTransform) {\n var entity = entityMap[entityKey];\n\n if (typeof customEntityTransform === 'function') {\n var html = customEntityTransform(entity, text);\n\n if (html) {\n return html;\n }\n }\n\n if (entity.type === 'MENTION') {\n return \"
\").concat(text, \" \");\n }\n\n if (entity.type === 'LINK') {\n var targetOption = entity.data.targetOption || '_self';\n return \"
\").concat(text, \" \");\n }\n\n if (entity.type === 'IMAGE') {\n var alignment = entity.data.alignment;\n\n if (alignment && alignment.length) {\n return \"
\");\n }\n\n return \"
\");\n }\n\n if (entity.type === 'EMBEDDED_LINK') {\n return \"
\");\n }\n\n return text;\n }\n /**\n * For a given section in a block the function will return a further list of sections,\n * with similar inline styles applicable to them.\n */\n\n\n function getInlineStyleSections(block, styles, start, end) {\n var styleSections = [];\n var text = Array.from(block.text);\n\n if (text.length > 0) {\n var inlineStyles = getStyleArrayForBlock(block);\n var section;\n\n for (var i = start; i < end; i += 1) {\n if (i !== start && sameStyleAsPrevious(inlineStyles, styles, i)) {\n section.text.push(text[i]);\n section.end = i + 1;\n } else {\n section = {\n styles: getStylesAtOffset(inlineStyles, i),\n text: [text[i]],\n start: i,\n end: i + 1\n };\n styleSections.push(section);\n }\n }\n }\n\n return styleSections;\n }\n /**\n * Replace leading blank spaces by \n */\n\n\n function trimLeadingZeros(sectionText) {\n if (sectionText) {\n var replacedText = sectionText;\n\n for (var i = 0; i < replacedText.length; i += 1) {\n if (sectionText[i] === ' ') {\n replacedText = replacedText.replace(' ', ' ');\n } else {\n break;\n }\n }\n\n return replacedText;\n }\n\n return sectionText;\n }\n /**\n * Replace trailing blank spaces by \n */\n\n\n function trimTrailingZeros(sectionText) {\n if (sectionText) {\n var replacedText = sectionText;\n\n for (var i = replacedText.length - 1; i >= 0; i -= 1) {\n if (replacedText[i] === ' ') {\n replacedText = \"\".concat(replacedText.substring(0, i), \" \").concat(replacedText.substring(i + 1));\n } else {\n break;\n }\n }\n\n return replacedText;\n }\n\n return sectionText;\n }\n /**\n * The method returns markup for section to which inline styles\n * like BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, CODE, SUPERSCRIPT, SUBSCRIPT are applicable.\n */\n\n\n function getStyleTagSectionMarkup(styleSection) {\n var styles = styleSection.styles,\n text = styleSection.text;\n var content = getSectionText(text);\n forEach(styles, function (style, value) {\n content = addInlineStyleMarkup(style, content);\n });\n return content;\n }\n /**\n * The method returns markup for section to which inline styles\n like color, background-color, font-size are applicable.\n */\n\n\n function getInlineStyleSectionMarkup(block, styleSection) {\n var styleTagSections = getInlineStyleSections(block, ['BOLD', 'ITALIC', 'UNDERLINE', 'STRIKETHROUGH', 'CODE', 'SUPERSCRIPT', 'SUBSCRIPT'], styleSection.start, styleSection.end);\n var styleSectionText = '';\n styleTagSections.forEach(function (stylePropertySection) {\n styleSectionText += getStyleTagSectionMarkup(stylePropertySection);\n });\n styleSectionText = addStylePropertyMarkup(styleSection.styles, styleSectionText);\n return styleSectionText;\n }\n /*\n * The method returns markup for an entity section.\n * An entity section is a continuous section in a block\n * to which same entity or no entity is applicable.\n */\n\n\n function getSectionMarkup(block, entityMap, section, customEntityTransform) {\n var entityInlineMarkup = [];\n var inlineStyleSections = getInlineStyleSections(block, ['COLOR', 'BGCOLOR', 'FONTSIZE', 'FONTFAMILY'], section.start, section.end);\n inlineStyleSections.forEach(function (styleSection) {\n entityInlineMarkup.push(getInlineStyleSectionMarkup(block, styleSection));\n });\n var sectionText = entityInlineMarkup.join('');\n\n if (section.type === 'ENTITY') {\n if (section.entityKey !== undefined && section.entityKey !== null) {\n sectionText = getEntityMarkup(entityMap, section.entityKey, sectionText, customEntityTransform); // eslint-disable-line max-len\n }\n } else if (section.type === 'HASHTAG') {\n sectionText = \"
\").concat(sectionText, \" \");\n }\n\n return sectionText;\n }\n /**\n * Function will return the markup for block preserving the inline styles and\n * special characters like newlines or blank spaces.\n */\n\n\n function getBlockInnerMarkup(block, entityMap, hashtagConfig, customEntityTransform) {\n var blockMarkup = [];\n var sections = getSections(block, hashtagConfig);\n sections.forEach(function (section, index) {\n var sectionText = getSectionMarkup(block, entityMap, section, customEntityTransform);\n\n if (index === 0) {\n sectionText = trimLeadingZeros(sectionText);\n }\n\n if (index === sections.length - 1) {\n sectionText = trimTrailingZeros(sectionText);\n }\n\n blockMarkup.push(sectionText);\n });\n return blockMarkup.join('');\n }\n /**\n * Function will return html for the block.\n */\n\n\n function getBlockMarkup(block, entityMap, hashtagConfig, directional, customEntityTransform) {\n var blockHtml = [];\n\n if (isAtomicEntityBlock(block)) {\n blockHtml.push(getEntityMarkup(entityMap, block.entityRanges[0].key, undefined, customEntityTransform));\n } else {\n var blockTag = getBlockTag(block.type);\n\n if (blockTag) {\n blockHtml.push(\"<\".concat(blockTag));\n var blockStyle = getBlockStyle(block.data);\n\n if (blockStyle) {\n blockHtml.push(\" style=\\\"\".concat(blockStyle, \"\\\"\"));\n }\n\n if (directional) {\n blockHtml.push(' dir = \"auto\"');\n }\n\n blockHtml.push('>');\n blockHtml.push(getBlockInnerMarkup(block, entityMap, hashtagConfig, customEntityTransform));\n blockHtml.push(\"\".concat(blockTag, \">\"));\n }\n }\n\n blockHtml.push('\\n');\n return blockHtml.join('');\n }\n /**\n * Function to check if a block is of type list.\n */\n\n\n function isList(blockType) {\n return blockType === 'unordered-list-item' || blockType === 'ordered-list-item';\n }\n /**\n * Function will return html markup for a list block.\n */\n\n\n function getListMarkup(listBlocks, entityMap, hashtagConfig, directional, customEntityTransform) {\n var listHtml = [];\n var nestedListBlock = [];\n var previousBlock;\n listBlocks.forEach(function (block) {\n var nestedBlock = false;\n\n if (!previousBlock) {\n listHtml.push(\"<\".concat(getBlockTag(block.type), \">\\n\"));\n } else if (previousBlock.type !== block.type) {\n listHtml.push(\"\".concat(getBlockTag(previousBlock.type), \">\\n\"));\n listHtml.push(\"<\".concat(getBlockTag(block.type), \">\\n\"));\n } else if (previousBlock.depth === block.depth) {\n if (nestedListBlock && nestedListBlock.length > 0) {\n listHtml.push(getListMarkup(nestedListBlock, entityMap, hashtagConfig, directional, customEntityTransform));\n nestedListBlock = [];\n }\n } else {\n nestedBlock = true;\n nestedListBlock.push(block);\n }\n\n if (!nestedBlock) {\n listHtml.push('
');\n listHtml.push(getBlockInnerMarkup(block, entityMap, hashtagConfig, customEntityTransform));\n listHtml.push(' \\n');\n previousBlock = block;\n }\n });\n\n if (nestedListBlock && nestedListBlock.length > 0) {\n listHtml.push(getListMarkup(nestedListBlock, entityMap, hashtagConfig, directional, customEntityTransform));\n }\n\n listHtml.push(\"\".concat(getBlockTag(previousBlock.type), \">\\n\"));\n return listHtml.join('');\n }\n /**\n * The function will generate html markup for given draftjs editorContent.\n */\n\n\n function draftToHtml(editorContent, hashtagConfig, directional, customEntityTransform) {\n var html = [];\n\n if (editorContent) {\n var blocks = editorContent.blocks,\n entityMap = editorContent.entityMap;\n\n if (blocks && blocks.length > 0) {\n var listBlocks = [];\n blocks.forEach(function (block) {\n if (isList(block.type)) {\n listBlocks.push(block);\n } else {\n if (listBlocks.length > 0) {\n var listHtml = getListMarkup(listBlocks, entityMap, hashtagConfig, customEntityTransform); // eslint-disable-line max-len\n\n html.push(listHtml);\n listBlocks = [];\n }\n\n var blockHtml = getBlockMarkup(block, entityMap, hashtagConfig, directional, customEntityTransform);\n html.push(blockHtml);\n }\n });\n\n if (listBlocks.length > 0) {\n var listHtml = getListMarkup(listBlocks, entityMap, hashtagConfig, directional, customEntityTransform); // eslint-disable-line max-len\n\n html.push(listHtml);\n listBlocks = [];\n }\n }\n }\n\n return html.join('');\n }\n\n return draftToHtml;\n});","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar PhotosMimeType = require(\"./PhotosMimeType\");\n\nvar createArrayFromMixed = require(\"./createArrayFromMixed\");\n\nvar emptyFunction = require(\"./emptyFunction\");\n\nvar CR_LF_REGEX = new RegExp(\"\\r\\n\", 'g');\nvar LF_ONLY = \"\\n\";\nvar RICH_TEXT_TYPES = {\n 'text/rtf': 1,\n 'text/html': 1\n};\n/**\n * If DataTransferItem is a file then return the Blob of data.\n *\n * @param {object} item\n * @return {?blob}\n */\n\nfunction getFileFromDataTransfer(item) {\n if (item.kind == 'file') {\n return item.getAsFile();\n }\n}\n\nvar DataTransfer = /*#__PURE__*/function () {\n /**\n * @param {object} data\n */\n function DataTransfer(data) {\n this.data = data; // Types could be DOMStringList or array\n\n this.types = data.types ? createArrayFromMixed(data.types) : [];\n }\n /**\n * Is this likely to be a rich text data transfer?\n *\n * @return {boolean}\n */\n\n\n var _proto = DataTransfer.prototype;\n\n _proto.isRichText = function isRichText() {\n // If HTML is available, treat this data as rich text. This way, we avoid\n // using a pasted image if it is packaged with HTML -- this may occur with\n // pastes from MS Word, for example. However this is only rich text if\n // there's accompanying text.\n if (this.getHTML() && this.getText()) {\n return true;\n } // When an image is copied from a preview window, you end up with two\n // DataTransferItems one of which is a file's metadata as text. Skip those.\n\n\n if (this.isImage()) {\n return false;\n }\n\n return this.types.some(function (type) {\n return RICH_TEXT_TYPES[type];\n });\n };\n /**\n * Get raw text.\n *\n * @return {?string}\n */\n\n\n _proto.getText = function getText() {\n var text;\n\n if (this.data.getData) {\n if (!this.types.length) {\n text = this.data.getData('Text');\n } else if (this.types.indexOf('text/plain') != -1) {\n text = this.data.getData('text/plain');\n }\n }\n\n return text ? text.replace(CR_LF_REGEX, LF_ONLY) : null;\n };\n /**\n * Get HTML paste data\n *\n * @return {?string}\n */\n\n\n _proto.getHTML = function getHTML() {\n if (this.data.getData) {\n if (!this.types.length) {\n return this.data.getData('Text');\n } else if (this.types.indexOf('text/html') != -1) {\n return this.data.getData('text/html');\n }\n }\n };\n /**\n * Is this a link data transfer?\n *\n * @return {boolean}\n */\n\n\n _proto.isLink = function isLink() {\n return this.types.some(function (type) {\n return type.indexOf('Url') != -1 || type.indexOf('text/uri-list') != -1 || type.indexOf('text/x-moz-url');\n });\n };\n /**\n * Get a link url.\n *\n * @return {?string}\n */\n\n\n _proto.getLink = function getLink() {\n if (this.data.getData) {\n if (this.types.indexOf('text/x-moz-url') != -1) {\n var url = this.data.getData('text/x-moz-url').split('\\n');\n return url[0];\n }\n\n return this.types.indexOf('text/uri-list') != -1 ? this.data.getData('text/uri-list') : this.data.getData('url');\n }\n\n return null;\n };\n /**\n * Is this an image data transfer?\n *\n * @return {boolean}\n */\n\n\n _proto.isImage = function isImage() {\n var isImage = this.types.some(function (type) {\n // Firefox will have a type of application/x-moz-file for images during\n // dragging\n return type.indexOf('application/x-moz-file') != -1;\n });\n\n if (isImage) {\n return true;\n }\n\n var items = this.getFiles();\n\n for (var i = 0; i < items.length; i++) {\n var type = items[i].type;\n\n if (!PhotosMimeType.isImage(type)) {\n return false;\n }\n }\n\n return true;\n };\n\n _proto.getCount = function getCount() {\n if (this.data.hasOwnProperty('items')) {\n return this.data.items.length;\n } else if (this.data.hasOwnProperty('mozItemCount')) {\n return this.data.mozItemCount;\n } else if (this.data.files) {\n return this.data.files.length;\n }\n\n return null;\n };\n /**\n * Get files.\n *\n * @return {array}\n */\n\n\n _proto.getFiles = function getFiles() {\n if (this.data.items) {\n // createArrayFromMixed doesn't properly handle DataTransferItemLists.\n return Array.prototype.slice.call(this.data.items).map(getFileFromDataTransfer).filter(emptyFunction.thatReturnsArgument);\n } else if (this.data.files) {\n return Array.prototype.slice.call(this.data.files);\n } else {\n return [];\n }\n };\n /**\n * Are there any files to fetch?\n *\n * @return {boolean}\n */\n\n\n _proto.hasFiles = function hasFiles() {\n return this.getFiles().length > 0;\n };\n\n return DataTransfer;\n}();\n\nmodule.exports = DataTransfer;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nmodule.exports = {\n BACKSPACE: 8,\n TAB: 9,\n RETURN: 13,\n ALT: 18,\n ESC: 27,\n SPACE: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n END: 35,\n HOME: 36,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n DELETE: 46,\n COMMA: 188,\n PERIOD: 190,\n A: 65,\n Z: 90,\n ZERO: 48,\n NUMPAD_0: 96,\n NUMPAD_9: 105\n};","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nvar PhotosMimeType = {\n isImage: function isImage(mimeString) {\n return getParts(mimeString)[0] === 'image';\n },\n isJpeg: function isJpeg(mimeString) {\n var parts = getParts(mimeString);\n return PhotosMimeType.isImage(mimeString) && ( // see http://fburl.com/10972194\n parts[1] === 'jpeg' || parts[1] === 'pjpeg');\n }\n};\n\nfunction getParts(mimeString) {\n return mimeString.split('/');\n}\n\nmodule.exports = PhotosMimeType;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * @param {DOMElement} element\n * @param {DOMDocument} doc\n * @return {boolean}\n */\n\nfunction _isViewportScrollElement(element, doc) {\n return !!doc && (element === doc.documentElement || element === doc.body);\n}\n/**\n * Scroll Module. This class contains 4 simple static functions\n * to be used to access Element.scrollTop/scrollLeft properties.\n * To solve the inconsistencies between browsers when either\n * document.body or document.documentElement is supplied,\n * below logic will be used to alleviate the issue:\n *\n * 1. If 'element' is either 'document.body' or 'document.documentElement,\n * get whichever element's 'scroll{Top,Left}' is larger.\n * 2. If 'element' is either 'document.body' or 'document.documentElement',\n * set the 'scroll{Top,Left}' on both elements.\n */\n\n\nvar Scroll = {\n /**\n * @param {DOMElement} element\n * @return {number}\n */\n getTop: function getTop(element) {\n var doc = element.ownerDocument;\n return _isViewportScrollElement(element, doc) ? // In practice, they will either both have the same value,\n // or one will be zero and the other will be the scroll position\n // of the viewport. So we can use `X || Y` instead of `Math.max(X, Y)`\n doc.body.scrollTop || doc.documentElement.scrollTop : element.scrollTop;\n },\n\n /**\n * @param {DOMElement} element\n * @param {number} newTop\n */\n setTop: function setTop(element, newTop) {\n var doc = element.ownerDocument;\n\n if (_isViewportScrollElement(element, doc)) {\n doc.body.scrollTop = doc.documentElement.scrollTop = newTop;\n } else {\n element.scrollTop = newTop;\n }\n },\n\n /**\n * @param {DOMElement} element\n * @return {number}\n */\n getLeft: function getLeft(element) {\n var doc = element.ownerDocument;\n return _isViewportScrollElement(element, doc) ? doc.body.scrollLeft || doc.documentElement.scrollLeft : element.scrollLeft;\n },\n\n /**\n * @param {DOMElement} element\n * @param {number} newLeft\n */\n setLeft: function setLeft(element, newLeft) {\n var doc = element.ownerDocument;\n\n if (_isViewportScrollElement(element, doc)) {\n doc.body.scrollLeft = doc.documentElement.scrollLeft = newLeft;\n } else {\n element.scrollLeft = newLeft;\n }\n }\n};\nmodule.exports = Scroll;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar getStyleProperty = require(\"./getStyleProperty\");\n/**\n * @param {DOMNode} element [description]\n * @param {string} name Overflow style property name.\n * @return {boolean} True if the supplied ndoe is scrollable.\n */\n\n\nfunction _isNodeScrollable(element, name) {\n var overflow = Style.get(element, name);\n return overflow === 'auto' || overflow === 'scroll';\n}\n/**\n * Utilities for querying and mutating style properties.\n */\n\n\nvar Style = {\n /**\n * Gets the style property for the supplied node. This will return either the\n * computed style, if available, or the declared style.\n *\n * @param {DOMNode} node\n * @param {string} name Style property name.\n * @return {?string} Style property value.\n */\n get: getStyleProperty,\n\n /**\n * Determines the nearest ancestor of a node that is scrollable.\n *\n * NOTE: This can be expensive if used repeatedly or on a node nested deeply.\n *\n * @param {?DOMNode} node Node from which to start searching.\n * @return {?DOMWindow|DOMElement} Scroll parent of the supplied node.\n */\n getScrollParent: function getScrollParent(node) {\n if (!node) {\n return null;\n }\n\n var ownerDocument = node.ownerDocument;\n\n while (node && node !== ownerDocument.body) {\n if (_isNodeScrollable(node, 'overflow') || _isNodeScrollable(node, 'overflowY') || _isNodeScrollable(node, 'overflowX')) {\n return node;\n }\n\n node = node.parentNode;\n }\n\n return ownerDocument.defaultView || ownerDocument.parentWindow;\n }\n};\nmodule.exports = Style;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n * @stub\n * \n */\n'use strict'; // \\u00a1-\\u00b1\\u00b4-\\u00b8\\u00ba\\u00bb\\u00bf\n// is latin supplement punctuation except fractions and superscript\n// numbers\n// \\u2010-\\u2027\\u2030-\\u205e\n// is punctuation from the general punctuation block:\n// weird quotes, commas, bullets, dashes, etc.\n// \\u30fb\\u3001\\u3002\\u3008-\\u3011\\u3014-\\u301f\n// is CJK punctuation\n// \\uff1a-\\uff1f\\uff01-\\uff0f\\uff3b-\\uff40\\uff5b-\\uff65\n// is some full-width/half-width punctuation\n// \\u2E2E\\u061f\\u066a-\\u066c\\u061b\\u060c\\u060d\\uFD3e\\uFD3F\n// is some Arabic punctuation marks\n// \\u1801\\u0964\\u104a\\u104b\n// is misc. other language punctuation marks\n\nvar PUNCTUATION = '[.,+*?$|#{}()\\'\\\\^\\\\-\\\\[\\\\]\\\\\\\\\\\\/!@%\"~=<>_:;' + \"\\u30FB\\u3001\\u3002\\u3008-\\u3011\\u3014-\\u301F\\uFF1A-\\uFF1F\\uFF01-\\uFF0F\" + \"\\uFF3B-\\uFF40\\uFF5B-\\uFF65\\u2E2E\\u061F\\u066A-\\u066C\\u061B\\u060C\\u060D\" + \"\\uFD3E\\uFD3F\\u1801\\u0964\\u104A\\u104B\\u2010-\\u2027\\u2030-\\u205E\" + \"\\xA1-\\xB1\\xB4-\\xB8\\xBA\\xBB\\xBF]\";\nmodule.exports = {\n getPunctuation: function getPunctuation() {\n return PUNCTUATION;\n }\n};","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n'use strict';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nvar URI = /*#__PURE__*/function () {\n function URI(uri) {\n _defineProperty(this, \"_uri\", void 0);\n\n this._uri = uri;\n }\n\n var _proto = URI.prototype;\n\n _proto.toString = function toString() {\n return this._uri;\n };\n\n return URI;\n}();\n\nmodule.exports = URI;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n * \n */\n\n/**\n * Basic (stateless) API for text direction detection\n *\n * Part of our implementation of Unicode Bidirectional Algorithm (UBA)\n * Unicode Standard Annex #9 (UAX9)\n * http://www.unicode.org/reports/tr9/\n */\n'use strict';\n\nvar UnicodeBidiDirection = require(\"./UnicodeBidiDirection\");\n\nvar invariant = require(\"./invariant\");\n/**\n * RegExp ranges of characters with a *Strong* Bidi_Class value.\n *\n * Data is based on DerivedBidiClass.txt in UCD version 7.0.0.\n *\n * NOTE: For performance reasons, we only support Unicode's\n * Basic Multilingual Plane (BMP) for now.\n */\n\n\nvar RANGE_BY_BIDI_TYPE = {\n L: \"A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u01BA\\u01BB\" + \"\\u01BC-\\u01BF\\u01C0-\\u01C3\\u01C4-\\u0293\\u0294\\u0295-\\u02AF\\u02B0-\\u02B8\" + \"\\u02BB-\\u02C1\\u02D0-\\u02D1\\u02E0-\\u02E4\\u02EE\\u0370-\\u0373\\u0376-\\u0377\" + \"\\u037A\\u037B-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\" + \"\\u03A3-\\u03F5\\u03F7-\\u0481\\u0482\\u048A-\\u052F\\u0531-\\u0556\\u0559\" + \"\\u055A-\\u055F\\u0561-\\u0587\\u0589\\u0903\\u0904-\\u0939\\u093B\\u093D\" + \"\\u093E-\\u0940\\u0949-\\u094C\\u094E-\\u094F\\u0950\\u0958-\\u0961\\u0964-\\u0965\" + \"\\u0966-\\u096F\\u0970\\u0971\\u0972-\\u0980\\u0982-\\u0983\\u0985-\\u098C\" + \"\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\" + \"\\u09BE-\\u09C0\\u09C7-\\u09C8\\u09CB-\\u09CC\\u09CE\\u09D7\\u09DC-\\u09DD\" + \"\\u09DF-\\u09E1\\u09E6-\\u09EF\\u09F0-\\u09F1\\u09F4-\\u09F9\\u09FA\\u0A03\" + \"\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\" + \"\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A3E-\\u0A40\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A6F\" + \"\\u0A72-\\u0A74\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\" + \"\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0ABE-\\u0AC0\\u0AC9\\u0ACB-\\u0ACC\\u0AD0\" + \"\\u0AE0-\\u0AE1\\u0AE6-\\u0AEF\\u0AF0\\u0B02-\\u0B03\\u0B05-\\u0B0C\\u0B0F-\\u0B10\" + \"\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B3E\\u0B40\" + \"\\u0B47-\\u0B48\\u0B4B-\\u0B4C\\u0B57\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B66-\\u0B6F\" + \"\\u0B70\\u0B71\\u0B72-\\u0B77\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\" + \"\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\" + \"\\u0BBE-\\u0BBF\\u0BC1-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD0\\u0BD7\" + \"\\u0BE6-\\u0BEF\\u0BF0-\\u0BF2\\u0C01-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\" + \"\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C41-\\u0C44\\u0C58-\\u0C59\\u0C60-\\u0C61\" + \"\\u0C66-\\u0C6F\\u0C7F\\u0C82-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\" + \"\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CBE\\u0CBF\\u0CC0-\\u0CC4\\u0CC6\" + \"\\u0CC7-\\u0CC8\\u0CCA-\\u0CCB\\u0CD5-\\u0CD6\\u0CDE\\u0CE0-\\u0CE1\\u0CE6-\\u0CEF\" + \"\\u0CF1-\\u0CF2\\u0D02-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\" + \"\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D4E\\u0D57\\u0D60-\\u0D61\" + \"\\u0D66-\\u0D6F\\u0D70-\\u0D75\\u0D79\\u0D7A-\\u0D7F\\u0D82-\\u0D83\\u0D85-\\u0D96\" + \"\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\" + \"\\u0DE6-\\u0DEF\\u0DF2-\\u0DF3\\u0DF4\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E45\" + \"\\u0E46\\u0E4F\\u0E50-\\u0E59\\u0E5A-\\u0E5B\\u0E81-\\u0E82\\u0E84\\u0E87-\\u0E88\" + \"\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\" + \"\\u0EAA-\\u0EAB\\u0EAD-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\" + \"\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F01-\\u0F03\\u0F04-\\u0F12\\u0F13\\u0F14\" + \"\\u0F15-\\u0F17\\u0F1A-\\u0F1F\\u0F20-\\u0F29\\u0F2A-\\u0F33\\u0F34\\u0F36\\u0F38\" + \"\\u0F3E-\\u0F3F\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F7F\\u0F85\\u0F88-\\u0F8C\" + \"\\u0FBE-\\u0FC5\\u0FC7-\\u0FCC\\u0FCE-\\u0FCF\\u0FD0-\\u0FD4\\u0FD5-\\u0FD8\" + \"\\u0FD9-\\u0FDA\\u1000-\\u102A\\u102B-\\u102C\\u1031\\u1038\\u103B-\\u103C\\u103F\" + \"\\u1040-\\u1049\\u104A-\\u104F\\u1050-\\u1055\\u1056-\\u1057\\u105A-\\u105D\\u1061\" + \"\\u1062-\\u1064\\u1065-\\u1066\\u1067-\\u106D\\u106E-\\u1070\\u1075-\\u1081\" + \"\\u1083-\\u1084\\u1087-\\u108C\\u108E\\u108F\\u1090-\\u1099\\u109A-\\u109C\" + \"\\u109E-\\u109F\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FB\\u10FC\" + \"\\u10FD-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\" + \"\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\" + \"\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1360-\\u1368\" + \"\\u1369-\\u137C\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166D-\\u166E\" + \"\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EB-\\u16ED\\u16EE-\\u16F0\" + \"\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1735-\\u1736\" + \"\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17B6\\u17BE-\\u17C5\" + \"\\u17C7-\\u17C8\\u17D4-\\u17D6\\u17D7\\u17D8-\\u17DA\\u17DC\\u17E0-\\u17E9\" + \"\\u1810-\\u1819\\u1820-\\u1842\\u1843\\u1844-\\u1877\\u1880-\\u18A8\\u18AA\" + \"\\u18B0-\\u18F5\\u1900-\\u191E\\u1923-\\u1926\\u1929-\\u192B\\u1930-\\u1931\" + \"\\u1933-\\u1938\\u1946-\\u194F\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\" + \"\\u19B0-\\u19C0\\u19C1-\\u19C7\\u19C8-\\u19C9\\u19D0-\\u19D9\\u19DA\\u1A00-\\u1A16\" + \"\\u1A19-\\u1A1A\\u1A1E-\\u1A1F\\u1A20-\\u1A54\\u1A55\\u1A57\\u1A61\\u1A63-\\u1A64\" + \"\\u1A6D-\\u1A72\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1AA0-\\u1AA6\\u1AA7\\u1AA8-\\u1AAD\" + \"\\u1B04\\u1B05-\\u1B33\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43-\\u1B44\\u1B45-\\u1B4B\" + \"\\u1B50-\\u1B59\\u1B5A-\\u1B60\\u1B61-\\u1B6A\\u1B74-\\u1B7C\\u1B82\\u1B83-\\u1BA0\" + \"\\u1BA1\\u1BA6-\\u1BA7\\u1BAA\\u1BAE-\\u1BAF\\u1BB0-\\u1BB9\\u1BBA-\\u1BE5\\u1BE7\" + \"\\u1BEA-\\u1BEC\\u1BEE\\u1BF2-\\u1BF3\\u1BFC-\\u1BFF\\u1C00-\\u1C23\\u1C24-\\u1C2B\" + \"\\u1C34-\\u1C35\\u1C3B-\\u1C3F\\u1C40-\\u1C49\\u1C4D-\\u1C4F\\u1C50-\\u1C59\" + \"\\u1C5A-\\u1C77\\u1C78-\\u1C7D\\u1C7E-\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u1CE1\" + \"\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF2-\\u1CF3\\u1CF5-\\u1CF6\\u1D00-\\u1D2B\" + \"\\u1D2C-\\u1D6A\\u1D6B-\\u1D77\\u1D78\\u1D79-\\u1D9A\\u1D9B-\\u1DBF\\u1E00-\\u1F15\" + \"\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\" + \"\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\" + \"\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200E\" + \"\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\" + \"\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2134\\u2135-\\u2138\\u2139\" + \"\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u214F\\u2160-\\u2182\\u2183-\\u2184\" + \"\\u2185-\\u2188\\u2336-\\u237A\\u2395\\u249C-\\u24E9\\u26AC\\u2800-\\u28FF\" + \"\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2C7B\\u2C7C-\\u2C7D\\u2C7E-\\u2CE4\" + \"\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\" + \"\\u2D70\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\" + \"\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3005\\u3006\\u3007\" + \"\\u3021-\\u3029\\u302E-\\u302F\\u3031-\\u3035\\u3038-\\u303A\\u303B\\u303C\" + \"\\u3041-\\u3096\\u309D-\\u309E\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FE\\u30FF\" + \"\\u3105-\\u312D\\u3131-\\u318E\\u3190-\\u3191\\u3192-\\u3195\\u3196-\\u319F\" + \"\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3200-\\u321C\\u3220-\\u3229\\u322A-\\u3247\" + \"\\u3248-\\u324F\\u3260-\\u327B\\u327F\\u3280-\\u3289\\u328A-\\u32B0\\u32C0-\\u32CB\" + \"\\u32D0-\\u32FE\\u3300-\\u3376\\u337B-\\u33DD\\u33E0-\\u33FE\\u3400-\\u4DB5\" + \"\\u4E00-\\u9FCC\\uA000-\\uA014\\uA015\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA4F8-\\uA4FD\" + \"\\uA4FE-\\uA4FF\\uA500-\\uA60B\\uA60C\\uA610-\\uA61F\\uA620-\\uA629\\uA62A-\\uA62B\" + \"\\uA640-\\uA66D\\uA66E\\uA680-\\uA69B\\uA69C-\\uA69D\\uA6A0-\\uA6E5\\uA6E6-\\uA6EF\" + \"\\uA6F2-\\uA6F7\\uA722-\\uA76F\\uA770\\uA771-\\uA787\\uA789-\\uA78A\\uA78B-\\uA78E\" + \"\\uA790-\\uA7AD\\uA7B0-\\uA7B1\\uA7F7\\uA7F8-\\uA7F9\\uA7FA\\uA7FB-\\uA801\" + \"\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA823-\\uA824\\uA827\\uA830-\\uA835\" + \"\\uA836-\\uA837\\uA840-\\uA873\\uA880-\\uA881\\uA882-\\uA8B3\\uA8B4-\\uA8C3\" + \"\\uA8CE-\\uA8CF\\uA8D0-\\uA8D9\\uA8F2-\\uA8F7\\uA8F8-\\uA8FA\\uA8FB\\uA900-\\uA909\" + \"\\uA90A-\\uA925\\uA92E-\\uA92F\\uA930-\\uA946\\uA952-\\uA953\\uA95F\\uA960-\\uA97C\" + \"\\uA983\\uA984-\\uA9B2\\uA9B4-\\uA9B5\\uA9BA-\\uA9BB\\uA9BD-\\uA9C0\\uA9C1-\\uA9CD\" + \"\\uA9CF\\uA9D0-\\uA9D9\\uA9DE-\\uA9DF\\uA9E0-\\uA9E4\\uA9E6\\uA9E7-\\uA9EF\" + \"\\uA9F0-\\uA9F9\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA2F-\\uAA30\\uAA33-\\uAA34\" + \"\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA4D\\uAA50-\\uAA59\\uAA5C-\\uAA5F\\uAA60-\\uAA6F\" + \"\\uAA70\\uAA71-\\uAA76\\uAA77-\\uAA79\\uAA7A\\uAA7B\\uAA7D\\uAA7E-\\uAAAF\\uAAB1\" + \"\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADC\\uAADD\\uAADE-\\uAADF\" + \"\\uAAE0-\\uAAEA\\uAAEB\\uAAEE-\\uAAEF\\uAAF0-\\uAAF1\\uAAF2\\uAAF3-\\uAAF4\\uAAF5\" + \"\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\" + \"\\uAB30-\\uAB5A\\uAB5B\\uAB5C-\\uAB5F\\uAB64-\\uAB65\\uABC0-\\uABE2\\uABE3-\\uABE4\" + \"\\uABE6-\\uABE7\\uABE9-\\uABEA\\uABEB\\uABEC\\uABF0-\\uABF9\\uAC00-\\uD7A3\" + \"\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uE000-\\uF8FF\\uF900-\\uFA6D\\uFA70-\\uFAD9\" + \"\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFF6F\\uFF70\" + \"\\uFF71-\\uFF9D\\uFF9E-\\uFF9F\\uFFA0-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\" + \"\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\",\n R: \"\\u0590\\u05BE\\u05C0\\u05C3\\u05C6\\u05C8-\\u05CF\\u05D0-\\u05EA\\u05EB-\\u05EF\" + \"\\u05F0-\\u05F2\\u05F3-\\u05F4\\u05F5-\\u05FF\\u07C0-\\u07C9\\u07CA-\\u07EA\" + \"\\u07F4-\\u07F5\\u07FA\\u07FB-\\u07FF\\u0800-\\u0815\\u081A\\u0824\\u0828\" + \"\\u082E-\\u082F\\u0830-\\u083E\\u083F\\u0840-\\u0858\\u085C-\\u085D\\u085E\" + \"\\u085F-\\u089F\\u200F\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB37\\uFB38-\\uFB3C\" + \"\\uFB3D\\uFB3E\\uFB3F\\uFB40-\\uFB41\\uFB42\\uFB43-\\uFB44\\uFB45\\uFB46-\\uFB4F\",\n AL: \"\\u0608\\u060B\\u060D\\u061B\\u061C\\u061D\\u061E-\\u061F\\u0620-\\u063F\\u0640\" + \"\\u0641-\\u064A\\u066D\\u066E-\\u066F\\u0671-\\u06D3\\u06D4\\u06D5\\u06E5-\\u06E6\" + \"\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FD-\\u06FE\\u06FF\\u0700-\\u070D\\u070E\\u070F\" + \"\\u0710\\u0712-\\u072F\\u074B-\\u074C\\u074D-\\u07A5\\u07B1\\u07B2-\\u07BF\" + \"\\u08A0-\\u08B2\\u08B3-\\u08E3\\uFB50-\\uFBB1\\uFBB2-\\uFBC1\\uFBC2-\\uFBD2\" + \"\\uFBD3-\\uFD3D\\uFD40-\\uFD4F\\uFD50-\\uFD8F\\uFD90-\\uFD91\\uFD92-\\uFDC7\" + \"\\uFDC8-\\uFDCF\\uFDF0-\\uFDFB\\uFDFC\\uFDFE-\\uFDFF\\uFE70-\\uFE74\\uFE75\" + \"\\uFE76-\\uFEFC\\uFEFD-\\uFEFE\"\n};\nvar REGEX_STRONG = new RegExp('[' + RANGE_BY_BIDI_TYPE.L + RANGE_BY_BIDI_TYPE.R + RANGE_BY_BIDI_TYPE.AL + ']');\nvar REGEX_RTL = new RegExp('[' + RANGE_BY_BIDI_TYPE.R + RANGE_BY_BIDI_TYPE.AL + ']');\n/**\n * Returns the first strong character (has Bidi_Class value of L, R, or AL).\n *\n * @param str A text block; e.g. paragraph, table cell, tag\n * @return A character with strong bidi direction, or null if not found\n */\n\nfunction firstStrongChar(str) {\n var match = REGEX_STRONG.exec(str);\n return match == null ? null : match[0];\n}\n/**\n * Returns the direction of a block of text, based on the direction of its\n * first strong character (has Bidi_Class value of L, R, or AL).\n *\n * @param str A text block; e.g. paragraph, table cell, tag\n * @return The resolved direction\n */\n\n\nfunction firstStrongCharDir(str) {\n var strongChar = firstStrongChar(str);\n\n if (strongChar == null) {\n return UnicodeBidiDirection.NEUTRAL;\n }\n\n return REGEX_RTL.exec(strongChar) ? UnicodeBidiDirection.RTL : UnicodeBidiDirection.LTR;\n}\n/**\n * Returns the direction of a block of text, based on the direction of its\n * first strong character (has Bidi_Class value of L, R, or AL), or a fallback\n * direction, if no strong character is found.\n *\n * This function is supposed to be used in respect to Higher-Level Protocol\n * rule HL1. (http://www.unicode.org/reports/tr9/#HL1)\n *\n * @param str A text block; e.g. paragraph, table cell, tag\n * @param fallback Fallback direction, used if no strong direction detected\n * for the block (default = NEUTRAL)\n * @return The resolved direction\n */\n\n\nfunction resolveBlockDir(str, fallback) {\n fallback = fallback || UnicodeBidiDirection.NEUTRAL;\n\n if (!str.length) {\n return fallback;\n }\n\n var blockDir = firstStrongCharDir(str);\n return blockDir === UnicodeBidiDirection.NEUTRAL ? fallback : blockDir;\n}\n/**\n * Returns the direction of a block of text, based on the direction of its\n * first strong character (has Bidi_Class value of L, R, or AL), or a fallback\n * direction, if no strong character is found.\n *\n * NOTE: This function is similar to resolveBlockDir(), but uses the global\n * direction as the fallback, so it *always* returns a Strong direction,\n * making it useful for integration in places that you need to make the final\n * decision, like setting some CSS class.\n *\n * This function is supposed to be used in respect to Higher-Level Protocol\n * rule HL1. (http://www.unicode.org/reports/tr9/#HL1)\n *\n * @param str A text block; e.g. paragraph, table cell\n * @param strongFallback Fallback direction, used if no strong direction\n * detected for the block (default = global direction)\n * @return The resolved Strong direction\n */\n\n\nfunction getDirection(str, strongFallback) {\n if (!strongFallback) {\n strongFallback = UnicodeBidiDirection.getGlobalDir();\n }\n\n !UnicodeBidiDirection.isStrong(strongFallback) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Fallback direction must be a strong direction') : invariant(false) : void 0;\n return resolveBlockDir(str, strongFallback);\n}\n/**\n * Returns true if getDirection(arguments...) returns LTR.\n *\n * @param str A text block; e.g. paragraph, table cell\n * @param strongFallback Fallback direction, used if no strong direction\n * detected for the block (default = global direction)\n * @return True if the resolved direction is LTR\n */\n\n\nfunction isDirectionLTR(str, strongFallback) {\n return getDirection(str, strongFallback) === UnicodeBidiDirection.LTR;\n}\n/**\n * Returns true if getDirection(arguments...) returns RTL.\n *\n * @param str A text block; e.g. paragraph, table cell\n * @param strongFallback Fallback direction, used if no strong direction\n * detected for the block (default = global direction)\n * @return True if the resolved direction is RTL\n */\n\n\nfunction isDirectionRTL(str, strongFallback) {\n return getDirection(str, strongFallback) === UnicodeBidiDirection.RTL;\n}\n\nvar UnicodeBidi = {\n firstStrongChar: firstStrongChar,\n firstStrongCharDir: firstStrongCharDir,\n resolveBlockDir: resolveBlockDir,\n getDirection: getDirection,\n isDirectionLTR: isDirectionLTR,\n isDirectionRTL: isDirectionRTL\n};\nmodule.exports = UnicodeBidi;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n * \n */\n\n/**\n * Constants to represent text directionality\n *\n * Also defines a *global* direciton, to be used in bidi algorithms as a\n * default fallback direciton, when no better direction is found or provided.\n *\n * NOTE: Use `setGlobalDir()`, or update `initGlobalDir()`, to set the initial\n * global direction value based on the application.\n *\n * Part of the implementation of Unicode Bidirectional Algorithm (UBA)\n * Unicode Standard Annex #9 (UAX9)\n * http://www.unicode.org/reports/tr9/\n */\n'use strict';\n\nvar invariant = require(\"./invariant\");\n\nvar NEUTRAL = 'NEUTRAL'; // No strong direction\n\nvar LTR = 'LTR'; // Left-to-Right direction\n\nvar RTL = 'RTL'; // Right-to-Left direction\n\nvar globalDir = null; // == Helpers ==\n\n/**\n * Check if a directionality value is a Strong one\n */\n\nfunction isStrong(dir) {\n return dir === LTR || dir === RTL;\n}\n/**\n * Get string value to be used for `dir` HTML attribute or `direction` CSS\n * property.\n */\n\n\nfunction getHTMLDir(dir) {\n !isStrong(dir) ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`dir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;\n return dir === LTR ? 'ltr' : 'rtl';\n}\n/**\n * Get string value to be used for `dir` HTML attribute or `direction` CSS\n * property, but returns null if `dir` has same value as `otherDir`.\n * `null`.\n */\n\n\nfunction getHTMLDirIfDifferent(dir, otherDir) {\n !isStrong(dir) ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`dir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;\n !isStrong(otherDir) ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`otherDir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;\n return dir === otherDir ? null : getHTMLDir(dir);\n} // == Global Direction ==\n\n/**\n * Set the global direction.\n */\n\n\nfunction setGlobalDir(dir) {\n globalDir = dir;\n}\n/**\n * Initialize the global direction\n */\n\n\nfunction initGlobalDir() {\n setGlobalDir(LTR);\n}\n/**\n * Get the global direction\n */\n\n\nfunction getGlobalDir() {\n if (!globalDir) {\n this.initGlobalDir();\n }\n\n !globalDir ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Global direction not set.') : invariant(false) : void 0;\n return globalDir;\n}\n\nvar UnicodeBidiDirection = {\n // Values\n NEUTRAL: NEUTRAL,\n LTR: LTR,\n RTL: RTL,\n // Helpers\n isStrong: isStrong,\n getHTMLDir: getHTMLDir,\n getHTMLDirIfDifferent: getHTMLDirIfDifferent,\n // Global Direction\n setGlobalDir: setGlobalDir,\n initGlobalDir: initGlobalDir,\n getGlobalDir: getGlobalDir\n};\nmodule.exports = UnicodeBidiDirection;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n * \n */\n\n/**\n * Stateful API for text direction detection\n *\n * This class can be used in applications where you need to detect the\n * direction of a sequence of text blocks, where each direction shall be used\n * as the fallback direction for the next one.\n *\n * NOTE: A default direction, if not provided, is set based on the global\n * direction, as defined by `UnicodeBidiDirection`.\n *\n * == Example ==\n * ```\n * var UnicodeBidiService = require('UnicodeBidiService');\n *\n * var bidiService = new UnicodeBidiService();\n *\n * ...\n *\n * bidiService.reset();\n * for (var para in paragraphs) {\n * var dir = bidiService.getDirection(para);\n * ...\n * }\n * ```\n *\n * Part of our implementation of Unicode Bidirectional Algorithm (UBA)\n * Unicode Standard Annex #9 (UAX9)\n * http://www.unicode.org/reports/tr9/\n */\n'use strict';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nvar UnicodeBidi = require(\"./UnicodeBidi\");\n\nvar UnicodeBidiDirection = require(\"./UnicodeBidiDirection\");\n\nvar invariant = require(\"./invariant\");\n\nvar UnicodeBidiService = /*#__PURE__*/function () {\n /**\n * Stateful class for paragraph direction detection\n *\n * @param defaultDir Default direction of the service\n */\n function UnicodeBidiService(defaultDir) {\n _defineProperty(this, \"_defaultDir\", void 0);\n\n _defineProperty(this, \"_lastDir\", void 0);\n\n if (!defaultDir) {\n defaultDir = UnicodeBidiDirection.getGlobalDir();\n } else {\n !UnicodeBidiDirection.isStrong(defaultDir) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Default direction must be a strong direction (LTR or RTL)') : invariant(false) : void 0;\n }\n\n this._defaultDir = defaultDir;\n this.reset();\n }\n /**\n * Reset the internal state\n *\n * Instead of creating a new instance, you can just reset() your instance\n * everytime you start a new loop.\n */\n\n\n var _proto = UnicodeBidiService.prototype;\n\n _proto.reset = function reset() {\n this._lastDir = this._defaultDir;\n };\n /**\n * Returns the direction of a block of text, and remembers it as the\n * fall-back direction for the next paragraph.\n *\n * @param str A text block, e.g. paragraph, table cell, tag\n * @return The resolved direction\n */\n\n\n _proto.getDirection = function getDirection(str) {\n this._lastDir = UnicodeBidi.getDirection(str, this._lastDir);\n return this._lastDir;\n };\n\n return UnicodeBidiService;\n}();\n\nmodule.exports = UnicodeBidiService;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\n/**\n * Unicode-enabled replacesments for basic String functions.\n *\n * All the functions in this module assume that the input string is a valid\n * UTF-16 encoding of a Unicode sequence. If it's not the case, the behavior\n * will be undefined.\n *\n * WARNING: Since this module is typechecks-enforced, you may find new bugs\n * when replacing normal String functions with ones provided here.\n */\n'use strict';\n\nvar invariant = require(\"./invariant\"); // These two ranges are consecutive so anything in [HIGH_START, LOW_END] is a\n// surrogate code unit.\n\n\nvar SURROGATE_HIGH_START = 0xD800;\nvar SURROGATE_HIGH_END = 0xDBFF;\nvar SURROGATE_LOW_START = 0xDC00;\nvar SURROGATE_LOW_END = 0xDFFF;\nvar SURROGATE_UNITS_REGEX = /[\\uD800-\\uDFFF]/;\n/**\n * @param {number} codeUnit A Unicode code-unit, in range [0, 0x10FFFF]\n * @return {boolean} Whether code-unit is in a surrogate (hi/low) range\n */\n\nfunction isCodeUnitInSurrogateRange(codeUnit) {\n return SURROGATE_HIGH_START <= codeUnit && codeUnit <= SURROGATE_LOW_END;\n}\n/**\n * Returns whether the two characters starting at `index` form a surrogate pair.\n * For example, given the string s = \"\\uD83D\\uDE0A\", (s, 0) returns true and\n * (s, 1) returns false.\n *\n * @param {string} str\n * @param {number} index\n * @return {boolean}\n */\n\n\nfunction isSurrogatePair(str, index) {\n !(0 <= index && index < str.length) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'isSurrogatePair: Invalid index %s for string length %s.', index, str.length) : invariant(false) : void 0;\n\n if (index + 1 === str.length) {\n return false;\n }\n\n var first = str.charCodeAt(index);\n var second = str.charCodeAt(index + 1);\n return SURROGATE_HIGH_START <= first && first <= SURROGATE_HIGH_END && SURROGATE_LOW_START <= second && second <= SURROGATE_LOW_END;\n}\n/**\n * @param {string} str Non-empty string\n * @return {boolean} True if the input includes any surrogate code units\n */\n\n\nfunction hasSurrogateUnit(str) {\n return SURROGATE_UNITS_REGEX.test(str);\n}\n/**\n * Return the length of the original Unicode character at given position in the\n * String by looking into the UTF-16 code unit; that is equal to 1 for any\n * non-surrogate characters in BMP ([U+0000..U+D7FF] and [U+E000, U+FFFF]); and\n * returns 2 for the hi/low surrogates ([U+D800..U+DFFF]), which are in fact\n * representing non-BMP characters ([U+10000..U+10FFFF]).\n *\n * Examples:\n * - '\\u0020' => 1\n * - '\\u3020' => 1\n * - '\\uD835' => 2\n * - '\\uD835\\uDDEF' => 2\n * - '\\uDDEF' => 2\n *\n * @param {string} str Non-empty string\n * @param {number} pos Position in the string to look for one code unit\n * @return {number} Number 1 or 2\n */\n\n\nfunction getUTF16Length(str, pos) {\n return 1 + isCodeUnitInSurrogateRange(str.charCodeAt(pos));\n}\n/**\n * Fully Unicode-enabled replacement for String#length\n *\n * @param {string} str Valid Unicode string\n * @return {number} The number of Unicode characters in the string\n */\n\n\nfunction strlen(str) {\n // Call the native functions if there's no surrogate char\n if (!hasSurrogateUnit(str)) {\n return str.length;\n }\n\n var len = 0;\n\n for (var pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) {\n len++;\n }\n\n return len;\n}\n/**\n * Fully Unicode-enabled replacement for String#substr()\n *\n * @param {string} str Valid Unicode string\n * @param {number} start Location in Unicode sequence to begin extracting\n * @param {?number} length The number of Unicode characters to extract\n * (default: to the end of the string)\n * @return {string} Extracted sub-string\n */\n\n\nfunction substr(str, start, length) {\n start = start || 0;\n length = length === undefined ? Infinity : length || 0; // Call the native functions if there's no surrogate char\n\n if (!hasSurrogateUnit(str)) {\n return str.substr(start, length);\n } // Obvious cases\n\n\n var size = str.length;\n\n if (size <= 0 || start > size || length <= 0) {\n return '';\n } // Find the actual starting position\n\n\n var posA = 0;\n\n if (start > 0) {\n for (; start > 0 && posA < size; start--) {\n posA += getUTF16Length(str, posA);\n }\n\n if (posA >= size) {\n return '';\n }\n } else if (start < 0) {\n for (posA = size; start < 0 && 0 < posA; start++) {\n posA -= getUTF16Length(str, posA - 1);\n }\n\n if (posA < 0) {\n posA = 0;\n }\n } // Find the actual ending position\n\n\n var posB = size;\n\n if (length < size) {\n for (posB = posA; length > 0 && posB < size; length--) {\n posB += getUTF16Length(str, posB);\n }\n }\n\n return str.substring(posA, posB);\n}\n/**\n * Fully Unicode-enabled replacement for String#substring()\n *\n * @param {string} str Valid Unicode string\n * @param {number} start Location in Unicode sequence to begin extracting\n * @param {?number} end Location in Unicode sequence to end extracting\n * (default: end of the string)\n * @return {string} Extracted sub-string\n */\n\n\nfunction substring(str, start, end) {\n start = start || 0;\n end = end === undefined ? Infinity : end || 0;\n\n if (start < 0) {\n start = 0;\n }\n\n if (end < 0) {\n end = 0;\n }\n\n var length = Math.abs(end - start);\n start = start < end ? start : end;\n return substr(str, start, length);\n}\n/**\n * Get a list of Unicode code-points from a String\n *\n * @param {string} str Valid Unicode string\n * @return {array
} A list of code-points in [0..0x10FFFF]\n */\n\n\nfunction getCodePoints(str) {\n var codePoints = [];\n\n for (var pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) {\n codePoints.push(str.codePointAt(pos));\n }\n\n return codePoints;\n}\n\nvar UnicodeUtils = {\n getCodePoints: getCodePoints,\n getUTF16Length: getUTF16Length,\n hasSurrogateUnit: hasSurrogateUnit,\n isCodeUnitInSurrogateRange: isCodeUnitInSurrogateRange,\n isSurrogatePair: isSurrogatePair,\n strlen: strlen,\n substring: substring,\n substr: substr\n};\nmodule.exports = UnicodeUtils;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar UserAgentData = require(\"./UserAgentData\");\n\nvar VersionRange = require(\"./VersionRange\");\n\nvar mapObject = require(\"./mapObject\");\n\nvar memoizeStringOnly = require(\"./memoizeStringOnly\");\n/**\n * Checks to see whether `name` and `version` satisfy `query`.\n *\n * @param {string} name Name of the browser, device, engine or platform\n * @param {?string} version Version of the browser, engine or platform\n * @param {string} query Query of form \"Name [range expression]\"\n * @param {?function} normalizer Optional pre-processor for range expression\n * @return {boolean}\n */\n\n\nfunction compare(name, version, query, normalizer) {\n // check for exact match with no version\n if (name === query) {\n return true;\n } // check for non-matching names\n\n\n if (!query.startsWith(name)) {\n return false;\n } // full comparison with version\n\n\n var range = query.slice(name.length);\n\n if (version) {\n range = normalizer ? normalizer(range) : range;\n return VersionRange.contains(range, version);\n }\n\n return false;\n}\n/**\n * Normalizes `version` by stripping any \"NT\" prefix, but only on the Windows\n * platform.\n *\n * Mimics the stripping performed by the `UserAgentWindowsPlatform` PHP class.\n *\n * @param {string} version\n * @return {string}\n */\n\n\nfunction normalizePlatformVersion(version) {\n if (UserAgentData.platformName === 'Windows') {\n return version.replace(/^\\s*NT/, '');\n }\n\n return version;\n}\n/**\n * Provides client-side access to the authoritative PHP-generated User Agent\n * information supplied by the server.\n */\n\n\nvar UserAgent = {\n /**\n * Check if the User Agent browser matches `query`.\n *\n * `query` should be a string like \"Chrome\" or \"Chrome > 33\".\n *\n * Valid browser names include:\n *\n * - ACCESS NetFront\n * - AOL\n * - Amazon Silk\n * - Android\n * - BlackBerry\n * - BlackBerry PlayBook\n * - Chrome\n * - Chrome for iOS\n * - Chrome frame\n * - Facebook PHP SDK\n * - Facebook for iOS\n * - Firefox\n * - IE\n * - IE Mobile\n * - Mobile Safari\n * - Motorola Internet Browser\n * - Nokia\n * - Openwave Mobile Browser\n * - Opera\n * - Opera Mini\n * - Opera Mobile\n * - Safari\n * - UIWebView\n * - Unknown\n * - webOS\n * - etc...\n *\n * An authoritative list can be found in the PHP `BrowserDetector` class and\n * related classes in the same file (see calls to `new UserAgentBrowser` here:\n * https://fburl.com/50728104).\n *\n * @note Function results are memoized\n *\n * @param {string} query Query of the form \"Name [range expression]\"\n * @return {boolean}\n */\n isBrowser: function isBrowser(query) {\n return compare(UserAgentData.browserName, UserAgentData.browserFullVersion, query);\n },\n\n /**\n * Check if the User Agent browser uses a 32 or 64 bit architecture.\n *\n * @note Function results are memoized\n *\n * @param {string} query Query of the form \"32\" or \"64\".\n * @return {boolean}\n */\n isBrowserArchitecture: function isBrowserArchitecture(query) {\n return compare(UserAgentData.browserArchitecture, null, query);\n },\n\n /**\n * Check if the User Agent device matches `query`.\n *\n * `query` should be a string like \"iPhone\" or \"iPad\".\n *\n * Valid device names include:\n *\n * - Kindle\n * - Kindle Fire\n * - Unknown\n * - iPad\n * - iPhone\n * - iPod\n * - etc...\n *\n * An authoritative list can be found in the PHP `DeviceDetector` class and\n * related classes in the same file (see calls to `new UserAgentDevice` here:\n * https://fburl.com/50728332).\n *\n * @note Function results are memoized\n *\n * @param {string} query Query of the form \"Name\"\n * @return {boolean}\n */\n isDevice: function isDevice(query) {\n return compare(UserAgentData.deviceName, null, query);\n },\n\n /**\n * Check if the User Agent rendering engine matches `query`.\n *\n * `query` should be a string like \"WebKit\" or \"WebKit >= 537\".\n *\n * Valid engine names include:\n *\n * - Gecko\n * - Presto\n * - Trident\n * - WebKit\n * - etc...\n *\n * An authoritative list can be found in the PHP `RenderingEngineDetector`\n * class related classes in the same file (see calls to `new\n * UserAgentRenderingEngine` here: https://fburl.com/50728617).\n *\n * @note Function results are memoized\n *\n * @param {string} query Query of the form \"Name [range expression]\"\n * @return {boolean}\n */\n isEngine: function isEngine(query) {\n return compare(UserAgentData.engineName, UserAgentData.engineVersion, query);\n },\n\n /**\n * Check if the User Agent platform matches `query`.\n *\n * `query` should be a string like \"Windows\" or \"iOS 5 - 6\".\n *\n * Valid platform names include:\n *\n * - Android\n * - BlackBerry OS\n * - Java ME\n * - Linux\n * - Mac OS X\n * - Mac OS X Calendar\n * - Mac OS X Internet Account\n * - Symbian\n * - SymbianOS\n * - Windows\n * - Windows Mobile\n * - Windows Phone\n * - iOS\n * - iOS Facebook Integration Account\n * - iOS Facebook Social Sharing UI\n * - webOS\n * - Chrome OS\n * - etc...\n *\n * An authoritative list can be found in the PHP `PlatformDetector` class and\n * related classes in the same file (see calls to `new UserAgentPlatform`\n * here: https://fburl.com/50729226).\n *\n * @note Function results are memoized\n *\n * @param {string} query Query of the form \"Name [range expression]\"\n * @return {boolean}\n */\n isPlatform: function isPlatform(query) {\n return compare(UserAgentData.platformName, UserAgentData.platformFullVersion, query, normalizePlatformVersion);\n },\n\n /**\n * Check if the User Agent platform is a 32 or 64 bit architecture.\n *\n * @note Function results are memoized\n *\n * @param {string} query Query of the form \"32\" or \"64\".\n * @return {boolean}\n */\n isPlatformArchitecture: function isPlatformArchitecture(query) {\n return compare(UserAgentData.platformArchitecture, null, query);\n }\n};\nmodule.exports = mapObject(UserAgent, memoizeStringOnly);","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * Usage note:\n * This module makes a best effort to export the same data we would internally.\n * At Facebook we use a server-generated module that does the parsing and\n * exports the data for the client to use. We can't rely on a server-side\n * implementation in open source so instead we make use of an open source\n * library to do the heavy lifting and then make some adjustments as necessary.\n * It's likely there will be some differences. Some we can smooth over.\n * Others are going to be harder.\n */\n'use strict';\n\nvar UAParser = require(\"ua-parser-js\");\n\nvar UNKNOWN = 'Unknown';\nvar PLATFORM_MAP = {\n 'Mac OS': 'Mac OS X'\n};\n/**\n * Convert from UAParser platform name to what we expect.\n */\n\nfunction convertPlatformName(name) {\n return PLATFORM_MAP[name] || name;\n}\n/**\n * Get the version number in parts. This is very naive. We actually get major\n * version as a part of UAParser already, which is generally good enough, but\n * let's get the minor just in case.\n */\n\n\nfunction getBrowserVersion(version) {\n if (!version) {\n return {\n major: '',\n minor: ''\n };\n }\n\n var parts = version.split('.');\n return {\n major: parts[0],\n minor: parts[1]\n };\n}\n/**\n * Get the UA data fom UAParser and then convert it to the format we're\n * expecting for our APIS.\n */\n\n\nvar parser = new UAParser();\nvar results = parser.getResult(); // Do some conversion first.\n\nvar browserVersionData = getBrowserVersion(results.browser.version);\nvar uaData = {\n browserArchitecture: results.cpu.architecture || UNKNOWN,\n browserFullVersion: results.browser.version || UNKNOWN,\n browserMinorVersion: browserVersionData.minor || UNKNOWN,\n browserName: results.browser.name || UNKNOWN,\n browserVersion: results.browser.major || UNKNOWN,\n deviceName: results.device.model || UNKNOWN,\n engineName: results.engine.name || UNKNOWN,\n engineVersion: results.engine.version || UNKNOWN,\n platformArchitecture: results.cpu.architecture || UNKNOWN,\n platformName: convertPlatformName(results.os.name) || UNKNOWN,\n platformVersion: results.os.version || UNKNOWN,\n platformFullVersion: results.os.version || UNKNOWN\n};\nmodule.exports = uaData;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar invariant = require(\"./invariant\");\n\nvar componentRegex = /\\./;\nvar orRegex = /\\|\\|/;\nvar rangeRegex = /\\s+\\-\\s+/;\nvar modifierRegex = /^(<=|<|=|>=|~>|~|>|)?\\s*(.+)/;\nvar numericRegex = /^(\\d*)(.*)/;\n/**\n * Splits input `range` on \"||\" and returns true if any subrange matches\n * `version`.\n *\n * @param {string} range\n * @param {string} version\n * @returns {boolean}\n */\n\nfunction checkOrExpression(range, version) {\n var expressions = range.split(orRegex);\n\n if (expressions.length > 1) {\n return expressions.some(function (range) {\n return VersionRange.contains(range, version);\n });\n } else {\n range = expressions[0].trim();\n return checkRangeExpression(range, version);\n }\n}\n/**\n * Splits input `range` on \" - \" (the surrounding whitespace is required) and\n * returns true if version falls between the two operands.\n *\n * @param {string} range\n * @param {string} version\n * @returns {boolean}\n */\n\n\nfunction checkRangeExpression(range, version) {\n var expressions = range.split(rangeRegex);\n !(expressions.length > 0 && expressions.length <= 2) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'the \"-\" operator expects exactly 2 operands') : invariant(false) : void 0;\n\n if (expressions.length === 1) {\n return checkSimpleExpression(expressions[0], version);\n } else {\n var startVersion = expressions[0],\n endVersion = expressions[1];\n !(isSimpleVersion(startVersion) && isSimpleVersion(endVersion)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'operands to the \"-\" operator must be simple (no modifiers)') : invariant(false) : void 0;\n return checkSimpleExpression('>=' + startVersion, version) && checkSimpleExpression('<=' + endVersion, version);\n }\n}\n/**\n * Checks if `range` matches `version`. `range` should be a \"simple\" range (ie.\n * not a compound range using the \" - \" or \"||\" operators).\n *\n * @param {string} range\n * @param {string} version\n * @returns {boolean}\n */\n\n\nfunction checkSimpleExpression(range, version) {\n range = range.trim();\n\n if (range === '') {\n return true;\n }\n\n var versionComponents = version.split(componentRegex);\n\n var _getModifierAndCompon = getModifierAndComponents(range),\n modifier = _getModifierAndCompon.modifier,\n rangeComponents = _getModifierAndCompon.rangeComponents;\n\n switch (modifier) {\n case '<':\n return checkLessThan(versionComponents, rangeComponents);\n\n case '<=':\n return checkLessThanOrEqual(versionComponents, rangeComponents);\n\n case '>=':\n return checkGreaterThanOrEqual(versionComponents, rangeComponents);\n\n case '>':\n return checkGreaterThan(versionComponents, rangeComponents);\n\n case '~':\n case '~>':\n return checkApproximateVersion(versionComponents, rangeComponents);\n\n default:\n return checkEqual(versionComponents, rangeComponents);\n }\n}\n/**\n * Checks whether `a` is less than `b`.\n *\n * @param {array} a\n * @param {array} b\n * @returns {boolean}\n */\n\n\nfunction checkLessThan(a, b) {\n return compareComponents(a, b) === -1;\n}\n/**\n * Checks whether `a` is less than or equal to `b`.\n *\n * @param {array} a\n * @param {array} b\n * @returns {boolean}\n */\n\n\nfunction checkLessThanOrEqual(a, b) {\n var result = compareComponents(a, b);\n return result === -1 || result === 0;\n}\n/**\n * Checks whether `a` is equal to `b`.\n *\n * @param {array} a\n * @param {array} b\n * @returns {boolean}\n */\n\n\nfunction checkEqual(a, b) {\n return compareComponents(a, b) === 0;\n}\n/**\n * Checks whether `a` is greater than or equal to `b`.\n *\n * @param {array} a\n * @param {array} b\n * @returns {boolean}\n */\n\n\nfunction checkGreaterThanOrEqual(a, b) {\n var result = compareComponents(a, b);\n return result === 1 || result === 0;\n}\n/**\n * Checks whether `a` is greater than `b`.\n *\n * @param {array} a\n * @param {array} b\n * @returns {boolean}\n */\n\n\nfunction checkGreaterThan(a, b) {\n return compareComponents(a, b) === 1;\n}\n/**\n * Checks whether `a` is \"reasonably close\" to `b` (as described in\n * https://www.npmjs.org/doc/misc/semver.html). For example, if `b` is \"1.3.1\"\n * then \"reasonably close\" is defined as \">= 1.3.1 and < 1.4\".\n *\n * @param {array} a\n * @param {array} b\n * @returns {boolean}\n */\n\n\nfunction checkApproximateVersion(a, b) {\n var lowerBound = b.slice();\n var upperBound = b.slice();\n\n if (upperBound.length > 1) {\n upperBound.pop();\n }\n\n var lastIndex = upperBound.length - 1;\n var numeric = parseInt(upperBound[lastIndex], 10);\n\n if (isNumber(numeric)) {\n upperBound[lastIndex] = numeric + 1 + '';\n }\n\n return checkGreaterThanOrEqual(a, lowerBound) && checkLessThan(a, upperBound);\n}\n/**\n * Extracts the optional modifier (<, <=, =, >=, >, ~, ~>) and version\n * components from `range`.\n *\n * For example, given `range` \">= 1.2.3\" returns an object with a `modifier` of\n * `\">=\"` and `components` of `[1, 2, 3]`.\n *\n * @param {string} range\n * @returns {object}\n */\n\n\nfunction getModifierAndComponents(range) {\n var rangeComponents = range.split(componentRegex);\n var matches = rangeComponents[0].match(modifierRegex);\n !matches ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'expected regex to match but it did not') : invariant(false) : void 0;\n return {\n modifier: matches[1],\n rangeComponents: [matches[2]].concat(rangeComponents.slice(1))\n };\n}\n/**\n * Determines if `number` is a number.\n *\n * @param {mixed} number\n * @returns {boolean}\n */\n\n\nfunction isNumber(number) {\n return !isNaN(number) && isFinite(number);\n}\n/**\n * Tests whether `range` is a \"simple\" version number without any modifiers\n * (\">\", \"~\" etc).\n *\n * @param {string} range\n * @returns {boolean}\n */\n\n\nfunction isSimpleVersion(range) {\n return !getModifierAndComponents(range).modifier;\n}\n/**\n * Zero-pads array `array` until it is at least `length` long.\n *\n * @param {array} array\n * @param {number} length\n */\n\n\nfunction zeroPad(array, length) {\n for (var i = array.length; i < length; i++) {\n array[i] = '0';\n }\n}\n/**\n * Normalizes `a` and `b` in preparation for comparison by doing the following:\n *\n * - zero-pads `a` and `b`\n * - marks any \"x\", \"X\" or \"*\" component in `b` as equivalent by zero-ing it out\n * in both `a` and `b`\n * - marks any final \"*\" component in `b` as a greedy wildcard by zero-ing it\n * and all of its successors in `a`\n *\n * @param {array} a\n * @param {array} b\n * @returns {array>}\n */\n\n\nfunction normalizeVersions(a, b) {\n a = a.slice();\n b = b.slice();\n zeroPad(a, b.length); // mark \"x\" and \"*\" components as equal\n\n for (var i = 0; i < b.length; i++) {\n var matches = b[i].match(/^[x*]$/i);\n\n if (matches) {\n b[i] = a[i] = '0'; // final \"*\" greedily zeros all remaining components\n\n if (matches[0] === '*' && i === b.length - 1) {\n for (var j = i; j < a.length; j++) {\n a[j] = '0';\n }\n }\n }\n }\n\n zeroPad(b, a.length);\n return [a, b];\n}\n/**\n * Returns the numerical -- not the lexicographical -- ordering of `a` and `b`.\n *\n * For example, `10-alpha` is greater than `2-beta`.\n *\n * @param {string} a\n * @param {string} b\n * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,\n * or greater than `b`, respectively\n */\n\n\nfunction compareNumeric(a, b) {\n var aPrefix = a.match(numericRegex)[1];\n var bPrefix = b.match(numericRegex)[1];\n var aNumeric = parseInt(aPrefix, 10);\n var bNumeric = parseInt(bPrefix, 10);\n\n if (isNumber(aNumeric) && isNumber(bNumeric) && aNumeric !== bNumeric) {\n return compare(aNumeric, bNumeric);\n } else {\n return compare(a, b);\n }\n}\n/**\n * Returns the ordering of `a` and `b`.\n *\n * @param {string|number} a\n * @param {string|number} b\n * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,\n * or greater than `b`, respectively\n */\n\n\nfunction compare(a, b) {\n !(typeof a === typeof b) ? process.env.NODE_ENV !== \"production\" ? invariant(false, '\"a\" and \"b\" must be of the same type') : invariant(false) : void 0;\n\n if (a > b) {\n return 1;\n } else if (a < b) {\n return -1;\n } else {\n return 0;\n }\n}\n/**\n * Compares arrays of version components.\n *\n * @param {array} a\n * @param {array} b\n * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,\n * or greater than `b`, respectively\n */\n\n\nfunction compareComponents(a, b) {\n var _normalizeVersions = normalizeVersions(a, b),\n aNormalized = _normalizeVersions[0],\n bNormalized = _normalizeVersions[1];\n\n for (var i = 0; i < bNormalized.length; i++) {\n var result = compareNumeric(aNormalized[i], bNormalized[i]);\n\n if (result) {\n return result;\n }\n }\n\n return 0;\n}\n\nvar VersionRange = {\n /**\n * Checks whether `version` satisfies the `range` specification.\n *\n * We support a subset of the expressions defined in\n * https://www.npmjs.org/doc/misc/semver.html:\n *\n * version Must match version exactly\n * =version Same as just version\n * >version Must be greater than version\n * >=version Must be greater than or equal to version\n * = 1.2.3 and < 1.3\"\n * ~>version Equivalent to ~version\n * 1.2.x Must match \"1.2.x\", where \"x\" is a wildcard that matches\n * anything\n * 1.2.* Similar to \"1.2.x\", but \"*\" in the trailing position is a\n * \"greedy\" wildcard, so will match any number of additional\n * components:\n * \"1.2.*\" will match \"1.2.1\", \"1.2.1.1\", \"1.2.1.1.1\" etc\n * * Any version\n * \"\" (Empty string) Same as *\n * v1 - v2 Equivalent to \">= v1 and <= v2\"\n * r1 || r2 Passes if either r1 or r2 are satisfied\n *\n * @param {string} range\n * @param {string} version\n * @returns {boolean}\n */\n contains: function contains(range, version) {\n return checkOrExpression(range.trim(), version.trim());\n }\n};\nmodule.exports = VersionRange;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar _hyphenPattern = /-(.)/g;\n/**\n * Camelcases a hyphenated string, for example:\n *\n * > camelize('background-color')\n * < \"backgroundColor\"\n *\n * @param {string} string\n * @return {string}\n */\n\nfunction camelize(string) {\n return string.replace(_hyphenPattern, function (_, character) {\n return character.toUpperCase();\n });\n}\n\nmodule.exports = camelize;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nvar isTextNode = require(\"./isTextNode\");\n/*eslint-disable no-bitwise */\n\n/**\n * Checks if a given DOM node contains or is another DOM node.\n */\n\n\nfunction containsNode(outerNode, innerNode) {\n if (!outerNode || !innerNode) {\n return false;\n } else if (outerNode === innerNode) {\n return true;\n } else if (isTextNode(outerNode)) {\n return false;\n } else if (isTextNode(innerNode)) {\n return containsNode(outerNode, innerNode.parentNode);\n } else if ('contains' in outerNode) {\n return outerNode.contains(innerNode);\n } else if (outerNode.compareDocumentPosition) {\n return !!(outerNode.compareDocumentPosition(innerNode) & 16);\n } else {\n return false;\n }\n}\n\nmodule.exports = containsNode;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar invariant = require(\"./invariant\");\n/**\n * Convert array-like objects to arrays.\n *\n * This API assumes the caller knows the contents of the data type. For less\n * well defined inputs use createArrayFromMixed.\n *\n * @param {object|function|filelist} obj\n * @return {array}\n */\n\n\nfunction toArray(obj) {\n var length = obj.length; // Some browsers builtin objects can report typeof 'function' (e.g. NodeList\n // in old versions of Safari).\n\n !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;\n !(typeof length === 'number') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;\n !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;\n !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'toArray: Object can\\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; // Old IE doesn't give collections access to hasOwnProperty. Assume inputs\n // without method will throw during the slice call and skip straight to the\n // fallback.\n\n if (obj.hasOwnProperty) {\n try {\n return Array.prototype.slice.call(obj);\n } catch (e) {// IE < 9 does not support Array#slice on collections objects\n }\n } // Fall back to copying key by key. This assumes all keys have a value,\n // so will not preserve sparsely populated inputs.\n\n\n var ret = Array(length);\n\n for (var ii = 0; ii < length; ii++) {\n ret[ii] = obj[ii];\n }\n\n return ret;\n}\n/**\n * Perform a heuristic test to determine if an object is \"array-like\".\n *\n * A monk asked Joshu, a Zen master, \"Has a dog Buddha nature?\"\n * Joshu replied: \"Mu.\"\n *\n * This function determines if its argument has \"array nature\": it returns\n * true if the argument is an actual array, an `arguments' object, or an\n * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).\n *\n * It will return false for other array-like objects like Filelist.\n *\n * @param {*} obj\n * @return {boolean}\n */\n\n\nfunction hasArrayNature(obj) {\n return (// not null/false\n !!obj && ( // arrays are objects, NodeLists are functions in Safari\n typeof obj == 'object' || typeof obj == 'function') && // quacks like an array\n 'length' in obj && // not window\n !('setInterval' in obj) && // no DOM node should be considered an array-like\n // a 'select' element has 'length' and 'item' properties on IE8\n typeof obj.nodeType != 'number' && ( // a real array\n Array.isArray(obj) || // arguments\n 'callee' in obj || // HTMLCollection/NodeList\n 'item' in obj)\n );\n}\n/**\n * Ensure that the argument is an array by wrapping it in an array if it is not.\n * Creates a copy of the argument if it is already an array.\n *\n * This is mostly useful idiomatically:\n *\n * var createArrayFromMixed = require('createArrayFromMixed');\n *\n * function takesOneOrMoreThings(things) {\n * things = createArrayFromMixed(things);\n * ...\n * }\n *\n * This allows you to treat `things' as an array, but accept scalars in the API.\n *\n * If you need to convert an array-like object, like `arguments`, into an array\n * use toArray instead.\n *\n * @param {*} obj\n * @return {array}\n */\n\n\nfunction createArrayFromMixed(obj) {\n if (!hasArrayNature(obj)) {\n return [obj];\n } else if (Array.isArray(obj)) {\n return obj.slice();\n } else {\n return toArray(obj);\n }\n}\n\nmodule.exports = createArrayFromMixed;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * This function is used to mark string literals representing CSS class names\n * so that they can be transformed statically. This allows for modularization\n * and minification of CSS class names.\n *\n * In static_upstream, this function is actually implemented, but it should\n * eventually be replaced with something more descriptive, and the transform\n * that is used in the main stack should be ported for use elsewhere.\n *\n * @param string|object className to modularize, or an object of key/values.\n * In the object case, the values are conditions that\n * determine if the className keys should be included.\n * @param [string ...] Variable list of classNames in the string case.\n * @return string Renderable space-separated CSS className.\n */\n\nfunction cx(classNames) {\n if (typeof classNames == 'object') {\n return Object.keys(classNames).filter(function (className) {\n return classNames[className];\n }).map(replace).join(' ');\n }\n\n return Array.prototype.map.call(arguments, replace).join(' ');\n}\n\nfunction replace(str) {\n return str.replace(/\\//g, '-');\n}\n\nmodule.exports = cx;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nfunction makeEmptyFunction(arg) {\n return function () {\n return arg;\n };\n}\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\n\n\nvar emptyFunction = function emptyFunction() {};\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\n\nemptyFunction.thatReturnsThis = function () {\n return this;\n};\n\nemptyFunction.thatReturnsArgument = function (arg) {\n return arg;\n};\n\nmodule.exports = emptyFunction;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\n/* eslint-disable fb-www/typeof-undefined */\n\n/**\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\n * not safe to call document.activeElement if there is nothing focused.\n *\n * The activeElement will be null only if the document or document body is not\n * yet defined.\n *\n * @param {?DOMDocument} doc Defaults to current document.\n * @return {?DOMElement}\n */\n\nfunction getActiveElement(doc)\n/*?DOMElement*/\n{\n doc = doc || (typeof document !== 'undefined' ? document : undefined);\n\n if (typeof doc === 'undefined') {\n return null;\n }\n\n try {\n return doc.activeElement || doc.body;\n } catch (e) {\n return doc.body;\n }\n}\n\nmodule.exports = getActiveElement;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n'use strict';\n\nvar isWebkit = typeof navigator !== 'undefined' && navigator.userAgent.indexOf('AppleWebKit') > -1;\n/**\n * Gets the element with the document scroll properties such as `scrollLeft` and\n * `scrollHeight`. This may differ across different browsers.\n *\n * NOTE: The return value can be null if the DOM is not yet ready.\n *\n * @param {?DOMDocument} doc Defaults to current document.\n * @return {?DOMElement}\n */\n\nfunction getDocumentScrollElement(doc) {\n doc = doc || document;\n\n if (doc.scrollingElement) {\n return doc.scrollingElement;\n }\n\n return !isWebkit && doc.compatMode === 'CSS1Compat' ? doc.documentElement : doc.body;\n}\n\nmodule.exports = getDocumentScrollElement;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar getElementRect = require(\"./getElementRect\");\n/**\n * Gets an element's position in pixels relative to the viewport. The returned\n * object represents the position of the element's top left corner.\n *\n * @param {DOMElement} element\n * @return {object}\n */\n\n\nfunction getElementPosition(element) {\n var rect = getElementRect(element);\n return {\n x: rect.left,\n y: rect.top,\n width: rect.right - rect.left,\n height: rect.bottom - rect.top\n };\n}\n\nmodule.exports = getElementPosition;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar containsNode = require(\"./containsNode\");\n/**\n * Gets an element's bounding rect in pixels relative to the viewport.\n *\n * @param {DOMElement} elem\n * @return {object}\n */\n\n\nfunction getElementRect(elem) {\n var docElem = elem.ownerDocument.documentElement; // FF 2, Safari 3 and Opera 9.5- do not support getBoundingClientRect().\n // IE9- will throw if the element is not in the document.\n\n if (!('getBoundingClientRect' in elem) || !containsNode(docElem, elem)) {\n return {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n };\n } // Subtracts clientTop/Left because IE8- added a 2px border to the\n // element (see http://fburl.com/1493213). IE 7 in\n // Quicksmode does not report clientLeft/clientTop so there\n // will be an unaccounted offset of 2px when in quirksmode\n\n\n var rect = elem.getBoundingClientRect();\n return {\n left: Math.round(rect.left) - docElem.clientLeft,\n right: Math.round(rect.right) - docElem.clientLeft,\n top: Math.round(rect.top) - docElem.clientTop,\n bottom: Math.round(rect.bottom) - docElem.clientTop\n };\n}\n\nmodule.exports = getElementRect;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n'use strict';\n\nvar getDocumentScrollElement = require(\"./getDocumentScrollElement\");\n\nvar getUnboundedScrollPosition = require(\"./getUnboundedScrollPosition\");\n/**\n * Gets the scroll position of the supplied element or window.\n *\n * The return values are bounded. This means that if the scroll position is\n * negative or exceeds the element boundaries (which is possible using inertial\n * scrolling), you will get zero or the maximum scroll position, respectively.\n *\n * If you need the unbound scroll position, use `getUnboundedScrollPosition`.\n *\n * @param {DOMWindow|DOMElement} scrollable\n * @return {object} Map with `x` and `y` keys.\n */\n\n\nfunction getScrollPosition(scrollable) {\n var documentScrollElement = getDocumentScrollElement(scrollable.ownerDocument || scrollable.document);\n\n if (scrollable.Window && scrollable instanceof scrollable.Window) {\n scrollable = documentScrollElement;\n }\n\n var scrollPosition = getUnboundedScrollPosition(scrollable);\n var viewport = scrollable === documentScrollElement ? scrollable.ownerDocument.documentElement : scrollable;\n var xMax = scrollable.scrollWidth - viewport.clientWidth;\n var yMax = scrollable.scrollHeight - viewport.clientHeight;\n scrollPosition.x = Math.max(0, Math.min(scrollPosition.x, xMax));\n scrollPosition.y = Math.max(0, Math.min(scrollPosition.y, yMax));\n return scrollPosition;\n}\n\nmodule.exports = getScrollPosition;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar camelize = require(\"./camelize\");\n\nvar hyphenate = require(\"./hyphenate\");\n\nfunction asString(value)\n/*?string*/\n{\n return value == null ? value : String(value);\n}\n\nfunction getStyleProperty(\n/*DOMNode*/\nnode,\n/*string*/\nname)\n/*?string*/\n{\n var computedStyle; // W3C Standard\n\n if (window.getComputedStyle) {\n // In certain cases such as within an iframe in FF3, this returns null.\n computedStyle = window.getComputedStyle(node, null);\n\n if (computedStyle) {\n return asString(computedStyle.getPropertyValue(hyphenate(name)));\n }\n } // Safari\n\n\n if (document.defaultView && document.defaultView.getComputedStyle) {\n computedStyle = document.defaultView.getComputedStyle(node, null); // A Safari bug causes this to return null for `display: none` elements.\n\n if (computedStyle) {\n return asString(computedStyle.getPropertyValue(hyphenate(name)));\n }\n\n if (name === 'display') {\n return 'none';\n }\n } // Internet Explorer\n\n\n if (node.currentStyle) {\n if (name === 'float') {\n return asString(node.currentStyle.cssFloat || node.currentStyle.styleFloat);\n }\n\n return asString(node.currentStyle[camelize(name)]);\n }\n\n return asString(node.style && node.style[camelize(name)]);\n}\n\nmodule.exports = getStyleProperty;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n'use strict';\n/**\n * Gets the scroll position of the supplied element or window.\n *\n * The return values are unbounded, unlike `getScrollPosition`. This means they\n * may be negative or exceed the element boundaries (which is possible using\n * inertial scrolling).\n *\n * @param {DOMWindow|DOMElement} scrollable\n * @return {object} Map with `x` and `y` keys.\n */\n\nfunction getUnboundedScrollPosition(scrollable) {\n if (scrollable.Window && scrollable instanceof scrollable.Window) {\n return {\n x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,\n y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop\n };\n }\n\n return {\n x: scrollable.scrollLeft,\n y: scrollable.scrollTop\n };\n}\n\nmodule.exports = getUnboundedScrollPosition;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @typechecks\n */\n\nfunction getViewportWidth() {\n var width;\n\n if (document.documentElement) {\n width = document.documentElement.clientWidth;\n }\n\n if (!width && document.body) {\n width = document.body.clientWidth;\n }\n\n return width || 0;\n}\n\nfunction getViewportHeight() {\n var height;\n\n if (document.documentElement) {\n height = document.documentElement.clientHeight;\n }\n\n if (!height && document.body) {\n height = document.body.clientHeight;\n }\n\n return height || 0;\n}\n/**\n * Gets the viewport dimensions including any scrollbars.\n */\n\n\nfunction getViewportDimensions() {\n return {\n width: window.innerWidth || getViewportWidth(),\n height: window.innerHeight || getViewportHeight()\n };\n}\n/**\n * Gets the viewport dimensions excluding any scrollbars.\n */\n\n\ngetViewportDimensions.withoutScrollbars = function () {\n return {\n width: getViewportWidth(),\n height: getViewportHeight()\n };\n};\n\nmodule.exports = getViewportDimensions;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar _uppercasePattern = /([A-Z])/g;\n/**\n * Hyphenates a camelcased string, for example:\n *\n * > hyphenate('backgroundColor')\n * < \"background-color\"\n *\n * For CSS style names, use `hyphenateStyleName` instead which works properly\n * with all vendor prefixes, including `ms`.\n *\n * @param {string} string\n * @return {string}\n */\n\nfunction hyphenate(string) {\n return string.replace(_uppercasePattern, '-$1').toLowerCase();\n}\n\nmodule.exports = hyphenate;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n'use strict';\n\nvar validateFormat = process.env.NODE_ENV !== \"production\" ? function (format) {\n if (format === undefined) {\n throw new Error('invariant(...): Second argument must be a string.');\n }\n} : function (format) {};\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments to provide\n * information about what broke and what you were expecting.\n *\n * The invariant message will be stripped in production, but the invariant will\n * remain to ensure logic does not differ in production.\n */\n\nfunction invariant(condition, format) {\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n validateFormat(format);\n\n if (!condition) {\n var error;\n\n if (format === undefined) {\n error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n } else {\n var argIndex = 0;\n error = new Error(format.replace(/%s/g, function () {\n return String(args[argIndex++]);\n }));\n error.name = 'Invariant Violation';\n }\n\n error.framesToPop = 1; // Skip invariant's own stack frame.\n\n throw error;\n }\n}\n\nmodule.exports = invariant;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM node.\n */\n\nfunction isNode(object) {\n var doc = object ? object.ownerDocument || object : document;\n var defaultView = doc.defaultView || window;\n return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));\n}\n\nmodule.exports = isNode;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\nvar isNode = require(\"./isNode\");\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM text node.\n */\n\n\nfunction isTextNode(object) {\n return isNode(object) && object.nodeType == 3;\n}\n\nmodule.exports = isTextNode;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @typechecks static-only\n */\n'use strict';\n/**\n * Combines multiple className strings into one.\n */\n\nfunction joinClasses(className) {\n var newClassName = className || '';\n var argLength = arguments.length;\n\n if (argLength > 1) {\n for (var index = 1; index < argLength; index++) {\n var nextClass = arguments[index];\n\n if (nextClass) {\n newClassName = (newClassName ? newClassName + ' ' : '') + nextClass;\n }\n }\n }\n\n return newClassName;\n}\n\nmodule.exports = joinClasses;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * Executes the provided `callback` once for each enumerable own property in the\n * object and constructs a new object from the results. The `callback` is\n * invoked with three arguments:\n *\n * - the property value\n * - the property name\n * - the object being traversed\n *\n * Properties that are added after the call to `mapObject` will not be visited\n * by `callback`. If the values of existing properties are changed, the value\n * passed to `callback` will be the value at the time `mapObject` visits them.\n * Properties that are deleted before being visited are not visited.\n *\n * @grep function objectMap()\n * @grep function objMap()\n *\n * @param {?object} object\n * @param {function} callback\n * @param {*} context\n * @return {?object}\n */\n\nfunction mapObject(object, callback, context) {\n if (!object) {\n return null;\n }\n\n var result = {};\n\n for (var name in object) {\n if (hasOwnProperty.call(object, name)) {\n result[name] = callback.call(context, object[name], name, object);\n }\n }\n\n return result;\n}\n\nmodule.exports = mapObject;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @typechecks static-only\n */\n'use strict';\n/**\n * Memoizes the return value of a function that accepts one string argument.\n */\n\nfunction memoizeStringOnly(callback) {\n var cache = {};\n return function (string) {\n if (!cache.hasOwnProperty(string)) {\n cache[string] = callback.call(this, string);\n }\n\n return cache[string];\n };\n}\n\nmodule.exports = memoizeStringOnly;","\"use strict\";\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nvar nullthrows = function nullthrows(x) {\n if (x != null) {\n return x;\n }\n\n throw new Error(\"Got unexpected null or undefined\");\n};\n\nmodule.exports = nullthrows;","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict'; // setimmediate adds setImmediate to the global. We want to make sure we export\n// the actual function.\n\nrequire(\"setimmediate\");\n\nmodule.exports = global.setImmediate;","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar emptyFunction = require(\"./emptyFunction\");\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\n\nfunction printWarning(format) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n var argIndex = 0;\n var message = 'Warning: ' + format.replace(/%s/g, function () {\n return args[argIndex++];\n });\n\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n}\n\nvar warning = process.env.NODE_ENV !== \"production\" ? function (condition, format) {\n if (format === undefined) {\n throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');\n }\n\n if (!condition) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n args[_key2 - 2] = arguments[_key2];\n }\n\n printWarning.apply(void 0, [format].concat(args));\n }\n} : emptyFunction;\nmodule.exports = warning;","!function (e, t) {\n \"object\" == typeof exports && \"object\" == typeof module ? module.exports = t(require(\"immutable\"), require(\"draft-js\")) : \"function\" == typeof define && define.amd ? define([\"immutable\", \"draft-js\"], t) : \"object\" == typeof exports ? exports.htmlToDraftjs = t(require(\"immutable\"), require(\"draft-js\")) : e.htmlToDraftjs = t(e.immutable, e[\"draft-js\"]);\n}(window, function (n, r) {\n return o = {}, i.m = a = [function (e, t) {\n e.exports = n;\n }, function (e, t) {\n e.exports = r;\n }, function (e, t, n) {\n e.exports = n(3);\n }, function (e, t, n) {\n \"use strict\";\n\n n.r(t);\n\n var v = n(1),\n u = n(0),\n s = function s(e) {\n var t,\n n = null;\n return document.implementation && document.implementation.createHTMLDocument && ((t = document.implementation.createHTMLDocument(\"foo\")).documentElement.innerHTML = e, n = t.getElementsByTagName(\"body\")[0]), n;\n },\n x = function x(e, t, n) {\n var r,\n i = e.textContent;\n return \"\" === i.trim() ? {\n chunk: (r = n, {\n text: \" \",\n inlines: [new u.OrderedSet()],\n entities: [r],\n blocks: []\n })\n } : {\n chunk: {\n text: i,\n inlines: Array(i.length).fill(t),\n entities: Array(i.length).fill(n),\n blocks: []\n }\n };\n },\n M = function M() {\n return {\n text: \"\\n\",\n inlines: [new u.OrderedSet()],\n entities: new Array(1),\n blocks: []\n };\n },\n k = function k() {\n return {\n text: \"\",\n inlines: [],\n entities: [],\n blocks: []\n };\n },\n E = function E(e, t) {\n return {\n text: \"\",\n inlines: [],\n entities: [],\n blocks: [{\n type: e,\n depth: 0,\n data: t || new u.Map({})\n }]\n };\n },\n w = function w(e, t, n) {\n return {\n text: \"\\r\",\n inlines: [],\n entities: [],\n blocks: [{\n type: e,\n depth: Math.max(0, Math.min(4, t)),\n data: n || new u.Map({})\n }]\n };\n },\n T = function T(e) {\n return {\n text: \"\\r \",\n inlines: [new u.OrderedSet()],\n entities: [e],\n blocks: [{\n type: \"atomic\",\n depth: 0,\n data: new u.Map({})\n }]\n };\n },\n L = function L(e, t) {\n return {\n text: e.text + t.text,\n inlines: e.inlines.concat(t.inlines),\n entities: e.entities.concat(t.entities),\n blocks: e.blocks.concat(t.blocks)\n };\n },\n A = new u.Map({\n \"header-one\": {\n element: \"h1\"\n },\n \"header-two\": {\n element: \"h2\"\n },\n \"header-three\": {\n element: \"h3\"\n },\n \"header-four\": {\n element: \"h4\"\n },\n \"header-five\": {\n element: \"h5\"\n },\n \"header-six\": {\n element: \"h6\"\n },\n \"unordered-list-item\": {\n element: \"li\",\n wrapper: \"ul\"\n },\n \"ordered-list-item\": {\n element: \"li\",\n wrapper: \"ol\"\n },\n blockquote: {\n element: \"blockquote\"\n },\n code: {\n element: \"pre\"\n },\n atomic: {\n element: \"figure\"\n },\n unstyled: {\n element: \"p\",\n aliasedElements: [\"div\"]\n }\n });\n\n var O = {\n code: \"CODE\",\n del: \"STRIKETHROUGH\",\n em: \"ITALIC\",\n strong: \"BOLD\",\n ins: \"UNDERLINE\",\n sub: \"SUBSCRIPT\",\n sup: \"SUPERSCRIPT\"\n };\n\n function S(e) {\n return e.style.textAlign ? new u.Map({\n \"text-align\": e.style.textAlign\n }) : e.style.marginLeft ? new u.Map({\n \"margin-left\": e.style.marginLeft\n }) : void 0;\n }\n\n var _ = function _(e) {\n var t = void 0;\n\n if (e instanceof HTMLAnchorElement) {\n var n = {};\n t = e.dataset && void 0 !== e.dataset.mention ? (n.url = e.href, n.text = e.innerHTML, n.value = e.dataset.value, v.Entity.__create(\"MENTION\", \"IMMUTABLE\", n)) : (n.url = e.getAttribute && e.getAttribute(\"href\") || e.href, n.title = e.innerHTML, n.targetOption = e.target, v.Entity.__create(\"LINK\", \"MUTABLE\", n));\n }\n\n return t;\n };\n\n n.d(t, \"default\", function () {\n return r;\n });\n var d = \" \",\n f = new RegExp(\" \", \"g\"),\n j = !0;\n\n function I(e, t, n, r, i, a) {\n var o = e.nodeName.toLowerCase();\n\n if (a) {\n var l = a(o, e);\n\n if (l) {\n var c = v.Entity.__create(l.type, l.mutability, l.data || {});\n\n return {\n chunk: T(c)\n };\n }\n }\n\n if (\"#text\" === o && \"\\n\" !== e.textContent) return x(e, t, i);\n if (\"br\" === o) return {\n chunk: M()\n };\n\n if (\"img\" === o && e instanceof HTMLImageElement) {\n var u = {};\n u.src = e.getAttribute && e.getAttribute(\"src\") || e.src, u.alt = e.alt, u.height = e.style.height, u.width = e.style.width, e.style.float && (u.alignment = e.style.float);\n\n var s = v.Entity.__create(\"IMAGE\", \"MUTABLE\", u);\n\n return {\n chunk: T(s)\n };\n }\n\n if (\"video\" === o && e instanceof HTMLVideoElement) {\n var d = {};\n d.src = e.getAttribute && e.getAttribute(\"src\") || e.src, d.alt = e.alt, d.height = e.style.height, d.width = e.style.width, e.style.float && (d.alignment = e.style.float);\n\n var f = v.Entity.__create(\"VIDEO\", \"MUTABLE\", d);\n\n return {\n chunk: T(f)\n };\n }\n\n if (\"iframe\" === o && e instanceof HTMLIFrameElement) {\n var m = {};\n m.src = e.getAttribute && e.getAttribute(\"src\") || e.src, m.height = e.height, m.width = e.width;\n\n var p = v.Entity.__create(\"EMBEDDED_LINK\", \"MUTABLE\", m);\n\n return {\n chunk: T(p)\n };\n }\n\n var h,\n y = function (t, n) {\n var e = A.filter(function (e) {\n return e.element === t && (!e.wrapper || e.wrapper === n) || e.wrapper === t || e.aliasedElements && -1 < e.aliasedElements.indexOf(t);\n }).keySeq().toSet().toArray();\n if (1 === e.length) return e[0];\n }(o, r);\n\n y && (\"ul\" === o || \"ol\" === o ? (r = o, n += 1) : (\"unordered-list-item\" !== y && \"ordered-list-item\" !== y && (r = \"\", n = -1), j ? (h = E(y, S(e)), j = !1) : h = w(y, n, S(e)))), h = h || k(), t = function (e, t, n) {\n var r,\n i = O[e];\n if (i) r = n.add(i).toOrderedSet();else if (t instanceof HTMLElement) {\n var c = t;\n r = (r = n).withMutations(function (e) {\n var t = c.style.color,\n n = c.style.backgroundColor,\n r = c.style.fontSize,\n i = c.style.fontFamily.replace(/^\"|\"$/g, \"\"),\n a = c.style.fontWeight,\n o = c.style.textDecoration,\n l = c.style.fontStyle;\n t && e.add(\"color-\".concat(t.replace(/ /g, \"\"))), n && e.add(\"bgcolor-\".concat(n.replace(/ /g, \"\"))), r && e.add(\"fontsize-\".concat(r.replace(/px$/g, \"\"))), i && e.add(\"fontfamily-\".concat(i)), \"bold\" === a && e.add(O.strong), \"underline\" === o && e.add(O.ins), \"italic\" === l && e.add(O.em);\n }).toOrderedSet();\n }\n return r;\n }(o, e, t);\n\n for (var b = e.firstChild; b;) {\n var g = I(b, t, n, r, _(b) || i, a).chunk;\n h = L(h, g), b = b.nextSibling;\n }\n\n return {\n chunk: h\n };\n }\n\n function r(e, t) {\n var n,\n r,\n i,\n a = (n = t, r = e.trim().replace(f, d), (i = s(r)) ? (j = !0, {\n chunk: I(i, new u.OrderedSet(), -1, \"\", void 0, n).chunk\n }) : null);\n\n if (a) {\n var o = a.chunk,\n l = new u.OrderedMap({});\n o.entities && o.entities.forEach(function (e) {\n e && (l = l.set(e, v.Entity.__get(e)));\n });\n var c = 0;\n return {\n contentBlocks: o.text.split(\"\\r\").map(function (e, t) {\n var n = c + e.length,\n r = o && o.inlines.slice(c, n),\n i = o && o.entities.slice(c, n),\n a = new u.List(r.map(function (e, t) {\n var n = {\n style: e,\n entity: null\n };\n return i[t] && (n.entity = i[t]), v.CharacterMetadata.create(n);\n }));\n return c = n, new v.ContentBlock({\n key: Object(v.genKey)(),\n type: o && o.blocks[t] && o.blocks[t].type || \"unstyled\",\n depth: o && o.blocks[t] && o.blocks[t].depth,\n data: o && o.blocks[t] && o.blocks[t].data || new u.Map({}),\n text: e,\n characterList: a\n });\n }),\n entityMap: l\n };\n }\n\n return null;\n }\n }], i.c = o, i.d = function (e, t, n) {\n i.o(e, t) || Object.defineProperty(e, t, {\n enumerable: !0,\n get: n\n });\n }, i.r = function (e) {\n \"undefined\" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {\n value: \"Module\"\n }), Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n }, i.t = function (t, e) {\n if (1 & e && (t = i(t)), 8 & e) return t;\n if (4 & e && \"object\" == typeof t && t && t.__esModule) return t;\n var n = Object.create(null);\n if (i.r(n), Object.defineProperty(n, \"default\", {\n enumerable: !0,\n value: t\n }), 2 & e && \"string\" != typeof t) for (var r in t) {\n i.d(n, r, function (e) {\n return t[e];\n }.bind(null, r));\n }\n return n;\n }, i.n = function (e) {\n var t = e && e.__esModule ? function () {\n return e.default;\n } : function () {\n return e;\n };\n return i.d(t, \"a\", t), t;\n }, i.o = function (e, t) {\n return Object.prototype.hasOwnProperty.call(e, t);\n }, i.p = \"\", i(i.s = 2);\n\n function i(e) {\n if (o[e]) return o[e].exports;\n var t = o[e] = {\n i: e,\n l: !1,\n exports: {}\n };\n return a[e].call(t.exports, t, t.exports, i), t.l = !0, t.exports;\n }\n\n var a, o;\n});","require(\"core-js/modules/es.array.flat-map.js\");\n\nrequire(\"core-js/modules/es.array.unscopables.flat-map.js\");\n\n/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.Immutable = factory();\n})(this, function () {\n 'use strict';\n\n var SLICE$0 = Array.prototype.slice;\n\n function createClass(ctor, superClass) {\n if (superClass) {\n ctor.prototype = Object.create(superClass.prototype);\n }\n\n ctor.prototype.constructor = ctor;\n }\n\n function Iterable(value) {\n return isIterable(value) ? value : Seq(value);\n }\n\n createClass(KeyedIterable, Iterable);\n\n function KeyedIterable(value) {\n return isKeyed(value) ? value : KeyedSeq(value);\n }\n\n createClass(IndexedIterable, Iterable);\n\n function IndexedIterable(value) {\n return isIndexed(value) ? value : IndexedSeq(value);\n }\n\n createClass(SetIterable, Iterable);\n\n function SetIterable(value) {\n return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n }\n\n function isIterable(maybeIterable) {\n return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n }\n\n function isKeyed(maybeKeyed) {\n return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n }\n\n function isIndexed(maybeIndexed) {\n return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n }\n\n function isAssociative(maybeAssociative) {\n return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n }\n\n function isOrdered(maybeOrdered) {\n return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n }\n\n Iterable.isIterable = isIterable;\n Iterable.isKeyed = isKeyed;\n Iterable.isIndexed = isIndexed;\n Iterable.isAssociative = isAssociative;\n Iterable.isOrdered = isOrdered;\n Iterable.Keyed = KeyedIterable;\n Iterable.Indexed = IndexedIterable;\n Iterable.Set = SetIterable;\n var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; // Used for setting prototype methods that IE8 chokes on.\n\n var DELETE = 'delete'; // Constants describing the size of trie nodes.\n\n var SHIFT = 5; // Resulted in best performance after ______?\n\n var SIZE = 1 << SHIFT;\n var MASK = SIZE - 1; // A consistent shared value representing \"not set\" which equals nothing other\n // than itself, and nothing that could be provided externally.\n\n var NOT_SET = {}; // Boolean references, Rough equivalent of `bool &`.\n\n var CHANGE_LENGTH = {\n value: false\n };\n var DID_ALTER = {\n value: false\n };\n\n function MakeRef(ref) {\n ref.value = false;\n return ref;\n }\n\n function SetRef(ref) {\n ref && (ref.value = true);\n } // A function which returns a value representing an \"owner\" for transient writes\n // to tries. The return value will only ever equal itself, and will not equal\n // the return of any subsequent call of this function.\n\n\n function OwnerID() {} // http://jsperf.com/copy-array-inline\n\n\n function arrCopy(arr, offset) {\n offset = offset || 0;\n var len = Math.max(0, arr.length - offset);\n var newArr = new Array(len);\n\n for (var ii = 0; ii < len; ii++) {\n newArr[ii] = arr[ii + offset];\n }\n\n return newArr;\n }\n\n function ensureSize(iter) {\n if (iter.size === undefined) {\n iter.size = iter.__iterate(returnTrue);\n }\n\n return iter.size;\n }\n\n function wrapIndex(iter, index) {\n // This implements \"is array index\" which the ECMAString spec defines as:\n //\n // A String property name P is an array index if and only if\n // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n // to 2^32−1.\n //\n // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n if (typeof index !== 'number') {\n var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n\n if ('' + uint32Index !== index || uint32Index === 4294967295) {\n return NaN;\n }\n\n index = uint32Index;\n }\n\n return index < 0 ? ensureSize(iter) + index : index;\n }\n\n function returnTrue() {\n return true;\n }\n\n function wholeSlice(begin, end, size) {\n return (begin === 0 || size !== undefined && begin <= -size) && (end === undefined || size !== undefined && end >= size);\n }\n\n function resolveBegin(begin, size) {\n return resolveIndex(begin, size, 0);\n }\n\n function resolveEnd(end, size) {\n return resolveIndex(end, size, size);\n }\n\n function resolveIndex(index, size, defaultIndex) {\n return index === undefined ? defaultIndex : index < 0 ? Math.max(0, size + index) : size === undefined ? index : Math.min(size, index);\n }\n /* global Symbol */\n\n\n var ITERATE_KEYS = 0;\n var ITERATE_VALUES = 1;\n var ITERATE_ENTRIES = 2;\n var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator';\n var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n function Iterator(next) {\n this.next = next;\n }\n\n Iterator.prototype.toString = function () {\n return '[Iterator]';\n };\n\n Iterator.KEYS = ITERATE_KEYS;\n Iterator.VALUES = ITERATE_VALUES;\n Iterator.ENTRIES = ITERATE_ENTRIES;\n\n Iterator.prototype.inspect = Iterator.prototype.toSource = function () {\n return this.toString();\n };\n\n Iterator.prototype[ITERATOR_SYMBOL] = function () {\n return this;\n };\n\n function iteratorValue(type, k, v, iteratorResult) {\n var value = type === 0 ? k : type === 1 ? v : [k, v];\n iteratorResult ? iteratorResult.value = value : iteratorResult = {\n value: value,\n done: false\n };\n return iteratorResult;\n }\n\n function iteratorDone() {\n return {\n value: undefined,\n done: true\n };\n }\n\n function hasIterator(maybeIterable) {\n return !!getIteratorFn(maybeIterable);\n }\n\n function isIterator(maybeIterator) {\n return maybeIterator && typeof maybeIterator.next === 'function';\n }\n\n function getIterator(iterable) {\n var iteratorFn = getIteratorFn(iterable);\n return iteratorFn && iteratorFn.call(iterable);\n }\n\n function getIteratorFn(iterable) {\n var iteratorFn = iterable && (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL] || iterable[FAUX_ITERATOR_SYMBOL]);\n\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n function isArrayLike(value) {\n return value && typeof value.length === 'number';\n }\n\n createClass(Seq, Iterable);\n\n function Seq(value) {\n return value === null || value === undefined ? emptySequence() : isIterable(value) ? value.toSeq() : seqFromValue(value);\n }\n\n Seq.of = function\n /*...values*/\n () {\n return Seq(arguments);\n };\n\n Seq.prototype.toSeq = function () {\n return this;\n };\n\n Seq.prototype.toString = function () {\n return this.__toString('Seq {', '}');\n };\n\n Seq.prototype.cacheResult = function () {\n if (!this._cache && this.__iterateUncached) {\n this._cache = this.entrySeq().toArray();\n this.size = this._cache.length;\n }\n\n return this;\n }; // abstract __iterateUncached(fn, reverse)\n\n\n Seq.prototype.__iterate = function (fn, reverse) {\n return seqIterate(this, fn, reverse, true);\n }; // abstract __iteratorUncached(type, reverse)\n\n\n Seq.prototype.__iterator = function (type, reverse) {\n return seqIterator(this, type, reverse, true);\n };\n\n createClass(KeyedSeq, Seq);\n\n function KeyedSeq(value) {\n return value === null || value === undefined ? emptySequence().toKeyedSeq() : isIterable(value) ? isKeyed(value) ? value.toSeq() : value.fromEntrySeq() : keyedSeqFromValue(value);\n }\n\n KeyedSeq.prototype.toKeyedSeq = function () {\n return this;\n };\n\n createClass(IndexedSeq, Seq);\n\n function IndexedSeq(value) {\n return value === null || value === undefined ? emptySequence() : !isIterable(value) ? indexedSeqFromValue(value) : isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n }\n\n IndexedSeq.of = function\n /*...values*/\n () {\n return IndexedSeq(arguments);\n };\n\n IndexedSeq.prototype.toIndexedSeq = function () {\n return this;\n };\n\n IndexedSeq.prototype.toString = function () {\n return this.__toString('Seq [', ']');\n };\n\n IndexedSeq.prototype.__iterate = function (fn, reverse) {\n return seqIterate(this, fn, reverse, false);\n };\n\n IndexedSeq.prototype.__iterator = function (type, reverse) {\n return seqIterator(this, type, reverse, false);\n };\n\n createClass(SetSeq, Seq);\n\n function SetSeq(value) {\n return (value === null || value === undefined ? emptySequence() : !isIterable(value) ? indexedSeqFromValue(value) : isKeyed(value) ? value.entrySeq() : value).toSetSeq();\n }\n\n SetSeq.of = function\n /*...values*/\n () {\n return SetSeq(arguments);\n };\n\n SetSeq.prototype.toSetSeq = function () {\n return this;\n };\n\n Seq.isSeq = isSeq;\n Seq.Keyed = KeyedSeq;\n Seq.Set = SetSeq;\n Seq.Indexed = IndexedSeq;\n var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n Seq.prototype[IS_SEQ_SENTINEL] = true;\n createClass(ArraySeq, IndexedSeq);\n\n function ArraySeq(array) {\n this._array = array;\n this.size = array.length;\n }\n\n ArraySeq.prototype.get = function (index, notSetValue) {\n return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n };\n\n ArraySeq.prototype.__iterate = function (fn, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n return ii + 1;\n }\n }\n\n return ii;\n };\n\n ArraySeq.prototype.__iterator = function (type, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n var ii = 0;\n return new Iterator(function () {\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++]);\n });\n };\n\n createClass(ObjectSeq, KeyedSeq);\n\n function ObjectSeq(object) {\n var keys = Object.keys(object);\n this._object = object;\n this._keys = keys;\n this.size = keys.length;\n }\n\n ObjectSeq.prototype.get = function (key, notSetValue) {\n if (notSetValue !== undefined && !this.has(key)) {\n return notSetValue;\n }\n\n return this._object[key];\n };\n\n ObjectSeq.prototype.has = function (key) {\n return this._object.hasOwnProperty(key);\n };\n\n ObjectSeq.prototype.__iterate = function (fn, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n\n for (var ii = 0; ii <= maxIndex; ii++) {\n var key = keys[reverse ? maxIndex - ii : ii];\n\n if (fn(object[key], key, this) === false) {\n return ii + 1;\n }\n }\n\n return ii;\n };\n\n ObjectSeq.prototype.__iterator = function (type, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n var ii = 0;\n return new Iterator(function () {\n var key = keys[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ? iteratorDone() : iteratorValue(type, key, object[key]);\n });\n };\n\n ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n createClass(IterableSeq, IndexedSeq);\n\n function IterableSeq(iterable) {\n this._iterable = iterable;\n this.size = iterable.length || iterable.size;\n }\n\n IterableSeq.prototype.__iterateUncached = function (fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n var iterations = 0;\n\n if (isIterator(iterator)) {\n var step;\n\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n }\n\n return iterations;\n };\n\n IterableSeq.prototype.__iteratorUncached = function (type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n\n if (!isIterator(iterator)) {\n return new Iterator(iteratorDone);\n }\n\n var iterations = 0;\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value);\n });\n };\n\n createClass(IteratorSeq, IndexedSeq);\n\n function IteratorSeq(iterator) {\n this._iterator = iterator;\n this._iteratorCache = [];\n }\n\n IteratorSeq.prototype.__iterateUncached = function (fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n\n while (iterations < cache.length) {\n if (fn(cache[iterations], iterations++, this) === false) {\n return iterations;\n }\n }\n\n var step;\n\n while (!(step = iterator.next()).done) {\n var val = step.value;\n cache[iterations] = val;\n\n if (fn(val, iterations++, this) === false) {\n break;\n }\n }\n\n return iterations;\n };\n\n IteratorSeq.prototype.__iteratorUncached = function (type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n return new Iterator(function () {\n if (iterations >= cache.length) {\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n cache[iterations] = step.value;\n }\n\n return iteratorValue(type, iterations, cache[iterations++]);\n });\n }; // # pragma Helper functions\n\n\n function isSeq(maybeSeq) {\n return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n }\n\n var EMPTY_SEQ;\n\n function emptySequence() {\n return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n }\n\n function keyedSeqFromValue(value) {\n var seq = Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : typeof value === 'object' ? new ObjectSeq(value) : undefined;\n\n if (!seq) {\n throw new TypeError('Expected Array or iterable object of [k, v] entries, ' + 'or keyed object: ' + value);\n }\n\n return seq;\n }\n\n function indexedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n\n if (!seq) {\n throw new TypeError('Expected Array or iterable object of values: ' + value);\n }\n\n return seq;\n }\n\n function seqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value) || typeof value === 'object' && new ObjectSeq(value);\n\n if (!seq) {\n throw new TypeError('Expected Array or iterable object of values, or keyed object: ' + value);\n }\n\n return seq;\n }\n\n function maybeIndexedSeqFromValue(value) {\n return isArrayLike(value) ? new ArraySeq(value) : isIterator(value) ? new IteratorSeq(value) : hasIterator(value) ? new IterableSeq(value) : undefined;\n }\n\n function seqIterate(seq, fn, reverse, useKeys) {\n var cache = seq._cache;\n\n if (cache) {\n var maxIndex = cache.length - 1;\n\n for (var ii = 0; ii <= maxIndex; ii++) {\n var entry = cache[reverse ? maxIndex - ii : ii];\n\n if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n return ii + 1;\n }\n }\n\n return ii;\n }\n\n return seq.__iterateUncached(fn, reverse);\n }\n\n function seqIterator(seq, type, reverse, useKeys) {\n var cache = seq._cache;\n\n if (cache) {\n var maxIndex = cache.length - 1;\n var ii = 0;\n return new Iterator(function () {\n var entry = cache[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ? iteratorDone() : iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n });\n }\n\n return seq.__iteratorUncached(type, reverse);\n }\n\n function fromJS(json, converter) {\n return converter ? fromJSWith(converter, json, '', {\n '': json\n }) : fromJSDefault(json);\n }\n\n function fromJSWith(converter, json, key, parentJSON) {\n if (Array.isArray(json)) {\n return converter.call(parentJSON, key, IndexedSeq(json).map(function (v, k) {\n return fromJSWith(converter, v, k, json);\n }));\n }\n\n if (isPlainObj(json)) {\n return converter.call(parentJSON, key, KeyedSeq(json).map(function (v, k) {\n return fromJSWith(converter, v, k, json);\n }));\n }\n\n return json;\n }\n\n function fromJSDefault(json) {\n if (Array.isArray(json)) {\n return IndexedSeq(json).map(fromJSDefault).toList();\n }\n\n if (isPlainObj(json)) {\n return KeyedSeq(json).map(fromJSDefault).toMap();\n }\n\n return json;\n }\n\n function isPlainObj(value) {\n return value && (value.constructor === Object || value.constructor === undefined);\n }\n /**\n * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n *\n * NaN is considered the same as NaN, however -0 and 0 are considered the same\n * value, which is different from the algorithm described by\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n *\n * This is extended further to allow Objects to describe the values they\n * represent, by way of `valueOf` or `equals` (and `hashCode`).\n *\n * Note: because of this extension, the key equality of Immutable.Map and the\n * value equality of Immutable.Set will differ from ES6 Map and Set.\n *\n * ### Defining custom values\n *\n * The easiest way to describe the value an object represents is by implementing\n * `valueOf`. For example, `Date` represents a value by returning a unix\n * timestamp for `valueOf`:\n *\n * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n * var date2 = new Date(1234567890000);\n * date1.valueOf(); // 1234567890000\n * assert( date1 !== date2 );\n * assert( Immutable.is( date1, date2 ) );\n *\n * Note: overriding `valueOf` may have other implications if you use this object\n * where JavaScript expects a primitive, such as implicit string coercion.\n *\n * For more complex types, especially collections, implementing `valueOf` may\n * not be performant. An alternative is to implement `equals` and `hashCode`.\n *\n * `equals` takes another object, presumably of similar type, and returns true\n * if the it is equal. Equality is symmetrical, so the same result should be\n * returned if this and the argument are flipped.\n *\n * assert( a.equals(b) === b.equals(a) );\n *\n * `hashCode` returns a 32bit integer number representing the object which will\n * be used to determine how to store the value object in a Map or Set. You must\n * provide both or neither methods, one must not exist without the other.\n *\n * Also, an important relationship between these methods must be upheld: if two\n * values are equal, they *must* return the same hashCode. If the values are not\n * equal, they might have the same hashCode; this is called a hash collision,\n * and while undesirable for performance reasons, it is acceptable.\n *\n * if (a.equals(b)) {\n * assert( a.hashCode() === b.hashCode() );\n * }\n *\n * All Immutable collections implement `equals` and `hashCode`.\n *\n */\n\n\n function is(valueA, valueB) {\n if (valueA === valueB || valueA !== valueA && valueB !== valueB) {\n return true;\n }\n\n if (!valueA || !valueB) {\n return false;\n }\n\n if (typeof valueA.valueOf === 'function' && typeof valueB.valueOf === 'function') {\n valueA = valueA.valueOf();\n valueB = valueB.valueOf();\n\n if (valueA === valueB || valueA !== valueA && valueB !== valueB) {\n return true;\n }\n\n if (!valueA || !valueB) {\n return false;\n }\n }\n\n if (typeof valueA.equals === 'function' && typeof valueB.equals === 'function' && valueA.equals(valueB)) {\n return true;\n }\n\n return false;\n }\n\n function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (!isIterable(b) || a.size !== undefined && b.size !== undefined && a.size !== b.size || a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || isKeyed(a) !== isKeyed(b) || isIndexed(a) !== isIndexed(b) || isOrdered(a) !== isOrdered(b)) {\n return false;\n }\n\n if (a.size === 0 && b.size === 0) {\n return true;\n }\n\n var notAssociative = !isAssociative(a);\n\n if (isOrdered(a)) {\n var entries = a.entries();\n return b.every(function (v, k) {\n var entry = entries.next().value;\n return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n }) && entries.next().done;\n }\n\n var flipped = false;\n\n if (a.size === undefined) {\n if (b.size === undefined) {\n if (typeof a.cacheResult === 'function') {\n a.cacheResult();\n }\n } else {\n flipped = true;\n var _ = a;\n a = b;\n b = _;\n }\n }\n\n var allEqual = true;\n\n var bSize = b.__iterate(function (v, k) {\n if (notAssociative ? !a.has(v) : flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n allEqual = false;\n return false;\n }\n });\n\n return allEqual && a.size === bSize;\n }\n\n createClass(Repeat, IndexedSeq);\n\n function Repeat(value, times) {\n if (!(this instanceof Repeat)) {\n return new Repeat(value, times);\n }\n\n this._value = value;\n this.size = times === undefined ? Infinity : Math.max(0, times);\n\n if (this.size === 0) {\n if (EMPTY_REPEAT) {\n return EMPTY_REPEAT;\n }\n\n EMPTY_REPEAT = this;\n }\n }\n\n Repeat.prototype.toString = function () {\n if (this.size === 0) {\n return 'Repeat []';\n }\n\n return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n };\n\n Repeat.prototype.get = function (index, notSetValue) {\n return this.has(index) ? this._value : notSetValue;\n };\n\n Repeat.prototype.includes = function (searchValue) {\n return is(this._value, searchValue);\n };\n\n Repeat.prototype.slice = function (begin, end) {\n var size = this.size;\n return wholeSlice(begin, end, size) ? this : new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n };\n\n Repeat.prototype.reverse = function () {\n return this;\n };\n\n Repeat.prototype.indexOf = function (searchValue) {\n if (is(this._value, searchValue)) {\n return 0;\n }\n\n return -1;\n };\n\n Repeat.prototype.lastIndexOf = function (searchValue) {\n if (is(this._value, searchValue)) {\n return this.size;\n }\n\n return -1;\n };\n\n Repeat.prototype.__iterate = function (fn, reverse) {\n for (var ii = 0; ii < this.size; ii++) {\n if (fn(this._value, ii, this) === false) {\n return ii + 1;\n }\n }\n\n return ii;\n };\n\n Repeat.prototype.__iterator = function (type, reverse) {\n var this$0 = this;\n var ii = 0;\n return new Iterator(function () {\n return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone();\n });\n };\n\n Repeat.prototype.equals = function (other) {\n return other instanceof Repeat ? is(this._value, other._value) : deepEqual(other);\n };\n\n var EMPTY_REPEAT;\n\n function invariant(condition, error) {\n if (!condition) throw new Error(error);\n }\n\n createClass(Range, IndexedSeq);\n\n function Range(start, end, step) {\n if (!(this instanceof Range)) {\n return new Range(start, end, step);\n }\n\n invariant(step !== 0, 'Cannot step a Range by 0');\n start = start || 0;\n\n if (end === undefined) {\n end = Infinity;\n }\n\n step = step === undefined ? 1 : Math.abs(step);\n\n if (end < start) {\n step = -step;\n }\n\n this._start = start;\n this._end = end;\n this._step = step;\n this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n\n if (this.size === 0) {\n if (EMPTY_RANGE) {\n return EMPTY_RANGE;\n }\n\n EMPTY_RANGE = this;\n }\n }\n\n Range.prototype.toString = function () {\n if (this.size === 0) {\n return 'Range []';\n }\n\n return 'Range [ ' + this._start + '...' + this._end + (this._step !== 1 ? ' by ' + this._step : '') + ' ]';\n };\n\n Range.prototype.get = function (index, notSetValue) {\n return this.has(index) ? this._start + wrapIndex(this, index) * this._step : notSetValue;\n };\n\n Range.prototype.includes = function (searchValue) {\n var possibleIndex = (searchValue - this._start) / this._step;\n return possibleIndex >= 0 && possibleIndex < this.size && possibleIndex === Math.floor(possibleIndex);\n };\n\n Range.prototype.slice = function (begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n\n begin = resolveBegin(begin, this.size);\n end = resolveEnd(end, this.size);\n\n if (end <= begin) {\n return new Range(0, 0);\n }\n\n return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n };\n\n Range.prototype.indexOf = function (searchValue) {\n var offsetValue = searchValue - this._start;\n\n if (offsetValue % this._step === 0) {\n var index = offsetValue / this._step;\n\n if (index >= 0 && index < this.size) {\n return index;\n }\n }\n\n return -1;\n };\n\n Range.prototype.lastIndexOf = function (searchValue) {\n return this.indexOf(searchValue);\n };\n\n Range.prototype.__iterate = function (fn, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(value, ii, this) === false) {\n return ii + 1;\n }\n\n value += reverse ? -step : step;\n }\n\n return ii;\n };\n\n Range.prototype.__iterator = function (type, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n var ii = 0;\n return new Iterator(function () {\n var v = value;\n value += reverse ? -step : step;\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n });\n };\n\n Range.prototype.equals = function (other) {\n return other instanceof Range ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual(this, other);\n };\n\n var EMPTY_RANGE;\n createClass(Collection, Iterable);\n\n function Collection() {\n throw TypeError('Abstract');\n }\n\n createClass(KeyedCollection, Collection);\n\n function KeyedCollection() {}\n\n createClass(IndexedCollection, Collection);\n\n function IndexedCollection() {}\n\n createClass(SetCollection, Collection);\n\n function SetCollection() {}\n\n Collection.Keyed = KeyedCollection;\n Collection.Indexed = IndexedCollection;\n Collection.Set = SetCollection;\n var imul = typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? Math.imul : function imul(a, b) {\n a = a | 0; // int\n\n b = b | 0; // int\n\n var c = a & 0xffff;\n var d = b & 0xffff; // Shift by 0 fixes the sign on the high part.\n\n return c * d + ((a >>> 16) * d + c * (b >>> 16) << 16 >>> 0) | 0; // int\n }; // v8 has an optimization for storing 31-bit signed numbers.\n // Values which have either 00 or 11 as the high order bits qualify.\n // This function drops the highest order bit in a signed number, maintaining\n // the sign bit.\n\n function smi(i32) {\n return i32 >>> 1 & 0x40000000 | i32 & 0xBFFFFFFF;\n }\n\n function hash(o) {\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n\n if (typeof o.valueOf === 'function') {\n o = o.valueOf();\n\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n }\n\n if (o === true) {\n return 1;\n }\n\n var type = typeof o;\n\n if (type === 'number') {\n if (o !== o || o === Infinity) {\n return 0;\n }\n\n var h = o | 0;\n\n if (h !== o) {\n h ^= o * 0xFFFFFFFF;\n }\n\n while (o > 0xFFFFFFFF) {\n o /= 0xFFFFFFFF;\n h ^= o;\n }\n\n return smi(h);\n }\n\n if (type === 'string') {\n return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n }\n\n if (typeof o.hashCode === 'function') {\n return o.hashCode();\n }\n\n if (type === 'object') {\n return hashJSObj(o);\n }\n\n if (typeof o.toString === 'function') {\n return hashString(o.toString());\n }\n\n throw new Error('Value type ' + type + ' cannot be hashed.');\n }\n\n function cachedHashString(string) {\n var hash = stringHashCache[string];\n\n if (hash === undefined) {\n hash = hashString(string);\n\n if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n STRING_HASH_CACHE_SIZE = 0;\n stringHashCache = {};\n }\n\n STRING_HASH_CACHE_SIZE++;\n stringHashCache[string] = hash;\n }\n\n return hash;\n } // http://jsperf.com/hashing-strings\n\n\n function hashString(string) {\n // This is the hash from JVM\n // The hash code for a string is computed as\n // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n // where s[i] is the ith character of the string and n is the length of\n // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n // (exclusive) by dropping high bits.\n var hash = 0;\n\n for (var ii = 0; ii < string.length; ii++) {\n hash = 31 * hash + string.charCodeAt(ii) | 0;\n }\n\n return smi(hash);\n }\n\n function hashJSObj(obj) {\n var hash;\n\n if (usingWeakMap) {\n hash = weakMap.get(obj);\n\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = obj[UID_HASH_KEY];\n\n if (hash !== undefined) {\n return hash;\n }\n\n if (!canDefineProperty) {\n hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n\n if (hash !== undefined) {\n return hash;\n }\n\n hash = getIENodeHash(obj);\n\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = ++objHashUID;\n\n if (objHashUID & 0x40000000) {\n objHashUID = 0;\n }\n\n if (usingWeakMap) {\n weakMap.set(obj, hash);\n } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n throw new Error('Non-extensible objects are not allowed as keys.');\n } else if (canDefineProperty) {\n Object.defineProperty(obj, UID_HASH_KEY, {\n 'enumerable': false,\n 'configurable': false,\n 'writable': false,\n 'value': hash\n });\n } else if (obj.propertyIsEnumerable !== undefined && obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n // Since we can't define a non-enumerable property on the object\n // we'll hijack one of the less-used non-enumerable properties to\n // save our hash on it. Since this is a function it will not show up in\n // `JSON.stringify` which is what we want.\n obj.propertyIsEnumerable = function () {\n return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n };\n\n obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n } else if (obj.nodeType !== undefined) {\n // At this point we couldn't get the IE `uniqueID` to use as a hash\n // and we couldn't use a non-enumerable property to exploit the\n // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n // itself.\n obj[UID_HASH_KEY] = hash;\n } else {\n throw new Error('Unable to set a non-enumerable property on object.');\n }\n\n return hash;\n } // Get references to ES5 object methods.\n\n\n var isExtensible = Object.isExtensible; // True if Object.defineProperty works as expected. IE8 fails this test.\n\n var canDefineProperty = function () {\n try {\n Object.defineProperty({}, '@', {});\n return true;\n } catch (e) {\n return false;\n }\n }(); // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n // and avoid memory leaks from the IE cloneNode bug.\n\n\n function getIENodeHash(node) {\n if (node && node.nodeType > 0) {\n switch (node.nodeType) {\n case 1:\n // Element\n return node.uniqueID;\n\n case 9:\n // Document\n return node.documentElement && node.documentElement.uniqueID;\n }\n }\n } // If possible, use a WeakMap.\n\n\n var usingWeakMap = typeof WeakMap === 'function';\n var weakMap;\n\n if (usingWeakMap) {\n weakMap = new WeakMap();\n }\n\n var objHashUID = 0;\n var UID_HASH_KEY = '__immutablehash__';\n\n if (typeof Symbol === 'function') {\n UID_HASH_KEY = Symbol(UID_HASH_KEY);\n }\n\n var STRING_HASH_CACHE_MIN_STRLEN = 16;\n var STRING_HASH_CACHE_MAX_SIZE = 255;\n var STRING_HASH_CACHE_SIZE = 0;\n var stringHashCache = {};\n\n function assertNotInfinite(size) {\n invariant(size !== Infinity, 'Cannot perform this action with an infinite size.');\n }\n\n createClass(Map, KeyedCollection); // @pragma Construction\n\n function Map(value) {\n return value === null || value === undefined ? emptyMap() : isMap(value) && !isOrdered(value) ? value : emptyMap().withMutations(function (map) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v, k) {\n return map.set(k, v);\n });\n });\n }\n\n Map.of = function () {\n var keyValues = SLICE$0.call(arguments, 0);\n return emptyMap().withMutations(function (map) {\n for (var i = 0; i < keyValues.length; i += 2) {\n if (i + 1 >= keyValues.length) {\n throw new Error('Missing value for key: ' + keyValues[i]);\n }\n\n map.set(keyValues[i], keyValues[i + 1]);\n }\n });\n };\n\n Map.prototype.toString = function () {\n return this.__toString('Map {', '}');\n }; // @pragma Access\n\n\n Map.prototype.get = function (k, notSetValue) {\n return this._root ? this._root.get(0, undefined, k, notSetValue) : notSetValue;\n }; // @pragma Modification\n\n\n Map.prototype.set = function (k, v) {\n return updateMap(this, k, v);\n };\n\n Map.prototype.setIn = function (keyPath, v) {\n return this.updateIn(keyPath, NOT_SET, function () {\n return v;\n });\n };\n\n Map.prototype.remove = function (k) {\n return updateMap(this, k, NOT_SET);\n };\n\n Map.prototype.deleteIn = function (keyPath) {\n return this.updateIn(keyPath, function () {\n return NOT_SET;\n });\n };\n\n Map.prototype.update = function (k, notSetValue, updater) {\n return arguments.length === 1 ? k(this) : this.updateIn([k], notSetValue, updater);\n };\n\n Map.prototype.updateIn = function (keyPath, notSetValue, updater) {\n if (!updater) {\n updater = notSetValue;\n notSetValue = undefined;\n }\n\n var updatedValue = updateInDeepMap(this, forceIterator(keyPath), notSetValue, updater);\n return updatedValue === NOT_SET ? undefined : updatedValue;\n };\n\n Map.prototype.clear = function () {\n if (this.size === 0) {\n return this;\n }\n\n if (this.__ownerID) {\n this.size = 0;\n this._root = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return emptyMap();\n }; // @pragma Composition\n\n\n Map.prototype.merge = function\n /*...iters*/\n () {\n return mergeIntoMapWith(this, undefined, arguments);\n };\n\n Map.prototype.mergeWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, merger, iters);\n };\n\n Map.prototype.mergeIn = function (keyPath) {\n var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(keyPath, emptyMap(), function (m) {\n return typeof m.merge === 'function' ? m.merge.apply(m, iters) : iters[iters.length - 1];\n });\n };\n\n Map.prototype.mergeDeep = function\n /*...iters*/\n () {\n return mergeIntoMapWith(this, deepMerger, arguments);\n };\n\n Map.prototype.mergeDeepWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n };\n\n Map.prototype.mergeDeepIn = function (keyPath) {\n var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(keyPath, emptyMap(), function (m) {\n return typeof m.mergeDeep === 'function' ? m.mergeDeep.apply(m, iters) : iters[iters.length - 1];\n });\n };\n\n Map.prototype.sort = function (comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator));\n };\n\n Map.prototype.sortBy = function (mapper, comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator, mapper));\n }; // @pragma Mutability\n\n\n Map.prototype.withMutations = function (fn) {\n var mutable = this.asMutable();\n fn(mutable);\n return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n };\n\n Map.prototype.asMutable = function () {\n return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n };\n\n Map.prototype.asImmutable = function () {\n return this.__ensureOwner();\n };\n\n Map.prototype.wasAltered = function () {\n return this.__altered;\n };\n\n Map.prototype.__iterator = function (type, reverse) {\n return new MapIterator(this, type, reverse);\n };\n\n Map.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n var iterations = 0;\n this._root && this._root.iterate(function (entry) {\n iterations++;\n return fn(entry[1], entry[0], this$0);\n }, reverse);\n return iterations;\n };\n\n Map.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n\n return makeMap(this.size, this._root, ownerID, this.__hash);\n };\n\n function isMap(maybeMap) {\n return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n }\n\n Map.isMap = isMap;\n var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n var MapPrototype = Map.prototype;\n MapPrototype[IS_MAP_SENTINEL] = true;\n MapPrototype[DELETE] = MapPrototype.remove;\n MapPrototype.removeIn = MapPrototype.deleteIn; // #pragma Trie Nodes\n\n function ArrayMapNode(ownerID, entries) {\n this.ownerID = ownerID;\n this.entries = entries;\n }\n\n ArrayMapNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n\n return notSetValue;\n };\n\n ArrayMapNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var entries = this.entries;\n var idx = 0;\n\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && entries.length === 1) {\n return; // undefined\n }\n\n if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n return createNodes(ownerID, entries, key, value);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : newEntries[idx] = newEntries.pop();\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new ArrayMapNode(ownerID, newEntries);\n };\n\n function BitmapIndexedNode(ownerID, bitmap, nodes) {\n this.ownerID = ownerID;\n this.bitmap = bitmap;\n this.nodes = nodes;\n }\n\n BitmapIndexedNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK);\n var bitmap = this.bitmap;\n return (bitmap & bit) === 0 ? notSetValue : this.nodes[popCount(bitmap & bit - 1)].get(shift + SHIFT, keyHash, key, notSetValue);\n };\n\n BitmapIndexedNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var bit = 1 << keyHashFrag;\n var bitmap = this.bitmap;\n var exists = (bitmap & bit) !== 0;\n\n if (!exists && value === NOT_SET) {\n return this;\n }\n\n var idx = popCount(bitmap & bit - 1);\n var nodes = this.nodes;\n var node = exists ? nodes[idx] : undefined;\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n }\n\n if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n return nodes[idx ^ 1];\n }\n\n if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n return newNode;\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n var newNodes = exists ? newNode ? setIn(nodes, idx, newNode, isEditable) : spliceOut(nodes, idx, isEditable) : spliceIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.bitmap = newBitmap;\n this.nodes = newNodes;\n return this;\n }\n\n return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n };\n\n function HashArrayMapNode(ownerID, count, nodes) {\n this.ownerID = ownerID;\n this.count = count;\n this.nodes = nodes;\n }\n\n HashArrayMapNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var node = this.nodes[idx];\n return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n };\n\n HashArrayMapNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var removed = value === NOT_SET;\n var nodes = this.nodes;\n var node = nodes[idx];\n\n if (removed && !node) {\n return this;\n }\n\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n var newCount = this.count;\n\n if (!node) {\n newCount++;\n } else if (!newNode) {\n newCount--;\n\n if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n return packNodes(ownerID, nodes, newCount, idx);\n }\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.count = newCount;\n this.nodes = newNodes;\n return this;\n }\n\n return new HashArrayMapNode(ownerID, newCount, newNodes);\n };\n\n function HashCollisionNode(ownerID, keyHash, entries) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entries = entries;\n }\n\n HashCollisionNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n\n return notSetValue;\n };\n\n HashCollisionNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var removed = value === NOT_SET;\n\n if (keyHash !== this.keyHash) {\n if (removed) {\n return this;\n }\n\n SetRef(didAlter);\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n }\n\n var entries = this.entries;\n var idx = 0;\n\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && len === 2) {\n return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : newEntries[idx] = newEntries.pop();\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n };\n\n function ValueNode(ownerID, keyHash, entry) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entry = entry;\n }\n\n ValueNode.prototype.get = function (shift, keyHash, key, notSetValue) {\n return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n };\n\n ValueNode.prototype.update = function (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var keyMatch = is(key, this.entry[0]);\n\n if (keyMatch ? value === this.entry[1] : removed) {\n return this;\n }\n\n SetRef(didAlter);\n\n if (removed) {\n SetRef(didChangeSize);\n return; // undefined\n }\n\n if (keyMatch) {\n if (ownerID && ownerID === this.ownerID) {\n this.entry[1] = value;\n return this;\n }\n\n return new ValueNode(ownerID, this.keyHash, [key, value]);\n }\n\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n }; // #pragma Iterators\n\n\n ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function (fn, reverse) {\n var entries = this.entries;\n\n for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n return false;\n }\n }\n };\n\n BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n var nodes = this.nodes;\n\n for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n var node = nodes[reverse ? maxIndex - ii : ii];\n\n if (node && node.iterate(fn, reverse) === false) {\n return false;\n }\n }\n };\n\n ValueNode.prototype.iterate = function (fn, reverse) {\n return fn(this.entry);\n };\n\n createClass(MapIterator, Iterator);\n\n function MapIterator(map, type, reverse) {\n this._type = type;\n this._reverse = reverse;\n this._stack = map._root && mapIteratorFrame(map._root);\n }\n\n MapIterator.prototype.next = function () {\n var type = this._type;\n var stack = this._stack;\n\n while (stack) {\n var node = stack.node;\n var index = stack.index++;\n var maxIndex;\n\n if (node.entry) {\n if (index === 0) {\n return mapIteratorValue(type, node.entry);\n }\n } else if (node.entries) {\n maxIndex = node.entries.length - 1;\n\n if (index <= maxIndex) {\n return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n }\n } else {\n maxIndex = node.nodes.length - 1;\n\n if (index <= maxIndex) {\n var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n\n if (subNode) {\n if (subNode.entry) {\n return mapIteratorValue(type, subNode.entry);\n }\n\n stack = this._stack = mapIteratorFrame(subNode, stack);\n }\n\n continue;\n }\n }\n\n stack = this._stack = this._stack.__prev;\n }\n\n return iteratorDone();\n };\n\n function mapIteratorValue(type, entry) {\n return iteratorValue(type, entry[0], entry[1]);\n }\n\n function mapIteratorFrame(node, prev) {\n return {\n node: node,\n index: 0,\n __prev: prev\n };\n }\n\n function makeMap(size, root, ownerID, hash) {\n var map = Object.create(MapPrototype);\n map.size = size;\n map._root = root;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_MAP;\n\n function emptyMap() {\n return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n }\n\n function updateMap(map, k, v) {\n var newRoot;\n var newSize;\n\n if (!map._root) {\n if (v === NOT_SET) {\n return map;\n }\n\n newSize = 1;\n newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n } else {\n var didChangeSize = MakeRef(CHANGE_LENGTH);\n var didAlter = MakeRef(DID_ALTER);\n newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n\n if (!didAlter.value) {\n return map;\n }\n\n newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n }\n\n if (map.__ownerID) {\n map.size = newSize;\n map._root = newRoot;\n map.__hash = undefined;\n map.__altered = true;\n return map;\n }\n\n return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n }\n\n function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (!node) {\n if (value === NOT_SET) {\n return node;\n }\n\n SetRef(didAlter);\n SetRef(didChangeSize);\n return new ValueNode(ownerID, keyHash, [key, value]);\n }\n\n return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n }\n\n function isLeafNode(node) {\n return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n }\n\n function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n if (node.keyHash === keyHash) {\n return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n }\n\n var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var newNode;\n var nodes = idx1 === idx2 ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : (newNode = new ValueNode(ownerID, keyHash, entry), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n return new BitmapIndexedNode(ownerID, 1 << idx1 | 1 << idx2, nodes);\n }\n\n function createNodes(ownerID, entries, key, value) {\n if (!ownerID) {\n ownerID = new OwnerID();\n }\n\n var node = new ValueNode(ownerID, hash(key), [key, value]);\n\n for (var ii = 0; ii < entries.length; ii++) {\n var entry = entries[ii];\n node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n }\n\n return node;\n }\n\n function packNodes(ownerID, nodes, count, excluding) {\n var bitmap = 0;\n var packedII = 0;\n var packedNodes = new Array(count);\n\n for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n var node = nodes[ii];\n\n if (node !== undefined && ii !== excluding) {\n bitmap |= bit;\n packedNodes[packedII++] = node;\n }\n }\n\n return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n }\n\n function expandNodes(ownerID, nodes, bitmap, including, node) {\n var count = 0;\n var expandedNodes = new Array(SIZE);\n\n for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n }\n\n expandedNodes[including] = node;\n return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n }\n\n function mergeIntoMapWith(map, merger, iterables) {\n var iters = [];\n\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = KeyedIterable(value);\n\n if (!isIterable(value)) {\n iter = iter.map(function (v) {\n return fromJS(v);\n });\n }\n\n iters.push(iter);\n }\n\n return mergeIntoCollectionWith(map, merger, iters);\n }\n\n function deepMerger(existing, value, key) {\n return existing && existing.mergeDeep && isIterable(value) ? existing.mergeDeep(value) : is(existing, value) ? existing : value;\n }\n\n function deepMergerWith(merger) {\n return function (existing, value, key) {\n if (existing && existing.mergeDeepWith && isIterable(value)) {\n return existing.mergeDeepWith(merger, value);\n }\n\n var nextValue = merger(existing, value, key);\n return is(existing, nextValue) ? existing : nextValue;\n };\n }\n\n function mergeIntoCollectionWith(collection, merger, iters) {\n iters = iters.filter(function (x) {\n return x.size !== 0;\n });\n\n if (iters.length === 0) {\n return collection;\n }\n\n if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n return collection.constructor(iters[0]);\n }\n\n return collection.withMutations(function (collection) {\n var mergeIntoMap = merger ? function (value, key) {\n collection.update(key, NOT_SET, function (existing) {\n return existing === NOT_SET ? value : merger(existing, value, key);\n });\n } : function (value, key) {\n collection.set(key, value);\n };\n\n for (var ii = 0; ii < iters.length; ii++) {\n iters[ii].forEach(mergeIntoMap);\n }\n });\n }\n\n function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n var isNotSet = existing === NOT_SET;\n var step = keyPathIter.next();\n\n if (step.done) {\n var existingValue = isNotSet ? notSetValue : existing;\n var newValue = updater(existingValue);\n return newValue === existingValue ? existing : newValue;\n }\n\n invariant(isNotSet || existing && existing.set, 'invalid keyPath');\n var key = step.value;\n var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n var nextUpdated = updateInDeepMap(nextExisting, keyPathIter, notSetValue, updater);\n return nextUpdated === nextExisting ? existing : nextUpdated === NOT_SET ? existing.remove(key) : (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n }\n\n function popCount(x) {\n x = x - (x >> 1 & 0x55555555);\n x = (x & 0x33333333) + (x >> 2 & 0x33333333);\n x = x + (x >> 4) & 0x0f0f0f0f;\n x = x + (x >> 8);\n x = x + (x >> 16);\n return x & 0x7f;\n }\n\n function setIn(array, idx, val, canEdit) {\n var newArray = canEdit ? array : arrCopy(array);\n newArray[idx] = val;\n return newArray;\n }\n\n function spliceIn(array, idx, val, canEdit) {\n var newLen = array.length + 1;\n\n if (canEdit && idx + 1 === newLen) {\n array[idx] = val;\n return array;\n }\n\n var newArray = new Array(newLen);\n var after = 0;\n\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n newArray[ii] = val;\n after = -1;\n } else {\n newArray[ii] = array[ii + after];\n }\n }\n\n return newArray;\n }\n\n function spliceOut(array, idx, canEdit) {\n var newLen = array.length - 1;\n\n if (canEdit && idx === newLen) {\n array.pop();\n return array;\n }\n\n var newArray = new Array(newLen);\n var after = 0;\n\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n after = 1;\n }\n\n newArray[ii] = array[ii + after];\n }\n\n return newArray;\n }\n\n var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n createClass(List, IndexedCollection); // @pragma Construction\n\n function List(value) {\n var empty = emptyList();\n\n if (value === null || value === undefined) {\n return empty;\n }\n\n if (isList(value)) {\n return value;\n }\n\n var iter = IndexedIterable(value);\n var size = iter.size;\n\n if (size === 0) {\n return empty;\n }\n\n assertNotInfinite(size);\n\n if (size > 0 && size < SIZE) {\n return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n }\n\n return empty.withMutations(function (list) {\n list.setSize(size);\n iter.forEach(function (v, i) {\n return list.set(i, v);\n });\n });\n }\n\n List.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n List.prototype.toString = function () {\n return this.__toString('List [', ']');\n }; // @pragma Access\n\n\n List.prototype.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n\n if (index >= 0 && index < this.size) {\n index += this._origin;\n var node = listNodeFor(this, index);\n return node && node.array[index & MASK];\n }\n\n return notSetValue;\n }; // @pragma Modification\n\n\n List.prototype.set = function (index, value) {\n return updateList(this, index, value);\n };\n\n List.prototype.remove = function (index) {\n return !this.has(index) ? this : index === 0 ? this.shift() : index === this.size - 1 ? this.pop() : this.splice(index, 1);\n };\n\n List.prototype.insert = function (index, value) {\n return this.splice(index, 0, value);\n };\n\n List.prototype.clear = function () {\n if (this.size === 0) {\n return this;\n }\n\n if (this.__ownerID) {\n this.size = this._origin = this._capacity = 0;\n this._level = SHIFT;\n this._root = this._tail = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return emptyList();\n };\n\n List.prototype.push = function\n /*...values*/\n () {\n var values = arguments;\n var oldSize = this.size;\n return this.withMutations(function (list) {\n setListBounds(list, 0, oldSize + values.length);\n\n for (var ii = 0; ii < values.length; ii++) {\n list.set(oldSize + ii, values[ii]);\n }\n });\n };\n\n List.prototype.pop = function () {\n return setListBounds(this, 0, -1);\n };\n\n List.prototype.unshift = function\n /*...values*/\n () {\n var values = arguments;\n return this.withMutations(function (list) {\n setListBounds(list, -values.length);\n\n for (var ii = 0; ii < values.length; ii++) {\n list.set(ii, values[ii]);\n }\n });\n };\n\n List.prototype.shift = function () {\n return setListBounds(this, 1);\n }; // @pragma Composition\n\n\n List.prototype.merge = function\n /*...iters*/\n () {\n return mergeIntoListWith(this, undefined, arguments);\n };\n\n List.prototype.mergeWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, merger, iters);\n };\n\n List.prototype.mergeDeep = function\n /*...iters*/\n () {\n return mergeIntoListWith(this, deepMerger, arguments);\n };\n\n List.prototype.mergeDeepWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, deepMergerWith(merger), iters);\n };\n\n List.prototype.setSize = function (size) {\n return setListBounds(this, 0, size);\n }; // @pragma Iteration\n\n\n List.prototype.slice = function (begin, end) {\n var size = this.size;\n\n if (wholeSlice(begin, end, size)) {\n return this;\n }\n\n return setListBounds(this, resolveBegin(begin, size), resolveEnd(end, size));\n };\n\n List.prototype.__iterator = function (type, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n return new Iterator(function () {\n var value = values();\n return value === DONE ? iteratorDone() : iteratorValue(type, index++, value);\n });\n };\n\n List.prototype.__iterate = function (fn, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n var value;\n\n while ((value = values()) !== DONE) {\n if (fn(value, index++, this) === false) {\n break;\n }\n }\n\n return index;\n };\n\n List.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n return this;\n }\n\n return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n };\n\n function isList(maybeList) {\n return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n }\n\n List.isList = isList;\n var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n var ListPrototype = List.prototype;\n ListPrototype[IS_LIST_SENTINEL] = true;\n ListPrototype[DELETE] = ListPrototype.remove;\n ListPrototype.setIn = MapPrototype.setIn;\n ListPrototype.deleteIn = ListPrototype.removeIn = MapPrototype.removeIn;\n ListPrototype.update = MapPrototype.update;\n ListPrototype.updateIn = MapPrototype.updateIn;\n ListPrototype.mergeIn = MapPrototype.mergeIn;\n ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n ListPrototype.withMutations = MapPrototype.withMutations;\n ListPrototype.asMutable = MapPrototype.asMutable;\n ListPrototype.asImmutable = MapPrototype.asImmutable;\n ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n function VNode(array, ownerID) {\n this.array = array;\n this.ownerID = ownerID;\n } // TODO: seems like these methods are very similar\n\n\n VNode.prototype.removeBefore = function (ownerID, level, index) {\n if (index === level ? 1 << level : 0 || this.array.length === 0) {\n return this;\n }\n\n var originIndex = index >>> level & MASK;\n\n if (originIndex >= this.array.length) {\n return new VNode([], ownerID);\n }\n\n var removingFirst = originIndex === 0;\n var newChild;\n\n if (level > 0) {\n var oldChild = this.array[originIndex];\n newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n\n if (newChild === oldChild && removingFirst) {\n return this;\n }\n }\n\n if (removingFirst && !newChild) {\n return this;\n }\n\n var editable = editableVNode(this, ownerID);\n\n if (!removingFirst) {\n for (var ii = 0; ii < originIndex; ii++) {\n editable.array[ii] = undefined;\n }\n }\n\n if (newChild) {\n editable.array[originIndex] = newChild;\n }\n\n return editable;\n };\n\n VNode.prototype.removeAfter = function (ownerID, level, index) {\n if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n return this;\n }\n\n var sizeIndex = index - 1 >>> level & MASK;\n\n if (sizeIndex >= this.array.length) {\n return this;\n }\n\n var newChild;\n\n if (level > 0) {\n var oldChild = this.array[sizeIndex];\n newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n\n if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n return this;\n }\n }\n\n var editable = editableVNode(this, ownerID);\n editable.array.splice(sizeIndex + 1);\n\n if (newChild) {\n editable.array[sizeIndex] = newChild;\n }\n\n return editable;\n };\n\n var DONE = {};\n\n function iterateList(list, reverse) {\n var left = list._origin;\n var right = list._capacity;\n var tailPos = getTailOffset(right);\n var tail = list._tail;\n return iterateNodeOrLeaf(list._root, list._level, 0);\n\n function iterateNodeOrLeaf(node, level, offset) {\n return level === 0 ? iterateLeaf(node, offset) : iterateNode(node, level, offset);\n }\n\n function iterateLeaf(node, offset) {\n var array = offset === tailPos ? tail && tail.array : node && node.array;\n var from = offset > left ? 0 : left - offset;\n var to = right - offset;\n\n if (to > SIZE) {\n to = SIZE;\n }\n\n return function () {\n if (from === to) {\n return DONE;\n }\n\n var idx = reverse ? --to : from++;\n return array && array[idx];\n };\n }\n\n function iterateNode(node, level, offset) {\n var values;\n var array = node && node.array;\n var from = offset > left ? 0 : left - offset >> level;\n var to = (right - offset >> level) + 1;\n\n if (to > SIZE) {\n to = SIZE;\n }\n\n return function () {\n do {\n if (values) {\n var value = values();\n\n if (value !== DONE) {\n return value;\n }\n\n values = null;\n }\n\n if (from === to) {\n return DONE;\n }\n\n var idx = reverse ? --to : from++;\n values = iterateNodeOrLeaf(array && array[idx], level - SHIFT, offset + (idx << level));\n } while (true);\n };\n }\n }\n\n function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n var list = Object.create(ListPrototype);\n list.size = capacity - origin;\n list._origin = origin;\n list._capacity = capacity;\n list._level = level;\n list._root = root;\n list._tail = tail;\n list.__ownerID = ownerID;\n list.__hash = hash;\n list.__altered = false;\n return list;\n }\n\n var EMPTY_LIST;\n\n function emptyList() {\n return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n }\n\n function updateList(list, index, value) {\n index = wrapIndex(list, index);\n\n if (index !== index) {\n return list;\n }\n\n if (index >= list.size || index < 0) {\n return list.withMutations(function (list) {\n index < 0 ? setListBounds(list, index).set(0, value) : setListBounds(list, 0, index + 1).set(index, value);\n });\n }\n\n index += list._origin;\n var newTail = list._tail;\n var newRoot = list._root;\n var didAlter = MakeRef(DID_ALTER);\n\n if (index >= getTailOffset(list._capacity)) {\n newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n } else {\n newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n }\n\n if (!didAlter.value) {\n return list;\n }\n\n if (list.__ownerID) {\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n\n return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n }\n\n function updateVNode(node, ownerID, level, index, value, didAlter) {\n var idx = index >>> level & MASK;\n var nodeHas = node && idx < node.array.length;\n\n if (!nodeHas && value === undefined) {\n return node;\n }\n\n var newNode;\n\n if (level > 0) {\n var lowerNode = node && node.array[idx];\n var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n\n if (newLowerNode === lowerNode) {\n return node;\n }\n\n newNode = editableVNode(node, ownerID);\n newNode.array[idx] = newLowerNode;\n return newNode;\n }\n\n if (nodeHas && node.array[idx] === value) {\n return node;\n }\n\n SetRef(didAlter);\n newNode = editableVNode(node, ownerID);\n\n if (value === undefined && idx === newNode.array.length - 1) {\n newNode.array.pop();\n } else {\n newNode.array[idx] = value;\n }\n\n return newNode;\n }\n\n function editableVNode(node, ownerID) {\n if (ownerID && node && ownerID === node.ownerID) {\n return node;\n }\n\n return new VNode(node ? node.array.slice() : [], ownerID);\n }\n\n function listNodeFor(list, rawIndex) {\n if (rawIndex >= getTailOffset(list._capacity)) {\n return list._tail;\n }\n\n if (rawIndex < 1 << list._level + SHIFT) {\n var node = list._root;\n var level = list._level;\n\n while (node && level > 0) {\n node = node.array[rawIndex >>> level & MASK];\n level -= SHIFT;\n }\n\n return node;\n }\n }\n\n function setListBounds(list, begin, end) {\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n\n if (end !== undefined) {\n end = end | 0;\n }\n\n var owner = list.__ownerID || new OwnerID();\n var oldOrigin = list._origin;\n var oldCapacity = list._capacity;\n var newOrigin = oldOrigin + begin;\n var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n\n if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n return list;\n } // If it's going to end after it starts, it's empty.\n\n\n if (newOrigin >= newCapacity) {\n return list.clear();\n }\n\n var newLevel = list._level;\n var newRoot = list._root; // New origin might need creating a higher root.\n\n var offsetShift = 0;\n\n while (newOrigin + offsetShift < 0) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n newLevel += SHIFT;\n offsetShift += 1 << newLevel;\n }\n\n if (offsetShift) {\n newOrigin += offsetShift;\n oldOrigin += offsetShift;\n newCapacity += offsetShift;\n oldCapacity += offsetShift;\n }\n\n var oldTailOffset = getTailOffset(oldCapacity);\n var newTailOffset = getTailOffset(newCapacity); // New size might need creating a higher root.\n\n while (newTailOffset >= 1 << newLevel + SHIFT) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n newLevel += SHIFT;\n } // Locate or create the new tail.\n\n\n var oldTail = list._tail;\n var newTail = newTailOffset < oldTailOffset ? listNodeFor(list, newCapacity - 1) : newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail; // Merge Tail into tree.\n\n if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n newRoot = editableVNode(newRoot, owner);\n var node = newRoot;\n\n for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n var idx = oldTailOffset >>> level & MASK;\n node = node.array[idx] = editableVNode(node.array[idx], owner);\n }\n\n node.array[oldTailOffset >>> SHIFT & MASK] = oldTail;\n } // If the size has been reduced, there's a chance the tail needs to be trimmed.\n\n\n if (newCapacity < oldCapacity) {\n newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n } // If the new origin is within the tail, then we do not need a root.\n\n\n if (newOrigin >= newTailOffset) {\n newOrigin -= newTailOffset;\n newCapacity -= newTailOffset;\n newLevel = SHIFT;\n newRoot = null;\n newTail = newTail && newTail.removeBefore(owner, 0, newOrigin); // Otherwise, if the root has been trimmed, garbage collect.\n } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n offsetShift = 0; // Identify the new top root node of the subtree of the old root.\n\n while (newRoot) {\n var beginIndex = newOrigin >>> newLevel & MASK;\n\n if (beginIndex !== newTailOffset >>> newLevel & MASK) {\n break;\n }\n\n if (beginIndex) {\n offsetShift += (1 << newLevel) * beginIndex;\n }\n\n newLevel -= SHIFT;\n newRoot = newRoot.array[beginIndex];\n } // Trim the new sides of the new root.\n\n\n if (newRoot && newOrigin > oldOrigin) {\n newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n }\n\n if (newRoot && newTailOffset < oldTailOffset) {\n newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n }\n\n if (offsetShift) {\n newOrigin -= offsetShift;\n newCapacity -= offsetShift;\n }\n }\n\n if (list.__ownerID) {\n list.size = newCapacity - newOrigin;\n list._origin = newOrigin;\n list._capacity = newCapacity;\n list._level = newLevel;\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n\n return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n }\n\n function mergeIntoListWith(list, merger, iterables) {\n var iters = [];\n var maxSize = 0;\n\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = IndexedIterable(value);\n\n if (iter.size > maxSize) {\n maxSize = iter.size;\n }\n\n if (!isIterable(value)) {\n iter = iter.map(function (v) {\n return fromJS(v);\n });\n }\n\n iters.push(iter);\n }\n\n if (maxSize > list.size) {\n list = list.setSize(maxSize);\n }\n\n return mergeIntoCollectionWith(list, merger, iters);\n }\n\n function getTailOffset(size) {\n return size < SIZE ? 0 : size - 1 >>> SHIFT << SHIFT;\n }\n\n createClass(OrderedMap, Map); // @pragma Construction\n\n function OrderedMap(value) {\n return value === null || value === undefined ? emptyOrderedMap() : isOrderedMap(value) ? value : emptyOrderedMap().withMutations(function (map) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v, k) {\n return map.set(k, v);\n });\n });\n }\n\n OrderedMap.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n OrderedMap.prototype.toString = function () {\n return this.__toString('OrderedMap {', '}');\n }; // @pragma Access\n\n\n OrderedMap.prototype.get = function (k, notSetValue) {\n var index = this._map.get(k);\n\n return index !== undefined ? this._list.get(index)[1] : notSetValue;\n }; // @pragma Modification\n\n\n OrderedMap.prototype.clear = function () {\n if (this.size === 0) {\n return this;\n }\n\n if (this.__ownerID) {\n this.size = 0;\n\n this._map.clear();\n\n this._list.clear();\n\n return this;\n }\n\n return emptyOrderedMap();\n };\n\n OrderedMap.prototype.set = function (k, v) {\n return updateOrderedMap(this, k, v);\n };\n\n OrderedMap.prototype.remove = function (k) {\n return updateOrderedMap(this, k, NOT_SET);\n };\n\n OrderedMap.prototype.wasAltered = function () {\n return this._map.wasAltered() || this._list.wasAltered();\n };\n\n OrderedMap.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return this._list.__iterate(function (entry) {\n return entry && fn(entry[1], entry[0], this$0);\n }, reverse);\n };\n\n OrderedMap.prototype.__iterator = function (type, reverse) {\n return this._list.fromEntrySeq().__iterator(type, reverse);\n };\n\n OrderedMap.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n var newMap = this._map.__ensureOwner(ownerID);\n\n var newList = this._list.__ensureOwner(ownerID);\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n this._list = newList;\n return this;\n }\n\n return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n };\n\n function isOrderedMap(maybeOrderedMap) {\n return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n }\n\n OrderedMap.isOrderedMap = isOrderedMap;\n OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n function makeOrderedMap(map, list, ownerID, hash) {\n var omap = Object.create(OrderedMap.prototype);\n omap.size = map ? map.size : 0;\n omap._map = map;\n omap._list = list;\n omap.__ownerID = ownerID;\n omap.__hash = hash;\n return omap;\n }\n\n var EMPTY_ORDERED_MAP;\n\n function emptyOrderedMap() {\n return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n }\n\n function updateOrderedMap(omap, k, v) {\n var map = omap._map;\n var list = omap._list;\n var i = map.get(k);\n var has = i !== undefined;\n var newMap;\n var newList;\n\n if (v === NOT_SET) {\n // removed\n if (!has) {\n return omap;\n }\n\n if (list.size >= SIZE && list.size >= map.size * 2) {\n newList = list.filter(function (entry, idx) {\n return entry !== undefined && i !== idx;\n });\n newMap = newList.toKeyedSeq().map(function (entry) {\n return entry[0];\n }).flip().toMap();\n\n if (omap.__ownerID) {\n newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n }\n } else {\n newMap = map.remove(k);\n newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n }\n } else {\n if (has) {\n if (v === list.get(i)[1]) {\n return omap;\n }\n\n newMap = map;\n newList = list.set(i, [k, v]);\n } else {\n newMap = map.set(k, list.size);\n newList = list.set(list.size, [k, v]);\n }\n }\n\n if (omap.__ownerID) {\n omap.size = newMap.size;\n omap._map = newMap;\n omap._list = newList;\n omap.__hash = undefined;\n return omap;\n }\n\n return makeOrderedMap(newMap, newList);\n }\n\n createClass(ToKeyedSequence, KeyedSeq);\n\n function ToKeyedSequence(indexed, useKeys) {\n this._iter = indexed;\n this._useKeys = useKeys;\n this.size = indexed.size;\n }\n\n ToKeyedSequence.prototype.get = function (key, notSetValue) {\n return this._iter.get(key, notSetValue);\n };\n\n ToKeyedSequence.prototype.has = function (key) {\n return this._iter.has(key);\n };\n\n ToKeyedSequence.prototype.valueSeq = function () {\n return this._iter.valueSeq();\n };\n\n ToKeyedSequence.prototype.reverse = function () {\n var this$0 = this;\n var reversedSequence = reverseFactory(this, true);\n\n if (!this._useKeys) {\n reversedSequence.valueSeq = function () {\n return this$0._iter.toSeq().reverse();\n };\n }\n\n return reversedSequence;\n };\n\n ToKeyedSequence.prototype.map = function (mapper, context) {\n var this$0 = this;\n var mappedSequence = mapFactory(this, mapper, context);\n\n if (!this._useKeys) {\n mappedSequence.valueSeq = function () {\n return this$0._iter.toSeq().map(mapper, context);\n };\n }\n\n return mappedSequence;\n };\n\n ToKeyedSequence.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n var ii;\n return this._iter.__iterate(this._useKeys ? function (v, k) {\n return fn(v, k, this$0);\n } : (ii = reverse ? resolveSize(this) : 0, function (v) {\n return fn(v, reverse ? --ii : ii++, this$0);\n }), reverse);\n };\n\n ToKeyedSequence.prototype.__iterator = function (type, reverse) {\n if (this._useKeys) {\n return this._iter.__iterator(type, reverse);\n }\n\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\n var ii = reverse ? resolveSize(this) : 0;\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n });\n };\n\n ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n createClass(ToIndexedSequence, IndexedSeq);\n\n function ToIndexedSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToIndexedSequence.prototype.includes = function (value) {\n return this._iter.includes(value);\n };\n\n ToIndexedSequence.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n var iterations = 0;\n return this._iter.__iterate(function (v) {\n return fn(v, iterations++, this$0);\n }, reverse);\n };\n\n ToIndexedSequence.prototype.__iterator = function (type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\n var iterations = 0;\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value, step);\n });\n };\n\n createClass(ToSetSequence, SetSeq);\n\n function ToSetSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToSetSequence.prototype.has = function (key) {\n return this._iter.includes(key);\n };\n\n ToSetSequence.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return this._iter.__iterate(function (v) {\n return fn(v, v, this$0);\n }, reverse);\n };\n\n ToSetSequence.prototype.__iterator = function (type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, step.value, step.value, step);\n });\n };\n\n createClass(FromEntriesSequence, KeyedSeq);\n\n function FromEntriesSequence(entries) {\n this._iter = entries;\n this.size = entries.size;\n }\n\n FromEntriesSequence.prototype.entrySeq = function () {\n return this._iter.toSeq();\n };\n\n FromEntriesSequence.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return this._iter.__iterate(function (entry) {\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return fn(indexedIterable ? entry.get(1) : entry[1], indexedIterable ? entry.get(0) : entry[0], this$0);\n }\n }, reverse);\n };\n\n FromEntriesSequence.prototype.__iterator = function (type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\n return new Iterator(function () {\n while (true) {\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n var entry = step.value; // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return iteratorValue(type, indexedIterable ? entry.get(0) : entry[0], indexedIterable ? entry.get(1) : entry[1], step);\n }\n }\n });\n };\n\n ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;\n\n function flipFactory(iterable) {\n var flipSequence = makeSequence(iterable);\n flipSequence._iter = iterable;\n flipSequence.size = iterable.size;\n\n flipSequence.flip = function () {\n return iterable;\n };\n\n flipSequence.reverse = function () {\n var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n\n reversedSequence.flip = function () {\n return iterable.reverse();\n };\n\n return reversedSequence;\n };\n\n flipSequence.has = function (key) {\n return iterable.includes(key);\n };\n\n flipSequence.includes = function (key) {\n return iterable.has(key);\n };\n\n flipSequence.cacheResult = cacheResultThrough;\n\n flipSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n return iterable.__iterate(function (v, k) {\n return fn(k, v, this$0) !== false;\n }, reverse);\n };\n\n flipSequence.__iteratorUncached = function (type, reverse) {\n if (type === ITERATE_ENTRIES) {\n var iterator = iterable.__iterator(type, reverse);\n\n return new Iterator(function () {\n var step = iterator.next();\n\n if (!step.done) {\n var k = step.value[0];\n step.value[0] = step.value[1];\n step.value[1] = k;\n }\n\n return step;\n });\n }\n\n return iterable.__iterator(type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, reverse);\n };\n\n return flipSequence;\n }\n\n function mapFactory(iterable, mapper, context) {\n var mappedSequence = makeSequence(iterable);\n mappedSequence.size = iterable.size;\n\n mappedSequence.has = function (key) {\n return iterable.has(key);\n };\n\n mappedSequence.get = function (key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v === NOT_SET ? notSetValue : mapper.call(context, v, key, iterable);\n };\n\n mappedSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n return iterable.__iterate(function (v, k, c) {\n return fn(mapper.call(context, v, k, c), k, this$0) !== false;\n }, reverse);\n };\n\n mappedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\n return new Iterator(function () {\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n var entry = step.value;\n var key = entry[0];\n return iteratorValue(type, key, mapper.call(context, entry[1], key, iterable), step);\n });\n };\n\n return mappedSequence;\n }\n\n function reverseFactory(iterable, useKeys) {\n var reversedSequence = makeSequence(iterable);\n reversedSequence._iter = iterable;\n reversedSequence.size = iterable.size;\n\n reversedSequence.reverse = function () {\n return iterable;\n };\n\n if (iterable.flip) {\n reversedSequence.flip = function () {\n var flipSequence = flipFactory(iterable);\n\n flipSequence.reverse = function () {\n return iterable.flip();\n };\n\n return flipSequence;\n };\n }\n\n reversedSequence.get = function (key, notSetValue) {\n return iterable.get(useKeys ? key : -1 - key, notSetValue);\n };\n\n reversedSequence.has = function (key) {\n return iterable.has(useKeys ? key : -1 - key);\n };\n\n reversedSequence.includes = function (value) {\n return iterable.includes(value);\n };\n\n reversedSequence.cacheResult = cacheResultThrough;\n\n reversedSequence.__iterate = function (fn, reverse) {\n var this$0 = this;\n return iterable.__iterate(function (v, k) {\n return fn(v, k, this$0);\n }, !reverse);\n };\n\n reversedSequence.__iterator = function (type, reverse) {\n return iterable.__iterator(type, !reverse);\n };\n\n return reversedSequence;\n }\n\n function filterFactory(iterable, predicate, context, useKeys) {\n var filterSequence = makeSequence(iterable);\n\n if (useKeys) {\n filterSequence.has = function (key) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n };\n\n filterSequence.get = function (key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && predicate.call(context, v, key, iterable) ? v : notSetValue;\n };\n }\n\n filterSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n var iterations = 0;\n\n iterable.__iterate(function (v, k, c) {\n if (predicate.call(context, v, k, c)) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n }, reverse);\n\n return iterations;\n };\n\n filterSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\n var iterations = 0;\n return new Iterator(function () {\n while (true) {\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n var entry = step.value;\n var key = entry[0];\n var value = entry[1];\n\n if (predicate.call(context, value, key, iterable)) {\n return iteratorValue(type, useKeys ? key : iterations++, value, step);\n }\n }\n });\n };\n\n return filterSequence;\n }\n\n function countByFactory(iterable, grouper, context) {\n var groups = Map().asMutable();\n\n iterable.__iterate(function (v, k) {\n groups.update(grouper.call(context, v, k, iterable), 0, function (a) {\n return a + 1;\n });\n });\n\n return groups.asImmutable();\n }\n\n function groupByFactory(iterable, grouper, context) {\n var isKeyedIter = isKeyed(iterable);\n var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n\n iterable.__iterate(function (v, k) {\n groups.update(grouper.call(context, v, k, iterable), function (a) {\n return a = a || [], a.push(isKeyedIter ? [k, v] : v), a;\n });\n });\n\n var coerce = iterableClass(iterable);\n return groups.map(function (arr) {\n return reify(iterable, coerce(arr));\n });\n }\n\n function sliceFactory(iterable, begin, end, useKeys) {\n var originalSize = iterable.size; // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n\n if (begin !== undefined) {\n begin = begin | 0;\n }\n\n if (end !== undefined) {\n if (end === Infinity) {\n end = originalSize;\n } else {\n end = end | 0;\n }\n }\n\n if (wholeSlice(begin, end, originalSize)) {\n return iterable;\n }\n\n var resolvedBegin = resolveBegin(begin, originalSize);\n var resolvedEnd = resolveEnd(end, originalSize); // begin or end will be NaN if they were provided as negative numbers and\n // this iterable's size is unknown. In that case, cache first so there is\n // a known size and these do not resolve to NaN.\n\n if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n } // Note: resolvedEnd is undefined when the original sequence's length is\n // unknown and this slice did not supply an end and should contain all\n // elements after resolvedBegin.\n // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n\n\n var resolvedSize = resolvedEnd - resolvedBegin;\n var sliceSize;\n\n if (resolvedSize === resolvedSize) {\n sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n }\n\n var sliceSeq = makeSequence(iterable); // If iterable.size is undefined, the size of the realized sliceSeq is\n // unknown at this point unless the number of items to slice is 0\n\n sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n sliceSeq.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n return index >= 0 && index < sliceSize ? iterable.get(index + resolvedBegin, notSetValue) : notSetValue;\n };\n }\n\n sliceSeq.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n\n if (sliceSize === 0) {\n return 0;\n }\n\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var skipped = 0;\n var isSkipping = true;\n var iterations = 0;\n\n iterable.__iterate(function (v, k) {\n if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0) !== false && iterations !== sliceSize;\n }\n });\n\n return iterations;\n };\n\n sliceSeq.__iteratorUncached = function (type, reverse) {\n if (sliceSize !== 0 && reverse) {\n return this.cacheResult().__iterator(type, reverse);\n } // Don't bother instantiating parent iterator if taking 0.\n\n\n var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n\n var skipped = 0;\n var iterations = 0;\n return new Iterator(function () {\n while (skipped++ < resolvedBegin) {\n iterator.next();\n }\n\n if (++iterations > sliceSize) {\n return iteratorDone();\n }\n\n var step = iterator.next();\n\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations - 1, undefined, step);\n } else {\n return iteratorValue(type, iterations - 1, step.value[1], step);\n }\n });\n };\n\n return sliceSeq;\n }\n\n function takeWhileFactory(iterable, predicate, context) {\n var takeSequence = makeSequence(iterable);\n\n takeSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var iterations = 0;\n\n iterable.__iterate(function (v, k, c) {\n return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0);\n });\n\n return iterations;\n };\n\n takeSequence.__iteratorUncached = function (type, reverse) {\n var this$0 = this;\n\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\n var iterating = true;\n return new Iterator(function () {\n if (!iterating) {\n return iteratorDone();\n }\n\n var step = iterator.next();\n\n if (step.done) {\n return step;\n }\n\n var entry = step.value;\n var k = entry[0];\n var v = entry[1];\n\n if (!predicate.call(context, v, k, this$0)) {\n iterating = false;\n return iteratorDone();\n }\n\n return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);\n });\n };\n\n return takeSequence;\n }\n\n function skipWhileFactory(iterable, predicate, context, useKeys) {\n var skipSequence = makeSequence(iterable);\n\n skipSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n\n var isSkipping = true;\n var iterations = 0;\n\n iterable.__iterate(function (v, k, c) {\n if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n });\n\n return iterations;\n };\n\n skipSequence.__iteratorUncached = function (type, reverse) {\n var this$0 = this;\n\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\n var skipping = true;\n var iterations = 0;\n return new Iterator(function () {\n var step, k, v;\n\n do {\n step = iterator.next();\n\n if (step.done) {\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations++, undefined, step);\n } else {\n return iteratorValue(type, iterations++, step.value[1], step);\n }\n }\n\n var entry = step.value;\n k = entry[0];\n v = entry[1];\n skipping && (skipping = predicate.call(context, v, k, this$0));\n } while (skipping);\n\n return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);\n });\n };\n\n return skipSequence;\n }\n\n function concatFactory(iterable, values) {\n var isKeyedIterable = isKeyed(iterable);\n var iters = [iterable].concat(values).map(function (v) {\n if (!isIterable(v)) {\n v = isKeyedIterable ? keyedSeqFromValue(v) : indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n } else if (isKeyedIterable) {\n v = KeyedIterable(v);\n }\n\n return v;\n }).filter(function (v) {\n return v.size !== 0;\n });\n\n if (iters.length === 0) {\n return iterable;\n }\n\n if (iters.length === 1) {\n var singleton = iters[0];\n\n if (singleton === iterable || isKeyedIterable && isKeyed(singleton) || isIndexed(iterable) && isIndexed(singleton)) {\n return singleton;\n }\n }\n\n var concatSeq = new ArraySeq(iters);\n\n if (isKeyedIterable) {\n concatSeq = concatSeq.toKeyedSeq();\n } else if (!isIndexed(iterable)) {\n concatSeq = concatSeq.toSetSeq();\n }\n\n concatSeq = concatSeq.flatten(true);\n concatSeq.size = iters.reduce(function (sum, seq) {\n if (sum !== undefined) {\n var size = seq.size;\n\n if (size !== undefined) {\n return sum + size;\n }\n }\n }, 0);\n return concatSeq;\n }\n\n function flattenFactory(iterable, depth, useKeys) {\n var flatSequence = makeSequence(iterable);\n\n flatSequence.__iterateUncached = function (fn, reverse) {\n var iterations = 0;\n var stopped = false;\n\n function flatDeep(iter, currentDepth) {\n var this$0 = this;\n\n iter.__iterate(function (v, k) {\n if ((!depth || currentDepth < depth) && isIterable(v)) {\n flatDeep(v, currentDepth + 1);\n } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n stopped = true;\n }\n\n return !stopped;\n }, reverse);\n }\n\n flatDeep(iterable, 0);\n return iterations;\n };\n\n flatSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(type, reverse);\n\n var stack = [];\n var iterations = 0;\n return new Iterator(function () {\n while (iterator) {\n var step = iterator.next();\n\n if (step.done !== false) {\n iterator = stack.pop();\n continue;\n }\n\n var v = step.value;\n\n if (type === ITERATE_ENTRIES) {\n v = v[1];\n }\n\n if ((!depth || stack.length < depth) && isIterable(v)) {\n stack.push(iterator);\n iterator = v.__iterator(type, reverse);\n } else {\n return useKeys ? step : iteratorValue(type, iterations++, v, step);\n }\n }\n\n return iteratorDone();\n });\n };\n\n return flatSequence;\n }\n\n function flatMapFactory(iterable, mapper, context) {\n var coerce = iterableClass(iterable);\n return iterable.toSeq().map(function (v, k) {\n return coerce(mapper.call(context, v, k, iterable));\n }).flatten(true);\n }\n\n function interposeFactory(iterable, separator) {\n var interposedSequence = makeSequence(iterable);\n interposedSequence.size = iterable.size && iterable.size * 2 - 1;\n\n interposedSequence.__iterateUncached = function (fn, reverse) {\n var this$0 = this;\n var iterations = 0;\n\n iterable.__iterate(function (v, k) {\n return (!iterations || fn(separator, iterations++, this$0) !== false) && fn(v, iterations++, this$0) !== false;\n }, reverse);\n\n return iterations;\n };\n\n interposedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n\n var iterations = 0;\n var step;\n return new Iterator(function () {\n if (!step || iterations % 2) {\n step = iterator.next();\n\n if (step.done) {\n return step;\n }\n }\n\n return iterations % 2 ? iteratorValue(type, iterations++, separator) : iteratorValue(type, iterations++, step.value, step);\n });\n };\n\n return interposedSequence;\n }\n\n function sortFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n\n var isKeyedIterable = isKeyed(iterable);\n var index = 0;\n var entries = iterable.toSeq().map(function (v, k) {\n return [k, v, index++, mapper ? mapper(v, k, iterable) : v];\n }).toArray();\n entries.sort(function (a, b) {\n return comparator(a[3], b[3]) || a[2] - b[2];\n }).forEach(isKeyedIterable ? function (v, i) {\n entries[i].length = 2;\n } : function (v, i) {\n entries[i] = v[1];\n });\n return isKeyedIterable ? KeyedSeq(entries) : isIndexed(iterable) ? IndexedSeq(entries) : SetSeq(entries);\n }\n\n function maxFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n\n if (mapper) {\n var entry = iterable.toSeq().map(function (v, k) {\n return [v, mapper(v, k, iterable)];\n }).reduce(function (a, b) {\n return maxCompare(comparator, a[1], b[1]) ? b : a;\n });\n return entry && entry[0];\n } else {\n return iterable.reduce(function (a, b) {\n return maxCompare(comparator, a, b) ? b : a;\n });\n }\n }\n\n function maxCompare(comparator, a, b) {\n var comp = comparator(b, a); // b is considered the new max if the comparator declares them equal, but\n // they are not equal and b is in fact a nullish value.\n\n return comp === 0 && b !== a && (b === undefined || b === null || b !== b) || comp > 0;\n }\n\n function zipWithFactory(keyIter, zipper, iters) {\n var zipSequence = makeSequence(keyIter);\n zipSequence.size = new ArraySeq(iters).map(function (i) {\n return i.size;\n }).min(); // Note: this a generic base implementation of __iterate in terms of\n // __iterator which may be more generically useful in the future.\n\n zipSequence.__iterate = function (fn, reverse) {\n /* generic:\n var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n iterations++;\n if (fn(step.value[1], step.value[0], this) === false) {\n break;\n }\n }\n return iterations;\n */\n // indexed:\n var iterator = this.__iterator(ITERATE_VALUES, reverse);\n\n var step;\n var iterations = 0;\n\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n\n return iterations;\n };\n\n zipSequence.__iteratorUncached = function (type, reverse) {\n var iterators = iters.map(function (i) {\n return i = Iterable(i), getIterator(reverse ? i.reverse() : i);\n });\n var iterations = 0;\n var isDone = false;\n return new Iterator(function () {\n var steps;\n\n if (!isDone) {\n steps = iterators.map(function (i) {\n return i.next();\n });\n isDone = steps.some(function (s) {\n return s.done;\n });\n }\n\n if (isDone) {\n return iteratorDone();\n }\n\n return iteratorValue(type, iterations++, zipper.apply(null, steps.map(function (s) {\n return s.value;\n })));\n });\n };\n\n return zipSequence;\n } // #pragma Helper Functions\n\n\n function reify(iter, seq) {\n return isSeq(iter) ? seq : iter.constructor(seq);\n }\n\n function validateEntry(entry) {\n if (entry !== Object(entry)) {\n throw new TypeError('Expected [K, V] tuple: ' + entry);\n }\n }\n\n function resolveSize(iter) {\n assertNotInfinite(iter.size);\n return ensureSize(iter);\n }\n\n function iterableClass(iterable) {\n return isKeyed(iterable) ? KeyedIterable : isIndexed(iterable) ? IndexedIterable : SetIterable;\n }\n\n function makeSequence(iterable) {\n return Object.create((isKeyed(iterable) ? KeyedSeq : isIndexed(iterable) ? IndexedSeq : SetSeq).prototype);\n }\n\n function cacheResultThrough() {\n if (this._iter.cacheResult) {\n this._iter.cacheResult();\n\n this.size = this._iter.size;\n return this;\n } else {\n return Seq.prototype.cacheResult.call(this);\n }\n }\n\n function defaultComparator(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n function forceIterator(keyPath) {\n var iter = getIterator(keyPath);\n\n if (!iter) {\n // Array might not be iterable in this environment, so we need a fallback\n // to our wrapped type.\n if (!isArrayLike(keyPath)) {\n throw new TypeError('Expected iterable or array-like: ' + keyPath);\n }\n\n iter = getIterator(Iterable(keyPath));\n }\n\n return iter;\n }\n\n createClass(Record, KeyedCollection);\n\n function Record(defaultValues, name) {\n var hasInitialized;\n\n var RecordType = function Record(values) {\n if (values instanceof RecordType) {\n return values;\n }\n\n if (!(this instanceof RecordType)) {\n return new RecordType(values);\n }\n\n if (!hasInitialized) {\n hasInitialized = true;\n var keys = Object.keys(defaultValues);\n setProps(RecordTypePrototype, keys);\n RecordTypePrototype.size = keys.length;\n RecordTypePrototype._name = name;\n RecordTypePrototype._keys = keys;\n RecordTypePrototype._defaultValues = defaultValues;\n }\n\n this._map = Map(values);\n };\n\n var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n RecordTypePrototype.constructor = RecordType;\n return RecordType;\n }\n\n Record.prototype.toString = function () {\n return this.__toString(recordName(this) + ' {', '}');\n }; // @pragma Access\n\n\n Record.prototype.has = function (k) {\n return this._defaultValues.hasOwnProperty(k);\n };\n\n Record.prototype.get = function (k, notSetValue) {\n if (!this.has(k)) {\n return notSetValue;\n }\n\n var defaultVal = this._defaultValues[k];\n return this._map ? this._map.get(k, defaultVal) : defaultVal;\n }; // @pragma Modification\n\n\n Record.prototype.clear = function () {\n if (this.__ownerID) {\n this._map && this._map.clear();\n return this;\n }\n\n var RecordType = this.constructor;\n return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n };\n\n Record.prototype.set = function (k, v) {\n if (!this.has(k)) {\n throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n }\n\n if (this._map && !this._map.has(k)) {\n var defaultVal = this._defaultValues[k];\n\n if (v === defaultVal) {\n return this;\n }\n }\n\n var newMap = this._map && this._map.set(k, v);\n\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n\n return makeRecord(this, newMap);\n };\n\n Record.prototype.remove = function (k) {\n if (!this.has(k)) {\n return this;\n }\n\n var newMap = this._map && this._map.remove(k);\n\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n\n return makeRecord(this, newMap);\n };\n\n Record.prototype.wasAltered = function () {\n return this._map.wasAltered();\n };\n\n Record.prototype.__iterator = function (type, reverse) {\n var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function (_, k) {\n return this$0.get(k);\n }).__iterator(type, reverse);\n };\n\n Record.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function (_, k) {\n return this$0.get(k);\n }).__iterate(fn, reverse);\n };\n\n Record.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n var newMap = this._map && this._map.__ensureOwner(ownerID);\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n\n return makeRecord(this, newMap, ownerID);\n };\n\n var RecordPrototype = Record.prototype;\n RecordPrototype[DELETE] = RecordPrototype.remove;\n RecordPrototype.deleteIn = RecordPrototype.removeIn = MapPrototype.removeIn;\n RecordPrototype.merge = MapPrototype.merge;\n RecordPrototype.mergeWith = MapPrototype.mergeWith;\n RecordPrototype.mergeIn = MapPrototype.mergeIn;\n RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n RecordPrototype.setIn = MapPrototype.setIn;\n RecordPrototype.update = MapPrototype.update;\n RecordPrototype.updateIn = MapPrototype.updateIn;\n RecordPrototype.withMutations = MapPrototype.withMutations;\n RecordPrototype.asMutable = MapPrototype.asMutable;\n RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n function makeRecord(likeRecord, map, ownerID) {\n var record = Object.create(Object.getPrototypeOf(likeRecord));\n record._map = map;\n record.__ownerID = ownerID;\n return record;\n }\n\n function recordName(record) {\n return record._name || record.constructor.name || 'Record';\n }\n\n function setProps(prototype, names) {\n try {\n names.forEach(setProp.bind(undefined, prototype));\n } catch (error) {// Object.defineProperty failed. Probably IE8.\n }\n }\n\n function setProp(prototype, name) {\n Object.defineProperty(prototype, name, {\n get: function get() {\n return this.get(name);\n },\n set: function set(value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record.');\n this.set(name, value);\n }\n });\n }\n\n createClass(Set, SetCollection); // @pragma Construction\n\n function Set(value) {\n return value === null || value === undefined ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations(function (set) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v) {\n return set.add(v);\n });\n });\n }\n\n Set.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n Set.fromKeys = function (value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n Set.prototype.toString = function () {\n return this.__toString('Set {', '}');\n }; // @pragma Access\n\n\n Set.prototype.has = function (value) {\n return this._map.has(value);\n }; // @pragma Modification\n\n\n Set.prototype.add = function (value) {\n return updateSet(this, this._map.set(value, true));\n };\n\n Set.prototype.remove = function (value) {\n return updateSet(this, this._map.remove(value));\n };\n\n Set.prototype.clear = function () {\n return updateSet(this, this._map.clear());\n }; // @pragma Composition\n\n\n Set.prototype.union = function () {\n var iters = SLICE$0.call(arguments, 0);\n iters = iters.filter(function (x) {\n return x.size !== 0;\n });\n\n if (iters.length === 0) {\n return this;\n }\n\n if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n return this.constructor(iters[0]);\n }\n\n return this.withMutations(function (set) {\n for (var ii = 0; ii < iters.length; ii++) {\n SetIterable(iters[ii]).forEach(function (value) {\n return set.add(value);\n });\n }\n });\n };\n\n Set.prototype.intersect = function () {\n var iters = SLICE$0.call(arguments, 0);\n\n if (iters.length === 0) {\n return this;\n }\n\n iters = iters.map(function (iter) {\n return SetIterable(iter);\n });\n var originalSet = this;\n return this.withMutations(function (set) {\n originalSet.forEach(function (value) {\n if (!iters.every(function (iter) {\n return iter.includes(value);\n })) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.subtract = function () {\n var iters = SLICE$0.call(arguments, 0);\n\n if (iters.length === 0) {\n return this;\n }\n\n iters = iters.map(function (iter) {\n return SetIterable(iter);\n });\n var originalSet = this;\n return this.withMutations(function (set) {\n originalSet.forEach(function (value) {\n if (iters.some(function (iter) {\n return iter.includes(value);\n })) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.merge = function () {\n return this.union.apply(this, arguments);\n };\n\n Set.prototype.mergeWith = function (merger) {\n var iters = SLICE$0.call(arguments, 1);\n return this.union.apply(this, iters);\n };\n\n Set.prototype.sort = function (comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator));\n };\n\n Set.prototype.sortBy = function (mapper, comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator, mapper));\n };\n\n Set.prototype.wasAltered = function () {\n return this._map.wasAltered();\n };\n\n Set.prototype.__iterate = function (fn, reverse) {\n var this$0 = this;\n return this._map.__iterate(function (_, k) {\n return fn(k, k, this$0);\n }, reverse);\n };\n\n Set.prototype.__iterator = function (type, reverse) {\n return this._map.map(function (_, k) {\n return k;\n }).__iterator(type, reverse);\n };\n\n Set.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n var newMap = this._map.__ensureOwner(ownerID);\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n\n return this.__make(newMap, ownerID);\n };\n\n function isSet(maybeSet) {\n return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n }\n\n Set.isSet = isSet;\n var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n var SetPrototype = Set.prototype;\n SetPrototype[IS_SET_SENTINEL] = true;\n SetPrototype[DELETE] = SetPrototype.remove;\n SetPrototype.mergeDeep = SetPrototype.merge;\n SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n SetPrototype.withMutations = MapPrototype.withMutations;\n SetPrototype.asMutable = MapPrototype.asMutable;\n SetPrototype.asImmutable = MapPrototype.asImmutable;\n SetPrototype.__empty = emptySet;\n SetPrototype.__make = makeSet;\n\n function updateSet(set, newMap) {\n if (set.__ownerID) {\n set.size = newMap.size;\n set._map = newMap;\n return set;\n }\n\n return newMap === set._map ? set : newMap.size === 0 ? set.__empty() : set.__make(newMap);\n }\n\n function makeSet(map, ownerID) {\n var set = Object.create(SetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_SET;\n\n function emptySet() {\n return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n }\n\n createClass(OrderedSet, Set); // @pragma Construction\n\n function OrderedSet(value) {\n return value === null || value === undefined ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations(function (set) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v) {\n return set.add(v);\n });\n });\n }\n\n OrderedSet.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n OrderedSet.fromKeys = function (value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n OrderedSet.prototype.toString = function () {\n return this.__toString('OrderedSet {', '}');\n };\n\n function isOrderedSet(maybeOrderedSet) {\n return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n }\n\n OrderedSet.isOrderedSet = isOrderedSet;\n var OrderedSetPrototype = OrderedSet.prototype;\n OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n OrderedSetPrototype.__empty = emptyOrderedSet;\n OrderedSetPrototype.__make = makeOrderedSet;\n\n function makeOrderedSet(map, ownerID) {\n var set = Object.create(OrderedSetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_ORDERED_SET;\n\n function emptyOrderedSet() {\n return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n }\n\n createClass(Stack, IndexedCollection); // @pragma Construction\n\n function Stack(value) {\n return value === null || value === undefined ? emptyStack() : isStack(value) ? value : emptyStack().unshiftAll(value);\n }\n\n Stack.of = function\n /*...values*/\n () {\n return this(arguments);\n };\n\n Stack.prototype.toString = function () {\n return this.__toString('Stack [', ']');\n }; // @pragma Access\n\n\n Stack.prototype.get = function (index, notSetValue) {\n var head = this._head;\n index = wrapIndex(this, index);\n\n while (head && index--) {\n head = head.next;\n }\n\n return head ? head.value : notSetValue;\n };\n\n Stack.prototype.peek = function () {\n return this._head && this._head.value;\n }; // @pragma Modification\n\n\n Stack.prototype.push = function\n /*...values*/\n () {\n if (arguments.length === 0) {\n return this;\n }\n\n var newSize = this.size + arguments.length;\n var head = this._head;\n\n for (var ii = arguments.length - 1; ii >= 0; ii--) {\n head = {\n value: arguments[ii],\n next: head\n };\n }\n\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pushAll = function (iter) {\n iter = IndexedIterable(iter);\n\n if (iter.size === 0) {\n return this;\n }\n\n assertNotInfinite(iter.size);\n var newSize = this.size;\n var head = this._head;\n iter.reverse().forEach(function (value) {\n newSize++;\n head = {\n value: value,\n next: head\n };\n });\n\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pop = function () {\n return this.slice(1);\n };\n\n Stack.prototype.unshift = function\n /*...values*/\n () {\n return this.push.apply(this, arguments);\n };\n\n Stack.prototype.unshiftAll = function (iter) {\n return this.pushAll(iter);\n };\n\n Stack.prototype.shift = function () {\n return this.pop.apply(this, arguments);\n };\n\n Stack.prototype.clear = function () {\n if (this.size === 0) {\n return this;\n }\n\n if (this.__ownerID) {\n this.size = 0;\n this._head = undefined;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return emptyStack();\n };\n\n Stack.prototype.slice = function (begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n\n var resolvedBegin = resolveBegin(begin, this.size);\n var resolvedEnd = resolveEnd(end, this.size);\n\n if (resolvedEnd !== this.size) {\n // super.slice(begin, end);\n return IndexedCollection.prototype.slice.call(this, begin, end);\n }\n\n var newSize = this.size - resolvedBegin;\n var head = this._head;\n\n while (resolvedBegin--) {\n head = head.next;\n }\n\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n\n return makeStack(newSize, head);\n }; // @pragma Mutability\n\n\n Stack.prototype.__ensureOwner = function (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n\n return makeStack(this.size, this._head, ownerID, this.__hash);\n }; // @pragma Iteration\n\n\n Stack.prototype.__iterate = function (fn, reverse) {\n if (reverse) {\n return this.reverse().__iterate(fn);\n }\n\n var iterations = 0;\n var node = this._head;\n\n while (node) {\n if (fn(node.value, iterations++, this) === false) {\n break;\n }\n\n node = node.next;\n }\n\n return iterations;\n };\n\n Stack.prototype.__iterator = function (type, reverse) {\n if (reverse) {\n return this.reverse().__iterator(type);\n }\n\n var iterations = 0;\n var node = this._head;\n return new Iterator(function () {\n if (node) {\n var value = node.value;\n node = node.next;\n return iteratorValue(type, iterations++, value);\n }\n\n return iteratorDone();\n });\n };\n\n function isStack(maybeStack) {\n return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n }\n\n Stack.isStack = isStack;\n var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n var StackPrototype = Stack.prototype;\n StackPrototype[IS_STACK_SENTINEL] = true;\n StackPrototype.withMutations = MapPrototype.withMutations;\n StackPrototype.asMutable = MapPrototype.asMutable;\n StackPrototype.asImmutable = MapPrototype.asImmutable;\n StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n function makeStack(size, head, ownerID, hash) {\n var map = Object.create(StackPrototype);\n map.size = size;\n map._head = head;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_STACK;\n\n function emptyStack() {\n return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n }\n /**\n * Contributes additional methods to a constructor\n */\n\n\n function mixin(ctor, methods) {\n var keyCopier = function keyCopier(key) {\n ctor.prototype[key] = methods[key];\n };\n\n Object.keys(methods).forEach(keyCopier);\n Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n return ctor;\n }\n\n Iterable.Iterator = Iterator;\n mixin(Iterable, {\n // ### Conversion to other types\n toArray: function toArray() {\n assertNotInfinite(this.size);\n var array = new Array(this.size || 0);\n\n this.valueSeq().__iterate(function (v, i) {\n array[i] = v;\n });\n\n return array;\n },\n toIndexedSeq: function toIndexedSeq() {\n return new ToIndexedSequence(this);\n },\n toJS: function toJS() {\n return this.toSeq().map(function (value) {\n return value && typeof value.toJS === 'function' ? value.toJS() : value;\n }).__toJS();\n },\n toJSON: function toJSON() {\n return this.toSeq().map(function (value) {\n return value && typeof value.toJSON === 'function' ? value.toJSON() : value;\n }).__toJS();\n },\n toKeyedSeq: function toKeyedSeq() {\n return new ToKeyedSequence(this, true);\n },\n toMap: function toMap() {\n // Use Late Binding here to solve the circular dependency.\n return Map(this.toKeyedSeq());\n },\n toObject: function toObject() {\n assertNotInfinite(this.size);\n var object = {};\n\n this.__iterate(function (v, k) {\n object[k] = v;\n });\n\n return object;\n },\n toOrderedMap: function toOrderedMap() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedMap(this.toKeyedSeq());\n },\n toOrderedSet: function toOrderedSet() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n },\n toSet: function toSet() {\n // Use Late Binding here to solve the circular dependency.\n return Set(isKeyed(this) ? this.valueSeq() : this);\n },\n toSetSeq: function toSetSeq() {\n return new ToSetSequence(this);\n },\n toSeq: function toSeq() {\n return isIndexed(this) ? this.toIndexedSeq() : isKeyed(this) ? this.toKeyedSeq() : this.toSetSeq();\n },\n toStack: function toStack() {\n // Use Late Binding here to solve the circular dependency.\n return Stack(isKeyed(this) ? this.valueSeq() : this);\n },\n toList: function toList() {\n // Use Late Binding here to solve the circular dependency.\n return List(isKeyed(this) ? this.valueSeq() : this);\n },\n // ### Common JavaScript methods and properties\n toString: function toString() {\n return '[Iterable]';\n },\n __toString: function __toString(head, tail) {\n if (this.size === 0) {\n return head + tail;\n }\n\n return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n },\n // ### ES6 Collection methods (ES6 Array and Map)\n concat: function concat() {\n var values = SLICE$0.call(arguments, 0);\n return reify(this, concatFactory(this, values));\n },\n includes: function includes(searchValue) {\n return this.some(function (value) {\n return is(value, searchValue);\n });\n },\n entries: function entries() {\n return this.__iterator(ITERATE_ENTRIES);\n },\n every: function every(predicate, context) {\n assertNotInfinite(this.size);\n var returnValue = true;\n\n this.__iterate(function (v, k, c) {\n if (!predicate.call(context, v, k, c)) {\n returnValue = false;\n return false;\n }\n });\n\n return returnValue;\n },\n filter: function filter(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, true));\n },\n find: function find(predicate, context, notSetValue) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[1] : notSetValue;\n },\n forEach: function forEach(sideEffect, context) {\n assertNotInfinite(this.size);\n return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n },\n join: function join(separator) {\n assertNotInfinite(this.size);\n separator = separator !== undefined ? '' + separator : ',';\n var joined = '';\n var isFirst = true;\n\n this.__iterate(function (v) {\n isFirst ? isFirst = false : joined += separator;\n joined += v !== null && v !== undefined ? v.toString() : '';\n });\n\n return joined;\n },\n keys: function keys() {\n return this.__iterator(ITERATE_KEYS);\n },\n map: function map(mapper, context) {\n return reify(this, mapFactory(this, mapper, context));\n },\n reduce: function reduce(reducer, initialReduction, context) {\n assertNotInfinite(this.size);\n var reduction;\n var useFirst;\n\n if (arguments.length < 2) {\n useFirst = true;\n } else {\n reduction = initialReduction;\n }\n\n this.__iterate(function (v, k, c) {\n if (useFirst) {\n useFirst = false;\n reduction = v;\n } else {\n reduction = reducer.call(context, reduction, v, k, c);\n }\n });\n\n return reduction;\n },\n reduceRight: function reduceRight(reducer, initialReduction, context) {\n var reversed = this.toKeyedSeq().reverse();\n return reversed.reduce.apply(reversed, arguments);\n },\n reverse: function reverse() {\n return reify(this, reverseFactory(this, true));\n },\n slice: function slice(begin, end) {\n return reify(this, sliceFactory(this, begin, end, true));\n },\n some: function some(predicate, context) {\n return !this.every(not(predicate), context);\n },\n sort: function sort(comparator) {\n return reify(this, sortFactory(this, comparator));\n },\n values: function values() {\n return this.__iterator(ITERATE_VALUES);\n },\n // ### More sequential methods\n butLast: function butLast() {\n return this.slice(0, -1);\n },\n isEmpty: function isEmpty() {\n return this.size !== undefined ? this.size === 0 : !this.some(function () {\n return true;\n });\n },\n count: function count(predicate, context) {\n return ensureSize(predicate ? this.toSeq().filter(predicate, context) : this);\n },\n countBy: function countBy(grouper, context) {\n return countByFactory(this, grouper, context);\n },\n equals: function equals(other) {\n return deepEqual(this, other);\n },\n entrySeq: function entrySeq() {\n var iterable = this;\n\n if (iterable._cache) {\n // We cache as an entries array, so we can just return the cache!\n return new ArraySeq(iterable._cache);\n }\n\n var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n\n entriesSequence.fromEntrySeq = function () {\n return iterable.toSeq();\n };\n\n return entriesSequence;\n },\n filterNot: function filterNot(predicate, context) {\n return this.filter(not(predicate), context);\n },\n findEntry: function findEntry(predicate, context, notSetValue) {\n var found = notSetValue;\n\n this.__iterate(function (v, k, c) {\n if (predicate.call(context, v, k, c)) {\n found = [k, v];\n return false;\n }\n });\n\n return found;\n },\n findKey: function findKey(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry && entry[0];\n },\n findLast: function findLast(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n },\n findLastEntry: function findLastEntry(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);\n },\n findLastKey: function findLastKey(predicate, context) {\n return this.toKeyedSeq().reverse().findKey(predicate, context);\n },\n first: function first() {\n return this.find(returnTrue);\n },\n flatMap: function flatMap(mapper, context) {\n return reify(this, flatMapFactory(this, mapper, context));\n },\n flatten: function flatten(depth) {\n return reify(this, flattenFactory(this, depth, true));\n },\n fromEntrySeq: function fromEntrySeq() {\n return new FromEntriesSequence(this);\n },\n get: function get(searchKey, notSetValue) {\n return this.find(function (_, key) {\n return is(key, searchKey);\n }, undefined, notSetValue);\n },\n getIn: function getIn(searchKeyPath, notSetValue) {\n var nested = this; // Note: in an ES6 environment, we would prefer:\n // for (var key of searchKeyPath) {\n\n var iter = forceIterator(searchKeyPath);\n var step;\n\n while (!(step = iter.next()).done) {\n var key = step.value;\n nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n\n if (nested === NOT_SET) {\n return notSetValue;\n }\n }\n\n return nested;\n },\n groupBy: function groupBy(grouper, context) {\n return groupByFactory(this, grouper, context);\n },\n has: function has(searchKey) {\n return this.get(searchKey, NOT_SET) !== NOT_SET;\n },\n hasIn: function hasIn(searchKeyPath) {\n return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n },\n isSubset: function isSubset(iter) {\n iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n return this.every(function (value) {\n return iter.includes(value);\n });\n },\n isSuperset: function isSuperset(iter) {\n iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n return iter.isSubset(this);\n },\n keyOf: function keyOf(searchValue) {\n return this.findKey(function (value) {\n return is(value, searchValue);\n });\n },\n keySeq: function keySeq() {\n return this.toSeq().map(keyMapper).toIndexedSeq();\n },\n last: function last() {\n return this.toSeq().reverse().first();\n },\n lastKeyOf: function lastKeyOf(searchValue) {\n return this.toKeyedSeq().reverse().keyOf(searchValue);\n },\n max: function max(comparator) {\n return maxFactory(this, comparator);\n },\n maxBy: function maxBy(mapper, comparator) {\n return maxFactory(this, comparator, mapper);\n },\n min: function min(comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n },\n minBy: function minBy(mapper, comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n },\n rest: function rest() {\n return this.slice(1);\n },\n skip: function skip(amount) {\n return this.slice(Math.max(0, amount));\n },\n skipLast: function skipLast(amount) {\n return reify(this, this.toSeq().reverse().skip(amount).reverse());\n },\n skipWhile: function skipWhile(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, true));\n },\n skipUntil: function skipUntil(predicate, context) {\n return this.skipWhile(not(predicate), context);\n },\n sortBy: function sortBy(mapper, comparator) {\n return reify(this, sortFactory(this, comparator, mapper));\n },\n take: function take(amount) {\n return this.slice(0, Math.max(0, amount));\n },\n takeLast: function takeLast(amount) {\n return reify(this, this.toSeq().reverse().take(amount).reverse());\n },\n takeWhile: function takeWhile(predicate, context) {\n return reify(this, takeWhileFactory(this, predicate, context));\n },\n takeUntil: function takeUntil(predicate, context) {\n return this.takeWhile(not(predicate), context);\n },\n valueSeq: function valueSeq() {\n return this.toIndexedSeq();\n },\n // ### Hashable Object\n hashCode: function hashCode() {\n return this.__hash || (this.__hash = hashIterable(this));\n } // ### Internal\n // abstract __iterate(fn, reverse)\n // abstract __iterator(type, reverse)\n\n }); // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n var IterablePrototype = Iterable.prototype;\n IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n IterablePrototype.__toJS = IterablePrototype.toArray;\n IterablePrototype.__toStringMapper = quoteString;\n\n IterablePrototype.inspect = IterablePrototype.toSource = function () {\n return this.toString();\n };\n\n IterablePrototype.chain = IterablePrototype.flatMap;\n IterablePrototype.contains = IterablePrototype.includes;\n mixin(KeyedIterable, {\n // ### More sequential methods\n flip: function flip() {\n return reify(this, flipFactory(this));\n },\n mapEntries: function mapEntries(mapper, context) {\n var this$0 = this;\n var iterations = 0;\n return reify(this, this.toSeq().map(function (v, k) {\n return mapper.call(context, [k, v], iterations++, this$0);\n }).fromEntrySeq());\n },\n mapKeys: function mapKeys(mapper, context) {\n var this$0 = this;\n return reify(this, this.toSeq().flip().map(function (k, v) {\n return mapper.call(context, k, v, this$0);\n }).flip());\n }\n });\n var KeyedIterablePrototype = KeyedIterable.prototype;\n KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n\n KeyedIterablePrototype.__toStringMapper = function (v, k) {\n return JSON.stringify(k) + ': ' + quoteString(v);\n };\n\n mixin(IndexedIterable, {\n // ### Conversion to other types\n toKeyedSeq: function toKeyedSeq() {\n return new ToKeyedSequence(this, false);\n },\n // ### ES6 Collection methods (ES6 Array and Map)\n filter: function filter(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, false));\n },\n findIndex: function findIndex(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n indexOf: function indexOf(searchValue) {\n var key = this.keyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n lastIndexOf: function lastIndexOf(searchValue) {\n var key = this.lastKeyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n reverse: function reverse() {\n return reify(this, reverseFactory(this, false));\n },\n slice: function slice(begin, end) {\n return reify(this, sliceFactory(this, begin, end, false));\n },\n splice: function splice(index, removeNum\n /*, ...values*/\n ) {\n var numArgs = arguments.length;\n removeNum = Math.max(removeNum | 0, 0);\n\n if (numArgs === 0 || numArgs === 2 && !removeNum) {\n return this;\n } // If index is negative, it should resolve relative to the size of the\n // collection. However size may be expensive to compute if not cached, so\n // only call count() if the number is in fact negative.\n\n\n index = resolveBegin(index, index < 0 ? this.count() : this.size);\n var spliced = this.slice(0, index);\n return reify(this, numArgs === 1 ? spliced : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)));\n },\n // ### More collection methods\n findLastIndex: function findLastIndex(predicate, context) {\n var entry = this.findLastEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n first: function first() {\n return this.get(0);\n },\n flatten: function flatten(depth) {\n return reify(this, flattenFactory(this, depth, false));\n },\n get: function get(index, notSetValue) {\n index = wrapIndex(this, index);\n return index < 0 || this.size === Infinity || this.size !== undefined && index > this.size ? notSetValue : this.find(function (_, key) {\n return key === index;\n }, undefined, notSetValue);\n },\n has: function has(index) {\n index = wrapIndex(this, index);\n return index >= 0 && (this.size !== undefined ? this.size === Infinity || index < this.size : this.indexOf(index) !== -1);\n },\n interpose: function interpose(separator) {\n return reify(this, interposeFactory(this, separator));\n },\n interleave: function\n /*...iterables*/\n interleave() {\n var iterables = [this].concat(arrCopy(arguments));\n var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n var interleaved = zipped.flatten(true);\n\n if (zipped.size) {\n interleaved.size = zipped.size * iterables.length;\n }\n\n return reify(this, interleaved);\n },\n keySeq: function keySeq() {\n return Range(0, this.size);\n },\n last: function last() {\n return this.get(-1);\n },\n skipWhile: function skipWhile(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, false));\n },\n zip: function\n /*, ...iterables */\n zip() {\n var iterables = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, iterables));\n },\n zipWith: function zipWith(zipper\n /*, ...iterables */\n ) {\n var iterables = arrCopy(arguments);\n iterables[0] = this;\n return reify(this, zipWithFactory(this, zipper, iterables));\n }\n });\n IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n mixin(SetIterable, {\n // ### ES6 Collection methods (ES6 Array and Map)\n get: function get(value, notSetValue) {\n return this.has(value) ? value : notSetValue;\n },\n includes: function includes(value) {\n return this.has(value);\n },\n // ### More sequential methods\n keySeq: function keySeq() {\n return this.valueSeq();\n }\n });\n SetIterable.prototype.has = IterablePrototype.includes;\n SetIterable.prototype.contains = SetIterable.prototype.includes; // Mixin subclasses\n\n mixin(KeyedSeq, KeyedIterable.prototype);\n mixin(IndexedSeq, IndexedIterable.prototype);\n mixin(SetSeq, SetIterable.prototype);\n mixin(KeyedCollection, KeyedIterable.prototype);\n mixin(IndexedCollection, IndexedIterable.prototype);\n mixin(SetCollection, SetIterable.prototype); // #pragma Helper functions\n\n function keyMapper(v, k) {\n return k;\n }\n\n function entryMapper(v, k) {\n return [k, v];\n }\n\n function not(predicate) {\n return function () {\n return !predicate.apply(this, arguments);\n };\n }\n\n function neg(predicate) {\n return function () {\n return -predicate.apply(this, arguments);\n };\n }\n\n function quoteString(value) {\n return typeof value === 'string' ? JSON.stringify(value) : String(value);\n }\n\n function defaultZipper() {\n return arrCopy(arguments);\n }\n\n function defaultNegComparator(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n }\n\n function hashIterable(iterable) {\n if (iterable.size === Infinity) {\n return 0;\n }\n\n var ordered = isOrdered(iterable);\n var keyed = isKeyed(iterable);\n var h = ordered ? 1 : 0;\n\n var size = iterable.__iterate(keyed ? ordered ? function (v, k) {\n h = 31 * h + hashMerge(hash(v), hash(k)) | 0;\n } : function (v, k) {\n h = h + hashMerge(hash(v), hash(k)) | 0;\n } : ordered ? function (v) {\n h = 31 * h + hash(v) | 0;\n } : function (v) {\n h = h + hash(v) | 0;\n });\n\n return murmurHashOfSize(size, h);\n }\n\n function murmurHashOfSize(size, h) {\n h = imul(h, 0xCC9E2D51);\n h = imul(h << 15 | h >>> -15, 0x1B873593);\n h = imul(h << 13 | h >>> -13, 5);\n h = (h + 0xE6546B64 | 0) ^ size;\n h = imul(h ^ h >>> 16, 0x85EBCA6B);\n h = imul(h ^ h >>> 13, 0xC2B2AE35);\n h = smi(h ^ h >>> 16);\n return h;\n }\n\n function hashMerge(a, b) {\n return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n }\n\n var Immutable = {\n Iterable: Iterable,\n Seq: Seq,\n Collection: Collection,\n Map: Map,\n OrderedMap: OrderedMap,\n List: List,\n Stack: Stack,\n Set: Set,\n OrderedSet: OrderedSet,\n Record: Record,\n Range: Range,\n Repeat: Repeat,\n is: is,\n fromJS: fromJS\n };\n return Immutable;\n});","/**\n * {@docCategory Button}\n */\nexport var ElementType;\n\n(function (ElementType) {\n /** element. */\n ElementType[ElementType[\"button\"] = 0] = \"button\";\n /** element. */\n\n ElementType[ElementType[\"anchor\"] = 1] = \"anchor\";\n})(ElementType || (ElementType = {}));\n/**\n * {@docCategory Button}\n */\n\n\nexport var ButtonType;\n\n(function (ButtonType) {\n ButtonType[ButtonType[\"normal\"] = 0] = \"normal\";\n ButtonType[ButtonType[\"primary\"] = 1] = \"primary\";\n ButtonType[ButtonType[\"hero\"] = 2] = \"hero\";\n ButtonType[ButtonType[\"compound\"] = 3] = \"compound\";\n ButtonType[ButtonType[\"command\"] = 4] = \"command\";\n ButtonType[ButtonType[\"icon\"] = 5] = \"icon\";\n ButtonType[ButtonType[\"default\"] = 6] = \"default\";\n})(ButtonType || (ButtonType = {}));","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { warn } from '../../Utilities';\nimport { ButtonType } from './Button.types';\nimport { DefaultButton } from './DefaultButton/DefaultButton';\nimport { ActionButton } from './ActionButton/ActionButton';\nimport { CompoundButton } from './CompoundButton/CompoundButton';\nimport { IconButton } from './IconButton/IconButton';\nimport { PrimaryButton } from './PrimaryButton/PrimaryButton';\n/**\n * This class is deprecated. Use the individual *Button components instead.\n * @deprecated Use the individual *Button components instead.\n * {@docCategory Button}\n */\n\nvar Button =\n/** @class */\nfunction (_super) {\n __extends(Button, _super);\n\n function Button(props) {\n var _this = _super.call(this, props) || this;\n\n warn(\"The Button component has been deprecated. Use specific variants instead. \" + \"(PrimaryButton, DefaultButton, IconButton, ActionButton, etc.)\");\n return _this;\n }\n\n Button.prototype.render = function () {\n var props = this.props; // eslint-disable-next-line deprecation/deprecation\n\n switch (props.buttonType) {\n case ButtonType.command:\n return React.createElement(ActionButton, __assign({}, props));\n\n case ButtonType.compound:\n return React.createElement(CompoundButton, __assign({}, props));\n\n case ButtonType.icon:\n return React.createElement(IconButton, __assign({}, props));\n\n case ButtonType.primary:\n return React.createElement(PrimaryButton, __assign({}, props));\n\n default:\n return React.createElement(DefaultButton, __assign({}, props));\n }\n };\n\n return Button;\n}(React.Component);\n\nexport { Button };","import { concatStyleSets, getFocusStyle } from '../../../Styling';\nimport { memoizeFunction } from '../../../Utilities';\nexport var getStyles = memoizeFunction(function (theme, customStyles) {\n return concatStyleSets({\n root: [getFocusStyle(theme, {\n inset: 1,\n highContrastStyle: {\n outlineOffset: '-4px',\n outline: '1px solid Window'\n },\n borderColor: 'transparent'\n }), {\n height: 24\n }]\n }, customStyles);\n});","import { __assign, __decorate, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { DefaultButton } from '../DefaultButton/DefaultButton';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { getStyles } from './MessageBarButton.styles';\n/**\n * {@docCategory MessageBar}\n */\n\nvar MessageBarButton =\n/** @class */\nfunction (_super) {\n __extends(MessageBarButton, _super);\n\n function MessageBarButton() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n MessageBarButton.prototype.render = function () {\n var _a = this.props,\n styles = _a.styles,\n theme = _a.theme;\n return React.createElement(DefaultButton, __assign({}, this.props, {\n styles: getStyles(theme, styles),\n onRenderDescription: nullRender\n }));\n };\n\n MessageBarButton = __decorate([customizable('MessageBarButton', ['theme', 'styles'], true)], MessageBarButton);\n return MessageBarButton;\n}(React.Component);\n\nexport { MessageBarButton };","import { __assign, __extends, __rest } from \"tslib\";\nimport * as React from 'react';\nimport { Image } from '../../../Image';\nimport { Icon } from '../../../Icon';\nimport { classNamesFunction, getNativeProps, inputProperties, css, initializeComponentRef } from '../../../Utilities';\nimport { composeRenderFunction } from '@uifabric/utilities';\nvar getClassNames = classNamesFunction();\nvar LARGE_IMAGE_SIZE = 71;\n/**\n * {@docCategory ChoiceGroup}\n */\n\nvar ChoiceGroupOptionBase =\n/** @class */\nfunction (_super) {\n __extends(ChoiceGroupOptionBase, _super);\n\n function ChoiceGroupOptionBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._onChange = function (evt) {\n var onChange = _this.props.onChange;\n\n if (onChange) {\n onChange(evt, _this.props);\n }\n };\n\n _this._onBlur = function (evt) {\n var onBlur = _this.props.onBlur;\n\n if (onBlur) {\n onBlur(evt, _this.props);\n }\n };\n\n _this._onFocus = function (evt) {\n var onFocus = _this.props.onFocus;\n\n if (onFocus) {\n onFocus(evt, _this.props);\n }\n };\n\n _this._onRenderField = function (props) {\n var id = props.id,\n imageSrc = props.imageSrc,\n _a = props.imageAlt,\n imageAlt = _a === void 0 ? '' : _a,\n selectedImageSrc = props.selectedImageSrc,\n iconProps = props.iconProps;\n var imageSize = props.imageSize ? props.imageSize : {\n width: 32,\n height: 32\n };\n var onRenderLabel = props.onRenderLabel ? composeRenderFunction(props.onRenderLabel, _this._onRenderLabel) : _this._onRenderLabel;\n var label = onRenderLabel(props);\n return React.createElement(\"label\", {\n htmlFor: id,\n className: _this._classNames.field\n }, imageSrc && React.createElement(\"div\", {\n className: _this._classNames.innerField\n }, React.createElement(\"div\", {\n className: _this._classNames.imageWrapper\n }, React.createElement(Image, {\n src: imageSrc,\n alt: imageAlt,\n width: imageSize.width,\n height: imageSize.height\n })), React.createElement(\"div\", {\n className: _this._classNames.selectedImageWrapper\n }, React.createElement(Image, {\n src: selectedImageSrc,\n alt: imageAlt,\n width: imageSize.width,\n height: imageSize.height\n }))), iconProps && React.createElement(\"div\", {\n className: _this._classNames.innerField\n }, React.createElement(\"div\", {\n className: _this._classNames.iconWrapper\n }, React.createElement(Icon, __assign({}, iconProps)))), imageSrc || iconProps ? React.createElement(\"div\", {\n className: _this._classNames.labelWrapper\n }, label) : label);\n };\n\n _this._onRenderLabel = function (props) {\n return React.createElement(\"span\", {\n id: props.labelId,\n className: \"ms-ChoiceFieldLabel\"\n }, props.text);\n };\n\n initializeComponentRef(_this);\n return _this;\n }\n\n ChoiceGroupOptionBase.prototype.render = function () {\n var _a = this.props,\n ariaLabel = _a.ariaLabel,\n focused = _a.focused,\n required = _a.required,\n theme = _a.theme,\n iconProps = _a.iconProps,\n imageSrc = _a.imageSrc,\n imageSize = _a.imageSize,\n disabled = _a.disabled,\n // eslint-disable-next-line deprecation/deprecation\n checked = _a.checked,\n id = _a.id,\n styles = _a.styles,\n name = _a.name,\n _b = _a.onRenderField,\n onRenderField = _b === void 0 ? this._onRenderField : _b,\n rest = __rest(_a, [\"ariaLabel\", \"focused\", \"required\", \"theme\", \"iconProps\", \"imageSrc\", \"imageSize\", \"disabled\", \"checked\", \"id\", \"styles\", \"name\", \"onRenderField\"]);\n\n this._classNames = getClassNames(styles, {\n theme: theme,\n hasIcon: !!iconProps,\n hasImage: !!imageSrc,\n checked: checked,\n disabled: disabled,\n imageIsLarge: !!imageSrc && (imageSize.width > LARGE_IMAGE_SIZE || imageSize.height > LARGE_IMAGE_SIZE),\n imageSize: imageSize,\n focused: focused\n });\n\n var _c = getNativeProps(rest, inputProperties),\n className = _c.className,\n nativeProps = __rest(_c, [\"className\"]);\n\n return React.createElement(\"div\", {\n className: this._classNames.root\n }, React.createElement(\"div\", {\n className: this._classNames.choiceFieldWrapper\n }, React.createElement(\"input\", __assign({\n \"aria-label\": ariaLabel,\n id: id,\n className: css(this._classNames.input, className),\n type: \"radio\",\n name: name,\n disabled: disabled,\n checked: checked,\n required: required\n }, nativeProps, {\n onChange: this._onChange,\n onFocus: this._onFocus,\n onBlur: this._onBlur\n })), onRenderField(this.props, this._onRenderField)));\n };\n\n ChoiceGroupOptionBase.defaultProps = {\n // This ensures default imageSize value doesn't mutate. Mutation can cause style re-calcuation.\n imageSize: {\n width: 32,\n height: 32\n }\n };\n return ChoiceGroupOptionBase;\n}(React.Component);\n\nexport { ChoiceGroupOptionBase };","import { __assign } from \"tslib\";\nimport { HighContrastSelector, getGlobalClassNames, getHighContrastNoAdjustStyle } from '../../../Styling';\nimport { IsFocusVisibleClassName } from '../../../Utilities';\nvar GlobalClassNames = {\n root: 'ms-ChoiceField',\n choiceFieldWrapper: 'ms-ChoiceField-wrapper',\n input: 'ms-ChoiceField-input',\n field: 'ms-ChoiceField-field',\n innerField: 'ms-ChoiceField-innerField',\n imageWrapper: 'ms-ChoiceField-imageWrapper',\n iconWrapper: 'ms-ChoiceField-iconWrapper',\n labelWrapper: 'ms-ChoiceField-labelWrapper',\n checked: 'is-checked'\n};\nvar labelWrapperLineHeight = 15;\nvar labelWrapperHeight = labelWrapperLineHeight * 2 + 2; // adding 2px height to ensure text doesn't get cutoff\n\nvar iconSize = 32;\nvar choiceFieldSize = 20;\nvar choiceFieldTransitionDuration = '200ms';\nvar choiceFieldTransitionTiming = 'cubic-bezier(.4, 0, .23, 1)';\nvar radioButtonSpacing = 3;\nvar radioButtonInnerSize = 5;\n\nfunction getChoiceGroupFocusStyle(focusBorderColor, hasIconOrImage) {\n var _a, _b;\n\n return ['is-inFocus', {\n selectors: (_a = {}, _a[\".\" + IsFocusVisibleClassName + \" &\"] = {\n position: 'relative',\n outline: 'transparent',\n selectors: {\n '::-moz-focus-inner': {\n border: 0\n },\n ':after': {\n content: '\"\"',\n top: -2,\n right: -2,\n bottom: -2,\n left: -2,\n pointerEvents: 'none',\n border: \"1px solid \" + focusBorderColor,\n position: 'absolute',\n selectors: (_b = {}, _b[HighContrastSelector] = {\n borderColor: 'WindowText',\n borderWidth: hasIconOrImage ? 1 : 2\n }, _b)\n }\n }\n }, _a)\n }];\n}\n\nfunction getImageWrapperStyle(isSelectedImageWrapper, className, checked) {\n return [className, {\n paddingBottom: 2,\n transitionProperty: 'opacity',\n transitionDuration: choiceFieldTransitionDuration,\n transitionTimingFunction: 'ease',\n selectors: {\n '.ms-Image': {\n display: 'inline-block',\n borderStyle: 'none'\n }\n }\n }, (checked ? !isSelectedImageWrapper : isSelectedImageWrapper) && ['is-hidden', {\n position: 'absolute',\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n overflow: 'hidden',\n opacity: 0\n }]];\n}\n\nexport var getStyles = function getStyles(props) {\n var _a, _b, _c, _d, _e;\n\n var theme = props.theme,\n hasIcon = props.hasIcon,\n hasImage = props.hasImage,\n checked = props.checked,\n disabled = props.disabled,\n imageIsLarge = props.imageIsLarge,\n focused = props.focused,\n imageSize = props.imageSize;\n var palette = theme.palette,\n semanticColors = theme.semanticColors,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(GlobalClassNames, theme); // Tokens\n // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.smallInputBorder\n\n var circleBorderColor = palette.neutralPrimary;\n var circleHoveredBorderColor = semanticColors.inputBorderHovered;\n var circleCheckedBorderColor = semanticColors.inputBackgroundChecked; // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered\n\n var circleCheckedHoveredBorderColor = palette.themeDark;\n var circleDisabledBorderColor = semanticColors.disabledBodySubtext;\n var circleBackgroundColor = semanticColors.bodyBackground;\n var dotUncheckedHoveredColor = palette.neutralSecondary;\n var dotCheckedColor = semanticColors.inputBackgroundChecked; // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered\n\n var dotCheckedHoveredColor = palette.themeDark;\n var dotDisabledColor = semanticColors.disabledBodySubtext; // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.bodyTextChecked\n\n var labelHoverFocusColor = palette.neutralDark;\n var focusBorderColor = semanticColors.focusBorder;\n var iconOrImageChoiceBorderUncheckedHoveredColor = semanticColors.inputBorderHovered; // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered\n\n var iconOrImageChoiceBorderCheckedColor = semanticColors.inputBackgroundChecked;\n var iconOrImageChoiceBorderCheckedHoveredColor = palette.themeDark;\n var iconOrImageChoiceBackgroundColor = palette.neutralLighter;\n var fieldHoverOrFocusProperties = {\n selectors: {\n '.ms-ChoiceFieldLabel': {\n color: labelHoverFocusColor\n },\n ':before': {\n borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor\n },\n ':after': [!hasIcon && !hasImage && !checked && {\n content: '\"\"',\n transitionProperty: 'background-color',\n left: 5,\n top: 5,\n width: 10,\n height: 10,\n backgroundColor: dotUncheckedHoveredColor\n }, checked && {\n borderColor: dotCheckedHoveredColor\n }]\n }\n };\n var enabledFieldWithImageHoverOrFocusProperties = {\n borderColor: checked ? iconOrImageChoiceBorderCheckedHoveredColor : iconOrImageChoiceBorderUncheckedHoveredColor,\n selectors: {\n ':before': {\n opacity: 1,\n borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor\n }\n }\n };\n var circleAreaProperties = [{\n content: '\"\"',\n display: 'inline-block',\n backgroundColor: circleBackgroundColor,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: circleBorderColor,\n width: choiceFieldSize,\n height: choiceFieldSize,\n fontWeight: 'normal',\n position: 'absolute',\n top: 0,\n left: 0,\n boxSizing: 'border-box',\n transitionProperty: 'border-color',\n transitionDuration: choiceFieldTransitionDuration,\n transitionTimingFunction: choiceFieldTransitionTiming,\n borderRadius: '50%'\n }, disabled && {\n borderColor: circleDisabledBorderColor,\n selectors: (_a = {}, _a[HighContrastSelector] = __assign({\n borderColor: 'GrayText',\n background: 'Window'\n }, getHighContrastNoAdjustStyle()), _a)\n }, checked && {\n borderColor: disabled ? circleDisabledBorderColor : circleCheckedBorderColor,\n selectors: (_b = {}, _b[HighContrastSelector] = {\n borderColor: 'Highlight',\n background: 'Window',\n forcedColorAdjust: 'none'\n }, _b)\n }, (hasIcon || hasImage) && {\n top: radioButtonSpacing,\n right: radioButtonSpacing,\n left: 'auto',\n opacity: checked ? 1 : 0\n }];\n var dotAreaProperties = [{\n content: '\"\"',\n width: 0,\n height: 0,\n borderRadius: '50%',\n position: 'absolute',\n left: choiceFieldSize / 2,\n right: 0,\n transitionProperty: 'border-width',\n transitionDuration: choiceFieldTransitionDuration,\n transitionTimingFunction: choiceFieldTransitionTiming,\n boxSizing: 'border-box'\n }, checked && {\n borderWidth: 5,\n borderStyle: 'solid',\n borderColor: disabled ? dotDisabledColor : dotCheckedColor,\n left: 5,\n top: 5,\n width: 10,\n height: 10,\n selectors: (_c = {}, _c[HighContrastSelector] = {\n borderColor: 'Highlight',\n forcedColorAdjust: 'none'\n }, _c)\n }, checked && (hasIcon || hasImage) && {\n top: radioButtonSpacing + radioButtonInnerSize,\n right: radioButtonSpacing + radioButtonInnerSize,\n left: 'auto'\n }];\n return {\n root: [classNames.root, theme.fonts.medium, {\n display: 'flex',\n alignItems: 'center',\n boxSizing: 'border-box',\n color: semanticColors.bodyText,\n minHeight: 26,\n border: 'none',\n position: 'relative',\n marginTop: 8,\n selectors: {\n '.ms-ChoiceFieldLabel': {\n display: 'inline-block'\n }\n }\n }, !hasIcon && !hasImage && {\n selectors: {\n '.ms-ChoiceFieldLabel': {\n paddingLeft: '26px'\n }\n }\n }, hasImage && 'ms-ChoiceField--image', hasIcon && 'ms-ChoiceField--icon', (hasIcon || hasImage) && {\n display: 'inline-flex',\n fontSize: 0,\n margin: '0 4px 4px 0',\n paddingLeft: 0,\n backgroundColor: iconOrImageChoiceBackgroundColor,\n height: '100%'\n }],\n choiceFieldWrapper: [classNames.choiceFieldWrapper, focused && getChoiceGroupFocusStyle(focusBorderColor, hasIcon || hasImage)],\n // The hidden input\n input: [classNames.input, {\n position: 'absolute',\n opacity: 0,\n top: 0,\n right: 0,\n width: '100%',\n height: '100%',\n margin: 0\n }, disabled && 'is-disabled'],\n field: [classNames.field, checked && classNames.checked, {\n display: 'inline-block',\n cursor: 'pointer',\n marginTop: 0,\n position: 'relative',\n verticalAlign: 'top',\n userSelect: 'none',\n minHeight: 20,\n selectors: {\n ':hover': !disabled && fieldHoverOrFocusProperties,\n ':focus': !disabled && fieldHoverOrFocusProperties,\n // The circle\n ':before': circleAreaProperties,\n // The dot\n ':after': dotAreaProperties\n }\n }, hasIcon && 'ms-ChoiceField--icon', hasImage && 'ms-ChoiceField-field--image', (hasIcon || hasImage) && {\n boxSizing: 'content-box',\n cursor: 'pointer',\n paddingTop: 22,\n margin: 0,\n textAlign: 'center',\n transitionProperty: 'all',\n transitionDuration: choiceFieldTransitionDuration,\n transitionTimingFunction: 'ease',\n border: '1px solid transparent',\n justifyContent: 'center',\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column'\n }, checked && {\n borderColor: iconOrImageChoiceBorderCheckedColor\n }, (hasIcon || hasImage) && !disabled && {\n selectors: {\n ':hover': enabledFieldWithImageHoverOrFocusProperties,\n ':focus': enabledFieldWithImageHoverOrFocusProperties\n }\n }, disabled && {\n cursor: 'default',\n selectors: {\n '.ms-ChoiceFieldLabel': {\n color: semanticColors.disabledBodyText,\n selectors: (_d = {}, _d[HighContrastSelector] = __assign({\n color: 'GrayText'\n }, getHighContrastNoAdjustStyle()), _d)\n }\n }\n }, checked && disabled && {\n borderColor: iconOrImageChoiceBackgroundColor\n }],\n innerField: [classNames.innerField, hasImage && {\n // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class.\n height: imageSize.height,\n width: imageSize.width\n }, (hasIcon || hasImage) && {\n position: 'relative',\n display: 'inline-block',\n paddingLeft: 30,\n paddingRight: 30\n }, (hasIcon || hasImage) && imageIsLarge && {\n paddingLeft: 24,\n paddingRight: 24\n }, (hasIcon || hasImage) && disabled && {\n opacity: 0.25,\n selectors: (_e = {}, _e[HighContrastSelector] = {\n color: 'GrayText',\n opacity: 1\n }, _e)\n }],\n imageWrapper: getImageWrapperStyle(false, classNames.imageWrapper, checked),\n selectedImageWrapper: getImageWrapperStyle(true, classNames.imageWrapper, checked),\n iconWrapper: [classNames.iconWrapper, {\n fontSize: iconSize,\n lineHeight: iconSize,\n height: iconSize\n }],\n labelWrapper: [classNames.labelWrapper, fonts.medium, (hasIcon || hasImage) && {\n display: 'block',\n position: 'relative',\n margin: '4px 8px 2px 8px',\n height: labelWrapperHeight,\n lineHeight: labelWrapperLineHeight,\n // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class.\n maxWidth: imageSize.width * 2,\n overflow: 'hidden',\n whiteSpace: 'pre-wrap'\n }]\n };\n};","import { styled } from '../../../Utilities';\nimport { ChoiceGroupOptionBase } from './ChoiceGroupOption.base';\nimport { getStyles } from './ChoiceGroupOption.styles';\nexport var ChoiceGroupOption = styled(ChoiceGroupOptionBase, getStyles, undefined, {\n scope: 'ChoiceGroupOption'\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { Label } from '../../Label';\nimport { initializeComponentRef, warnDeprecations, warnMutuallyExclusive, classNamesFunction, find, getId, isControlled, getNativeProps, divProperties, setFocusVisibility } from '../../Utilities';\nimport { ChoiceGroupOption } from './ChoiceGroupOption/index';\nvar getClassNames = classNamesFunction();\n/**\n * {@docCategory ChoiceGroup}\n */\n\nvar ChoiceGroupBase =\n/** @class */\nfunction (_super) {\n __extends(ChoiceGroupBase, _super);\n\n function ChoiceGroupBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._focusCallbacks = {};\n _this._changeCallbacks = {};\n\n _this._onBlur = function (ev, option) {\n _this.setState({\n keyFocused: undefined\n });\n };\n\n initializeComponentRef(_this);\n\n if (process.env.NODE_ENV !== 'production') {\n warnDeprecations('ChoiceGroup', props, {\n onChanged: 'onChange'\n });\n warnMutuallyExclusive('ChoiceGroup', props, {\n selectedKey: 'defaultSelectedKey'\n });\n }\n\n var defaultSelectedKey = props.defaultSelectedKey,\n _a = props.options,\n options = _a === void 0 ? [] : _a;\n var validDefaultSelectedKey = !_isControlled(props) && defaultSelectedKey !== undefined && options.some(function (option) {\n return option.key === defaultSelectedKey;\n });\n _this.state = {\n keyChecked: validDefaultSelectedKey ? defaultSelectedKey : _this._getKeyChecked(props)\n };\n _this._id = getId('ChoiceGroup');\n _this._labelId = getId('ChoiceGroupLabel');\n return _this;\n }\n\n Object.defineProperty(ChoiceGroupBase.prototype, \"checkedOption\", {\n /**\n * Gets the current checked option.\n */\n get: function get() {\n var _this = this;\n\n var _a = this.props.options,\n options = _a === void 0 ? [] : _a;\n return find(options, function (value) {\n return value.key === _this.state.keyChecked;\n });\n },\n enumerable: true,\n configurable: true\n });\n\n ChoiceGroupBase.prototype.componentDidUpdate = function (prevProps, prevState) {\n // Only update if a new props object has been passed in (don't care about state updates)\n if (prevProps !== this.props) {\n var newKeyChecked = this._getKeyChecked(this.props);\n\n var oldKeyChecked = this._getKeyChecked(prevProps);\n\n if (newKeyChecked !== oldKeyChecked) {\n this.setState({\n keyChecked: newKeyChecked\n });\n }\n }\n };\n\n ChoiceGroupBase.prototype.render = function () {\n var _this = this;\n\n var _a = this.props,\n className = _a.className,\n theme = _a.theme,\n styles = _a.styles,\n _b = _a.options,\n options = _b === void 0 ? [] : _b,\n label = _a.label,\n required = _a.required,\n disabled = _a.disabled,\n name = _a.name;\n var _c = this.state,\n keyChecked = _c.keyChecked,\n keyFocused = _c.keyFocused;\n var divProps = getNativeProps(this.props, divProperties, ['onChange', 'className', 'required']);\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n optionsContainIconOrImage: options.some(function (option) {\n return !!(option.iconProps || option.imageSrc);\n })\n });\n var labelId = this._id + '-label';\n var ariaLabelledBy = this.props.ariaLabelledBy || (label ? labelId : this.props['aria-labelledby']); // TODO (Fabric 8?) - if possible, move `root` class to the actual root and eliminate\n // `applicationRole` class (but the div structure will stay the same by necessity)\n\n return (// eslint-disable-next-line deprecation/deprecation\n React.createElement(\"div\", __assign({\n className: classNames.applicationRole\n }, divProps), React.createElement(\"div\", __assign({\n className: classNames.root,\n role: \"radiogroup\"\n }, ariaLabelledBy && {\n 'aria-labelledby': ariaLabelledBy\n }), label && React.createElement(Label, {\n className: classNames.label,\n required: required,\n id: labelId,\n disabled: disabled\n }, label), React.createElement(\"div\", {\n className: classNames.flexContainer\n }, options.map(function (option) {\n var innerOptionProps = __assign(__assign({}, option), {\n focused: option.key === keyFocused,\n checked: option.key === keyChecked,\n disabled: option.disabled || disabled,\n id: _this._getOptionId(option),\n labelId: _this._getOptionLabelId(option),\n name: name || _this._id,\n required: required\n });\n\n return React.createElement(ChoiceGroupOption, __assign({\n key: option.key,\n onBlur: _this._onBlur,\n onFocus: _this._onFocus(option.key),\n onChange: _this._onChange(option.key)\n }, innerOptionProps));\n }))))\n );\n };\n\n ChoiceGroupBase.prototype.focus = function () {\n var _a = this.props.options,\n options = _a === void 0 ? [] : _a;\n var optionToFocus = this.checkedOption || options.filter(function (option) {\n return !option.disabled;\n })[0];\n var elementToFocus = optionToFocus && document.getElementById(this._getOptionId(optionToFocus));\n\n if (elementToFocus) {\n elementToFocus.focus();\n setFocusVisibility(true, elementToFocus);\n }\n };\n\n ChoiceGroupBase.prototype._onFocus = function (key) {\n var _this = this; // This extra mess is necessary because React won't pass the `key` prop through to ChoiceGroupOption\n\n\n if (!this._focusCallbacks[key]) {\n this._focusCallbacks[key] = function (ev, option) {\n _this.setState({\n keyFocused: key\n });\n };\n }\n\n return this._focusCallbacks[key];\n };\n\n ChoiceGroupBase.prototype._onChange = function (key) {\n var _this = this; // This extra mess is necessary because React won't pass the `key` prop through to ChoiceGroupOption\n\n\n if (!this._changeCallbacks[key]) {\n this._changeCallbacks[key] = function (evt, option) {\n // eslint-disable-next-line deprecation/deprecation\n var _a = _this.props,\n onChanged = _a.onChanged,\n onChange = _a.onChange; // Only manage state in uncontrolled scenarios.\n\n if (!_isControlled(_this.props)) {\n _this.setState({\n keyChecked: key\n });\n } // Get the original option without the `key` prop removed\n\n\n var originalOption = find(_this.props.options || [], function (value) {\n return value.key === key;\n }); // TODO: onChanged deprecated, remove else if after 07/17/2017 when onChanged has been removed.\n\n if (onChange) {\n onChange(evt, originalOption);\n } else if (onChanged) {\n onChanged(originalOption, evt);\n }\n };\n }\n\n return this._changeCallbacks[key];\n };\n /**\n * Returns `selectedKey` if provided, or the key of the first option with the `checked` prop set.\n */\n\n\n ChoiceGroupBase.prototype._getKeyChecked = function (props) {\n if (props.selectedKey !== undefined) {\n return props.selectedKey;\n }\n\n var _a = props.options,\n options = _a === void 0 ? [] : _a; // eslint-disable-next-line deprecation/deprecation\n\n var optionsChecked = options.filter(function (option) {\n return option.checked;\n });\n return optionsChecked[0] && optionsChecked[0].key;\n };\n\n ChoiceGroupBase.prototype._getOptionId = function (option) {\n return option.id || this._id + \"-\" + option.key;\n };\n\n ChoiceGroupBase.prototype._getOptionLabelId = function (option) {\n return option.labelId || this._labelId + \"-\" + option.key;\n };\n\n return ChoiceGroupBase;\n}(React.Component);\n\nexport { ChoiceGroupBase };\n\nfunction _isControlled(props) {\n return isControlled(props, 'selectedKey');\n}","import { getGlobalClassNames } from '../../Styling';\nvar GlobalClassNames = {\n root: 'ms-ChoiceFieldGroup',\n flexContainer: 'ms-ChoiceFieldGroup-flexContainer'\n};\nexport var getStyles = function getStyles(props) {\n var className = props.className,\n optionsContainIconOrImage = props.optionsContainIconOrImage,\n theme = props.theme;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n return {\n // TODO (Fabric 8?) - merge className back into `root` and apply root style to\n // the actual root role=application element\n applicationRole: className,\n root: [classNames.root, theme.fonts.medium, {\n display: 'block'\n }],\n flexContainer: [classNames.flexContainer, optionsContainIconOrImage && {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap'\n }]\n };\n};","import { styled } from '../../Utilities';\nimport { ChoiceGroupBase } from './ChoiceGroup.base';\nimport { getStyles } from './ChoiceGroup.styles';\nexport var ChoiceGroup = styled(ChoiceGroupBase, getStyles, undefined, {\n scope: 'ChoiceGroup'\n});","var _a, _b;\n\nimport { __assign } from \"tslib\";\nimport { FontWeights, concatStyleSets, getFocusStyle, HighContrastSelector, getPlaceholderStyles, hiddenContentStyle, getInputFocusStyle, getHighContrastNoAdjustStyle } from '../../Styling';\nimport { memoizeFunction } from '../../Utilities';\nvar ComboBoxHeight = 32;\nvar ComboBoxLineHeight = 30;\nvar ComboBoxCaretDownWidth = 32;\nvar ComboBoxOptionHeight = 36;\nvar getDisabledStyles = memoizeFunction(function (theme) {\n var _a;\n\n var semanticColors = theme.semanticColors;\n return {\n backgroundColor: semanticColors.disabledBackground,\n color: semanticColors.disabledText,\n cursor: 'default',\n selectors: (_a = {\n ':after': {\n borderColor: semanticColors.disabledBackground\n }\n }, _a[HighContrastSelector] = {\n color: 'GrayText',\n selectors: {\n ':after': {\n borderColor: 'GrayText'\n }\n }\n }, _a)\n };\n});\nvar listOptionHighContrastStyles = {\n selectors: (_a = {}, _a[HighContrastSelector] = __assign({\n backgroundColor: 'Highlight',\n borderColor: 'Highlight',\n color: 'HighlightText'\n }, getHighContrastNoAdjustStyle()), _a)\n};\nvar inputHighContrastStyles = {\n selectors: (_b = {}, _b[HighContrastSelector] = __assign({\n color: 'WindowText',\n backgroundColor: 'Window'\n }, getHighContrastNoAdjustStyle()), _b)\n};\nexport var getOptionStyles = memoizeFunction(function (theme, customStylesForAllOptions, customOptionStylesForCurrentOption, isPending, isHidden) {\n var _a;\n\n var palette = theme.palette,\n semanticColors = theme.semanticColors;\n var option = {\n textHoveredColor: semanticColors.menuItemTextHovered,\n textSelectedColor: palette.neutralDark,\n textDisabledColor: semanticColors.disabledText,\n backgroundHoveredColor: semanticColors.menuItemBackgroundHovered,\n backgroundPressedColor: semanticColors.menuItemBackgroundPressed\n };\n var optionStyles = {\n root: [theme.fonts.medium, {\n backgroundColor: isPending ? option.backgroundHoveredColor : 'transparent',\n boxSizing: 'border-box',\n cursor: 'pointer',\n display: isHidden ? 'none' : 'block',\n width: '100%',\n height: 'auto',\n minHeight: ComboBoxOptionHeight,\n lineHeight: '20px',\n padding: '0 8px',\n position: 'relative',\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: 'transparent',\n borderRadius: 0,\n wordWrap: 'break-word',\n overflowWrap: 'break-word',\n textAlign: 'left',\n selectors: (_a = {}, _a[HighContrastSelector] = {\n border: 'none',\n borderColor: 'Background'\n }, _a['&.ms-Checkbox'] = {\n display: 'flex',\n alignItems: 'center'\n }, _a['&.ms-Button--command:hover:active'] = {\n backgroundColor: option.backgroundPressedColor\n }, _a['.ms-Checkbox-label'] = {\n width: '100%'\n }, _a)\n }],\n rootHovered: {\n backgroundColor: option.backgroundHoveredColor,\n color: option.textHoveredColor\n },\n rootFocused: {\n backgroundColor: option.backgroundHoveredColor\n },\n rootChecked: [{\n backgroundColor: 'transparent',\n color: option.textSelectedColor,\n selectors: {\n ':hover': [{\n backgroundColor: option.backgroundHoveredColor\n }, listOptionHighContrastStyles]\n }\n }, getFocusStyle(theme, {\n inset: -1,\n isFocusedOnly: false\n }), listOptionHighContrastStyles],\n rootDisabled: {\n color: option.textDisabledColor,\n cursor: 'default'\n },\n optionText: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n minWidth: '0px',\n maxWidth: '100%',\n wordWrap: 'break-word',\n overflowWrap: 'break-word',\n display: 'inline-block'\n },\n optionTextWrapper: {\n maxWidth: '100%',\n display: 'flex',\n alignItems: 'center'\n }\n };\n return concatStyleSets(optionStyles, customStylesForAllOptions, customOptionStylesForCurrentOption);\n});\nexport var getCaretDownButtonStyles = memoizeFunction(function (theme, customStyles) {\n var _a, _b;\n\n var semanticColors = theme.semanticColors,\n fonts = theme.fonts;\n var caret = {\n buttonTextColor: semanticColors.bodySubtext,\n buttonTextHoveredCheckedColor: semanticColors.buttonTextChecked,\n buttonBackgroundHoveredColor: semanticColors.listItemBackgroundHovered,\n buttonBackgroundCheckedColor: semanticColors.listItemBackgroundChecked,\n buttonBackgroundCheckedHoveredColor: semanticColors.listItemBackgroundCheckedHovered\n };\n var buttonHighContrastStyles = {\n selectors: (_a = {}, _a[HighContrastSelector] = __assign({\n backgroundColor: 'Highlight',\n borderColor: 'Highlight',\n color: 'HighlightText'\n }, getHighContrastNoAdjustStyle()), _a)\n };\n var styles = {\n root: {\n color: caret.buttonTextColor,\n fontSize: fonts.small.fontSize,\n position: 'absolute',\n top: 0,\n height: '100%',\n lineHeight: ComboBoxLineHeight,\n width: ComboBoxCaretDownWidth,\n textAlign: 'center',\n cursor: 'default',\n selectors: (_b = {}, _b[HighContrastSelector] = __assign({\n backgroundColor: 'ButtonFace',\n borderColor: 'ButtonText',\n color: 'ButtonText'\n }, getHighContrastNoAdjustStyle()), _b)\n },\n icon: {\n fontSize: fonts.small.fontSize\n },\n rootHovered: [{\n backgroundColor: caret.buttonBackgroundHoveredColor,\n color: caret.buttonTextHoveredCheckedColor,\n cursor: 'pointer'\n }, buttonHighContrastStyles],\n rootPressed: [{\n backgroundColor: caret.buttonBackgroundCheckedColor,\n color: caret.buttonTextHoveredCheckedColor\n }, buttonHighContrastStyles],\n rootChecked: [{\n backgroundColor: caret.buttonBackgroundCheckedColor,\n color: caret.buttonTextHoveredCheckedColor\n }, buttonHighContrastStyles],\n rootCheckedHovered: [{\n backgroundColor: caret.buttonBackgroundCheckedHoveredColor,\n color: caret.buttonTextHoveredCheckedColor\n }, buttonHighContrastStyles],\n rootDisabled: [getDisabledStyles(theme), {\n position: 'absolute'\n }]\n };\n return concatStyleSets(styles, customStyles);\n});\nexport var getStyles = memoizeFunction(function (theme, customStyles, comboBoxOptionWidth) {\n var _a, _b, _c, _d, _e, _f;\n\n var semanticColors = theme.semanticColors,\n fonts = theme.fonts,\n effects = theme.effects;\n var root = {\n textColor: semanticColors.inputText,\n borderColor: semanticColors.inputBorder,\n borderHoveredColor: semanticColors.inputBorderHovered,\n borderPressedColor: semanticColors.inputFocusBorderAlt,\n borderFocusedColor: semanticColors.inputFocusBorderAlt,\n backgroundColor: semanticColors.inputBackground,\n erroredColor: semanticColors.errorText\n };\n var option = {\n headerTextColor: semanticColors.menuHeader,\n dividerBorderColor: semanticColors.bodyDivider\n }; // placeholder style variables\n\n var placeholderHighContrastStyles = {\n selectors: (_a = {}, _a[HighContrastSelector] = {\n color: 'GrayText'\n }, _a)\n };\n var placeholderStyles = [{\n color: semanticColors.inputPlaceholderText\n }, placeholderHighContrastStyles];\n var placeholderStylesHovered = [{\n color: semanticColors.inputTextHovered\n }, placeholderHighContrastStyles];\n var disabledPlaceholderStyles = [{\n color: semanticColors.disabledText\n }, placeholderHighContrastStyles];\n\n var ComboBoxRootHighContrastFocused = __assign(__assign({\n color: 'HighlightText',\n backgroundColor: 'Window'\n }, getHighContrastNoAdjustStyle()), {\n selectors: {\n ':after': {\n borderColor: 'Highlight'\n }\n }\n });\n\n var focusBorderStyles = getInputFocusStyle(root.borderPressedColor, effects.roundedCorner2, 'border', 0);\n var styles = {\n container: {},\n label: {},\n labelDisabled: {},\n root: [theme.fonts.medium, {\n boxShadow: 'none',\n marginLeft: '0',\n paddingRight: ComboBoxCaretDownWidth,\n paddingLeft: 9,\n color: root.textColor,\n position: 'relative',\n outline: '0',\n userSelect: 'none',\n backgroundColor: root.backgroundColor,\n cursor: 'text',\n display: 'block',\n height: ComboBoxHeight,\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n boxSizing: 'border-box',\n selectors: {\n '.ms-Label': {\n display: 'inline-block',\n marginBottom: '8px'\n },\n '&.is-open': {\n selectors: (_b = {}, _b[HighContrastSelector] = ComboBoxRootHighContrastFocused, _b)\n },\n // setting border using pseudo-element here in order to\n // prevent chevron button to overlap ComboBox border under certain resolutions\n ':after': {\n pointerEvents: 'none',\n content: \"''\",\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0,\n right: 0,\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: root.borderColor,\n borderRadius: effects.roundedCorner2\n }\n }\n }],\n rootHovered: {\n selectors: (_c = {\n ':after': {\n borderColor: root.borderHoveredColor\n },\n '.ms-ComboBox-Input': [{\n color: semanticColors.inputTextHovered\n }, getPlaceholderStyles(placeholderStylesHovered), inputHighContrastStyles]\n }, _c[HighContrastSelector] = __assign(__assign({\n color: 'HighlightText',\n backgroundColor: 'Window'\n }, getHighContrastNoAdjustStyle()), {\n selectors: {\n ':after': {\n borderColor: 'Highlight'\n }\n }\n }), _c)\n },\n rootPressed: [{\n position: 'relative',\n selectors: (_d = {}, _d[HighContrastSelector] = ComboBoxRootHighContrastFocused, _d)\n }],\n rootFocused: [{\n selectors: (_e = {\n '.ms-ComboBox-Input': [{\n color: semanticColors.inputTextHovered\n }, inputHighContrastStyles]\n }, _e[HighContrastSelector] = ComboBoxRootHighContrastFocused, _e)\n }, focusBorderStyles],\n rootDisabled: getDisabledStyles(theme),\n rootError: {\n selectors: {\n ':after': {\n borderColor: root.erroredColor\n },\n ':hover:after': {\n borderColor: semanticColors.inputBorderHovered\n }\n }\n },\n rootDisallowFreeForm: {},\n input: [getPlaceholderStyles(placeholderStyles), {\n backgroundColor: root.backgroundColor,\n color: root.textColor,\n boxSizing: 'border-box',\n width: '100%',\n height: '100%',\n borderStyle: 'none',\n outline: 'none',\n font: 'inherit',\n textOverflow: 'ellipsis',\n padding: '0',\n selectors: {\n '::-ms-clear': {\n display: 'none'\n }\n }\n }, inputHighContrastStyles],\n inputDisabled: [getDisabledStyles(theme), getPlaceholderStyles(disabledPlaceholderStyles)],\n errorMessage: [theme.fonts.small, {\n color: root.erroredColor,\n marginTop: '5px'\n }],\n callout: {\n boxShadow: effects.elevation8\n },\n optionsContainerWrapper: {\n width: comboBoxOptionWidth\n },\n optionsContainer: {\n display: 'block'\n },\n screenReaderText: hiddenContentStyle,\n header: [fonts.medium, {\n fontWeight: FontWeights.semibold,\n color: option.headerTextColor,\n backgroundColor: 'none',\n borderStyle: 'none',\n height: ComboBoxOptionHeight,\n lineHeight: ComboBoxOptionHeight,\n cursor: 'default',\n padding: '0 8px',\n userSelect: 'none',\n textAlign: 'left',\n selectors: (_f = {}, _f[HighContrastSelector] = __assign({\n color: 'GrayText'\n }, getHighContrastNoAdjustStyle()), _f)\n }],\n divider: {\n height: 1,\n backgroundColor: option.dividerBorderColor\n }\n };\n return concatStyleSets(styles, customStyles);\n});","import { __assign, __decorate, __extends, __spreadArrays } from \"tslib\";\nimport * as React from 'react';\nimport { Autofill } from '../Autofill/index';\nimport { initializeComponentRef, css, customizable, divProperties, findElementRecursive, findIndex, focusAsync, getId, getNativeProps, isIOS, isMac, KeyCodes, shallowCompare, mergeAriaAttributeValues, warnMutuallyExclusive, Async, EventGroup } from '../../Utilities';\nimport { Callout } from '../../Callout';\nimport { Checkbox } from '../../Checkbox';\nimport { CommandButton, IconButton } from '../../Button';\nimport { DirectionalHint } from '../../common/DirectionalHint';\nimport { getCaretDownButtonStyles, getOptionStyles, getStyles } from './ComboBox.styles';\nimport { getClassNames, getComboBoxOptionClassNames } from './ComboBox.classNames';\nimport { KeytipData } from '../../KeytipData';\nimport { Label } from '../../Label';\nimport { SelectableOptionMenuItemType, getAllSelectedOptions } from '../../utilities/selectableOption/index';\nvar SearchDirection;\n\n(function (SearchDirection) {\n SearchDirection[SearchDirection[\"backward\"] = -1] = \"backward\";\n SearchDirection[SearchDirection[\"none\"] = 0] = \"none\";\n SearchDirection[SearchDirection[\"forward\"] = 1] = \"forward\";\n})(SearchDirection || (SearchDirection = {}));\n\nvar HoverStatus;\n\n(function (HoverStatus) {\n /** Used when the user was hovering and has since moused out of the menu items */\n HoverStatus[HoverStatus[\"clearAll\"] = -2] = \"clearAll\";\n /** Default \"normal\" state, when no hover has happened or a hover is in progress */\n\n HoverStatus[HoverStatus[\"default\"] = -1] = \"default\";\n})(HoverStatus || (HoverStatus = {}));\n\nvar ScrollIdleDelay = 250;\n/* ms */\n\nvar TouchIdleDelay = 500;\n/* ms */\n\n/**\n * This is used to clear any pending autocomplete text (used when autocomplete is true and\n * allowFreeform is false)\n */\n\nvar ReadOnlyPendingAutoCompleteTimeout = 1000;\n/* ms */\n\n/**\n * Internal class that is used to wrap all ComboBox options.\n * This is used to customize when we want to rerender components,\n * so we don't rerender every option every time render is executed.\n */\n\nvar ComboBoxOptionWrapper =\n/** @class */\nfunction (_super) {\n __extends(ComboBoxOptionWrapper, _super);\n\n function ComboBoxOptionWrapper() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n ComboBoxOptionWrapper.prototype.render = function () {\n return this.props.render();\n };\n\n ComboBoxOptionWrapper.prototype.shouldComponentUpdate = function (newProps) {\n // The render function will always be different, so we ignore that prop\n return !shallowCompare(__assign(__assign({}, this.props), {\n render: undefined\n }), __assign(__assign({}, newProps), {\n render: undefined\n }));\n };\n\n return ComboBoxOptionWrapper;\n}(React.Component);\n\nvar COMPONENT_NAME = 'ComboBox';\n\nvar ComboBox =\n/** @class */\nfunction (_super) {\n __extends(ComboBox, _super);\n\n function ComboBox(props) {\n var _this = _super.call(this, props) || this;\n\n _this._root = React.createRef();\n /** The input aspect of the comboBox */\n\n _this._autofill = React.createRef();\n /** The wrapping div of the input and button */\n\n _this._comboBoxWrapper = React.createRef();\n /** The callout element */\n\n _this._comboBoxMenu = React.createRef();\n /** The menu item element that is currently selected */\n\n _this._selectedElement = React.createRef();\n /**\n * {@inheritdoc}\n */\n\n _this.focus = function (shouldOpenOnFocus, useFocusAsync) {\n if (_this.props.disabled === true) {\n return;\n }\n\n if (_this._autofill.current) {\n if (useFocusAsync) {\n focusAsync(_this._autofill.current);\n } else {\n _this._autofill.current.focus();\n }\n\n if (shouldOpenOnFocus) {\n _this.setState({\n isOpen: true\n });\n }\n } // Programatically setting focus means that there is nothing else that needs to be done\n // Focus is now contained\n\n\n if (!_this._hasFocus()) {\n _this.setState({\n focusState: 'focused'\n });\n }\n };\n /**\n * Close menu callout if it is open\n */\n\n\n _this.dismissMenu = function () {\n var isOpen = _this.state.isOpen;\n isOpen && _this.setState({\n isOpen: false\n });\n };\n /**\n * componentWillReceiveProps handler for the auto fill component\n * Checks/updates the iput value to set, if needed\n * @param defaultVisibleValue - the defaultVisibleValue that got passed\n * in to the auto fill's componentWillReceiveProps\n * @returns - the updated value to set, if needed\n */\n\n\n _this._onUpdateValueInAutofillWillReceiveProps = function () {\n var comboBox = _this._autofill.current;\n\n if (!comboBox) {\n return null;\n }\n\n if (comboBox.value === null || comboBox.value === undefined) {\n return null;\n }\n\n var visibleValue = _this._normalizeToString(_this._currentVisibleValue);\n\n if (comboBox.value !== visibleValue) {\n // If visibleValue is empty, ensure that the empty string is used\n return visibleValue || '';\n }\n\n return comboBox.value;\n };\n\n _this._renderComboBoxWrapper = function (multiselectAccessibleText, errorMessageId, keytipAttributes) {\n if (keytipAttributes === void 0) {\n keytipAttributes = {};\n }\n\n var _a = _this.props,\n label = _a.label,\n disabled = _a.disabled,\n ariaLabel = _a.ariaLabel,\n ariaDescribedBy = _a.ariaDescribedBy,\n required = _a.required,\n errorMessage = _a.errorMessage,\n buttonIconProps = _a.buttonIconProps,\n _b = _a.isButtonAriaHidden,\n isButtonAriaHidden = _b === void 0 ? true : _b,\n title = _a.title,\n placeholderProp = _a.placeholder,\n tabIndex = _a.tabIndex,\n autofill = _a.autofill,\n iconButtonProps = _a.iconButtonProps;\n var _c = _this.state,\n isOpen = _c.isOpen,\n suggestedDisplayValue = _c.suggestedDisplayValue; // If the combobox has focus, is multiselect, and has a display string, then use that placeholder\n // so that the selected items don't appear to vanish. This is not ideal but it's the only reasonable way\n // to correct the behavior where the input is cleared so the user can type. If a full refactor is done, then this\n // should be removed and the multiselect combobox should behave like a picker.\n\n var placeholder = _this._hasFocus() && _this.props.multiSelect && multiselectAccessibleText ? multiselectAccessibleText : placeholderProp;\n return React.createElement(\"div\", {\n \"data-ktp-target\": keytipAttributes['data-ktp-target'],\n ref: _this._comboBoxWrapper,\n id: _this._id + 'wrapper',\n className: _this._classNames.root\n }, React.createElement(Autofill, __assign({\n \"data-ktp-execute-target\": keytipAttributes['data-ktp-execute-target'],\n \"data-is-interactable\": !disabled,\n componentRef: _this._autofill,\n id: _this._id + '-input',\n className: _this._classNames.input,\n type: \"text\",\n onFocus: _this._onFocus,\n onBlur: _this._onBlur,\n onKeyDown: _this._onInputKeyDown,\n onKeyUp: _this._onInputKeyUp,\n onClick: _this._onAutofillClick,\n onTouchStart: _this._onTouchStart,\n onInputValueChange: _this._onInputChange,\n \"aria-expanded\": isOpen,\n \"aria-autocomplete\": _this._getAriaAutoCompleteValue(),\n role: \"combobox\",\n readOnly: disabled,\n \"aria-labelledby\": label && _this._id + '-label',\n \"aria-label\": ariaLabel && !label ? ariaLabel : undefined,\n \"aria-describedby\": errorMessage !== undefined ? mergeAriaAttributeValues(ariaDescribedBy, keytipAttributes['aria-describedby'], errorMessageId) : mergeAriaAttributeValues(ariaDescribedBy, keytipAttributes['aria-describedby']),\n \"aria-activedescendant\": _this._getAriaActiveDescendantValue(),\n \"aria-required\": required,\n \"aria-disabled\": disabled,\n \"aria-owns\": isOpen ? _this._id + '-list' : undefined,\n spellCheck: false,\n defaultVisibleValue: _this._currentVisibleValue,\n suggestedDisplayValue: suggestedDisplayValue,\n updateValueInWillReceiveProps: _this._onUpdateValueInAutofillWillReceiveProps,\n shouldSelectFullInputValueInComponentDidUpdate: _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate,\n title: title,\n preventValueSelection: !_this._hasFocus(),\n placeholder: placeholder,\n tabIndex: tabIndex\n }, autofill)), React.createElement(IconButton, __assign({\n className: 'ms-ComboBox-CaretDown-button',\n styles: _this._getCaretButtonStyles(),\n role: \"presentation\",\n \"aria-hidden\": isButtonAriaHidden,\n \"data-is-focusable\": false,\n tabIndex: -1,\n onClick: _this._onComboBoxClick,\n onBlur: _this._onBlur,\n iconProps: buttonIconProps,\n disabled: disabled,\n checked: isOpen\n }, iconButtonProps)));\n };\n /**\n * componentDidUpdate handler for the auto fill component\n *\n * @param defaultVisibleValue - the current defaultVisibleValue in the auto fill's componentDidUpdate\n * @param suggestedDisplayValue - the current suggestedDisplayValue in the auto fill's componentDidUpdate\n * @returns - should the full value of the input be selected?\n * True if the defaultVisibleValue equals the suggestedDisplayValue, false otherwise\n */\n\n\n _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate = function () {\n return _this._currentVisibleValue === _this.state.suggestedDisplayValue;\n };\n /**\n * Get the correct value to pass to the input\n * to show to the user based off of the current props and state\n * @returns the value to pass to the input\n */\n\n\n _this._getVisibleValue = function () {\n var _a = _this.props,\n text = _a.text,\n allowFreeform = _a.allowFreeform,\n autoComplete = _a.autoComplete;\n var _b = _this.state,\n selectedIndices = _b.selectedIndices,\n currentPendingValueValidIndex = _b.currentPendingValueValidIndex,\n currentOptions = _b.currentOptions,\n currentPendingValue = _b.currentPendingValue,\n suggestedDisplayValue = _b.suggestedDisplayValue,\n isOpen = _b.isOpen;\n\n var currentPendingIndexValid = _this._indexWithinBounds(currentOptions, currentPendingValueValidIndex); // If the user passed is a value prop, use that\n // unless we are open and have a valid current pending index\n\n\n if (!(isOpen && currentPendingIndexValid) && text && (currentPendingValue === null || currentPendingValue === undefined)) {\n return text;\n }\n\n if (_this.props.multiSelect) {\n // Multi-select\n if (_this._hasFocus()) {\n var index = -1;\n\n if (autoComplete === 'on' && currentPendingIndexValid) {\n index = currentPendingValueValidIndex;\n }\n\n return _this._getPendingString(currentPendingValue, currentOptions, index);\n } else {\n return _this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue);\n }\n } else {\n // Single-select\n var index = _this._getFirstSelectedIndex();\n\n if (allowFreeform) {\n // If we are allowing freeform and autocomplete is also true\n // and we've got a pending value that matches an option, remember\n // the matched option's index\n if (autoComplete === 'on' && currentPendingIndexValid) {\n index = currentPendingValueValidIndex;\n } // Since we are allowing freeform, if there is currently a pending value, use that\n // otherwise use the index determined above (falling back to '' if we did not get a valid index)\n\n\n return _this._getPendingString(currentPendingValue, currentOptions, index);\n } else {\n // If we are not allowing freeform and have a\n // valid index that matches the pending value,\n // we know we will need some version of the pending value\n if (currentPendingIndexValid && autoComplete === 'on') {\n // If autoComplete is on, return the\n // raw pending value, otherwise remember\n // the matched option's index\n index = currentPendingValueValidIndex;\n return _this._normalizeToString(currentPendingValue);\n } else if (!_this.state.isOpen && currentPendingValue) {\n return _this._indexWithinBounds(currentOptions, index) ? currentPendingValue : _this._normalizeToString(suggestedDisplayValue);\n } else {\n return _this._indexWithinBounds(currentOptions, index) ? currentOptions[index].text : _this._normalizeToString(suggestedDisplayValue);\n }\n }\n }\n };\n /**\n * Handler for typing changes on the input\n * @param updatedValue - the newly changed value\n */\n\n\n _this._onInputChange = function (updatedValue) {\n if (_this.props.disabled) {\n _this._handleInputWhenDisabled(null\n /* event */\n );\n\n return;\n }\n\n _this.props.allowFreeform ? _this._processInputChangeWithFreeform(updatedValue) : _this._processInputChangeWithoutFreeform(updatedValue);\n };\n /**\n * Focus (and select) the content of the input\n * and set the focused state\n */\n\n\n _this._onFocus = function () {\n if (_this._autofill.current && _this._autofill.current.inputElement) {\n _this._autofill.current.inputElement.select();\n }\n\n if (!_this._hasFocus()) {\n _this.setState({\n focusState: 'focusing'\n });\n }\n };\n /**\n * Callback issued when the options should be resolved, if they have been updated or\n * if they need to be passed in the first time. This only does work if an onResolveOptions\n * callback was passed in\n */\n\n\n _this._onResolveOptions = function () {\n if (_this.props.onResolveOptions) {\n // get the options\n var newOptions = _this.props.onResolveOptions(__spreadArrays(_this.state.currentOptions)); // Check to see if the returned value is an array, if it is update the state\n // If the returned value is not an array then check to see if it's a promise or PromiseLike.\n // If it is then resolve it asynchronously.\n\n\n if (Array.isArray(newOptions)) {\n _this.setState({\n currentOptions: newOptions\n });\n } else if (newOptions && newOptions.then) {\n // Ensure that the promise will only use the callback if it was the most recent one\n // and update the state when the promise returns\n var promise_1 = _this._currentPromise = newOptions;\n promise_1.then(function (newOptionsFromPromise) {\n if (promise_1 === _this._currentPromise) {\n _this.setState({\n currentOptions: newOptionsFromPromise\n });\n }\n });\n }\n }\n };\n /**\n * OnBlur handler. Set the focused state to false\n * and submit any pending value\n */\n // eslint-disable-next-line deprecation/deprecation\n\n\n _this._onBlur = function (event) {\n // Do nothing if the blur is coming from something\n // inside the comboBox root or the comboBox menu since\n // it we are not really bluring from the whole comboBox\n var relatedTarget = event.relatedTarget;\n\n if (event.relatedTarget === null) {\n // In IE11, due to lack of support, event.relatedTarget is always\n // null making every onBlur call to be \"outside\" of the ComboBox\n // even when it's not. Using document.activeElement is another way\n // for us to be able to get what the relatedTarget without relying\n // on the event\n relatedTarget = document.activeElement;\n }\n\n if (relatedTarget && ( // when event coming from withing the comboBox title\n _this._root.current && _this._root.current.contains(relatedTarget) || // when event coming from within the comboBox list menu\n _this._comboBoxMenu.current && (_this._comboBoxMenu.current.contains(relatedTarget) || // when event coming from the callout containing the comboBox list menu (ex: when scrollBar of the\n // Callout is clicked) checks if the relatedTarget is a parent of _comboBoxMenu\n findElementRecursive(_this._comboBoxMenu.current, function (element) {\n return element === relatedTarget;\n })))) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (_this._hasFocus()) {\n _this.setState({\n focusState: 'none'\n });\n\n if (!_this.props.multiSelect || _this.props.allowFreeform) {\n _this._submitPendingValue(event);\n }\n }\n }; // Render Callout container and pass in list\n\n\n _this._onRenderContainer = function (props) {\n var onRenderList = props.onRenderList,\n calloutProps = props.calloutProps,\n dropdownWidth = props.dropdownWidth,\n dropdownMaxWidth = props.dropdownMaxWidth,\n _a = props.onRenderUpperContent,\n onRenderUpperContent = _a === void 0 ? _this._onRenderUpperContent : _a,\n _b = props.onRenderLowerContent,\n onRenderLowerContent = _b === void 0 ? _this._onRenderLowerContent : _b,\n useComboBoxAsMenuWidth = props.useComboBoxAsMenuWidth,\n persistMenu = props.persistMenu,\n _c = props.shouldRestoreFocus,\n shouldRestoreFocus = _c === void 0 ? true : _c;\n var isOpen = _this.state.isOpen;\n var id = _this._id;\n var comboBoxMenuWidth = useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? _this._comboBoxWrapper.current.clientWidth + 2 : undefined;\n return React.createElement(Callout, __assign({\n isBeakVisible: false,\n gapSpace: 0,\n doNotLayer: false,\n directionalHint: DirectionalHint.bottomLeftEdge,\n directionalHintFixed: false\n }, calloutProps, {\n onLayerMounted: _this._onLayerMounted,\n className: css(_this._classNames.callout, calloutProps ? calloutProps.className : undefined),\n target: _this._comboBoxWrapper.current,\n onDismiss: _this._onDismiss,\n onMouseDown: _this._onCalloutMouseDown,\n onScroll: _this._onScroll,\n setInitialFocus: false,\n calloutWidth: useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? comboBoxMenuWidth && comboBoxMenuWidth : dropdownWidth,\n calloutMaxWidth: dropdownMaxWidth ? dropdownMaxWidth : comboBoxMenuWidth,\n hidden: persistMenu ? !isOpen : undefined,\n shouldRestoreFocus: shouldRestoreFocus\n }), onRenderUpperContent(_this.props, _this._onRenderUpperContent), React.createElement(\"div\", {\n className: _this._classNames.optionsContainerWrapper,\n ref: _this._comboBoxMenu\n }, onRenderList(__assign(__assign({}, props), {\n id: id\n }), _this._onRenderList)), onRenderLowerContent(_this.props, _this._onRenderLowerContent));\n };\n\n _this._onLayerMounted = function () {\n _this._onCalloutLayerMounted();\n\n if (_this.props.calloutProps && _this.props.calloutProps.onLayerMounted) {\n _this.props.calloutProps.onLayerMounted();\n }\n };\n\n _this._onRenderLabel = function (onRenderLabelProps) {\n var _a = onRenderLabelProps.props,\n label = _a.label,\n disabled = _a.disabled,\n required = _a.required;\n\n if (label) {\n return React.createElement(Label, {\n id: _this._id + '-label',\n disabled: disabled,\n required: required,\n className: _this._classNames.label\n }, label, onRenderLabelProps.multiselectAccessibleText && React.createElement(\"span\", {\n className: _this._classNames.screenReaderText\n }, onRenderLabelProps.multiselectAccessibleText));\n }\n\n return null;\n }; // Render List of items\n\n\n _this._onRenderList = function (props) {\n var _a = props.onRenderItem,\n onRenderItem = _a === void 0 ? _this._onRenderItem : _a,\n label = props.label,\n ariaLabel = props.ariaLabel;\n var queue = {\n items: []\n };\n var renderedList = [];\n var id = _this._id;\n\n var emptyQueue = function emptyQueue() {\n var newGroup = queue.id ? [React.createElement(\"div\", {\n role: \"group\",\n key: queue.id,\n \"aria-labelledby\": queue.id\n }, queue.items)] : queue.items;\n renderedList = __spreadArrays(renderedList, newGroup); // Flush items and id\n\n queue = {\n items: []\n };\n };\n\n var placeRenderedOptionIntoQueue = function placeRenderedOptionIntoQueue(item, index) {\n /*\n Case Header\n empty queue if it's not already empty\n ensure unique ID for header and set queue ID\n push header into queue\n Case Divider\n push divider into queue if not first item\n empty queue if not already empty\n Default\n push item into queue\n */\n switch (item.itemType) {\n case SelectableOptionMenuItemType.Header:\n queue.items.length > 0 && emptyQueue();\n id = id + item.key;\n queue.items.push(onRenderItem(__assign(__assign({\n id: id\n }, item), {\n index: index\n }), _this._onRenderItem));\n queue.id = id;\n break;\n\n case SelectableOptionMenuItemType.Divider:\n index > 0 && queue.items.push(onRenderItem(__assign(__assign({}, item), {\n index: index\n }), _this._onRenderItem));\n queue.items.length > 0 && emptyQueue();\n break;\n\n default:\n queue.items.push(onRenderItem(__assign(__assign({}, item), {\n index: index\n }), _this._onRenderItem));\n }\n }; // Place options into the queue. Queue will be emptied anytime a Header or Divider is encountered\n\n\n props.options.forEach(function (item, index) {\n placeRenderedOptionIntoQueue(item, index);\n }); // Push remaining items into all renderedList\n\n queue.items.length > 0 && emptyQueue();\n return React.createElement(\"div\", {\n id: id + '-list',\n className: _this._classNames.optionsContainer,\n \"aria-labelledby\": label && id + '-label',\n \"aria-label\": ariaLabel && !label ? ariaLabel : undefined,\n role: \"listbox\"\n }, renderedList);\n }; // Render items\n\n\n _this._onRenderItem = function (item) {\n switch (item.itemType) {\n case SelectableOptionMenuItemType.Divider:\n return _this._renderSeparator(item);\n\n case SelectableOptionMenuItemType.Header:\n return _this._renderHeader(item);\n\n default:\n return _this._renderOption(item);\n }\n }; // Default _onRenderLowerContent function returns nothing\n\n\n _this._onRenderLowerContent = function () {\n return null;\n }; // Default _onRenderUpperContent function returns nothing\n\n\n _this._onRenderUpperContent = function () {\n return null;\n };\n\n _this._renderOption = function (item) {\n var _a = _this.props.onRenderOption,\n onRenderOption = _a === void 0 ? _this._onRenderOptionContent : _a;\n var id = _this._id;\n\n var isSelected = _this._isOptionSelected(item.index);\n\n var isChecked = _this._isOptionChecked(item.index);\n\n var optionStyles = _this._getCurrentOptionStyles(item);\n\n var optionClassNames = getComboBoxOptionClassNames(_this._getCurrentOptionStyles(item));\n\n var title = _this._getPreviewText(item);\n\n var onRenderCheckboxLabel = function onRenderCheckboxLabel() {\n return onRenderOption(item, _this._onRenderOptionContent);\n };\n\n var getOptionComponent = function getOptionComponent() {\n return !_this.props.multiSelect ? React.createElement(CommandButton, {\n id: id + '-list' + item.index,\n key: item.key,\n \"data-index\": item.index,\n styles: optionStyles,\n checked: isSelected,\n className: 'ms-ComboBox-option',\n onClick: _this._onItemClick(item),\n // eslint-disable-next-line react/jsx-no-bind\n onMouseEnter: _this._onOptionMouseEnter.bind(_this, item.index),\n // eslint-disable-next-line react/jsx-no-bind\n onMouseMove: _this._onOptionMouseMove.bind(_this, item.index),\n onMouseLeave: _this._onOptionMouseLeave,\n role: \"option\",\n \"aria-selected\": isChecked ? 'true' : 'false',\n ariaLabel: item.ariaLabel,\n disabled: item.disabled,\n title: title\n }, React.createElement(\"span\", {\n className: optionClassNames.optionTextWrapper,\n ref: isSelected ? _this._selectedElement : undefined\n }, onRenderOption(item, _this._onRenderOptionContent))) : React.createElement(Checkbox, {\n id: id + '-list' + item.index,\n ariaLabel: item.ariaLabel,\n key: item.key,\n styles: optionStyles,\n className: 'ms-ComboBox-option',\n onChange: _this._onItemClick(item),\n label: item.text,\n checked: isChecked,\n title: title,\n disabled: item.disabled,\n // eslint-disable-next-line react/jsx-no-bind\n onRenderLabel: onRenderCheckboxLabel,\n inputProps: __assign({\n // aria-selected should only be applied to checked items, not hovered items\n 'aria-selected': isChecked ? 'true' : 'false',\n role: 'option'\n }, {\n 'data-index': item.index,\n 'data-is-focusable': true\n })\n });\n };\n\n return React.createElement(ComboBoxOptionWrapper, {\n key: item.key,\n index: item.index,\n disabled: item.disabled,\n isSelected: isSelected,\n isChecked: isChecked,\n text: item.text,\n // eslint-disable-next-line react/jsx-no-bind\n render: getOptionComponent,\n data: item.data\n });\n };\n /**\n * Mouse clicks to headers, dividers and scrollbar should not make input lose focus\n */\n\n\n _this._onCalloutMouseDown = function (ev) {\n ev.preventDefault();\n };\n /**\n * Scroll handler for the callout to make sure the mouse events\n * for updating focus are not interacting during scroll\n */\n\n\n _this._onScroll = function () {\n if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) {\n _this._async.clearTimeout(_this._scrollIdleTimeoutId);\n\n _this._scrollIdleTimeoutId = undefined;\n } else {\n _this._isScrollIdle = false;\n }\n\n _this._scrollIdleTimeoutId = _this._async.setTimeout(function () {\n _this._isScrollIdle = true;\n }, ScrollIdleDelay);\n };\n\n _this._onRenderOptionContent = function (item) {\n var optionClassNames = getComboBoxOptionClassNames(_this._getCurrentOptionStyles(item));\n return React.createElement(\"span\", {\n className: optionClassNames.optionText\n }, item.text);\n };\n /**\n * Handles dismissing (cancelling) the menu\n */\n\n\n _this._onDismiss = function () {\n var onMenuDismiss = _this.props.onMenuDismiss;\n\n if (onMenuDismiss) {\n onMenuDismiss();\n } // In persistMode we need to simulate callout layer mount\n // since that only happens once. We do it on dismiss since\n // it works either way.\n\n\n if (_this.props.persistMenu) {\n _this._onCalloutLayerMounted();\n } // close the menu\n\n\n _this._setOpenStateAndFocusOnClose(false\n /* isOpen */\n , false\n /* focusInputAfterClose */\n ); // reset the selected index\n // to the last value state\n\n\n _this._resetSelectedIndex();\n };\n\n _this._onAfterClearPendingInfo = function () {\n _this._processingClearPendingInfo = false;\n };\n /**\n * Handle keydown on the input\n * @param ev - The keyboard event that was fired\n */\n\n\n _this._onInputKeyDown = function (ev) {\n var _a = _this.props,\n disabled = _a.disabled,\n allowFreeform = _a.allowFreeform,\n autoComplete = _a.autoComplete;\n var _b = _this.state,\n isOpen = _b.isOpen,\n currentOptions = _b.currentOptions,\n currentPendingValueValidIndexOnHover = _b.currentPendingValueValidIndexOnHover; // Take note if we are processing an alt (option) or meta (command) keydown.\n // See comment in _onInputKeyUp for reasoning.\n\n _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev);\n\n if (disabled) {\n _this._handleInputWhenDisabled(ev);\n\n return;\n }\n\n var index = _this._getPendingSelectedIndex(false\n /* includeCurrentPendingValue */\n );\n\n switch (ev.which) {\n case KeyCodes.enter:\n if (_this._autofill.current && _this._autofill.current.inputElement) {\n _this._autofill.current.inputElement.select();\n }\n\n _this._submitPendingValue(ev);\n\n if (_this.props.multiSelect && isOpen) {\n _this.setState({\n currentPendingValueValidIndex: index\n });\n } else {\n // On enter submit the pending value\n if (isOpen || (!allowFreeform || _this.state.currentPendingValue === undefined || _this.state.currentPendingValue === null || _this.state.currentPendingValue.length <= 0) && _this.state.currentPendingValueValidIndex < 0) {\n // if we are open or\n // if we are not allowing freeform or\n // our we have no pending value\n // and no valid pending index\n // flip the open state\n _this.setState({\n isOpen: !isOpen\n });\n }\n }\n\n break;\n\n case KeyCodes.tab:\n // On enter submit the pending value\n if (!_this.props.multiSelect) {\n _this._submitPendingValue(ev);\n } // If we are not allowing freeform\n // or the comboBox is open, flip the open state\n\n\n if (isOpen) {\n _this._setOpenStateAndFocusOnClose(!isOpen, false\n /* focusInputAfterClose */\n );\n } // Allow TAB to propigate\n\n\n return;\n\n case KeyCodes.escape:\n // reset the selected index\n _this._resetSelectedIndex(); // Close the menu if opened\n\n\n if (isOpen) {\n _this.setState({\n isOpen: false\n });\n } else {\n return;\n }\n\n break;\n\n case KeyCodes.up:\n // if we are in clearAll state (e.g. the user as hovering\n // and has since mousedOut of the menu items),\n // go to the last index\n if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) {\n index = _this.state.currentOptions.length;\n }\n\n if (ev.altKey || ev.metaKey) {\n // Close the menu if it is open and break so\n // that the event get stopPropagation and prevent default.\n // Otherwise, we need to let the event continue to propagate\n if (isOpen) {\n _this._setOpenStateAndFocusOnClose(!isOpen, true\n /* focusInputAfterClose */\n );\n\n break;\n }\n\n return;\n } // Go to the previous option\n\n\n _this._setPendingInfoFromIndexAndDirection(index, SearchDirection.backward);\n\n break;\n\n case KeyCodes.down:\n // Expand the comboBox on ALT + DownArrow\n if (ev.altKey || ev.metaKey) {\n _this._setOpenStateAndFocusOnClose(true\n /* isOpen */\n , true\n /* focusInputAfterClose */\n );\n } else {\n // if we are in clearAll state (e.g. the user as hovering\n // and has since mousedOut of the menu items),\n // go to the first index\n if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) {\n index = -1;\n } // Got to the next option\n\n\n _this._setPendingInfoFromIndexAndDirection(index, SearchDirection.forward);\n }\n\n break;\n\n case KeyCodes.home:\n case KeyCodes.end:\n if (allowFreeform) {\n return;\n } // Set the initial values to respond to HOME\n // which goes to the first selectable option\n\n\n index = -1;\n var directionToSearch = SearchDirection.forward; // If end, update the values to respond to END\n // which goes to the last selectable option\n\n if (ev.which === KeyCodes.end) {\n index = currentOptions.length;\n directionToSearch = SearchDirection.backward;\n }\n\n _this._setPendingInfoFromIndexAndDirection(index, directionToSearch);\n\n break;\n\n /* eslint-disable no-fallthrough */\n\n case KeyCodes.space:\n // event handled in _onComboBoxKeyUp\n if (!allowFreeform && autoComplete === 'off') {\n break;\n }\n\n default:\n /* eslint-enable no-fallthrough */\n // are we processing a function key? if so bail out\n if (ev.which >= 112\n /* F1 */\n && ev.which <= 123\n /* F12 */\n ) {\n return;\n } // If we get here and we got either and ALT key\n // or meta key, let the event propagate\n\n\n if (ev.keyCode === KeyCodes.alt || ev.key === 'Meta'\n /* && isOpen */\n ) {\n return;\n } // If we are not allowing freeform and\n // allowing autoComplete, handle the input here\n // since we have marked the input as readonly\n\n\n if (!allowFreeform && autoComplete === 'on') {\n _this._onInputChange(ev.key);\n\n break;\n } // allow the key to propagate by default\n\n\n return;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n };\n /**\n * Handle keyup on the input\n * @param ev - the keyboard event that was fired\n */\n\n\n _this._onInputKeyUp = function (ev) {\n var _a = _this.props,\n disabled = _a.disabled,\n allowFreeform = _a.allowFreeform,\n autoComplete = _a.autoComplete;\n var isOpen = _this.state.isOpen; // We close the menu on key up only if ALL of the following are true:\n // - Most recent key down was alt or meta (command)\n // - The alt/meta key down was NOT followed by some other key (such as down/up arrow to\n // expand/collapse the menu)\n // - We're not on a Mac (or iOS)\n // This is because on Windows, pressing alt moves focus to the application menu bar or similar,\n // closing any open context menus. There is not a similar behavior on Macs.\n\n var keyPressIsAltOrMetaAlone = _this._lastKeyDownWasAltOrMeta && _this._isAltOrMeta(ev);\n\n _this._lastKeyDownWasAltOrMeta = false;\n var shouldHandleKey = keyPressIsAltOrMetaAlone && !(isMac() || isIOS());\n\n if (disabled) {\n _this._handleInputWhenDisabled(ev);\n\n return;\n }\n\n switch (ev.which) {\n case KeyCodes.space:\n // If we are not allowing freeform and are not autoComplete\n // make space expand/collapse the comboBox\n // and allow the event to propagate\n if (!allowFreeform && autoComplete === 'off') {\n _this._setOpenStateAndFocusOnClose(!isOpen, !!isOpen);\n }\n\n return;\n\n default:\n if (shouldHandleKey && isOpen) {\n _this._setOpenStateAndFocusOnClose(!isOpen, true\n /* focusInputAfterClose */\n );\n } else {\n if (_this.state.focusState === 'focusing' && _this.props.openOnKeyboardFocus) {\n _this.setState({\n isOpen: true\n });\n }\n\n if (_this.state.focusState !== 'focused') {\n _this.setState({\n focusState: 'focused'\n });\n }\n }\n\n return;\n }\n };\n\n _this._onOptionMouseLeave = function () {\n if (_this._shouldIgnoreMouseEvent()) {\n return;\n } // Ignore the event in persistMenu mode if the callout has\n // closed. This is to avoid clearing the visuals on item click.\n\n\n if (_this.props.persistMenu && !_this.state.isOpen) {\n return;\n }\n\n _this.setState({\n currentPendingValueValidIndexOnHover: HoverStatus.clearAll\n });\n };\n /**\n * Click handler for the button of the comboBox\n * and the input when not allowing freeform. This\n * toggles the expand/collapse state of the comboBox (if enbled)\n */\n\n\n _this._onComboBoxClick = function () {\n var disabled = _this.props.disabled;\n var isOpen = _this.state.isOpen;\n\n if (!disabled) {\n _this._setOpenStateAndFocusOnClose(!isOpen, false\n /* focusInputAfterClose */\n );\n\n _this.setState({\n focusState: 'focused'\n });\n }\n };\n /**\n * Click handler for the autofill.\n */\n\n\n _this._onAutofillClick = function () {\n var _a = _this.props,\n disabled = _a.disabled,\n allowFreeform = _a.allowFreeform;\n\n if (allowFreeform && !disabled) {\n _this.focus(_this.state.isOpen || _this._processingTouch);\n } else {\n _this._onComboBoxClick();\n }\n };\n\n _this._onTouchStart = function () {\n if (_this._comboBoxWrapper.current && !('onpointerdown' in _this._comboBoxWrapper)) {\n _this._handleTouchAndPointerEvent();\n }\n };\n\n _this._onPointerDown = function (ev) {\n if (ev.pointerType === 'touch') {\n _this._handleTouchAndPointerEvent();\n\n ev.preventDefault();\n ev.stopImmediatePropagation();\n }\n };\n\n initializeComponentRef(_this);\n _this._async = new Async(_this);\n _this._events = new EventGroup(_this);\n warnMutuallyExclusive(COMPONENT_NAME, props, {\n defaultSelectedKey: 'selectedKey',\n text: 'defaultSelectedKey',\n selectedKey: 'value',\n dropdownWidth: 'useComboBoxAsMenuWidth',\n ariaLabel: 'label'\n });\n _this._id = props.id || getId('ComboBox');\n\n var selectedKeys = _this._buildDefaultSelectedKeys(props.defaultSelectedKey, props.selectedKey);\n\n _this._isScrollIdle = true;\n _this._processingTouch = false;\n _this._gotMouseMove = false;\n _this._processingClearPendingInfo = false;\n\n var initialSelectedIndices = _this._getSelectedIndices(props.options, selectedKeys);\n\n _this.state = {\n isOpen: false,\n selectedIndices: initialSelectedIndices,\n focusState: 'none',\n suggestedDisplayValue: undefined,\n currentOptions: _this.props.options,\n currentPendingValueValidIndex: -1,\n currentPendingValue: undefined,\n currentPendingValueValidIndexOnHover: HoverStatus.default\n };\n return _this;\n }\n\n Object.defineProperty(ComboBox.prototype, \"selectedOptions\", {\n /**\n * All selected options\n */\n get: function get() {\n var _a = this.state,\n currentOptions = _a.currentOptions,\n selectedIndices = _a.selectedIndices;\n return getAllSelectedOptions(currentOptions, selectedIndices);\n },\n enumerable: true,\n configurable: true\n });\n\n ComboBox.prototype.componentDidMount = function () {\n if (this._comboBoxWrapper.current && !this.props.disabled) {\n // hook up resolving the options if needed on focus\n this._events.on(this._comboBoxWrapper.current, 'focus', this._onResolveOptions, true);\n\n if ('onpointerdown' in this._comboBoxWrapper.current) {\n // For ComboBoxes, touching anywhere in the combo box should drop the dropdown, including the input element.\n // This gives more hit target space for touch environments. We're setting the onpointerdown here, because React\n // does not support Pointer events yet.\n this._events.on(this._comboBoxWrapper.current, 'pointerdown', this._onPointerDown, true);\n }\n }\n };\n\n ComboBox.prototype.UNSAFE_componentWillReceiveProps = function (newProps) {\n // Update the selectedIndex and currentOptions state if\n // the selectedKey, value, or options have changed\n if (newProps.selectedKey !== this.props.selectedKey || newProps.text !== this.props.text || newProps.options !== this.props.options) {\n var selectedKeys = this._buildSelectedKeys(newProps.selectedKey);\n\n var indices = this._getSelectedIndices(newProps.options, selectedKeys);\n\n this.setState({\n selectedIndices: indices,\n currentOptions: newProps.options\n });\n\n if (newProps.selectedKey === null) {\n this.setState({\n suggestedDisplayValue: undefined\n });\n }\n }\n };\n\n ComboBox.prototype.componentDidUpdate = function (prevProps, prevState) {\n var _this = this;\n\n var _a = this.props,\n allowFreeform = _a.allowFreeform,\n text = _a.text,\n onMenuOpen = _a.onMenuOpen,\n onMenuDismissed = _a.onMenuDismissed;\n var _b = this.state,\n isOpen = _b.isOpen,\n selectedIndices = _b.selectedIndices,\n currentPendingValueValidIndex = _b.currentPendingValueValidIndex; // If we are newly open or are open and the pending valid index changed,\n // make sure the currently selected/pending option is scrolled into view\n\n if (isOpen && (!prevState.isOpen || prevState.currentPendingValueValidIndex !== currentPendingValueValidIndex)) {\n // Need this timeout so that the selectedElement ref is correctly updated\n this._async.setTimeout(function () {\n return _this._scrollIntoView();\n }, 0);\n } // if an action is taken that put focus in the ComboBox\n // and If we are open or we are just closed, shouldFocusAfterClose is set,\n // but we are not the activeElement set focus on the input\n\n\n if (this._hasFocus() && (isOpen || prevState.isOpen && !isOpen && this._focusInputAfterClose && this._autofill.current && document.activeElement !== this._autofill.current.inputElement)) {\n this.focus(undefined\n /*shouldOpenOnFocus*/\n , true\n /*useFocusAsync*/\n );\n } // If we should focusAfterClose AND\n // just opened/closed the menu OR\n // are focused AND\n // updated the selectedIndex with the menu closed OR\n // are not allowing freeform OR\n // the value changed\n // we need to set selection\n\n\n if (this._focusInputAfterClose && (prevState.isOpen && !isOpen || this._hasFocus() && (!isOpen && !this.props.multiSelect && prevState.selectedIndices && selectedIndices && prevState.selectedIndices[0] !== selectedIndices[0] || !allowFreeform || text !== prevProps.text))) {\n this._onFocus();\n }\n\n this._notifyPendingValueChanged(prevState);\n\n if (isOpen && !prevState.isOpen && onMenuOpen) {\n onMenuOpen();\n }\n\n if (!isOpen && prevState.isOpen && onMenuDismissed) {\n onMenuDismissed();\n }\n };\n\n ComboBox.prototype.componentWillUnmount = function () {\n this._async.dispose();\n\n this._events.dispose();\n }; // Primary Render\n\n\n ComboBox.prototype.render = function () {\n var _this = this;\n\n var id = this._id;\n var errorMessageId = id + '-error';\n var _a = this.props,\n className = _a.className,\n disabled = _a.disabled,\n required = _a.required,\n errorMessage = _a.errorMessage,\n _b = _a.onRenderContainer,\n onRenderContainer = _b === void 0 ? this._onRenderContainer : _b,\n _c = _a.onRenderLabel,\n onRenderLabel = _c === void 0 ? this._onRenderLabel : _c,\n _d = _a.onRenderList,\n onRenderList = _d === void 0 ? this._onRenderList : _d,\n _e = _a.onRenderItem,\n onRenderItem = _e === void 0 ? this._onRenderItem : _e,\n _f = _a.onRenderOption,\n onRenderOption = _f === void 0 ? this._onRenderOptionContent : _f,\n allowFreeform = _a.allowFreeform,\n customStyles = _a.styles,\n theme = _a.theme,\n keytipProps = _a.keytipProps,\n persistMenu = _a.persistMenu,\n multiSelect = _a.multiSelect;\n var _g = this.state,\n isOpen = _g.isOpen,\n suggestedDisplayValue = _g.suggestedDisplayValue;\n this._currentVisibleValue = this._getVisibleValue(); // Single select is already accessible since the whole text is selected\n // when focus enters the input. Since multiselect appears to clear the input\n // it needs special accessible text\n\n var multiselectAccessibleText = multiSelect ? this._getMultiselectDisplayString(this.state.selectedIndices, this.state.currentOptions, suggestedDisplayValue) : undefined;\n var divProps = getNativeProps(this.props, divProperties, ['onChange', 'value']);\n var hasErrorMessage = errorMessage && errorMessage.length > 0 ? true : false;\n this._classNames = this.props.getClassNames ? this.props.getClassNames(theme, !!isOpen, !!disabled, !!required, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage, className) : getClassNames(getStyles(theme, customStyles), className, !!isOpen, !!disabled, !!required, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage);\n var comboBoxWrapper = keytipProps ? React.createElement(KeytipData, {\n keytipProps: keytipProps,\n disabled: disabled\n }, function (keytipAttributes) {\n return _this._renderComboBoxWrapper(multiselectAccessibleText, errorMessageId, keytipAttributes);\n }) : this._renderComboBoxWrapper(multiselectAccessibleText, errorMessageId);\n return React.createElement(\"div\", __assign({}, divProps, {\n ref: this._root,\n className: this._classNames.container\n }), onRenderLabel({\n props: this.props,\n multiselectAccessibleText: multiselectAccessibleText\n }, this._onRenderLabel), comboBoxWrapper, (persistMenu || isOpen) && onRenderContainer(__assign(__assign({}, this.props), {\n onRenderList: onRenderList,\n onRenderItem: onRenderItem,\n onRenderOption: onRenderOption,\n options: this.state.currentOptions.map(function (item, index) {\n return __assign(__assign({}, item), {\n index: index\n });\n }),\n onDismiss: this._onDismiss\n }), this._onRenderContainer), hasErrorMessage && React.createElement(\"div\", {\n role: \"alert\",\n id: errorMessageId,\n className: this._classNames.errorMessage\n }, errorMessage));\n };\n\n ComboBox.prototype._getPendingString = function (currentPendingValue, currentOptions, index) {\n return currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValue : this._indexWithinBounds(currentOptions, index) ? currentOptions[index].text : '';\n };\n /**\n * Returns a string that concatenates all of the selected values\n * for multiselect combobox.\n */\n\n\n ComboBox.prototype._getMultiselectDisplayString = function (selectedIndices, currentOptions, suggestedDisplayValue) {\n var displayValues = [];\n\n for (var idx = 0; selectedIndices && idx < selectedIndices.length; idx++) {\n var index = selectedIndices[idx];\n displayValues.push(this._indexWithinBounds(currentOptions, index) ? currentOptions[index].text : this._normalizeToString(suggestedDisplayValue));\n }\n\n var _a = this.props.multiSelectDelimiter,\n multiSelectDelimiter = _a === void 0 ? ', ' : _a;\n return displayValues.join(multiSelectDelimiter);\n };\n /**\n * Is the index within the bounds of the array?\n * @param options - options to check if the index is valid for\n * @param index - the index to check\n * @returns - true if the index is valid for the given options, false otherwise\n */\n\n\n ComboBox.prototype._indexWithinBounds = function (options, index) {\n if (!options) {\n return false;\n }\n\n return index >= 0 && index < options.length;\n };\n /**\n * Process the new input's new value when the comboBox\n * allows freeform entry\n * @param updatedValue - the input's newly changed value\n */\n\n\n ComboBox.prototype._processInputChangeWithFreeform = function (updatedValue) {\n var _this = this;\n\n var currentOptions = this.state.currentOptions;\n var newCurrentPendingValueValidIndex = -1; // if the new value is empty, see if we have an exact match\n // and then set the pending info\n\n if (updatedValue === '') {\n var items = currentOptions.map(function (item, index) {\n return __assign(__assign({}, item), {\n index: index\n });\n }).filter(function (option) {\n return option.itemType !== SelectableOptionMenuItemType.Header && option.itemType !== SelectableOptionMenuItemType.Divider;\n }).filter(function (option) {\n return _this._getPreviewText(option) === updatedValue;\n }); // if we found a match remember the index\n\n if (items.length === 1) {\n newCurrentPendingValueValidIndex = items[0].index;\n }\n\n this._setPendingInfo(updatedValue, newCurrentPendingValueValidIndex, updatedValue);\n\n return;\n } // Remember the original value and then,\n // make the value lowercase for comparison\n\n\n var originalUpdatedValue = updatedValue;\n updatedValue = updatedValue.toLocaleLowerCase();\n var newSuggestedDisplayValue = ''; // If autoComplete is on, attempt to find a match from the available options\n\n if (this.props.autoComplete === 'on') {\n // If autoComplete is on, attempt to find a match where the text of an option starts with the updated value\n var items = currentOptions.map(function (item, index) {\n return __assign(__assign({}, item), {\n index: index\n });\n }).filter(function (option) {\n return option.itemType !== SelectableOptionMenuItemType.Header && option.itemType !== SelectableOptionMenuItemType.Divider;\n }).filter(function (option) {\n return _this._getPreviewText(option).toLocaleLowerCase().indexOf(updatedValue) === 0;\n });\n\n if (items.length > 0) {\n // use ariaLabel as the value when the option is set\n var text = this._getPreviewText(items[0]); // If the user typed out the complete option text, we don't need any suggested display text anymore\n\n\n newSuggestedDisplayValue = text.toLocaleLowerCase() !== updatedValue ? text : ''; // remember the index of the match we found\n\n newCurrentPendingValueValidIndex = items[0].index;\n }\n } else {\n // If autoComplete is off, attempt to find a match only when the value is exactly equal to the text of an option\n var items = currentOptions.map(function (item, index) {\n return __assign(__assign({}, item), {\n index: index\n });\n }).filter(function (option) {\n return option.itemType !== SelectableOptionMenuItemType.Header && option.itemType !== SelectableOptionMenuItemType.Divider;\n }).filter(function (option) {\n return _this._getPreviewText(option).toLocaleLowerCase() === updatedValue;\n }); // if we found a match remember the index\n\n if (items.length === 1) {\n newCurrentPendingValueValidIndex = items[0].index;\n }\n } // Set the updated state\n\n\n this._setPendingInfo(originalUpdatedValue, newCurrentPendingValueValidIndex, newSuggestedDisplayValue);\n };\n /**\n * Process the new input's new value when the comboBox\n * does not allow freeform entry\n * @param updatedValue - the input's newly changed value\n */\n\n\n ComboBox.prototype._processInputChangeWithoutFreeform = function (updatedValue) {\n var _this = this;\n\n var _a = this.state,\n currentPendingValue = _a.currentPendingValue,\n currentPendingValueValidIndex = _a.currentPendingValueValidIndex,\n currentOptions = _a.currentOptions;\n\n if (this.props.autoComplete === 'on') {\n // If autoComplete is on while allow freeform is off,\n // we will remember the keypresses and build up a string to attempt to match\n // as long as characters are typed within a the timeout span of each other,\n // otherwise we will clear the string and start building a new one on the next keypress.\n // Also, only do this processing if we have a non-empty value\n if (updatedValue !== '') {\n // If we have a pending autocomplete clearing task,\n // we know that the user is typing with keypresses happening\n // within the timeout of each other so remove the clearing task\n // and continue building the pending value with the udpated value\n if (this._lastReadOnlyAutoCompleteChangeTimeoutId !== undefined) {\n this._async.clearTimeout(this._lastReadOnlyAutoCompleteChangeTimeoutId);\n\n this._lastReadOnlyAutoCompleteChangeTimeoutId = undefined;\n updatedValue = this._normalizeToString(currentPendingValue) + updatedValue;\n }\n\n var originalUpdatedValue = updatedValue;\n updatedValue = updatedValue.toLocaleLowerCase(); // If autoComplete is on, attempt to find a match where the text of an option starts with the updated value\n\n var items = currentOptions.map(function (item, i) {\n return __assign(__assign({}, item), {\n index: i\n });\n }).filter(function (option) {\n return option.itemType !== SelectableOptionMenuItemType.Header && option.itemType !== SelectableOptionMenuItemType.Divider;\n }).filter(function (option) {\n return option.text.toLocaleLowerCase().indexOf(updatedValue) === 0;\n }); // If we found a match, udpdate the state\n\n if (items.length > 0) {\n this._setPendingInfo(originalUpdatedValue, items[0].index, this._getPreviewText(items[0]));\n } // Schedule a timeout to clear the pending value after the timeout span\n\n\n this._lastReadOnlyAutoCompleteChangeTimeoutId = this._async.setTimeout(function () {\n _this._lastReadOnlyAutoCompleteChangeTimeoutId = undefined;\n }, ReadOnlyPendingAutoCompleteTimeout);\n return;\n }\n } // If we get here, either autoComplete is on or we did not find a match with autoComplete on.\n // Remember we are not allowing freeform, so at this point, if we have a pending valid value index\n // use that; otherwise use the selectedIndex\n\n\n var index = currentPendingValueValidIndex >= 0 ? currentPendingValueValidIndex : this._getFirstSelectedIndex(); // Since we are not allowing freeform, we need to\n // set both the pending and suggested values/index\n // to allow us to select all content in the input to\n // give the illusion that we are readonly (e.g. freeform off)\n\n this._setPendingInfoFromIndex(index);\n };\n\n ComboBox.prototype._getFirstSelectedIndex = function () {\n return this.state.selectedIndices && this.state.selectedIndices.length > 0 ? this.state.selectedIndices[0] : -1;\n };\n /**\n * Walk along the options starting at the index, stepping by the delta (positive or negative)\n * looking for the next valid selectable index (e.g. skipping headings and dividers)\n * @param index - the index to get the next selectable index from\n * @param delta - optional delta to step by when finding the next index, defaults to 0\n * @returns - the next valid selectable index. If the new index is outside of the bounds,\n * it will snap to the edge of the options array. If delta == 0 and the given index is not selectable\n */\n\n\n ComboBox.prototype._getNextSelectableIndex = function (index, searchDirection) {\n var currentOptions = this.state.currentOptions;\n var newIndex = index + searchDirection;\n newIndex = Math.max(0, Math.min(currentOptions.length - 1, newIndex));\n\n if (!this._indexWithinBounds(currentOptions, newIndex)) {\n return -1;\n }\n\n var option = currentOptions[newIndex];\n\n if (option.itemType === SelectableOptionMenuItemType.Header || option.itemType === SelectableOptionMenuItemType.Divider || option.hidden === true) {\n // Should we continue looking for an index to select?\n if (searchDirection !== SearchDirection.none && (newIndex > 0 && searchDirection < SearchDirection.none || newIndex >= 0 && newIndex < currentOptions.length && searchDirection > SearchDirection.none)) {\n newIndex = this._getNextSelectableIndex(newIndex, searchDirection);\n } else {\n // If we cannot perform a useful search just return the index we were given\n return index;\n }\n } // We have the next valid selectable index, return it\n\n\n return newIndex;\n };\n /**\n * Set the selected index. Note, this is\n * the \"real\" selected index, not the pending selected index\n * @param index - the index to set (or the index to set from if a search direction is provided)\n * @param searchDirection - the direction to search along the options from the given index\n */\n\n\n ComboBox.prototype._setSelectedIndex = function (index, submitPendingValueEvent, searchDirection) {\n var _this = this;\n\n if (searchDirection === void 0) {\n searchDirection = SearchDirection.none;\n }\n\n var _a = this.props,\n onChange = _a.onChange,\n onPendingValueChanged = _a.onPendingValueChanged;\n var currentOptions = this.state.currentOptions;\n var initialIndices = this.state.selectedIndices; // Clone selectedIndices so we don't mutate state\n\n var selectedIndices = initialIndices ? initialIndices.slice() : []; // Find the next selectable index, if searchDirection is none\n // we will get our starting index back\n\n index = this._getNextSelectableIndex(index, searchDirection);\n\n if (!this._indexWithinBounds(currentOptions, index)) {\n return;\n } // Are we at a new index? If so, update the state, otherwise\n // there is nothing to do\n\n\n if (this.props.multiSelect || selectedIndices.length < 1 || selectedIndices.length === 1 && selectedIndices[0] !== index) {\n var option_1 = __assign({}, currentOptions[index]); // if option doesn't existing, or option is disabled, we noop\n\n\n if (!option_1 || option_1.disabled) {\n return;\n }\n\n if (this.props.multiSelect) {\n // Setting the initial state of option.selected in Multi-select combobox by checking the\n // selectedIndices array and overriding the undefined issue\n option_1.selected = option_1.selected !== undefined ? !option_1.selected : selectedIndices.indexOf(index) < 0;\n\n if (option_1.selected && selectedIndices.indexOf(index) < 0) {\n selectedIndices.push(index);\n } else if (!option_1.selected && selectedIndices.indexOf(index) >= 0) {\n selectedIndices = selectedIndices.filter(function (value) {\n return value !== index;\n });\n }\n } else {\n selectedIndices[0] = index;\n }\n\n submitPendingValueEvent.persist(); // Only setstate if combobox is uncontrolled.\n\n if (this.props.selectedKey || this.props.selectedKey === null) {\n // If ComboBox value is changed, revert preview first\n if (this._hasPendingValue && onPendingValueChanged) {\n onPendingValueChanged();\n this._hasPendingValue = false;\n }\n\n if (onChange) {\n onChange(submitPendingValueEvent, option_1, index, undefined);\n }\n } else {\n // Update current options\n var changedOptions = currentOptions.slice();\n changedOptions[index] = option_1; // Call onChange after state is updated\n\n this.setState({\n selectedIndices: selectedIndices,\n currentOptions: changedOptions\n }, function () {\n // If ComboBox value is changed, revert preview first\n if (_this._hasPendingValue && onPendingValueChanged) {\n onPendingValueChanged();\n _this._hasPendingValue = false;\n }\n\n if (onChange) {\n onChange(submitPendingValueEvent, option_1, index, undefined);\n }\n });\n }\n }\n\n if (this.props.multiSelect && this.state.isOpen) {\n return;\n } // clear all of the pending info\n\n\n this._clearPendingInfo();\n };\n /**\n * Submit a pending value if there is one\n */\n\n\n ComboBox.prototype._submitPendingValue = function (submitPendingValueEvent) {\n var _a = this.props,\n onChange = _a.onChange,\n allowFreeform = _a.allowFreeform,\n autoComplete = _a.autoComplete;\n var _b = this.state,\n currentPendingValue = _b.currentPendingValue,\n currentPendingValueValidIndex = _b.currentPendingValueValidIndex,\n currentOptions = _b.currentOptions,\n currentPendingValueValidIndexOnHover = _b.currentPendingValueValidIndexOnHover;\n var selectedIndices = this.state.selectedIndices; // Do not submit any pending value if we\n // have already initiated clearing the pending info\n\n if (this._processingClearPendingInfo) {\n return;\n } // If we allow freeform we need to handle that\n\n\n if (allowFreeform) {\n // if currentPendingValue is null or undefined the user did not submit anything\n // (not even empty because we would have stored that as the pending value)\n if (currentPendingValue === null || currentPendingValue === undefined) {\n // if a user did not type anything they may just hovered over an item\n if (currentPendingValueValidIndexOnHover >= 0) {\n this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent);\n\n this._clearPendingInfo();\n }\n\n return;\n } // Check to see if the user typed an exact match\n\n\n if (this._indexWithinBounds(currentOptions, currentPendingValueValidIndex)) {\n var pendingOptionText = this._getPreviewText(currentOptions[currentPendingValueValidIndex]).toLocaleLowerCase(); // By exact match, that means: our pending value is the same as the pending option text OR\n // the pending option starts with the pending value and we have an \"autoComplete\" selection\n // where the total length is equal to pending option length OR\n // the live value in the underlying input matches the pending option; update the state\n\n\n if (currentPendingValue.toLocaleLowerCase() === pendingOptionText || autoComplete && pendingOptionText.indexOf(currentPendingValue.toLocaleLowerCase()) === 0 && this._autofill.current && this._autofill.current.isValueSelected && currentPendingValue.length + (this._autofill.current.selectionEnd - this._autofill.current.selectionStart) === pendingOptionText.length || this._autofill.current && this._autofill.current.inputElement && this._autofill.current.inputElement.value.toLocaleLowerCase() === pendingOptionText) {\n this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent);\n\n if (this.props.multiSelect && this.state.isOpen) {\n return;\n }\n\n this._clearPendingInfo();\n\n return;\n }\n }\n\n if (onChange) {\n if (onChange) {\n // trigger onChange to clear value\n onChange(submitPendingValueEvent, undefined, undefined, currentPendingValue);\n }\n } else {\n // If we are not controlled, create a new selected option\n var newOption = {\n key: currentPendingValue || getId(),\n text: this._normalizeToString(currentPendingValue)\n }; // If it's multiselect, set selected state to true\n\n if (this.props.multiSelect) {\n newOption.selected = true;\n }\n\n var newOptions = currentOptions.concat([newOption]);\n\n if (selectedIndices) {\n if (!this.props.multiSelect) {\n selectedIndices = [];\n }\n\n selectedIndices.push(newOptions.length - 1);\n }\n\n this.setState({\n currentOptions: newOptions,\n selectedIndices: selectedIndices\n });\n }\n } else if (currentPendingValueValidIndex >= 0) {\n // Since we are not allowing freeform, we must have a matching\n // to be able to update state\n this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent);\n } else if (currentPendingValueValidIndexOnHover >= 0) {\n // If all else failed and we were hovering over an item, select it\n this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent);\n } // Finally, clear the pending info\n\n\n this._clearPendingInfo();\n };\n\n ComboBox.prototype._onCalloutLayerMounted = function () {\n // In persistMenu mode _onLayerMounted is only called once for the lifetime\n // of the component. Any functionality required for callout \"on mount\" can\n // go here so that we can also call it again during callout dismissal to reset\n // object state.\n this._gotMouseMove = false;\n }; // Render separator\n\n\n ComboBox.prototype._renderSeparator = function (item) {\n var index = item.index,\n key = item.key;\n\n if (index && index > 0) {\n return React.createElement(\"div\", {\n role: \"separator\",\n key: key,\n className: this._classNames.divider\n });\n }\n\n return null;\n };\n\n ComboBox.prototype._renderHeader = function (item) {\n var _a = this.props.onRenderOption,\n onRenderOption = _a === void 0 ? this._onRenderOptionContent : _a;\n return React.createElement(\"div\", {\n id: item.id,\n key: item.key,\n className: this._classNames.header\n }, onRenderOption(item, this._onRenderOptionContent));\n };\n /**\n * If we are coming from a mouseOut:\n * there is no visible selected option.\n *\n * Else if We are hovering over an item:\n * that gets the selected look.\n *\n * Else:\n * Use the current valid pending index if it exists OR\n * we do not have a valid index and we currently have a pending input value,\n * otherwise use the selected index\n * */\n\n\n ComboBox.prototype._isOptionSelected = function (index) {\n var currentPendingValueValidIndexOnHover = this.state.currentPendingValueValidIndexOnHover; // If the hover state is set to clearAll, don't show a selected index.\n // Note, this happens when the user moused out of the menu items\n\n if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) {\n return false;\n }\n\n return this._getPendingSelectedIndex(true\n /* includePendingValue */\n ) === index ? true : false;\n };\n\n ComboBox.prototype._isOptionChecked = function (index) {\n if (this.props.multiSelect && index !== undefined && this.state.selectedIndices) {\n var idxOfSelectedIndex = -1;\n idxOfSelectedIndex = this.state.selectedIndices.indexOf(index);\n return idxOfSelectedIndex >= 0;\n }\n\n return false;\n };\n /**\n * Gets the pending selected index taking into account hover, valueValidIndex, and selectedIndex\n * @param includeCurrentPendingValue - Should we include the currentPendingValue when\n * finding the index\n */\n\n\n ComboBox.prototype._getPendingSelectedIndex = function (includeCurrentPendingValue) {\n var _a = this.state,\n currentPendingValueValidIndexOnHover = _a.currentPendingValueValidIndexOnHover,\n currentPendingValueValidIndex = _a.currentPendingValueValidIndex,\n currentPendingValue = _a.currentPendingValue;\n return currentPendingValueValidIndexOnHover >= 0 ? currentPendingValueValidIndexOnHover : currentPendingValueValidIndex >= 0 || includeCurrentPendingValue && currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValueValidIndex : this.props.multiSelect ? 0 : this._getFirstSelectedIndex();\n };\n /**\n * Scroll the selected element into view\n */\n\n\n ComboBox.prototype._scrollIntoView = function () {\n var _a = this.props,\n onScrollToItem = _a.onScrollToItem,\n scrollSelectedToTop = _a.scrollSelectedToTop;\n var _b = this.state,\n currentPendingValueValidIndex = _b.currentPendingValueValidIndex,\n currentPendingValue = _b.currentPendingValue;\n\n if (onScrollToItem) {\n // Use the custom scroll handler\n onScrollToItem(currentPendingValueValidIndex >= 0 || currentPendingValue !== '' ? currentPendingValueValidIndex : this._getFirstSelectedIndex());\n } else if (this._selectedElement.current && this._selectedElement.current.offsetParent) {\n // We are using refs, scroll the ref into view\n if (scrollSelectedToTop) {\n this._selectedElement.current.offsetParent.scrollIntoView(true);\n } else {\n var alignToTop = true;\n\n if (this._comboBoxMenu.current && this._comboBoxMenu.current.offsetParent) {\n var scrollableParentRect = this._comboBoxMenu.current.offsetParent.getBoundingClientRect();\n\n var selectedElementRect = this._selectedElement.current.offsetParent.getBoundingClientRect(); // If we are completely in view then we do not need to scroll\n\n\n if (scrollableParentRect.top <= selectedElementRect.top && scrollableParentRect.top + scrollableParentRect.height >= selectedElementRect.top + selectedElementRect.height) {\n return;\n } // If we are lower than the scrollable parent viewport then we should align to the bottom\n\n\n if (scrollableParentRect.top + scrollableParentRect.height <= selectedElementRect.top + selectedElementRect.height) {\n alignToTop = false;\n }\n }\n\n this._selectedElement.current.offsetParent.scrollIntoView(alignToTop);\n }\n }\n };\n /**\n * Click handler for the menu items\n * to select the item and also close the menu\n * @param index - the index of the item that was clicked\n */\n\n\n ComboBox.prototype._onItemClick = function (item) {\n var _this = this;\n\n var onItemClick = this.props.onItemClick;\n var index = item.index;\n return function (ev) {\n // only close the callout when it's in single-select mode\n if (!_this.props.multiSelect) {\n // ensure that focus returns to the input, not the button\n _this._autofill.current && _this._autofill.current.focus();\n\n _this.setState({\n isOpen: false\n });\n } // Continue processing the click only after\n // performing menu close / control focus(inner working)\n\n\n onItemClick && onItemClick(ev, item, index);\n\n _this._setSelectedIndex(index, ev);\n };\n };\n /**\n * Get the indices of the options that are marked as selected\n * @param options - the comboBox options\n * @param selectedKeys - the known selected keys to find\n * @returns - an array of the indices of the selected options, empty array if nothing is selected\n */\n\n\n ComboBox.prototype._getSelectedIndices = function (options, selectedKeys) {\n if (!options || !selectedKeys) {\n return [];\n }\n\n var selectedIndices = {};\n options.forEach(function (option, index) {\n if (option.selected) {\n selectedIndices[index] = true;\n }\n });\n\n var _loop_1 = function _loop_1(selectedKey) {\n var index = findIndex(options, function (option) {\n return option.key === selectedKey;\n });\n\n if (index > -1) {\n selectedIndices[index] = true;\n }\n };\n\n for (var _i = 0, selectedKeys_1 = selectedKeys; _i < selectedKeys_1.length; _i++) {\n var selectedKey = selectedKeys_1[_i];\n\n _loop_1(selectedKey);\n }\n\n return Object.keys(selectedIndices).map(Number).sort();\n };\n /**\n * Reset the selected index by clearing the\n * input (of any pending text), clearing the pending state,\n * and setting the suggested display value to the last\n * selected state text\n */\n\n\n ComboBox.prototype._resetSelectedIndex = function () {\n var currentOptions = this.state.currentOptions;\n\n this._clearPendingInfo();\n\n var selectedIndex = this._getFirstSelectedIndex();\n\n if (selectedIndex > 0 && selectedIndex < currentOptions.length) {\n this.setState({\n suggestedDisplayValue: currentOptions[selectedIndex].text\n });\n } else if (this.props.text) {\n // If we had a value initially, restore it\n this.setState({\n suggestedDisplayValue: this.props.text\n });\n }\n };\n /**\n * Clears the pending info state\n */\n\n\n ComboBox.prototype._clearPendingInfo = function () {\n this._processingClearPendingInfo = true;\n this.setState({\n currentPendingValue: undefined,\n currentPendingValueValidIndex: -1,\n suggestedDisplayValue: undefined,\n currentPendingValueValidIndexOnHover: HoverStatus.default\n }, this._onAfterClearPendingInfo);\n };\n /**\n * Set the pending info\n * @param currentPendingValue - new pending value to set\n * @param currentPendingValueValidIndex - new pending value index to set\n * @param suggestedDisplayValue - new suggest display value to set\n */\n\n\n ComboBox.prototype._setPendingInfo = function (currentPendingValue, currentPendingValueValidIndex, suggestedDisplayValue) {\n if (currentPendingValueValidIndex === void 0) {\n currentPendingValueValidIndex = -1;\n }\n\n if (this._processingClearPendingInfo) {\n return;\n }\n\n this.setState({\n currentPendingValue: this._normalizeToString(currentPendingValue),\n currentPendingValueValidIndex: currentPendingValueValidIndex,\n suggestedDisplayValue: suggestedDisplayValue,\n currentPendingValueValidIndexOnHover: HoverStatus.default\n });\n };\n /**\n * Set the pending info from the given index\n * @param index - the index to set the pending info from\n */\n\n\n ComboBox.prototype._setPendingInfoFromIndex = function (index) {\n var currentOptions = this.state.currentOptions;\n\n if (index >= 0 && index < currentOptions.length) {\n var option = currentOptions[index];\n\n this._setPendingInfo(this._getPreviewText(option), index, this._getPreviewText(option));\n } else {\n this._clearPendingInfo();\n }\n };\n /**\n * Sets the pending info for the comboBox\n * @param index - the index to search from\n * @param searchDirection - the direction to search\n */\n\n\n ComboBox.prototype._setPendingInfoFromIndexAndDirection = function (index, searchDirection) {\n var currentOptions = this.state.currentOptions; // update index to allow content to wrap\n\n if (searchDirection === SearchDirection.forward && index >= currentOptions.length - 1) {\n index = -1;\n } else if (searchDirection === SearchDirection.backward && index <= 0) {\n index = currentOptions.length;\n } // get the next \"valid\" index\n\n\n var indexUpdate = this._getNextSelectableIndex(index, searchDirection); // if the two indicies are equal we didn't move and\n // we should attempt to get get the first/last \"valid\" index to use\n // (Note, this takes care of the potential cases where the first/last\n // item is not focusable), otherwise use the updated index\n\n\n if (index === indexUpdate) {\n if (searchDirection === SearchDirection.forward) {\n index = this._getNextSelectableIndex(-1, searchDirection);\n } else if (searchDirection === SearchDirection.backward) {\n index = this._getNextSelectableIndex(currentOptions.length, searchDirection);\n }\n } else {\n index = indexUpdate;\n }\n\n if (this._indexWithinBounds(currentOptions, index)) {\n this._setPendingInfoFromIndex(index);\n }\n };\n\n ComboBox.prototype._notifyPendingValueChanged = function (prevState) {\n var onPendingValueChanged = this.props.onPendingValueChanged;\n\n if (!onPendingValueChanged) {\n return;\n }\n\n var _a = this.state,\n currentPendingValue = _a.currentPendingValue,\n currentOptions = _a.currentOptions,\n currentPendingValueValidIndex = _a.currentPendingValueValidIndex,\n currentPendingValueValidIndexOnHover = _a.currentPendingValueValidIndexOnHover;\n var newPendingIndex = undefined;\n var newPendingValue = undefined;\n\n if (currentPendingValueValidIndexOnHover !== prevState.currentPendingValueValidIndexOnHover && this._indexWithinBounds(currentOptions, currentPendingValueValidIndexOnHover)) {\n // Set new pending index if hover index was changed\n newPendingIndex = currentPendingValueValidIndexOnHover;\n } else if (currentPendingValueValidIndex !== prevState.currentPendingValueValidIndex && this._indexWithinBounds(currentOptions, currentPendingValueValidIndex)) {\n // Set new pending index if currentPendingValueValidIndex was changed\n newPendingIndex = currentPendingValueValidIndex;\n } else if (currentPendingValue !== prevState.currentPendingValue) {\n // Set pendingValue in the case it was changed and no index was changed\n newPendingValue = currentPendingValue;\n } // Notify when there is a new pending index/value. Also, if there is a pending value, it needs to send undefined.\n\n\n if (newPendingIndex !== undefined || newPendingValue !== undefined || this._hasPendingValue) {\n onPendingValueChanged(newPendingIndex !== undefined ? currentOptions[newPendingIndex] : undefined, newPendingIndex, newPendingValue);\n this._hasPendingValue = newPendingIndex !== undefined || newPendingValue !== undefined;\n }\n };\n /**\n * Sets the isOpen state and updates focusInputAfterClose\n */\n\n\n ComboBox.prototype._setOpenStateAndFocusOnClose = function (isOpen, focusInputAfterClose) {\n this._focusInputAfterClose = focusInputAfterClose;\n this.setState({\n isOpen: isOpen\n });\n };\n /**\n * Returns true if the key for the event is alt (Mac option) or meta (Mac command).\n */\n\n\n ComboBox.prototype._isAltOrMeta = function (ev) {\n return ev.which === KeyCodes.alt || ev.key === 'Meta';\n };\n\n ComboBox.prototype._onOptionMouseEnter = function (index) {\n if (this._shouldIgnoreMouseEvent()) {\n return;\n }\n\n this.setState({\n currentPendingValueValidIndexOnHover: index\n });\n };\n\n ComboBox.prototype._onOptionMouseMove = function (index) {\n this._gotMouseMove = true;\n\n if (!this._isScrollIdle || this.state.currentPendingValueValidIndexOnHover === index) {\n return;\n }\n\n this.setState({\n currentPendingValueValidIndexOnHover: index\n });\n };\n\n ComboBox.prototype._shouldIgnoreMouseEvent = function () {\n return !this._isScrollIdle || !this._gotMouseMove;\n };\n /**\n * Handle dismissing the menu and\n * eating the required key event when disabled\n * @param ev - the keyboard event that was fired\n */\n\n\n ComboBox.prototype._handleInputWhenDisabled = function (ev) {\n // If we are disabled, close the menu (if needed)\n // and eat all keystokes other than TAB or ESC\n if (this.props.disabled) {\n if (this.state.isOpen) {\n this.setState({\n isOpen: false\n });\n } // When disabled stop propagation and prevent default\n // of the event unless we have a tab, escape, or function key\n\n\n if (ev !== null && ev.which !== KeyCodes.tab && ev.which !== KeyCodes.escape && (ev.which < 112\n /* F1 */\n || ev.which > 123)\n /* F12 */\n ) {\n ev.stopPropagation();\n ev.preventDefault();\n }\n }\n };\n\n ComboBox.prototype._handleTouchAndPointerEvent = function () {\n var _this = this; // If we already have an existing timeeout from a previous touch and pointer event\n // cancel that timeout so we can set a nwe one.\n\n\n if (this._lastTouchTimeoutId !== undefined) {\n this._async.clearTimeout(this._lastTouchTimeoutId);\n\n this._lastTouchTimeoutId = undefined;\n }\n\n this._processingTouch = true;\n this._lastTouchTimeoutId = this._async.setTimeout(function () {\n _this._processingTouch = false;\n _this._lastTouchTimeoutId = undefined;\n }, TouchIdleDelay);\n };\n /**\n * Get the styles for the current option.\n * @param item - Item props for the current option\n */\n\n\n ComboBox.prototype._getCaretButtonStyles = function () {\n var customCaretDownButtonStyles = this.props.caretDownButtonStyles;\n return getCaretDownButtonStyles(this.props.theme, customCaretDownButtonStyles);\n };\n /**\n * Get the styles for the current option.\n * @param item - Item props for the current option\n */\n\n\n ComboBox.prototype._getCurrentOptionStyles = function (item) {\n var customStylesForAllOptions = this.props.comboBoxOptionStyles;\n var customStylesForCurrentOption = item.styles;\n return getOptionStyles(this.props.theme, customStylesForAllOptions, customStylesForCurrentOption, this._isPendingOption(item), item.hidden);\n };\n /**\n * Get the aria-activedescendant value for the comboxbox.\n * @returns the id of the current focused combo item, otherwise the id of the currently selected element,\n * null otherwise\n */\n\n\n ComboBox.prototype._getAriaActiveDescendantValue = function () {\n var descendantText = this.state.isOpen && this.state.selectedIndices && this.state.selectedIndices.length > 0 ? this._id + '-list' + this.state.selectedIndices[0] : undefined;\n\n if (this.state.isOpen && this._hasFocus() && this.state.currentPendingValueValidIndex !== -1) {\n descendantText = this._id + '-list' + this.state.currentPendingValueValidIndex;\n }\n\n return descendantText;\n };\n /**\n * Get the aria autocomplete value for the Combobox\n * @returns 'inline' if auto-complete automatically dynamic, 'both' if we have a list of possible values to pick from\n * and can dynamically populate input, and 'none' if auto-complete is not enabled as we can't give user inputs.\n */\n\n\n ComboBox.prototype._getAriaAutoCompleteValue = function () {\n var autoComplete = !this.props.disabled && this.props.autoComplete === 'on';\n return autoComplete ? this.props.allowFreeform ? 'inline' : 'both' : 'none';\n };\n\n ComboBox.prototype._isPendingOption = function (item) {\n return item && item.index === this.state.currentPendingValueValidIndex;\n };\n /**\n * Given default selected key(s) and selected key(s), return the selected keys(s).\n * When default selected key(s) are available, they take precedence and return them instead of selected key(s).\n *\n * @returns No matter what specific types the input parameters are, always return an array of\n * either strings or numbers instead of premitive type. This normlization makes caller's logic easier.\n */\n\n\n ComboBox.prototype._buildDefaultSelectedKeys = function (defaultSelectedKey, selectedKey) {\n var selectedKeys = this._buildSelectedKeys(defaultSelectedKey);\n\n if (selectedKeys.length) {\n return selectedKeys;\n }\n\n return this._buildSelectedKeys(selectedKey);\n };\n\n ComboBox.prototype._buildSelectedKeys = function (selectedKey) {\n if (selectedKey === undefined) {\n return [];\n } // need to cast here so typescript does not complain\n\n\n return selectedKey instanceof Array ? selectedKey : [selectedKey];\n }; // For scenarios where the option's text prop contains embedded styles, we use the option's\n // ariaLabel value as the text in the input and for autocomplete matching. We know to use this\n // when the useAriaLabelAsText prop is set to true\n\n\n ComboBox.prototype._getPreviewText = function (item) {\n return item.useAriaLabelAsText && item.ariaLabel ? item.ariaLabel : item.text;\n };\n\n ComboBox.prototype._normalizeToString = function (value) {\n return value || '';\n };\n /**\n * Returns true if the component has some kind of focus. If it's either focusing or if it's focused\n */\n\n\n ComboBox.prototype._hasFocus = function () {\n return this.state.focusState !== 'none';\n };\n\n ComboBox.defaultProps = {\n options: [],\n allowFreeform: false,\n autoComplete: 'on',\n buttonIconProps: {\n iconName: 'ChevronDown'\n }\n };\n ComboBox = __decorate([customizable('ComboBox', ['theme', 'styles'], true)], ComboBox);\n return ComboBox;\n}(React.Component);\n\nexport { ComboBox };","import { memoizeFunction } from '../../Utilities';\nimport { mergeStyles } from '../../Styling';\nexport var getClassNames = memoizeFunction(function (styles, className, isOpen, disabled, required, focused, allowFreeForm, hasErrorMessage) {\n return {\n container: mergeStyles('ms-ComboBox-container', className, styles.container),\n label: mergeStyles(styles.label, disabled && styles.labelDisabled),\n root: mergeStyles('ms-ComboBox', hasErrorMessage ? styles.rootError : isOpen && 'is-open', required && 'is-required', styles.root, !allowFreeForm && styles.rootDisallowFreeForm, hasErrorMessage && !focused ? styles.rootError : !disabled && focused && styles.rootFocused, !disabled && {\n selectors: {\n ':hover': hasErrorMessage ? styles.rootError : !isOpen && !focused && styles.rootHovered,\n ':active': hasErrorMessage ? styles.rootError : styles.rootPressed,\n ':focus': hasErrorMessage ? styles.rootError : styles.rootFocused\n }\n }, disabled && ['is-disabled', styles.rootDisabled]),\n input: mergeStyles('ms-ComboBox-Input', styles.input, disabled && styles.inputDisabled),\n errorMessage: mergeStyles(styles.errorMessage),\n callout: mergeStyles('ms-ComboBox-callout', styles.callout),\n optionsContainerWrapper: mergeStyles('ms-ComboBox-optionsContainerWrapper', styles.optionsContainerWrapper),\n optionsContainer: mergeStyles('ms-ComboBox-optionsContainer', styles.optionsContainer),\n header: mergeStyles('ms-ComboBox-header', styles.header),\n divider: mergeStyles('ms-ComboBox-divider', styles.divider),\n screenReaderText: mergeStyles(styles.screenReaderText)\n };\n});\nexport var getComboBoxOptionClassNames = memoizeFunction(function (styles) {\n return {\n optionText: mergeStyles('ms-ComboBox-optionText', styles.optionText),\n root: mergeStyles('ms-ComboBox-option', styles.root, {\n selectors: {\n ':hover': styles.rootHovered,\n ':focus': styles.rootFocused,\n ':active': styles.rootPressed\n }\n }),\n optionTextWrapper: mergeStyles(styles.optionTextWrapper)\n };\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { ComboBox } from './ComboBox';\nimport { List } from '../../List';\nimport { initializeComponentRef } from '../../Utilities';\n\nvar VirtualizedComboBox =\n/** @class */\nfunction (_super) {\n __extends(VirtualizedComboBox, _super);\n\n function VirtualizedComboBox(props) {\n var _this = _super.call(this, props) || this;\n /** The combo box element */\n\n\n _this._comboBox = React.createRef();\n /** The virtualized list element */\n\n _this._list = React.createRef();\n\n _this._onRenderList = function (props) {\n var id = props.id,\n onRenderItem = props.onRenderItem; // Render virtualized list\n\n return React.createElement(List, {\n componentRef: _this._list,\n role: \"listbox\",\n id: id + \"-list\",\n \"aria-labelledby\": id + \"-label\",\n items: props.options,\n // eslint-disable-next-line react/jsx-no-bind\n onRenderCell: onRenderItem ? function (item) {\n return onRenderItem(item);\n } : function () {\n return null;\n }\n });\n };\n\n _this._onScrollToItem = function (itemIndex) {\n // We are using the List component, call scrollToIndex\n _this._list.current && _this._list.current.scrollToIndex(itemIndex);\n };\n\n initializeComponentRef(_this);\n return _this;\n }\n\n Object.defineProperty(VirtualizedComboBox.prototype, \"selectedOptions\", {\n /**\n * All selected options\n */\n get: function get() {\n if (this._comboBox.current) {\n return this._comboBox.current.selectedOptions;\n }\n\n return [];\n },\n enumerable: true,\n configurable: true\n });\n\n VirtualizedComboBox.prototype.dismissMenu = function () {\n if (this._comboBox.current) {\n return this._comboBox.current.dismissMenu();\n }\n };\n\n VirtualizedComboBox.prototype.focus = function (shouldOpenOnFocus, useFocusAsync) {\n if (this._comboBox.current) {\n this._comboBox.current.focus(shouldOpenOnFocus, useFocusAsync);\n\n return true;\n }\n\n return false;\n };\n\n VirtualizedComboBox.prototype.render = function () {\n return React.createElement(ComboBox, __assign({}, this.props, {\n componentRef: this._comboBox,\n onRenderList: this._onRenderList,\n onScrollToItem: this._onScrollToItem\n }));\n };\n\n return VirtualizedComboBox;\n}(React.Component);\n\nexport { VirtualizedComboBox };","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { KeyCodes, classNamesFunction, getId, getNativeProps, divProperties, css, initializeComponentRef } from '../../Utilities';\nimport { Calendar, DayOfWeek } from '../../Calendar';\nimport { FirstWeekOfYear } from '../../utilities/dateValues/DateValues';\nimport { Callout } from '../../Callout';\nimport { DirectionalHint } from '../../common/DirectionalHint';\nimport { TextField } from '../../TextField';\nimport { compareDates, compareDatePart } from '../../utilities/dateMath/DateMath';\nimport { FocusTrapZone } from '../../FocusTrapZone';\nvar getClassNames = classNamesFunction();\nvar DEFAULT_STRINGS = {\n months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n shortDays: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n goToToday: 'Go to today',\n prevMonthAriaLabel: 'Go to previous month',\n nextMonthAriaLabel: 'Go to next month',\n prevYearAriaLabel: 'Go to previous year',\n nextYearAriaLabel: 'Go to next year',\n prevYearRangeAriaLabel: 'Previous year range',\n nextYearRangeAriaLabel: 'Next year range',\n closeButtonAriaLabel: 'Close date picker',\n weekNumberFormatString: 'Week number {0}'\n};\n\nvar DatePickerBase =\n/** @class */\nfunction (_super) {\n __extends(DatePickerBase, _super);\n\n function DatePickerBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._calendar = React.createRef();\n _this._datePickerDiv = React.createRef();\n _this._textField = React.createRef();\n\n _this._onSelectDate = function (date) {\n var _a = _this.props,\n formatDate = _a.formatDate,\n onSelectDate = _a.onSelectDate;\n\n if (_this.props.calendarProps && _this.props.calendarProps.onSelectDate) {\n _this.props.calendarProps.onSelectDate(date);\n }\n\n _this.setState({\n selectedDate: date,\n formattedDate: formatDate && date ? formatDate(date) : ''\n });\n\n if (onSelectDate) {\n onSelectDate(date);\n }\n\n _this._calendarDismissed();\n };\n\n _this._onCalloutPositioned = function () {\n var shouldFocus = true; // If the user has specified that the callout shouldn't use initial focus, then respect\n // that and don't attempt to set focus. That will default to true within the callout\n // so we need to check if it's undefined here.\n\n if (_this.props.calloutProps && _this.props.calloutProps.setInitialFocus !== undefined) {\n shouldFocus = _this.props.calloutProps.setInitialFocus;\n }\n\n if (_this._calendar.current && shouldFocus) {\n _this._calendar.current.focus();\n }\n };\n\n _this._onTextFieldFocus = function (ev) {\n if (_this.props.disableAutoFocus) {\n return;\n }\n\n if (!_this.props.allowTextInput) {\n if (!_this._preventFocusOpeningPicker) {\n _this._showDatePickerPopup();\n } else {\n _this._preventFocusOpeningPicker = false;\n }\n }\n };\n\n _this._onTextFieldBlur = function (ev) {\n _this._validateTextInput();\n };\n\n _this._onTextFieldChanged = function (ev, newValue) {\n var _a = _this.props,\n allowTextInput = _a.allowTextInput,\n textField = _a.textField;\n\n if (allowTextInput) {\n if (_this.state.isDatePickerShown) {\n _this._dismissDatePickerPopup();\n }\n\n var _b = _this.props,\n isRequired = _b.isRequired,\n strings = _b.strings;\n\n _this.setState({\n errorMessage: isRequired && !newValue ? strings.isRequiredErrorMessage || ' ' : undefined,\n formattedDate: newValue\n });\n }\n\n if (textField && textField.onChange) {\n textField.onChange(ev, newValue);\n }\n };\n\n _this._onTextFieldKeyDown = function (ev) {\n switch (ev.which) {\n case KeyCodes.enter:\n ev.preventDefault();\n ev.stopPropagation();\n\n if (!_this.state.isDatePickerShown) {\n _this._validateTextInput();\n\n _this._showDatePickerPopup();\n } else {\n // When DatePicker allows input date string directly,\n // it is expected to hit another enter to close the popup\n if (_this.props.allowTextInput) {\n _this._dismissDatePickerPopup();\n }\n }\n\n break;\n\n case KeyCodes.escape:\n _this._handleEscKey(ev);\n\n break;\n\n default:\n break;\n }\n };\n\n _this._onTextFieldClick = function (ev) {\n if (!_this.props.disableAutoFocus && !_this.state.isDatePickerShown && !_this.props.disabled) {\n _this._showDatePickerPopup();\n\n return;\n }\n\n if (_this.props.allowTextInput) {\n _this._dismissDatePickerPopup();\n }\n };\n\n _this._onIconClick = function (ev) {\n ev.stopPropagation();\n\n if (!_this.state.isDatePickerShown && !_this.props.disabled) {\n _this._showDatePickerPopup();\n } else if (_this.props.allowTextInput) {\n _this._dismissDatePickerPopup();\n }\n };\n\n _this._dismissDatePickerPopup = function () {\n if (_this.state.isDatePickerShown) {\n _this.setState({\n isDatePickerShown: false\n }, function () {\n // setState is async, so we must call validate in a callback\n _this._validateTextInput();\n });\n }\n };\n /**\n * Callback for closing the calendar callout\n */\n\n\n _this._calendarDismissed = function () {\n _this._preventFocusOpeningPicker = true;\n\n _this._dismissDatePickerPopup(); // don't need to focus the text box, if necessary the focusTrapZone will do it\n\n };\n\n _this._handleEscKey = function (ev) {\n if (_this.state.isDatePickerShown) {\n ev.stopPropagation();\n }\n\n _this._calendarDismissed();\n };\n\n _this._validateTextInput = function () {\n var _a = _this.props,\n isRequired = _a.isRequired,\n allowTextInput = _a.allowTextInput,\n strings = _a.strings,\n parseDateFromString = _a.parseDateFromString,\n onSelectDate = _a.onSelectDate,\n formatDate = _a.formatDate,\n minDate = _a.minDate,\n maxDate = _a.maxDate;\n var inputValue = _this.state.formattedDate; // Do validation only if DatePicker's popup is dismissed\n\n if (_this.state.isDatePickerShown) {\n return;\n }\n\n if (allowTextInput) {\n var date = null;\n\n if (inputValue) {\n // Don't parse if the selected date has the same formatted string as what we're about to parse.\n // The formatted string might be ambiguous (ex: \"1/2/3\" or \"New Year Eve\") and the parser might\n // not be able to come up with the exact same date.\n if (_this.state.selectedDate && !_this.state.errorMessage && formatDate && formatDate(_this.state.selectedDate) === inputValue) {\n return;\n }\n\n date = parseDateFromString(inputValue); // Check if date is null, or date is Invalid Date\n\n if (!date || isNaN(date.getTime())) {\n // Reset invalid input field, if formatting is available\n if (formatDate) {\n date = _this.state.selectedDate;\n\n _this.setState({\n formattedDate: formatDate(date).toString()\n });\n }\n\n _this.setState({\n errorMessage: strings.invalidInputErrorMessage || ' '\n });\n } else {\n // Check against optional date boundaries\n if (_this._isDateOutOfBounds(date, minDate, maxDate)) {\n _this.setState({\n errorMessage: strings.isOutOfBoundsErrorMessage || ' '\n });\n } else {\n _this.setState({\n selectedDate: date,\n errorMessage: ''\n }); // When formatting is available:\n // If formatted date is valid, but is different from input, update with formatted date.\n // This occurs when an invalid date is entered twice.\n\n\n if (formatDate && formatDate(date) !== inputValue) {\n _this.setState({\n formattedDate: formatDate(date).toString()\n });\n }\n }\n }\n } else {\n // Only show error for empty inputValue if it is a required field\n _this.setState({\n errorMessage: isRequired ? strings.isRequiredErrorMessage || ' ' : ''\n });\n } // Execute onSelectDate callback\n\n\n if (onSelectDate) {\n // If no input date string or input date string is invalid\n // date variable will be null, callback should expect null value for this case\n onSelectDate(date);\n }\n } else if (isRequired && !inputValue) {\n // Check when DatePicker is a required field but has NO input value\n _this.setState({\n errorMessage: strings.isRequiredErrorMessage || ' '\n });\n } else {\n // Cleanup the error message\n _this.setState({\n errorMessage: ''\n });\n }\n };\n\n _this._renderReadOnlyInput = function (inputProps) {\n var formattedDate = _this.state.formattedDate;\n var _a = _this.props,\n styles = _a.styles,\n theme = _a.theme,\n placeholder = _a.placeholder,\n tabIndex = _a.tabIndex,\n underlined = _a.underlined;\n var classNames = getClassNames(styles, {\n theme: theme,\n underlined: underlined\n });\n var divProps = getNativeProps(inputProps, divProperties); // Talkback on Android treats readonly inputs as disabled, so swipe gestures to open the Calendar\n // don't register. Workaround is rendering a div with role=\"combobox\" (passed in via TextField props).\n\n return React.createElement(\"div\", __assign({}, divProps, {\n className: css(divProps.className, classNames.readOnlyTextField),\n tabIndex: tabIndex || 0\n }), formattedDate || // Putting the placeholder in a separate span fixes specificity issues for the text color\n React.createElement(\"span\", {\n className: classNames.readOnlyPlaceholder\n }, placeholder));\n };\n\n initializeComponentRef(_this);\n _this.state = _this._getDefaultState();\n _this._id = props.id || getId('DatePicker');\n _this._preventFocusOpeningPicker = false;\n return _this;\n }\n\n DatePickerBase.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) {\n var formatDate = nextProps.formatDate,\n value = nextProps.value;\n\n if (compareDates(this.props.minDate, nextProps.minDate) && compareDates(this.props.maxDate, nextProps.maxDate) && this.props.isRequired === nextProps.isRequired && compareDates(this.state.selectedDate, value) && this.props.formatDate === formatDate) {\n // if the props we care about haven't changed, don't run validation or updates\n return;\n }\n\n this._setErrorMessage(true, nextProps);\n\n this._id = nextProps.id || this._id; // Issue# 1274: Check if the date value changed from old value, i.e., if indeed a new date is being\n // passed in or if the formatting function was modified. We only update the selected date if either of these\n // had a legit change. Note tha the bug will still repro when only the formatDate was passed in props and this\n // is the result of the onSelectDate callback, but this should be a rare scenario.\n\n var oldValue = this.state.selectedDate;\n\n if (!compareDates(oldValue, value) || this.props.formatDate !== formatDate) {\n this.setState({\n selectedDate: value || undefined,\n formattedDate: formatDate && value ? formatDate(value) : ''\n });\n }\n };\n\n DatePickerBase.prototype.componentDidUpdate = function (prevProps, prevState) {\n if (prevState.isDatePickerShown && !this.state.isDatePickerShown) {\n // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n if (this.props.onAfterMenuDismiss) {\n this.props.onAfterMenuDismiss();\n }\n }\n };\n\n DatePickerBase.prototype.render = function () {\n var _a = this.props,\n firstDayOfWeek = _a.firstDayOfWeek,\n strings = _a.strings,\n label = _a.label,\n theme = _a.theme,\n className = _a.className,\n styles = _a.styles,\n initialPickerDate = _a.initialPickerDate,\n isRequired = _a.isRequired,\n disabled = _a.disabled,\n ariaLabel = _a.ariaLabel,\n pickerAriaLabel = _a.pickerAriaLabel,\n placeholder = _a.placeholder,\n allowTextInput = _a.allowTextInput,\n borderless = _a.borderless,\n minDate = _a.minDate,\n maxDate = _a.maxDate,\n showCloseButton = _a.showCloseButton,\n calendarProps = _a.calendarProps,\n calloutProps = _a.calloutProps,\n textFieldProps = _a.textField,\n underlined = _a.underlined,\n allFocusable = _a.allFocusable,\n _b = _a.calendarAs,\n CalendarType = _b === void 0 ? Calendar : _b,\n tabIndex = _a.tabIndex;\n var _c = this.state,\n isDatePickerShown = _c.isDatePickerShown,\n formattedDate = _c.formattedDate,\n selectedDate = _c.selectedDate;\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n disabled: disabled,\n underlined: underlined,\n label: !!label,\n isDatePickerShown: isDatePickerShown\n });\n var calloutId = getId('DatePicker-Callout');\n var nativeProps = getNativeProps(this.props, divProperties, ['value']);\n var iconProps = textFieldProps && textFieldProps.iconProps;\n var textFieldId = textFieldProps && textFieldProps.id && textFieldProps.id !== this._id ? textFieldProps.id : this._id + '-label';\n var readOnly = !allowTextInput && !disabled;\n return React.createElement(\"div\", __assign({}, nativeProps, {\n className: classNames.root\n }), React.createElement(\"div\", {\n ref: this._datePickerDiv,\n \"aria-haspopup\": \"true\",\n \"aria-owns\": isDatePickerShown ? calloutId : undefined,\n className: classNames.wrapper\n }, React.createElement(TextField, __assign({\n role: \"combobox\",\n label: label,\n \"aria-expanded\": isDatePickerShown,\n ariaLabel: ariaLabel,\n \"aria-controls\": isDatePickerShown ? calloutId : undefined,\n required: isRequired,\n disabled: disabled,\n errorMessage: this._getErrorMessage(),\n placeholder: placeholder,\n borderless: borderless,\n value: formattedDate,\n componentRef: this._textField,\n underlined: underlined,\n tabIndex: tabIndex,\n readOnly: !allowTextInput\n }, textFieldProps, {\n id: textFieldId,\n className: css(classNames.textField, textFieldProps && textFieldProps.className),\n iconProps: __assign(__assign({\n iconName: 'Calendar'\n }, iconProps), {\n className: css(classNames.icon, iconProps && iconProps.className),\n onClick: this._onIconClick\n }),\n onKeyDown: this._onTextFieldKeyDown,\n onFocus: this._onTextFieldFocus,\n onBlur: this._onTextFieldBlur,\n onClick: this._onTextFieldClick,\n onChange: this._onTextFieldChanged,\n onRenderInput: readOnly ? this._renderReadOnlyInput : undefined\n }))), isDatePickerShown && React.createElement(Callout, __assign({\n id: calloutId,\n role: \"dialog\",\n ariaLabel: pickerAriaLabel,\n isBeakVisible: false,\n gapSpace: 0,\n doNotLayer: false,\n target: this._datePickerDiv.current,\n directionalHint: DirectionalHint.bottomLeftEdge\n }, calloutProps, {\n className: css(classNames.callout, calloutProps && calloutProps.className),\n onDismiss: this._calendarDismissed,\n onPositioned: this._onCalloutPositioned\n }), React.createElement(FocusTrapZone, {\n isClickableOutsideFocusTrap: true,\n disableFirstFocus: this.props.disableAutoFocus,\n forceFocusInsideTrap: false\n }, React.createElement(CalendarType, __assign({}, calendarProps, {\n onSelectDate: this._onSelectDate,\n onDismiss: this._calendarDismissed,\n isMonthPickerVisible: this.props.isMonthPickerVisible,\n showMonthPickerAsOverlay: this.props.showMonthPickerAsOverlay,\n today: this.props.today,\n value: selectedDate || initialPickerDate,\n firstDayOfWeek: firstDayOfWeek,\n strings: strings,\n highlightCurrentMonth: this.props.highlightCurrentMonth,\n highlightSelectedMonth: this.props.highlightSelectedMonth,\n showWeekNumbers: this.props.showWeekNumbers,\n firstWeekOfYear: this.props.firstWeekOfYear,\n showGoToToday: this.props.showGoToToday,\n dateTimeFormatter: this.props.dateTimeFormatter,\n minDate: minDate,\n maxDate: maxDate,\n componentRef: this._calendar,\n showCloseButton: showCloseButton,\n allFocusable: allFocusable\n })))));\n };\n\n DatePickerBase.prototype.focus = function () {\n if (this._textField.current) {\n this._textField.current.focus();\n }\n };\n\n DatePickerBase.prototype.reset = function () {\n this.setState(this._getDefaultState());\n };\n\n DatePickerBase.prototype._setErrorMessage = function (setState, nextProps) {\n var _a = nextProps || this.props,\n isRequired = _a.isRequired,\n strings = _a.strings,\n value = _a.value,\n minDate = _a.minDate,\n maxDate = _a.maxDate,\n initialPickerDate = _a.initialPickerDate;\n\n var errorMessage = !initialPickerDate && isRequired && !value ? strings.isRequiredErrorMessage || ' ' : undefined;\n\n if (!errorMessage && value) {\n errorMessage = this._isDateOutOfBounds(value, minDate, maxDate) ? strings.isOutOfBoundsErrorMessage || ' ' : undefined;\n }\n\n if (setState) {\n this.setState({\n errorMessage: errorMessage\n });\n }\n\n return errorMessage;\n };\n\n DatePickerBase.prototype._showDatePickerPopup = function () {\n if (!this.state.isDatePickerShown) {\n this._preventFocusOpeningPicker = true;\n this.setState({\n isDatePickerShown: true\n });\n }\n };\n\n DatePickerBase.prototype._getDefaultState = function (props) {\n if (props === void 0) {\n props = this.props;\n }\n\n return {\n selectedDate: props.value || undefined,\n formattedDate: props.formatDate && props.value ? props.formatDate(props.value) : '',\n isDatePickerShown: false,\n errorMessage: this._setErrorMessage(false)\n };\n };\n\n DatePickerBase.prototype._isDateOutOfBounds = function (date, minDate, maxDate) {\n return !!minDate && compareDatePart(minDate, date) > 0 || !!maxDate && compareDatePart(maxDate, date) < 0;\n };\n\n DatePickerBase.prototype._getErrorMessage = function () {\n if (this.state.isDatePickerShown) {\n return undefined;\n }\n\n return this.state.errorMessage;\n };\n\n DatePickerBase.defaultProps = {\n allowTextInput: false,\n formatDate: function formatDate(date) {\n if (date) {\n return date.toDateString();\n }\n\n return '';\n },\n parseDateFromString: function parseDateFromString(dateStr) {\n var date = Date.parse(dateStr);\n\n if (date) {\n return new Date(date);\n }\n\n return null;\n },\n firstDayOfWeek: DayOfWeek.Sunday,\n initialPickerDate: new Date(),\n isRequired: false,\n isMonthPickerVisible: true,\n showMonthPickerAsOverlay: false,\n strings: DEFAULT_STRINGS,\n highlightCurrentMonth: false,\n highlightSelectedMonth: false,\n borderless: false,\n pickerAriaLabel: 'Calendar',\n showWeekNumbers: false,\n firstWeekOfYear: FirstWeekOfYear.FirstDay,\n showGoToToday: true,\n dateTimeFormatter: undefined,\n showCloseButton: false,\n underlined: false,\n allFocusable: false\n };\n return DatePickerBase;\n}(React.Component);\n\nexport { DatePickerBase };","import { normalize, getGlobalClassNames, HighContrastSelector, getInputFocusStyle } from '../../Styling';\nvar GlobalClassNames = {\n root: 'ms-DatePicker',\n callout: 'ms-DatePicker-callout',\n withLabel: 'ms-DatePicker-event--with-label',\n withoutLabel: 'ms-DatePicker-event--without-label',\n disabled: 'msDatePickerDisabled '\n};\nvar TEXTFIELD_HEIGHT = 32;\nexport var styles = function styles(props) {\n var _a, _b;\n\n var className = props.className,\n theme = props.theme,\n disabled = props.disabled,\n underlined = props.underlined,\n label = props.label,\n isDatePickerShown = props.isDatePickerShown;\n var palette = theme.palette,\n semanticColors = theme.semanticColors,\n effects = theme.effects,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var DatePickerIcon = {\n color: palette.neutralSecondary,\n fontSize: fonts.mediumPlus.fontSize,\n lineHeight: '18px',\n pointerEvents: 'none',\n position: 'absolute',\n right: '4px',\n padding: '5px'\n };\n return {\n root: [classNames.root, theme.fonts.medium, isDatePickerShown && 'is-open', normalize, className],\n textField: [{\n position: 'relative',\n selectors: {\n '& input[readonly]': {\n cursor: 'pointer'\n },\n input: {\n selectors: {\n '::-ms-clear': {\n display: 'none'\n }\n }\n }\n }\n }, disabled && {\n selectors: {\n '& input[readonly]': {\n cursor: 'default'\n }\n }\n }],\n callout: [classNames.callout, {\n boxShadow: effects.elevation8\n }],\n icon: [DatePickerIcon, label ? classNames.withLabel : classNames.withoutLabel, {\n paddingTop: '7px'\n }, !disabled && [classNames.disabled, {\n pointerEvents: 'initial',\n cursor: 'pointer'\n }], disabled && {\n color: semanticColors.disabledText,\n cursor: 'default'\n }],\n readOnlyTextField: [{\n cursor: 'pointer',\n height: TEXTFIELD_HEIGHT,\n lineHeight: TEXTFIELD_HEIGHT - 2,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n selectors: (_a = {}, _a['&:focus'] = getInputFocusStyle(semanticColors.inputFocusBorderAlt, effects.roundedCorner2), _a)\n }, underlined && {\n lineHeight: TEXTFIELD_HEIGHT + 2\n }],\n readOnlyPlaceholder: (_b = {\n color: semanticColors.inputPlaceholderText\n }, _b[HighContrastSelector] = {\n color: 'GrayText'\n }, _b)\n };\n};","import { styled } from '../../Utilities';\nimport { DatePickerBase } from './DatePicker.base';\nimport { styles } from './DatePicker.styles';\n/**\n * DatePicker description\n */\n\nexport var DatePicker = styled(DatePickerBase, styles, undefined, {\n scope: 'DatePicker'\n});","var _a, _b, _c;\n\nimport { __assign, __spreadArrays } from \"tslib\";\nimport { IsFocusVisibleClassName } from '../../Utilities';\nimport { RectangleEdge } from '../../utilities/positioning';\nimport { FontWeights, HighContrastSelector, getGlobalClassNames, normalize, HighContrastSelectorWhite, getScreenSelector, ScreenWidthMinMedium, getHighContrastNoAdjustStyle } from '../../Styling';\nvar GlobalClassNames = {\n root: 'ms-Dropdown-container',\n label: 'ms-Dropdown-label',\n dropdown: 'ms-Dropdown',\n title: 'ms-Dropdown-title',\n caretDownWrapper: 'ms-Dropdown-caretDownWrapper',\n caretDown: 'ms-Dropdown-caretDown',\n callout: 'ms-Dropdown-callout',\n panel: 'ms-Dropdown-panel',\n dropdownItems: 'ms-Dropdown-items',\n dropdownItem: 'ms-Dropdown-item',\n dropdownDivider: 'ms-Dropdown-divider',\n dropdownOptionText: 'ms-Dropdown-optionText',\n dropdownItemHeader: 'ms-Dropdown-header',\n titleIsPlaceHolder: 'ms-Dropdown-titleIsPlaceHolder',\n titleHasError: 'ms-Dropdown-title--hasError'\n};\nvar DROPDOWN_HEIGHT = 32;\nvar DROPDOWN_ITEM_HEIGHT = 36;\nvar highContrastAdjustMixin = (_a = {}, _a[HighContrastSelector + \", \" + HighContrastSelectorWhite.replace('@media ', '')] = __assign({}, getHighContrastNoAdjustStyle()), _a);\nvar highContrastItemAndTitleStateMixin = {\n selectors: __assign((_b = {}, _b[HighContrastSelector] = {\n backgroundColor: 'Highlight',\n borderColor: 'Highlight',\n color: 'HighlightText'\n }, _b), highContrastAdjustMixin)\n};\nvar highContrastBorderState = {\n selectors: (_c = {}, _c[HighContrastSelector] = {\n borderColor: 'Highlight'\n }, _c)\n};\nvar MinimumScreenSelector = getScreenSelector(0, ScreenWidthMinMedium);\nexport var getStyles = function getStyles(props) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n\n var theme = props.theme,\n hasError = props.hasError,\n hasLabel = props.hasLabel,\n className = props.className,\n isOpen = props.isOpen,\n disabled = props.disabled,\n required = props.required,\n isRenderingPlaceholder = props.isRenderingPlaceholder,\n panelClassName = props.panelClassName,\n calloutClassName = props.calloutClassName,\n calloutRenderEdge = props.calloutRenderEdge;\n\n if (!theme) {\n throw new Error('theme is undefined or null in base Dropdown getStyles function.');\n }\n\n var globalClassnames = getGlobalClassNames(GlobalClassNames, theme);\n var palette = theme.palette,\n semanticColors = theme.semanticColors,\n effects = theme.effects,\n fonts = theme.fonts;\n var rootHoverFocusActiveSelectorNeutralDarkMixin = {\n color: semanticColors.menuItemTextHovered\n };\n var rootHoverFocusActiveSelectorNeutralPrimaryMixin = {\n color: semanticColors.menuItemText\n };\n var borderColorError = {\n borderColor: semanticColors.errorText\n };\n var dropdownItemStyle = [globalClassnames.dropdownItem, {\n backgroundColor: 'transparent',\n boxSizing: 'border-box',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n padding: '0 8px',\n width: '100%',\n minHeight: DROPDOWN_ITEM_HEIGHT,\n lineHeight: 20,\n height: 0,\n position: 'relative',\n border: '1px solid transparent',\n borderRadius: 0,\n wordWrap: 'break-word',\n overflowWrap: 'break-word',\n textAlign: 'left',\n '.ms-Button-flexContainer': {\n width: '100%'\n }\n }];\n var selectedItemBackgroundColor = semanticColors.menuItemBackgroundPressed;\n\n var itemSelectors = function itemSelectors(isSelected) {\n var _a;\n\n if (isSelected === void 0) {\n isSelected = false;\n }\n\n return {\n selectors: (_a = {\n '&:hover:focus': [{\n color: semanticColors.menuItemTextHovered,\n backgroundColor: !isSelected ? semanticColors.menuItemBackgroundHovered : selectedItemBackgroundColor\n }, highContrastItemAndTitleStateMixin],\n '&:focus': [{\n backgroundColor: !isSelected ? 'transparent' : selectedItemBackgroundColor\n }, highContrastItemAndTitleStateMixin],\n '&:active': [{\n color: semanticColors.menuItemTextHovered,\n backgroundColor: !isSelected ? semanticColors.menuBackground : semanticColors.menuItemBackgroundHovered\n }, highContrastItemAndTitleStateMixin]\n }, _a[\".\" + IsFocusVisibleClassName + \" &:focus:after\"] = {\n left: 0,\n top: 0,\n bottom: 0,\n right: 0\n }, _a[HighContrastSelector] = {\n border: 'none'\n }, _a)\n };\n };\n\n var dropdownItemSelected = __spreadArrays(dropdownItemStyle, [{\n backgroundColor: selectedItemBackgroundColor,\n color: semanticColors.menuItemTextHovered\n }, itemSelectors(true), highContrastItemAndTitleStateMixin]);\n\n var dropdownItemDisabled = __spreadArrays(dropdownItemStyle, [{\n color: semanticColors.disabledText,\n cursor: 'default',\n selectors: (_a = {}, _a[HighContrastSelector] = {\n color: 'GrayText',\n border: 'none'\n }, _a)\n }]);\n\n var titleOpenBorderRadius = calloutRenderEdge === RectangleEdge.bottom ? effects.roundedCorner2 + \" \" + effects.roundedCorner2 + \" 0 0\" : \"0 0 \" + effects.roundedCorner2 + \" \" + effects.roundedCorner2;\n var calloutOpenBorderRadius = calloutRenderEdge === RectangleEdge.bottom ? \"0 0 \" + effects.roundedCorner2 + \" \" + effects.roundedCorner2 : effects.roundedCorner2 + \" \" + effects.roundedCorner2 + \" 0 0\";\n return {\n root: [globalClassnames.root, className],\n label: globalClassnames.label,\n dropdown: [globalClassnames.dropdown, normalize, fonts.medium, {\n color: semanticColors.menuItemText,\n borderColor: semanticColors.focusBorder,\n position: 'relative',\n outline: 0,\n userSelect: 'none',\n selectors: (_b = {}, _b['&:hover .' + globalClassnames.title] = [!disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, {\n borderColor: isOpen ? palette.neutralSecondary : palette.neutralPrimary\n }, highContrastBorderState], _b['&:focus .' + globalClassnames.title] = [!disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, {\n selectors: (_c = {}, _c[HighContrastSelector] = {\n color: 'Highlight'\n }, _c)\n }], _b['&:focus:after'] = [{\n pointerEvents: 'none',\n content: \"''\",\n position: 'absolute',\n boxSizing: 'border-box',\n top: '0px',\n left: '0px',\n width: '100%',\n height: '100%',\n // see https://github.com/microsoft/fluentui/pull/9182 for semantic color disc\n border: !disabled ? \"2px solid \" + palette.themePrimary : 'none',\n borderRadius: '2px',\n selectors: (_d = {}, _d[HighContrastSelector] = {\n color: 'Highlight'\n }, _d)\n }], _b['&:active .' + globalClassnames.title] = [!disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, {\n borderColor: palette.themePrimary\n }, highContrastBorderState], _b['&:hover .' + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _b['&:focus .' + globalClassnames.caretDown] = [!disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, {\n selectors: (_e = {}, _e[HighContrastSelector] = {\n color: 'Highlight'\n }, _e)\n }], _b['&:active .' + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _b['&:hover .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _b['&:focus .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _b['&:active .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _b['&:hover .' + globalClassnames.titleHasError] = borderColorError, _b['&:active .' + globalClassnames.titleHasError] = borderColorError, _b)\n }, isOpen && 'is-open', disabled && 'is-disabled', required && 'is-required', required && !hasLabel && {\n selectors: (_f = {\n ':before': {\n content: \"'*'\",\n color: semanticColors.errorText,\n position: 'absolute',\n top: -5,\n right: -10\n }\n }, _f[HighContrastSelector] = {\n selectors: {\n ':after': {\n right: -14\n }\n }\n }, _f)\n }],\n title: [globalClassnames.title, normalize, {\n backgroundColor: semanticColors.inputBackground,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: semanticColors.inputBorder,\n borderRadius: isOpen ? titleOpenBorderRadius : effects.roundedCorner2,\n cursor: 'pointer',\n display: 'block',\n height: DROPDOWN_HEIGHT,\n lineHeight: DROPDOWN_HEIGHT - 2,\n padding: \"0 28px 0 8px\",\n position: 'relative',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis'\n }, isRenderingPlaceholder && [globalClassnames.titleIsPlaceHolder, {\n color: semanticColors.inputPlaceholderText\n }], hasError && [globalClassnames.titleHasError, borderColorError], disabled && {\n backgroundColor: semanticColors.disabledBackground,\n border: 'none',\n color: semanticColors.disabledText,\n cursor: 'default',\n selectors: (_g = {}, _g[HighContrastSelector] = __assign({\n border: '1px solid GrayText',\n color: 'GrayText',\n backgroundColor: 'Window'\n }, getHighContrastNoAdjustStyle()), _g)\n }],\n caretDownWrapper: [globalClassnames.caretDownWrapper, {\n position: 'absolute',\n top: 1,\n right: 8,\n height: DROPDOWN_HEIGHT,\n lineHeight: DROPDOWN_HEIGHT - 2\n }, !disabled && {\n cursor: 'pointer'\n }],\n caretDown: [globalClassnames.caretDown, {\n color: palette.neutralSecondary,\n fontSize: fonts.small.fontSize,\n pointerEvents: 'none'\n }, disabled && {\n color: semanticColors.disabledText,\n selectors: (_h = {}, _h[HighContrastSelector] = __assign({\n color: 'GrayText'\n }, getHighContrastNoAdjustStyle()), _h)\n }],\n errorMessage: __assign(__assign({\n color: semanticColors.errorText\n }, theme.fonts.small), {\n paddingTop: 5\n }),\n callout: [globalClassnames.callout, {\n boxShadow: effects.elevation8,\n borderRadius: calloutOpenBorderRadius,\n selectors: (_j = {}, _j['.ms-Callout-main'] = {\n borderRadius: calloutOpenBorderRadius\n }, _j)\n }, calloutClassName],\n dropdownItemsWrapper: {\n selectors: {\n '&:focus': {\n outline: 0\n }\n }\n },\n dropdownItems: [globalClassnames.dropdownItems, {\n display: 'block'\n }],\n dropdownItem: __spreadArrays(dropdownItemStyle, [itemSelectors()]),\n dropdownItemSelected: dropdownItemSelected,\n dropdownItemDisabled: dropdownItemDisabled,\n dropdownItemSelectedAndDisabled: [dropdownItemSelected, dropdownItemDisabled, {\n backgroundColor: 'transparent'\n }],\n dropdownItemHidden: __spreadArrays(dropdownItemStyle, [{\n display: 'none'\n }]),\n dropdownDivider: [globalClassnames.dropdownDivider, {\n height: 1,\n backgroundColor: semanticColors.bodyDivider\n }],\n dropdownOptionText: [globalClassnames.dropdownOptionText, {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n minWidth: 0,\n maxWidth: '100%',\n wordWrap: 'break-word',\n overflowWrap: 'break-word',\n margin: '1px'\n }],\n dropdownItemHeader: [globalClassnames.dropdownItemHeader, __assign(__assign({}, fonts.medium), {\n fontWeight: FontWeights.semibold,\n color: semanticColors.menuHeader,\n background: 'none',\n backgroundColor: 'transparent',\n border: 'none',\n height: DROPDOWN_ITEM_HEIGHT,\n lineHeight: DROPDOWN_ITEM_HEIGHT,\n cursor: 'default',\n padding: '0 8px',\n userSelect: 'none',\n textAlign: 'left',\n selectors: (_k = {}, _k[HighContrastSelector] = __assign({\n color: 'GrayText'\n }, getHighContrastNoAdjustStyle()), _k)\n })],\n subComponentStyles: {\n label: {\n root: {\n display: 'inline-block'\n }\n },\n multiSelectItem: {\n root: {\n padding: 0\n },\n label: {\n alignSelf: 'stretch',\n padding: '0 8px',\n width: '100%'\n }\n },\n panel: {\n root: [panelClassName],\n main: {\n selectors: (_l = {}, // In case of extra small screen sizes\n _l[MinimumScreenSelector] = {\n // panelWidth xs\n width: 272\n }, _l)\n },\n contentInner: {\n padding: '0 0 20px'\n }\n }\n }\n };\n};","import { __spreadArrays } from \"tslib\";\nimport { DropdownMenuItemType } from '../Dropdown.types';\n/**\n * A utility class to cache size and position in cache.\n *\n * Dropdown options has non-selectable display types. It is therefore not cheap to determine\n * the total number of actual selectable options as well as the position an option is in the\n * list of options - O(n) cost for each lookup.\n *\n * Given that we potentially have to make this determination on every single render pass, this\n * cache should provide a little bit of relief.\n */\n\nvar DropdownSizePosCache =\n/** @class */\nfunction () {\n function DropdownSizePosCache() {\n this._size = 0;\n }\n /**\n * Invalidates the cache and recalculate the size of selectable options.\n */\n\n\n DropdownSizePosCache.prototype.updateOptions = function (options) {\n var displayOnlyOptionsCache = [];\n var size = 0;\n\n for (var i = 0; i < options.length; i++) {\n if (options[i].itemType === DropdownMenuItemType.Divider || options[i].itemType === DropdownMenuItemType.Header) {\n displayOnlyOptionsCache.push(i);\n } else if (!options[i].hidden) {\n size++;\n }\n }\n\n this._size = size;\n this._displayOnlyOptionsCache = displayOnlyOptionsCache;\n this._cachedOptions = __spreadArrays(options);\n };\n\n Object.defineProperty(DropdownSizePosCache.prototype, \"optionSetSize\", {\n /**\n * The size of all the selectable options.\n */\n get: function get() {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DropdownSizePosCache.prototype, \"cachedOptions\", {\n /**\n * The chached options array.\n */\n get: function get() {\n return this._cachedOptions;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Returns the position of this option element relative to the full set of selectable option elements.\n * Note: the first selectable element is position 1 in the set.\n * @param index The raw index of the option element.\n */\n\n DropdownSizePosCache.prototype.positionInSet = function (index) {\n if (index === undefined) {\n return undefined;\n } // we could possibly memoize this too but this should be good enough, most of the time (the expectation is that\n // when you have a lot of options, the selectable options will heavily dominate over the non-selectable options.\n\n\n var offset = 0;\n\n while (index > this._displayOnlyOptionsCache[offset]) {\n offset++;\n }\n\n if (this._displayOnlyOptionsCache[offset] === index) {\n throw new Error(\"Unexpected: Option at index \" + index + \" is not a selectable element.\");\n }\n\n return index - offset + 1;\n };\n\n return DropdownSizePosCache;\n}();\n\nexport { DropdownSizePosCache };","import { __assign, __decorate, __extends, __spreadArrays } from \"tslib\";\nimport * as React from 'react';\nimport { KeyCodes, classNamesFunction, divProperties, findIndex, getDocument, getFirstFocusable, getId, getLastFocusable, getNativeProps, initializeComponentRef, isIOS, isMac, mergeAriaAttributeValues, safeRequestAnimationFrame, warn, warnDeprecations, warnMutuallyExclusive } from '../../Utilities';\nimport { Callout } from '../../Callout';\nimport { Checkbox } from '../../Checkbox';\nimport { CommandButton } from '../../Button';\nimport { DirectionalHint } from '../../common/DirectionalHint';\nimport { DropdownMenuItemType } from './Dropdown.types';\nimport { DropdownSizePosCache } from './utilities/DropdownSizePosCache';\nimport { FocusZone, FocusZoneDirection } from '../../FocusZone';\nimport { Icon } from '../../Icon';\nimport { Label } from '../../Label';\nimport { KeytipData } from '../../KeytipData';\nimport { Panel } from '../../Panel';\nimport { ResponsiveMode, withResponsiveMode } from '../../utilities/decorators/withResponsiveMode';\nimport { SelectableOptionMenuItemType, getAllSelectedOptions } from '../../utilities/selectableOption/index';\nvar COMPONENT_NAME = 'Dropdown';\nvar getClassNames = classNamesFunction();\n\nvar DropdownBase =\n/** @class */\nfunction (_super) {\n __extends(DropdownBase, _super);\n\n function DropdownBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._host = React.createRef();\n _this._focusZone = React.createRef();\n _this._dropDown = React.createRef();\n _this._scrollIdleDelay = 250\n /* ms */\n ;\n _this._sizePosCache = new DropdownSizePosCache();\n _this._requestAnimationFrame = safeRequestAnimationFrame(_this);\n\n _this._onChange = function (event, options, index, checked, multiSelect) {\n // eslint-disable-next-line deprecation/deprecation\n var _a = _this.props,\n onChange = _a.onChange,\n onChanged = _a.onChanged;\n\n if (onChange || onChanged) {\n // for single-select, option passed in will always be selected.\n // for multi-select, flip the checked value\n var changedOpt = multiSelect ? __assign(__assign({}, options[index]), {\n selected: !checked\n }) : options[index];\n onChange && onChange(__assign(__assign({}, event), {\n target: _this._dropDown.current\n }), changedOpt, index);\n onChanged && onChanged(changedOpt, index);\n }\n };\n /** Get either props.placeholder (new name) or props.placeHolder (old name) */\n\n\n _this._getPlaceholder = function () {\n // eslint-disable-next-line deprecation/deprecation\n return _this.props.placeholder || _this.props.placeHolder;\n };\n /** Get text in dropdown input as a string */\n\n\n _this._getTitle = function (items, _unused) {\n var _a = _this.props.multiSelectDelimiter,\n multiSelectDelimiter = _a === void 0 ? ', ' : _a;\n return items.map(function (i) {\n return i.text;\n }).join(multiSelectDelimiter);\n };\n /** Render text in dropdown input */\n\n\n _this._onRenderTitle = function (items) {\n return React.createElement(React.Fragment, null, _this._getTitle(items));\n };\n /** Render placeholder text in dropdown input */\n\n\n _this._onRenderPlaceholder = function (props) {\n if (!_this._getPlaceholder()) {\n return null;\n }\n\n return React.createElement(React.Fragment, null, _this._getPlaceholder());\n };\n /** Render Callout or Panel container and pass in list */\n\n\n _this._onRenderContainer = function (props) {\n var calloutProps = props.calloutProps,\n panelProps = props.panelProps;\n var _a = _this.props,\n responsiveMode = _a.responsiveMode,\n dropdownWidth = _a.dropdownWidth;\n var isSmall = responsiveMode <= ResponsiveMode.medium;\n var panelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.panel : undefined;\n var calloutWidth = undefined;\n var calloutMinWidth = undefined;\n\n if (dropdownWidth === 'auto') {\n calloutMinWidth = _this._dropDown.current ? _this._dropDown.current.clientWidth : 0;\n } else {\n calloutWidth = dropdownWidth || (_this._dropDown.current ? _this._dropDown.current.clientWidth : 0);\n }\n\n return isSmall ? React.createElement(Panel, __assign({\n isOpen: true,\n isLightDismiss: true,\n onDismiss: _this._onDismiss,\n hasCloseButton: false,\n styles: panelStyles\n }, panelProps), _this._renderFocusableList(props)) : React.createElement(Callout, __assign({\n isBeakVisible: false,\n gapSpace: 0,\n doNotLayer: false,\n directionalHintFixed: false,\n directionalHint: DirectionalHint.bottomLeftEdge,\n calloutWidth: calloutWidth,\n calloutMinWidth: calloutMinWidth\n }, calloutProps, {\n className: _this._classNames.callout,\n target: _this._dropDown.current,\n onDismiss: _this._onDismiss,\n onScroll: _this._onScroll,\n onPositioned: _this._onPositioned\n }), _this._renderFocusableList(props));\n };\n /** Render Caret Down Icon */\n\n\n _this._onRenderCaretDown = function (props) {\n return React.createElement(Icon, {\n className: _this._classNames.caretDown,\n iconName: \"ChevronDown\",\n \"aria-hidden\": true\n });\n };\n /** Render List of items */\n\n\n _this._onRenderList = function (props) {\n var _a = props.onRenderItem,\n onRenderItem = _a === void 0 ? _this._onRenderItem : _a;\n var queue = {\n items: []\n };\n var renderedList = [];\n\n var emptyQueue = function emptyQueue() {\n var newGroup = queue.id ? [React.createElement(\"div\", {\n role: \"group\",\n key: queue.id,\n \"aria-labelledby\": queue.id\n }, queue.items)] : queue.items;\n renderedList = __spreadArrays(renderedList, newGroup); // Flush items and id\n\n queue = {\n items: []\n };\n };\n\n var placeRenderedOptionIntoQueue = function placeRenderedOptionIntoQueue(item, index) {\n /*\n Case Header\n empty queue if it's not already empty\n ensure unique ID for header and set queue ID\n push header into queue\n Case Divider\n push divider into queue if not first item\n empty queue if not already empty\n Default\n push item into queue\n */\n switch (item.itemType) {\n case SelectableOptionMenuItemType.Header:\n queue.items.length > 0 && emptyQueue();\n var id = _this._id + item.key;\n queue.items.push(onRenderItem(__assign(__assign({\n id: id\n }, item), {\n index: index\n }), _this._onRenderItem));\n queue.id = id;\n break;\n\n case SelectableOptionMenuItemType.Divider:\n index > 0 && queue.items.push(onRenderItem(__assign(__assign({}, item), {\n index: index\n }), _this._onRenderItem));\n queue.items.length > 0 && emptyQueue();\n break;\n\n default:\n queue.items.push(onRenderItem(__assign(__assign({}, item), {\n index: index\n }), _this._onRenderItem));\n }\n }; // Place options into the queue. Queue will be emptied anytime a Header or Divider is encountered\n\n\n props.options.forEach(function (item, index) {\n placeRenderedOptionIntoQueue(item, index);\n }); // Push remaining items into all renderedList\n\n queue.items.length > 0 && emptyQueue();\n return React.createElement(React.Fragment, null, renderedList);\n };\n\n _this._onRenderItem = function (item) {\n switch (item.itemType) {\n case SelectableOptionMenuItemType.Divider:\n return _this._renderSeparator(item);\n\n case SelectableOptionMenuItemType.Header:\n return _this._renderHeader(item);\n\n default:\n return _this._renderOption(item);\n }\n };\n\n _this._renderOption = function (item) {\n var _a = _this.props.onRenderOption,\n onRenderOption = _a === void 0 ? _this._onRenderOption : _a;\n var _b = _this.state.selectedIndices,\n selectedIndices = _b === void 0 ? [] : _b;\n var isItemSelected = item.index !== undefined && selectedIndices ? selectedIndices.indexOf(item.index) > -1 : false; // select the right className based on the combination of selected/disabled\n\n var itemClassName = item.hidden // predicate: item hidden\n ? _this._classNames.dropdownItemHidden : isItemSelected && item.disabled === true // predicate: both selected and disabled\n ? _this._classNames.dropdownItemSelectedAndDisabled : isItemSelected // predicate: selected only\n ? _this._classNames.dropdownItemSelected : item.disabled === true // predicate: disabled only\n ? _this._classNames.dropdownItemDisabled : _this._classNames.dropdownItem;\n var _c = item.title,\n title = _c === void 0 ? item.text : _c;\n var multiSelectItemStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.multiSelectItem : undefined;\n return !_this.props.multiSelect ? React.createElement(CommandButton, {\n id: _this._listId + item.index,\n key: item.key,\n \"data-index\": item.index,\n \"data-is-focusable\": !item.disabled,\n disabled: item.disabled,\n className: itemClassName,\n onClick: _this._onItemClick(item),\n // eslint-disable-next-line react/jsx-no-bind\n onMouseEnter: _this._onItemMouseEnter.bind(_this, item),\n // eslint-disable-next-line react/jsx-no-bind\n onMouseLeave: _this._onMouseItemLeave.bind(_this, item),\n // eslint-disable-next-line react/jsx-no-bind\n onMouseMove: _this._onItemMouseMove.bind(_this, item),\n role: \"option\",\n \"aria-selected\": isItemSelected ? 'true' : 'false',\n ariaLabel: item.ariaLabel,\n title: title,\n \"aria-posinset\": _this._sizePosCache.positionInSet(item.index),\n \"aria-setsize\": _this._sizePosCache.optionSetSize\n }, onRenderOption(item, _this._onRenderOption)) : React.createElement(Checkbox, {\n id: _this._listId + item.index,\n key: item.key,\n disabled: item.disabled,\n onChange: _this._onItemClick(item),\n inputProps: __assign({\n 'aria-selected': isItemSelected,\n onMouseEnter: _this._onItemMouseEnter.bind(_this, item),\n onMouseLeave: _this._onMouseItemLeave.bind(_this, item),\n onMouseMove: _this._onItemMouseMove.bind(_this, item),\n role: 'option'\n }, {\n 'data-index': item.index,\n 'data-is-focusable': !item.disabled\n }),\n label: item.text,\n title: title,\n // eslint-disable-next-line react/jsx-no-bind\n onRenderLabel: _this._onRenderItemLabel.bind(_this, item),\n className: itemClassName,\n checked: isItemSelected,\n styles: multiSelectItemStyles,\n ariaPositionInSet: _this._sizePosCache.positionInSet(item.index),\n ariaSetSize: _this._sizePosCache.optionSetSize\n });\n };\n /** Render content of item (i.e. text/icon inside of button) */\n\n\n _this._onRenderOption = function (item) {\n return React.createElement(\"span\", {\n className: _this._classNames.dropdownOptionText\n }, item.text);\n };\n /** Render custom label for drop down item */\n\n\n _this._onRenderItemLabel = function (item) {\n var _a = _this.props.onRenderOption,\n onRenderOption = _a === void 0 ? _this._onRenderOption : _a;\n return onRenderOption(item, _this._onRenderOption);\n };\n\n _this._onPositioned = function (positions) {\n if (_this._focusZone.current) {\n // Focusing an element can trigger a reflow. Making this wait until there is an animation\n // frame can improve perf significantly.\n _this._requestAnimationFrame(function () {\n var selectedIndices = _this.state.selectedIndices;\n\n if (_this._focusZone.current) {\n if (selectedIndices && selectedIndices[0] && !_this.props.options[selectedIndices[0]].disabled) {\n var element = getDocument().getElementById(_this._id + \"-list\" + selectedIndices[0]);\n\n if (element) {\n _this._focusZone.current.focusElement(element);\n }\n } else {\n _this._focusZone.current.focus();\n }\n }\n });\n }\n\n if (!_this.state.calloutRenderEdge || _this.state.calloutRenderEdge !== positions.targetEdge) {\n _this.setState({\n calloutRenderEdge: positions.targetEdge\n });\n }\n };\n\n _this._onItemClick = function (item) {\n return function (event) {\n if (!item.disabled) {\n _this.setSelectedIndex(event, item.index);\n\n if (!_this.props.multiSelect) {\n // only close the callout when it's in single-select mode\n _this.setState({\n isOpen: false\n });\n }\n }\n };\n };\n /**\n * Scroll handler for the callout to make sure the mouse events\n * for updating focus are not interacting during scroll\n */\n\n\n _this._onScroll = function () {\n if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) {\n clearTimeout(_this._scrollIdleTimeoutId);\n _this._scrollIdleTimeoutId = undefined;\n } else {\n _this._isScrollIdle = false;\n }\n\n _this._scrollIdleTimeoutId = setTimeout(function () {\n _this._isScrollIdle = true;\n }, _this._scrollIdleDelay);\n };\n\n _this._onMouseItemLeave = function (item, ev) {\n if (_this._shouldIgnoreMouseEvent()) {\n return;\n }\n /**\n * IE11 focus() method forces parents to scroll to top of element.\n * Edge and IE expose a setActive() function for focusable divs that\n * sets the page focus but does not scroll the parent element.\n */\n\n\n if (_this._host.current) {\n if (_this._host.current.setActive) {\n try {\n _this._host.current.setActive();\n } catch (e) {\n /* no-op */\n }\n } else {\n _this._host.current.focus();\n }\n }\n };\n\n _this._onDismiss = function () {\n _this.setState({\n isOpen: false\n });\n };\n\n _this._onDropdownBlur = function (ev) {\n // If Dropdown disabled do not proceed with this logic.\n var disabled = _this._isDisabled();\n\n if (disabled) {\n return;\n } // hasFocus tracks whether the root element has focus so always update the state.\n\n\n _this.setState({\n hasFocus: false\n });\n\n if (_this.state.isOpen) {\n // Do not onBlur when the callout is opened\n return;\n }\n\n if (_this.props.onBlur) {\n _this.props.onBlur(ev);\n }\n };\n\n _this._onDropdownKeyDown = function (ev) {\n // If Dropdown disabled do not process any keyboard events.\n var disabled = _this._isDisabled();\n\n if (disabled) {\n return;\n } // Take note if we are processing an alt (option) or meta (command) keydown.\n // See comment in _shouldHandleKeyUp for reasoning.\n\n\n _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev);\n\n if (_this.props.onKeyDown) {\n _this.props.onKeyDown(ev);\n\n if (ev.defaultPrevented) {\n return;\n }\n }\n\n var newIndex;\n var selectedIndex = _this.state.selectedIndices.length ? _this.state.selectedIndices[0] : -1;\n var containsExpandCollapseModifier = ev.altKey || ev.metaKey;\n var isOpen = _this.state.isOpen;\n\n switch (ev.which) {\n case KeyCodes.enter:\n _this.setState({\n isOpen: !isOpen\n });\n\n break;\n\n case KeyCodes.escape:\n if (!isOpen) {\n return;\n }\n\n _this.setState({\n isOpen: false\n });\n\n break;\n\n case KeyCodes.up:\n if (containsExpandCollapseModifier) {\n if (isOpen) {\n _this.setState({\n isOpen: false\n });\n\n break;\n }\n\n return;\n }\n\n if (_this.props.multiSelect) {\n _this.setState({\n isOpen: true\n });\n } else if (!_this._isDisabled()) {\n newIndex = _this._moveIndex(ev, -1, selectedIndex - 1, selectedIndex);\n }\n\n break;\n\n case KeyCodes.down:\n if (containsExpandCollapseModifier) {\n ev.stopPropagation();\n ev.preventDefault();\n }\n\n if (containsExpandCollapseModifier && !isOpen || _this.props.multiSelect) {\n _this.setState({\n isOpen: true\n });\n } else if (!_this._isDisabled()) {\n newIndex = _this._moveIndex(ev, 1, selectedIndex + 1, selectedIndex);\n }\n\n break;\n\n case KeyCodes.home:\n if (!_this.props.multiSelect) {\n newIndex = _this._moveIndex(ev, 1, 0, selectedIndex);\n }\n\n break;\n\n case KeyCodes.end:\n if (!_this.props.multiSelect) {\n newIndex = _this._moveIndex(ev, -1, _this.props.options.length - 1, selectedIndex);\n }\n\n break;\n\n case KeyCodes.space:\n // event handled in _onDropdownKeyUp\n break;\n\n default:\n return;\n }\n\n if (newIndex !== selectedIndex) {\n ev.stopPropagation();\n ev.preventDefault();\n }\n };\n\n _this._onDropdownKeyUp = function (ev) {\n // If Dropdown disabled do not process any keyboard events.\n var disabled = _this._isDisabled();\n\n if (disabled) {\n return;\n }\n\n var shouldHandleKey = _this._shouldHandleKeyUp(ev);\n\n var isOpen = _this.state.isOpen;\n\n if (_this.props.onKeyUp) {\n _this.props.onKeyUp(ev);\n\n if (ev.defaultPrevented) {\n return;\n }\n }\n\n switch (ev.which) {\n case KeyCodes.space:\n _this.setState({\n isOpen: !isOpen\n });\n\n break;\n\n default:\n if (shouldHandleKey && isOpen) {\n _this.setState({\n isOpen: false\n });\n }\n\n return;\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n };\n\n _this._onZoneKeyDown = function (ev) {\n var elementToFocus; // Take note if we are processing an alt (option) or meta (command) keydown.\n // See comment in _shouldHandleKeyUp for reasoning.\n\n _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev);\n var containsExpandCollapseModifier = ev.altKey || ev.metaKey;\n\n switch (ev.which) {\n case KeyCodes.up:\n if (containsExpandCollapseModifier) {\n _this.setState({\n isOpen: false\n });\n } else {\n if (_this._host.current) {\n elementToFocus = getLastFocusable(_this._host.current, _this._host.current.lastChild, true);\n }\n }\n\n break;\n // All directional keystrokes should be canceled when the zone is rendered.\n // This avoids the body scroll from reacting and thus dismissing the dropdown.\n\n case KeyCodes.home:\n case KeyCodes.end:\n case KeyCodes.pageUp:\n case KeyCodes.pageDown:\n break;\n\n case KeyCodes.down:\n if (!containsExpandCollapseModifier && _this._host.current) {\n elementToFocus = getFirstFocusable(_this._host.current, _this._host.current.firstChild, true);\n }\n\n break;\n\n case KeyCodes.escape:\n _this.setState({\n isOpen: false\n });\n\n break;\n\n case KeyCodes.tab:\n _this.setState({\n isOpen: false\n });\n\n return;\n\n default:\n return;\n }\n\n if (elementToFocus) {\n elementToFocus.focus();\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n };\n\n _this._onZoneKeyUp = function (ev) {\n var shouldHandleKey = _this._shouldHandleKeyUp(ev);\n\n if (shouldHandleKey && _this.state.isOpen) {\n _this.setState({\n isOpen: false\n });\n\n ev.preventDefault();\n }\n };\n\n _this._onDropdownClick = function (ev) {\n if (_this.props.onClick) {\n _this.props.onClick(ev);\n\n if (ev.defaultPrevented) {\n return;\n }\n }\n\n var isOpen = _this.state.isOpen;\n\n var disabled = _this._isDisabled();\n\n if (!disabled && !_this._shouldOpenOnFocus()) {\n _this.setState({\n isOpen: !isOpen\n });\n }\n\n _this._isFocusedByClick = false; // reset\n };\n\n _this._onDropdownMouseDown = function () {\n _this._isFocusedByClick = true;\n };\n\n _this._onFocus = function (ev) {\n var disabled = _this._isDisabled();\n\n if (!disabled) {\n if (_this.props.onFocus) {\n _this.props.onFocus(ev);\n }\n\n var state = {\n hasFocus: true\n };\n\n if (_this._shouldOpenOnFocus()) {\n state.isOpen = true;\n }\n\n _this.setState(state);\n }\n };\n /**\n * Because the isDisabled prop is deprecated, we have had to repeat this logic all over the place.\n * This helper method avoids all the repetition.\n */\n\n\n _this._isDisabled = function () {\n var disabled = _this.props.disabled; // eslint-disable-next-line deprecation/deprecation\n\n var isDisabled = _this.props.isDisabled; // Remove this deprecation workaround at 1.0.0\n\n if (disabled === undefined) {\n disabled = isDisabled;\n }\n\n return disabled;\n };\n\n _this._onRenderLabel = function (props) {\n var label = props.label,\n required = props.required,\n disabled = props.disabled;\n var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : undefined;\n return label ? React.createElement(Label, {\n className: _this._classNames.label,\n id: _this._labelId,\n required: required,\n styles: labelStyles,\n disabled: disabled\n }, label) : null;\n };\n\n initializeComponentRef(_this);\n var multiSelect = props.multiSelect,\n selectedKey = props.selectedKey,\n selectedKeys = props.selectedKeys,\n defaultSelectedKey = props.defaultSelectedKey,\n defaultSelectedKeys = props.defaultSelectedKeys,\n options = props.options;\n\n if (process.env.NODE_ENV !== 'production') {\n warnDeprecations(COMPONENT_NAME, props, {\n isDisabled: 'disabled',\n onChanged: 'onChange',\n placeHolder: 'placeholder',\n onRenderPlaceHolder: 'onRenderPlaceholder'\n });\n warnMutuallyExclusive(COMPONENT_NAME, props, {\n defaultSelectedKey: 'selectedKey',\n defaultSelectedKeys: 'selectedKeys',\n selectedKeys: 'selectedKey'\n });\n\n if (multiSelect) {\n var warnMultiSelect = function warnMultiSelect(prop) {\n return warn(\"Dropdown property '\" + prop + \"' cannot be used when 'multiSelect' is true. Use '\" + prop + \"s' instead.\");\n };\n\n if (selectedKey !== undefined) {\n warnMultiSelect('selectedKey');\n }\n\n if (defaultSelectedKey !== undefined) {\n warnMultiSelect('defaultSelectedKey');\n }\n } else {\n var warnNotMultiSelect = function warnNotMultiSelect(prop) {\n return warn(\"Dropdown property '\" + prop + \"s' cannot be used when 'multiSelect' is false/unset. Use '\" + prop + \"' instead.\");\n };\n\n if (selectedKeys !== undefined) {\n warnNotMultiSelect('selectedKey');\n }\n\n if (defaultSelectedKeys !== undefined) {\n warnNotMultiSelect('defaultSelectedKey');\n }\n }\n }\n\n _this._id = props.id || getId('Dropdown');\n _this._labelId = _this._id + '-label';\n _this._listId = _this._id + '-list';\n _this._optionId = _this._id + '-option';\n _this._isScrollIdle = true;\n var selectedIndices;\n\n if (multiSelect) {\n selectedIndices = _this._getSelectedIndexes(options, defaultSelectedKeys !== undefined ? defaultSelectedKeys : selectedKeys);\n } else {\n selectedIndices = _this._getSelectedIndexes(options, defaultSelectedKey !== undefined ? defaultSelectedKey : selectedKey);\n }\n\n _this._sizePosCache.updateOptions(options);\n\n _this.state = {\n isOpen: false,\n selectedIndices: selectedIndices,\n hasFocus: false,\n calloutRenderEdge: undefined\n };\n return _this;\n }\n\n Object.defineProperty(DropdownBase.prototype, \"selectedOptions\", {\n /**\n * All selected options\n */\n get: function get() {\n var options = this.props.options;\n var selectedIndices = this.state.selectedIndices;\n return getAllSelectedOptions(options, selectedIndices);\n },\n enumerable: true,\n configurable: true\n });\n\n DropdownBase.prototype.componentWillUnmount = function () {\n clearTimeout(this._scrollIdleTimeoutId);\n };\n\n DropdownBase.prototype.UNSAFE_componentWillReceiveProps = function (newProps) {\n // In controlled component usage where selectedKey is provided, update the selectedIndex\n // state if the key or options change.\n var selectedKeyProp; // this does a shallow compare (assumes options are pure), for the purposes of determining whether\n // defaultSelectedKey/defaultSelectedKeys are respected.\n\n var didOptionsChange = newProps.options !== this.props.options;\n\n if (newProps.multiSelect) {\n if (didOptionsChange && newProps.defaultSelectedKeys !== undefined) {\n selectedKeyProp = 'defaultSelectedKeys';\n } else {\n selectedKeyProp = 'selectedKeys';\n }\n } else {\n if (didOptionsChange && newProps.defaultSelectedKey !== undefined) {\n selectedKeyProp = 'defaultSelectedKey';\n } else {\n selectedKeyProp = 'selectedKey';\n }\n }\n\n if (newProps[selectedKeyProp] !== undefined && (newProps[selectedKeyProp] !== this.props[selectedKeyProp] || didOptionsChange)) {\n this.setState({\n selectedIndices: this._getSelectedIndexes(newProps.options, newProps[selectedKeyProp])\n });\n }\n };\n\n DropdownBase.prototype.componentDidUpdate = function (prevProps, prevState) {\n if (prevState.isOpen === true && this.state.isOpen === false) {\n this._gotMouseMove = false;\n\n if (this.props.onDismiss) {\n this.props.onDismiss();\n }\n }\n };\n\n DropdownBase.prototype.render = function () {\n var _this = this;\n\n var _a, _b;\n\n var id = this._id;\n var props = this.props;\n var className = props.className,\n label = props.label,\n options = props.options,\n ariaLabel = props.ariaLabel,\n required = props.required,\n errorMessage = props.errorMessage,\n keytipProps = props.keytipProps,\n propStyles = props.styles,\n theme = props.theme,\n panelProps = props.panelProps,\n calloutProps = props.calloutProps,\n _c = props.onRenderTitle,\n onRenderTitle = _c === void 0 ? this._getTitle : _c,\n _d = props.onRenderContainer,\n onRenderContainer = _d === void 0 ? this._onRenderContainer : _d,\n _e = props.onRenderCaretDown,\n onRenderCaretDown = _e === void 0 ? this._onRenderCaretDown : _e,\n _f = props.onRenderLabel,\n onRenderLabel = _f === void 0 ? this._onRenderLabel : _f;\n var _g = this.state,\n isOpen = _g.isOpen,\n selectedIndices = _g.selectedIndices,\n calloutRenderEdge = _g.calloutRenderEdge; // eslint-disable-next-line deprecation/deprecation\n\n var onRenderPlaceholder = props.onRenderPlaceholder || props.onRenderPlaceHolder || this._getPlaceholder; // If our cached options are out of date update our cache\n\n if (options !== this._sizePosCache.cachedOptions) {\n this._sizePosCache.updateOptions(options);\n }\n\n var selectedOptions = getAllSelectedOptions(options, selectedIndices);\n var divProps = getNativeProps(props, divProperties);\n\n var disabled = this._isDisabled();\n\n var errorMessageId = id + '-errorMessage';\n var ariaActiveDescendant = disabled ? undefined : isOpen && selectedIndices.length === 1 && selectedIndices[0] >= 0 ? this._listId + selectedIndices[0] : undefined;\n this._classNames = getClassNames(propStyles, {\n theme: theme,\n className: className,\n hasError: !!(errorMessage && errorMessage.length > 0),\n hasLabel: !!label,\n isOpen: isOpen,\n required: required,\n disabled: disabled,\n isRenderingPlaceholder: !selectedOptions.length,\n panelClassName: (_a = panelProps) === null || _a === void 0 ? void 0 : _a.className,\n calloutClassName: (_b = calloutProps) === null || _b === void 0 ? void 0 : _b.className,\n calloutRenderEdge: calloutRenderEdge\n });\n var hasErrorMessage = !!errorMessage && errorMessage.length > 0;\n return React.createElement(\"div\", {\n className: this._classNames.root\n }, onRenderLabel(this.props, this._onRenderLabel), React.createElement(KeytipData, {\n keytipProps: keytipProps,\n disabled: disabled\n }, function (keytipAttributes) {\n return React.createElement(\"div\", __assign({}, keytipAttributes, {\n \"data-is-focusable\": !disabled,\n ref: _this._dropDown,\n id: id,\n tabIndex: disabled ? -1 : 0,\n role: \"combobox\",\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": isOpen ? 'true' : 'false',\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": label && !ariaLabel ? mergeAriaAttributeValues(_this._labelId, _this._optionId) : undefined,\n \"aria-describedby\": mergeAriaAttributeValues(keytipAttributes['aria-describedby'], hasErrorMessage ? _this._id + '-errorMessage' : undefined),\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-required\": required,\n \"aria-disabled\": disabled,\n \"aria-controls\": isOpen ? _this._listId : undefined\n }, divProps, {\n className: _this._classNames.dropdown,\n onBlur: _this._onDropdownBlur,\n onKeyDown: _this._onDropdownKeyDown,\n onKeyUp: _this._onDropdownKeyUp,\n onClick: _this._onDropdownClick,\n onMouseDown: _this._onDropdownMouseDown,\n onFocus: _this._onFocus\n }), React.createElement(\"span\", {\n id: _this._optionId,\n className: _this._classNames.title,\n \"aria-live\": \"polite\",\n \"aria-atomic\": true\n }, // If option is selected render title, otherwise render the placeholder text\n selectedOptions.length ? onRenderTitle(selectedOptions, _this._onRenderTitle) : onRenderPlaceholder(props, _this._onRenderPlaceholder)), React.createElement(\"span\", {\n className: _this._classNames.caretDownWrapper\n }, onRenderCaretDown(props, _this._onRenderCaretDown)));\n }), isOpen && onRenderContainer(__assign(__assign({}, props), {\n onDismiss: this._onDismiss\n }), this._onRenderContainer), hasErrorMessage && React.createElement(\"div\", {\n role: \"alert\",\n id: errorMessageId,\n className: this._classNames.errorMessage\n }, errorMessage));\n };\n\n DropdownBase.prototype.focus = function (shouldOpenOnFocus) {\n if (this._dropDown.current) {\n this._dropDown.current.focus();\n\n if (shouldOpenOnFocus) {\n this.setState({\n isOpen: true\n });\n }\n }\n };\n\n DropdownBase.prototype.setSelectedIndex = function (event, index) {\n var _this = this;\n\n var _a = this.props,\n options = _a.options,\n selectedKey = _a.selectedKey,\n selectedKeys = _a.selectedKeys,\n multiSelect = _a.multiSelect,\n notifyOnReselect = _a.notifyOnReselect;\n var _b = this.state.selectedIndices,\n selectedIndices = _b === void 0 ? [] : _b;\n var checked = selectedIndices ? selectedIndices.indexOf(index) > -1 : false;\n var newIndexes = [];\n index = Math.max(0, Math.min(options.length - 1, index)); // If this is a controlled component then no state change should take place.\n\n if (selectedKey !== undefined || selectedKeys !== undefined) {\n this._onChange(event, options, index, checked, multiSelect);\n\n return;\n }\n\n if (!multiSelect && !notifyOnReselect && index === selectedIndices[0]) {\n return;\n } else if (multiSelect) {\n newIndexes = selectedIndices ? this._copyArray(selectedIndices) : [];\n\n if (checked) {\n var position = newIndexes.indexOf(index);\n\n if (position > -1) {\n // unchecked the current one\n newIndexes.splice(position, 1);\n }\n } else {\n // add the new selected index into the existing one\n newIndexes.push(index);\n }\n } else {\n // Set the selected option if this is an uncontrolled component\n newIndexes = [index];\n }\n\n event.persist(); // Call onChange after state is updated\n\n this.setState({\n selectedIndices: newIndexes\n }, function () {\n _this._onChange(event, options, index, checked, multiSelect);\n });\n };\n\n DropdownBase.prototype._copyArray = function (array) {\n var newArray = [];\n\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\n var element = array_1[_i];\n newArray.push(element);\n }\n\n return newArray;\n };\n /**\n * Finds the next valid Dropdown option and sets the selected index to it.\n * @param stepValue - Value of how many items the function should traverse. Should be -1 or 1.\n * @param index - Index of where the search should start\n * @param selectedIndex - The selectedIndex Dropdown's state\n * @returns The next valid dropdown option's index\n */\n\n\n DropdownBase.prototype._moveIndex = function (event, stepValue, index, selectedIndex) {\n var options = this.props.options; // Return selectedIndex if nothing has changed or options is empty\n\n if (selectedIndex === index || options.length === 0) {\n return selectedIndex;\n } // If the user is pressing the up or down key we want to make\n // sure that the dropdown cycles through the options without\n // causing the screen to scroll. In _onDropdownKeyDown\n // at the very end is a check to see if newIndex !== selectedIndex.\n // If the index is less than 0 and we set it back to 0, then\n // newIndex will equal selectedIndex and not stop the action\n // of the key press happening and vice versa for indexes greater\n // than or equal to the options length.\n\n\n if (index >= options.length) {\n index = 0;\n } else if (index < 0) {\n index = options.length - 1;\n }\n\n var stepCounter = 0; // If current index is a header or divider, or disabled, increment by step\n\n while (options[index].itemType === DropdownMenuItemType.Header || options[index].itemType === DropdownMenuItemType.Divider || options[index].disabled) {\n // If stepCounter exceeds length of options, then return selectedIndex (-1)\n if (stepCounter >= options.length) {\n return selectedIndex;\n } // If index + stepValue is out of bounds, wrap around\n\n\n if (index + stepValue < 0) {\n index = options.length;\n } else if (index + stepValue >= options.length) {\n index = -1;\n }\n\n index = index + stepValue;\n stepCounter++;\n }\n\n this.setSelectedIndex(event, index);\n return index;\n };\n /** Wrap item list in a FocusZone */\n\n\n DropdownBase.prototype._renderFocusableList = function (props) {\n var _a = props.onRenderList,\n onRenderList = _a === void 0 ? this._onRenderList : _a,\n label = props.label,\n ariaLabel = props.ariaLabel,\n multiSelect = props.multiSelect;\n return React.createElement(\"div\", {\n className: this._classNames.dropdownItemsWrapper,\n onKeyDown: this._onZoneKeyDown,\n onKeyUp: this._onZoneKeyUp,\n ref: this._host,\n tabIndex: 0\n }, React.createElement(FocusZone, {\n ref: this._focusZone,\n direction: FocusZoneDirection.vertical,\n id: this._listId,\n className: this._classNames.dropdownItems,\n role: \"listbox\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": label && !ariaLabel ? this._labelId : undefined,\n \"aria-multiselectable\": multiSelect\n }, onRenderList(props, this._onRenderList)));\n };\n\n DropdownBase.prototype._renderSeparator = function (item) {\n var index = item.index,\n key = item.key;\n\n if (index > 0) {\n return React.createElement(\"div\", {\n role: \"separator\",\n key: key,\n className: this._classNames.dropdownDivider\n });\n }\n\n return null;\n };\n\n DropdownBase.prototype._renderHeader = function (item) {\n var _a = this.props.onRenderOption,\n onRenderOption = _a === void 0 ? this._onRenderOption : _a;\n var key = item.key,\n id = item.id;\n return React.createElement(\"div\", {\n id: id,\n key: key,\n className: this._classNames.dropdownItemHeader\n }, onRenderOption(item, this._onRenderOption));\n };\n\n DropdownBase.prototype._onItemMouseEnter = function (item, ev) {\n if (this._shouldIgnoreMouseEvent()) {\n return;\n }\n\n var targetElement = ev.currentTarget;\n targetElement.focus();\n };\n\n DropdownBase.prototype._onItemMouseMove = function (item, ev) {\n var targetElement = ev.currentTarget;\n this._gotMouseMove = true;\n\n if (!this._isScrollIdle || document.activeElement === targetElement) {\n return;\n }\n\n targetElement.focus();\n };\n\n DropdownBase.prototype._shouldIgnoreMouseEvent = function () {\n return !this._isScrollIdle || !this._gotMouseMove;\n };\n /** Get all selected indexes for multi-select mode */\n\n\n DropdownBase.prototype._getSelectedIndexes = function (options, selectedKey) {\n if (selectedKey === undefined) {\n if (this.props.multiSelect) {\n return this._getAllSelectedIndices(options);\n }\n\n var selectedIndex = this._getSelectedIndex(options, null);\n\n return selectedIndex !== -1 ? [selectedIndex] : [];\n } else if (!Array.isArray(selectedKey)) {\n var selectedIndex = this._getSelectedIndex(options, selectedKey);\n\n return selectedIndex !== -1 ? [selectedIndex] : [];\n }\n\n var selectedIndices = [];\n\n for (var _i = 0, selectedKey_1 = selectedKey; _i < selectedKey_1.length; _i++) {\n var key = selectedKey_1[_i];\n\n var selectedIndex = this._getSelectedIndex(options, key);\n\n selectedIndex !== -1 && selectedIndices.push(selectedIndex);\n }\n\n return selectedIndices;\n };\n\n DropdownBase.prototype._getAllSelectedIndices = function (options) {\n return options.map(function (option, index) {\n return option.selected ? index : -1;\n }).filter(function (index) {\n return index !== -1;\n });\n };\n\n DropdownBase.prototype._getSelectedIndex = function (options, selectedKey) {\n return findIndex(options, function (option) {\n // eslint-disable-next-line eqeqeq\n if (selectedKey != null) {\n return option.key === selectedKey;\n } else {\n // eslint-disable-next-line deprecation/deprecation\n return !!option.selected || !!option.isSelected;\n }\n });\n };\n /**\n * Returns true if the key for the event is alt (Mac option) or meta (Mac command).\n */\n\n\n DropdownBase.prototype._isAltOrMeta = function (ev) {\n return ev.which === KeyCodes.alt || ev.key === 'Meta';\n };\n /**\n * We close the menu on key up only if ALL of the following are true:\n * - Most recent key down was alt or meta (command)\n * - The alt/meta key down was NOT followed by some other key (such as down/up arrow to\n * expand/collapse the menu)\n * - We're not on a Mac (or iOS)\n *\n * This is because on Windows, pressing alt moves focus to the application menu bar or similar,\n * closing any open context menus. There is not a similar behavior on Macs.\n */\n\n\n DropdownBase.prototype._shouldHandleKeyUp = function (ev) {\n var keyPressIsAltOrMetaAlone = this._lastKeyDownWasAltOrMeta && this._isAltOrMeta(ev);\n\n this._lastKeyDownWasAltOrMeta = false;\n return !!keyPressIsAltOrMetaAlone && !(isMac() || isIOS());\n };\n /**\n * Returns true if dropdown should set to open on focus.\n * Otherwise, isOpen state should be toggled on click\n */\n\n\n DropdownBase.prototype._shouldOpenOnFocus = function () {\n var hasFocus = this.state.hasFocus;\n var openOnKeyboardFocus = this.props.openOnKeyboardFocus;\n return !this._isFocusedByClick && openOnKeyboardFocus === true && !hasFocus;\n };\n\n DropdownBase.defaultProps = {\n options: []\n };\n DropdownBase = __decorate([withResponsiveMode], DropdownBase);\n return DropdownBase;\n}(React.Component);\n\nexport { DropdownBase };","import { styled } from '../../Utilities';\nimport { DropdownBase } from './Dropdown.base';\nimport { getStyles } from './Dropdown.styles';\nexport var Dropdown = styled(DropdownBase, getStyles, undefined, {\n scope: 'Dropdown'\n});","/**\n * Enum to help identify which suggestions action button is selected.\n * {@docCategory Pickers}\n */\nexport var SuggestionActionType;\n\n(function (SuggestionActionType) {\n /** None of the actions is selected. */\n SuggestionActionType[SuggestionActionType[\"none\"] = 0] = \"none\";\n /** ForceResolve action is selected. */\n\n SuggestionActionType[SuggestionActionType[\"forceResolve\"] = 1] = \"forceResolve\";\n /** SearchMore action is selected. */\n\n SuggestionActionType[SuggestionActionType[\"searchMore\"] = 2] = \"searchMore\";\n})(SuggestionActionType || (SuggestionActionType = {}));","import { __assign } from \"tslib\";\nimport { getGlobalClassNames, HighContrastSelector, getHighContrastNoAdjustStyle } from '../../../Styling';\nimport { IsFocusVisibleClassName } from '../../../Utilities';\nexport var SuggestionsItemGlobalClassNames = {\n root: 'ms-Suggestions-item',\n itemButton: 'ms-Suggestions-itemButton',\n closeButton: 'ms-Suggestions-closeButton',\n isSuggested: 'is-suggested'\n};\nexport function getStyles(props) {\n var _a, _b, _c, _d, _e, _f;\n\n var className = props.className,\n theme = props.theme,\n suggested = props.suggested;\n var palette = theme.palette,\n semanticColors = theme.semanticColors;\n var classNames = getGlobalClassNames(SuggestionsItemGlobalClassNames, theme);\n return {\n root: [classNames.root, {\n display: 'flex',\n alignItems: 'stretch',\n boxSizing: 'border-box',\n width: '100%',\n position: 'relative',\n selectors: {\n '&:hover': {\n background: semanticColors.menuItemBackgroundHovered\n },\n '&:hover .ms-Suggestions-closeButton': {\n display: 'block'\n }\n }\n }, suggested && {\n selectors: (_a = {}, _a[\".\" + IsFocusVisibleClassName + \" &\"] = {\n selectors: (_b = {}, _b[\".\" + classNames.closeButton] = {\n display: 'block',\n background: semanticColors.menuItemBackgroundPressed\n }, _b)\n }, _a[':after'] = {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n left: 0,\n top: 0,\n bottom: 0,\n right: 0,\n border: \"1px solid \" + theme.semanticColors.focusBorder\n }, _a)\n }, className],\n itemButton: [classNames.itemButton, {\n width: '100%',\n padding: 0,\n border: 'none',\n height: '100%',\n // Force the item button to be collapsible so it can always shrink\n // to accommodate the close button as a peer in its flex container.\n minWidth: 0,\n // Require for IE11 to truncate the component.\n overflow: 'hidden',\n selectors: (_c = {}, _c[HighContrastSelector] = {\n color: 'WindowText',\n selectors: {\n ':hover': __assign({\n background: 'Highlight',\n color: 'HighlightText'\n }, getHighContrastNoAdjustStyle())\n }\n }, _c[':hover'] = {\n color: semanticColors.menuItemTextHovered\n }, _c)\n }, suggested && [classNames.isSuggested, {\n background: semanticColors.menuItemBackgroundPressed,\n selectors: (_d = {\n ':hover': {\n background: semanticColors.menuDivider\n }\n }, _d[HighContrastSelector] = __assign({\n background: 'Highlight',\n color: 'HighlightText'\n }, getHighContrastNoAdjustStyle()), _d)\n }]],\n closeButton: [classNames.closeButton, {\n display: 'none',\n color: palette.neutralSecondary,\n padding: '0 4px',\n height: 'auto',\n width: 32,\n selectors: (_e = {\n ':hover, :active': {\n background: palette.neutralTertiaryAlt,\n color: palette.neutralDark\n }\n }, _e[HighContrastSelector] = {\n color: 'WindowText'\n }, _e)\n }, suggested && (_f = {}, _f[\".\" + IsFocusVisibleClassName + \" &\"] = {\n selectors: {\n ':hover, :active': {\n background: palette.neutralTertiary\n }\n }\n }, _f.selectors = {\n ':hover, :active': {\n background: palette.neutralTertiary,\n color: palette.neutralPrimary\n }\n }, _f)]\n };\n}","/**\n * Validation state of the user's input.\n * {@docCategory Pickers}\n */\nexport var ValidationState;\n\n(function (ValidationState) {\n /** User input is valid. */\n ValidationState[ValidationState[\"valid\"] = 0] = \"valid\";\n /** User input could be valid or invalid, its state is not known yet. */\n\n ValidationState[ValidationState[\"warning\"] = 1] = \"warning\";\n /** User input is invalid. */\n\n ValidationState[ValidationState[\"invalid\"] = 2] = \"invalid\";\n})(ValidationState || (ValidationState = {}));","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { initializeComponentRef, KeyCodes, classNamesFunction, css, styled } from '../../../Utilities';\nimport { CommandButton } from '../../../Button';\nimport { Spinner } from '../../../Spinner';\nimport { Announced } from '../../../Announced';\nimport { SuggestionActionType } from './Suggestions.types';\nimport { SuggestionsItem } from './SuggestionsItem';\nimport { getStyles as suggestionsItemStyles } from './SuggestionsItem.styles';\nimport * as stylesImport from './Suggestions.scss';\nvar legacyStyles = stylesImport;\nvar getClassNames = classNamesFunction();\nvar StyledSuggestionsItem = styled(SuggestionsItem, suggestionsItemStyles, undefined, {\n scope: 'SuggestionItem'\n});\n/**\n * {@docCategory Pickers}\n */\n\nvar Suggestions =\n/** @class */\nfunction (_super) {\n __extends(Suggestions, _super);\n\n function Suggestions(suggestionsProps) {\n var _this = _super.call(this, suggestionsProps) || this;\n\n _this._forceResolveButton = React.createRef();\n _this._searchForMoreButton = React.createRef();\n _this._selectedElement = React.createRef();\n /**\n * Returns true if the event was handled, false otherwise\n */\n\n _this.tryHandleKeyDown = function (keyCode, currentSuggestionIndex) {\n var isEventHandled = false;\n var newSelectedActionType = null;\n var currentSelectedAction = _this.state.selectedActionType;\n var suggestionLength = _this.props.suggestions.length;\n\n if (keyCode === KeyCodes.down) {\n switch (currentSelectedAction) {\n case SuggestionActionType.forceResolve:\n if (suggestionLength > 0) {\n _this._refocusOnSuggestions(keyCode);\n\n newSelectedActionType = SuggestionActionType.none;\n } else if (_this._searchForMoreButton.current) {\n newSelectedActionType = SuggestionActionType.searchMore;\n } else {\n newSelectedActionType = SuggestionActionType.forceResolve;\n }\n\n break;\n\n case SuggestionActionType.searchMore:\n if (_this._forceResolveButton.current) {\n newSelectedActionType = SuggestionActionType.forceResolve;\n } else if (suggestionLength > 0) {\n _this._refocusOnSuggestions(keyCode);\n\n newSelectedActionType = SuggestionActionType.none;\n } else {\n newSelectedActionType = SuggestionActionType.searchMore;\n }\n\n break;\n\n case SuggestionActionType.none:\n if (currentSuggestionIndex === -1 && _this._forceResolveButton.current) {\n newSelectedActionType = SuggestionActionType.forceResolve;\n }\n\n break;\n }\n } else if (keyCode === KeyCodes.up) {\n switch (currentSelectedAction) {\n case SuggestionActionType.forceResolve:\n if (_this._searchForMoreButton.current) {\n newSelectedActionType = SuggestionActionType.searchMore;\n } else if (suggestionLength > 0) {\n _this._refocusOnSuggestions(keyCode);\n\n newSelectedActionType = SuggestionActionType.none;\n }\n\n break;\n\n case SuggestionActionType.searchMore:\n if (suggestionLength > 0) {\n _this._refocusOnSuggestions(keyCode);\n\n newSelectedActionType = SuggestionActionType.none;\n } else if (_this._forceResolveButton.current) {\n newSelectedActionType = SuggestionActionType.forceResolve;\n }\n\n break;\n\n case SuggestionActionType.none:\n if (currentSuggestionIndex === -1 && _this._searchForMoreButton.current) {\n newSelectedActionType = SuggestionActionType.searchMore;\n }\n\n break;\n }\n }\n\n if (newSelectedActionType !== null) {\n _this.setState({\n selectedActionType: newSelectedActionType\n });\n\n isEventHandled = true;\n }\n\n return isEventHandled;\n };\n\n _this._getAlertText = function () {\n var _a = _this.props,\n isLoading = _a.isLoading,\n isSearching = _a.isSearching,\n suggestions = _a.suggestions,\n suggestionsAvailableAlertText = _a.suggestionsAvailableAlertText,\n noResultsFoundText = _a.noResultsFoundText;\n\n if (!isLoading && !isSearching) {\n if (suggestions.length > 0) {\n return suggestionsAvailableAlertText || '';\n }\n\n if (noResultsFoundText) {\n return noResultsFoundText;\n }\n }\n\n return '';\n };\n\n _this._getMoreResults = function () {\n if (_this.props.onGetMoreResults) {\n _this.props.onGetMoreResults();\n }\n };\n\n _this._forceResolve = function () {\n if (_this.props.createGenericItem) {\n _this.props.createGenericItem();\n }\n };\n\n _this._shouldShowForceResolve = function () {\n return _this.props.showForceResolve ? _this.props.showForceResolve() : false;\n };\n\n _this._onClickTypedSuggestionsItem = function (item, index) {\n return function (ev) {\n _this.props.onSuggestionClick(ev, item, index);\n };\n };\n\n _this._refocusOnSuggestions = function (keyCode) {\n if (typeof _this.props.refocusSuggestions === 'function') {\n _this.props.refocusSuggestions(keyCode);\n }\n };\n\n _this._onRemoveTypedSuggestionsItem = function (item, index) {\n return function (ev) {\n var onSuggestionRemove = _this.props.onSuggestionRemove;\n onSuggestionRemove(ev, item, index);\n ev.stopPropagation();\n };\n };\n\n initializeComponentRef(_this);\n _this.state = {\n selectedActionType: SuggestionActionType.none\n };\n return _this;\n }\n\n Suggestions.prototype.componentDidMount = function () {\n this.scrollSelected();\n this.activeSelectedElement = this._selectedElement ? this._selectedElement.current : null;\n };\n\n Suggestions.prototype.componentDidUpdate = function () {\n // Only scroll to selected element if the selected element has changed. Otherwise do nothing.\n // This prevents some odd behavior where scrolling the active element out of view and clicking on a selected element\n // will trigger a focus event and not give the clicked element the click.\n if (this._selectedElement.current && this.activeSelectedElement !== this._selectedElement.current) {\n this.scrollSelected();\n this.activeSelectedElement = this._selectedElement.current;\n }\n };\n\n Suggestions.prototype.render = function () {\n var _a, _b;\n\n var _this = this;\n\n var _c = this.props,\n forceResolveText = _c.forceResolveText,\n mostRecentlyUsedHeaderText = _c.mostRecentlyUsedHeaderText,\n searchForMoreIcon = _c.searchForMoreIcon,\n searchForMoreText = _c.searchForMoreText,\n className = _c.className,\n moreSuggestionsAvailable = _c.moreSuggestionsAvailable,\n noResultsFoundText = _c.noResultsFoundText,\n suggestions = _c.suggestions,\n isLoading = _c.isLoading,\n isSearching = _c.isSearching,\n loadingText = _c.loadingText,\n onRenderNoResultFound = _c.onRenderNoResultFound,\n searchingText = _c.searchingText,\n isMostRecentlyUsedVisible = _c.isMostRecentlyUsedVisible,\n resultsMaximumNumber = _c.resultsMaximumNumber,\n resultsFooterFull = _c.resultsFooterFull,\n resultsFooter = _c.resultsFooter,\n _d = _c.isResultsFooterVisible,\n isResultsFooterVisible = _d === void 0 ? true : _d,\n suggestionsHeaderText = _c.suggestionsHeaderText,\n suggestionsClassName = _c.suggestionsClassName,\n theme = _c.theme,\n styles = _c.styles,\n suggestionsListId = _c.suggestionsListId; // TODO\n // Clean this up by leaving only the first part after removing support for SASS.\n // Currently we can not remove the SASS styles from Suggestions class because it\n // might be used by consumers separately from pickers extending from BasePicker\n // and have not used the new 'styles' prop. Because it's expecting a type parameter,\n // we can not use the 'styled' function without adding some helpers which can break\n // downstream consumers who did not use the new helpers.\n // We check for 'styles' prop which is going to be injected by the 'styled' HOC\n // in BasePicker when the typed Suggestions class is ready to be rendered. If the check\n // passes we can use the CSS-in-JS styles. If the check fails (ex: custom picker),\n // then we just use the old SASS styles instead.\n\n this._classNames = styles ? getClassNames(styles, {\n theme: theme,\n className: className,\n suggestionsClassName: suggestionsClassName,\n forceResolveButtonSelected: this.state.selectedActionType === SuggestionActionType.forceResolve,\n searchForMoreButtonSelected: this.state.selectedActionType === SuggestionActionType.searchMore\n }) : {\n root: css('ms-Suggestions', className, legacyStyles.root),\n title: css('ms-Suggestions-title', legacyStyles.suggestionsTitle),\n searchForMoreButton: css('ms-SearchMore-button', legacyStyles.actionButton, (_a = {}, _a['is-selected ' + legacyStyles.buttonSelected] = this.state.selectedActionType === SuggestionActionType.searchMore, _a)),\n forceResolveButton: css('ms-forceResolve-button', legacyStyles.actionButton, (_b = {}, _b['is-selected ' + legacyStyles.buttonSelected] = this.state.selectedActionType === SuggestionActionType.forceResolve, _b)),\n suggestionsAvailable: css('ms-Suggestions-suggestionsAvailable', legacyStyles.suggestionsAvailable),\n suggestionsContainer: css('ms-Suggestions-container', legacyStyles.suggestionsContainer, suggestionsClassName),\n noSuggestions: css('ms-Suggestions-none', legacyStyles.suggestionsNone)\n };\n var spinnerStyles = this._classNames.subComponentStyles ? this._classNames.subComponentStyles.spinner : undefined; // TODO: cleanup after refactor of pickers to composition pattern and remove SASS support.\n\n var spinnerClassNameOrStyles = styles ? {\n styles: spinnerStyles\n } : {\n className: css('ms-Suggestions-spinner', legacyStyles.suggestionsSpinner)\n };\n\n var noResults = function noResults() {\n return noResultsFoundText ? React.createElement(\"div\", {\n className: _this._classNames.noSuggestions\n }, noResultsFoundText) : null;\n }; // MostRecently Used text should supercede the header text if it's there and available.\n\n\n var headerText = suggestionsHeaderText;\n\n if (isMostRecentlyUsedVisible && mostRecentlyUsedHeaderText) {\n headerText = mostRecentlyUsedHeaderText;\n }\n\n var footerTitle = undefined;\n\n if (isResultsFooterVisible) {\n footerTitle = suggestions.length >= resultsMaximumNumber ? resultsFooterFull : resultsFooter;\n }\n\n var hasNoSuggestions = (!suggestions || !suggestions.length) && !isLoading;\n var divProps = hasNoSuggestions || isLoading ? {\n role: 'dialog',\n id: suggestionsListId\n } : {};\n var forceResolveId = this.state.selectedActionType === SuggestionActionType.forceResolve ? 'sug-selectedAction' : undefined;\n var searchForMoreId = this.state.selectedActionType === SuggestionActionType.searchMore ? 'sug-selectedAction' : undefined;\n return React.createElement(\"div\", __assign({\n className: this._classNames.root\n }, divProps), React.createElement(Announced, {\n message: this._getAlertText(),\n \"aria-live\": \"polite\"\n }), headerText ? React.createElement(\"div\", {\n className: this._classNames.title\n }, headerText) : null, forceResolveText && this._shouldShowForceResolve() && React.createElement(CommandButton, {\n componentRef: this._forceResolveButton,\n className: this._classNames.forceResolveButton,\n id: forceResolveId,\n onClick: this._forceResolve,\n \"data-automationid\": 'sug-forceResolve'\n }, forceResolveText), isLoading && React.createElement(Spinner, __assign({}, spinnerClassNameOrStyles, {\n label: loadingText\n })), hasNoSuggestions ? onRenderNoResultFound ? onRenderNoResultFound(undefined, noResults) : noResults() : this._renderSuggestions(), searchForMoreText && moreSuggestionsAvailable && React.createElement(CommandButton, {\n componentRef: this._searchForMoreButton,\n className: this._classNames.searchForMoreButton,\n iconProps: searchForMoreIcon || {\n iconName: 'Search'\n },\n id: searchForMoreId,\n onClick: this._getMoreResults,\n \"data-automationid\": 'sug-searchForMore'\n }, searchForMoreText), isSearching ? React.createElement(Spinner, __assign({}, spinnerClassNameOrStyles, {\n label: searchingText\n })) : null, footerTitle && !moreSuggestionsAvailable && !isMostRecentlyUsedVisible && !isSearching ? React.createElement(\"div\", {\n className: this._classNames.title\n }, footerTitle(this.props)) : null);\n };\n\n Suggestions.prototype.hasSuggestedAction = function () {\n return !!this._searchForMoreButton.current || !!this._forceResolveButton.current;\n };\n\n Suggestions.prototype.hasSuggestedActionSelected = function () {\n return this.state.selectedActionType !== SuggestionActionType.none;\n };\n\n Suggestions.prototype.executeSelectedAction = function () {\n switch (this.state.selectedActionType) {\n case SuggestionActionType.forceResolve:\n this._forceResolve();\n\n break;\n\n case SuggestionActionType.searchMore:\n this._getMoreResults();\n\n break;\n }\n };\n\n Suggestions.prototype.focusAboveSuggestions = function () {\n if (this._forceResolveButton.current) {\n this.setState({\n selectedActionType: SuggestionActionType.forceResolve\n });\n } else if (this._searchForMoreButton.current) {\n this.setState({\n selectedActionType: SuggestionActionType.searchMore\n });\n }\n };\n\n Suggestions.prototype.focusBelowSuggestions = function () {\n if (this._searchForMoreButton.current) {\n this.setState({\n selectedActionType: SuggestionActionType.searchMore\n });\n } else if (this._forceResolveButton.current) {\n this.setState({\n selectedActionType: SuggestionActionType.forceResolve\n });\n }\n };\n\n Suggestions.prototype.focusSearchForMoreButton = function () {\n if (this._searchForMoreButton.current) {\n this._searchForMoreButton.current.focus();\n }\n }; // TODO get the element to scroll into view properly regardless of direction.\n\n\n Suggestions.prototype.scrollSelected = function () {\n if (this._selectedElement.current && this._selectedElement.current.scrollIntoView !== undefined) {\n this._selectedElement.current.scrollIntoView(false);\n }\n };\n\n Suggestions.prototype._renderSuggestions = function () {\n var _this = this;\n\n var _a = this.props,\n isMostRecentlyUsedVisible = _a.isMostRecentlyUsedVisible,\n mostRecentlyUsedHeaderText = _a.mostRecentlyUsedHeaderText,\n onRenderSuggestion = _a.onRenderSuggestion,\n removeSuggestionAriaLabel = _a.removeSuggestionAriaLabel,\n suggestionsItemClassName = _a.suggestionsItemClassName,\n resultsMaximumNumber = _a.resultsMaximumNumber,\n showRemoveButtons = _a.showRemoveButtons,\n suggestionsContainerAriaLabel = _a.suggestionsContainerAriaLabel,\n suggestionsHeaderText = _a.suggestionsHeaderText,\n suggestionsListId = _a.suggestionsListId;\n var suggestions = this.props.suggestions;\n var StyledTypedSuggestionsItem = StyledSuggestionsItem;\n var selectedIndex = -1;\n suggestions.some(function (element, index) {\n if (element.selected) {\n selectedIndex = index;\n return true;\n }\n\n return false;\n });\n\n if (resultsMaximumNumber) {\n suggestions = selectedIndex >= resultsMaximumNumber ? suggestions.slice(selectedIndex - resultsMaximumNumber + 1, selectedIndex + 1) : suggestions.slice(0, resultsMaximumNumber);\n }\n\n if (suggestions.length === 0) {\n return null;\n } // MostRecently Used text should supercede the header text if it's there and available.\n\n\n var headerText = suggestionsHeaderText;\n\n if (isMostRecentlyUsedVisible && mostRecentlyUsedHeaderText) {\n headerText = mostRecentlyUsedHeaderText;\n }\n\n return React.createElement(\"div\", {\n className: this._classNames.suggestionsContainer,\n id: suggestionsListId,\n role: \"listbox\",\n \"aria-label\": suggestionsContainerAriaLabel || headerText\n }, suggestions.map(function (suggestion, index) {\n return React.createElement(\"div\", {\n ref: suggestion.selected ? _this._selectedElement : undefined,\n key: suggestion.item.key ? suggestion.item.key : index,\n role: \"presentation\"\n }, React.createElement(StyledTypedSuggestionsItem, {\n suggestionModel: suggestion,\n RenderSuggestion: onRenderSuggestion,\n onClick: _this._onClickTypedSuggestionsItem(suggestion.item, index),\n className: suggestionsItemClassName,\n showRemoveButton: showRemoveButtons,\n removeButtonAriaLabel: removeSuggestionAriaLabel,\n onRemoveItem: _this._onRemoveTypedSuggestionsItem(suggestion.item, index),\n id: 'sug-' + index\n }));\n }));\n };\n\n return Suggestions;\n}(React.Component);\n\nexport { Suggestions };","/**\n * {@docCategory Pickers}\n */\nvar SuggestionsController =\n/** @class */\nfunction () {\n function SuggestionsController() {\n var _this = this;\n\n this._isSuggestionModel = function (value) {\n return value.item !== undefined;\n };\n\n this._ensureSuggestionModel = function (suggestion) {\n if (_this._isSuggestionModel(suggestion)) {\n return suggestion;\n } else {\n return {\n item: suggestion,\n selected: false,\n ariaLabel: suggestion.name || suggestion.primaryText\n };\n }\n };\n\n this.suggestions = [];\n this.currentIndex = -1;\n }\n\n SuggestionsController.prototype.updateSuggestions = function (newSuggestions, selectedIndex) {\n if (newSuggestions && newSuggestions.length > 0) {\n this.suggestions = this.convertSuggestionsToSuggestionItems(newSuggestions);\n this.currentIndex = selectedIndex ? selectedIndex : 0;\n\n if (selectedIndex === -1) {\n this.currentSuggestion = undefined;\n } else if (selectedIndex !== undefined) {\n this.suggestions[selectedIndex].selected = true;\n this.currentSuggestion = this.suggestions[selectedIndex];\n }\n } else {\n this.suggestions = [];\n this.currentIndex = -1;\n this.currentSuggestion = undefined;\n }\n };\n /**\n * Increments the suggestion index and gets the next suggestion in the list.\n */\n\n\n SuggestionsController.prototype.nextSuggestion = function () {\n if (this.suggestions && this.suggestions.length) {\n if (this.currentIndex < this.suggestions.length - 1) {\n this.setSelectedSuggestion(this.currentIndex + 1);\n return true;\n } else if (this.currentIndex === this.suggestions.length - 1) {\n this.setSelectedSuggestion(0);\n return true;\n }\n }\n\n return false;\n };\n /**\n * Decrements the suggestion index and gets the previous suggestion in the list.\n */\n\n\n SuggestionsController.prototype.previousSuggestion = function () {\n if (this.suggestions && this.suggestions.length) {\n if (this.currentIndex > 0) {\n this.setSelectedSuggestion(this.currentIndex - 1);\n return true;\n } else if (this.currentIndex === 0) {\n this.setSelectedSuggestion(this.suggestions.length - 1);\n return true;\n }\n }\n\n return false;\n };\n\n SuggestionsController.prototype.getSuggestions = function () {\n return this.suggestions;\n };\n\n SuggestionsController.prototype.getCurrentItem = function () {\n return this.currentSuggestion;\n };\n\n SuggestionsController.prototype.getSuggestionAtIndex = function (index) {\n return this.suggestions[index];\n };\n\n SuggestionsController.prototype.hasSelectedSuggestion = function () {\n return this.currentSuggestion ? true : false;\n };\n\n SuggestionsController.prototype.removeSuggestion = function (index) {\n this.suggestions.splice(index, 1);\n };\n\n SuggestionsController.prototype.createGenericSuggestion = function (itemToConvert) {\n var itemToAdd = this.convertSuggestionsToSuggestionItems([itemToConvert])[0];\n this.currentSuggestion = itemToAdd;\n };\n\n SuggestionsController.prototype.convertSuggestionsToSuggestionItems = function (suggestions) {\n return Array.isArray(suggestions) ? suggestions.map(this._ensureSuggestionModel) : [];\n };\n\n SuggestionsController.prototype.deselectAllSuggestions = function () {\n if (this.currentIndex > -1) {\n this.suggestions[this.currentIndex].selected = false;\n this.currentIndex = -1;\n }\n };\n\n SuggestionsController.prototype.setSelectedSuggestion = function (index) {\n if (index > this.suggestions.length - 1 || index < 0) {\n this.currentIndex = 0;\n this.currentSuggestion.selected = false;\n this.currentSuggestion = this.suggestions[0];\n this.currentSuggestion.selected = true;\n } else {\n if (this.currentIndex > -1) {\n this.suggestions[this.currentIndex].selected = false;\n }\n\n this.suggestions[index].selected = true;\n this.currentIndex = index;\n this.currentSuggestion = this.suggestions[index];\n }\n };\n\n return SuggestionsController;\n}();\n\nexport { SuggestionsController };","import { __assign } from \"tslib\";\nimport { getGlobalClassNames, getHighContrastNoAdjustStyle, HighContrastSelector, hiddenContentStyle } from '../../../Styling';\nvar GlobalClassNames = {\n root: 'ms-Suggestions',\n suggestionsContainer: 'ms-Suggestions-container',\n title: 'ms-Suggestions-title',\n forceResolveButton: 'ms-forceResolve-button',\n searchForMoreButton: 'ms-SearchMore-button',\n spinner: 'ms-Suggestions-spinner',\n noSuggestions: 'ms-Suggestions-none',\n suggestionsAvailable: 'ms-Suggestions-suggestionsAvailable',\n isSelected: 'is-selected'\n};\nexport function getStyles(props) {\n var _a;\n\n var className = props.className,\n suggestionsClassName = props.suggestionsClassName,\n theme = props.theme,\n forceResolveButtonSelected = props.forceResolveButtonSelected,\n searchForMoreButtonSelected = props.searchForMoreButtonSelected;\n var palette = theme.palette,\n semanticColors = theme.semanticColors,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var actionButtonStyles = {\n backgroundColor: 'transparent',\n border: 0,\n cursor: 'pointer',\n margin: 0,\n paddingLeft: 8,\n position: 'relative',\n borderTop: \"1px solid \" + palette.neutralLight,\n height: 40,\n textAlign: 'left',\n width: '100%',\n fontSize: fonts.small.fontSize,\n selectors: {\n ':hover': {\n backgroundColor: semanticColors.menuItemBackgroundPressed,\n cursor: 'pointer'\n },\n ':focus, :active': {\n backgroundColor: palette.themeLight\n },\n '.ms-Button-icon': {\n fontSize: fonts.mediumPlus.fontSize,\n width: 25\n },\n '.ms-Button-label': {\n margin: '0 4px 0 9px'\n }\n }\n };\n var actionButtonSelectedStyles = {\n backgroundColor: palette.themeLight,\n selectors: (_a = {}, _a[HighContrastSelector] = __assign({\n backgroundColor: 'Highlight',\n borderColor: 'Highlight',\n color: 'HighlightText'\n }, getHighContrastNoAdjustStyle()), _a)\n };\n return {\n root: [classNames.root, {\n minWidth: 260\n }, className],\n suggestionsContainer: [classNames.suggestionsContainer, {\n overflowY: 'auto',\n overflowX: 'hidden',\n maxHeight: 300,\n transform: 'translate3d(0,0,0)'\n }, suggestionsClassName],\n title: [classNames.title, {\n padding: '0 12px',\n fontSize: fonts.small.fontSize,\n color: palette.themePrimary,\n lineHeight: 40,\n borderBottom: \"1px solid \" + semanticColors.menuItemBackgroundPressed\n }],\n forceResolveButton: [classNames.forceResolveButton, actionButtonStyles, forceResolveButtonSelected && [classNames.isSelected, actionButtonSelectedStyles]],\n searchForMoreButton: [classNames.searchForMoreButton, actionButtonStyles, searchForMoreButtonSelected && [classNames.isSelected, actionButtonSelectedStyles]],\n noSuggestions: [classNames.noSuggestions, {\n textAlign: 'center',\n color: palette.neutralSecondary,\n fontSize: fonts.small.fontSize,\n lineHeight: 30\n }],\n suggestionsAvailable: [classNames.suggestionsAvailable, hiddenContentStyle],\n subComponentStyles: {\n spinner: {\n root: [classNames.spinner, {\n margin: '5px 0',\n paddingLeft: 14,\n textAlign: 'left',\n whiteSpace: 'nowrap',\n lineHeight: 20,\n fontSize: fonts.small.fontSize\n }],\n circle: {\n display: 'inline-block',\n verticalAlign: 'middle'\n },\n label: {\n display: 'inline-block',\n verticalAlign: 'middle',\n margin: '0 10px 0 16px'\n }\n }\n }\n };\n}","/* eslint-disable */\nimport { loadStyles } from '@microsoft/load-themed-styles';\nloadStyles([{\n \"rawString\": \".pickerText_7f99953b{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid \"\n}, {\n \"theme\": \"neutralTertiary\",\n \"defaultValue\": \"#a19f9d\"\n}, {\n \"rawString\": \";min-width:180px;min-height:30px}.pickerText_7f99953b:hover{border-color:\"\n}, {\n \"theme\": \"inputBorderHovered\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \"}.pickerText_7f99953b.inputFocused_7f99953b{position:relative;border-color:\"\n}, {\n \"theme\": \"inputFocusBorderAlt\",\n \"defaultValue\": \"#0078d4\"\n}, {\n \"rawString\": \"}.pickerText_7f99953b.inputFocused_7f99953b:after{pointer-events:none;content:'';position:absolute;left:-1px;top:-1px;bottom:-1px;right:-1px;border:2px solid \"\n}, {\n \"theme\": \"inputFocusBorderAlt\",\n \"defaultValue\": \"#0078d4\"\n}, {\n \"rawString\": \"}@media screen and (-ms-high-contrast:active){.pickerText_7f99953b.inputDisabled_7f99953b{position:relative;border-color:GrayText}.pickerText_7f99953b.inputDisabled_7f99953b:after{pointer-events:none;content:'';position:absolute;left:0;top:0;bottom:0;right:0;background-color:Window}}.pickerInput_7f99953b{height:34px;border:none;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;outline:0;padding:0 6px 0;-ms-flex-item-align:end;align-self:flex-end}.pickerItems_7f99953b{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%}.screenReaderOnly_7f99953b{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}\"\n}]);\nexport var pickerText = \"pickerText_7f99953b\";\nexport var inputFocused = \"inputFocused_7f99953b\";\nexport var inputDisabled = \"inputDisabled_7f99953b\";\nexport var pickerInput = \"pickerInput_7f99953b\";\nexport var pickerItems = \"pickerItems_7f99953b\";\nexport var screenReaderOnly = \"screenReaderOnly_7f99953b\";","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { Async, KeyCodes, css, elementContains, getId, classNamesFunction, styled, initializeComponentRef } from '../../Utilities';\nimport { FocusZone, FocusZoneDirection } from '../../FocusZone';\nimport { Callout, DirectionalHint } from '../../Callout';\nimport { Selection, SelectionZone, SelectionMode } from '../../utilities/selection/index';\nimport { Suggestions } from './Suggestions/Suggestions';\nimport { getStyles as suggestionsStyles } from './Suggestions/Suggestions.styles';\nimport { SuggestionsController } from './Suggestions/SuggestionsController';\nimport { ValidationState } from './BasePicker.types';\nimport { Autofill } from '../Autofill/index';\nimport * as stylesImport from './BasePicker.scss';\nvar legacyStyles = stylesImport;\nvar getClassNames = classNamesFunction();\n/**\n * Should be removed once new picker without inheritance is created\n */\n\nfunction getStyledSuggestions(suggestionsType) {\n return styled(suggestionsType, suggestionsStyles, undefined, {\n scope: 'Suggestions'\n });\n}\n/**\n * {@docCategory Pickers}\n */\n\n\nvar BasePicker =\n/** @class */\nfunction (_super) {\n __extends(BasePicker, _super);\n\n function BasePicker(basePickerProps) {\n var _this = _super.call(this, basePickerProps) || this; // Refs\n\n\n _this.root = React.createRef();\n _this.input = React.createRef();\n _this.focusZone = React.createRef();\n _this.suggestionElement = React.createRef();\n /**\n * @deprecated this is no longer necessary as typescript now supports generic elements\n */\n\n _this.SuggestionOfProperType = Suggestions; // eslint-disable-next-line deprecation/deprecation\n\n _this._styledSuggestions = getStyledSuggestions(_this.SuggestionOfProperType);\n\n _this.dismissSuggestions = function (ev) {\n var selectItemFunction = function selectItemFunction() {\n var addItemOnDismiss = true;\n\n if (_this.props.onDismiss) {\n addItemOnDismiss = _this.props.onDismiss(ev, _this.suggestionStore.currentSuggestion ? _this.suggestionStore.currentSuggestion.item : undefined);\n }\n\n if (!ev || ev && !ev.defaultPrevented) {\n // Select the first suggestion if one is available and permitted by onDismiss when user leaves.\n if (addItemOnDismiss !== false && _this.canAddItems() && _this.suggestionStore.hasSelectedSuggestion() && _this.state.suggestedDisplayValue) {\n _this.addItemByIndex(0);\n }\n }\n };\n\n if (_this.currentPromise) {\n _this.currentPromise.then(function () {\n return selectItemFunction();\n });\n } else {\n selectItemFunction();\n }\n\n _this.setState({\n suggestionsVisible: false\n });\n };\n\n _this.refocusSuggestions = function (keyCode) {\n _this.resetFocus();\n\n if (_this.suggestionStore.suggestions && _this.suggestionStore.suggestions.length > 0) {\n if (keyCode === KeyCodes.up) {\n _this.suggestionStore.setSelectedSuggestion(_this.suggestionStore.suggestions.length - 1);\n } else if (keyCode === KeyCodes.down) {\n _this.suggestionStore.setSelectedSuggestion(0);\n }\n }\n };\n\n _this.onInputChange = function (value) {\n _this.updateValue(value);\n\n _this.setState({\n moreSuggestionsAvailable: true,\n isMostRecentlyUsedVisible: false\n });\n };\n\n _this.onSuggestionClick = function (ev, item, index) {\n _this.addItemByIndex(index);\n };\n\n _this.onSuggestionRemove = function (ev, item, index) {\n if (_this.props.onRemoveSuggestion) {\n _this.props.onRemoveSuggestion(item);\n }\n\n _this.suggestionStore.removeSuggestion(index);\n };\n\n _this.onInputFocus = function (ev) {\n _this.selection.setAllSelected(false); // Only trigger all of the focus if this component isn't already focused.\n // For example when an item is selected or removed from the selected list it should be treated\n // as though the input is still focused.\n\n\n if (!_this.state.isFocused) {\n _this.setState({\n isFocused: true\n });\n\n _this._userTriggeredSuggestions();\n\n if (_this.props.inputProps && _this.props.inputProps.onFocus) {\n _this.props.inputProps.onFocus(ev);\n }\n }\n };\n\n _this.onInputBlur = function (ev) {\n if (_this.props.inputProps && _this.props.inputProps.onBlur) {\n _this.props.inputProps.onBlur(ev);\n }\n };\n\n _this.onBlur = function (ev) {\n if (_this.state.isFocused) {\n // Only blur the entire component if an unrelated element gets focus.\n // Otherwise treat it as though it still has focus.\n // Do nothing if the blur is coming from something\n // inside the comboBox root or the comboBox menu since\n // it we are not really bluring from the whole comboBox\n var relatedTarget = ev.relatedTarget;\n\n if (ev.relatedTarget === null) {\n // In IE11, due to lack of support, event.relatedTarget is always\n // null making every onBlur call to be \"outside\" of the ComboBox\n // even when it's not. Using document.activeElement is another way\n // for us to be able to get what the relatedTarget without relying\n // on the event\n relatedTarget = document.activeElement;\n }\n\n if (relatedTarget && !elementContains(_this.root.current, relatedTarget)) {\n _this.setState({\n isFocused: false\n });\n\n if (_this.props.onBlur) {\n _this.props.onBlur(ev);\n }\n }\n }\n };\n /**\n * Reveals suggestions any time the user clicks on the input element\n * without shifting focus.\n */\n\n\n _this.onClick = function (ev) {\n if (_this.props.inputProps !== undefined && _this.props.inputProps.onClick !== undefined) {\n _this.props.inputProps.onClick(ev);\n } // Only primary (left) clicks show suggestions.\n\n\n if (ev.button === 0) {\n _this._userTriggeredSuggestions();\n }\n };\n\n _this.onKeyDown = function (ev) {\n var keyCode = ev.which;\n\n switch (keyCode) {\n case KeyCodes.escape:\n if (_this.state.suggestionsVisible) {\n _this.setState({\n suggestionsVisible: false\n });\n\n ev.preventDefault();\n ev.stopPropagation();\n }\n\n break;\n\n case KeyCodes.tab:\n case KeyCodes.enter:\n if (_this.suggestionElement.current && _this.suggestionElement.current.hasSuggestedActionSelected()) {\n _this.suggestionElement.current.executeSelectedAction();\n } else if (!ev.shiftKey && _this.suggestionStore.hasSelectedSuggestion() && _this.state.suggestionsVisible) {\n _this.completeSuggestion();\n\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n _this._completeGenericSuggestion();\n }\n\n break;\n\n case KeyCodes.backspace:\n if (!_this.props.disabled) {\n _this.onBackspace(ev);\n }\n\n ev.stopPropagation();\n break;\n\n case KeyCodes.del:\n if (!_this.props.disabled) {\n if (_this.input.current && ev.target === _this.input.current.inputElement && _this.state.suggestionsVisible && _this.suggestionStore.currentIndex !== -1) {\n if (_this.props.onRemoveSuggestion) {\n _this.props.onRemoveSuggestion(_this.suggestionStore.currentSuggestion.item);\n }\n\n _this.suggestionStore.removeSuggestion(_this.suggestionStore.currentIndex);\n\n _this.forceUpdate();\n } else {\n _this.onBackspace(ev);\n }\n }\n\n ev.stopPropagation();\n break;\n\n case KeyCodes.up:\n if (_this.input.current && ev.target === _this.input.current.inputElement && _this.state.suggestionsVisible) {\n if (_this.suggestionElement.current && _this.suggestionElement.current.tryHandleKeyDown(keyCode, _this.suggestionStore.currentIndex)) {\n ev.preventDefault();\n ev.stopPropagation();\n\n _this.forceUpdate();\n } else {\n if (_this.suggestionElement.current && _this.suggestionElement.current.hasSuggestedAction() && _this.suggestionStore.currentIndex === 0) {\n ev.preventDefault();\n ev.stopPropagation();\n\n _this.suggestionElement.current.focusAboveSuggestions();\n\n _this.suggestionStore.deselectAllSuggestions();\n\n _this.forceUpdate();\n } else {\n if (_this.suggestionStore.previousSuggestion()) {\n ev.preventDefault();\n ev.stopPropagation();\n\n _this.onSuggestionSelect();\n }\n }\n }\n }\n\n break;\n\n case KeyCodes.down:\n if (_this.input.current && ev.target === _this.input.current.inputElement && _this.state.suggestionsVisible) {\n if (_this.suggestionElement.current && _this.suggestionElement.current.tryHandleKeyDown(keyCode, _this.suggestionStore.currentIndex)) {\n ev.preventDefault();\n ev.stopPropagation();\n\n _this.forceUpdate();\n } else {\n if (_this.suggestionElement.current && _this.suggestionElement.current.hasSuggestedAction() && _this.suggestionStore.currentIndex + 1 === _this.suggestionStore.suggestions.length) {\n ev.preventDefault();\n ev.stopPropagation();\n\n _this.suggestionElement.current.focusBelowSuggestions();\n\n _this.suggestionStore.deselectAllSuggestions();\n\n _this.forceUpdate();\n } else {\n if (_this.suggestionStore.nextSuggestion()) {\n ev.preventDefault();\n ev.stopPropagation();\n\n _this.onSuggestionSelect();\n }\n }\n }\n }\n\n break;\n }\n };\n\n _this.onItemChange = function (changedItem, index) {\n var items = _this.state.items;\n\n if (index >= 0) {\n var newItems = items;\n newItems[index] = changedItem;\n\n _this._updateSelectedItems(newItems);\n }\n };\n\n _this.onGetMoreResults = function () {\n _this.setState({\n isSearching: true\n }, function () {\n if (_this.props.onGetMoreResults && _this.input.current) {\n var suggestions = _this.props.onGetMoreResults(_this.input.current.value, _this.state.items);\n\n var suggestionsArray = suggestions;\n var suggestionsPromiseLike = suggestions;\n\n if (Array.isArray(suggestionsArray)) {\n _this.updateSuggestions(suggestionsArray);\n\n _this.setState({\n isSearching: false\n });\n } else if (suggestionsPromiseLike.then) {\n suggestionsPromiseLike.then(function (newSuggestions) {\n _this.updateSuggestions(newSuggestions);\n\n _this.setState({\n isSearching: false\n });\n });\n }\n } else {\n _this.setState({\n isSearching: false\n });\n }\n\n if (_this.input.current) {\n _this.input.current.focus();\n }\n\n _this.setState({\n moreSuggestionsAvailable: false,\n isResultsFooterVisible: true\n });\n });\n };\n\n _this.completeSelection = function (item) {\n _this.addItem(item);\n\n _this.updateValue('');\n\n if (_this.input.current) {\n _this.input.current.clear();\n }\n\n _this.setState({\n suggestionsVisible: false\n });\n };\n\n _this.addItemByIndex = function (index) {\n _this.completeSelection(_this.suggestionStore.getSuggestionAtIndex(index).item);\n };\n\n _this.addItem = function (item) {\n var processedItem = _this.props.onItemSelected ? _this.props.onItemSelected(item) : item;\n\n if (processedItem === null) {\n return;\n }\n\n var processedItemObject = processedItem;\n var processedItemPromiseLike = processedItem;\n\n if (processedItemPromiseLike && processedItemPromiseLike.then) {\n processedItemPromiseLike.then(function (resolvedProcessedItem) {\n var newItems = _this.state.items.concat([resolvedProcessedItem]);\n\n _this._updateSelectedItems(newItems);\n });\n } else {\n var newItems = _this.state.items.concat([processedItemObject]);\n\n _this._updateSelectedItems(newItems);\n }\n\n _this.setState({\n suggestedDisplayValue: ''\n });\n };\n\n _this.removeItem = function (item, focusNextItem) {\n var items = _this.state.items;\n var index = items.indexOf(item);\n\n if (index >= 0) {\n var newItems = items.slice(0, index).concat(items.slice(index + 1));\n\n _this._updateSelectedItems(newItems);\n }\n };\n\n _this.removeItems = function (itemsToRemove) {\n var items = _this.state.items;\n var newItems = items.filter(function (item) {\n return itemsToRemove.indexOf(item) === -1;\n });\n\n _this._updateSelectedItems(newItems);\n };\n\n _this._shouldFocusZoneEnterInnerZone = function (ev) {\n // If suggestions are shown const up/down keys control them, otherwise allow them through to control the focusZone.\n if (_this.state.suggestionsVisible) {\n switch (ev.which) {\n case KeyCodes.up:\n case KeyCodes.down:\n return true;\n }\n }\n\n if (ev.which === KeyCodes.enter) {\n return true;\n }\n\n return false;\n };\n\n _this._onResolveSuggestions = function (updatedValue) {\n var suggestions = _this.props.onResolveSuggestions(updatedValue, _this.state.items);\n\n if (suggestions !== null) {\n _this.updateSuggestionsList(suggestions, updatedValue);\n }\n };\n\n _this._completeGenericSuggestion = function () {\n if (_this.props.onValidateInput && _this.input.current && _this.props.onValidateInput(_this.input.current.value) !== ValidationState.invalid && _this.props.createGenericItem) {\n var itemToConvert = _this.props.createGenericItem(_this.input.current.value, _this.props.onValidateInput(_this.input.current.value));\n\n _this.suggestionStore.createGenericSuggestion(itemToConvert);\n\n _this.completeSuggestion();\n }\n };\n /**\n * This should be called when the user does something other than use text entry to trigger suggestions.\n *\n */\n\n\n _this._userTriggeredSuggestions = function () {\n if (!_this.state.suggestionsVisible) {\n var input = _this.input.current ? _this.input.current.value : '';\n\n if (!input) {\n _this.onEmptyInputFocus();\n } else {\n if (_this.suggestionStore.suggestions.length === 0) {\n _this._onResolveSuggestions(input);\n } else {\n _this.setState({\n isMostRecentlyUsedVisible: false,\n suggestionsVisible: true\n });\n }\n }\n }\n };\n\n initializeComponentRef(_this);\n _this._async = new Async(_this);\n var items = basePickerProps.selectedItems || basePickerProps.defaultSelectedItems || [];\n _this._id = getId();\n _this._ariaMap = {\n selectedItems: \"selected-items-\" + _this._id,\n selectedSuggestionAlert: \"selected-suggestion-alert-\" + _this._id,\n suggestionList: \"suggestion-list-\" + _this._id,\n combobox: \"combobox-\" + _this._id\n };\n _this.suggestionStore = new SuggestionsController();\n _this.selection = new Selection({\n onSelectionChanged: function onSelectionChanged() {\n return _this.onSelectionChange();\n }\n });\n\n _this.selection.setItems(items);\n\n _this.state = {\n items: items,\n suggestedDisplayValue: '',\n isMostRecentlyUsedVisible: false,\n moreSuggestionsAvailable: false,\n isFocused: false,\n isSearching: false,\n selectedIndices: []\n };\n return _this;\n }\n\n BasePicker.getDerivedStateFromProps = function (newProps) {\n if (newProps.selectedItems) {\n return {\n items: newProps.selectedItems\n };\n }\n\n return null;\n };\n\n Object.defineProperty(BasePicker.prototype, \"items\", {\n get: function get() {\n return this.state.items;\n },\n enumerable: true,\n configurable: true\n });\n\n BasePicker.prototype.componentDidMount = function () {\n this.selection.setItems(this.state.items);\n this._onResolveSuggestions = this._async.debounce(this._onResolveSuggestions, this.props.resolveDelay);\n };\n\n BasePicker.prototype.componentDidUpdate = function (oldProps, oldState) {\n if (this.state.items && this.state.items !== oldState.items) {\n var currentSelectedIndex = this.selection.getSelectedIndices()[0];\n this.selection.setItems(this.state.items);\n\n if (this.state.isFocused) {\n // Reset focus and selection so that selected item stays in sync if something\n // has been removed\n if (this.state.items.length < oldState.items.length) {\n this.selection.setIndexSelected(currentSelectedIndex, true, true);\n this.resetFocus(currentSelectedIndex);\n }\n }\n }\n };\n\n BasePicker.prototype.componentWillUnmount = function () {\n if (this.currentPromise) {\n this.currentPromise = undefined;\n }\n\n this._async.dispose();\n };\n\n BasePicker.prototype.focus = function () {\n if (this.focusZone.current) {\n this.focusZone.current.focus();\n }\n };\n\n BasePicker.prototype.focusInput = function () {\n if (this.input.current) {\n this.input.current.focus();\n }\n };\n\n BasePicker.prototype.completeSuggestion = function (forceComplete) {\n if (this.suggestionStore.hasSelectedSuggestion() && this.input.current) {\n this.completeSelection(this.suggestionStore.currentSuggestion.item);\n } else if (forceComplete) {\n this._completeGenericSuggestion();\n }\n };\n\n BasePicker.prototype.render = function () {\n var _a, _b;\n\n var _c = this.state,\n suggestedDisplayValue = _c.suggestedDisplayValue,\n isFocused = _c.isFocused,\n items = _c.items;\n var _d = this.props,\n className = _d.className,\n inputProps = _d.inputProps,\n disabled = _d.disabled,\n theme = _d.theme,\n styles = _d.styles;\n var suggestionsAvailable = this.state.suggestionsVisible ? this._ariaMap.suggestionList : ''; // TODO\n // Clean this up by leaving only the first part after removing support for SASS.\n // Currently we can not remove the SASS styles from BasePicker class because it\n // might be used by consumers who created custom pickers from extending from\n // this base class and have not used the new 'styles' prop.\n // We check for 'styles' prop which is going to be injected by the 'styled' HOC\n // for every other already existing picker variant (PeoplePicker, TagPicker)\n // so that we can use the CSS-in-JS styles. If the check fails (ex: custom picker),\n // then we just use the old SASS styles instead.\n\n var classNames = styles ? getClassNames(styles, {\n theme: theme,\n className: className,\n isFocused: isFocused,\n disabled: disabled,\n inputClassName: inputProps && inputProps.className\n }) : {\n root: css('ms-BasePicker', className ? className : ''),\n text: css('ms-BasePicker-text', legacyStyles.pickerText, this.state.isFocused && legacyStyles.inputFocused),\n itemsWrapper: legacyStyles.pickerItems,\n input: css('ms-BasePicker-input', legacyStyles.pickerInput, inputProps && inputProps.className),\n screenReaderText: legacyStyles.screenReaderOnly\n };\n return React.createElement(\"div\", {\n ref: this.root,\n className: classNames.root,\n onKeyDown: this.onKeyDown,\n onBlur: this.onBlur\n }, React.createElement(FocusZone, {\n componentRef: this.focusZone,\n direction: FocusZoneDirection.bidirectional,\n shouldEnterInnerZone: this._shouldFocusZoneEnterInnerZone\n }, this.getSuggestionsAlert(classNames.screenReaderText), React.createElement(SelectionZone, {\n selection: this.selection,\n selectionMode: SelectionMode.multiple\n }, React.createElement(\"div\", {\n className: classNames.text\n }, items.length > 0 && React.createElement(\"span\", {\n id: this._ariaMap.selectedItems,\n className: classNames.itemsWrapper,\n role: 'list'\n }, this.renderItems()), this.canAddItems() && React.createElement(Autofill, __assign({\n spellCheck: false\n }, inputProps, {\n className: classNames.input,\n componentRef: this.input,\n id: ((_a = inputProps) === null || _a === void 0 ? void 0 : _a.id) ? inputProps.id : this._ariaMap.combobox,\n onClick: this.onClick,\n onFocus: this.onInputFocus,\n onBlur: this.onInputBlur,\n onInputValueChange: this.onInputChange,\n suggestedDisplayValue: suggestedDisplayValue,\n \"aria-activedescendant\": this.getActiveDescendant(),\n \"aria-controls\": suggestionsAvailable,\n \"aria-describedby\": items.length > 0 ? this._ariaMap.selectedItems : undefined,\n \"aria-expanded\": !!this.state.suggestionsVisible,\n \"aria-haspopup\": \"listbox\",\n \"aria-label\": this.props['aria-label'] || ((_b = inputProps) === null || _b === void 0 ? void 0 : _b['aria-label']),\n role: \"combobox\",\n disabled: disabled,\n onInputChange: this.props.onInputChange\n }))))), this.renderSuggestions());\n };\n\n BasePicker.prototype.canAddItems = function () {\n var items = this.state.items;\n var itemLimit = this.props.itemLimit;\n return itemLimit === undefined || items.length < itemLimit;\n };\n\n BasePicker.prototype.renderSuggestions = function () {\n var StyledTypedSuggestions = this._styledSuggestions;\n return this.state.suggestionsVisible && this.input ? React.createElement(Callout, __assign({\n isBeakVisible: false,\n gapSpace: 5,\n target: this.input.current ? this.input.current.inputElement : undefined,\n onDismiss: this.dismissSuggestions,\n directionalHint: DirectionalHint.bottomLeftEdge,\n directionalHintForRTL: DirectionalHint.bottomRightEdge\n }, this.props.pickerCalloutProps), React.createElement(StyledTypedSuggestions // Assumed to set in derived component's defaultProps\n , __assign({\n // Assumed to set in derived component's defaultProps\n onRenderSuggestion: this.props.onRenderSuggestionsItem,\n onSuggestionClick: this.onSuggestionClick,\n onSuggestionRemove: this.onSuggestionRemove,\n suggestions: this.suggestionStore.getSuggestions(),\n componentRef: this.suggestionElement,\n onGetMoreResults: this.onGetMoreResults,\n moreSuggestionsAvailable: this.state.moreSuggestionsAvailable,\n isLoading: this.state.suggestionsLoading,\n isSearching: this.state.isSearching,\n isMostRecentlyUsedVisible: this.state.isMostRecentlyUsedVisible,\n isResultsFooterVisible: this.state.isResultsFooterVisible,\n refocusSuggestions: this.refocusSuggestions,\n removeSuggestionAriaLabel: this.props.removeButtonAriaLabel,\n suggestionsListId: this._ariaMap.suggestionList,\n createGenericItem: this._completeGenericSuggestion\n }, this.props.pickerSuggestionsProps))) : null;\n };\n\n BasePicker.prototype.renderItems = function () {\n var _this = this;\n\n var _a = this.props,\n disabled = _a.disabled,\n removeButtonAriaLabel = _a.removeButtonAriaLabel;\n var onRenderItem = this.props.onRenderItem;\n var _b = this.state,\n items = _b.items,\n selectedIndices = _b.selectedIndices;\n return items.map(function (item, index) {\n return onRenderItem({\n item: item,\n index: index,\n key: item.key ? item.key : index,\n selected: selectedIndices.indexOf(index) !== -1,\n onRemoveItem: function onRemoveItem() {\n return _this.removeItem(item, true);\n },\n disabled: disabled,\n onItemChange: _this.onItemChange,\n removeButtonAriaLabel: removeButtonAriaLabel\n });\n });\n };\n\n BasePicker.prototype.resetFocus = function (index) {\n var items = this.state.items;\n\n if (items.length && index >= 0) {\n var newEl = this.root.current && this.root.current.querySelectorAll('[data-selection-index]')[Math.min(index, items.length - 1)];\n\n if (newEl && this.focusZone.current) {\n this.focusZone.current.focusElement(newEl);\n }\n } else if (!this.canAddItems()) {\n this.resetFocus(items.length - 1);\n } else {\n if (this.input.current) {\n this.input.current.focus();\n }\n }\n };\n\n BasePicker.prototype.onSuggestionSelect = function () {\n if (this.suggestionStore.currentSuggestion) {\n var currentValue = this.input.current ? this.input.current.value : '';\n\n var itemValue = this._getTextFromItem(this.suggestionStore.currentSuggestion.item, currentValue);\n\n this.setState({\n suggestedDisplayValue: itemValue\n });\n }\n };\n\n BasePicker.prototype.onSelectionChange = function () {\n this.setState({\n selectedIndices: this.selection.getSelectedIndices()\n });\n };\n\n BasePicker.prototype.updateSuggestions = function (suggestions) {\n this.suggestionStore.updateSuggestions(suggestions, 0);\n this.forceUpdate();\n };\n /**\n * Only to be called when there is nothing in the input. Checks to see if the consumer has\n * provided a function to resolve suggestions\n */\n\n\n BasePicker.prototype.onEmptyInputFocus = function () {\n var emptyResolveSuggestions = this.props.onEmptyResolveSuggestions ? this.props.onEmptyResolveSuggestions : // eslint-disable-next-line deprecation/deprecation\n this.props.onEmptyInputFocus; // Only attempt to resolve suggestions if it exists\n\n if (emptyResolveSuggestions) {\n var suggestions = emptyResolveSuggestions(this.state.items);\n this.updateSuggestionsList(suggestions);\n this.setState({\n isMostRecentlyUsedVisible: true,\n suggestionsVisible: true,\n moreSuggestionsAvailable: false\n });\n }\n };\n\n BasePicker.prototype.updateValue = function (updatedValue) {\n this._onResolveSuggestions(updatedValue);\n };\n\n BasePicker.prototype.updateSuggestionsList = function (suggestions, updatedValue) {\n var _this = this;\n\n var suggestionsArray = suggestions;\n var suggestionsPromiseLike = suggestions; // Check to see if the returned value is an array, if it is then just pass it into the next function .\n // If the returned value is not an array then check to see if it's a promise or PromiseLike.\n // If it is then resolve it asynchronously.\n\n if (Array.isArray(suggestionsArray)) {\n this._updateAndResolveValue(updatedValue, suggestionsArray);\n } else if (suggestionsPromiseLike && suggestionsPromiseLike.then) {\n this.setState({\n suggestionsLoading: true\n }); // Clear suggestions\n\n this.suggestionStore.updateSuggestions([]);\n\n if (updatedValue !== undefined) {\n this.setState({\n suggestionsVisible: this._getShowSuggestions()\n });\n } else {\n this.setState({\n suggestionsVisible: this.input.current && this.input.current.inputElement === document.activeElement\n });\n } // Ensure that the promise will only use the callback if it was the most recent one.\n\n\n var promise_1 = this.currentPromise = suggestionsPromiseLike;\n promise_1.then(function (newSuggestions) {\n if (promise_1 === _this.currentPromise) {\n _this._updateAndResolveValue(updatedValue, newSuggestions);\n }\n });\n }\n };\n\n BasePicker.prototype.resolveNewValue = function (updatedValue, suggestions) {\n var _this = this;\n\n this.updateSuggestions(suggestions);\n var itemValue = undefined;\n\n if (this.suggestionStore.currentSuggestion) {\n itemValue = this._getTextFromItem(this.suggestionStore.currentSuggestion.item, updatedValue);\n } // Only set suggestionloading to false after there has been time for the new suggestions to flow\n // to the suggestions list. This is to ensure that the suggestions are available before aria-activedescendant\n // is set so that screen readers will read out the first selected option.\n\n\n this.setState({\n suggestedDisplayValue: itemValue,\n suggestionsVisible: this._getShowSuggestions()\n }, function () {\n return _this.setState({\n suggestionsLoading: false\n });\n });\n };\n\n BasePicker.prototype.onChange = function (items) {\n if (this.props.onChange) {\n this.props.onChange(items);\n }\n }; // This is protected because we may expect the backspace key to work differently in a different kind of picker.\n // This lets the subclass override it and provide it's own onBackspace. For an example see the BasePickerListBelow\n\n\n BasePicker.prototype.onBackspace = function (ev) {\n if (this.state.items.length && !this.input.current || this.input.current && !this.input.current.isValueSelected && this.input.current.cursorLocation === 0) {\n if (this.selection.getSelectedCount() > 0) {\n this.removeItems(this.selection.getSelection());\n } else {\n this.removeItem(this.state.items[this.state.items.length - 1]);\n }\n }\n };\n\n BasePicker.prototype.getActiveDescendant = function () {\n if (this.state.suggestionsLoading) {\n return undefined;\n }\n\n var currentIndex = this.suggestionStore.currentIndex; // if the suggestions element has actions and the currentIndex does not point to a suggestion, return the action id\n\n if (currentIndex < 0 && this.suggestionElement.current && this.suggestionElement.current.hasSuggestedAction()) {\n return 'sug-selectedAction';\n }\n\n return currentIndex > -1 && !this.state.suggestionsLoading ? 'sug-' + currentIndex : undefined;\n };\n\n BasePicker.prototype.getSuggestionsAlert = function (suggestionAlertClassName) {\n if (suggestionAlertClassName === void 0) {\n suggestionAlertClassName = legacyStyles.screenReaderOnly;\n }\n\n var currentIndex = this.suggestionStore.currentIndex;\n\n if (this.props.enableSelectedSuggestionAlert) {\n var selectedSuggestion = currentIndex > -1 ? this.suggestionStore.getSuggestionAtIndex(this.suggestionStore.currentIndex) : undefined;\n var selectedSuggestionAlertText = selectedSuggestion ? selectedSuggestion.ariaLabel : undefined;\n return React.createElement(\"div\", {\n className: suggestionAlertClassName,\n role: \"alert\",\n id: this._ariaMap.selectedSuggestionAlert,\n \"aria-live\": \"assertive\"\n }, selectedSuggestionAlertText, ' ');\n }\n };\n /**\n * Takes in the current updated value and either resolves it with the new suggestions\n * or if updated value is undefined then it clears out currently suggested items\n */\n\n\n BasePicker.prototype._updateAndResolveValue = function (updatedValue, newSuggestions) {\n if (updatedValue !== undefined) {\n this.resolveNewValue(updatedValue, newSuggestions);\n } else {\n this.suggestionStore.updateSuggestions(newSuggestions, -1);\n\n if (this.state.suggestionsLoading) {\n this.setState({\n suggestionsLoading: false\n });\n }\n }\n };\n /**\n * Controls what happens whenever there is an action that impacts the selected items.\n * If `selectedItems` is provided, this will act as a controlled component and it will not update its own state.\n */\n\n\n BasePicker.prototype._updateSelectedItems = function (items) {\n var _this = this;\n\n if (this.props.selectedItems) {\n // If the component is a controlled component then the controlling component will need to add or remove the items.\n this.onChange(items);\n } else {\n this.setState({\n items: items\n }, function () {\n _this._onSelectedItemsUpdated(items);\n });\n }\n };\n\n BasePicker.prototype._onSelectedItemsUpdated = function (items) {\n this.onChange(items);\n };\n /**\n * Suggestions are normally shown after the user updates text and the text\n * is non-empty, but also when the user clicks on the input element.\n * @returns True if suggestions should be shown.\n */\n\n\n BasePicker.prototype._getShowSuggestions = function () {\n var areSuggestionsVisible = this.input.current !== undefined && this.input.current !== null && this.input.current.inputElement === document.activeElement && this.input.current.value !== '';\n return areSuggestionsVisible;\n };\n\n BasePicker.prototype._getTextFromItem = function (item, currentValue) {\n if (this.props.getTextFromItem) {\n return this.props.getTextFromItem(item, currentValue);\n } else {\n return '';\n }\n };\n\n return BasePicker;\n}(React.Component);\n\nexport { BasePicker };\n\nvar BasePickerListBelow =\n/** @class */\nfunction (_super) {\n __extends(BasePickerListBelow, _super);\n\n function BasePickerListBelow() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n BasePickerListBelow.prototype.render = function () {\n var _a = this.state,\n suggestedDisplayValue = _a.suggestedDisplayValue,\n isFocused = _a.isFocused;\n var _b = this.props,\n className = _b.className,\n inputProps = _b.inputProps,\n disabled = _b.disabled,\n theme = _b.theme,\n styles = _b.styles;\n var suggestionsAvailable = this.state.suggestionsVisible ? this._ariaMap.suggestionList : ''; // TODO\n // Clean this up by leaving only the first part after removing support for SASS.\n // Currently we can not remove the SASS styles from BasePicker class because it\n // might be used by consumers who created custom pickers from extending from\n // this base class and have not used the new 'styles' prop.\n // We check for 'styles' prop which is going to be injected by the 'styled' HOC\n // for every other already existing picker variant (PeoplePicker, TagPicker)\n // so that we can use the CSS-in-JS styles. If the check fails (ex: custom picker),\n // then we just use the old SASS styles instead.\n\n var classNames = styles ? getClassNames(styles, {\n theme: theme,\n className: className,\n isFocused: isFocused,\n inputClassName: inputProps && inputProps.className\n }) : {\n root: css('ms-BasePicker', className ? className : ''),\n text: css('ms-BasePicker-text', legacyStyles.pickerText, this.state.isFocused && legacyStyles.inputFocused, disabled && legacyStyles.inputDisabled),\n input: css('ms-BasePicker-input', legacyStyles.pickerInput, inputProps && inputProps.className),\n screenReaderText: legacyStyles.screenReaderOnly\n };\n return React.createElement(\"div\", {\n ref: this.root,\n onBlur: this.onBlur\n }, React.createElement(\"div\", {\n className: classNames.root,\n onKeyDown: this.onKeyDown\n }, this.getSuggestionsAlert(classNames.screenReaderText), React.createElement(\"div\", {\n className: classNames.text\n }, React.createElement(Autofill, __assign({}, inputProps, {\n className: classNames.input,\n componentRef: this.input,\n onFocus: this.onInputFocus,\n onBlur: this.onInputBlur,\n onClick: this.onClick,\n onInputValueChange: this.onInputChange,\n suggestedDisplayValue: suggestedDisplayValue,\n \"aria-activedescendant\": this.getActiveDescendant(),\n \"aria-controls\": suggestionsAvailable || undefined,\n \"aria-expanded\": !!this.state.suggestionsVisible,\n \"aria-haspopup\": \"listbox\",\n role: \"combobox\",\n disabled: disabled,\n onInputChange: this.props.onInputChange\n })))), this.renderSuggestions(), React.createElement(SelectionZone, {\n selection: this.selection,\n selectionMode: SelectionMode.single\n }, React.createElement(FocusZone, {\n componentRef: this.focusZone,\n className: \"ms-BasePicker-selectedItems\" // just a className hook without any styles applied to it.\n ,\n isCircularNavigation: true,\n direction: FocusZoneDirection.bidirectional,\n shouldEnterInnerZone: this._shouldFocusZoneEnterInnerZone,\n id: this._ariaMap.selectedItems,\n role: 'list'\n }, this.renderItems())));\n };\n\n BasePickerListBelow.prototype.onBackspace = function (ev) {// override the existing backspace method to not do anything because the list items appear below.\n };\n\n return BasePickerListBelow;\n}(BasePicker);\n\nexport { BasePickerListBelow };","import { __assign } from \"tslib\";\nimport { getGlobalClassNames, getFocusStyle, HighContrastSelector, getHighContrastNoAdjustStyle } from '../../../../Styling';\nimport { ButtonGlobalClassNames } from '../../../Button/BaseButton.classNames';\nvar GlobalClassNames = {\n root: 'ms-PickerPersona-container',\n itemContent: 'ms-PickerItem-content',\n removeButton: 'ms-PickerItem-removeButton',\n isSelected: 'is-selected',\n isInvalid: 'is-invalid'\n};\nvar REMOVE_BUTTON_SIZE = 24;\nexport function getStyles(props) {\n var _a, _b, _c, _d, _e, _f, _g;\n\n var className = props.className,\n theme = props.theme,\n selected = props.selected,\n invalid = props.invalid,\n disabled = props.disabled;\n var palette = theme.palette,\n semanticColors = theme.semanticColors,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var personaPrimaryTextStyles = [selected && !invalid && !disabled && {\n color: palette.white,\n selectors: (_a = {\n ':hover': {\n color: palette.white\n }\n }, _a[HighContrastSelector] = {\n color: 'HighlightText'\n }, _a)\n }, (invalid && !selected || invalid && selected && disabled) && {\n color: palette.redDark,\n borderBottom: \"2px dotted \" + palette.redDark,\n selectors: (_b = {}, _b[\".\" + classNames.root + \":hover &\"] = {\n // override Persona root:hover selector\n color: palette.redDark\n }, _b)\n }, invalid && selected && !disabled && {\n color: palette.white,\n borderBottom: \"2px dotted \" + palette.white\n }, disabled && {\n selectors: (_c = {}, _c[HighContrastSelector] = {\n color: 'GrayText'\n }, _c)\n }];\n var personaCoinInitialsStyles = [invalid && {\n fontSize: fonts.xLarge.fontSize\n }];\n return {\n root: [classNames.root, getFocusStyle(theme, {\n inset: -2\n }), {\n borderRadius: 15,\n display: 'inline-flex',\n alignItems: 'center',\n background: palette.neutralLighter,\n margin: '1px 2px',\n cursor: 'default',\n userSelect: 'none',\n maxWidth: 300,\n verticalAlign: 'middle',\n minWidth: 0,\n selectors: (_d = {\n ':hover': {\n background: !selected && !disabled ? palette.neutralLight : ''\n }\n }, _d[HighContrastSelector] = [{\n border: '1px solid WindowText'\n }, disabled && {\n borderColor: 'GrayText'\n }], _d)\n }, selected && !disabled && [classNames.isSelected, {\n background: palette.themePrimary,\n selectors: (_e = {}, _e[HighContrastSelector] = __assign({\n borderColor: 'HighLight',\n background: 'Highlight'\n }, getHighContrastNoAdjustStyle()), _e)\n }], invalid && [classNames.isInvalid], invalid && selected && !disabled && {\n background: palette.redDark\n }, className],\n itemContent: [classNames.itemContent, {\n flex: '0 1 auto',\n minWidth: 0,\n // CSS below is needed for IE 11 to properly truncate long persona names in the picker\n // and to clip the presence indicator (in all browsers)\n maxWidth: '100%',\n overflow: 'hidden'\n }],\n removeButton: [classNames.removeButton, {\n borderRadius: 15,\n color: palette.neutralPrimary,\n flex: '0 0 auto',\n width: REMOVE_BUTTON_SIZE,\n height: REMOVE_BUTTON_SIZE,\n selectors: {\n ':hover': {\n background: palette.neutralTertiaryAlt,\n color: palette.neutralDark\n }\n }\n }, selected && [{\n color: palette.white,\n selectors: (_f = {\n ':hover': {\n color: palette.white,\n background: palette.themeDark\n },\n ':active': {\n color: palette.white,\n background: palette.themeDarker\n }\n }, _f[HighContrastSelector] = {\n color: 'HighlightText'\n }, _f)\n }, invalid && {\n selectors: {\n ':hover': {\n background: palette.red\n },\n ':active': {\n background: palette.redDark\n }\n }\n }], disabled && {\n selectors: (_g = {}, _g[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: semanticColors.buttonText\n }, _g)\n }],\n subComponentStyles: {\n persona: {\n primaryText: personaPrimaryTextStyles\n },\n personaCoin: {\n initials: personaCoinInitialsStyles\n }\n }\n };\n}","import { __assign } from \"tslib\";\nimport * as React from 'react';\nimport { getId, classNamesFunction, styled } from '../../../../Utilities';\nimport { Persona, PersonaSize } from '../../../../Persona';\nimport { IconButton } from '../../../../Button';\nimport { ValidationState } from '../../BasePicker.types';\nimport { getStyles } from './PeoplePickerItem.styles';\nvar getClassNames = classNamesFunction();\nexport var PeoplePickerItemBase = function PeoplePickerItemBase(props) {\n var item = props.item,\n onRemoveItem = props.onRemoveItem,\n index = props.index,\n selected = props.selected,\n removeButtonAriaLabel = props.removeButtonAriaLabel,\n styles = props.styles,\n theme = props.theme,\n className = props.className,\n disabled = props.disabled;\n var itemId = getId();\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n selected: selected,\n disabled: disabled,\n invalid: item.ValidationState === ValidationState.warning\n });\n var personaStyles = classNames.subComponentStyles ? classNames.subComponentStyles.persona : undefined;\n var personaCoinStyles = classNames.subComponentStyles ? classNames.subComponentStyles.personaCoin : undefined;\n return React.createElement(\"div\", {\n className: classNames.root,\n \"data-is-focusable\": !disabled,\n \"data-is-sub-focuszone\": true,\n \"data-selection-index\": index,\n role: 'listitem',\n \"aria-labelledby\": 'selectedItemPersona-' + itemId\n }, React.createElement(\"div\", {\n className: classNames.itemContent,\n id: 'selectedItemPersona-' + itemId\n }, React.createElement(Persona, __assign({\n size: PersonaSize.size24,\n styles: personaStyles,\n coinProps: {\n styles: personaCoinStyles\n }\n }, item))), React.createElement(IconButton, {\n onClick: onRemoveItem,\n disabled: disabled,\n iconProps: {\n iconName: 'Cancel',\n styles: {\n root: {\n fontSize: '12px'\n }\n }\n },\n className: classNames.removeButton,\n ariaLabel: removeButtonAriaLabel\n }));\n};\nexport var PeoplePickerItem = styled(PeoplePickerItemBase, getStyles, undefined, {\n scope: 'PeoplePickerItem'\n});","import { getGlobalClassNames, HighContrastSelector } from '../../../../Styling';\nimport { SuggestionsItemGlobalClassNames as suggested } from '../../Suggestions/SuggestionsItem.styles';\nvar GlobalClassNames = {\n root: 'ms-PeoplePicker-personaContent',\n personaWrapper: 'ms-PeoplePicker-Persona'\n};\nexport function getStyles(props) {\n var _a, _b, _c;\n\n var className = props.className,\n theme = props.theme;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var textSelectorsStyles = {\n selectors: (_a = {}, _a[\".\" + suggested.isSuggested + \" &\"] = {\n selectors: (_b = {}, _b[HighContrastSelector] = {\n color: 'HighlightText'\n }, _b)\n }, _a[\".\" + classNames.root + \":hover &\"] = {\n selectors: (_c = {}, _c[HighContrastSelector] = {\n color: 'HighlightText'\n }, _c)\n }, _a)\n };\n return {\n root: [classNames.root, {\n width: '100%',\n padding: '4px 12px'\n }, className],\n personaWrapper: [classNames.personaWrapper, {\n width: 180\n }],\n subComponentStyles: {\n persona: {\n primaryText: textSelectorsStyles,\n secondaryText: textSelectorsStyles\n }\n }\n };\n}","import { __assign } from \"tslib\";\nimport * as React from 'react';\nimport { classNamesFunction, styled } from '../../../../Utilities';\nimport { Persona, PersonaSize } from '../../../../Persona';\nimport { getStyles } from './PeoplePickerItemSuggestion.styles';\nvar getClassNames = classNamesFunction();\nexport var PeoplePickerItemSuggestionBase = function PeoplePickerItemSuggestionBase(props) {\n var personaProps = props.personaProps,\n suggestionsProps = props.suggestionsProps,\n compact = props.compact,\n styles = props.styles,\n theme = props.theme,\n className = props.className;\n var classNames = getClassNames(styles, {\n theme: theme,\n className: suggestionsProps && suggestionsProps.suggestionsItemClassName || className\n });\n var personaStyles = classNames.subComponentStyles && classNames.subComponentStyles.persona ? classNames.subComponentStyles.persona : undefined;\n return React.createElement(\"div\", {\n className: classNames.root\n }, React.createElement(Persona, __assign({\n size: PersonaSize.size24,\n styles: personaStyles,\n className: classNames.personaWrapper,\n showSecondaryText: !compact\n }, personaProps)));\n};\nexport var PeoplePickerItemSuggestion = styled(PeoplePickerItemSuggestionBase, getStyles, undefined, {\n scope: 'PeoplePickerItemSuggestion'\n});","import { getGlobalClassNames, getInputFocusStyle, getPlaceholderStyles, hiddenContentStyle, HighContrastSelector } from '../../Styling';\nvar GlobalClassNames = {\n root: 'ms-BasePicker',\n text: 'ms-BasePicker-text',\n itemsWrapper: 'ms-BasePicker-itemsWrapper',\n input: 'ms-BasePicker-input'\n};\nexport function getStyles(props) {\n var _a, _b, _c;\n\n var className = props.className,\n theme = props.theme,\n isFocused = props.isFocused,\n inputClassName = props.inputClassName,\n disabled = props.disabled;\n\n if (!theme) {\n throw new Error('theme is undefined or null in base BasePicker getStyles function.');\n }\n\n var semanticColors = theme.semanticColors,\n effects = theme.effects,\n fonts = theme.fonts;\n var inputBorder = semanticColors.inputBorder,\n inputBorderHovered = semanticColors.inputBorderHovered,\n inputFocusBorderAlt = semanticColors.inputFocusBorderAlt;\n var classNames = getGlobalClassNames(GlobalClassNames, theme); // placeholder style constants\n\n var placeholderStyles = [fonts.medium, {\n color: semanticColors.inputPlaceholderText,\n opacity: 1,\n selectors: (_a = {}, _a[HighContrastSelector] = {\n color: 'GrayText'\n }, _a)\n }];\n var disabledPlaceholderStyles = {\n color: semanticColors.disabledText,\n selectors: (_b = {}, _b[HighContrastSelector] = {\n color: 'GrayText'\n }, _b)\n }; // The following lines are to create a semi-transparent color overlay for the disabled state with designer's approval.\n // @todo: investigate the performance cost of the calculation below and apply if negligible.\n // Replacing with a static color for now.\n // const rgbColor: IRGB | undefined = cssColor(palette.neutralQuaternaryAlt);\n // const disabledOverlayColor = rgbColor ? `rgba(${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}, 0.29)` : 'transparent';\n\n var disabledOverlayColor = 'rgba(218, 218, 218, 0.29)';\n return {\n root: [classNames.root, className],\n text: [classNames.text, {\n display: 'flex',\n position: 'relative',\n flexWrap: 'wrap',\n alignItems: 'center',\n boxSizing: 'border-box',\n minWidth: 180,\n minHeight: 30,\n border: \"1px solid \" + inputBorder,\n borderRadius: effects.roundedCorner2\n }, !isFocused && !disabled && {\n selectors: {\n ':hover': {\n borderColor: inputBorderHovered\n }\n }\n }, isFocused && !disabled && getInputFocusStyle(inputFocusBorderAlt, effects.roundedCorner2), disabled && {\n borderColor: disabledOverlayColor,\n selectors: (_c = {\n ':after': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n background: disabledOverlayColor\n }\n }, _c[HighContrastSelector] = {\n borderColor: 'GrayText',\n selectors: {\n ':after': {\n background: 'none'\n }\n }\n }, _c)\n }],\n itemsWrapper: [classNames.itemsWrapper, {\n display: 'flex',\n flexWrap: 'wrap',\n maxWidth: '100%'\n }],\n input: [classNames.input, fonts.medium, {\n height: 30,\n border: 'none',\n flexGrow: 1,\n outline: 'none',\n padding: '0 6px 0',\n alignSelf: 'flex-end',\n borderRadius: effects.roundedCorner2,\n backgroundColor: 'transparent',\n color: semanticColors.inputText,\n selectors: {\n '::-ms-clear': {\n display: 'none'\n }\n }\n }, getPlaceholderStyles(placeholderStyles), disabled && getPlaceholderStyles(disabledPlaceholderStyles), inputClassName],\n screenReaderText: hiddenContentStyle\n };\n}","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { getRTL, getInitials, styled } from '../../../Utilities';\nimport { BasePicker, BasePickerListBelow } from '../BasePicker';\nimport { ValidationState } from '../BasePicker.types';\nimport { PeoplePickerItem } from './PeoplePickerItems/PeoplePickerItem';\nimport { PeoplePickerItemSuggestion } from './PeoplePickerItems/PeoplePickerItemSuggestion';\nimport { getStyles } from '../BasePicker.styles';\n/**\n * {@docCategory PeoplePicker}\n */\n\nvar BasePeoplePicker =\n/** @class */\nfunction (_super) {\n __extends(BasePeoplePicker, _super);\n\n function BasePeoplePicker() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n return BasePeoplePicker;\n}(BasePicker);\n\nexport { BasePeoplePicker };\n/**\n * {@docCategory PeoplePicker}\n */\n\nvar MemberListPeoplePicker =\n/** @class */\nfunction (_super) {\n __extends(MemberListPeoplePicker, _super);\n\n function MemberListPeoplePicker() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n return MemberListPeoplePicker;\n}(BasePickerListBelow);\n\nexport { MemberListPeoplePicker };\n/**\n * Standard People Picker.\n * {@docCategory PeoplePicker}\n */\n\nvar NormalPeoplePickerBase =\n/** @class */\nfunction (_super) {\n __extends(NormalPeoplePickerBase, _super);\n\n function NormalPeoplePickerBase() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /** Default props for NormalPeoplePicker. */\n\n\n NormalPeoplePickerBase.defaultProps = {\n onRenderItem: function onRenderItem(props) {\n return React.createElement(PeoplePickerItem, __assign({}, props));\n },\n onRenderSuggestionsItem: function onRenderSuggestionsItem(personaProps, suggestionsProps) {\n return React.createElement(PeoplePickerItemSuggestion, {\n personaProps: personaProps,\n suggestionsProps: suggestionsProps\n });\n },\n createGenericItem: createGenericItem\n };\n return NormalPeoplePickerBase;\n}(BasePeoplePicker);\n\nexport { NormalPeoplePickerBase };\n/**\n * Compact layout. It uses personas without secondary text when displaying search results.\n * {@docCategory PeoplePicker}\n */\n\nvar CompactPeoplePickerBase =\n/** @class */\nfunction (_super) {\n __extends(CompactPeoplePickerBase, _super);\n\n function CompactPeoplePickerBase() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /** Default props for CompactPeoplePicker. */\n\n\n CompactPeoplePickerBase.defaultProps = {\n onRenderItem: function onRenderItem(props) {\n return React.createElement(PeoplePickerItem, __assign({}, props));\n },\n onRenderSuggestionsItem: function onRenderSuggestionsItem(personaProps, suggestionsProps) {\n return React.createElement(PeoplePickerItemSuggestion, {\n personaProps: personaProps,\n suggestionsProps: suggestionsProps,\n compact: true\n });\n },\n createGenericItem: createGenericItem\n };\n return CompactPeoplePickerBase;\n}(BasePeoplePicker);\n\nexport { CompactPeoplePickerBase };\n/**\n * MemberList layout. The selected people show up below the search box.\n * {@docCategory PeoplePicker}\n */\n\nvar ListPeoplePickerBase =\n/** @class */\nfunction (_super) {\n __extends(ListPeoplePickerBase, _super);\n\n function ListPeoplePickerBase() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /** Default props for ListPeoplePicker. */\n\n\n ListPeoplePickerBase.defaultProps = {\n onRenderItem: function onRenderItem(props) {\n return React.createElement(PeoplePickerItem, __assign({}, props));\n },\n onRenderSuggestionsItem: function onRenderSuggestionsItem(personaProps, suggestionsProps) {\n return React.createElement(PeoplePickerItemSuggestion, {\n personaProps: personaProps,\n suggestionsProps: suggestionsProps\n });\n },\n createGenericItem: createGenericItem\n };\n return ListPeoplePickerBase;\n}(MemberListPeoplePicker);\n\nexport { ListPeoplePickerBase };\n/**\n * {@docCategory PeoplePicker}\n */\n\nexport function createGenericItem(name, currentValidationState) {\n var personaToConvert = {\n key: name,\n primaryText: name,\n imageInitials: '!',\n ValidationState: currentValidationState\n };\n\n if (currentValidationState !== ValidationState.warning) {\n personaToConvert.imageInitials = getInitials(name, getRTL());\n }\n\n return personaToConvert;\n}\nexport var NormalPeoplePicker = styled(NormalPeoplePickerBase, getStyles, undefined, {\n scope: 'NormalPeoplePicker'\n});\nexport var CompactPeoplePicker = styled(CompactPeoplePickerBase, getStyles, undefined, {\n scope: 'CompactPeoplePicker'\n});\nexport var ListPeoplePicker = styled(ListPeoplePickerBase, getStyles, undefined, {\n scope: 'ListPeoplePickerBase'\n});","import { getGlobalClassNames, getFocusStyle, HighContrastSelector } from '../../../Styling';\nimport { ButtonGlobalClassNames } from '../../Button/BaseButton.classNames';\nimport { getRTL } from '../../../Utilities';\nvar GlobalClassNames = {\n root: 'ms-TagItem',\n text: 'ms-TagItem-text',\n close: 'ms-TagItem-close',\n isSelected: 'is-selected'\n};\nvar TAG_HEIGHT = 26;\nexport function getStyles(props) {\n var _a, _b, _c, _d;\n\n var className = props.className,\n theme = props.theme,\n selected = props.selected,\n disabled = props.disabled;\n var palette = theme.palette,\n effects = theme.effects,\n fonts = theme.fonts,\n semanticColors = theme.semanticColors;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n return {\n root: [classNames.root, fonts.medium, getFocusStyle(theme), {\n boxSizing: 'content-box',\n flexShrink: '1',\n margin: 2,\n height: TAG_HEIGHT,\n lineHeight: TAG_HEIGHT,\n cursor: 'default',\n userSelect: 'none',\n display: 'flex',\n flexWrap: 'nowrap',\n maxWidth: 300,\n minWidth: 0,\n borderRadius: effects.roundedCorner2,\n color: semanticColors.inputText,\n background: !selected || disabled ? palette.neutralLighter : palette.themePrimary,\n selectors: (_a = {\n ':hover': [!disabled && !selected && {\n color: palette.neutralDark,\n background: palette.neutralLight,\n selectors: {\n '.ms-TagItem-close': {\n color: palette.neutralPrimary\n }\n }\n }, disabled && {\n background: palette.neutralLighter\n }, selected && !disabled && {\n background: palette.themePrimary\n }]\n }, _a[HighContrastSelector] = {\n border: \"1px solid \" + (!selected ? 'WindowText' : 'WindowFrame')\n }, _a)\n }, disabled && {\n selectors: (_b = {}, _b[HighContrastSelector] = {\n borderColor: 'GrayText'\n }, _b)\n }, selected && !disabled && [classNames.isSelected, {\n color: palette.white\n }], className],\n text: [classNames.text, {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n minWidth: 30,\n margin: '0 8px'\n }, disabled && {\n selectors: (_c = {}, _c[HighContrastSelector] = {\n color: 'GrayText'\n }, _c)\n }],\n close: [classNames.close, {\n color: palette.neutralSecondary,\n width: 30,\n height: '100%',\n flex: '0 0 auto',\n borderRadius: getRTL(theme) ? effects.roundedCorner2 + \" 0 0 \" + effects.roundedCorner2 : \"0 \" + effects.roundedCorner2 + \" \" + effects.roundedCorner2 + \" 0\",\n selectors: {\n ':hover': {\n background: palette.neutralQuaternaryAlt,\n color: palette.neutralPrimary\n },\n ':active': {\n color: palette.white,\n backgroundColor: palette.themeDark\n }\n }\n }, selected && {\n color: palette.white,\n selectors: {\n ':hover': {\n color: palette.white,\n background: palette.themeDark\n }\n }\n }, disabled && {\n selectors: (_d = {}, _d[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: palette.neutralSecondary\n }, _d)\n }]\n };\n}","import * as React from 'react';\nimport { styled, classNamesFunction } from '../../../Utilities';\nimport { IconButton } from '../../../Button';\nimport { getStyles } from './TagItem.styles';\nvar getClassNames = classNamesFunction();\n/**\n * {@docCategory TagPicker}\n */\n\nexport var TagItemBase = function TagItemBase(props) {\n var theme = props.theme,\n styles = props.styles,\n selected = props.selected,\n disabled = props.disabled,\n enableTagFocusInDisabledPicker = props.enableTagFocusInDisabledPicker,\n children = props.children,\n className = props.className,\n index = props.index,\n onRemoveItem = props.onRemoveItem,\n removeButtonAriaLabel = props.removeButtonAriaLabel,\n _a = props.title,\n title = _a === void 0 ? typeof props.children === 'string' ? props.children : props.item.name : _a;\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n selected: selected,\n disabled: disabled\n });\n return React.createElement(\"div\", {\n className: classNames.root,\n role: 'listitem',\n key: index,\n \"data-selection-index\": index,\n \"data-is-focusable\": (enableTagFocusInDisabledPicker || !disabled) && true\n }, React.createElement(\"span\", {\n className: classNames.text,\n \"aria-label\": title,\n title: title\n }, children), React.createElement(IconButton, {\n onClick: onRemoveItem,\n disabled: disabled,\n iconProps: {\n iconName: 'Cancel',\n styles: {\n root: {\n fontSize: '12px'\n }\n }\n },\n className: classNames.close,\n ariaLabel: removeButtonAriaLabel\n }));\n};\nexport var TagItem = styled(TagItemBase, getStyles, undefined, {\n scope: 'TagItem'\n});","import { getGlobalClassNames } from '../../../Styling';\nvar GlobalClassNames = {\n suggestionTextOverflow: 'ms-TagItem-TextOverflow'\n};\nexport function getStyles(props) {\n var className = props.className,\n theme = props.theme;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n return {\n suggestionTextOverflow: [classNames.suggestionTextOverflow, {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '60vw',\n padding: '6px 12px 7px',\n whiteSpace: 'nowrap'\n }, className]\n };\n}","import * as React from 'react';\nimport { classNamesFunction, styled } from '../../../Utilities';\nimport { getStyles } from './TagItemSuggestion.styles';\nvar getClassNames = classNamesFunction();\n/**\n * {@docCategory TagPicker}\n */\n\nexport var TagItemSuggestionBase = function TagItemSuggestionBase(props) {\n var styles = props.styles,\n theme = props.theme,\n children = props.children;\n var classNames = getClassNames(styles, {\n theme: theme\n });\n return React.createElement(\"div\", {\n className: classNames.suggestionTextOverflow\n }, \" \", children, \" \");\n};\nexport var TagItemSuggestion = styled(TagItemSuggestionBase, getStyles, undefined, {\n scope: 'TagItemSuggestion'\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { styled, initializeComponentRef } from '../../../Utilities';\nimport { BasePicker } from '../BasePicker';\nimport { getStyles } from '../BasePicker.styles';\nimport { TagItem } from './TagItem';\nimport { TagItemSuggestion } from './TagItemSuggestion';\n/**\n * {@docCategory TagPicker}\n */\n\nvar TagPickerBase =\n/** @class */\nfunction (_super) {\n __extends(TagPickerBase, _super);\n\n function TagPickerBase(props) {\n var _this = _super.call(this, props) || this;\n\n initializeComponentRef(_this);\n return _this;\n }\n\n TagPickerBase.defaultProps = {\n onRenderItem: function onRenderItem(props) {\n return React.createElement(TagItem, __assign({}, props), props.item.name);\n },\n onRenderSuggestionsItem: function onRenderSuggestionsItem(props) {\n return React.createElement(TagItemSuggestion, null, props.name);\n }\n };\n return TagPickerBase;\n}(BasePicker);\n\nexport { TagPickerBase };\nexport var TagPicker = styled(TagPickerBase, getStyles, undefined, {\n scope: 'TagPicker'\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { classNamesFunction, getId } from '../../Utilities';\nvar getClassNames = classNamesFunction(); // if the percentComplete is near 0, don't animate it.\n// This prevents animations on reset to 0 scenarios\n\nvar ZERO_THRESHOLD = 0.01;\n/**\n * ProgressIndicator with no default styles.\n * [Use the `styles` API to add your own styles.](https://github.com/microsoft/fluentui/wiki/Styling)\n */\n\nvar ProgressIndicatorBase =\n/** @class */\nfunction (_super) {\n __extends(ProgressIndicatorBase, _super);\n\n function ProgressIndicatorBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._onRenderProgress = function (props) {\n // eslint-disable-next-line deprecation/deprecation\n var _a = _this.props,\n ariaValueText = _a.ariaValueText,\n barHeight = _a.barHeight,\n className = _a.className,\n description = _a.description,\n _b = _a.label,\n label = _b === void 0 ? _this.props.title : _b,\n styles = _a.styles,\n theme = _a.theme;\n var percentComplete = typeof _this.props.percentComplete === 'number' ? Math.min(100, Math.max(0, _this.props.percentComplete * 100)) : undefined;\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n barHeight: barHeight,\n indeterminate: percentComplete === undefined ? true : false\n });\n var progressBarStyles = {\n width: percentComplete !== undefined ? percentComplete + '%' : undefined,\n transition: percentComplete !== undefined && percentComplete < ZERO_THRESHOLD ? 'none' : undefined\n };\n var ariaValueMin = percentComplete !== undefined ? 0 : undefined;\n var ariaValueMax = percentComplete !== undefined ? 100 : undefined;\n var ariaValueNow = percentComplete !== undefined ? Math.floor(percentComplete) : undefined;\n return React.createElement(\"div\", {\n className: classNames.itemProgress\n }, React.createElement(\"div\", {\n className: classNames.progressTrack\n }), React.createElement(\"div\", {\n className: classNames.progressBar,\n style: progressBarStyles,\n role: \"progressbar\",\n \"aria-describedby\": description ? _this._descriptionId : undefined,\n \"aria-labelledby\": label ? _this._labelId : undefined,\n \"aria-valuemin\": ariaValueMin,\n \"aria-valuemax\": ariaValueMax,\n \"aria-valuenow\": ariaValueNow,\n \"aria-valuetext\": ariaValueText\n }));\n };\n\n var id = getId('progress-indicator');\n _this._labelId = id + '-label';\n _this._descriptionId = id + '-description';\n return _this;\n }\n\n ProgressIndicatorBase.prototype.render = function () {\n var _a = this.props,\n barHeight = _a.barHeight,\n className = _a.className,\n // eslint-disable-next-line deprecation/deprecation\n _b = _a.label,\n // eslint-disable-next-line deprecation/deprecation\n label = _b === void 0 ? this.props.title : _b,\n // Fall back to deprecated value.\n description = _a.description,\n styles = _a.styles,\n theme = _a.theme,\n progressHidden = _a.progressHidden,\n _c = _a.onRenderProgress,\n onRenderProgress = _c === void 0 ? this._onRenderProgress : _c;\n var percentComplete = typeof this.props.percentComplete === 'number' ? Math.min(100, Math.max(0, this.props.percentComplete * 100)) : undefined;\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n barHeight: barHeight,\n indeterminate: percentComplete === undefined ? true : false\n });\n return React.createElement(\"div\", {\n className: classNames.root\n }, label ? React.createElement(\"div\", {\n id: this._labelId,\n className: classNames.itemName\n }, label) : null, !progressHidden ? onRenderProgress(__assign(__assign({}, this.props), {\n percentComplete: percentComplete\n }), this._onRenderProgress) : null, description ? React.createElement(\"div\", {\n id: this._descriptionId,\n className: classNames.itemDescription\n }, description) : null);\n };\n\n ProgressIndicatorBase.defaultProps = {\n label: '',\n description: '',\n width: 180\n };\n return ProgressIndicatorBase;\n}(React.Component);\n\nexport { ProgressIndicatorBase };","import { __assign } from \"tslib\";\nimport { HighContrastSelector, keyframes, noWrap, getGlobalClassNames, getHighContrastNoAdjustStyle } from '../../Styling';\nimport { getRTL, memoizeFunction } from '../../Utilities';\nvar GlobalClassNames = {\n root: 'ms-ProgressIndicator',\n itemName: 'ms-ProgressIndicator-itemName',\n itemDescription: 'ms-ProgressIndicator-itemDescription',\n itemProgress: 'ms-ProgressIndicator-itemProgress',\n progressTrack: 'ms-ProgressIndicator-progressTrack',\n progressBar: 'ms-ProgressIndicator-progressBar'\n};\nvar IndeterminateProgress = memoizeFunction(function () {\n return keyframes({\n '0%': {\n left: '-30%'\n },\n '100%': {\n left: '100%'\n }\n });\n});\nvar IndeterminateProgressRTL = memoizeFunction(function () {\n return keyframes({\n '100%': {\n right: '-30%'\n },\n '0%': {\n right: '100%'\n }\n });\n});\nexport var getStyles = function getStyles(props) {\n var _a, _b, _c;\n\n var isRTL = getRTL(props.theme);\n var className = props.className,\n indeterminate = props.indeterminate,\n theme = props.theme,\n _d = props.barHeight,\n barHeight = _d === void 0 ? 2 : _d;\n var palette = theme.palette,\n semanticColors = theme.semanticColors,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var marginBetweenText = 8;\n var textHeight = 18;\n var progressTrackColor = palette.neutralLight;\n return {\n root: [classNames.root, fonts.medium, className],\n itemName: [classNames.itemName, noWrap, {\n color: semanticColors.bodyText,\n paddingTop: marginBetweenText / 2,\n lineHeight: textHeight + 2\n }],\n itemDescription: [classNames.itemDescription, {\n color: semanticColors.bodySubtext,\n fontSize: fonts.small.fontSize,\n lineHeight: textHeight\n }],\n itemProgress: [classNames.itemProgress, {\n position: 'relative',\n overflow: 'hidden',\n height: barHeight,\n padding: marginBetweenText + \"px 0\"\n }],\n progressTrack: [classNames.progressTrack, {\n position: 'absolute',\n width: '100%',\n height: barHeight,\n backgroundColor: progressTrackColor,\n selectors: (_a = {}, _a[HighContrastSelector] = {\n borderBottom: '1px solid WindowText'\n }, _a)\n }],\n progressBar: [{\n backgroundColor: palette.themePrimary,\n height: barHeight,\n position: 'absolute',\n transition: 'width .3s ease',\n width: 0,\n selectors: (_b = {}, _b[HighContrastSelector] = __assign({\n backgroundColor: 'highlight'\n }, getHighContrastNoAdjustStyle()), _b)\n }, indeterminate ? {\n position: 'absolute',\n minWidth: '33%',\n background: \"linear-gradient(to right, \" + progressTrackColor + \" 0%, \" + (palette.themePrimary + \" 50%, \" + progressTrackColor + \" 100%)\"),\n animation: (isRTL ? IndeterminateProgressRTL() : IndeterminateProgress()) + \" 3s infinite\",\n selectors: (_c = {}, _c[HighContrastSelector] = {\n background: \"highlight\"\n }, _c)\n } : {\n transition: 'width .15s linear'\n }, classNames.progressBar]\n };\n};","import { styled } from '../../Utilities';\nimport { ProgressIndicatorBase } from './ProgressIndicator.base';\nimport { getStyles } from './ProgressIndicator.styles';\n/**\n * ProgressIndicator description\n */\n\nexport var ProgressIndicator = styled(ProgressIndicatorBase, getStyles, undefined, {\n scope: 'ProgressIndicator'\n});","import { __assign, __rest } from \"tslib\";\n/** @jsxRuntime classic */\n\n/** @jsx withSlots */\n\nimport * as React from 'react';\nimport { withSlots, getSlots } from '../../Foundation';\nimport { getNativeProps, htmlElementProperties } from '../../Utilities';\nexport var TextView = function TextView(props) {\n if (React.Children.count(props.children) === 0) {\n return null;\n }\n\n var block = props.block,\n className = props.className,\n _a = props.as,\n RootType = _a === void 0 ? 'span' : _a,\n variant = props.variant,\n nowrap = props.nowrap,\n rest = __rest(props, [\"block\", \"className\", \"as\", \"variant\", \"nowrap\"]);\n\n var Slots = getSlots(props, {\n root: RootType\n });\n return withSlots(Slots.root, __assign({}, getNativeProps(rest, htmlElementProperties)));\n};","export var TextStyles = function TextStyles(props, theme) {\n var as = props.as,\n className = props.className,\n block = props.block,\n nowrap = props.nowrap,\n variant = props.variant;\n var fonts = theme.fonts;\n var variantObject = fonts[variant || 'medium'];\n return {\n root: [theme.fonts.medium, {\n display: block ? as === 'td' ? 'table-cell' : 'block' : 'inline',\n fontFamily: variantObject.fontFamily,\n fontSize: variantObject.fontSize,\n fontWeight: variantObject.fontWeight,\n color: variantObject.color,\n mozOsxFontSmoothing: variantObject.MozOsxFontSmoothing,\n webkitFontSmoothing: variantObject.WebkitFontSmoothing\n }, nowrap && {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n }, className]\n };\n};","import { createComponent } from '../../Foundation';\nimport { TextView } from './Text.view';\nimport { TextStyles as styles } from './Text.styles';\nexport var Text = createComponent(TextView, {\n displayName: 'Text',\n styles: styles\n});\nexport default Text;","export var DEFAULT_MASK_FORMAT_CHARS = {\n '9': /[0-9]/,\n a: /[a-zA-Z]/,\n '*': /[a-zA-Z0-9]/\n};\n/**\n * Takes in the mask string and the formatCharacters and returns an array of MaskValues\n * Example:\n * mask = 'Phone Number: (999) - 9999'\n * return = [\n * { value: undefined, displayIndex: 16, format: /[0-9]/ },\n * { value: undefined, displayIndex: 17, format: /[0-9]/ },\n * { value: undefined, displayIndex: 18, format: /[0-9]/ },\n * { value: undefined, displayIndex: 22, format: /[0-9]/ },\n * ]\n *\n * @param mask The string use to define the format of the displayed maskedValue.\n * @param formatChars An object defining how certain characters in the mask should accept input.\n */\n\nexport function parseMask(mask, formatChars) {\n if (formatChars === void 0) {\n formatChars = DEFAULT_MASK_FORMAT_CHARS;\n }\n\n if (!mask) {\n return [];\n }\n\n var maskCharData = []; // Count the escape characters in the mask string.\n\n var escapedChars = 0;\n\n for (var i = 0; i + escapedChars < mask.length; i++) {\n var maskChar = mask.charAt(i + escapedChars);\n\n if (maskChar === '\\\\') {\n escapedChars++;\n } else {\n // Check if the maskChar is a format character.\n var maskFormat = formatChars[maskChar];\n\n if (maskFormat) {\n maskCharData.push({\n /**\n * Do not add escapedChars to the displayIndex.\n * The index refers to a position in the mask's displayValue.\n * Since the backslashes don't appear in the displayValue,\n * we do not add them to the charData displayIndex.\n */\n displayIndex: i,\n format: maskFormat\n });\n }\n }\n }\n\n return maskCharData;\n}\n/**\n * Takes in the mask string, an array of MaskValues, and the maskCharacter\n * returns the mask string formatted with the input values and maskCharacter.\n * If the maskChar is undefined, the maskDisplay is truncated to the last filled format character.\n * Example:\n * mask = 'Phone Number: (999) 999 - 9999'\n * maskCharData = '12345'\n * maskChar = '_'\n * return = 'Phone Number: (123) 45_ - ___'\n *\n * Example:\n * mask = 'Phone Number: (999) 999 - 9999'\n * value = '12345'\n * maskChar = undefined\n * return = 'Phone Number: (123) 45'\n *\n * @param mask The string use to define the format of the displayed maskedValue.\n * @param maskCharData The input values to insert into the mask string for displaying.\n * @param maskChar? A character to display in place of unfilled mask format characters.\n */\n\nexport function getMaskDisplay(mask, maskCharData, maskChar) {\n var maskDisplay = mask;\n\n if (!maskDisplay) {\n return '';\n } // Remove all backslashes\n\n\n maskDisplay = maskDisplay.replace(/\\\\/g, ''); // lastDisplayIndex is is used to truncate the string if necessary.\n\n var lastDisplayIndex = 0;\n\n if (maskCharData.length > 0) {\n lastDisplayIndex = maskCharData[0].displayIndex - 1;\n }\n /**\n * For each input value, replace the character in the maskDisplay with the value.\n * If there is no value set for the format character, use the maskChar.\n */\n\n\n for (var _i = 0, maskCharData_1 = maskCharData; _i < maskCharData_1.length; _i++) {\n var charData = maskCharData_1[_i];\n var nextChar = ' ';\n\n if (charData.value) {\n nextChar = charData.value;\n\n if (charData.displayIndex > lastDisplayIndex) {\n lastDisplayIndex = charData.displayIndex;\n }\n } else {\n if (maskChar) {\n nextChar = maskChar;\n }\n } // Insert the character into the maskdisplay at its corresponding index\n\n\n maskDisplay = maskDisplay.slice(0, charData.displayIndex) + nextChar + maskDisplay.slice(charData.displayIndex + 1);\n } // Cut off all mask characters after the last filled format value\n\n\n if (!maskChar) {\n maskDisplay = maskDisplay.slice(0, lastDisplayIndex + 1);\n }\n\n return maskDisplay;\n}\n/**\n * Get the next format index right of or at a specified index.\n * If no index exists, returns the rightmost index.\n * @param maskCharData\n * @param index\n */\n\nexport function getRightFormatIndex(maskCharData, index) {\n for (var i = 0; i < maskCharData.length; i++) {\n if (maskCharData[i].displayIndex >= index) {\n return maskCharData[i].displayIndex;\n }\n }\n\n return maskCharData[maskCharData.length - 1].displayIndex;\n}\n/**\n * Get the next format index left of a specified index.\n * If no index exists, returns the leftmost index.\n * @param maskCharData\n * @param index\n */\n\nexport function getLeftFormatIndex(maskCharData, index) {\n for (var i = maskCharData.length - 1; i >= 0; i--) {\n if (maskCharData[i].displayIndex < index) {\n return maskCharData[i].displayIndex;\n }\n }\n\n return maskCharData[0].displayIndex;\n}\n/**\n * Deletes all values in maskCharData with a displayIndex that falls inside the specified range.\n * maskCharData is modified inline and also returned.\n * @param maskCharData\n * @param selectionStart\n * @param selectionCount\n */\n\nexport function clearRange(maskCharData, selectionStart, selectionCount) {\n for (var i = 0; i < maskCharData.length; i++) {\n if (maskCharData[i].displayIndex >= selectionStart) {\n if (maskCharData[i].displayIndex >= selectionStart + selectionCount) {\n break;\n }\n\n maskCharData[i].value = undefined;\n }\n }\n\n return maskCharData;\n}\n/**\n * Deletes the input character at or after a specified index and returns the new array of charData\n * maskCharData is modified inline and also returned.\n * @param maskCharData\n * @param selectionStart\n */\n\nexport function clearNext(maskCharData, selectionStart) {\n for (var i = 0; i < maskCharData.length; i++) {\n if (maskCharData[i].displayIndex >= selectionStart) {\n maskCharData[i].value = undefined;\n break;\n }\n }\n\n return maskCharData;\n}\n/**\n * Deletes the input character before a specified index and returns the new array of charData\n * maskCharData is modified inline and also returned.\n * @param maskCharData\n * @param selectionStart\n */\n\nexport function clearPrev(maskCharData, selectionStart) {\n for (var i = maskCharData.length - 1; i >= 0; i--) {\n if (maskCharData[i].displayIndex < selectionStart) {\n maskCharData[i].value = undefined;\n break;\n }\n }\n\n return maskCharData;\n}\n/**\n * Deletes all values in maskCharData with a displayIndex that falls inside the specified range.\n * Modifies the maskCharData inplace with the passed string and returns the display index of the\n * next format character after the inserted string.\n * @param maskCharData\n * @param selectionStart\n * @param selectionCount\n * @return The displayIndex of the next format character\n */\n\nexport function insertString(maskCharData, selectionStart, newString) {\n var stringIndex = 0;\n var nextIndex = 0;\n var isStringInserted = false; // Iterate through _maskCharData finding values with a displayIndex after the specified range start\n\n for (var i = 0; i < maskCharData.length && stringIndex < newString.length; i++) {\n if (maskCharData[i].displayIndex >= selectionStart) {\n isStringInserted = true;\n nextIndex = maskCharData[i].displayIndex; // Find the next character in the newString that matches the format\n\n while (stringIndex < newString.length) {\n // If the character matches the format regexp, set the maskCharData to the new character\n if (maskCharData[i].format.test(newString.charAt(stringIndex))) {\n maskCharData[i].value = newString.charAt(stringIndex++); // Set the nextIndex to the display index of the next mask format character.\n\n if (i + 1 < maskCharData.length) {\n nextIndex = maskCharData[i + 1].displayIndex;\n } else {\n nextIndex++;\n }\n\n break;\n }\n\n stringIndex++;\n }\n }\n }\n\n return isStringInserted ? nextIndex : selectionStart;\n}","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { TextField } from '../TextField';\nimport { initializeComponentRef, KeyCodes } from '../../../Utilities';\nimport { clearNext, clearPrev, clearRange, DEFAULT_MASK_FORMAT_CHARS, getLeftFormatIndex, getMaskDisplay, getRightFormatIndex, insertString, parseMask } from './inputMask';\nexport var DEFAULT_MASK_CHAR = '_';\n\nvar MaskedTextField =\n/** @class */\nfunction (_super) {\n __extends(MaskedTextField, _super);\n\n function MaskedTextField(props) {\n var _this = _super.call(this, props) || this;\n\n _this._textField = React.createRef();\n\n _this._onFocus = function (event) {\n if (_this.props.onFocus) {\n _this.props.onFocus(event);\n }\n\n _this._isFocused = true; // Move the cursor position to the leftmost unfilled position\n\n for (var i = 0; i < _this._maskCharData.length; i++) {\n if (!_this._maskCharData[i].value) {\n _this.setState({\n maskCursorPosition: _this._maskCharData[i].displayIndex\n });\n\n break;\n }\n }\n };\n\n _this._onBlur = function (event) {\n if (_this.props.onBlur) {\n _this.props.onBlur(event);\n }\n\n _this._isFocused = false;\n _this._moveCursorOnMouseUp = true;\n };\n\n _this._onMouseDown = function (event) {\n if (_this.props.onMouseDown) {\n _this.props.onMouseDown(event);\n }\n\n if (!_this._isFocused) {\n _this._moveCursorOnMouseUp = true;\n }\n };\n\n _this._onMouseUp = function (event) {\n if (_this.props.onMouseUp) {\n _this.props.onMouseUp(event);\n } // Move the cursor on mouseUp after focusing the textField\n\n\n if (_this._moveCursorOnMouseUp) {\n _this._moveCursorOnMouseUp = false; // Move the cursor position to the rightmost unfilled position\n\n for (var i = 0; i < _this._maskCharData.length; i++) {\n if (!_this._maskCharData[i].value) {\n _this.setState({\n maskCursorPosition: _this._maskCharData[i].displayIndex\n });\n\n break;\n }\n }\n }\n };\n\n _this._onInputChange = function (ev, value) {\n var textField = _this._textField.current;\n\n if (_this._changeSelectionData === null && textField) {\n _this._changeSelectionData = {\n changeType: 'default',\n selectionStart: textField.selectionStart !== null ? textField.selectionStart : -1,\n selectionEnd: textField.selectionEnd !== null ? textField.selectionEnd : -1\n };\n }\n\n if (!_this._changeSelectionData) {\n return;\n }\n\n var displayValue = _this.state.displayValue; // The initial value of cursorPos does not matter\n\n var cursorPos = 0;\n var _a = _this._changeSelectionData,\n changeType = _a.changeType,\n selectionStart = _a.selectionStart,\n selectionEnd = _a.selectionEnd;\n\n if (changeType === 'textPasted') {\n var charsSelected = selectionEnd - selectionStart;\n var charCount = value.length + charsSelected - displayValue.length;\n var startPos = selectionStart;\n var pastedString = value.substr(startPos, charCount); // Clear any selected characters\n\n if (charsSelected) {\n _this._maskCharData = clearRange(_this._maskCharData, selectionStart, charsSelected);\n }\n\n cursorPos = insertString(_this._maskCharData, startPos, pastedString);\n } else if (changeType === 'delete' || changeType === 'backspace') {\n // isDel is true If the characters are removed LTR, otherwise RTL\n var isDel = changeType === 'delete';\n var charCount = selectionEnd - selectionStart;\n\n if (charCount) {\n // charCount is > 0 if range was deleted\n _this._maskCharData = clearRange(_this._maskCharData, selectionStart, charCount);\n cursorPos = getRightFormatIndex(_this._maskCharData, selectionStart);\n } else {\n // If charCount === 0, there was no selection and a single character was deleted\n if (isDel) {\n _this._maskCharData = clearNext(_this._maskCharData, selectionStart);\n cursorPos = getRightFormatIndex(_this._maskCharData, selectionStart);\n } else {\n _this._maskCharData = clearPrev(_this._maskCharData, selectionStart);\n cursorPos = getLeftFormatIndex(_this._maskCharData, selectionStart);\n }\n }\n } else if (value.length > displayValue.length) {\n // This case is if the user added characters\n var charCount = value.length - displayValue.length;\n var startPos = selectionEnd - charCount;\n var enteredString = value.substr(startPos, charCount);\n cursorPos = insertString(_this._maskCharData, startPos, enteredString);\n } else if (value.length <= displayValue.length) {\n /**\n * This case is reached only if the user has selected a block of 1 or more\n * characters and input a character replacing the characters they've selected.\n */\n var charCount = 1;\n var selectCount = displayValue.length + charCount - value.length;\n var startPos = selectionEnd - charCount;\n var enteredString = value.substr(startPos, charCount); // Clear the selected range\n\n _this._maskCharData = clearRange(_this._maskCharData, startPos, selectCount); // Insert the printed character\n\n cursorPos = insertString(_this._maskCharData, startPos, enteredString);\n }\n\n _this._changeSelectionData = null;\n var newValue = getMaskDisplay(_this.props.mask, _this._maskCharData, _this.props.maskChar);\n\n _this.setState({\n displayValue: newValue,\n maskCursorPosition: cursorPos\n }); // Perform onChange after input has been processed. Return value is expected to be the displayed text\n\n\n if (_this.props.onChange) {\n _this.props.onChange(ev, newValue);\n }\n };\n\n _this._onKeyDown = function (event) {\n var current = _this._textField.current;\n\n if (_this.props.onKeyDown) {\n _this.props.onKeyDown(event);\n }\n\n _this._changeSelectionData = null;\n\n if (current && current.value) {\n var keyCode = event.keyCode,\n ctrlKey = event.ctrlKey,\n metaKey = event.metaKey; // Ignore ctrl and meta keydown\n\n if (ctrlKey || metaKey) {\n return;\n } // On backspace or delete, store the selection and the keyCode\n\n\n if (keyCode === KeyCodes.backspace || keyCode === KeyCodes.del) {\n var selectionStart = event.target.selectionStart;\n var selectionEnd = event.target.selectionEnd; // Check if backspace or delete press is valid.\n\n if (!(keyCode === KeyCodes.backspace && selectionEnd && selectionEnd > 0) && !(keyCode === KeyCodes.del && selectionStart !== null && selectionStart < current.value.length)) {\n return;\n }\n\n _this._changeSelectionData = {\n changeType: keyCode === KeyCodes.backspace ? 'backspace' : 'delete',\n selectionStart: selectionStart !== null ? selectionStart : -1,\n selectionEnd: selectionEnd !== null ? selectionEnd : -1\n };\n }\n }\n };\n\n _this._onPaste = function (event) {\n if (_this.props.onPaste) {\n _this.props.onPaste(event);\n }\n\n var selectionStart = event.target.selectionStart;\n var selectionEnd = event.target.selectionEnd; // Store the paste selection range\n\n _this._changeSelectionData = {\n changeType: 'textPasted',\n selectionStart: selectionStart !== null ? selectionStart : -1,\n selectionEnd: selectionEnd !== null ? selectionEnd : -1\n };\n };\n\n initializeComponentRef(_this); // Translate mask into charData\n\n _this._maskCharData = parseMask(props.mask, props.maskFormat); // If an initial value is provided, use it to populate the format chars\n\n props.value !== undefined && _this.setValue(props.value);\n _this._isFocused = false;\n _this._moveCursorOnMouseUp = false;\n _this.state = {\n displayValue: getMaskDisplay(props.mask, _this._maskCharData, props.maskChar)\n };\n return _this;\n }\n\n MaskedTextField.prototype.UNSAFE_componentWillReceiveProps = function (newProps) {\n if (newProps.mask !== this.props.mask || newProps.value !== this.props.value) {\n this._maskCharData = parseMask(newProps.mask, newProps.maskFormat);\n newProps.value !== undefined && this.setValue(newProps.value);\n this.setState({\n displayValue: getMaskDisplay(newProps.mask, this._maskCharData, newProps.maskChar)\n });\n }\n };\n\n MaskedTextField.prototype.componentDidUpdate = function () {\n // Move the cursor to the start of the mask format on update\n if (this._isFocused && this.state.maskCursorPosition !== undefined && this._textField.current) {\n this._textField.current.setSelectionRange(this.state.maskCursorPosition, this.state.maskCursorPosition);\n }\n };\n\n MaskedTextField.prototype.render = function () {\n return React.createElement(TextField, __assign({}, this.props, {\n onFocus: this._onFocus,\n onBlur: this._onBlur,\n onMouseDown: this._onMouseDown,\n onMouseUp: this._onMouseUp,\n onChange: this._onInputChange,\n onKeyDown: this._onKeyDown,\n onPaste: this._onPaste,\n value: this.state.displayValue || '',\n componentRef: this._textField\n }));\n };\n\n Object.defineProperty(MaskedTextField.prototype, \"value\", {\n /**\n * @returns The value of all filled format characters or undefined if not all format characters are filled\n */\n get: function get() {\n var value = '';\n\n for (var i = 0; i < this._maskCharData.length; i++) {\n if (!this._maskCharData[i].value) {\n return undefined;\n }\n\n value += this._maskCharData[i].value;\n }\n\n return value;\n },\n enumerable: true,\n configurable: true\n });\n\n MaskedTextField.prototype.setValue = function (newValue) {\n var valueIndex = 0;\n var charDataIndex = 0;\n\n while (valueIndex < newValue.length && charDataIndex < this._maskCharData.length) {\n // Test if the next character in the new value fits the next format character\n var testVal = newValue[valueIndex];\n\n if (this._maskCharData[charDataIndex].format.test(testVal)) {\n this._maskCharData[charDataIndex].value = testVal;\n charDataIndex++;\n }\n\n valueIndex++;\n }\n };\n\n MaskedTextField.prototype.focus = function () {\n var current = this._textField.current;\n current && current.focus();\n };\n\n MaskedTextField.prototype.blur = function () {\n var current = this._textField.current;\n current && current.blur();\n };\n\n MaskedTextField.prototype.select = function () {\n var current = this._textField.current;\n current && current.select();\n };\n\n MaskedTextField.prototype.setSelectionStart = function (value) {\n var current = this._textField.current;\n current && current.setSelectionStart(value);\n };\n\n MaskedTextField.prototype.setSelectionEnd = function (value) {\n var current = this._textField.current;\n current && current.setSelectionEnd(value);\n };\n\n MaskedTextField.prototype.setSelectionRange = function (start, end) {\n var current = this._textField.current;\n current && current.setSelectionRange(start, end);\n };\n\n Object.defineProperty(MaskedTextField.prototype, \"selectionStart\", {\n get: function get() {\n var current = this._textField.current;\n return current && current.selectionStart !== null ? current.selectionStart : -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MaskedTextField.prototype, \"selectionEnd\", {\n get: function get() {\n var current = this._textField.current;\n return current && current.selectionEnd ? current.selectionEnd : -1;\n },\n enumerable: true,\n configurable: true\n });\n MaskedTextField.defaultProps = {\n maskChar: DEFAULT_MASK_CHAR,\n maskFormat: DEFAULT_MASK_FORMAT_CHARS\n };\n return MaskedTextField;\n}(React.Component);\n\nexport { MaskedTextField };","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { initializeComponentRef, classNamesFunction, getId, inputProperties, getNativeProps, warnDeprecations, warnMutuallyExclusive, FocusRects } from '../../Utilities';\nimport { Label } from '../../Label';\nimport { KeytipData } from '../../KeytipData';\nvar getClassNames = classNamesFunction();\nvar COMPONENT_NAME = 'Toggle';\n\nvar ToggleBase =\n/** @class */\nfunction (_super) {\n __extends(ToggleBase, _super);\n\n function ToggleBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._toggleButton = React.createRef();\n\n _this._onClick = function (ev) {\n // eslint-disable-next-line deprecation/deprecation\n var _a = _this.props,\n disabled = _a.disabled,\n checkedProp = _a.checked,\n onChange = _a.onChange,\n onChanged = _a.onChanged,\n onClick = _a.onClick;\n var checked = _this.state.checked;\n\n if (!disabled) {\n // Only update the state if the user hasn't provided it.\n if (checkedProp === undefined) {\n _this.setState({\n checked: !checked\n });\n }\n\n if (onChange) {\n onChange(ev, !checked);\n }\n\n if (onChanged) {\n onChanged(!checked);\n }\n\n if (onClick) {\n onClick(ev);\n }\n }\n };\n\n initializeComponentRef(_this);\n warnMutuallyExclusive(COMPONENT_NAME, props, {\n checked: 'defaultChecked'\n });\n warnDeprecations(COMPONENT_NAME, props, {\n onAriaLabel: 'ariaLabel',\n offAriaLabel: undefined,\n onChanged: 'onChange'\n });\n _this.state = {\n checked: !!(props.checked || props.defaultChecked)\n };\n _this._id = getId('Toggle');\n return _this;\n }\n\n ToggleBase.getDerivedStateFromProps = function (nextProps, prevState) {\n if (nextProps.checked === undefined) {\n return null;\n }\n\n return {\n checked: !!nextProps.checked\n };\n };\n\n Object.defineProperty(ToggleBase.prototype, \"checked\", {\n /**\n * Gets the current checked state of the toggle.\n */\n get: function get() {\n return this.state.checked;\n },\n enumerable: true,\n configurable: true\n });\n\n ToggleBase.prototype.render = function () {\n var _this = this;\n\n var _a = this.props,\n _b = _a.as,\n RootType = _b === void 0 ? 'div' : _b,\n className = _a.className,\n theme = _a.theme,\n disabled = _a.disabled,\n keytipProps = _a.keytipProps,\n id = _a.id,\n label = _a.label,\n ariaLabel = _a.ariaLabel,\n\n /* eslint-disable deprecation/deprecation */\n onAriaLabel = _a.onAriaLabel,\n offAriaLabel = _a.offAriaLabel,\n\n /* eslint-enable deprecation/deprecation */\n offText = _a.offText,\n onText = _a.onText,\n styles = _a.styles,\n inlineLabel = _a.inlineLabel;\n var checked = this.state.checked;\n var stateText = checked ? onText : offText;\n var badAriaLabel = checked ? onAriaLabel : offAriaLabel;\n var toggleNativeProps = getNativeProps(this.props, inputProperties, ['defaultChecked']);\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n disabled: disabled,\n checked: checked,\n inlineLabel: inlineLabel,\n onOffMissing: !onText && !offText\n });\n var toggleId = id || this._id;\n var labelId = toggleId + \"-label\";\n var stateTextId = toggleId + \"-stateText\"; // The following properties take priority for what Narrator should read:\n // 1. ariaLabel\n // 2. onAriaLabel (if checked) or offAriaLabel (if not checked)\n // 3. label AND stateText, if existent\n\n var labelledById = undefined;\n\n if (!ariaLabel && !badAriaLabel) {\n if (label) {\n labelledById = labelId;\n }\n\n if (stateText) {\n labelledById = labelledById ? labelledById + \" \" + stateTextId : stateTextId;\n }\n }\n\n var ariaRole = this.props.role ? this.props.role : 'switch';\n\n var renderPill = function renderPill(keytipAttributes) {\n if (keytipAttributes === void 0) {\n keytipAttributes = {};\n }\n\n return React.createElement(\"button\", __assign({}, toggleNativeProps, keytipAttributes, {\n className: classNames.pill,\n disabled: disabled,\n id: toggleId,\n type: \"button\",\n role: ariaRole,\n ref: _this._toggleButton,\n \"aria-disabled\": disabled,\n \"aria-checked\": checked,\n \"aria-label\": ariaLabel ? ariaLabel : badAriaLabel,\n \"data-is-focusable\": true,\n onChange: _this._noop,\n onClick: _this._onClick,\n \"aria-labelledby\": labelledById\n }), React.createElement(\"span\", {\n className: classNames.thumb\n }));\n };\n\n var pillContent = keytipProps ? React.createElement(KeytipData, {\n keytipProps: keytipProps,\n ariaDescribedBy: toggleNativeProps['aria-describedby'],\n disabled: disabled\n }, function (keytipAttributes) {\n return renderPill(keytipAttributes);\n }) : renderPill();\n return React.createElement(RootType, {\n className: classNames.root,\n hidden: toggleNativeProps.hidden\n }, label && React.createElement(Label, {\n htmlFor: toggleId,\n className: classNames.label,\n id: labelId\n }, label), React.createElement(\"div\", {\n className: classNames.container\n }, pillContent, stateText && // This second \"htmlFor\" property is needed to allow the\n // toggle's stateText to also trigger a state change when clicked.\n React.createElement(Label, {\n htmlFor: toggleId,\n className: classNames.text,\n id: stateTextId\n }, stateText)), React.createElement(FocusRects, null));\n };\n\n ToggleBase.prototype.focus = function () {\n if (this._toggleButton.current) {\n this._toggleButton.current.focus();\n }\n };\n\n ToggleBase.prototype._noop = function () {\n /* no-op */\n };\n\n return ToggleBase;\n}(React.Component);\n\nexport { ToggleBase };","import { styled } from '../../Utilities';\nimport { ToggleBase } from './Toggle.base';\nimport { getStyles } from './Toggle.styles';\nexport var Toggle = styled(ToggleBase, getStyles, undefined, {\n scope: 'Toggle'\n});","import { __assign } from \"tslib\";\nimport { HighContrastSelector, getFocusStyle, FontWeights, getHighContrastNoAdjustStyle } from '../../Styling';\nvar DEFAULT_PILL_WIDTH = 40;\nvar DEFAULT_PILL_HEIGHT = 20;\nvar DEFAULT_THUMB_SIZE = 12;\nexport var getStyles = function getStyles(props) {\n var _a, _b, _c, _d, _e, _f, _g;\n\n var theme = props.theme,\n className = props.className,\n disabled = props.disabled,\n checked = props.checked,\n inlineLabel = props.inlineLabel,\n onOffMissing = props.onOffMissing;\n var semanticColors = theme.semanticColors,\n palette = theme.palette; // Tokens\n\n var pillUncheckedBackground = semanticColors.bodyBackground;\n var pillCheckedBackground = semanticColors.inputBackgroundChecked;\n var pillCheckedHoveredBackground = semanticColors.inputBackgroundCheckedHovered;\n var thumbUncheckedHoveredBackground = palette.neutralDark;\n var pillCheckedDisabledBackground = semanticColors.disabledBodySubtext;\n var thumbBackground = semanticColors.smallInputBorder;\n var thumbCheckedBackground = semanticColors.inputForegroundChecked;\n var thumbDisabledBackground = semanticColors.disabledBodySubtext;\n var thumbCheckedDisabledBackground = semanticColors.disabledBackground;\n var pillBorderColor = semanticColors.smallInputBorder;\n var pillBorderHoveredColor = semanticColors.inputBorderHovered;\n var pillBorderDisabledColor = semanticColors.disabledBodySubtext;\n var textDisabledColor = semanticColors.disabledText;\n return {\n root: ['ms-Toggle', checked && 'is-checked', !disabled && 'is-enabled', disabled && 'is-disabled', theme.fonts.medium, {\n marginBottom: '8px'\n }, inlineLabel && {\n display: 'flex',\n alignItems: 'center'\n }, className],\n label: ['ms-Toggle-label', {\n display: 'inline-block'\n }, disabled && {\n color: textDisabledColor,\n selectors: (_a = {}, _a[HighContrastSelector] = {\n color: 'GrayText'\n }, _a)\n }, inlineLabel && !onOffMissing && {\n marginRight: 16\n }, onOffMissing && inlineLabel && {\n order: 1,\n marginLeft: 16\n }, inlineLabel && {\n wordBreak: 'break-all'\n }],\n container: ['ms-Toggle-innerContainer', {\n display: 'flex',\n position: 'relative'\n }],\n pill: ['ms-Toggle-background', getFocusStyle(theme, {\n inset: -3\n }), {\n fontSize: '20px',\n boxSizing: 'border-box',\n width: DEFAULT_PILL_WIDTH,\n height: DEFAULT_PILL_HEIGHT,\n borderRadius: DEFAULT_PILL_HEIGHT / 2,\n transition: 'all 0.1s ease',\n border: \"1px solid \" + pillBorderColor,\n background: pillUncheckedBackground,\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n padding: '0 3px'\n }, !disabled && [!checked && {\n selectors: {\n ':hover': [{\n borderColor: pillBorderHoveredColor\n }],\n ':hover .ms-Toggle-thumb': [{\n backgroundColor: thumbUncheckedHoveredBackground,\n selectors: (_b = {}, _b[HighContrastSelector] = {\n borderColor: 'Highlight'\n }, _b)\n }]\n }\n }, checked && [{\n background: pillCheckedBackground,\n borderColor: 'transparent',\n justifyContent: 'flex-end'\n }, {\n selectors: (_c = {\n ':hover': [{\n backgroundColor: pillCheckedHoveredBackground,\n borderColor: 'transparent',\n selectors: (_d = {}, _d[HighContrastSelector] = {\n backgroundColor: 'Highlight'\n }, _d)\n }]\n }, _c[HighContrastSelector] = __assign({\n backgroundColor: 'Highlight'\n }, getHighContrastNoAdjustStyle()), _c)\n }]], disabled && [{\n cursor: 'default'\n }, !checked && [{\n borderColor: pillBorderDisabledColor\n }], checked && [{\n backgroundColor: pillCheckedDisabledBackground,\n borderColor: 'transparent',\n justifyContent: 'flex-end'\n }]], !disabled && {\n selectors: {\n '&:hover': {\n selectors: (_e = {}, _e[HighContrastSelector] = {\n borderColor: 'Highlight'\n }, _e)\n }\n }\n }],\n thumb: ['ms-Toggle-thumb', {\n display: 'block',\n width: DEFAULT_THUMB_SIZE,\n height: DEFAULT_THUMB_SIZE,\n borderRadius: '50%',\n transition: 'all 0.1s ease',\n backgroundColor: thumbBackground,\n\n /* Border is added to handle high contrast mode for Firefox */\n borderColor: 'transparent',\n borderWidth: DEFAULT_THUMB_SIZE / 2,\n borderStyle: 'solid',\n boxSizing: 'border-box'\n }, !disabled && checked && [{\n backgroundColor: thumbCheckedBackground,\n selectors: (_f = {}, _f[HighContrastSelector] = {\n backgroundColor: 'Window',\n borderColor: 'Window'\n }, _f)\n }], disabled && [!checked && [{\n backgroundColor: thumbDisabledBackground\n }], checked && [{\n backgroundColor: thumbCheckedDisabledBackground\n }]]],\n text: ['ms-Toggle-stateText', {\n selectors: {\n // Workaround: make rules more specific than Label rules.\n '&&': {\n padding: '0',\n margin: '0 8px',\n userSelect: 'none',\n fontWeight: FontWeights.regular\n }\n }\n }, disabled && {\n selectors: {\n '&&': {\n color: textDisabledColor,\n selectors: (_g = {}, _g[HighContrastSelector] = {\n color: 'GrayText'\n }, _g)\n }\n }\n }]\n };\n};","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { DelayedRender, classNamesFunction, getNativeProps, divProperties } from '../../Utilities';\nvar getClassNames = classNamesFunction();\n/**\n * {@docCategory Announced}\n */\n\nvar AnnouncedBase =\n/** @class */\nfunction (_super) {\n __extends(AnnouncedBase, _super);\n\n function AnnouncedBase() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n AnnouncedBase.prototype.render = function () {\n var _a = this.props,\n message = _a.message,\n styles = _a.styles,\n _b = _a.as,\n Root = _b === void 0 ? 'div' : _b,\n className = _a.className;\n var classNames = getClassNames(styles, {\n className: className\n });\n return React.createElement(Root, __assign({\n role: \"status\",\n className: classNames.root\n }, getNativeProps(this.props, divProperties, ['className'])), React.createElement(DelayedRender, null, React.createElement(\"div\", {\n className: classNames.screenReaderText\n }, message)));\n };\n\n AnnouncedBase.defaultProps = {\n 'aria-live': 'polite'\n };\n return AnnouncedBase;\n}(React.Component);\n\nexport { AnnouncedBase };","import { styled } from '../../Utilities';\nimport { AnnouncedBase } from './Announced.base';\nimport { getStyles } from './Announced.styles';\nexport var Announced = styled(AnnouncedBase, getStyles);","import { hiddenContentStyle } from '../../Styling';\nexport var getStyles = function getStyles(props) {\n return {\n root: props.className,\n screenReaderText: hiddenContentStyle\n };\n};","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { KeyCodes, getNativeProps, inputProperties, isIE11, Async, initializeComponentRef } from '../../Utilities';\nvar SELECTION_FORWARD = 'forward';\nvar SELECTION_BACKWARD = 'backward';\n/**\n * {@docCategory Autofill}\n */\n\nvar Autofill =\n/** @class */\nfunction (_super) {\n __extends(Autofill, _super);\n\n function Autofill(props) {\n var _this = _super.call(this, props) || this;\n\n _this._inputElement = React.createRef();\n _this._autoFillEnabled = true;\n _this._isComposing = false; // Composition events are used when the character/text requires several keystrokes to be completed.\n // Some examples of this are mobile text input and langauges like Japanese or Arabic.\n // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart\n\n _this._onCompositionStart = function (ev) {\n _this._isComposing = true;\n _this._autoFillEnabled = false;\n }; // Composition events are used when the character/text requires several keystrokes to be completed.\n // Some examples of this are mobile text input and languages like Japanese or Arabic.\n // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart\n\n\n _this._onCompositionUpdate = function () {\n if (isIE11()) {\n _this._updateValue(_this._getCurrentInputValue(), true);\n }\n }; // Composition events are used when the character/text requires several keystrokes to be completed.\n // Some examples of this are mobile text input and langauges like Japanese or Arabic.\n // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart\n\n\n _this._onCompositionEnd = function (ev) {\n var inputValue = _this._getCurrentInputValue();\n\n _this._tryEnableAutofill(inputValue, _this.value, false, true);\n\n _this._isComposing = false; // Due to timing, this needs to be async, otherwise no text will be selected.\n\n _this._async.setTimeout(function () {\n // it's technically possible that the value of _isComposing is reset during this timeout,\n // so explicitly trigger this with composing=true here, since it is supposed to be the\n // update for composition end\n _this._updateValue(_this._getCurrentInputValue(), false);\n }, 0);\n };\n\n _this._onClick = function () {\n if (_this._value && _this._value !== '' && _this._autoFillEnabled) {\n _this._autoFillEnabled = false;\n }\n };\n\n _this._onKeyDown = function (ev) {\n if (_this.props.onKeyDown) {\n _this.props.onKeyDown(ev);\n } // If the event is actively being composed, then don't alert autofill.\n // Right now typing does not have isComposing, once that has been fixed any should be removed.\n\n\n if (!ev.nativeEvent.isComposing) {\n switch (ev.which) {\n case KeyCodes.backspace:\n _this._autoFillEnabled = false;\n break;\n\n case KeyCodes.left:\n case KeyCodes.right:\n if (_this._autoFillEnabled) {\n _this._value = _this.state.displayValue;\n _this._autoFillEnabled = false;\n }\n\n break;\n\n default:\n if (!_this._autoFillEnabled) {\n if (_this.props.enableAutofillOnKeyPress.indexOf(ev.which) !== -1) {\n _this._autoFillEnabled = true;\n }\n }\n\n break;\n }\n }\n };\n\n _this._onInputChanged = function (ev) {\n var value = _this._getCurrentInputValue(ev);\n\n if (!_this._isComposing) {\n _this._tryEnableAutofill(value, _this._value, ev.nativeEvent.isComposing);\n } // If it is not IE11 and currently composing, update the value\n\n\n if (!(isIE11() && _this._isComposing)) {\n var nativeEventComposing = ev.nativeEvent.isComposing;\n var isComposing = nativeEventComposing === undefined ? _this._isComposing : nativeEventComposing;\n\n _this._updateValue(value, isComposing);\n }\n };\n\n _this._onChanged = function () {\n // Swallow this event, we don't care about it\n // We must provide it because React PropTypes marks it as required, but onInput serves the correct purpose\n return;\n };\n /**\n * Updates the current input value as well as getting a new display value.\n * @param newValue - The new value from the input\n */\n\n\n _this._updateValue = function (newValue, composing) {\n // Only proceed if the value is nonempty and is different from the old value\n // This is to work around the fact that, in IE 11, inputs with a placeholder fire an onInput event on focus\n if (!newValue && newValue === _this._value) {\n return;\n }\n\n _this._value = _this.props.onInputChange ? _this.props.onInputChange(newValue, composing) : newValue;\n\n _this.setState({\n displayValue: _this._getDisplayValue(_this._value, _this.props.suggestedDisplayValue)\n }, function () {\n return _this._notifyInputChange(_this._value, composing);\n });\n };\n\n initializeComponentRef(_this);\n _this._async = new Async(_this);\n _this._value = props.defaultVisibleValue || '';\n _this.state = {\n displayValue: props.defaultVisibleValue || ''\n };\n return _this;\n }\n\n Object.defineProperty(Autofill.prototype, \"cursorLocation\", {\n get: function get() {\n if (this._inputElement.current) {\n var inputElement = this._inputElement.current;\n\n if (inputElement.selectionDirection !== SELECTION_FORWARD) {\n return inputElement.selectionEnd;\n } else {\n return inputElement.selectionStart;\n }\n } else {\n return -1;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Autofill.prototype, \"isValueSelected\", {\n get: function get() {\n return Boolean(this.inputElement && this.inputElement.selectionStart !== this.inputElement.selectionEnd);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Autofill.prototype, \"value\", {\n get: function get() {\n return this._value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Autofill.prototype, \"selectionStart\", {\n get: function get() {\n return this._inputElement.current ? this._inputElement.current.selectionStart : -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Autofill.prototype, \"selectionEnd\", {\n get: function get() {\n return this._inputElement.current ? this._inputElement.current.selectionEnd : -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Autofill.prototype, \"inputElement\", {\n get: function get() {\n return this._inputElement.current;\n },\n enumerable: true,\n configurable: true\n });\n\n Autofill.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) {\n if (this.props.updateValueInWillReceiveProps) {\n var updatedInputValue = this.props.updateValueInWillReceiveProps(); // Don't update if we have a null value or the value isn't changing\n // the value should still update if an empty string is passed in\n\n if (updatedInputValue !== null && updatedInputValue !== this._value) {\n this._value = updatedInputValue;\n }\n }\n\n var newDisplayValue = this._getDisplayValue(this._value, nextProps.suggestedDisplayValue);\n\n if (typeof newDisplayValue === 'string') {\n this.setState({\n displayValue: newDisplayValue\n });\n }\n };\n\n Autofill.prototype.componentDidUpdate = function () {\n var value = this._value;\n var _a = this.props,\n suggestedDisplayValue = _a.suggestedDisplayValue,\n shouldSelectFullInputValueInComponentDidUpdate = _a.shouldSelectFullInputValueInComponentDidUpdate,\n preventValueSelection = _a.preventValueSelection;\n var differenceIndex = 0;\n\n if (preventValueSelection) {\n return;\n }\n\n if (this._autoFillEnabled && value && suggestedDisplayValue && this._doesTextStartWith(suggestedDisplayValue, value)) {\n var shouldSelectFullRange = false;\n\n if (shouldSelectFullInputValueInComponentDidUpdate) {\n shouldSelectFullRange = shouldSelectFullInputValueInComponentDidUpdate();\n }\n\n if (shouldSelectFullRange && this._inputElement.current) {\n this._inputElement.current.setSelectionRange(0, suggestedDisplayValue.length, SELECTION_BACKWARD);\n } else {\n while (differenceIndex < value.length && value[differenceIndex].toLocaleLowerCase() === suggestedDisplayValue[differenceIndex].toLocaleLowerCase()) {\n differenceIndex++;\n }\n\n if (differenceIndex > 0 && this._inputElement.current) {\n this._inputElement.current.setSelectionRange(differenceIndex, suggestedDisplayValue.length, SELECTION_BACKWARD);\n }\n }\n }\n };\n\n Autofill.prototype.componentWillUnmount = function () {\n this._async.dispose();\n };\n\n Autofill.prototype.render = function () {\n var displayValue = this.state.displayValue;\n var nativeProps = getNativeProps(this.props, inputProperties);\n return React.createElement(\"input\", __assign({\n autoCapitalize: \"off\",\n autoComplete: \"off\",\n \"aria-autocomplete\": 'both'\n }, nativeProps, {\n ref: this._inputElement,\n value: displayValue,\n onCompositionStart: this._onCompositionStart,\n onCompositionUpdate: this._onCompositionUpdate,\n onCompositionEnd: this._onCompositionEnd,\n // TODO (Fabric 8?) - switch to calling only onChange. See notes in TextField._onInputChange.\n onChange: this._onChanged,\n onInput: this._onInputChanged,\n onKeyDown: this._onKeyDown,\n onClick: this.props.onClick ? this.props.onClick : this._onClick,\n \"data-lpignore\": true\n }));\n };\n\n Autofill.prototype.focus = function () {\n this._inputElement.current && this._inputElement.current.focus();\n };\n\n Autofill.prototype.clear = function () {\n this._autoFillEnabled = true;\n\n this._updateValue('', false);\n\n this._inputElement.current && this._inputElement.current.setSelectionRange(0, 0);\n };\n\n Autofill.prototype._getCurrentInputValue = function (ev) {\n if (ev && ev.target && ev.target.value) {\n return ev.target.value;\n } else if (this.inputElement && this.inputElement.value) {\n return this.inputElement.value;\n } else {\n return '';\n }\n };\n /**\n * Attempts to enable autofill. Whether or not autofill is enabled depends on the input value,\n * whether or not any text is selected, and only if the new input value is longer than the old input value.\n * Autofill should never be set to true if the value is composing. Once compositionEnd is called, then\n * it should be completed.\n * See https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent for more information on composition.\n * @param newValue - new input value\n * @param oldValue - old input value\n * @param isComposing - if true then the text is actively being composed and it has not completed.\n * @param isComposed - if the text is a composed text value.\n */\n\n\n Autofill.prototype._tryEnableAutofill = function (newValue, oldValue, isComposing, isComposed) {\n if (!isComposing && newValue && this._inputElement.current && this._inputElement.current.selectionStart === newValue.length && !this._autoFillEnabled && (newValue.length > oldValue.length || isComposed)) {\n this._autoFillEnabled = true;\n }\n };\n\n Autofill.prototype._notifyInputChange = function (newValue, composing) {\n if (this.props.onInputValueChange) {\n this.props.onInputValueChange(newValue, composing);\n }\n };\n /**\n * Returns a string that should be used as the display value.\n * It evaluates this based on whether or not the suggested value starts with the input value\n * and whether or not autofill is enabled.\n * @param inputValue - the value that the input currently has.\n * @param suggestedDisplayValue - the possible full value\n */\n\n\n Autofill.prototype._getDisplayValue = function (inputValue, suggestedDisplayValue) {\n var displayValue = inputValue;\n\n if (suggestedDisplayValue && inputValue && this._doesTextStartWith(suggestedDisplayValue, displayValue) && this._autoFillEnabled) {\n displayValue = suggestedDisplayValue;\n }\n\n return displayValue;\n };\n\n Autofill.prototype._doesTextStartWith = function (text, startWith) {\n if (!text || !startWith) {\n return false;\n }\n\n return text.toLocaleLowerCase().indexOf(startWith.toLocaleLowerCase()) === 0;\n };\n\n Autofill.defaultProps = {\n enableAutofillOnKeyPress: [KeyCodes.down, KeyCodes.up]\n };\n return Autofill;\n}(React.Component);\n\nexport { Autofill };\n/**\n * @deprecated do not use.\n * {@docCategory Autofill}\n */\n\nvar BaseAutoFill =\n/** @class */\nfunction (_super) {\n __extends(BaseAutoFill, _super);\n\n function BaseAutoFill() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n return BaseAutoFill;\n}(Autofill);\n\nexport { BaseAutoFill };","import { __assign } from \"tslib\";\nimport { concatStyleSets, getFocusStyle, HighContrastSelector, getHighContrastNoAdjustStyle } from '../../../Styling';\nimport { memoizeFunction } from '../../../Utilities';\nimport { getStyles as getBaseButtonStyles } from '../BaseButton.styles';\nimport { getStyles as getSplitButtonStyles } from '../SplitButton/SplitButton.styles';\nimport { ButtonGlobalClassNames } from '../BaseButton.classNames';\nexport var getStyles = memoizeFunction(function (theme, customStyles, focusInset, focusColor) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;\n\n var baseButtonStyles = getBaseButtonStyles(theme);\n var baseSplitButtonStyles = getSplitButtonStyles(theme);\n var p = theme.palette,\n semanticColors = theme.semanticColors;\n var commandButtonHighContrastFocus = {\n left: 4,\n top: 4,\n bottom: 4,\n right: 4,\n border: 'none'\n };\n var commandButtonStyles = {\n root: [getFocusStyle(theme, {\n inset: 2,\n highContrastStyle: commandButtonHighContrastFocus,\n borderColor: 'transparent'\n }), theme.fonts.medium, {\n minWidth: '40px',\n backgroundColor: p.white,\n color: p.neutralPrimary,\n padding: '0 4px',\n border: 'none',\n borderRadius: 0,\n selectors: (_a = {}, _a[HighContrastSelector] = {\n border: 'none'\n }, _a)\n }],\n rootHovered: {\n backgroundColor: p.neutralLighter,\n color: p.neutralDark,\n selectors: (_b = {}, _b[HighContrastSelector] = {\n color: 'Highlight'\n }, _b[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: p.themeDarkAlt\n }, _b[\".\" + ButtonGlobalClassNames.msButtonMenuIcon] = {\n color: p.neutralPrimary\n }, _b)\n },\n rootPressed: {\n backgroundColor: p.neutralLight,\n color: p.neutralDark,\n selectors: (_c = {}, _c[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: p.themeDark\n }, _c[\".\" + ButtonGlobalClassNames.msButtonMenuIcon] = {\n color: p.neutralPrimary\n }, _c)\n },\n rootChecked: {\n backgroundColor: p.neutralLight,\n color: p.neutralDark,\n selectors: (_d = {}, _d[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: p.themeDark\n }, _d[\".\" + ButtonGlobalClassNames.msButtonMenuIcon] = {\n color: p.neutralPrimary\n }, _d)\n },\n rootCheckedHovered: {\n backgroundColor: p.neutralQuaternaryAlt,\n selectors: (_e = {}, _e[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: p.themeDark\n }, _e[\".\" + ButtonGlobalClassNames.msButtonMenuIcon] = {\n color: p.neutralPrimary\n }, _e)\n },\n rootExpanded: {\n backgroundColor: p.neutralLight,\n color: p.neutralDark,\n selectors: (_f = {}, _f[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: p.themeDark\n }, _f[\".\" + ButtonGlobalClassNames.msButtonMenuIcon] = {\n color: p.neutralPrimary\n }, _f)\n },\n rootExpandedHovered: {\n backgroundColor: p.neutralQuaternaryAlt\n },\n rootDisabled: {\n backgroundColor: p.white,\n selectors: (_g = {}, _g[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: semanticColors.disabledBodySubtext,\n selectors: (_h = {}, _h[HighContrastSelector] = __assign({\n color: 'GrayText'\n }, getHighContrastNoAdjustStyle()), _h)\n }, _g[HighContrastSelector] = __assign({\n color: 'GrayText',\n backgroundColor: 'Window'\n }, getHighContrastNoAdjustStyle()), _g)\n },\n // Split button styles\n splitButtonContainer: {\n height: '100%',\n selectors: (_j = {}, _j[HighContrastSelector] = {\n border: 'none'\n }, _j)\n },\n splitButtonDividerDisabled: {\n selectors: (_k = {}, _k[HighContrastSelector] = {\n backgroundColor: 'Window'\n }, _k)\n },\n splitButtonDivider: {\n backgroundColor: p.neutralTertiaryAlt\n },\n splitButtonMenuButton: {\n backgroundColor: p.white,\n border: 'none',\n borderTopRightRadius: '0',\n borderBottomRightRadius: '0',\n color: p.neutralSecondary,\n selectors: {\n ':hover': {\n backgroundColor: p.neutralLighter,\n color: p.neutralDark,\n selectors: (_l = {}, _l[HighContrastSelector] = {\n color: 'Highlight'\n }, _l[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: p.neutralPrimary\n }, _l)\n },\n ':active': {\n backgroundColor: p.neutralLight,\n selectors: (_m = {}, _m[\".\" + ButtonGlobalClassNames.msButtonIcon] = {\n color: p.neutralPrimary\n }, _m)\n }\n }\n },\n splitButtonMenuButtonDisabled: {\n backgroundColor: p.white,\n selectors: (_o = {}, _o[HighContrastSelector] = __assign({\n color: 'GrayText',\n border: 'none',\n backgroundColor: 'Window'\n }, getHighContrastNoAdjustStyle()), _o)\n },\n splitButtonMenuButtonChecked: {\n backgroundColor: p.neutralLight,\n color: p.neutralDark,\n selectors: {\n ':hover': {\n backgroundColor: p.neutralQuaternaryAlt\n }\n }\n },\n splitButtonMenuButtonExpanded: {\n backgroundColor: p.neutralLight,\n color: p.black,\n selectors: {\n ':hover': {\n backgroundColor: p.neutralQuaternaryAlt\n }\n }\n },\n splitButtonMenuIcon: {\n color: p.neutralPrimary\n },\n splitButtonMenuIconDisabled: {\n color: p.neutralTertiary\n },\n label: {\n fontWeight: 'normal'\n },\n icon: {\n color: p.themePrimary\n },\n menuIcon: (_p = {\n color: p.neutralSecondary\n }, _p[HighContrastSelector] = {\n color: 'GrayText'\n }, _p)\n };\n return concatStyleSets(baseButtonStyles, baseSplitButtonStyles, commandButtonStyles, customStyles);\n});","import { __assign, __decorate, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { BaseButton } from '../BaseButton';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { getStyles } from './CommandBarButton.styles';\n/**\n * {@docCategory Button}\n */\n\nvar CommandBarButton =\n/** @class */\nfunction (_super) {\n __extends(CommandBarButton, _super);\n\n function CommandBarButton() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n CommandBarButton.prototype.render = function () {\n var _a = this.props,\n styles = _a.styles,\n theme = _a.theme;\n return React.createElement(BaseButton, __assign({}, this.props, {\n variantClassName: \"ms-Button--commandBar\",\n styles: getStyles(theme, styles),\n onRenderDescription: nullRender\n }));\n };\n\n CommandBarButton = __decorate([customizable('CommandBarButton', ['theme', 'styles'], true)], CommandBarButton);\n return CommandBarButton;\n}(React.Component);\n\nexport { CommandBarButton };","import { ActionButton } from '../ActionButton/ActionButton';\n/**\n * {@docCategory Button}\n */\n\nexport var CommandButton = ActionButton;","import { __assign } from \"tslib\";\nimport { concatStyleSets, FontWeights, HighContrastSelector, getHighContrastNoAdjustStyle } from '../../../Styling';\nimport { memoizeFunction } from '../../../Utilities';\nimport { getStyles as getBaseButtonStyles } from '../BaseButton.styles';\nimport { getStyles as getSplitButtonStyles } from '../SplitButton/SplitButton.styles';\nimport { primaryStyles, standardStyles } from '../ButtonThemes';\nexport var getStyles = memoizeFunction(function (theme, customStyles, primary) {\n var _a, _b, _c, _d, _e;\n\n var fonts = theme.fonts,\n palette = theme.palette;\n var baseButtonStyles = getBaseButtonStyles(theme);\n var splitButtonStyles = getSplitButtonStyles(theme);\n var compoundButtonStyles = {\n root: {\n maxWidth: '280px',\n minHeight: '72px',\n height: 'auto',\n padding: '16px 12px'\n },\n flexContainer: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n minWidth: '100%',\n margin: ''\n },\n textContainer: {\n textAlign: 'left'\n },\n icon: {\n fontSize: '2em',\n lineHeight: '1em',\n height: '1em',\n margin: '0px 8px 0px 0px',\n flexBasis: '1em',\n flexShrink: '0'\n },\n label: {\n margin: '0 0 5px',\n lineHeight: '100%',\n fontWeight: FontWeights.semibold\n },\n description: [fonts.small, {\n lineHeight: '100%'\n }]\n };\n var standardCompoundTheme = {\n description: {\n color: palette.neutralSecondary\n },\n descriptionHovered: {\n color: palette.neutralDark\n },\n descriptionPressed: {\n color: 'inherit'\n },\n descriptionChecked: {\n color: 'inherit'\n },\n descriptionDisabled: {\n color: 'inherit'\n }\n };\n var primaryCompoundTheme = {\n description: {\n color: palette.white,\n selectors: (_a = {}, _a[HighContrastSelector] = __assign({\n backgroundColor: 'WindowText',\n color: 'Window'\n }, getHighContrastNoAdjustStyle()), _a)\n },\n descriptionHovered: {\n color: palette.white,\n selectors: (_b = {}, _b[HighContrastSelector] = {\n backgroundColor: 'Highlight',\n color: 'Window'\n }, _b)\n },\n descriptionPressed: {\n color: 'inherit',\n selectors: (_c = {}, _c[HighContrastSelector] = __assign({\n color: 'Window',\n backgroundColor: 'WindowText'\n }, getHighContrastNoAdjustStyle()), _c)\n },\n descriptionChecked: {\n color: 'inherit',\n selectors: (_d = {}, _d[HighContrastSelector] = __assign({\n color: 'Window',\n backgroundColor: 'WindowText'\n }, getHighContrastNoAdjustStyle()), _d)\n },\n descriptionDisabled: {\n color: 'inherit',\n selectors: (_e = {}, _e[HighContrastSelector] = {\n color: 'inherit'\n }, _e)\n }\n };\n return concatStyleSets(baseButtonStyles, compoundButtonStyles, primary ? primaryStyles(theme) : standardStyles(theme), primary ? primaryCompoundTheme : standardCompoundTheme, splitButtonStyles, customStyles);\n});","import { __assign, __decorate, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { BaseButton } from '../BaseButton';\nimport { customizable } from '../../../Utilities';\nimport { getStyles } from './CompoundButton.styles';\n/**\n * {@docCategory Button}\n */\n\nvar CompoundButton =\n/** @class */\nfunction (_super) {\n __extends(CompoundButton, _super);\n\n function CompoundButton() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n CompoundButton.prototype.render = function () {\n var _a = this.props,\n _b = _a.primary,\n primary = _b === void 0 ? false : _b,\n styles = _a.styles,\n theme = _a.theme;\n return React.createElement(BaseButton, __assign({}, this.props, {\n variantClassName: primary ? 'ms-Button--compoundPrimary' : 'ms-Button--compound',\n styles: getStyles(theme, styles, primary)\n }));\n };\n\n CompoundButton = __decorate([customizable('CompoundButton', ['theme', 'styles'], true)], CompoundButton);\n return CompoundButton;\n}(React.Component);\n\nexport { CompoundButton };","import { concatStyleSets, HighContrastSelector } from '../../../Styling';\nimport { memoizeFunction } from '../../../Utilities';\nimport { getStyles as getBaseButtonStyles } from '../BaseButton.styles';\nimport { getStyles as getSplitButtonStyles } from '../SplitButton/SplitButton.styles';\nexport var getStyles = memoizeFunction(function (theme, customStyles) {\n var _a;\n\n var baseButtonStyles = getBaseButtonStyles(theme);\n var splitButtonStyles = getSplitButtonStyles(theme);\n var palette = theme.palette,\n semanticColors = theme.semanticColors;\n var iconButtonStyles = {\n root: {\n padding: '0 4px',\n width: '32px',\n height: '32px',\n backgroundColor: 'transparent',\n border: 'none',\n color: semanticColors.link\n },\n rootHovered: {\n color: palette.themeDarkAlt,\n backgroundColor: palette.neutralLighter,\n selectors: (_a = {}, _a[HighContrastSelector] = {\n borderColor: 'Highlight',\n color: 'Highlight'\n }, _a)\n },\n rootHasMenu: {\n width: 'auto'\n },\n rootPressed: {\n color: palette.themeDark,\n backgroundColor: palette.neutralLight\n },\n rootExpanded: {\n color: palette.themeDark,\n backgroundColor: palette.neutralLight\n },\n rootChecked: {\n color: palette.themeDark,\n backgroundColor: palette.neutralLight\n },\n rootCheckedHovered: {\n color: palette.themeDark,\n backgroundColor: palette.neutralQuaternaryAlt\n },\n rootDisabled: {\n color: palette.neutralTertiaryAlt\n }\n };\n return concatStyleSets(baseButtonStyles, iconButtonStyles, splitButtonStyles, customStyles);\n});","import { __assign, __decorate, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { BaseButton } from '../BaseButton';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { getStyles } from './IconButton.styles';\n/**\n * {@docCategory Button}\n */\n\nvar IconButton =\n/** @class */\nfunction (_super) {\n __extends(IconButton, _super);\n\n function IconButton() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n IconButton.prototype.render = function () {\n var _a = this.props,\n styles = _a.styles,\n theme = _a.theme;\n return React.createElement(BaseButton, __assign({}, this.props, {\n variantClassName: \"ms-Button--icon\",\n styles: getStyles(theme, styles),\n onRenderText: nullRender,\n onRenderDescription: nullRender\n }));\n };\n\n IconButton = __decorate([customizable('IconButton', ['theme', 'styles'], true)], IconButton);\n return IconButton;\n}(React.Component);\n\nexport { IconButton };","import { __assign, __decorate, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { DefaultButton } from '../DefaultButton/DefaultButton';\n/**\n * {@docCategory Button}\n */\n\nvar PrimaryButton =\n/** @class */\nfunction (_super) {\n __extends(PrimaryButton, _super);\n\n function PrimaryButton() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n PrimaryButton.prototype.render = function () {\n return React.createElement(DefaultButton, __assign({}, this.props, {\n primary: true,\n onRenderDescription: nullRender\n }));\n };\n\n PrimaryButton = __decorate([customizable('PrimaryButton', ['theme', 'styles'], true)], PrimaryButton);\n return PrimaryButton;\n}(React.Component);\n\nexport { PrimaryButton };","/* eslint-disable */\nimport { loadStyles } from '@microsoft/load-themed-styles';\nloadStyles([{\n \"rawString\": \".root_3822b975{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:none;box-shadow:none;margin:0;padding:0}.root_3822b975 *{overflow:visible}.root_3822b975 ::-moz-focus-inner{border:0}.root_3822b975 *{outline:transparent}.root_3822b975 *{position:relative}.ms-Fabric--isFocusVisible .root_3822b975 :focus:after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;border:1px solid \"\n}, {\n \"theme\": \"neutralSecondary\",\n \"defaultValue\": \"#605e5c\"\n}, {\n \"rawString\": \"}.picker_3822b975{color:\"\n}, {\n \"theme\": \"black\",\n \"defaultValue\": \"#000000\"\n}, {\n \"rawString\": \";font-size:14px;position:relative}html[dir=ltr] .picker_3822b975{text-align:left}html[dir=rtl] .picker_3822b975{text-align:right}.holder_3822b975{-webkit-overflow-scrolling:touch;-webkit-box-sizing:border-box;box-sizing:border-box;display:none}.picker_3822b975.pickerIsOpened_3822b975 .holder_3822b975{-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block}.pickerIsOpened_3822b975{position:relative}.frame_3822b975{position:relative}.wrap_3822b975{min-height:212px;padding:12px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-sizing:content-box;box-sizing:content-box}.wrap_3822b975.goTodaySpacing_3822b975{min-height:228px}.dayPicker_3822b975{display:block}.header_3822b975{position:relative;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;height:28px;line-height:44px;width:100%}.divider_3822b975{top:0;margin-top:-12px;margin-bottom:-12px}html[dir=ltr] .divider_3822b975{border-right:1px solid \"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}html[dir=rtl] .divider_3822b975{border-left:1px solid \"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.decade_3822b975,.monthAndYear_3822b975,.year_3822b975{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;font-size:14px;font-weight:400;font-weight:600;color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \";padding:0 5px}.currentDecade_3822b975:hover,.currentYear_3822b975:hover,.monthAndYear_3822b975:hover{cursor:default}.table_3822b975{text-align:center;border-collapse:collapse;border-spacing:0;table-layout:fixed;font-size:inherit;margin-top:4px;width:197px}.table_3822b975 td{margin:0;padding:0}.dayWrapper_3822b975,.weekday_3822b975{width:28px;height:28px;padding:0;line-height:28px;font-size:12px;font-size:15px;font-weight:400;color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \";-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:default}.dayWrapper_3822b975 ::-moz-focus-inner,.weekday_3822b975 ::-moz-focus-inner{border:0}.dayWrapper_3822b975 *,.weekday_3822b975 *{outline:transparent}.dayWrapper_3822b975 *,.weekday_3822b975 *{position:relative}.ms-Fabric--isFocusVisible .dayWrapper_3822b975 :focus:after,.ms-Fabric--isFocusVisible .weekday_3822b975 :focus:after{content:'';position:absolute;top:-2px;right:-2px;bottom:-2px;left:-2px;pointer-events:none;border:1px solid \"\n}, {\n \"theme\": \"neutralSecondary\",\n \"defaultValue\": \"#605e5c\"\n}, {\n \"rawString\": \"}.day_3822b975{width:24px;height:24px;border-radius:2px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border:none;padding:0;background-color:transparent;line-height:100%;color:inherit;font-size:inherit;font-weight:inherit;font-family:inherit}@media screen and (-ms-high-contrast:active){.daySelection_3822b975 .day_3822b975:active,.daySelection_3822b975 .day_3822b975:hover{outline:1px solid Highlight;-ms-high-contrast-adjust:none}}@media screen and (-ms-high-contrast:active){.daySelection_3822b975 .day_3822b975:active{color:Highlight;-ms-high-contrast-adjust:none}}.dayIsToday_3822b975{border-radius:100%}.dayIsToday_3822b975,.dayIsToday_3822b975:hover{position:relative;background-color:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \"}@media screen and (-ms-high-contrast:active){.dayIsToday_3822b975,.dayIsToday_3822b975:hover{background-color:Highlight;-ms-high-contrast-adjust:none}}.dayIsToday_3822b975:hover,.dayIsToday_3822b975:hover:hover{border-radius:100%}.dayIsDisabled_3822b975:before{border-top-color:\"\n}, {\n \"theme\": \"neutralTertiary\",\n \"defaultValue\": \"#a19f9d\"\n}, {\n \"rawString\": \"}.dayIsUnfocused_3822b975{color:\"\n}, {\n \"theme\": \"neutralSecondary\",\n \"defaultValue\": \"#605e5c\"\n}, {\n \"rawString\": \";font-weight:400}.dayIsFocused_3822b975:hover,.dayIsUnfocused_3822b975:hover{cursor:pointer;background:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.daySelection_3822b975.dayIsHighlighted_3822b975:hover,.pickerIsFocused_3822b975 .dayIsHighlighted_3822b975.daySelection_3822b975{cursor:pointer;background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";border-radius:2px}@media screen and (-ms-high-contrast:active){.daySelection_3822b975.dayIsHighlighted_3822b975:hover,.pickerIsFocused_3822b975 .dayIsHighlighted_3822b975.daySelection_3822b975{outline:2px solid Highlight}.daySelection_3822b975.dayIsHighlighted_3822b975:hover :not(.dayIsToday_3822b975) span,.pickerIsFocused_3822b975 .dayIsHighlighted_3822b975.daySelection_3822b975 :not(.dayIsToday_3822b975) span{color:Highlight;-ms-high-contrast-adjust:none}}@media screen and (-ms-high-contrast:active){.dayIsHighlighted_3822b975 button.dayIsToday_3822b975{border-radius:100%}}@media screen and (-ms-high-contrast:active){.dayIsHighlighted_3822b975 button.dayIsToday_3822b975 span{color:Window;-ms-high-contrast-adjust:none}}.dayIsFocused_3822b975:active,.dayIsHighlighted_3822b975{background-color:\"\n}, {\n \"theme\": \"themeLight\",\n \"defaultValue\": \"#c7e0f4\"\n}, {\n \"rawString\": \"}.dayIsFocused_3822b975:active.day_3822b975,.dayIsHighlighted_3822b975.day_3822b975{color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \";background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.dayIsHighlighted_3822b975.dayDisabled_3822b975,.dayIsHighlighted_3822b975.dayDisabled_3822b975:hover{background:\"\n}, {\n \"theme\": \"neutralTertiary\",\n \"defaultValue\": \"#a19f9d\"\n}, {\n \"rawString\": \"}.dayBackground_3822b975,.dayBackground_3822b975:active,.dayBackground_3822b975:hover{border-radius:2px}.dayHover_3822b975,.dayHover_3822b975:hover{cursor:pointer;background:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.dayPress_3822b975,.dayPress_3822b975:hover{cursor:pointer;color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \";background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.dayPress_3822b975 .dayIsToday_3822b975,.dayPress_3822b975:hover .dayIsToday_3822b975{background:\"\n}, {\n \"theme\": \"themePrimary\",\n \"defaultValue\": \"#0078d4\"\n}, {\n \"rawString\": \";border-radius:100%}.dayIsFocused_3822b975:active,.dayIsHighlighted_3822b975,.dayIsHighlighted_3822b975:active,.dayIsHighlighted_3822b975:hover,.dayIsUnfocused_3822b975:active,.weekBackground_3822b975,.weekBackground_3822b975:active,.weekBackground_3822b975:hover{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.dayIsToday_3822b975,.dayIsToday_3822b975.day_3822b975:active,.pickerIsFocused_3822b975 .dayIsToday_3822b975{position:relative;color:\"\n}, {\n \"theme\": \"white\",\n \"defaultValue\": \"#ffffff\"\n}, {\n \"rawString\": \";font-weight:600;background:\"\n}, {\n \"theme\": \"themePrimary\",\n \"defaultValue\": \"#0078d4\"\n}, {\n \"rawString\": \";border-radius:100%}@media screen and (-ms-high-contrast:active){.dayIsToday_3822b975,.dayIsToday_3822b975.day_3822b975:active,.pickerIsFocused_3822b975 .dayIsToday_3822b975{background-color:Highlight;color:HighlightText;-ms-high-contrast-adjust:none}}.showWeekNumbers_3822b975 .weekNumbers_3822b975{border-right:1px solid \"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";-webkit-box-sizing:border-box;box-sizing:border-box;width:28px;padding:0}.showWeekNumbers_3822b975 .weekNumbers_3822b975 .dayWrapper_3822b975{color:\"\n}, {\n \"theme\": \"neutralSecondary\",\n \"defaultValue\": \"#605e5c\"\n}, {\n \"rawString\": \"}.showWeekNumbers_3822b975 .weekNumbers_3822b975 .dayWrapper_3822b975.weekIsHighlighted_3822b975{color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \"}.showWeekNumbers_3822b975 .table_3822b975{width:225px}.showWeekNumbers_3822b975 .table_3822b975 .dayWrapper_3822b975,.showWeekNumbers_3822b975 .table_3822b975 .weekday_3822b975{width:30px}.showWeekNumbersRTL_3822b975 .weekNumbers_3822b975{border-left:1px solid \"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";-webkit-box-sizing:border-box;box-sizing:border-box}.showWeekNumbersRTL_3822b975 .weekNumbers_3822b975 .dayWrapper_3822b975{color:\"\n}, {\n \"theme\": \"neutralSecondary\",\n \"defaultValue\": \"#605e5c\"\n}, {\n \"rawString\": \"}.showWeekNumbersRTL_3822b975 .weekNumbers_3822b975 .dayWrapper_3822b975.weekIsHighlighted_3822b975{color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \"}.showWeekNumbersRTL_3822b975 .table_3822b975{width:225px}.showWeekNumbersRTL_3822b975 .table_3822b975 .dayWrapper_3822b975,.showWeekNumbersRTL_3822b975 .table_3822b975 .weekday_3822b975{width:30px}.decadeComponents_3822b975,.monthComponents_3822b975,.yearComponents_3822b975{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-item-align:end;align-self:flex-end}.closeButton_3822b975,.nextDecade_3822b975,.nextMonth_3822b975,.nextYear_3822b975,.prevDecade_3822b975,.prevMonth_3822b975,.prevYear_3822b975{font-family:inherit;width:28px;height:28px;display:block;text-align:center;line-height:28px;text-align:center;font-size:12px;color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \";border-radius:2px;position:relative;background-color:transparent;border:none;padding:0}.closeButton_3822b975:hover,.nextDecade_3822b975:hover,.nextMonth_3822b975:hover,.nextYear_3822b975:hover,.prevDecade_3822b975:hover,.prevMonth_3822b975:hover,.prevYear_3822b975:hover{color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \";cursor:pointer;outline:1px solid transparent}.nextDecadeIsDisabled_3822b975,.nextMonthIsDisabled_3822b975,.nextYearIsDisabled_3822b975,.prevDecadeIsDisabled_3822b975,.prevMonthIsDisabled_3822b975,.prevYearIsDisabled_3822b975{color:\"\n}, {\n \"theme\": \"neutralTertiaryAlt\",\n \"defaultValue\": \"#c8c6c4\"\n}, {\n \"rawString\": \";pointer-events:none}.headerToggleView_3822b975{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:4px 8px}.headerToggleView_3822b975:hover{color:\"\n}, {\n \"theme\": \"black\",\n \"defaultValue\": \"#000000\"\n}, {\n \"rawString\": \";cursor:pointer}@media screen and (-ms-high-contrast:active){.headerToggleView_3822b975:hover{outline:1px solid highlight}}@media screen and (-ms-high-contrast:active){.headerToggleView_3822b975:hover:active{color:highlight}}.currentDecade_3822b975,.currentYear_3822b975{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;padding:0 5px;font-size:14px;font-weight:400;font-weight:600;color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \";height:28px;line-height:28px}html[dir=ltr] .currentDecade_3822b975,html[dir=ltr] .currentYear_3822b975{margin-left:5px}html[dir=rtl] .currentDecade_3822b975,html[dir=rtl] .currentYear_3822b975{margin-right:5px}.optionGrid_3822b975{position:relative;height:210px;width:196px;margin:4px 0 0 0}html[dir=rtl] .optionGrid_3822b975{margin:4px 0 0 0}.monthOption_3822b975,.yearOption_3822b975{width:60px;height:60px;line-height:100%;cursor:pointer;margin:0 10px 10px 0;font-size:13px;font-weight:400;font-family:inherit;color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \";text-align:center;border:none;padding:0;background-color:transparent;border-radius:2px}html[dir=ltr] .monthOption_3822b975,html[dir=ltr] .yearOption_3822b975{float:left}html[dir=rtl] .monthOption_3822b975,html[dir=rtl] .yearOption_3822b975{float:right}html[dir=rtl] .monthOption_3822b975,html[dir=rtl] .yearOption_3822b975{margin:0 0 10px 10px}.monthOption_3822b975:hover,.yearOption_3822b975:hover{color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \";background-color:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \";outline:1px solid transparent}@media screen and (-ms-high-contrast:active){.monthOption_3822b975:hover,.yearOption_3822b975:hover{outline-color:highlight}}@media screen and (-ms-high-contrast:active){.monthOption_3822b975:active,.yearOption_3822b975:active{color:highlight}}.monthOption_3822b975.isHighlighted_3822b975,.yearOption_3822b975.isHighlighted_3822b975{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.dayIsDisabled_3822b975,.monthOptionIsDisabled_3822b975,.yearOptionIsDisabled_3822b975{color:\"\n}, {\n \"theme\": \"neutralTertiaryAlt\",\n \"defaultValue\": \"#c8c6c4\"\n}, {\n \"rawString\": \";pointer-events:none}.goToday_3822b975{bottom:0;color:\"\n}, {\n \"theme\": \"themePrimary\",\n \"defaultValue\": \"#0078d4\"\n}, {\n \"rawString\": \";cursor:pointer;font-size:12px;font-weight:400;font-family:inherit;color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \";height:30px;line-height:30px;padding:0 10px;background-color:transparent;border:none;position:absolute!important;-webkit-box-sizing:content-box;box-sizing:content-box}[dir=ltr] .goToday_3822b975{right:13px}[dir=rtl] .goToday_3822b975{left:13px}.goToday_3822b975:hover{color:\"\n}, {\n \"theme\": \"themePrimary\",\n \"defaultValue\": \"#0078d4\"\n}, {\n \"rawString\": \";outline:1px solid transparent}@media screen and (-ms-high-contrast:active){.goToday_3822b975:hover{outline-color:highlight}}.goToday_3822b975:active{color:\"\n}, {\n \"theme\": \"themeDark\",\n \"defaultValue\": \"#005a9e\"\n}, {\n \"rawString\": \"}@media screen and (-ms-high-contrast:active){.goToday_3822b975:active{color:highlight}}.goToTodayIsDisabled_3822b975{color:\"\n}, {\n \"theme\": \"neutralTertiaryAlt\",\n \"defaultValue\": \"#c8c6c4\"\n}, {\n \"rawString\": \";pointer-events:none}.goTodayInlineMonth_3822b975{top:212px}.wrap_3822b975.goTodaySpacing_3822b975{padding-bottom:28px}.root_3822b975.isPickingYears_3822b975 .dayPicker_3822b975,.root_3822b975.isPickingYears_3822b975 .monthComponents_3822b975{display:none}.root_3822b975.isPickingYears_3822b975 .monthPicker_3822b975{display:none}.root_3822b975.isPickingYears_3822b975 .yearPicker_3822b975{display:block}@media (min-device-width:460px){.wrap_3822b975{padding:12px}.dayPicker_3822b975,.monthPicker_3822b975{min-height:200px}.header_3822b975{height:28px;line-height:28px;width:100%}.dayWrapper_3822b975,.weekday_3822b975{width:28px;height:28px;line-height:28px;font-size:12px}.closeButton_3822b975,.nextDecade_3822b975,.nextMonth_3822b975,.nextYear_3822b975,.prevDecade_3822b975,.prevMonth_3822b975,.prevYear_3822b975{font-size:12px;width:28px;height:28px;line-height:28px}.holder_3822b975{display:inline-block;height:auto;overflow:hidden}.decade_3822b975,.monthAndYear_3822b975,.year_3822b975{font-size:14px;color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \"}.yearComponents_3822b975{margin-left:1px}.goToday_3822b975{padding:0 3px}[dir=ltr] .goToday_3822b975{right:20px}[dir=rtl] .goToday_3822b975{left:20px}.showWeekNumbers_3822b975 .table_3822b975 .dayWrapper_3822b975,.showWeekNumbers_3822b975 .table_3822b975 .weekday_3822b975{width:28px}.showWeekNumbersRTL_3822b975 .table_3822b975 .dayWrapper_3822b975,.showWeekNumbersRTL_3822b975 .table_3822b975 .weekday_3822b975{width:28px}.monthPickerVisible_3822b975 .wrap_3822b975{padding:12px}.monthPickerVisible_3822b975 .dayPicker_3822b975{margin:-10px 0;padding:10px 0}.monthPickerVisible_3822b975 .dayPicker_3822b975{-webkit-box-sizing:border-box;box-sizing:border-box;width:212px;min-height:200px}.monthPickerVisible_3822b975 .monthPicker_3822b975{display:block}.monthPickerVisible_3822b975 .optionGrid_3822b975{height:150px;width:196px}.monthPickerVisible_3822b975 .toggleMonthView_3822b975{display:none}.monthPickerVisible_3822b975 .currentDecade_3822b975,.monthPickerVisible_3822b975 .currentYear_3822b975{font-size:14px;margin:0;height:28px;line-height:28px;display:inline-block}.monthPickerVisible_3822b975 .monthOption_3822b975,.monthPickerVisible_3822b975 .yearOption_3822b975{width:40px;height:40px;line-height:100%;font-size:12px;margin:0 12px 16px 0}html[dir=rtl] .monthPickerVisible_3822b975 .monthOption_3822b975,html[dir=rtl] .monthPickerVisible_3822b975 .yearOption_3822b975{margin:0 0 16px 12px}.monthPickerVisible_3822b975 .monthOption_3822b975:hover,.monthPickerVisible_3822b975 .yearOption_3822b975:hover{outline:1px solid transparent}.monthPickerVisible_3822b975 .monthOption_3822b975:nth-child(4n+4),.monthPickerVisible_3822b975 .yearOption_3822b975:nth-child(4n+4){margin:0 0 16px 0}html[dir=rtl] .monthPickerVisible_3822b975 .monthOption_3822b975:nth-child(4n+4),html[dir=rtl] .monthPickerVisible_3822b975 .yearOption_3822b975:nth-child(4n+4){margin:0 0 16px 0}.monthPickerVisible_3822b975 .goToday_3822b975{font-size:12px;height:28px;line-height:28px;padding:0 10px}[dir=ltr] .monthPickerVisible_3822b975 .goToday_3822b975{right:8px}[dir=rtl] .monthPickerVisible_3822b975 .goToday_3822b975{left:8px}html[dir=ltr] .monthPickerVisible_3822b975 .goToday_3822b975{text-align:right}html[dir=rtl] .monthPickerVisible_3822b975 .goToday_3822b975{text-align:left}.monthPickerVisible_3822b975 .root_3822b975.isPickingYears_3822b975 .dayPicker_3822b975,.monthPickerVisible_3822b975 .root_3822b975.isPickingYears_3822b975 .monthComponents_3822b975{display:block}.monthPickerVisible_3822b975 .root_3822b975.isPickingYears_3822b975 .monthPicker_3822b975{display:none}.monthPickerVisible_3822b975 .root_3822b975.isPickingYears_3822b975 .yearPicker_3822b975{display:block}.calendarsInline_3822b975 .wrap_3822b975{padding:12px}.calendarsInline_3822b975 .holder_3822b975{height:auto}html[dir=ltr] .calendarsInline_3822b975 .table_3822b975{margin-right:12px}html[dir=rtl] .calendarsInline_3822b975 .table_3822b975{margin-left:12px}.calendarsInline_3822b975 .dayPicker_3822b975{width:auto}html[dir=ltr] .calendarsInline_3822b975 .monthPicker_3822b975{margin-left:12px}html[dir=rtl] .calendarsInline_3822b975 .monthPicker_3822b975{margin-right:12px}html[dir=ltr] .calendarsInline_3822b975 .yearPicker_3822b975{margin-left:12px}html[dir=rtl] .calendarsInline_3822b975 .yearPicker_3822b975{margin-right:12px}.calendarsInline_3822b975 .goToday_3822b975{padding:0 10px}[dir=ltr] .calendarsInline_3822b975 .goToday_3822b975{right:14px}[dir=rtl] .calendarsInline_3822b975 .goToday_3822b975{left:14px}html[dir=ltr] .calendarsInline_3822b975 .monthComponents_3822b975{margin-right:12px}html[dir=rtl] .calendarsInline_3822b975 .monthComponents_3822b975{margin-left:12px}.monthPickerOnly_3822b975 .wrap_3822b975{padding:12px}.monthPickerAsOverlay_3822b975 .wrap_3822b975{padding-bottom:28px;margin-bottom:6px}.monthPickerAsOverlay_3822b975 .holder_3822b975{height:240px;min-height:240px}.monthPickerAsOverlay_3822b975 .holderWithButton_3822b975{padding-top:6px;height:auto}}@media (max-device-width:459px){.calendarsInline_3822b975 .monthPicker_3822b975,.calendarsInline_3822b975 .yearPicker_3822b975{display:none}.yearComponents_3822b975{margin-top:2px}}.goToday_3822b975{width:auto}.closeButton_3822b975,.nextDecade_3822b975,.nextMonth_3822b975,.nextYear_3822b975,.prevDecade_3822b975,.prevMonth_3822b975,.prevYear_3822b975{display:inline-block}.closeButton_3822b975:hover,.nextDecade_3822b975:hover,.nextMonth_3822b975:hover,.nextYear_3822b975:hover,.prevDecade_3822b975:hover,.prevMonth_3822b975:hover,.prevYear_3822b975:hover{background-color:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}@media screen and (-ms-high-contrast:active){.closeButton_3822b975:hover,.nextDecade_3822b975:hover,.nextMonth_3822b975:hover,.nextYear_3822b975:hover,.prevDecade_3822b975:hover,.prevMonth_3822b975:hover,.prevYear_3822b975:hover{outline:1px solid Highlight}}.closeButton_3822b975:active,.nextDecade_3822b975:active,.nextMonth_3822b975:active,.nextYear_3822b975:active,.prevDecade_3822b975:active,.prevMonth_3822b975:active,.prevYear_3822b975:active{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}@media screen and (-ms-high-contrast:active){.closeButton_3822b975:active,.nextDecade_3822b975:active,.nextMonth_3822b975:active,.nextYear_3822b975:active,.prevDecade_3822b975:active,.prevMonth_3822b975:active,.prevYear_3822b975:active{color:highlight}}.monthIsHighlighted_3822b975{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.monthIsHighlighted_3822b975.monthOption_3822b975:hover{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}@media screen and (-ms-high-contrast:active){.monthIsHighlighted_3822b975{color:highlight;border:2px solid highlight;border-radius:2px}.monthIsHighlighted_3822b975:hover{outline:0!important}}.monthIsCurrentMonth_3822b975{color:\"\n}, {\n \"theme\": \"white\",\n \"defaultValue\": \"#ffffff\"\n}, {\n \"rawString\": \";background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.monthIsCurrentMonth_3822b975.monthOption_3822b975:hover{color:\"\n}, {\n \"theme\": \"white\",\n \"defaultValue\": \"#ffffff\"\n}, {\n \"rawString\": \";background-color:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \"}.monthOption_3822b975:active{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.yearIsHighlighted_3822b975{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.yearIsHighlighted_3822b975.yearOption_3822b975:hover{background-color:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \"}.yearIsCurrentYear_3822b975{color:\"\n}, {\n \"theme\": \"white\",\n \"defaultValue\": \"#ffffff\"\n}, {\n \"rawString\": \";background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.yearIsCurrentYear_3822b975.yearOption_3822b975:hover{color:\"\n}, {\n \"theme\": \"white\",\n \"defaultValue\": \"#ffffff\"\n}, {\n \"rawString\": \";background-color:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \"}.yearOption_3822b975:active{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.topLeftCornerDate_3822b975{border-top-left-radius:2px}.topRightCornerDate_3822b975{border-top-right-radius:2px}.bottomLeftCornerDate_3822b975{border-bottom-left-radius:2px}.bottomRightCornerDate_3822b975{border-bottom-right-radius:2px}@media screen and (-ms-high-contrast:active){.weekBackground_3822b975{border-top:1px solid highlight;border-bottom:1px solid highlight}.weekBackground_3822b975.bottomRightCornerDate_3822b975.topRightCornerDate_3822b975{border-right:1px solid highlight;border-left:none;padding-left:1px}.weekBackground_3822b975.bottomLeftCornerDate_3822b975.topLeftCornerDate_3822b975{border-left:1px solid highlight;border-right:none;padding-right:1px}.weekBackground_3822b975 :not(.dayIsToday_3822b975) span{color:highlight}.weekSelection_3822b975.dayHover_3822b975{border-top:1px solid highlight;border-bottom:1px solid highlight}.weekSelection_3822b975.dayHover_3822b975.bottomLeftCornerDate_3822b975.topLeftCornerDate_3822b975{border-left:1px solid highlight;padding-right:1px}.weekSelection_3822b975.dayHover_3822b975.bottomRightCornerDate_3822b975.topRightCornerDate_3822b975{border-right:1px solid highlight;padding-left:1px}.weekSelection_3822b975.dayHover_3822b975.dayPress_3822b975 :not(.dayIsToday_3822b975) span{color:highlight}.monthSelection_3822b975.dayHover_3822b975.bottomLeftCornerDate_3822b975,.monthSelection_3822b975.dayHover_3822b975.topLeftCornerDate_3822b975{border-left:1px solid highlight;padding-right:1px}.monthSelection_3822b975.dayHover_3822b975.bottomRightCornerDate_3822b975,.monthSelection_3822b975.dayHover_3822b975.topRightCornerDate_3822b975{border-right:1px solid highlight;padding-left:1px}.monthSelection_3822b975.dayIsFocused_3822b975.dayHover_3822b975.topDate_3822b975,.monthSelection_3822b975.dayIsUnfocused_3822b975.dayHover_3822b975.topDate_3822b975{border-top:1px solid highlight;padding-bottom:1px}.monthSelection_3822b975.dayIsFocused_3822b975.dayHover_3822b975.rightDate_3822b975,.monthSelection_3822b975.dayIsUnfocused_3822b975.dayHover_3822b975.rightDate_3822b975{border-right:1px solid highlight;padding-left:1px}.monthSelection_3822b975.dayIsFocused_3822b975.dayHover_3822b975.bottomDate_3822b975,.monthSelection_3822b975.dayIsUnfocused_3822b975.dayHover_3822b975.bottomDate_3822b975{border-bottom:1px solid highlight;padding-top:1px}.monthSelection_3822b975.dayIsFocused_3822b975.dayHover_3822b975.leftdate_3822b975,.monthSelection_3822b975.dayIsUnfocused_3822b975.dayHover_3822b975.leftdate_3822b975{border-left:1px solid highlight;padding-right:1px}.monthSelection_3822b975.dayIsFocused_3822b975.dayHover_3822b975.dayPress_3822b975 :not(.dayIsToday_3822b975) span,.monthSelection_3822b975.dayIsUnfocused_3822b975.dayHover_3822b975.dayPress_3822b975 :not(.dayIsToday_3822b975) span{color:highlight}}\"\n}]);\nexport var root = \"root_3822b975\";\nexport var picker = \"picker_3822b975\";\nexport var holder = \"holder_3822b975\";\nexport var pickerIsOpened = \"pickerIsOpened_3822b975\";\nexport var frame = \"frame_3822b975\";\nexport var wrap = \"wrap_3822b975\";\nexport var goTodaySpacing = \"goTodaySpacing_3822b975\";\nexport var dayPicker = \"dayPicker_3822b975\";\nexport var header = \"header_3822b975\";\nexport var divider = \"divider_3822b975\";\nexport var monthAndYear = \"monthAndYear_3822b975\";\nexport var year = \"year_3822b975\";\nexport var decade = \"decade_3822b975\";\nexport var currentYear = \"currentYear_3822b975\";\nexport var currentDecade = \"currentDecade_3822b975\";\nexport var table = \"table_3822b975\";\nexport var dayWrapper = \"dayWrapper_3822b975\";\nexport var weekday = \"weekday_3822b975\";\nexport var day = \"day_3822b975\";\nexport var daySelection = \"daySelection_3822b975\";\nexport var dayIsToday = \"dayIsToday_3822b975\";\nexport var dayIsDisabled = \"dayIsDisabled_3822b975\";\nexport var dayIsUnfocused = \"dayIsUnfocused_3822b975\";\nexport var dayIsFocused = \"dayIsFocused_3822b975\";\nexport var dayIsHighlighted = \"dayIsHighlighted_3822b975\";\nexport var pickerIsFocused = \"pickerIsFocused_3822b975\";\nexport var dayDisabled = \"dayDisabled_3822b975\";\nexport var dayBackground = \"dayBackground_3822b975\";\nexport var dayHover = \"dayHover_3822b975\";\nexport var dayPress = \"dayPress_3822b975\";\nexport var weekBackground = \"weekBackground_3822b975\";\nexport var showWeekNumbers = \"showWeekNumbers_3822b975\";\nexport var weekNumbers = \"weekNumbers_3822b975\";\nexport var weekIsHighlighted = \"weekIsHighlighted_3822b975\";\nexport var showWeekNumbersRTL = \"showWeekNumbersRTL_3822b975\";\nexport var monthComponents = \"monthComponents_3822b975\";\nexport var yearComponents = \"yearComponents_3822b975\";\nexport var decadeComponents = \"decadeComponents_3822b975\";\nexport var closeButton = \"closeButton_3822b975\";\nexport var prevMonth = \"prevMonth_3822b975\";\nexport var nextMonth = \"nextMonth_3822b975\";\nexport var prevYear = \"prevYear_3822b975\";\nexport var nextYear = \"nextYear_3822b975\";\nexport var prevDecade = \"prevDecade_3822b975\";\nexport var nextDecade = \"nextDecade_3822b975\";\nexport var prevMonthIsDisabled = \"prevMonthIsDisabled_3822b975\";\nexport var nextMonthIsDisabled = \"nextMonthIsDisabled_3822b975\";\nexport var prevYearIsDisabled = \"prevYearIsDisabled_3822b975\";\nexport var nextYearIsDisabled = \"nextYearIsDisabled_3822b975\";\nexport var prevDecadeIsDisabled = \"prevDecadeIsDisabled_3822b975\";\nexport var nextDecadeIsDisabled = \"nextDecadeIsDisabled_3822b975\";\nexport var headerToggleView = \"headerToggleView_3822b975\";\nexport var optionGrid = \"optionGrid_3822b975\";\nexport var monthOption = \"monthOption_3822b975\";\nexport var yearOption = \"yearOption_3822b975\";\nexport var isHighlighted = \"isHighlighted_3822b975\";\nexport var monthOptionIsDisabled = \"monthOptionIsDisabled_3822b975\";\nexport var yearOptionIsDisabled = \"yearOptionIsDisabled_3822b975\";\nexport var goToday = \"goToday_3822b975\";\nexport var goToTodayIsDisabled = \"goToTodayIsDisabled_3822b975\";\nexport var goTodayInlineMonth = \"goTodayInlineMonth_3822b975\";\nexport var isPickingYears = \"isPickingYears_3822b975\";\nexport var monthPicker = \"monthPicker_3822b975\";\nexport var yearPicker = \"yearPicker_3822b975\";\nexport var monthPickerVisible = \"monthPickerVisible_3822b975\";\nexport var toggleMonthView = \"toggleMonthView_3822b975\";\nexport var calendarsInline = \"calendarsInline_3822b975\";\nexport var monthPickerOnly = \"monthPickerOnly_3822b975\";\nexport var monthPickerAsOverlay = \"monthPickerAsOverlay_3822b975\";\nexport var holderWithButton = \"holderWithButton_3822b975\";\nexport var monthIsHighlighted = \"monthIsHighlighted_3822b975\";\nexport var monthIsCurrentMonth = \"monthIsCurrentMonth_3822b975\";\nexport var yearIsHighlighted = \"yearIsHighlighted_3822b975\";\nexport var yearIsCurrentYear = \"yearIsCurrentYear_3822b975\";\nexport var topLeftCornerDate = \"topLeftCornerDate_3822b975\";\nexport var topRightCornerDate = \"topRightCornerDate_3822b975\";\nexport var bottomLeftCornerDate = \"bottomLeftCornerDate_3822b975\";\nexport var bottomRightCornerDate = \"bottomRightCornerDate_3822b975\";\nexport var weekSelection = \"weekSelection_3822b975\";\nexport var monthSelection = \"monthSelection_3822b975\";\nexport var topDate = \"topDate_3822b975\";\nexport var rightDate = \"rightDate_3822b975\";\nexport var bottomDate = \"bottomDate_3822b975\";\nexport var leftdate = \"leftdate_3822b975\";","import { __extends, __spreadArrays } from \"tslib\";\nimport * as React from 'react';\nimport { KeyCodes, css, getId, getRTL, getRTLSafeKeyCode, format, findIndex, find, initializeComponentRef } from '../../Utilities';\nimport { DateRangeType } from '../../utilities/dateValues/DateValues';\nimport { FocusZone } from '../../FocusZone';\nimport { Icon } from '../../Icon';\nimport { addDays, addWeeks, addMonths, compareDates, compareDatePart, getDateRangeArray, isInDateRangeArray, getWeekNumber, getWeekNumbersInMonth, getMonthStart, getMonthEnd } from '../../utilities/dateMath/DateMath';\nimport * as stylesImport from './Calendar.scss';\nvar styles = stylesImport;\nvar DAYS_IN_WEEK = 7;\n\nvar CalendarDay =\n/** @class */\nfunction (_super) {\n __extends(CalendarDay, _super);\n\n function CalendarDay(props) {\n var _this = _super.call(this, props) || this;\n\n _this.days = {};\n\n _this._onKeyDown = function (callback, ev) {\n if (ev.which === KeyCodes.enter || ev.which === KeyCodes.space) {\n callback();\n }\n };\n\n _this._onDayKeyDown = function (originalDate, weekIndex, dayIndex) {\n return function (ev) {\n if (ev.which === KeyCodes.enter) {\n _this._onSelectDate(originalDate, ev);\n\n ev.preventDefault();\n } else {\n _this._navigateMonthEdge(ev, originalDate, weekIndex, dayIndex);\n }\n };\n };\n\n _this._onDayMouseDown = function (originalDate, weekIndex, dayIndex, dateRangeType) {\n return function (ev) {\n // set the press styling\n if (dateRangeType === DateRangeType.Month) {\n _this._applyFunctionToDayRefs(function (ref, day) {\n if (ref && day.originalDate.getMonth() === originalDate.getMonth() && day.isInBounds) {\n ref.classList.add(styles.dayPress);\n }\n });\n } else {\n // week or work week view\n _this._applyFunctionToDayRefs(function (ref, day, dayWeekIndex) {\n if (ref && dayWeekIndex === weekIndex && day.isInBounds) {\n ref.classList.add(styles.dayPress);\n ref.classList.add(styles.dayIsHighlighted);\n } else if (ref) {\n ref.classList.remove(styles.dayIsHighlighted);\n }\n });\n }\n };\n };\n\n _this._onDayMouseUp = function (originalDate, weekIndex, dayIndex, dateRangeType) {\n return function (ev) {\n // remove press styling\n if (dateRangeType === DateRangeType.Month) {\n _this._applyFunctionToDayRefs(function (ref, day) {\n if (ref && day.originalDate.getMonth() === originalDate.getMonth() && day.isInBounds) {\n ref.classList.remove(styles.dayPress);\n }\n });\n } else {\n // week or work week view\n _this._applyFunctionToDayRefs(function (ref, day, dayWeekIndex) {\n if (ref && dayWeekIndex === weekIndex && day.isInBounds) {\n ref.classList.remove(styles.dayPress);\n }\n });\n }\n };\n };\n\n _this._onDayMouseOver = function (originalDate, weekIndex, dayIndex, dateRangeType) {\n return function (ev) {\n // set the hover styling on every day in the same month\n if (dateRangeType === DateRangeType.Month) {\n _this._applyFunctionToDayRefs(function (ref, day) {\n if (ref && day.originalDate.getMonth() === originalDate.getMonth() && day.isInBounds) {\n ref.classList.add(styles.dayHover);\n }\n });\n } else {\n // week or work week view\n _this._applyFunctionToDayRefs(function (ref, day, dayWeekIndex) {\n if (ref && dayWeekIndex === weekIndex && day.isInBounds) {\n ref.classList.add(styles.dayHover);\n }\n });\n }\n };\n };\n\n _this._onDayMouseLeave = function (originalDate, weekIndex, dayIndex, dateRangeType) {\n return function (ev) {\n // remove the hover and pressed styling\n if (dateRangeType === DateRangeType.Month) {\n _this._applyFunctionToDayRefs(function (ref, day) {\n if (ref && day.originalDate.getMonth() === originalDate.getMonth() && day.isInBounds) {\n ref.classList.remove(styles.dayHover);\n }\n });\n } else {\n // week or work week view\n _this._applyFunctionToDayRefs(function (ref, day, dayWeekIndex) {\n if (ref && dayWeekIndex === weekIndex && day.isInBounds) {\n ref.classList.remove(styles.dayHover);\n }\n });\n }\n };\n };\n\n _this._onTableMouseLeave = function (ev) {\n if (ev.target.contains && ev.relatedTarget && ev.relatedTarget.contains && ev.target.contains(ev.relatedTarget)) {\n return;\n }\n\n _this._applyFunctionToDayRefs(function (ref, day) {\n if (ref) {\n ref.classList.remove(styles.dayHover);\n ref.classList.remove(styles.dayPress);\n }\n });\n };\n\n _this._onTableMouseUp = function (ev) {\n if (ev.target.contains && ev.relatedTarget && ev.relatedTarget.contains && ev.target.contains(ev.relatedTarget)) {\n return;\n }\n\n _this._applyFunctionToDayRefs(function (ref, day) {\n if (ref) {\n ref.classList.remove(styles.dayPress);\n }\n });\n };\n\n _this._onSelectDate = function (selectedDate, ev) {\n var _a = _this.props,\n onSelectDate = _a.onSelectDate,\n dateRangeType = _a.dateRangeType,\n firstDayOfWeek = _a.firstDayOfWeek,\n navigatedDate = _a.navigatedDate,\n autoNavigateOnSelection = _a.autoNavigateOnSelection,\n minDate = _a.minDate,\n maxDate = _a.maxDate,\n workWeekDays = _a.workWeekDays;\n\n if (ev) {\n ev.stopPropagation();\n }\n\n var dateRange = getDateRangeArray(selectedDate, dateRangeType, firstDayOfWeek, workWeekDays);\n\n if (dateRangeType !== DateRangeType.Day) {\n dateRange = _this._getBoundedDateRange(dateRange, minDate, maxDate);\n }\n\n dateRange = dateRange.filter(function (d) {\n return !_this._getIsRestrictedDate(d);\n });\n\n if (onSelectDate) {\n onSelectDate(selectedDate, dateRange);\n } // Navigate to next or previous month if needed\n\n\n if (autoNavigateOnSelection && selectedDate.getMonth() !== navigatedDate.getMonth()) {\n var compareResult = compareDatePart(selectedDate, navigatedDate);\n\n if (compareResult < 0) {\n _this._onSelectPrevMonth();\n } else if (compareResult > 0) {\n _this._onSelectNextMonth();\n }\n }\n };\n\n _this._onSelectNextMonth = function () {\n _this.props.onNavigateDate(addMonths(_this.props.navigatedDate, 1), false);\n };\n\n _this._onSelectPrevMonth = function () {\n _this.props.onNavigateDate(addMonths(_this.props.navigatedDate, -1), false);\n };\n\n _this._onClose = function () {\n if (_this.props.onDismiss) {\n _this.props.onDismiss();\n }\n };\n\n _this._onHeaderSelect = function () {\n var onHeaderSelect = _this.props.onHeaderSelect;\n\n if (onHeaderSelect) {\n onHeaderSelect(true);\n }\n };\n\n _this._onHeaderKeyDown = function (ev) {\n var onHeaderSelect = _this.props.onHeaderSelect;\n\n if (onHeaderSelect && (ev.which === KeyCodes.enter || ev.which === KeyCodes.space)) {\n onHeaderSelect(true);\n }\n };\n\n _this._onPrevMonthKeyDown = function (ev) {\n if (ev.which === KeyCodes.enter) {\n _this._onKeyDown(_this._onSelectPrevMonth, ev);\n }\n };\n\n _this._onNextMonthKeyDown = function (ev) {\n if (ev.which === KeyCodes.enter) {\n _this._onKeyDown(_this._onSelectNextMonth, ev);\n }\n };\n\n _this._onCloseButtonKeyDown = function (ev) {\n if (ev.which === KeyCodes.enter) {\n _this._onKeyDown(_this._onClose, ev);\n }\n };\n\n initializeComponentRef(_this);\n _this.state = {\n activeDescendantId: getId('DatePickerDay-active'),\n weeks: _this._getWeeks(props)\n };\n _this._onSelectNextMonth = _this._onSelectNextMonth.bind(_this);\n _this._onSelectPrevMonth = _this._onSelectPrevMonth.bind(_this);\n _this._onClose = _this._onClose.bind(_this);\n return _this;\n }\n\n CalendarDay.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) {\n this.setState({\n weeks: this._getWeeks(nextProps)\n });\n };\n\n CalendarDay.prototype.render = function () {\n var _a, _b;\n\n var _this = this;\n\n var _c = this.state,\n activeDescendantId = _c.activeDescendantId,\n weeks = _c.weeks;\n var _d = this.props,\n firstDayOfWeek = _d.firstDayOfWeek,\n strings = _d.strings,\n navigatedDate = _d.navigatedDate,\n selectedDate = _d.selectedDate,\n dateRangeType = _d.dateRangeType,\n navigationIcons = _d.navigationIcons,\n showWeekNumbers = _d.showWeekNumbers,\n firstWeekOfYear = _d.firstWeekOfYear,\n dateTimeFormatter = _d.dateTimeFormatter,\n minDate = _d.minDate,\n maxDate = _d.maxDate,\n showCloseButton = _d.showCloseButton,\n allFocusable = _d.allFocusable;\n var dayPickerId = getId('DatePickerDay-dayPicker');\n var monthAndYearId = getId('DatePickerDay-monthAndYear');\n var leftNavigationIcon = navigationIcons.leftNavigation;\n var rightNavigationIcon = navigationIcons.rightNavigation;\n var closeNavigationIcon = navigationIcons.closeIcon;\n var weekNumbers = showWeekNumbers ? getWeekNumbersInMonth(weeks.length, firstDayOfWeek, firstWeekOfYear, navigatedDate) : null;\n var selectedDateWeekNumber = showWeekNumbers ? getWeekNumber(selectedDate, firstDayOfWeek, firstWeekOfYear) : undefined; // When the month is highlighted get the corner dates so that styles can be added to them\n\n var weekCorners = this._getWeekCornerStyles(weeks, dateRangeType); // determine if previous/next months are in bounds\n\n\n var prevMonthInBounds = minDate ? compareDatePart(minDate, getMonthStart(navigatedDate)) < 0 : true;\n var nextMonthInBounds = maxDate ? compareDatePart(getMonthEnd(navigatedDate), maxDate) < 0 : true;\n return React.createElement(\"div\", {\n className: css('ms-DatePicker-dayPicker', styles.dayPicker, showWeekNumbers && 'ms-DatePicker-showWeekNumbers' && (getRTL() ? styles.showWeekNumbersRTL : styles.showWeekNumbers)),\n id: dayPickerId\n }, React.createElement(\"div\", {\n className: css('ms-DatePicker-header', styles.header)\n }, React.createElement(\"div\", {\n \"aria-live\": \"polite\",\n \"aria-relevant\": \"text\",\n \"aria-atomic\": \"true\",\n id: monthAndYearId,\n className: styles.monthAndYear\n }, this.props.onHeaderSelect ? React.createElement(\"div\", {\n className: css('ms-DatePicker-monthAndYear js-showMonthPicker', styles.headerToggleView),\n onClick: this._onHeaderSelect,\n onKeyDown: this._onHeaderKeyDown,\n \"aria-label\": dateTimeFormatter.formatMonthYear(navigatedDate, strings),\n role: \"button\",\n tabIndex: 0\n }, dateTimeFormatter.formatMonthYear(navigatedDate, strings)) : React.createElement(\"div\", {\n className: css('ms-DatePicker-monthAndYear', styles.monthAndYear)\n }, dateTimeFormatter.formatMonthYear(navigatedDate, strings))), React.createElement(\"div\", {\n className: css('ms-DatePicker-monthComponents', styles.monthComponents)\n }, React.createElement(\"div\", {\n className: css('ms-DatePicker-navContainer', styles.navContainer)\n }, React.createElement(\"button\", {\n className: css('ms-DatePicker-prevMonth js-prevMonth', styles.prevMonth, (_a = {}, _a['ms-DatePicker-prevMonth--disabled ' + styles.prevMonthIsDisabled] = !prevMonthInBounds, _a)),\n disabled: !allFocusable && !prevMonthInBounds,\n \"aria-disabled\": !prevMonthInBounds,\n onClick: prevMonthInBounds ? this._onSelectPrevMonth : undefined,\n onKeyDown: prevMonthInBounds ? this._onPrevMonthKeyDown : undefined,\n \"aria-controls\": dayPickerId,\n title: strings.prevMonthAriaLabel ? strings.prevMonthAriaLabel + ' ' + strings.months[addMonths(navigatedDate, -1).getMonth()] : undefined,\n role: \"button\",\n type: \"button\"\n }, React.createElement(Icon, {\n iconName: leftNavigationIcon\n })), React.createElement(\"button\", {\n className: css('ms-DatePicker-nextMonth js-nextMonth', styles.nextMonth, (_b = {}, _b['ms-DatePicker-nextMonth--disabled ' + styles.nextMonthIsDisabled] = !nextMonthInBounds, _b)),\n disabled: !allFocusable && !nextMonthInBounds,\n \"aria-disabled\": !nextMonthInBounds,\n onClick: nextMonthInBounds ? this._onSelectNextMonth : undefined,\n onKeyDown: nextMonthInBounds ? this._onNextMonthKeyDown : undefined,\n \"aria-controls\": dayPickerId,\n title: strings.nextMonthAriaLabel ? strings.nextMonthAriaLabel + ' ' + strings.months[addMonths(navigatedDate, 1).getMonth()] : undefined,\n role: \"button\",\n type: \"button\"\n }, React.createElement(Icon, {\n iconName: rightNavigationIcon\n })), showCloseButton && React.createElement(\"button\", {\n className: css('ms-DatePicker-closeButton js-closeButton', styles.closeButton),\n onClick: this._onClose,\n onKeyDown: this._onCloseButtonKeyDown,\n title: strings.closeButtonAriaLabel,\n role: \"button\",\n type: \"button\"\n }, React.createElement(Icon, {\n iconName: closeNavigationIcon\n }))))), React.createElement(FocusZone, null, React.createElement(\"table\", {\n className: css('ms-DatePicker-table', styles.table),\n \"aria-readonly\": \"true\",\n \"aria-multiselectable\": \"false\",\n \"aria-labelledby\": monthAndYearId,\n \"aria-activedescendant\": activeDescendantId,\n role: \"grid\"\n }, React.createElement(\"thead\", null, React.createElement(\"tr\", null, showWeekNumbers && React.createElement(\"th\", {\n className: css('ms-DatePicker-weekday', styles.weekday)\n }), strings.shortDays.map(function (val, index) {\n return React.createElement(\"th\", {\n className: css('ms-DatePicker-weekday', styles.weekday),\n role: \"columnheader\",\n scope: \"col\",\n key: index,\n title: strings.days[(index + firstDayOfWeek) % DAYS_IN_WEEK],\n \"aria-label\": strings.days[(index + firstDayOfWeek) % DAYS_IN_WEEK],\n \"data-is-focusable\": allFocusable ? true : undefined\n }, strings.shortDays[(index + firstDayOfWeek) % DAYS_IN_WEEK]);\n }))), React.createElement(\"tbody\", {\n onMouseLeave: dateRangeType !== DateRangeType.Day ? this._onTableMouseLeave : undefined,\n onMouseUp: dateRangeType !== DateRangeType.Day ? this._onTableMouseUp : undefined\n }, weeks.map(function (week, weekIndex) {\n var _a;\n\n return React.createElement(\"tr\", {\n key: weekNumbers ? weekNumbers[weekIndex] : weekIndex\n }, showWeekNumbers && weekNumbers && React.createElement(\"th\", {\n className: css('ms-DatePicker-weekNumbers', 'ms-DatePicker-weekday', styles.weekday, styles.weekNumbers),\n key: weekIndex,\n title: weekNumbers && strings.weekNumberFormatString && format(strings.weekNumberFormatString, weekNumbers[weekIndex]),\n \"aria-label\": weekNumbers && strings.weekNumberFormatString && format(strings.weekNumberFormatString, weekNumbers[weekIndex]),\n scope: \"row\"\n }, React.createElement(\"div\", {\n className: css('ms-DatePicker-day', styles.day, (_a = {}, _a['ms-DatePicker-week--highlighted ' + styles.weekIsHighlighted] = selectedDateWeekNumber === weekNumbers[weekIndex], _a))\n }, React.createElement(\"span\", null, weekNumbers[weekIndex]))), week.map(function (day, dayIndex) {\n var _a, _b;\n\n var isNavigatedDate = compareDates(navigatedDate, day.originalDate);\n return React.createElement(\"td\", {\n key: day.key,\n onClick: day.isInBounds ? day.onSelected : undefined,\n className: css(styles.dayWrapper, 'ms-DatePicker-day', _this._getHighlightedCornerStyle(weekCorners, dayIndex, weekIndex), (_a = {}, _a['ms-DatePicker-weekBackground ' + styles.weekBackground] = day.isSelected && (dateRangeType === DateRangeType.Week || dateRangeType === DateRangeType.WorkWeek), _a['ms-DatePicker-dayBackground ' + styles.dayBackground] = dateRangeType === DateRangeType.Day, _a['ms-DatePicker-day--highlighted ' + styles.dayIsHighlighted] = day.isSelected && dateRangeType === DateRangeType.Day, _a['ms-DatePicker-day--infocus ' + styles.dayIsFocused] = day.isInBounds && day.isInMonth, _a['ms-DatePicker-day--outfocus ' + styles.dayIsUnfocused] = day.isInBounds && !day.isInMonth, _a[styles.daySelection] = dateRangeType === DateRangeType.Day, _a[styles.weekSelection] = dateRangeType === DateRangeType.Week || dateRangeType === DateRangeType.WorkWeek, _a[styles.monthSelection] = dateRangeType === DateRangeType.Month, _a)),\n ref: function ref(element) {\n return _this._setDayCellRef(element, day, isNavigatedDate);\n },\n onMouseOver: dateRangeType !== DateRangeType.Day && day.isInBounds ? _this._onDayMouseOver(day.originalDate, weekIndex, dayIndex, dateRangeType) : undefined,\n onMouseLeave: dateRangeType !== DateRangeType.Day && day.isInBounds ? _this._onDayMouseLeave(day.originalDate, weekIndex, dayIndex, dateRangeType) : undefined,\n onMouseDown: dateRangeType !== DateRangeType.Day && day.isInBounds ? _this._onDayMouseDown(day.originalDate, weekIndex, dayIndex, dateRangeType) : undefined,\n onMouseUp: dateRangeType !== DateRangeType.Day && day.isInBounds ? _this._onDayMouseUp(day.originalDate, weekIndex, dayIndex, dateRangeType) : undefined,\n role: 'presentation'\n }, React.createElement(\"button\", {\n key: day.key + 'button',\n onClick: day.isInBounds ? day.onSelected : undefined,\n className: css(styles.day, 'ms-DatePicker-day-button', (_b = {}, _b['ms-DatePicker-day--disabled ' + styles.dayIsDisabled] = !day.isInBounds, _b['ms-DatePicker-day--today ' + styles.dayIsToday] = day.isToday, _b)),\n onKeyDown: _this._onDayKeyDown(day.originalDate, weekIndex, dayIndex),\n \"aria-label\": dateTimeFormatter.formatMonthDayYear(day.originalDate, strings),\n id: isNavigatedDate ? activeDescendantId : undefined,\n \"aria-readonly\": true,\n \"aria-current\": day.isToday ? 'date' : undefined,\n \"aria-selected\": day.isInBounds ? day.isSelected : undefined,\n \"data-is-focusable\": allFocusable || (day.isInBounds ? true : undefined),\n ref: function ref(element) {\n return _this._setDayRef(element, day, isNavigatedDate);\n },\n disabled: !allFocusable && !day.isInBounds,\n \"aria-disabled\": !day.isInBounds,\n type: \"button\",\n role: 'gridcell'\n }, React.createElement(\"span\", {\n \"aria-hidden\": \"true\"\n }, dateTimeFormatter.formatDay(day.originalDate))));\n }));\n })))));\n };\n\n CalendarDay.prototype.focus = function () {\n if (this.navigatedDay) {\n this.navigatedDay.tabIndex = 0;\n this.navigatedDay.focus();\n }\n };\n\n CalendarDay.prototype._setDayRef = function (element, day, isNavigatedDate) {\n if (isNavigatedDate) {\n this.navigatedDay = element;\n }\n };\n\n CalendarDay.prototype._setDayCellRef = function (element, day, isNavigatedDate) {\n this.days[day.key] = element;\n };\n\n CalendarDay.prototype._getWeekCornerStyles = function (weeks, dateRangeType) {\n var _this = this;\n\n var weekCornersStyled = {};\n\n switch (dateRangeType) {\n case DateRangeType.Month:\n /* need to handle setting all of the corners on arbitrarily shaped blobs\n __\n __|A |\n |B |C |__\n |D |E |F |\n in this case, A needs top left rounded, top right rounded\n B needs top left rounded\n C doesn't need any rounding\n D needs bottom left rounded\n E doesn't need any rounding\n F needs top right rounding\n */\n // if there's an item above, lose both top corners. Item below, lose both bottom corners, etc.\n weeks.forEach(function (week, weekIndex) {\n week.forEach(function (day, dayIndex) {\n var above = weeks[weekIndex - 1] && weeks[weekIndex - 1][dayIndex] && weeks[weekIndex - 1][dayIndex].originalDate.getMonth() === weeks[weekIndex][dayIndex].originalDate.getMonth();\n var below = weeks[weekIndex + 1] && weeks[weekIndex + 1][dayIndex] && weeks[weekIndex + 1][dayIndex].originalDate.getMonth() === weeks[weekIndex][dayIndex].originalDate.getMonth();\n var left = weeks[weekIndex][dayIndex - 1] && weeks[weekIndex][dayIndex - 1].originalDate.getMonth() === weeks[weekIndex][dayIndex].originalDate.getMonth();\n var right = weeks[weekIndex][dayIndex + 1] && weeks[weekIndex][dayIndex + 1].originalDate.getMonth() === weeks[weekIndex][dayIndex].originalDate.getMonth();\n var roundedTopLeft = !above && !left;\n var roundedTopRight = !above && !right;\n var roundedBottomLeft = !below && !left;\n var roundedBottomRight = !below && !right;\n var style = '';\n\n if (roundedTopLeft) {\n style = getRTL() ? style.concat(styles.topRightCornerDate + ' ') : style.concat(styles.topLeftCornerDate + ' ');\n }\n\n if (roundedTopRight) {\n style = getRTL() ? style.concat(styles.topLeftCornerDate + ' ') : style.concat(styles.topRightCornerDate + ' ');\n }\n\n if (roundedBottomLeft) {\n style = getRTL() ? style.concat(styles.bottomRightCornerDate + ' ') : style.concat(styles.bottomLeftCornerDate + ' ');\n }\n\n if (roundedBottomRight) {\n style = getRTL() ? style.concat(styles.bottomLeftCornerDate + ' ') : style.concat(styles.bottomRightCornerDate + ' ');\n }\n\n if (!above) {\n style = style.concat(styles.topDate + ' ');\n }\n\n if (!below) {\n style = style.concat(styles.bottomDate + ' ');\n }\n\n if (!right) {\n style = style.concat(styles.rightDate + ' ');\n }\n\n if (!left) {\n style = style.concat(styles.leftdate + ' ');\n }\n\n weekCornersStyled[weekIndex + '_' + dayIndex] = style;\n });\n });\n break;\n\n case DateRangeType.Week:\n case DateRangeType.WorkWeek:\n weeks.forEach(function (week, weekIndex) {\n var minIndex = findIndex(week, function (item) {\n return item.isInBounds;\n });\n\n var maxIndex = _this._findLastIndex(week, function (item) {\n return item.isInBounds;\n });\n\n var leftStyle = styles.topLeftCornerDate + ' ' + styles.bottomLeftCornerDate;\n var rightStyle = styles.topRightCornerDate + ' ' + styles.bottomRightCornerDate;\n weekCornersStyled[weekIndex + '_' + minIndex] = getRTL() ? rightStyle : leftStyle;\n weekCornersStyled[weekIndex + '_' + maxIndex] = getRTL() ? leftStyle : rightStyle;\n });\n break;\n }\n\n return weekCornersStyled;\n };\n\n CalendarDay.prototype._getHighlightedCornerStyle = function (weekCorners, dayIndex, weekIndex) {\n var cornerStyle = weekCorners[weekIndex + '_' + dayIndex] ? weekCorners[weekIndex + '_' + dayIndex] : '';\n return cornerStyle;\n };\n\n CalendarDay.prototype._navigateMonthEdge = function (ev, date, weekIndex, dayIndex) {\n var _a = this.props,\n minDate = _a.minDate,\n maxDate = _a.maxDate;\n var targetDate = undefined;\n\n if (weekIndex === 0 && ev.which === KeyCodes.up) {\n targetDate = addWeeks(date, -1);\n } else if (weekIndex === this.state.weeks.length - 1 && ev.which === KeyCodes.down) {\n targetDate = addWeeks(date, 1);\n } else if (dayIndex === 0 && ev.which === getRTLSafeKeyCode(KeyCodes.left)) {\n targetDate = addDays(date, -1);\n } else if (dayIndex === DAYS_IN_WEEK - 1 && ev.which === getRTLSafeKeyCode(KeyCodes.right)) {\n targetDate = addDays(date, 1);\n } // Don't navigate to out-of-bounds date\n\n\n if (targetDate && (minDate ? compareDatePart(minDate, targetDate) < 1 : true) && (maxDate ? compareDatePart(targetDate, maxDate) < 1 : true)) {\n this.props.onNavigateDate(targetDate, true);\n ev.preventDefault();\n }\n };\n\n CalendarDay.prototype._applyFunctionToDayRefs = function (func) {\n var _this = this;\n\n if (this.state.weeks) {\n this.state.weeks.forEach(function (week, weekIndex) {\n week.forEach(function (day) {\n var ref = _this.days[day.key];\n func(ref, day, weekIndex);\n });\n });\n }\n };\n\n CalendarDay.prototype._getWeeks = function (propsToUse) {\n var navigatedDate = propsToUse.navigatedDate,\n selectedDate = propsToUse.selectedDate,\n dateRangeType = propsToUse.dateRangeType,\n firstDayOfWeek = propsToUse.firstDayOfWeek,\n today = propsToUse.today,\n minDate = propsToUse.minDate,\n maxDate = propsToUse.maxDate,\n showSixWeeksByDefault = propsToUse.showSixWeeksByDefault,\n workWeekDays = propsToUse.workWeekDays;\n var date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), 1);\n var todaysDate = today || new Date();\n var weeks = []; // Cycle the date backwards to get to the first day of the week.\n\n while (date.getDay() !== firstDayOfWeek) {\n date.setDate(date.getDate() - 1);\n } // a flag to indicate whether all days of the week are in the month\n\n\n var isAllDaysOfWeekOutOfMonth = false; // in work week view we want to select the whole week\n\n var selectedDateRangeType = dateRangeType === DateRangeType.WorkWeek ? DateRangeType.Week : dateRangeType;\n var selectedDates = getDateRangeArray(selectedDate, selectedDateRangeType, firstDayOfWeek, workWeekDays);\n\n if (dateRangeType !== DateRangeType.Day) {\n selectedDates = this._getBoundedDateRange(selectedDates, minDate, maxDate);\n }\n\n var shouldGetWeeks = true;\n\n for (var weekIndex = 0; shouldGetWeeks; weekIndex++) {\n var week = [];\n isAllDaysOfWeekOutOfMonth = true;\n\n for (var dayIndex = 0; dayIndex < DAYS_IN_WEEK; dayIndex++) {\n // Casting date parameter as an any to avoid [ object Object ] error.\n var originalDate = new Date(date);\n var dayInfo = {\n key: date.toString(),\n date: date.getDate().toString(),\n originalDate: originalDate,\n isInMonth: date.getMonth() === navigatedDate.getMonth(),\n isToday: compareDates(todaysDate, date),\n isSelected: isInDateRangeArray(date, selectedDates),\n onSelected: this._onSelectDate.bind(this, originalDate),\n isInBounds: (minDate ? compareDatePart(minDate, date) < 1 : true) && (maxDate ? compareDatePart(date, maxDate) < 1 : true) && !this._getIsRestrictedDate(date)\n };\n week.push(dayInfo);\n\n if (dayInfo.isInMonth) {\n isAllDaysOfWeekOutOfMonth = false;\n }\n\n date.setDate(date.getDate() + 1);\n } // We append the condition of the loop depending upon the showSixWeeksByDefault prop.\n\n\n shouldGetWeeks = showSixWeeksByDefault ? !isAllDaysOfWeekOutOfMonth || weekIndex <= 5 : !isAllDaysOfWeekOutOfMonth;\n\n if (shouldGetWeeks) {\n weeks.push(week);\n }\n }\n\n return weeks;\n };\n\n CalendarDay.prototype._getIsRestrictedDate = function (date) {\n var restrictedDates = this.props.restrictedDates;\n\n if (!restrictedDates) {\n return false;\n }\n\n var restrictedDate = find(restrictedDates, function (rd) {\n return compareDates(rd, date);\n });\n return restrictedDate ? true : false;\n };\n\n CalendarDay.prototype._getBoundedDateRange = function (dateRange, minDate, maxDate) {\n var boundedDateRange = __spreadArrays(dateRange);\n\n if (minDate) {\n boundedDateRange = boundedDateRange.filter(function (date) {\n return compareDatePart(date, minDate) >= 0;\n });\n }\n\n if (maxDate) {\n boundedDateRange = boundedDateRange.filter(function (date) {\n return compareDatePart(date, maxDate) <= 0;\n });\n }\n\n return boundedDateRange;\n };\n /**\n * Returns the index of the last element in the array where the predicate is true, and -1\n * otherwise\n * @param items Array of items to be iterated over using the predicate\n * @param predicate find calls predicate once for each element of the array, in descending\n * order, until it finds one where predicate returns true if such an element is found.\n */\n\n\n CalendarDay.prototype._findLastIndex = function (items, predicate) {\n for (var i = items.length - 1; i >= 0; i--) {\n var item = items[i];\n\n if (predicate(item)) {\n return i;\n }\n }\n\n return -1;\n };\n\n return CalendarDay;\n}(React.Component);\n\nexport { CalendarDay };","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { KeyCodes, css, getRTL, format } from '../../Utilities';\nimport { FocusZone } from '../../FocusZone';\nimport * as stylesImport from './Calendar.scss';\nimport { Icon } from '../../Icon';\nvar styles = stylesImport;\nvar CELL_COUNT = 12;\nvar DefaultCalendarYearStrings = {\n prevRangeAriaLabel: undefined,\n nextRangeAriaLabel: undefined\n};\nvar DefaultNavigationIcons = {\n leftNavigation: 'Up',\n rightNavigation: 'Down',\n closeIcon: 'CalculatorMultiply'\n};\n\nvar CalendarYearGridCell =\n/** @class */\nfunction (_super) {\n __extends(CalendarYearGridCell, _super);\n\n function CalendarYearGridCell() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this._buttonRef = React.createRef();\n\n _this._onRenderYear = function () {\n var _a = _this.props,\n year = _a.year,\n onRenderYear = _a.onRenderYear;\n\n if (onRenderYear) {\n return onRenderYear(year);\n }\n\n return year;\n };\n\n _this._onClick = function () {\n if (_this.props.onSelectYear) {\n _this.props.onSelectYear(_this.props.year);\n }\n };\n\n _this._onKeyDown = function (ev) {\n if (_this.props.onSelectYear && ev.which === KeyCodes.enter) {\n _this.props.onSelectYear(_this.props.year);\n }\n };\n\n return _this;\n }\n\n CalendarYearGridCell.prototype.focus = function () {\n if (this._buttonRef.current) {\n this._buttonRef.current.focus();\n }\n };\n\n CalendarYearGridCell.prototype.render = function () {\n var _a;\n\n var _b = this.props,\n year = _b.year,\n selected = _b.selected,\n disabled = _b.disabled,\n onSelectYear = _b.onSelectYear;\n return React.createElement(\"button\", {\n className: css('ms-DatePicker-yearOption', styles.yearOption, (_a = {}, _a['ms-DatePicker-day--highlighted ' + styles.yearIsHighlighted] = selected, _a['ms-DatePicker-yearOption--disabled ' + styles.yearOptionIsDisabled] = disabled, _a)),\n type: \"button\",\n role: \"gridcell\",\n onClick: !disabled && onSelectYear ? this._onClick : undefined,\n onKeyDown: !disabled && onSelectYear ? this._onKeyDown : undefined,\n disabled: disabled,\n \"aria-label\": String(year),\n \"aria-selected\": selected,\n ref: this._buttonRef\n }, this._onRenderYear());\n };\n\n return CalendarYearGridCell;\n}(React.Component);\n\nvar CalendarYearGrid =\n/** @class */\nfunction (_super) {\n __extends(CalendarYearGrid, _super);\n\n function CalendarYearGrid() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this._selectedCellRef = React.createRef();\n _this._currentCellRef = React.createRef();\n\n _this._renderCell = function (year) {\n var selected = year === _this.props.selectedYear;\n var _a = _this.props,\n minYear = _a.minYear,\n maxYear = _a.maxYear,\n onSelectYear = _a.onSelectYear;\n var disabled = minYear !== undefined && year < minYear || maxYear !== undefined && year > maxYear;\n var current = year === new Date().getFullYear();\n return React.createElement(CalendarYearGridCell, {\n key: year,\n year: year,\n selected: selected,\n current: current,\n disabled: disabled,\n onSelectYear: onSelectYear,\n ref: selected ? _this._selectedCellRef : current ? _this._currentCellRef : undefined\n });\n };\n\n return _this;\n }\n\n CalendarYearGrid.prototype.focus = function () {\n if (this._selectedCellRef.current) {\n this._selectedCellRef.current.focus();\n } else if (this._currentCellRef.current) {\n this._currentCellRef.current.focus();\n }\n };\n\n CalendarYearGrid.prototype.render = function () {\n var _a = this.props,\n fromYear = _a.fromYear,\n toYear = _a.toYear;\n var year = fromYear;\n var cells = [];\n\n while (year <= toYear) {\n cells.push(this._renderCell(year));\n year++;\n }\n\n return React.createElement(FocusZone, null, React.createElement(\"div\", {\n className: css('ms-DatePicker-optionGrid', styles.optionGrid),\n role: \"grid\"\n }, React.createElement(\"div\", {\n role: \"row\"\n }, cells)));\n };\n\n return CalendarYearGrid;\n}(React.Component);\n\nvar CalendarYearNavPrev =\n/** @class */\nfunction (_super) {\n __extends(CalendarYearNavPrev, _super);\n\n function CalendarYearNavPrev() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this._onSelectPrev = function () {\n if (!_this.isDisabled && _this.props.onSelectPrev) {\n _this.props.onSelectPrev();\n }\n };\n\n _this._onKeyDown = function (ev) {\n if (ev.which === KeyCodes.enter) {\n _this._onSelectPrev();\n }\n };\n\n return _this;\n }\n\n CalendarYearNavPrev.prototype.render = function () {\n var _a;\n\n var iconStrings = this.props.navigationIcons || DefaultNavigationIcons;\n var strings = this.props.strings || DefaultCalendarYearStrings;\n var prevRangeAriaLabel = strings.prevRangeAriaLabel;\n var prevRange = {\n fromYear: this.props.fromYear - CELL_COUNT,\n toYear: this.props.toYear - CELL_COUNT\n };\n var prevAriaLabel = prevRangeAriaLabel ? typeof prevRangeAriaLabel === 'string' ? prevRangeAriaLabel : prevRangeAriaLabel(prevRange) : undefined;\n var disabled = this.isDisabled;\n var onSelectPrev = this.props.onSelectPrev;\n return React.createElement(\"button\", {\n className: css('ms-DatePicker-prevDecade', styles.prevDecade, (_a = {}, _a['ms-DatePicker-prevDecade--disabled ' + styles.prevDecadeIsDisabled] = disabled, _a)),\n onClick: !disabled && onSelectPrev ? this._onSelectPrev : undefined,\n onKeyDown: !disabled && onSelectPrev ? this._onKeyDown : undefined,\n type: \"button\",\n tabIndex: 0,\n title: prevAriaLabel,\n disabled: disabled\n }, React.createElement(Icon, {\n iconName: getRTL() ? iconStrings.rightNavigation : iconStrings.leftNavigation\n }));\n };\n\n Object.defineProperty(CalendarYearNavPrev.prototype, \"isDisabled\", {\n get: function get() {\n var minYear = this.props.minYear;\n return minYear !== undefined && this.props.fromYear < minYear;\n },\n enumerable: true,\n configurable: true\n });\n return CalendarYearNavPrev;\n}(React.Component);\n\nvar CalendarYearNavNext =\n/** @class */\nfunction (_super) {\n __extends(CalendarYearNavNext, _super);\n\n function CalendarYearNavNext() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this._onSelectNext = function () {\n if (!_this.isDisabled && _this.props.onSelectNext) {\n _this.props.onSelectNext();\n }\n };\n\n _this._onKeyDown = function (ev) {\n if (ev.which === KeyCodes.enter) {\n _this._onSelectNext();\n }\n };\n\n return _this;\n }\n\n CalendarYearNavNext.prototype.render = function () {\n var _a;\n\n var iconStrings = this.props.navigationIcons || DefaultNavigationIcons;\n var strings = this.props.strings || DefaultCalendarYearStrings;\n var nextRangeAriaLabel = strings.nextRangeAriaLabel;\n var nextRange = {\n fromYear: this.props.fromYear + CELL_COUNT,\n toYear: this.props.toYear + CELL_COUNT\n };\n var nextAriaLabel = nextRangeAriaLabel ? typeof nextRangeAriaLabel === 'string' ? nextRangeAriaLabel : nextRangeAriaLabel(nextRange) : undefined;\n var onSelectNext = this.props.onSelectNext;\n var disabled = this.isDisabled;\n return React.createElement(\"button\", {\n className: css('ms-DatePicker-nextDecade', styles.nextDecade, (_a = {}, _a['ms-DatePicker-nextDecade--disabled ' + styles.nextDecadeIsDisabled] = disabled, _a)),\n onClick: !disabled && onSelectNext ? this._onSelectNext : undefined,\n onKeyDown: !disabled && onSelectNext ? this._onKeyDown : undefined,\n type: \"button\",\n tabIndex: 0,\n title: nextAriaLabel,\n disabled: this.isDisabled\n }, React.createElement(Icon, {\n iconName: getRTL() ? iconStrings.leftNavigation : iconStrings.rightNavigation\n }));\n };\n\n Object.defineProperty(CalendarYearNavNext.prototype, \"isDisabled\", {\n get: function get() {\n var maxYear = this.props.maxYear;\n return maxYear !== undefined && this.props.fromYear + CELL_COUNT > maxYear;\n },\n enumerable: true,\n configurable: true\n });\n return CalendarYearNavNext;\n}(React.Component);\n\nvar CalendarYearNav =\n/** @class */\nfunction (_super) {\n __extends(CalendarYearNav, _super);\n\n function CalendarYearNav() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n CalendarYearNav.prototype.render = function () {\n return React.createElement(\"div\", {\n className: css('ms-DatePicker-decadeComponents', styles.decadeComponents)\n }, React.createElement(\"div\", {\n className: css('ms-DatePicker-navContainer', styles.navContainer)\n }, React.createElement(CalendarYearNavPrev, __assign({}, this.props)), React.createElement(CalendarYearNavNext, __assign({}, this.props))));\n };\n\n return CalendarYearNav;\n}(React.Component);\n\nvar CalendarYearTitle =\n/** @class */\nfunction (_super) {\n __extends(CalendarYearTitle, _super);\n\n function CalendarYearTitle() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this._onHeaderSelect = function () {\n if (_this.props.onHeaderSelect) {\n _this.props.onHeaderSelect(true);\n }\n };\n\n _this._onHeaderKeyDown = function (ev) {\n if (_this.props.onHeaderSelect && (ev.which === KeyCodes.enter || ev.which === KeyCodes.space)) {\n _this.props.onHeaderSelect(true);\n }\n };\n\n _this._onRenderYear = function (year) {\n if (_this.props.onRenderYear) {\n return _this.props.onRenderYear(year);\n }\n\n return year;\n };\n\n return _this;\n }\n\n CalendarYearTitle.prototype.render = function () {\n var _a = this.props,\n fromYear = _a.fromYear,\n toYear = _a.toYear,\n onHeaderSelect = _a.onHeaderSelect;\n\n if (onHeaderSelect) {\n var strings = this.props.strings || DefaultCalendarYearStrings;\n var rangeAriaLabel = strings.rangeAriaLabel;\n var currentDateRange = rangeAriaLabel ? typeof rangeAriaLabel === 'string' ? rangeAriaLabel : rangeAriaLabel(this.props) : undefined;\n var ariaLabel = strings.headerAriaLabelFormatString ? format(strings.headerAriaLabelFormatString, currentDateRange) : currentDateRange;\n return React.createElement(\"div\", {\n className: css('ms-DatePicker-currentDecade js-showYearPicker', styles.currentDecade, styles.headerToggleView),\n onClick: this._onHeaderSelect,\n onKeyDown: this._onHeaderKeyDown,\n \"aria-label\": ariaLabel,\n role: \"button\",\n \"aria-atomic\": true,\n \"aria-live\": \"polite\",\n tabIndex: 0\n }, this._onRenderYear(fromYear), \" - \", this._onRenderYear(toYear));\n }\n\n return React.createElement(\"div\", {\n className: css('ms-DatePicker-currentDecade js-showYearPicker', styles.currentDecade)\n }, this._onRenderYear(fromYear), \" - \", this._onRenderYear(toYear));\n };\n\n return CalendarYearTitle;\n}(React.Component);\n\nvar CalendarYearHeader =\n/** @class */\nfunction (_super) {\n __extends(CalendarYearHeader, _super);\n\n function CalendarYearHeader() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this._onRenderTitle = function () {\n if (_this.props.onRenderTitle) {\n return _this.props.onRenderTitle(_this.props);\n }\n\n return React.createElement(CalendarYearTitle, __assign({}, _this.props));\n };\n\n _this._onRenderNav = function () {\n return React.createElement(CalendarYearNav, __assign({}, _this.props));\n };\n\n return _this;\n }\n\n CalendarYearHeader.prototype.render = function () {\n return React.createElement(\"div\", {\n className: css('ms-DatePicker-header', styles.header)\n }, this._onRenderTitle(), this._onRenderNav());\n };\n\n return CalendarYearHeader;\n}(React.Component);\n\nvar CalendarYear =\n/** @class */\nfunction (_super) {\n __extends(CalendarYear, _super);\n\n function CalendarYear(props) {\n var _this = _super.call(this, props) || this;\n\n _this._gridRef = React.createRef();\n\n _this._onNavNext = function () {\n _this.setState({\n fromYear: _this.state.fromYear + CELL_COUNT\n });\n };\n\n _this._onNavPrev = function () {\n _this.setState({\n fromYear: _this.state.fromYear - CELL_COUNT\n });\n };\n\n _this._renderHeader = function () {\n return React.createElement(CalendarYearHeader, __assign({}, _this.props, {\n fromYear: _this.state.fromYear,\n toYear: _this.state.fromYear + CELL_COUNT - 1,\n onSelectPrev: _this._onNavPrev,\n onSelectNext: _this._onNavNext\n }));\n };\n\n _this._renderGrid = function () {\n return React.createElement(CalendarYearGrid, __assign({}, _this.props, {\n fromYear: _this.state.fromYear,\n toYear: _this.state.fromYear + CELL_COUNT - 1,\n ref: _this._gridRef\n }));\n };\n\n _this.state = _this._calculateInitialStateFromProps(props);\n return _this;\n }\n\n CalendarYear.prototype.focus = function () {\n if (this._gridRef.current) {\n this._gridRef.current.focus();\n }\n };\n\n CalendarYear.prototype.render = function () {\n return React.createElement(\"div\", {\n className: css('ms-DatePicker-yearPicker', styles.yearPicker)\n }, this._renderHeader(), this._renderGrid());\n };\n\n CalendarYear.prototype._calculateInitialStateFromProps = function (props) {\n var selectedYear = props.selectedYear,\n navigatedYear = props.navigatedYear;\n var rangeYear = selectedYear || navigatedYear || new Date().getFullYear();\n var fromYear = Math.floor(rangeYear / 10) * 10;\n return {\n fromYear: fromYear,\n navigatedYear: navigatedYear,\n selectedYear: selectedYear\n };\n };\n\n return CalendarYear;\n}(React.Component);\n\nexport { CalendarYear };","import { __extends } from \"tslib\";\nimport * as React from 'react';\nimport { KeyCodes, css, getRTL, initializeComponentRef, format } from '../../Utilities';\nimport { FocusZone } from '../../FocusZone';\nimport { addYears, setMonth, getYearStart, getYearEnd, getMonthStart, getMonthEnd, compareDatePart } from '../../utilities/dateMath/DateMath';\nimport { Icon } from '../../Icon';\nimport * as stylesImport from './Calendar.scss';\nimport { CalendarYear } from './CalendarYear';\nvar styles = stylesImport;\nvar MONTHS_PER_ROW = 4;\n\nvar CalendarMonth =\n/** @class */\nfunction (_super) {\n __extends(CalendarMonth, _super);\n\n function CalendarMonth(props) {\n var _this = _super.call(this, props) || this;\n\n _this._navigatedMonthRef = React.createRef();\n\n _this._onCalendarYearRef = function (ref) {\n _this._calendarYearRef = ref;\n };\n\n _this._onKeyDown = function (callback, ev) {\n if (ev.which === KeyCodes.enter) {\n callback();\n }\n };\n\n _this._onSelectYear = function (selectedYear) {\n _this._focusOnUpdate = true;\n var _a = _this.props,\n navigatedDate = _a.navigatedDate,\n onNavigateDate = _a.onNavigateDate,\n maxDate = _a.maxDate,\n minDate = _a.minDate;\n var navYear = navigatedDate.getFullYear();\n\n if (navYear !== selectedYear) {\n var newNavigationDate = new Date(navigatedDate.getTime());\n newNavigationDate.setFullYear(selectedYear); // for min and max dates, adjust the new navigation date - perhaps this should be\n // checked on the master navigation date handler (i.e. in Calendar)\n\n if (maxDate && newNavigationDate > maxDate) {\n newNavigationDate = setMonth(newNavigationDate, maxDate.getMonth());\n } else if (minDate && newNavigationDate < minDate) {\n newNavigationDate = setMonth(newNavigationDate, minDate.getMonth());\n }\n\n onNavigateDate(newNavigationDate, true);\n }\n\n _this.setState({\n isYearPickerVisible: false\n });\n };\n\n _this._yearToString = function (year) {\n var _a = _this.props,\n navigatedDate = _a.navigatedDate,\n dateTimeFormatter = _a.dateTimeFormatter;\n\n if (dateTimeFormatter) {\n // create a date based on the current nav date\n var yearFormattingDate = new Date(navigatedDate.getTime());\n yearFormattingDate.setFullYear(year);\n return dateTimeFormatter.formatYear(yearFormattingDate);\n }\n\n return String(year);\n };\n\n _this._yearRangeToString = function (yearRange) {\n return _this._yearToString(yearRange.fromYear) + \" - \" + _this._yearToString(yearRange.toYear);\n };\n\n _this._yearRangeToNextDecadeLabel = function (yearRange) {\n var strings = _this.props.strings;\n return strings.nextYearRangeAriaLabel ? strings.nextYearRangeAriaLabel + \" \" + _this._yearRangeToString(yearRange) : '';\n };\n\n _this._yearRangeToPrevDecadeLabel = function (yearRange) {\n var strings = _this.props.strings;\n return strings.prevYearRangeAriaLabel ? strings.prevYearRangeAriaLabel + \" \" + _this._yearRangeToString(yearRange) : '';\n };\n\n _this._onRenderYear = function (year) {\n return _this._yearToString(year);\n };\n\n _this._onSelectNextYear = function () {\n var _a = _this.props,\n navigatedDate = _a.navigatedDate,\n onNavigateDate = _a.onNavigateDate;\n onNavigateDate(addYears(navigatedDate, 1), false);\n };\n\n _this._onSelectNextYearKeyDown = function (ev) {\n if (ev.which === KeyCodes.enter) {\n _this._onKeyDown(_this._onSelectNextYear, ev);\n }\n };\n\n _this._onSelectPrevYear = function () {\n var _a = _this.props,\n navigatedDate = _a.navigatedDate,\n onNavigateDate = _a.onNavigateDate;\n onNavigateDate(addYears(navigatedDate, -1), false);\n };\n\n _this._onSelectPrevYearKeyDown = function (ev) {\n if (ev.which === KeyCodes.enter) {\n _this._onKeyDown(_this._onSelectPrevYear, ev);\n }\n };\n\n _this._onSelectMonthKeyDown = function (index) {\n return function (ev) {\n return _this._onKeyDown(function () {\n return _this._onSelectMonth(index);\n }, ev);\n };\n };\n\n _this._onSelectMonth = function (newMonth) {\n var _a = _this.props,\n navigatedDate = _a.navigatedDate,\n onNavigateDate = _a.onNavigateDate,\n onHeaderSelect = _a.onHeaderSelect; // If header is clickable the calendars are overlayed, switch back to day picker when month is clicked\n\n if (onHeaderSelect) {\n onHeaderSelect(true);\n }\n\n onNavigateDate(setMonth(navigatedDate, newMonth), true);\n };\n\n _this._onHeaderSelect = function () {\n var _a = _this.props,\n onHeaderSelect = _a.onHeaderSelect,\n yearPickerHidden = _a.yearPickerHidden;\n\n if (!yearPickerHidden) {\n _this._focusOnUpdate = true;\n\n _this.setState({\n isYearPickerVisible: true\n });\n } else if (onHeaderSelect) {\n onHeaderSelect(true);\n }\n };\n\n _this._onYearPickerHeaderSelect = function (focus) {\n _this._focusOnUpdate = focus;\n\n _this.setState({\n isYearPickerVisible: false\n });\n };\n\n _this._onHeaderKeyDown = function (ev) {\n if (_this._onHeaderSelect && (ev.which === KeyCodes.enter || ev.which === KeyCodes.space)) {\n _this._onHeaderSelect();\n }\n };\n\n initializeComponentRef(_this);\n _this._selectMonthCallbacks = [];\n props.strings.shortMonths.forEach(function (month, index) {\n _this._selectMonthCallbacks[index] = _this._onSelectMonth.bind(_this, index);\n });\n _this._isCurrentMonth = _this._isCurrentMonth.bind(_this);\n _this._onSelectNextYear = _this._onSelectNextYear.bind(_this);\n _this._onSelectPrevYear = _this._onSelectPrevYear.bind(_this);\n _this._onSelectMonth = _this._onSelectMonth.bind(_this);\n _this.state = {\n isYearPickerVisible: false\n };\n return _this;\n }\n\n CalendarMonth.prototype.componentDidUpdate = function () {\n if (this._focusOnUpdate) {\n this.focus();\n this._focusOnUpdate = false;\n }\n };\n\n CalendarMonth.prototype.render = function () {\n var _a, _b;\n\n var _this = this;\n\n var _c = this.props,\n navigatedDate = _c.navigatedDate,\n selectedDate = _c.selectedDate,\n strings = _c.strings,\n today = _c.today,\n highlightCurrentMonth = _c.highlightCurrentMonth,\n highlightSelectedMonth = _c.highlightSelectedMonth,\n navigationIcons = _c.navigationIcons,\n dateTimeFormatter = _c.dateTimeFormatter,\n minDate = _c.minDate,\n maxDate = _c.maxDate,\n yearPickerHidden = _c.yearPickerHidden;\n\n if (this.state.isYearPickerVisible) {\n // default the year picker to the current navigated date\n var currentSelectedDate = navigatedDate ? navigatedDate.getFullYear() : undefined;\n return React.createElement(CalendarYear, {\n key: 'calendarYear_' + (currentSelectedDate && currentSelectedDate.toString()),\n minYear: minDate ? minDate.getFullYear() : undefined,\n maxYear: maxDate ? maxDate.getFullYear() : undefined,\n onSelectYear: this._onSelectYear,\n navigationIcons: navigationIcons,\n onHeaderSelect: this._onYearPickerHeaderSelect,\n selectedYear: currentSelectedDate,\n onRenderYear: this._onRenderYear,\n strings: {\n rangeAriaLabel: this._yearRangeToString,\n prevRangeAriaLabel: this._yearRangeToPrevDecadeLabel,\n nextRangeAriaLabel: this._yearRangeToNextDecadeLabel,\n headerAriaLabelFormatString: strings.yearPickerHeaderAriaLabel\n },\n ref: this._onCalendarYearRef\n });\n }\n\n var rowIndexes = [];\n\n for (var i = 0; i < strings.shortMonths.length / MONTHS_PER_ROW; i++) {\n rowIndexes.push(i);\n }\n\n var leftNavigationIcon = navigationIcons.leftNavigation;\n var rightNavigationIcon = navigationIcons.rightNavigation; // determine if previous/next years are in bounds\n\n var isPrevYearInBounds = minDate ? compareDatePart(minDate, getYearStart(navigatedDate)) < 0 : true;\n var isNextYearInBounds = maxDate ? compareDatePart(getYearEnd(navigatedDate), maxDate) < 0 : true;\n var yearString = dateTimeFormatter.formatYear(navigatedDate);\n var headerAriaLabel = strings.monthPickerHeaderAriaLabel ? format(strings.monthPickerHeaderAriaLabel, yearString) : yearString;\n return React.createElement(\"div\", {\n className: css('ms-DatePicker-monthPicker', styles.monthPicker)\n }, React.createElement(\"div\", {\n className: css('ms-DatePicker-header', styles.header)\n }, this.props.onHeaderSelect || !yearPickerHidden ? React.createElement(\"div\", {\n className: css('ms-DatePicker-currentYear js-showYearPicker', styles.currentYear, styles.headerToggleView),\n onClick: this._onHeaderSelect,\n onKeyDown: this._onHeaderKeyDown,\n \"aria-label\": headerAriaLabel,\n role: \"button\",\n \"aria-atomic\": true,\n \"aria-live\": \"polite\",\n tabIndex: 0\n }, dateTimeFormatter.formatYear(navigatedDate)) : React.createElement(\"div\", {\n className: css('ms-DatePicker-currentYear js-showYearPicker', styles.currentYear)\n }, dateTimeFormatter.formatYear(navigatedDate)), React.createElement(\"div\", {\n className: css('ms-DatePicker-yearComponents', styles.yearComponents)\n }, React.createElement(\"div\", {\n className: css('ms-DatePicker-navContainer', styles.navContainer)\n }, React.createElement(\"button\", {\n className: css('ms-DatePicker-prevYear js-prevYear', styles.prevYear, (_a = {}, _a['ms-DatePicker-prevYear--disabled ' + styles.prevYearIsDisabled] = !isPrevYearInBounds, _a)),\n disabled: !isPrevYearInBounds,\n onClick: isPrevYearInBounds ? this._onSelectPrevYear : undefined,\n onKeyDown: isPrevYearInBounds ? this._onSelectPrevYearKeyDown : undefined,\n title: strings.prevYearAriaLabel ? strings.prevYearAriaLabel + ' ' + dateTimeFormatter.formatYear(addYears(navigatedDate, -1)) : undefined,\n role: \"button\",\n type: \"button\"\n }, React.createElement(Icon, {\n iconName: getRTL() ? rightNavigationIcon : leftNavigationIcon\n })), React.createElement(\"button\", {\n className: css('ms-DatePicker-nextYear js-nextYear', styles.nextYear, (_b = {}, _b['ms-DatePicker-nextYear--disabled ' + styles.nextYearIsDisabled] = !isNextYearInBounds, _b)),\n disabled: !isNextYearInBounds,\n onClick: isNextYearInBounds ? this._onSelectNextYear : undefined,\n onKeyDown: isNextYearInBounds ? this._onSelectNextYearKeyDown : undefined,\n title: strings.nextYearAriaLabel ? strings.nextYearAriaLabel + ' ' + dateTimeFormatter.formatYear(addYears(navigatedDate, 1)) : undefined,\n role: \"button\",\n type: \"button\"\n }, React.createElement(Icon, {\n iconName: getRTL() ? leftNavigationIcon : rightNavigationIcon\n }))))), React.createElement(FocusZone, null, React.createElement(\"div\", {\n className: css('ms-DatePicker-optionGrid', styles.optionGrid),\n role: \"grid\",\n \"aria-readonly\": \"true\"\n }, rowIndexes.map(function (rowNum) {\n var monthsForRow = strings.shortMonths.slice(rowNum * MONTHS_PER_ROW, (rowNum + 1) * MONTHS_PER_ROW);\n return React.createElement(\"div\", {\n key: 'monthRow_' + rowNum,\n role: \"row\"\n }, monthsForRow.map(function (month, index) {\n var _a;\n\n var monthIndex = rowNum * MONTHS_PER_ROW + index;\n var indexedMonth = setMonth(navigatedDate, monthIndex);\n\n var isCurrentMonth = _this._isCurrentMonth(monthIndex, navigatedDate.getFullYear(), today);\n\n var isNavigatedMonth = navigatedDate.getMonth() === monthIndex;\n var isSelectedMonth = selectedDate.getMonth() === monthIndex;\n var isSelectedYear = selectedDate.getFullYear() === navigatedDate.getFullYear();\n var isInBounds = (minDate ? compareDatePart(minDate, getMonthEnd(indexedMonth)) < 1 : true) && (maxDate ? compareDatePart(getMonthStart(indexedMonth), maxDate) < 1 : true);\n return React.createElement(\"button\", {\n role: 'gridcell',\n className: css('ms-DatePicker-monthOption', styles.monthOption, (_a = {}, _a['ms-DatePicker-day--today ' + styles.monthIsCurrentMonth] = highlightCurrentMonth && isCurrentMonth, _a['ms-DatePicker-day--highlighted ' + styles.monthIsHighlighted] = (highlightCurrentMonth || highlightSelectedMonth) && isSelectedMonth && isSelectedYear, _a['ms-DatePicker-monthOption--disabled ' + styles.monthOptionIsDisabled] = !isInBounds, _a)),\n disabled: !isInBounds,\n key: monthIndex,\n onClick: isInBounds ? _this._selectMonthCallbacks[monthIndex] : undefined,\n onKeyDown: isInBounds ? _this._onSelectMonthKeyDown(monthIndex) : undefined,\n \"aria-label\": dateTimeFormatter.formatMonthYear(indexedMonth, strings),\n \"aria-selected\": isNavigatedMonth,\n \"data-is-focusable\": isInBounds ? true : undefined,\n ref: isNavigatedMonth ? _this._navigatedMonthRef : undefined,\n type: \"button\"\n }, month);\n }));\n }))));\n };\n\n CalendarMonth.prototype.focus = function () {\n if (this._calendarYearRef) {\n this._calendarYearRef.focus();\n } else if (this._navigatedMonthRef.current) {\n this._navigatedMonthRef.current.tabIndex = 0;\n\n this._navigatedMonthRef.current.focus();\n }\n };\n\n CalendarMonth.prototype._isCurrentMonth = function (month, year, today) {\n return today.getFullYear() === year && today.getMonth() === month;\n };\n\n return CalendarMonth;\n}(React.Component);\n\nexport { CalendarMonth };","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { DayOfWeek, FirstWeekOfYear, DateRangeType } from '../../utilities/dateValues/DateValues';\nimport { CalendarDay } from './CalendarDay';\nimport { CalendarMonth } from './CalendarMonth';\nimport { compareDates, getDateRangeArray } from '../../utilities/dateMath/DateMath';\nimport { css, elementContains, KeyCodes, getNativeProps, divProperties, initializeComponentRef, FocusRects } from '../../Utilities';\nimport * as stylesImport from './Calendar.scss';\nvar styles = stylesImport;\nvar leftArrow = 'Up';\nvar rightArrow = 'Down';\nvar closeIcon = 'CalculatorMultiply';\nvar iconStrings = {\n leftNavigation: leftArrow,\n rightNavigation: rightArrow,\n closeIcon: closeIcon\n};\nvar defaultWorkWeekDays = [DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday];\nvar dateTimeFormatterCallbacks = {\n formatMonthDayYear: function formatMonthDayYear(date, strings) {\n return strings.months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();\n },\n formatMonthYear: function formatMonthYear(date, strings) {\n return strings.months[date.getMonth()] + ' ' + date.getFullYear();\n },\n formatDay: function formatDay(date) {\n return date.getDate().toString();\n },\n formatYear: function formatYear(date) {\n return date.getFullYear().toString();\n }\n};\n\nvar Calendar =\n/** @class */\nfunction (_super) {\n __extends(Calendar, _super);\n\n function Calendar(props) {\n var _this = _super.call(this, props) || this;\n\n _this._dayPicker = React.createRef();\n _this._monthPicker = React.createRef();\n _this._hasFocus = false;\n\n _this._onBlur = function (event) {\n if (!elementContains(event.currentTarget, event.relatedTarget)) {\n _this._hasFocus = false;\n _this.props.onBlur && _this.props.onBlur(event);\n }\n };\n\n _this._onFocus = function (event) {\n if (!_this._hasFocus) {\n _this._hasFocus = true;\n _this.props.onFocus && _this.props.onFocus(event);\n }\n };\n\n _this._navigateDayPickerDay = function (date) {\n _this.setState({\n navigatedDayDate: date,\n navigatedMonthDate: date\n });\n };\n\n _this._navigateMonthPickerDay = function (date) {\n _this.setState({\n navigatedMonthDate: date\n });\n };\n\n _this._onNavigateDayDate = function (date, focusOnNavigatedDay) {\n _this._navigateDayPickerDay(date);\n\n _this._focusOnUpdate = focusOnNavigatedDay;\n };\n\n _this._onNavigateMonthDate = function (date, focusOnNavigatedDay) {\n if (!focusOnNavigatedDay) {\n _this._navigateMonthPickerDay(date);\n\n _this._focusOnUpdate = focusOnNavigatedDay;\n return;\n }\n\n var monthPickerOnly = !_this.props.showMonthPickerAsOverlay && !_this.props.isDayPickerVisible;\n\n if (monthPickerOnly) {\n _this._onSelectDate(date);\n }\n\n _this._navigateDayPickerDay(date);\n };\n\n _this._onSelectDate = function (date, selectedDateRangeArray) {\n var onSelectDate = _this.props.onSelectDate;\n\n _this.setState({\n selectedDate: date\n });\n\n if (onSelectDate) {\n onSelectDate(date, selectedDateRangeArray);\n }\n };\n\n _this._onHeaderSelect = function (focus) {\n _this.setState({\n isDayPickerVisible: !_this.state.isDayPickerVisible,\n isMonthPickerVisible: !_this.state.isMonthPickerVisible\n });\n\n if (focus) {\n _this._focusOnUpdate = true;\n }\n };\n\n _this._onGotoToday = function () {\n var _a = _this.props,\n dateRangeType = _a.dateRangeType,\n firstDayOfWeek = _a.firstDayOfWeek,\n today = _a.today,\n workWeekDays = _a.workWeekDays,\n selectDateOnClick = _a.selectDateOnClick;\n\n if (selectDateOnClick) {\n // When using Defaultprops, TypeScript doesn't know that React is going to inject defaults\n // so we use exclamation mark as a hint to the type checker (see link below)\n // https://decembersoft.com/posts/error-ts2532-optional-react-component-props-in-typescript/\n var dates = getDateRangeArray(today, dateRangeType, firstDayOfWeek, workWeekDays);\n\n _this._onSelectDate(today, dates);\n }\n\n _this._navigateDayPickerDay(today);\n\n _this._focusOnUpdate = true;\n };\n\n _this._onGotoTodayClick = function (ev) {\n _this._onGotoToday();\n };\n\n _this._onGotoTodayKeyDown = function (ev) {\n if (ev.which === KeyCodes.enter) {\n ev.preventDefault();\n\n _this._onGotoToday();\n }\n };\n\n _this._onDatePickerPopupKeyDown = function (ev) {\n switch (ev.which) {\n case KeyCodes.enter:\n ev.preventDefault();\n break;\n\n case KeyCodes.backspace:\n ev.preventDefault();\n break;\n\n case KeyCodes.escape:\n _this._handleEscKey(ev);\n\n break;\n\n default:\n break;\n }\n };\n\n _this._handleEscKey = function (ev) {\n if (_this.props.onDismiss) {\n _this.props.onDismiss();\n }\n };\n\n initializeComponentRef(_this);\n var currentDate = props.value && !isNaN(props.value.getTime()) ? props.value : props.today || new Date();\n _this.state = {\n selectedDate: currentDate,\n navigatedDayDate: currentDate,\n navigatedMonthDate: currentDate,\n\n /** When showMonthPickerAsOverlay is active it overrides isMonthPickerVisible/isDayPickerVisible props\n (These props permanently set the visibility of their respective calendars). */\n isMonthPickerVisible: _this.props.showMonthPickerAsOverlay ? false : _this.props.isMonthPickerVisible,\n isDayPickerVisible: _this.props.showMonthPickerAsOverlay ? true : _this.props.isDayPickerVisible\n };\n _this._focusOnUpdate = false;\n return _this;\n }\n\n Calendar.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) {\n var autoNavigateOnSelection = nextProps.autoNavigateOnSelection,\n value = nextProps.value,\n _a = nextProps.today,\n today = _a === void 0 ? new Date() : _a; // Make sure auto-navigation is supported for programmatic changes to selected date, i.e.,\n // if selected date is updated via props, we may need to modify the navigated date\n\n var overrideNavigatedDate = autoNavigateOnSelection && !compareDates(value, this.props.value);\n\n if (overrideNavigatedDate) {\n this.setState({\n navigatedMonthDate: value,\n navigatedDayDate: value\n });\n }\n\n this.setState({\n selectedDate: value || today\n });\n };\n\n Calendar.prototype.componentDidUpdate = function () {\n if (this._focusOnUpdate) {\n this.focus();\n this._focusOnUpdate = false;\n }\n };\n\n Calendar.prototype.render = function () {\n var _a;\n\n var rootClass = 'ms-DatePicker';\n var _b = this.props,\n firstDayOfWeek = _b.firstDayOfWeek,\n dateRangeType = _b.dateRangeType,\n strings = _b.strings,\n showMonthPickerAsOverlay = _b.showMonthPickerAsOverlay,\n autoNavigateOnSelection = _b.autoNavigateOnSelection,\n showGoToToday = _b.showGoToToday,\n highlightCurrentMonth = _b.highlightCurrentMonth,\n highlightSelectedMonth = _b.highlightSelectedMonth,\n navigationIcons = _b.navigationIcons,\n minDate = _b.minDate,\n maxDate = _b.maxDate,\n restrictedDates = _b.restrictedDates,\n className = _b.className,\n showCloseButton = _b.showCloseButton,\n allFocusable = _b.allFocusable,\n yearPickerHidden = _b.yearPickerHidden,\n today = _b.today;\n var nativeProps = getNativeProps(this.props, divProperties, ['value']);\n var _c = this.state,\n selectedDate = _c.selectedDate,\n navigatedDayDate = _c.navigatedDayDate,\n navigatedMonthDate = _c.navigatedMonthDate,\n isMonthPickerVisible = _c.isMonthPickerVisible,\n isDayPickerVisible = _c.isDayPickerVisible;\n var onHeaderSelect = showMonthPickerAsOverlay ? this._onHeaderSelect : undefined;\n var monthPickerOnly = !showMonthPickerAsOverlay && !isDayPickerVisible;\n var overlayedWithButton = showMonthPickerAsOverlay && showGoToToday;\n var goTodayEnabled = showGoToToday;\n\n if (goTodayEnabled && navigatedDayDate && navigatedMonthDate && today) {\n goTodayEnabled = navigatedDayDate.getFullYear() !== today.getFullYear() || navigatedDayDate.getMonth() !== today.getMonth() || navigatedMonthDate.getFullYear() !== today.getFullYear() || navigatedMonthDate.getMonth() !== today.getMonth();\n }\n\n return React.createElement(\"div\", {\n className: css(rootClass, styles.root, className),\n role: \"application\"\n }, React.createElement(\"div\", __assign({}, nativeProps, {\n onBlur: this._onBlur,\n onFocus: this._onFocus,\n className: css('ms-DatePicker-picker ms-DatePicker-picker--opened ms-DatePicker-picker--focused', styles.picker, styles.pickerIsOpened, styles.pickerIsFocused, isMonthPickerVisible && 'ms-DatePicker-monthPickerVisible ' + styles.monthPickerVisible, isMonthPickerVisible && isDayPickerVisible && 'ms-DatePicker-calendarsInline ' + styles.calendarsInline, monthPickerOnly && 'ms-DatePicker-monthPickerOnly ' + styles.monthPickerOnly, showMonthPickerAsOverlay && 'ms-DatePicker-monthPickerAsOverlay ' + styles.monthPickerAsOverlay)\n }), React.createElement(\"div\", {\n className: css('ms-DatePicker-holder ms-slideDownIn10', styles.holder, overlayedWithButton && styles.holderWithButton),\n onKeyDown: this._onDatePickerPopupKeyDown\n }, React.createElement(\"div\", {\n className: css('ms-DatePicker-frame', styles.frame)\n }, React.createElement(\"div\", {\n className: css('ms-DatePicker-wrap', styles.wrap, showGoToToday && styles.goTodaySpacing)\n }, isDayPickerVisible && React.createElement(CalendarDay, {\n selectedDate: selectedDate,\n navigatedDate: navigatedDayDate,\n today: this.props.today,\n onSelectDate: this._onSelectDate,\n onNavigateDate: this._onNavigateDayDate,\n onDismiss: this.props.onDismiss,\n firstDayOfWeek: firstDayOfWeek,\n dateRangeType: dateRangeType,\n autoNavigateOnSelection: autoNavigateOnSelection,\n strings: strings,\n onHeaderSelect: onHeaderSelect,\n navigationIcons: navigationIcons,\n showWeekNumbers: this.props.showWeekNumbers,\n firstWeekOfYear: this.props.firstWeekOfYear,\n dateTimeFormatter: this.props.dateTimeFormatter,\n showSixWeeksByDefault: this.props.showSixWeeksByDefault,\n minDate: minDate,\n maxDate: maxDate,\n restrictedDates: restrictedDates,\n workWeekDays: this.props.workWeekDays,\n componentRef: this._dayPicker,\n showCloseButton: showCloseButton,\n allFocusable: allFocusable\n }), isDayPickerVisible && isMonthPickerVisible && React.createElement(\"div\", {\n className: styles.divider\n }), isMonthPickerVisible && React.createElement(CalendarMonth, {\n navigatedDate: navigatedMonthDate,\n selectedDate: navigatedDayDate,\n strings: strings,\n onNavigateDate: this._onNavigateMonthDate,\n today: this.props.today,\n highlightCurrentMonth: highlightCurrentMonth,\n highlightSelectedMonth: highlightSelectedMonth,\n onHeaderSelect: onHeaderSelect,\n navigationIcons: navigationIcons,\n dateTimeFormatter: this.props.dateTimeFormatter,\n minDate: minDate,\n maxDate: maxDate,\n componentRef: this._monthPicker,\n yearPickerHidden: yearPickerHidden || showMonthPickerAsOverlay\n }), showGoToToday && React.createElement(\"button\", {\n role: \"button\",\n className: css('ms-DatePicker-goToday js-goToday', styles.goToday, (_a = {}, _a[styles.goTodayInlineMonth] = isMonthPickerVisible, _a[styles.goToTodayIsDisabled] = !goTodayEnabled, _a)),\n onClick: this._onGotoTodayClick,\n onKeyDown: this._onGotoTodayKeyDown,\n tabIndex: 0,\n disabled: !goTodayEnabled,\n type: \"button\"\n }, strings.goToToday))))), React.createElement(FocusRects, null));\n };\n\n Calendar.prototype.focus = function () {\n if (this.state.isDayPickerVisible && this._dayPicker.current) {\n this._dayPicker.current.focus();\n } else if (this.state.isMonthPickerVisible && this._monthPicker.current) {\n this._monthPicker.current.focus();\n }\n };\n\n Calendar.defaultProps = {\n onSelectDate: undefined,\n onDismiss: undefined,\n isMonthPickerVisible: true,\n isDayPickerVisible: true,\n showMonthPickerAsOverlay: false,\n value: undefined,\n today: new Date(),\n firstDayOfWeek: DayOfWeek.Sunday,\n dateRangeType: DateRangeType.Day,\n autoNavigateOnSelection: false,\n showGoToToday: true,\n strings: null,\n highlightCurrentMonth: false,\n highlightSelectedMonth: false,\n navigationIcons: iconStrings,\n showWeekNumbers: false,\n firstWeekOfYear: FirstWeekOfYear.FirstDay,\n dateTimeFormatter: dateTimeFormatterCallbacks,\n showSixWeeksByDefault: false,\n workWeekDays: defaultWorkWeekDays,\n showCloseButton: false,\n allFocusable: false\n };\n return Calendar;\n}(React.Component);\n\nexport { Calendar };","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { getId, classNamesFunction, mergeAriaAttributeValues, initializeComponentRef, warnMutuallyExclusive, FocusRects } from '../../Utilities';\nimport { Icon } from '../../Icon';\nimport { KeytipData } from '../../KeytipData';\nvar getClassNames = classNamesFunction();\n\nvar CheckboxBase =\n/** @class */\nfunction (_super) {\n __extends(CheckboxBase, _super);\n /**\n * Initialize a new instance of the Checkbox\n * @param props - Props for the component\n * @param context - Context or initial state for the base component.\n */\n\n\n function CheckboxBase(props, context) {\n var _this = _super.call(this, props, context) || this;\n\n _this._checkBox = React.createRef();\n\n _this._renderContent = function (checked, indeterminate, keytipAttributes) {\n if (keytipAttributes === void 0) {\n keytipAttributes = {};\n }\n\n var _a = _this.props,\n disabled = _a.disabled,\n inputProps = _a.inputProps,\n name = _a.name,\n ariaLabel = _a.ariaLabel,\n ariaLabelledBy = _a.ariaLabelledBy,\n ariaDescribedBy = _a.ariaDescribedBy,\n _b = _a.onRenderLabel,\n onRenderLabel = _b === void 0 ? _this._onRenderLabel : _b,\n checkmarkIconProps = _a.checkmarkIconProps,\n ariaPositionInSet = _a.ariaPositionInSet,\n ariaSetSize = _a.ariaSetSize,\n title = _a.title,\n label = _a.label;\n return React.createElement(\"div\", {\n className: _this._classNames.root,\n title: title\n }, React.createElement(FocusRects, null), React.createElement(\"input\", __assign({\n type: \"checkbox\"\n }, inputProps, {\n \"data-ktp-execute-target\": keytipAttributes['data-ktp-execute-target'],\n checked: checked,\n disabled: disabled,\n className: _this._classNames.input,\n ref: _this._checkBox,\n name: name,\n id: _this._id,\n title: title,\n onChange: _this._onChange,\n onFocus: _this._onFocus,\n onBlur: _this._onBlur,\n \"aria-disabled\": disabled,\n \"aria-label\": ariaLabel || label,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": mergeAriaAttributeValues(ariaDescribedBy, keytipAttributes['aria-describedby']),\n \"aria-posinset\": ariaPositionInSet,\n \"aria-setsize\": ariaSetSize,\n \"aria-checked\": indeterminate ? 'mixed' : checked ? 'true' : 'false'\n })), React.createElement(\"label\", {\n className: _this._classNames.label,\n htmlFor: _this._id\n }, React.createElement(\"div\", {\n className: _this._classNames.checkbox,\n \"data-ktp-target\": keytipAttributes['data-ktp-target']\n }, React.createElement(Icon, __assign({\n iconName: \"CheckMark\"\n }, checkmarkIconProps, {\n className: _this._classNames.checkmark\n }))), onRenderLabel(_this.props, _this._onRenderLabel)));\n };\n\n _this._onFocus = function (ev) {\n var inputProps = _this.props.inputProps;\n\n if (inputProps && inputProps.onFocus) {\n inputProps.onFocus(ev);\n }\n };\n\n _this._onBlur = function (ev) {\n var inputProps = _this.props.inputProps;\n\n if (inputProps && inputProps.onBlur) {\n inputProps.onBlur(ev);\n }\n };\n\n _this._onChange = function (ev) {\n var onChange = _this.props.onChange;\n var _a = _this.state,\n isChecked = _a.isChecked,\n isIndeterminate = _a.isIndeterminate;\n\n if (!isIndeterminate) {\n if (onChange) {\n onChange(ev, !isChecked);\n }\n\n if (_this.props.checked === undefined) {\n _this.setState({\n isChecked: !isChecked\n });\n }\n } else {\n // If indeterminate, clicking the checkbox *only* removes the indeterminate state (or if\n // controlled, lets the consumer know to change it by calling onChange). It doesn't\n // change the checked state.\n if (onChange) {\n onChange(ev, isChecked);\n }\n\n if (_this.props.indeterminate === undefined) {\n _this.setState({\n isIndeterminate: false\n });\n }\n }\n };\n\n _this._onRenderLabel = function (props) {\n var label = props.label,\n title = props.title;\n return label ? React.createElement(\"span\", {\n \"aria-hidden\": \"true\",\n className: _this._classNames.text,\n title: title\n }, label) : null;\n };\n\n initializeComponentRef(_this);\n\n if (process.env.NODE_ENV !== 'production') {\n warnMutuallyExclusive('Checkbox', props, {\n checked: 'defaultChecked',\n indeterminate: 'defaultIndeterminate'\n });\n }\n\n _this._id = _this.props.id || getId('checkbox-');\n _this.state = {\n isChecked: !!(props.checked !== undefined ? props.checked : props.defaultChecked),\n isIndeterminate: !!(props.indeterminate !== undefined ? props.indeterminate : props.defaultIndeterminate)\n };\n return _this;\n }\n\n CheckboxBase.getDerivedStateFromProps = function (nextProps, prevState) {\n var stateUpdate = {};\n\n if (nextProps.indeterminate !== undefined) {\n stateUpdate.isIndeterminate = !!nextProps.indeterminate;\n }\n\n if (nextProps.checked !== undefined) {\n stateUpdate.isChecked = !!nextProps.checked;\n }\n\n return Object.keys(stateUpdate).length ? stateUpdate : null;\n };\n /**\n * Render the Checkbox based on passed props\n */\n\n\n CheckboxBase.prototype.render = function () {\n var _this = this;\n\n var _a = this.props,\n className = _a.className,\n disabled = _a.disabled,\n boxSide = _a.boxSide,\n theme = _a.theme,\n styles = _a.styles,\n _b = _a.onRenderLabel,\n onRenderLabel = _b === void 0 ? this._onRenderLabel : _b,\n keytipProps = _a.keytipProps;\n var _c = this.state,\n isChecked = _c.isChecked,\n isIndeterminate = _c.isIndeterminate;\n this._classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n disabled: disabled,\n indeterminate: isIndeterminate,\n checked: isChecked,\n reversed: boxSide !== 'start',\n isUsingCustomLabelRender: onRenderLabel !== this._onRenderLabel\n });\n\n if (keytipProps) {\n return React.createElement(KeytipData, {\n keytipProps: keytipProps,\n disabled: disabled\n }, function (keytipAttributes) {\n return _this._renderContent(isChecked, isIndeterminate, keytipAttributes);\n });\n }\n\n return this._renderContent(isChecked, isIndeterminate);\n };\n\n Object.defineProperty(CheckboxBase.prototype, \"indeterminate\", {\n get: function get() {\n return !!this.state.isIndeterminate;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CheckboxBase.prototype, \"checked\", {\n get: function get() {\n return !!this.state.isChecked;\n },\n enumerable: true,\n configurable: true\n });\n\n CheckboxBase.prototype.focus = function () {\n if (this._checkBox.current) {\n this._checkBox.current.focus();\n }\n };\n\n CheckboxBase.defaultProps = {\n boxSide: 'start'\n };\n return CheckboxBase;\n}(React.Component);\n\nexport { CheckboxBase };","import { __assign } from \"tslib\";\nimport { HighContrastSelector, getGlobalClassNames, getHighContrastNoAdjustStyle } from '../../Styling';\nimport { IsFocusVisibleClassName } from '../../Utilities';\nvar GlobalClassNames = {\n root: 'ms-Checkbox',\n label: 'ms-Checkbox-label',\n checkbox: 'ms-Checkbox-checkbox',\n checkmark: 'ms-Checkbox-checkmark',\n text: 'ms-Checkbox-text'\n};\nvar MS_CHECKBOX_LABEL_SIZE = '20px';\nvar MS_CHECKBOX_TRANSITION_DURATION = '200ms';\nvar MS_CHECKBOX_TRANSITION_TIMING = 'cubic-bezier(.4, 0, .23, 1)';\nexport var getStyles = function getStyles(props) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;\n\n var className = props.className,\n theme = props.theme,\n reversed = props.reversed,\n checked = props.checked,\n disabled = props.disabled,\n isUsingCustomLabelRender = props.isUsingCustomLabelRender,\n indeterminate = props.indeterminate;\n var semanticColors = theme.semanticColors,\n effects = theme.effects,\n palette = theme.palette,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var checkmarkFontColor = semanticColors.inputForegroundChecked; // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBorder\n\n var checkmarkFontColorHovered = palette.neutralSecondary; // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.smallInputBorder\n\n var checkboxBorderColor = palette.neutralPrimary;\n var checkboxBorderIndeterminateColor = semanticColors.inputBackgroundChecked;\n var checkboxBorderColorChecked = semanticColors.inputBackgroundChecked;\n var checkboxBorderColorDisabled = semanticColors.disabledBodySubtext;\n var checkboxBorderHoveredColor = semanticColors.inputBorderHovered;\n var checkboxBorderIndeterminateHoveredColor = semanticColors.inputBackgroundCheckedHovered;\n var checkboxBackgroundChecked = semanticColors.inputBackgroundChecked; // TODO: after updating the semanticColors slots mapping the following 2 tokens need to be\n // semanticColors.inputBackgroundCheckedHovered\n\n var checkboxBackgroundCheckedHovered = semanticColors.inputBackgroundCheckedHovered;\n var checkboxBorderColorCheckedHovered = semanticColors.inputBackgroundCheckedHovered;\n var checkboxHoveredTextColor = semanticColors.inputTextHovered;\n var checkboxBackgroundDisabledChecked = semanticColors.disabledBodySubtext;\n var checkboxTextColor = semanticColors.bodyText;\n var checkboxTextColorDisabled = semanticColors.disabledText;\n var indeterminateDotStyles = [(_a = {\n content: '\"\"',\n borderRadius: effects.roundedCorner2,\n position: 'absolute',\n width: 10,\n height: 10,\n top: 4,\n left: 4,\n boxSizing: 'border-box',\n borderWidth: 5,\n borderStyle: 'solid',\n borderColor: disabled ? checkboxBorderColorDisabled : checkboxBorderIndeterminateColor,\n transitionProperty: 'border-width, border, border-color',\n transitionDuration: MS_CHECKBOX_TRANSITION_DURATION,\n transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING\n }, _a[HighContrastSelector] = {\n borderColor: 'WindowText'\n }, _a)];\n return {\n root: [classNames.root, {\n position: 'relative',\n display: 'flex'\n }, reversed && 'reversed', checked && 'is-checked', !disabled && 'is-enabled', disabled && 'is-disabled', !disabled && [!checked && (_b = {}, _b[\":hover .\" + classNames.checkbox] = (_c = {\n borderColor: checkboxBorderHoveredColor\n }, _c[HighContrastSelector] = {\n borderColor: 'Highlight'\n }, _c), _b[\":focus .\" + classNames.checkbox] = {\n borderColor: checkboxBorderHoveredColor\n }, _b[\":hover .\" + classNames.checkmark] = (_d = {\n color: checkmarkFontColorHovered,\n opacity: '1'\n }, _d[HighContrastSelector] = {\n color: 'Highlight'\n }, _d), _b), checked && !indeterminate && (_e = {}, _e[\":hover .\" + classNames.checkbox] = {\n background: checkboxBackgroundCheckedHovered,\n borderColor: checkboxBorderColorCheckedHovered\n }, _e[\":focus .\" + classNames.checkbox] = {\n background: checkboxBackgroundCheckedHovered,\n borderColor: checkboxBorderColorCheckedHovered\n }, _e[HighContrastSelector] = (_f = {}, _f[\":hover .\" + classNames.checkbox] = {\n background: 'Highlight',\n borderColor: 'Highlight'\n }, _f[\":focus .\" + classNames.checkbox] = {\n background: 'Highlight'\n }, _f[\":focus:hover .\" + classNames.checkbox] = {\n background: 'Highlight'\n }, _f[\":focus:hover .\" + classNames.checkmark] = {\n color: 'Window'\n }, _f[\":hover .\" + classNames.checkmark] = {\n color: 'Window'\n }, _f), _e), indeterminate && (_g = {}, _g[\":hover .\" + classNames.checkbox + \", :hover .\" + classNames.checkbox + \":after\"] = (_h = {\n borderColor: checkboxBorderIndeterminateHoveredColor\n }, _h[HighContrastSelector] = {\n borderColor: 'WindowText'\n }, _h), _g[\":focus .\" + classNames.checkbox] = {\n borderColor: checkboxBorderIndeterminateHoveredColor\n }, _g[\":hover .\" + classNames.checkmark] = {\n opacity: '0'\n }, _g), (_j = {}, _j[\":hover .\" + classNames.text + \", :focus .\" + classNames.text] = (_k = {\n color: checkboxHoveredTextColor\n }, _k[HighContrastSelector] = {\n color: disabled ? 'GrayText' : 'WindowText'\n }, _k), _j)], className],\n input: (_l = {\n position: 'absolute',\n background: 'none',\n opacity: 0\n }, _l[\".\" + IsFocusVisibleClassName + \" &:focus + label::before\"] = (_m = {\n outline: '1px solid ' + theme.palette.neutralSecondary,\n outlineOffset: '2px'\n }, _m[HighContrastSelector] = {\n outline: '1px solid WindowText'\n }, _m), _l),\n label: [classNames.label, theme.fonts.medium, {\n display: 'flex',\n alignItems: isUsingCustomLabelRender ? 'center' : 'flex-start',\n cursor: disabled ? 'default' : 'pointer',\n position: 'relative',\n userSelect: 'none'\n }, reversed && {\n flexDirection: 'row-reverse',\n justifyContent: 'flex-end'\n }, {\n '&::before': {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n content: '\"\"',\n pointerEvents: 'none'\n }\n }],\n checkbox: [classNames.checkbox, (_o = {\n position: 'relative',\n display: 'flex',\n flexShrink: 0,\n alignItems: 'center',\n justifyContent: 'center',\n height: MS_CHECKBOX_LABEL_SIZE,\n width: MS_CHECKBOX_LABEL_SIZE,\n border: \"1px solid \" + checkboxBorderColor,\n borderRadius: effects.roundedCorner2,\n boxSizing: 'border-box',\n transitionProperty: 'background, border, border-color',\n transitionDuration: MS_CHECKBOX_TRANSITION_DURATION,\n transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING,\n\n /* in case the icon is bigger than the box */\n overflow: 'hidden',\n ':after': indeterminate ? indeterminateDotStyles : null\n }, _o[HighContrastSelector] = __assign({\n borderColor: 'WindowText'\n }, getHighContrastNoAdjustStyle()), _o), indeterminate && {\n borderColor: checkboxBorderIndeterminateColor\n }, !reversed ? // This margin on the checkbox is for backwards compat. Notably it has the effect where a customRender\n // is used, there will be only a 4px margin from checkbox to label. The label by default would have\n // another 4px margin for a total of 8px margin between checkbox and label. We don't combine the two\n // (and move it into the text) to not incur a breaking change for everyone using custom render atm.\n {\n marginRight: 4\n } : {\n marginLeft: 4\n }, !disabled && !indeterminate && checked && (_p = {\n background: checkboxBackgroundChecked,\n borderColor: checkboxBorderColorChecked\n }, _p[HighContrastSelector] = {\n background: 'Highlight',\n borderColor: 'Highlight'\n }, _p), disabled && (_q = {\n borderColor: checkboxBorderColorDisabled\n }, _q[HighContrastSelector] = {\n borderColor: 'GrayText'\n }, _q), checked && disabled && (_r = {\n background: checkboxBackgroundDisabledChecked,\n borderColor: checkboxBorderColorDisabled\n }, _r[HighContrastSelector] = {\n background: 'Window'\n }, _r)],\n checkmark: [classNames.checkmark, (_s = {\n opacity: checked ? '1' : '0',\n color: checkmarkFontColor\n }, _s[HighContrastSelector] = __assign({\n color: disabled ? 'GrayText' : 'Window'\n }, getHighContrastNoAdjustStyle()), _s)],\n text: [classNames.text, (_t = {\n color: disabled ? checkboxTextColorDisabled : checkboxTextColor,\n fontSize: fonts.medium.fontSize,\n lineHeight: '20px'\n }, _t[HighContrastSelector] = __assign({\n color: disabled ? 'GrayText' : 'WindowText'\n }, getHighContrastNoAdjustStyle()), _t), !reversed ? {\n marginLeft: 4\n } : {\n marginRight: 4\n }]\n };\n};","import { styled } from '../../Utilities';\nimport { CheckboxBase } from './Checkbox.base';\nimport { getStyles } from './Checkbox.styles';\nexport var Checkbox = styled(CheckboxBase, getStyles, undefined, {\n scope: 'Checkbox'\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { divProperties, getNativeProps } from '../../Utilities';\nimport { classNamesFunction } from '../../Utilities';\nvar getClassNames = classNamesFunction({\n // Label is used a lot by other components.\n // It's likely to see expected cases which pass different className to the Label.\n // Therefore setting a larger cache size.\n cacheSize: 100\n});\n\nvar LabelBase =\n/** @class */\nfunction (_super) {\n __extends(LabelBase, _super);\n\n function LabelBase() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n LabelBase.prototype.render = function () {\n var _a = this.props,\n _b = _a.as,\n RootType = _b === void 0 ? 'label' : _b,\n children = _a.children,\n className = _a.className,\n disabled = _a.disabled,\n styles = _a.styles,\n required = _a.required,\n theme = _a.theme;\n var classNames = getClassNames(styles, {\n className: className,\n disabled: disabled,\n required: required,\n theme: theme\n });\n return React.createElement(RootType, __assign({}, getNativeProps(this.props, divProperties), {\n className: classNames.root\n }), children);\n };\n\n return LabelBase;\n}(React.Component);\n\nexport { LabelBase };","import { styled } from '../../Utilities';\nimport { LabelBase } from './Label.base';\nimport { getStyles } from './Label.styles';\nexport var Label = styled(LabelBase, getStyles, undefined, {\n scope: 'Label'\n});","import { __assign } from \"tslib\";\nimport { HighContrastSelector, FontWeights, getHighContrastNoAdjustStyle } from '../../Styling';\nexport var getStyles = function getStyles(props) {\n var _a;\n\n var theme = props.theme,\n className = props.className,\n disabled = props.disabled,\n required = props.required;\n var semanticColors = theme.semanticColors; // Tokens\n\n var labelFontWeight = FontWeights.semibold;\n var labelColor = semanticColors.bodyText;\n var labelDisabledColor = semanticColors.disabledBodyText;\n var labelRequiredStarColor = semanticColors.errorText;\n return {\n root: ['ms-Label', theme.fonts.medium, {\n fontWeight: labelFontWeight,\n color: labelColor,\n boxSizing: 'border-box',\n boxShadow: 'none',\n margin: 0,\n display: 'block',\n padding: '5px 0',\n wordWrap: 'break-word',\n overflowWrap: 'break-word'\n }, disabled && {\n color: labelDisabledColor,\n selectors: (_a = {}, _a[HighContrastSelector] = __assign({\n color: 'GrayText'\n }, getHighContrastNoAdjustStyle()), _a)\n }, required && {\n selectors: {\n '::after': {\n content: \"' *'\",\n color: labelRequiredStarColor,\n paddingRight: 12\n }\n }\n }, className]\n };\n};","import { __assign, __extends, __rest } from \"tslib\";\nimport * as React from 'react';\nimport { Async, EventGroup, css, divProperties, findIndex, findScrollableParent, getNativeProps, getParent, getWindow, initializeComponentRef } from '../../Utilities';\nimport { ScrollToMode } from './List.types';\nimport { composeRenderFunction } from '../../Utilities';\nvar RESIZE_DELAY = 16;\nvar MIN_SCROLL_UPDATE_DELAY = 100;\nvar MAX_SCROLL_UPDATE_DELAY = 500;\nvar IDLE_DEBOUNCE_DELAY = 200; // The amount of time to wait before declaring that the list isn't scrolling\n\nvar DONE_SCROLLING_WAIT = 500;\nvar DEFAULT_ITEMS_PER_PAGE = 10;\nvar DEFAULT_PAGE_HEIGHT = 30;\nvar DEFAULT_RENDERED_WINDOWS_BEHIND = 2;\nvar DEFAULT_RENDERED_WINDOWS_AHEAD = 2;\nvar PAGE_KEY_PREFIX = 'page-';\nvar SPACER_KEY_PREFIX = 'spacer-';\nvar EMPTY_RECT = {\n top: -1,\n bottom: -1,\n left: -1,\n right: -1,\n width: 0,\n height: 0\n}; // Naming expensive measures so that they're named in profiles.\n\nvar _measurePageRect = function _measurePageRect(element) {\n return element.getBoundingClientRect();\n};\n\nvar _measureSurfaceRect = _measurePageRect;\nvar _measureScrollRect = _measurePageRect;\n/**\n * The List renders virtualized pages of items. Each page's item count is determined by the getItemCountForPage callback\n * if provided by the caller, or 10 as default. Each page's height is determined by the getPageHeight callback if\n * provided by the caller, or by cached measurements if available, or by a running average, or a default fallback.\n *\n * The algorithm for rendering pages works like this:\n *\n * 1. Predict visible pages based on \"current measure data\" (page heights, surface position, visible window)\n * 2. If changes are necessary, apply changes (add/remove pages)\n * 3. For pages that are added, measure the page heights if we need to using getBoundingClientRect\n * 4. If measurements don't match predictions, update measure data and goto step 1 asynchronously\n *\n * Measuring too frequently can pull performance down significantly. To compensate, we cache measured values so that\n * we can avoid re-measuring during operations that should not alter heights, like scrolling.\n *\n * To optimize glass rendering performance, onShouldVirtualize can be set. When onShouldVirtualize return false,\n * List will run in fast mode (not virtualized) to render all items without any measurements to improve page load time.\n * And we start doing measurements and rendering in virtualized mode when items grows larger than this threshold.\n *\n * However, certain operations can make measure data stale. For example, resizing the list, or passing in new props,\n * or forcing an update change cause pages to shrink/grow. When these operations occur, we increment a measureVersion\n * number, which we associate with cached measurements and use to determine if a remeasure should occur.\n */\n\nvar List =\n/** @class */\nfunction (_super) {\n __extends(List, _super);\n\n function List(props) {\n var _this = _super.call(this, props) || this;\n\n _this._root = React.createRef();\n _this._surface = React.createRef();\n _this._pageRefs = {};\n\n _this._getDerivedStateFromProps = function (nextProps, previousState) {\n if (nextProps.items !== _this.props.items || nextProps.renderCount !== _this.props.renderCount || nextProps.startIndex !== _this.props.startIndex || nextProps.version !== _this.props.version) {\n // We have received new items so we want to make sure that initially we only render a single window to\n // fill the currently visible rect, and then later render additional windows.\n _this._resetRequiredWindows();\n\n _this._requiredRect = null;\n _this._measureVersion++;\n\n _this._invalidatePageCache();\n\n return _this._updatePages(nextProps, previousState);\n }\n\n return previousState;\n };\n\n _this._onRenderRoot = function (props) {\n var rootRef = props.rootRef,\n surfaceElement = props.surfaceElement,\n divProps = props.divProps;\n return React.createElement(\"div\", __assign({\n ref: rootRef\n }, divProps), surfaceElement);\n };\n\n _this._onRenderSurface = function (props) {\n var surfaceRef = props.surfaceRef,\n pageElements = props.pageElements,\n divProps = props.divProps;\n return React.createElement(\"div\", __assign({\n ref: surfaceRef\n }, divProps), pageElements);\n };\n\n _this._onRenderPage = function (pageProps, defaultRender) {\n var _a = _this.props,\n onRenderCell = _a.onRenderCell,\n role = _a.role;\n\n var _b = pageProps.page,\n _c = _b.items,\n items = _c === void 0 ? [] : _c,\n startIndex = _b.startIndex,\n divProps = __rest(pageProps, [\"page\"]); // only assign list item role if no role is assigned\n\n\n var cellRole = role === undefined ? 'listitem' : 'presentation';\n var cells = [];\n\n for (var i = 0; i < items.length; i++) {\n var index = startIndex + i;\n var item = items[i];\n var itemKey = _this.props.getKey ? _this.props.getKey(item, index) : item && item.key;\n\n if (itemKey === null || itemKey === undefined) {\n itemKey = index;\n }\n\n cells.push(React.createElement(\"div\", {\n role: cellRole,\n className: 'ms-List-cell',\n key: itemKey,\n \"data-list-index\": index,\n \"data-automationid\": \"ListCell\"\n }, onRenderCell && onRenderCell(item, index, !_this.props.ignoreScrollingState ? _this.state.isScrolling : undefined)));\n }\n\n return React.createElement(\"div\", __assign({}, divProps), cells);\n };\n\n initializeComponentRef(_this);\n _this.state = {\n pages: [],\n isScrolling: false,\n getDerivedStateFromProps: _this._getDerivedStateFromProps\n };\n _this._async = new Async(_this);\n _this._events = new EventGroup(_this);\n _this._estimatedPageHeight = 0;\n _this._totalEstimates = 0;\n _this._requiredWindowsAhead = 0;\n _this._requiredWindowsBehind = 0; // Track the measure version for everything.\n\n _this._measureVersion = 0; // Ensure that scrolls are lazy updated.\n\n _this._onAsyncScroll = _this._async.debounce(_this._onAsyncScroll, MIN_SCROLL_UPDATE_DELAY, {\n leading: false,\n maxWait: MAX_SCROLL_UPDATE_DELAY\n });\n _this._onAsyncIdle = _this._async.debounce(_this._onAsyncIdle, IDLE_DEBOUNCE_DELAY, {\n leading: false\n });\n _this._onAsyncResize = _this._async.debounce(_this._onAsyncResize, RESIZE_DELAY, {\n leading: false\n });\n _this._onScrollingDone = _this._async.debounce(_this._onScrollingDone, DONE_SCROLLING_WAIT, {\n leading: false\n });\n _this._cachedPageHeights = {};\n _this._estimatedPageHeight = 0;\n _this._focusedIndex = -1;\n _this._pageCache = {};\n return _this;\n }\n\n List.getDerivedStateFromProps = function (nextProps, previousState) {\n return previousState.getDerivedStateFromProps(nextProps, previousState);\n };\n\n Object.defineProperty(List.prototype, \"pageRefs\", {\n get: function get() {\n return this._pageRefs;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Scroll to the given index. By default will bring the page the specified item is on into the view. If a callback\n * to measure the height of an individual item is specified, will only scroll to bring the specific item into view.\n *\n * Note: with items of variable height and no passed in `getPageHeight` method, the list might jump after scrolling\n * when windows before/ahead are being rendered, and the estimated height is replaced using actual elements.\n *\n * @param index - Index of item to scroll to\n * @param measureItem - Optional callback to measure the height of an individual item\n * @param scrollToMode - Optional defines where in the window the item should be positioned to when scrolling\n */\n\n List.prototype.scrollToIndex = function (index, measureItem, scrollToMode) {\n if (scrollToMode === void 0) {\n scrollToMode = ScrollToMode.auto;\n }\n\n var startIndex = this.props.startIndex;\n\n var renderCount = this._getRenderCount();\n\n var endIndex = startIndex + renderCount;\n var allowedRect = this._allowedRect;\n var scrollTop = 0;\n var itemsPerPage = 1;\n\n for (var itemIndex = startIndex; itemIndex < endIndex; itemIndex += itemsPerPage) {\n var pageSpecification = this._getPageSpecification(itemIndex, allowedRect);\n\n var pageHeight = pageSpecification.height;\n itemsPerPage = pageSpecification.itemCount;\n var requestedIndexIsInPage = itemIndex <= index && itemIndex + itemsPerPage > index;\n\n if (requestedIndexIsInPage) {\n // We have found the page. If the user provided a way to measure an individual item, we will try to scroll in\n // just the given item, otherwise we'll only bring the page into view\n if (measureItem && this._scrollElement) {\n var scrollRect = _measureScrollRect(this._scrollElement);\n\n var scrollWindow = {\n top: this._scrollElement.scrollTop,\n bottom: this._scrollElement.scrollTop + scrollRect.height\n }; // Adjust for actual item position within page\n\n var itemPositionWithinPage = index - itemIndex;\n\n for (var itemIndexInPage = 0; itemIndexInPage < itemPositionWithinPage; ++itemIndexInPage) {\n scrollTop += measureItem(itemIndex + itemIndexInPage);\n }\n\n var scrollBottom = scrollTop + measureItem(index); // If scrollToMode is set to something other than auto, we always want to\n // scroll the item into a specific position on the page.\n\n switch (scrollToMode) {\n case ScrollToMode.top:\n this._scrollElement.scrollTop = scrollTop;\n return;\n\n case ScrollToMode.bottom:\n this._scrollElement.scrollTop = scrollBottom - scrollRect.height;\n return;\n\n case ScrollToMode.center:\n this._scrollElement.scrollTop = (scrollTop + scrollBottom - scrollRect.height) / 2;\n return;\n\n case ScrollToMode.auto:\n default:\n break;\n }\n\n var itemIsFullyVisible = scrollTop >= scrollWindow.top && scrollBottom <= scrollWindow.bottom;\n\n if (itemIsFullyVisible) {\n // Item is already visible, do nothing.\n return;\n }\n\n var itemIsPartiallyAbove = scrollTop < scrollWindow.top;\n var itemIsPartiallyBelow = scrollBottom > scrollWindow.bottom;\n\n if (itemIsPartiallyAbove) {// We will just scroll to 'scrollTop'\n // .------. - scrollTop\n // |Item |\n // | .----|-. - scrollWindow.top\n // '------' |\n // | |\n // '------'\n } else if (itemIsPartiallyBelow) {\n // Adjust scrollTop position to just bring in the element\n // .------. - scrollTop\n // | |\n // | .------.\n // '-|----' | - scrollWindow.bottom\n // | Item |\n // '------' - scrollBottom\n scrollTop = scrollBottom - scrollRect.height;\n }\n }\n\n this._scrollElement.scrollTop = scrollTop;\n return;\n }\n\n scrollTop += pageHeight;\n }\n };\n\n List.prototype.getStartItemIndexInView = function (measureItem) {\n var pages = this.state.pages || [];\n\n for (var _i = 0, pages_1 = pages; _i < pages_1.length; _i++) {\n var page = pages_1[_i];\n var isPageVisible = !page.isSpacer && (this._scrollTop || 0) >= page.top && (this._scrollTop || 0) <= page.top + page.height;\n\n if (isPageVisible) {\n if (!measureItem) {\n var rowHeight = Math.floor(page.height / page.itemCount);\n return page.startIndex + Math.floor((this._scrollTop - page.top) / rowHeight);\n } else {\n var totalRowHeight = 0;\n\n for (var itemIndex = page.startIndex; itemIndex < page.startIndex + page.itemCount; itemIndex++) {\n var rowHeight = measureItem(itemIndex);\n\n if (page.top + totalRowHeight <= this._scrollTop && this._scrollTop < page.top + totalRowHeight + rowHeight) {\n return itemIndex;\n } else {\n totalRowHeight += rowHeight;\n }\n }\n }\n }\n }\n\n return 0;\n };\n\n List.prototype.componentDidMount = function () {\n this.setState(this._updatePages(this.props, this.state));\n this._measureVersion++;\n this._scrollElement = findScrollableParent(this._root.current);\n\n this._events.on(window, 'resize', this._onAsyncResize);\n\n if (this._root.current) {\n this._events.on(this._root.current, 'focus', this._onFocus, true);\n }\n\n if (this._scrollElement) {\n this._events.on(this._scrollElement, 'scroll', this._onScroll);\n\n this._events.on(this._scrollElement, 'scroll', this._onAsyncScroll);\n }\n };\n\n List.prototype.componentDidUpdate = function (previousProps, previousState) {\n var finalProps = this.props;\n var finalState = this.state;\n\n if (this.state.pagesVersion !== previousState.pagesVersion) {\n // If we weren't provided with the page height, measure the pages\n if (!finalProps.getPageHeight) {\n // If measured version is invalid since we've updated the DOM\n var heightsChanged = this._updatePageMeasurements(finalState.pages); // On first render, we should re-measure so that we don't get a visual glitch.\n\n\n if (heightsChanged) {\n this._materializedRect = null;\n\n if (!this._hasCompletedFirstRender) {\n this._hasCompletedFirstRender = true;\n this.setState(this._updatePages(finalProps, finalState));\n } else {\n this._onAsyncScroll();\n }\n } else {\n // Enqueue an idle bump.\n this._onAsyncIdle();\n }\n } else {\n // Enqueue an idle bump\n this._onAsyncIdle();\n } // Notify the caller that rendering the new pages has completed\n\n\n if (finalProps.onPagesUpdated) {\n finalProps.onPagesUpdated(finalState.pages);\n }\n }\n };\n\n List.prototype.componentWillUnmount = function () {\n this._async.dispose();\n\n this._events.dispose();\n\n delete this._scrollElement;\n };\n\n List.prototype.shouldComponentUpdate = function (newProps, newState) {\n var oldPages = this.state.pages;\n var newPages = newState.pages;\n var shouldComponentUpdate = false; // Update if the page stops scrolling\n\n if (!newState.isScrolling && this.state.isScrolling) {\n return true;\n }\n\n if (newProps.version !== this.props.version) {\n return true;\n }\n\n if (newProps.items === this.props.items && oldPages.length === newPages.length) {\n for (var i = 0; i < oldPages.length; i++) {\n var oldPage = oldPages[i];\n var newPage = newPages[i];\n\n if (oldPage.key !== newPage.key || oldPage.itemCount !== newPage.itemCount) {\n shouldComponentUpdate = true;\n break;\n }\n }\n } else {\n shouldComponentUpdate = true;\n }\n\n return shouldComponentUpdate;\n };\n\n List.prototype.forceUpdate = function () {\n this._invalidatePageCache(); // Ensure that when the list is force updated we update the pages first before render.\n\n\n this._updateRenderRects(this.props, this.state, true);\n\n this.setState(this._updatePages(this.props, this.state));\n this._measureVersion++;\n\n _super.prototype.forceUpdate.call(this);\n };\n /**\n * Get the current height the list and it's pages.\n */\n\n\n List.prototype.getTotalListHeight = function () {\n return this._surfaceRect.height;\n };\n\n List.prototype.render = function () {\n var _a = this.props,\n className = _a.className,\n _b = _a.role,\n role = _b === void 0 ? 'list' : _b,\n onRenderSurface = _a.onRenderSurface,\n onRenderRoot = _a.onRenderRoot;\n var _c = this.state.pages,\n pages = _c === void 0 ? [] : _c;\n var pageElements = [];\n var divProps = getNativeProps(this.props, divProperties);\n\n for (var _i = 0, pages_2 = pages; _i < pages_2.length; _i++) {\n var page = pages_2[_i];\n pageElements.push(this._renderPage(page));\n }\n\n var finalOnRenderSurface = onRenderSurface ? composeRenderFunction(onRenderSurface, this._onRenderSurface) : this._onRenderSurface;\n var finalOnRenderRoot = onRenderRoot ? composeRenderFunction(onRenderRoot, this._onRenderRoot) : this._onRenderRoot;\n return finalOnRenderRoot({\n rootRef: this._root,\n pages: pages,\n surfaceElement: finalOnRenderSurface({\n surfaceRef: this._surface,\n pages: pages,\n pageElements: pageElements,\n divProps: {\n role: 'presentation',\n className: 'ms-List-surface'\n }\n }),\n divProps: __assign(__assign({}, divProps), {\n className: css('ms-List', className),\n role: pageElements.length > 0 ? role : undefined\n })\n });\n };\n\n List.prototype._shouldVirtualize = function (props) {\n if (props === void 0) {\n props = this.props;\n }\n\n var onShouldVirtualize = props.onShouldVirtualize;\n return !onShouldVirtualize || onShouldVirtualize(props);\n };\n /**\n * when props.items change or forceUpdate called, throw away cached pages\n */\n\n\n List.prototype._invalidatePageCache = function () {\n this._pageCache = {};\n };\n\n List.prototype._renderPage = function (page) {\n var _this = this;\n\n var usePageCache = this.props.usePageCache;\n var cachedPage; // if usePageCache is set and cached page element can be found, just return cached page\n\n if (usePageCache) {\n cachedPage = this._pageCache[page.key];\n\n if (cachedPage && cachedPage.pageElement) {\n return cachedPage.pageElement;\n }\n }\n\n var pageStyle = this._getPageStyle(page);\n\n var _a = this.props.onRenderPage,\n onRenderPage = _a === void 0 ? this._onRenderPage : _a;\n var pageElement = onRenderPage({\n page: page,\n className: 'ms-List-page',\n key: page.key,\n ref: function ref(newRef) {\n _this._pageRefs[page.key] = newRef;\n },\n style: pageStyle,\n role: 'presentation'\n }, this._onRenderPage); // cache the first page for now since it is re-rendered a lot times unnecessarily.\n // todo: a more aggresive caching mechanism is to cache pages constaining the items not changed.\n // now we re-render pages too frequently, for example, props.items increased from 30 to 60, although the\n // first 30 items did not change, we still re-rendered all of them in this props.items change.\n\n if (usePageCache && page.startIndex === 0) {\n this._pageCache[page.key] = {\n page: page,\n pageElement: pageElement\n };\n }\n\n return pageElement;\n };\n /** Generate the style object for the page. */\n\n\n List.prototype._getPageStyle = function (page) {\n var getPageStyle = this.props.getPageStyle;\n return __assign(__assign({}, getPageStyle ? getPageStyle(page) : {}), !page.items ? {\n height: page.height\n } : {});\n };\n /** Track the last item index focused so that we ensure we keep it rendered. */\n\n\n List.prototype._onFocus = function (ev) {\n var target = ev.target;\n\n while (target !== this._surface.current) {\n var indexString = target.getAttribute('data-list-index');\n\n if (indexString) {\n this._focusedIndex = Number(indexString);\n break;\n }\n\n target = getParent(target);\n }\n };\n /**\n * Called synchronously to reset the required render range to 0 on scrolling. After async scroll has executed,\n * we will call onAsyncIdle which will reset it back to it's correct value.\n */\n\n\n List.prototype._onScroll = function () {\n if (!this.state.isScrolling && !this.props.ignoreScrollingState) {\n this.setState({\n isScrolling: true\n });\n }\n\n this._resetRequiredWindows();\n\n this._onScrollingDone();\n };\n\n List.prototype._resetRequiredWindows = function () {\n this._requiredWindowsAhead = 0;\n this._requiredWindowsBehind = 0;\n };\n /**\n * Debounced method to asynchronously update the visible region on a scroll event.\n */\n\n\n List.prototype._onAsyncScroll = function () {\n this._updateRenderRects(this.props, this.state); // Only update pages when the visible rect falls outside of the materialized rect.\n\n\n if (!this._materializedRect || !_isContainedWithin(this._requiredRect, this._materializedRect)) {\n this.setState(this._updatePages(this.props, this.state));\n } else {// console.log('requiredRect contained in materialized', this._requiredRect, this._materializedRect);\n }\n };\n /**\n * This is an async debounced method that will try and increment the windows we render. If we can increment\n * either, we increase the amount we render and re-evaluate.\n */\n\n\n List.prototype._onAsyncIdle = function () {\n var _a = this.props,\n renderedWindowsAhead = _a.renderedWindowsAhead,\n renderedWindowsBehind = _a.renderedWindowsBehind;\n\n var _b = this,\n requiredWindowsAhead = _b._requiredWindowsAhead,\n requiredWindowsBehind = _b._requiredWindowsBehind;\n\n var windowsAhead = Math.min(renderedWindowsAhead, requiredWindowsAhead + 1);\n var windowsBehind = Math.min(renderedWindowsBehind, requiredWindowsBehind + 1);\n\n if (windowsAhead !== requiredWindowsAhead || windowsBehind !== requiredWindowsBehind) {\n // console.log('idling', windowsBehind, windowsAhead);\n this._requiredWindowsAhead = windowsAhead;\n this._requiredWindowsBehind = windowsBehind;\n\n this._updateRenderRects(this.props, this.state);\n\n this.setState(this._updatePages(this.props, this.state));\n }\n\n if (renderedWindowsAhead > windowsAhead || renderedWindowsBehind > windowsBehind) {\n // Async increment on next tick.\n this._onAsyncIdle();\n }\n };\n /**\n * Function to call when the list is done scrolling.\n * This function is debounced.\n */\n\n\n List.prototype._onScrollingDone = function () {\n if (!this.props.ignoreScrollingState) {\n this.setState({\n isScrolling: false\n });\n }\n };\n\n List.prototype._onAsyncResize = function () {\n this.forceUpdate();\n };\n\n List.prototype._updatePages = function (nextProps, previousState) {\n // console.log('updating pages');\n if (!this._requiredRect) {\n this._updateRenderRects(nextProps, previousState);\n }\n\n var newListState = this._buildPages(nextProps, previousState);\n\n var oldListPages = previousState.pages;\n\n this._notifyPageChanges(oldListPages, newListState.pages, this.props);\n\n return __assign(__assign(__assign({}, previousState), newListState), {\n pagesVersion: {}\n });\n };\n /**\n * Notify consumers that the rendered pages have changed\n * @param oldPages - The old pages\n * @param newPages - The new pages\n * @param props - The props to use\n */\n\n\n List.prototype._notifyPageChanges = function (oldPages, newPages, props) {\n var onPageAdded = props.onPageAdded,\n onPageRemoved = props.onPageRemoved;\n\n if (onPageAdded || onPageRemoved) {\n var renderedIndexes = {};\n\n for (var _i = 0, oldPages_1 = oldPages; _i < oldPages_1.length; _i++) {\n var page = oldPages_1[_i];\n\n if (page.items) {\n renderedIndexes[page.startIndex] = page;\n }\n }\n\n for (var _a = 0, newPages_1 = newPages; _a < newPages_1.length; _a++) {\n var page = newPages_1[_a];\n\n if (page.items) {\n if (!renderedIndexes[page.startIndex]) {\n this._onPageAdded(page);\n } else {\n delete renderedIndexes[page.startIndex];\n }\n }\n }\n\n for (var index in renderedIndexes) {\n if (renderedIndexes.hasOwnProperty(index)) {\n this._onPageRemoved(renderedIndexes[index]);\n }\n }\n }\n };\n\n List.prototype._updatePageMeasurements = function (pages) {\n var heightChanged = false; // when not in virtualize mode, we render all the items without page measurement\n\n if (!this._shouldVirtualize()) {\n return heightChanged;\n }\n\n for (var i = 0; i < pages.length; i++) {\n var page = pages[i];\n\n if (page.items) {\n heightChanged = this._measurePage(page) || heightChanged;\n }\n }\n\n return heightChanged;\n };\n /**\n * Given a page, measure its dimensions, update cache.\n * @returns True if the height has changed.\n */\n\n\n List.prototype._measurePage = function (page) {\n var hasChangedHeight = false;\n var pageElement = this._pageRefs[page.key];\n var cachedHeight = this._cachedPageHeights[page.startIndex]; // console.log(' * measure attempt', page.startIndex, cachedHeight);\n\n if (pageElement && this._shouldVirtualize() && (!cachedHeight || cachedHeight.measureVersion !== this._measureVersion)) {\n var newClientRect = {\n width: pageElement.clientWidth,\n height: pageElement.clientHeight\n };\n\n if (newClientRect.height || newClientRect.width) {\n hasChangedHeight = page.height !== newClientRect.height; // console.warn(' *** expensive page measure', page.startIndex, page.height, newClientRect.height);\n\n page.height = newClientRect.height;\n this._cachedPageHeights[page.startIndex] = {\n height: newClientRect.height,\n measureVersion: this._measureVersion\n };\n this._estimatedPageHeight = Math.round((this._estimatedPageHeight * this._totalEstimates + newClientRect.height) / (this._totalEstimates + 1));\n this._totalEstimates++;\n }\n }\n\n return hasChangedHeight;\n };\n /** Called when a page has been added to the DOM. */\n\n\n List.prototype._onPageAdded = function (page) {\n var onPageAdded = this.props.onPageAdded; // console.log('page added', page.startIndex, this.state.pages.map(page => page.key).join(', '));\n\n if (onPageAdded) {\n onPageAdded(page);\n }\n };\n /** Called when a page has been removed from the DOM. */\n\n\n List.prototype._onPageRemoved = function (page) {\n var onPageRemoved = this.props.onPageRemoved; // console.log(' --- page removed', page.startIndex, this.state.pages.map(page => page.key).join(', '));\n\n if (onPageRemoved) {\n onPageRemoved(page);\n }\n };\n /** Build up the pages that should be rendered. */\n\n\n List.prototype._buildPages = function (props, state) {\n var renderCount = props.renderCount;\n var items = props.items,\n startIndex = props.startIndex,\n getPageHeight = props.getPageHeight;\n renderCount = this._getRenderCount(props);\n\n var materializedRect = __assign({}, EMPTY_RECT);\n\n var pages = [];\n var itemsPerPage = 1;\n var pageTop = 0;\n var currentSpacer = null;\n var focusedIndex = this._focusedIndex;\n var endIndex = startIndex + renderCount;\n\n var shouldVirtualize = this._shouldVirtualize(props); // First render is very important to track; when we render cells, we have no idea of estimated page height.\n // So we should default to rendering only the first page so that we can get information.\n // However if the user provides a measure function, let's just assume they know the right heights.\n\n\n var isFirstRender = this._estimatedPageHeight === 0 && !getPageHeight;\n var allowedRect = this._allowedRect;\n\n var _loop_1 = function _loop_1(itemIndex) {\n var pageSpecification = this_1._getPageSpecification(itemIndex, allowedRect);\n\n var pageHeight = pageSpecification.height;\n var pageData = pageSpecification.data;\n var key = pageSpecification.key;\n itemsPerPage = pageSpecification.itemCount;\n var pageBottom = pageTop + pageHeight - 1;\n var isPageRendered = findIndex(state.pages, function (page) {\n return !!page.items && page.startIndex === itemIndex;\n }) > -1;\n var isPageInAllowedRange = !allowedRect || pageBottom >= allowedRect.top && pageTop <= allowedRect.bottom;\n var isPageInRequiredRange = !this_1._requiredRect || pageBottom >= this_1._requiredRect.top && pageTop <= this_1._requiredRect.bottom;\n var isPageVisible = !isFirstRender && (isPageInRequiredRange || isPageInAllowedRange && isPageRendered) || !shouldVirtualize;\n var isPageFocused = focusedIndex >= itemIndex && focusedIndex < itemIndex + itemsPerPage;\n var isFirstPage = itemIndex === startIndex; // console.log('building page', itemIndex, 'pageTop: ' + pageTop, 'inAllowed: ' +\n // isPageInAllowedRange, 'inRequired: ' + isPageInRequiredRange);\n // Only render whats visible, focused, or first page,\n // or when running in fast rendering mode (not in virtualized mode), we render all current items in pages\n\n if (isPageVisible || isPageFocused || isFirstPage) {\n if (currentSpacer) {\n pages.push(currentSpacer);\n currentSpacer = null;\n }\n\n var itemsInPage = Math.min(itemsPerPage, endIndex - itemIndex);\n\n var newPage = this_1._createPage(key, items.slice(itemIndex, itemIndex + itemsInPage), itemIndex, undefined, undefined, pageData);\n\n newPage.top = pageTop;\n newPage.height = pageHeight;\n\n if (this_1._visibleRect && this_1._visibleRect.bottom) {\n newPage.isVisible = pageBottom >= this_1._visibleRect.top && pageTop <= this_1._visibleRect.bottom;\n }\n\n pages.push(newPage);\n\n if (isPageInRequiredRange && this_1._allowedRect) {\n _mergeRect(materializedRect, {\n top: pageTop,\n bottom: pageBottom,\n height: pageHeight,\n left: allowedRect.left,\n right: allowedRect.right,\n width: allowedRect.width\n });\n }\n } else {\n if (!currentSpacer) {\n currentSpacer = this_1._createPage(SPACER_KEY_PREFIX + itemIndex, undefined, itemIndex, 0, undefined, pageData, true\n /*isSpacer*/\n );\n }\n\n currentSpacer.height = (currentSpacer.height || 0) + (pageBottom - pageTop) + 1;\n currentSpacer.itemCount += itemsPerPage;\n }\n\n pageTop += pageBottom - pageTop + 1; // in virtualized mode, we render need to render first page then break and measure,\n // otherwise, we render all items without measurement to make rendering fast\n\n if (isFirstRender && shouldVirtualize) {\n return \"break\";\n }\n };\n\n var this_1 = this;\n\n for (var itemIndex = startIndex; itemIndex < endIndex; itemIndex += itemsPerPage) {\n var state_1 = _loop_1(itemIndex);\n\n if (state_1 === \"break\") break;\n }\n\n if (currentSpacer) {\n currentSpacer.key = SPACER_KEY_PREFIX + 'end';\n pages.push(currentSpacer);\n }\n\n this._materializedRect = materializedRect; // console.log('materialized: ', materializedRect);\n\n return __assign(__assign({}, state), {\n pages: pages,\n measureVersion: this._measureVersion\n });\n };\n\n List.prototype._getPageSpecification = function (itemIndex, visibleRect) {\n var getPageSpecification = this.props.getPageSpecification;\n\n if (getPageSpecification) {\n var pageData = getPageSpecification(itemIndex, visibleRect);\n var _a = pageData.itemCount,\n itemCount = _a === void 0 ? this._getItemCountForPage(itemIndex, visibleRect) : _a;\n var _b = pageData.height,\n height = _b === void 0 ? this._getPageHeight(itemIndex, visibleRect, itemCount) : _b;\n return {\n itemCount: itemCount,\n height: height,\n data: pageData.data,\n key: pageData.key\n };\n } else {\n var itemCount = this._getItemCountForPage(itemIndex, visibleRect);\n\n return {\n itemCount: itemCount,\n height: this._getPageHeight(itemIndex, visibleRect, itemCount)\n };\n }\n };\n /**\n * Get the pixel height of a give page. Will use the props getPageHeight first, and if not provided, fallback to\n * cached height, or estimated page height, or default page height.\n */\n\n\n List.prototype._getPageHeight = function (itemIndex, visibleRect, itemsPerPage) {\n if (this.props.getPageHeight) {\n return this.props.getPageHeight(itemIndex, visibleRect, itemsPerPage);\n } else {\n var cachedHeight = this._cachedPageHeights[itemIndex];\n return cachedHeight ? cachedHeight.height : this._estimatedPageHeight || DEFAULT_PAGE_HEIGHT;\n }\n };\n\n List.prototype._getItemCountForPage = function (itemIndex, visibileRect) {\n var itemsPerPage = this.props.getItemCountForPage ? this.props.getItemCountForPage(itemIndex, visibileRect) : DEFAULT_ITEMS_PER_PAGE;\n return itemsPerPage ? itemsPerPage : DEFAULT_ITEMS_PER_PAGE;\n };\n\n List.prototype._createPage = function (pageKey, items, startIndex, count, style, data, isSpacer) {\n if (startIndex === void 0) {\n startIndex = -1;\n }\n\n if (count === void 0) {\n count = items ? items.length : 0;\n }\n\n if (style === void 0) {\n style = {};\n }\n\n pageKey = pageKey || PAGE_KEY_PREFIX + startIndex;\n var cachedPage = this._pageCache[pageKey];\n\n if (cachedPage && cachedPage.page) {\n return cachedPage.page;\n }\n\n return {\n key: pageKey,\n startIndex: startIndex,\n itemCount: count,\n items: items,\n style: style,\n top: 0,\n height: 0,\n data: data,\n isSpacer: isSpacer || false\n };\n };\n\n List.prototype._getRenderCount = function (props) {\n var _a = props || this.props,\n items = _a.items,\n startIndex = _a.startIndex,\n renderCount = _a.renderCount;\n\n return renderCount === undefined ? items ? items.length - startIndex : 0 : renderCount;\n };\n /** Calculate the visible rect within the list where top: 0 and left: 0 is the top/left of the list. */\n\n\n List.prototype._updateRenderRects = function (props, state, forceUpdate) {\n var renderedWindowsAhead = props.renderedWindowsAhead,\n renderedWindowsBehind = props.renderedWindowsBehind;\n var pages = state.pages; // when not in virtualize mode, we render all items without measurement to optimize page rendering perf\n\n if (!this._shouldVirtualize(props)) {\n return;\n }\n\n var surfaceRect = this._surfaceRect || __assign({}, EMPTY_RECT);\n\n var scrollHeight = this._scrollElement && this._scrollElement.scrollHeight;\n var scrollTop = this._scrollElement ? this._scrollElement.scrollTop : 0; // WARNING: EXPENSIVE CALL! We need to know the surface top relative to the window.\n // This needs to be called to recalculate when new pages should be loaded.\n // We check to see how far we've scrolled and if it's further than a third of a page we run it again.\n\n if (this._surface.current && (forceUpdate || !pages || !this._surfaceRect || !scrollHeight || scrollHeight !== this._scrollHeight || Math.abs(this._scrollTop - scrollTop) > this._estimatedPageHeight / 3)) {\n surfaceRect = this._surfaceRect = _measureSurfaceRect(this._surface.current);\n this._scrollTop = scrollTop;\n } // If the scroll height has changed, something in the container likely resized and\n // we should redo the page heights incase their content resized.\n\n\n if (forceUpdate || !scrollHeight || scrollHeight !== this._scrollHeight) {\n this._measureVersion++;\n }\n\n this._scrollHeight = scrollHeight; // If the surface is above the container top or below the container bottom, or if this is not the first\n // render return empty rect.\n // The first time the list gets rendered we need to calculate the rectangle. The width of the list is\n // used to calculate the width of the list items.\n\n var visibleTop = Math.max(0, -surfaceRect.top);\n var win = getWindow(this._root.current);\n var visibleRect = {\n top: visibleTop,\n left: surfaceRect.left,\n bottom: visibleTop + win.innerHeight,\n right: surfaceRect.right,\n width: surfaceRect.width,\n height: win.innerHeight\n }; // The required/allowed rects are adjusted versions of the visible rect.\n\n this._requiredRect = _expandRect(visibleRect, this._requiredWindowsBehind, this._requiredWindowsAhead);\n this._allowedRect = _expandRect(visibleRect, renderedWindowsBehind, renderedWindowsAhead); // store the visible rect for later use.\n\n this._visibleRect = visibleRect;\n };\n\n List.defaultProps = {\n startIndex: 0,\n onRenderCell: function onRenderCell(item, index, containsFocus) {\n return React.createElement(React.Fragment, null, item && item.name || '');\n },\n renderedWindowsAhead: DEFAULT_RENDERED_WINDOWS_AHEAD,\n renderedWindowsBehind: DEFAULT_RENDERED_WINDOWS_BEHIND\n };\n return List;\n}(React.Component);\n\nexport { List };\n\nfunction _expandRect(rect, pagesBefore, pagesAfter) {\n var top = rect.top - pagesBefore * rect.height;\n var height = rect.height + (pagesBefore + pagesAfter) * rect.height;\n return {\n top: top,\n bottom: top + height,\n height: height,\n left: rect.left,\n right: rect.right,\n width: rect.width\n };\n}\n\nfunction _isContainedWithin(innerRect, outerRect) {\n return innerRect.top >= outerRect.top && innerRect.left >= outerRect.left && innerRect.bottom <= outerRect.bottom && innerRect.right <= outerRect.right;\n}\n\nfunction _mergeRect(targetRect, newRect) {\n targetRect.top = newRect.top < targetRect.top || targetRect.top === -1 ? newRect.top : targetRect.top;\n targetRect.left = newRect.left < targetRect.left || targetRect.left === -1 ? newRect.left : targetRect.left;\n targetRect.bottom = newRect.bottom > targetRect.bottom || targetRect.bottom === -1 ? newRect.bottom : targetRect.bottom;\n targetRect.right = newRect.right > targetRect.right || targetRect.right === -1 ? newRect.right : targetRect.right;\n targetRect.width = targetRect.right - targetRect.left + 1;\n targetRect.height = targetRect.bottom - targetRect.top + 1;\n return targetRect;\n}","/**\n * {@docCategory List}\n */\nexport var ScrollToMode = {\n /**\n * Does not make any consideration to where in the viewport the item should align to.\n */\n auto: 0,\n\n /**\n * Attempts to scroll the list so the top of the desired item is aligned with the top of the viewport.\n */\n top: 1,\n\n /**\n * Attempts to scroll the list so the bottom of the desired item is aligned with the bottom of the viewport.\n */\n bottom: 2,\n\n /**\n * Attempts to scroll the list so the desired item is in the exact center of the viewport.\n */\n center: 3\n};","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { DelayedRender, getId, classNamesFunction, getNativeProps, htmlElementProperties, css, initializeComponentRef } from '../../Utilities';\nimport { IconButton } from '../../Button';\nimport { Icon } from '../../Icon';\nimport { MessageBarType } from './MessageBar.types';\nvar getClassNames = classNamesFunction();\n\nvar MessageBarBase =\n/** @class */\nfunction (_super) {\n __extends(MessageBarBase, _super);\n\n function MessageBarBase(props) {\n var _a;\n\n var _this = _super.call(this, props) || this;\n\n _this.ICON_MAP = (_a = {}, _a[MessageBarType.info] = 'Info', _a[MessageBarType.warning] = 'Info', _a[MessageBarType.error] = 'ErrorBadge', _a[MessageBarType.blocked] = 'Blocked2', _a[MessageBarType.severeWarning] = 'Warning', _a[MessageBarType.success] = 'Completed', _a);\n\n _this._getRegionProps = function () {\n var hasActions = !!_this._getActionsDiv() || !!_this._getDismissDiv();\n var regionProps = {\n 'aria-describedby': _this.state.labelId,\n role: 'region'\n };\n return hasActions ? regionProps : {};\n };\n\n _this._onClick = function (ev) {\n _this.setState({\n expandSingleLine: !_this.state.expandSingleLine\n });\n };\n\n initializeComponentRef(_this);\n _this.state = {\n labelId: getId('MessageBar'),\n // eslint-disable-next-line react/no-unused-state\n showContent: false,\n expandSingleLine: false\n };\n return _this;\n }\n\n MessageBarBase.prototype.render = function () {\n var isMultiline = this.props.isMultiline;\n this._classNames = this._getClassNames();\n return isMultiline ? this._renderMultiLine() : this._renderSingleLine();\n };\n\n MessageBarBase.prototype._getActionsDiv = function () {\n if (this.props.actions) {\n return React.createElement(\"div\", {\n className: this._classNames.actions\n }, this.props.actions);\n }\n\n return null;\n };\n\n MessageBarBase.prototype._getDismissDiv = function () {\n var _a = this.props,\n onDismiss = _a.onDismiss,\n dismissIconProps = _a.dismissIconProps;\n\n if (onDismiss) {\n return React.createElement(IconButton, {\n disabled: false,\n className: this._classNames.dismissal,\n onClick: onDismiss,\n iconProps: dismissIconProps ? dismissIconProps : {\n iconName: 'Clear'\n },\n title: this.props.dismissButtonAriaLabel,\n ariaLabel: this.props.dismissButtonAriaLabel\n });\n }\n\n return null;\n };\n\n MessageBarBase.prototype._getDismissSingleLine = function () {\n if (this.props.onDismiss) {\n return React.createElement(\"div\", {\n className: this._classNames.dismissSingleLine\n }, this._getDismissDiv());\n }\n\n return null;\n };\n\n MessageBarBase.prototype._getExpandSingleLine = function () {\n if (!this.props.actions && this.props.truncated) {\n return React.createElement(\"div\", {\n className: this._classNames.expandSingleLine\n }, React.createElement(IconButton, {\n disabled: false,\n className: this._classNames.expand,\n onClick: this._onClick,\n iconProps: {\n iconName: this.state.expandSingleLine ? 'DoubleChevronUp' : 'DoubleChevronDown'\n },\n ariaLabel: this.props.overflowButtonAriaLabel,\n \"aria-expanded\": this.state.expandSingleLine\n }));\n }\n\n return null;\n };\n\n MessageBarBase.prototype._getIconSpan = function () {\n var messageBarIconProps = this.props.messageBarIconProps;\n return React.createElement(\"div\", {\n className: this._classNames.iconContainer,\n \"aria-hidden\": true\n }, messageBarIconProps ? React.createElement(Icon, __assign({}, messageBarIconProps, {\n className: css(this._classNames.icon, messageBarIconProps.className)\n })) : React.createElement(Icon, {\n iconName: this.ICON_MAP[this.props.messageBarType],\n className: this._classNames.icon\n }));\n };\n\n MessageBarBase.prototype._renderMultiLine = function () {\n return React.createElement(\"div\", __assign({\n className: this._classNames.root\n }, this._getRegionProps()), React.createElement(\"div\", {\n className: this._classNames.content\n }, this._getIconSpan(), this._renderInnerText(), this._getDismissDiv()), this._getActionsDiv());\n };\n\n MessageBarBase.prototype._renderSingleLine = function () {\n return React.createElement(\"div\", __assign({\n className: this._classNames.root\n }, this._getRegionProps()), React.createElement(\"div\", {\n className: this._classNames.content\n }, this._getIconSpan(), this._renderInnerText(), this._getExpandSingleLine(), this._getActionsDiv(), this._getDismissSingleLine()));\n };\n\n MessageBarBase.prototype._renderInnerText = function () {\n var nativeProps = getNativeProps(this.props, htmlElementProperties, ['className']);\n return React.createElement(\"div\", {\n className: this._classNames.text,\n id: this.state.labelId,\n role: \"status\",\n \"aria-live\": this._getAnnouncementPriority()\n }, React.createElement(\"span\", __assign({\n className: this._classNames.innerText\n }, nativeProps), React.createElement(DelayedRender, null, React.createElement(\"span\", null, this.props.children))));\n };\n\n MessageBarBase.prototype._getClassNames = function () {\n var _a = this.props,\n theme = _a.theme,\n className = _a.className,\n messageBarType = _a.messageBarType,\n onDismiss = _a.onDismiss,\n actions = _a.actions,\n truncated = _a.truncated,\n isMultiline = _a.isMultiline;\n var expandSingleLine = this.state.expandSingleLine;\n return getClassNames(this.props.styles, {\n theme: theme,\n messageBarType: messageBarType || MessageBarType.info,\n onDismiss: onDismiss !== undefined,\n actions: actions !== undefined,\n truncated: truncated,\n isMultiline: isMultiline,\n expandSingleLine: expandSingleLine,\n className: className\n });\n };\n\n MessageBarBase.prototype._getAnnouncementPriority = function () {\n switch (this.props.messageBarType) {\n case MessageBarType.blocked:\n case MessageBarType.error:\n case MessageBarType.severeWarning:\n return 'assertive';\n }\n\n return 'polite';\n };\n\n MessageBarBase.defaultProps = {\n messageBarType: MessageBarType.info,\n onDismiss: undefined,\n isMultiline: true\n };\n return MessageBarBase;\n}(React.Component);\n\nexport { MessageBarBase };","var _a, _b, _c;\n\nimport { __assign } from \"tslib\";\nimport { HighContrastSelector, ScreenWidthMaxSmall, getScreenSelector, getGlobalClassNames, getFocusStyle, IconFontSizes, getHighContrastNoAdjustStyle } from '../../Styling';\nimport { MessageBarType } from './MessageBar.types';\nvar GlobalClassNames = {\n root: 'ms-MessageBar',\n error: 'ms-MessageBar--error',\n blocked: 'ms-MessageBar--blocked',\n severeWarning: 'ms-MessageBar--severeWarning',\n success: 'ms-MessageBar--success',\n warning: 'ms-MessageBar--warning',\n multiline: 'ms-MessageBar-multiline',\n singleline: 'ms-MessageBar-singleline',\n dismissalSingleLine: 'ms-MessageBar-dismissalSingleLine',\n expandingSingleLine: 'ms-MessageBar-expandingSingleLine',\n content: 'ms-MessageBar-content',\n iconContainer: 'ms-MessageBar-icon',\n text: 'ms-MessageBar-text',\n innerText: 'ms-MessageBar-innerText',\n dismissSingleLine: 'ms-MessageBar-dismissSingleLine',\n expandSingleLine: 'ms-MessageBar-expandSingleLine',\n dismissal: 'ms-MessageBar-dismissal',\n expand: 'ms-MessageBar-expand',\n actions: 'ms-MessageBar-actions',\n actionsSingleline: 'ms-MessageBar-actionsSingleLine'\n};\nvar backgroundColor = (_a = {}, _a[MessageBarType.error] = 'errorBackground', _a[MessageBarType.blocked] = 'errorBackground', _a[MessageBarType.success] = 'successBackground', _a[MessageBarType.warning] = 'warningBackground', _a[MessageBarType.severeWarning] = 'severeWarningBackground', _a[MessageBarType.info] = 'infoBackground', _a);\nvar highContrastBackgroundColor = (_b = {}, _b[MessageBarType.error] = 'rgba(255, 0, 0, 0.3)', _b[MessageBarType.blocked] = 'rgba(255, 0, 0, 0.3)', _b[MessageBarType.success] = 'rgba(48, 241, 73, 0.3)', _b[MessageBarType.warning] = 'rgba(255, 254, 57, 0.3)', _b[MessageBarType.severeWarning] = 'rgba(255, 0, 0, 0.3)', _b[MessageBarType.info] = 'Window', _b);\nvar iconColor = (_c = {}, _c[MessageBarType.error] = 'errorIcon', _c[MessageBarType.blocked] = 'errorIcon', _c[MessageBarType.success] = 'successIcon', _c[MessageBarType.warning] = 'warningIcon', _c[MessageBarType.severeWarning] = 'severeWarningIcon', _c[MessageBarType.info] = 'infoIcon', _c);\nexport var getStyles = function getStyles(props) {\n var _a, _b, _c, _d, _e;\n\n var theme = props.theme,\n className = props.className,\n onDismiss = props.onDismiss,\n truncated = props.truncated,\n isMultiline = props.isMultiline,\n expandSingleLine = props.expandSingleLine,\n _f = props.messageBarType,\n messageBarType = _f === void 0 ? MessageBarType.info : _f;\n var semanticColors = theme.semanticColors,\n fonts = theme.fonts;\n var SmallScreenSelector = getScreenSelector(0, ScreenWidthMaxSmall);\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var dismissalAndExpandIconStyle = {\n fontSize: IconFontSizes.xSmall,\n height: 10,\n lineHeight: '10px',\n color: semanticColors.messageText,\n selectors: (_a = {}, _a[HighContrastSelector] = __assign(__assign({}, getHighContrastNoAdjustStyle()), {\n color: 'WindowText'\n }), _a)\n };\n var dismissalAndExpandStyle = [getFocusStyle(theme, {\n inset: 1,\n highContrastStyle: {\n outlineOffset: '-6px',\n outline: '1px solid Highlight'\n },\n borderColor: 'transparent'\n }), {\n flexShrink: 0,\n width: 32,\n height: 32,\n padding: '8px 12px',\n selectors: {\n '& .ms-Button-icon': dismissalAndExpandIconStyle,\n ':hover': {\n backgroundColor: 'transparent'\n },\n ':active': {\n backgroundColor: 'transparent'\n }\n }\n }];\n return {\n root: [classNames.root, fonts.medium, messageBarType === MessageBarType.error && classNames.error, messageBarType === MessageBarType.blocked && classNames.blocked, messageBarType === MessageBarType.severeWarning && classNames.severeWarning, messageBarType === MessageBarType.success && classNames.success, messageBarType === MessageBarType.warning && classNames.warning, isMultiline ? classNames.multiline : classNames.singleline, !isMultiline && onDismiss && classNames.dismissalSingleLine, !isMultiline && truncated && classNames.expandingSingleLine, {\n background: semanticColors[backgroundColor[messageBarType]],\n color: semanticColors.messageText,\n minHeight: 32,\n width: '100%',\n display: 'flex',\n wordBreak: 'break-word',\n selectors: (_b = {\n '.ms-Link': {\n color: semanticColors.messageLink,\n selectors: {\n ':hover': {\n color: semanticColors.messageLinkHovered\n }\n }\n }\n }, _b[HighContrastSelector] = __assign(__assign({}, getHighContrastNoAdjustStyle()), {\n background: highContrastBackgroundColor[messageBarType],\n border: '1px solid WindowText',\n color: 'WindowText'\n }), _b)\n }, isMultiline && {\n flexDirection: 'column'\n }, className],\n content: [classNames.content, {\n display: 'flex',\n width: '100%',\n lineHeight: 'normal'\n }],\n iconContainer: [classNames.iconContainer, {\n fontSize: IconFontSizes.medium,\n minWidth: 16,\n minHeight: 16,\n display: 'flex',\n flexShrink: 0,\n margin: '8px 0 8px 12px'\n }],\n icon: {\n color: semanticColors[iconColor[messageBarType]],\n selectors: (_c = {}, _c[HighContrastSelector] = __assign(__assign({}, getHighContrastNoAdjustStyle()), {\n color: 'WindowText'\n }), _c)\n },\n text: [classNames.text, __assign(__assign({\n minWidth: 0,\n display: 'flex',\n flexGrow: 1,\n margin: 8\n }, fonts.small), {\n selectors: (_d = {}, _d[HighContrastSelector] = __assign({}, getHighContrastNoAdjustStyle()), _d)\n }), !onDismiss && {\n marginRight: 12\n }],\n innerText: [classNames.innerText, {\n lineHeight: 16,\n selectors: {\n '& span a': {\n paddingLeft: 4\n }\n }\n }, truncated && {\n overflow: 'visible',\n whiteSpace: 'pre-wrap'\n }, !isMultiline && {\n // In high contrast this causes the top and bottom of links' focus outline to be clipped\n // (not sure of a good way around that while still maintaining text clipping)\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n }, !isMultiline && !truncated && {\n selectors: (_e = {}, _e[SmallScreenSelector] = {\n overflow: 'visible',\n whiteSpace: 'pre-wrap'\n }, _e)\n }, expandSingleLine && {\n overflow: 'visible',\n whiteSpace: 'pre-wrap'\n }],\n dismissSingleLine: classNames.dismissSingleLine,\n expandSingleLine: classNames.expandSingleLine,\n dismissal: [classNames.dismissal, dismissalAndExpandStyle],\n expand: [classNames.expand, dismissalAndExpandStyle],\n actions: [isMultiline ? classNames.actions : classNames.actionsSingleline, {\n display: 'flex',\n flexGrow: 0,\n flexShrink: 0,\n flexBasis: 'auto',\n flexDirection: 'row-reverse',\n alignItems: 'center',\n margin: '0 12px 0 8px',\n selectors: {\n '& button:nth-child(n+2)': {\n marginLeft: 8\n }\n }\n }, isMultiline && {\n marginBottom: 8\n }, onDismiss && !isMultiline && {\n marginRight: 0\n }]\n };\n};","import { styled } from '../../Utilities';\nimport { MessageBarBase } from './MessageBar.base';\nimport { getStyles } from './MessageBar.styles';\nexport var MessageBar = styled(MessageBarBase, getStyles, undefined, {\n scope: 'MessageBar'\n});","/**\n * {@docCategory MessageBar}\n */\nexport var MessageBarType;\n\n(function (MessageBarType) {\n /** Info styled MessageBar */\n MessageBarType[MessageBarType[\"info\"] = 0] = \"info\";\n /** Error styled MessageBar */\n\n MessageBarType[MessageBarType[\"error\"] = 1] = \"error\";\n /** Blocked styled MessageBar */\n\n MessageBarType[MessageBarType[\"blocked\"] = 2] = \"blocked\";\n /** SevereWarning styled MessageBar */\n\n MessageBarType[MessageBarType[\"severeWarning\"] = 3] = \"severeWarning\";\n /** Success styled MessageBar */\n\n MessageBarType[MessageBarType[\"success\"] = 4] = \"success\";\n /** Warning styled MessageBar */\n\n MessageBarType[MessageBarType[\"warning\"] = 5] = \"warning\";\n})(MessageBarType || (MessageBarType = {}));","import { memoizeFunction } from '../../Utilities';\nimport { mergeStyles } from '../../Styling';\nexport var getClassNames = memoizeFunction(function (className, isDragging) {\n return {\n root: mergeStyles(className, isDragging && {\n touchAction: 'none',\n selectors: {\n '& *': {\n userSelect: 'none'\n }\n }\n })\n };\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { getClassNames } from './DraggableZone.styles';\nimport { on } from '../../Utilities';\nvar eventMapping = {\n touch: {\n start: 'touchstart',\n move: 'touchmove',\n stop: 'touchend'\n },\n mouse: {\n start: 'mousedown',\n move: 'mousemove',\n stop: 'mouseup'\n }\n};\n\nvar DraggableZone =\n/** @class */\nfunction (_super) {\n __extends(DraggableZone, _super);\n\n function DraggableZone(props) {\n var _this = _super.call(this, props) || this;\n\n _this._currentEventType = eventMapping.mouse;\n _this._events = [];\n\n _this._onMouseDown = function (event) {\n var onMouseDown = React.Children.only(_this.props.children).props.onMouseDown;\n\n if (onMouseDown) {\n onMouseDown(event);\n }\n\n _this._currentEventType = eventMapping.mouse;\n return _this._onDragStart(event);\n };\n\n _this._onMouseUp = function (event) {\n var onMouseUp = React.Children.only(_this.props.children).props.onMouseUp;\n\n if (onMouseUp) {\n onMouseUp(event);\n }\n\n _this._currentEventType = eventMapping.mouse;\n return _this._onDragStop(event);\n };\n\n _this._onTouchStart = function (event) {\n var onTouchStart = React.Children.only(_this.props.children).props.onTouchStart;\n\n if (onTouchStart) {\n onTouchStart(event);\n }\n\n _this._currentEventType = eventMapping.touch;\n return _this._onDragStart(event);\n };\n\n _this._onTouchEnd = function (event) {\n var onTouchEnd = React.Children.only(_this.props.children).props.onTouchEnd;\n\n if (onTouchEnd) {\n onTouchEnd(event);\n }\n\n _this._currentEventType = eventMapping.touch;\n\n _this._onDragStop(event);\n };\n\n _this._onDragStart = function (event) {\n // Only handle left click for dragging\n if (typeof event.button === 'number' && event.button !== 0) {\n return false;\n } // If the target doesn't match the handleSelector OR\n // if the target does match the preventDragSelector, bail out\n\n\n if (_this.props.handleSelector && !_this._matchesSelector(event.target, _this.props.handleSelector) || _this.props.preventDragSelector && _this._matchesSelector(event.target, _this.props.preventDragSelector)) {\n return;\n } // Remember the touch identifier if this is a touch event so we can\n // distinguish between individual touches in multitouch scenarios\n // by remembering which touch point we were given\n\n\n _this._touchId = _this._getTouchId(event);\n\n var position = _this._getControlPosition(event);\n\n if (position === undefined) {\n return;\n }\n\n var dragData = _this._createDragDataFromPosition(position);\n\n _this.props.onStart && _this.props.onStart(event, dragData);\n\n _this.setState({\n isDragging: true,\n lastPosition: position\n }); // hook up the appropriate mouse/touch events to the body to ensure\n // smooth dragging\n\n\n _this._events = [on(document.body, _this._currentEventType.move, _this._onDrag, true\n /* use capture phase */\n ), on(document.body, _this._currentEventType.stop, _this._onDragStop, true\n /* use capture phase */\n )];\n };\n\n _this._onDrag = function (event) {\n // Prevent scrolling on mobile devices\n if (event.type === 'touchmove') {\n event.preventDefault();\n }\n\n var position = _this._getControlPosition(event);\n\n if (!position) {\n return;\n } // create the updated drag data from the position data\n\n\n var updatedData = _this._createUpdatedDragData(_this._createDragDataFromPosition(position));\n\n var updatedPosition = updatedData.position;\n _this.props.onDragChange && _this.props.onDragChange(event, updatedData);\n\n _this.setState({\n position: updatedPosition,\n lastPosition: position\n });\n };\n\n _this._onDragStop = function (event) {\n if (!_this.state.isDragging) {\n return;\n }\n\n var position = _this._getControlPosition(event);\n\n if (!position) {\n return;\n }\n\n var baseDragData = _this._createDragDataFromPosition(position); // Set dragging to false and reset the lastPosition\n\n\n _this.setState({\n isDragging: false,\n lastPosition: undefined\n });\n\n _this.props.onStop && _this.props.onStop(event, baseDragData);\n\n if (_this.props.position) {\n _this.setState({\n position: _this.props.position\n });\n } // Remove event handlers\n\n\n _this._events.forEach(function (dispose) {\n return dispose();\n });\n };\n\n _this.state = {\n isDragging: false,\n position: _this.props.position || {\n x: 0,\n y: 0\n },\n lastPosition: undefined\n };\n return _this;\n }\n\n DraggableZone.prototype.componentDidUpdate = function (prevProps) {\n if (this.props.position && (!prevProps.position || this.props.position !== prevProps.position)) {\n this.setState({\n position: this.props.position\n });\n }\n };\n\n DraggableZone.prototype.componentWillUnmount = function () {\n this._events.forEach(function (dispose) {\n return dispose();\n });\n };\n\n DraggableZone.prototype.render = function () {\n var child = React.Children.only(this.props.children);\n var props = child.props;\n var position = this.props.position;\n var _a = this.state,\n statePosition = _a.position,\n isDragging = _a.isDragging;\n var x = statePosition.x;\n var y = statePosition.y;\n\n if (position && !isDragging) {\n x = position.x;\n y = position.y;\n }\n\n return React.cloneElement(child, {\n style: __assign(__assign({}, props.style), {\n transform: \"translate(\" + x + \"px, \" + y + \"px)\"\n }),\n className: getClassNames(props.className, this.state.isDragging).root,\n onMouseDown: this._onMouseDown,\n onMouseUp: this._onMouseUp,\n onTouchStart: this._onTouchStart,\n onTouchEnd: this._onTouchEnd\n });\n };\n /**\n * Get the control position based off the event that fired\n * @param event - The event to get offsets from\n */\n\n\n DraggableZone.prototype._getControlPosition = function (event) {\n var touchObj = this._getActiveTouch(event); // did we get the right touch?\n\n\n if (this._touchId !== undefined && !touchObj) {\n return undefined;\n }\n\n var eventToGetOffset = touchObj || event;\n return {\n x: eventToGetOffset.clientX,\n y: eventToGetOffset.clientY\n };\n };\n /**\n * Get the active touch point that we have saved from the event's TouchList\n * @param event - The event used to get the TouchList for the active touch point\n */\n\n\n DraggableZone.prototype._getActiveTouch = function (event) {\n return event.targetTouches && this._findTouchInTouchList(event.targetTouches) || event.changedTouches && this._findTouchInTouchList(event.changedTouches);\n };\n /**\n * Get the initial touch identifier associated with the given event\n * @param event - The event that contains the TouchList\n */\n\n\n DraggableZone.prototype._getTouchId = function (event) {\n var touch = event.targetTouches && event.targetTouches[0] || event.changedTouches && event.changedTouches[0];\n\n if (touch) {\n return touch.identifier;\n }\n };\n /**\n * Returns if an element (or any of the element's parents) match the given selector\n */\n\n\n DraggableZone.prototype._matchesSelector = function (element, selector) {\n if (!element || element === document.body) {\n return false;\n }\n\n var matchesSelectorFn = element.matches || element.webkitMatchesSelector || element.msMatchesSelector\n /* for IE */\n ;\n\n if (!matchesSelectorFn) {\n return false;\n }\n\n return matchesSelectorFn.call(element, selector) || this._matchesSelector(element.parentElement, selector);\n };\n /**\n * Attempts to find the Touch that matches the identifier we stored in dragStart\n * @param touchList The TouchList to look for the stored identifier from dragStart\n */\n\n\n DraggableZone.prototype._findTouchInTouchList = function (touchList) {\n if (this._touchId === undefined) {\n return;\n }\n\n for (var i = 0; i < touchList.length; i++) {\n if (touchList[i].identifier === this._touchId) {\n return touchList[i];\n }\n }\n\n return undefined;\n };\n /**\n * Create DragData based off of the last known position and the new position passed in\n * @param position The new position as part of the drag\n */\n\n\n DraggableZone.prototype._createDragDataFromPosition = function (position) {\n var lastPosition = this.state.lastPosition; // If we have no lastPosition, use the given position\n // for last position\n\n if (lastPosition === undefined) {\n return {\n delta: {\n x: 0,\n y: 0\n },\n lastPosition: position,\n position: position\n };\n }\n\n return {\n delta: {\n x: position.x - lastPosition.x,\n y: position.y - lastPosition.y\n },\n lastPosition: lastPosition,\n position: position\n };\n };\n /**\n * Creates an updated DragData based off the current position and given baseDragData\n * @param baseDragData The base DragData (from _createDragDataFromPosition) used to calculate the updated positions\n */\n\n\n DraggableZone.prototype._createUpdatedDragData = function (baseDragData) {\n var position = this.state.position;\n return {\n position: {\n x: position.x + baseDragData.delta.x,\n y: position.y + baseDragData.delta.y\n },\n delta: baseDragData.delta,\n lastPosition: position\n };\n };\n\n return DraggableZone;\n}(React.Component);\n\nexport { DraggableZone };","import { __assign, __decorate, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { classNamesFunction, getId, allowScrollOnElement, allowOverscrollOnElement, KeyCodes, elementContains, warnDeprecations, Async, EventGroup } from '../../Utilities';\nimport { FocusTrapZone } from '../FocusTrapZone/index';\nimport { animationDuration } from './Modal.styles';\nimport { Overlay } from '../../Overlay';\nimport { Layer } from '../../Layer';\nimport { Popup } from '../Popup/index';\nimport { withResponsiveMode, ResponsiveMode } from '../../utilities/decorators/withResponsiveMode';\nimport { DirectionalHint } from '../Callout/index';\nimport { Icon } from '../Icon/index';\nimport { DraggableZone } from '../../utilities/DraggableZone/index';\nimport { initializeComponentRef } from '@uifabric/utilities'; // @TODO - need to change this to a panel whenever the breakpoint is under medium (verify the spec)\n\nvar DefaultLayerProps = {\n eventBubblingEnabled: false\n};\nvar getClassNames = classNamesFunction();\nvar COMPONENT_NAME = 'Modal';\n\nvar ModalBase =\n/** @class */\nfunction (_super) {\n __extends(ModalBase, _super);\n\n function ModalBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._focusTrapZone = React.createRef();\n\n _this._registerInitialModalPosition = function () {\n var _a;\n\n var dialogMain = document.querySelector(\"[data-id=\" + _this.state.id + \"]\");\n\n if (dialogMain) {\n var modalRectangle = dialogMain.getBoundingClientRect();\n\n if (((_a = _this.props.dragOptions) === null || _a === void 0 ? void 0 : _a.keepInBounds) && !_this._minClampedPosition && !_this._maxClampedPosition) {\n _this._minClampedPosition = {\n x: -modalRectangle.x,\n y: -modalRectangle.y\n };\n _this._maxClampedPosition = {\n x: modalRectangle.x,\n y: modalRectangle.y\n };\n }\n\n _this.setState({\n modalRectangleTop: modalRectangle.top\n });\n }\n }; // Allow the user to scroll within the modal but not on the body\n\n\n _this._allowScrollOnModal = function (elt) {\n if (elt) {\n if (_this._allowTouchBodyScroll) {\n allowOverscrollOnElement(elt, _this._events);\n } else {\n allowScrollOnElement(elt, _this._events);\n }\n } else {\n _this._events.off(_this._scrollableContent);\n }\n\n _this._scrollableContent = elt;\n };\n\n _this._onModalContextMenuClose = function () {\n _this.setState({\n isModalMenuOpen: false\n });\n };\n\n _this._onModalClose = function () {\n _this._lastSetX = 0;\n _this._lastSetY = 0;\n\n _this.setState({\n isModalMenuOpen: false,\n isInKeyboardMoveMode: false,\n isOpen: false,\n x: 0,\n y: 0\n });\n\n if (_this.props.dragOptions && _this._hasRegisteredKeyUp) {\n _this._events.off(window, 'keyup', _this._onKeyUp, true\n /* useCapture */\n );\n } // Call the onDismiss callback\n\n\n if (_this.props.onDismissed) {\n _this.props.onDismissed();\n }\n };\n\n _this._onDragStart = function () {\n _this.setState({\n isModalMenuOpen: false,\n isInKeyboardMoveMode: false\n });\n };\n\n _this._onDrag = function (_, ui) {\n var _a = _this.state,\n x = _a.x,\n y = _a.y;\n\n _this.setState(_this._getClampedPosition({\n x: x + ui.delta.x,\n y: y + ui.delta.y\n }));\n };\n\n _this._onDragStop = function () {\n _this.focus();\n };\n\n _this._onKeyUp = function (event) {\n // Need to handle the CTRL + ALT + SPACE key during keyup due to FireFox bug:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143\n // Otherwise it would continue to fire a click even if the event was cancelled\n // during mouseDown.\n if (event.altKey && event.ctrlKey && event.keyCode === KeyCodes.space) {\n // Since this is a global handler, we should make sure the target is within the dialog\n // before opening the dropdown\n if (elementContains(_this._scrollableContent, event.target)) {\n _this.setState({\n isModalMenuOpen: !_this.state.isModalMenuOpen\n });\n\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }; // We need a global onKeyDown event when we are in the move mode so that we can\n // handle the key presses and the components inside the modal do not get the events\n\n\n _this._onKeyDown = function (event) {\n if (event.altKey && event.ctrlKey && event.keyCode === KeyCodes.space) {\n // CTRL + ALT + SPACE is handled during keyUp\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (_this.state.isModalMenuOpen && (event.altKey || event.keyCode === KeyCodes.escape)) {\n _this.setState({\n isModalMenuOpen: false\n });\n }\n\n if (_this.state.isInKeyboardMoveMode && (event.keyCode === KeyCodes.escape || event.keyCode === KeyCodes.enter)) {\n _this.setState({\n isInKeyboardMoveMode: false\n });\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n if (_this.state.isInKeyboardMoveMode) {\n var handledEvent = true;\n\n var delta = _this._getMoveDelta(event);\n\n switch (event.keyCode) {\n /* eslint-disable no-fallthrough */\n case KeyCodes.escape:\n _this.setState({\n x: _this._lastSetX,\n y: _this._lastSetY\n });\n\n case KeyCodes.enter:\n {\n // TODO: determine if fallthrough was intentional\n\n /* eslint-enable no-fallthrough */\n _this._lastSetX = 0;\n _this._lastSetY = 0;\n\n _this.setState({\n isInKeyboardMoveMode: false\n });\n\n break;\n }\n\n case KeyCodes.up:\n {\n _this.setState({\n y: _this._getClampedPositionY(_this.state.y - delta)\n });\n\n break;\n }\n\n case KeyCodes.down:\n {\n _this.setState({\n y: _this._getClampedPositionY(_this.state.y + delta)\n });\n\n break;\n }\n\n case KeyCodes.left:\n {\n _this.setState({\n x: _this._getClampedPositionX(_this.state.x - delta)\n });\n\n break;\n }\n\n case KeyCodes.right:\n {\n _this.setState({\n x: _this._getClampedPositionX(_this.state.x + delta)\n });\n\n break;\n }\n\n default:\n {\n handledEvent = false;\n }\n }\n\n if (handledEvent) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n };\n\n _this._onEnterKeyboardMoveMode = function () {\n _this._lastSetX = _this.state.x;\n _this._lastSetY = _this.state.y;\n\n _this.setState({\n isInKeyboardMoveMode: true,\n isModalMenuOpen: false\n });\n\n _this._events.on(window, 'keydown', _this._onKeyDown, true\n /* useCapture */\n );\n };\n\n _this._onExitKeyboardMoveMode = function () {\n _this._lastSetX = 0;\n _this._lastSetY = 0;\n\n _this.setState({\n isInKeyboardMoveMode: false\n });\n\n _this._events.off(window, 'keydown', _this._onKeyDown, true\n /* useCapture */\n );\n };\n\n _this._registerForKeyUp = function () {\n if (!_this._hasRegisteredKeyUp) {\n _this._events.on(window, 'keyup', _this._onKeyUp, true\n /* useCapture */\n );\n\n _this._hasRegisteredKeyUp = true;\n }\n };\n\n _this._async = new Async(_this);\n _this._events = new EventGroup(_this);\n initializeComponentRef(_this);\n warnDeprecations(COMPONENT_NAME, props, {\n onLayerDidMount: 'layerProps.onLayerDidMount'\n });\n _this.state = {\n id: getId('Modal'),\n isOpen: props.isOpen,\n isVisible: props.isOpen,\n hasBeenOpened: props.isOpen,\n x: 0,\n y: 0\n };\n _this._lastSetX = 0;\n _this._lastSetY = 0;\n var _a = _this.props.allowTouchBodyScroll,\n allowTouchBodyScroll = _a === void 0 ? false : _a;\n _this._allowTouchBodyScroll = allowTouchBodyScroll;\n return _this;\n }\n\n ModalBase.prototype.UNSAFE_componentWillReceiveProps = function (newProps) {\n clearTimeout(this._onModalCloseTimer); // Opening the dialog\n\n if (newProps.isOpen) {\n if (!this.state.isOpen) {\n // First Open\n this.setState({\n isOpen: true\n }); // Add a keyUp handler for all key up events when the dialog is open\n\n if (newProps.dragOptions) {\n this._registerForKeyUp();\n }\n } else {\n // Modal has been opened\n // Reopen during closing\n this.setState({\n hasBeenOpened: true,\n isVisible: true\n });\n }\n } // Closing the dialog\n\n\n if (!newProps.isOpen && this.state.isOpen) {\n this._onModalCloseTimer = this._async.setTimeout(this._onModalClose, parseFloat(animationDuration) * 1000);\n this.setState({\n isVisible: false\n });\n }\n };\n\n ModalBase.prototype.componentDidMount = function () {\n var _this = this; // Not all modals show just by updating their props. Some only render when they are mounted and pass in\n // isOpen as true. We need to add the keyUp handler in componentDidMount if we are in that case.\n\n\n if (this.state.isOpen && this.state.isVisible) {\n this._registerForKeyUp();\n\n requestAnimationFrame(function () {\n return setTimeout(_this._registerInitialModalPosition, 0);\n });\n }\n };\n\n ModalBase.prototype.componentDidUpdate = function (prevProps, prevState) {\n var _this = this;\n\n if (!prevProps.isOpen && !prevState.isVisible) {\n this.setState({\n isVisible: true\n });\n }\n\n if (!prevProps.isOpen && this.props.isOpen) {\n requestAnimationFrame(function () {\n return setTimeout(_this._registerInitialModalPosition, 0);\n });\n }\n };\n\n ModalBase.prototype.componentWillUnmount = function () {\n this._async.dispose();\n\n this._events.dispose();\n };\n\n ModalBase.prototype.render = function () {\n var _a = this.props,\n className = _a.className,\n containerClassName = _a.containerClassName,\n scrollableContentClassName = _a.scrollableContentClassName,\n elementToFocusOnDismiss = _a.elementToFocusOnDismiss,\n firstFocusableSelector = _a.firstFocusableSelector,\n forceFocusInsideTrap = _a.forceFocusInsideTrap,\n ignoreExternalFocusing = _a.ignoreExternalFocusing,\n isBlocking = _a.isBlocking,\n isClickableOutsideFocusTrap = _a.isClickableOutsideFocusTrap,\n isDarkOverlay = _a.isDarkOverlay,\n onDismiss = _a.onDismiss,\n layerProps = _a.layerProps,\n overlay = _a.overlay,\n responsiveMode = _a.responsiveMode,\n titleAriaId = _a.titleAriaId,\n styles = _a.styles,\n subtitleAriaId = _a.subtitleAriaId,\n theme = _a.theme,\n topOffsetFixed = _a.topOffsetFixed,\n // eslint-disable-next-line deprecation/deprecation\n onLayerDidMount = _a.onLayerDidMount,\n isModeless = _a.isModeless,\n isAlert = _a.isAlert,\n dragOptions = _a.dragOptions,\n enableAriaHiddenSiblings = _a.enableAriaHiddenSiblings;\n var _b = this.state,\n isOpen = _b.isOpen,\n isVisible = _b.isVisible,\n hasBeenOpened = _b.hasBeenOpened,\n modalRectangleTop = _b.modalRectangleTop,\n x = _b.x,\n y = _b.y,\n isInKeyboardMoveMode = _b.isInKeyboardMoveMode;\n\n if (!isOpen) {\n return null;\n }\n\n var layerClassName = layerProps === undefined ? '' : layerProps.className;\n var isAlertRole = isAlert !== null && isAlert !== void 0 ? isAlert : isBlocking && !isModeless;\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n containerClassName: containerClassName,\n scrollableContentClassName: scrollableContentClassName,\n isOpen: isOpen,\n isVisible: isVisible,\n hasBeenOpened: hasBeenOpened,\n modalRectangleTop: modalRectangleTop,\n topOffsetFixed: topOffsetFixed,\n isModeless: isModeless,\n layerClassName: layerClassName,\n isDefaultDragHandle: dragOptions && !dragOptions.dragHandleSelector\n });\n\n var mergedLayerProps = __assign(__assign(__assign({}, DefaultLayerProps), this.props.layerProps), {\n onLayerDidMount: layerProps && layerProps.onLayerDidMount ? layerProps.onLayerDidMount : onLayerDidMount,\n insertFirst: isModeless,\n className: classNames.layer\n });\n\n var modalContent = React.createElement(FocusTrapZone, {\n \"data-id\": this.state.id,\n componentRef: this._focusTrapZone,\n className: classNames.main,\n elementToFocusOnDismiss: elementToFocusOnDismiss,\n isClickableOutsideFocusTrap: isModeless || isClickableOutsideFocusTrap || !isBlocking,\n ignoreExternalFocusing: ignoreExternalFocusing,\n forceFocusInsideTrap: isModeless ? !isModeless : forceFocusInsideTrap,\n firstFocusableSelector: firstFocusableSelector,\n focusPreviouslyFocusedInnerElement: true,\n onBlur: isInKeyboardMoveMode ? this._onExitKeyboardMoveMode : undefined,\n enableAriaHiddenSiblings: enableAriaHiddenSiblings\n }, dragOptions && isInKeyboardMoveMode && React.createElement(\"div\", {\n className: classNames.keyboardMoveIconContainer\n }, dragOptions.keyboardMoveIconProps ? React.createElement(Icon, __assign({}, dragOptions.keyboardMoveIconProps)) : React.createElement(Icon, {\n iconName: \"move\",\n className: classNames.keyboardMoveIcon\n })), React.createElement(\"div\", {\n ref: this._allowScrollOnModal,\n className: classNames.scrollableContent,\n \"data-is-scrollable\": true\n }, dragOptions && this.state.isModalMenuOpen && React.createElement(dragOptions.menu, {\n items: [{\n key: 'move',\n text: dragOptions.moveMenuItemText,\n onClick: this._onEnterKeyboardMoveMode\n }, {\n key: 'close',\n text: dragOptions.closeMenuItemText,\n onClick: this._onModalClose\n }],\n onDismiss: this._onModalContextMenuClose,\n alignTargetEdge: true,\n coverTarget: true,\n directionalHint: DirectionalHint.topLeftEdge,\n directionalHintFixed: true,\n shouldFocusOnMount: true,\n target: this._scrollableContent\n }), this.props.children)); // @temp tuatology - Will adjust this to be a panel at certain breakpoints\n\n if (responsiveMode >= ResponsiveMode.small) {\n return React.createElement(Layer, __assign({}, mergedLayerProps), React.createElement(Popup, {\n role: isAlertRole ? 'alertdialog' : 'dialog',\n \"aria-modal\": !isModeless,\n ariaLabelledBy: titleAriaId,\n ariaDescribedBy: subtitleAriaId,\n onDismiss: onDismiss,\n shouldRestoreFocus: !ignoreExternalFocusing\n }, React.createElement(\"div\", {\n className: classNames.root,\n role: !isModeless ? 'document' : undefined\n }, !isModeless && React.createElement(Overlay, __assign({\n isDarkThemed: isDarkOverlay,\n onClick: isBlocking ? undefined : onDismiss,\n allowTouchBodyScroll: this._allowTouchBodyScroll\n }, overlay)), dragOptions ? React.createElement(DraggableZone, {\n handleSelector: dragOptions.dragHandleSelector || \".\" + classNames.main.split(' ')[0],\n preventDragSelector: \"button\",\n onStart: this._onDragStart,\n onDragChange: this._onDrag,\n onStop: this._onDragStop,\n position: {\n x: x,\n y: y\n }\n }, modalContent) : modalContent)));\n }\n\n return null;\n };\n\n ModalBase.prototype.focus = function () {\n if (this._focusTrapZone.current) {\n this._focusTrapZone.current.focus();\n }\n };\n /**\n * Clamps the position coordinates to the maximum/minimum value specified in props\n */\n\n\n ModalBase.prototype._getClampedPosition = function (position) {\n if (!this.props.dragOptions || !this.props.dragOptions.keepInBounds) {\n return position;\n }\n\n return {\n x: this._getClampedPositionX(position.x),\n y: this._getClampedPositionY(position.y)\n };\n };\n\n ModalBase.prototype._getClampedPositionY = function (y) {\n var minPosition = this._minClampedPosition;\n var maxPosition = this._maxClampedPosition;\n\n if (minPosition) {\n y = Math.max(minPosition.y, y);\n }\n\n if (maxPosition) {\n y = Math.min(maxPosition.y, y);\n }\n\n return y;\n };\n\n ModalBase.prototype._getClampedPositionX = function (x) {\n var minPosition = this._minClampedPosition;\n var maxPosition = this._maxClampedPosition;\n\n if (minPosition) {\n x = Math.max(minPosition.x, x);\n }\n\n if (maxPosition) {\n x = Math.min(maxPosition.x, x);\n }\n\n return x;\n };\n\n ModalBase.prototype._getMoveDelta = function (event) {\n var delta = 10;\n\n if (event.shiftKey) {\n if (!event.ctrlKey) {\n delta = 50;\n }\n } else if (event.ctrlKey) {\n delta = 1;\n }\n\n return delta;\n };\n\n ModalBase.defaultProps = {\n isOpen: false,\n isDarkOverlay: true,\n isBlocking: false,\n className: '',\n containerClassName: ''\n };\n ModalBase = __decorate([withResponsiveMode], ModalBase);\n return ModalBase;\n}(React.Component);\n\nexport { ModalBase };","import { styled } from '../../Utilities';\nimport { ModalBase } from './Modal.base';\nimport { getStyles } from './Modal.styles';\nexport var Modal = styled(ModalBase, getStyles, undefined, {\n scope: 'Modal',\n fields: ['theme', 'styles', 'enableAriaHiddenSiblings']\n});","import { AnimationVariables, getGlobalClassNames, ZIndexes } from '../../Styling';\nexport var animationDuration = AnimationVariables.durationValue2;\nvar globalClassNames = {\n root: 'ms-Modal',\n main: 'ms-Dialog-main',\n scrollableContent: 'ms-Modal-scrollableContent',\n isOpen: 'is-open',\n layer: 'ms-Modal-Layer'\n};\nexport var getStyles = function getStyles(props) {\n var _a;\n\n var className = props.className,\n containerClassName = props.containerClassName,\n scrollableContentClassName = props.scrollableContentClassName,\n isOpen = props.isOpen,\n isVisible = props.isVisible,\n hasBeenOpened = props.hasBeenOpened,\n modalRectangleTop = props.modalRectangleTop,\n theme = props.theme,\n topOffsetFixed = props.topOffsetFixed,\n isModeless = props.isModeless,\n layerClassName = props.layerClassName,\n isDefaultDragHandle = props.isDefaultDragHandle;\n var palette = theme.palette,\n effects = theme.effects,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(globalClassNames, theme);\n return {\n root: [classNames.root, fonts.medium, {\n backgroundColor: 'transparent',\n position: isModeless ? 'absolute' : 'fixed',\n height: '100%',\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n opacity: 0,\n pointerEvents: 'none',\n transition: \"opacity \" + animationDuration\n }, topOffsetFixed && typeof modalRectangleTop === 'number' && hasBeenOpened && {\n alignItems: 'flex-start'\n }, isOpen && classNames.isOpen, isVisible && {\n opacity: 1,\n pointerEvents: 'auto'\n }, className],\n main: [classNames.main, {\n boxShadow: effects.elevation64,\n borderRadius: effects.roundedCorner2,\n backgroundColor: palette.white,\n boxSizing: 'border-box',\n position: 'relative',\n textAlign: 'left',\n outline: '3px solid transparent',\n maxHeight: 'calc(100% - 32px)',\n maxWidth: 'calc(100% - 32px)',\n minHeight: '176px',\n minWidth: '288px',\n overflowY: 'auto',\n zIndex: isModeless ? ZIndexes.Layer : undefined\n }, topOffsetFixed && typeof modalRectangleTop === 'number' && hasBeenOpened && {\n top: modalRectangleTop\n }, isDefaultDragHandle && {\n cursor: 'move'\n }, containerClassName],\n scrollableContent: [classNames.scrollableContent, {\n overflowY: 'auto',\n flexGrow: 1,\n maxHeight: '100vh',\n selectors: (_a = {}, _a['@supports (-webkit-overflow-scrolling: touch)'] = {\n maxHeight: window.innerHeight\n }, _a)\n }, scrollableContentClassName],\n layer: isModeless && [layerClassName, classNames.layer, {\n position: 'static',\n width: 'unset',\n height: 'unset'\n }],\n keyboardMoveIconContainer: {\n position: 'absolute',\n display: 'flex',\n justifyContent: 'center',\n width: '100%',\n padding: '3px 0px'\n },\n keyboardMoveIcon: {\n // eslint-disable-next-line deprecation/deprecation\n fontSize: fonts.xLargePlus.fontSize,\n width: '24px'\n }\n };\n};","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { classNamesFunction, getNativeProps, divProperties, enableBodyScroll, disableBodyScroll, initializeComponentRef } from '../../Utilities';\nvar getClassNames = classNamesFunction();\n\nvar OverlayBase =\n/** @class */\nfunction (_super) {\n __extends(OverlayBase, _super);\n\n function OverlayBase(props) {\n var _this = _super.call(this, props) || this;\n\n initializeComponentRef(_this);\n var _a = _this.props.allowTouchBodyScroll,\n allowTouchBodyScroll = _a === void 0 ? false : _a;\n _this._allowTouchBodyScroll = allowTouchBodyScroll;\n return _this;\n }\n\n OverlayBase.prototype.componentDidMount = function () {\n !this._allowTouchBodyScroll && disableBodyScroll();\n };\n\n OverlayBase.prototype.componentWillUnmount = function () {\n !this._allowTouchBodyScroll && enableBodyScroll();\n };\n\n OverlayBase.prototype.render = function () {\n var _a = this.props,\n isDark = _a.isDarkThemed,\n className = _a.className,\n theme = _a.theme,\n styles = _a.styles;\n var divProps = getNativeProps(this.props, divProperties);\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n isDark: isDark\n });\n return React.createElement(\"div\", __assign({}, divProps, {\n className: classNames.root\n }));\n };\n\n return OverlayBase;\n}(React.Component);\n\nexport { OverlayBase };","import { HighContrastSelector, getGlobalClassNames } from '../../Styling';\nvar GlobalClassNames = {\n root: 'ms-Overlay',\n rootDark: 'ms-Overlay--dark'\n};\nexport var getStyles = function getStyles(props) {\n var _a;\n\n var className = props.className,\n theme = props.theme,\n isNone = props.isNone,\n isDark = props.isDark;\n var palette = theme.palette;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n return {\n root: [classNames.root, theme.fonts.medium, {\n backgroundColor: palette.whiteTranslucent40,\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n position: 'absolute',\n selectors: (_a = {}, _a[HighContrastSelector] = {\n border: '1px solid WindowText',\n opacity: 0\n }, _a)\n }, isNone && {\n visibility: 'hidden'\n }, isDark && [classNames.rootDark, {\n backgroundColor: palette.blackTranslucent40\n }], className]\n };\n};","import { styled } from '../../Utilities';\nimport { OverlayBase } from './Overlay.base';\nimport { getStyles } from './Overlay.styles';\nexport var Overlay = styled(OverlayBase, getStyles, undefined, {\n scope: 'Overlay'\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { IconButton } from '../../Button';\nimport { Layer } from '../../Layer';\nimport { Overlay } from '../../Overlay';\nimport { Popup } from '../../Popup';\nimport { allowScrollOnElement, allowOverscrollOnElement, classNamesFunction, divProperties, elementContains, getId, getNativeProps, getRTL, css, warnDeprecations, Async, EventGroup, initializeComponentRef } from '../../Utilities';\nimport { FocusTrapZone } from '../FocusTrapZone/index';\nimport { PanelType } from './Panel.types';\nvar getClassNames = classNamesFunction();\nvar COMPONENT_NAME = 'Panel';\nvar PanelVisibilityState;\n\n(function (PanelVisibilityState) {\n PanelVisibilityState[PanelVisibilityState[\"closed\"] = 0] = \"closed\";\n PanelVisibilityState[PanelVisibilityState[\"animatingOpen\"] = 1] = \"animatingOpen\";\n PanelVisibilityState[PanelVisibilityState[\"open\"] = 2] = \"open\";\n PanelVisibilityState[PanelVisibilityState[\"animatingClosed\"] = 3] = \"animatingClosed\";\n})(PanelVisibilityState || (PanelVisibilityState = {}));\n\nvar PanelBase =\n/** @class */\nfunction (_super) {\n __extends(PanelBase, _super);\n\n function PanelBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._panel = React.createRef();\n _this._animationCallback = null;\n _this._hasCustomNavigation = !!(_this.props.onRenderNavigation || _this.props.onRenderNavigationContent);\n\n _this.dismiss = function (ev) {\n if (_this.props.onDismiss && _this.isActive) {\n _this.props.onDismiss(ev);\n }\n\n if (!ev || ev && !ev.defaultPrevented) {\n _this.close();\n }\n }; // Allow the user to scroll within the panel but not on the body\n\n\n _this._allowScrollOnPanel = function (elt) {\n if (elt) {\n if (_this._allowTouchBodyScroll) {\n allowOverscrollOnElement(elt, _this._events);\n } else {\n allowScrollOnElement(elt, _this._events);\n }\n } else {\n _this._events.off(_this._scrollableContent);\n }\n\n _this._scrollableContent = elt;\n };\n\n _this._onRenderNavigation = function (props) {\n if (!_this.props.onRenderNavigationContent && !_this.props.onRenderNavigation && !_this.props.hasCloseButton) {\n return null;\n }\n\n var _a = _this.props.onRenderNavigationContent,\n onRenderNavigationContent = _a === void 0 ? _this._onRenderNavigationContent : _a;\n return React.createElement(\"div\", {\n className: _this._classNames.navigation\n }, onRenderNavigationContent(props, _this._onRenderNavigationContent));\n };\n\n _this._onRenderNavigationContent = function (props) {\n var _a;\n\n var closeButtonAriaLabel = props.closeButtonAriaLabel,\n hasCloseButton = props.hasCloseButton,\n _b = props.onRenderHeader,\n onRenderHeader = _b === void 0 ? _this._onRenderHeader : _b;\n\n if (hasCloseButton) {\n var iconButtonStyles = (_a = _this._classNames.subComponentStyles) === null || _a === void 0 ? void 0 : _a.closeButton();\n return React.createElement(React.Fragment, null, !_this._hasCustomNavigation && onRenderHeader(_this.props, _this._onRenderHeader, _this._headerTextId), React.createElement(IconButton, {\n styles: iconButtonStyles,\n // eslint-disable-next-line deprecation/deprecation\n className: _this._classNames.closeButton,\n onClick: _this._onPanelClick,\n ariaLabel: closeButtonAriaLabel,\n title: closeButtonAriaLabel,\n \"data-is-visible\": true,\n iconProps: {\n iconName: 'Cancel'\n }\n }));\n }\n\n return null;\n };\n\n _this._onRenderHeader = function (props, defaultRender, headerTextId) {\n var headerText = props.headerText,\n _a = props.headerTextProps,\n headerTextProps = _a === void 0 ? {} : _a;\n\n if (headerText) {\n return React.createElement(\"div\", {\n className: _this._classNames.header\n }, React.createElement(\"div\", __assign({\n id: headerTextId,\n role: \"heading\",\n \"aria-level\": 1\n }, headerTextProps, {\n className: css(_this._classNames.headerText, headerTextProps.className)\n }), headerText));\n }\n\n return null;\n };\n\n _this._onRenderBody = function (props) {\n return React.createElement(\"div\", {\n className: _this._classNames.content\n }, props.children);\n };\n\n _this._onRenderFooter = function (props) {\n var _a = _this.props.onRenderFooterContent,\n onRenderFooterContent = _a === void 0 ? null : _a;\n\n if (onRenderFooterContent) {\n return React.createElement(\"div\", {\n className: _this._classNames.footer\n }, React.createElement(\"div\", {\n className: _this._classNames.footerInner\n }, onRenderFooterContent()));\n }\n\n return null;\n };\n\n _this._animateTo = function (newVisibilityState) {\n if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpen) {\n _this.props.onOpen();\n }\n\n _this._animationCallback = _this._async.setTimeout(function () {\n _this.setState({\n visibility: newVisibilityState\n });\n\n _this._onTransitionComplete();\n }, 200);\n };\n\n _this._clearExistingAnimationTimer = function () {\n if (_this._animationCallback !== null) {\n _this._async.clearTimeout(_this._animationCallback);\n }\n };\n\n _this._onPanelClick = function (ev) {\n _this.dismiss(ev);\n };\n\n _this._onTransitionComplete = function () {\n _this._updateFooterPosition();\n\n if (_this.state.visibility === PanelVisibilityState.open && _this.props.onOpened) {\n _this.props.onOpened();\n }\n\n if (_this.state.visibility === PanelVisibilityState.closed && _this.props.onDismissed) {\n _this.props.onDismissed();\n }\n };\n\n var _a = _this.props.allowTouchBodyScroll,\n allowTouchBodyScroll = _a === void 0 ? false : _a;\n _this._allowTouchBodyScroll = allowTouchBodyScroll;\n _this._async = new Async(_this);\n _this._events = new EventGroup(_this);\n initializeComponentRef(_this);\n warnDeprecations(COMPONENT_NAME, props, {\n ignoreExternalFocusing: 'focusTrapZoneProps',\n forceFocusInsideTrap: 'focusTrapZoneProps',\n firstFocusableSelector: 'focusTrapZoneProps'\n });\n _this.state = {\n isFooterSticky: false,\n // intentionally ignore props so animation takes place during componentDidMount\n visibility: PanelVisibilityState.closed,\n id: getId('Panel')\n };\n return _this;\n }\n\n PanelBase.getDerivedStateFromProps = function (nextProps, prevState) {\n if (nextProps.isOpen === undefined) {\n return null; // no state update\n }\n\n if (nextProps.isOpen && (prevState.visibility === PanelVisibilityState.closed || prevState.visibility === PanelVisibilityState.animatingClosed)) {\n return {\n visibility: PanelVisibilityState.animatingOpen\n };\n }\n\n if (!nextProps.isOpen && (prevState.visibility === PanelVisibilityState.open || prevState.visibility === PanelVisibilityState.animatingOpen)) {\n return {\n visibility: PanelVisibilityState.animatingClosed\n };\n }\n\n return null;\n };\n\n PanelBase.prototype.componentDidMount = function () {\n this._events.on(window, 'resize', this._updateFooterPosition);\n\n if (this._shouldListenForOuterClick(this.props)) {\n this._events.on(document.body, 'mousedown', this._dismissOnOuterClick, true);\n }\n\n if (this.props.isOpen) {\n this.setState({\n visibility: PanelVisibilityState.animatingOpen\n });\n }\n };\n\n PanelBase.prototype.componentDidUpdate = function (previousProps, previousState) {\n var shouldListenOnOuterClick = this._shouldListenForOuterClick(this.props);\n\n var previousShouldListenOnOuterClick = this._shouldListenForOuterClick(previousProps);\n\n if (this.state.visibility !== previousState.visibility) {\n this._clearExistingAnimationTimer();\n\n if (this.state.visibility === PanelVisibilityState.animatingOpen) {\n this._animateTo(PanelVisibilityState.open);\n } else if (this.state.visibility === PanelVisibilityState.animatingClosed) {\n this._animateTo(PanelVisibilityState.closed);\n }\n }\n\n if (shouldListenOnOuterClick && !previousShouldListenOnOuterClick) {\n this._events.on(document.body, 'mousedown', this._dismissOnOuterClick, true);\n } else if (!shouldListenOnOuterClick && previousShouldListenOnOuterClick) {\n this._events.off(document.body, 'mousedown', this._dismissOnOuterClick, true);\n }\n };\n\n PanelBase.prototype.componentWillUnmount = function () {\n this._async.dispose();\n\n this._events.dispose();\n };\n\n PanelBase.prototype.render = function () {\n var _a = this.props,\n _b = _a.className,\n className = _b === void 0 ? '' : _b,\n elementToFocusOnDismiss = _a.elementToFocusOnDismiss,\n\n /* eslint-disable deprecation/deprecation */\n firstFocusableSelector = _a.firstFocusableSelector,\n focusTrapZoneProps = _a.focusTrapZoneProps,\n forceFocusInsideTrap = _a.forceFocusInsideTrap,\n hasCloseButton = _a.hasCloseButton,\n headerText = _a.headerText,\n _c = _a.headerClassName,\n headerClassName = _c === void 0 ? '' : _c,\n ignoreExternalFocusing = _a.ignoreExternalFocusing,\n\n /* eslint-enable deprecation/deprecation */\n isBlocking = _a.isBlocking,\n isFooterAtBottom = _a.isFooterAtBottom,\n isLightDismiss = _a.isLightDismiss,\n isHiddenOnDismiss = _a.isHiddenOnDismiss,\n layerProps = _a.layerProps,\n overlayProps = _a.overlayProps,\n popupProps = _a.popupProps,\n type = _a.type,\n styles = _a.styles,\n theme = _a.theme,\n customWidth = _a.customWidth,\n _d = _a.onLightDismissClick,\n onLightDismissClick = _d === void 0 ? this._onPanelClick : _d,\n _e = _a.onRenderNavigation,\n onRenderNavigation = _e === void 0 ? this._onRenderNavigation : _e,\n _f = _a.onRenderHeader,\n onRenderHeader = _f === void 0 ? this._onRenderHeader : _f,\n _g = _a.onRenderBody,\n onRenderBody = _g === void 0 ? this._onRenderBody : _g,\n _h = _a.onRenderFooter,\n onRenderFooter = _h === void 0 ? this._onRenderFooter : _h;\n var _j = this.state,\n isFooterSticky = _j.isFooterSticky,\n visibility = _j.visibility,\n id = _j.id;\n var isLeft = type === PanelType.smallFixedNear || type === PanelType.customNear ? true : false;\n var isRTL = getRTL(theme);\n var isOnRightSide = isRTL ? isLeft : !isLeft;\n var customWidthStyles = type === PanelType.custom || type === PanelType.customNear ? {\n width: customWidth\n } : {};\n var nativeProps = getNativeProps(this.props, divProperties);\n var isOpen = this.isActive;\n var isAnimating = visibility === PanelVisibilityState.animatingClosed || visibility === PanelVisibilityState.animatingOpen;\n this._headerTextId = headerText && id + '-headerText';\n\n if (!isOpen && !isAnimating && !isHiddenOnDismiss) {\n return null;\n }\n\n this._classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n focusTrapZoneClassName: focusTrapZoneProps ? focusTrapZoneProps.className : undefined,\n hasCloseButton: hasCloseButton,\n headerClassName: headerClassName,\n isAnimating: isAnimating,\n isFooterSticky: isFooterSticky,\n isFooterAtBottom: isFooterAtBottom,\n isOnRightSide: isOnRightSide,\n isOpen: isOpen,\n isHiddenOnDismiss: isHiddenOnDismiss,\n type: type,\n hasCustomNavigation: this._hasCustomNavigation\n });\n\n var _k = this,\n _classNames = _k._classNames,\n _allowTouchBodyScroll = _k._allowTouchBodyScroll;\n\n var overlay;\n\n if (isBlocking && isOpen) {\n overlay = React.createElement(Overlay, __assign({\n className: _classNames.overlay,\n isDarkThemed: false,\n onClick: isLightDismiss ? onLightDismissClick : undefined,\n allowTouchBodyScroll: _allowTouchBodyScroll\n }, overlayProps));\n }\n\n return React.createElement(Layer, __assign({}, layerProps), React.createElement(Popup, __assign({\n role: \"dialog\",\n \"aria-modal\": \"true\",\n ariaLabelledBy: this._headerTextId ? this._headerTextId : undefined,\n onDismiss: this.dismiss,\n className: _classNames.hiddenPanel\n }, popupProps), React.createElement(\"div\", __assign({\n \"aria-hidden\": !isOpen && isAnimating\n }, nativeProps, {\n ref: this._panel,\n className: _classNames.root\n }), overlay, React.createElement(FocusTrapZone, __assign({\n ignoreExternalFocusing: ignoreExternalFocusing,\n forceFocusInsideTrap: !isBlocking || isHiddenOnDismiss && !isOpen ? false : forceFocusInsideTrap,\n firstFocusableSelector: firstFocusableSelector,\n isClickableOutsideFocusTrap: true\n }, focusTrapZoneProps, {\n className: _classNames.main,\n style: customWidthStyles,\n elementToFocusOnDismiss: elementToFocusOnDismiss\n }), React.createElement(\"div\", {\n className: _classNames.commands,\n \"data-is-visible\": true\n }, onRenderNavigation(this.props, this._onRenderNavigation)), React.createElement(\"div\", {\n className: _classNames.contentInner\n }, (this._hasCustomNavigation || !hasCloseButton) && onRenderHeader(this.props, this._onRenderHeader, this._headerTextId), React.createElement(\"div\", {\n ref: this._allowScrollOnPanel,\n className: _classNames.scrollableContent,\n \"data-is-scrollable\": true\n }, onRenderBody(this.props, this._onRenderBody)), onRenderFooter(this.props, this._onRenderFooter))))));\n };\n\n PanelBase.prototype.open = function () {\n if (this.props.isOpen !== undefined) {\n return;\n }\n\n if (this.isActive) {\n return;\n }\n\n this.setState({\n visibility: PanelVisibilityState.animatingOpen\n });\n };\n\n PanelBase.prototype.close = function () {\n if (this.props.isOpen !== undefined) {\n return;\n }\n\n if (!this.isActive) {\n return;\n }\n\n this.setState({\n visibility: PanelVisibilityState.animatingClosed\n });\n };\n\n Object.defineProperty(PanelBase.prototype, \"isActive\", {\n /** isActive is true when panel is open or opening. */\n get: function get() {\n return this.state.visibility === PanelVisibilityState.open || this.state.visibility === PanelVisibilityState.animatingOpen;\n },\n enumerable: true,\n configurable: true\n });\n\n PanelBase.prototype._shouldListenForOuterClick = function (props) {\n return !!props.isBlocking && !!props.isOpen;\n };\n\n PanelBase.prototype._updateFooterPosition = function () {\n var scrollableContent = this._scrollableContent;\n\n if (scrollableContent) {\n var height = scrollableContent.clientHeight;\n var innerHeight_1 = scrollableContent.scrollHeight;\n this.setState({\n isFooterSticky: height < innerHeight_1 ? true : false\n });\n }\n };\n\n PanelBase.prototype._dismissOnOuterClick = function (ev) {\n var panel = this._panel.current;\n\n if (this.isActive && panel && !ev.defaultPrevented) {\n if (!elementContains(panel, ev.target)) {\n if (this.props.onOuterClick) {\n this.props.onOuterClick(ev);\n } else {\n this.dismiss(ev);\n }\n }\n }\n };\n\n PanelBase.defaultProps = {\n isHiddenOnDismiss: false,\n isOpen: undefined,\n isBlocking: true,\n hasCloseButton: true,\n type: PanelType.smallFixedFar\n };\n return PanelBase;\n}(React.Component);\n\nexport { PanelBase };","var _a, _b, _c, _d, _e;\n\nimport { __assign } from \"tslib\";\nimport { PanelType } from './Panel.types';\nimport { AnimationClassNames, AnimationVariables, getGlobalClassNames, HighContrastSelector, ScreenWidthMinMedium, ScreenWidthMinLarge, ScreenWidthMinXLarge, ScreenWidthMinXXLarge, ScreenWidthMinUhfMobile, IconFontSizes } from '../../Styling';\nvar GlobalClassNames = {\n root: 'ms-Panel',\n main: 'ms-Panel-main',\n commands: 'ms-Panel-commands',\n contentInner: 'ms-Panel-contentInner',\n scrollableContent: 'ms-Panel-scrollableContent',\n navigation: 'ms-Panel-navigation',\n closeButton: 'ms-Panel-closeButton ms-PanelAction-close',\n header: 'ms-Panel-header',\n headerText: 'ms-Panel-headerText',\n content: 'ms-Panel-content',\n footer: 'ms-Panel-footer',\n footerInner: 'ms-Panel-footerInner',\n isOpen: 'is-open',\n hasCloseButton: 'ms-Panel--hasCloseButton',\n smallFluid: 'ms-Panel--smFluid',\n smallFixedNear: 'ms-Panel--smLeft',\n smallFixedFar: 'ms-Panel--sm',\n medium: 'ms-Panel--md',\n large: 'ms-Panel--lg',\n largeFixed: 'ms-Panel--fixed',\n extraLarge: 'ms-Panel--xl',\n custom: 'ms-Panel--custom',\n customNear: 'ms-Panel--customLeft'\n};\nvar panelWidth = {\n full: '100%',\n auto: 'auto',\n xs: 272,\n sm: 340,\n md1: 592,\n md2: 644,\n lg: 940\n};\nvar panelMargin = {\n auto: 'auto',\n none: 0,\n md: 48,\n lg: 428,\n xl: 176\n}; // Following consts are used below in `getPanelBreakpoints()` function to provide\n// necessary fallbacks for different types of Panel in different breakpoints.\n\nvar smallPanelSelectors = (_a = {}, _a[\"@media (min-width: \" + ScreenWidthMinMedium + \"px)\"] = {\n width: panelWidth.sm\n}, _a);\nvar mediumPanelSelectors = (_b = {}, _b[\"@media (min-width: \" + ScreenWidthMinLarge + \"px)\"] = {\n width: panelWidth.md1\n}, _b[\"@media (min-width: \" + ScreenWidthMinXLarge + \"px)\"] = {\n width: panelWidth.md2\n}, _b);\nvar largePanelSelectors = (_c = {}, _c[\"@media (min-width: \" + ScreenWidthMinUhfMobile + \"px)\"] = {\n left: panelMargin.md,\n width: panelWidth.auto\n}, _c[\"@media (min-width: \" + ScreenWidthMinXXLarge + \"px)\"] = {\n left: panelMargin.lg\n}, _c);\nvar largeFixedPanelSelectors = (_d = {}, _d[\"@media (min-width: \" + ScreenWidthMinXXLarge + \"px)\"] = {\n left: panelMargin.auto,\n width: panelWidth.lg\n}, _d);\nvar extraLargePanelSelectors = (_e = {}, _e[\"@media (min-width: \" + ScreenWidthMinXXLarge + \"px)\"] = {\n left: panelMargin.xl\n}, _e); // Make sure Panels have fallbacks to different breakpoints by reusing same selectors.\n// This is done in the effort to follow design redlines.\n\nvar getPanelBreakpoints = function getPanelBreakpoints(type) {\n var selectors; // Panel types `smallFluid`, `smallFixedNear`, `custom` and `customNear`\n // are not checked in here because they render the same in all the breakpoints\n // and have the checks done separately in the `getStyles` function below.\n\n switch (type) {\n case PanelType.smallFixedFar:\n selectors = __assign({}, smallPanelSelectors);\n break;\n\n case PanelType.medium:\n selectors = __assign(__assign({}, smallPanelSelectors), mediumPanelSelectors);\n break;\n\n case PanelType.large:\n selectors = __assign(__assign(__assign({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors);\n break;\n\n case PanelType.largeFixed:\n selectors = __assign(__assign(__assign(__assign({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), largeFixedPanelSelectors);\n break;\n\n case PanelType.extraLarge:\n selectors = __assign(__assign(__assign(__assign({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), extraLargePanelSelectors);\n break;\n\n default:\n break;\n }\n\n return selectors;\n};\n\nvar commandBarHeight = '44px';\nvar sharedPaddingStyles = {\n paddingLeft: '24px',\n paddingRight: '24px'\n};\nexport var getStyles = function getStyles(props) {\n var _a;\n\n var className = props.className,\n focusTrapZoneClassName = props.focusTrapZoneClassName,\n hasCloseButton = props.hasCloseButton,\n headerClassName = props.headerClassName,\n isAnimating = props.isAnimating,\n isFooterSticky = props.isFooterSticky,\n isFooterAtBottom = props.isFooterAtBottom,\n isOnRightSide = props.isOnRightSide,\n isOpen = props.isOpen,\n isHiddenOnDismiss = props.isHiddenOnDismiss,\n hasCustomNavigation = props.hasCustomNavigation,\n theme = props.theme,\n _b = props.type,\n type = _b === void 0 ? PanelType.smallFixedFar : _b;\n var effects = theme.effects,\n fonts = theme.fonts,\n semanticColors = theme.semanticColors;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var isCustomPanel = type === PanelType.custom || type === PanelType.customNear;\n return {\n root: [classNames.root, theme.fonts.medium, isOpen && classNames.isOpen, hasCloseButton && classNames.hasCloseButton, {\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0\n }, isCustomPanel && isOnRightSide && classNames.custom, isCustomPanel && !isOnRightSide && classNames.customNear, className],\n overlay: [{\n pointerEvents: 'auto',\n cursor: 'pointer'\n }, isOpen && isAnimating && AnimationClassNames.fadeIn100, !isOpen && isAnimating && AnimationClassNames.fadeOut100],\n hiddenPanel: [!isOpen && !isAnimating && isHiddenOnDismiss && {\n visibility: 'hidden'\n }],\n main: [classNames.main, {\n backgroundColor: semanticColors.bodyBackground,\n boxShadow: effects.elevation64,\n pointerEvents: 'auto',\n position: 'absolute',\n display: 'flex',\n flexDirection: 'column',\n overflowX: 'hidden',\n overflowY: 'auto',\n WebkitOverflowScrolling: 'touch',\n bottom: 0,\n top: 0,\n // left, right, width are overridden depending on the type of the Panel and the screen breakpoint.\n left: panelMargin.auto,\n right: panelMargin.none,\n width: panelWidth.full,\n selectors: __assign((_a = {}, _a[HighContrastSelector] = {\n borderLeft: \"3px solid \" + semanticColors.variantBorder,\n borderRight: \"3px solid \" + semanticColors.variantBorder\n }, _a), getPanelBreakpoints(type))\n }, type === PanelType.smallFluid && {\n left: panelMargin.none\n }, type === PanelType.smallFixedNear && {\n left: panelMargin.none,\n right: panelMargin.auto,\n width: panelWidth.xs\n }, type === PanelType.customNear && {\n right: 'auto',\n left: 0\n }, isCustomPanel && {\n maxWidth: '100vw'\n }, isOpen && isAnimating && !isOnRightSide && AnimationClassNames.slideRightIn40, isOpen && isAnimating && isOnRightSide && AnimationClassNames.slideLeftIn40, !isOpen && isAnimating && !isOnRightSide && AnimationClassNames.slideLeftOut40, !isOpen && isAnimating && isOnRightSide && AnimationClassNames.slideRightOut40, focusTrapZoneClassName],\n commands: [classNames.commands, {\n marginTop: 18\n }, hasCustomNavigation && {\n marginTop: 'inherit'\n }],\n navigation: [classNames.navigation, {\n display: 'flex',\n justifyContent: 'flex-end'\n }, hasCustomNavigation && {\n height: commandBarHeight\n }],\n contentInner: [classNames.contentInner, {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n overflowY: 'hidden'\n }],\n header: [classNames.header, sharedPaddingStyles, {\n alignSelf: 'flex-start'\n }, hasCloseButton && !hasCustomNavigation && {\n flexGrow: 1\n }, hasCustomNavigation && {\n // Ensure that title doesn't shrink if screen is too small\n flexShrink: 0\n }],\n headerText: [classNames.headerText, fonts.xLarge, {\n color: semanticColors.bodyText,\n lineHeight: '27px',\n overflowWrap: 'break-word',\n wordWrap: 'break-word',\n wordBreak: 'break-word',\n hyphens: 'auto'\n }, headerClassName],\n scrollableContent: [classNames.scrollableContent, {\n overflowY: 'auto'\n }, isFooterAtBottom && {\n flexGrow: 1\n }],\n content: [classNames.content, sharedPaddingStyles, {\n paddingBottom: 20\n }],\n footer: [classNames.footer, {\n // Ensure that footer doesn't shrink if screen is too small\n flexShrink: 0,\n borderTop: '1px solid transparent',\n transition: \"opacity \" + AnimationVariables.durationValue3 + \" \" + AnimationVariables.easeFunction2\n }, isFooterSticky && {\n background: semanticColors.bodyBackground,\n borderTopColor: semanticColors.variantBorder\n }],\n footerInner: [classNames.footerInner, sharedPaddingStyles, {\n paddingBottom: 16,\n paddingTop: 16\n }],\n subComponentStyles: {\n closeButton: {\n root: [classNames.closeButton, {\n marginRight: 14,\n color: theme.palette.neutralSecondary,\n fontSize: IconFontSizes.large\n }, hasCustomNavigation && {\n marginRight: 0,\n height: 'auto',\n width: '44px'\n }],\n rootHovered: {\n color: theme.palette.neutralPrimary\n }\n }\n }\n };\n};","import { styled } from '../../Utilities';\nimport { PanelBase } from './Panel.base';\nimport { getStyles } from './Panel.styles';\n/**\n * Panel description\n */\n\nexport var Panel = styled(PanelBase, getStyles, undefined, {\n scope: 'Panel'\n});","/**\n * {@docCategory Panel}\n */\nexport var PanelType;\n\n(function (PanelType) {\n /**\n * Renders the Panel with a `fluid` (full screen) width.\n * Recommended for use on small screen breakpoints.\n * - Small (320-479): full screen width, 16px left/right padding\n * - Medium (480-639): full screen width, 16px left/right padding\n * - Large (640-1023): full screen width, 32px left/right padding\n * - XLarge (1024-1365): full screen width, 32px left/right padding\n * - XXLarge (1366-up): full screen width, 40px left/right padding\n */\n PanelType[PanelType[\"smallFluid\"] = 0] = \"smallFluid\";\n /**\n * Renders the Panel in fixed-width `small` size, anchored to the far side (right in LTR mode).\n * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint\n * - Medium (480-639): 340px width, 16px left/right padding\n * - Large (640-1023): 340px width, 32px left/right padding\n * - XLarge (1024-1365): 340px width, 32px left/right padding\n * - XXLarge (1366-up): 340px width, 40px left/right padding\n */\n\n PanelType[PanelType[\"smallFixedFar\"] = 1] = \"smallFixedFar\";\n /**\n * Renders the Panel in fixed-width `small` size, anchored to the near side (left in LTR mode).\n * - Small (320-479): 272px width, 16px left/right padding\n * - Medium (480-639): 272px width, 16px left/right padding\n * - Large (640-1023): 272px width, 32px left/right padding\n * - XLarge (1024-1365): 272px width, 32px left/right padding\n * - XXLarge (1366-up): 272px width, 40px left/right padding\n */\n\n PanelType[PanelType[\"smallFixedNear\"] = 2] = \"smallFixedNear\";\n /**\n * Renders the Panel in `medium` size, anchored to the far side (right in LTR mode).\n * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint\n * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint\n * - Large (640-1023): 592px width, 32px left/right padding\n * - XLarge (1024-1365): 644px width, 32px left/right padding\n * - XXLarge (1366-up): 644px width, 40px left/right padding\n */\n\n PanelType[PanelType[\"medium\"] = 3] = \"medium\";\n /**\n * Renders the Panel in `large` size, anchored to the far side (right in LTR mode).\n * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint\n * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint\n * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint\n * - XLarge (1024-1365): 48px fixed left margin, fluid width, 32px left/right padding\n * - XXLarge (1366-up): 428px fixed left margin, fluid width, 40px left/right padding\n */\n\n PanelType[PanelType[\"large\"] = 4] = \"large\";\n /**\n * Renders the Panel in `large` size, anchored to the far side (right in LTR mode), with a fixed width at\n * XX-Large breakpoint.\n * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint\n * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint\n * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint\n * - XLarge (1024-1365): 48px fixed left margin, fluid width, 32px left/right padding\n * - XXLarge (1366-up): 940px width, 40px left/right padding\n */\n\n PanelType[PanelType[\"largeFixed\"] = 5] = \"largeFixed\";\n /**\n * Renders the Panel in `extra large` size, anchored to the far side (right in LTR mode).\n * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint\n * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint\n * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint\n * - XLarge (1024-1365): adapts to `PanelType.large` at this breakpoint\n * - XXLarge (1366-1919): 176px fixed left margin, fluid width, 40px left/right padding\n * - XXXLarge (1920-up): 176px fixed left margin, fluid width, 40px left/right padding\n */\n\n PanelType[PanelType[\"extraLarge\"] = 6] = \"extraLarge\";\n /**\n * Renders the Panel in `custom` size using `customWidth`, anchored to the far side (right in LTR mode).\n * - Has a fixed width provided by the `customWidth` prop\n * - When screen width reaches the `customWidth` value it will behave like a fluid width Panel\n * taking up 100% of the viewport width\n */\n\n PanelType[PanelType[\"custom\"] = 7] = \"custom\";\n /**\n * Renders the Panel in `custom` size using `customWidth`, anchored to the near side (left in LTR mode).\n * - Has a fixed width provided by the `customWidth` prop\n * - When screen width reaches the `customWidth` value it will behave like a fluid width Panel\n * taking up 100% of the viewport width\n */\n\n PanelType[PanelType[\"customNear\"] = 8] = \"customNear\";\n})(PanelType || (PanelType = {}));","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { warnDeprecations, classNamesFunction, divProperties, getNativeProps } from '../../Utilities';\nimport { TooltipHost, TooltipOverflowMode, DirectionalHint } from '../../Tooltip';\nimport { PersonaCoin } from './PersonaCoin/PersonaCoin';\nimport { PersonaPresence as PersonaPresenceEnum, PersonaSize } from './Persona.types';\nvar getClassNames = classNamesFunction();\n/**\n * Persona with no default styles.\n * [Use the `styles` API to add your own styles.](https://github.com/microsoft/fluentui/wiki/Styling)\n */\n\nvar PersonaBase =\n/** @class */\nfunction (_super) {\n __extends(PersonaBase, _super);\n\n function PersonaBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._onRenderPersonaCoin = function (props) {\n return React.createElement(PersonaCoin, __assign({}, props));\n };\n\n if (process.env.NODE_ENV !== 'production') {\n warnDeprecations('Persona', props, {\n primaryText: 'text'\n });\n }\n\n return _this;\n }\n\n PersonaBase.prototype.render = function () {\n // wrapping default render behavior based on various this.props properties\n var _onRenderPrimaryText = this._onRenderText(this._getText());\n\n var _onRenderSecondaryText = this._onRenderText(this.props.secondaryText);\n\n var _onRenderTertiaryText = this._onRenderText(this.props.tertiaryText);\n\n var _onRenderOptionalText = this._onRenderText(this.props.optionalText);\n\n var _a = this.props,\n hidePersonaDetails = _a.hidePersonaDetails,\n _b = _a.onRenderOptionalText,\n onRenderOptionalText = _b === void 0 ? _onRenderOptionalText : _b,\n _c = _a.onRenderPrimaryText,\n onRenderPrimaryText = _c === void 0 ? _onRenderPrimaryText : _c,\n _d = _a.onRenderSecondaryText,\n onRenderSecondaryText = _d === void 0 ? _onRenderSecondaryText : _d,\n _e = _a.onRenderTertiaryText,\n onRenderTertiaryText = _e === void 0 ? _onRenderTertiaryText : _e,\n _f = _a.onRenderPersonaCoin,\n onRenderPersonaCoin = _f === void 0 ? this._onRenderPersonaCoin : _f;\n var size = this.props.size; // These properties are to be explicitly passed into PersonaCoin because they are the only props directly used\n\n var _g = this.props,\n allowPhoneInitials = _g.allowPhoneInitials,\n className = _g.className,\n coinProps = _g.coinProps,\n showUnknownPersonaCoin = _g.showUnknownPersonaCoin,\n coinSize = _g.coinSize,\n styles = _g.styles,\n imageAlt = _g.imageAlt,\n imageInitials = _g.imageInitials,\n imageShouldFadeIn = _g.imageShouldFadeIn,\n imageShouldStartVisible = _g.imageShouldStartVisible,\n imageUrl = _g.imageUrl,\n initialsColor = _g.initialsColor,\n initialsTextColor = _g.initialsTextColor,\n isOutOfOffice = _g.isOutOfOffice,\n onPhotoLoadingStateChange = _g.onPhotoLoadingStateChange,\n // eslint-disable-next-line deprecation/deprecation\n onRenderCoin = _g.onRenderCoin,\n onRenderInitials = _g.onRenderInitials,\n presence = _g.presence,\n presenceTitle = _g.presenceTitle,\n presenceColors = _g.presenceColors,\n showInitialsUntilImageLoads = _g.showInitialsUntilImageLoads,\n showSecondaryText = _g.showSecondaryText,\n theme = _g.theme;\n\n var personaCoinProps = __assign({\n allowPhoneInitials: allowPhoneInitials,\n showUnknownPersonaCoin: showUnknownPersonaCoin,\n coinSize: coinSize,\n imageAlt: imageAlt,\n imageInitials: imageInitials,\n imageShouldFadeIn: imageShouldFadeIn,\n imageShouldStartVisible: imageShouldStartVisible,\n imageUrl: imageUrl,\n initialsColor: initialsColor,\n initialsTextColor: initialsTextColor,\n onPhotoLoadingStateChange: onPhotoLoadingStateChange,\n onRenderCoin: onRenderCoin,\n onRenderInitials: onRenderInitials,\n presence: presence,\n presenceTitle: presenceTitle,\n showInitialsUntilImageLoads: showInitialsUntilImageLoads,\n size: size,\n text: this._getText(),\n isOutOfOffice: isOutOfOffice,\n presenceColors: presenceColors\n }, coinProps);\n\n var classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n showSecondaryText: showSecondaryText,\n presence: presence,\n size: size\n });\n var divProps = getNativeProps(this.props, divProperties);\n var personaDetails = React.createElement(\"div\", {\n className: classNames.details\n }, this._renderElement(classNames.primaryText, onRenderPrimaryText, _onRenderPrimaryText), this._renderElement(classNames.secondaryText, onRenderSecondaryText, _onRenderSecondaryText), this._renderElement(classNames.tertiaryText, onRenderTertiaryText, _onRenderTertiaryText), this._renderElement(classNames.optionalText, onRenderOptionalText, _onRenderOptionalText), this.props.children);\n return React.createElement(\"div\", __assign({}, divProps, {\n className: classNames.root,\n style: coinSize ? {\n height: coinSize,\n minWidth: coinSize\n } : undefined\n }), onRenderPersonaCoin(personaCoinProps, this._onRenderPersonaCoin), (!hidePersonaDetails || size === PersonaSize.size8 || size === PersonaSize.size10 || size === PersonaSize.tiny) && personaDetails\n /* eslint-enable deprecation/deprecation */\n );\n };\n /**\n * Renders various types of Text (primaryText, secondaryText, etc)\n * based on the classNames passed\n * @param classNames - element className\n * @param renderFunction - render function\n * @param defaultRenderFunction - default render function\n */\n\n\n PersonaBase.prototype._renderElement = function (classNames, renderFunction, defaultRenderFunction) {\n return React.createElement(\"div\", {\n dir: \"auto\",\n className: classNames\n }, renderFunction && renderFunction(this.props, defaultRenderFunction));\n };\n /**\n * Deprecation helper for getting text.\n */\n\n\n PersonaBase.prototype._getText = function () {\n // eslint-disable-next-line deprecation/deprecation\n return this.props.text || this.props.primaryText || '';\n };\n /**\n * using closure to wrap the default render behavior\n * to make it independent of the type of text passed\n * @param text - text to render\n */\n\n\n PersonaBase.prototype._onRenderText = function (text) {\n // return default render behaviour for valid text or undefined\n return text ? function () {\n // default onRender behaviour\n return React.createElement(TooltipHost, {\n content: text,\n overflowMode: TooltipOverflowMode.Parent,\n directionalHint: DirectionalHint.topLeftEdge\n }, text);\n } : undefined;\n };\n\n PersonaBase.defaultProps = {\n size: PersonaSize.size48,\n presence: PersonaPresenceEnum.none,\n imageAlt: ''\n };\n return PersonaBase;\n}(React.Component);\n\nexport { PersonaBase };","import { FontWeights, normalize, noWrap, getGlobalClassNames } from '../../Styling';\nimport { personaSize, presenceBoolean, sizeBoolean } from './PersonaConsts';\nvar GlobalClassNames = {\n root: 'ms-Persona',\n size8: 'ms-Persona--size8',\n size10: 'ms-Persona--size10',\n size16: 'ms-Persona--size16',\n size24: 'ms-Persona--size24',\n size28: 'ms-Persona--size28',\n size32: 'ms-Persona--size32',\n size40: 'ms-Persona--size40',\n size48: 'ms-Persona--size48',\n size56: 'ms-Persona--size56',\n size72: 'ms-Persona--size72',\n size100: 'ms-Persona--size100',\n size120: 'ms-Persona--size120',\n available: 'ms-Persona--online',\n away: 'ms-Persona--away',\n blocked: 'ms-Persona--blocked',\n busy: 'ms-Persona--busy',\n doNotDisturb: 'ms-Persona--donotdisturb',\n offline: 'ms-Persona--offline',\n details: 'ms-Persona-details',\n primaryText: 'ms-Persona-primaryText',\n secondaryText: 'ms-Persona-secondaryText',\n tertiaryText: 'ms-Persona-tertiaryText',\n optionalText: 'ms-Persona-optionalText',\n textContent: 'ms-Persona-textContent'\n};\nexport var getStyles = function getStyles(props) {\n var className = props.className,\n showSecondaryText = props.showSecondaryText,\n theme = props.theme;\n var semanticColors = theme.semanticColors,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var size = sizeBoolean(props.size);\n var presence = presenceBoolean(props.presence);\n var showSecondaryTextDefaultHeight = '16px';\n var sharedTextStyles = {\n color: semanticColors.bodySubtext,\n fontWeight: FontWeights.regular,\n fontSize: fonts.small.fontSize\n };\n return {\n root: [classNames.root, theme.fonts.medium, normalize, {\n color: semanticColors.bodyText,\n position: 'relative',\n height: personaSize.size48,\n minWidth: personaSize.size48,\n display: 'flex',\n alignItems: 'center',\n selectors: {\n '.contextualHost': {\n display: 'none'\n }\n }\n }, size.isSize8 && [classNames.size8, {\n height: personaSize.size8,\n minWidth: personaSize.size8\n }], // TODO: Deprecated size and needs to be removed in a future major release.\n size.isSize10 && [classNames.size10, {\n height: personaSize.size10,\n minWidth: personaSize.size10\n }], // TODO: Deprecated size and needs to be removed in a future major release.\n size.isSize16 && [classNames.size16, {\n height: personaSize.size16,\n minWidth: personaSize.size16\n }], size.isSize24 && [classNames.size24, {\n height: personaSize.size24,\n minWidth: personaSize.size24\n }], size.isSize24 && showSecondaryText && {\n height: '36px'\n }, // TODO: Deprecated size and needs to be removed in a future major release.\n size.isSize28 && [classNames.size28, {\n height: personaSize.size28,\n minWidth: personaSize.size28\n }], size.isSize28 && showSecondaryText && {\n height: '32px'\n }, size.isSize32 && [classNames.size32, {\n height: personaSize.size32,\n minWidth: personaSize.size32\n }], size.isSize40 && [classNames.size40, {\n height: personaSize.size40,\n minWidth: personaSize.size40\n }], size.isSize48 && classNames.size48, size.isSize56 && [classNames.size56, {\n height: personaSize.size56,\n minWidth: personaSize.size56\n }], size.isSize72 && [classNames.size72, {\n height: personaSize.size72,\n minWidth: personaSize.size72\n }], size.isSize100 && [classNames.size100, {\n height: personaSize.size100,\n minWidth: personaSize.size100\n }], size.isSize120 && [classNames.size120, {\n height: personaSize.size120,\n minWidth: personaSize.size120\n }],\n /**\n * Modifiers: presence\n */\n presence.isAvailable && classNames.available, presence.isAway && classNames.away, presence.isBlocked && classNames.blocked, presence.isBusy && classNames.busy, presence.isDoNotDisturb && classNames.doNotDisturb, presence.isOffline && classNames.offline, className],\n details: [classNames.details, {\n padding: '0 24px 0 16px',\n minWidth: 0,\n width: '100%',\n textAlign: 'left',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-around'\n }, (size.isSize8 || size.isSize10) && {\n paddingLeft: 17\n }, (size.isSize24 || size.isSize28 || size.isSize32) && {\n padding: '0 8px'\n }, (size.isSize40 || size.isSize48) && {\n padding: '0 12px'\n }],\n primaryText: [classNames.primaryText, noWrap, {\n color: semanticColors.bodyText,\n fontWeight: FontWeights.regular,\n fontSize: fonts.medium.fontSize,\n selectors: {\n ':hover': {\n color: semanticColors.inputTextHovered\n }\n }\n }, showSecondaryText && {\n height: showSecondaryTextDefaultHeight,\n lineHeight: showSecondaryTextDefaultHeight,\n overflowX: 'hidden'\n }, (size.isSize8 || size.isSize10) && {\n fontSize: fonts.small.fontSize,\n lineHeight: personaSize.size8\n }, size.isSize16 && {\n lineHeight: personaSize.size28\n }, (size.isSize24 || size.isSize28 || size.isSize32 || size.isSize40 || size.isSize48) && showSecondaryText && {\n height: 18\n }, (size.isSize56 || size.isSize72 || size.isSize100 || size.isSize120) && {\n fontSize: fonts.xLarge.fontSize\n }, (size.isSize56 || size.isSize72 || size.isSize100 || size.isSize120) && showSecondaryText && {\n height: 22\n }],\n secondaryText: [classNames.secondaryText, noWrap, sharedTextStyles, (size.isSize8 || size.isSize10 || size.isSize16 || size.isSize24 || size.isSize28 || size.isSize32) && {\n display: 'none'\n }, showSecondaryText && {\n display: 'block',\n height: showSecondaryTextDefaultHeight,\n lineHeight: showSecondaryTextDefaultHeight,\n overflowX: 'hidden'\n }, size.isSize24 && showSecondaryText && {\n height: 18\n }, (size.isSize56 || size.isSize72 || size.isSize100 || size.isSize120) && {\n fontSize: fonts.medium.fontSize\n }, (size.isSize56 || size.isSize72 || size.isSize100 || size.isSize120) && showSecondaryText && {\n height: 18\n }],\n tertiaryText: [classNames.tertiaryText, noWrap, sharedTextStyles, {\n display: 'none',\n fontSize: fonts.medium.fontSize\n }, (size.isSize72 || size.isSize100 || size.isSize120) && {\n display: 'block'\n }],\n optionalText: [classNames.optionalText, noWrap, sharedTextStyles, {\n display: 'none',\n fontSize: fonts.medium.fontSize\n }, (size.isSize100 || size.isSize120) && {\n display: 'block'\n }],\n textContent: [classNames.textContent, noWrap]\n };\n};","import { styled } from '../../Utilities';\nimport { PersonaBase } from './Persona.base';\nimport { getStyles } from './Persona.styles';\n/**\n * Personas are used for rendering an individual's avatar, presence and details.\n * They are used within the PeoplePicker components.\n */\n\nexport var Persona = styled(PersonaBase, getStyles, undefined, {\n scope: 'Persona'\n});","/**\n * {@docCategory Persona}\n */\nexport var PersonaSize;\n\n(function (PersonaSize) {\n /**\n * `tiny` size has been deprecated in favor of standardized numeric sizing. Use `size8` instead.\n * @deprecated Use `size8` instead.\n */\n PersonaSize[PersonaSize[\"tiny\"] = 0] = \"tiny\";\n /**\n *\n * `extraExtraSmall` size has been deprecated in favor of standardized numeric sizing. Use `size24` instead.\n * @deprecated Use `size24` instead.\n */\n\n PersonaSize[PersonaSize[\"extraExtraSmall\"] = 1] = \"extraExtraSmall\";\n /**\n * `extraSmall` size has been deprecated in favor of standardized numeric sizing. Use `size32` instead.\n * @deprecated Use `size32` instead.\n */\n\n PersonaSize[PersonaSize[\"extraSmall\"] = 2] = \"extraSmall\";\n /**\n * `small` size has been deprecated in favor of standardized numeric sizing. Use `size40` instead.\n * @deprecated Use `size40` instead.\n */\n\n PersonaSize[PersonaSize[\"small\"] = 3] = \"small\";\n /**\n * `regular` size has been deprecated in favor of standardized numeric sizing. Use `size48` instead.\n * @deprecated Use `size48` instead.\n */\n\n PersonaSize[PersonaSize[\"regular\"] = 4] = \"regular\";\n /**\n * `large` size has been deprecated in favor of standardized numeric sizing. Use `size72` instead.\n * @deprecated Use `size72` instead.\n */\n\n PersonaSize[PersonaSize[\"large\"] = 5] = \"large\";\n /**\n * `extraLarge` size has been deprecated in favor of standardized numeric sizing. Use `size100` instead.\n * @deprecated Use `size100` instead.\n */\n\n PersonaSize[PersonaSize[\"extraLarge\"] = 6] = \"extraLarge\";\n /**\n * No `PersonaCoin` is rendered.\n */\n\n PersonaSize[PersonaSize[\"size8\"] = 17] = \"size8\";\n /**\n * No `PersonaCoin` is rendered. Deprecated in favor of `size8` to align with design specifications.\n * @deprecated Use `size8` instead. Will be removed in a future major release.\n */\n\n PersonaSize[PersonaSize[\"size10\"] = 9] = \"size10\";\n /**\n * Renders a 16px `PersonaCoin`. Deprecated due to not being in the design specification.\n * @deprecated Will be removed in a future major release.\n */\n\n PersonaSize[PersonaSize[\"size16\"] = 8] = \"size16\";\n /**\n * Renders a 24px `PersonaCoin`.\n */\n\n PersonaSize[PersonaSize[\"size24\"] = 10] = \"size24\";\n /**\n * Renders a 28px `PersonaCoin`. Deprecated due to not being in the design specification.\n * @deprecated Will be removed in a future major release.\n */\n\n PersonaSize[PersonaSize[\"size28\"] = 7] = \"size28\";\n /**\n * Renders a 32px `PersonaCoin`.\n */\n\n PersonaSize[PersonaSize[\"size32\"] = 11] = \"size32\";\n /**\n * Renders a 40px `PersonaCoin`.\n */\n\n PersonaSize[PersonaSize[\"size40\"] = 12] = \"size40\";\n /**\n * Renders a 48px `PersonaCoin`.\n */\n\n PersonaSize[PersonaSize[\"size48\"] = 13] = \"size48\";\n /**\n * Renders a 56px `PersonaCoin`.\n */\n\n PersonaSize[PersonaSize[\"size56\"] = 16] = \"size56\";\n /**\n * Renders a 72px `PersonaCoin`.\n */\n\n PersonaSize[PersonaSize[\"size72\"] = 14] = \"size72\";\n /**\n * Renders a 100px `PersonaCoin`.\n */\n\n PersonaSize[PersonaSize[\"size100\"] = 15] = \"size100\";\n /**\n * Renders a 120px `PersonaCoin`.\n */\n\n PersonaSize[PersonaSize[\"size120\"] = 18] = \"size120\";\n})(PersonaSize || (PersonaSize = {}));\n/**\n * {@docCategory Persona}\n */\n\n\nexport var PersonaPresence;\n\n(function (PersonaPresence) {\n PersonaPresence[PersonaPresence[\"none\"] = 0] = \"none\";\n PersonaPresence[PersonaPresence[\"offline\"] = 1] = \"offline\";\n PersonaPresence[PersonaPresence[\"online\"] = 2] = \"online\";\n PersonaPresence[PersonaPresence[\"away\"] = 3] = \"away\";\n PersonaPresence[PersonaPresence[\"dnd\"] = 4] = \"dnd\";\n PersonaPresence[PersonaPresence[\"blocked\"] = 5] = \"blocked\";\n PersonaPresence[PersonaPresence[\"busy\"] = 6] = \"busy\";\n})(PersonaPresence || (PersonaPresence = {}));\n/**\n * {@docCategory Persona}\n */\n\n\nexport var PersonaInitialsColor;\n\n(function (PersonaInitialsColor) {\n PersonaInitialsColor[PersonaInitialsColor[\"lightBlue\"] = 0] = \"lightBlue\";\n PersonaInitialsColor[PersonaInitialsColor[\"blue\"] = 1] = \"blue\";\n PersonaInitialsColor[PersonaInitialsColor[\"darkBlue\"] = 2] = \"darkBlue\";\n PersonaInitialsColor[PersonaInitialsColor[\"teal\"] = 3] = \"teal\";\n PersonaInitialsColor[PersonaInitialsColor[\"lightGreen\"] = 4] = \"lightGreen\";\n PersonaInitialsColor[PersonaInitialsColor[\"green\"] = 5] = \"green\";\n PersonaInitialsColor[PersonaInitialsColor[\"darkGreen\"] = 6] = \"darkGreen\";\n PersonaInitialsColor[PersonaInitialsColor[\"lightPink\"] = 7] = \"lightPink\";\n PersonaInitialsColor[PersonaInitialsColor[\"pink\"] = 8] = \"pink\";\n PersonaInitialsColor[PersonaInitialsColor[\"magenta\"] = 9] = \"magenta\";\n PersonaInitialsColor[PersonaInitialsColor[\"purple\"] = 10] = \"purple\";\n /**\n * Black can result in offensive persona coins with some initials combinations, so it can only be set with overrides.\n * @deprecated will be removed in a future major release.\n */\n\n PersonaInitialsColor[PersonaInitialsColor[\"black\"] = 11] = \"black\";\n PersonaInitialsColor[PersonaInitialsColor[\"orange\"] = 12] = \"orange\";\n /**\n * Red often has a special meaning, so it is considered a reserved color and can only be set with overrides.\n * @deprecated will be removed in a future major release.\n */\n\n PersonaInitialsColor[PersonaInitialsColor[\"red\"] = 13] = \"red\";\n PersonaInitialsColor[PersonaInitialsColor[\"darkRed\"] = 14] = \"darkRed\";\n /**\n * Transparent is not intended to be used with typical initials due to accessibility issues.\n * Its primary use is for overflow buttons, so it is considered a reserved color and can only be set with overrides.\n */\n\n PersonaInitialsColor[PersonaInitialsColor[\"transparent\"] = 15] = \"transparent\";\n PersonaInitialsColor[PersonaInitialsColor[\"violet\"] = 16] = \"violet\";\n PersonaInitialsColor[PersonaInitialsColor[\"lightRed\"] = 17] = \"lightRed\";\n PersonaInitialsColor[PersonaInitialsColor[\"gold\"] = 18] = \"gold\";\n PersonaInitialsColor[PersonaInitialsColor[\"burgundy\"] = 19] = \"burgundy\";\n PersonaInitialsColor[PersonaInitialsColor[\"warmGray\"] = 20] = \"warmGray\";\n PersonaInitialsColor[PersonaInitialsColor[\"coolGray\"] = 21] = \"coolGray\";\n /**\n * Gray can result in offensive persona coins with some initials combinations, so it can only be set with overrides.\n */\n\n PersonaInitialsColor[PersonaInitialsColor[\"gray\"] = 22] = \"gray\";\n PersonaInitialsColor[PersonaInitialsColor[\"cyan\"] = 23] = \"cyan\";\n PersonaInitialsColor[PersonaInitialsColor[\"rust\"] = 24] = \"rust\";\n})(PersonaInitialsColor || (PersonaInitialsColor = {}));","import { __extends } from \"tslib\";\nimport * as React from 'react';\nimport { classNamesFunction } from '../../../Utilities';\nimport { Icon } from '../../../Icon';\nimport { PersonaPresence as PersonaPresenceEnum } from '../Persona.types';\nimport { sizeBoolean } from '../PersonaConsts';\nvar coinSizeFontScaleFactor = 6;\nvar coinSizePresenceScaleFactor = 3;\nvar presenceMaxSize = 40;\nvar presenceFontMaxSize = 20;\nvar getClassNames = classNamesFunction({\n // There can be many PersonaPresence rendered with different sizes.\n // Therefore setting a larger cache size.\n cacheSize: 100\n});\n/**\n * PersonaPresence with no default styles.\n * [Use the `getStyles` API to add your own styles.](https://github.com/microsoft/fluentui/wiki/Styling)\n */\n\nvar PersonaPresenceBase =\n/** @class */\nfunction (_super) {\n __extends(PersonaPresenceBase, _super);\n\n function PersonaPresenceBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._onRenderIcon = function (className, style) {\n return React.createElement(Icon, {\n className: className,\n iconName: determineIcon(_this.props.presence, _this.props.isOutOfOffice),\n style: style\n });\n };\n\n return _this;\n }\n\n PersonaPresenceBase.prototype.render = function () {\n var _a = this.props,\n coinSize = _a.coinSize,\n isOutOfOffice = _a.isOutOfOffice,\n styles = _a.styles,\n // Use getStyles from props.\n presence = _a.presence,\n theme = _a.theme,\n presenceTitle = _a.presenceTitle,\n presenceColors = _a.presenceColors;\n var size = sizeBoolean(this.props.size); // Render Presence Icon if Persona is above size 32.\n\n var renderIcon = !(size.isSize8 || size.isSize10 || size.isSize16 || size.isSize24 || size.isSize28 || size.isSize32) && (coinSize ? coinSize > 32 : true);\n var presenceHeightWidth = coinSize ? coinSize / coinSizePresenceScaleFactor < presenceMaxSize ? coinSize / coinSizePresenceScaleFactor + 'px' : presenceMaxSize + 'px' : '';\n var presenceFontSize = coinSize ? coinSize / coinSizeFontScaleFactor < presenceFontMaxSize ? coinSize / coinSizeFontScaleFactor + 'px' : presenceFontMaxSize + 'px' : '';\n var coinSizeWithPresenceIconStyle = coinSize ? {\n fontSize: presenceFontSize,\n lineHeight: presenceHeightWidth\n } : undefined;\n var coinSizeWithPresenceStyle = coinSize ? {\n width: presenceHeightWidth,\n height: presenceHeightWidth\n } : undefined; // Use getStyles from props, or fall back to getStyles from styles file.\n\n var classNames = getClassNames(styles, {\n theme: theme,\n presence: presence,\n size: this.props.size,\n isOutOfOffice: isOutOfOffice,\n presenceColors: presenceColors\n });\n\n if (presence === PersonaPresenceEnum.none) {\n return null;\n }\n\n return React.createElement(\"div\", {\n role: \"presentation\",\n className: classNames.presence,\n style: coinSizeWithPresenceStyle,\n title: presenceTitle\n }, renderIcon && this._onRenderIcon(classNames.presenceIcon, coinSizeWithPresenceIconStyle));\n };\n\n return PersonaPresenceBase;\n}(React.Component);\n\nexport { PersonaPresenceBase };\n\nfunction determineIcon(presence, isOutOfOffice) {\n if (!presence) {\n return undefined;\n }\n\n var oofIcon = 'SkypeArrow';\n\n switch (PersonaPresenceEnum[presence]) {\n case 'online':\n return 'SkypeCheck';\n\n case 'away':\n return isOutOfOffice ? oofIcon : 'SkypeClock';\n\n case 'dnd':\n return 'SkypeMinus';\n\n case 'offline':\n return isOutOfOffice ? oofIcon : '';\n }\n\n return '';\n}","import { __assign } from \"tslib\";\nimport { HighContrastSelector, getGlobalClassNames, getHighContrastNoAdjustStyle } from '../../../Styling';\nimport { personaPresenceSize, presenceBoolean, sizeBoolean } from '../PersonaConsts';\nvar GlobalClassNames = {\n presence: 'ms-Persona-presence',\n presenceIcon: 'ms-Persona-presenceIcon'\n};\nexport var getStyles = function getStyles(props) {\n var _a, _b, _c, _d, _e, _f;\n\n var theme = props.theme,\n presenceColors = props.presenceColors;\n var semanticColors = theme.semanticColors,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n var size = sizeBoolean(props.size);\n var presence = presenceBoolean(props.presence); // Presence colors\n\n var presenceColorAvailable = presenceColors && presenceColors.available || '#6BB700';\n var presenceColorAway = presenceColors && presenceColors.away || '#FFAA44';\n var presenceColorBusy = presenceColors && presenceColors.busy || '#C43148';\n var presenceColorDnd = presenceColors && presenceColors.dnd || '#C50F1F';\n var presenceColorOffline = presenceColors && presenceColors.offline || '#8A8886';\n var presenceColorOof = presenceColors && presenceColors.oof || '#B4009E';\n var presenceColorBackground = presenceColors && presenceColors.background || semanticColors.bodyBackground;\n var isOpenCirclePresence = presence.isOffline || props.isOutOfOffice && (presence.isAvailable || presence.isBusy || presence.isAway || presence.isDoNotDisturb);\n var borderSizeForSmallPersonas = '1px';\n var borderSizeForLargePersonas = '2px';\n var borderSize = size.isSize72 || size.isSize100 ? borderSizeForLargePersonas : borderSizeForSmallPersonas;\n return {\n presence: [classNames.presence, __assign(__assign({\n position: 'absolute',\n height: personaPresenceSize.size12,\n width: personaPresenceSize.size12,\n borderRadius: '50%',\n top: 'auto',\n right: '-2px',\n bottom: '-2px',\n border: \"2px solid \" + presenceColorBackground,\n textAlign: 'center',\n boxSizing: 'content-box',\n backgroundClip: 'content-box'\n }, getHighContrastNoAdjustStyle()), {\n selectors: (_a = {}, _a[HighContrastSelector] = {\n borderColor: 'Window',\n backgroundColor: 'WindowText'\n }, _a)\n }), (size.isSize8 || size.isSize10) && {\n right: 'auto',\n top: '7px',\n left: 0,\n border: 0,\n selectors: (_b = {}, _b[HighContrastSelector] = {\n top: '9px',\n border: '1px solid WindowText'\n }, _b)\n }, (size.isSize8 || size.isSize10 || size.isSize24 || size.isSize28 || size.isSize32) && makeSizeStyle(personaPresenceSize.size8), (size.isSize40 || size.isSize48) && makeSizeStyle(personaPresenceSize.size12), size.isSize16 && {\n height: personaPresenceSize.size6,\n width: personaPresenceSize.size6,\n borderWidth: '1.5px'\n }, size.isSize56 && makeSizeStyle(personaPresenceSize.size16), size.isSize72 && makeSizeStyle(personaPresenceSize.size20), size.isSize100 && makeSizeStyle(personaPresenceSize.size28), size.isSize120 && makeSizeStyle(personaPresenceSize.size32), presence.isAvailable && {\n backgroundColor: presenceColorAvailable,\n selectors: (_c = {}, _c[HighContrastSelector] = backgroundColor('Highlight'), _c)\n }, presence.isAway && backgroundColor(presenceColorAway), presence.isBlocked && [{\n selectors: (_d = {\n // Only show :after at larger sizes\n ':after': size.isSize40 || size.isSize48 || size.isSize72 || size.isSize100 ? {\n content: '\"\"',\n width: '100%',\n height: borderSize,\n backgroundColor: presenceColorBusy,\n transform: 'translateY(-50%) rotate(-45deg)',\n position: 'absolute',\n top: '50%',\n left: 0\n } : undefined\n }, _d[HighContrastSelector] = {\n selectors: {\n ':after': {\n width: \"calc(100% - 4px)\",\n left: '2px',\n backgroundColor: 'Window'\n }\n }\n }, _d)\n }], presence.isBusy && backgroundColor(presenceColorBusy), presence.isDoNotDisturb && backgroundColor(presenceColorDnd), presence.isOffline && backgroundColor(presenceColorOffline), (isOpenCirclePresence || presence.isBlocked) && [{\n backgroundColor: presenceColorBackground,\n selectors: (_e = {\n ':before': {\n content: '\"\"',\n width: '100%',\n height: '100%',\n position: 'absolute',\n top: 0,\n left: 0,\n border: borderSize + \" solid \" + presenceColorBusy,\n borderRadius: '50%',\n boxSizing: 'border-box'\n }\n }, _e[HighContrastSelector] = {\n backgroundColor: 'WindowText',\n selectors: {\n ':before': {\n width: \"calc(100% - 2px)\",\n height: \"calc(100% - 2px)\",\n top: '1px',\n left: '1px',\n borderColor: 'Window'\n }\n }\n }, _e)\n }], isOpenCirclePresence && presence.isAvailable && makeBeforeBorderStyle(borderSize, presenceColorAvailable), isOpenCirclePresence && presence.isBusy && makeBeforeBorderStyle(borderSize, presenceColorBusy), isOpenCirclePresence && presence.isAway && makeBeforeBorderStyle(borderSize, presenceColorOof), isOpenCirclePresence && presence.isDoNotDisturb && makeBeforeBorderStyle(borderSize, presenceColorDnd), isOpenCirclePresence && presence.isOffline && makeBeforeBorderStyle(borderSize, presenceColorOffline), isOpenCirclePresence && presence.isOffline && props.isOutOfOffice && makeBeforeBorderStyle(borderSize, presenceColorOof)],\n presenceIcon: [classNames.presenceIcon, {\n color: presenceColorBackground,\n fontSize: '6px',\n lineHeight: personaPresenceSize.size12,\n verticalAlign: 'top',\n selectors: (_f = {}, _f[HighContrastSelector] = {\n color: 'Window'\n }, _f)\n }, size.isSize56 && {\n fontSize: '8px',\n lineHeight: personaPresenceSize.size16\n }, size.isSize72 && {\n fontSize: fonts.small.fontSize,\n lineHeight: personaPresenceSize.size20\n }, size.isSize100 && {\n fontSize: fonts.medium.fontSize,\n lineHeight: personaPresenceSize.size28\n }, size.isSize120 && {\n fontSize: fonts.medium.fontSize,\n lineHeight: personaPresenceSize.size32\n }, presence.isAway && {\n position: 'relative',\n left: isOpenCirclePresence ? undefined : '1px'\n }, isOpenCirclePresence && presence.isAvailable && makeOpenCircleIconStyle(presenceColorAvailable), isOpenCirclePresence && presence.isBusy && makeOpenCircleIconStyle(presenceColorBusy), isOpenCirclePresence && presence.isAway && makeOpenCircleIconStyle(presenceColorOof), isOpenCirclePresence && presence.isDoNotDisturb && makeOpenCircleIconStyle(presenceColorDnd), isOpenCirclePresence && presence.isOffline && makeOpenCircleIconStyle(presenceColorOffline), isOpenCirclePresence && presence.isOffline && props.isOutOfOffice && makeOpenCircleIconStyle(presenceColorOof)]\n };\n};\n\nfunction makeOpenCircleIconStyle(color) {\n return {\n color: color,\n borderColor: color\n };\n}\n\nfunction makeBeforeBorderStyle(borderSize, color) {\n return {\n selectors: {\n ':before': {\n border: borderSize + \" solid \" + color\n }\n }\n };\n}\n\nfunction makeSizeStyle(size) {\n return {\n height: size,\n width: size\n };\n}\n\nfunction backgroundColor(color) {\n return {\n backgroundColor: color\n };\n}","import { styled } from '../../../Utilities';\nimport { PersonaPresenceBase } from './PersonaPresence.base';\nimport { getStyles } from './PersonaPresence.styles';\n/**\n * PersonaPresence is used to render an individual's presence.\n */\n\nexport var PersonaPresence = styled(PersonaPresenceBase, getStyles, undefined, {\n scope: 'PersonaPresence'\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { warnDeprecations, classNamesFunction, divProperties, memoizeFunction, getInitials, getNativeProps, getRTL } from '../../../Utilities';\nimport { mergeStyles } from '../../../Styling';\nimport { PersonaPresence } from '../PersonaPresence/index';\nimport { Icon } from '../../../Icon';\nimport { Image, ImageFit, ImageLoadState } from '../../../Image';\nimport { PersonaPresence as PersonaPresenceEnum, PersonaSize } from '../Persona.types';\nimport { getPersonaInitialsColor } from '../PersonaInitialsColor';\nimport { sizeToPixels } from '../PersonaConsts';\nvar getClassNames = classNamesFunction({\n // There can be many PersonaCoin rendered with different sizes.\n // Therefore setting a larger cache size.\n cacheSize: 100\n});\nvar getInitialsStyles = memoizeFunction(function (className, initialsColor, initialsTextColor, text, primaryText, showUnknownPersonaCoin) {\n return mergeStyles(className, !showUnknownPersonaCoin && {\n backgroundColor: getPersonaInitialsColor({\n text: text,\n initialsColor: initialsColor,\n primaryText: primaryText\n }),\n color: initialsTextColor\n });\n});\n/**\n * PersonaCoin with no default styles.\n * [Use the `getStyles` API to add your own styles.](https://github.com/microsoft/fluentui/wiki/Styling)\n */\n\nvar PersonaCoinBase =\n/** @class */\nfunction (_super) {\n __extends(PersonaCoinBase, _super);\n\n function PersonaCoinBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._onRenderCoin = function (props) {\n var _a = _this.props,\n coinSize = _a.coinSize,\n styles = _a.styles,\n imageUrl = _a.imageUrl,\n imageAlt = _a.imageAlt,\n imageShouldFadeIn = _a.imageShouldFadeIn,\n imageShouldStartVisible = _a.imageShouldStartVisible,\n theme = _a.theme,\n showUnknownPersonaCoin = _a.showUnknownPersonaCoin; // Render the Image component only if an image URL is provided\n\n if (!imageUrl) {\n return null;\n }\n\n var size = _this.props.size;\n var classNames = getClassNames(styles, {\n theme: theme,\n size: size,\n showUnknownPersonaCoin: showUnknownPersonaCoin\n });\n var dimension = coinSize || sizeToPixels[size];\n return React.createElement(Image, {\n className: classNames.image,\n imageFit: ImageFit.cover,\n src: imageUrl,\n width: dimension,\n height: dimension,\n alt: imageAlt,\n shouldFadeIn: imageShouldFadeIn,\n shouldStartVisible: imageShouldStartVisible,\n onLoadingStateChange: _this._onPhotoLoadingStateChange\n });\n };\n\n _this._onRenderInitials = function (props) {\n var imageInitials = props.imageInitials;\n var allowPhoneInitials = props.allowPhoneInitials,\n showUnknownPersonaCoin = props.showUnknownPersonaCoin;\n\n if (showUnknownPersonaCoin) {\n return React.createElement(Icon, {\n iconName: \"Help\"\n });\n }\n\n var isRTL = getRTL(_this.props.theme);\n imageInitials = imageInitials || getInitials(_this._getText(), isRTL, allowPhoneInitials);\n return imageInitials !== '' ? React.createElement(\"span\", null, imageInitials) : React.createElement(Icon, {\n iconName: \"Contact\"\n });\n };\n\n _this._onPhotoLoadingStateChange = function (loadState) {\n _this.setState({\n isImageLoaded: loadState === ImageLoadState.loaded,\n isImageError: loadState === ImageLoadState.error\n });\n\n _this.props.onPhotoLoadingStateChange && _this.props.onPhotoLoadingStateChange(loadState);\n };\n\n if (process.env.NODE_ENV !== 'production') {\n warnDeprecations('PersonaCoin', props, {\n primaryText: 'text'\n });\n }\n\n _this.state = {\n isImageLoaded: false,\n isImageError: false\n };\n return _this;\n }\n\n PersonaCoinBase.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) {\n if (nextProps.imageUrl !== this.props.imageUrl) {\n this.setState({\n isImageLoaded: false,\n isImageError: false\n });\n }\n };\n\n PersonaCoinBase.prototype.render = function () {\n var _a = this.props,\n className = _a.className,\n coinProps = _a.coinProps,\n showUnknownPersonaCoin = _a.showUnknownPersonaCoin,\n coinSize = _a.coinSize,\n styles = _a.styles,\n imageUrl = _a.imageUrl,\n initialsColor = _a.initialsColor,\n initialsTextColor = _a.initialsTextColor,\n isOutOfOffice = _a.isOutOfOffice,\n\n /* eslint-disable deprecation/deprecation */\n _b = _a.onRenderCoin,\n\n /* eslint-disable deprecation/deprecation */\n onRenderCoin = _b === void 0 ? this._onRenderCoin : _b,\n _c = _a.onRenderPersonaCoin,\n onRenderPersonaCoin = _c === void 0 ? onRenderCoin : _c,\n\n /* eslint-enable deprecation/deprecation */\n _d = _a.onRenderInitials,\n\n /* eslint-enable deprecation/deprecation */\n onRenderInitials = _d === void 0 ? this._onRenderInitials : _d,\n presence = _a.presence,\n presenceTitle = _a.presenceTitle,\n presenceColors = _a.presenceColors,\n // eslint-disable-next-line deprecation/deprecation\n primaryText = _a.primaryText,\n showInitialsUntilImageLoads = _a.showInitialsUntilImageLoads,\n text = _a.text,\n theme = _a.theme;\n var size = this.props.size;\n var divProps = getNativeProps(this.props, divProperties);\n var divCoinProps = getNativeProps(coinProps || {}, divProperties);\n var coinSizeStyle = coinSize ? {\n width: coinSize,\n height: coinSize\n } : undefined;\n var hideImage = showUnknownPersonaCoin;\n var personaPresenceProps = {\n coinSize: coinSize,\n isOutOfOffice: isOutOfOffice,\n presence: presence,\n presenceTitle: presenceTitle,\n presenceColors: presenceColors,\n size: size,\n theme: theme\n }; // Use getStyles from props, or fall back to getStyles from styles file.\n\n var classNames = getClassNames(styles, {\n theme: theme,\n className: coinProps && coinProps.className ? coinProps.className : className,\n size: size,\n coinSize: coinSize,\n showUnknownPersonaCoin: showUnknownPersonaCoin\n });\n var shouldRenderInitials = Boolean(!this.state.isImageLoaded && (showInitialsUntilImageLoads && imageUrl || !imageUrl || this.state.isImageError || hideImage));\n return React.createElement(\"div\", __assign({\n role: \"presentation\"\n }, divProps, {\n className: classNames.coin\n }), // eslint-disable-next-line deprecation/deprecation\n size !== PersonaSize.size8 && size !== PersonaSize.size10 && size !== PersonaSize.tiny ? React.createElement(\"div\", __assign({\n role: \"presentation\"\n }, divCoinProps, {\n className: classNames.imageArea,\n style: coinSizeStyle\n }), shouldRenderInitials && React.createElement(\"div\", {\n className: getInitialsStyles(classNames.initials, initialsColor, initialsTextColor, text, primaryText, showUnknownPersonaCoin),\n style: coinSizeStyle,\n \"aria-hidden\": \"true\"\n }, onRenderInitials(this.props, this._onRenderInitials)), !hideImage && onRenderPersonaCoin(this.props, this._onRenderCoin), React.createElement(PersonaPresence, __assign({}, personaPresenceProps))) : // Otherwise, render just PersonaPresence.\n this.props.presence ? React.createElement(PersonaPresence, __assign({}, personaPresenceProps)) : // Just render Contact Icon if there isn't a Presence prop.\n React.createElement(Icon, {\n iconName: \"Contact\",\n className: classNames.size10WithoutPresenceIcon\n }), this.props.children);\n };\n /**\n * Deprecation helper for getting text.\n */\n\n\n PersonaCoinBase.prototype._getText = function () {\n // eslint-disable-next-line deprecation/deprecation\n return this.props.text || this.props.primaryText || '';\n };\n\n PersonaCoinBase.defaultProps = {\n size: PersonaSize.size48,\n presence: PersonaPresenceEnum.none,\n imageAlt: ''\n };\n return PersonaCoinBase;\n}(React.Component);\n\nexport { PersonaCoinBase };","import { __assign } from \"tslib\";\nimport { HighContrastSelector, FontWeights, getGlobalClassNames, getHighContrastNoAdjustStyle } from '../../../Styling';\nimport { sizeBoolean, sizeToPixels } from '../PersonaConsts';\nvar GlobalClassNames = {\n coin: 'ms-Persona-coin',\n imageArea: 'ms-Persona-imageArea',\n image: 'ms-Persona-image',\n initials: 'ms-Persona-initials',\n size8: 'ms-Persona--size8',\n size10: 'ms-Persona--size10',\n size16: 'ms-Persona--size16',\n size24: 'ms-Persona--size24',\n size28: 'ms-Persona--size28',\n size32: 'ms-Persona--size32',\n size40: 'ms-Persona--size40',\n size48: 'ms-Persona--size48',\n size56: 'ms-Persona--size56',\n size72: 'ms-Persona--size72',\n size100: 'ms-Persona--size100',\n size120: 'ms-Persona--size120'\n};\nexport var getStyles = function getStyles(props) {\n var _a;\n\n var className = props.className,\n theme = props.theme,\n coinSize = props.coinSize;\n var palette = theme.palette,\n fonts = theme.fonts;\n var size = sizeBoolean(props.size);\n var classNames = getGlobalClassNames(GlobalClassNames, theme); // Static colors used when displaying 'unknown persona' coin\n\n var unknownPersonaBackgroundColor = 'rgb(234, 234, 234)';\n var unknownPersonaFontColor = 'rgb(168, 0, 0)';\n var dimension = coinSize || props.size && sizeToPixels[props.size] || 48;\n return {\n coin: [classNames.coin, fonts.medium, size.isSize8 && classNames.size8, size.isSize10 && classNames.size10, size.isSize16 && classNames.size16, size.isSize24 && classNames.size24, size.isSize28 && classNames.size28, size.isSize32 && classNames.size32, size.isSize40 && classNames.size40, size.isSize48 && classNames.size48, size.isSize56 && classNames.size56, size.isSize72 && classNames.size72, size.isSize100 && classNames.size100, size.isSize120 && classNames.size120, className],\n size10WithoutPresenceIcon: {\n fontSize: fonts.xSmall.fontSize,\n position: 'absolute',\n top: '5px',\n right: 'auto',\n left: 0\n },\n imageArea: [classNames.imageArea, {\n position: 'relative',\n textAlign: 'center',\n flex: '0 0 auto',\n height: dimension,\n width: dimension\n }, dimension <= 10 && {\n overflow: 'visible',\n background: 'transparent',\n height: 0,\n width: 0\n }],\n image: [classNames.image, {\n marginRight: '10px',\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n border: 0,\n borderRadius: '50%',\n perspective: '1px'\n }, dimension <= 10 && {\n overflow: 'visible',\n background: 'transparent',\n height: 0,\n width: 0\n }, dimension > 10 && {\n height: dimension,\n width: dimension\n }],\n initials: [classNames.initials, {\n borderRadius: '50%',\n color: props.showUnknownPersonaCoin ? unknownPersonaFontColor : palette.white,\n fontSize: fonts.large.fontSize,\n fontWeight: FontWeights.semibold,\n // copying the logic for the dimensions; defaulted to 46 for size48\n lineHeight: dimension === 48 ? 46 : dimension,\n height: dimension,\n selectors: (_a = {}, _a[HighContrastSelector] = __assign(__assign({\n border: '1px solid WindowText'\n }, getHighContrastNoAdjustStyle()), {\n color: 'WindowText',\n boxSizing: 'border-box',\n backgroundColor: 'Window !important'\n }), _a.i = {\n fontWeight: FontWeights.semibold\n }, _a)\n }, props.showUnknownPersonaCoin && {\n backgroundColor: unknownPersonaBackgroundColor\n }, dimension < 32 && {\n fontSize: fonts.xSmall.fontSize\n }, dimension >= 32 && dimension < 40 && {\n fontSize: fonts.medium.fontSize\n }, dimension >= 40 && dimension < 56 && {\n fontSize: fonts.mediumPlus.fontSize\n }, dimension >= 56 && dimension < 72 && {\n fontSize: fonts.xLarge.fontSize\n }, dimension >= 72 && dimension < 100 && {\n fontSize: fonts.xxLarge.fontSize\n }, dimension >= 100 && {\n fontSize: fonts.superLarge.fontSize\n }]\n };\n};","import { styled } from '../../../Utilities';\nimport { PersonaCoinBase } from './PersonaCoin.base';\nimport { getStyles } from './PersonaCoin.styles';\n/**\n * PersonaCoin is used to render an individual's avatar and presence.\n */\n\nexport var PersonaCoin = styled(PersonaCoinBase, getStyles, undefined, {\n scope: 'PersonaCoin'\n});","var _a;\n\nimport { PersonaPresence, PersonaSize } from './Persona.types'; // Persona Sizes\n\nexport var personaSize;\n\n(function (personaSize) {\n personaSize.size8 = '20px'; // TODO: remove in a future major release as it's deprecated.\n\n personaSize.size10 = '20px'; // TODO: remove in a future major release as it's deprecated.\n\n personaSize.size16 = '16px';\n personaSize.size24 = '24px'; // TODO: remove in a future major release as it's deprecated.\n\n personaSize.size28 = '28px';\n personaSize.size32 = '32px';\n personaSize.size40 = '40px';\n personaSize.size48 = '48px';\n personaSize.size56 = '56px';\n personaSize.size72 = '72px';\n personaSize.size100 = '100px';\n personaSize.size120 = '120px';\n})(personaSize || (personaSize = {})); // Persona Presence Sizes\n\n\nexport var personaPresenceSize;\n\n(function (personaPresenceSize) {\n personaPresenceSize.size6 = '6px';\n personaPresenceSize.size8 = '8px';\n personaPresenceSize.size12 = '12px';\n personaPresenceSize.size16 = '16px';\n personaPresenceSize.size20 = '20px';\n personaPresenceSize.size28 = '28px';\n personaPresenceSize.size32 = '32px';\n /**\n * @deprecated This is now unused\n */\n\n personaPresenceSize.border = '2px';\n})(personaPresenceSize || (personaPresenceSize = {})); // TODO: remove the deprecated parts in a future major release.\n\n\nexport var sizeBoolean = function sizeBoolean(size) {\n return {\n isSize8: size === PersonaSize.size8,\n\n /* eslint-disable deprecation/deprecation */\n isSize10: size === PersonaSize.size10 || size === PersonaSize.tiny,\n isSize16: size === PersonaSize.size16,\n isSize24: size === PersonaSize.size24 || size === PersonaSize.extraExtraSmall,\n isSize28: size === PersonaSize.size28 || size === PersonaSize.extraSmall,\n isSize32: size === PersonaSize.size32,\n isSize40: size === PersonaSize.size40 || size === PersonaSize.small,\n isSize48: size === PersonaSize.size48 || size === PersonaSize.regular,\n isSize56: size === PersonaSize.size56,\n isSize72: size === PersonaSize.size72 || size === PersonaSize.large,\n isSize100: size === PersonaSize.size100 || size === PersonaSize.extraLarge,\n isSize120: size === PersonaSize.size120\n };\n};\nexport var sizeToPixels = (_a = {}, // Old deprecated sizes\n_a[PersonaSize.tiny] = 10, _a[PersonaSize.extraExtraSmall] = 24, _a[PersonaSize.extraSmall] = 28, _a[PersonaSize.small] = 40, _a[PersonaSize.regular] = 48, _a[PersonaSize.large] = 72, _a[PersonaSize.extraLarge] = 100, // New sizes\n_a[PersonaSize.size8] = 8, _a[PersonaSize.size10] = 10, _a[PersonaSize.size16] = 16, _a[PersonaSize.size24] = 24, _a[PersonaSize.size28] = 28,\n/* eslint-enable deprecation/deprecation */\n_a[PersonaSize.size32] = 32, _a[PersonaSize.size40] = 40, _a[PersonaSize.size48] = 48, _a[PersonaSize.size56] = 56, _a[PersonaSize.size72] = 72, _a[PersonaSize.size100] = 100, _a[PersonaSize.size120] = 120, _a);\nexport var presenceBoolean = function presenceBoolean(presence) {\n return {\n isAvailable: presence === PersonaPresence.online,\n isAway: presence === PersonaPresence.away,\n isBlocked: presence === PersonaPresence.blocked,\n isBusy: presence === PersonaPresence.busy,\n isDoNotDisturb: presence === PersonaPresence.dnd,\n isOffline: presence === PersonaPresence.offline\n };\n};","import { PersonaInitialsColor } from './Persona.types';\n/**\n * Following colors are considered reserved and can only be set with overrides, so they are excluded from this set:\n * - `gray` and `black` can result in offensive persona coins with some initials combinations\n * - `red` often has a special meaning\n * - `transparent` is not intended to be used with typical initials due to accessibility issues;\n * its primary use is for Facepile overflow buttons.\n */\n\nvar COLOR_SWATCHES_LOOKUP = [PersonaInitialsColor.lightBlue, PersonaInitialsColor.blue, PersonaInitialsColor.darkBlue, PersonaInitialsColor.teal, PersonaInitialsColor.green, PersonaInitialsColor.darkGreen, PersonaInitialsColor.lightPink, PersonaInitialsColor.pink, PersonaInitialsColor.magenta, PersonaInitialsColor.purple, PersonaInitialsColor.orange, PersonaInitialsColor.lightRed, PersonaInitialsColor.darkRed, PersonaInitialsColor.violet, PersonaInitialsColor.gold, PersonaInitialsColor.burgundy, PersonaInitialsColor.warmGray, PersonaInitialsColor.cyan, PersonaInitialsColor.rust, PersonaInitialsColor.coolGray];\nvar COLOR_SWATCHES_NUM_ENTRIES = COLOR_SWATCHES_LOOKUP.length;\n\nfunction getInitialsColorFromName(displayName) {\n var color = PersonaInitialsColor.blue;\n\n if (!displayName) {\n return color;\n }\n\n var hashCode = 0;\n\n for (var iLen = displayName.length - 1; iLen >= 0; iLen--) {\n var ch = displayName.charCodeAt(iLen);\n var shift = iLen % 8; // eslint-disable-next-line no-bitwise\n\n hashCode ^= (ch << shift) + (ch >> 8 - shift);\n }\n\n color = COLOR_SWATCHES_LOOKUP[hashCode % COLOR_SWATCHES_NUM_ENTRIES];\n return color;\n}\n\nfunction personaInitialsColorToHexCode(personaInitialsColor) {\n switch (personaInitialsColor) {\n case PersonaInitialsColor.lightBlue:\n return '#4F6BED';\n\n case PersonaInitialsColor.blue:\n return '#0078D4';\n\n case PersonaInitialsColor.darkBlue:\n return '#004E8C';\n\n case PersonaInitialsColor.teal:\n return '#038387';\n\n case PersonaInitialsColor.lightGreen:\n case PersonaInitialsColor.green:\n return '#498205';\n\n case PersonaInitialsColor.darkGreen:\n return '#0B6A0B';\n\n case PersonaInitialsColor.lightPink:\n return '#C239B3';\n\n case PersonaInitialsColor.pink:\n return '#E3008C';\n\n case PersonaInitialsColor.magenta:\n return '#881798';\n\n case PersonaInitialsColor.purple:\n return '#5C2E91';\n\n case PersonaInitialsColor.orange:\n return '#CA5010';\n // eslint-disable-next-line deprecation/deprecation\n\n case PersonaInitialsColor.red:\n return '#EE1111';\n\n case PersonaInitialsColor.lightRed:\n return '#D13438';\n\n case PersonaInitialsColor.darkRed:\n return '#A4262C';\n\n case PersonaInitialsColor.transparent:\n return 'transparent';\n\n case PersonaInitialsColor.violet:\n return '#8764B8';\n\n case PersonaInitialsColor.gold:\n return '#986F0B';\n\n case PersonaInitialsColor.burgundy:\n return '#750B1C';\n\n case PersonaInitialsColor.warmGray:\n return '#7A7574';\n\n case PersonaInitialsColor.cyan:\n return '#005B70';\n\n case PersonaInitialsColor.rust:\n return '#8E562E';\n\n case PersonaInitialsColor.coolGray:\n return '#69797E';\n // eslint-disable-next-line deprecation/deprecation\n\n case PersonaInitialsColor.black:\n return '#1D1D1D';\n\n case PersonaInitialsColor.gray:\n return '#393939';\n }\n}\n/** @deprecated Use `getPersonaInitialsColor` */\n\n\nexport function initialsColorPropToColorCode(props) {\n return getPersonaInitialsColor(props);\n}\n/**\n * Gets the hex color string (prefixed with #) for the given persona props.\n * This is the logic used internally by the Persona control.\n * @param props - Current persona props\n * @returns Hex color string prefixed with #\n */\n\nexport function getPersonaInitialsColor(props) {\n // eslint-disable-next-line deprecation/deprecation\n var primaryText = props.primaryText,\n text = props.text;\n var initialsColor = props.initialsColor;\n var initialsColorCode;\n\n if (typeof initialsColor === 'string') {\n initialsColorCode = initialsColor;\n } else {\n initialsColor = initialsColor !== undefined ? initialsColor : getInitialsColorFromName(text || primaryText);\n initialsColorCode = personaInitialsColorToHexCode(initialsColor);\n }\n\n return initialsColorCode;\n}","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { Label } from '../../Label';\nimport { Icon } from '../../Icon';\nimport { Async, DelayedRender, classNamesFunction, getId, getNativeProps, getWindow, initializeComponentRef, inputProperties, isControlled, isIE11, textAreaProperties, warn, warnControlledUsage, warnMutuallyExclusive } from '../../Utilities';\nvar getClassNames = classNamesFunction();\nvar DEFAULT_STATE_VALUE = '';\nvar COMPONENT_NAME = 'TextField';\nvar REVEAL_ICON_NAME = 'RedEye';\nvar HIDE_ICON_NAME = 'Hide';\n\nvar TextFieldBase =\n/** @class */\nfunction (_super) {\n __extends(TextFieldBase, _super);\n\n function TextFieldBase(props) {\n var _this = _super.call(this, props) || this;\n\n _this._textElement = React.createRef();\n\n _this._onFocus = function (ev) {\n if (_this.props.onFocus) {\n _this.props.onFocus(ev);\n }\n\n _this.setState({\n isFocused: true\n }, function () {\n if (_this.props.validateOnFocusIn) {\n _this._validate(_this.value);\n }\n });\n };\n\n _this._onBlur = function (ev) {\n if (_this.props.onBlur) {\n _this.props.onBlur(ev);\n }\n\n _this.setState({\n isFocused: false\n }, function () {\n if (_this.props.validateOnFocusOut) {\n _this._validate(_this.value);\n }\n });\n };\n\n _this._onRenderLabel = function (props) {\n var label = props.label,\n required = props.required; // IProcessedStyleSet definition requires casting for what Label expects as its styles prop\n\n var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : undefined;\n\n if (label) {\n return React.createElement(Label, {\n required: required,\n htmlFor: _this._id,\n styles: labelStyles,\n disabled: props.disabled,\n id: _this._labelId\n }, props.label);\n }\n\n return null;\n };\n\n _this._onRenderDescription = function (props) {\n if (props.description) {\n return React.createElement(\"span\", {\n className: _this._classNames.description\n }, props.description);\n }\n\n return null;\n };\n\n _this._onRevealButtonClick = function (event) {\n _this.setState(function (prevState) {\n return {\n isRevealingPassword: !prevState.isRevealingPassword\n };\n });\n };\n\n _this._onInputChange = function (event) {\n // Previously, we needed to call both onInput and onChange due to some weird IE/React issues,\n // which have *probably* been fixed now:\n // - https://github.com/microsoft/fluentui/issues/744 (likely fixed)\n // - https://github.com/microsoft/fluentui/issues/824 (confirmed fixed)\n // TODO (Fabric 8?) - Switch to calling only onChange. This switch is pretty disruptive for\n // tests (ours and maybe consumers' too), so it seemed best to do the switch in a major bump.\n var element = event.target;\n var value = element.value; // Ignore this event if the value is undefined (in case one of the IE bugs comes back)\n\n if (value === undefined || value === _this._lastChangeValue) {\n return;\n }\n\n _this._lastChangeValue = value; // This is so developers can access the event properties in asynchronous callbacks\n // https://reactjs.org/docs/events.html#event-pooling\n\n event.persist();\n var isSameValue;\n\n _this.setState(function (prevState, props) {\n var prevValue = _getValue(props, prevState) || '';\n isSameValue = value === prevValue; // Avoid doing unnecessary work when the value has not changed.\n\n if (isSameValue) {\n return null;\n } // ONLY if this is an uncontrolled component, update the displayed value.\n // (Controlled components must update the `value` prop from `onChange`.)\n\n\n return _this._isControlled ? null : {\n uncontrolledValue: value\n };\n }, function () {\n // If the value actually changed, call onChange (for either controlled or uncontrolled)\n var onChange = _this.props.onChange;\n\n if (!isSameValue && onChange) {\n onChange(event, value);\n }\n });\n };\n\n initializeComponentRef(_this);\n _this._async = new Async(_this);\n\n if (process.env.NODE_ENV !== 'production') {\n warnMutuallyExclusive(COMPONENT_NAME, props, {\n errorMessage: 'onGetErrorMessage'\n });\n }\n\n _this._fallbackId = getId(COMPONENT_NAME);\n _this._descriptionId = getId(COMPONENT_NAME + 'Description');\n _this._labelId = getId(COMPONENT_NAME + 'Label');\n\n _this._warnControlledUsage();\n\n var _a = props.defaultValue,\n defaultValue = _a === void 0 ? DEFAULT_STATE_VALUE : _a;\n\n if (typeof defaultValue === 'number') {\n // This isn't allowed per the props, but happens anyway.\n defaultValue = String(defaultValue);\n }\n\n _this.state = {\n uncontrolledValue: _this._isControlled ? undefined : defaultValue,\n isFocused: false,\n errorMessage: ''\n };\n _this._delayedValidate = _this._async.debounce(_this._validate, _this.props.deferredValidationTime);\n _this._lastValidation = 0;\n return _this;\n }\n\n Object.defineProperty(TextFieldBase.prototype, \"value\", {\n /**\n * Gets the current value of the text field.\n */\n get: function get() {\n return _getValue(this.props, this.state);\n },\n enumerable: true,\n configurable: true\n });\n\n TextFieldBase.prototype.componentDidMount = function () {\n this._adjustInputHeight();\n\n if (this.props.validateOnLoad) {\n this._validate(this.value);\n }\n };\n\n TextFieldBase.prototype.componentWillUnmount = function () {\n this._async.dispose();\n };\n\n TextFieldBase.prototype.getSnapshotBeforeUpdate = function (prevProps, prevState) {\n return {\n selection: [this.selectionStart, this.selectionEnd]\n };\n };\n\n TextFieldBase.prototype.componentDidUpdate = function (prevProps, prevState, snapshot) {\n var props = this.props;\n var _a = (snapshot || {}).selection,\n selection = _a === void 0 ? [null, null] : _a;\n var start = selection[0],\n end = selection[1];\n\n if (!!prevProps.multiline !== !!props.multiline && prevState.isFocused) {\n // The text field has just changed between single- and multi-line, so we need to reset focus\n // and selection/cursor.\n this.focus();\n\n if (start !== null && end !== null && start >= 0 && end >= 0) {\n this.setSelectionRange(start, end);\n }\n }\n\n var prevValue = _getValue(prevProps, prevState);\n\n var value = this.value;\n\n if (prevValue !== value) {\n // Handle controlled/uncontrolled warnings and status\n this._warnControlledUsage(prevProps); // Clear error message if needed\n // TODO: is there any way to do this without an extra render?\n\n\n if (this.state.errorMessage && !props.errorMessage) {\n this.setState({\n errorMessage: ''\n });\n } // Adjust height if needed based on new value\n\n\n this._adjustInputHeight(); // Reset the record of the last value seen by a change/input event\n\n\n this._lastChangeValue = undefined; // TODO: #5875 added logic to trigger validation in componentWillReceiveProps and other places.\n // This seems a bit odd and hard to integrate with the new approach.\n // (Starting to think we should just put the validation logic in a separate wrapper component...?)\n\n if (_shouldValidateAllChanges(props)) {\n this._delayedValidate(value);\n }\n }\n };\n\n TextFieldBase.prototype.render = function () {\n var _a = this.props,\n borderless = _a.borderless,\n className = _a.className,\n disabled = _a.disabled,\n iconProps = _a.iconProps,\n inputClassName = _a.inputClassName,\n label = _a.label,\n multiline = _a.multiline,\n required = _a.required,\n underlined = _a.underlined,\n prefix = _a.prefix,\n resizable = _a.resizable,\n suffix = _a.suffix,\n theme = _a.theme,\n styles = _a.styles,\n autoAdjustHeight = _a.autoAdjustHeight,\n canRevealPassword = _a.canRevealPassword,\n type = _a.type,\n _b = _a.onRenderPrefix,\n onRenderPrefix = _b === void 0 ? this._onRenderPrefix : _b,\n _c = _a.onRenderSuffix,\n onRenderSuffix = _c === void 0 ? this._onRenderSuffix : _c,\n _d = _a.onRenderLabel,\n onRenderLabel = _d === void 0 ? this._onRenderLabel : _d,\n _e = _a.onRenderDescription,\n onRenderDescription = _e === void 0 ? this._onRenderDescription : _e;\n var _f = this.state,\n isFocused = _f.isFocused,\n isRevealingPassword = _f.isRevealingPassword;\n var errorMessage = this._errorMessage;\n\n var hasRevealButton = !!canRevealPassword && type === 'password' && _browserNeedsRevealButton();\n\n var classNames = this._classNames = getClassNames(styles, {\n theme: theme,\n className: className,\n disabled: disabled,\n focused: isFocused,\n required: required,\n multiline: multiline,\n hasLabel: !!label,\n hasErrorMessage: !!errorMessage,\n borderless: borderless,\n resizable: resizable,\n hasIcon: !!iconProps,\n underlined: underlined,\n inputClassName: inputClassName,\n autoAdjustHeight: autoAdjustHeight,\n hasRevealButton: hasRevealButton\n });\n return React.createElement(\"div\", {\n className: classNames.root\n }, React.createElement(\"div\", {\n className: classNames.wrapper\n }, onRenderLabel(this.props, this._onRenderLabel), React.createElement(\"div\", {\n className: classNames.fieldGroup\n }, (prefix !== undefined || this.props.onRenderPrefix) && React.createElement(\"div\", {\n className: classNames.prefix\n }, onRenderPrefix(this.props, this._onRenderPrefix)), multiline ? this._renderTextArea() : this._renderInput(), iconProps && React.createElement(Icon, __assign({\n className: classNames.icon\n }, iconProps)), hasRevealButton && // Explicitly set type=\"button\" since the default button type within a form is \"submit\"\n React.createElement(\"button\", {\n className: classNames.revealButton,\n onClick: this._onRevealButtonClick,\n type: \"button\"\n }, React.createElement(\"span\", {\n className: classNames.revealSpan\n }, React.createElement(Icon, {\n className: classNames.revealIcon,\n iconName: isRevealingPassword ? HIDE_ICON_NAME : REVEAL_ICON_NAME\n }))), (suffix !== undefined || this.props.onRenderSuffix) && React.createElement(\"div\", {\n className: classNames.suffix\n }, onRenderSuffix(this.props, this._onRenderSuffix)))), this._isDescriptionAvailable && React.createElement(\"span\", {\n id: this._descriptionId\n }, onRenderDescription(this.props, this._onRenderDescription), errorMessage && React.createElement(\"div\", {\n role: \"alert\"\n }, React.createElement(DelayedRender, null, React.createElement(\"p\", {\n className: classNames.errorMessage\n }, React.createElement(\"span\", {\n \"data-automation-id\": \"error-message\"\n }, errorMessage))))));\n };\n /**\n * Sets focus on the text field\n */\n\n\n TextFieldBase.prototype.focus = function () {\n if (this._textElement.current) {\n this._textElement.current.focus();\n }\n };\n /**\n * Blurs the text field.\n */\n\n\n TextFieldBase.prototype.blur = function () {\n if (this._textElement.current) {\n this._textElement.current.blur();\n }\n };\n /**\n * Selects the text field\n */\n\n\n TextFieldBase.prototype.select = function () {\n if (this._textElement.current) {\n this._textElement.current.select();\n }\n };\n /**\n * Sets the selection start of the text field to a specified value\n */\n\n\n TextFieldBase.prototype.setSelectionStart = function (value) {\n if (this._textElement.current) {\n this._textElement.current.selectionStart = value;\n }\n };\n /**\n * Sets the selection end of the text field to a specified value\n */\n\n\n TextFieldBase.prototype.setSelectionEnd = function (value) {\n if (this._textElement.current) {\n this._textElement.current.selectionEnd = value;\n }\n };\n\n Object.defineProperty(TextFieldBase.prototype, \"selectionStart\", {\n /**\n * Gets the selection start of the text field\n */\n get: function get() {\n return this._textElement.current ? this._textElement.current.selectionStart : -1;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TextFieldBase.prototype, \"selectionEnd\", {\n /**\n * Gets the selection end of the text field\n */\n get: function get() {\n return this._textElement.current ? this._textElement.current.selectionEnd : -1;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Sets the start and end positions of a selection in a text field.\n * @param start - Index of the start of the selection.\n * @param end - Index of the end of the selection.\n */\n\n TextFieldBase.prototype.setSelectionRange = function (start, end) {\n if (this._textElement.current) {\n this._textElement.current.setSelectionRange(start, end);\n }\n };\n\n TextFieldBase.prototype._warnControlledUsage = function (prevProps) {\n // Show warnings if props are being used in an invalid way\n warnControlledUsage({\n componentId: this._id,\n componentName: COMPONENT_NAME,\n props: this.props,\n oldProps: prevProps,\n valueProp: 'value',\n defaultValueProp: 'defaultValue',\n onChangeProp: 'onChange',\n readOnlyProp: 'readOnly'\n });\n\n if (this.props.value === null && !this._hasWarnedNullValue) {\n this._hasWarnedNullValue = true;\n warn(\"Warning: 'value' prop on '\" + COMPONENT_NAME + \"' should not be null. Consider using an \" + 'empty string to clear the component or undefined to indicate an uncontrolled component.');\n }\n };\n\n Object.defineProperty(TextFieldBase.prototype, \"_id\", {\n /** Returns `props.id` if available, or a fallback if not. */\n get: function get() {\n return this.props.id || this._fallbackId;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TextFieldBase.prototype, \"_isControlled\", {\n get: function get() {\n return isControlled(this.props, 'value');\n },\n enumerable: true,\n configurable: true\n });\n\n TextFieldBase.prototype._onRenderPrefix = function (props) {\n var prefix = props.prefix;\n return React.createElement(\"span\", {\n style: {\n paddingBottom: '1px'\n }\n }, prefix);\n };\n\n TextFieldBase.prototype._onRenderSuffix = function (props) {\n var suffix = props.suffix;\n return React.createElement(\"span\", {\n style: {\n paddingBottom: '1px'\n }\n }, suffix);\n };\n\n Object.defineProperty(TextFieldBase.prototype, \"_errorMessage\", {\n /**\n * Current error message from either `props.errorMessage` or the result of `props.onGetErrorMessage`.\n *\n * - If there is no validation error or we have not validated the input value, errorMessage is an empty string.\n * - If we have done the validation and there is validation error, errorMessage is the validation error message.\n */\n get: function get() {\n var _a = this.props.errorMessage,\n errorMessage = _a === void 0 ? this.state.errorMessage : _a;\n return errorMessage || '';\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TextFieldBase.prototype, \"_isDescriptionAvailable\", {\n /**\n * If a custom description render function is supplied then treat description as always available.\n * Otherwise defer to the presence of description or error message text.\n */\n get: function get() {\n var props = this.props;\n return !!(props.onRenderDescription || props.description || this._errorMessage);\n },\n enumerable: true,\n configurable: true\n });\n\n TextFieldBase.prototype._renderTextArea = function () {\n var textAreaProps = getNativeProps(this.props, textAreaProperties, ['defaultValue']);\n var ariaLabelledBy = this.props['aria-labelledby'] || (this.props.label ? this._labelId : undefined);\n return React.createElement(\"textarea\", __assign({\n id: this._id\n }, textAreaProps, {\n ref: this._textElement,\n value: this.value || '',\n onInput: this._onInputChange,\n onChange: this._onInputChange,\n className: this._classNames.field,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": this._isDescriptionAvailable ? this._descriptionId : this.props['aria-describedby'],\n \"aria-invalid\": !!this._errorMessage,\n \"aria-label\": this.props.ariaLabel,\n readOnly: this.props.readOnly,\n onFocus: this._onFocus,\n onBlur: this._onBlur\n }));\n };\n\n TextFieldBase.prototype._renderInput = function () {\n var inputProps = __assign(__assign({\n type: this.state.isRevealingPassword ? 'text' : this.props.type || 'text',\n id: this._id\n }, getNativeProps(this.props, inputProperties, ['defaultValue', 'type'])), {\n 'aria-labelledby': this.props['aria-labelledby'] || (this.props.label ? this._labelId : undefined),\n ref: this._textElement,\n value: this.value || '',\n onInput: this._onInputChange,\n onChange: this._onInputChange,\n className: this._classNames.field,\n 'aria-label': this.props.ariaLabel,\n 'aria-describedby': this._isDescriptionAvailable ? this._descriptionId : this.props['aria-describedby'],\n 'aria-invalid': !!this._errorMessage,\n onFocus: this._onFocus,\n onBlur: this._onBlur\n });\n\n var defaultRender = function defaultRender(updatedInputProps) {\n return React.createElement(\"input\", __assign({}, updatedInputProps));\n };\n\n var onRenderInput = this.props.onRenderInput || defaultRender;\n return onRenderInput(inputProps, defaultRender);\n };\n\n TextFieldBase.prototype._validate = function (value) {\n var _this = this; // In case _validate is called again while validation promise is executing\n\n\n if (this._latestValidateValue === value && _shouldValidateAllChanges(this.props)) {\n return;\n }\n\n this._latestValidateValue = value;\n var onGetErrorMessage = this.props.onGetErrorMessage;\n var result = onGetErrorMessage && onGetErrorMessage(value || '');\n\n if (result !== undefined) {\n if (typeof result === 'string' || !('then' in result)) {\n this.setState({\n errorMessage: result\n });\n\n this._notifyAfterValidate(value, result);\n } else {\n var currentValidation_1 = ++this._lastValidation;\n result.then(function (errorMessage) {\n if (currentValidation_1 === _this._lastValidation) {\n _this.setState({\n errorMessage: errorMessage\n });\n }\n\n _this._notifyAfterValidate(value, errorMessage);\n });\n }\n } else {\n this._notifyAfterValidate(value, '');\n }\n };\n\n TextFieldBase.prototype._notifyAfterValidate = function (value, errorMessage) {\n if (value === this.value && this.props.onNotifyValidationResult) {\n this.props.onNotifyValidationResult(errorMessage, value);\n }\n };\n\n TextFieldBase.prototype._adjustInputHeight = function () {\n if (this._textElement.current && this.props.autoAdjustHeight && this.props.multiline) {\n var textField = this._textElement.current;\n textField.style.height = '';\n textField.style.height = textField.scrollHeight + 'px';\n }\n };\n\n TextFieldBase.defaultProps = {\n resizable: true,\n deferredValidationTime: 200,\n validateOnLoad: true,\n canRevealPassword: false\n };\n return TextFieldBase;\n}(React.Component);\n\nexport { TextFieldBase };\n/** Get the value from the given state and props (converting from number to string if needed) */\n\nfunction _getValue(props, state) {\n var _a = props.value,\n value = _a === void 0 ? state.uncontrolledValue : _a;\n\n if (typeof value === 'number') {\n // not allowed per typings, but happens anyway\n return String(value);\n }\n\n return value;\n}\n/**\n * If `validateOnFocusIn` or `validateOnFocusOut` is true, validation should run **only** on that event.\n * Otherwise, validation should run on every change.\n */\n\n\nfunction _shouldValidateAllChanges(props) {\n return !(props.validateOnFocusIn || props.validateOnFocusOut);\n} // Only calculate this once across all TextFields, since will stay the same\n\n\nvar __browserNeedsRevealButton;\n\nfunction _browserNeedsRevealButton() {\n var _a;\n\n if (typeof __browserNeedsRevealButton !== 'boolean') {\n var win = getWindow();\n\n if ((_a = win) === null || _a === void 0 ? void 0 : _a.navigator) {\n // Edge, Chromium Edge\n var isEdge = /Edg/.test(win.navigator.userAgent || '');\n __browserNeedsRevealButton = !(isIE11() || isEdge);\n } else {\n __browserNeedsRevealButton = true;\n }\n }\n\n return __browserNeedsRevealButton;\n}","import { __assign } from \"tslib\";\nimport { AnimationClassNames, getGlobalClassNames, getInputFocusStyle, HighContrastSelector, normalize, getPlaceholderStyles, IconFontSizes, getHighContrastNoAdjustStyle } from '../../Styling';\nvar globalClassNames = {\n root: 'ms-TextField',\n description: 'ms-TextField-description',\n errorMessage: 'ms-TextField-errorMessage',\n field: 'ms-TextField-field',\n fieldGroup: 'ms-TextField-fieldGroup',\n prefix: 'ms-TextField-prefix',\n suffix: 'ms-TextField-suffix',\n wrapper: 'ms-TextField-wrapper',\n revealButton: 'ms-TextField-reveal',\n multiline: 'ms-TextField--multiline',\n borderless: 'ms-TextField--borderless',\n underlined: 'ms-TextField--underlined',\n unresizable: 'ms-TextField--unresizable',\n required: 'is-required',\n disabled: 'is-disabled',\n active: 'is-active'\n};\n\nfunction getLabelStyles(props) {\n var underlined = props.underlined,\n disabled = props.disabled,\n focused = props.focused,\n theme = props.theme;\n var palette = theme.palette,\n fonts = theme.fonts;\n return function () {\n var _a;\n\n return {\n root: [underlined && disabled && {\n color: palette.neutralTertiary\n }, underlined && {\n fontSize: fonts.medium.fontSize,\n marginRight: 8,\n paddingLeft: 12,\n paddingRight: 0,\n lineHeight: '22px',\n height: 32\n }, underlined && focused && {\n selectors: (_a = {}, _a[HighContrastSelector] = {\n height: 31\n }, _a)\n }]\n };\n };\n}\n\nexport function getStyles(props) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;\n\n var theme = props.theme,\n className = props.className,\n disabled = props.disabled,\n focused = props.focused,\n required = props.required,\n multiline = props.multiline,\n hasLabel = props.hasLabel,\n borderless = props.borderless,\n underlined = props.underlined,\n hasIcon = props.hasIcon,\n resizable = props.resizable,\n hasErrorMessage = props.hasErrorMessage,\n inputClassName = props.inputClassName,\n autoAdjustHeight = props.autoAdjustHeight,\n hasRevealButton = props.hasRevealButton;\n var semanticColors = theme.semanticColors,\n effects = theme.effects,\n fonts = theme.fonts;\n var classNames = getGlobalClassNames(globalClassNames, theme);\n var fieldPrefixSuffix = {\n // Suffix/Prefix are not editable so the disabled slot perfectly fits.\n background: semanticColors.disabledBackground,\n color: !disabled ? semanticColors.inputPlaceholderText : semanticColors.disabledText,\n display: 'flex',\n alignItems: 'center',\n padding: '0 10px',\n lineHeight: 1,\n whiteSpace: 'nowrap',\n flexShrink: 0,\n selectors: (_a = {}, _a[HighContrastSelector] = {\n background: 'Window',\n color: disabled ? 'GrayText' : 'WindowText'\n }, _a)\n }; // placeholder style constants\n\n var placeholderStyles = [fonts.medium, {\n color: semanticColors.inputPlaceholderText,\n opacity: 1,\n selectors: (_b = {}, _b[HighContrastSelector] = {\n color: 'GrayText'\n }, _b)\n }];\n var disabledPlaceholderStyles = {\n color: semanticColors.disabledText,\n selectors: (_c = {}, _c[HighContrastSelector] = {\n color: 'GrayText'\n }, _c)\n };\n return {\n root: [classNames.root, fonts.medium, required && classNames.required, disabled && classNames.disabled, focused && classNames.active, multiline && classNames.multiline, borderless && classNames.borderless, underlined && classNames.underlined, normalize, {\n position: 'relative'\n }, className],\n wrapper: [classNames.wrapper, underlined && [{\n display: 'flex',\n borderBottom: \"1px solid \" + (!hasErrorMessage ? semanticColors.inputBorder : semanticColors.errorText),\n width: '100%'\n }, disabled && {\n borderBottomColor: semanticColors.disabledBackground,\n selectors: (_d = {}, _d[HighContrastSelector] = __assign({\n borderColor: 'GrayText'\n }, getHighContrastNoAdjustStyle()), _d)\n }, !disabled && {\n selectors: {\n ':hover': {\n borderBottomColor: !hasErrorMessage ? semanticColors.inputBorderHovered : semanticColors.errorText,\n selectors: (_e = {}, _e[HighContrastSelector] = __assign({\n borderBottomColor: 'Highlight'\n }, getHighContrastNoAdjustStyle()), _e)\n }\n }\n }, focused && [{\n position: 'relative'\n }, getInputFocusStyle(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, 0, 'borderBottom')]]],\n fieldGroup: [classNames.fieldGroup, normalize, {\n border: \"1px solid \" + semanticColors.inputBorder,\n borderRadius: effects.roundedCorner2,\n background: semanticColors.inputBackground,\n cursor: 'text',\n height: 32,\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'stretch',\n position: 'relative'\n }, multiline && {\n minHeight: '60px',\n height: 'auto',\n display: 'flex'\n }, !focused && !disabled && {\n selectors: {\n ':hover': {\n borderColor: semanticColors.inputBorderHovered,\n selectors: (_f = {}, _f[HighContrastSelector] = __assign({\n borderColor: 'Highlight'\n }, getHighContrastNoAdjustStyle()), _f)\n }\n }\n }, focused && !underlined && getInputFocusStyle(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, effects.roundedCorner2), disabled && {\n borderColor: semanticColors.disabledBackground,\n selectors: (_g = {}, _g[HighContrastSelector] = __assign({\n borderColor: 'GrayText'\n }, getHighContrastNoAdjustStyle()), _g),\n cursor: 'default'\n }, borderless && {\n border: 'none'\n }, borderless && focused && {\n border: 'none',\n selectors: {\n ':after': {\n border: 'none'\n }\n }\n }, underlined && {\n flex: '1 1 0px',\n border: 'none',\n textAlign: 'left'\n }, underlined && disabled && {\n backgroundColor: 'transparent'\n }, hasErrorMessage && !underlined && {\n borderColor: semanticColors.errorText,\n selectors: {\n '&:hover': {\n borderColor: semanticColors.errorText\n }\n }\n }, !hasLabel && required && {\n selectors: (_h = {\n ':before': {\n content: \"'*'\",\n color: semanticColors.errorText,\n position: 'absolute',\n top: -5,\n right: -10\n }\n }, _h[HighContrastSelector] = {\n selectors: {\n ':before': {\n color: 'WindowText',\n right: -14\n }\n }\n }, _h)\n }],\n field: [fonts.medium, classNames.field, normalize, {\n borderRadius: 0,\n border: 'none',\n background: 'none',\n backgroundColor: 'transparent',\n color: semanticColors.inputText,\n padding: '0 8px',\n width: '100%',\n minWidth: 0,\n textOverflow: 'ellipsis',\n outline: 0,\n selectors: (_j = {\n '&:active, &:focus, &:hover': {\n outline: 0\n },\n '::-ms-clear': {\n display: 'none'\n }\n }, _j[HighContrastSelector] = {\n background: 'Window',\n color: disabled ? 'GrayText' : 'WindowText'\n }, _j)\n }, getPlaceholderStyles(placeholderStyles), multiline && !resizable && [classNames.unresizable, {\n resize: 'none'\n }], multiline && {\n minHeight: 'inherit',\n lineHeight: 17,\n flexGrow: 1,\n paddingTop: 6,\n paddingBottom: 6,\n overflow: 'auto',\n width: '100%'\n }, multiline && autoAdjustHeight && {\n overflow: 'hidden'\n }, hasIcon && !hasRevealButton && {\n paddingRight: 24\n }, multiline && hasIcon && {\n paddingRight: 40\n }, disabled && [{\n backgroundColor: semanticColors.disabledBackground,\n color: semanticColors.disabledText,\n borderColor: semanticColors.disabledBackground\n }, getPlaceholderStyles(disabledPlaceholderStyles)], underlined && {\n textAlign: 'left'\n }, focused && !borderless && {\n selectors: (_k = {}, _k[HighContrastSelector] = {\n paddingLeft: 11,\n paddingRight: 11\n }, _k)\n }, focused && multiline && !borderless && {\n selectors: (_l = {}, _l[HighContrastSelector] = {\n paddingTop: 4\n }, _l)\n }, inputClassName],\n icon: [multiline && {\n paddingRight: 24,\n alignItems: 'flex-end'\n }, {\n pointerEvents: 'none',\n position: 'absolute',\n bottom: 6,\n right: 8,\n top: 'auto',\n fontSize: IconFontSizes.medium,\n lineHeight: 18\n }, disabled && {\n color: semanticColors.disabledText\n }],\n description: [classNames.description, {\n color: semanticColors.bodySubtext,\n fontSize: fonts.xSmall.fontSize\n }],\n errorMessage: [classNames.errorMessage, AnimationClassNames.slideDownIn20, fonts.small, {\n color: semanticColors.errorText,\n margin: 0,\n paddingTop: 5,\n display: 'flex',\n alignItems: 'center'\n }],\n prefix: [classNames.prefix, fieldPrefixSuffix],\n suffix: [classNames.suffix, fieldPrefixSuffix],\n revealButton: [classNames.revealButton, 'ms-Button', 'ms-Button--icon', {\n height: 30,\n width: 32,\n border: 'none',\n padding: '0px 4px',\n backgroundColor: 'transparent',\n color: semanticColors.link,\n selectors: {\n ':hover': {\n outline: 0,\n color: semanticColors.primaryButtonBackgroundHovered,\n backgroundColor: semanticColors.buttonBackgroundHovered,\n selectors: (_m = {}, _m[HighContrastSelector] = {\n borderColor: 'Highlight',\n color: 'Highlight'\n }, _m)\n },\n ':focus': {\n outline: 0\n }\n }\n }, hasIcon && {\n marginRight: 28\n }],\n revealSpan: {\n display: 'flex',\n height: '100%',\n alignItems: 'center'\n },\n revealIcon: {\n margin: '0px 4px',\n pointerEvents: 'none',\n bottom: 6,\n right: 8,\n top: 'auto',\n fontSize: IconFontSizes.medium,\n lineHeight: 18\n },\n subComponentStyles: {\n label: getLabelStyles(props)\n }\n };\n}","import { styled } from '../../Utilities';\nimport { TextFieldBase } from './TextField.base';\nimport { getStyles } from './TextField.styles';\nexport var TextField = styled(TextFieldBase, getStyles, undefined, {\n scope: 'TextField'\n});","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { classNamesFunction, divProperties, getNativeProps } from '../../Utilities';\nimport { Callout } from '../../Callout';\nimport { DirectionalHint } from '../../common/DirectionalHint';\nvar getClassNames = classNamesFunction();\n\nvar TooltipBase =\n/** @class */\nfunction (_super) {\n __extends(TooltipBase, _super);\n\n function TooltipBase() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this._onRenderContent = function (props) {\n return React.createElement(\"p\", {\n className: _this._classNames.subText\n }, props.content);\n };\n\n return _this;\n }\n\n TooltipBase.prototype.render = function () {\n var _a = this.props,\n className = _a.className,\n calloutProps = _a.calloutProps,\n directionalHint = _a.directionalHint,\n directionalHintForRTL = _a.directionalHintForRTL,\n styles = _a.styles,\n id = _a.id,\n maxWidth = _a.maxWidth,\n _b = _a.onRenderContent,\n onRenderContent = _b === void 0 ? this._onRenderContent : _b,\n targetElement = _a.targetElement,\n theme = _a.theme;\n this._classNames = getClassNames(styles, {\n theme: theme,\n className: className || calloutProps && calloutProps.className,\n beakWidth: calloutProps && calloutProps.beakWidth,\n gapSpace: calloutProps && calloutProps.gapSpace,\n maxWidth: maxWidth\n });\n return React.createElement(Callout, __assign({\n target: targetElement,\n directionalHint: directionalHint,\n directionalHintForRTL: directionalHintForRTL\n }, calloutProps, getNativeProps(this.props, divProperties, ['id']), {\n className: this._classNames.root\n }), React.createElement(\"div\", {\n className: this._classNames.content,\n id: id,\n role: \"tooltip\",\n onMouseEnter: this.props.onMouseEnter,\n onMouseLeave: this.props.onMouseLeave\n }, onRenderContent(this.props, this._onRenderContent)));\n }; // Specify default props values\n\n\n TooltipBase.defaultProps = {\n directionalHint: DirectionalHint.topCenter,\n maxWidth: '364px',\n calloutProps: {\n isBeakVisible: true,\n beakWidth: 16,\n gapSpace: 0,\n setInitialFocus: true,\n doNotLayer: false\n }\n };\n return TooltipBase;\n}(React.Component);\n\nexport { TooltipBase };","import { styled } from '../../Utilities';\nimport { TooltipBase } from './Tooltip.base';\nimport { getStyles } from './Tooltip.styles';\nexport var Tooltip = styled(TooltipBase, getStyles, undefined, {\n scope: 'Tooltip'\n});","import { AnimationClassNames } from '../../Styling';\nexport var getStyles = function getStyles(props) {\n var className = props.className,\n _a = props.beakWidth,\n beakWidth = _a === void 0 ? 16 : _a,\n _b = props.gapSpace,\n gapSpace = _b === void 0 ? 0 : _b,\n maxWidth = props.maxWidth,\n theme = props.theme;\n var semanticColors = theme.semanticColors,\n fonts = theme.fonts,\n effects = theme.effects; // The math here is done to account for the 45 degree rotation of the beak\n // and sub-pixel rounding that differs across browsers, which is more noticeable when\n // the device pixel ratio is larger\n\n var tooltipGapSpace = -(Math.sqrt(beakWidth * beakWidth / 2) + gapSpace) + 1 / window.devicePixelRatio;\n return {\n root: ['ms-Tooltip', theme.fonts.medium, AnimationClassNames.fadeIn200, {\n background: semanticColors.menuBackground,\n boxShadow: effects.elevation8,\n padding: '8px',\n maxWidth: maxWidth,\n selectors: {\n ':after': {\n content: \"''\",\n position: 'absolute',\n bottom: tooltipGapSpace,\n left: tooltipGapSpace,\n right: tooltipGapSpace,\n top: tooltipGapSpace,\n zIndex: 0\n }\n }\n }, className],\n content: ['ms-Tooltip-content', fonts.small, {\n position: 'relative',\n zIndex: 1,\n color: semanticColors.menuItemText,\n wordWrap: 'break-word',\n overflowWrap: 'break-word',\n overflow: 'hidden'\n }],\n subText: ['ms-Tooltip-subtext', {\n // Using inherit here to avoid unintentional global overrides of the tag.\n fontSize: 'inherit',\n fontWeight: 'inherit',\n color: 'inherit',\n margin: 0\n }]\n };\n};","/**\n * {@docCategory Tooltip}\n */\nexport var TooltipDelay;\n\n(function (TooltipDelay) {\n TooltipDelay[TooltipDelay[\"zero\"] = 0] = \"zero\";\n /** 300 ms delay before showng the tooltip */\n\n TooltipDelay[TooltipDelay[\"medium\"] = 1] = \"medium\";\n /** 500 ms delay before showing the tooltip */\n\n TooltipDelay[TooltipDelay[\"long\"] = 2] = \"long\";\n})(TooltipDelay || (TooltipDelay = {}));","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { hiddenContentStyle } from '../../Styling';\nimport { initializeComponentRef, Async, divProperties, getNativeProps, getId, assign, hasOverflow, portalContainsElement, classNamesFunction, KeyCodes } from '../../Utilities';\nimport { TooltipOverflowMode } from './TooltipHost.types';\nimport { Tooltip } from './Tooltip';\nimport { TooltipDelay } from './Tooltip.types';\nvar getClassNames = classNamesFunction();\n\nvar TooltipHostBase =\n/** @class */\nfunction (_super) {\n __extends(TooltipHostBase, _super); // Constructor\n\n\n function TooltipHostBase(props) {\n var _this = _super.call(this, props) || this; // The wrapping div that gets the hover events\n\n\n _this._tooltipHost = React.createRef();\n _this._defaultTooltipId = getId('tooltip');\n\n _this.show = function () {\n _this._toggleTooltip(true);\n };\n\n _this.dismiss = function () {\n _this._hideTooltip();\n };\n\n _this._getTargetElement = function () {\n if (!_this._tooltipHost.current) {\n return undefined;\n }\n\n var overflowMode = _this.props.overflowMode; // Select target element based on overflow mode. For parent mode, you want to position the tooltip relative\n // to the parent element, otherwise it might look off.\n\n if (overflowMode !== undefined) {\n switch (overflowMode) {\n case TooltipOverflowMode.Parent:\n return _this._tooltipHost.current.parentElement;\n\n case TooltipOverflowMode.Self:\n return _this._tooltipHost.current;\n }\n }\n\n return _this._tooltipHost.current;\n }; // Show Tooltip\n\n\n _this._onTooltipMouseEnter = function (ev) {\n var _a = _this.props,\n overflowMode = _a.overflowMode,\n delay = _a.delay;\n\n if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip !== _this) {\n TooltipHostBase._currentVisibleTooltip.dismiss();\n }\n\n TooltipHostBase._currentVisibleTooltip = _this;\n\n if (overflowMode !== undefined) {\n var overflowElement = _this._getTargetElement();\n\n if (overflowElement && !hasOverflow(overflowElement)) {\n return;\n }\n }\n\n if (ev.target && portalContainsElement(ev.target, _this._getTargetElement())) {\n // Do not show tooltip when target is inside a portal relative to TooltipHost.\n return;\n }\n\n _this._clearDismissTimer();\n\n _this._clearOpenTimer();\n\n if (delay !== TooltipDelay.zero) {\n _this.setState({\n isAriaPlaceholderRendered: true\n });\n\n var delayTime = _this._getDelayTime(delay); // non-null assertion because we set it in `defaultProps`\n\n\n _this._openTimerId = _this._async.setTimeout(function () {\n _this._toggleTooltip(true);\n }, delayTime);\n } else {\n _this._toggleTooltip(true);\n }\n }; // Hide Tooltip\n\n\n _this._onTooltipMouseLeave = function (ev) {\n var closeDelay = _this.props.closeDelay;\n\n _this._clearDismissTimer();\n\n _this._clearOpenTimer();\n\n if (closeDelay) {\n _this._dismissTimerId = _this._async.setTimeout(function () {\n _this._toggleTooltip(false);\n }, closeDelay);\n } else {\n _this._toggleTooltip(false);\n }\n\n if (TooltipHostBase._currentVisibleTooltip === _this) {\n TooltipHostBase._currentVisibleTooltip = undefined;\n }\n };\n\n _this._onTooltipKeyDown = function (ev) {\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && _this.state.isTooltipVisible) {\n _this._hideTooltip();\n\n ev.stopPropagation();\n }\n };\n\n _this._clearDismissTimer = function () {\n _this._async.clearTimeout(_this._dismissTimerId);\n };\n\n _this._clearOpenTimer = function () {\n _this._async.clearTimeout(_this._openTimerId);\n }; // Hide Tooltip\n\n\n _this._hideTooltip = function () {\n _this._clearOpenTimer();\n\n _this._clearDismissTimer();\n\n _this._toggleTooltip(false);\n };\n\n _this._toggleTooltip = function (isTooltipVisible) {\n if (_this.state.isTooltipVisible !== isTooltipVisible) {\n _this.setState({\n isAriaPlaceholderRendered: false,\n isTooltipVisible: isTooltipVisible\n }, function () {\n return _this.props.onTooltipToggle && _this.props.onTooltipToggle(isTooltipVisible);\n });\n }\n };\n\n _this._getDelayTime = function (delay) {\n switch (delay) {\n case TooltipDelay.medium:\n return 300;\n\n case TooltipDelay.long:\n return 500;\n\n default:\n return 0;\n }\n };\n\n initializeComponentRef(_this);\n _this.state = {\n isAriaPlaceholderRendered: false,\n isTooltipVisible: false\n };\n _this._async = new Async(_this);\n return _this;\n } // Render\n\n\n TooltipHostBase.prototype.render = function () {\n var _a = this.props,\n calloutProps = _a.calloutProps,\n children = _a.children,\n content = _a.content,\n directionalHint = _a.directionalHint,\n directionalHintForRTL = _a.directionalHintForRTL,\n className = _a.hostClassName,\n id = _a.id,\n _b = _a.setAriaDescribedBy,\n setAriaDescribedBy = _b === void 0 ? true : _b,\n tooltipProps = _a.tooltipProps,\n styles = _a.styles,\n theme = _a.theme;\n this._classNames = getClassNames(styles, {\n theme: theme,\n className: className\n });\n var _c = this.state,\n isAriaPlaceholderRendered = _c.isAriaPlaceholderRendered,\n isTooltipVisible = _c.isTooltipVisible;\n var tooltipId = id || this._defaultTooltipId;\n var isContentPresent = !!(content || tooltipProps && tooltipProps.onRenderContent && tooltipProps.onRenderContent());\n var showTooltip = isTooltipVisible && isContentPresent;\n var ariaDescribedBy = setAriaDescribedBy && isTooltipVisible && isContentPresent ? tooltipId : undefined;\n return React.createElement(\"div\", __assign({\n className: this._classNames.root,\n ref: this._tooltipHost\n }, {\n onFocusCapture: this._onTooltipMouseEnter\n }, {\n onBlurCapture: this._hideTooltip\n }, {\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n onKeyDown: this._onTooltipKeyDown,\n \"aria-describedby\": ariaDescribedBy\n }), children, showTooltip && React.createElement(Tooltip, __assign({\n id: tooltipId,\n content: content,\n targetElement: this._getTargetElement(),\n directionalHint: directionalHint,\n directionalHintForRTL: directionalHintForRTL,\n calloutProps: assign({}, calloutProps, {\n onDismiss: this._hideTooltip,\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave\n }),\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave\n }, getNativeProps(this.props, divProperties), tooltipProps)), isAriaPlaceholderRendered && React.createElement(\"div\", {\n id: tooltipId,\n style: hiddenContentStyle\n }, content));\n };\n\n TooltipHostBase.prototype.componentWillUnmount = function () {\n if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip === this) {\n TooltipHostBase._currentVisibleTooltip = undefined;\n }\n\n this._async.dispose();\n };\n\n TooltipHostBase.defaultProps = {\n delay: TooltipDelay.medium\n };\n return TooltipHostBase;\n}(React.Component);\n\nexport { TooltipHostBase };","import { getGlobalClassNames } from '../../Styling';\nvar GlobalClassNames = {\n root: 'ms-TooltipHost',\n ariaPlaceholder: 'ms-TooltipHost-aria-placeholder'\n};\nexport var getStyles = function getStyles(props) {\n var className = props.className,\n theme = props.theme;\n var classNames = getGlobalClassNames(GlobalClassNames, theme);\n return {\n root: [classNames.root, {\n display: 'inline'\n }, className]\n };\n};","import { styled } from '../../Utilities';\nimport { TooltipHostBase } from './TooltipHost.base';\nimport { getStyles } from './TooltipHost.styles';\nexport var TooltipHost = styled(TooltipHostBase, getStyles, undefined, {\n scope: 'TooltipHost'\n});","/**\n * {@docCategory Tooltip}\n */\nexport var TooltipOverflowMode;\n\n(function (TooltipOverflowMode) {\n /** Only show tooltip if parent DOM element is overflowing */\n TooltipOverflowMode[TooltipOverflowMode[\"Parent\"] = 0] = \"Parent\";\n /**\n * Only show tooltip if tooltip host's content is overflowing.\n * Note that this does not check the children for overflow, only the TooltipHost root.\n */\n\n TooltipOverflowMode[TooltipOverflowMode[\"Self\"] = 1] = \"Self\";\n})(TooltipOverflowMode || (TooltipOverflowMode = {}));","/* eslint-disable */\nimport { loadStyles } from '@microsoft/load-themed-styles';\nloadStyles([{\n \"rawString\": \".root_c995a031{min-width:260px}.suggestionsItem_c995a031{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-webkit-box-sizing:border-box;box-sizing:border-box;width:100%;position:relative;overflow:hidden}.suggestionsItem_c995a031:hover{background:\"\n}, {\n \"theme\": \"neutralLighter\",\n \"defaultValue\": \"#f3f2f1\"\n}, {\n \"rawString\": \"}.suggestionsItem_c995a031:hover .closeButton_c995a031{display:block}.suggestionsItem_c995a031.suggestionsItemIsSuggested_c995a031{background:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.suggestionsItem_c995a031.suggestionsItemIsSuggested_c995a031:hover{background:\"\n}, {\n \"theme\": \"neutralTertiaryAlt\",\n \"defaultValue\": \"#c8c6c4\"\n}, {\n \"rawString\": \"}@media screen and (-ms-high-contrast:active){.suggestionsItem_c995a031.suggestionsItemIsSuggested_c995a031:hover{background:Highlight;color:HighlightText}}@media screen and (-ms-high-contrast:active){.suggestionsItem_c995a031.suggestionsItemIsSuggested_c995a031{background:Highlight;color:HighlightText;-ms-high-contrast-adjust:none}}.suggestionsItem_c995a031.suggestionsItemIsSuggested_c995a031 .closeButton_c995a031:hover{background:\"\n}, {\n \"theme\": \"neutralTertiary\",\n \"defaultValue\": \"#a19f9d\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralPrimary\",\n \"defaultValue\": \"#323130\"\n}, {\n \"rawString\": \"}@media screen and (-ms-high-contrast:active){.suggestionsItem_c995a031.suggestionsItemIsSuggested_c995a031 .itemButton_c995a031{color:HighlightText}}.suggestionsItem_c995a031 .closeButton_c995a031{display:none;color:\"\n}, {\n \"theme\": \"neutralSecondary\",\n \"defaultValue\": \"#605e5c\"\n}, {\n \"rawString\": \"}.suggestionsItem_c995a031 .closeButton_c995a031:hover{background:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.actionButton_c995a031{background-color:transparent;border:0;cursor:pointer;margin:0;position:relative;border-top:1px solid \"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";height:40px;width:100%;font-size:12px}[dir=ltr] .actionButton_c995a031{padding-left:8px}[dir=rtl] .actionButton_c995a031{padding-right:8px}html[dir=ltr] .actionButton_c995a031{text-align:left}html[dir=rtl] .actionButton_c995a031{text-align:right}.actionButton_c995a031:hover{background-color:\"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \";cursor:pointer}.actionButton_c995a031:active,.actionButton_c995a031:focus{background-color:\"\n}, {\n \"theme\": \"themeLight\",\n \"defaultValue\": \"#c7e0f4\"\n}, {\n \"rawString\": \"}.actionButton_c995a031 .ms-Button-icon{font-size:16px;width:25px}.actionButton_c995a031 .ms-Button-label{margin:0 4px 0 9px}html[dir=rtl] .actionButton_c995a031 .ms-Button-label{margin:0 9px 0 4px}.buttonSelected_c995a031{background-color:\"\n}, {\n \"theme\": \"themeLight\",\n \"defaultValue\": \"#c7e0f4\"\n}, {\n \"rawString\": \"}.suggestionsTitle_c995a031{padding:0 12px;color:\"\n}, {\n \"theme\": \"themePrimary\",\n \"defaultValue\": \"#0078d4\"\n}, {\n \"rawString\": \";font-size:12px;line-height:40px;border-bottom:1px solid \"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.suggestionsContainer_c995a031{overflow-y:auto;overflow-x:hidden;max-height:300px;border-bottom:1px solid \"\n}, {\n \"theme\": \"neutralLight\",\n \"defaultValue\": \"#edebe9\"\n}, {\n \"rawString\": \"}.suggestionsNone_c995a031{text-align:center;color:#797775;font-size:12px;line-height:30px}.suggestionsSpinner_c995a031{margin:5px 0;white-space:nowrap;line-height:20px;font-size:12px}html[dir=ltr] .suggestionsSpinner_c995a031{padding-left:14px}html[dir=rtl] .suggestionsSpinner_c995a031{padding-right:14px}html[dir=ltr] .suggestionsSpinner_c995a031{text-align:left}html[dir=rtl] .suggestionsSpinner_c995a031{text-align:right}.suggestionsSpinner_c995a031 .ms-Spinner-circle{display:inline-block;vertical-align:middle}.suggestionsSpinner_c995a031 .ms-Spinner-label{display:inline-block;margin:0 10px 0 16px;vertical-align:middle}html[dir=rtl] .suggestionsSpinner_c995a031 .ms-Spinner-label{margin:0 16px 0 10px}.itemButton_c995a031.itemButton_c995a031{width:100%;padding:0;min-width:0;height:100%}@media screen and (-ms-high-contrast:active){.itemButton_c995a031.itemButton_c995a031{color:WindowText}}.itemButton_c995a031.itemButton_c995a031:hover{color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.closeButton_c995a031.closeButton_c995a031{padding:0 4px;height:auto;width:32px}@media screen and (-ms-high-contrast:active){.closeButton_c995a031.closeButton_c995a031{color:WindowText}}.closeButton_c995a031.closeButton_c995a031:hover{background:\"\n}, {\n \"theme\": \"neutralTertiaryAlt\",\n \"defaultValue\": \"#c8c6c4\"\n}, {\n \"rawString\": \";color:\"\n}, {\n \"theme\": \"neutralDark\",\n \"defaultValue\": \"#201f1e\"\n}, {\n \"rawString\": \"}.suggestionsAvailable_c995a031{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}\"\n}]);\nexport var root = \"root_c995a031\";\nexport var suggestionsItem = \"suggestionsItem_c995a031\";\nexport var closeButton = \"closeButton_c995a031\";\nexport var suggestionsItemIsSuggested = \"suggestionsItemIsSuggested_c995a031\";\nexport var itemButton = \"itemButton_c995a031\";\nexport var actionButton = \"actionButton_c995a031\";\nexport var buttonSelected = \"buttonSelected_c995a031\";\nexport var suggestionsTitle = \"suggestionsTitle_c995a031\";\nexport var suggestionsContainer = \"suggestionsContainer_c995a031\";\nexport var suggestionsNone = \"suggestionsNone_c995a031\";\nexport var suggestionsSpinner = \"suggestionsSpinner_c995a031\";\nexport var suggestionsAvailable = \"suggestionsAvailable_c995a031\";","import { __extends } from \"tslib\";\nimport * as React from 'react';\nimport { classNamesFunction, css, initializeComponentRef } from '../../../Utilities';\nimport { CommandButton, IconButton } from '../../../Button';\nimport * as stylesImport from './Suggestions.scss';\nvar legacyStyles = stylesImport;\nvar getClassNames = classNamesFunction();\n/**\n * {@docCategory Pickers}\n */\n\nvar SuggestionsItem =\n/** @class */\nfunction (_super) {\n __extends(SuggestionsItem, _super);\n\n function SuggestionsItem(props) {\n var _this = _super.call(this, props) || this;\n\n initializeComponentRef(_this);\n return _this;\n }\n\n SuggestionsItem.prototype.render = function () {\n var _a;\n\n var _b = this.props,\n suggestionModel = _b.suggestionModel,\n RenderSuggestion = _b.RenderSuggestion,\n onClick = _b.onClick,\n className = _b.className,\n id = _b.id,\n onRemoveItem = _b.onRemoveItem,\n isSelectedOverride = _b.isSelectedOverride,\n removeButtonAriaLabel = _b.removeButtonAriaLabel,\n styles = _b.styles,\n theme = _b.theme; // TODO\n // Clean this up by leaving only the first part after removing support for SASS.\n // Currently we can not remove the SASS styles from SuggestionsItem class because it\n // might be used by consumers separately from pickers extending from BasePicker\n // and have not used the new 'styles' prop. Because it's expecting a type parameter,\n // we can not use the 'styled' function without adding some helpers which can break\n // downstream consumers who did not use the new helpers.\n // We check for 'styles' prop which is going to be injected by the 'styled' HOC\n // in Suggestions when the typed SuggestionsItem class is ready to be rendered. If the\n // check passes we can use the CSS-in-JS styles. If the check fails (ex: custom picker),\n // then we just use the old SASS styles instead.\n\n var classNames = styles ? getClassNames(styles, {\n theme: theme,\n className: className,\n suggested: suggestionModel.selected || isSelectedOverride\n }) : {\n root: css('ms-Suggestions-item', legacyStyles.suggestionsItem, (_a = {}, _a['is-suggested ' + legacyStyles.suggestionsItemIsSuggested] = suggestionModel.selected || isSelectedOverride, _a), className),\n itemButton: css('ms-Suggestions-itemButton', legacyStyles.itemButton),\n closeButton: css('ms-Suggestions-closeButton', legacyStyles.closeButton)\n };\n return React.createElement(\"div\", {\n className: classNames.root,\n role: \"presentation\"\n }, React.createElement(CommandButton, {\n onClick: onClick,\n className: classNames.itemButton,\n id: id,\n \"aria-selected\": suggestionModel.selected,\n role: \"option\",\n \"aria-label\": suggestionModel.ariaLabel\n }, RenderSuggestion(suggestionModel.item, this.props)), this.props.showRemoveButton ? React.createElement(IconButton, {\n iconProps: {\n iconName: 'Cancel',\n styles: {\n root: {\n fontSize: '12px'\n }\n }\n },\n title: removeButtonAriaLabel,\n ariaLabel: removeButtonAriaLabel,\n onClick: onRemoveItem,\n className: classNames.closeButton\n }) : null);\n };\n\n return SuggestionsItem;\n}(React.Component);\n\nexport { SuggestionsItem };","export function getAllSelectedOptions(options, selectedIndices) {\n var selectedOptions = [];\n\n for (var _i = 0, selectedIndices_1 = selectedIndices; _i < selectedIndices_1.length; _i++) {\n var index = selectedIndices_1[_i];\n var option = options[index];\n\n if (option) {\n selectedOptions.push(option);\n }\n }\n\n return selectedOptions;\n}","export var SelectableOptionMenuItemType;\n\n(function (SelectableOptionMenuItemType) {\n SelectableOptionMenuItemType[SelectableOptionMenuItemType[\"Normal\"] = 0] = \"Normal\";\n SelectableOptionMenuItemType[SelectableOptionMenuItemType[\"Divider\"] = 1] = \"Divider\";\n SelectableOptionMenuItemType[SelectableOptionMenuItemType[\"Header\"] = 2] = \"Header\";\n})(SelectableOptionMenuItemType || (SelectableOptionMenuItemType = {}));","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { Async, EventGroup, KeyCodes, elementContains, findScrollableParent, getParent, getDocument, getWindow, isElementTabbable, css, initializeComponentRef, FocusRects } from '../../Utilities';\nimport { SelectionMode } from './interfaces'; // Selection definitions:\n//\n// Anchor index: the point from which a range selection starts.\n// Focus index: the point from which layout movement originates from.\n//\n// These two can differ. Tests:\n//\n// If you start at index 5\n// Shift click to index 10\n// The focus is 10, the anchor is 5.\n// If you shift click at index 0\n// The anchor remains at 5, the items between 0 and 5 are selected and everything else is cleared.\n// If you click index 8\n// The anchor and focus are set to 8.\n\nvar SELECTION_DISABLED_ATTRIBUTE_NAME = 'data-selection-disabled';\nvar SELECTION_INDEX_ATTRIBUTE_NAME = 'data-selection-index';\nvar SELECTION_TOGGLE_ATTRIBUTE_NAME = 'data-selection-toggle';\nvar SELECTION_INVOKE_ATTRIBUTE_NAME = 'data-selection-invoke';\nvar SELECTION_INVOKE_TOUCH_ATTRIBUTE_NAME = 'data-selection-touch-invoke';\nvar SELECTALL_TOGGLE_ALL_ATTRIBUTE_NAME = 'data-selection-all-toggle';\nvar SELECTION_SELECT_ATTRIBUTE_NAME = 'data-selection-select';\n/**\n * {@docCategory Selection}\n */\n\nvar SelectionZone =\n/** @class */\nfunction (_super) {\n __extends(SelectionZone, _super);\n\n function SelectionZone(props) {\n var _this = _super.call(this, props) || this;\n\n _this._root = React.createRef();\n /**\n * In some cases, the consuming scenario requires to set focus on a row without having SelectionZone\n * react to the event. Note that focus events in IE \\<= 11 will occur asynchronously after .focus() has\n * been called on an element, so we need a flag to store the idea that we will bypass the \"next\"\n * focus event that occurs. This method does that.\n */\n\n _this.ignoreNextFocus = function () {\n _this._handleNextFocus(false);\n };\n\n _this._onSelectionChange = function () {\n var selection = _this.props.selection;\n var isModal = selection.isModal && selection.isModal();\n\n _this.setState({\n isModal: isModal\n });\n };\n\n _this._onMouseDownCapture = function (ev) {\n var target = ev.target;\n\n if (document.activeElement !== target && !elementContains(document.activeElement, target)) {\n _this.ignoreNextFocus();\n\n return;\n }\n\n if (!elementContains(target, _this._root.current)) {\n return;\n }\n\n while (target !== _this._root.current) {\n if (_this._hasAttribute(target, SELECTION_INVOKE_ATTRIBUTE_NAME)) {\n _this.ignoreNextFocus();\n\n break;\n }\n\n target = getParent(target);\n }\n };\n /**\n * When we focus an item, for single/multi select scenarios, we should try to select it immediately\n * as long as the focus did not originate from a mouse down/touch event. For those cases, we handle them\n * specially.\n */\n\n\n _this._onFocus = function (ev) {\n var target = ev.target;\n var selection = _this.props.selection;\n var isToggleModifierPressed = _this._isCtrlPressed || _this._isMetaPressed;\n\n var selectionMode = _this._getSelectionMode();\n\n if (_this._shouldHandleFocus && selectionMode !== SelectionMode.none) {\n var isToggle = _this._hasAttribute(target, SELECTION_TOGGLE_ATTRIBUTE_NAME);\n\n var itemRoot = _this._findItemRoot(target);\n\n if (!isToggle && itemRoot) {\n var index = _this._getItemIndex(itemRoot);\n\n if (isToggleModifierPressed) {\n // set anchor only.\n selection.setIndexSelected(index, selection.isIndexSelected(index), true);\n\n if (_this.props.enterModalOnTouch && _this._isTouch && selection.setModal) {\n selection.setModal(true);\n\n _this._setIsTouch(false);\n }\n } else {\n if (_this.props.isSelectedOnFocus) {\n _this._onItemSurfaceClick(ev, index);\n }\n }\n }\n }\n\n _this._handleNextFocus(false);\n };\n\n _this._onMouseDown = function (ev) {\n _this._updateModifiers(ev);\n\n var target = ev.target;\n\n var itemRoot = _this._findItemRoot(target); // No-op if selection is disabled\n\n\n if (_this._isSelectionDisabled(target)) {\n return;\n }\n\n while (target !== _this._root.current) {\n if (_this._hasAttribute(target, SELECTALL_TOGGLE_ALL_ATTRIBUTE_NAME)) {\n break;\n } else if (itemRoot) {\n if (_this._hasAttribute(target, SELECTION_TOGGLE_ATTRIBUTE_NAME)) {\n break;\n } else if (_this._hasAttribute(target, SELECTION_INVOKE_ATTRIBUTE_NAME)) {\n break;\n } else if ((target === itemRoot || _this._shouldAutoSelect(target)) && !_this._isShiftPressed && !_this._isCtrlPressed && !_this._isMetaPressed) {\n _this._onInvokeMouseDown(ev, _this._getItemIndex(itemRoot));\n\n break;\n } else if (_this.props.disableAutoSelectOnInputElements && (target.tagName === 'A' || target.tagName === 'BUTTON' || target.tagName === 'INPUT')) {\n return;\n }\n }\n\n target = getParent(target);\n }\n };\n\n _this._onTouchStartCapture = function (ev) {\n _this._setIsTouch(true);\n };\n\n _this._onClick = function (ev) {\n var _a = _this.props.enableTouchInvocationTarget,\n enableTouchInvocationTarget = _a === void 0 ? false : _a;\n\n _this._updateModifiers(ev);\n\n var target = ev.target;\n\n var itemRoot = _this._findItemRoot(target);\n\n var isSelectionDisabled = _this._isSelectionDisabled(target);\n\n while (target !== _this._root.current) {\n if (_this._hasAttribute(target, SELECTALL_TOGGLE_ALL_ATTRIBUTE_NAME)) {\n if (!isSelectionDisabled) {\n _this._onToggleAllClick(ev);\n }\n\n break;\n } else if (itemRoot) {\n var index = _this._getItemIndex(itemRoot);\n\n if (_this._hasAttribute(target, SELECTION_TOGGLE_ATTRIBUTE_NAME)) {\n if (!isSelectionDisabled) {\n if (_this._isShiftPressed) {\n _this._onItemSurfaceClick(ev, index);\n } else {\n _this._onToggleClick(ev, index);\n }\n }\n\n break;\n } else if (_this._isTouch && enableTouchInvocationTarget && _this._hasAttribute(target, SELECTION_INVOKE_TOUCH_ATTRIBUTE_NAME) || _this._hasAttribute(target, SELECTION_INVOKE_ATTRIBUTE_NAME)) {\n // Items should be invokable even if selection is disabled.\n _this._onInvokeClick(ev, index);\n\n break;\n } else if (target === itemRoot) {\n if (!isSelectionDisabled) {\n _this._onItemSurfaceClick(ev, index);\n }\n\n break;\n } else if (target.tagName === 'A' || target.tagName === 'BUTTON' || target.tagName === 'INPUT') {\n return;\n }\n }\n\n target = getParent(target);\n }\n };\n\n _this._onContextMenu = function (ev) {\n var target = ev.target;\n var _a = _this.props,\n onItemContextMenu = _a.onItemContextMenu,\n selection = _a.selection;\n\n if (onItemContextMenu) {\n var itemRoot = _this._findItemRoot(target);\n\n if (itemRoot) {\n var index = _this._getItemIndex(itemRoot);\n\n _this._onInvokeMouseDown(ev, index);\n\n var skipPreventDefault = onItemContextMenu(selection.getItems()[index], index, ev.nativeEvent); // In order to keep back compat, if the value here is undefined, then we should still\n // call preventDefault(). Only in the case where true is explicitly returned should\n // the call be skipped.\n\n if (!skipPreventDefault) {\n ev.preventDefault();\n }\n }\n }\n };\n /**\n * In multi selection, if you double click within an item's root (but not within the invoke element or\n * input elements), we should execute the invoke handler.\n */\n\n\n _this._onDoubleClick = function (ev) {\n var target = ev.target;\n var onItemInvoked = _this.props.onItemInvoked;\n\n var itemRoot = _this._findItemRoot(target);\n\n if (itemRoot && onItemInvoked && !_this._isInputElement(target)) {\n var index = _this._getItemIndex(itemRoot);\n\n while (target !== _this._root.current) {\n if (_this._hasAttribute(target, SELECTION_TOGGLE_ATTRIBUTE_NAME) || _this._hasAttribute(target, SELECTION_INVOKE_ATTRIBUTE_NAME)) {\n break;\n } else if (target === itemRoot) {\n _this._onInvokeClick(ev, index);\n\n break;\n }\n\n target = getParent(target);\n }\n\n target = getParent(target);\n }\n };\n\n _this._onKeyDownCapture = function (ev) {\n _this._updateModifiers(ev);\n\n _this._handleNextFocus(true);\n };\n\n _this._onKeyDown = function (ev) {\n _this._updateModifiers(ev);\n\n var target = ev.target;\n\n var isSelectionDisabled = _this._isSelectionDisabled(target);\n\n var selection = _this.props.selection;\n var isSelectAllKey = ev.which === KeyCodes.a && (_this._isCtrlPressed || _this._isMetaPressed);\n var isClearSelectionKey = ev.which === KeyCodes.escape; // Ignore key downs from input elements.\n\n if (_this._isInputElement(target)) {\n // A key was pressed while an item in this zone was focused.\n return;\n }\n\n var selectionMode = _this._getSelectionMode(); // If ctrl-a is pressed, select all (if all are not already selected.)\n\n\n if (isSelectAllKey && selectionMode === SelectionMode.multiple && !selection.isAllSelected()) {\n if (!isSelectionDisabled) {\n selection.setAllSelected(true);\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n return;\n } // If escape is pressed, clear selection (if any are selected.)\n\n\n if (isClearSelectionKey && selection.getSelectedCount() > 0) {\n if (!isSelectionDisabled) {\n selection.setAllSelected(false);\n }\n\n ev.stopPropagation();\n ev.preventDefault();\n return;\n }\n\n var itemRoot = _this._findItemRoot(target); // If a key was pressed within an item, we should treat \"enters\" as invokes and \"space\" as toggle\n\n\n if (itemRoot) {\n var index = _this._getItemIndex(itemRoot);\n\n while (target !== _this._root.current) {\n if (_this._hasAttribute(target, SELECTION_TOGGLE_ATTRIBUTE_NAME)) {\n // For toggle elements, assuming they are rendered as buttons, they will generate a click event,\n // so we can no-op for any keydowns in this case.\n break;\n } else if (_this._shouldAutoSelect(target)) {\n if (!isSelectionDisabled) {\n // If the event went to an element which should trigger auto-select, select it and then let\n // the default behavior kick in.\n _this._onInvokeMouseDown(ev, index);\n }\n\n break;\n } else if ((ev.which === KeyCodes.enter || ev.which === KeyCodes.space) && (target.tagName === 'BUTTON' || target.tagName === 'A' || target.tagName === 'INPUT')) {\n return false;\n } else if (target === itemRoot) {\n if (ev.which === KeyCodes.enter) {\n // Items should be invokable even if selection is disabled.\n _this._onInvokeClick(ev, index);\n\n ev.preventDefault();\n return;\n } else if (ev.which === KeyCodes.space) {\n if (!isSelectionDisabled) {\n _this._onToggleClick(ev, index);\n }\n\n ev.preventDefault();\n return;\n }\n\n break;\n }\n\n target = getParent(target);\n }\n }\n };\n\n _this._events = new EventGroup(_this);\n _this._async = new Async(_this);\n initializeComponentRef(_this);\n var selection = _this.props.selection; // Reflect the initial modal state of selection into the state.\n\n var isModal = selection.isModal && selection.isModal();\n _this.state = {\n isModal: isModal\n };\n return _this;\n }\n\n SelectionZone.getDerivedStateFromProps = function (nextProps, prevState) {\n var isModal = nextProps.selection.isModal && nextProps.selection.isModal();\n return __assign(__assign({}, prevState), {\n isModal: isModal\n });\n };\n\n SelectionZone.prototype.componentDidMount = function () {\n var win = getWindow(this._root.current); // Track the latest modifier keys globally.\n\n this._events.on(win, 'keydown, keyup', this._updateModifiers, true);\n\n this._events.on(document, 'click', this._findScrollParentAndTryClearOnEmptyClick);\n\n this._events.on(document.body, 'touchstart', this._onTouchStartCapture, true);\n\n this._events.on(document.body, 'touchend', this._onTouchStartCapture, true); // Subscribe to the selection to keep modal state updated.\n\n\n this._events.on(this.props.selection, 'change', this._onSelectionChange);\n };\n\n SelectionZone.prototype.render = function () {\n var isModal = this.state.isModal;\n return React.createElement(\"div\", {\n className: css('ms-SelectionZone', this.props.className, {\n 'ms-SelectionZone--modal': !!isModal\n }),\n ref: this._root,\n onKeyDown: this._onKeyDown,\n onMouseDown: this._onMouseDown,\n onKeyDownCapture: this._onKeyDownCapture,\n onClick: this._onClick,\n role: \"presentation\",\n onDoubleClick: this._onDoubleClick,\n onContextMenu: this._onContextMenu,\n onMouseDownCapture: this._onMouseDownCapture,\n onFocusCapture: this._onFocus,\n \"data-selection-is-modal\": isModal ? true : undefined\n }, this.props.children, React.createElement(FocusRects, null));\n };\n\n SelectionZone.prototype.componentDidUpdate = function (previousProps) {\n var selection = this.props.selection;\n\n if (selection !== previousProps.selection) {\n // Whenever selection changes, update the subscripton to keep modal state updated.\n this._events.off(previousProps.selection);\n\n this._events.on(selection, 'change', this._onSelectionChange);\n }\n };\n\n SelectionZone.prototype.componentWillUnmount = function () {\n this._events.dispose();\n\n this._async.dispose();\n };\n\n SelectionZone.prototype._isSelectionDisabled = function (target) {\n if (this._getSelectionMode() === SelectionMode.none) {\n return true;\n }\n\n while (target !== this._root.current) {\n if (this._hasAttribute(target, SELECTION_DISABLED_ATTRIBUTE_NAME)) {\n return true;\n }\n\n target = getParent(target);\n }\n\n return false;\n };\n\n SelectionZone.prototype._onToggleAllClick = function (ev) {\n var selection = this.props.selection;\n\n var selectionMode = this._getSelectionMode();\n\n if (selectionMode === SelectionMode.multiple) {\n selection.toggleAllSelected();\n ev.stopPropagation();\n ev.preventDefault();\n }\n };\n\n SelectionZone.prototype._onToggleClick = function (ev, index) {\n var selection = this.props.selection;\n\n var selectionMode = this._getSelectionMode();\n\n selection.setChangeEvents(false);\n\n if (this.props.enterModalOnTouch && this._isTouch && !selection.isIndexSelected(index) && selection.setModal) {\n selection.setModal(true);\n\n this._setIsTouch(false);\n }\n\n if (selectionMode === SelectionMode.multiple) {\n selection.toggleIndexSelected(index);\n } else if (selectionMode === SelectionMode.single) {\n var isSelected = selection.isIndexSelected(index);\n var isModal = selection.isModal && selection.isModal();\n selection.setAllSelected(false);\n selection.setIndexSelected(index, !isSelected, true);\n\n if (isModal && selection.setModal) {\n // Since the above call to setAllSelected(false) clears modal state,\n // restore it. This occurs because the SelectionMode of the Selection\n // may differ from the SelectionZone.\n selection.setModal(true);\n }\n } else {\n selection.setChangeEvents(true);\n return;\n }\n\n selection.setChangeEvents(true);\n ev.stopPropagation(); // NOTE: ev.preventDefault is not called for toggle clicks, because this will kill the browser behavior\n // for checkboxes if you use a checkbox for the toggle.\n };\n\n SelectionZone.prototype._onInvokeClick = function (ev, index) {\n var _a = this.props,\n selection = _a.selection,\n onItemInvoked = _a.onItemInvoked;\n\n if (onItemInvoked) {\n onItemInvoked(selection.getItems()[index], index, ev.nativeEvent);\n ev.preventDefault();\n ev.stopPropagation();\n }\n };\n\n SelectionZone.prototype._onItemSurfaceClick = function (ev, index) {\n var selection = this.props.selection;\n var isToggleModifierPressed = this._isCtrlPressed || this._isMetaPressed;\n\n var selectionMode = this._getSelectionMode();\n\n if (selectionMode === SelectionMode.multiple) {\n if (this._isShiftPressed && !this._isTabPressed) {\n selection.selectToIndex(index, !isToggleModifierPressed);\n } else if (isToggleModifierPressed) {\n selection.toggleIndexSelected(index);\n } else {\n this._clearAndSelectIndex(index);\n }\n } else if (selectionMode === SelectionMode.single) {\n this._clearAndSelectIndex(index);\n }\n };\n\n SelectionZone.prototype._onInvokeMouseDown = function (ev, index) {\n var selection = this.props.selection; // Only do work if item is not selected.\n\n if (selection.isIndexSelected(index)) {\n return;\n }\n\n this._clearAndSelectIndex(index);\n };\n /**\n * To avoid high startup cost of traversing the DOM on component mount,\n * defer finding the scrollable parent until a click interaction.\n *\n * The styles will probably already calculated since we're running in a click handler,\n * so this is less likely to cause layout thrashing then doing it in mount.\n */\n\n\n SelectionZone.prototype._findScrollParentAndTryClearOnEmptyClick = function (ev) {\n var scrollParent = findScrollableParent(this._root.current); // unbind this handler and replace binding with a binding on the actual scrollable parent\n\n this._events.off(document, 'click', this._findScrollParentAndTryClearOnEmptyClick);\n\n this._events.on(scrollParent, 'click', this._tryClearOnEmptyClick); // If we clicked inside the scrollable parent, call through to the handler on this click.\n\n\n if (scrollParent && ev.target instanceof Node && scrollParent.contains(ev.target) || scrollParent === ev.target) {\n this._tryClearOnEmptyClick(ev);\n }\n };\n\n SelectionZone.prototype._tryClearOnEmptyClick = function (ev) {\n if (!this.props.selectionPreservedOnEmptyClick && this._isNonHandledClick(ev.target)) {\n this.props.selection.setAllSelected(false);\n }\n };\n\n SelectionZone.prototype._clearAndSelectIndex = function (index) {\n var selection = this.props.selection;\n var isAlreadySingleSelected = selection.getSelectedCount() === 1 && selection.isIndexSelected(index);\n\n if (!isAlreadySingleSelected) {\n var isModal = selection.isModal && selection.isModal();\n selection.setChangeEvents(false);\n selection.setAllSelected(false);\n selection.setIndexSelected(index, true, true);\n\n if (isModal || this.props.enterModalOnTouch && this._isTouch) {\n if (selection.setModal) {\n selection.setModal(true);\n }\n\n if (this._isTouch) {\n this._setIsTouch(false);\n }\n }\n\n selection.setChangeEvents(true);\n }\n };\n /**\n * We need to track the modifier key states so that when focus events occur, which do not contain\n * modifier states in the Event object, we know how to behave.\n */\n\n\n SelectionZone.prototype._updateModifiers = function (ev) {\n this._isShiftPressed = ev.shiftKey;\n this._isCtrlPressed = ev.ctrlKey;\n this._isMetaPressed = ev.metaKey;\n var keyCode = ev.keyCode;\n this._isTabPressed = keyCode ? keyCode === KeyCodes.tab : false;\n };\n\n SelectionZone.prototype._findItemRoot = function (target) {\n var selection = this.props.selection;\n\n while (target !== this._root.current) {\n var indexValue = target.getAttribute(SELECTION_INDEX_ATTRIBUTE_NAME);\n var index = Number(indexValue);\n\n if (indexValue !== null && index >= 0 && index < selection.getItems().length) {\n break;\n }\n\n target = getParent(target);\n }\n\n if (target === this._root.current) {\n return undefined;\n }\n\n return target;\n };\n\n SelectionZone.prototype._getItemIndex = function (itemRoot) {\n return Number(itemRoot.getAttribute(SELECTION_INDEX_ATTRIBUTE_NAME));\n };\n\n SelectionZone.prototype._shouldAutoSelect = function (element) {\n return this._hasAttribute(element, SELECTION_SELECT_ATTRIBUTE_NAME);\n };\n\n SelectionZone.prototype._hasAttribute = function (element, attributeName) {\n var isToggle = false;\n\n while (!isToggle && element !== this._root.current) {\n isToggle = element.getAttribute(attributeName) === 'true';\n element = getParent(element);\n }\n\n return isToggle;\n };\n\n SelectionZone.prototype._isInputElement = function (element) {\n return element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n };\n\n SelectionZone.prototype._isNonHandledClick = function (element) {\n var doc = getDocument();\n\n if (doc && element) {\n while (element && element !== doc.documentElement) {\n if (isElementTabbable(element)) {\n return false;\n }\n\n element = getParent(element);\n }\n }\n\n return true;\n };\n\n SelectionZone.prototype._handleNextFocus = function (handleFocus) {\n var _this = this;\n\n if (this._shouldHandleFocusTimeoutId) {\n this._async.clearTimeout(this._shouldHandleFocusTimeoutId);\n\n this._shouldHandleFocusTimeoutId = undefined;\n }\n\n this._shouldHandleFocus = handleFocus;\n\n if (handleFocus) {\n this._async.setTimeout(function () {\n _this._shouldHandleFocus = false;\n }, 100);\n }\n };\n\n SelectionZone.prototype._setIsTouch = function (isTouch) {\n var _this = this;\n\n if (this._isTouchTimeoutId) {\n this._async.clearTimeout(this._isTouchTimeoutId);\n\n this._isTouchTimeoutId = undefined;\n }\n\n this._isTouch = true;\n\n if (isTouch) {\n this._async.setTimeout(function () {\n _this._isTouch = false;\n }, 300);\n }\n };\n\n SelectionZone.prototype._getSelectionMode = function () {\n var selection = this.props.selection;\n var _a = this.props.selectionMode,\n selectionMode = _a === void 0 ? selection ? selection.mode : SelectionMode.none : _a;\n return selectionMode;\n };\n\n SelectionZone.defaultProps = {\n isSelectedOnFocus: true,\n selectionMode: SelectionMode.multiple\n };\n return SelectionZone;\n}(React.Component);\n\nexport { SelectionZone };","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n } // Copy function arguments\n\n\n var args = new Array(arguments.length - 1);\n\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n } // Store and register the task\n\n\n var task = {\n callback: callback,\n args: args\n };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n\n switch (args.length) {\n case 0:\n callback();\n break;\n\n case 1:\n callback(args[0]);\n break;\n\n case 2:\n callback(args[0], args[1]);\n break;\n\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n\n if (task) {\n currentlyRunningATask = true;\n\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function registerImmediate(handle) {\n process.nextTick(function () {\n runIfPresent(handle);\n });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n\n global.onmessage = function () {\n postMessageIsAsynchronous = false;\n };\n\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n\n var onGlobalMessage = function onGlobalMessage(event) {\n if (event.source === global && typeof event.data === \"string\" && event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function registerImmediate(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n\n channel.port1.onmessage = function (event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function registerImmediate(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n\n registerImmediate = function registerImmediate(handle) {\n // Create a