@viswa-test/test-citation 0.0.333 → 0.0.335

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 (341) hide show
  1. package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
  2. package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  3. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.js +2 -0
  4. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.js.map +1 -0
  5. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js +2 -0
  6. package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  7. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js +2 -0
  8. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js.map +1 -0
  9. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js +2 -0
  10. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js.map +1 -0
  11. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js +2 -0
  12. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js.map +1 -0
  13. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js +2 -0
  14. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js.map +1 -0
  15. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js +2 -0
  16. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js.map +1 -0
  17. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js +2 -0
  18. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js.map +1 -0
  19. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js +2 -0
  20. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js.map +1 -0
  21. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
  22. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  23. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  24. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
  25. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  26. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  27. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  28. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
  29. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +1 -1
  30. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +1 -1
  31. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +1 -1
  32. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +1 -1
  33. package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
  34. package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
  35. package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationContent.js +1 -1
  36. package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationContent.module.css.js +1 -1
  37. package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationRender.js +1 -1
  38. package/dist/cjs/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.js +1 -1
  39. package/dist/cjs/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.js +1 -1
  40. package/dist/cjs/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.js +1 -1
  41. package/dist/cjs/features/RequirementAI/components/segment/Segment.js +1 -1
  42. package/dist/cjs/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  43. package/dist/cjs/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
  44. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  45. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
  46. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  47. package/dist/cjs/features/RequirementAI/hooks/useStreamContentHandler.js +1 -1
  48. package/dist/cjs/features/RequirementAI/utils/helpers.js +1 -1
  49. package/dist/cjs/features/RequirementAI/utils/proccess-stream.utils.js +1 -1
  50. package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +1 -1
  51. package/dist/cjs/features/SegmentReviewComponents/CognitiveIntegrity.js +1 -1
  52. package/dist/cjs/features/SegmentReviewComponents/LabelCheck.js +1 -1
  53. package/dist/cjs/features/SegmentReviewComponents/PageCheck.js +2 -0
  54. package/dist/cjs/features/SegmentReviewComponents/PageCheck.js.map +1 -0
  55. package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
  56. package/dist/cjs/features/SegmentReviewComponents/helper.js +1 -1
  57. package/dist/cjs/features/SegmentReviewComponents/reviewStepAdapters.js +1 -1
  58. package/dist/cjs/index.js +1 -1
  59. package/dist/cjs/service/redlineService.js +1 -1
  60. package/dist/features/PdfViewer/PdfViewer.js +1 -1
  61. package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  62. package/dist/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.js +2 -0
  63. package/dist/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.js.map +1 -0
  64. package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js +2 -0
  65. package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  66. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js +2 -0
  67. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js.map +1 -0
  68. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js +2 -0
  69. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js.map +1 -0
  70. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js +2 -0
  71. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js.map +1 -0
  72. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js +2 -0
  73. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js.map +1 -0
  74. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js +2 -0
  75. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js.map +1 -0
  76. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js +2 -0
  77. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js.map +1 -0
  78. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js +2 -0
  79. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js.map +1 -0
  80. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
  81. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  82. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  83. package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
  84. package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  85. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  86. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  87. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
  88. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +1 -1
  89. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +1 -1
  90. package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +1 -1
  91. package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +1 -1
  92. package/dist/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
  93. package/dist/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
  94. package/dist/features/RequirementAI/components/citations/file-citation/FileCitationContent.js +1 -1
  95. package/dist/features/RequirementAI/components/citations/file-citation/FileCitationContent.module.css.js +1 -1
  96. package/dist/features/RequirementAI/components/citations/file-citation/FileCitationRender.js +1 -1
  97. package/dist/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.js +1 -1
  98. package/dist/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.js +1 -1
  99. package/dist/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.js +1 -1
  100. package/dist/features/RequirementAI/components/segment/Segment.js +1 -1
  101. package/dist/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  102. package/dist/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
  103. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  104. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
  105. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  106. package/dist/features/RequirementAI/hooks/useStreamContentHandler.js +1 -1
  107. package/dist/features/RequirementAI/utils/helpers.js +1 -1
  108. package/dist/features/RequirementAI/utils/proccess-stream.utils.js +1 -1
  109. package/dist/features/SegmentReviewComponents/BoundaryCard.js +1 -1
  110. package/dist/features/SegmentReviewComponents/CognitiveIntegrity.js +1 -1
  111. package/dist/features/SegmentReviewComponents/LabelCheck.js +1 -1
  112. package/dist/features/SegmentReviewComponents/PageCheck.js +2 -0
  113. package/dist/features/SegmentReviewComponents/PageCheck.js.map +1 -0
  114. package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
  115. package/dist/features/SegmentReviewComponents/helper.js +1 -1
  116. package/dist/features/SegmentReviewComponents/reviewStepAdapters.js +1 -1
  117. package/dist/index.js +1 -1
  118. package/dist/service/redlineService.js +1 -1
  119. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  120. package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
  121. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +1 -0
  122. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
  123. package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
  124. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +39 -29
  125. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
  126. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.d.ts +2 -0
  127. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.d.ts.map +1 -0
  128. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.d.ts +2 -0
  129. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.d.ts.map +1 -0
  130. package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  131. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.d.ts +10 -0
  132. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.d.ts.map +1 -0
  133. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.d.ts +17 -0
  134. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.d.ts.map +1 -0
  135. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.d.ts +23 -0
  136. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.d.ts.map +1 -0
  137. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.d.ts +3 -0
  138. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.d.ts.map +1 -0
  139. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.d.ts.map +1 -1
  140. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +1 -1
  141. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  142. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts +84 -5439
  143. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts.map +1 -1
  144. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +1 -1
  145. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  146. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts +1 -1
  147. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
  148. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +2 -2
  149. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
  150. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +19 -2
  151. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  152. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts +7 -2
  153. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts.map +1 -1
  154. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts.map +1 -1
  155. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts +15 -1
  156. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts.map +1 -1
  157. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts +2 -1
  158. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts.map +1 -1
  159. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts +3 -2
  160. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts.map +1 -1
  161. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts.map +1 -1
  162. package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationContent.d.ts +1 -0
  163. package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationContent.d.ts.map +1 -1
  164. package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationRender.d.ts +1 -0
  165. package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationRender.d.ts.map +1 -1
  166. package/dist/types/src/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.d.ts.map +1 -1
  167. package/dist/types/src/features/RequirementAI/components/common/onDemandCitationButton.d.ts +12 -0
  168. package/dist/types/src/features/RequirementAI/components/common/onDemandCitationButton.d.ts.map +1 -0
  169. package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.d.ts +3 -2
  170. package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.d.ts.map +1 -1
  171. package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.d.ts +1 -1
  172. package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.d.ts.map +1 -1
  173. package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts +3 -1
  174. package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts.map +1 -1
  175. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts +2 -1
  176. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts.map +1 -1
  177. package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalContext.d.ts +1 -0
  178. package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalContext.d.ts.map +1 -1
  179. package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.d.ts +2 -0
  180. package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.d.ts.map +1 -1
  181. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +2 -1
  182. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  183. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts +2 -1
  184. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
  185. package/dist/types/src/features/RequirementAI/hooks/useStreamContentHandler.d.ts +1 -1
  186. package/dist/types/src/features/RequirementAI/hooks/useStreamContentHandler.d.ts.map +1 -1
  187. package/dist/types/src/features/RequirementAI/interfaces/userstory.interface.d.ts +2 -0
  188. package/dist/types/src/features/RequirementAI/interfaces/userstory.interface.d.ts.map +1 -1
  189. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +3 -0
  190. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
  191. package/dist/types/src/features/RequirementAI/types/segment.type.d.ts +2 -1
  192. package/dist/types/src/features/RequirementAI/types/segment.type.d.ts.map +1 -1
  193. package/dist/types/src/features/RequirementAI/utils/helpers.d.ts +2 -0
  194. package/dist/types/src/features/RequirementAI/utils/helpers.d.ts.map +1 -1
  195. package/dist/types/src/features/RequirementAI/utils/proccess-stream.utils.d.ts.map +1 -1
  196. package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts +1 -3
  197. package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts.map +1 -1
  198. package/dist/types/src/features/SegmentReviewComponents/LabelCheck.d.ts +1 -3
  199. package/dist/types/src/features/SegmentReviewComponents/LabelCheck.d.ts.map +1 -1
  200. package/dist/types/src/features/SegmentReviewComponents/PageCheck.d.ts +51 -0
  201. package/dist/types/src/features/SegmentReviewComponents/PageCheck.d.ts.map +1 -0
  202. package/dist/types/src/features/SegmentReviewComponents/ReviewedCard.d.ts +1 -2
  203. package/dist/types/src/features/SegmentReviewComponents/ReviewedCard.d.ts.map +1 -1
  204. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts +5 -17
  205. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -1
  206. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewRedirectionTest.d.ts.map +1 -1
  207. package/dist/types/src/features/SegmentReviewComponents/helper.d.ts.map +1 -1
  208. package/dist/types/src/features/SegmentReviewComponents/index.d.ts +5 -6
  209. package/dist/types/src/features/SegmentReviewComponents/index.d.ts.map +1 -1
  210. package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts +37 -35
  211. package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts.map +1 -1
  212. package/dist/types/src/index.d.ts +2 -2
  213. package/dist/types/src/index.d.ts.map +1 -1
  214. package/dist/types/src/service/redlineService.d.ts.map +1 -1
  215. package/package.json +9 -4
  216. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js +0 -2
  217. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js.map +0 -1
  218. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +0 -2
  219. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js.map +0 -1
  220. package/dist/cjs/features/CognitiveCompare/components/GuidelineSkeletonLoader.js +0 -2
  221. package/dist/cjs/features/CognitiveCompare/components/GuidelineSkeletonLoader.js.map +0 -1
  222. package/dist/cjs/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js +0 -2
  223. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
  224. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
  225. package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
  226. package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
  227. package/dist/cjs/features/PdfViewer/nyc-components/BoundaryCard.js +0 -2
  228. package/dist/cjs/features/PdfViewer/nyc-components/BoundaryCard.js.map +0 -1
  229. package/dist/cjs/features/PdfViewer/nyc-components/CardWrapper.js +0 -2
  230. package/dist/cjs/features/PdfViewer/nyc-components/CardWrapper.js.map +0 -1
  231. package/dist/cjs/features/PdfViewer/nyc-components/CognitiveIcon.js +0 -2
  232. package/dist/cjs/features/PdfViewer/nyc-components/CognitiveIcon.js.map +0 -1
  233. package/dist/cjs/features/PdfViewer/nyc-components/LabelCheck.js +0 -2
  234. package/dist/cjs/features/PdfViewer/nyc-components/LabelCheck.js.map +0 -1
  235. package/dist/cjs/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js +0 -2
  236. package/dist/cjs/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js.map +0 -1
  237. package/dist/cjs/features/PdfViewer/nyc-components/infoAlert.js +0 -2
  238. package/dist/cjs/features/PdfViewer/nyc-components/infoAlert.js.map +0 -1
  239. package/dist/cjs/features/PdfViewer/nyc-components/reviewStepAdapters.js +0 -2
  240. package/dist/cjs/features/PdfViewer/nyc-components/reviewStepAdapters.js.map +0 -1
  241. package/dist/cjs/features/SegmentReviewComponents/ChartBreakoutCircle.js +0 -2
  242. package/dist/cjs/features/SegmentReviewComponents/ChartBreakoutCircle.js.map +0 -1
  243. package/dist/cjs/features/SegmentReviewComponents/RevertCard.js +0 -2
  244. package/dist/cjs/features/SegmentReviewComponents/RevertCard.js.map +0 -1
  245. package/dist/cjs/features/SegmentReviewComponents/RevertSuccessCard.js +0 -2
  246. package/dist/cjs/features/SegmentReviewComponents/RevertSuccessCard.js.map +0 -1
  247. package/dist/cjs/features/SegmentReviewComponents/RevertSummaryNotice.js +0 -2
  248. package/dist/cjs/features/SegmentReviewComponents/RevertSummaryNotice.js.map +0 -1
  249. package/dist/cjs/features/SegmentReviewComponents/ReviewedCard.js +0 -2
  250. package/dist/cjs/features/SegmentReviewComponents/ReviewedCard.js.map +0 -1
  251. package/dist/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js +0 -2
  252. package/dist/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js.map +0 -1
  253. package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +0 -2
  254. package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js.map +0 -1
  255. package/dist/features/CognitiveCompare/components/GuidelineSkeletonLoader.js +0 -2
  256. package/dist/features/CognitiveCompare/components/GuidelineSkeletonLoader.js.map +0 -1
  257. package/dist/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js +0 -2
  258. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
  259. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
  260. package/dist/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
  261. package/dist/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
  262. package/dist/features/PdfViewer/nyc-components/BoundaryCard.js +0 -2
  263. package/dist/features/PdfViewer/nyc-components/BoundaryCard.js.map +0 -1
  264. package/dist/features/PdfViewer/nyc-components/CardWrapper.js +0 -2
  265. package/dist/features/PdfViewer/nyc-components/CardWrapper.js.map +0 -1
  266. package/dist/features/PdfViewer/nyc-components/CognitiveIcon.js +0 -2
  267. package/dist/features/PdfViewer/nyc-components/CognitiveIcon.js.map +0 -1
  268. package/dist/features/PdfViewer/nyc-components/LabelCheck.js +0 -2
  269. package/dist/features/PdfViewer/nyc-components/LabelCheck.js.map +0 -1
  270. package/dist/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js +0 -2
  271. package/dist/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js.map +0 -1
  272. package/dist/features/PdfViewer/nyc-components/infoAlert.js +0 -2
  273. package/dist/features/PdfViewer/nyc-components/infoAlert.js.map +0 -1
  274. package/dist/features/PdfViewer/nyc-components/reviewStepAdapters.js +0 -2
  275. package/dist/features/PdfViewer/nyc-components/reviewStepAdapters.js.map +0 -1
  276. package/dist/features/SegmentReviewComponents/ChartBreakoutCircle.js +0 -2
  277. package/dist/features/SegmentReviewComponents/ChartBreakoutCircle.js.map +0 -1
  278. package/dist/features/SegmentReviewComponents/RevertCard.js +0 -2
  279. package/dist/features/SegmentReviewComponents/RevertCard.js.map +0 -1
  280. package/dist/features/SegmentReviewComponents/RevertSuccessCard.js +0 -2
  281. package/dist/features/SegmentReviewComponents/RevertSuccessCard.js.map +0 -1
  282. package/dist/features/SegmentReviewComponents/RevertSummaryNotice.js +0 -2
  283. package/dist/features/SegmentReviewComponents/RevertSummaryNotice.js.map +0 -1
  284. package/dist/features/SegmentReviewComponents/ReviewedCard.js +0 -2
  285. package/dist/features/SegmentReviewComponents/ReviewedCard.js.map +0 -1
  286. package/dist/types/node_modules/react-markdown/lib/complex-types.d.ts +0 -23
  287. package/dist/types/node_modules/react-markdown/lib/complex-types.d.ts.map +0 -1
  288. package/dist/types/src/Background.d.ts +0 -7
  289. package/dist/types/src/Background.d.ts.map +0 -1
  290. package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
  291. package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
  292. package/dist/types/src/RedlineEditorTest2.d.ts +0 -3
  293. package/dist/types/src/RedlineEditorTest2.d.ts.map +0 -1
  294. package/dist/types/src/assests/icons/ChartSplitIcon.d.ts +0 -3
  295. package/dist/types/src/assests/icons/ChartSplitIcon.d.ts.map +0 -1
  296. package/dist/types/src/commonConstants.d.ts +0 -31103
  297. package/dist/types/src/commonConstants.d.ts.map +0 -1
  298. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/guidelineTargets.d.ts +0 -3
  299. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/guidelineTargets.d.ts.map +0 -1
  300. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts +0 -19
  301. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts.map +0 -1
  302. package/dist/types/src/features/CognitiveCompare/components/GuidelineSkeletonLoader.d.ts +0 -8
  303. package/dist/types/src/features/CognitiveCompare/components/GuidelineSkeletonLoader.d.ts.map +0 -1
  304. package/dist/types/src/features/CognitiveCompare/utils/buildComparisonRows.test.d.ts +0 -2
  305. package/dist/types/src/features/CognitiveCompare/utils/buildComparisonRows.test.d.ts.map +0 -1
  306. package/dist/types/src/features/CognitiveCompare/utils/normalizeRedlineMarkdown.d.ts +0 -6
  307. package/dist/types/src/features/CognitiveCompare/utils/normalizeRedlineMarkdown.d.ts.map +0 -1
  308. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts +0 -128
  309. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts.map +0 -1
  310. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts +0 -13
  311. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts.map +0 -1
  312. package/dist/types/src/features/PdfViewer/nyc-components/BoundaryCard.d.ts +0 -59
  313. package/dist/types/src/features/PdfViewer/nyc-components/BoundaryCard.d.ts.map +0 -1
  314. package/dist/types/src/features/PdfViewer/nyc-components/CardWrapper.d.ts +0 -19
  315. package/dist/types/src/features/PdfViewer/nyc-components/CardWrapper.d.ts.map +0 -1
  316. package/dist/types/src/features/PdfViewer/nyc-components/CognitiveIcon.d.ts +0 -3
  317. package/dist/types/src/features/PdfViewer/nyc-components/CognitiveIcon.d.ts.map +0 -1
  318. package/dist/types/src/features/PdfViewer/nyc-components/LabelCheck.d.ts +0 -77
  319. package/dist/types/src/features/PdfViewer/nyc-components/LabelCheck.d.ts.map +0 -1
  320. package/dist/types/src/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.d.ts +0 -47
  321. package/dist/types/src/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.d.ts.map +0 -1
  322. package/dist/types/src/features/PdfViewer/nyc-components/index.d.ts +0 -15
  323. package/dist/types/src/features/PdfViewer/nyc-components/index.d.ts.map +0 -1
  324. package/dist/types/src/features/PdfViewer/nyc-components/infoAlert.d.ts +0 -3
  325. package/dist/types/src/features/PdfViewer/nyc-components/infoAlert.d.ts.map +0 -1
  326. package/dist/types/src/features/PdfViewer/nyc-components/reviewStepAdapters.d.ts +0 -36
  327. package/dist/types/src/features/PdfViewer/nyc-components/reviewStepAdapters.d.ts.map +0 -1
  328. package/dist/types/src/features/SegmentReviewComponents/ChartBreakoutCircle.d.ts +0 -3
  329. package/dist/types/src/features/SegmentReviewComponents/ChartBreakoutCircle.d.ts.map +0 -1
  330. package/dist/types/src/features/SegmentReviewComponents/RevertCard.d.ts +0 -37
  331. package/dist/types/src/features/SegmentReviewComponents/RevertCard.d.ts.map +0 -1
  332. package/dist/types/src/features/SegmentReviewComponents/RevertSuccessCard.d.ts +0 -9
  333. package/dist/types/src/features/SegmentReviewComponents/RevertSuccessCard.d.ts.map +0 -1
  334. package/dist/types/src/features/SegmentReviewComponents/RevertSummaryNotice.d.ts +0 -7
  335. package/dist/types/src/features/SegmentReviewComponents/RevertSummaryNotice.d.ts.map +0 -1
  336. package/dist/types/src/features/SegmentReviewComponents/helper.test.d.ts +0 -2
  337. package/dist/types/src/features/SegmentReviewComponents/helper.test.d.ts.map +0 -1
  338. package/dist/types/src/features/SegmentReviewComponents/segmentReviewEdgeCases.test.d.ts +0 -2
  339. package/dist/types/src/features/SegmentReviewComponents/segmentReviewEdgeCases.test.d.ts.map +0 -1
  340. /package/dist/cjs/features/{CognitiveCompare → RequirementAI/components/RichTextEditor/Editor}/utils/normalizeRedlineMarkdown.js.map +0 -0
  341. /package/dist/features/{CognitiveCompare → RequirementAI/components/RichTextEditor/Editor}/utils/normalizeRedlineMarkdown.js.map +0 -0
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import l,{useContext as o,useMemo as i}from"react";import{Pencil as a,Check as s,X as r,ArrowUpRight as d,Trash2 as c}from"lucide-react";import{cn as m}from"../../../UserStoryImport/lib/cn.js";import p from"./segment.module.css.js";import u from"./deleteSegmentDialog.module.css.js";import g from"./ExampleComponentWrapper.js";import y from"../ai-reasoning/AiReasoningCitationContent.js";import h from"./SegmentLoader.js";import"./segment-common.css.js";import{MarkdownStateContext as v}from"../../store/markdown-context.js";import f from"@mui/material/Dialog";import C from"@mui/material/IconButton";import S from"./DeleteSegmentsDialog.js";import x from"@mui/material/Tooltip";import b from"./EditSegmentDialog.js";const I=({id:I="Segment",label:E,children:w,segmentUUID:D,decisionStrength:N=80,aiReason:k,customStyles:j,customIcons:B,aiReasoningCitationCustomStyles:$,segmentExampleComponent:z,handleViewGlossary:L,isUpdatedSegment:W,onOpen:A,onDelete:R,onEdit:U,customDeleteStyles:M,customDeleteIcons:T,enabledSegmentActions:G})=>{var V,F;const{citationsMetadata:H,updateCitationsMetadata:K}=o(v),[O,q]=l.useState(!1),[J,P]=l.useState(!1),[Q,X]=l.useState(!1),[Y,Z]=l.useState(""),[_,ee]=l.useState(!1),{prefix:te,inner:ne}=i(()=>(e=>{const t=e.match(/^(.*?)\s*\{([^}]+)\}\s*$/);return!t||t.length<3?{prefix:"",inner:e}:{prefix:t[1].trim(),inner:t[2].trim()}})(null!=E?E:""),[E]);l.useEffect(()=>{Q||Z(ne)},[Q,ne]);const le=async()=>{if(U){const e=Y.toLowerCase();await U(e)}X(!1),ee(!1)},oe=()=>X(!1),ie=(null==T?void 0:T.editIcon)||e(a,{size:14}),ae=(null==T?void 0:T.checkIcon)||e(s,{size:16,color:"#16A34A"}),se=(null==T?void 0:T.crossIcon)||e(r,{size:16,color:"#DC2626"}),re=i(()=>H.get(D),[H,D]),de=i(()=>(null==re?void 0:re.open)||!1,[re]),ce=i(()=>re&&"loading"===re.state,[re]),me=async()=>{const e=!de;if(q(!1),console.log("citation metadata::",e,k),e&&!(null==k?void 0:k.reason)){K(D,t=>{if(t){const e={...t};return e.state="loading",e}return{open:e,state:"loading"}});try{console.log("citation metadata:: onopen"),await(null==A?void 0:A())}finally{K(D,t=>{if(t){const n={...t};return n.state="ready",n.open=e,n}return{open:e,state:"ready"}})}}else console.log("citation metadata:: else block"),K(D,t=>{if(t){const n={...t};return n.open=e,n}return{open:e,state:ce?"loading":"ready"}})};return t("div",{className:`segment-wrapper-${I} ${p.segmentWrapper}`,style:{...null==j?void 0:j.segmentWrapper,display:"inline-flex",verticalAlign:"middle"},children:[t("div",{className:`segment-${I}-container segmentContainer ${W?"updatedSegmentContainer":""}`,style:{...null==j?void 0:j.container},children:[e("span",{className:`segment-${I} segmentLabel ${W?"updatedSegmentLabel":""}`,style:{...null==j?void 0:j.label},children:W?w:E}),e("button",{className:`${p.segmentExplanationButtonContainer}`,style:{...null==j?void 0:j.buttonContainer},onClick:me,children:e(d,{className:m(W&&p.updatedChevronIcon,p.cheveronIcon),style:{...null==j?void 0:j.cheveronIcon}})})]}),de&&e(f,{open:!0,onClose:me,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",maxWidth:"xl",container:document.getElementById("#root"),children:t("div",{style:{minWidth:"50vw",paddingLeft:16,paddingRight:16,paddingTop:24,paddingBottom:24},children:[t("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[t("div",Q?{style:{display:"flex",alignItems:"center",gap:"8px"},children:[te&&e("span",{className:"segmentLabel",style:{fontSize:18,fontWeight:600,...null==j?void 0:j.label},children:te}),t("div",{className:p.editInputWrapper,style:null==j?void 0:j.editInputWrapper,children:[e("input",{value:Y,onChange:e=>Z(e.target.value),className:p.editInput,style:{...null==j?void 0:j.editInput,color:(null===(V=null==j?void 0:j.label)||void 0===V?void 0:V.color)?String(j.label.color):"#3B82F6",textTransform:"uppercase"},autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&le(),"Escape"===e.key&&oe()}}),e(C,{onClick:()=>{Y!==ne?(K(D,e=>e?{...e,open:!1}:{open:!1,state:ce?"loading":"ready"}),ee(!0)):X(!1)},size:"small",style:null==j?void 0:j.editCheckIcon,children:ae}),e(C,{onClick:oe,size:"small",style:null==j?void 0:j.editCrossIcon,children:se})]})]}:{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e("span",{className:"segmentLabel",style:{fontSize:18,fontWeight:600,...null==j?void 0:j.label},children:null!=E?E:"SEGMENT NAME"}),(null==G?void 0:G.includes("edit"))&&e(x,{title:"Edit segment",placement:"top",arrow:!0,children:e("button",{onClick:()=>X(!0),className:p.headerEditButton,style:null==j?void 0:j.editIconButton,children:ie})})]}),t("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0,...null==j?void 0:j.headerActionsContainer},children:[(null==G?void 0:G.includes("delete"))&&e(x,{title:"Delete segment",placement:"top",arrow:!0,children:t("button",{onClick:()=>{q(!1),P(!0),K(D,e=>{if(e){const t={...e};return t.open=!1,t}return{open:!1,state:ce?"loading":"ready"}})},className:u.headerDeleteButton,children:[e(c,{size:14}),"Delete"]})}),e(C,{"aria-label":"close",onClick:me,sx:e=>({padding:"4px",color:e.palette.grey[500]}),children:e(r,{size:20})})]})]}),ce?e(h,{customStyles:null==j?void 0:j.loadingSkeleton}):t(n,{children:[O&&!W&&e("div",{style:{marginBottom:16},children:e(g,{label:null!=E?E:"",segmentExampleComponent:z,customStyles:{...null==j?void 0:j.segmentExample,exampleContainer:{...null===(F=null==j?void 0:j.segmentExample)||void 0===F?void 0:F.exampleContainer,width:"100%"}},handleCancelExample:()=>{q(!1)}})}),W&&e("div",{style:{marginBottom:16},children:e("div",{className:`segment-${I}-container segmentContainer updatedSegmentContainer`,style:{...null==j?void 0:j.container},children:e("span",{className:`segment-${I} segmentLabel updatedSegmentLabel`,style:{...null==j?void 0:j.label},children:w})})}),e("div",{children:e(y,{aiReason:k,customStyles:{...$,aiReasoningContent:{...null==$?void 0:$.aiReasoningContent,headerBar:{width:"auto"}},aiReasoningAccordion:{header:{width:"auto"}}},customIcons:B,isSegmentExplanation:!0,handleViewGlossary:L?()=>{K(D,e=>{if(e){const t={...e};return t.open=!1,t}return{open:!1,state:ce?"loading":"ready"}}),null==L||L(I)}:void 0,handleViewExample:z?()=>{q(!0)}:void 0,isUpdatedSegment:W})})]})]})}),e(S,{open:J,onHide:()=>{P(!1)},customDeleteStyles:M,customDeleteIcons:T,onDelete:async e=>{await(null==R?void 0:R(e))}}),e(b,{open:_,onHide:()=>{ee(!1),X(!1)},customStyles:M,customIcons:T,onConfirm:le})]})};export{I as default};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import o,{useContext as l,useMemo as i}from"react";import{Pencil as a,Check as s,X as r,ArrowUpRight as d,Trash2 as m}from"lucide-react";import{cn as c}from"../../../UserStoryImport/lib/cn.js";import p from"./segment.module.css.js";import u from"./deleteSegmentDialog.module.css.js";import g from"./ExampleComponentWrapper.js";import y from"../ai-reasoning/AiReasoningCitationContent.js";import v from"./SegmentLoader.js";import"./segment-common.css.js";import{MarkdownStateContext as h}from"../../store/markdown-context.js";import f from"@mui/material/Dialog";import C from"@mui/material/IconButton";import S from"./DeleteSegmentsDialog.js";import x from"@mui/material/Tooltip";import b from"./EditSegmentDialog.js";const I=({id:I="Segment",label:E,children:w,segmentUUID:D,decisionStrength:N=80,aiReason:k,customStyles:j,customIcons:B,aiReasoningCitationCustomStyles:L,segmentExampleComponent:$,handleViewGlossary:z,isUpdatedSegment:W,onOpen:A,onDelete:R,onEdit:U,customDeleteStyles:M,customDeleteIcons:T,enabledSegmentActions:G,segmentDataList:V,onShowNotification:F})=>{var H,K;const{citationsMetadata:O,updateCitationsMetadata:_}=l(h),[q,J]=o.useState(!1),[P,Q]=o.useState(!1),[X,Y]=o.useState(!1),[Z,ee]=o.useState(""),[te,ne]=o.useState(!1),{prefix:oe,inner:le}=i(()=>(e=>{const t=e.match(/^(.*?)\s*\{([^}]+)\}\s*$/);return!t||t.length<3?{prefix:"",inner:e}:{prefix:t[1].trim(),inner:t[2].trim()}})(null!=E?E:""),[E]);o.useEffect(()=>{X||ee(le)},[X,le]);const ie=async()=>{if(U){const e=Z.toLowerCase();_(D,e=>e?{...e,open:!1}:{open:!1,state:pe?"loading":"ready"}),await U(e)}Y(!1),ne(!1)},ae=()=>Y(!1),se=(null==T?void 0:T.editIcon)||e(a,{size:14}),re=(null==T?void 0:T.checkIcon)||e(s,{size:16,color:"#16A34A"}),de=(null==T?void 0:T.crossIcon)||e(r,{size:16,color:"#DC2626"}),me=i(()=>O.get(D),[O,D]),ce=i(()=>(null==me?void 0:me.open)||!1,[me]),pe=i(()=>me&&"loading"===me.state,[me]),ue=async()=>{const e=!ce;if(J(!1),console.log("citation metadata::",e,k),e&&!(null==k?void 0:k.reason)){_(D,t=>{if(t){const e={...t};return e.state="loading",e}return{open:e,state:"loading"}});try{console.log("citation metadata:: onopen"),await(null==A?void 0:A())}finally{_(D,t=>{if(t){const n={...t};return n.state="ready",n.open=e,n}return{open:e,state:"ready"}})}}else console.log("citation metadata:: else block"),_(D,t=>{if(t){const n={...t};return n.open=e,n}return{open:e,state:pe?"loading":"ready"}})};return t("div",{className:`segment-wrapper-${I} ${p.segmentWrapper}`,style:{...null==j?void 0:j.segmentWrapper,display:"inline-flex",verticalAlign:"middle"},children:[t("div",{className:`segment-${I}-container segmentContainer ${W?"updatedSegmentContainer":""}`,style:{...null==j?void 0:j.container},children:[e("span",{className:`segment-${I} segmentLabel ${W?"updatedSegmentLabel":""}`,style:{...null==j?void 0:j.label},children:W?w:E}),e("button",{className:`${p.segmentExplanationButtonContainer}`,style:{...null==j?void 0:j.buttonContainer},onClick:ue,children:e(d,{className:c(W&&p.updatedChevronIcon,p.cheveronIcon),style:{...null==j?void 0:j.cheveronIcon}})})]}),ce&&e(f,{open:!0,onClose:ue,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",maxWidth:"xl",container:document.getElementById("#root"),children:t("div",{style:{minWidth:"50vw",paddingLeft:16,paddingRight:16,paddingTop:24,paddingBottom:24},children:[t("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[t("div",X?{style:{display:"flex",alignItems:"center",gap:"8px"},children:[oe&&e("span",{className:"segmentLabel",style:{fontSize:18,fontWeight:600,...null==j?void 0:j.label},children:oe}),t("div",{className:p.editInputWrapper,style:null==j?void 0:j.editInputWrapper,children:[e("input",{value:Z,onChange:e=>ee(e.target.value),className:p.editInput,style:{...null==j?void 0:j.editInput,color:(null===(H=null==j?void 0:j.label)||void 0===H?void 0:H.color)?String(j.label.color):"#3B82F6",textTransform:"uppercase"},autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&ie(),"Escape"===e.key&&ae()}}),e(C,{onClick:()=>{if(Z===le||""===Z.trim())return void Y(!1);const e=Z.toLowerCase().trim();if(null==V?void 0:V.some(t=>t.segment_name.toLowerCase().trim()===e))return null==F||F("error","Error","Segment name already exists!"),_(D,e=>e?{...e,open:!1}:{open:!1,state:pe?"loading":"ready"}),void Y(!1);ne(!0)},size:"small",style:null==j?void 0:j.editCheckIcon,children:re}),e(C,{onClick:ae,size:"small",style:null==j?void 0:j.editCrossIcon,children:de})]})]}:{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e("span",{className:"segmentLabel",style:{fontSize:18,fontWeight:600,...null==j?void 0:j.label},children:null!=E?E:"SEGMENT NAME"}),(null==G?void 0:G.includes("edit"))&&e(x,{title:"Edit segment",placement:"top",arrow:!0,children:e("button",{onClick:()=>Y(!0),className:p.headerEditButton,style:null==j?void 0:j.editIconButton,children:se})})]}),t("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0,...null==j?void 0:j.headerActionsContainer},children:[(null==G?void 0:G.includes("delete"))&&e(x,{title:"Delete segment",placement:"top",arrow:!0,children:t("button",{onClick:()=>{J(!1),Q(!0),_(D,e=>{if(e){const t={...e};return t.open=!1,t}return{open:!1,state:pe?"loading":"ready"}})},className:u.headerDeleteButton,children:[e(m,{size:14}),"Delete"]})}),e(C,{"aria-label":"close",onClick:ue,sx:e=>({padding:"4px",color:e.palette.grey[500]}),children:e(r,{size:20})})]})]}),pe?e(v,{customStyles:null==j?void 0:j.loadingSkeleton}):t(n,{children:[q&&!W&&e("div",{style:{marginBottom:16},children:e(g,{label:null!=E?E:"",segmentExampleComponent:$,customStyles:{...null==j?void 0:j.segmentExample,exampleContainer:{...null===(K=null==j?void 0:j.segmentExample)||void 0===K?void 0:K.exampleContainer,width:"100%"}},handleCancelExample:()=>{J(!1)}})}),W&&e("div",{style:{marginBottom:16},children:e("div",{className:`segment-${I}-container segmentContainer updatedSegmentContainer`,style:{...null==j?void 0:j.container},children:e("span",{className:`segment-${I} segmentLabel updatedSegmentLabel`,style:{...null==j?void 0:j.label},children:w})})}),e("div",{children:e(y,{aiReason:k,customStyles:{...L,aiReasoningContent:{...null==L?void 0:L.aiReasoningContent,headerBar:{width:"auto"}},aiReasoningAccordion:{header:{width:"auto"}}},customIcons:B,isSegmentExplanation:!0,handleViewGlossary:z?()=>{_(D,e=>{if(e){const t={...e};return t.open=!1,t}return{open:!1,state:pe?"loading":"ready"}}),null==z||z(I)}:void 0,handleViewExample:$?()=>{J(!0)}:void 0,isUpdatedSegment:W})})]})]})}),e(S,{open:P,onHide:()=>{Q(!1)},customDeleteStyles:M,customDeleteIcons:T,onDelete:async e=>{await(null==R?void 0:R(e))}}),e(b,{open:te,onHide:()=>{ne(!1),Y(!1)},customStyles:M,customIcons:T,onConfirm:ie})]})};export{I as default};
2
2
  //# sourceMappingURL=Segment.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import n from"./Segment.js";import t from"dompurify";const o=({id:o,children:l,props:i,segmentComponentConfig:d,customStyles:s,customIcons:a,extractText:u,isUpdatedSegment:r=!1,blockId:v,customDeleteStyles:m,customDeleteIcons:g})=>{var c,p,S,h,I,C,y,D,b,f,x,_,E,U,W,k,A,F,L;const w=(null==i?void 0:i.id)||"Segment",R=(null==i?void 0:i.decisionstrength)||"80",{segmentDataList:j,getSegmentExampleComponent:B,handleViewGlossary:G,upadatedSegmentDataList:O,handleFetchUpdatedSegmentDetails:T,handleFetchSegmentDetails:V,handleDeleteSegment:z,handleEditSegment:H,enabledSegmentActions:M}=d||{},q=r?null==O?void 0:O.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==w?void 0:w.split("-"))||void 0===n?void 0:n[0])}):null==j?void 0:j.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==w?void 0:w.split("-"))||void 0===n?void 0:n[0])}),J={id:w,reason:null!==(c=null==q?void 0:q.reason)&&void 0!==c?c:"",gap:null!==(p=null==q?void 0:q.gap)&&void 0!==p?p:"",explanation:null!==(S=null==q?void 0:q.explanation)&&void 0!==S?S:"",relevance_score:null!==(h=null==q?void 0:q.relevance_score)&&void 0!==h?h:0,isOpen:!1};let K;const N=u(l),P=i["data-table"];let Q="";if(P&&!r)try{Q=decodeURIComponent(atob(P))}catch(e){console.error("Failed to decode data-table for segment",w,e)}const X=t.sanitize(Q),Y=()=>e("div",{dangerouslySetInnerHTML:{__html:X}});return q||!V||r||null==V||V(w),w&&q&&B&&!r&&(K=P?e(Y,{}):B(w,N,q.segment_type)),e(n,{id:w,segmentUUID:o,label:null!==(I=null==q?void 0:q.label)&&void 0!==I?I:null==q?void 0:q.segment_name,decisionStrength:R,aiReason:J,customIcons:a,aiReasoningCitationCustomStyles:s,segmentExampleComponent:K,handleViewGlossary:G,customStyles:{segmentWrapper:null===(C=null==s?void 0:s.segment)||void 0===C?void 0:C.segmentWrapper,container:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.container,label:null===(D=null==s?void 0:s.segment)||void 0===D?void 0:D.label,decisionStrength:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.decisionStrength,buttonContainer:null===(f=null==s?void 0:s.segment)||void 0===f?void 0:f.buttonContainer,cheveronIcon:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.cheveronIcon,segmentExample:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.segmentExample,loadingSkeleton:null===(E=null==s?void 0:s.segment)||void 0===E?void 0:E.SegmentLoadingSkeletonStyles,editInputWrapper:null===(U=null==s?void 0:s.segment)||void 0===U?void 0:U.editInputWrapper,editInput:null===(W=null==s?void 0:s.segment)||void 0===W?void 0:W.editInput,editCheckIcon:null===(k=null==s?void 0:s.segment)||void 0===k?void 0:k.editCheckIcon,editCrossIcon:null===(A=null==s?void 0:s.segment)||void 0===A?void 0:A.editCrossIcon,headerActionsContainer:null===(F=null==s?void 0:s.segment)||void 0===F?void 0:F.headerActionsContainer,editIconButton:null===(L=null==s?void 0:s.segment)||void 0===L?void 0:L.editIconButton},isUpdatedSegment:r,onOpen:async()=>{!q&&r&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),await(null==T?void 0:T(w)))},onDelete:e=>{if(console.log("SegmentWrapper: onDelete",e,{...q,segment_uuid:w},v),q)return null==z?void 0:z(e,{...q,segment_uuid:w},v)},onEdit:e=>{if(console.log("SegmentWrapper: onEdit",q,e),q&&H)return null==H?void 0:H(q,e)},customDeleteStyles:m,customDeleteIcons:g,enabledSegmentActions:M,children:l},w)};export{o as default};
1
+ import{jsx as e}from"react/jsx-runtime";import n from"./Segment.js";import t from"dompurify";const o=({id:o,children:l,props:i,segmentComponentConfig:d,customStyles:s,customIcons:a,extractText:u,isUpdatedSegment:r=!1,blockId:m,storyId:v,customDeleteStyles:g,customDeleteIcons:c})=>{var p,S,h,I,C,f,y,D,b,x,_,E,U,W,k,w,L,A,F;const R=(null==i?void 0:i.id)||"Segment",j=(null==i?void 0:i.decisionstrength)||"80",{segmentDataList:B,getSegmentExampleComponent:G,handleViewGlossary:N,upadatedSegmentDataList:O,handleFetchUpdatedSegmentDetails:T,handleFetchSegmentDetails:V,handleDeleteSegment:z,handleEditSegment:H,enabledSegmentActions:M,onShowNotification:q}=d||{},J=r?null==O?void 0:O.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==R?void 0:R.split("-"))||void 0===n?void 0:n[0])}):null==B?void 0:B.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==R?void 0:R.split("-"))||void 0===n?void 0:n[0])}),K={id:R,reason:null!==(p=null==J?void 0:J.reason)&&void 0!==p?p:"",gap:null!==(S=null==J?void 0:J.gap)&&void 0!==S?S:"",explanation:null!==(h=null==J?void 0:J.explanation)&&void 0!==h?h:"",relevance_score:null!==(I=null==J?void 0:J.relevance_score)&&void 0!==I?I:0,isOpen:!1};let P;const Q=u(l),X=i["data-table"];let Y="";if(X&&!r)try{Y=decodeURIComponent(atob(X))}catch(e){console.error("Failed to decode data-table for segment",R,e)}const Z=t.sanitize(Y),$=()=>e("div",{dangerouslySetInnerHTML:{__html:Z}});return J||!V||r||null==V||V(R),R&&J&&G&&!r&&(P=X?e($,{}):G(R,Q,J.segment_type)),e(n,{id:R,segmentUUID:o,label:null!==(C=null==J?void 0:J.label)&&void 0!==C?C:null==J?void 0:J.segment_name,decisionStrength:j,aiReason:K,customIcons:a,aiReasoningCitationCustomStyles:s,segmentExampleComponent:P,handleViewGlossary:N,customStyles:{segmentWrapper:null===(f=null==s?void 0:s.segment)||void 0===f?void 0:f.segmentWrapper,container:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.container,label:null===(D=null==s?void 0:s.segment)||void 0===D?void 0:D.label,decisionStrength:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.decisionStrength,buttonContainer:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.buttonContainer,cheveronIcon:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.cheveronIcon,segmentExample:null===(E=null==s?void 0:s.segment)||void 0===E?void 0:E.segmentExample,loadingSkeleton:null===(U=null==s?void 0:s.segment)||void 0===U?void 0:U.SegmentLoadingSkeletonStyles,editInputWrapper:null===(W=null==s?void 0:s.segment)||void 0===W?void 0:W.editInputWrapper,editInput:null===(k=null==s?void 0:s.segment)||void 0===k?void 0:k.editInput,editCheckIcon:null===(w=null==s?void 0:s.segment)||void 0===w?void 0:w.editCheckIcon,editCrossIcon:null===(L=null==s?void 0:s.segment)||void 0===L?void 0:L.editCrossIcon,headerActionsContainer:null===(A=null==s?void 0:s.segment)||void 0===A?void 0:A.headerActionsContainer,editIconButton:null===(F=null==s?void 0:s.segment)||void 0===F?void 0:F.editIconButton},isUpdatedSegment:r,onOpen:async()=>{!J&&r&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),await(null==T?void 0:T(R)))},onDelete:e=>{if(console.log("SegmentWrapper: onDelete",e,{...J,segment_uuid:R},v,m),J)return null==z?void 0:z(e,{...J,segment_uuid:R},v,m)},onEdit:e=>{if(console.log("SegmentWrapper: onEdit",J,e),J&&H)return null==H?void 0:H(J,e)},customDeleteStyles:g,customDeleteIcons:c,enabledSegmentActions:M,segmentDataList:B,onShowNotification:(e,n,t)=>{q&&q(e,n,t)},children:l},R)};export{o as default};
2
2
  //# sourceMappingURL=SegmentWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as n,useCallback as r,useMemo as i,useEffect as a}from"react";import s from"showdown";import{useRequirementAI as d}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{createUserStoriesForApproval as c,cloneUserStories as u}from"../../utils/userstory-approval-transform.utils.js";import{getFirstNonApprovedSegmentId as v,getFirstUnapprovedStoryId as p,approveAllSegments as m}from"../../utils/userstory-approval.utils.js";import{useApprovalStatus as h}from"../../hooks/useApprovalStatus.js";import{ContentSegment as S}from"./components/ContentSegment/ContentSegment.js";import{ApprovalBadge as y}from"./components/ApprovalBadge/ApprovalBadge.js";import g from"./UserStoryApprovalScreen.module.css.js";import{CheckIcon as f}from"../../icons/CheckIcon.js";import{BookmarkIcon as b}from"../../icons/BookmarkIcon.js";import{ApprovalSidebar as I}from"./components/ApprovalSidebar/ApprovalSidebar.js";import{ExternalLink as C,Download as A,Share2 as w,Copy as E,SidebarOpenIcon as N,SidebarCloseIcon as U}from"lucide-react";import{UserStoryApprovalScreenContext as x,useUserStoryApprovalScreen as T}from"./UserStoryApprovalContext.js";import{BigEnoughPanel as k}from"../story-screen/BigEnoughPanel.js";import B from"../../icons/BigEnoughIcon.js";import{Menu as D,MenuItem as F}from"@mui/material";import{formatMarkdown as j}from"../../utils/helpers.js";import{replaceTitleSection as P}from"../../utils/user-story.utils.js";const M={showApproveAllButton:!0,allowEditing:!0,allowDeletion:!0,showSidebar:!1,containerHeight:"calc(100vh - 100px)",useFullWidth:!1},_={approveAll:"Approve All",approved:"Approved",approve:"Approve",correctMe:"Correct Me",delete:"Delete",save:"Save",cancel:"Cancel",savingArtifact:"Saving Artifact...",artifactSavedTitle:"Artifact Saved Successfully",artifactSavedMessage:"Your changes have been saved.",saveFailedTitle:"Failed to Save the Artifact",saveFailedMessage:"An error occurred while saving your changes.",emptyContentWarning:"Saving empty content is not allowed",unsavedChangesWarning:"Please save the updated changes to proceed with Approve All"},R=Object.assign(({artifactTitleIds:o,config:t={},callbacks:s={},labels:m={},isDisabled:S=!1,children:y,classNames:f,selectedArtifactId:b})=>{var I;const{userStory:C,customStyles:A}=d(),w={...M,...t},E={..._,...m},[N,U]=l([]),[T,k]=l(""),[B,D]=l(""),[F,j]=l(!1),[P,R]=l(!0),z=n(void 0),W=r((e,o,t,l)=>{s.onShowNotification?s.onShowNotification(e,o,t,l):console.log(`[${e.toUpperCase()}] ${o}: ${t}`)},[s]),$=r(e=>{s.onScrollToElement?s.onScrollToElement(e):(e.style.scrollMarginTop="20px",e.scrollIntoView({behavior:"smooth",block:"start"}))},[s]),L=i(()=>{const e=N.findIndex(e=>e.artifactId===T);return e>=0?e:0},[N,T]),O=N[L];a(()=>{z.current=O},[O]),a(()=>{var e;if(!(null==C?void 0:C.length))return;null===(e=s.onInitialize)||void 0===e||e.call(s),1===C.length&&R(!1),C.length>0&&!T&&k(b||C[0].artifactId);const o=c(u(C));U(o)},[C,b]),a(()=>{b&&b!==T&&k(b)},[b,T]),a(()=>{if(!O)return;const e=v(O,"");D(e)},[null==O?void 0:O.artifactId]);const V=r((e,o)=>{U(t=>{const l=[...t];if("APPROVED"===o.approval_status&&"APPROVED"!==t[e].approval_status){const e=p(t,o.artifactId);e&&k(e)}return l[e]=o,l})},[]),q=r(e=>{const o=z.current;if(!o)return;const t=v(o,e);"NA"!==t&&(D(""),setTimeout(()=>{D(t)},0))},[]);h({userStoryForApproval:N,selectedUserStoryForApproval:O,userStoryIndex:L,callbacks:s,labels:E,onSaveUserStory:V});const H={height:w.containerHeight,...w.useFullWidth?{width:"100%",marginLeft:0,marginRight:0}:{width:"calc(100% + 40px)",marginLeft:"-20px",marginRight:"-20px"}},G={userStoryForApproval:N,setUserStoryForApproval:U,selectedStoryArtifactId:T,setSelectedStoryArtifactId:k,selectedUserStoryIndex:L,selectedUserStoryForApproval:O,currentContentId:B,setCurrentContentId:D,isEditingSegment:F,setIsEditingSegment:j,isSidebarExpanded:P,setIsSidebarExpanded:R,artifactTitleIds:o,config:w,labels:E,callbacks:s,isDisabled:S,handleSaveUserStory:V,handleUpdateContentId:q,showNotification:W,scrollToElement:$};return e(x.Provider,{value:G,children:e("div",{className:`${g.container} ${(null==f?void 0:f.container)||""}`,style:{...H,...null===(I=null==A?void 0:A.approvalScreen)||void 0===I?void 0:I.wrapperContainer},children:y})})},{Sidebar:({Component:o,config:t,className:l})=>{const{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:i,userStoryForApproval:a,isEditingSegment:s,artifactTitleIds:d}=T();return o?e(o,{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:i,userStoryForApproval:a,isEditingAnUserStorySegment:s,artifactTitleIds:d}):e(I,{config:t,className:l})},SidebarToggle:({OpenIcon:o,CloseIcon:t,className:l=""})=>{const{isSidebarExpanded:n,setIsSidebarExpanded:r}=T(),i=o||N,a=t||U;return e("div",{className:`${g.sidebarToggleWrapper} ${l}`,children:e("button",{onClick:()=>r(e=>!e),className:g.sidebarToggleBtn,"aria-label":n?"Collapse sidebar":"Expand sidebar",type:"button",children:e(n?a:i,{})})})},Content:({children:i,ButtonComponent:a,hideApproveAll:c=!1,pageTitle:u="Review Generated Requirements",showShareIcon:v=!1,handleDownloadUserStory:p,handleOpenSendDialog:h,pageDescription:S="This page displays automatically generated requirements for your project. Use this screen to review, refine, correct, or approve all generated requirements."})=>{var I,N,U,x,M,_,R,z,W,$,L,O,V,q,H,G,Y,J,K,Q,X,Z,ee,oe,te,le,ne,re,ie,ae,se;const{selectedUserStoryForApproval:de,selectedUserStoryIndex:ce,artifactTitleIds:ue,labels:ve,config:pe,isDisabled:me,isEditingSegment:he,handleSaveUserStory:Se,setCurrentContentId:ye,showNotification:ge}=T(),{userStory:fe,setUserStory:be}=d(),Ie=fe[0],[Ce,Ae]=l(null),we=()=>{Ae(null)},Ee=n(null),[Ne,Ue]=l(!1),{customStyles:xe,customIcons:Te}=d(),ke=null==xe?void 0:xe.userStoryCardStyles,[Be,De]=l(!1),Fe=r(()=>{if(!de)return;if(he)return void ge("warn","Warning!",ve.unsavedChangesWarning,3e3);const e=m(de);Se(ce,e),ye("")},[de,ce,he,ve,Se,ye,ge]);if(!de)return null;const je=ue[ce]||"",Pe="APPROVED"===de.approval_status,Me=null!=(null==de?void 0:de.big_enough)&&!Number.isNaN(de.big_enough)&&!!(null==de?void 0:de.big_enough_decision_factors);return o("div",{className:g.content,style:{...null===(N=null===(I=null==xe?void 0:xe.approvalScreen)||void 0===I?void 0:I.content)||void 0===N?void 0:N.content},"data-lsc-ui-page-title":u,"data-lsc-ui-page-description":S,children:[o("div",{className:g.header,style:{...null===(M=null===(x=null===(U=null==xe?void 0:xe.approvalScreen)||void 0===U?void 0:U.body)||void 0===x?void 0:x.contentSegment)||void 0===M?void 0:M.header},children:[o("div",{className:g.headerLeft,style:{...null===(R=null===(_=null==xe?void 0:xe.approvalScreen)||void 0===_?void 0:_.content)||void 0===R?void 0:R.headerLeft},children:[o("div",{className:g.headerMeta,style:{...null===($=null===(W=null===(z=null==xe?void 0:xe.approvalScreen)||void 0===z?void 0:z.body)||void 0===W?void 0:W.contentSegment)||void 0===$?void 0:$.headerMeta},children:[e(b,{size:16,color:(null===(V=null===(O=null===(L=null==xe?void 0:xe.approvalScreen)||void 0===L?void 0:L.body)||void 0===O?void 0:O.contentSegment)||void 0===V?void 0:V.bookMarkColor)||"#8C8C8C"}),e("h2",{className:g.headerArtifactId,style:{...null===(G=null===(H=null===(q=null==xe?void 0:xe.approvalScreen)||void 0===q?void 0:q.body)||void 0===H?void 0:H.contentSegment)||void 0===G?void 0:G.headerArtifactId},children:je})]}),e("p",{className:g.headerTitle,style:{...null===(K=null===(J=null===(Y=null==xe?void 0:xe.approvalScreen)||void 0===Y?void 0:Y.body)||void 0===J?void 0:J.contentSegment)||void 0===K?void 0:K.headerTitle},children:null==de?void 0:de.title})]}),o("div",{className:null==g?void 0:g.containerStyle,style:null===(X=null===(Q=null==xe?void 0:xe.approvalScreen)||void 0===Q?void 0:Q.BigEnoughStyles)||void 0===X?void 0:X.containerStyle,children:[Me&&e("button",{className:g.developerEffortButton,style:null===(ee=null===(Z=null==xe?void 0:xe.approvalScreen)||void 0===Z?void 0:Z.BigEnoughStyles)||void 0===ee?void 0:ee.buttonStyle,onClick:()=>De(!Be),children:e(B,{color:null===(te=null===(oe=null==xe?void 0:xe.approvalScreen)||void 0===oe?void 0:oe.BigEnoughStyles)||void 0===te?void 0:te.iconColor,size:null===(ne=null===(le=null==xe?void 0:xe.approvalScreen)||void 0===le?void 0:le.BigEnoughStyles)||void 0===ne?void 0:ne.iconSize})}),v&&o(t,{children:[e("button",{className:g.iconButton,style:null==ke?void 0:ke.iconButton,onClick:e=>{Ae(e.currentTarget)},children:e(C,{size:16})}),o(D,{id:"user-story-share-menu",anchorEl:Ce,open:!!Ce,onClose:()=>Ae(null),style:null==ke?void 0:ke.userStoryShareMenu,children:[e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{Ue(!0),p&&(await Promise.all([p("pdf"),p("doc")]),Ue(!1))},children:o("div",{ref:Ee,className:g.menuItemContent,style:null==ke?void 0:ke.menuItemContent,children:[e(A,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Download"})]})}),e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{let e=Ie;e={...Ie,value:`${P(null==Ie?void 0:Ie.value,Ie.title)}`},null==h||h(!0,[e],Ie.artifactId),we()},children:o("div",{style:null==ke?void 0:ke.menuItemContent,className:g.menuItemContentPadded,children:[e(w,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Send"})]})}),e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{const e=(new s.Converter).makeHtml(j(Ie.value)||Ie.value),o=function(e){const o=(new s.Converter).makeHtml(e),t=document.createElement("div");return t.innerHTML=o,t.textContent||t.innerText||""}(j(Ie.value)||Ie.value),t=new ClipboardItem({"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([t]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{we()}},children:o("div",{style:null==ke?void 0:ke.menuItemContent,className:g.menuItemContentPadded,children:[e(E,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Copy"})]})})]})]}),!c&&pe.showApproveAllButton&&e("div",{className:g.headerRight,children:Pe?e(y,{status:"APPROVED",label:ve.approved}):a?e(a,{type:"fill",onClick:Fe,isDisable:me,className:g.approveAllButton,overrideStyles:!0,lscUIAgent:{id:"approve-all",lscUIType:"button",lscUILabel:ve.approveAll,lscUIDescription:"Clicks this button to approve all generated requirements on the page in a single action.",lscUIWhenToApply:"Apply when the user wants to accept all requirements without reviewing them individually, or when they say phrases like 'approve everything', 'finalize all', 'accept all', or 'this looks good, approve all'."},children:o("div",{className:g.approveAllContent,children:[e(f,{size:16,color:"white"}),e("span",{children:ve.approveAll})]})}):o("button",{onClick:Fe,disabled:me,className:g.approveAllButtonDefault,style:{...null===(ie=null===(re=null==xe?void 0:xe.approvalScreen)||void 0===re?void 0:re.content)||void 0===ie?void 0:ie.approveAllButtonDefault},children:[e(f,{size:16,color:"white"}),e("span",{children:ve.approveAll})]})})]})]}),Be&&Me&&e("div",{className:g.bigEnoughWrapper,children:e(k,{customIcons:null==Te?void 0:Te.userStoryIcons,customStyles:null===(ae=null==xe?void 0:xe.approvalScreen)||void 0===ae?void 0:ae.aiReasoningCitaionStyles,currentUserStory:de,panelStyles:null===(se=null==xe?void 0:xe.approvalScreen)||void 0===se?void 0:se.BigEnoughStyles,showPanel:Be})}),i]})},Body:({children:t,EditorComponent:l,ViewerComponent:n,handleDownloadUserStory:i,handleOpenSendDialog:a,showShareIcon:s=!1})=>{var c,u,v;const{selectedUserStoryForApproval:p,selectedUserStoryIndex:m,artifactTitleIds:h,handleSaveUserStory:y}=T(),{customStyles:f}=d(),b=r(e=>{y(m,e)},[m,y]),I=r((e,o)=>{var t;if(!p)return;const l={...p,sub_features:null===(t=p.sub_features)||void 0===t?void 0:t.map((t,l)=>l===e?o:t)};y(m,l)},[p,m,y]),C=r(e=>{var o;if(!p)return;const t={...p,sub_features:null===(o=p.sub_features)||void 0===o?void 0:o.filter((o,t)=>t!==e)};y(m,t)},[p,m,y]);if(!p)return null;const A=h[m]||"";return o("div",{className:g.body,style:{...null===(u=null===(c=null==f?void 0:f.approvalScreen)||void 0===c?void 0:c.body)||void 0===u?void 0:u.container},children:[e(S,{userStoryForApproval:p,artifactTitleId:A,onSaveMainStoryContent:b,EditorComponent:l,ViewerComponent:n}),null===(v=p.sub_features)||void 0===v?void 0:v.map((o,t)=>e(S,{userStoryForApproval:o,artifactTitleId:`${A} - ${String.fromCharCode(65+t)}`,isSubFeature:!0,subFeatureIndex:t,onSaveSubFeature:I,onDeleteSubFeature:C,EditorComponent:l,ViewerComponent:n,handleDownloadUserStory:i,handleOpenSendDialog:a,showShareIcon:s},o.artifactId)),t]})}});export{R as default};
1
+ import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as n,useCallback as r,useMemo as i,useEffect as a}from"react";import s from"showdown";import{useRequirementAI as d}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{createUserStoriesForApproval as c,cloneUserStories as u}from"../../utils/userstory-approval-transform.utils.js";import{getFirstNonApprovedSegmentId as v,getFirstUnapprovedStoryId as p,approveAllSegments as m}from"../../utils/userstory-approval.utils.js";import{useApprovalStatus as h}from"../../hooks/useApprovalStatus.js";import{ContentSegment as S}from"./components/ContentSegment/ContentSegment.js";import{ApprovalBadge as y}from"./components/ApprovalBadge/ApprovalBadge.js";import g from"./UserStoryApprovalScreen.module.css.js";import{CheckIcon as f}from"../../icons/CheckIcon.js";import{BookmarkIcon as b}from"../../icons/BookmarkIcon.js";import{ApprovalSidebar as I}from"./components/ApprovalSidebar/ApprovalSidebar.js";import{ExternalLink as C,Download as A,Share2 as w,Copy as E,SidebarOpenIcon as N,SidebarCloseIcon as U}from"lucide-react";import{UserStoryApprovalScreenContext as x,useUserStoryApprovalScreen as T}from"./UserStoryApprovalContext.js";import{BigEnoughPanel as k}from"../story-screen/BigEnoughPanel.js";import B from"../../icons/BigEnoughIcon.js";import{Menu as D,MenuItem as F,Tooltip as j}from"@mui/material";import{formatMarkdown as P}from"../../utils/helpers.js";import{replaceTitleSection as R}from"../../utils/user-story.utils.js";const M={showApproveAllButton:!0,allowEditing:!0,allowDeletion:!0,showSidebar:!1,containerHeight:"calc(100vh - 100px)",useFullWidth:!1},_={approveAll:"Approve All",approved:"Approved",approve:"Approve",correctMe:"Correct Me",delete:"Delete",save:"Save",cancel:"Cancel",savingArtifact:"Saving Artifact...",artifactSavedTitle:"Artifact Saved Successfully",artifactSavedMessage:"Your changes have been saved.",saveFailedTitle:"Failed to Save the Artifact",saveFailedMessage:"An error occurred while saving your changes.",emptyContentWarning:"Saving empty content is not allowed",unsavedChangesWarning:"Please save the updated changes to proceed with Approve All"},z=Object.assign(({artifactTitleIds:o,config:t={},callbacks:s={},labels:m={},isDisabled:S=!1,disabledReason:y="",children:f,classNames:b,selectedArtifactId:I})=>{var C;const{userStory:A,customStyles:w}=d(),E={...M,...t},N={..._,...m},[U,T]=l([]),[k,B]=l(""),[D,F]=l(""),[j,P]=l(!1),[R,z]=l(!0),W=n(void 0),$=r((e,o,t,l)=>{s.onShowNotification?s.onShowNotification(e,o,t,l):console.log(`[${e.toUpperCase()}] ${o}: ${t}`)},[s]),L=r(e=>{s.onScrollToElement?s.onScrollToElement(e):(e.style.scrollMarginTop="20px",e.scrollIntoView({behavior:"smooth",block:"start"}))},[s]),O=i(()=>{const e=U.findIndex(e=>e.artifactId===k);return e>=0?e:0},[U,k]),V=U[O];a(()=>{W.current=V},[V]),a(()=>{var e;if(!(null==A?void 0:A.length))return;null===(e=s.onInitialize)||void 0===e||e.call(s),1===A.length&&z(!1),A.length>0&&!k&&B(I||A[0].artifactId);const o=c(u(A));T(o)},[A,I]),a(()=>{I&&I!==k&&B(I)},[I,k]),a(()=>{if(!V)return;const e=v(V,"");F(e)},[null==V?void 0:V.artifactId]);const q=r((e,o)=>{T(t=>{const l=[...t];if("APPROVED"===o.approval_status&&"APPROVED"!==t[e].approval_status){const e=p(t,o.artifactId);e&&B(e)}return l[e]=o,l})},[]),H=r(e=>{const o=W.current;if(!o)return;const t=v(o,e);"NA"!==t&&(F(""),setTimeout(()=>{F(t)},0))},[]);h({userStoryForApproval:U,selectedUserStoryForApproval:V,userStoryIndex:O,callbacks:s,labels:N,onSaveUserStory:q});const G={height:E.containerHeight,...E.useFullWidth?{width:"100%",marginLeft:0,marginRight:0}:{width:"calc(100% + 40px)",marginLeft:"-20px",marginRight:"-20px"}},Y={userStoryForApproval:U,setUserStoryForApproval:T,selectedStoryArtifactId:k,setSelectedStoryArtifactId:B,selectedUserStoryIndex:O,selectedUserStoryForApproval:V,currentContentId:D,setCurrentContentId:F,isEditingSegment:j,setIsEditingSegment:P,isSidebarExpanded:R,setIsSidebarExpanded:z,artifactTitleIds:o,config:E,labels:N,callbacks:s,isDisabled:S,disabledReason:y,handleSaveUserStory:q,handleUpdateContentId:H,showNotification:$,scrollToElement:L};return e(x.Provider,{value:Y,children:e("div",{className:`${g.container} ${(null==b?void 0:b.container)||""}`,style:{...G,...null===(C=null==w?void 0:w.approvalScreen)||void 0===C?void 0:C.wrapperContainer},children:f})})},{Sidebar:({Component:o,config:t,className:l})=>{const{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:i,userStoryForApproval:a,isEditingSegment:s,artifactTitleIds:d}=T();return o?e(o,{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:i,userStoryForApproval:a,isEditingAnUserStorySegment:s,artifactTitleIds:d}):e(I,{config:t,className:l})},SidebarToggle:({OpenIcon:o,CloseIcon:t,className:l=""})=>{const{isSidebarExpanded:n,setIsSidebarExpanded:r}=T(),i=o||N,a=t||U;return e("div",{className:`${g.sidebarToggleWrapper} ${l}`,children:e("button",{onClick:()=>r(e=>!e),className:g.sidebarToggleBtn,"aria-label":n?"Collapse sidebar":"Expand sidebar",type:"button",children:e(n?a:i,{})})})},Content:({children:i,ButtonComponent:a,hideApproveAll:c=!1,pageTitle:u="Review Generated Requirements",showShareIcon:v=!1,handleDownloadUserStory:p,handleOpenSendDialog:h,pageDescription:S="This page displays automatically generated requirements for your project. Use this screen to review, refine, correct, or approve all generated requirements."})=>{var I,N,U,x,M,_,z,W,$,L,O,V,q,H,G,Y,J,K,Q,X,Z,ee,oe,te,le,ne,re,ie,ae,se,de;const{selectedUserStoryForApproval:ce,selectedUserStoryIndex:ue,artifactTitleIds:ve,labels:pe,config:me,isDisabled:he,disabledReason:Se,isEditingSegment:ye,handleSaveUserStory:ge,setCurrentContentId:fe,showNotification:be}=T(),{userStory:Ie,setUserStory:Ce}=d(),Ae=Ie[0],[we,Ee]=l(null),Ne=()=>{Ee(null)},Ue=n(null),[xe,Te]=l(!1),{customStyles:ke,customIcons:Be}=d(),De=null==ke?void 0:ke.userStoryCardStyles,[Fe,je]=l(!1),Pe=r(()=>{if(!ce)return;if(ye)return void be("warn","Warning!",pe.unsavedChangesWarning,3e3);const e=m(ce);ge(ue,e),fe("")},[ce,ue,ye,pe,ge,fe,be]);if(!ce)return null;const Re=ve[ue]||"",Me="APPROVED"===ce.approval_status,_e=he?Se:"",ze=null!=(null==ce?void 0:ce.big_enough)&&!Number.isNaN(ce.big_enough)&&!!(null==ce?void 0:ce.big_enough_decision_factors);return o("div",{className:g.content,style:{...null===(N=null===(I=null==ke?void 0:ke.approvalScreen)||void 0===I?void 0:I.content)||void 0===N?void 0:N.content},"data-lsc-ui-page-title":u,"data-lsc-ui-page-description":S,children:[o("div",{className:g.header,style:{...null===(M=null===(x=null===(U=null==ke?void 0:ke.approvalScreen)||void 0===U?void 0:U.body)||void 0===x?void 0:x.contentSegment)||void 0===M?void 0:M.header},children:[o("div",{className:g.headerLeft,style:{...null===(z=null===(_=null==ke?void 0:ke.approvalScreen)||void 0===_?void 0:_.content)||void 0===z?void 0:z.headerLeft},children:[o("div",{className:g.headerMeta,style:{...null===(L=null===($=null===(W=null==ke?void 0:ke.approvalScreen)||void 0===W?void 0:W.body)||void 0===$?void 0:$.contentSegment)||void 0===L?void 0:L.headerMeta},children:[e(b,{size:16,color:(null===(q=null===(V=null===(O=null==ke?void 0:ke.approvalScreen)||void 0===O?void 0:O.body)||void 0===V?void 0:V.contentSegment)||void 0===q?void 0:q.bookMarkColor)||"#8C8C8C"}),e("h2",{className:g.headerArtifactId,style:{...null===(Y=null===(G=null===(H=null==ke?void 0:ke.approvalScreen)||void 0===H?void 0:H.body)||void 0===G?void 0:G.contentSegment)||void 0===Y?void 0:Y.headerArtifactId},children:Re})]}),e("p",{className:g.headerTitle,style:{...null===(Q=null===(K=null===(J=null==ke?void 0:ke.approvalScreen)||void 0===J?void 0:J.body)||void 0===K?void 0:K.contentSegment)||void 0===Q?void 0:Q.headerTitle},children:null==ce?void 0:ce.title})]}),o("div",{className:null==g?void 0:g.containerStyle,style:null===(Z=null===(X=null==ke?void 0:ke.approvalScreen)||void 0===X?void 0:X.BigEnoughStyles)||void 0===Z?void 0:Z.containerStyle,children:[ze&&e("button",{className:g.developerEffortButton,style:null===(oe=null===(ee=null==ke?void 0:ke.approvalScreen)||void 0===ee?void 0:ee.BigEnoughStyles)||void 0===oe?void 0:oe.buttonStyle,onClick:()=>je(!Fe),children:e(B,{color:null===(le=null===(te=null==ke?void 0:ke.approvalScreen)||void 0===te?void 0:te.BigEnoughStyles)||void 0===le?void 0:le.iconColor,size:null===(re=null===(ne=null==ke?void 0:ke.approvalScreen)||void 0===ne?void 0:ne.BigEnoughStyles)||void 0===re?void 0:re.iconSize})}),v&&o(t,{children:[e("button",{className:g.iconButton,style:null==De?void 0:De.iconButton,onClick:e=>{Ee(e.currentTarget)},children:e(C,{size:16})}),o(D,{id:"user-story-share-menu",anchorEl:we,open:!!we,onClose:()=>Ee(null),style:null==De?void 0:De.userStoryShareMenu,children:[e(F,{style:null==De?void 0:De.userStoryMenuItem,onClick:async()=>{Te(!0),p&&(await Promise.all([p("pdf"),p("doc")]),Te(!1))},children:o("div",{ref:Ue,className:g.menuItemContent,style:null==De?void 0:De.menuItemContent,children:[e(A,{size:16,color:null==De?void 0:De.menuIconColor}),e("p",{style:null==De?void 0:De.menuLabel,children:"Download"})]})}),e(F,{style:null==De?void 0:De.userStoryMenuItem,onClick:async()=>{let e=Ae;e={...Ae,value:`${R(null==Ae?void 0:Ae.value,Ae.title)}`},null==h||h(!0,[e],Ae.artifactId),Ne()},children:o("div",{style:null==De?void 0:De.menuItemContent,className:g.menuItemContentPadded,children:[e(w,{size:16,color:null==De?void 0:De.menuIconColor}),e("p",{style:null==De?void 0:De.menuLabel,children:"Send"})]})}),e(F,{style:null==De?void 0:De.userStoryMenuItem,onClick:async()=>{const e=(new s.Converter).makeHtml(P(Ae.value)||Ae.value),o=function(e){const o=(new s.Converter).makeHtml(e),t=document.createElement("div");return t.innerHTML=o,t.textContent||t.innerText||""}(P(Ae.value)||Ae.value),t=new ClipboardItem({"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([t]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{Ne()}},children:o("div",{style:null==De?void 0:De.menuItemContent,className:g.menuItemContentPadded,children:[e(E,{size:16,color:null==De?void 0:De.menuIconColor}),e("p",{style:null==De?void 0:De.menuLabel,children:"Copy"})]})})]})]}),!c&&me.showApproveAllButton&&e("div",{className:g.headerRight,children:Me?e(y,{status:"APPROVED",label:pe.approved}):e(j,a?{title:_e,children:e("span",{children:e(a,{type:"fill",onClick:Pe,isDisable:he,className:g.approveAllButton,overrideStyles:!0,lscUIAgent:{id:"approve-all",lscUIType:"button",lscUILabel:pe.approveAll,lscUIDescription:"Clicks this button to approve all generated requirements on the page in a single action.",lscUIWhenToApply:"Apply when the user wants to accept all requirements without reviewing them individually, or when they say phrases like 'approve everything', 'finalize all', 'accept all', or 'this looks good, approve all'."},children:o("div",{className:g.approveAllContent,children:[e(f,{size:16,color:"white"}),e("span",{children:pe.approveAll})]})})})}:{title:_e,children:e("span",{children:o("button",{onClick:Pe,disabled:he,className:g.approveAllButtonDefault,style:{...null===(ae=null===(ie=null==ke?void 0:ke.approvalScreen)||void 0===ie?void 0:ie.content)||void 0===ae?void 0:ae.approveAllButtonDefault},children:[e(f,{size:16,color:"white"}),e("span",{children:pe.approveAll})]})})})})]})]}),Fe&&ze&&e("div",{className:g.bigEnoughWrapper,children:e(k,{customIcons:null==Be?void 0:Be.userStoryIcons,customStyles:null===(se=null==ke?void 0:ke.approvalScreen)||void 0===se?void 0:se.aiReasoningCitaionStyles,currentUserStory:ce,panelStyles:null===(de=null==ke?void 0:ke.approvalScreen)||void 0===de?void 0:de.BigEnoughStyles,showPanel:Fe})}),i]})},Body:({children:t,EditorComponent:l,ViewerComponent:n,handleDownloadUserStory:i,handleOpenSendDialog:a,showShareIcon:s=!1})=>{var c,u,v;const{selectedUserStoryForApproval:p,selectedUserStoryIndex:m,artifactTitleIds:h,handleSaveUserStory:y}=T(),{customStyles:f}=d(),b=r(e=>{y(m,e)},[m,y]),I=r((e,o)=>{var t;if(!p)return;const l={...p,sub_features:null===(t=p.sub_features)||void 0===t?void 0:t.map((t,l)=>l===e?o:t)};y(m,l)},[p,m,y]),C=r(e=>{var o;if(!p)return;const t={...p,sub_features:null===(o=p.sub_features)||void 0===o?void 0:o.filter((o,t)=>t!==e)};y(m,t)},[p,m,y]);if(!p)return null;const A=h[m]||"";return o("div",{className:g.body,style:{...null===(u=null===(c=null==f?void 0:f.approvalScreen)||void 0===c?void 0:c.body)||void 0===u?void 0:u.container},children:[e(S,{userStoryForApproval:p,artifactTitleId:A,onSaveMainStoryContent:b,EditorComponent:l,ViewerComponent:n}),null===(v=p.sub_features)||void 0===v?void 0:v.map((o,t)=>e(S,{userStoryForApproval:o,artifactTitleId:`${A} - ${String.fromCharCode(65+t)}`,isSubFeature:!0,subFeatureIndex:t,onSaveSubFeature:I,onDeleteSubFeature:C,EditorComponent:l,ViewerComponent:n,handleDownloadUserStory:i,handleOpenSendDialog:a,showShareIcon:s},o.artifactId)),t]})}});export{z as default};
2
2
  //# sourceMappingURL=UserStoryApprovalScreen.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,Fragment as n,jsxs as i}from"react/jsx-runtime";import o,{createContext as t,useRef as l,useState as r,useCallback as d,useMemo as a,useEffect as s,useContext as c}from"react";import u from"react-markdown";import p from"rehype-raw";import g from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as h}from"../../shared/useMarkdownSearch.js";import{Info as v}from"lucide-react";import{Tooltip as m}from"@mui/material";import C from"dompurify";import f from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as I}from"../RequirementAIWrapper/RequirementAIWrapper.js";import S from"../../icons/CognitiveDecision.js";import b from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as $}from"../ai-reasoning/AiReasoningCitation.js";import x from"../../icons/RelevanceScoreIcon.js";import N from"../RecommendationBlock/RecommendationBlock.js";import k from"../UserStoryCard/AttachedContext.js";import A from"../ai-reasoning/AiReasoningCitationContent.js";import j from"./components/InlineUpdatedComponent.js";import U from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as E}from"../../store/markdown-context.js";import L from"./components/InlineManualComponent.js";import M from"./components/HighlightButtonComponent.js";import{escapeTagIds as T,splitTagAcrossParagraphs as P}from"../../../../utils/tagHelper.js";const D=t(!1),_=t({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),H=t({rowId:""}),F=({aiReason:n,isHighConfidence:o,customStyle:t,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=c(_),{rowId:u}=c(H),p=String(n.id);u&&s.current.set(p,u);const h=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===n.id,v=o?(null==l?void 0:l.highConfidence)||e(S,{}):(null==l?void 0:l.lowConfidence)||e(b,{});return i("button",{className:g.aiReasoningButton,style:t,onClick:e=>{e.stopPropagation(),e.preventDefault(),a(h?null:u,h?null:n)},children:[v,e("i",h?{className:`pi pi-angle-up ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`})]})},B=({children:n,node:o,customStyles:t,customIcons:r})=>{var d,a;const s=l(Math.random().toString(36).slice(2)).current,{expandedInfo:u}=c(_),p=(null==u?void 0:u.rowId)===s,h=Array.isArray(null==o?void 0:o.children)?o.children.filter(e=>"element"===e.type).length:1,v=null!==(a=null===(d=null==o?void 0:o.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return i(H.Provider,{value:{rowId:s},children:[e("tr",{style:v?{cssText:v}:void 0,children:n}),p&&(null==u?void 0:u.aiReason)&&e("tr",{style:{width:"100%"},children:e("td",{colSpan:h||1,className:g.tableExpandedCell,children:e("div",{className:g.tableExpandedCellInner,children:e("div",{className:g.tableExpandedCellContent,children:e(A,{aiReason:u.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==t?void 0:t.aiReasoningContent,aiReasoningAccordion:null==t?void 0:t.aiReasoningAccordion,aiReasoningMarkdown:null==t?void 0:t.aiReasoningMarkdown,aiReasoningPill:null==t?void 0:t.aiReasoningPill,webCitation:null==t?void 0:t.webCitation,stormeeCitation:null==t?void 0:t.stormeeCitation,waveformCitation:null==t?void 0:t.waveformCitation,imageCitation:null==t?void 0:t.imageCitation,fileCitation:null==t?void 0:t.fileCitation,appModCitation:null==t?void 0:t.appModCitation,rcaCitation:null==t?void 0:t.rcaCitation,readFileCitation:null==t?void 0:t.readFileCitation,loadingCitations:null==t?void 0:t.loadingCitations,chatCitation:null==t?void 0:t.chatCitation}})})})})})]})};const W=["del","ins"];function O(e){return function(e,n,i){const o=n.join("|");return e.replace(new RegExp(`<(${o})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,o)=>`<${n}>${i(o)}</${n}>`)}(e,W,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var o;return`<code>${t=null!==(o=n[Number(i)])&&void 0!==o?o:"",t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var t})}(e)).join(""))}const V=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function q(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!o.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(V.has(d))return e;const a=null===(r=o.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?o.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const z=({message:t,noMarkdownContent:S,useMarkdown:b=!0,isParent:A,scenario:H,showUserStoryDiff:W=!1,aiReasoningsForBlock:V,isCitationLoadingDisplay:z=!1,className:G,highConfidenceIcon:Q,lowConfidenceIcon:J,customStyles:K,customIcons:X,contextVariant:Y,aiReasoningDiffView:Z,userStoryCitations:ee,artifactId:ne,isCraflow:ie,onCraAccept:oe,onCraReject:te,craFlowConfig:le,isDisplayHighlightControl:re=!1,showConfidenceScore:de=!0,CDNeededInChip:ae,blockId:se,showWaitingIconInChip:ce})=>{var ue;console.log("userstorywithcitation blockid ",se);const pe=l(null),{userStory:ge,inlineUpdateComponentConfig:he,getAvgScoreForStory:ve,setUserStory:me,aiReasoning:Ce,setAiReasoning:fe,customIcons:ye,searchQueryList:we,searchQueryReasoningIdList:Ie,currentHighlightIndex:Se,segmentComponentConfig:be,inlineManualComponentConfig:Re,diffEditConfig:$e}=I(),xe=null!=X?X:null==ye?void 0:ye.userStoryIcons;null==K||K.searchHighlight;const{search:Ne,clear:ke}=h(pe),[Ae,je]=r("1"),[Ue,Ee]=r(null),Le=l(new Map),[Me,Te]=r(new Set),Pe=d((e,n)=>{Ee(e&&n?{rowId:e,aiReason:n}:null)},[]),De=ne?ve(ne):0,[_e,He]=r([]),Fe=d(e=>{Te(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Be=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Be).join(""):o.isValidElement(e)?Be(e.props.children):"",We=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,o,t)=>{const l=o.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,o,t)=>{const l=n.substring(0,t),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=o;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let o;const t=new RegExp(n.source,n.flags);for(;null!==(o=t.exec(e));){const e=o[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),t=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:o.index,endIndex:o.index+o[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==t?void 0:t[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],o=n.changedItemCount-n.deletedItemCount;if(0===o)continue;const t=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of t){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+o}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=O(n),n},Oe=a(()=>t?We(t):t,[t]);s(()=>{He(V||Ce)},[V,Ce]);const Ve=a(()=>({span:({node:n,children:i,...o})=>{var t,l,r,d,a;const s=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t["highlight-id"])&&void 0!==l?l:null==o?void 0:o["highlight-id"],c="string"==typeof s&&Me.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==o?void 0:o["highlight-color"];return e("span",{style:{...null!==(a=null==K?void 0:K.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:i,children:o,...t})=>{var l,r,d,a,s,c;const u=null!==(r=null===(l=null==i?void 0:i.properties)||void 0===l?void 0:l.action)&&void 0!==r?r:null==t?void 0:t.action,p=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(c=null===(s=null==i?void 0:i.properties)||void 0===s?void 0:s["highlight-type"])&&void 0!==c?c:null==t?void 0:t["highlight-type"];return"highlight"===u?e(M,{highlightId:p,handleHighlightSpan:Fe,icon:"web"===g?null==xe?void 0:xe.webCitationIcon:"doc"===g?null==xe?void 0:xe.fileCitationIcon:e(n,{}),customStyles:"web"===g?null==K?void 0:K.webButton:"doc"===g?null==K?void 0:K.docButton:{}}):null},upt:({node:i,children:o,...t})=>{var l,r;const d=null==t?void 0:t.id,a=d?null===(r=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===r?void 0:r.replaceAll("@","<").replaceAll("#",">"):null,s=Ce.find(e=>e.id.toString()===a);if(!s)return o||e(n,{});const c="data-main"in t,u=t["data-status"];return e(n,{children:e(j,{aiReason:s,customStyles:null==K?void 0:K.inlineUpdatedComponent,handleClickCognitiveDecision:null==he?void 0:he.handleClickCognitiveDecision,handleClickUpdatedPill:null==he?void 0:he.handleClickUpdatedPill,handleClickOutputValue:null==he?void 0:he.handleClickOutputValue,customIcons:null==he?void 0:he.customIcons,CDNeededInChip:ae,showWaitingIconInChip:ce,showChip:c,status:u,children:o||e(n,{})})})},del:({node:o,children:t,...l})=>{var r;const{cleanedChildren:d,extractedNodes:a}=q(t,["ins"]);return i(n,{children:[e("span",{className:g.deleted,style:null!==(r=null==K?void 0:K.deleted)&&void 0!==r?r:{},...l,onClick:()=>{l.onclick&&l.onclick()},children:d}),a]})},ins:({children:o,...t})=>{var l;const{cleanedChildren:r,extractedNodes:d}=q(o,["del"]);return i(n,{children:[e("span",{className:g.inserted,style:null!==(l=null==K?void 0:K.inserted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:r}),d]})},preserved:({children:n,...i})=>e("span",{className:g.preserved,style:null==K?void 0:K.preserved,...i,children:n}),manual:({children:i,...o})=>{var t;const l=null===(t=null==o?void 0:o.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),r=Ce.find(e=>e.id.toString()===l),d=o["data-status"];return r?e(L,{aiReason:r,handleClick:null==Re?void 0:Re.handleClick,status:d,children:i}):i||e(n,{})},invisible:({children:i,...o})=>e(n,{}),h1:({node:n,...i})=>e("h1",{className:g.heading1,style:null==K?void 0:K.heading1,children:i.children}),h2:({node:n,...i})=>e("h2",{className:g.heading2,style:null==K?void 0:K.heading2,children:i.children}),h3:({node:n,...i})=>e("h3",{className:g.heading3,style:null==K?void 0:K.heading3,children:i.children}),b:({node:n,...i})=>e("b",{className:g.bold,style:null==K?void 0:K.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e("p",{...i,className:g.paragraph,style:null==K?void 0:K.paragraph,children:i.children}),updated:({node:n,...i})=>e(f,{...i,showUserStoryDiff:W,currentUpdatedTagId:Ae,setCurrentUpdatedTagId:je,userStory:ge,setUserStory:me,setAiReasoning:fe,node:n,isCraflow:ie,onCraAccept:oe,onCraReject:te,diffEditConfig:$e,customStyles:null==K?void 0:K.updatedContent,craFlowConfig:le}),ol:({node:n,...i})=>{var o,t,l;const r=null!==(l=null!==(t=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.start)&&void 0!==t?t:null==i?void 0:i.start)&&void 0!==l?l:void 0;return e("ol",{className:g.orderedList,style:null==K?void 0:K.olist,...r?{start:Number(r)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e("ul",{className:g.unorderedList,style:null==K?void 0:K.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e("div",{className:g.tableWrapper,children:e("table",{className:g.table,style:null==K?void 0:K.table,children:n})}),tr:({node:n,children:i})=>e(B,{node:n,children:i,customStyles:K}),td:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(D.Provider,{value:!0,children:e("td",{...l,style:t?{cssText:t}:void 0,children:i})})},th:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(D.Provider,{value:!0,children:e("th",{...l,style:t?{cssText:t}:void 0,children:i})})},recommendation:({node:n,...i})=>{var o;const t=`The AI has selected this content based on: ${(null===(o=null==i?void 0:i.children)||void 0===o?void 0:o[0])||""}`;return e(N,{...i,customStyles:null==K?void 0:K.recommendationBlock,label:t})},a:({inline:n,children:i,node:o,...t})=>{var l,r,d;const a=c(D)||"true"==(null==t?void 0:t.table),s=`${null==t?void 0:t.href}`,u=null===(l=s.split("$"))||void 0===l?void 0:l[0],p=null===(r=s.split("$"))||void 0===r?void 0:r[1];if("ai_reasoning"===u){const n=(null!==(d=W?Z:Ce)&&void 0!==d?d:[]).find(e=>e.id.toString()===decodeURIComponent(p)),o=Ie.includes(p);if(n){if(a)return e(F,{aiReason:n,customStyle:null==K?void 0:K.tableAiReasoning,customIcons:xe,isHighConfidence:n.relevance_score>=$});const t=Be(i),l="source"!==t.trim().toLowerCase();return e(R,{aiReason:n,isSourceHasHighlight:o,inlineLabel:t,isInlineCitation:l,customIcons:xe,customStyles:{aiReasoningContent:null==K?void 0:K.aiReasoningContent,aiReasoningAccordion:null==K?void 0:K.aiReasoningAccordion,aiReasoningMarkdown:null==K?void 0:K.aiReasoningMarkdown,aiReasoningPill:null==K?void 0:K.aiReasoningPill,webCitation:null==K?void 0:K.webCitation,stormeeCitation:null==K?void 0:K.stormeeCitation,waveformCitation:null==K?void 0:K.waveformCitation,imageCitation:null==K?void 0:K.imageCitation,fileCitation:null==K?void 0:K.fileCitation,appModCitation:null==K?void 0:K.appModCitation,rcaCitation:null==K?void 0:K.rcaCitation,readFileCitation:null==K?void 0:K.readFileCitation,loadingCitations:null==K?void 0:K.loadingCitations,chatCitation:null==K?void 0:K.chatCitation,bigEnoughCitation:null==K?void 0:K.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:o,node:t,...l})=>/language-(\w+)/.exec(o||"")||(null==o?void 0:o.includes("language-"))?e("div",{children:e("code",{className:g.blockCode,style:null==K?void 0:K.code,children:i})}):e("code",{className:g.inlineCode,style:null==K?void 0:K.code,children:i}),learned:({children:n})=>e(m,{title:n,placement:"top",children:e(v,{size:16,className:g.learned})}),generatedcode:({node:n,...i})=>{const o=(null==i?void 0:i.language)||"python",t=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e(y,{title:"Generated Code",code:t,language:o,customStyles:{pill:null==K?void 0:K.generatedCodePill,content:null==K?void 0:K.generatedCodeContent}})},updatedsegment:({node:n,children:i,...o})=>{var t,l,r,d;const a=`${null===(t=n.position)||void 0===t?void 0:t.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(o),c=e("div",s?{dangerouslySetInnerHTML:{__html:C.sanitize(s)}}:{children:i});return e(U,{id:a,node:n,children:c,props:o,segmentComponentConfig:be,customStyles:K,customIcons:X,extractText:Be,isUpdatedSegment:!0})},segment:({node:n,children:i,...o})=>{var t,l,r,d;const a=`${null===(t=n.position)||void 0===t?void 0:t.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e(U,{id:a,node:n,children:i,props:o,segmentComponentConfig:be,customStyles:K,customIcons:X,extractText:Be,blockId:se})}}),[_e,le,Ce,ee,Ae,W,t,X,we,Ie,K,be,Me,Fe,se]),qe=a(()=>{let e=T(Oe,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=P(e,n,"upt"===n)}),e},[Oe]);return s(()=>{if(!pe.current)return;if(!we.length)return void ke();let e;if(0===Ie.length||re)requestAnimationFrame(()=>{Ne([we[Se].replace(/\*/g,"")])});else{const n=pe.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{Ne([we[Se].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[we,Ie,Se,re]),e(_.Provider,{value:{expandedInfo:Ue,setExpanded:Pe,reasonToRow:Le},children:i("div",{ref:pe,className:`${g.container} ${"approving"!==H?g.wrapper:""} ${G||""}`,style:null==K?void 0:K.container,children:[b?e(E,{children:e(u,{components:Ve,rehypePlugins:[p],children:qe})}):S,De>0&&de&&e("div",{className:g.confidenceScoreContainer,style:null==K?void 0:K.confidenceScoreContainer,children:i("span",{className:g.confidenceScore,style:null==K?void 0:K.confidenceScore,children:[e(x,{size:14,color:(null==K?void 0:K.confidenceScoreIconColor)||"#166534"}),De,"%"]})}),z&&e("div",{className:g.citationLoader,style:null==K?void 0:K.citationLoaderContainer,children:e(w,{customStyles:{container:null==K?void 0:K.citationLoadingContainer,icon:null==K?void 0:K.citationLoadingIcon,text:null==K?void 0:K.citationLoadingText}})}),A&&e("div",{style:{...null===(ue=null==K?void 0:K.attachedContext)||void 0===ue?void 0:ue.wrapper},className:"flex mt-5",children:e(k,{customStyles:null==K?void 0:K.attachedContext,variant:Y})})]})})};export{z as default,q as splitNestedDiffNodes};
1
+ import{jsx as e,Fragment as n,jsxs as i}from"react/jsx-runtime";import t,{createContext as o,useRef as l,useState as r,useCallback as d,useMemo as a,useEffect as s,useContext as c}from"react";import u from"react-markdown";import p from"rehype-raw";import h from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as g}from"../../shared/useMarkdownSearch.js";import{Info as m}from"lucide-react";import{Tooltip as v}from"@mui/material";import f from"dompurify";import C from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as b}from"../RequirementAIWrapper/RequirementAIWrapper.js";import I from"../../icons/CognitiveDecision.js";import S from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as $}from"../ai-reasoning/AiReasoningCitation.js";import x from"../../icons/RelevanceScoreIcon.js";import N from"../RecommendationBlock/RecommendationBlock.js";import k from"../UserStoryCard/AttachedContext.js";import A from"../ai-reasoning/AiReasoningCitationContent.js";import j from"./components/InlineUpdatedComponent.js";import L from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as U}from"../../store/markdown-context.js";import E from"./components/InlineManualComponent.js";import M from"./components/HighlightButtonComponent.js";import{escapeTagIds as P,splitTagAcrossParagraphs as T}from"../../../../utils/tagHelper.js";import{normalizeRedlineMarkdown as D}from"../RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js";const _=o(!1),H=o({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),W=o({rowId:""}),B=({aiReason:n,isHighConfidence:t,customStyle:o,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=c(H),{rowId:u}=c(W),p=String(n.id);u&&s.current.set(p,u);const g=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===n.id,m=t?(null==l?void 0:l.highConfidence)||e(I,{}):(null==l?void 0:l.lowConfidence)||e(S,{});return i("button",{className:h.aiReasoningButton,style:o,onClick:e=>{e.stopPropagation(),e.preventDefault(),a(g?null:u,g?null:n)},children:[m,e("i",g?{className:`pi pi-angle-up ${t?h.aiReasoningIconHighConfidence:h.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${t?h.aiReasoningIconHighConfidence:h.aiReasoningIconLowConfidence}`})]})},F=({children:n,node:t,customStyles:o,customIcons:r})=>{var d,a;const s=l(Math.random().toString(36).slice(2)).current,{expandedInfo:u}=c(H),p=(null==u?void 0:u.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,m=null!==(a=null===(d=null==t?void 0:t.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return i(W.Provider,{value:{rowId:s},children:[e("tr",{style:m?{cssText:m}:void 0,children:n}),p&&(null==u?void 0:u.aiReason)&&e("tr",{style:{width:"100%"},children:e("td",{colSpan:g||1,className:h.tableExpandedCell,children:e("div",{className:h.tableExpandedCellInner,children:e("div",{className:h.tableExpandedCellContent,children:e(A,{aiReason:u.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})})})})})]})};const O=["del","ins"];function V(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var t;const o=null!==(t=n[Number(i)])&&void 0!==t?t:"";return`<code>${l=o,l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var l})}function q(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,O,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:V(e)).join(""))}function z(e){let n=e.trim();n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const i=[];let t="",o=!1;for(const e of n)o?(t+=e,o=!1):"\\"!==e?"|"!==e?t+=e:(i.push(t.trim()),t=""):(t+=e,o=!0);return i.push(t.trim()),i}function G(e){return e.trim().includes("|")&&z(e).length>1}function Q(e){const n=z(e);return n.length>1&&n.every(e=>/^:?-{3,}:?$/.test(e.replace(/\s+/g,"")))}function J(e){if(!e)return;const n=e.replace(/\s+/g,"");return n.startsWith(":")&&n.endsWith(":")?"center":n.endsWith(":")?"right":"left"}function K(e,n){return Array.from({length:n},(n,i)=>{var t;return null!==(t=e[i])&&void 0!==t?t:""})}function X(e,n,i){return`<${e}${function(e){return e?` align="${e}"`:""}(i)}>${V(n)}</${e}>`}function Y(e,n,i){const t=Math.max(e.length,n.length,...i.map(e=>e.length)),o=K(e,t),l=K(n,t).map(J);return`\n\n<table>${`<thead><tr>${o.map((e,n)=>X("th",e,l[n])).join("")}</tr></thead>`}${i.length?`<tbody>${i.map(e=>`<tr>${K(e,t).map((e,n)=>X("td",e,l[n])).join("")}</tr>`).join("")}</tbody>`:""}</table>\n\n`}const Z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ee(e,n){const i=[],o=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!t.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(o.has(d))return i.push(e),null;if(Z.has(d))return e;const a=null===(r=t.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?t.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const ne=({message:o,noMarkdownContent:I,useMarkdown:S=!0,isParent:A,scenario:W,showUserStoryDiff:O=!1,aiReasoningsForBlock:V,isCitationLoadingDisplay:J=!1,className:K,highConfidenceIcon:X,lowConfidenceIcon:Z,customStyles:ne,customIcons:ie,contextVariant:te,aiReasoningDiffView:oe,userStoryCitations:le,artifactId:re,isCraflow:de,onCraAccept:ae,onCraReject:se,craFlowConfig:ce,isDisplayHighlightControl:ue=!1,showConfidenceScore:pe=!0,CDNeededInChip:he,blockId:ge,storyId:me,showWaitingIconInChip:ve})=>{var fe;console.log("userstorywithcitation blockid ",ge);const Ce=l(null),{userStory:ye,inlineUpdateComponentConfig:we,getAvgScoreForStory:be,setUserStory:Ie,aiReasoning:Se,setAiReasoning:Re,customIcons:$e,searchQueryList:xe,searchQueryReasoningIdList:Ne,currentHighlightIndex:ke,segmentComponentConfig:Ae,inlineManualComponentConfig:je,diffEditConfig:Le,customSectionConfig:Ue}=b(),Ee=null!=ie?ie:null==$e?void 0:$e.userStoryIcons;null==ne||ne.searchHighlight;const{search:Me,clear:Pe}=g(Ce),[Te,De]=r("1"),[_e,He]=r(null),We=l(new Map),[Be,Fe]=r(new Set),Oe=d((e,n)=>{He(e&&n?{rowId:e,aiReason:n}:null)},[]),Ve=re?be(re):0,[qe,ze]=r([]),Ge=d(e=>{Fe(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Qe=d((e,n)=>{var i,t,o,l,r,d;const a=n["data-upt-id"];if("string"!=typeof a)return;let s=a;try{s=decodeURIComponent(a)}catch(e){}const c=null===(t=null===(i=s.split("$"))||void 0===i?void 0:i[1])||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),u=Se.find(e=>e.id.toString()===c);if(!u)return;e.preventDefault(),e.stopPropagation();const p=null!==(r=Array.from(null!==(l=null===(o=Ce.current)||void 0===o?void 0:o.querySelectorAll("[data-ai-reason-id]"))&&void 0!==l?l:[]).find(e=>e.dataset.aiReasonId===u.id.toString()))&&void 0!==r?r:e.currentTarget;null===(d=null==we?void 0:we.handleClickUpdatedPill)||void 0===d||d.call(we,p,u)},[Se,null==we?void 0:we.handleClickUpdatedPill]),Je=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Je).join(""):t.isValidElement(e)?Je(e.props.children):"",Ke=e=>{let n=function(e){const n=e.split("\n"),i=[];let t=!1;for(let e=0;e<n.length;e++){const o=n[e];if(/^\s*(```|~~~)/.test(o)){t=!t,i.push(o);continue}const l=n[e+1];if(!t&&void 0!==l&&G(o)&&Q(l)){const t=z(o),r=z(l),d=[];for(e+=2;e<n.length&&G(n[e])&&!Q(n[e]);)d.push(z(n[e])),e++;e--,i.push(Y(t,r,d));continue}i.push(o)}return i.join("\n")}(D(function(e){return e.replace(/\\r\\n|\\n|\\r/g,"\n")}(e)));return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,t,o)=>{const l=t.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,t,o)=>{const l=n.substring(0,o),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=t;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let t;const o=new RegExp(n.source,n.flags);for(;null!==(t=o.exec(e));){const e=t[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),o=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const o=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=q(n),n},Xe=a(()=>o?Ke(o):o,[o]);s(()=>{ze(V||Se)},[V,Se]);const Ye=a(()=>{const o=Boolean(null==Ue?void 0:Ue.negateList),l=(e,n)=>{let i=0;return t.Children.map(e,e=>{if(!t.isValidElement(e))return e;const o=n(i);return i+=1,t.cloneElement(e,{"data-list-marker":o})})};return{span:({node:n,children:i,...t})=>{var o,l,r,d,a;const s=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==l?l:null==t?void 0:t["highlight-id"],c="string"==typeof s&&Be.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==t?void 0:t["highlight-color"];return e("span",{style:{...null!==(a=null==ne?void 0:ne.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:i,children:t,...o})=>{var l,r,d,a,s,c;const u=null!==(r=null===(l=null==i?void 0:i.properties)||void 0===l?void 0:l.action)&&void 0!==r?r:null==o?void 0:o.action,p=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==o?void 0:o["highlight-id"],h=null!==(c=null===(s=null==i?void 0:i.properties)||void 0===s?void 0:s["highlight-type"])&&void 0!==c?c:null==o?void 0:o["highlight-type"];return"highlight"===u?e(M,{highlightId:p,handleHighlightSpan:Ge,icon:"web"===h?null==Ee?void 0:Ee.webCitationIcon:"doc"===h?null==Ee?void 0:Ee.fileCitationIcon:e(n,{}),customStyles:"web"===h?null==ne?void 0:ne.webButton:"doc"===h?null==ne?void 0:ne.docButton:{}}):null},upt:({node:i,children:t,...o})=>{var l,r;const d=null==o?void 0:o.id,a=d?null===(r=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===r?void 0:r.replaceAll("@","<").replaceAll("#",">"):null,s=Se.find(e=>e.id.toString()===a);if(!s)return t||e(n,{});const c="data-main"in o,u=o["data-status"];return e(n,{children:e(j,{aiReason:s,customStyles:null==ne?void 0:ne.inlineUpdatedComponent,handleClickCognitiveDecision:null==we?void 0:we.handleClickCognitiveDecision,handleClickUpdatedPill:null==we?void 0:we.handleClickUpdatedPill,handleClickOutputValue:null==we?void 0:we.handleClickOutputValue,customIcons:null==we?void 0:we.customIcons,CDNeededInChip:he,showWaitingIconInChip:ve,showChip:c,status:u,containerRef:Ce,children:t||e(n,{})})})},del:({node:t,children:o,...l})=>{var r;const{cleanedChildren:d,extractedNodes:a}=ee(o,["ins"]);return i(n,{children:[e("span",{className:h.deleted,style:null!==(r=null==ne?void 0:ne.deleted)&&void 0!==r?r:{},...l,onClick:()=>{l.onclick&&l.onclick()},children:d}),a]})},ins:({children:t,...o})=>{var l;const{cleanedChildren:r,extractedNodes:d}=ee(t,["del"]);return console.log("LOG: Printing ins props",o),i(n,{children:[e("span",{className:h.inserted,style:null!==(l=null==ne?void 0:ne.inserted)&&void 0!==l?l:{},...o,onClick:()=>{o.onclick&&o.onclick()},children:r}),d]})},deleted:({children:n,...i})=>e("span",{style:{textDecorationLine:"line-through",textDecorationColor:"#dc2626",cursor:"pointer"},...i,onClick:e=>Qe(e,i),children:n}),changed:({children:n,...i})=>e("span",{style:{backgroundColor:"#f3e8ff",color:"#1e3a8a",padding:"1px 2px",borderRadius:"2px",cursor:"pointer"},...i,onClick:e=>Qe(e,i),children:n}),preserved:({children:n,...i})=>e("span",{className:h.preserved,style:null==ne?void 0:ne.preserved,...i,children:n}),manual:({children:i,...t})=>{var o;const l=null===(o=null==t?void 0:t.id)||void 0===o?void 0:o.replaceAll("@","<").replaceAll("#",">"),r=Se.find(e=>e.id.toString()===l),d=t["data-status"];return r?e(E,{aiReason:r,handleClick:null==je?void 0:je.handleClick,status:d,children:i}):i||e(n,{})},invisible:({children:i,...t})=>e(n,{}),h1:({node:n,...i})=>e("h1",{className:h.heading1,style:null==ne?void 0:ne.heading1,children:i.children}),h2:({node:n,...i})=>e("h2",{className:h.heading2,style:null==ne?void 0:ne.heading2,children:i.children}),h3:({node:n,...i})=>e("h3",{className:h.heading3,style:null==ne?void 0:ne.heading3,children:i.children}),b:({node:n,...i})=>e("b",{className:h.bold,style:null==ne?void 0:ne.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e("p",{...i,className:h.paragraph,style:null==ne?void 0:ne.paragraph,children:i.children}),updated:({node:n,...i})=>e(C,{...i,showUserStoryDiff:O,currentUpdatedTagId:Te,setCurrentUpdatedTagId:De,userStory:ye,setUserStory:Ie,setAiReasoning:Re,node:n,isCraflow:de,onCraAccept:ae,onCraReject:se,diffEditConfig:Le,customStyles:null==ne?void 0:ne.updatedContent,craFlowConfig:ce}),ol:({node:n,...i})=>{var t,r,d;const a=null!==(d=null!==(r=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==r?r:null==i?void 0:i.start)&&void 0!==d?d:void 0,s=Number(null!=a?a:1);return o?e("div",{role:"list",className:h.negatedOrderedList,style:null==ne?void 0:ne.olist,children:l(i.children,e=>`${s+e}.`)}):e("ol",{className:h.orderedList,style:null==ne?void 0:ne.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>o?e("div",{role:"list",className:h.negatedUnorderedList,style:null==ne?void 0:ne.ulist,children:l(i.children,()=>"•")}):e("ul",{className:h.unorderedList,style:null==ne?void 0:ne.ulist,children:null==i?void 0:i.children}),li:({node:n,...t})=>{if(o){const e=t["data-list-marker"],{children:n,"data-list-marker":o,...l}=t;return i("div",{...l,role:"listitem",className:`${h.paragraph} ${h.negatedListItem}`,style:null==ne?void 0:ne.paragraph,children:[e&&i("span",{className:h.negatedListMarker,children:[e," "]}),n]})}return e("li",{children:null==t?void 0:t.children})},table:({children:n})=>e("div",{className:h.tableWrapper,children:e("table",{className:h.table,style:null==ne?void 0:ne.table,children:n})}),tr:({node:n,children:i})=>e(F,{node:n,children:i,customStyles:ne}),td:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e(_.Provider,{value:!0,children:e("td",{...l,style:o?{cssText:o}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e(_.Provider,{value:!0,children:e("th",{...l,style:o?{cssText:o}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const o=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e(N,{...i,customStyles:null==ne?void 0:ne.recommendationBlock,label:o})},a:({inline:n,children:i,node:t,...o})=>{var l;const r=c(_)||"true"===(null==o?void 0:o.table),d=`${null==o?void 0:o.href}`,[a,s]=d.split("$"),u=null==s?void 0:s.split("?")[0];if("ai_reasoning"===a){const n=(null!==(l=O?oe:Se)&&void 0!==l?l:[]).find(e=>e.id.toString()===decodeURIComponent(u)),t=Ne.includes(u);if(n){if(r)return e(B,{aiReason:n,customStyle:null==ne?void 0:ne.tableAiReasoning,customIcons:Ee,isHighConfidence:n.relevance_score>=$});const o=Je(i),l="source"!==o.trim().toLowerCase();return e(R,{aiReason:n,isSourceHasHighlight:t,inlineLabel:o,isInlineCitation:l,customIcons:Ee,customStyles:{aiReasoningContent:null==ne?void 0:ne.aiReasoningContent,aiReasoningAccordion:null==ne?void 0:ne.aiReasoningAccordion,aiReasoningMarkdown:null==ne?void 0:ne.aiReasoningMarkdown,aiReasoningPill:null==ne?void 0:ne.aiReasoningPill,webCitation:null==ne?void 0:ne.webCitation,stormeeCitation:null==ne?void 0:ne.stormeeCitation,waveformCitation:null==ne?void 0:ne.waveformCitation,imageCitation:null==ne?void 0:ne.imageCitation,fileCitation:null==ne?void 0:ne.fileCitation,appModCitation:null==ne?void 0:ne.appModCitation,rcaCitation:null==ne?void 0:ne.rcaCitation,readFileCitation:null==ne?void 0:ne.readFileCitation,loadingCitations:null==ne?void 0:ne.loadingCitations,chatCitation:null==ne?void 0:ne.chatCitation,bigEnoughCitation:null==ne?void 0:ne.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:t,node:o,...l})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e("div",{children:e("code",{className:h.blockCode,style:null==ne?void 0:ne.code,children:i})}):e("code",{className:h.inlineCode,style:null==ne?void 0:ne.code,children:i}),learned:({children:n})=>e(v,{title:n,placement:"top",children:e(m,{size:16,className:h.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",o=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e(y,{title:"Generated Code",code:o,language:t,customStyles:{pill:null==ne?void 0:ne.generatedCodePill,content:null==ne?void 0:ne.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var o,l,r,d;const a=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(t),c=e("div",s?{dangerouslySetInnerHTML:{__html:f.sanitize(s)}}:{children:i});return e(L,{id:a,node:n,children:c,props:t,segmentComponentConfig:Ae,customStyles:ne,customIcons:ie,extractText:Je,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var o,l,r,d;const a=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e(L,{id:a,node:n,children:i,props:t,segmentComponentConfig:Ae,customStyles:ne,customIcons:ie,extractText:Je,blockId:ge,storyId:me})}}},[qe,ce,Se,le,Te,O,o,ie,xe,Ne,ne,Ae,Be,Ge,Qe,ge,me,null==Ue?void 0:Ue.negateList]),Ze=a(()=>{let e=P(Xe,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=T(e,n,"upt"===n)}),e},[Xe]);return s(()=>{if(!Ce.current)return;if(!xe.length)return void Pe();let e;if(0===Ne.length||ue)requestAnimationFrame(()=>{Me([xe[ke].replace(/\*/g,"")])});else{const n=Ce.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{Me([xe[ke].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[xe,Ne,ke,ue]),e(H.Provider,{value:{expandedInfo:_e,setExpanded:Oe,reasonToRow:We},children:i("div",{ref:Ce,className:`${h.container} ${"approving"!==W?h.wrapper:""} ${K||""}`,style:null==ne?void 0:ne.container,children:[S?e(U,{children:e(u,{components:Ye,rehypePlugins:[p],children:Ze})}):I,Ve>0&&pe&&e("div",{className:h.confidenceScoreContainer,style:null==ne?void 0:ne.confidenceScoreContainer,children:i("span",{className:h.confidenceScore,style:null==ne?void 0:ne.confidenceScore,children:[e(x,{size:14,color:(null==ne?void 0:ne.confidenceScoreIconColor)||"#166534"}),Ve,"%"]})}),J&&e("div",{className:h.citationLoader,style:null==ne?void 0:ne.citationLoaderContainer,children:e(w,{customStyles:{container:null==ne?void 0:ne.citationLoadingContainer,icon:null==ne?void 0:ne.citationLoadingIcon,text:null==ne?void 0:ne.citationLoadingText}})}),A&&e("div",{style:{...null===(fe=null==ne?void 0:ne.attachedContext)||void 0===fe?void 0:fe.wrapper},className:"flex mt-5",children:e(k,{customStyles:null==ne?void 0:ne.attachedContext,variant:te})})]})})};export{ne as default,ee as splitNestedDiffNodes};
2
2
  //# sourceMappingURL=UserStoryWithCitation.js.map
@@ -1,2 +1,2 @@
1
- var e={container:"UserStoryWithCitation-module_container__YRdbR",wrapper:"UserStoryWithCitation-module_wrapper__wbnqg",heading1:"UserStoryWithCitation-module_heading1__KsWUO",heading2:"UserStoryWithCitation-module_heading2__GHshw",heading3:"UserStoryWithCitation-module_heading3__Jm9Xb",bold:"UserStoryWithCitation-module_bold__HenfX",paragraph:"UserStoryWithCitation-module_paragraph__a1-pc",orderedList:"UserStoryWithCitation-module_orderedList__E5PQa",unorderedList:"UserStoryWithCitation-module_unorderedList__SFvpc",inlineCode:"UserStoryWithCitation-module_inlineCode__5014y",blockCode:"UserStoryWithCitation-module_blockCode__pmHG5",learned:"UserStoryWithCitation-module_learned__0US6d",linkText:"UserStoryWithCitation-module_linkText__5kBNv",tableWrapper:"UserStoryWithCitation-module_tableWrapper__r94Fx",table:"UserStoryWithCitation-module_table__tEyKd",scrollContainer:"UserStoryWithCitation-module_scrollContainer__S-BtW",citationLoader:"UserStoryWithCitation-module_citationLoader__Op7Sm",aiReasoningButton:"UserStoryWithCitation-module_aiReasoningButton__-tprH",aiReasoningIconHighConfidence:"UserStoryWithCitation-module_aiReasoningIconHighConfidence__FmXx6",aiReasoningIconLowConfidence:"UserStoryWithCitation-module_aiReasoningIconLowConfidence__TfkJz",confidenceScoreContainer:"UserStoryWithCitation-module_confidenceScoreContainer__zOE-E",confidenceScore:"UserStoryWithCitation-module_confidenceScore__lhT4p",inserted:"UserStoryWithCitation-module_inserted__66gBL",deleted:"UserStoryWithCitation-module_deleted__mzR4t",preserved:"UserStoryWithCitation-module_preserved__ND8uC"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode('.UserStoryWithCitation-module_container__YRdbR{box-sizing:border-box;position:relative;width:100%}.UserStoryWithCitation-module_wrapper__wbnqg{border:1px solid #d5d5d5;border-radius:16px;padding:20px}.UserStoryWithCitation-module_heading1__KsWUO{color:#000;font-family:Inter,sans-serif;font-size:1.5rem;margin:.75rem 0 .25rem;padding:0}.UserStoryWithCitation-module_heading2__GHshw{color:#000;font-family:Inter,sans-serif;font-size:1.25rem;margin:10px 0 0;padding:0}.UserStoryWithCitation-module_heading3__Jm9Xb{color:#000;font-family:Inter,sans-serif;font-size:1.125rem;margin:10px 0 0;padding:0}.UserStoryWithCitation-module_bold__HenfX{font-family:Inter,sans-serif;font-weight:700}.UserStoryWithCitation-module_paragraph__a1-pc{word-wrap:break-word;display:block;flex-wrap:wrap;font-family:Inter,sans-serif;font-size:1rem;line-height:1.75rem;margin:0;max-width:100%;overflow:hidden;overflow:visible;overflow-wrap:break-word;text-align:justify;white-space:normal;word-break:break-word}.UserStoryWithCitation-module_orderedList__E5PQa{font-family:Inter,sans-serif;list-style-type:decimal;margin-left:1rem}.UserStoryWithCitation-module_unorderedList__SFvpc{font-family:Inter,sans-serif;list-style-type:disc;margin-left:1rem}.UserStoryWithCitation-module_inlineCode__5014y{background-color:#d633840d;border-radius:.3rem;box-sizing:border-box;color:#d63384;font-family:Source Code Pro,monospace;font-size:.95em;overflow-wrap:break-word;padding:.2rem .5rem;white-space:pre-wrap;width:100%;word-break:break-word}.UserStoryWithCitation-module_blockCode__pmHG5{color:#d63384;display:block;overflow:hidden;white-space:pre-wrap;word-break:break-words}.UserStoryWithCitation-module_learned__0US6d{color:#3b82f6;cursor:pointer;display:inline-block;margin-left:.25rem;margin-right:.25rem}.UserStoryWithCitation-module_linkText__5kBNv:hover{color:#1d4ed8}.UserStoryWithCitation-module_tableWrapper__r94Fx{box-sizing:border-box;max-width:100%;overflow-x:auto;width:100%}.UserStoryWithCitation-module_table__tEyKd{border-collapse:collapse;box-sizing:border-box;margin:20px 0;table-layout:fixed;width:100%}.UserStoryWithCitation-module_scrollContainer__S-BtW{overflow:hidden}.UserStoryWithCitation-module_citationLoader__Op7Sm{bottom:0;left:0;margin-top:12px}.UserStoryWithCitation-module_aiReasoningButton__-tprH{align-items:center;background:#0000;border:none;cursor:pointer;display:inline-flex;gap:2px;padding:2px 4px;vertical-align:middle}.UserStoryWithCitation-module_aiReasoningIconHighConfidence__FmXx6{color:#4b5563;font-size:12px;transform:translateY(5px)}.UserStoryWithCitation-module_aiReasoningIconLowConfidence__TfkJz{color:#cf4343;font-size:12px;transform:translateY(5px)}.UserStoryWithCitation-module_confidenceScoreContainer__zOE-E{position:absolute;right:12px;top:12px;z-index:10}.UserStoryWithCitation-module_confidenceScore__lhT4p{align-items:center;background-color:#f0fdf4;border:1px solid #bbf7d0;border-radius:9999px;box-shadow:0 1px 2px #0000000d;color:#166534;display:inline-flex;font-family:Inter,sans-serif;font-size:12px;font-weight:700;gap:4px;padding:4px 8px}.UserStoryWithCitation-module_orderedList__E5PQa{counter-reset:parentItem}.UserStoryWithCitation-module_orderedList__E5PQa>li{counter-increment:parentItem}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc{counter-reset:childItem;list-style-type:none!important}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc>li{align-items:baseline;counter-increment:childItem}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc>li:before{content:counter(parentItem) "." counter(childItem) " ";flex-shrink:0;margin-right:4px}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc>li>.UserStoryWithCitation-module_paragraph__a1-pc{display:inline}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc li>.UserStoryWithCitation-module_unorderedList__SFvpc{counter-reset:grandchildItem;list-style-type:none!important}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc li>.UserStoryWithCitation-module_unorderedList__SFvpc>li{align-items:baseline;counter-increment:grandchildItem}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc li>.UserStoryWithCitation-module_unorderedList__SFvpc>li:before{content:counter(parentItem) "." counter(childItem) "." counter(grandchildItem) " ";flex-shrink:0;margin-right:4px}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc li>.UserStoryWithCitation-module_unorderedList__SFvpc>li>.UserStoryWithCitation-module_paragraph__a1-pc{display:inline}.UserStoryWithCitation-module_inserted__66gBL{background-color:#8cbeff}.UserStoryWithCitation-module_deleted__mzR4t{background-color:#fff;text-decoration:line-through;text-decoration-color:#dc2626}.UserStoryWithCitation-module_preserved__ND8uC{background-color:#fff;text-decoration:underline;text-decoration-color:#d3d3d3}[class*=_upt-]>[class*=_inserted_]{background-color:#f3e8ff}[class^=_manual-]>[class^=_inserted_]{background-color:#8cbeff}'));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}();export{e as default};
1
+ var t={container:"UserStoryWithCitation-module_container__YRdbR",wrapper:"UserStoryWithCitation-module_wrapper__wbnqg",heading1:"UserStoryWithCitation-module_heading1__KsWUO",heading2:"UserStoryWithCitation-module_heading2__GHshw",heading3:"UserStoryWithCitation-module_heading3__Jm9Xb",bold:"UserStoryWithCitation-module_bold__HenfX",paragraph:"UserStoryWithCitation-module_paragraph__a1-pc",orderedList:"UserStoryWithCitation-module_orderedList__E5PQa",unorderedList:"UserStoryWithCitation-module_unorderedList__SFvpc",inlineCode:"UserStoryWithCitation-module_inlineCode__5014y",blockCode:"UserStoryWithCitation-module_blockCode__pmHG5",learned:"UserStoryWithCitation-module_learned__0US6d",linkText:"UserStoryWithCitation-module_linkText__5kBNv",tableWrapper:"UserStoryWithCitation-module_tableWrapper__r94Fx",table:"UserStoryWithCitation-module_table__tEyKd",scrollContainer:"UserStoryWithCitation-module_scrollContainer__S-BtW",citationLoader:"UserStoryWithCitation-module_citationLoader__Op7Sm",aiReasoningButton:"UserStoryWithCitation-module_aiReasoningButton__-tprH",aiReasoningIconHighConfidence:"UserStoryWithCitation-module_aiReasoningIconHighConfidence__FmXx6",aiReasoningIconLowConfidence:"UserStoryWithCitation-module_aiReasoningIconLowConfidence__TfkJz",confidenceScoreContainer:"UserStoryWithCitation-module_confidenceScoreContainer__zOE-E",confidenceScore:"UserStoryWithCitation-module_confidenceScore__lhT4p",inserted:"UserStoryWithCitation-module_inserted__66gBL",deleted:"UserStoryWithCitation-module_deleted__mzR4t",preserved:"UserStoryWithCitation-module_preserved__ND8uC",negatedOrderedList:"UserStoryWithCitation-module_negatedOrderedList__RZDGe",negatedUnorderedList:"UserStoryWithCitation-module_negatedUnorderedList__ZTOPu",negatedListItem:"UserStoryWithCitation-module_negatedListItem__pcJY9",negatedListMarker:"UserStoryWithCitation-module_negatedListMarker__yWtUn"};!function(){if("undefined"==typeof document)return;const t=document.createElement("style");t.type="text/css";const e=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode('.UserStoryWithCitation-module_container__YRdbR{box-sizing:border-box;position:relative;width:100%}.UserStoryWithCitation-module_wrapper__wbnqg{border:1px solid #d5d5d5;border-radius:16px;padding:20px}.UserStoryWithCitation-module_heading1__KsWUO{color:#000;font-family:Inter,sans-serif;font-size:1.5rem;margin:.75rem 0 .25rem;padding:0}.UserStoryWithCitation-module_heading2__GHshw{color:#000;font-family:Inter,sans-serif;font-size:1.25rem;margin:10px 0 0;padding:0}.UserStoryWithCitation-module_heading3__Jm9Xb{color:#000;font-family:Inter,sans-serif;font-size:1.125rem;margin:10px 0 0;padding:0}.UserStoryWithCitation-module_bold__HenfX{font-family:Inter,sans-serif;font-weight:700}.UserStoryWithCitation-module_paragraph__a1-pc{word-wrap:break-word;display:block;flex-wrap:wrap;font-family:Inter,sans-serif;font-size:1rem;line-height:1.75rem;margin:0;max-width:100%;overflow:hidden;overflow:visible;overflow-wrap:break-word;text-align:justify;white-space:normal;word-break:break-word}.UserStoryWithCitation-module_orderedList__E5PQa{font-family:Inter,sans-serif;list-style-type:decimal;margin-left:1rem}.UserStoryWithCitation-module_unorderedList__SFvpc{font-family:Inter,sans-serif;list-style-type:disc;margin-left:1rem}.UserStoryWithCitation-module_inlineCode__5014y{background-color:#f0f2f5;border-radius:.3rem;box-sizing:border-box;color:#323232;font-family:Source Code Pro,monospace;font-size:.95em;overflow-wrap:break-word;padding:.2rem .5rem;white-space:pre-wrap;width:100%;word-break:break-word}.UserStoryWithCitation-module_blockCode__pmHG5{color:#d63384;display:block;overflow:hidden;white-space:pre-wrap;word-break:break-words}.UserStoryWithCitation-module_learned__0US6d{color:#3b82f6;cursor:pointer;display:inline-block;margin-left:.25rem;margin-right:.25rem}.UserStoryWithCitation-module_linkText__5kBNv:hover{color:#1d4ed8}.UserStoryWithCitation-module_tableWrapper__r94Fx{-webkit-overflow-scrolling:touch;box-sizing:border-box;margin:16px 0;max-width:100%;overflow-x:auto;width:100%}.UserStoryWithCitation-module_table__tEyKd{border:1px solid #d1d5db;border-collapse:collapse;box-sizing:border-box;font-family:Inter,sans-serif;font-size:.95rem;line-height:1.45rem;margin:0;min-width:100%;table-layout:auto;width:100%}.UserStoryWithCitation-module_table__tEyKd td,.UserStoryWithCitation-module_table__tEyKd th{border:1px solid #d1d5db;color:#111827;overflow-wrap:break-word;padding:8px 10px;vertical-align:top;white-space:normal;word-break:normal}.UserStoryWithCitation-module_table__tEyKd th{background:#f3f4f6;font-weight:700;white-space:nowrap}.UserStoryWithCitation-module_table__tEyKd td[align=center],.UserStoryWithCitation-module_table__tEyKd th[align=center]{text-align:center}.UserStoryWithCitation-module_table__tEyKd td[align=right],.UserStoryWithCitation-module_table__tEyKd th[align=right]{text-align:right}.UserStoryWithCitation-module_table__tEyKd tr:nth-child(2n) td{background:#fafafa}.UserStoryWithCitation-module_table__tEyKd p{margin:0}.UserStoryWithCitation-module_scrollContainer__S-BtW{overflow:hidden}.UserStoryWithCitation-module_citationLoader__Op7Sm{bottom:0;left:0;margin-top:12px}.UserStoryWithCitation-module_aiReasoningButton__-tprH{align-items:center;background:#0000;border:none;cursor:pointer;display:inline-flex;gap:2px;padding:2px 4px;vertical-align:middle}.UserStoryWithCitation-module_aiReasoningIconHighConfidence__FmXx6{color:#4b5563;font-size:12px;transform:translateY(5px)}.UserStoryWithCitation-module_aiReasoningIconLowConfidence__TfkJz{color:#cf4343;font-size:12px;transform:translateY(5px)}.UserStoryWithCitation-module_confidenceScoreContainer__zOE-E{position:absolute;right:12px;top:12px;z-index:10}.UserStoryWithCitation-module_confidenceScore__lhT4p{align-items:center;background-color:#f0fdf4;border:1px solid #bbf7d0;border-radius:9999px;box-shadow:0 1px 2px #0000000d;color:#166534;display:inline-flex;font-family:Inter,sans-serif;font-size:12px;font-weight:700;gap:4px;padding:4px 8px}.UserStoryWithCitation-module_orderedList__E5PQa{counter-reset:parentItem}.UserStoryWithCitation-module_orderedList__E5PQa>li{counter-increment:parentItem}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc{counter-reset:childItem;list-style-type:none!important}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc>li{align-items:baseline;counter-increment:childItem}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc>li:before{content:counter(parentItem) "." counter(childItem) " ";flex-shrink:0;margin-right:4px}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc>li>.UserStoryWithCitation-module_paragraph__a1-pc{display:inline}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc li>.UserStoryWithCitation-module_unorderedList__SFvpc{counter-reset:grandchildItem;list-style-type:none!important}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc li>.UserStoryWithCitation-module_unorderedList__SFvpc>li{align-items:baseline;counter-increment:grandchildItem}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc li>.UserStoryWithCitation-module_unorderedList__SFvpc>li:before{content:counter(parentItem) "." counter(childItem) "." counter(grandchildItem) " ";flex-shrink:0;margin-right:4px}.UserStoryWithCitation-module_orderedList__E5PQa li>.UserStoryWithCitation-module_unorderedList__SFvpc li>.UserStoryWithCitation-module_unorderedList__SFvpc>li>.UserStoryWithCitation-module_paragraph__a1-pc{display:inline}.UserStoryWithCitation-module_inserted__66gBL{background-color:#8cbeff}.UserStoryWithCitation-module_deleted__mzR4t{background-color:#fff;text-decoration:line-through;text-decoration-color:#dc2626}.UserStoryWithCitation-module_preserved__ND8uC{background-color:#fff;text-decoration:underline;text-decoration-color:#d3d3d3}[class*=_upt-]>[class*=_inserted_]{background-color:#f3e8ff}[class^=_manual-]>[class^=_inserted_]{background-color:#8cbeff}.UserStoryWithCitation-module_negatedOrderedList__RZDGe,.UserStoryWithCitation-module_negatedUnorderedList__ZTOPu{margin:0;padding:0}.UserStoryWithCitation-module_negatedListItem__pcJY9{display:block;margin:0;padding:0}.UserStoryWithCitation-module_negatedListMarker__yWtUn{display:inline;font:inherit}.UserStoryWithCitation-module_negatedListItem__pcJY9>p:first-of-type{display:inline;margin:0}.UserStoryWithCitation-module_negatedListItem__pcJY9>.UserStoryWithCitation-module_negatedListMarker__yWtUn+span{display:inline!important;margin:0!important;width:auto!important}.UserStoryWithCitation-module_negatedListItem__pcJY9>.UserStoryWithCitation-module_negatedListMarker__yWtUn+span>span:not([class*=_hoverActions_]){display:inline!important;width:auto!important}'));const i=document.head||document.getElementsByTagName("head")[0]||document.documentElement;i&&i.appendChild(t)}();export{t as default};
2
2
  //# sourceMappingURL=UserStoryWithCitation.module.css.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as l,Fragment as n}from"react/jsx-runtime";import{Divider as o,CircularProgress as i}from"@mui/material";import{hexToOpacity as t}from"../../../utils/css.utils.js";import r from"./InlineUpdatedComponent.module.css.js";import d from"../../../icons/CognitiveDecision.js";import{Check as a,X as s,Undo2 as c,Hourglass as u,ChevronDown as v}from"lucide-react";import{useRef as p,useState as m,useCallback as g,useLayoutEffect as h}from"react";const f=({aiReason:f,children:C,customStyles:y,handleClickCognitiveDecision:w,handleClickUpdatedPill:b,handleClickOutputValue:N,customIcons:k,CDNeededInChip:I=!0,showWaitingIconInChip:D=!1,showChip:P,status:S})=>{var _,W,$,z,j,x,A,L,R,T,E,M,O,U,B,F,H,q,V;const G=p(null),J=p(null),[K,Q]=m(null),X=g(()=>{var e;const l=J.current,n=(null===(e=G.current)||void 0===e?void 0:e.offsetParent)||(null==l?void 0:l.offsetParent);if(!(l&&n instanceof HTMLElement))return;const o=l.getBoundingClientRect(),i=n.getBoundingClientRect(),t=o.top-i.top+o.height/2;Q(e=>null!==e&&Math.abs(e-t)<.5?e:t)},[]);h(()=>{X()}),h(()=>{var e,l;if("undefined"==typeof window)return;const n=window.requestAnimationFrame(X);window.addEventListener("resize",X);const o="undefined"!=typeof ResizeObserver?new ResizeObserver(X):null;J.current&&(null==o||o.observe(J.current));const i=(null===(e=G.current)||void 0===e?void 0:e.offsetParent)||(null===(l=J.current)||void 0===l?void 0:l.offsetParent);return i instanceof HTMLElement&&(null==o||o.observe(i)),()=>{window.cancelAnimationFrame(n),window.removeEventListener("resize",X),null==o||o.disconnect()}},[X]);const Y="pending"!==S?"#303030":null===($=null===(W=null===(_=f.redlining_details)||void 0===_?void 0:_.evaluation_outputs)||void 0===W?void 0:W.metadata)||void 0===$?void 0:$.label_color,Z={color:Y||"#000000",background:t(Y||"#000000",25),border:`1px solid ${t(Y||"#000000",75)}`},ee=Y||"#000000",le=t(Y||"#000000",25),ne={background:t(Y||"#000000",75),...null==y?void 0:y.dividerStyle};let oe=null;"accepted"===S?oe=null!==(z=null==k?void 0:k.accepted)&&void 0!==z?z:e(a,{color:"#16A34A"}):"rejected"===S?oe=null!==(j=null==k?void 0:k.rejected)&&void 0!==j?j:e(s,{color:"#DC2626"}):"reverted"===S&&(oe=null!==(x=null==k?void 0:k.reverted)&&void 0!==x?x:e(c,{color:"#475569"}));const ie=null===K?{}:{"--inline-update-anchor-top":`${K}px`},te=null===K?"":` ${r.anchorAligned}`;return l("span",{className:r.inlineUpdatedWrapper,children:[P&&l(n,{children:[oe&&e("span",{className:`${r.resolvedStatus}${te}`,style:{...ie,...null==y?void 0:y.resolvedIcon},children:oe}),e("span",{ref:G,id:f.id.toString(),onClick:e=>{e.stopPropagation(),null==b||b(e.currentTarget,f)},className:`${r.pillWrapper}${te}`,style:{...ie,...null==y?void 0:y.pillStyleWrapper},children:l("span",{className:r.pillComponent,style:{...Z,...null===(A=null==y?void 0:y.pillComponent)||void 0===A?void 0:A.commonStyle},children:[e("span",{children:(null===(T=null===(R=null===(L=f.redlining_details)||void 0===L?void 0:L.evaluation_outputs)||void 0===R?void 0:R.metadata)||void 0===T?void 0:T.label_text)||""}),e(o,{className:r.dividerStyle,style:ne}),D&&"pending"===S&&l(n,{children:[e("span",{className:r.waitingIconWrapper,style:{color:Y},title:"Waiting",children:e(u,{size:16})}),e(o,{className:r.dividerStyle,style:ne})]}),e("span",{className:r["output-container"],onClick:e=>{N&&(e.stopPropagation(),null==N||N(e.currentTarget,f))},children:f.resolving?e(i,{size:(null===(E=null==y?void 0:y.loader)||void 0===E?void 0:E.size)||18,"aria-label":"Loading…",sx:{color:(null===(M=null==y?void 0:y.loader)||void 0===M?void 0:M.color)||Y}}):"pending"!==S?oe:null===(U=null===(O=null==f?void 0:f.redlining_details)||void 0===O?void 0:O.evaluation_outputs)||void 0===U?void 0:U.output_value}),I&&l(n,{children:[e(o,{className:r.dividerStyle,style:ne}),e("span",{onClick:e=>{e.stopPropagation(),null==w||w(e.currentTarget,f)},className:r.cognitiveDecisionWrapper,style:null===(B=null==y?void 0:y.cognitiveDecisionIcon)||void 0===B?void 0:B.wrapper,children:e(d,{color:(null===(F=null==y?void 0:y.cognitiveDecisionIcon)||void 0===F?void 0:F.color)||ee,backgroundColor:(null===(H=null==y?void 0:y.cognitiveDecisionIcon)||void 0===H?void 0:H.backgroundColor)||le})}),e("span",{className:r.chevronWrapper,style:null===(q=null==y?void 0:y.Chevron)||void 0===q?void 0:q.wrapper,children:e(v,{color:(null===(V=null==y?void 0:y.Chevron)||void 0===V?void 0:V.color)||Y})})]})]})})]}),e("span",{ref:J,className:r[`upt-${S}`],onClick:e=>{e.preventDefault(),e.stopPropagation(),G.current&&(null==b||b(G.current,f))},children:C})]})};export{f as default};
1
+ import{jsx as e,jsxs as l,Fragment as n}from"react/jsx-runtime";import{Divider as o,CircularProgress as i}from"@mui/material";import{hexToOpacity as t}from"../../../utils/css.utils.js";import r from"./InlineUpdatedComponent.module.css.js";import d from"../../../icons/CognitiveDecision.js";import{Check as a,X as s,Undo2 as c,Hourglass as u,ChevronDown as v}from"lucide-react";import{useRef as p,useState as m,useCallback as g,useLayoutEffect as f}from"react";const h=({aiReason:h,children:C,customStyles:y,handleClickCognitiveDecision:w,handleClickUpdatedPill:b,handleClickOutputValue:N,customIcons:S,CDNeededInChip:k=!0,showWaitingIconInChip:I=!1,showChip:D,status:P,containerRef:_})=>{var W,$,z,A,R,j,x,L,T,E,M,O,U,q,B,F,H,V,G;const J=p(null),K=p(null),[Q,X]=m(null),Y=g(()=>{var e;const l=K.current,n=(null===(e=J.current)||void 0===e?void 0:e.offsetParent)||(null==l?void 0:l.offsetParent);if(!(l&&n instanceof HTMLElement))return;const o=l.getBoundingClientRect(),i=n.getBoundingClientRect(),t=o.top-i.top+o.height/2;X(e=>null!==e&&Math.abs(e-t)<.5?e:t)},[]);f(()=>{Y()}),f(()=>{var e,l;if("undefined"==typeof window)return;const n=window.requestAnimationFrame(Y);window.addEventListener("resize",Y);const o="undefined"!=typeof ResizeObserver?new ResizeObserver(Y):null;K.current&&(null==o||o.observe(K.current));const i=(null===(e=J.current)||void 0===e?void 0:e.offsetParent)||(null===(l=K.current)||void 0===l?void 0:l.offsetParent);return i instanceof HTMLElement&&(null==o||o.observe(i)),()=>{window.cancelAnimationFrame(n),window.removeEventListener("resize",Y),null==o||o.disconnect()}},[Y]);const Z="pending"!==P?"#303030":null===(z=null===($=null===(W=h.redlining_details)||void 0===W?void 0:W.evaluation_outputs)||void 0===$?void 0:$.metadata)||void 0===z?void 0:z.label_color,ee={color:Z||"#000000",background:t(Z||"#000000",25),border:`1px solid ${t(Z||"#000000",75)}`},le=Z||"#000000",ne=t(Z||"#000000",25),oe={background:t(Z||"#000000",75),...null==y?void 0:y.dividerStyle};let ie=null;"accepted"===P?ie=null!==(A=null==S?void 0:S.accepted)&&void 0!==A?A:e(a,{color:"#16A34A"}):"rejected"===P?ie=null!==(R=null==S?void 0:S.rejected)&&void 0!==R?R:e(s,{color:"#DC2626"}):"reverted"===P&&(ie=null!==(j=null==S?void 0:S.reverted)&&void 0!==j?j:e(c,{color:"#475569"}));const te=null===Q?{}:{"--inline-update-anchor-top":`${Q}px`},re=null===Q?"":` ${r.anchorAligned}`;return l("span",{className:r.inlineUpdatedWrapper,children:[D&&l(n,{children:[ie&&e("span",{className:`${r.resolvedStatus}${re}`,style:{...te,...null==y?void 0:y.resolvedIcon},children:ie}),e("span",{ref:J,id:h.id.toString(),"data-ai-reason-id":h.id.toString(),onClick:e=>{e.stopPropagation(),null==b||b(e.currentTarget,h)},className:`${r.pillWrapper}${re}`,style:{...te,...null==y?void 0:y.pillStyleWrapper},children:l("span",{className:r.pillComponent,style:{...ee,...null===(x=null==y?void 0:y.pillComponent)||void 0===x?void 0:x.commonStyle},children:[e("span",{children:(null===(E=null===(T=null===(L=h.redlining_details)||void 0===L?void 0:L.evaluation_outputs)||void 0===T?void 0:T.metadata)||void 0===E?void 0:E.label_text)||""}),e(o,{className:r.dividerStyle,style:oe}),I&&"pending"===P&&l(n,{children:[e("span",{className:r.waitingIconWrapper,style:{color:Z},title:"Waiting",children:e(u,{size:16})}),e(o,{className:r.dividerStyle,style:oe})]}),e("span",{className:r["output-container"],onClick:e=>{N&&(e.stopPropagation(),null==N||N(e.currentTarget,h))},children:h.resolving?e(i,{size:(null===(M=null==y?void 0:y.loader)||void 0===M?void 0:M.size)||18,"aria-label":"Loading…",sx:{color:(null===(O=null==y?void 0:y.loader)||void 0===O?void 0:O.color)||Z}}):"pending"!==P?ie:null===(q=null===(U=null==h?void 0:h.redlining_details)||void 0===U?void 0:U.evaluation_outputs)||void 0===q?void 0:q.output_value}),k&&l(n,{children:[e(o,{className:r.dividerStyle,style:oe}),e("span",{onClick:e=>{e.stopPropagation(),null==w||w(e.currentTarget,h)},className:r.cognitiveDecisionWrapper,style:null===(B=null==y?void 0:y.cognitiveDecisionIcon)||void 0===B?void 0:B.wrapper,children:e(d,{color:(null===(F=null==y?void 0:y.cognitiveDecisionIcon)||void 0===F?void 0:F.color)||le,backgroundColor:(null===(H=null==y?void 0:y.cognitiveDecisionIcon)||void 0===H?void 0:H.backgroundColor)||ne})}),e("span",{className:r.chevronWrapper,style:null===(V=null==y?void 0:y.Chevron)||void 0===V?void 0:V.wrapper,children:e(v,{color:(null===(G=null==y?void 0:y.Chevron)||void 0===G?void 0:G.color)||Z})})]})]})})]}),e("span",{ref:K,className:r[`upt-${P}`],onClick:e=>{var l,n,o;e.preventDefault(),e.stopPropagation();const i=h.id.toString(),t=null!==(l=J.current)&&void 0!==l?l:Array.from(null!==(o=null===(n=_.current)||void 0===n?void 0:n.querySelectorAll("[data-ai-reason-id]"))&&void 0!==o?o:[]).find(e=>e.dataset.aiReasonId===i);t&&(null==b||b(t,h))},children:C})]})};export{h as default};
2
2
  //# sourceMappingURL=InlineUpdatedComponent.js.map
@@ -1,2 +1,2 @@
1
- import{useRef as e}from"react";import{processAIReasoningFromBlocks as i}from"../utils/proccess-stream.utils.js";function t({setUserStory:t,setAiReasoning:o,setUserStoryCitations:n,onStreamingCompleted:r,isGraphQLCallInProgress:s,knowledgeBase:a,projectAnalyserSummary:u,dataSourceFiles:l,aiReasoning:c,setRedisValue:d,fetchCitationByBlock:p}){const _=e(new Set),m=e(new Set),g=e(null),b=e(null),v=e({gap_items_prompt:"",risk_items_prompt:""}),f=e(new Set);async function h(e,i,t){var a,u;let l="",c="";try{const r=await p(e,t,i);o(e=>{var i;const t=[...e];return null===(i=r.response.ai_reasonings)||void 0===i||i.forEach(e=>{const i=t.findIndex(i=>i.id===e.id);-1!==i&&e.gap.length>0&&e.reason.length>0&&(t[i]={...e})}),t}),l=(null===(a=r.response)||void 0===a?void 0:a.gap_items_prompt)||"",c=(null===(u=r.response)||void 0===u?void 0:u.risk_items_prompt)||"",(l||c)&&(v.current={gap_items_prompt:l,risk_items_prompt:c}),n(e=>{var i,t,o,n,s,a,u,l,c,d,p,_,m,g;return{...e,appmod_citations:[...null!==(i=e.appmod_citations)&&void 0!==i?i:[],...null!==(t=r.response.appmod_citations)&&void 0!==t?t:[]],audio_citations:[...null!==(o=e.audio_citations)&&void 0!==o?o:[],...null!==(n=r.response.audio_citations)&&void 0!==n?n:[]],file_citations:[...null!==(s=e.file_citations)&&void 0!==s?s:[],...null!==(a=r.response.file_citations)&&void 0!==a?a:[]],image_citations:[...null!==(u=e.image_citations)&&void 0!==u?u:[],...null!==(l=r.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=r.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=r.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=r.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(i){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,i)}finally{let i=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(m.current.add(i),m.current.size===_.current.size&&!s.current){const e=l||v.current.gap_items_prompt,i=c||v.current.risk_items_prompt;await r(e,i),_.current.clear(),m.current.clear(),g.current=null,b.current=null,v.current={gap_items_prompt:"",risk_items_prompt:""},f.current.clear()}}}return{processStreamContent:function(e,r,s){try{const p=JSON.stringify(e);if(b.current===p)return;b.current=p;let m=[],v=[];e=e.map(e=>{var t;const o=`${(e={...e,subBlockNumber:null!==(t=e.subBlockNumber)&&void 0!==t?t:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(f.current.has(o))return null;f.current.add(o);let{outputText:s,reasonings:a,gpt_citation:u,processedDescription:l}=i(e.value,e.blockNumber,e.storyNumber,e.description);n(e=>{var i;return u.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(i=e.gpt_citations)||void 0===i||i.push(...u)),{...e}}),m.push(...a),v.push([...a]);let c=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return _.current.has(c)||(h({...e,value:s,description:l},a,r),_.current.add(c)),{...e,value:s,description:l}}).filter(Boolean),m.forEach(e=>{o(i=>(i.find(i=>i.id===e.id)||i.push(e),[...i]))}),e.length>0&&e.map(({title:e,section:i,value:o,storyNumber:n,description:r,blockNumber:p,big_enough:_,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h},N)=>{t(t=>{var y,k,S,B,R,$,w,C;const O=t.findIndex(e=>e.storyNumber===n);if("intro"===i)-1===O?t.push({artifactId:`STORY-${n}-${p}`,title:e,value:o,description:r,storyNumber:n,sub_features:[],section:i,blockNumber:p,aiReasoning:v[N],big_enough:_,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h}):(t[O].value+=o,t[O].aiReasoning=t[O].aiReasoning||[],null===(k=null===(y=t[O])||void 0===y?void 0:y.aiReasoning)||void 0===k||k.push(...v[N]),t[O].big_enough=_,t[O].big_enough_decision_factors=m,t[O].gapValue=b,t[O].confidenceScore=f,t[O].metadata=h);else{t[O].sub_features||(t[O].sub_features=[]);const r=(null===(B=null===(S=t[O])||void 0===S?void 0:S.sub_features)||void 0===B?void 0:B.findIndex(e=>e.blockNumber===p))||-1;if(-1===r)null===($=null===(R=t[O])||void 0===R?void 0:R.sub_features)||void 0===$||$.push({artifactId:`STORY-${n}-${p}`,title:e,value:o,storyNumber:n,blockNumber:p,section:i,aiReasoning:v[N],big_enough:_,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h});else{let e=null===(C=null===(w=null==t?void 0:t[O])||void 0===w?void 0:w.sub_features)||void 0===C?void 0:C[r];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...v[N]),e.big_enough=_,e.big_enough_decision_factors=m,e.gapValue=b,e.confidenceScore=f,e.metadata=h}}const E=JSON.stringify(t);return g.current!==E&&(d({key:`streaming-redis-key-${s}`,value:{mmvf_list:t,knowledgeBase:a,projectAnalyserSummary:u,dataSources_files:l,ai_reasonings:c}}),g.current=E),[...t]})})}catch(e){console.error("Error in processing Stream Content",e)}}}}export{t as useStreamContentHandler};
1
+ import{useState as e,useRef as i,useEffect as t}from"react";import{processAIReasoningFromBlocks as o}from"../utils/proccess-stream.utils.js";function n({setUserStory:n,setAiReasoning:r,setUserStoryCitations:s,onStreamingCompleted:a,isGraphQLCallInProgress:l,knowledgeBase:u,projectAnalyserSummary:c,dataSourceFiles:d,aiReasoning:p,setRedisValue:_,fetchCitationByBlock:m}){const[g,f]=e({finalGap:"",finalRisk:"",status:"in-progress"}),b=i(new Set),v=i(new Set),h=i(null),k=i(null),y=i({gap_items_prompt:"",risk_items_prompt:""}),N=i(new Set);return t(()=>{"complete"!==g.status||l||(a(g.finalGap,g.finalRisk),b.current.clear(),v.current.clear(),h.current=null,k.current=null,y.current={gap_items_prompt:"",risk_items_prompt:""},N.current.clear(),f({finalGap:"",finalRisk:"",status:"in-progress"}))},[g,l]),{processStreamContent:function(e,i,t){try{const a=JSON.stringify(e);if(k.current===a)return;k.current=a;let l=[],g=[];e=e.map(e=>{var t;const n=`${(e={...e,subBlockNumber:null!==(t=e.subBlockNumber)&&void 0!==t?t:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(N.current.has(n))return null;N.current.add(n);let{outputText:a,reasonings:u,gpt_citation:c,processedDescription:d}=o(e.value,e.blockNumber,e.storyNumber,e.description);s(e=>{var i;return c.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(i=e.gpt_citations)||void 0===i||i.push(...c)),{...e}}),l.push(...u),g.push([...u]);const p=u.filter(e=>e.on_demand).flatMap(e=>[...e.reason.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g),...e.gap.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g)].map(e=>{const[i,t]=e[1].split("$");return"book_citation_doc"!==i&&"book_citation_pdf"!==i&&"document_citation"!==i?null:{citation_number:t,customMetadata:{type:"document_citation"===i?"book_citation_pdf":i,file_name:"",fileType:"",gcs_upload_url:""}}}).filter(Boolean));p.length&&s(e=>{var i;return{...e,file_citations:[...null!==(i=e.file_citations)&&void 0!==i?i:[],...p]}});let _=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return b.current.has(_)||(!async function(e,i,t){var o,n;let a="",l="";try{const u=await m(e,t,i);r(e=>{var i;const t=[...e];return null===(i=u.response.ai_reasonings)||void 0===i||i.forEach(e=>{const i=t.findIndex(i=>i.id===e.id);-1!==i&&e.gap.length>0&&e.reason.length>0&&(t[i]={...e})}),t}),a=(null===(o=u.response)||void 0===o?void 0:o.gap_items_prompt)||"",l=(null===(n=u.response)||void 0===n?void 0:n.risk_items_prompt)||"",(a||l)&&(y.current={gap_items_prompt:a,risk_items_prompt:l}),s(e=>{var i,t,o,n,r,s,a,l,c,d,p,_,m,g;return{...e,appmod_citations:[...null!==(i=e.appmod_citations)&&void 0!==i?i:[],...null!==(t=u.response.appmod_citations)&&void 0!==t?t:[]],audio_citations:[...null!==(o=e.audio_citations)&&void 0!==o?o:[],...null!==(n=u.response.audio_citations)&&void 0!==n?n:[]],file_citations:[...null!==(r=e.file_citations)&&void 0!==r?r:[],...null!==(s=u.response.file_citations)&&void 0!==s?s:[]],image_citations:[...null!==(a=e.image_citations)&&void 0!==a?a:[],...null!==(l=u.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=u.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=u.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=u.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(i){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,i)}finally{let i=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(v.current.add(i),v.current.size===b.current.size){const e=a||y.current.gap_items_prompt,i=l||y.current.risk_items_prompt;f({finalGap:e,finalRisk:i,status:"complete"})}}}({...e,value:a,description:d},u,i),b.current.add(_)),{...e,value:a,description:d}}).filter(Boolean),l.forEach(e=>{r(i=>(i.find(i=>i.id===e.id)||i.push(e),[...i]))}),e.length>0&&e.map(({title:e,section:i,value:o,storyNumber:r,description:s,blockNumber:a,big_enough:l,big_enough_decision_factors:m,gapValue:f,confidenceScore:b,metadata:v},k)=>{n(n=>{var y,N,S,R,B,$,C,w;const O=n.findIndex(e=>e.storyNumber===r);if("intro"===i)-1===O?n.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,description:s,storyNumber:r,sub_features:[],section:i,blockNumber:a,aiReasoning:g[k],big_enough:l,big_enough_decision_factors:m,gapValue:f,confidenceScore:b,metadata:v}):(n[O].value+=o,n[O].aiReasoning=n[O].aiReasoning||[],null===(N=null===(y=n[O])||void 0===y?void 0:y.aiReasoning)||void 0===N||N.push(...g[k]),n[O].big_enough=l,n[O].big_enough_decision_factors=m,n[O].gapValue=f,n[O].confidenceScore=b,n[O].metadata=v);else{n[O].sub_features||(n[O].sub_features=[]);const t=(null===(R=null===(S=n[O])||void 0===S?void 0:S.sub_features)||void 0===R?void 0:R.findIndex(e=>e.blockNumber===a))||-1;if(-1===t)null===($=null===(B=n[O])||void 0===B?void 0:B.sub_features)||void 0===$||$.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,storyNumber:r,blockNumber:a,section:i,aiReasoning:g[k],big_enough:l,big_enough_decision_factors:m,gapValue:f,confidenceScore:b,metadata:v});else{let e=null===(w=null===(C=null==n?void 0:n[O])||void 0===C?void 0:C.sub_features)||void 0===w?void 0:w[t];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...g[k]),e.big_enough=l,e.big_enough_decision_factors=m,e.gapValue=f,e.confidenceScore=b,e.metadata=v}}const E=JSON.stringify(n);return h.current!==E&&(_({key:`streaming-redis-key-${t}`,value:{mmvf_list:n,knowledgeBase:u,projectAnalyserSummary:c,dataSources_files:d,ai_reasonings:p}}),h.current=E),[...n]})})}catch(e){console.error("Error in processing Stream Content",e)}}}}export{n as useStreamContentHandler};
2
2
  //# sourceMappingURL=useStreamContentHandler.js.map
@@ -1,2 +1,2 @@
1
- function e(e){try{return e}catch(e){console.error("Error in formatMarkdown",e)}}function r(e){return e.includes("Acceptance Criteria")?e=null==(e=null==(e=null==(e=null==e?void 0:e.replace(/\\n/g,"\n"))?void 0:e.replace(/(\*\*.+?\*\*)\s*:/g,"\n$1:\n"))?void 0:e.replace(/(?<!\d)(\d+(?:\.\d+)+)\./g,(e,r)=>{const n=r.split(".");return`${" ".repeat(n.length-1)}${r}.`}))?void 0:e.replace(/([^\n])\n(?![\n\*#])/g,"$1<br>\n"):e}const n=e=>{if(!e)return"";e=(e=(e=(e=(e=e.replace(/%&&%[\s\S]*?%&&%/g,"")).replace(/<!--[\s\S]*?-->/g,"")).replace(/<crredirection[^>]*>[\s\S]*?<\/crredirection>/gi,"")).replace(/<answerExample[^>]*>[\s\S]*?<\/answerExample>/gi,"")).replace(/<a\s+data-cognitive-reasoning[^>]*>[\s\S]*?<\/a>/gi,"");return["b","strong","i","em","u","ol","ul","li","p","div","span","h1","h2","h3","h4","h5","h6","highlight","br","hr"].forEach(r=>{const n=new RegExp(`</?${r}[^>]*>`,"gi");e=e.replace(n,"")}),e=(e=(e=(e=(e=e.replace("ð","")).replace(/\*\*/g,"")).replace(/\n/g," ")).replace(/\s+/g," ")).trim()},a=e=>{const r=(new DOMParser).parseFromString(e,"text/html");return Array.from(r.querySelectorAll('a[href^="ai_reasoning$"]')).map(e=>e.getAttribute("href").replace("ai_reasoning$",""))},t=e=>{const r=(new DOMParser).parseFromString(e,"text/html");return r.querySelectorAll('a[href^="ai_reasoning$"]').forEach(e=>{e.remove()}),r.body.innerHTML.trim()};export{a as extractAllAiReasoningIds,e as formatMarkdown,r as indentMarkdown,t as stripAiReasoningAnchors,n as stripHtmlAndMetadata};
1
+ function r(r){try{return r}catch(r){console.error("Error in formatMarkdown",r)}}function e(r){return r.includes("Acceptance Criteria")?r=null==(r=null==(r=null==(r=null==r?void 0:r.replace(/\\n/g,"\n"))?void 0:r.replace(/(\*\*.+?\*\*)\s*:/g,"\n$1:\n"))?void 0:r.replace(/(?<!\d)(\d+(?:\.\d+)+)\./g,(r,e)=>{const n=e.split(".");return`${" ".repeat(n.length-1)}${e}.`}))?void 0:r.replace(/([^\n])\n(?![\n\*#])/g,"$1<br>\n"):r}const n=r=>{if(!r)return"";r=(r=(r=(r=(r=r.replace(/%&&%[\s\S]*?%&&%/g,"")).replace(/<!--[\s\S]*?-->/g,"")).replace(/<crredirection[^>]*>[\s\S]*?<\/crredirection>/gi,"")).replace(/<answerExample[^>]*>[\s\S]*?<\/answerExample>/gi,"")).replace(/<a\s+data-cognitive-reasoning[^>]*>[\s\S]*?<\/a>/gi,"");return["b","strong","i","em","u","ol","ul","li","p","div","span","h1","h2","h3","h4","h5","h6","highlight","br","hr"].forEach(e=>{const n=new RegExp(`</?${e}[^>]*>`,"gi");r=r.replace(n,"")}),r=(r=(r=(r=(r=r.replace("ð","")).replace(/\*\*/g,"")).replace(/\n/g," ")).replace(/\s+/g," ")).trim()},t=r=>{const e=(new DOMParser).parseFromString(r,"text/html");return Array.from(e.querySelectorAll('a[href^="ai_reasoning$"]')).map(r=>r.getAttribute("href").replace("ai_reasoning$",""))},a=r=>{const e=(new DOMParser).parseFromString(r,"text/html");return e.querySelectorAll('a[href^="ai_reasoning$"]').forEach(r=>{r.remove()}),e.body.innerHTML.trim()},i=(r="",e)=>{const n=r.split("?")[1]||"";if(!n)return"";try{return new URLSearchParams(n).get(e)||""}catch(r){return console.error("Failed to parse citation href query params",r),""}},o=["rulebook_citation","il_rulebook_citation","rulebook_chunk"];export{t as extractAllAiReasoningIds,r as formatMarkdown,i as getHrefQueryParam,o as guidelineCitationTypes,e as indentMarkdown,a as stripAiReasoningAnchors,n as stripHtmlAndMetadata};
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1,2 +1,2 @@
1
- const e=e=>{const t=[];try{const n="<BLOCK_STREAM_START>",r="<BLOCK_STREAM_END>";let i=0;for(;;){const o=e.indexOf(n,i);if(-1===o)break;const s=e.indexOf(r,o+n.length);if(-1===s)break;const c=e.slice(o+n.length,s).trim();t.push(JSON.parse(c)),i=s+r.length}}catch(e){console.error("Error in extracting blocks from stream",e)}finally{return t}};function t(e,t,i,o){const s=[];let c="";const a=[];let l="";console.log("RAW INPUT",JSON.stringify(e),JSON.stringify(o));try{const u=e=>e.replace(/<a\s+(?:(table="true")\s+)?href=(\\"|")ai_reasoning\$(\d+)(\\"|")>([\s\S]*?)<\/a>/g,(e,o,c,l,u,f)=>{var d,h,g,p,_;const b=`${l}<BLOCK_NUMBER>${t}<STORY_NUMBER>${i}`,$=function(e){const t=new Map,n="<gpt_citation ",r="</gpt_citation>";let i=0;for(;;){const o=e.indexOf(n,i);if(-1===o)break;const s=e.indexOf(">",o);if(-1===s)break;const c=e.indexOf(r,s);if(-1===c)break;const a=e.slice(o,c+r.length),l=e.slice(o,s+1),u=l.indexOf("id=");if(-1!==u){let e=u+3;"\\"===l[e]&&e++,'"'!==l[e]&&"'"!==l[e]||e++;let n="";for(;e<l.length&&/\d/.test(l[e]);)n+=l[e++];n&&t.set(n,a)}i=c+r.length}return t}(f);console.log("RAW INPUT",$);const m=f.match(/<reason(?:\s+source="([^"]*)")?>([\s\S]*?)<\/reason>/),v=f.match(/<gap(?:\s+source="([^"]*)")?>([\s\S]*?)<\/gap>/),O=f.match(/<relevance_score>([\s\S]*?)<\/relevance_score>/);let T=(null===(d=null==m?void 0:m[2])||void 0===d?void 0:d.trim())||"",S=(null===(h=null==v?void 0:v[2])||void 0===h?void 0:h.trim())||"";T=n(T,b),S=n(S,b),$.forEach((e,t)=>{const n=`${b}<GPT_CITATION_ID>${t}`;a.push(r(e,n))}),s.push({id:b,reason:T,reasonSource:(null===(g=null==m?void 0:m[1])||void 0===g?void 0:g.trim())||"",gap:S,gapSource:(null===(p=null==v?void 0:v[1])||void 0===p?void 0:p.trim())||"",relevance_score:Number(null===(_=null==O?void 0:O[1])||void 0===_?void 0:_.trim())||0});return`<a ${o?'table="true"':""} href=${c}ai_reasoning$${b}${u}>Source</a>`});c=u(e),o&&(l=u(o))}catch(t){console.error("Error in extracting AI Reasoning from this block:",e)}finally{return{outputText:c,reasonings:s,gpt_citation:a,processedDescription:l}}}function n(e,t){if(!e)return e;let n="",r=0;for(;;){const i=e.indexOf("<gpt_citation_here ",r);if(-1===i){n+=e.slice(r);break}n+=e.slice(r,i);const o=e.indexOf(">",i);if(-1===o){n+=e.slice(i);break}const s=e.slice(i,o+1),c=s.indexOf("id=");let a="";if(-1!==c){let e=c+3;for("\\"===s[e]&&e++,'"'!==s[e]&&"'"!==s[e]||e++;e<s.length&&/\d/.test(s[e]);)a+=s[e++]}if(a){n+=`<a href="gpt_citation$${`${t}<GPT_CITATION_ID>${a}`}">Source</a>`}r=o+1}return n}function r(e,t){const n=t=>{const n=new RegExp(`<${t}>([\\s\\S]*?)<\\/${t}>`,"gi"),r=[];let i;for(;null!==(i=n.exec(e));)r.push(i[1].trim());return r},r=n("domain"),i=n("paraphrase");return{citation_number:t,customMetadata:{type:"gpt_citation",data_sources:n("data_sources"),training_data_title:r,paraphrase:i}}}const i=(e,t,n)=>{let r=e.includes("<h1><b>Title</b></h1>\n\n")?e:n?`<h1><b>Title</b></h1>\n\n${n} \n${e}`:e;return r=r.includes("<h1><b>Requirement Type</b></h1>\n\n")?r:t?`<h1><b>Requirement Type</b></h1>\n\n${t} \n${r}`:r,r};function o(e){try{const t=/<h2>\s*(?:<b>)?Description(?:<\/b>)?\s*<\/h2>\s*([\s\S]*?)(?=\s*<h2>|$)/i,n=e.match(t);if(n)return n[1].trim()}catch(e){}return null}export{e as extractBlockStreams,o as extractDescription,r as parseGptCitation,t as processAIReasoningFromBlocks,i as processUserStoryValue,n as replaceGptCitation};
1
+ const e=e=>{const n=[];try{const t="<BLOCK_STREAM_START>",i="<BLOCK_STREAM_END>";let o=0;for(;;){const r=e.indexOf(t,o);if(-1===r)break;const s=e.indexOf(i,r+t.length);if(-1===s)break;const c=e.slice(r+t.length,s).trim();n.push(JSON.parse(c)),o=s+i.length}}catch(e){console.error("Error in extracting blocks from stream",e)}finally{return n}},n=e=>e.replace(/<onDemandCitation\s+type=(?:\\"|")([^"]+)(?:\\"|")\s+citationNo=(?:\\"|")(\d+)(?:\\"|")\s*(?:\/>|><\/onDemandCitation>)/g,(e,n,t)=>`<a href="${n}$${t}?type=on_demand">Source</a>`);function t(e,t,r,s){const c=[];let a="";const l=[];let u="";console.log("RAW INPUT",JSON.stringify(e),JSON.stringify(s));try{const d=e=>e.replace(/<a\s+(?:(table="true")\s+)?href=(\\"|")ai_reasoning\$(\d+)(\?[^\\"]*)?(\\"|")>([\s\S]*?)<\/a>/g,(e,s,a,u,d,f,h)=>{var p,g,_,m,$;const b=`${u}<BLOCK_NUMBER>${t}<STORY_NUMBER>${r}`,v=!!d&&d.includes("type=on_demand"),O=function(e){const n=new Map,t="<gpt_citation ",i="</gpt_citation>";let o=0;for(;;){const r=e.indexOf(t,o);if(-1===r)break;const s=e.indexOf(">",r);if(-1===s)break;const c=e.indexOf(i,s);if(-1===c)break;const a=e.slice(r,c+i.length),l=e.slice(r,s+1),u=l.indexOf("id=");if(-1!==u){let e=u+3;"\\"===l[e]&&e++,'"'!==l[e]&&"'"!==l[e]||e++;let t="";for(;e<l.length&&/\d/.test(l[e]);)t+=l[e++];t&&n.set(t,a)}o=c+i.length}return n}(h);console.log("RAW INPUT",O);const S=h.match(/<reason(?:\s+source="([^"]*)")?>([\s\S]*?)<\/reason>/),T=h.match(/<gap(?:\s+source="([^"]*)")?>([\s\S]*?)<\/gap>/),x=h.match(/<relevance_score>([\s\S]*?)<\/relevance_score>/);let y=(null===(p=null==S?void 0:S[2])||void 0===p?void 0:p.trim())||"",N=(null===(g=null==T?void 0:T[2])||void 0===g?void 0:g.trim())||"";y=n(y),N=n(N),y=i(y,b),N=i(N,b),O.forEach((e,n)=>{const t=`${b}<GPT_CITATION_ID>${n}`;l.push(o(e,t))}),c.push({id:b,reason:y,reasonSource:(null===(_=null==S?void 0:S[1])||void 0===_?void 0:_.trim())||"",gap:N,gapSource:(null===(m=null==T?void 0:T[1])||void 0===m?void 0:m.trim())||"",relevance_score:Number(null===($=null==x?void 0:x[1])||void 0===$?void 0:$.trim())||0,on_demand:v});return`<a ${s?'table="true"':""} href=${a}ai_reasoning$${b}${d||""}${f}>Source</a>`});a=d(e),s&&(u=d(s))}catch(n){console.error("Error in extracting AI Reasoning from this block:",e)}finally{return{outputText:a,reasonings:c,gpt_citation:l,processedDescription:u}}}function i(e,n){if(!e)return e;let t="",i=0;for(;;){const o=e.indexOf("<gpt_citation_here ",i);if(-1===o){t+=e.slice(i);break}t+=e.slice(i,o);const r=e.indexOf(">",o);if(-1===r){t+=e.slice(o);break}const s=e.slice(o,r+1),c=s.indexOf("id=");let a="";if(-1!==c){let e=c+3;for("\\"===s[e]&&e++,'"'!==s[e]&&"'"!==s[e]||e++;e<s.length&&/\d/.test(s[e]);)a+=s[e++]}if(a){t+=`<a href="gpt_citation$${`${n}<GPT_CITATION_ID>${a}`}">Source</a>`}i=r+1}return t}function o(e,n){const t=n=>{const t=new RegExp(`<${n}>([\\s\\S]*?)<\\/${n}>`,"gi"),i=[];let o;for(;null!==(o=t.exec(e));)i.push(o[1].trim());return i},i=t("domain"),o=t("paraphrase");return{citation_number:n,customMetadata:{type:"gpt_citation",data_sources:t("data_sources"),training_data_title:i,paraphrase:o}}}const r=(e,n,t)=>{let i=e.includes("<h1><b>Title</b></h1>\n\n")?e:t?`<h1><b>Title</b></h1>\n\n${t} \n${e}`:e;return i=i.includes("<h1><b>Requirement Type</b></h1>\n\n")?i:n?`<h1><b>Requirement Type</b></h1>\n\n${n} \n${i}`:i,i};function s(e){try{const n=/<h2>\s*(?:<b>)?Description(?:<\/b>)?\s*<\/h2>\s*([\s\S]*?)(?=\s*<h2>|$)/i,t=e.match(n);if(t)return t[1].trim()}catch(e){}return null}export{e as extractBlockStreams,s as extractDescription,o as parseGptCitation,t as processAIReasoningFromBlocks,r as processUserStoryValue,i as replaceGptCitation};
2
2
  //# sourceMappingURL=proccess-stream.utils.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as i}from"tslib";import{jsx as t,jsxs as n,Fragment as r}from"react/jsx-runtime";import{useMemo as o,useState as l}from"react";import d from"@mui/icons-material/ChevronRight";import a from"@mui/icons-material/Close";import c from"@mui/icons-material/ExpandMore";import s from"@mui/material/Box";import u from"@mui/material/Button";import m from"@mui/material/ButtonBase";import p from"@mui/material/Divider";import h from"@mui/material/IconButton";import g from"@mui/material/Paper";import f from"@mui/material/Radio";import x from"@mui/material/Stack";import b from"@mui/material/TextField";import C from"@mui/material/Typography";import E from"./RevertSummaryNotice.js";import v from"./CognitiveIcon.js";import F from"./CognitiveScoreBadge.js";import y from"../../assests/icons/InfoAlert.js";var S,w=function(e,t){return i([e],Array.isArray(t)?t:null==t?[]:[t],!0)},R="MERGE_ADJACENT";!function(e){e.KEEP="KEEP",e.SPLIT_HERE="SPLIT_HERE",e.MERGE_NEXT="MERGE_NEXT",e.MERGE_PREV="MERGE_PREV",e.MERGE_PREVIOUS="MERGE_PREVIOUS",e.SET_RANGE="SET_RANGE"}(S||(S={}));var A=function(e){return Object.values(S).includes(e)},M=function(e,t,n,r){if(!t||!e)return[];var o=t.additional_decisions,l=Array.isArray(o)?o:o?Object.values(o).flat():[],d=Array.from(new Set(i(i([],t.allowed_decisions,!0),l,!0)));return d.flatMap(function(i){var t=e.focus_page,o=d.find(function(e){return e.toLowerCase().includes("merge")}),l=null!=t&&null!=n&&null!=r&&t===n&&t===r,a=null!=t&&null!=n&&t===n,c=null!=t&&null!=r&&(t===r||t===r+1),s=a||c||!(null!=t&&(!(null!=n&&null!=r)||t>n&&t<r));switch(i){case S.SET_RANGE:return[];case"KEEP":return[{id:i,title:"Keep as is",description:"Keep the current document boundary unchanged."}];case"SPLIT_HERE":return[{id:i,title:"Split to a separate document",description:s?"A valid page inside the document is required to split it.":t?"Start a new document at page ".concat(t,"."):"Create a new document at this boundary.",disabled:s}];case"MERGE_PREV":case"MERGE_NEXT":case"MERGE_PREVIOUS":return i!==o?[]:l?[{id:R,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]:a?[{id:S.MERGE_PREVIOUS,title:"Merge with previous document",description:"Combine this document with the previous document."}]:c?[{id:S.MERGE_NEXT,title:"Merge with next document",description:"Combine this document with the next document."}]:[{id:R,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]}return[]})};function I(i){var I=i.headerName,k=void 0===I?"Boundary Check":I,z=i.title,T=i.pageNo,W=i.content,_=i.revertSummary,P=i.cognitiveScore,N=i.config,G=i.metadata,D=i.previousSegmentTitle,B=i.nextSegmentTitle,j=i.selectedIndex,H=i.defaultSelectedIndex,O=void 0===H?null:H,V=i.defaultStartPage,U=i.defaultEndPage,L=i.onSelectionChange,X=i.onConfirm,K=i.onActionConfirm,q=i.onCognitiveClick,J=i.onAdjustManually,Y=i.onClose,Q=i.confirmLabel,Z=void 0===Q?"Confirm":Q,$=i.manualPrompt,ee=void 0===$?"Didn't find the right option?":$,ie=i.manualActionLabel,te=void 0===ie?"Adjust Manually":ie,ne=i.cognitiveLabel,re=void 0===ne?"Cognitive Integrity":ne,oe=i.showAdjustManually,le=void 0===oe||oe,de=i.showCognitiveIntegrity,ae=void 0===de||de,ce=i.showCloseButton,se=void 0===ce||ce,ue=i.confirmDisabled,me=void 0!==ue&&ue,pe=i.width,he=void 0===pe?260:pe,ge=i.maxWidth,fe=void 0===ge?260:ge,xe=i.className,be=i.styles,Ce=i.reviewAction,Ee=o(function(){return(null!=N?N:G?M(G,Ce,V,U):[]).filter(function(e){return e.id!==S.SET_RANGE})},[N,U,V,G,Ce]),ve=l(O),Fe=ve[0],ye=ve[1],Se=l(null==V?"":String(V)),we=Se[0],Re=Se[1],Ae=l(null==U?"":String(U)),Me=Ae[0],Ie=Ae[1],ke=l(!1),ze=ke[0],Te=ke[1],We=l(!1),_e=We[0],Pe=We[1],Ne=l(null),Ge=Ne[0],De=Ne[1],Be=void 0===j?Fe:j,je=null==Be?void 0:Ee[Be],He=(null==je?void 0:je.id)===R,Oe=null!=D,Ve=null!=B,Ue=function(e){return!0===e.disabled||e.id===S.MERGE_PREV&&!Oe||e.id===S.MERGE_PREVIOUS&&!Oe||e.id===S.MERGE_NEXT&&!Ve||e.id===R&&!Oe&&!Ve},Le=Number(we),Xe=Number(Me),Ke=we.trim().length>0&&Me.trim().length>0&&Number.isInteger(Le)&&Number.isInteger(Xe)&&Le>0&&Xe>0&&Le<=Xe,qe=me||!je||Ue(je)||He&&null==Ge||!X&&!K;return t(g,e({className:xe,elevation:4,sx:w({width:he,maxWidth:fe,borderTop:"4px solid",borderColor:"error.main",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",boxSizing:"border-box","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==be?void 0:be.root)},{children:n(x,e({spacing:.75,sx:{p:1}},{children:[n(x,e({direction:"row",alignItems:"center",spacing:.75,sx:null==be?void 0:be.header},{children:[t(y,{color:"error",height:16,width:16}),t(C,e({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:k})),se&&t(h,e({size:"small",onClick:Y,disabled:!Y,"aria-label":"Close boundary check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:t(a,{sx:{fontSize:17}})}))]})),n(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:z})),null!=T&&t(C,e({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:T})),t(p,{sx:{my:.625}}),null!=_?t(E,{children:_}):null!=W&&t(C,e({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:W}))]}),n(x,e({spacing:.625,role:"radiogroup","aria-label":"Boundary options"},{children:[Ee.map(function(i,r){var o=Be===r,l=Ue(i);return n(g,e({variant:"outlined",sx:w({borderColor:o?"#1976d2":"divider",borderRadius:2,bgcolor:l?"#F8FAFC":"background.paper",overflow:"hidden"},null==be?void 0:be.option)},{children:[n(m,e({role:"radio","aria-checked":o,disabled:me||l,onClick:function(){return function(e,i){me||Ue(i)||(void 0===j&&ye(e),i.id!==R&&De(null),ze&&(Te(!1),Pe(!1)),null==L||L(e,i))}(r,i)},sx:{width:"100%",justifyContent:"flex-start",px:.75,py:.5,textAlign:"left"}},{children:[t(f,{checked:o,disabled:me||l,tabIndex:-1,size:"small",sx:{p:.25,mr:.5,"&.Mui-disabled":{color:"#CBD5E1"}}}),n(s,e({sx:{minWidth:0}},{children:[t(C,e({sx:{color:l?"#94A3B8":"text.primary",fontSize:12.5,fontWeight:500}},{children:i.title})),null!=i.description&&t(C,e({sx:{mt:.125,color:l?"#94A3B8":"text.secondary",fontSize:11}},{children:i.description}))]}))]})),o&&i.id===R&&t(x,e({direction:"row",spacing:.75,sx:w({px:.75,pb:.75},null==be?void 0:be.adjacentSelector)},{children:[{direction:"previous",title:null!=D?D:"No Previous document",caption:"← Merge into Previous",available:Oe},{direction:"next",title:null!=B?B:"No Next document",caption:"Merge into Next →",available:Ve}].map(function(i){var r=Ge===i.direction;return n(x,e({sx:{flex:1,minWidth:0}},{children:[t(m,e({disabled:me||!i.available,onClick:function(){return De(i.direction)},"aria-pressed":r,sx:{width:"100%",minWidth:0,minHeight:46,alignItems:"flex-start",justifyContent:"flex-start",p:.625,border:"1px solid",borderColor:r?"#7F56D9":"#D0D5DD",borderRadius:1.5,bgcolor:r?"#E0E7FF":"background.paper",color:r?"#7F56D9":i.available?"text.primary":"#98A2B3",textAlign:"left","&.Mui-disabled":{color:"#98A2B3",bgcolor:"#F8FAFC"}}},{children:t(C,e({sx:{color:"inherit",fontSize:11,fontWeight:500,lineHeight:1.25,overflowWrap:"anywhere"}},{children:i.title}))})),t(C,e({sx:{mt:.5,color:r?"#5925DC":"text.secondary",fontSize:9.5,lineHeight:1.2,whiteSpace:"nowrap",textAlign:"next"===i.direction?"right":"left"}},{children:i.caption}))]}),i.direction)})}))]}),i.id)}),He&&null!=Ge&&n(x,e({direction:"row",alignItems:"flex-start",spacing:.625,sx:w({p:.75,border:"1px solid #FCA5A5",borderRadius:1.5,bgcolor:"#FEF2F2"},null==be?void 0:be.impactWarning)},{children:[t(y,{color:"error",height:14,width:14,sx:{mt:.125}}),n(C,e({sx:{color:"#DC2626",fontSize:10.5,lineHeight:1.4}},{children:["This will impact the ",Ge," document. Its content and page range will change."]}))]})),t(u,e({variant:"contained",fullWidth:!0,disabled:qe,onClick:function(){if(!qe&&null!=Be&&je){var i=He?"previous"===Ge?S.MERGE_PREVIOUS:S.MERGE_NEXT:je.id,t=He?e(e({},je),{id:i}):je,n={selectedIndex:Be,option:t,metadata:G};null==X||X(Be,t,n),K&&A(i)&&K(i,n)}},sx:w({minHeight:32,mt:.25,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",backgroundColor:"#5925DC","&:hover":{backgroundColor:"#4A1FB8"},"&.Mui-disabled":{backgroundColor:"#D9D6FE",color:"#FFFFFF"}},null==be?void 0:be.confirmButton)},{children:Z}))]})),le&&n(x,e({spacing:.625,sx:null==be?void 0:be.manualSection},{children:[n(m,e({disabled:me,onClick:function(){var e=!ze;Te(e),Pe(!1),e&&(void 0===j&&ye(null),null==J||J())},"aria-expanded":ze,sx:{width:"100%",justifyContent:"space-between",borderRadius:1,textAlign:"left"}},{children:[n(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:11}},{children:ee})),t(C,e({sx:{mt:.125,color:"text.primary",fontSize:11}},{children:te}))]}),t(c,{sx:{color:"text.secondary",fontSize:16,transform:ze?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]})),ze&&!_e&&n(s,e({sx:{pt:.5,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif'}},{children:[n(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(C,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Starts"})),t(C,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Ends"}))]})),n(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(b,{size:"small",type:"number",value:we,disabled:me,onChange:function(e){return Re(e.target.value)},inputProps:{min:1,step:1,inputMode:"numeric"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"},"& input[type=number]":{MozAppearance:"textfield"},"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0}},onWheel:function(e){return e.currentTarget.blur()}}),t(b,{size:"small",type:"number",value:Me,disabled:me,error:we.trim().length>0&&Me.trim().length>0&&Le>Xe,onChange:function(e){return Ie(e.target.value)},inputProps:{min:1,step:1,inputMode:"numeric"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"},"& input[type=number]":{MozAppearance:"textfield"},"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0}},onWheel:function(e){return e.currentTarget.blur()}})]})),t(s,{children:t(u,e({onClick:function(){Ke&&Pe(!0)},disabled:me||!Ke,sx:{height:"30px",padding:"0 12px",display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",backgroundColor:"#FFFFFF",border:"1px solid #8E80F3",borderRadius:"6px",fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif',fontSize:"12px",fontWeight:600,lineHeight:"1",color:"#4A24CF",outline:"none",cursor:"pointer",textTransform:"none",transition:"all 150ms ease-in-out","&:hover":Ke?{backgroundColor:"#FAF9FF",borderColor:"#7F6FF0"}:{},"&:active":Ke?{transform:"translateY(1px)"}:{},"&.Mui-disabled":{backgroundColor:"#FFFFFF",borderColor:"#C3CFDC",color:"#A0ABBE",cursor:"not-allowed"}}},{children:"Apply"}))}),t(s,{sx:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"#EEF0F2",border:"0"}})]})),ze&&_e&&n(x,e({spacing:.75,sx:w({p:.75,borderRadius:1.5,bgcolor:"#FFF7ED"},null==be?void 0:be.manualConfirmation)},{children:[n(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(y,{color:"warning",height:14,width:14}),t(C,e({sx:{color:"#EA580C",fontSize:11,fontWeight:600}},{children:"Confirm this change?"}))]})),n(C,e({sx:{color:"text.secondary",fontSize:10.5,lineHeight:1.4}},{children:["Pages ",Le,"-",Xe," will become part of ",z,", including pages from other documents in this range."]})),n(x,e({direction:"row",spacing:.75},{children:[t(u,e({variant:"outlined",fullWidth:!0,onClick:function(){return Pe(!1)},sx:{minHeight:28,borderRadius:1.5,fontSize:11,textTransform:"none"}},{children:"Cancel"})),t(u,e({variant:"contained",fullWidth:!0,disabled:me||!X,onClick:function(){if(Ke&&X){var e={id:S.SET_RANGE,title:te};X(-1,e,{selectedIndex:-1,option:e,startPage:Le,endPage:Xe,metadata:G})}},sx:{minHeight:28,borderRadius:1.5,bgcolor:"#EA580C",fontSize:11,textTransform:"none","&:hover":{bgcolor:"#C2410C"}}},{children:"Confirm"}))]}))]}))]})),t(x,e({spacing:.625,sx:null==be?void 0:be.footer},{children:ae&&n(r,{children:[t(p,{}),n(m,e({onClick:q,disabled:!q,sx:{justifyContent:"space-between",borderRadius:1,textAlign:"left",cursor:q?"pointer":"not-allowed"}},{children:[n(x,e({direction:"row",alignItems:"center",spacing:1},{children:[t(v,{sx:{color:"text.secondary"}}),t(C,e({sx:{color:"text.primary",fontSize:12}},{children:re}))]})),n(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(F,{score:P}),t(d,{sx:{color:"text.secondary"}})]}))]}))]})}))]}))}))}export{S as BoundaryReviewActionEnum,M as createBoundaryCardOptions,I as default,A as isBoundaryReviewAction};
1
+ import{__assign as e,__spreadArray as i}from"tslib";import{jsx as t,jsxs as n,Fragment as r}from"react/jsx-runtime";import{useMemo as o,useState as l}from"react";import d from"@mui/icons-material/ChevronRight";import a from"@mui/icons-material/Close";import c from"@mui/icons-material/ExpandMore";import s from"@mui/material/Box";import u from"@mui/material/Button";import m from"@mui/material/ButtonBase";import p from"@mui/material/Divider";import h from"@mui/material/IconButton";import g from"@mui/material/Paper";import f from"@mui/material/Radio";import x from"@mui/material/Stack";import b from"@mui/material/TextField";import C from"@mui/material/Typography";import E from"./CognitiveIcon.js";import v from"./CognitiveScoreBadge.js";import F from"../../assests/icons/InfoAlert.js";var y,S=function(e,t){return i([e],Array.isArray(t)?t:null==t?[]:[t],!0)},w="MERGE_ADJACENT";!function(e){e.KEEP="KEEP",e.SPLIT_HERE="SPLIT_HERE",e.MERGE_NEXT="MERGE_NEXT",e.MERGE_PREV="MERGE_PREV",e.MERGE_PREVIOUS="MERGE_PREVIOUS",e.SET_RANGE="SET_RANGE"}(y||(y={}));var R=function(e){return Object.values(y).includes(e)},A=function(e,t,n,r){if(!t||!e)return[];var o=t.additional_decisions,l=Array.isArray(o)?o:o?Object.values(o).flat():[],d=Array.from(new Set(i(i([],t.allowed_decisions,!0),l,!0)));return d.flatMap(function(i){var t=e.focus_page,o=d.find(function(e){return e.toLowerCase().includes("merge")}),l=null!=t&&null!=n&&null!=r&&t===n&&t===r,a=null!=t&&null!=n&&t===n,c=null!=t&&null!=r&&(t===r||t===r+1),s=a||c||!(null!=t&&(!(null!=n&&null!=r)||t>n&&t<r));switch(i){case y.SET_RANGE:return[];case"KEEP":return[{id:i,title:"Keep as is",description:"Keep the current document boundary unchanged."}];case"SPLIT_HERE":return[{id:i,title:"Split to a separate document",description:s?"A valid page inside the document is required to split it.":t?"Start a new document at page ".concat(t,"."):"Create a new document at this boundary.",disabled:s}];case"MERGE_PREV":case"MERGE_NEXT":case"MERGE_PREVIOUS":return i!==o?[]:l?[{id:w,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]:a?[{id:y.MERGE_PREVIOUS,title:"Merge with previous document",description:"Combine this document with the previous document."}]:c?[{id:y.MERGE_NEXT,title:"Merge with next document",description:"Combine this document with the next document."}]:[{id:w,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]}return[]})};function M(i){var M=i.headerName,I=void 0===M?"Boundary Check":M,k=i.title,z=i.pageNo,T=i.content,W=i.cognitiveScore,_=i.config,P=i.metadata,G=i.previousSegmentTitle,N=i.nextSegmentTitle,D=i.selectedIndex,B=i.defaultSelectedIndex,H=void 0===B?null:B,j=i.defaultStartPage,O=i.defaultEndPage,V=i.onSelectionChange,U=i.onConfirm,L=i.onActionConfirm,X=i.onCognitiveClick,K=i.onAdjustManually,q=i.onClose,J=i.confirmLabel,Y=void 0===J?"Confirm":J,Q=i.manualPrompt,Z=void 0===Q?"Didn't find the right option?":Q,$=i.manualActionLabel,ee=void 0===$?"Adjust Manually":$,ie=i.cognitiveLabel,te=void 0===ie?"Cognitive Integrity":ie,ne=i.showAdjustManually,re=void 0===ne||ne,oe=i.showCognitiveIntegrity,le=void 0===oe||oe,de=i.showCloseButton,ae=void 0===de||de,ce=i.confirmDisabled,se=void 0!==ce&&ce,ue=i.width,me=void 0===ue?260:ue,pe=i.maxWidth,he=void 0===pe?260:pe,ge=i.className,fe=i.styles,xe=i.reviewAction,be=o(function(){return(null!=_?_:P?A(P,xe,j,O):[]).filter(function(e){return e.id!==y.SET_RANGE})},[_,O,j,P,xe]),Ce=l(H),Ee=Ce[0],ve=Ce[1],Fe=l(null==j?"":String(j)),ye=Fe[0],Se=Fe[1],we=l(null==O?"":String(O)),Re=we[0],Ae=we[1],Me=l(!1),Ie=Me[0],ke=Me[1],ze=l(!1),Te=ze[0],We=ze[1],_e=l(null),Pe=_e[0],Ge=_e[1],Ne=void 0===D?Ee:D,De=null==Ne?void 0:be[Ne],Be=(null==De?void 0:De.id)===w,He=null!=G,je=null!=N,Oe=function(e){return!0===e.disabled||e.id===y.MERGE_PREV&&!He||e.id===y.MERGE_PREVIOUS&&!He||e.id===y.MERGE_NEXT&&!je||e.id===w&&!He&&!je},Ve=Number(ye),Ue=Number(Re),Le=ye.trim().length>0&&Re.trim().length>0&&Number.isInteger(Ve)&&Number.isInteger(Ue)&&Ve>0&&Ue>0&&Ve<=Ue,Xe=se||!De||Oe(De)||Be&&null==Pe||!U&&!L;return t(g,e({className:ge,elevation:4,sx:S({width:me,maxWidth:he,borderTop:"4px solid",borderColor:"error.main",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",boxSizing:"border-box","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==fe?void 0:fe.root)},{children:n(x,e({spacing:.75,sx:{p:1}},{children:[n(x,e({direction:"row",alignItems:"center",spacing:.75,sx:null==fe?void 0:fe.header},{children:[t(F,{color:"error",height:16,width:16}),t(C,e({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:I})),ae&&t(h,e({size:"small",onClick:q,disabled:!q,"aria-label":"Close boundary check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:t(a,{sx:{fontSize:17}})}))]})),n(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:k})),null!=z&&t(C,e({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:z})),t(p,{sx:{my:.625}}),null!=T&&t(C,e({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:T}))]}),n(x,e({spacing:.625,role:"radiogroup","aria-label":"Boundary options"},{children:[be.map(function(i,r){var o=Ne===r,l=Oe(i);return n(g,e({variant:"outlined",sx:S({borderColor:o?"#1976d2":"divider",borderRadius:2,bgcolor:l?"#F8FAFC":"background.paper",overflow:"hidden"},null==fe?void 0:fe.option)},{children:[n(m,e({role:"radio","aria-checked":o,disabled:se||l,onClick:function(){return function(e,i){se||Oe(i)||(void 0===D&&ve(e),i.id!==w&&Ge(null),Ie&&(ke(!1),We(!1)),null==V||V(e,i))}(r,i)},sx:{width:"100%",justifyContent:"flex-start",px:.75,py:.5,textAlign:"left"}},{children:[t(f,{checked:o,disabled:se||l,tabIndex:-1,size:"small",sx:{p:.25,mr:.5,"&.Mui-disabled":{color:"#CBD5E1"}}}),n(s,e({sx:{minWidth:0}},{children:[t(C,e({sx:{color:l?"#94A3B8":"text.primary",fontSize:12.5,fontWeight:500}},{children:i.title})),null!=i.description&&t(C,e({sx:{mt:.125,color:l?"#94A3B8":"text.secondary",fontSize:11}},{children:i.description}))]}))]})),o&&i.id===w&&t(x,e({direction:"row",spacing:.75,sx:S({px:.75,pb:.75},null==fe?void 0:fe.adjacentSelector)},{children:[{direction:"previous",title:null!=G?G:"No Previous document",caption:"← Merge into Previous",available:He},{direction:"next",title:null!=N?N:"No Next document",caption:"Merge into Next →",available:je}].map(function(i){var r=Pe===i.direction;return n(x,e({sx:{flex:1,minWidth:0}},{children:[t(m,e({disabled:se||!i.available,onClick:function(){return Ge(i.direction)},"aria-pressed":r,sx:{width:"100%",minWidth:0,minHeight:46,alignItems:"flex-start",justifyContent:"flex-start",p:.625,border:"1px solid",borderColor:r?"#7F56D9":"#D0D5DD",borderRadius:1.5,bgcolor:r?"#E0E7FF":"background.paper",color:r?"#7F56D9":i.available?"text.primary":"#98A2B3",textAlign:"left","&.Mui-disabled":{color:"#98A2B3",bgcolor:"#F8FAFC"}}},{children:t(C,e({sx:{color:"inherit",fontSize:11,fontWeight:500,lineHeight:1.25,overflowWrap:"anywhere"}},{children:i.title}))})),t(C,e({sx:{mt:.5,color:r?"#5925DC":"text.secondary",fontSize:9.5,lineHeight:1.2,whiteSpace:"nowrap",textAlign:"next"===i.direction?"right":"left"}},{children:i.caption}))]}),i.direction)})}))]}),i.id)}),Be&&null!=Pe&&n(x,e({direction:"row",alignItems:"flex-start",spacing:.625,sx:S({p:.75,border:"1px solid #FCA5A5",borderRadius:1.5,bgcolor:"#FEF2F2"},null==fe?void 0:fe.impactWarning)},{children:[t(F,{color:"error",height:14,width:14,sx:{mt:.125}}),n(C,e({sx:{color:"#DC2626",fontSize:10.5,lineHeight:1.4}},{children:["This will impact the ",Pe," document. Its content and page range will change."]}))]})),t(u,e({variant:"contained",fullWidth:!0,disabled:Xe,onClick:function(){if(!Xe&&null!=Ne&&De){var i=Be?"previous"===Pe?y.MERGE_PREVIOUS:y.MERGE_NEXT:De.id,t=Be?e(e({},De),{id:i}):De,n={selectedIndex:Ne,option:t,metadata:P};null==U||U(Ne,t,n),L&&R(i)&&L(i,n)}},sx:S({minHeight:32,mt:.25,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",backgroundColor:"#5925DC","&:hover":{backgroundColor:"#4A1FB8"},"&.Mui-disabled":{backgroundColor:"#D9D6FE",color:"#FFFFFF"}},null==fe?void 0:fe.confirmButton)},{children:Y}))]})),re&&n(x,e({spacing:.625,sx:null==fe?void 0:fe.manualSection},{children:[n(m,e({disabled:se,onClick:function(){var e=!Ie;ke(e),We(!1),e&&(void 0===D&&ve(null),null==K||K())},"aria-expanded":Ie,sx:{width:"100%",justifyContent:"space-between",borderRadius:1,textAlign:"left"}},{children:[n(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:11}},{children:Z})),t(C,e({sx:{mt:.125,color:"text.primary",fontSize:11}},{children:ee}))]}),t(c,{sx:{color:"text.secondary",fontSize:16,transform:Ie?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]})),Ie&&!Te&&n(s,e({sx:{pt:.5,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif'}},{children:[n(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(C,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Starts"})),t(C,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Ends"}))]})),n(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(b,{size:"small",type:"number",value:ye,disabled:se,onChange:function(e){return Se(e.target.value)},inputProps:{min:1,step:1,inputMode:"numeric"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"},"& input[type=number]":{MozAppearance:"textfield"},"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0}},onWheel:function(e){return e.currentTarget.blur()}}),t(b,{size:"small",type:"number",value:Re,disabled:se,error:ye.trim().length>0&&Re.trim().length>0&&Ve>Ue,onChange:function(e){return Ae(e.target.value)},inputProps:{min:1,step:1,inputMode:"numeric"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"},"& input[type=number]":{MozAppearance:"textfield"},"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0}},onWheel:function(e){return e.currentTarget.blur()}})]})),t(s,{children:t(u,e({onClick:function(){Le&&We(!0)},disabled:se||!Le,sx:{height:"30px",padding:"0 12px",display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",backgroundColor:"#FFFFFF",border:"1px solid #8E80F3",borderRadius:"6px",fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif',fontSize:"12px",fontWeight:600,lineHeight:"1",color:"#4A24CF",outline:"none",cursor:"pointer",textTransform:"none",transition:"all 150ms ease-in-out","&:hover":Le?{backgroundColor:"#FAF9FF",borderColor:"#7F6FF0"}:{},"&:active":Le?{transform:"translateY(1px)"}:{},"&.Mui-disabled":{backgroundColor:"#FFFFFF",borderColor:"#C3CFDC",color:"#A0ABBE",cursor:"not-allowed"}}},{children:"Apply"}))}),t(s,{sx:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"#EEF0F2",border:"0"}})]})),Ie&&Te&&n(x,e({spacing:.75,sx:S({p:.75,borderRadius:1.5,bgcolor:"#FFF7ED"},null==fe?void 0:fe.manualConfirmation)},{children:[n(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(F,{color:"warning",height:14,width:14}),t(C,e({sx:{color:"#EA580C",fontSize:11,fontWeight:600}},{children:"Confirm this change?"}))]})),n(C,e({sx:{color:"text.secondary",fontSize:10.5,lineHeight:1.4}},{children:["Pages ",Ve,"-",Ue," will become part of ",k,", including pages from other documents in this range."]})),n(x,e({direction:"row",spacing:.75},{children:[t(u,e({variant:"outlined",fullWidth:!0,onClick:function(){return We(!1)},sx:{minHeight:28,borderRadius:1.5,fontSize:11,textTransform:"none"}},{children:"Cancel"})),t(u,e({variant:"contained",fullWidth:!0,disabled:se||!U,onClick:function(){if(Le&&U){var e={id:y.SET_RANGE,title:ee};U(-1,e,{selectedIndex:-1,option:e,startPage:Ve,endPage:Ue,metadata:P})}},sx:{minHeight:28,borderRadius:1.5,bgcolor:"#EA580C",fontSize:11,textTransform:"none","&:hover":{bgcolor:"#C2410C"}}},{children:"Confirm"}))]}))]}))]})),t(x,e({spacing:.625,sx:null==fe?void 0:fe.footer},{children:le&&n(r,{children:[t(p,{}),n(m,e({onClick:X,disabled:!X,sx:{justifyContent:"space-between",borderRadius:1,textAlign:"left",cursor:X?"pointer":"not-allowed"}},{children:[n(x,e({direction:"row",alignItems:"center",spacing:1},{children:[t(E,{sx:{color:"text.secondary"}}),t(C,e({sx:{color:"text.primary",fontSize:12}},{children:te}))]})),n(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(v,{score:W}),t(d,{sx:{color:"text.secondary"}})]}))]}))]})}))]}))}))}export{y as BoundaryReviewActionEnum,A as createBoundaryCardOptions,M as default,R as isBoundaryReviewAction};
2
2
  //# sourceMappingURL=BoundaryCard.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i,__spreadArray as e}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import o from"@mui/icons-material/ChevronLeft";import r from"@mui/icons-material/Close";import l from"@mui/material/Box";import a from"@mui/material/Divider";import m from"@mui/material/IconButton";import s from"@mui/material/Paper";import c from"@mui/material/Stack";import d from"@mui/material/Typography";import h from"../CitationRenderer/MarkdownRenderer.js";import u from"./CognitiveIcon.js";import p from"./CognitiveScoreBadge.js";var g=function(i,t){return e([i],Array.isArray(t)?t:null==t?[]:[t],!0)};function f(e){var f=e.reasons,x=e.reason,v=e.gap,y=e.score,b=e.headerName,S=void 0===b?"Cognitive Integrity":b,C=e.onBack,H=e.onClose,w=e.showCloseButton,z=void 0===w||w,k=e.width,W=void 0===k?260:k,B=e.maxWidth,A=void 0===B?260:B,R=e.className,I=e.styles,j=(null!=f?f:[]).filter(function(i){return"evidence"===i.type.trim().toLowerCase()}).map(function(i){return i.text.trim()}).filter(Boolean),T=(null!=f?f:[]).filter(function(i){return"gap"===i.type.trim().toLowerCase()}).map(function(i){return i.text.trim()}).filter(Boolean),L=null==x?void 0:x.trim(),M=null==v?void 0:v.trim();if(0===j.length&&L&&j.push(L),0===T.length&&M&&T.push(M),0===j.length&&0===T.length)return null;var N,D=(N=null==I?void 0:I.markdown,i(i({},N),{containerWrapper:i(i({},null==N?void 0:N.containerWrapper),{display:"block",height:"auto",minHeight:0,maxHeight:"fit-content",flex:"0 0 auto"}),mainCard:i(i({},null==N?void 0:N.mainCard),{height:"auto",minHeight:0,maxHeight:"none",flex:"0 0 auto",padding:0,border:"none",borderRadius:0,boxShadow:"none",backgroundColor:"transparent"}),scrollArea:i({height:"auto",minHeight:0,maxHeight:"none",overflowY:"visible",paddingRight:0,color:"#475467",fontSize:11.5,lineHeight:1.3},null==N?void 0:N.scrollArea),list:i({margin:"0",padding:"0 0 0 18px",fontSize:"11.5px",lineHeight:"1.3"},null==N?void 0:N.list)})),P=i(i({},D),{scrollArea:i(i({},D.scrollArea),{fontSize:"inherit",lineHeight:"inherit"}),summary:i(i({},D.summary),{display:"inline-flex",padding:0,fontSize:"inherit",lineHeight:"inherit"})}),F={m:0,pl:2.25,listStyleType:"decimal",listStylePosition:"outside",fontSize:11.5,lineHeight:1.3,"& > li":{pl:.25,fontSize:"inherit",lineHeight:"inherit"},"& > li::marker":{fontSize:"1em",fontWeight:"inherit"}};return t(s,i({className:R,elevation:4,sx:g({width:W,maxWidth:A,height:"fit-content",minHeight:0,alignSelf:"flex-start",flex:"0 0 auto",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",boxSizing:"border-box","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==I?void 0:I.root)},{children:n(c,i({spacing:.75,sx:{p:1,height:"auto",minHeight:0}},{children:[n(c,i({direction:"row",alignItems:"center",spacing:.75,sx:null==I?void 0:I.header},{children:[C&&t(m,i({size:"small",onClick:C,"aria-label":"Return to review check",sx:{p:0,color:"#6941C6"}},{children:t(o,{sx:{fontSize:17}})})),t(u,{sx:{color:"#6941C6"}}),t(d,i({sx:{flex:1,fontSize:12,fontWeight:500,alignItems:"center",display:"flex",lineHeight:1.25,textTransform:"capitalise"}},{children:S})),t(p,{score:y}),z&&t(m,i({size:"small",onClick:H,disabled:!H,"aria-label":"Close cognitive integrity",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:t(r,{sx:{fontSize:17}})}))]})),n(c,i({spacing:.75,sx:g({height:"auto",minHeight:0,flex:"0 0 auto"},null==I?void 0:I.content)},{children:[j.length>0&&n(l,i({sx:{marginTop:4}},{children:[t(d,i({sx:{mt:1,mb:.25,color:"text.primary",fontSize:12,fontWeight:500}},{children:"Decision Making Factors"})),t(a,{sx:{my:.625}}),t(l,i({component:"ol",sx:F,style:D.list},{children:j.map(function(e,n){return t(l,i({component:"li",sx:{mb:.5}},{children:t(h,{value:"<summary>".concat(e,"</summary>"),styles:P})}),"evidence-".concat(n))})}))]})),T.length>0&&n(l,i({sx:null==I?void 0:I.section},{children:[t(d,i({sx:{mb:.25,color:"text.primary",fontSize:12,fontWeight:500}},{children:"Gap"})),t(a,{sx:{my:.625}}),t(l,i({component:"ol",sx:F,style:D.list},{children:T.map(function(e,n){return t(l,i({component:"li",sx:{mb:.5}},{children:t(h,{value:"<summary>".concat(e,"</summary>"),styles:P})}),"gap-".concat(n))})}))]}))]}))]}))}))}export{f as default};
1
+ import{__assign as i,__spreadArray as e}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import o from"@mui/icons-material/ChevronLeft";import r from"@mui/icons-material/Close";import l from"@mui/material/Box";import a from"@mui/material/Divider";import m from"@mui/material/IconButton";import s from"@mui/material/Paper";import c from"@mui/material/Stack";import d from"@mui/material/Typography";import h from"../CitationRenderer/MarkdownRenderer.js";import u from"./CognitiveIcon.js";import p from"./CognitiveScoreBadge.js";var g=function(i,t){return e([i],Array.isArray(t)?t:null==t?[]:[t],!0)};function f(e){var f=e.reasons,x=e.reason,v=e.gap,y=e.score,b=e.headerName,S=void 0===b?"Cognitive Integrity":b,C=e.onBack,H=e.onClose,w=e.showCloseButton,z=void 0===w||w,k=e.width,W=void 0===k?260:k,B=e.maxWidth,A=void 0===B?260:B,R=e.className,I=e.styles,j=(null!=f?f:[]).filter(function(i){return"evidence"===i.type.trim().toLowerCase()}).map(function(i){return i.text.trim()}).filter(Boolean),T=(null!=f?f:[]).filter(function(i){return"gap"===i.type.trim().toLowerCase()}).map(function(i){return i.text.trim()}).filter(Boolean),L=null==x?void 0:x.trim(),M=null==v?void 0:v.trim();if(0===j.length&&L&&j.push(L),0===T.length&&M&&T.push(M),0===j.length&&0===T.length)return null;var N,D=(N=null==I?void 0:I.markdown,i(i({},N),{containerWrapper:i(i({},null==N?void 0:N.containerWrapper),{display:"block",height:"auto",minHeight:0,maxHeight:"none",flex:"0 0 auto"}),mainCard:i(i({},null==N?void 0:N.mainCard),{height:"auto",minHeight:0,maxHeight:"none",flex:"0 0 auto",padding:0,border:"none",borderRadius:0,boxShadow:"none",backgroundColor:"transparent"}),scrollArea:i({height:"auto",minHeight:0,maxHeight:"none",overflowY:"visible",paddingRight:0,color:"#475467",fontSize:11.5,lineHeight:1.3},null==N?void 0:N.scrollArea),list:i({margin:"0",padding:"0 0 0 18px",fontSize:"11.5px",lineHeight:"1.3"},null==N?void 0:N.list)})),P=i(i({},D),{scrollArea:i(i({},D.scrollArea),{fontSize:"inherit",lineHeight:"inherit"}),summary:i(i({},D.summary),{display:"inline-flex",padding:0,fontSize:"inherit",lineHeight:"inherit"})}),F={m:0,pl:2.25,listStyleType:"decimal",listStylePosition:"outside",fontSize:11.5,lineHeight:1.3,"& > li":{pl:.25,fontSize:"inherit",lineHeight:"inherit"},"& > li::marker":{fontSize:"1em",fontWeight:"inherit"}};return t(s,i({className:R,elevation:4,sx:g({width:W,maxWidth:A,height:"fit-content",minHeight:0,alignSelf:"flex-start",flex:"0 0 auto",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",boxSizing:"border-box","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==I?void 0:I.root)},{children:n(c,i({spacing:.75,sx:{p:1,height:"auto",minHeight:0}},{children:[n(c,i({direction:"row",alignItems:"center",spacing:.75,sx:null==I?void 0:I.header},{children:[C&&t(m,i({size:"small",onClick:C,"aria-label":"Return to review check",sx:{p:0,color:"#6941C6"}},{children:t(o,{sx:{fontSize:17}})})),t(u,{sx:{color:"#6941C6"}}),t(d,i({sx:{flex:1,fontSize:12,fontWeight:500,alignItems:"center",display:"flex",lineHeight:1.25,textTransform:"capitalise"}},{children:S})),t(p,{score:y}),z&&t(m,i({size:"small",onClick:H,disabled:!H,"aria-label":"Close cognitive integrity",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:t(r,{sx:{fontSize:17}})}))]})),n(c,i({spacing:.75,sx:g({height:"auto",minHeight:0,flex:"0 0 auto"},null==I?void 0:I.content)},{children:[j.length>0&&n(l,i({sx:{marginTop:4}},{children:[t(d,i({sx:{mt:1,mb:.25,color:"text.primary",fontSize:12,fontWeight:500}},{children:"Decision Making Factors"})),t(a,{sx:{my:.625}}),t(l,i({component:"ol",sx:F,style:D.list},{children:j.map(function(e,n){return t(l,i({component:"li",sx:{mb:.5}},{children:t(h,{value:"<summary>".concat(e,"</summary>"),styles:P})}),"evidence-".concat(n))})}))]})),T.length>0&&n(l,i({sx:null==I?void 0:I.section},{children:[t(d,i({sx:{mb:.25,color:"text.primary",fontSize:12,fontWeight:500}},{children:"Gap"})),t(a,{sx:{my:.625}}),t(l,i({component:"ol",sx:F,style:D.list},{children:T.map(function(e,n){return t(l,i({component:"li",sx:{mb:.5}},{children:t(h,{value:"<summary>".concat(e,"</summary>"),styles:P})}),"gap-".concat(n))})}))]}))]}))]}))}))}export{f as default};
2
2
  //# sourceMappingURL=CognitiveIntegrity.js.map