@azure/communication-react 1.20.0-alpha-202410080015 → 1.20.0-alpha-202410100016

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +2 -2
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-BwIa2hTH.js → ChatMessageComponentAsRichTextEditBox-Dk_okMwX.js} +2 -2
  3. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-BwIa2hTH.js.map → ChatMessageComponentAsRichTextEditBox-Dk_okMwX.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CMAkkxJl.js → RichTextSendBoxWrapper-C36s6eLH.js} +2 -2
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CMAkkxJl.js.map → RichTextSendBoxWrapper-C36s6eLH.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-Bj4O6YVq.js → index-C548hWR1.js} +202 -181
  7. package/dist/dist-cjs/communication-react/index-C548hWR1.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  10. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  11. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js +0 -1
  12. package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
  13. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  14. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +0 -3
  15. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  16. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +0 -2
  17. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
  18. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js +0 -7
  19. package/dist/dist-esm/calling-stateful-client/src/CaptionsSubscriber.js.map +1 -1
  20. package/dist/dist-esm/calling-stateful-client/src/Converter.js +0 -3
  21. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  22. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js +3 -2
  23. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -1
  24. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +6 -3
  25. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  26. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js +6 -4
  27. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
  28. package/dist/dist-esm/react-components/src/components/GridLayout.js +3 -0
  29. package/dist/dist-esm/react-components/src/components/GridLayout.js.map +1 -1
  30. package/dist/dist-esm/react-components/src/components/HorizontalGallery.js +4 -5
  31. package/dist/dist-esm/react-components/src/components/HorizontalGallery.js.map +1 -1
  32. package/dist/dist-esm/react-components/src/components/LocalVideoCameraButton.js +3 -0
  33. package/dist/dist-esm/react-components/src/components/LocalVideoCameraButton.js.map +1 -1
  34. package/dist/dist-esm/react-components/src/components/MeetingConferencePhoneInfo.js +2 -1
  35. package/dist/dist-esm/react-components/src/components/MeetingConferencePhoneInfo.js.map +1 -1
  36. package/dist/dist-esm/react-components/src/components/MessageThread.js +3 -3
  37. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  38. package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js +2 -1
  39. package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js.map +1 -1
  40. package/dist/dist-esm/react-components/src/components/ParticipantItem.js +1 -1
  41. package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
  42. package/dist/dist-esm/react-components/src/components/ReactionButton.js +27 -35
  43. package/dist/dist-esm/react-components/src/components/ReactionButton.js.map +1 -1
  44. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +9 -3
  45. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
  46. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js +1 -1
  47. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/TextFieldWithMention.js.map +1 -1
  48. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js +10 -11
  49. package/dist/dist-esm/react-components/src/components/TextFieldWithMention/mentionTagUtils.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/VerticalGallery.js +2 -1
  51. package/dist/dist-esm/react-components/src/components/VerticalGallery.js.map +1 -1
  52. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js +3 -3
  53. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js.map +1 -1
  54. package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteContentShareReactionOverlay.js +5 -4
  55. package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteContentShareReactionOverlay.js.map +1 -1
  56. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +15 -18
  57. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  58. package/dist/dist-esm/react-components/src/components/VideoTile.js +3 -0
  59. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  60. package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.d.ts +13 -6
  61. package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js +47 -19
  62. package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js.map +1 -1
  63. package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.d.ts +0 -6
  64. package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.js +6 -41
  65. package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.js.map +1 -1
  66. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js +4 -1
  67. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorUtils.js.map +1 -1
  68. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js +3 -0
  69. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js.map +1 -1
  70. package/dist/dist-esm/react-components/src/components/utils/responsive.js +6 -0
  71. package/dist/dist-esm/react-components/src/components/utils/responsive.js.map +1 -1
  72. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js.map +1 -1
  73. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +0 -12
  74. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  75. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +16 -22
  76. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  77. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js +9 -2
  78. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js.map +1 -1
  79. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +0 -1
  80. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
  81. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +1 -2
  82. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  83. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js +1 -3
  84. package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
  85. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -1
  86. package/package.json +1 -1
  87. package/dist/dist-cjs/communication-react/index-Bj4O6YVq.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"mentionTagUtils.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/TextFieldWithMention/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;IACxF,OAAO,QAAQ,GAAG,UAAU,GAAG,gCAAgC,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,gCAAgC,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAE,QAAgB,EAAU,EAAE;;IACtG,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,wBAAwB,GAAG,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,0CAAE,MAAM,KAAI,CAAC,CAAC;IACxE,IAAI,iBAAiB,GAAG,wBAAwB,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAChF,MAAM,qBAAqB,GAAG,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,0CAAE,MAAM,KAAI,CAAC,CAAC;IAC/D,iBAAiB,IAAI,qBAAqB,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3E,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAU,EAAE;IACtD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACjF,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ComponentStrings } from '../../localization';\nimport { Mention } from '../MentionPopover';\n\nconst MSFT_MENTION_TAG = 'msft-mention';\n\n/**\n * Props for finding a valid index in range.\n *\n * @private\n */\ntype ValidatedIndexRangeProps = {\n min: number;\n max: number;\n currentValue?: number;\n};\n\n/**\n * Get validated value for index between min and max values. If currentValue is not defined, -1 will be used instead.\n *\n * @private\n * @param props - Props for finding a valid index in range.\n * @returns Valid index in the range.\n */\nexport const getValidatedIndexInRange = (props: ValidatedIndexRangeProps): number => {\n const { min, max, currentValue } = props;\n let updatedValue = currentValue ?? -1;\n updatedValue = Math.max(min, updatedValue);\n updatedValue = Math.min(updatedValue, max);\n return updatedValue;\n};\n\n/**\n * Find mention tag for selection if exists.\n *\n * @private\n * @param tags - Existing list of tags.\n * @param selection - Selection index.\n * @returns Mention tag if exists, otherwise undefined.\n */\nexport const findMentionTagForSelection = (tags: TagData[], selection: number): TagData | undefined => {\n let mentionTag: TagData | undefined = undefined;\n tags.every((tag) => {\n const closingTagInfo = getTagClosingTagInfo(tag);\n if (tag.plainTextBeginIndex !== undefined && tag.plainTextBeginIndex > selection) {\n // no need to check further as the selection is before the tag\n return false;\n } else if (\n tag.plainTextBeginIndex !== undefined &&\n tag.plainTextBeginIndex <= selection &&\n selection <= closingTagInfo.plainTextEndIndex\n ) {\n // no need to check if tag doesn't contain selection\n if (tag.subTags !== undefined && tag.subTags.length !== 0) {\n const selectedTag = findMentionTagForSelection(tag.subTags, selection);\n if (selectedTag !== undefined) {\n mentionTag = selectedTag;\n return false;\n }\n } else if (tag.tagType === MSFT_MENTION_TAG) {\n mentionTag = tag;\n return false;\n }\n }\n return true;\n });\n return mentionTag;\n};\n\n/**\n * Props for finding new selection index for mention\n *\n * @private\n */\ntype NewSelectionIndexForMentionProps = {\n tag: TagData;\n textValue: string;\n currentSelectionIndex: number;\n previousSelectionIndex: number;\n};\n\n/**\n * Find a new the selection index.\n *\n * @private\n * @param props - Props for finding new selection index for mention.\n * @returns New selection index if it is inside of a mention tag, otherwise the current selection.\n */\nexport const findNewSelectionIndexForMention = (props: NewSelectionIndexForMentionProps): number => {\n const { tag, textValue, currentSelectionIndex, previousSelectionIndex } = props;\n // check if this is a mention tag and selection should be updated\n if (\n tag.tagType !== MSFT_MENTION_TAG ||\n tag.plainTextBeginIndex === undefined ||\n currentSelectionIndex === previousSelectionIndex ||\n tag.plainTextEndIndex === undefined\n ) {\n return currentSelectionIndex;\n }\n let spaceIndex = 0;\n if (currentSelectionIndex <= previousSelectionIndex) {\n // the cursor is moved to the left, find the last index before the cursor\n spaceIndex = textValue.lastIndexOf(' ', currentSelectionIndex ?? 0);\n if (spaceIndex === -1) {\n // no space before the selection, use the beginning of the tag\n spaceIndex = tag.plainTextBeginIndex;\n }\n } else {\n // the cursor is moved to the right, find the fist index after the cursor\n spaceIndex = textValue.indexOf(' ', currentSelectionIndex ?? 0);\n if (spaceIndex === -1) {\n // no space after the selection, use the end of the tag\n spaceIndex = tag.plainTextEndIndex ?? tag.plainTextBeginIndex;\n }\n }\n spaceIndex = getValidatedIndexInRange({\n min: tag.plainTextBeginIndex,\n max: tag.plainTextEndIndex,\n currentValue: spaceIndex\n });\n return spaceIndex;\n};\n\n/**\n * Props for mention update HTML function\n *\n * @private\n */\ntype MentionTagUpdateProps = {\n htmlText: string;\n oldPlainText: string;\n lastProcessedHTMLIndex: number;\n processedChange: string;\n change: string;\n tag: TagData;\n closeTagIdx: number;\n closeTagLength: number;\n plainTextEndIndex: number;\n startIndex: number;\n oldPlainTextEndIndex: number;\n mentionTagLength: number;\n};\n\n/**\n * Result for mention update HTML function\n *\n * @private\n */\ntype MentionTagUpdateResult = {\n result: string;\n updatedChange: string;\n htmlIndex: number;\n plainTextSelectionEndIndex?: number;\n};\n\n/**\n * Handle mention tag edit and by word deleting\n *\n * @private\n * @param props - Props for mention update HTML function.\n * @returns Updated texts and indexes.\n */\nconst handleMentionTagUpdate = (props: MentionTagUpdateProps): MentionTagUpdateResult => {\n const {\n htmlText,\n oldPlainText,\n change,\n tag,\n closeTagIdx,\n closeTagLength,\n plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n } = props;\n let processedChange = props.processedChange;\n let lastProcessedHTMLIndex = props.lastProcessedHTMLIndex;\n if (tag.tagType !== MSFT_MENTION_TAG || tag.plainTextBeginIndex === undefined) {\n // not a mention tag\n return {\n result: '',\n updatedChange: processedChange,\n htmlIndex: lastProcessedHTMLIndex,\n plainTextSelectionEndIndex: undefined\n };\n }\n let result = '';\n let plainTextSelectionEndIndex: number | undefined;\n let rangeStart: number;\n let rangeEnd: number;\n // check if space symbol is handled in case if string looks like '<1 2 3>'\n let isSpaceLengthHandled = false;\n rangeStart = oldPlainText.lastIndexOf(' ', startIndex);\n if (rangeStart !== -1 && rangeStart !== undefined && rangeStart > tag.plainTextBeginIndex) {\n isSpaceLengthHandled = true;\n }\n rangeEnd = oldPlainText.indexOf(' ', oldPlainTextEndIndex);\n if (rangeEnd === -1 || rangeEnd === undefined) {\n // check if space symbol is not found\n rangeEnd = plainTextEndIndex;\n } else if (!isSpaceLengthHandled) {\n // +1 to include the space symbol\n rangeEnd += 1;\n }\n isSpaceLengthHandled = true;\n\n if (rangeStart === -1 || rangeStart === undefined || rangeStart < tag.plainTextBeginIndex) {\n // rangeStart should be at least equal to tag.plainTextBeginIndex\n rangeStart = tag.plainTextBeginIndex;\n }\n if (rangeEnd > plainTextEndIndex) {\n // rangeEnd should be at most equal to plainTextEndIndex\n rangeEnd = plainTextEndIndex;\n }\n if (rangeStart === tag.plainTextBeginIndex && rangeEnd === plainTextEndIndex) {\n // the whole tag should be removed\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex) + processedChange;\n plainTextSelectionEndIndex = tag.plainTextBeginIndex + change.length;\n processedChange = '';\n lastProcessedHTMLIndex = closeTagIdx + closeTagLength;\n } else {\n // only part of the tag should be removed\n let startChangeDiff = 0;\n let endChangeDiff = 0;\n // need to check only rangeStart > tag.plainTextBeginIndex as when rangeStart === tag.plainTextBeginIndex startChangeDiff = 0 and mentionTagLength shouldn't be subtracted\n if (rangeStart > tag.plainTextBeginIndex) {\n startChangeDiff = rangeStart - tag.plainTextBeginIndex - mentionTagLength;\n }\n endChangeDiff = rangeEnd - tag.plainTextBeginIndex - mentionTagLength;\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length + startChangeDiff);\n\n if (startIndex < tag.plainTextBeginIndex) {\n // if the change is before the tag, the selection should start from startIndex (rangeStart will be equal to tag.plainTextBeginIndex)\n plainTextSelectionEndIndex = startIndex + change.length;\n } else {\n // if the change is inside the tag, the selection should start with rangeStart\n plainTextSelectionEndIndex = rangeStart + change.length;\n }\n lastProcessedHTMLIndex = tag.openTagIndex + tag.openTagBody.length + endChangeDiff;\n // processed change should not be changed as it should be added after the tag\n }\n return { result, updatedChange: processedChange, htmlIndex: lastProcessedHTMLIndex, plainTextSelectionEndIndex };\n};\n\n/**\n * Closing tag information\n *\n * @private\n */\ntype ClosingTagInfoResult = {\n plainTextEndIndex: number;\n closeTagIdx: number;\n closeTagLength: number;\n};\n\n/**\n * Get closing tag information if exists otherwise return information as for self closing tag\n *\n * @private\n * @param tag - Tag data.\n * @returns Closing tag information for the provided tag.\n */\nconst getTagClosingTagInfo = (tag: TagData): ClosingTagInfoResult => {\n let plainTextEndIndex = 0;\n let closeTagIdx = 0;\n let closeTagLength = 0;\n if (tag.plainTextEndIndex !== undefined && tag.closingTagIndex !== undefined) {\n // close tag exists\n plainTextEndIndex = tag.plainTextEndIndex;\n closeTagIdx = tag.closingTagIndex;\n // tag.tagType.length + </>\n closeTagLength = tag.tagType.length + 3;\n } else if (tag.plainTextBeginIndex !== undefined) {\n // no close tag\n plainTextEndIndex = tag.plainTextBeginIndex;\n closeTagIdx = tag.openTagIndex + tag.openTagBody.length;\n closeTagLength = 0;\n }\n return { plainTextEndIndex, closeTagIdx, closeTagLength };\n};\n\n/**\n * Props for update HTML function\n *\n * @private\n */\ntype UpdateHTMLProps = {\n htmlText: string;\n oldPlainText: string;\n tags: TagData[];\n startIndex: number;\n oldPlainTextEndIndex: number;\n change: string;\n mentionTrigger: string;\n};\n\n/**\n * Go through the text and update it with the changed text\n *\n * @private\n * @param props - Props for update HTML function.\n * @returns Updated HTML and selection index if the selection index should be set.\n */\nexport const updateHTML = (props: UpdateHTMLProps): { updatedHTML: string; updatedSelectionIndex?: number } => {\n const { htmlText, oldPlainText, tags, startIndex, oldPlainTextEndIndex, change, mentionTrigger } = props;\n if (tags.length === 0 || (startIndex === 0 && oldPlainTextEndIndex === oldPlainText.length - 1)) {\n // no tags added yet or the whole text is changed\n const changeWithSkippedChars = escapeHTMLChars(change);\n const updatedHTML =\n escapeHTMLChars(oldPlainText.substring(0, startIndex)) +\n changeWithSkippedChars +\n escapeHTMLChars(oldPlainText.substring(oldPlainTextEndIndex));\n return { updatedHTML, updatedSelectionIndex: undefined };\n }\n let result = '';\n let lastProcessedHTMLIndex = 0;\n // the value can be updated with empty string when the change covers more than 1 place (tag + before or after the tag)\n // in this case change won't be added as part of the tag\n // e.g.: change is before and partially in tag => change will be added before the tag and outdated text in the tag will be removed\n // e.g.: change is after and partially in tag => change will be added after the tag and outdated text in the tag will be removed\n // e.g.: change is on the beginning of the tag => change will be added before the tag\n // e.g.: change is on the end of the tag => change will be added to the tag if it's not mention and after the tag if it's mention\n let processedChange = escapeHTMLChars(change);\n\n // end tag plain text index of the last processed tag\n let lastProcessedPlainTextTagEndIndex = 0;\n // as some tags/text can be removed fully, selection should be updated correctly\n let changeNewEndIndex: number | undefined;\n\n for (let i = 0; i < tags.length; i++) {\n const tag = tags[i];\n if (tag.plainTextBeginIndex === undefined) {\n continue;\n }\n // all plain text indexes includes trigger length for the mention that shouldn't be included in\n // htmlText.substring because html strings don't include the trigger\n // mentionTagLength will be set only for mention tag, otherwise should be 0\n let mentionTagLength = 0;\n let isMentionTag = false;\n if (tag.tagType === MSFT_MENTION_TAG) {\n mentionTagLength = mentionTrigger.length;\n isMentionTag = true;\n }\n if (startIndex <= tag.plainTextBeginIndex) {\n // change start is before the open tag\n // Math.max(lastProcessedPlainTextTagEndIndex, startIndex) is used as startIndex may not be in [[previous tag].plainTextEndIndex - tag.plainTextBeginIndex] range\n const startChangeDiff = getChangeDiff(\n oldPlainText,\n Math.max(lastProcessedPlainTextTagEndIndex, startIndex),\n tag.plainTextBeginIndex\n );\n\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex - startChangeDiff) + processedChange;\n processedChange = '';\n if (oldPlainTextEndIndex <= tag.plainTextBeginIndex) {\n // the whole change is before tag start\n // mentionTag length can be ignored here as the change is before the tag\n const endChangeDiff = getChangeDiff(oldPlainText, oldPlainTextEndIndex, tag.plainTextBeginIndex);\n lastProcessedHTMLIndex = tag.openTagIndex - endChangeDiff;\n // the change is handled; exit\n break;\n } else {\n // change continues in the tag\n lastProcessedHTMLIndex = tag.openTagIndex;\n // proceed to the next check\n }\n }\n const closingTagInfo = getTagClosingTagInfo(tag);\n if (startIndex <= closingTagInfo.plainTextEndIndex) {\n // change started before the end tag\n if (startIndex <= tag.plainTextBeginIndex && oldPlainTextEndIndex === closingTagInfo.plainTextEndIndex) {\n // the change is a tag or starts before the tag\n // tag should be removed, no matter if there are sub-tags\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex) + processedChange;\n processedChange = '';\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n // the change is handled; exit\n break;\n } else if (startIndex >= tag.plainTextBeginIndex && oldPlainTextEndIndex <= closingTagInfo.plainTextEndIndex) {\n // the change is between the tag\n if (isMentionTag) {\n if (change !== '') {\n // case for startIndex === tag.plainTextBeginIndex and closingTagInfo.plainTextEndIndex === startIndex\n // is handled in startIndex <= tag.plainTextBeginIndex condition check\n // the change will be added at the beginning before the mention tag\n if (startIndex === closingTagInfo.plainTextEndIndex) {\n // non empty change at the end of the mention tag to be added after the mention tag\n result +=\n htmlText.substring(lastProcessedHTMLIndex, closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength) +\n processedChange;\n changeNewEndIndex = closingTagInfo.plainTextEndIndex + unEscapeHtmlCharacters(processedChange).length;\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n processedChange = '';\n // the change is handled; exit\n break;\n } else if (\n startIndex > tag.plainTextBeginIndex &&\n oldPlainTextEndIndex < closingTagInfo.plainTextEndIndex &&\n startIndex === oldPlainTextEndIndex\n ) {\n // mention tag should be deleted when user tries to edit it in the middle\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex) + processedChange;\n changeNewEndIndex = tag.plainTextBeginIndex + unEscapeHtmlCharacters(processedChange).length;\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n\n processedChange = '';\n // the change is handled; exit\n break;\n } else {\n // the selection for more that 1 symbol when 1 of the ends is included\n const updateMentionTagResult = handleMentionTagUpdate({\n htmlText,\n oldPlainText,\n lastProcessedHTMLIndex,\n processedChange,\n change,\n tag,\n closeTagIdx: closingTagInfo.closeTagIdx,\n closeTagLength: closingTagInfo.closeTagLength,\n plainTextEndIndex: closingTagInfo.plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n });\n result += updateMentionTagResult.result;\n changeNewEndIndex = updateMentionTagResult.plainTextSelectionEndIndex;\n processedChange = updateMentionTagResult.updatedChange;\n lastProcessedHTMLIndex = updateMentionTagResult.htmlIndex;\n // proceed with the next calculations\n }\n } else {\n // When change is empty, it means that this change is a deletion\n const updateMentionTagResult = handleMentionTagUpdate({\n htmlText,\n oldPlainText,\n lastProcessedHTMLIndex,\n processedChange,\n change,\n tag,\n closeTagIdx: closingTagInfo.closeTagIdx,\n closeTagLength: closingTagInfo.closeTagLength,\n plainTextEndIndex: closingTagInfo.plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n });\n result += updateMentionTagResult.result;\n changeNewEndIndex = updateMentionTagResult.plainTextSelectionEndIndex;\n processedChange = updateMentionTagResult.updatedChange;\n lastProcessedHTMLIndex = updateMentionTagResult.htmlIndex;\n // the change is handled; exit\n break;\n }\n } else if (tag.subTags !== undefined && tag.subTags.length !== 0 && tag.content !== undefined) {\n // with subtags\n const stringBefore = htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length);\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n const updatedContent = updateHTML({\n htmlText: tag.content,\n oldPlainText,\n tags: tag.subTags,\n startIndex,\n oldPlainTextEndIndex,\n change: processedChange,\n mentionTrigger\n });\n result += stringBefore + updatedContent.updatedHTML;\n changeNewEndIndex = updatedContent.updatedSelectionIndex;\n // the change is handled; exit\n break;\n } else {\n // no subtags\n const startChangeDiff = getChangeDiff(oldPlainText, tag.plainTextBeginIndex, startIndex);\n result +=\n htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length + startChangeDiff) +\n processedChange;\n processedChange = '';\n if (oldPlainTextEndIndex < closingTagInfo.plainTextEndIndex) {\n const endChangeDiff = getChangeDiff(oldPlainText, tag.plainTextBeginIndex, oldPlainTextEndIndex);\n lastProcessedHTMLIndex = tag.openTagIndex + tag.openTagBody.length + endChangeDiff;\n } else if (oldPlainTextEndIndex === closingTagInfo.plainTextEndIndex) {\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n }\n // the change is handled; exit\n break;\n }\n } else if (startIndex > tag.plainTextBeginIndex && oldPlainTextEndIndex > closingTagInfo.plainTextEndIndex) {\n // the change started in the tag but finishes somewhere further\n if (isMentionTag) {\n if (startIndex === closingTagInfo.plainTextEndIndex) {\n // the change should be handled out of mention tag\n // as startIndex === closingTagInfo.plainTextEndIndex and oldPlainTextEndIndex > closingTagInfo.plainTextEndIndex\n result += htmlText.substring(\n lastProcessedHTMLIndex,\n closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength\n );\n // no need to handle plainTextSelectionEndIndex as the change will be added later\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n } else {\n // part of the mention tag was changed/deleted\n const updateMentionTagResult = handleMentionTagUpdate({\n htmlText,\n oldPlainText,\n lastProcessedHTMLIndex,\n processedChange: '',\n change,\n tag,\n closeTagIdx: closingTagInfo.closeTagIdx,\n closeTagLength: closingTagInfo.closeTagLength,\n plainTextEndIndex: closingTagInfo.plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n });\n result += updateMentionTagResult.result;\n lastProcessedHTMLIndex = updateMentionTagResult.htmlIndex;\n // no need to handle plainTextSelectionEndIndex as the change will be added later\n }\n } else if (tag.subTags !== undefined && tag.subTags.length !== 0 && tag.content !== undefined) {\n // with subtags\n const stringBefore = htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length);\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n const updatedContent = updateHTML({\n htmlText: tag.content,\n oldPlainText,\n tags: tag.subTags,\n startIndex,\n oldPlainTextEndIndex,\n change: '', // the part of the tag should be just deleted without processedChange update and change will be added after this tag\n mentionTrigger\n });\n result += stringBefore + updatedContent.updatedHTML;\n } else {\n // no subtags\n const startChangeDiff = startIndex - tag.plainTextBeginIndex - mentionTagLength;\n result += htmlText.substring(\n lastProcessedHTMLIndex,\n tag.openTagIndex + tag.openTagBody.length + startChangeDiff\n );\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n }\n // proceed with the next calculations\n } else if (startIndex < tag.plainTextBeginIndex && oldPlainTextEndIndex > closingTagInfo.plainTextEndIndex) {\n // the change starts before the tag and finishes after it\n // tag should be removed, no matter if there are subtags\n // no need to save anything between lastProcessedHTMLIndex and closeTagIdx + closeTagLength\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n // proceed with the next calculations\n } else if (startIndex === tag.plainTextBeginIndex && oldPlainTextEndIndex > closingTagInfo.plainTextEndIndex) {\n // the change starts in the tag and finishes after it\n // tag should be removed, no matter if there are subtags\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex);\n // processedChange shouldn't be updated as it will be added after the tag\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n // proceed with the next calculations\n } else if (startIndex < tag.plainTextBeginIndex && oldPlainTextEndIndex < closingTagInfo.plainTextEndIndex) {\n // the change starts before the tag and ends in a tag\n if (isMentionTag) {\n // mention tag\n const updateMentionTagResult = handleMentionTagUpdate({\n htmlText,\n oldPlainText,\n lastProcessedHTMLIndex,\n processedChange: '', // the part of mention should be just deleted without processedChange update\n change,\n tag,\n closeTagIdx: closingTagInfo.closeTagIdx,\n closeTagLength: closingTagInfo.closeTagLength,\n plainTextEndIndex: closingTagInfo.plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n });\n changeNewEndIndex = updateMentionTagResult.plainTextSelectionEndIndex;\n result += updateMentionTagResult.result;\n lastProcessedHTMLIndex = updateMentionTagResult.htmlIndex;\n } else if (tag.subTags !== undefined && tag.subTags.length !== 0 && tag.content !== undefined) {\n // with subtags\n const stringBefore = htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length);\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n const updatedContent = updateHTML({\n htmlText: tag.content,\n oldPlainText,\n tags: tag.subTags,\n startIndex,\n oldPlainTextEndIndex,\n change: processedChange, // processedChange should be equal '' and the part of the tag should be deleted as the change was handled before this tag\n mentionTrigger\n });\n processedChange = '';\n result += stringBefore + updatedContent.updatedHTML;\n } else {\n // no subtags\n result +=\n htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length) + processedChange;\n processedChange = '';\n // oldPlainTextEndIndex already includes mentionTag length\n const endChangeDiff = getChangeDiff(oldPlainText, oldPlainTextEndIndex, closingTagInfo.plainTextEndIndex);\n // as change may be before the end of the tag, we need to add the rest of the tag\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx - endChangeDiff;\n }\n // the change is handled; exit\n break;\n }\n lastProcessedPlainTextTagEndIndex = closingTagInfo.plainTextEndIndex;\n }\n\n if (i === tags.length - 1 && oldPlainTextEndIndex >= closingTagInfo.plainTextEndIndex) {\n // the last tag should handle the end of the change if needed\n // oldPlainTextEndIndex already includes mentionTag length\n const endChangeDiff = getChangeDiff(oldPlainText, closingTagInfo.plainTextEndIndex, oldPlainTextEndIndex);\n if (startIndex >= closingTagInfo.plainTextEndIndex) {\n const startChangeDiff = getChangeDiff(oldPlainText, closingTagInfo.plainTextEndIndex, startIndex);\n result +=\n htmlText.substring(\n lastProcessedHTMLIndex,\n closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength + startChangeDiff\n ) + processedChange;\n } else {\n result +=\n htmlText.substring(lastProcessedHTMLIndex, closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength) +\n processedChange;\n }\n processedChange = '';\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength + endChangeDiff;\n // the change is handled; exit\n // break is not required here as this is the last element but added for consistency\n break;\n }\n }\n if (lastProcessedHTMLIndex < htmlText.length) {\n // add the rest of the html string\n result += htmlText.substring(lastProcessedHTMLIndex);\n }\n return { updatedHTML: result, updatedSelectionIndex: changeNewEndIndex };\n};\n\n/**\n * Props for finding strings diff indexes\n *\n * @private\n */\ntype DiffIndexesProps = {\n // the old text\n oldText: string;\n // the new text\n newText: string;\n // the start of previous selection, should be a valid position in the input field\n previousSelectionStart: number;\n // the end of previous selection, should be a valid position in the input field\n previousSelectionEnd: number;\n // the start of current selection, should be a valid position in the input field\n currentSelectionStart: number;\n // the end of current selection, should be a valid position in the input field\n currentSelectionEnd: number;\n};\n\n/**\n * Result of finding strings diff indexes function\n *\n * @private\n */\ntype DiffIndexesResult = {\n changeStart: number;\n oldChangeEnd: number;\n newChangeEnd: number;\n};\n\n/**\n * Given the oldText and newText, find the start index, old end index and new end index for the changes\n *\n * @private\n * @param props - Props for finding stings diff indexes function.\n * @returns Indexes for change start and ends in new and old texts. The old and new end indexes are exclusive.\n */\nexport const findStringsDiffIndexes = (props: DiffIndexesProps): DiffIndexesResult => {\n const { oldText, newText, previousSelectionStart, previousSelectionEnd, currentSelectionStart, currentSelectionEnd } =\n props;\n const newTextLength = newText.length;\n const oldTextLength = oldText.length;\n // let changeStart = 0;\n let newChangeEnd = newTextLength;\n let oldChangeEnd = oldTextLength;\n const previousSelectionStartValue = previousSelectionStart > -1 ? previousSelectionStart : oldTextLength;\n const previousSelectionEndValue = previousSelectionEnd > -1 ? previousSelectionEnd : oldTextLength;\n const currentSelectionStartValue = currentSelectionStart > -1 ? currentSelectionStart : newTextLength;\n const currentSelectionEndValue = currentSelectionEnd > -1 ? currentSelectionEnd : newTextLength;\n const changeStart = Math.min(\n previousSelectionStartValue,\n previousSelectionEndValue,\n currentSelectionStartValue,\n currentSelectionEndValue,\n newTextLength,\n oldTextLength\n );\n\n if (oldTextLength < newTextLength) {\n //insert or replacement\n if (oldTextLength === changeStart) {\n // when change was at the end of string\n // change is found\n newChangeEnd = newTextLength;\n oldChangeEnd = oldTextLength;\n } else {\n for (let i = 0; i < newTextLength && oldTextLength - i >= changeStart; i++) {\n newChangeEnd = newTextLength - i - 1;\n oldChangeEnd = oldTextLength - i - 1;\n\n if (newText[newChangeEnd] !== oldText[oldChangeEnd]) {\n // change is found\n break;\n }\n }\n // make indexes exclusive\n newChangeEnd += 1;\n oldChangeEnd += 1;\n }\n } else if (oldTextLength > newTextLength) {\n //deletion or replacement\n if (newTextLength === changeStart) {\n // when change was at the end of string\n // change is found\n newChangeEnd = newTextLength;\n oldChangeEnd = oldTextLength;\n } else {\n for (let i = 0; i < oldTextLength && newTextLength - i >= changeStart; i++) {\n newChangeEnd = newTextLength - i - 1;\n oldChangeEnd = oldTextLength - i - 1;\n if (newText[newChangeEnd] !== oldText[oldChangeEnd]) {\n // change is found\n break;\n }\n }\n // make indexes exclusive\n newChangeEnd += 1;\n oldChangeEnd += 1;\n }\n } else {\n // replacement\n for (let i = 0; i < oldTextLength && oldTextLength - i >= changeStart; i++) {\n newChangeEnd = newTextLength - i - 1;\n oldChangeEnd = oldTextLength - i - 1;\n\n if (newText[newChangeEnd] !== oldText[oldChangeEnd]) {\n // change is found\n break;\n }\n }\n // make indexes exclusive if they aren't equal to the length of the string\n if (newChangeEnd !== newText.length) {\n newChangeEnd += 1;\n }\n if (oldChangeEnd !== oldText.length) {\n oldChangeEnd += 1;\n }\n }\n return { changeStart, oldChangeEnd, newChangeEnd };\n};\n\n/**\n * Get the html string for the mention suggestion.\n *\n * @private\n * @param suggestion - The mention suggestion.\n * @param localeStrings - The locale strings.\n * @returns The html string for the mention suggestion.\n */\nexport const htmlStringForMentionSuggestion = (suggestion: Mention, localeStrings: ComponentStrings): string => {\n const idHTML = ' id=\"' + suggestion.id + '\"';\n const displayText = getDisplayNameForMentionSuggestion(suggestion, localeStrings);\n return '<' + MSFT_MENTION_TAG + idHTML + '>' + displayText + '</' + MSFT_MENTION_TAG + '>';\n};\n\n/**\n * Get display name for the mention suggestion.\n *\n * @private\n *\n * @param suggestion - The mention suggestion.\n * @param localeStrings - The locale strings.\n * @returns The display name for the mention suggestion or display name placeholder if display name is empty.\n */\nexport const getDisplayNameForMentionSuggestion = (suggestion: Mention, localeStrings: ComponentStrings): string => {\n const displayNamePlaceholder = localeStrings.participantItem.displayNamePlaceholder;\n return suggestion.displayText !== '' ? suggestion.displayText : displayNamePlaceholder ?? '';\n};\n\n/**\n * Tag data for a HTML tag in the string\n *\n * @private\n */\nexport type TagData = {\n tagType: string; // The type of tag (e.g. msft-mention)\n openTagIndex: number; // Start of the tag relative to the parent content\n openTagBody: string; // Complete open tag body\n content?: string; // All content between the open and close tags\n closingTagIndex?: number; // Start of the close tag relative to the parent content\n subTags?: TagData[]; // Any child tags\n plainTextBeginIndex?: number; // Absolute index of the open tag start should be in plain text\n plainTextEndIndex?: number; // Absolute index of the close tag start should be in plain text\n};\n\ntype HtmlTagType = 'open' | 'close' | 'self-closing';\n\ntype HtmlTag = {\n content: string;\n startIdx: number;\n type: HtmlTagType;\n};\n\n/**\n * Parse the text and return the tags and the plain text in one go\n * @private\n * @param text - The text to parse for HTML tags\n * @param trigger The trigger to show for the mention tag in plain text\n *\n * @returns An array of tags and the plain text representation\n */\nexport const textToTagParser = (text: string, trigger: string): { tags: TagData[]; plainText: string } => {\n const tags: TagData[] = []; // Tags passed back to the caller\n const tagParseStack: TagData[] = []; // Local stack to use while parsing\n\n let plainTextRepresentation = '';\n\n let parseIndex = 0;\n while (parseIndex < text.length) {\n const foundHtmlTag = findNextHtmlTag(text, parseIndex);\n\n if (!foundHtmlTag) {\n if (parseIndex !== 0) {\n // Add the remaining text to the plain text representation\n const newText = text.substring(parseIndex);\n plainTextRepresentation += unEscapeHtmlCharacters(newText);\n } else {\n plainTextRepresentation = unEscapeHtmlCharacters(text);\n }\n break;\n }\n\n if (foundHtmlTag.type === 'open' || foundHtmlTag.type === 'self-closing') {\n const nextTag = parseOpenTag(foundHtmlTag.content, foundHtmlTag.startIdx);\n // Add the plain text between the last tag and this one found\n plainTextRepresentation += unEscapeHtmlCharacters(text.substring(parseIndex, foundHtmlTag.startIdx));\n nextTag.plainTextBeginIndex = plainTextRepresentation.length;\n\n if (foundHtmlTag.type === 'open') {\n tagParseStack.push(nextTag);\n } else {\n nextTag.content = '';\n nextTag.plainTextBeginIndex = plainTextRepresentation.length;\n nextTag.plainTextEndIndex = plainTextRepresentation.length;\n addTag(nextTag, tagParseStack, tags);\n }\n }\n\n if (foundHtmlTag.type === 'close') {\n const currentOpenTag = tagParseStack.pop();\n const closeTagType = foundHtmlTag.content.substring(2, foundHtmlTag.content.length - 1).toLowerCase();\n\n if (currentOpenTag && currentOpenTag.tagType === closeTagType) {\n // Tag startIdx is absolute to the text. This is updated later to be relative to the parent tag\n currentOpenTag.content = text.substring(\n currentOpenTag.openTagIndex + currentOpenTag.openTagBody.length,\n foundHtmlTag.startIdx\n );\n\n // Insert the plain text pieces for the sub tags\n if (currentOpenTag.tagType === MSFT_MENTION_TAG) {\n plainTextRepresentation =\n plainTextRepresentation.slice(0, currentOpenTag.plainTextBeginIndex) +\n trigger +\n plainTextRepresentation.slice(currentOpenTag.plainTextBeginIndex);\n }\n\n if (!currentOpenTag.subTags) {\n plainTextRepresentation += unEscapeHtmlCharacters(currentOpenTag.content);\n } else if (currentOpenTag.subTags.length > 0) {\n // Add text after the last tag\n const lastSubTag = currentOpenTag.subTags[currentOpenTag.subTags.length - 1];\n const startOfRemainingText =\n (lastSubTag.closingTagIndex ?? lastSubTag.openTagIndex) + lastSubTag.tagType.length + 3;\n const trailingText = currentOpenTag.content.substring(startOfRemainingText);\n plainTextRepresentation += unEscapeHtmlCharacters(trailingText);\n }\n\n currentOpenTag.plainTextEndIndex = plainTextRepresentation.length;\n addTag(currentOpenTag, tagParseStack, tags);\n } else {\n throw new Error(\n 'Unexpected close tag found. Got \"' +\n closeTagType +\n '\" but expected \"' +\n tagParseStack[tagParseStack.length - 1]?.tagType +\n '\"'\n );\n }\n }\n\n // Update parsing index; move past the end of the close tag\n parseIndex = foundHtmlTag.startIdx + foundHtmlTag.content.length;\n } // While parseIndex < text.length loop\n\n return { tags, plainText: plainTextRepresentation };\n};\n\nconst parseOpenTag = (tag: string, startIdx: number): TagData => {\n const tagType = tag\n .substring(1, tag.length - 1)\n .split(' ')[0]\n .toLowerCase()\n .replace('/', '');\n return {\n tagType,\n openTagIndex: startIdx,\n openTagBody: tag\n };\n};\n\nconst findNextHtmlTag = (text: string, startIndex: number): HtmlTag | undefined => {\n const tagStartIndex = text.indexOf('<', startIndex);\n if (tagStartIndex === -1) {\n // No more tags\n return undefined;\n }\n const tagEndIndex = text.indexOf('>', tagStartIndex);\n if (tagEndIndex === -1) {\n // No close tag\n return undefined;\n }\n const tag = text.substring(tagStartIndex, tagEndIndex + 1);\n let type: HtmlTagType = 'open';\n if (tag[1] === '/') {\n type = 'close';\n } else if (tag[tag.length - 2] === '/') {\n type = 'self-closing';\n }\n return {\n content: tag,\n startIdx: tagStartIndex,\n type\n };\n};\n\nconst addTag = (tag: TagData, parseStack: TagData[], tags: TagData[]): void => {\n // Add as sub-tag to the parent stack tag, if there is one\n const parentTag = parseStack[parseStack.length - 1];\n\n if (parentTag) {\n // Adjust the open tag index to be relative to the parent tag\n const parentContentStartIdx = parentTag.openTagIndex + parentTag.openTagBody.length;\n const relativeIdx = tag.openTagIndex - parentContentStartIdx;\n tag.openTagIndex = relativeIdx;\n }\n\n if (!tag.closingTagIndex) {\n // If the tag is self-closing, the close tag is the same as the open tag\n if (tag.openTagBody[tag.openTagBody.length - 2] === '/') {\n tag.closingTagIndex = tag.openTagIndex;\n } else {\n // Otherwise, the close tag index is the open tag index + the open tag body + the content length\n tag.closingTagIndex = tag.openTagIndex + tag.openTagBody.length + (tag.content ?? []).length;\n }\n }\n\n // Put the tag where it belongs\n if (!parentTag) {\n tags.push(tag);\n } else {\n if (!parentTag.subTags) {\n parentTag.subTags = [tag];\n } else {\n parentTag.subTags.push(tag);\n }\n }\n};\n\n// We should revisit this in the future when we support other text such as rich text editing.\nconst escapeHTMLChars = (text: string): string => {\n const mentionRegex = new RegExp(`<${MSFT_MENTION_TAG}(.*?)>(.*?)</${MSFT_MENTION_TAG}>`, 'i');\n if (!text.match(mentionRegex)) {\n return text\n .replace(/&(?![A-Z]+;)/gi, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n }\n return text;\n};\n\nconst getChangeDiff = (plainText: string, startIndex: number, endIndex: number): number => {\n return endIndex - startIndex + getLengthDiffForEscapedHtmlChars(plainText, startIndex, endIndex);\n};\n\nconst getLengthDiffForEscapedHtmlChars = (text: string, startIndex: number, endIndex: number): number => {\n const subText = text.substring(startIndex, endIndex);\n const escapedAngleBracketCount = subText.match(/(<)|(>)/g)?.length || 0;\n let escapedCharLength = escapedAngleBracketCount * ('&lt;'.length - '<'.length);\n const escapedAmpersandCount = subText.match(/&/g)?.length || 0;\n escapedCharLength += escapedAmpersandCount * ('&amp;'.length - '&'.length);\n return escapedCharLength;\n};\n\nconst unEscapeHtmlCharacters = (text: string): string => {\n return text.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');\n};\n"]}
1
+ {"version":3,"file":"mentionTagUtils.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/TextFieldWithMention/mentionTagU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IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,UAAkB,EAAE,QAAgB,EAAU,EAAE;IACxF,OAAO,QAAQ,GAAG,UAAU,GAAG,gCAAgC,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,gCAAgC,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAE,QAAgB,EAAU,EAAE;;IACtG,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,wBAAwB,GAAG,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,0CAAE,MAAM,KAAI,CAAC,CAAC;IACxE,IAAI,iBAAiB,GAAG,wBAAwB,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAChF,MAAM,qBAAqB,GAAG,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,0CAAE,MAAM,KAAI,CAAC,CAAC;IAC/D,iBAAiB,IAAI,qBAAqB,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3E,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAU,EAAE;IACtD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACjF,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ComponentStrings } from '../../localization';\nimport { Mention } from '../MentionPopover';\n\nconst MSFT_MENTION_TAG = 'msft-mention';\n\n/**\n * Props for finding a valid index in range.\n *\n * @private\n */\ntype ValidatedIndexRangeProps = {\n min: number;\n max: number;\n currentValue?: number;\n};\n\n/**\n * Get validated value for index between min and max values. If currentValue is not defined, -1 will be used instead.\n *\n * @private\n * @param props - Props for finding a valid index in range.\n * @returns Valid index in the range.\n */\nexport const getValidatedIndexInRange = (props: ValidatedIndexRangeProps): number => {\n const { min, max, currentValue } = props;\n let updatedValue = currentValue ?? -1;\n updatedValue = Math.max(min, updatedValue);\n updatedValue = Math.min(updatedValue, max);\n return updatedValue;\n};\n\n/**\n * Find mention tag for selection if exists.\n *\n * @private\n * @param tags - Existing list of tags.\n * @param selection - Selection index.\n * @returns Mention tag if exists, otherwise undefined.\n */\nexport const findMentionTagForSelection = (tags: TagData[], selection: number): TagData | undefined => {\n let mentionTag: TagData | undefined = undefined;\n tags.every((tag) => {\n const closingTagInfo = getTagClosingTagInfo(tag);\n if (tag.plainTextBeginIndex !== undefined && tag.plainTextBeginIndex > selection) {\n // no need to check further as the selection is before the tag\n return false;\n } else if (\n tag.plainTextBeginIndex !== undefined &&\n tag.plainTextBeginIndex <= selection &&\n selection <= closingTagInfo.plainTextEndIndex\n ) {\n // no need to check if tag doesn't contain selection\n if (tag.subTags !== undefined && tag.subTags.length !== 0) {\n const selectedTag = findMentionTagForSelection(tag.subTags, selection);\n if (selectedTag !== undefined) {\n mentionTag = selectedTag;\n return false;\n }\n } else if (tag.tagType === MSFT_MENTION_TAG) {\n mentionTag = tag;\n return false;\n }\n }\n return true;\n });\n return mentionTag;\n};\n\n/**\n * Props for finding new selection index for mention\n *\n * @private\n */\ntype NewSelectionIndexForMentionProps = {\n tag: TagData;\n textValue: string;\n currentSelectionIndex: number;\n previousSelectionIndex: number;\n};\n\n/**\n * Find a new the selection index.\n *\n * @private\n * @param props - Props for finding new selection index for mention.\n * @returns New selection index if it is inside of a mention tag, otherwise the current selection.\n */\nexport const findNewSelectionIndexForMention = (props: NewSelectionIndexForMentionProps): number => {\n const { tag, textValue, currentSelectionIndex, previousSelectionIndex } = props;\n // check if this is a mention tag and selection should be updated\n if (\n tag.tagType !== MSFT_MENTION_TAG ||\n tag.plainTextBeginIndex === undefined ||\n currentSelectionIndex === previousSelectionIndex ||\n tag.plainTextEndIndex === undefined\n ) {\n return currentSelectionIndex;\n }\n let spaceIndex = 0;\n if (currentSelectionIndex <= previousSelectionIndex) {\n // the cursor is moved to the left, find the last index before the cursor\n spaceIndex = textValue.lastIndexOf(' ', currentSelectionIndex ?? 0);\n if (spaceIndex === -1) {\n // no space before the selection, use the beginning of the tag\n spaceIndex = tag.plainTextBeginIndex;\n }\n } else {\n // the cursor is moved to the right, find the fist index after the cursor\n spaceIndex = textValue.indexOf(' ', currentSelectionIndex ?? 0);\n if (spaceIndex === -1) {\n // no space after the selection, use the end of the tag\n spaceIndex = tag.plainTextEndIndex ?? tag.plainTextBeginIndex;\n }\n }\n spaceIndex = getValidatedIndexInRange({\n min: tag.plainTextBeginIndex,\n max: tag.plainTextEndIndex,\n currentValue: spaceIndex\n });\n return spaceIndex;\n};\n\n/**\n * Props for mention update HTML function\n *\n * @private\n */\ntype MentionTagUpdateProps = {\n htmlText: string;\n oldPlainText: string;\n lastProcessedHTMLIndex: number;\n processedChange: string;\n change: string;\n tag: TagData;\n closeTagIdx: number;\n closeTagLength: number;\n plainTextEndIndex: number;\n startIndex: number;\n oldPlainTextEndIndex: number;\n mentionTagLength: number;\n};\n\n/**\n * Result for mention update HTML function\n *\n * @private\n */\ntype MentionTagUpdateResult = {\n result: string;\n updatedChange: string;\n htmlIndex: number;\n plainTextSelectionEndIndex?: number;\n};\n\n/**\n * Handle mention tag edit and by word deleting\n *\n * @private\n * @param props - Props for mention update HTML function.\n * @returns Updated texts and indexes.\n */\nconst handleMentionTagUpdate = (props: MentionTagUpdateProps): MentionTagUpdateResult => {\n const {\n htmlText,\n oldPlainText,\n change,\n tag,\n closeTagIdx,\n closeTagLength,\n plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n } = props;\n let processedChange = props.processedChange;\n let lastProcessedHTMLIndex = props.lastProcessedHTMLIndex;\n if (tag.tagType !== MSFT_MENTION_TAG || tag.plainTextBeginIndex === undefined) {\n // not a mention tag\n return {\n result: '',\n updatedChange: processedChange,\n htmlIndex: lastProcessedHTMLIndex,\n plainTextSelectionEndIndex: undefined\n };\n }\n let result = '';\n let plainTextSelectionEndIndex: number | undefined;\n let rangeStart: number;\n let rangeEnd: number;\n // check if space symbol is handled in case if string looks like '<1 2 3>'\n let isSpaceLengthHandled = false;\n rangeStart = oldPlainText.lastIndexOf(' ', startIndex);\n if (rangeStart !== -1 && rangeStart !== undefined && rangeStart > tag.plainTextBeginIndex) {\n isSpaceLengthHandled = true;\n }\n rangeEnd = oldPlainText.indexOf(' ', oldPlainTextEndIndex);\n if (rangeEnd === -1 || rangeEnd === undefined) {\n // check if space symbol is not found\n rangeEnd = plainTextEndIndex;\n } else if (!isSpaceLengthHandled) {\n // +1 to include the space symbol\n rangeEnd += 1;\n }\n isSpaceLengthHandled = true;\n\n if (rangeStart === -1 || rangeStart === undefined || rangeStart < tag.plainTextBeginIndex) {\n // rangeStart should be at least equal to tag.plainTextBeginIndex\n rangeStart = tag.plainTextBeginIndex;\n }\n if (rangeEnd > plainTextEndIndex) {\n // rangeEnd should be at most equal to plainTextEndIndex\n rangeEnd = plainTextEndIndex;\n }\n if (rangeStart === tag.plainTextBeginIndex && rangeEnd === plainTextEndIndex) {\n // the whole tag should be removed\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex) + processedChange;\n plainTextSelectionEndIndex = tag.plainTextBeginIndex + change.length;\n processedChange = '';\n lastProcessedHTMLIndex = closeTagIdx + closeTagLength;\n } else {\n // only part of the tag should be removed\n let startChangeDiff = 0;\n let endChangeDiff = 0;\n // need to check only rangeStart > tag.plainTextBeginIndex as when rangeStart === tag.plainTextBeginIndex startChangeDiff = 0 and mentionTagLength shouldn't be subtracted\n if (rangeStart > tag.plainTextBeginIndex) {\n startChangeDiff = rangeStart - tag.plainTextBeginIndex - mentionTagLength;\n }\n endChangeDiff = rangeEnd - tag.plainTextBeginIndex - mentionTagLength;\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length + startChangeDiff);\n\n if (startIndex < tag.plainTextBeginIndex) {\n // if the change is before the tag, the selection should start from startIndex (rangeStart will be equal to tag.plainTextBeginIndex)\n plainTextSelectionEndIndex = startIndex + change.length;\n } else {\n // if the change is inside the tag, the selection should start with rangeStart\n plainTextSelectionEndIndex = rangeStart + change.length;\n }\n lastProcessedHTMLIndex = tag.openTagIndex + tag.openTagBody.length + endChangeDiff;\n // processed change should not be changed as it should be added after the tag\n }\n return { result, updatedChange: processedChange, htmlIndex: lastProcessedHTMLIndex, plainTextSelectionEndIndex };\n};\n\n/**\n * Closing tag information\n *\n * @private\n */\ntype ClosingTagInfoResult = {\n plainTextEndIndex: number;\n closeTagIdx: number;\n closeTagLength: number;\n};\n\n/**\n * Get closing tag information if exists otherwise return information as for self closing tag\n *\n * @private\n * @param tag - Tag data.\n * @returns Closing tag information for the provided tag.\n */\nconst getTagClosingTagInfo = (tag: TagData): ClosingTagInfoResult => {\n let plainTextEndIndex = 0;\n let closeTagIdx = 0;\n let closeTagLength = 0;\n if (tag.plainTextEndIndex !== undefined && tag.closingTagIndex !== undefined) {\n // close tag exists\n plainTextEndIndex = tag.plainTextEndIndex;\n closeTagIdx = tag.closingTagIndex;\n // tag.tagType.length + </>\n closeTagLength = tag.tagType.length + 3;\n } else if (tag.plainTextBeginIndex !== undefined) {\n // no close tag\n plainTextEndIndex = tag.plainTextBeginIndex;\n closeTagIdx = tag.openTagIndex + tag.openTagBody.length;\n closeTagLength = 0;\n }\n return { plainTextEndIndex, closeTagIdx, closeTagLength };\n};\n\n/**\n * Props for update HTML function\n *\n * @private\n */\ntype UpdateHTMLProps = {\n htmlText: string;\n oldPlainText: string;\n tags: TagData[];\n startIndex: number;\n oldPlainTextEndIndex: number;\n change: string;\n mentionTrigger: string;\n};\n\n/**\n * Go through the text and update it with the changed text\n *\n * @private\n * @param props - Props for update HTML function.\n * @returns Updated HTML and selection index if the selection index should be set.\n */\nexport const updateHTML = (props: UpdateHTMLProps): { updatedHTML: string; updatedSelectionIndex?: number } => {\n const { htmlText, oldPlainText, tags, startIndex, oldPlainTextEndIndex, change, mentionTrigger } = props;\n if (tags.length === 0 || (startIndex === 0 && oldPlainTextEndIndex === oldPlainText.length - 1)) {\n // no tags added yet or the whole text is changed\n const changeWithSkippedChars = escapeHTMLChars(change);\n const updatedHTML =\n escapeHTMLChars(oldPlainText.substring(0, startIndex)) +\n changeWithSkippedChars +\n escapeHTMLChars(oldPlainText.substring(oldPlainTextEndIndex));\n return { updatedHTML, updatedSelectionIndex: undefined };\n }\n let result = '';\n let lastProcessedHTMLIndex = 0;\n // the value can be updated with empty string when the change covers more than 1 place (tag + before or after the tag)\n // in this case change won't be added as part of the tag\n // e.g.: change is before and partially in tag => change will be added before the tag and outdated text in the tag will be removed\n // e.g.: change is after and partially in tag => change will be added after the tag and outdated text in the tag will be removed\n // e.g.: change is on the beginning of the tag => change will be added before the tag\n // e.g.: change is on the end of the tag => change will be added to the tag if it's not mention and after the tag if it's mention\n let processedChange = escapeHTMLChars(change);\n\n // end tag plain text index of the last processed tag\n let lastProcessedPlainTextTagEndIndex = 0;\n // as some tags/text can be removed fully, selection should be updated correctly\n let changeNewEndIndex: number | undefined;\n\n for (let i = 0; i < tags.length; i++) {\n const tag = tags[i];\n if (tag?.plainTextBeginIndex === undefined) {\n continue;\n }\n // all plain text indexes includes trigger length for the mention that shouldn't be included in\n // htmlText.substring because html strings don't include the trigger\n // mentionTagLength will be set only for mention tag, otherwise should be 0\n let mentionTagLength = 0;\n let isMentionTag = false;\n if (tag.tagType === MSFT_MENTION_TAG) {\n mentionTagLength = mentionTrigger.length;\n isMentionTag = true;\n }\n if (startIndex <= tag.plainTextBeginIndex) {\n // change start is before the open tag\n // Math.max(lastProcessedPlainTextTagEndIndex, startIndex) is used as startIndex may not be in [[previous tag].plainTextEndIndex - tag.plainTextBeginIndex] range\n const startChangeDiff = getChangeDiff(\n oldPlainText,\n Math.max(lastProcessedPlainTextTagEndIndex, startIndex),\n tag.plainTextBeginIndex\n );\n\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex - startChangeDiff) + processedChange;\n processedChange = '';\n if (oldPlainTextEndIndex <= tag.plainTextBeginIndex) {\n // the whole change is before tag start\n // mentionTag length can be ignored here as the change is before the tag\n const endChangeDiff = getChangeDiff(oldPlainText, oldPlainTextEndIndex, tag.plainTextBeginIndex);\n lastProcessedHTMLIndex = tag.openTagIndex - endChangeDiff;\n // the change is handled; exit\n break;\n } else {\n // change continues in the tag\n lastProcessedHTMLIndex = tag.openTagIndex;\n // proceed to the next check\n }\n }\n const closingTagInfo = getTagClosingTagInfo(tag);\n if (startIndex <= closingTagInfo.plainTextEndIndex) {\n // change started before the end tag\n if (startIndex <= tag.plainTextBeginIndex && oldPlainTextEndIndex === closingTagInfo.plainTextEndIndex) {\n // the change is a tag or starts before the tag\n // tag should be removed, no matter if there are sub-tags\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex) + processedChange;\n processedChange = '';\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n // the change is handled; exit\n break;\n } else if (startIndex >= tag.plainTextBeginIndex && oldPlainTextEndIndex <= closingTagInfo.plainTextEndIndex) {\n // the change is between the tag\n if (isMentionTag) {\n if (change !== '') {\n // case for startIndex === tag.plainTextBeginIndex and closingTagInfo.plainTextEndIndex === startIndex\n // is handled in startIndex <= tag.plainTextBeginIndex condition check\n // the change will be added at the beginning before the mention tag\n if (startIndex === closingTagInfo.plainTextEndIndex) {\n // non empty change at the end of the mention tag to be added after the mention tag\n result +=\n htmlText.substring(lastProcessedHTMLIndex, closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength) +\n processedChange;\n changeNewEndIndex = closingTagInfo.plainTextEndIndex + unEscapeHtmlCharacters(processedChange).length;\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n processedChange = '';\n // the change is handled; exit\n break;\n } else if (\n startIndex > tag.plainTextBeginIndex &&\n oldPlainTextEndIndex < closingTagInfo.plainTextEndIndex &&\n startIndex === oldPlainTextEndIndex\n ) {\n // mention tag should be deleted when user tries to edit it in the middle\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex) + processedChange;\n changeNewEndIndex = tag.plainTextBeginIndex + unEscapeHtmlCharacters(processedChange).length;\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n\n processedChange = '';\n // the change is handled; exit\n break;\n } else {\n // the selection for more that 1 symbol when 1 of the ends is included\n const updateMentionTagResult = handleMentionTagUpdate({\n htmlText,\n oldPlainText,\n lastProcessedHTMLIndex,\n processedChange,\n change,\n tag,\n closeTagIdx: closingTagInfo.closeTagIdx,\n closeTagLength: closingTagInfo.closeTagLength,\n plainTextEndIndex: closingTagInfo.plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n });\n result += updateMentionTagResult.result;\n changeNewEndIndex = updateMentionTagResult.plainTextSelectionEndIndex;\n processedChange = updateMentionTagResult.updatedChange;\n lastProcessedHTMLIndex = updateMentionTagResult.htmlIndex;\n // proceed with the next calculations\n }\n } else {\n // When change is empty, it means that this change is a deletion\n const updateMentionTagResult = handleMentionTagUpdate({\n htmlText,\n oldPlainText,\n lastProcessedHTMLIndex,\n processedChange,\n change,\n tag,\n closeTagIdx: closingTagInfo.closeTagIdx,\n closeTagLength: closingTagInfo.closeTagLength,\n plainTextEndIndex: closingTagInfo.plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n });\n result += updateMentionTagResult.result;\n changeNewEndIndex = updateMentionTagResult.plainTextSelectionEndIndex;\n processedChange = updateMentionTagResult.updatedChange;\n lastProcessedHTMLIndex = updateMentionTagResult.htmlIndex;\n // the change is handled; exit\n break;\n }\n } else if (tag.subTags !== undefined && tag.subTags.length !== 0 && tag.content !== undefined) {\n // with subtags\n const stringBefore = htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length);\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n const updatedContent = updateHTML({\n htmlText: tag.content,\n oldPlainText,\n tags: tag.subTags,\n startIndex,\n oldPlainTextEndIndex,\n change: processedChange,\n mentionTrigger\n });\n result += stringBefore + updatedContent.updatedHTML;\n changeNewEndIndex = updatedContent.updatedSelectionIndex;\n // the change is handled; exit\n break;\n } else {\n // no subtags\n const startChangeDiff = getChangeDiff(oldPlainText, tag.plainTextBeginIndex, startIndex);\n result +=\n htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length + startChangeDiff) +\n processedChange;\n processedChange = '';\n if (oldPlainTextEndIndex < closingTagInfo.plainTextEndIndex) {\n const endChangeDiff = getChangeDiff(oldPlainText, tag.plainTextBeginIndex, oldPlainTextEndIndex);\n lastProcessedHTMLIndex = tag.openTagIndex + tag.openTagBody.length + endChangeDiff;\n } else if (oldPlainTextEndIndex === closingTagInfo.plainTextEndIndex) {\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n }\n // the change is handled; exit\n break;\n }\n } else if (startIndex > tag.plainTextBeginIndex && oldPlainTextEndIndex > closingTagInfo.plainTextEndIndex) {\n // the change started in the tag but finishes somewhere further\n if (isMentionTag) {\n if (startIndex === closingTagInfo.plainTextEndIndex) {\n // the change should be handled out of mention tag\n // as startIndex === closingTagInfo.plainTextEndIndex and oldPlainTextEndIndex > closingTagInfo.plainTextEndIndex\n result += htmlText.substring(\n lastProcessedHTMLIndex,\n closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength\n );\n // no need to handle plainTextSelectionEndIndex as the change will be added later\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n } else {\n // part of the mention tag was changed/deleted\n const updateMentionTagResult = handleMentionTagUpdate({\n htmlText,\n oldPlainText,\n lastProcessedHTMLIndex,\n processedChange: '',\n change,\n tag,\n closeTagIdx: closingTagInfo.closeTagIdx,\n closeTagLength: closingTagInfo.closeTagLength,\n plainTextEndIndex: closingTagInfo.plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n });\n result += updateMentionTagResult.result;\n lastProcessedHTMLIndex = updateMentionTagResult.htmlIndex;\n // no need to handle plainTextSelectionEndIndex as the change will be added later\n }\n } else if (tag.subTags !== undefined && tag.subTags.length !== 0 && tag.content !== undefined) {\n // with subtags\n const stringBefore = htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length);\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n const updatedContent = updateHTML({\n htmlText: tag.content,\n oldPlainText,\n tags: tag.subTags,\n startIndex,\n oldPlainTextEndIndex,\n change: '', // the part of the tag should be just deleted without processedChange update and change will be added after this tag\n mentionTrigger\n });\n result += stringBefore + updatedContent.updatedHTML;\n } else {\n // no subtags\n const startChangeDiff = startIndex - tag.plainTextBeginIndex - mentionTagLength;\n result += htmlText.substring(\n lastProcessedHTMLIndex,\n tag.openTagIndex + tag.openTagBody.length + startChangeDiff\n );\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n }\n // proceed with the next calculations\n } else if (startIndex < tag.plainTextBeginIndex && oldPlainTextEndIndex > closingTagInfo.plainTextEndIndex) {\n // the change starts before the tag and finishes after it\n // tag should be removed, no matter if there are subtags\n // no need to save anything between lastProcessedHTMLIndex and closeTagIdx + closeTagLength\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n // proceed with the next calculations\n } else if (startIndex === tag.plainTextBeginIndex && oldPlainTextEndIndex > closingTagInfo.plainTextEndIndex) {\n // the change starts in the tag and finishes after it\n // tag should be removed, no matter if there are subtags\n result += htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex);\n // processedChange shouldn't be updated as it will be added after the tag\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength;\n // proceed with the next calculations\n } else if (startIndex < tag.plainTextBeginIndex && oldPlainTextEndIndex < closingTagInfo.plainTextEndIndex) {\n // the change starts before the tag and ends in a tag\n if (isMentionTag) {\n // mention tag\n const updateMentionTagResult = handleMentionTagUpdate({\n htmlText,\n oldPlainText,\n lastProcessedHTMLIndex,\n processedChange: '', // the part of mention should be just deleted without processedChange update\n change,\n tag,\n closeTagIdx: closingTagInfo.closeTagIdx,\n closeTagLength: closingTagInfo.closeTagLength,\n plainTextEndIndex: closingTagInfo.plainTextEndIndex,\n startIndex,\n oldPlainTextEndIndex,\n mentionTagLength\n });\n changeNewEndIndex = updateMentionTagResult.plainTextSelectionEndIndex;\n result += updateMentionTagResult.result;\n lastProcessedHTMLIndex = updateMentionTagResult.htmlIndex;\n } else if (tag.subTags !== undefined && tag.subTags.length !== 0 && tag.content !== undefined) {\n // with subtags\n const stringBefore = htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length);\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx;\n const updatedContent = updateHTML({\n htmlText: tag.content,\n oldPlainText,\n tags: tag.subTags,\n startIndex,\n oldPlainTextEndIndex,\n change: processedChange, // processedChange should be equal '' and the part of the tag should be deleted as the change was handled before this tag\n mentionTrigger\n });\n processedChange = '';\n result += stringBefore + updatedContent.updatedHTML;\n } else {\n // no subtags\n result +=\n htmlText.substring(lastProcessedHTMLIndex, tag.openTagIndex + tag.openTagBody.length) + processedChange;\n processedChange = '';\n // oldPlainTextEndIndex already includes mentionTag length\n const endChangeDiff = getChangeDiff(oldPlainText, oldPlainTextEndIndex, closingTagInfo.plainTextEndIndex);\n // as change may be before the end of the tag, we need to add the rest of the tag\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx - endChangeDiff;\n }\n // the change is handled; exit\n break;\n }\n lastProcessedPlainTextTagEndIndex = closingTagInfo.plainTextEndIndex;\n }\n\n if (i === tags.length - 1 && oldPlainTextEndIndex >= closingTagInfo.plainTextEndIndex) {\n // the last tag should handle the end of the change if needed\n // oldPlainTextEndIndex already includes mentionTag length\n const endChangeDiff = getChangeDiff(oldPlainText, closingTagInfo.plainTextEndIndex, oldPlainTextEndIndex);\n if (startIndex >= closingTagInfo.plainTextEndIndex) {\n const startChangeDiff = getChangeDiff(oldPlainText, closingTagInfo.plainTextEndIndex, startIndex);\n result +=\n htmlText.substring(\n lastProcessedHTMLIndex,\n closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength + startChangeDiff\n ) + processedChange;\n } else {\n result +=\n htmlText.substring(lastProcessedHTMLIndex, closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength) +\n processedChange;\n }\n processedChange = '';\n lastProcessedHTMLIndex = closingTagInfo.closeTagIdx + closingTagInfo.closeTagLength + endChangeDiff;\n // the change is handled; exit\n // break is not required here as this is the last element but added for consistency\n break;\n }\n }\n if (lastProcessedHTMLIndex < htmlText.length) {\n // add the rest of the html string\n result += htmlText.substring(lastProcessedHTMLIndex);\n }\n return { updatedHTML: result, updatedSelectionIndex: changeNewEndIndex };\n};\n\n/**\n * Props for finding strings diff indexes\n *\n * @private\n */\ntype DiffIndexesProps = {\n // the old text\n oldText: string;\n // the new text\n newText: string;\n // the start of previous selection, should be a valid position in the input field\n previousSelectionStart: number;\n // the end of previous selection, should be a valid position in the input field\n previousSelectionEnd: number;\n // the start of current selection, should be a valid position in the input field\n currentSelectionStart: number;\n // the end of current selection, should be a valid position in the input field\n currentSelectionEnd: number;\n};\n\n/**\n * Result of finding strings diff indexes function\n *\n * @private\n */\ntype DiffIndexesResult = {\n changeStart: number;\n oldChangeEnd: number;\n newChangeEnd: number;\n};\n\n/**\n * Given the oldText and newText, find the start index, old end index and new end index for the changes\n *\n * @private\n * @param props - Props for finding stings diff indexes function.\n * @returns Indexes for change start and ends in new and old texts. The old and new end indexes are exclusive.\n */\nexport const findStringsDiffIndexes = (props: DiffIndexesProps): DiffIndexesResult => {\n const { oldText, newText, previousSelectionStart, previousSelectionEnd, currentSelectionStart, currentSelectionEnd } =\n props;\n const newTextLength = newText.length;\n const oldTextLength = oldText.length;\n // let changeStart = 0;\n let newChangeEnd = newTextLength;\n let oldChangeEnd = oldTextLength;\n const previousSelectionStartValue = previousSelectionStart > -1 ? previousSelectionStart : oldTextLength;\n const previousSelectionEndValue = previousSelectionEnd > -1 ? previousSelectionEnd : oldTextLength;\n const currentSelectionStartValue = currentSelectionStart > -1 ? currentSelectionStart : newTextLength;\n const currentSelectionEndValue = currentSelectionEnd > -1 ? currentSelectionEnd : newTextLength;\n const changeStart = Math.min(\n previousSelectionStartValue,\n previousSelectionEndValue,\n currentSelectionStartValue,\n currentSelectionEndValue,\n newTextLength,\n oldTextLength\n );\n\n if (oldTextLength < newTextLength) {\n //insert or replacement\n if (oldTextLength === changeStart) {\n // when change was at the end of string\n // change is found\n newChangeEnd = newTextLength;\n oldChangeEnd = oldTextLength;\n } else {\n for (let i = 0; i < newTextLength && oldTextLength - i >= changeStart; i++) {\n newChangeEnd = newTextLength - i - 1;\n oldChangeEnd = oldTextLength - i - 1;\n\n if (newText[newChangeEnd] !== oldText[oldChangeEnd]) {\n // change is found\n break;\n }\n }\n // make indexes exclusive\n newChangeEnd += 1;\n oldChangeEnd += 1;\n }\n } else if (oldTextLength > newTextLength) {\n //deletion or replacement\n if (newTextLength === changeStart) {\n // when change was at the end of string\n // change is found\n newChangeEnd = newTextLength;\n oldChangeEnd = oldTextLength;\n } else {\n for (let i = 0; i < oldTextLength && newTextLength - i >= changeStart; i++) {\n newChangeEnd = newTextLength - i - 1;\n oldChangeEnd = oldTextLength - i - 1;\n if (newText[newChangeEnd] !== oldText[oldChangeEnd]) {\n // change is found\n break;\n }\n }\n // make indexes exclusive\n newChangeEnd += 1;\n oldChangeEnd += 1;\n }\n } else {\n // replacement\n for (let i = 0; i < oldTextLength && oldTextLength - i >= changeStart; i++) {\n newChangeEnd = newTextLength - i - 1;\n oldChangeEnd = oldTextLength - i - 1;\n\n if (newText[newChangeEnd] !== oldText[oldChangeEnd]) {\n // change is found\n break;\n }\n }\n // make indexes exclusive if they aren't equal to the length of the string\n if (newChangeEnd !== newText.length) {\n newChangeEnd += 1;\n }\n if (oldChangeEnd !== oldText.length) {\n oldChangeEnd += 1;\n }\n }\n return { changeStart, oldChangeEnd, newChangeEnd };\n};\n\n/**\n * Get the html string for the mention suggestion.\n *\n * @private\n * @param suggestion - The mention suggestion.\n * @param localeStrings - The locale strings.\n * @returns The html string for the mention suggestion.\n */\nexport const htmlStringForMentionSuggestion = (suggestion: Mention, localeStrings: ComponentStrings): string => {\n const idHTML = ' id=\"' + suggestion.id + '\"';\n const displayText = getDisplayNameForMentionSuggestion(suggestion, localeStrings);\n return '<' + MSFT_MENTION_TAG + idHTML + '>' + displayText + '</' + MSFT_MENTION_TAG + '>';\n};\n\n/**\n * Get display name for the mention suggestion.\n *\n * @private\n *\n * @param suggestion - The mention suggestion.\n * @param localeStrings - The locale strings.\n * @returns The display name for the mention suggestion or display name placeholder if display name is empty.\n */\nexport const getDisplayNameForMentionSuggestion = (suggestion: Mention, localeStrings: ComponentStrings): string => {\n const displayNamePlaceholder = localeStrings.participantItem.displayNamePlaceholder;\n return suggestion.displayText !== '' ? suggestion.displayText : displayNamePlaceholder ?? '';\n};\n\n/**\n * Tag data for a HTML tag in the string\n *\n * @private\n */\nexport type TagData = {\n tagType: string; // The type of tag (e.g. msft-mention)\n openTagIndex: number; // Start of the tag relative to the parent content\n openTagBody: string; // Complete open tag body\n content?: string; // All content between the open and close tags\n closingTagIndex?: number; // Start of the close tag relative to the parent content\n subTags?: TagData[]; // Any child tags\n plainTextBeginIndex?: number; // Absolute index of the open tag start should be in plain text\n plainTextEndIndex?: number; // Absolute index of the close tag start should be in plain text\n};\n\ntype HtmlTagType = 'open' | 'close' | 'self-closing';\n\ntype HtmlTag = {\n content: string;\n startIdx: number;\n type: HtmlTagType;\n};\n\n/**\n * Parse the text and return the tags and the plain text in one go\n * @private\n * @param text - The text to parse for HTML tags\n * @param trigger The trigger to show for the mention tag in plain text\n *\n * @returns An array of tags and the plain text representation\n */\nexport const textToTagParser = (text: string, trigger: string): { tags: TagData[]; plainText: string } => {\n const tags: TagData[] = []; // Tags passed back to the caller\n const tagParseStack: TagData[] = []; // Local stack to use while parsing\n\n let plainTextRepresentation = '';\n\n let parseIndex = 0;\n while (parseIndex < text.length) {\n const foundHtmlTag = findNextHtmlTag(text, parseIndex);\n\n if (!foundHtmlTag) {\n if (parseIndex !== 0) {\n // Add the remaining text to the plain text representation\n const newText = text.substring(parseIndex);\n plainTextRepresentation += unEscapeHtmlCharacters(newText);\n } else {\n plainTextRepresentation = unEscapeHtmlCharacters(text);\n }\n break;\n }\n\n if (foundHtmlTag.type === 'open' || foundHtmlTag.type === 'self-closing') {\n const nextTag = parseOpenTag(foundHtmlTag.content, foundHtmlTag.startIdx);\n // Add the plain text between the last tag and this one found\n plainTextRepresentation += unEscapeHtmlCharacters(text.substring(parseIndex, foundHtmlTag.startIdx));\n nextTag.plainTextBeginIndex = plainTextRepresentation.length;\n\n if (foundHtmlTag.type === 'open') {\n tagParseStack.push(nextTag);\n } else {\n nextTag.content = '';\n nextTag.plainTextBeginIndex = plainTextRepresentation.length;\n nextTag.plainTextEndIndex = plainTextRepresentation.length;\n addTag(nextTag, tagParseStack, tags);\n }\n }\n\n if (foundHtmlTag.type === 'close') {\n const currentOpenTag = tagParseStack.pop();\n const closeTagType = foundHtmlTag.content.substring(2, foundHtmlTag.content.length - 1).toLowerCase();\n\n if (currentOpenTag && currentOpenTag.tagType === closeTagType) {\n // Tag startIdx is absolute to the text. This is updated later to be relative to the parent tag\n currentOpenTag.content = text.substring(\n currentOpenTag.openTagIndex + currentOpenTag.openTagBody.length,\n foundHtmlTag.startIdx\n );\n\n // Insert the plain text pieces for the sub tags\n if (currentOpenTag.tagType === MSFT_MENTION_TAG) {\n plainTextRepresentation =\n plainTextRepresentation.slice(0, currentOpenTag.plainTextBeginIndex) +\n trigger +\n plainTextRepresentation.slice(currentOpenTag.plainTextBeginIndex);\n }\n\n const lastSubTag = currentOpenTag.subTags?.[currentOpenTag.subTags.length - 1];\n if (!currentOpenTag.subTags) {\n plainTextRepresentation += unEscapeHtmlCharacters(currentOpenTag.content);\n } else if (lastSubTag) {\n // Add text after the last tag\n const startOfRemainingText =\n (lastSubTag?.closingTagIndex ?? lastSubTag.openTagIndex) + lastSubTag.tagType.length + 3;\n const trailingText = currentOpenTag.content.substring(startOfRemainingText);\n plainTextRepresentation += unEscapeHtmlCharacters(trailingText);\n }\n\n currentOpenTag.plainTextEndIndex = plainTextRepresentation.length;\n addTag(currentOpenTag, tagParseStack, tags);\n } else {\n throw new Error(\n 'Unexpected close tag found. Got \"' +\n closeTagType +\n '\" but expected \"' +\n tagParseStack[tagParseStack.length - 1]?.tagType +\n '\"'\n );\n }\n }\n\n // Update parsing index; move past the end of the close tag\n parseIndex = foundHtmlTag.startIdx + foundHtmlTag.content.length;\n } // While parseIndex < text.length loop\n\n return { tags, plainText: plainTextRepresentation };\n};\n\nconst parseOpenTag = (tag: string, startIdx: number): TagData => {\n let tagType = tag.substring(1, tag.length - 1);\n tagType = tagType.split(' ')[0] ?? tagType;\n tagType = tagType.toLowerCase().replace('/', '');\n return {\n tagType,\n openTagIndex: startIdx,\n openTagBody: tag\n };\n};\n\nconst findNextHtmlTag = (text: string, startIndex: number): HtmlTag | undefined => {\n const tagStartIndex = text.indexOf('<', startIndex);\n if (tagStartIndex === -1) {\n // No more tags\n return undefined;\n }\n const tagEndIndex = text.indexOf('>', tagStartIndex);\n if (tagEndIndex === -1) {\n // No close tag\n return undefined;\n }\n const tag = text.substring(tagStartIndex, tagEndIndex + 1);\n let type: HtmlTagType = 'open';\n if (tag[1] === '/') {\n type = 'close';\n } else if (tag[tag.length - 2] === '/') {\n type = 'self-closing';\n }\n return {\n content: tag,\n startIdx: tagStartIndex,\n type\n };\n};\n\nconst addTag = (tag: TagData, parseStack: TagData[], tags: TagData[]): void => {\n // Add as sub-tag to the parent stack tag, if there is one\n const parentTag = parseStack[parseStack.length - 1];\n\n if (parentTag) {\n // Adjust the open tag index to be relative to the parent tag\n const parentContentStartIdx = parentTag.openTagIndex + parentTag.openTagBody.length;\n const relativeIdx = tag.openTagIndex - parentContentStartIdx;\n tag.openTagIndex = relativeIdx;\n }\n\n if (!tag.closingTagIndex) {\n // If the tag is self-closing, the close tag is the same as the open tag\n if (tag.openTagBody[tag.openTagBody.length - 2] === '/') {\n tag.closingTagIndex = tag.openTagIndex;\n } else {\n // Otherwise, the close tag index is the open tag index + the open tag body + the content length\n tag.closingTagIndex = tag.openTagIndex + tag.openTagBody.length + (tag.content ?? []).length;\n }\n }\n\n // Put the tag where it belongs\n if (!parentTag) {\n tags.push(tag);\n } else {\n if (!parentTag.subTags) {\n parentTag.subTags = [tag];\n } else {\n parentTag.subTags.push(tag);\n }\n }\n};\n\n// We should revisit this in the future when we support other text such as rich text editing.\nconst escapeHTMLChars = (text: string): string => {\n const mentionRegex = new RegExp(`<${MSFT_MENTION_TAG}(.*?)>(.*?)</${MSFT_MENTION_TAG}>`, 'i');\n if (!text.match(mentionRegex)) {\n return text\n .replace(/&(?![A-Z]+;)/gi, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n }\n return text;\n};\n\nconst getChangeDiff = (plainText: string, startIndex: number, endIndex: number): number => {\n return endIndex - startIndex + getLengthDiffForEscapedHtmlChars(plainText, startIndex, endIndex);\n};\n\nconst getLengthDiffForEscapedHtmlChars = (text: string, startIndex: number, endIndex: number): number => {\n const subText = text.substring(startIndex, endIndex);\n const escapedAngleBracketCount = subText.match(/(<)|(>)/g)?.length || 0;\n let escapedCharLength = escapedAngleBracketCount * ('&lt;'.length - '<'.length);\n const escapedAmpersandCount = subText.match(/&/g)?.length || 0;\n escapedCharLength += escapedAmpersandCount * ('&amp;'.length - '&'.length);\n return escapedCharLength;\n};\n\nconst unEscapeHtmlCharacters = (text: string): string => {\n return text.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');\n};\n"]}
@@ -32,8 +32,9 @@ export const VerticalGallery = (props) => {
32
32
  const firstIndexOfCurrentPage = (page - 1) * childrenPerPage;
33
33
  const clippedPage = firstIndexOfCurrentPage < numberOfChildren - 1 ? page : lastPage;
34
34
  const childrenOnCurrentPage = useMemo(() => {
35
+ var _a;
35
36
  if (indexesArray[0] !== undefined) {
36
- return indexesArray[clippedPage - 1].map((index) => {
37
+ return (_a = indexesArray[clippedPage - 1]) === null || _a === void 0 ? void 0 : _a.map((index) => {
37
38
  return React.Children.toArray(children)[index];
38
39
  });
39
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalGallery.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/VerticalGallery.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAU,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,sCAAsC,EACtC,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,SAAS,EACV,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAsE3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAe,EAAE;IAC1E,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;IAE1E,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG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Q,EAAE,CAAC;IAEpD,OAAO,CACL,oBAAC,KAAK,IAAC,eAAe,EAAC,QAAQ,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAU,QAAC,SAAS,EAAE,0BAA0B;QACzG,oBAAC,aAAa,IACZ,SAAS,EAAE,mBAAmB,EAC9B,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,EACnC,SAAS,EAAE,OAAO,CAAC,sBAAsB,gBAC7B,GAAG,CAAC,4BAA4B;YAE5C,oBAAC,IAAI,IAAC,QAAQ,EAAC,2BAA2B,EAAC,MAAM,EAAE,aAAa,GAAI,CACtD;QAChB,oBAAC,IAAI,kBACS,GAAG,CAAC,0BAA0B,EAC1C,SAAS,EAAE,iBAAiB,IAC5B,GAAG,WAAW,MAAM,UAAU,EAAE,CAAQ;QAC1C,oBAAC,aAAa,IACZ,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,EAC/B,SAAS,EAAE,OAAO,CAAC,uBAAuB,gBAC9B,GAAG,CAAC,6BAA6B;YAE7C,oBAAC,IAAI,IAAC,QAAQ,EAAC,4BAA4B,EAAC,MAAM,EAAE,aAAa,GAAI,CACvD,CACV,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { DefaultButton, Icon, IStyle, mergeStyles, Stack, Text } from '@fluentui/react';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport { useLocale } from '../localization';\nimport { useIdentifiers } from '../identifiers';\nimport { useTheme } from '../theming';\nimport { BaseCustomStyles } from '../types';\nimport {\n childrenContainerStyle,\n pageNavigationControlBarContainerStyle,\n participantPageCounter,\n leftRightButtonStyles,\n navIconStyles,\n rootStyle\n} from './styles/VerticalGallery.styles';\nimport { bucketize } from './utils/overFlowGalleriesUtils';\n\n/**\n * Styles for the VerticalGallery component\n *\n * @public\n */\nexport interface VerticalGalleryStyles extends BaseCustomStyles {\n /** Styles for each video tile in the vertical gallery */\n children?: IStyle;\n /** Styles for the verticalGallery control bar */\n controlBar?: VerticalGalleryControlBarStyles;\n}\n\n/**\n * Strings for localization of the vertical gallery.\n *\n * @public\n */\nexport interface VerticalGalleryStrings {\n /** Aria label for the left page navigation button */\n leftNavButtonAriaLabel?: string;\n /** Aria label for the right page navigation button */\n rightNavButtonAriaLabel?: string;\n}\n\n/**\n * Styles for the control bar inside the VerticalGallery component\n *\n * @public\n */\nexport interface VerticalGalleryControlBarStyles extends BaseCustomStyles {\n /**\n * styles for the next button in the VerticalGalleryControlBar\n */\n nextButton?: IStyle;\n /**\n * Styles for the previous button in the VerticalGalleryControlBar\n */\n previousButton?: IStyle;\n /**\n * Styles for the counter in the VerticalGalleryControlBar\n */\n counter?: IStyle;\n}\n/**\n * Props for the VerticalGallery component\n *\n * @public\n */\nexport interface VerticalGalleryProps {\n /** Video tiles for the remote participants in the vertical gallery */\n children: React.ReactNode;\n /** Max number of children per page in the vertical Gallery */\n childrenPerPage: number;\n /** Styles to customize the vertical gallery */\n styles?: VerticalGalleryStyles;\n /** helper function to choose which tiles to give video to. */\n onFetchTilesToRender?: (indexes: number[]) => void;\n}\n\ninterface VerticalGalleryControlBarProps {\n onNextButtonClick: () => void;\n onPreviousButtonClick: () => void;\n buttonsDisabled: { next: boolean; previous: boolean };\n totalPages: number;\n currentPage: number;\n styles?: VerticalGalleryControlBarStyles;\n}\n\n/**\n * VerticalGallery is a overflow gallery for participants in the {@link VideoGallery} component. Stacks\n * participants on the Y-axis of the VideoGallery for better use of horizontal space.\n *\n * @public\n */\nexport const VerticalGallery = (props: VerticalGalleryProps): JSX.Element => {\n const { children, styles, childrenPerPage, onFetchTilesToRender } = props;\n\n const [page, setPage] = useState(1);\n const [buttonState, setButtonState] = useState<{ previous: boolean; next: boolean }>({ previous: true, next: true });\n\n const ids = useIdentifiers();\n\n const numberOfChildren = React.Children.count(children);\n const lastPage = Math.ceil(numberOfChildren / childrenPerPage);\n\n const indexesArray: number[][] = useMemo(() => {\n return bucketize([...Array(numberOfChildren).keys()], childrenPerPage);\n }, [numberOfChildren, childrenPerPage]);\n\n useEffect(() => {\n if (onFetchTilesToRender && indexesArray) {\n onFetchTilesToRender(indexesArray[page - 1] ?? []);\n }\n }, [indexesArray, onFetchTilesToRender, page]);\n\n const firstIndexOfCurrentPage = (page - 1) * childrenPerPage;\n const clippedPage = firstIndexOfCurrentPage < numberOfChildren - 1 ? page : lastPage;\n const childrenOnCurrentPage = useMemo(() => {\n if (indexesArray[0] !== undefined) {\n return indexesArray[clippedPage - 1].map((index) => {\n return React.Children.toArray(children)[index];\n });\n }\n return;\n }, [indexesArray, clippedPage, children]);\n\n const showButtons = numberOfChildren > childrenPerPage;\n\n const onPreviousButtonClick = (): void => {\n setPage(page - 1);\n };\n const onNextButtonClick = (): void => {\n setPage(page + 1);\n };\n\n if (page > lastPage && lastPage > 0) {\n setPage(lastPage);\n }\n\n useEffect(() => {\n if (page > 1 && page < lastPage && showButtons) {\n // we are somewhere in between first and last pages.\n setButtonState({ previous: false, next: false });\n } else if (page === 1 && showButtons) {\n // we are on the first page.\n setButtonState({ previous: true, next: false });\n } else if (page === lastPage && showButtons) {\n // we are on the last page.\n setButtonState({ previous: false, next: true });\n }\n }, [page, numberOfChildren, lastPage, showButtons]);\n\n const childContainerStyle = useMemo(() => {\n return { root: childrenContainerStyle(2) };\n }, []);\n\n const childrenStyles = useMemo(() => {\n return { root: styles?.children };\n }, [styles?.children]);\n\n if (childrenPerPage <= 0) {\n return <></>;\n }\n\n return (\n <Stack className={mergeStyles(rootStyle, styles?.root)}>\n <Stack styles={childContainerStyle}>\n {childrenOnCurrentPage?.map((child, i) => {\n return (\n <Stack.Item key={i} styles={childrenStyles} data-ui-id={ids.verticalGalleryVideoTile}>\n {child}\n </Stack.Item>\n );\n })}\n </Stack>\n {showButtons && (\n <VerticalGalleryControlBar\n buttonsDisabled={buttonState}\n onPreviousButtonClick={onPreviousButtonClick}\n onNextButtonClick={onNextButtonClick}\n totalPages={lastPage}\n currentPage={page}\n />\n )}\n </Stack>\n );\n};\n\nconst VerticalGalleryControlBar = (props: VerticalGalleryControlBarProps): JSX.Element => {\n const { onNextButtonClick, onPreviousButtonClick, buttonsDisabled, currentPage, totalPages, styles } = props;\n const theme = useTheme();\n const ids = useIdentifiers();\n\n const strings = useLocale().strings.verticalGallery;\n\n const pageCounterContainerStyles = useMemo(() => {\n return mergeStyles(pageNavigationControlBarContainerStyle, styles?.root);\n }, [styles?.root]);\n\n const previousButtonSyles = useMemo(() => {\n return mergeStyles(leftRightButtonStyles(theme), styles?.previousButton);\n }, [styles?.previousButton, theme]);\n\n const pageCounterStyles = useMemo(() => {\n return mergeStyles(participantPageCounter, styles?.counter);\n }, [styles?.counter]);\n\n const nextButtonsStyles = useMemo(() => {\n return mergeStyles(leftRightButtonStyles(theme), styles?.nextButton);\n }, [styles?.nextButton, theme]);\n\n const controlBarSpacing = { childrenGap: '0.5rem' };\n\n return (\n <Stack horizontalAlign=\"center\" tokens={controlBarSpacing} horizontal className={pageCounterContainerStyles}>\n <DefaultButton\n className={previousButtonSyles}\n onClick={onPreviousButtonClick}\n disabled={buttonsDisabled?.previous}\n ariaLabel={strings.leftNavButtonAriaLabel}\n data-ui-id={ids.overflowGalleryLeftNavButton}\n >\n <Icon iconName=\"VerticalGalleryLeftButton\" styles={navIconStyles} />\n </DefaultButton>\n <Text\n data-ui-id={ids.verticalGalleryPageCounter}\n className={pageCounterStyles}\n >{`${currentPage} / ${totalPages}`}</Text>\n <DefaultButton\n className={nextButtonsStyles}\n onClick={onNextButtonClick}\n disabled={buttonsDisabled?.next}\n ariaLabel={strings.rightNavButtonAriaLabel}\n data-ui-id={ids.overflowGalleryRightNavButton}\n >\n <Icon iconName=\"VerticalGalleryRightButton\" styles={navIconStyles} />\n </DefaultButton>\n </Stack>\n );\n};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,EAAC,2BAA2B,EAAC,MAAM,EAAE,aAAa,GAAI,CACtD;QAChB,oBAAC,IAAI,kBACS,GAAG,CAAC,0BAA0B,EAC1C,SAAS,EAAE,iBAAiB,IAC5B,GAAG,WAAW,MAAM,UAAU,EAAE,CAAQ;QAC1C,oBAAC,aAAa,IACZ,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,EAC/B,SAAS,EAAE,OAAO,CAAC,uBAAuB,gBAC9B,GAAG,CAAC,6BAA6B;YAE7C,oBAAC,IAAI,IAAC,QAAQ,EAAC,4BAA4B,EAAC,MAAM,EAAE,aAAa,GAAI,CACvD,CACV,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { DefaultButton, Icon, IStyle, mergeStyles, Stack, Text } from '@fluentui/react';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport { useLocale } from '../localization';\nimport { useIdentifiers } from '../identifiers';\nimport { useTheme } from '../theming';\nimport { BaseCustomStyles } from '../types';\nimport {\n childrenContainerStyle,\n pageNavigationControlBarContainerStyle,\n participantPageCounter,\n leftRightButtonStyles,\n navIconStyles,\n rootStyle\n} from './styles/VerticalGallery.styles';\nimport { bucketize } from './utils/overFlowGalleriesUtils';\n\n/**\n * Styles for the VerticalGallery component\n *\n * @public\n */\nexport interface VerticalGalleryStyles extends BaseCustomStyles {\n /** Styles for each video tile in the vertical gallery */\n children?: IStyle;\n /** Styles for the verticalGallery control bar */\n controlBar?: VerticalGalleryControlBarStyles;\n}\n\n/**\n * Strings for localization of the vertical gallery.\n *\n * @public\n */\nexport interface VerticalGalleryStrings {\n /** Aria label for the left page navigation button */\n leftNavButtonAriaLabel?: string;\n /** Aria label for the right page navigation button */\n rightNavButtonAriaLabel?: string;\n}\n\n/**\n * Styles for the control bar inside the VerticalGallery component\n *\n * @public\n */\nexport interface VerticalGalleryControlBarStyles extends BaseCustomStyles {\n /**\n * styles for the next button in the VerticalGalleryControlBar\n */\n nextButton?: IStyle;\n /**\n * Styles for the previous button in the VerticalGalleryControlBar\n */\n previousButton?: IStyle;\n /**\n * Styles for the counter in the VerticalGalleryControlBar\n */\n counter?: IStyle;\n}\n/**\n * Props for the VerticalGallery component\n *\n * @public\n */\nexport interface VerticalGalleryProps {\n /** Video tiles for the remote participants in the vertical gallery */\n children: React.ReactNode;\n /** Max number of children per page in the vertical Gallery */\n childrenPerPage: number;\n /** Styles to customize the vertical gallery */\n styles?: VerticalGalleryStyles;\n /** helper function to choose which tiles to give video to. */\n onFetchTilesToRender?: (indexes: number[]) => void;\n}\n\ninterface VerticalGalleryControlBarProps {\n onNextButtonClick: () => void;\n onPreviousButtonClick: () => void;\n buttonsDisabled: { next: boolean; previous: boolean };\n totalPages: number;\n currentPage: number;\n styles?: VerticalGalleryControlBarStyles;\n}\n\n/**\n * VerticalGallery is a overflow gallery for participants in the {@link VideoGallery} component. Stacks\n * participants on the Y-axis of the VideoGallery for better use of horizontal space.\n *\n * @public\n */\nexport const VerticalGallery = (props: VerticalGalleryProps): JSX.Element => {\n const { children, styles, childrenPerPage, onFetchTilesToRender } = props;\n\n const [page, setPage] = useState(1);\n const [buttonState, setButtonState] = useState<{ previous: boolean; next: boolean }>({ previous: true, next: true });\n\n const ids = useIdentifiers();\n\n const numberOfChildren = React.Children.count(children);\n const lastPage = Math.ceil(numberOfChildren / childrenPerPage);\n\n const indexesArray: number[][] = useMemo(() => {\n return bucketize([...Array(numberOfChildren).keys()], childrenPerPage);\n }, [numberOfChildren, childrenPerPage]);\n\n useEffect(() => {\n if (onFetchTilesToRender && indexesArray) {\n onFetchTilesToRender(indexesArray[page - 1] ?? []);\n }\n }, [indexesArray, onFetchTilesToRender, page]);\n\n const firstIndexOfCurrentPage = (page - 1) * childrenPerPage;\n const clippedPage = firstIndexOfCurrentPage < numberOfChildren - 1 ? page : lastPage;\n const childrenOnCurrentPage = useMemo(() => {\n if (indexesArray[0] !== undefined) {\n return indexesArray[clippedPage - 1]?.map((index) => {\n return React.Children.toArray(children)[index];\n });\n }\n return;\n }, [indexesArray, clippedPage, children]);\n\n const showButtons = numberOfChildren > childrenPerPage;\n\n const onPreviousButtonClick = (): void => {\n setPage(page - 1);\n };\n const onNextButtonClick = (): void => {\n setPage(page + 1);\n };\n\n if (page > lastPage && lastPage > 0) {\n setPage(lastPage);\n }\n\n useEffect(() => {\n if (page > 1 && page < lastPage && showButtons) {\n // we are somewhere in between first and last pages.\n setButtonState({ previous: false, next: false });\n } else if (page === 1 && showButtons) {\n // we are on the first page.\n setButtonState({ previous: true, next: false });\n } else if (page === lastPage && showButtons) {\n // we are on the last page.\n setButtonState({ previous: false, next: true });\n }\n }, [page, numberOfChildren, lastPage, showButtons]);\n\n const childContainerStyle = useMemo(() => {\n return { root: childrenContainerStyle(2) };\n }, []);\n\n const childrenStyles = useMemo(() => {\n return { root: styles?.children };\n }, [styles?.children]);\n\n if (childrenPerPage <= 0) {\n return <></>;\n }\n\n return (\n <Stack className={mergeStyles(rootStyle, styles?.root)}>\n <Stack styles={childContainerStyle}>\n {childrenOnCurrentPage?.map((child, i) => {\n return (\n <Stack.Item key={i} styles={childrenStyles} data-ui-id={ids.verticalGalleryVideoTile}>\n {child}\n </Stack.Item>\n );\n })}\n </Stack>\n {showButtons && (\n <VerticalGalleryControlBar\n buttonsDisabled={buttonState}\n onPreviousButtonClick={onPreviousButtonClick}\n onNextButtonClick={onNextButtonClick}\n totalPages={lastPage}\n currentPage={page}\n />\n )}\n </Stack>\n );\n};\n\nconst VerticalGalleryControlBar = (props: VerticalGalleryControlBarProps): JSX.Element => {\n const { onNextButtonClick, onPreviousButtonClick, buttonsDisabled, currentPage, totalPages, styles } = props;\n const theme = useTheme();\n const ids = useIdentifiers();\n\n const strings = useLocale().strings.verticalGallery;\n\n const pageCounterContainerStyles = useMemo(() => {\n return mergeStyles(pageNavigationControlBarContainerStyle, styles?.root);\n }, [styles?.root]);\n\n const previousButtonSyles = useMemo(() => {\n return mergeStyles(leftRightButtonStyles(theme), styles?.previousButton);\n }, [styles?.previousButton, theme]);\n\n const pageCounterStyles = useMemo(() => {\n return mergeStyles(participantPageCounter, styles?.counter);\n }, [styles?.counter]);\n\n const nextButtonsStyles = useMemo(() => {\n return mergeStyles(leftRightButtonStyles(theme), styles?.nextButton);\n }, [styles?.nextButton, theme]);\n\n const controlBarSpacing = { childrenGap: '0.5rem' };\n\n return (\n <Stack horizontalAlign=\"center\" tokens={controlBarSpacing} horizontal className={pageCounterContainerStyles}>\n <DefaultButton\n className={previousButtonSyles}\n onClick={onPreviousButtonClick}\n disabled={buttonsDisabled?.previous}\n ariaLabel={strings.leftNavButtonAriaLabel}\n data-ui-id={ids.overflowGalleryLeftNavButton}\n >\n <Icon iconName=\"VerticalGalleryLeftButton\" styles={navIconStyles} />\n </DefaultButton>\n <Text\n data-ui-id={ids.verticalGalleryPageCounter}\n className={pageCounterStyles}\n >{`${currentPage} / ${totalPages}`}</Text>\n <DefaultButton\n className={nextButtonsStyles}\n onClick={onNextButtonClick}\n disabled={buttonsDisabled?.next}\n ariaLabel={strings.rightNavButtonAriaLabel}\n data-ui-id={ids.overflowGalleryRightNavButton}\n >\n <Icon iconName=\"VerticalGalleryRightButton\" styles={navIconStyles} />\n </DefaultButton>\n </Stack>\n );\n};\n"]}
@@ -15,7 +15,7 @@ import { hiddenVideoEffectsItemContainerStyles } from './VideoEffectsItem.styles
15
15
  * @internal
16
16
  */
17
17
  export const _VideoBackgroundEffectsPicker = (props) => {
18
- var _a, _b, _c;
18
+ var _a, _b, _c, _d, _e;
19
19
  const [componentControlledSelectedEffectKey, setComponentControlledSelectedEffectKey] = React.useState(props.defaultSelectedEffectKey);
20
20
  // Warn the developer if they use the component in an incorrect controlled way.
21
21
  useWarnings({
@@ -37,9 +37,9 @@ export const _VideoBackgroundEffectsPicker = (props) => {
37
37
  const itemsPerRow = (_b = props.itemsPerRow) !== null && _b !== void 0 ? _b : 3;
38
38
  const optionsByRow = itemsPerRow === 'wrap' ? [convertedOptions] : chunk(convertedOptions, itemsPerRow);
39
39
  // If the final row is not full, fill it with hidden items to ensure layout.
40
- const fillCount = itemsPerRow === 'wrap' ? 0 : itemsPerRow - optionsByRow[optionsByRow.length - 1].length;
40
+ const fillCount = itemsPerRow === 'wrap' ? 0 : itemsPerRow - ((_d = (_c = optionsByRow[optionsByRow.length - 1]) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0);
41
41
  return (React.createElement(Stack, { tokens: { childrenGap: '0.5rem' } },
42
- React.createElement(Label, { className: mergeStyles((_c = props.styles) === null || _c === void 0 ? void 0 : _c.label) }, props.label),
42
+ React.createElement(Label, { className: mergeStyles((_e = props.styles) === null || _e === void 0 ? void 0 : _e.label) }, props.label),
43
43
  optionsByRow.map((options, rowIndex) => {
44
44
  var _a;
45
45
  return (React.createElement(Stack, { className: mergeStyles((_a = props.styles) === null || _a === void 0 ? void 0 : _a.rowRoot), wrap: props.itemsPerRow === 'wrap', horizontal: true, key: rowIndex, tokens: { childrenGap: '0.5rem' }, "data-ui-id": "video-effects-picker-row" },
@@ -1 +1 @@
1
- {"version":3,"file":"VideoBackgroundEffectsPicker.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAkFlF;;;;;;;GA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AAC,KAAK,IACJ,GAAG,EAAE,KAAK,EACV,MAAM,EAAE,qCAAqC,gBAClC,2BAA2B,GACtC,CACH,CAAC,CACE,CACT,CAAA;SAAA,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IStyle, Label, mergeStyles, Stack } from '@fluentui/react';\nimport { useWarnings } from '@fluentui/react-hooks';\nimport React from 'react';\nimport { chunk } from '../utils';\nimport { _VideoEffectsItem, _VideoEffectsItemProps } from './VideoEffectsItem';\nimport { hiddenVideoEffectsItemContainerStyles } from './VideoEffectsItem.styles';\n\n/**\n * Props for {@link _VideoBackgroundEffectsPicker}\n * @internal\n */\nexport interface _VideoBackgroundEffectsPickerProps {\n /**\n * The options to display in the picker.\n */\n options: _VideoBackgroundEffectChoiceOption[];\n\n /**\n * The key of the current selected Video Background Effect.\n * If you provide this, you must maintain selection state by observing onChange events and passing a new value in when changed.\n */\n selectedEffectKey?: string;\n\n /**\n * Callback to invoke when a Video Background Effect is selected.\n * @param effectKey - The key of the Video Background Effect that was selected.\n */\n onChange?: (effectKey: string) => void;\n\n /**\n * The key of the Video Background Effect that is initially selected.\n * Only provide this if the picker is an uncontrolled component;\n * otherwise, use the `selectedEffectKey` property.\n */\n defaultSelectedEffectKey?: string;\n\n /**\n * The label to display for the picker.\n */\n label?: string;\n\n /**\n * The number of items to display per row.\n * @default 3\n */\n itemsPerRow?: 'wrap' | number;\n\n /**\n * Styles for the picker.\n */\n styles?: _VideoBackgroundEffectsPickerStyles;\n\n /**\n * Imperative handle for calling focus()\n */\n componentRef?: React.RefObject<{\n focus: () => void;\n }>;\n}\n\n/**\n * Option for the {@link _VideoBackgroundEffectsPicker}.\n * @internal\n */\nexport type _VideoBackgroundEffectChoiceOption = _VideoEffectsItemProps;\n\n/**\n * Styles for the {@link _VideoBackgroundEffectsPicker}.\n * @internal\n */\nexport interface _VideoBackgroundEffectsPickerStyles {\n /**\n * Styles for the root element.\n */\n root?: IStyle;\n\n /**\n * Styles for the label.\n */\n label?: IStyle;\n\n /**\n * Styles for the root of each row element.\n */\n rowRoot?: IStyle;\n}\n\n/**\n * Picker for choosing a Video Background Effect.\n *\n * @remarks\n * This functions similar to a radio group of buttons, where the user can select one of the options.\n *\n * @internal\n */\nexport const _VideoBackgroundEffectsPicker = (props: _VideoBackgroundEffectsPickerProps): JSX.Element => {\n const [componentControlledSelectedEffectKey, setComponentControlledSelectedEffectKey] = React.useState<\n string | undefined\n >(props.defaultSelectedEffectKey);\n\n // Warn the developer if they use the component in an incorrect controlled way.\n useWarnings({\n name: 'VideoBackgroundEffectsPicker',\n props,\n controlledUsage: {\n onChangeProp: 'onChange',\n valueProp: 'selectedEffectKey',\n defaultValueProp: 'defaultSelectedEffectKey'\n }\n });\n\n const selectedEffect = props.selectedEffectKey ?? componentControlledSelectedEffectKey;\n const setSelectedEffect = (selectedEffectKey: string): void => {\n setComponentControlledSelectedEffectKey(selectedEffectKey);\n props.onChange?.(selectedEffectKey);\n };\n\n const convertedOptions: _VideoEffectsItemProps[] = props.options.map((option) => ({\n isSelected: option.itemKey === selectedEffect,\n onSelect: () => setSelectedEffect(option.itemKey),\n ...option\n }));\n\n const itemsPerRow = props.itemsPerRow ?? 3;\n const optionsByRow = itemsPerRow === 'wrap' ? [convertedOptions] : chunk(convertedOptions, itemsPerRow);\n\n // If the final row is not full, fill it with hidden items to ensure layout.\n const fillCount = itemsPerRow === 'wrap' ? 0 : itemsPerRow - optionsByRow[optionsByRow.length - 1].length;\n\n return (\n <Stack tokens={{ childrenGap: '0.5rem' }}>\n <Label className={mergeStyles(props.styles?.label)}>{props.label}</Label>\n {optionsByRow.map((options, rowIndex) => (\n <Stack\n className={mergeStyles(props.styles?.rowRoot)}\n wrap={props.itemsPerRow === 'wrap'}\n horizontal\n key={rowIndex}\n tokens={{ childrenGap: '0.5rem' }}\n data-ui-id=\"video-effects-picker-row\"\n >\n {options.map((option, i) => {\n if (i === 0 && rowIndex === 0) {\n return (\n <_VideoEffectsItem\n {...option}\n itemKey={option.itemKey}\n key={option.itemKey}\n componentRef={props.componentRef}\n />\n );\n }\n return <_VideoEffectsItem {...option} itemKey={option.itemKey} key={option.itemKey} />;\n })}\n {fillCount > 0 &&\n rowIndex === optionsByRow.length - 1 &&\n Array.from({ length: fillCount }).map((_, index) => (\n <Stack\n key={index}\n styles={hiddenVideoEffectsItemContainerStyles}\n data-ui-id=\"video-effects-hidden-item\"\n />\n ))}\n </Stack>\n ))}\n </Stack>\n );\n};\n"]}
1
+ {"version":3,"file":"VideoBackgroundEffectsPicker.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAkFlF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAyC,EAAe,EAAE;;IACtG,MAAM,CAAC,oCAAoC,EAAE,uCAAuC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAEpG,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAElC,+EAA+E;IAC/E,WAAW,CAAC;QACV,IAAI,EAAE,8BAA8B;QACpC,KAAK;QACL,eAAe,EAAE;YACf,YAAY,EAAE,UAAU;YACxB,SAAS,EAAE,mBAAmB;YAC9B,gBAAgB,EAAE,0BAA0B;SAC7C;KACF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,MAAA,KA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A,KAAK,CAAC,MAAM,0CAAE,OAAO,CAAC,EAC7C,IAAI,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,EAClC,UAAU,QACV,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,gBACtB,0BAA0B;gBAEpC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACzB,IAAI,CAAC,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;wBAC9B,OAAO,CACL,oBAAC,iBAAiB,oBACZ,MAAM,IACV,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,GAAG,EAAE,MAAM,CAAC,OAAO,EACnB,YAAY,EAAE,KAAK,CAAC,YAAY,IAChC,CACH,CAAC;oBACJ,CAAC;oBACD,OAAO,oBAAC,iBAAiB,oBAAK,MAAM,IAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,OAAO,IAAI,CAAC;gBACzF,CAAC,CAAC;gBACD,SAAS,GAAG,CAAC;oBACZ,QAAQ,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC;oBACpC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAClD,oBAAC,KAAK,IACJ,GAAG,EAAE,KAAK,EACV,MAAM,EAAE,qCAAqC,gBAClC,2BAA2B,GACtC,CACH,CAAC,CACE,CACT,CAAA;SAAA,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IStyle, Label, mergeStyles, Stack } from '@fluentui/react';\nimport { useWarnings } from '@fluentui/react-hooks';\nimport React from 'react';\nimport { chunk } from '../utils';\nimport { _VideoEffectsItem, _VideoEffectsItemProps } from './VideoEffectsItem';\nimport { hiddenVideoEffectsItemContainerStyles } from './VideoEffectsItem.styles';\n\n/**\n * Props for {@link _VideoBackgroundEffectsPicker}\n * @internal\n */\nexport interface _VideoBackgroundEffectsPickerProps {\n /**\n * The options to display in the picker.\n */\n options: _VideoBackgroundEffectChoiceOption[];\n\n /**\n * The key of the current selected Video Background Effect.\n * If you provide this, you must maintain selection state by observing onChange events and passing a new value in when changed.\n */\n selectedEffectKey?: string;\n\n /**\n * Callback to invoke when a Video Background Effect is selected.\n * @param effectKey - The key of the Video Background Effect that was selected.\n */\n onChange?: (effectKey: string) => void;\n\n /**\n * The key of the Video Background Effect that is initially selected.\n * Only provide this if the picker is an uncontrolled component;\n * otherwise, use the `selectedEffectKey` property.\n */\n defaultSelectedEffectKey?: string;\n\n /**\n * The label to display for the picker.\n */\n label?: string;\n\n /**\n * The number of items to display per row.\n * @default 3\n */\n itemsPerRow?: 'wrap' | number;\n\n /**\n * Styles for the picker.\n */\n styles?: _VideoBackgroundEffectsPickerStyles;\n\n /**\n * Imperative handle for calling focus()\n */\n componentRef?: React.RefObject<{\n focus: () => void;\n }>;\n}\n\n/**\n * Option for the {@link _VideoBackgroundEffectsPicker}.\n * @internal\n */\nexport type _VideoBackgroundEffectChoiceOption = _VideoEffectsItemProps;\n\n/**\n * Styles for the {@link _VideoBackgroundEffectsPicker}.\n * @internal\n */\nexport interface _VideoBackgroundEffectsPickerStyles {\n /**\n * Styles for the root element.\n */\n root?: IStyle;\n\n /**\n * Styles for the label.\n */\n label?: IStyle;\n\n /**\n * Styles for the root of each row element.\n */\n rowRoot?: IStyle;\n}\n\n/**\n * Picker for choosing a Video Background Effect.\n *\n * @remarks\n * This functions similar to a radio group of buttons, where the user can select one of the options.\n *\n * @internal\n */\nexport const _VideoBackgroundEffectsPicker = (props: _VideoBackgroundEffectsPickerProps): JSX.Element => {\n const [componentControlledSelectedEffectKey, setComponentControlledSelectedEffectKey] = React.useState<\n string | undefined\n >(props.defaultSelectedEffectKey);\n\n // Warn the developer if they use the component in an incorrect controlled way.\n useWarnings({\n name: 'VideoBackgroundEffectsPicker',\n props,\n controlledUsage: {\n onChangeProp: 'onChange',\n valueProp: 'selectedEffectKey',\n defaultValueProp: 'defaultSelectedEffectKey'\n }\n });\n\n const selectedEffect = props.selectedEffectKey ?? componentControlledSelectedEffectKey;\n const setSelectedEffect = (selectedEffectKey: string): void => {\n setComponentControlledSelectedEffectKey(selectedEffectKey);\n props.onChange?.(selectedEffectKey);\n };\n\n const convertedOptions: _VideoEffectsItemProps[] = props.options.map((option) => ({\n isSelected: option.itemKey === selectedEffect,\n onSelect: () => setSelectedEffect(option.itemKey),\n ...option\n }));\n\n const itemsPerRow = props.itemsPerRow ?? 3;\n const optionsByRow = itemsPerRow === 'wrap' ? [convertedOptions] : chunk(convertedOptions, itemsPerRow);\n\n // If the final row is not full, fill it with hidden items to ensure layout.\n const fillCount = itemsPerRow === 'wrap' ? 0 : itemsPerRow - (optionsByRow[optionsByRow.length - 1]?.length ?? 0);\n\n return (\n <Stack tokens={{ childrenGap: '0.5rem' }}>\n <Label className={mergeStyles(props.styles?.label)}>{props.label}</Label>\n {optionsByRow.map((options, rowIndex) => (\n <Stack\n className={mergeStyles(props.styles?.rowRoot)}\n wrap={props.itemsPerRow === 'wrap'}\n horizontal\n key={rowIndex}\n tokens={{ childrenGap: '0.5rem' }}\n data-ui-id=\"video-effects-picker-row\"\n >\n {options.map((option, i) => {\n if (i === 0 && rowIndex === 0) {\n return (\n <_VideoEffectsItem\n {...option}\n itemKey={option.itemKey}\n key={option.itemKey}\n componentRef={props.componentRef}\n />\n );\n }\n return <_VideoEffectsItem {...option} itemKey={option.itemKey} key={option.itemKey} />;\n })}\n {fillCount > 0 &&\n rowIndex === optionsByRow.length - 1 &&\n Array.from({ length: fillCount }).map((_, index) => (\n <Stack\n key={index}\n styles={hiddenVideoEffectsItemContainerStyles}\n data-ui-id=\"video-effects-hidden-item\"\n />\n ))}\n </Stack>\n ))}\n </Stack>\n );\n};\n"]}
@@ -41,13 +41,13 @@ export const RemoteContentShareReactionOverlay = React.memo((props) => {
41
41
  return visibleReactionPosition.current.findIndex((item) => item === false);
42
42
  };
43
43
  const updateVisibleReactions = useCallback((reaction, userId) => {
44
- var _a;
44
+ var _a, _b;
45
45
  const combinedKey = getCombinedKey(userId, reaction.reactionType, reaction.receivedOn);
46
46
  const alreadyHandled = ((_a = latestReceivedReaction.current[userId]) === null || _a === void 0 ? void 0 : _a.id) === combinedKey;
47
47
  if (alreadyHandled) {
48
48
  return;
49
49
  }
50
- const activeCount = activeTypeCount.current[reaction.reactionType];
50
+ const activeCount = (_b = activeTypeCount.current[reaction.reactionType]) !== null && _b !== void 0 ? _b : 0;
51
51
  if (activeCount >= MAX_NUMBER_OF_EMOJIS / NUMBER_OF_EMOJI_TYPES) {
52
52
  latestReceivedReaction.current[userId] = {
53
53
  id: combinedKey,
@@ -78,8 +78,9 @@ export const RemoteContentShareReactionOverlay = React.memo((props) => {
78
78
  visibleReactionPosition.current[index] = false;
79
79
  activeTypeCount.current[reactionType] -= 1;
80
80
  Object.entries(latestReceivedReaction.current).forEach(([userId, reaction]) => {
81
- if (reaction.id === id) {
82
- latestReceivedReaction.current[userId].status = 'completedAnimating';
81
+ const userLastReaction = latestReceivedReaction.current[userId];
82
+ if (reaction.id === id && userLastReaction) {
83
+ userLastReaction.status = 'completedAnimating';
83
84
  }
84
85
  });
85
86
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteContentShareReactionOverlay.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/RemoteContentShareReactionOverlay.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BA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qB,CAAC;wBAC/D,6BACE,KAAK,EAAE,qBAAqB,CAC1B,mCAAmC,EACnC,aAAa,EAAE,EACf,MAAA,gBAAgB,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC,mCAAI,EAAE,CAC3E,GACD,CACE,CACF,CACF,CACP,CACG,CACF,CACP,CAAA;KAAA,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Reaction, ReactionResources, VideoGalleryLocalParticipant, VideoGalleryRemoteParticipant } from '../../types';\nimport { Stack, mergeStyles } from '@fluentui/react';\nimport { videoContainerStyles } from '../styles/VideoTile.styles';\nimport { getEmojiResource } from './utils/videoGalleryLayoutUtils';\nimport {\n IReactionStyleBucket,\n generateStartPositionWave,\n getReactionMovementStyle,\n getReactionStyleBucket,\n moveAnimationStyles,\n opacityAnimationStyles,\n reactionOverlayStyle,\n spriteAnimationStyles\n} from '../styles/ReactionOverlay.style';\nimport {\n REACTION_NUMBER_OF_ANIMATION_FRAMES,\n REACTION_SCREEN_SHARE_ANIMATION_TIME_MS,\n REACTION_START_DISPLAY_SIZE,\n getCombinedKey,\n getReceivedUnixTime\n} from './utils/reactionUtils';\n\ntype VisibleReaction = {\n reaction: Reaction;\n id: string;\n reactionMovementIndex: number;\n styleBucket: IReactionStyleBucket;\n};\n\ntype ReceivedReaction = {\n id: string;\n status: 'animating' | 'completedAnimating' | 'ignored';\n};\n\nconst MAX_NUMBER_OF_EMOJIS = 50;\nconst NUMBER_OF_EMOJI_TYPES = 5;\nconst REACTION_POSITION_ARRAY_SIZE = 55;\n\n/**\n * The overlay responsible for rendering multiple reactions all at once in presentation mode\n * @internal\n */\nexport const RemoteContentShareReactionOverlay = React.memo(\n (props: {\n reactionResources: ReactionResources;\n localParticipant?: VideoGalleryLocalParticipant;\n remoteParticipants?: VideoGalleryRemoteParticipant[];\n hostDivHeight?: number;\n hostDivWidth?: number;\n }) => {\n const { reactionResources, localParticipant, remoteParticipants, hostDivHeight, hostDivWidth } = props;\n\n // Reactions that are currently being animated\n const [visibleReactions, setVisibleReactions] = useState<VisibleReaction[]>([]);\n\n // Dictionary of userId to a reaction status. This is used to track the latest received reaction\n // per user to avoid animating the same reaction multiple times and to limit the number of\n // active reactions of a certain type.\n const latestReceivedReaction = useRef<Record<string, ReceivedReaction>>({});\n\n // Track the number of active reactions of each type to limit the number of active reactions\n // of a certain type.\n const activeTypeCount = useRef<Record<string, number>>({\n like: 0,\n heart: 0,\n laugh: 0,\n applause: 0,\n surprised: 0\n });\n\n // Used to track the total number of reactions ever played. This is a helper variable\n // to calculate the reaction movement index (i.e. the .left position of the reaction)\n const visibleReactionPosition = useRef<boolean[]>(new Array<boolean>(REACTION_POSITION_ARRAY_SIZE).fill(false));\n\n const remoteParticipantReactions: Reaction[] = useMemo(\n () =>\n remoteParticipants\n ?.map((remoteParticipant) => remoteParticipant.reaction)\n .filter((reaction): reaction is Reaction => !!reaction) ?? [],\n [remoteParticipants]\n );\n\n const findFirstEmptyPosition = (): number => {\n return visibleReactionPosition.current.findIndex((item) => item === false);\n };\n\n const updateVisibleReactions = useCallback(\n (reaction: Reaction, userId: string): void => {\n const combinedKey = getCombinedKey(userId, reaction.reactionType, reaction.receivedOn);\n\n const alreadyHandled = latestReceivedReaction.current[userId]?.id === combinedKey;\n if (alreadyHandled) {\n return;\n }\n\n const activeCount = activeTypeCount.current[reaction.reactionType];\n\n if (activeCount >= MAX_NUMBER_OF_EMOJIS / NUMBER_OF_EMOJI_TYPES) {\n latestReceivedReaction.current[userId] = {\n id: combinedKey,\n status: 'ignored'\n };\n return;\n }\n\n activeTypeCount.current[reaction.reactionType] += 1;\n latestReceivedReaction.current[userId] = {\n id: combinedKey,\n status: 'animating'\n };\n const reactionMovementIndex = findFirstEmptyPosition();\n visibleReactionPosition.current[reactionMovementIndex] = true;\n setVisibleReactions([\n ...visibleReactions,\n {\n reaction: reaction,\n id: combinedKey,\n reactionMovementIndex: reactionMovementIndex,\n styleBucket: getReactionStyleBucket()\n }\n ]);\n return;\n },\n [activeTypeCount, visibleReactions]\n );\n\n const removeVisibleReaction = (reactionType: string, id: string, index: number): void => {\n setVisibleReactions(visibleReactions.filter((reaction) => reaction.id !== id));\n visibleReactionPosition.current[index] = false;\n activeTypeCount.current[reactionType] -= 1;\n Object.entries(latestReceivedReaction.current).forEach(([userId, reaction]) => {\n if (reaction.id === id) {\n latestReceivedReaction.current[userId].status = 'completedAnimating';\n }\n });\n };\n\n // Update visible reactions when local participant sends a reaction\n useEffect(() => {\n if (localParticipant?.reaction) {\n updateVisibleReactions(localParticipant.reaction, localParticipant.userId);\n }\n }, [localParticipant, updateVisibleReactions]);\n\n // Update visible reactions when remote participants send a reaction\n useEffect(() => {\n remoteParticipants?.map((participant) => {\n if (participant?.reaction) {\n updateVisibleReactions(participant.reaction, participant.userId);\n }\n });\n }, [remoteParticipantReactions, remoteParticipants, updateVisibleReactions]);\n\n // Note: canRenderReaction shouldn't be needed as we remove the animation on the onAnimationEnd event\n const canRenderReaction = (reaction: Reaction, id: string, movementIndex: number): boolean => {\n // compare current time to reaction.received at and see if more than 4 seconds has elapsed\n const canRender = Date.now() - getReceivedUnixTime(reaction.receivedOn) < REACTION_SCREEN_SHARE_ANIMATION_TIME_MS;\n\n // Clean up the reaction if it's not in the visible reaction list\n if (!canRender) {\n removeVisibleReaction(reaction?.reactionType, id, movementIndex);\n }\n\n return canRender;\n };\n\n const styleBucket = (): IReactionStyleBucket => getReactionStyleBucket();\n const displaySizePx = (): number => REACTION_START_DISPLAY_SIZE * styleBucket().sizeScale;\n\n const containerHeight = hostDivHeight ?? 0;\n const containerWidth = (hostDivWidth ?? 0) - displaySizePx();\n\n const leftPosition = (position: number): number => generateStartPositionWave(position, containerWidth / 2, true);\n const reactionMovementStyle = (position: number): React.CSSProperties =>\n getReactionMovementStyle(leftPosition(position));\n\n return (\n <Stack\n className={mergeStyles(videoContainerStyles, {\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: 'transparent'\n })}\n >\n {visibleReactions.map((reaction) => (\n <div key={reaction.id} style={reactionOverlayStyle}>\n <div className=\"reaction-item\">\n {canRenderReaction(reaction.reaction, reaction.id, reaction.reactionMovementIndex) && (\n // First div - Section that fixes the travel height and applies the movement animation\n // Second div - Keeps track of active sprites and responsible for marking, counting\n // and removing reactions. Responsible for opacity controls as the sprite emoji animates\n // Third div - Responsible for calculating the point of X axis where the reaction will start animation\n // Fourth div - Play Animation as the other animation applies on the base play animation for the sprite\n <div\n style={moveAnimationStyles(\n containerHeight / 2, // dividing by two because reactionOverlayStyle height is set to 50%\n (containerHeight / 2) * (1 - reaction.styleBucket.heightMaxScale)\n )}\n >\n <div\n onAnimationEnd={() => {\n removeVisibleReaction(\n reaction.reaction.reactionType,\n reaction.id,\n reaction.reactionMovementIndex\n );\n }}\n style={opacityAnimationStyles(reaction.styleBucket.opacityMax)}\n >\n <div style={reactionMovementStyle(reaction.reactionMovementIndex)}>\n <div\n style={spriteAnimationStyles(\n REACTION_NUMBER_OF_ANIMATION_FRAMES,\n displaySizePx(),\n getEmojiResource(reaction?.reaction.reactionType, reactionResources) ?? ''\n )}\n />\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n ))}\n </Stack>\n );\n }\n);\n"]}
1
+ {"version":3,"file":"RemoteContentShareReactionOverlay.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/RemoteContentShareReactionOverlay.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO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B,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC;oBAE9D,6BAAK,KAAK,EAAE,qBAAqB,CAAC,QAAQ,CAAC,qBAAqB,CAAC;wBAC/D,6BACE,KAAK,EAAE,qBAAqB,CAC1B,mCAAmC,EACnC,aAAa,EAAE,EACf,MAAA,gBAAgB,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC,mCAAI,EAAE,CAC3E,GACD,CACE,CACF,CACF,CACP,CACG,CACF,CACP,CAAA;KAAA,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Reaction, ReactionResources, VideoGalleryLocalParticipant, VideoGalleryRemoteParticipant } from '../../types';\nimport { Stack, mergeStyles } from '@fluentui/react';\nimport { videoContainerStyles } from '../styles/VideoTile.styles';\nimport { getEmojiResource } from './utils/videoGalleryLayoutUtils';\nimport {\n IReactionStyleBucket,\n generateStartPositionWave,\n getReactionMovementStyle,\n getReactionStyleBucket,\n moveAnimationStyles,\n opacityAnimationStyles,\n reactionOverlayStyle,\n spriteAnimationStyles\n} from '../styles/ReactionOverlay.style';\nimport {\n REACTION_NUMBER_OF_ANIMATION_FRAMES,\n REACTION_SCREEN_SHARE_ANIMATION_TIME_MS,\n REACTION_START_DISPLAY_SIZE,\n getCombinedKey,\n getReceivedUnixTime\n} from './utils/reactionUtils';\n\ntype VisibleReaction = {\n reaction: Reaction;\n id: string;\n reactionMovementIndex: number;\n styleBucket: IReactionStyleBucket;\n};\n\ntype ReceivedReaction = {\n id: string;\n status: 'animating' | 'completedAnimating' | 'ignored';\n};\n\nconst MAX_NUMBER_OF_EMOJIS = 50;\nconst NUMBER_OF_EMOJI_TYPES = 5;\nconst REACTION_POSITION_ARRAY_SIZE = 55;\n\n/**\n * The overlay responsible for rendering multiple reactions all at once in presentation mode\n * @internal\n */\nexport const RemoteContentShareReactionOverlay = React.memo(\n (props: {\n reactionResources: ReactionResources;\n localParticipant?: VideoGalleryLocalParticipant;\n remoteParticipants?: VideoGalleryRemoteParticipant[];\n hostDivHeight?: number;\n hostDivWidth?: number;\n }) => {\n const { reactionResources, localParticipant, remoteParticipants, hostDivHeight, hostDivWidth } = props;\n\n // Reactions that are currently being animated\n const [visibleReactions, setVisibleReactions] = useState<VisibleReaction[]>([]);\n\n // Dictionary of userId to a reaction status. This is used to track the latest received reaction\n // per user to avoid animating the same reaction multiple times and to limit the number of\n // active reactions of a certain type.\n const latestReceivedReaction = useRef<Record<string, ReceivedReaction>>({});\n\n // Track the number of active reactions of each type to limit the number of active reactions\n // of a certain type.\n const activeTypeCount = useRef<Record<string, number>>({\n like: 0,\n heart: 0,\n laugh: 0,\n applause: 0,\n surprised: 0\n });\n\n // Used to track the total number of reactions ever played. This is a helper variable\n // to calculate the reaction movement index (i.e. the .left position of the reaction)\n const visibleReactionPosition = useRef<boolean[]>(new Array<boolean>(REACTION_POSITION_ARRAY_SIZE).fill(false));\n\n const remoteParticipantReactions: Reaction[] = useMemo(\n () =>\n remoteParticipants\n ?.map((remoteParticipant) => remoteParticipant.reaction)\n .filter((reaction): reaction is Reaction => !!reaction) ?? [],\n [remoteParticipants]\n );\n\n const findFirstEmptyPosition = (): number => {\n return visibleReactionPosition.current.findIndex((item) => item === false);\n };\n\n const updateVisibleReactions = useCallback(\n (reaction: Reaction, userId: string): void => {\n const combinedKey = getCombinedKey(userId, reaction.reactionType, reaction.receivedOn);\n\n const alreadyHandled = latestReceivedReaction.current[userId]?.id === combinedKey;\n if (alreadyHandled) {\n return;\n }\n\n const activeCount = activeTypeCount.current[reaction.reactionType] ?? 0;\n\n if (activeCount >= MAX_NUMBER_OF_EMOJIS / NUMBER_OF_EMOJI_TYPES) {\n latestReceivedReaction.current[userId] = {\n id: combinedKey,\n status: 'ignored'\n };\n return;\n }\n\n activeTypeCount.current[reaction.reactionType] += 1;\n latestReceivedReaction.current[userId] = {\n id: combinedKey,\n status: 'animating'\n };\n const reactionMovementIndex = findFirstEmptyPosition();\n visibleReactionPosition.current[reactionMovementIndex] = true;\n setVisibleReactions([\n ...visibleReactions,\n {\n reaction: reaction,\n id: combinedKey,\n reactionMovementIndex: reactionMovementIndex,\n styleBucket: getReactionStyleBucket()\n }\n ]);\n return;\n },\n [activeTypeCount, visibleReactions]\n );\n\n const removeVisibleReaction = (reactionType: string, id: string, index: number): void => {\n setVisibleReactions(visibleReactions.filter((reaction) => reaction.id !== id));\n visibleReactionPosition.current[index] = false;\n activeTypeCount.current[reactionType] -= 1;\n Object.entries(latestReceivedReaction.current).forEach(([userId, reaction]) => {\n const userLastReaction = latestReceivedReaction.current[userId];\n if (reaction.id === id && userLastReaction) {\n userLastReaction.status = 'completedAnimating';\n }\n });\n };\n\n // Update visible reactions when local participant sends a reaction\n useEffect(() => {\n if (localParticipant?.reaction) {\n updateVisibleReactions(localParticipant.reaction, localParticipant.userId);\n }\n }, [localParticipant, updateVisibleReactions]);\n\n // Update visible reactions when remote participants send a reaction\n useEffect(() => {\n remoteParticipants?.map((participant) => {\n if (participant?.reaction) {\n updateVisibleReactions(participant.reaction, participant.userId);\n }\n });\n }, [remoteParticipantReactions, remoteParticipants, updateVisibleReactions]);\n\n // Note: canRenderReaction shouldn't be needed as we remove the animation on the onAnimationEnd event\n const canRenderReaction = (reaction: Reaction, id: string, movementIndex: number): boolean => {\n // compare current time to reaction.received at and see if more than 4 seconds has elapsed\n const canRender = Date.now() - getReceivedUnixTime(reaction.receivedOn) < REACTION_SCREEN_SHARE_ANIMATION_TIME_MS;\n\n // Clean up the reaction if it's not in the visible reaction list\n if (!canRender) {\n removeVisibleReaction(reaction?.reactionType, id, movementIndex);\n }\n\n return canRender;\n };\n\n const styleBucket = (): IReactionStyleBucket => getReactionStyleBucket();\n const displaySizePx = (): number => REACTION_START_DISPLAY_SIZE * styleBucket().sizeScale;\n\n const containerHeight = hostDivHeight ?? 0;\n const containerWidth = (hostDivWidth ?? 0) - displaySizePx();\n\n const leftPosition = (position: number): number => generateStartPositionWave(position, containerWidth / 2, true);\n const reactionMovementStyle = (position: number): React.CSSProperties =>\n getReactionMovementStyle(leftPosition(position));\n\n return (\n <Stack\n className={mergeStyles(videoContainerStyles, {\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: 'transparent'\n })}\n >\n {visibleReactions.map((reaction) => (\n <div key={reaction.id} style={reactionOverlayStyle}>\n <div className=\"reaction-item\">\n {canRenderReaction(reaction.reaction, reaction.id, reaction.reactionMovementIndex) && (\n // First div - Section that fixes the travel height and applies the movement animation\n // Second div - Keeps track of active sprites and responsible for marking, counting\n // and removing reactions. Responsible for opacity controls as the sprite emoji animates\n // Third div - Responsible for calculating the point of X axis where the reaction will start animation\n // Fourth div - Play Animation as the other animation applies on the base play animation for the sprite\n <div\n style={moveAnimationStyles(\n containerHeight / 2, // dividing by two because reactionOverlayStyle height is set to 50%\n (containerHeight / 2) * (1 - reaction.styleBucket.heightMaxScale)\n )}\n >\n <div\n onAnimationEnd={() => {\n removeVisibleReaction(\n reaction.reaction.reactionType,\n reaction.id,\n reaction.reactionMovementIndex\n );\n }}\n style={opacityAnimationStyles(reaction.styleBucket.opacityMax)}\n >\n <div style={reactionMovementStyle(reaction.reactionMovementIndex)}>\n <div\n style={spriteAnimationStyles(\n REACTION_NUMBER_OF_ANIMATION_FRAMES,\n displaySizePx(),\n getEmojiResource(reaction?.reaction.reactionType, reactionResources) ?? ''\n )}\n />\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n ))}\n </Stack>\n );\n }\n);\n"]}