@viswa-test/test-citation 0.0.382 → 0.0.383

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 (440) hide show
  1. package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/CitationRenderer.js +1 -1
  3. package/dist/cjs/features/CognitiveCompare/CitationRendererInner.js +2 -0
  4. package/dist/cjs/features/CognitiveCompare/CitationRendererInner.js.map +1 -0
  5. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  6. package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
  7. package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  8. package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
  9. package/dist/cjs/features/CognitiveCompare/CompareContext.js +1 -1
  10. package/dist/cjs/features/CognitiveCompare/GptWebCitationPanel.js +2 -0
  11. package/dist/cjs/features/CognitiveCompare/GptWebCitationPanel.js.map +1 -0
  12. package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
  13. package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
  14. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
  15. package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  16. package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  17. package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  18. package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  19. package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  20. package/dist/cjs/features/CognitiveCompare/hooks/useOnDemandCitationCache.js +2 -0
  21. package/dist/cjs/features/CognitiveCompare/hooks/useOnDemandCitationCache.js.map +1 -0
  22. package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
  23. package/dist/cjs/features/CognitiveCompare/onDemandCitations/cacheKey.js +2 -0
  24. package/dist/cjs/features/CognitiveCompare/onDemandCitations/cacheKey.js.map +1 -0
  25. package/dist/cjs/features/CognitiveCompare/onDemandCitations/contextBuilder.js +2 -0
  26. package/dist/cjs/features/CognitiveCompare/onDemandCitations/contextBuilder.js.map +1 -0
  27. package/dist/cjs/features/CognitiveCompare/onDemandCitations/href.js +2 -0
  28. package/dist/cjs/features/CognitiveCompare/onDemandCitations/href.js.map +1 -0
  29. package/dist/cjs/features/CognitiveCompare/onDemandCitations/payload.js +2 -0
  30. package/dist/cjs/features/CognitiveCompare/onDemandCitations/payload.js.map +1 -0
  31. package/dist/cjs/features/CognitiveCompare/onDemandCitations/response.js +2 -0
  32. package/dist/cjs/features/CognitiveCompare/onDemandCitations/response.js.map +1 -0
  33. package/dist/cjs/features/CognitiveCompare/utils/normalizeInlineMarkdown.js +2 -0
  34. package/dist/cjs/features/CognitiveCompare/utils/normalizeInlineMarkdown.js.map +1 -0
  35. package/dist/cjs/features/CognitiveCompare/utils/onDemandCitations.js +2 -0
  36. package/dist/cjs/features/CognitiveCompare/utils/onDemandCitations.js.map +1 -0
  37. package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
  38. package/dist/cjs/features/GptWebCitation/GptWebCitation.js +1 -1
  39. package/dist/cjs/features/GptWebCitation/GptWebCitationImageCitation.js +1 -1
  40. package/dist/cjs/features/GptWebCitation/utils/fixedHeight.utils.js +1 -1
  41. package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
  42. package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
  43. package/dist/cjs/features/PdfViewer/usePdfHighlight.js +1 -1
  44. package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  45. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.js +2 -0
  46. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.js.map +1 -0
  47. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js +2 -0
  48. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js.map +1 -0
  49. package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  50. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js +2 -0
  51. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js.map +1 -0
  52. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js +2 -0
  53. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js.map +1 -0
  54. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js +2 -0
  55. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js.map +1 -0
  56. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js +2 -0
  57. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js.map +1 -0
  58. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js +2 -0
  59. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js.map +1 -0
  60. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js +2 -0
  61. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js.map +1 -0
  62. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js +2 -0
  63. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js.map +1 -0
  64. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
  65. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  66. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  67. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
  68. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  69. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  70. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  71. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
  72. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +1 -1
  73. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +1 -1
  74. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +1 -1
  75. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +1 -1
  76. package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
  77. package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
  78. package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationContent.js +1 -1
  79. package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationContent.module.css.js +1 -1
  80. package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationRender.js +1 -1
  81. package/dist/cjs/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.js +1 -1
  82. package/dist/cjs/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.js +1 -1
  83. package/dist/cjs/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.js +1 -1
  84. package/dist/cjs/features/RequirementAI/components/segment/Segment.js +1 -1
  85. package/dist/cjs/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  86. package/dist/cjs/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
  87. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  88. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
  89. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  90. package/dist/cjs/features/RequirementAI/hooks/useStreamContentHandler.js +1 -1
  91. package/dist/cjs/features/RequirementAI/utils/helpers.js +1 -1
  92. package/dist/cjs/features/RequirementAI/utils/proccess-stream.utils.js +1 -1
  93. package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +1 -1
  94. package/dist/cjs/features/SegmentReviewComponents/CognitiveScoreBadge.js +1 -1
  95. package/dist/cjs/features/SegmentReviewComponents/RevertSuccessCard.js +1 -1
  96. package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
  97. package/dist/cjs/features/SegmentReviewComponents/helper.js +1 -1
  98. package/dist/cjs/features/SegmentReviewComponents/reviewStepAdapters.js +1 -1
  99. package/dist/cjs/index.js +1 -1
  100. package/dist/cjs/service/redlineService.js +1 -1
  101. package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
  102. package/dist/features/CognitiveCompare/CitationRenderer.js +1 -1
  103. package/dist/features/CognitiveCompare/CitationRendererInner.js +2 -0
  104. package/dist/features/CognitiveCompare/CitationRendererInner.js.map +1 -0
  105. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  106. package/dist/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
  107. package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  108. package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
  109. package/dist/features/CognitiveCompare/CompareContext.js +1 -1
  110. package/dist/features/CognitiveCompare/GptWebCitationPanel.js +2 -0
  111. package/dist/features/CognitiveCompare/GptWebCitationPanel.js.map +1 -0
  112. package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
  113. package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
  114. package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
  115. package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  116. package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  117. package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  118. package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  119. package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  120. package/dist/features/CognitiveCompare/hooks/useOnDemandCitationCache.js +2 -0
  121. package/dist/features/CognitiveCompare/hooks/useOnDemandCitationCache.js.map +1 -0
  122. package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
  123. package/dist/features/CognitiveCompare/onDemandCitations/cacheKey.js +2 -0
  124. package/dist/features/CognitiveCompare/onDemandCitations/cacheKey.js.map +1 -0
  125. package/dist/features/CognitiveCompare/onDemandCitations/contextBuilder.js +2 -0
  126. package/dist/features/CognitiveCompare/onDemandCitations/contextBuilder.js.map +1 -0
  127. package/dist/features/CognitiveCompare/onDemandCitations/href.js +2 -0
  128. package/dist/features/CognitiveCompare/onDemandCitations/href.js.map +1 -0
  129. package/dist/features/CognitiveCompare/onDemandCitations/payload.js +2 -0
  130. package/dist/features/CognitiveCompare/onDemandCitations/payload.js.map +1 -0
  131. package/dist/features/CognitiveCompare/onDemandCitations/response.js +2 -0
  132. package/dist/features/CognitiveCompare/onDemandCitations/response.js.map +1 -0
  133. package/dist/features/CognitiveCompare/utils/normalizeInlineMarkdown.js +2 -0
  134. package/dist/features/CognitiveCompare/utils/normalizeInlineMarkdown.js.map +1 -0
  135. package/dist/features/CognitiveCompare/utils/onDemandCitations.js +2 -0
  136. package/dist/features/CognitiveCompare/utils/onDemandCitations.js.map +1 -0
  137. package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
  138. package/dist/features/GptWebCitation/GptWebCitation.js +1 -1
  139. package/dist/features/GptWebCitation/GptWebCitationImageCitation.js +1 -1
  140. package/dist/features/GptWebCitation/utils/fixedHeight.utils.js +1 -1
  141. package/dist/features/PdfViewer/PdfToolbar.js +1 -1
  142. package/dist/features/PdfViewer/PdfViewer.js +1 -1
  143. package/dist/features/PdfViewer/usePdfHighlight.js +1 -1
  144. package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  145. package/dist/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.js +2 -0
  146. package/dist/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.js.map +1 -0
  147. package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js +2 -0
  148. package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js.map +1 -0
  149. package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  150. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js +2 -0
  151. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js.map +1 -0
  152. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js +2 -0
  153. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js.map +1 -0
  154. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js +2 -0
  155. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js.map +1 -0
  156. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js +2 -0
  157. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js.map +1 -0
  158. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js +2 -0
  159. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js.map +1 -0
  160. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js +2 -0
  161. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js.map +1 -0
  162. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js +2 -0
  163. package/dist/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js.map +1 -0
  164. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
  165. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  166. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  167. package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
  168. package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  169. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  170. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  171. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
  172. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +1 -1
  173. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +1 -1
  174. package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +1 -1
  175. package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +1 -1
  176. package/dist/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
  177. package/dist/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
  178. package/dist/features/RequirementAI/components/citations/file-citation/FileCitationContent.js +1 -1
  179. package/dist/features/RequirementAI/components/citations/file-citation/FileCitationContent.module.css.js +1 -1
  180. package/dist/features/RequirementAI/components/citations/file-citation/FileCitationRender.js +1 -1
  181. package/dist/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.js +1 -1
  182. package/dist/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.js +1 -1
  183. package/dist/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.js +1 -1
  184. package/dist/features/RequirementAI/components/segment/Segment.js +1 -1
  185. package/dist/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  186. package/dist/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
  187. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  188. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
  189. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  190. package/dist/features/RequirementAI/hooks/useStreamContentHandler.js +1 -1
  191. package/dist/features/RequirementAI/utils/helpers.js +1 -1
  192. package/dist/features/RequirementAI/utils/proccess-stream.utils.js +1 -1
  193. package/dist/features/SegmentReviewComponents/BoundaryCard.js +1 -1
  194. package/dist/features/SegmentReviewComponents/CognitiveScoreBadge.js +1 -1
  195. package/dist/features/SegmentReviewComponents/RevertSuccessCard.js +1 -1
  196. package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
  197. package/dist/features/SegmentReviewComponents/helper.js +1 -1
  198. package/dist/features/SegmentReviewComponents/reviewStepAdapters.js +1 -1
  199. package/dist/index.js +1 -1
  200. package/dist/service/redlineService.js +1 -1
  201. package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
  202. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  203. package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
  204. package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts +2 -0
  205. package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
  206. package/dist/types/src/features/CognitiveCompare/CitationRenderer.d.ts +8 -1
  207. package/dist/types/src/features/CognitiveCompare/CitationRenderer.d.ts.map +1 -1
  208. package/dist/types/src/features/CognitiveCompare/CitationRendererInner.d.ts +13 -0
  209. package/dist/types/src/features/CognitiveCompare/CitationRendererInner.d.ts.map +1 -0
  210. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
  211. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  212. package/dist/types/src/features/CognitiveCompare/CognitiveCompareConstants.d.ts +1 -1
  213. package/dist/types/src/features/CognitiveCompare/CognitiveCompareConstants.d.ts.map +1 -1
  214. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +12 -1
  215. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
  216. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +12 -0
  217. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
  218. package/dist/types/src/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
  219. package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +9 -1
  220. package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
  221. package/dist/types/src/features/CognitiveCompare/GptWebCitationPanel.d.ts +6 -0
  222. package/dist/types/src/features/CognitiveCompare/GptWebCitationPanel.d.ts.map +1 -0
  223. package/dist/types/src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
  224. package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
  225. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +3028 -891
  226. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
  227. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +14 -1
  228. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
  229. package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
  230. package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
  231. package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +2 -1
  232. package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
  233. package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
  234. package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
  235. package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
  236. package/dist/types/src/features/CognitiveCompare/hooks/useOnDemandCitationCache.d.ts +10 -0
  237. package/dist/types/src/features/CognitiveCompare/hooks/useOnDemandCitationCache.d.ts.map +1 -0
  238. package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
  239. package/dist/types/src/features/CognitiveCompare/onDemandCitations/cacheKey.d.ts +3 -0
  240. package/dist/types/src/features/CognitiveCompare/onDemandCitations/cacheKey.d.ts.map +1 -0
  241. package/dist/types/src/features/CognitiveCompare/onDemandCitations/contextBuilder.d.ts +16 -0
  242. package/dist/types/src/features/CognitiveCompare/onDemandCitations/contextBuilder.d.ts.map +1 -0
  243. package/dist/types/src/features/CognitiveCompare/onDemandCitations/href.d.ts +6 -0
  244. package/dist/types/src/features/CognitiveCompare/onDemandCitations/href.d.ts.map +1 -0
  245. package/dist/types/src/features/CognitiveCompare/onDemandCitations/index.d.ts +7 -0
  246. package/dist/types/src/features/CognitiveCompare/onDemandCitations/index.d.ts.map +1 -0
  247. package/dist/types/src/features/CognitiveCompare/onDemandCitations/payload.d.ts +4 -0
  248. package/dist/types/src/features/CognitiveCompare/onDemandCitations/payload.d.ts.map +1 -0
  249. package/dist/types/src/features/CognitiveCompare/onDemandCitations/response.d.ts +3 -0
  250. package/dist/types/src/features/CognitiveCompare/onDemandCitations/response.d.ts.map +1 -0
  251. package/dist/types/src/features/CognitiveCompare/onDemandCitations/types.d.ts +134 -0
  252. package/dist/types/src/features/CognitiveCompare/onDemandCitations/types.d.ts.map +1 -0
  253. package/dist/types/src/features/CognitiveCompare/utils/normalizeInlineMarkdown.d.ts +6 -0
  254. package/dist/types/src/features/CognitiveCompare/utils/normalizeInlineMarkdown.d.ts.map +1 -0
  255. package/dist/types/src/features/CognitiveCompare/utils/onDemandCitations.d.ts +2 -0
  256. package/dist/types/src/features/CognitiveCompare/utils/onDemandCitations.d.ts.map +1 -0
  257. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts +1 -0
  258. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts.map +1 -1
  259. package/dist/types/src/features/GptWebCitation/GptWebCitation.d.ts.map +1 -1
  260. package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts +2 -1
  261. package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts.map +1 -1
  262. package/dist/types/src/features/GptWebCitation/types.d.ts +11 -0
  263. package/dist/types/src/features/GptWebCitation/types.d.ts.map +1 -1
  264. package/dist/types/src/features/GptWebCitation/utils/fixedHeight.utils.d.ts +2 -0
  265. package/dist/types/src/features/GptWebCitation/utils/fixedHeight.utils.d.ts.map +1 -1
  266. package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
  267. package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
  268. package/dist/types/src/features/PdfViewer/usePdfHighlight.d.ts +0 -1
  269. package/dist/types/src/features/PdfViewer/usePdfHighlight.d.ts.map +1 -1
  270. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +39 -29
  271. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
  272. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.d.ts +2 -0
  273. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/constants/changeTags.d.ts.map +1 -0
  274. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.d.ts +2 -0
  275. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.d.ts.map +1 -0
  276. package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  277. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.d.ts +10 -0
  278. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.d.ts.map +1 -0
  279. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.d.ts +17 -0
  280. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.d.ts.map +1 -0
  281. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.d.ts +23 -0
  282. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.d.ts.map +1 -0
  283. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.d.ts +3 -0
  284. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.d.ts.map +1 -0
  285. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.d.ts.map +1 -1
  286. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +1 -1
  287. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  288. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts +84 -5439
  289. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts.map +1 -1
  290. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +1 -1
  291. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  292. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts +1 -1
  293. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
  294. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +2 -2
  295. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
  296. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +19 -2
  297. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  298. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts +7 -2
  299. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts.map +1 -1
  300. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts.map +1 -1
  301. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts +15 -1
  302. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts.map +1 -1
  303. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts +2 -1
  304. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts.map +1 -1
  305. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts +3 -2
  306. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts.map +1 -1
  307. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts.map +1 -1
  308. package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationContent.d.ts +1 -0
  309. package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationContent.d.ts.map +1 -1
  310. package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationRender.d.ts +1 -0
  311. package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationRender.d.ts.map +1 -1
  312. package/dist/types/src/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.d.ts.map +1 -1
  313. package/dist/types/src/features/RequirementAI/components/common/onDemandCitationButton.d.ts +12 -0
  314. package/dist/types/src/features/RequirementAI/components/common/onDemandCitationButton.d.ts.map +1 -0
  315. package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.d.ts +3 -2
  316. package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.d.ts.map +1 -1
  317. package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.d.ts +1 -1
  318. package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.d.ts.map +1 -1
  319. package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts +3 -1
  320. package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts.map +1 -1
  321. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts +2 -1
  322. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts.map +1 -1
  323. package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalContext.d.ts +1 -0
  324. package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalContext.d.ts.map +1 -1
  325. package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.d.ts +2 -0
  326. package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.d.ts.map +1 -1
  327. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +2 -1
  328. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  329. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts +2 -1
  330. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
  331. package/dist/types/src/features/RequirementAI/hooks/useStreamContentHandler.d.ts +1 -1
  332. package/dist/types/src/features/RequirementAI/hooks/useStreamContentHandler.d.ts.map +1 -1
  333. package/dist/types/src/features/RequirementAI/interfaces/userstory.interface.d.ts +2 -0
  334. package/dist/types/src/features/RequirementAI/interfaces/userstory.interface.d.ts.map +1 -1
  335. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +3 -0
  336. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
  337. package/dist/types/src/features/RequirementAI/types/segment.type.d.ts +2 -1
  338. package/dist/types/src/features/RequirementAI/types/segment.type.d.ts.map +1 -1
  339. package/dist/types/src/features/RequirementAI/utils/helpers.d.ts +2 -0
  340. package/dist/types/src/features/RequirementAI/utils/helpers.d.ts.map +1 -1
  341. package/dist/types/src/features/RequirementAI/utils/proccess-stream.utils.d.ts.map +1 -1
  342. package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts.map +1 -1
  343. package/dist/types/src/features/SegmentReviewComponents/CognitiveScoreBadge.d.ts.map +1 -1
  344. package/dist/types/src/features/SegmentReviewComponents/PageCheck.d.ts +0 -6
  345. package/dist/types/src/features/SegmentReviewComponents/PageCheck.d.ts.map +1 -1
  346. package/dist/types/src/features/SegmentReviewComponents/RevertSuccessCard.d.ts.map +1 -1
  347. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -1
  348. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewRedirectionTest.d.ts.map +1 -1
  349. package/dist/types/src/features/SegmentReviewComponents/helper.d.ts +4 -2
  350. package/dist/types/src/features/SegmentReviewComponents/helper.d.ts.map +1 -1
  351. package/dist/types/src/features/SegmentReviewComponents/index.d.ts +1 -3
  352. package/dist/types/src/features/SegmentReviewComponents/index.d.ts.map +1 -1
  353. package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts +1 -2
  354. package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts.map +1 -1
  355. package/dist/types/src/service/redlineService.d.ts.map +1 -1
  356. package/package.json +4 -4
  357. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
  358. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
  359. package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
  360. package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
  361. package/dist/cjs/features/PdfViewer/nyc-components/BoundaryCard.js +0 -2
  362. package/dist/cjs/features/PdfViewer/nyc-components/BoundaryCard.js.map +0 -1
  363. package/dist/cjs/features/PdfViewer/nyc-components/CardWrapper.js +0 -2
  364. package/dist/cjs/features/PdfViewer/nyc-components/CardWrapper.js.map +0 -1
  365. package/dist/cjs/features/PdfViewer/nyc-components/CognitiveIcon.js +0 -2
  366. package/dist/cjs/features/PdfViewer/nyc-components/CognitiveIcon.js.map +0 -1
  367. package/dist/cjs/features/PdfViewer/nyc-components/LabelCheck.js +0 -2
  368. package/dist/cjs/features/PdfViewer/nyc-components/LabelCheck.js.map +0 -1
  369. package/dist/cjs/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js +0 -2
  370. package/dist/cjs/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js.map +0 -1
  371. package/dist/cjs/features/PdfViewer/nyc-components/infoAlert.js +0 -2
  372. package/dist/cjs/features/PdfViewer/nyc-components/infoAlert.js.map +0 -1
  373. package/dist/cjs/features/PdfViewer/nyc-components/reviewStepAdapters.js +0 -2
  374. package/dist/cjs/features/PdfViewer/nyc-components/reviewStepAdapters.js.map +0 -1
  375. package/dist/cjs/features/SegmentReviewComponents/PageTypeChoiceCheck.js +0 -2
  376. package/dist/cjs/features/SegmentReviewComponents/PageTypeChoiceCheck.js.map +0 -1
  377. package/dist/cjs/features/SegmentReviewComponents/reviewScore.js +0 -2
  378. package/dist/cjs/features/SegmentReviewComponents/reviewScore.js.map +0 -1
  379. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
  380. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
  381. package/dist/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
  382. package/dist/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
  383. package/dist/features/PdfViewer/nyc-components/BoundaryCard.js +0 -2
  384. package/dist/features/PdfViewer/nyc-components/BoundaryCard.js.map +0 -1
  385. package/dist/features/PdfViewer/nyc-components/CardWrapper.js +0 -2
  386. package/dist/features/PdfViewer/nyc-components/CardWrapper.js.map +0 -1
  387. package/dist/features/PdfViewer/nyc-components/CognitiveIcon.js +0 -2
  388. package/dist/features/PdfViewer/nyc-components/CognitiveIcon.js.map +0 -1
  389. package/dist/features/PdfViewer/nyc-components/LabelCheck.js +0 -2
  390. package/dist/features/PdfViewer/nyc-components/LabelCheck.js.map +0 -1
  391. package/dist/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js +0 -2
  392. package/dist/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js.map +0 -1
  393. package/dist/features/PdfViewer/nyc-components/infoAlert.js +0 -2
  394. package/dist/features/PdfViewer/nyc-components/infoAlert.js.map +0 -1
  395. package/dist/features/PdfViewer/nyc-components/reviewStepAdapters.js +0 -2
  396. package/dist/features/PdfViewer/nyc-components/reviewStepAdapters.js.map +0 -1
  397. package/dist/features/SegmentReviewComponents/PageTypeChoiceCheck.js +0 -2
  398. package/dist/features/SegmentReviewComponents/PageTypeChoiceCheck.js.map +0 -1
  399. package/dist/features/SegmentReviewComponents/reviewScore.js +0 -2
  400. package/dist/features/SegmentReviewComponents/reviewScore.js.map +0 -1
  401. package/dist/types/node_modules/react-markdown/lib/complex-types.d.ts +0 -23
  402. package/dist/types/node_modules/react-markdown/lib/complex-types.d.ts.map +0 -1
  403. package/dist/types/src/Background.d.ts +0 -7
  404. package/dist/types/src/Background.d.ts.map +0 -1
  405. package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
  406. package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
  407. package/dist/types/src/RedlineEditorTest2.d.ts +0 -3
  408. package/dist/types/src/RedlineEditorTest2.d.ts.map +0 -1
  409. package/dist/types/src/commonConstants.d.ts +0 -31103
  410. package/dist/types/src/commonConstants.d.ts.map +0 -1
  411. package/dist/types/src/features/CognitiveCompare/utils/buildComparisonRows.test.d.ts +0 -2
  412. package/dist/types/src/features/CognitiveCompare/utils/buildComparisonRows.test.d.ts.map +0 -1
  413. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts +0 -128
  414. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts.map +0 -1
  415. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts +0 -13
  416. package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts.map +0 -1
  417. package/dist/types/src/features/PdfViewer/nyc-components/BoundaryCard.d.ts +0 -59
  418. package/dist/types/src/features/PdfViewer/nyc-components/BoundaryCard.d.ts.map +0 -1
  419. package/dist/types/src/features/PdfViewer/nyc-components/CardWrapper.d.ts +0 -19
  420. package/dist/types/src/features/PdfViewer/nyc-components/CardWrapper.d.ts.map +0 -1
  421. package/dist/types/src/features/PdfViewer/nyc-components/CognitiveIcon.d.ts +0 -3
  422. package/dist/types/src/features/PdfViewer/nyc-components/CognitiveIcon.d.ts.map +0 -1
  423. package/dist/types/src/features/PdfViewer/nyc-components/LabelCheck.d.ts +0 -77
  424. package/dist/types/src/features/PdfViewer/nyc-components/LabelCheck.d.ts.map +0 -1
  425. package/dist/types/src/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.d.ts +0 -47
  426. package/dist/types/src/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.d.ts.map +0 -1
  427. package/dist/types/src/features/PdfViewer/nyc-components/index.d.ts +0 -15
  428. package/dist/types/src/features/PdfViewer/nyc-components/index.d.ts.map +0 -1
  429. package/dist/types/src/features/PdfViewer/nyc-components/infoAlert.d.ts +0 -3
  430. package/dist/types/src/features/PdfViewer/nyc-components/infoAlert.d.ts.map +0 -1
  431. package/dist/types/src/features/PdfViewer/nyc-components/reviewStepAdapters.d.ts +0 -36
  432. package/dist/types/src/features/PdfViewer/nyc-components/reviewStepAdapters.d.ts.map +0 -1
  433. package/dist/types/src/features/SegmentReviewComponents/PageTypeChoiceCheck.d.ts +0 -28
  434. package/dist/types/src/features/SegmentReviewComponents/PageTypeChoiceCheck.d.ts.map +0 -1
  435. package/dist/types/src/features/SegmentReviewComponents/helper.test.d.ts +0 -2
  436. package/dist/types/src/features/SegmentReviewComponents/helper.test.d.ts.map +0 -1
  437. package/dist/types/src/features/SegmentReviewComponents/reviewScore.d.ts +0 -4
  438. package/dist/types/src/features/SegmentReviewComponents/reviewScore.d.ts.map +0 -1
  439. package/dist/types/src/features/SegmentReviewComponents/segmentReviewEdgeCases.test.d.ts +0 -2
  440. package/dist/types/src/features/SegmentReviewComponents/segmentReviewEdgeCases.test.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("react"),n=require("@mui/icons-material/ChevronRight"),r=require("@mui/icons-material/Close"),o=require("@mui/icons-material/ExpandMore"),a=require("@mui/material/Box"),s=require("@mui/material/Button"),l=require("@mui/material/ButtonBase"),d=require("@mui/material/Divider"),u=require("@mui/material/IconButton"),c=require("@mui/material/Paper"),x=require("@mui/material/Radio"),g=require("@mui/material/Stack"),f=require("@mui/material/TextField"),p=require("@mui/material/Typography"),h=require("./RevertSummaryNotice.js"),m=require("./CognitiveIcon.js"),_=require("./CognitiveScoreBadge.js"),b=require("../../assests/icons/InfoAlert.js");function E(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v,C=E(n),j=E(r),F=E(o),y=E(a),S=E(s),w=E(l),R=E(d),A=E(u),M=E(c),B=E(x),I=E(g),T=E(f),z=E(p),W=function(i,t){return e.__spreadArray([i],Array.isArray(t)?t:null==t?[]:[t],!0)},k="MERGE_ADJACENT";exports.BoundaryReviewActionEnum=void 0,(v=exports.BoundaryReviewActionEnum||(exports.BoundaryReviewActionEnum={})).KEEP="KEEP",v.SPLIT_HERE="SPLIT_HERE",v.MERGE_NEXT="MERGE_NEXT",v.MERGE_PREV="MERGE_PREV",v.MERGE_PREVIOUS="MERGE_PREVIOUS",v.SET_RANGE="SET_RANGE";var P=function(e){return Object.values(exports.BoundaryReviewActionEnum).includes(e)},N=function(i,t,n,r){if(!t||!i)return[];var o=t.additional_decisions,a=Array.isArray(o)?o:o?Object.values(o).flat():[],s=Array.from(new Set(e.__spreadArray(e.__spreadArray([],t.allowed_decisions,!0),a,!0)));return s.flatMap(function(e){var t=i.focus_page,o=s.find(function(e){return e.toLowerCase().includes("merge")}),a=null!=t&&null!=n&&null!=r&&t===n&&t===r,l=null!=t&&null!=n&&t===n,d=null!=t&&null!=r&&(t===r||t===r+1),u=l||d||!(null!=t&&(!(null!=n&&null!=r)||t>n&&t<r));switch(e){case exports.BoundaryReviewActionEnum.SET_RANGE:return[];case"KEEP":return[{id:e,title:"Keep as is",description:"Keep the current document boundary unchanged."}];case"SPLIT_HERE":return[{id:e,title:"Split to a separate document",description:u?"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:u}];case"MERGE_PREV":case"MERGE_NEXT":case"MERGE_PREVIOUS":return e!==o?[]:a?[{id:k,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]:l?[{id:exports.BoundaryReviewActionEnum.MERGE_PREVIOUS,title:"Merge with previous document",description:"Combine this document with the previous document."}]:d?[{id:exports.BoundaryReviewActionEnum.MERGE_NEXT,title:"Merge with next document",description:"Combine this document with the next document."}]:[{id:k,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]}return[]})};exports.createBoundaryCardOptions=N,exports.default=function(n){var r=n.headerName,o=void 0===r?"Boundary Check":r,a=n.title,s=n.pageNo,l=n.content,d=n.revertSummary,u=n.cognitiveScore,c=n.config,x=n.metadata,g=n.previousSegmentTitle,f=n.nextSegmentTitle,p=n.selectedIndex,E=n.defaultSelectedIndex,v=void 0===E?null:E,G=n.defaultStartPage,D=n.defaultEndPage,q=n.onSelectionChange,H=n.onConfirm,O=n.onActionConfirm,V=n.onCognitiveClick,L=n.onAdjustManually,U=n.onClose,X=n.confirmLabel,K=void 0===X?"Confirm":X,$=n.manualPrompt,J=void 0===$?"Didn't find the right option?":$,Y=n.manualActionLabel,Q=void 0===Y?"Adjust Manually":Y,Z=n.cognitiveLabel,ee=void 0===Z?"Cognitive Integrity":Z,ie=n.showAdjustManually,te=void 0===ie||ie,ne=n.showCognitiveIntegrity,re=void 0===ne||ne,oe=n.showCloseButton,ae=void 0===oe||oe,se=n.confirmDisabled,le=void 0!==se&&se,de=n.width,ue=void 0===de?260:de,ce=n.maxWidth,xe=void 0===ce?260:ce,ge=n.className,fe=n.styles,pe=n.reviewAction,he=n.totalPages;console.log("LOG: Total pages",he);var me=t.useMemo(function(){return(null!=c?c:x?N(x,pe,G,D):[]).filter(function(e){return e.id!==exports.BoundaryReviewActionEnum.SET_RANGE})},[c,D,G,x,pe]),_e=t.useState(v),be=_e[0],Ee=_e[1],ve=t.useState(null==G?"":String(G)),Ce=ve[0],je=ve[1],Fe=t.useState(null==D?"":String(D)),ye=Fe[0],Se=Fe[1],we=t.useState(!1),Re=we[0],Ae=we[1],Me=t.useState(!1),Be=Me[0],Ie=Me[1],Te=t.useState(null),ze=Te[0],We=Te[1],ke=t.useState(!1),Pe=ke[0],Ne=ke[1],Ge=void 0===p?be:p,De=null==Ge?void 0:me[Ge],qe=(null==De?void 0:De.id)===k,He=null!=g,Oe=null!=f,Ve=function(e){return!0===e.disabled||e.id===exports.BoundaryReviewActionEnum.MERGE_PREV&&!He||e.id===exports.BoundaryReviewActionEnum.MERGE_PREVIOUS&&!He||e.id===exports.BoundaryReviewActionEnum.MERGE_NEXT&&!Oe||e.id===k&&!He&&!Oe},Le=Number(Ce),Ue=Number(ye),Xe=Ce.trim().length>0&&ye.trim().length>0&&Number.isInteger(Le)&&Number.isInteger(Ue)&&Le>0&&Ue>0,Ke=null!=he&&Le>he,$e=null!=he&&Ue>he,Je=Ce.trim().length>0&&ye.trim().length>0&&Number.isInteger(Le)&&Number.isInteger(Ue)&&Le>Ue,Ye=Xe&&Le<=Ue&&!Ke&&!$e,Qe=Ye&&Le===G&&Ue===D,Ze=le||!De||Ve(De)||qe&&null==ze||!H&&!O;return i.jsx(M.default,e.__assign({className:ge,elevation:4,sx:W({width:ue,maxWidth:xe,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:i.jsxs(I.default,e.__assign({spacing:.75,sx:{p:1}},{children:[i.jsxs(I.default,e.__assign({direction:"row",alignItems:"center",spacing:.75,sx:null==fe?void 0:fe.header},{children:[i.jsx(b.default,{color:"error",height:16,width:16}),i.jsx(z.default,e.__assign({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:o})),ae&&i.jsx(A.default,e.__assign({size:"small",onClick:U,disabled:!U,"aria-label":"Close boundary check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:i.jsx(j.default,{sx:{fontSize:17}})}))]})),i.jsxs(y.default,{children:[i.jsx(z.default,e.__assign({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:a})),null!=s&&i.jsx(z.default,e.__assign({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:s})),i.jsx(R.default,{sx:{my:.625}}),null!=d?i.jsx(h.default,{children:d}):null!=l&&i.jsx(z.default,e.__assign({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:l}))]}),i.jsxs(I.default,e.__assign({spacing:.625,role:"radiogroup","aria-label":"Boundary options"},{children:[me.map(function(t,n){var r=Ge===n,o=Ve(t);return i.jsxs(M.default,e.__assign({variant:"outlined",sx:W({borderColor:r?"#1976d2":"divider",borderRadius:2,bgcolor:o?"#F8FAFC":"background.paper",overflow:"hidden"},null==fe?void 0:fe.option)},{children:[i.jsxs(w.default,e.__assign({role:"radio","aria-checked":r,disabled:le||o,onClick:function(){return function(e,i){le||Ve(i)||(void 0===p&&Ee(e),i.id!==k&&We(null),Re&&(Ae(!1),Ie(!1)),null==q||q(e,i))}(n,t)},sx:{width:"100%",justifyContent:"flex-start",px:.75,py:.5,textAlign:"left"}},{children:[i.jsx(B.default,{checked:r,disabled:le||o,tabIndex:-1,size:"small",sx:{p:.25,mr:.5,"&.Mui-disabled":{color:"#CBD5E1"}}}),i.jsxs(y.default,e.__assign({sx:{minWidth:0}},{children:[i.jsx(z.default,e.__assign({sx:{color:o?"#94A3B8":"text.primary",fontSize:12.5,fontWeight:500}},{children:t.title})),null!=t.description&&i.jsx(z.default,e.__assign({sx:{mt:.125,color:o?"#94A3B8":"text.secondary",fontSize:11}},{children:t.description}))]}))]})),r&&t.id===k&&i.jsx(I.default,e.__assign({direction:"row",spacing:.75,sx:W({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!=f?f:"No Next document",caption:"Merge into Next →",available:Oe}].map(function(t){var n=ze===t.direction;return i.jsxs(I.default,e.__assign({sx:{flex:1,minWidth:0}},{children:[i.jsx(w.default,e.__assign({disabled:le||!t.available,onClick:function(){return We(t.direction)},"aria-pressed":n,sx:{width:"100%",minWidth:0,minHeight:46,alignItems:"flex-start",justifyContent:"flex-start",p:.625,border:"1px solid",borderColor:n?"#7F56D9":"#D0D5DD",borderRadius:1.5,bgcolor:n?"#E0E7FF":"background.paper",color:n?"#7F56D9":t.available?"text.primary":"#98A2B3",textAlign:"left","&.Mui-disabled":{color:"#98A2B3",bgcolor:"#F8FAFC"}}},{children:i.jsx(z.default,e.__assign({sx:{color:"inherit",fontSize:11,fontWeight:500,lineHeight:1.25,overflowWrap:"anywhere"}},{children:t.title}))})),i.jsx(z.default,e.__assign({sx:{mt:.5,color:n?"#5925DC":"text.secondary",fontSize:9.5,lineHeight:1.2,whiteSpace:"nowrap",textAlign:"next"===t.direction?"right":"left"}},{children:t.caption}))]}),t.direction)})}))]}),t.id)}),qe&&null!=ze&&i.jsxs(I.default,e.__assign({direction:"row",alignItems:"flex-start",spacing:.625,sx:W({p:.75,border:"1px solid #FCA5A5",borderRadius:1.5,bgcolor:"#FEF2F2"},null==fe?void 0:fe.impactWarning)},{children:[i.jsx(b.default,{color:"error",height:14,width:14,sx:{mt:.125}}),i.jsxs(z.default,e.__assign({sx:{color:"#DC2626",fontSize:10.5,lineHeight:1.4}},{children:["This will impact the ",ze," document. Its content and page range will change."]}))]})),i.jsx(S.default,e.__assign({variant:"contained",fullWidth:!0,disabled:Ze,onClick:function(){if(!Ze&&null!=Ge&&De){var i=qe?"previous"===ze?exports.BoundaryReviewActionEnum.MERGE_PREVIOUS:exports.BoundaryReviewActionEnum.MERGE_NEXT:De.id,t=qe?e.__assign(e.__assign({},De),{id:i}):De,n={selectedIndex:Ge,option:t,metadata:x};null==H||H(Ge,t,n),O&&P(i)&&O(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==fe?void 0:fe.confirmButton)},{children:K}))]})),te&&i.jsxs(I.default,e.__assign({spacing:.625,sx:null==fe?void 0:fe.manualSection},{children:[i.jsxs(w.default,e.__assign({disabled:le,onClick:function(){var e=!Re;Ae(e),Ie(!1),e&&(void 0===p&&Ee(null),null==L||L())},"aria-expanded":Re,sx:{width:"100%",justifyContent:"space-between",borderRadius:1,textAlign:"left"}},{children:[i.jsx(y.default,{children:i.jsx(z.default,e.__assign({sx:{color:"text.primary",fontSize:12,fontWeight:600}},{children:J}))}),i.jsx(F.default,{sx:{color:"text.secondary",fontSize:16,transform:Re?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]})),Re&&!Be&&i.jsxs(y.default,e.__assign({sx:{pt:.5,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif'}},{children:[i.jsxs(y.default,e.__assign({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[i.jsx(z.default,e.__assign({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Starts"})),i.jsx(z.default,e.__assign({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Ends"}))]})),i.jsxs(y.default,e.__assign({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[i.jsxs(y.default,{children:[i.jsx(T.default,{size:"small",type:"text",value:Ce,disabled:le,error:Ke||Je,onChange:function(e){var i=e.target.value;/^\d*$/.test(i)&&je(i)},inputProps:{inputMode:"numeric",pattern:"[0-9]*"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:Ke||Je?"#EF4444":"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:Ke||Je?"#EF4444":"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:Ke||Je?"#EF4444":"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"}}}),Ke&&i.jsxs(z.default,e.__assign({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:["Must be ≤ ",he," (total pages)"]})),Je&&!Ke&&i.jsx(z.default,e.__assign({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:"Must be ≤ end page"}))]}),i.jsxs(y.default,{children:[i.jsx(T.default,{size:"small",type:"text",value:ye,disabled:le,error:$e||Je,onChange:function(e){var i=e.target.value;/^\d*$/.test(i)&&Se(i)},inputProps:{inputMode:"numeric",pattern:"[0-9]*"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:$e||Je?"#EF4444":"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:$e||Je?"#EF4444":"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:$e||Je?"#EF4444":"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"}}}),$e&&i.jsxs(z.default,e.__assign({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:["Must be ≤ ",he," (total pages)"]})),Je&&!$e&&i.jsx(z.default,e.__assign({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:"Must be ≥ start page"}))]})]})),i.jsx(y.default,{children:i.jsx(S.default,e.__assign({onClick:function(){Ye&&(Qe?Ne(!0):Ie(!0))},disabled:le||!Ye||Qe,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":!Ye||Qe?{}:{backgroundColor:"#FAF9FF",borderColor:"#7F6FF0"},"&:active":!Ye||Qe?{}:{transform:"translateY(1px)"},"&.Mui-disabled":{backgroundColor:"#FFFFFF",borderColor:"#C3CFDC",color:"#A0ABBE",cursor:"not-allowed"}}},{children:"Apply"}))}),Qe&&Pe&&i.jsx(y.default,e.__assign({sx:{backgroundColor:"#FEF3C7",border:"1px solid #FBBF24",borderRadius:"6px",padding:"8px 10px",marginTop:"4px"}},{children:i.jsx(z.default,e.__assign({sx:{fontSize:"10px",color:"#B45309",fontWeight:500,lineHeight:1.4}},{children:"Please change the boundary to change the document boundary as no changes will be applied."}))})),i.jsx(y.default,{sx:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"#EEF0F2",border:"0"}})]})),Re&&Be&&i.jsxs(I.default,e.__assign({spacing:.75,sx:W({p:.75,borderRadius:1.5,bgcolor:"#FFF7ED"},null==fe?void 0:fe.manualConfirmation)},{children:[i.jsxs(I.default,e.__assign({direction:"row",alignItems:"center",spacing:.5},{children:[i.jsx(b.default,{color:"warning",height:14,width:14}),i.jsx(z.default,e.__assign({sx:{color:"#EA580C",fontSize:11,fontWeight:600}},{children:"Confirm this change?"}))]})),i.jsxs(z.default,e.__assign({sx:{color:"text.secondary",fontSize:10.5,lineHeight:1.4}},{children:["Pages ",Le,"-",Ue," will become part of ",a,", including pages from other documents in this range."]})),i.jsxs(I.default,e.__assign({direction:"row",spacing:.75},{children:[i.jsx(S.default,e.__assign({variant:"outlined",fullWidth:!0,onClick:function(){return Ie(!1)},sx:{minHeight:28,borderRadius:1.5,fontSize:11,textTransform:"none"}},{children:"Cancel"})),i.jsx(S.default,e.__assign({variant:"contained",fullWidth:!0,disabled:le||!H||!Ye||Qe,onClick:function(){if(Ye&&!Qe&&H){var e={id:exports.BoundaryReviewActionEnum.SET_RANGE,title:Q};H(-1,e,{selectedIndex:-1,option:e,startPage:Le,endPage:Ue,metadata:x})}},sx:{minHeight:28,borderRadius:1.5,bgcolor:"#EA580C",fontSize:11,textTransform:"none","&:hover":{bgcolor:"#C2410C"}}},{children:"Confirm"}))]}))]}))]})),i.jsx(I.default,e.__assign({spacing:.625,sx:null==fe?void 0:fe.footer},{children:re&&i.jsxs(i.Fragment,{children:[i.jsx(R.default,{}),i.jsxs(w.default,e.__assign({onClick:V,disabled:!V,sx:{justifyContent:"space-between",borderRadius:1,textAlign:"left",cursor:V?"pointer":"not-allowed"}},{children:[i.jsxs(I.default,e.__assign({direction:"row",alignItems:"center",spacing:1},{children:[i.jsx(m.default,{sx:{color:"text.secondary"}}),i.jsx(z.default,e.__assign({sx:{color:"text.primary",fontSize:12}},{children:ee}))]})),i.jsxs(I.default,e.__assign({direction:"row",alignItems:"center",spacing:.5},{children:[i.jsx(_.default,{score:u}),i.jsx(C.default,{sx:{color:"text.secondary"}})]}))]}))]})}))]}))}))},exports.isBoundaryReviewAction=P;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("react"),n=require("@mui/icons-material/ChevronRight"),r=require("@mui/icons-material/Close"),o=require("@mui/icons-material/ExpandMore"),a=require("@mui/material/Box"),s=require("@mui/material/Button"),l=require("@mui/material/ButtonBase"),d=require("@mui/material/Divider"),u=require("@mui/material/IconButton"),c=require("@mui/material/Paper"),x=require("@mui/material/Radio"),g=require("@mui/material/Stack"),f=require("@mui/material/TextField"),p=require("@mui/material/Typography"),h=require("./RevertSummaryNotice.js"),m=require("./CognitiveIcon.js"),_=require("./CognitiveScoreBadge.js"),b=require("../../assests/icons/InfoAlert.js");function E(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v,C=E(n),j=E(r),F=E(o),y=E(a),S=E(s),w=E(l),R=E(d),A=E(u),M=E(c),B=E(x),I=E(g),T=E(f),z=E(p),W=function(i,t){return e.__spreadArray([i],Array.isArray(t)?t:null==t?[]:[t],!0)},k="MERGE_ADJACENT";exports.BoundaryReviewActionEnum=void 0,(v=exports.BoundaryReviewActionEnum||(exports.BoundaryReviewActionEnum={})).KEEP="KEEP",v.SPLIT_HERE="SPLIT_HERE",v.MERGE_NEXT="MERGE_NEXT",v.MERGE_PREV="MERGE_PREV",v.MERGE_PREVIOUS="MERGE_PREVIOUS",v.SET_RANGE="SET_RANGE";var P=function(e){return Object.values(exports.BoundaryReviewActionEnum).includes(e)},N=function(i,t,n,r){if(!t||!i)return[];var o=t.additional_decisions,a=Array.isArray(o)?o:o?Object.values(o).flat():[],s=Array.from(new Set(e.__spreadArray(e.__spreadArray([],t.allowed_decisions,!0),a,!0)));return s.flatMap(function(e){var t=i.focus_page,o=s.find(function(e){return e.toLowerCase().includes("merge")}),a=null!=t&&null!=n&&null!=r&&t===n&&t===r,l=null!=t&&null!=n&&t===n,d=null!=t&&null!=r&&(t===r||t===r+1),u=l||d||!(null!=t&&(!(null!=n&&null!=r)||t>n&&t<r));switch(e){case exports.BoundaryReviewActionEnum.SET_RANGE:return[];case"KEEP":return[{id:e,title:"Keep as is",description:"Keep the current document boundary unchanged."}];case"SPLIT_HERE":return[{id:e,title:"Split to a separate document",description:u?"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:u}];case"MERGE_PREV":case"MERGE_NEXT":case"MERGE_PREVIOUS":return e!==o?[]:a?[{id:k,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]:l?[{id:exports.BoundaryReviewActionEnum.MERGE_PREVIOUS,title:"Merge with previous document",description:"Combine this document with the previous document."}]:d?[{id:exports.BoundaryReviewActionEnum.MERGE_NEXT,title:"Merge with next document",description:"Combine this document with the next document."}]:[{id:k,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]}return[]})};exports.createBoundaryCardOptions=N,exports.default=function(n){var r=n.headerName,o=void 0===r?"Boundary Check":r,a=n.title,s=n.pageNo,l=n.content,d=n.revertSummary,u=n.cognitiveScore,c=n.config,x=n.metadata,g=n.previousSegmentTitle,f=n.nextSegmentTitle,p=n.selectedIndex,E=n.defaultSelectedIndex,v=void 0===E?null:E,G=n.defaultStartPage,D=n.defaultEndPage,q=n.onSelectionChange,H=n.onConfirm,O=n.onActionConfirm,V=n.onCognitiveClick,L=n.onAdjustManually,U=n.onClose,X=n.confirmLabel,K=void 0===X?"Confirm":X,$=n.manualPrompt,J=void 0===$?"Didn't find the right option?":$,Y=n.manualActionLabel,Q=void 0===Y?"Adjust Manually":Y,Z=n.cognitiveLabel,ee=void 0===Z?"Cognitive Integrity":Z,ie=n.showAdjustManually,te=void 0===ie||ie,ne=n.showCognitiveIntegrity,re=void 0===ne||ne,oe=n.showCloseButton,ae=void 0===oe||oe,se=n.confirmDisabled,le=void 0!==se&&se,de=n.width,ue=void 0===de?260:de,ce=n.maxWidth,xe=void 0===ce?260:ce,ge=n.className,fe=n.styles,pe=n.reviewAction,he=n.totalPages;console.log("LOG: Total pages",he);var me=t.useMemo(function(){return(null!=c?c:x?N(x,pe,G,D):[]).filter(function(e){return e.id!==exports.BoundaryReviewActionEnum.SET_RANGE})},[c,D,G,x,pe]),_e=t.useState(v),be=_e[0],Ee=_e[1],ve=t.useState(null==G?"":String(G)),Ce=ve[0],je=ve[1],Fe=t.useState(null==D?"":String(D)),ye=Fe[0],Se=Fe[1],we=t.useState(!1),Re=we[0],Ae=we[1],Me=t.useState(!1),Be=Me[0],Ie=Me[1],Te=t.useState(null),ze=Te[0],We=Te[1],ke=t.useState(!1),Pe=ke[0],Ne=ke[1],Ge=void 0===p?be:p,De=null==Ge?void 0:me[Ge],qe=(null==De?void 0:De.id)===k,He=null!=g,Oe=null!=f,Ve=function(e){return!0===e.disabled||e.id===exports.BoundaryReviewActionEnum.MERGE_PREV&&!He||e.id===exports.BoundaryReviewActionEnum.MERGE_PREVIOUS&&!He||e.id===exports.BoundaryReviewActionEnum.MERGE_NEXT&&!Oe||e.id===k&&!He&&!Oe},Le=Number(Ce),Ue=Number(ye),Xe=Ce.trim().length>0&&ye.trim().length>0&&Number.isInteger(Le)&&Number.isInteger(Ue)&&Le>0&&Ue>0,Ke=null!=he&&Le>he,$e=null!=he&&Ue>he,Je=Ce.trim().length>0&&ye.trim().length>0&&Number.isInteger(Le)&&Number.isInteger(Ue)&&Le>Ue,Ye=Xe&&Le<=Ue&&!Ke&&!$e,Qe=Ye&&Le===G&&Ue===D,Ze=le||!De||Ve(De)||qe&&null==ze||!H&&!O;return i.jsx(M.default,e.__assign({className:ge,elevation:4,sx:W({width:ue,maxWidth:xe,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:i.jsxs(I.default,e.__assign({spacing:.75,sx:{p:1}},{children:[i.jsxs(I.default,e.__assign({direction:"row",alignItems:"center",spacing:.75,sx:null==fe?void 0:fe.header},{children:[i.jsx(b.default,{color:"error",height:16,width:16}),i.jsx(z.default,e.__assign({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:o})),ae&&i.jsx(A.default,e.__assign({size:"small",onClick:U,disabled:!U,"aria-label":"Close boundary check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:i.jsx(j.default,{sx:{fontSize:17}})}))]})),i.jsxs(y.default,{children:[i.jsx(z.default,e.__assign({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:a})),null!=s&&i.jsx(z.default,e.__assign({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:s})),i.jsx(R.default,{sx:{my:.625}}),null!=d?i.jsx(h.default,{children:d}):null!=l&&i.jsx(z.default,e.__assign({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:l}))]}),i.jsxs(I.default,e.__assign({spacing:.625,role:"radiogroup","aria-label":"Boundary options"},{children:[me.map(function(t,n){var r=Ge===n,o=Ve(t);return i.jsxs(M.default,e.__assign({variant:"outlined",sx:W({borderColor:r?"#1976d2":"divider",borderRadius:2,bgcolor:o?"#F8FAFC":"background.paper",overflow:"hidden"},null==fe?void 0:fe.option)},{children:[i.jsxs(w.default,e.__assign({role:"radio","aria-checked":r,disabled:le||o,onClick:function(){return function(e,i){le||Ve(i)||(void 0===p&&Ee(e),i.id!==k&&We(null),Re&&(Ae(!1),Ie(!1)),null==q||q(e,i))}(n,t)},sx:{width:"100%",justifyContent:"flex-start",px:.75,py:.5,textAlign:"left"}},{children:[i.jsx(B.default,{checked:r,disabled:le||o,tabIndex:-1,size:"small",sx:{p:.25,mr:.5,"&.Mui-disabled":{color:"#CBD5E1"}}}),i.jsxs(y.default,e.__assign({sx:{minWidth:0}},{children:[i.jsx(z.default,e.__assign({sx:{color:o?"#94A3B8":"text.primary",fontSize:12.5,fontWeight:500}},{children:t.title})),null!=t.description&&i.jsx(z.default,e.__assign({sx:{mt:.125,color:o?"#94A3B8":"text.secondary",fontSize:11}},{children:t.description}))]}))]})),r&&t.id===k&&i.jsx(I.default,e.__assign({direction:"row",spacing:.75,sx:W({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!=f?f:"No Next document",caption:"Merge into Next →",available:Oe}].map(function(t){var n=ze===t.direction;return i.jsxs(I.default,e.__assign({sx:{flex:1,minWidth:0}},{children:[i.jsx(w.default,e.__assign({disabled:le||!t.available,onClick:function(){return We(t.direction)},"aria-pressed":n,sx:{width:"100%",minWidth:0,minHeight:46,alignItems:"flex-start",justifyContent:"flex-start",p:.625,border:"1px solid",borderColor:n?"#7F56D9":"#D0D5DD",borderRadius:1.5,bgcolor:n?"#E0E7FF":"background.paper",color:n?"#7F56D9":t.available?"text.primary":"#98A2B3",textAlign:"left","&.Mui-disabled":{color:"#98A2B3",bgcolor:"#F8FAFC"}}},{children:i.jsx(z.default,e.__assign({sx:{color:"inherit",fontSize:11,fontWeight:500,lineHeight:1.25,overflowWrap:"anywhere"}},{children:t.title}))})),i.jsx(z.default,e.__assign({sx:{mt:.5,color:n?"#5925DC":"text.secondary",fontSize:9.5,lineHeight:1.2,whiteSpace:"nowrap",textAlign:"next"===t.direction?"right":"left"}},{children:t.caption}))]}),t.direction)})}))]}),t.id)}),qe&&null!=ze&&i.jsxs(I.default,e.__assign({direction:"row",alignItems:"flex-start",spacing:.625,sx:W({p:.75,border:"1px solid #FCA5A5",borderRadius:1.5,bgcolor:"#FEF2F2"},null==fe?void 0:fe.impactWarning)},{children:[i.jsx(b.default,{color:"error",height:14,width:14,sx:{mt:.125}}),i.jsxs(z.default,e.__assign({sx:{color:"#DC2626",fontSize:10.5,lineHeight:1.4}},{children:["This will impact the ",ze," document. Its content and page range will change."]}))]})),i.jsx(S.default,e.__assign({variant:"contained",fullWidth:!0,disabled:Ze,onClick:function(){if(!Ze&&null!=Ge&&De){var i=qe?"previous"===ze?exports.BoundaryReviewActionEnum.MERGE_PREVIOUS:exports.BoundaryReviewActionEnum.MERGE_NEXT:De.id,t=qe?e.__assign(e.__assign({},De),{id:i}):De,n={selectedIndex:Ge,option:t,metadata:x};null==H||H(Ge,t,n),O&&P(i)&&O(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==fe?void 0:fe.confirmButton)},{children:K}))]})),te&&i.jsxs(I.default,e.__assign({spacing:.625,sx:null==fe?void 0:fe.manualSection},{children:[i.jsxs(w.default,e.__assign({disabled:le,onClick:function(){var e=!Re;Ae(e),Ie(!1),e&&(void 0===p&&Ee(null),null==L||L())},"aria-expanded":Re,sx:{width:"100%",justifyContent:"space-between",borderRadius:1,textAlign:"left"}},{children:[i.jsx(y.default,{children:i.jsx(z.default,e.__assign({sx:{color:"text.primary",fontSize:12,fontWeight:600}},{children:J}))}),i.jsx(F.default,{sx:{color:"text.secondary",fontSize:16,transform:Re?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]})),Re&&!Be&&i.jsxs(y.default,e.__assign({sx:{pt:.5,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif'}},{children:[i.jsxs(y.default,e.__assign({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[i.jsx(z.default,e.__assign({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Starts"})),i.jsx(z.default,e.__assign({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Ends"}))]})),i.jsxs(y.default,e.__assign({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[i.jsxs(y.default,{children:[i.jsx(T.default,{size:"small",type:"text",value:Ce,disabled:le,error:Ke||Je,onChange:function(e){var i=e.target.value;/^\d*$/.test(i)&&je(i)},inputProps:{inputMode:"numeric",pattern:"[0-9]*"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:Ke||Je?"#EF4444":"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:Ke||Je?"#EF4444":"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:Ke||Je?"#EF4444":"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"}}}),Ke&&i.jsxs(z.default,e.__assign({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:["Must be ≤ ",he," (total pages)"]})),Je&&!Ke&&i.jsx(z.default,e.__assign({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:"Must be ≤ end page"}))]}),i.jsxs(y.default,{children:[i.jsx(T.default,{size:"small",type:"text",value:ye,disabled:le,error:$e||Je,onChange:function(e){var i=e.target.value;/^\d*$/.test(i)&&Se(i)},inputProps:{inputMode:"numeric",pattern:"[0-9]*"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:$e||Je?"#EF4444":"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:$e||Je?"#EF4444":"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:$e||Je?"#EF4444":"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"}}}),$e&&i.jsxs(z.default,e.__assign({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:["Must be ≤ ",he," (total pages)"]})),Je&&!$e&&i.jsx(z.default,e.__assign({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:"Must be ≥ start page"}))]})]})),i.jsx(y.default,{children:i.jsx(S.default,e.__assign({onClick:function(){Ye&&(Qe?Ne(!0):Ie(!0))},disabled:le||!Ye,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":Ye?{backgroundColor:"#FAF9FF",borderColor:"#7F6FF0"}:{},"&:active":Ye?{transform:"translateY(1px)"}:{},"&.Mui-disabled":{backgroundColor:"#FFFFFF",borderColor:"#C3CFDC",color:"#A0ABBE",cursor:"not-allowed"}}},{children:"Apply"}))}),Qe&&Pe&&i.jsx(y.default,e.__assign({sx:{backgroundColor:"#FEF3C7",border:"1px solid #FBBF24",borderRadius:"6px",padding:"8px 10px",marginTop:"4px"}},{children:i.jsx(z.default,e.__assign({sx:{fontSize:"10px",color:"#B45309",fontWeight:500,lineHeight:1.4}},{children:"Please change the boundary to change the document boundary as no changes will be applied."}))})),i.jsx(y.default,{sx:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"#EEF0F2",border:"0"}})]})),Re&&Be&&i.jsxs(I.default,e.__assign({spacing:.75,sx:W({p:.75,borderRadius:1.5,bgcolor:"#FFF7ED"},null==fe?void 0:fe.manualConfirmation)},{children:[i.jsxs(I.default,e.__assign({direction:"row",alignItems:"center",spacing:.5},{children:[i.jsx(b.default,{color:"warning",height:14,width:14}),i.jsx(z.default,e.__assign({sx:{color:"#EA580C",fontSize:11,fontWeight:600}},{children:"Confirm this change?"}))]})),i.jsxs(z.default,e.__assign({sx:{color:"text.secondary",fontSize:10.5,lineHeight:1.4}},{children:["Pages ",Le,"-",Ue," will become part of ",a,", including pages from other documents in this range."]})),i.jsxs(I.default,e.__assign({direction:"row",spacing:.75},{children:[i.jsx(S.default,e.__assign({variant:"outlined",fullWidth:!0,onClick:function(){return Ie(!1)},sx:{minHeight:28,borderRadius:1.5,fontSize:11,textTransform:"none"}},{children:"Cancel"})),i.jsx(S.default,e.__assign({variant:"contained",fullWidth:!0,disabled:le||!H,onClick:function(){if(Ye&&H){var e={id:exports.BoundaryReviewActionEnum.SET_RANGE,title:Q};H(-1,e,{selectedIndex:-1,option:e,startPage:Le,endPage:Ue,metadata:x})}},sx:{minHeight:28,borderRadius:1.5,bgcolor:"#EA580C",fontSize:11,textTransform:"none","&:hover":{bgcolor:"#C2410C"}}},{children:"Confirm"}))]}))]}))]})),i.jsx(I.default,e.__assign({spacing:.625,sx:null==fe?void 0:fe.footer},{children:re&&i.jsxs(i.Fragment,{children:[i.jsx(R.default,{}),i.jsxs(w.default,e.__assign({onClick:V,disabled:!V,sx:{justifyContent:"space-between",borderRadius:1,textAlign:"left",cursor:V?"pointer":"not-allowed"}},{children:[i.jsxs(I.default,e.__assign({direction:"row",alignItems:"center",spacing:1},{children:[i.jsx(m.default,{sx:{color:"text.secondary"}}),i.jsx(z.default,e.__assign({sx:{color:"text.primary",fontSize:12}},{children:ee}))]})),i.jsxs(I.default,e.__assign({direction:"row",alignItems:"center",spacing:.5},{children:[i.jsx(_.default,{score:u}),i.jsx(C.default,{sx:{color:"text.secondary"}})]}))]}))]})}))]}))}))},exports.isBoundaryReviewAction=P;
2
2
  //# sourceMappingURL=BoundaryCard.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),t=require("@mui/material/Box"),o=require("./reviewScore.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(t);exports.default=function(t){var i=t.score;if(null==i||"string"==typeof i&&""===i.trim())return null;var u="number"==typeof i?"".concat(i,"%"):i,l=o.getReviewScoreBand("number"==typeof i||"string"==typeof i?i:null),s="low"===l?"#B91C1C":"medium"===l?"#997800":"high"===l?"#4F9E6C":"#374151";return r.jsx(n.default,e.__assign({component:"span",sx:{px:.625,py:0,border:"1.5px solid",borderColor:s,borderRadius:10,color:s,fontSize:11,lineHeight:1.25}},{children:u}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(require("@mui/material/Box"));exports.default=function(t){var o=t.score;if(null==o||"string"==typeof o&&""===o.trim())return null;var i="number"==typeof o?"".concat(o,"%"):o;return r.jsx(n.default,e.__assign({component:"span",sx:{px:.625,py:0,border:"1.5px solid",borderColor:"secondary.main",borderRadius:10,color:"secondary.main",fontSize:11,lineHeight:1.25}},{children:i}))};
2
2
  //# sourceMappingURL=CognitiveScoreBadge.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),i=require("@mui/icons-material/ArrowForward"),t=require("@mui/material/Box"),o=require("@mui/material/Button"),l=require("@mui/material/Paper"),a=require("@mui/material/Stack"),n=require("@mui/material/Typography"),s=require("lucide-react");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(i),c=d(t),x=d(o),g=d(l),h=d(a),f=d(n);exports.default=function(i){var t=i.title,o=i.description,l=i.onReview,a=i.reviewLabel,n=void 0===a?"Review":a;return r.jsx(g.default,e.__assign({elevation:0,role:"status",sx:{width:"100%",px:1.5,py:1.5,border:"1.5px solid #86EFAC",borderRadius:2,bgcolor:"#F0FDF4",boxSizing:"border-box"}},{children:r.jsxs(h.default,e.__assign({alignItems:"center",spacing:1.5,sx:{textAlign:"center"}},{children:[r.jsx(c.default,e.__assign({sx:{display:"grid",placeItems:"center",width:58,height:58,border:"8px solid rgba(255, 255, 255, 0.9)",borderRadius:"50%",bgcolor:"#DCFCE7",color:"#0A9B49"}},{children:r.jsx(s.CheckCircleIcon,{height:36,width:36})})),r.jsxs(c.default,{children:[r.jsx(f.default,e.__assign({sx:{color:"#166534",fontSize:15,fontWeight:600,lineHeight:1.4}},{children:t})),o?r.jsx(f.default,e.__assign({sx:{mt:.75,color:"#07883F",fontSize:14,lineHeight:1.55}},{children:o})):null]}),r.jsx(x.default,e.__assign({variant:"outlined",fullWidth:!0,onClick:l,endIcon:r.jsx(u.default,{}),sx:{minHeight:42,border:"1.5px solid #CBD5E1",borderRadius:2,bgcolor:"#FFFFFF",color:"#475569",fontSize:16,fontWeight:700,textTransform:"none","&:hover":{borderColor:"#94A3B8",bgcolor:"#FFFFFF"}}},{children:n}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),i=require("@mui/icons-material/ArrowForward"),t=require("@mui/material/Box"),o=require("@mui/material/Button"),l=require("@mui/material/Paper"),a=require("@mui/material/Stack"),n=require("@mui/material/Typography"),s=require("lucide-react");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(i),c=d(t),x=d(o),g=d(l),h=d(a),f=d(n);exports.default=function(i){var t=i.title,o=i.description,l=i.onReview,a=i.reviewLabel,n=void 0===a?"Review":a;return r.jsx(g.default,e.__assign({elevation:0,role:"status",sx:{width:"100%",px:1.5,py:1.5,border:"1.5px solid #86EFAC",borderRadius:2,bgcolor:"#F0FDF4",boxSizing:"border-box"}},{children:r.jsxs(h.default,e.__assign({alignItems:"center",spacing:1.5,sx:{textAlign:"center"}},{children:[r.jsx(c.default,e.__assign({sx:{display:"grid",placeItems:"center",width:58,height:58,border:"8px solid rgba(255, 255, 255, 0.9)",borderRadius:"50%",bgcolor:"#DCFCE7",color:"#0A9B49"}},{children:r.jsx(s.CheckCircleIcon,{height:36,width:36})})),r.jsxs(c.default,{children:[r.jsx(f.default,e.__assign({sx:{color:"#166534",fontSize:15,fontWeight:600,lineHeight:1.4}},{children:t})),r.jsx(f.default,e.__assign({sx:{mt:.75,color:"#07883F",fontSize:14,lineHeight:1.55}},{children:o}))]}),r.jsx(x.default,e.__assign({variant:"outlined",fullWidth:!0,onClick:l,endIcon:r.jsx(u.default,{}),sx:{minHeight:42,border:"1.5px solid #CBD5E1",borderRadius:2,bgcolor:"#FFFFFF",color:"#475569",fontSize:16,fontWeight:700,textTransform:"none","&:hover":{borderColor:"#94A3B8",bgcolor:"#FFFFFF"}}},{children:n}))]}))}))};
2
2
  //# sourceMappingURL=RevertSuccessCard.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n,t=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),o=require("@react-pdf-viewer/core"),a=require("../PdfViewer/PdfViewer.js"),l=require("./BoundaryCard.js"),u=require("./CardWrapper.js"),s=require("./CognitiveIntegrity.js"),d=require("./LabelCheck.js"),c=require("./PageCheck.js"),g=require("./PageTypeChoiceCheck.js"),v=require("./reviewStepAdapters.js"),m=require("lucide-react"),p=require("@mui/material"),f=require("./ReviewedCard.js"),h=require("./ReviewedBoundaryActions.js"),_=require("./RevertCard.js"),w=require("./RevertSuccessCard.js"),y=require("./helper.js"),b=require("./ChartBreakoutCircle.js"),S=require("./reviewScore.js"),x=260;exports.SegmentPdfSpecialZoomLevel=void 0,(n=exports.SegmentPdfSpecialZoomLevel||(exports.SegmentPdfSpecialZoomLevel={})).ActualSize="ActualSize",n.PageFit="PageFit",n.PageWidth="PageWidth";var R=((e={})[exports.SegmentPdfSpecialZoomLevel.ActualSize]=o.SpecialZoomLevel.ActualSize,e[exports.SegmentPdfSpecialZoomLevel.PageFit]=o.SpecialZoomLevel.PageFit,e[exports.SegmentPdfSpecialZoomLevel.PageWidth]=o.SpecialZoomLevel.PageWidth,e),E=function(e){return{reviewId:e.id,segment:e.segment,pageNumber:e.pageNumber}};exports.default=function(e){var n,C,k,P,A,M,I,j,N,B,T,L,F,q,W,K,z,G,O,D,V,H,U,Z,X,Y,J,$,Q,ee,ne,te,ie,re,oe,ae,le,ue=this,se=e.pdfUrl,de=e.pdfName,ce=e.segments,ge=e.totalPages,ve=e.styles,me=e.pdfViewerProps,pe=e.specialZoomLevel,fe=e.showBadges,he=void 0===fe||fe,_e=e.sortByConfidence,we=void 0===_e?"low":_e,ye=e.filterByConfidence,be=void 0===ye?"all":ye,Se=e.showBadgeNavigation,xe=void 0===Se||Se,Re=e.autoSelectReviewOnPageChange,Ee=void 0!==Re&&Re,Ce=e.autoAdvanceAfterConfirm,ke=void 0===Ce||Ce,Pe=e.autoAdvanceScoreBand,Ae=e.badgePreloadPages,Me=void 0===Ae?8:Ae,Ie=e.badgeOffsetTop,je=void 0===Ie?20:Ie,Ne=e.badgeOffsetRight,Be=void 0===Ne?68:Ne,Te=e.badgeOffsetLeft,Le=void 0===Te?0:Te,Fe=e.initialReviewId,qe=e.manualPrompt,We=e.heightBuffer,Ke=e.onBoundaryAction,ze=e.onLabelAction,Ge=e.onPageAction,Oe=e.onPageTypeRevert,De=e.onRevert,Ve=e.onActiveReviewChange,He=e.onCurrentPageChange,Ue=e.onActionError,Ze=e.disableAllActions,Xe=void 0!==Ze&&Ze,Ye=e.disablePdfAnnotations,Je=void 0!==Ye&&Ye,$e=e.disablePdfTextLayer,Qe=void 0===$e||$e,en=e.disableTitleCheckUntilBoundaryCheckCompleted,nn=void 0!==en&&en,tn=e.onAdjustManually,rn=e.onCognitiveClick,on=e.className,an=e.style,ln=e.viewerStyle,un=e.railStyle,sn=e.redirectionData,dn=e.onBadgeSelected;console.log("LOG: TOTAL PAGE IN PARENT",ge);var cn=r.useMemo(function(){return v.extractSegmentReviewData(ce)},[ce]),gn=cn.boundaryReviews,vn=cn.labelReviews,mn=cn.pageReviews,pn=r.useState(function(){return new Map}),fn=pn[0],hn=pn[1],_n=r.useState(function(){return new Set}),wn=_n[0],yn=_n[1],bn=r.useMemo(function(){var e=new Map,n=1;return ce.forEach(function(t,i){var r=v.getSegmentReviewKey(t,i);e.has(r)||(e.set(r,n),n+=1)}),e},[ce]),Sn=r.useMemo(function(){return new Set(vn.map(function(e){return v.getSegmentReviewKey(e.segment)}))},[vn]),xn=r.useMemo(function(){return y.getPendingMergeImpactedSegmentKeys(ce)},[ce]);r.useEffect(function(){hn(function(e){var n=!1,t=new Map(e);return e.forEach(function(e,i){var r=ce.find(function(e){return v.getSegmentReviewKey(e)===i});r&&!y.hasPolledStructuralAction(r,e)||(t.delete(i),n=!0)}),n?t:e})},[ce]),r.useEffect(function(){yn(function(e){var n=!1,t=new Set(e);return e.forEach(function(e){fn.has(e)||(t.delete(e),n=!0)}),n?t:e})},[fn]);var Rn=r.useMemo(function(){return y.getOptimisticMergeImpactedSegmentKeys(ce,fn,wn)},[wn,fn,ce]),En=r.useRef(null),Cn=r.useMemo(function(){return t.__spreadArray(t.__spreadArray(t.__spreadArray([],gn.filter(function(e){return!xn.has(v.getSegmentReviewKey(e.segment))&&!Rn.has(v.getSegmentReviewKey(e.segment))&&!y.shouldHideStructuralBoundaryReview(e.review_step,e.segment,Sn.has(v.getSegmentReviewKey(e.segment)),fn.get(v.getSegmentReviewKey(e.segment)))}).map(function(e){var n;return t.__assign(t.__assign({},e),{kind:"boundary",pageNumber:null!==(n=e.metadata.focus_page)&&void 0!==n?n:e.segment.start_page})}),!0),vn.filter(function(e){return!xn.has(v.getSegmentReviewKey(e.segment))&&!Rn.has(v.getSegmentReviewKey(e.segment))}).map(function(e){return t.__assign(t.__assign({},e),{kind:"label",pageNumber:e.segment.start_page})}),!0),mn.filter(function(e){return!xn.has(v.getSegmentReviewKey(e.segment))&&!Rn.has(v.getSegmentReviewKey(e.segment))}).map(function(e){var n;return t.__assign(t.__assign({},e),{kind:"page",pageNumber:null!==(n=e.metadata.page_num)&&void 0!==n?n:e.segment.start_page})}),!0).sort(function(e,n){var t,i,r=null!==(t=bn.get(v.getSegmentReviewKey(e.segment)))&&void 0!==t?t:Number.MAX_SAFE_INTEGER,o=null!==(i=bn.get(v.getSegmentReviewKey(n.segment)))&&void 0!==i?i:Number.MAX_SAFE_INTEGER;return e.pageNumber-n.pageNumber||r-o||e.reviewStepIndex-n.reviewStepIndex||e.id.localeCompare(n.id)})},[gn,vn,mn,Rn,fn,xn,bn,Sn]),kn=r.useMemo(function(){return ce.map(function(e){var n,i;return t.__assign(t.__assign({},e),{title:(null===(n=e.label)||void 0===n?void 0:n.trim())||e.title,page_count:null!==(i=e.page_count)&&void 0!==i?i:e.end_page-e.start_page+1})})},[ce]),Pn=r.useState(1),An=Pn[0],Mn=Pn[1],In=r.useState(null!=Fe?Fe:null),jn=In[0],Nn=In[1],Bn=r.useState(null!=Fe?Fe:null),Tn=Bn[0],Ln=Bn[1],Fn=r.useState(!1),qn=Fn[0],Wn=Fn[1],Kn=r.useState(null),zn=Kn[0],Gn=Kn[1],On=r.useState(null),Dn=On[0],Vn=On[1],Hn=r.useState(function(){return new Set}),Un=Hn[0],Zn=Hn[1],Xn=r.useState(null),Yn=Xn[0],Jn=Xn[1],$n=r.useState(null),Qn=$n[0],et=$n[1],nt=r.useState(null),tt=nt[0],it=nt[1],rt=r.useState(!1),ot=rt[0],at=rt[1],lt=r.useRef(0),ut=r.useRef(null),st=r.useRef(null),dt=r.useRef(new Map),ct=r.useRef(null),gt=r.useRef(null),vt=r.useRef(null),mt=r.useState(x),pt=mt[0],ft=mt[1],ht=null!==(C=null===(n=null==ve?void 0:ve.aside)||void 0===n?void 0:n.width)&&void 0!==C?C:"40%",_t="min(".concat("number"==typeof ht?"".concat(ht,"px"):ht,", ").concat(x,"px, 100%)");r.useEffect(function(){Zn(function(e){if(0===e.size)return e;var n=new Set(e),t=!1;return Cn.forEach(function(e){var i;null!=(null===(i=e.review_step.review)||void 0===i?void 0:i.action)&&n.has(e.id)&&(n.delete(e.id),t=!0)}),t?n:e})},[Cn]),r.useEffect(function(){var e=En.current;if(e&&he){var n=function(){var n=e.getBoundingClientRect().width;n>0&&ft(n)};n();var t="undefined"==typeof ResizeObserver?null:new ResizeObserver(n);return null==t||t.observe(e),function(){return null==t?void 0:t.disconnect()}}},[he]);var wt=r.useMemo(function(){var e=new Set;return Cn.forEach(function(n){var t;null!=(null===(t=n.review_step.review)||void 0===t?void 0:t.action)&&e.add(n.id)}),e},[Cn]),yt=r.useMemo(function(){var e;return null!==(e=Cn.find(function(e){return e.id===jn}))&&void 0!==e?e:null},[jn,Cn]),bt=r.useMemo(function(){return!(!nn||"label"!==(null==yt?void 0:yt.kind))&&gn.some(function(e){if(v.getSegmentReviewKey(e.segment)!==v.getSegmentReviewKey(yt.segment)||wt.has(e.id))return!1;var n=y.getResolvedScore(e.review_step.score,e.review_step.confidence);return null==n||n<85})},[yt,gn,nn,wt]),St=null==yt?-1:ce.findIndex(function(e){return v.getSegmentReviewKey(e)===v.getSegmentReviewKey(yt.segment)}),xt=St>0?ce[St-1]:void 0,Rt=St>=0?ce[St+1]:void 0,Et=(null===(k=null==xt?void 0:xt.label)||void 0===k?void 0:k.trim())||(null==xt?void 0:xt.title),Ct=(null===(P=null==Rt?void 0:Rt.label)||void 0===P?void 0:P.trim())||(null==Rt?void 0:Rt.title),kt=y.getConfidenceColors(null==yt?void 0:yt.review_step.score,null==yt?void 0:yt.review_step.confidence,null===(A=null==yt?void 0:yt.segment.confidence)||void 0===A?void 0:A.awaiting_llm),Pt=(null===(M=null==yt?void 0:yt.review_step.reasons)||void 0===M?void 0:M.length)?yt.review_step.reasons:null!==(j=null===(I=null==yt?void 0:yt.segment.confidence)||void 0===I?void 0:I.reasons)&&void 0!==j?j:[],At=Boolean(Pt.some(function(e){return e.text.trim()&&["evidence","gap"].includes(e.type.trim().toLowerCase())})||(null===(N=null==yt?void 0:yt.review_step.reason)||void 0===N?void 0:N.trim())||(null===(B=null==yt?void 0:yt.review_step.gap)||void 0===B?void 0:B.trim())),Mt=null==yt?null:"boundary"===yt.kind?y.getBoundaryReviewActionBadgeLabel(yt.review_step,yt.segment,fn.get(null!==(T=yt.segment.stable_key)&&void 0!==T?T:"")):y.getTitleReviewActionBadgeLabel(yt.review_step,yt.segment,fn.get(null!==(L=yt.segment.stable_key)&&void 0!==L?L:"")),It="label"===(null==yt?void 0:yt.kind)?[Mt,yt.review_step.human_action_enum,null===(F=yt.review_step.review)||void 0===F?void 0:F.action,null===(q=yt.review_step.human_resolution)||void 0===q?void 0:q.action]:[],jt="label"===(null==yt?void 0:yt.kind)&&It.some(function(e){var n,t=null!==(n=null==e?void 0:e.trim().toUpperCase())&&void 0!==n?n:"";return t.includes("MERGE")||t.includes("SPLIT")}),Nt=null!=yt&&Cn.some(function(e){return"boundary"===e.kind&&v.getSegmentReviewKey(e.segment)===v.getSegmentReviewKey(yt.segment)}),Bt=jt&&!Nt,Tt=("boundary"===(null==yt?void 0:yt.kind)||Bt)&&null!=yt?function(){var e,n,i,r,o,a;if("boundary"===yt.kind)return yt;var l=gn.find(function(e){return v.getSegmentReviewKey(e.segment)===v.getSegmentReviewKey(yt.segment)});return l?t.__assign(t.__assign({},l),{kind:"boundary",pageNumber:null!==(e=l.metadata.focus_page)&&void 0!==e?e:l.segment.start_page}):t.__assign(t.__assign({},yt),{kind:"boundary",pageNumber:null!==(i=null===(n=yt.segment.review_action)||void 0===n?void 0:n.focus_page)&&void 0!==i?i:yt.segment.start_page,metadata:{focus_page:null!==(o=null===(r=yt.segment.review_action)||void 0===r?void 0:r.focus_page)&&void 0!==o?o:null,boundary_margin:null!==(a=yt.segment.boundary_margin)&&void 0!==a?a:null,user_actions:[]}})}():void 0,Lt=null==yt?"":(null===(W=yt.segment.label)||void 0===W?void 0:W.trim())||yt.segment.title,Ft=null==yt?void 0:yt.review_step.revert,qt=null==yt?void 0:yt.segment.revert,Wt=function(e){return null==e?void 0:e.trim().toLowerCase()},Kt=null==yt||null===(z=t.__spreadArray([],null!==(K=yt.segment.review_steps)&&void 0!==K?K:[],!0).reverse().find(function(e){var n,t,i=null===(n=e.type)||void 0===n?void 0:n.trim().toLowerCase();return("page_boundary"===i||"page boundary review"===i)&&"boundary"===Wt(null===(t=e.revert)||void 0===t?void 0:t.type)}))||void 0===z?void 0:z.revert,zt=null!==(G=null!=Ft?Ft:null==yt?void 0:yt.segment.revert)&&void 0!==G?G:Kt,Gt=null==zt?void 0:zt.decision.trim().toUpperCase();null!=Mt||(null==Gt?void 0:Gt.includes("SPLIT"))||null==Gt||Gt.includes("MERGE");var Ot="label"===(null==yt?void 0:yt.kind)&&"SET_RANGE"===(null===(O=null==Kt?void 0:Kt.decision)||void 0===O?void 0:O.trim().toUpperCase())&&Kt.current_segment_ids.length!==Kt.previous_state.length,Dt="Merged"===Mt||"Split"===Mt||Ot,Vt=null==yt?void 0:Dt?"boundary"===Wt(null==Kt?void 0:Kt.type)?Kt:"boundary"===Wt(null==qt?void 0:qt.type)?qt:"boundary"===Wt(null==Ft?void 0:Ft.type)?Ft:void 0:"label"===yt.kind?"label"===Wt(null==Ft?void 0:Ft.type)?Ft:void 0:"boundary"===yt.kind?"boundary"===Wt(null==Ft?void 0:Ft.type)?Ft:"boundary"===Wt(null==Kt?void 0:Kt.type)?Kt:"boundary"===Wt(null==qt?void 0:qt.type)?qt:void 0:void 0,Ht=Dt&&(null==Vt?void 0:Vt.operation_id)?ce.flatMap(function(e){var n;return null!==(n=e.review_steps)&&void 0!==n?n:[]}).find(function(e){var n,t,i,r,o,a,l,u=null===(n=e.type)||void 0===n?void 0:n.trim().toLowerCase();return("page_boundary"===u||"page boundary review"===u)&&((null!==(o=null!==(i=null===(t=e.human_resolution)||void 0===t?void 0:t.operation_id)&&void 0!==i?i:null===(r=e.revert)||void 0===r?void 0:r.operation_id)&&void 0!==o?o:e.operation_id)===Vt.operation_id&&Boolean(null===(l=null===(a=e.human_resolution)||void 0===a?void 0:a.change_summary)||void 0===l?void 0:l.trim()))}):void 0,Ut=(null===(D=null==Vt?void 0:Vt.summary)||void 0===D?void 0:D.trim())||null,Zt=Dt?(null===(H=null===(V=null==Ht?void 0:Ht.human_resolution)||void 0===V?void 0:V.change_summary)||void 0===H?void 0:H.trim())||(null===(U=null==Vt?void 0:Vt.summary)||void 0===U?void 0:U.trim())||"":(null===(Y=null===(X=null===(Z=null==yt?void 0:yt.review_step)||void 0===Z?void 0:Z.human_resolution)||void 0===X?void 0:X.change_summary)||void 0===Y?void 0:Y.trim())||(null===($=null===(J=null==yt?void 0:yt.review_step)||void 0===J?void 0:J.summary)||void 0===$?void 0:$.trim())||"",Xt="page"===(null==yt?void 0:yt.kind)?{currentSegment:{title:Lt,startPage:yt.segment.start_page,endPage:yt.segment.end_page},previousSegments:[]}:yt&&Vt?{currentSegment:{title:Lt,startPage:yt.segment.start_page,endPage:yt.segment.end_page},previousSegments:(null!==(Q=Vt.previous_state)&&void 0!==Q?Q:[]).flatMap(function(e){var n,t=null===e.label?"Untitled document":null===(n=e.label)||void 0===n?void 0:n.trim();return t?[{title:t,startPage:e.start_page,endPage:e.end_page}]:[]})}:null,Yt="page"===(null==yt?void 0:yt.kind)?null!==(ne=null===(ee=yt.metadata.type_choices)||void 0===ee?void 0:ee.map(function(e){return e.classification_id}))&&void 0!==ne?ne:yt.metadata.classification_id?[yt.metadata.classification_id]:[]:[],Jt="page"===(null==yt?void 0:yt.kind)?Boolean(Oe&&Yt.length>0):Boolean((null==Vt?void 0:Vt.operation_id)&&(null==Vt?void 0:Vt.type)&&!1!==(null==Vt?void 0:Vt.revertable)),$t=Boolean(Xt&&Jt),Qt=r.useCallback(function(e,n){lt.current+=1,ut.current={requestId:lt.current,pageNumber:e,reviewId:n},Vn({pageNumber:e,requestId:lt.current})},[]),ei=r.useCallback(function(e){var n,t;!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)&&(null==dn||dn({reviewId:e.id,segment_id:null!==(t=e.segment.segment_id)&&void 0!==t?t:null,reviewStepIndex:e.reviewStepIndex,kind:e.kind,pageNumber:e.pageNumber,metadata:e.metadata}),et(null),it(null),Nn(e.id),Ln(e.id),Wn(!1),Gn(null),Qt(e.pageNumber,e.id),null==Ve||Ve(e.id,e.segment))},[Ve,dn,Qt]);r.useEffect(function(){if(tt){var e=requestAnimationFrame(function(){return at(!0)}),n=window.setTimeout(function(){at(!1)},3500),t=window.setTimeout(function(){it(null)},4e3);return function(){cancelAnimationFrame(e),window.clearTimeout(n),window.clearTimeout(t)}}},[tt]),r.useEffect(function(){var e,n,t,i;if(sn){if("pageGroup"===sn.type){var r=null!==(e=sn.pages)&&void 0!==e?e:[],o=null!==(n=sn.pageIndex)&&void 0!==n?n:0,a=r[o];if(null==a)return;return ni(),et({pages:r,index:o,label:null!==(t=sn.groupLabel)&&void 0!==t?t:""}),lt.current+=1,void Vn({pageNumber:a,requestId:lt.current})}if(et(null),sn.reviewId){var l=Cn.find(function(e){return e.id===sn.reviewId&&(!sn.type||e.kind===sn.type)});if(l)return void ei(l)}if(sn.classificationId){var u=Cn.find(function(e){var n;return"page"===e.kind&&(e.metadata.classification_id===sn.classificationId||(null===(n=e.metadata.type_choices)||void 0===n?void 0:n.some(function(e){return e.classification_id===sn.classificationId})))&&(!sn.segmentId||e.segment.segment_id===sn.segmentId)&&(!sn.type||e.kind===sn.type)});if(u)return void ei(u)}if(sn.pageNumber&&sn.type){var s=Number(sn.pageNumber);if(Number.isInteger(s)&&!(s<1)){var d=null===(i=sn.pageType)||void 0===i?void 0:i.trim().toLowerCase(),c=Cn.find(function(e){var n,t="page"===e.kind?e.pageNumber:e.segment.start_page,i="page"!==e.kind||!d||e.metadata.page_type===d||(null===(n=e.metadata.type_choices)||void 0===n?void 0:n.some(function(e){return e.page_type===d}));return(!sn.segmentId||e.segment.segment_id===sn.segmentId)&&t===s&&e.kind===sn.type&&i});c?ei(c):"page"===sn.type&&(ni(),lt.current+=1,Vn({pageNumber:s,requestId:lt.current}))}}}},[sn,ei,Cn]);var ni=r.useCallback(function(){ut.current=null,Wn(!1),Nn(null),Gn(null),null==Ve||Ve(null,null)},[Ve]),ti=r.useCallback(function(e){var n;at(!1),it(null);var t=null!==(n=Cn.find(function(n){return!wt.has(n.id)&&"boundary"===n.kind&&n.segment.start_page===e.startPage&&n.segment.end_page===e.endPage}))&&void 0!==n?n:Cn.find(function(n){return!wt.has(n.id)&&n.segment.start_page<=e.startPage&&n.segment.end_page>=e.startPage});t?ei(t):(ni(),lt.current+=1,Vn({pageNumber:e.startPage,requestId:lt.current}))},[ni,wt,Cn,ei]),ii=r.useCallback(function(e,n){var t,i=S.getReviewScoreBand(e.review_step.score),r=null==Pe||i===Pe,o=Un.has(e.id)&&y.isReviewStepResolutionCurrent(e.review_step,e.segment);return e.id!==n&&r&&!0!==(null===(t=e.segment.confidence)||void 0===t?void 0:t.awaiting_llm)&&!y.isReviewStepResolved(e.review_step,e.segment)&&!o},[Pe,Un]),ri=r.useCallback(function(e){var n;if(ke){var t=Cn.findIndex(function(n){return n.id===e}),i=null!==(n=Cn.find(function(n,i){return i>t&&ii(n,e)}))&&void 0!==n?n:Cn.find(function(n){return ii(n,e)});i?requestAnimationFrame(function(){return ei(i)}):ni()}else ni()},[ke,ni,ii,Cn,ei]),oi=r.useCallback(function(e,n){return t.__awaiter(ue,void 0,void 0,function(){var i,r,o,a,l,u,s,d,g,v;return t.__generator(this,function(m){switch(m.label){case 0:if(Xe||!Ge||0===n.length)return[2];if(2!==(i=null!==(v=e.metadata.type_choices)&&void 0!==v?v:[]).length)return[2];r=new Set(n),o=E(e),a=t.__spreadArray([],i,!0).sort(function(e,n){var t=r.has(e.page_type);return t===r.has(n.page_type)?0:t?-1:1}),Jn(e.id),m.label=1;case 1:m.trys.push([1,6,7,8]),l=0,u=a,m.label=2;case 2:return l<u.length?(s=u[l],d=r.has(s.page_type)?c.PageCheckActionEnum.YES:c.PageCheckActionEnum.NO,[4,Ge(d,{action:d,pageType:s.page_type,metadata:{user_actions:[c.PageCheckActionEnum.YES,c.PageCheckActionEnum.NO],page_num:e.metadata.page_num,page_type:s.page_type,classification_id:s.classification_id}},o)]):[3,5];case 3:m.sent(),m.label=4;case 4:return l++,[3,2];case 5:return Zn(function(n){var t=new Set(n);return t.add(e.id),t}),ri(e.id),[3,8];case 6:return g=m.sent(),null==Ue||Ue(g,o),[3,8];case 7:return Jn(null),[7];case 8:return[2]}})})},[Xe,Ue,Ge,ri]),ai=r.useCallback(function(e,n,i){return t.__awaiter(ue,void 0,void 0,function(){var r,o,a,u,s,d,c,g,m,p;return t.__generator(this,function(t){switch(t.label){case 0:if(Xe)return[2];if("boundary"===e.kind&&!Ke)return[2];if("label"===e.kind&&!ze)return[2];if("page"===e.kind&&!Ge)return[2];r=E(e),a=i,u=(o=n)===l.BoundaryReviewActionEnum.SET_RANGE?function(){var n=a.startPage,t=a.endPage;if(null==n||null==t)return null;var i=n<e.segment.start_page||t>e.segment.end_page,r=n>e.segment.start_page||t<e.segment.end_page;return i&&!r?n<e.segment.start_page?l.BoundaryReviewActionEnum.MERGE_PREV:l.BoundaryReviewActionEnum.MERGE_NEXT:r?l.BoundaryReviewActionEnum.SPLIT_HERE:null}():o,s="boundary"===e.kind&&null!=Ke&&ke&&(u===l.BoundaryReviewActionEnum.SPLIT_HERE||u===l.BoundaryReviewActionEnum.MERGE_NEXT||u===l.BoundaryReviewActionEnum.MERGE_PREV||u===l.BoundaryReviewActionEnum.MERGE_PREVIOUS),d=s?ce.findIndex(function(n){return v.getSegmentReviewKey(n)===v.getSegmentReviewKey(e.segment)}):-1,s&&d>=0&&u&&(st.current={action:u,originalSegmentIndex:d,segmentSignature:JSON.stringify(ce.map(function(e,n){var t;return{key:v.getSegmentReviewKey(e,n),startPage:e.start_page,endPage:e.end_page,version:null!==(t=e.version)&&void 0!==t?t:null}})),ready:!1}),Jn(e.id),t.label=1;case 1:return t.trys.push([1,8,9,10]),"boundary"!==e.kind?[3,3]:[4,null==Ke?void 0:Ke(n,i,r)];case 2:return t.sent(),[3,7];case 3:return"label"!==e.kind?[3,5]:[4,null==ze?void 0:ze(n,i,r)];case 4:return t.sent(),[3,7];case 5:return"page"!==e.kind?[3,7]:[4,null==Ge?void 0:Ge(n,i,r)];case 6:t.sent(),t.label=7;case 7:return Zn(function(n){var t=new Set(n);return t.add(e.id),t}),c="boundary"===e.kind&&(u===l.BoundaryReviewActionEnum.MERGE_NEXT||u===l.BoundaryReviewActionEnum.MERGE_PREV||u===l.BoundaryReviewActionEnum.MERGE_PREVIOUS),("boundary"===e.kind&&u===l.BoundaryReviewActionEnum.SPLIT_HERE||c)&&u&&(g=v.getSegmentReviewKey(e.segment),yn(function(e){var n=new Set(e);return o===l.BoundaryReviewActionEnum.SET_RANGE?n.add(g):n.delete(g),n}),hn(function(e){var n=new Map(e);return n.set(g,u),n})),st.current?(st.current.ready=!0,c&&(m=Cn.find(function(n){return"label"===n.kind&&v.getSegmentReviewKey(n.segment)===v.getSegmentReviewKey(e.segment)}))&&requestAnimationFrame(function(){return ei(m)})):ri(e.id),[3,10];case 8:return p=t.sent(),s&&(st.current=null),null==Ue||Ue(p,r),[3,10];case 9:return Jn(null),[7];case 10:return[2]}})})},[ke,Xe,Ue,Ke,ze,Ge,Oe,Cn,ce,ei,ri]);r.useEffect(function(){var e=st.current;if(null==e?void 0:e.ready){var n=JSON.stringify(ce.map(function(e,n){var t;return{key:v.getSegmentReviewKey(e,n),startPage:e.start_page,endPage:e.end_page,version:null!==(t=e.version)&&void 0!==t?t:null}}));if(n!==e.segmentSignature){var t=e.action===l.BoundaryReviewActionEnum.SPLIT_HERE?e.originalSegmentIndex+1:e.action===l.BoundaryReviewActionEnum.MERGE_PREV||e.action===l.BoundaryReviewActionEnum.MERGE_PREVIOUS?Math.max(0,e.originalSegmentIndex-1):e.originalSegmentIndex,i=new Map(ce.map(function(e,n){return[v.getSegmentReviewKey(e,n),n]})),r=Cn.find(function(e){var n=i.get(v.getSegmentReviewKey(e.segment));return null!=n&&n>=t&&ii(e)});if(!r)return st.current=null,void ni();requestAnimationFrame(function(){st.current=null,ei(r)})}}},[ni,ii,Cn,ce,ei]),r.useEffect(function(){st.current||jn&&!Cn.some(function(e){return e.id===jn})&&ni()},[jn,ni,Cn]),r.useEffect(function(){if(Ee&&!st.current){var e=Cn.find(function(e){return e.pageNumber===An});e&&e.id!==jn&&ei(e)}},[jn,Ee,An,ei,Cn]),r.useEffect(function(){st.current||jn&&!Cn.some(function(e){var n;return e.id===jn&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)})&&ni()},[jn,ni,Cn]);var li=r.useMemo(function(){var e=Cn.filter(function(e){var n;return!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if("all"===be)return e;var n=["low","medium","high"].filter(function(e){return e!==we}),i=t.__spreadArray([we],n,!0),r=new Map(i.map(function(e,n){return[e,n]}));return e.map(function(e,n){return{item:e,index:n}}).sort(function(e,n){var t,o,a,l,u=null===(t=e.item.review_step.confidence)||void 0===t?void 0:t.trim().toLowerCase(),s=null===(o=n.item.review_step.confidence)||void 0===o?void 0:o.trim().toLowerCase();return(null==u?i.length:null!==(a=r.get(u))&&void 0!==a?a:i.length)-(null==s?i.length:null!==(l=r.get(s))&&void 0!==l?l:i.length)||e.index-n.index}).map(function(e){return e.item})},[be,we,Cn]),ui=li.findIndex(function(e){return e.id===Tn}),si=r.useState(null),di=si[0],ci=si[1],gi=r.useState(null),vi=gi[0],mi=gi[1],pi=r.useRef(!1),fi=r.useCallback(function(e){var n=li[e];n&&ei(n)},[li,ei]);r.useCallback(function(e){if(!(!Qn||e<0||e>=Qn.pages.length)){var n=Qn.pages[e];null!=n&&(ni(),et(function(n){return null==n?n:t.__assign(t.__assign({},n),{index:e})}),lt.current+=1,Vn({pageNumber:n,requestId:lt.current}))}},[Qn,ni]),r.useEffect(function(){Tn&&!li.some(function(e){return e.id===Tn})&&Ln(null)},[li,Tn]),r.useEffect(function(){pi.current=!1,mi(null),ci(ui>=0?String(ui+1):null)},[ui,li.length]),r.useEffect(function(){if(pi.current&&null!=di){var e=window.setTimeout(function(){var e=Number(di.trim()),n=e-1;Number.isInteger(e)&&n>=0&&n<li.length&&(pi.current=!1,fi(n))},300);return function(){return window.clearTimeout(e)}}},[fi,di,li.length]);var hi=r.useMemo(function(){var e=new Map;Cn.forEach(function(n){var t,i=null!==(t=e.get(v.getSegmentReviewKey(n.segment)))&&void 0!==t?t:[];i.push(n),e.set(v.getSegmentReviewKey(n.segment),i)});var n=new Map;return e.forEach(function(e,t){var i,r=null!==(i=bn.get(t))&&void 0!==i?i:1;e.sort(function(e,n){return e.reviewStepIndex-n.reviewStepIndex}).forEach(function(e,t){n.set(e.id,"".concat(r).concat(function(e){for(var n=e+1,t="";n>0;)n-=1,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}(t)))})}),n},[Cn,bn]),_i=r.useMemo(function(){var e=new Map;Cn.forEach(function(n){var t,i=null!==(t=e.get(n.pageNumber))&&void 0!==t?t:[];i.push(n),e.set(n.pageNumber,i)});var n=new Map;return e.forEach(function(e){e.forEach(function(e,t){return n.set(e.id,t)})}),n},[Cn]),wi=r.useCallback(function(e){return{startPage:Math.max(0,e.startPage-Me),endPage:Math.min(e.numPages-1,e.endPage+Me)}},[Me]),yi=r.useCallback(function(){var e,n=gt.current,t=vt.current;if(n&&t){var i=n.getBoundingClientRect(),r=t.querySelector(".rpv-core__inner-pages"),o=null!==(e=null==r?void 0:r.getBoundingClientRect())&&void 0!==e?e:t.getBoundingClientRect();Cn.forEach(function(e){var n,r=dt.current.get(e.id);if(r){var a=t.querySelector('[data-testid="core__page-layer-'.concat(e.pageNumber-1,'"]'));if(a){var l=a.getBoundingClientRect(),u=null!==(n=_i.get(e.id))&&void 0!==n?n:0,s=l.top+je+40*u,d=s+(r.offsetHeight||32),c=s>=o.top&&d<=o.bottom;r.style.top="".concat(s-i.top,"px"),r.style.visibility=c?"visible":"hidden"}else r.style.visibility="hidden"}});var a=ct.current;if(a){var l=null==Qn?void 0:Qn.pages[Qn.index],u=null==l?null:t.querySelector('[data-testid="core__page-layer-'.concat(l-1,'"]'));if(Qn&&u){var s=u.getBoundingClientRect().top+je,d=s+(a.offsetHeight||25),c=s>=o.top&&d<=o.bottom;a.style.top="".concat(s-i.top,"px"),a.style.visibility=c?"visible":"hidden"}else a.style.visibility="hidden"}if(jn&&null==ut.current){var g=dt.current.get(jn);g&&"hidden"!==g.style.visibility&&Gn(function(e){return e===g?e:g})}}},[Qn,jn,je,_i,Cn]),bi=r.useCallback(function(e){var n=ut.current;n&&n.requestId===e.requestId&&n.pageNumber===e.pageNumber&&(ut.current=null,yi(),requestAnimationFrame(function(){if(null==ut.current){var e=dt.current.get(n.reviewId);e&&"hidden"!==e.style.visibility&&Gn(e)}}))},[yi]);return r.useEffect(function(){var e=vt.current;if(e&&he){var n=null,t=function(){null==n&&(n=requestAnimationFrame(function(){n=null,yi()}))};e.addEventListener("scroll",t,!0),window.addEventListener("resize",t);var i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});var r="undefined"==typeof ResizeObserver?null:new ResizeObserver(t);return null==r||r.observe(e),t(),function(){null!=n&&cancelAnimationFrame(n),e.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t),i.disconnect(),null==r||r.disconnect()}}},[he,yi]),i.jsxs("div",t.__assign({ref:gt,className:on,style:t.__assign(t.__assign({},an),{display:"block",position:"relative",width:"100%",height:"100%",minWidth:0,overflowX:"auto",overflowY:"hidden"})},{children:[i.jsxs("div",t.__assign({className:"segment-review-wrapper__container",style:{display:"flex",alignItems:"stretch",gap:0,width:"100%",minWidth:700,height:"100%"}},{children:[i.jsx("div",t.__assign({ref:vt,style:t.__assign(t.__assign({},ln),{flex:"1 1 auto",width:he?"auto":"100%",minWidth:0,height:"100%",boxSizing:"border-box"})},{children:i.jsx(a.default,t.__assign({highlightText:[],highlightPages:{},highlightCordinatePages:[],useCoordinates:!1,showRotateButton:!0},me,{defaultScale:void 0===pe?null!==(te=null==me?void 0:me.defaultScale)&&void 0!==te?te:o.SpecialZoomLevel.PageFit:R[pe],disablePdfAnnotations:Je,disablePdfTextLayer:Qe,pdfUrl:se,pdfName:de,segments:kn,navigationRequest:Dn,onNavigationSettled:bi,setRenderRange:wi,onCurrentPageChange:function(e){Mn(e),null==ut.current&&yt&&yt.pageNumber!==e&&ni(),null==He||He(e)}}))})),he&&i.jsxs("aside",t.__assign({"aria-label":"Page review badges",ref:En,style:t.__assign(t.__assign({},un),{position:"relative",width:_t,maxWidth:x,flex:"0 1 ".concat(_t),minHeight:0,overflow:"hidden",boxSizing:"border-box"})},{children:[Qn&&i.jsx("span",t.__assign({ref:ct,style:{position:"absolute",top:0,left:10,visibility:"hidden",zIndex:2,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,minHeight:25,padding:"2px 8px",border:"1px solid #E2E8F0",borderRadius:16,backgroundColor:"#F8FAFC",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)",font:"inherit"}},{children:i.jsxs(p.Typography,t.__assign({fontFamily:"Inter",sx:{fontSize:11,fontWeight:500,color:"#475569",whiteSpace:"nowrap"}},{children:[Qn.label||"Pages"," Pg: ",Qn.index+1]}))})),xe&&li.length>0&&!Qn&&i.jsxs("nav",t.__assign({"aria-label":"Review badge navigation",style:{position:"absolute",top:8,right:Be||"auto",left:Le||"auto",zIndex:2,display:"flex",alignItems:"center",gap:7,width:128,minHeight:40,padding:"4px 6px",border:"1px solid #CBD5E1",borderRadius:6,backgroundColor:"#FFFFFF",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.06)",font:"inherit"}},{children:[i.jsx(p.Tooltip,t.__assign({title:"out-of-range"===vi?"Please enter valid number present in the range":"Please enter valid numbers",open:null!=vi,placement:"top",arrow:!0},{children:i.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:null!=di?di:"-",min:0,max:li.length,"aria-label":"Review badge number","aria-invalid":null!=vi,onFocus:function(){null==di&&ci("")},onBlur:function(){mi(null);var e=Number(di);(null==di||""===di||!Number.isInteger(e)||e<1||e>li.length)&&(pi.current=!1,ci(ui>=0?String(ui+1):null))},onChange:function(e){var n=e.target.value;if(/^\d*$/.test(n)){var t=Number(n),i=""!==n&&(t<1||t>li.length);mi(i?"out-of-range":null),pi.current=!0,ci(n)}else mi("invalid-number")},style:{width:30,height:28,padding:0,border:"1px solid ".concat(vi?"#DC2626":"#A5B4FC"),borderRadius:3,color:"#4F46E5",backgroundColor:"#FFFFFF",textAlign:"center",font:"inherit",fontSize:15,outline:"none"}})})),i.jsxs("span",t.__assign({"aria-label":"".concat(li.length," reviews"),style:{flex:1,color:"#4F46E5",fontSize:14,whiteSpace:"nowrap",textAlign:"center"}},{children:["of ",li.length]})),["previous","next"].map(function(e){var n="previous"===e,r=ui+(n?-1:1),o=r<0||r>=li.length;return i.jsx("button",t.__assign({type:"button","aria-label":"".concat(n?"Previous":"Next"," review badge"),disabled:o,onClick:function(){return fi(r)},style:{display:"grid",placeItems:"center",width:17,height:28,padding:0,border:0,background:"transparent",color:o?"#C7D2FE":"#4F46E5",cursor:o?"default":"pointer"}},{children:i.jsx("svg",t.__assign({width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},{children:i.jsx("path",{d:n?"M1 7L6 2L11 7":"M1 1L6 6L11 1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))}),e)})]})),!Qn&&Cn.map(function(e){var n,r,o=jn===e.id,a=null!==(n=hi.get(e.id))&&void 0!==n?n:"1A",l=e.review_step.score,u=e.review_step.confidence,s=y.formatScore(l,u),d="boundary"===e.kind?y.getBoundaryReviewActionBadgeLabel(e.review_step,e.segment,fn.get(v.getSegmentReviewKey(e.segment))):"label"===e.kind?y.getTitleReviewActionBadgeLabel(e.review_step,e.segment,fn.get(v.getSegmentReviewKey(e.segment))):null,c=null!=d?d:"N/A"===s?s:"".concat(s,"%"),g=!0===(null===(r=e.segment.confidence)||void 0===r?void 0:r.awaiting_llm),f=y.getConfidenceColors(l,u,g),h=wt.has(e.id),_=g;return i.jsx(p.Tooltip,t.__assign({title:g?"data is being processed":"",arrow:!0},{children:i.jsx("span",t.__assign({ref:function(n){n?dt.current.set(e.id,n):dt.current.delete(e.id)},style:{position:"absolute",top:0,left:10,visibility:"hidden",display:"inline-flex",cursor:_?"not-allowed":"pointer"}},{children:i.jsx("button",t.__assign({disabled:_,type:"button","aria-pressed":o,"aria-label":g?"".concat(e.review_step.type," · Page ").concat(e.pageNumber," · Data is being processed"):"".concat(e.review_step.type," · Page ").concat(e.pageNumber),onClick:function(){return ei(e)},style:{cursor:"inherit",display:"flex",alignItems:"center",justifyContent:"space-around",gap:4,width:d?h&&!g?115:90:h&&!g?105:80,minHeight:25,padding:"2px 5px",border:"1px solid ".concat(h&&!g?"#E2E8F0":f.border),borderRadius:16,backgroundColor:h&&!g?"#F8FAFC":f.background,color:h&&!g?"#475569":f.text,font:"inherit",alignContent:"center",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)"}},{children:h&&!g?i.jsxs(p.Typography,t.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),i.jsxs("span",t.__assign({style:{display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:c}))]})),i.jsxs("span",t.__assign({style:{fontSize:11,fontWeight:500,display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{display:"flex",marginLeft:"7px",alignItems:"center"}},{children:i.jsx(m.CircleCheck,{height:14,width:14,strokeWidth:2,color:"#16A34A"})}))]}))]})):i.jsxs(p.Typography,t.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),i.jsxs("span",t.__assign({style:{display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:f.divider,strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:c}))]}))]}))}))}))}),e.id)})]}))]})),yt&&zn&&i.jsxs(u.default,t.__assign({anchorElement:zn,placement:"bottom-start",offset:{top:8},width:Math.min(pt,x),maxWidth:x,heightBuffer:null!=We?We:25},{children:[qn&&i.jsx(s.default,{width:"100%",maxWidth:"100%",score:yt.review_step.score,reasons:Pt,reason:yt.review_step.reason,gap:yt.review_step.gap,onBack:function(){return Wn(!1)},onClose:ni}),i.jsx("div",t.__assign({style:{display:qn?"none":"block"}},{children:wt.has(yt.id)?i.jsx(f.default,{width:"100%",maxWidth:"100%",headerName:"page"===yt.kind?"Page format approved":"Split"===Mt?"Split approved":"Merged"===Mt?"Merge approved":"User approved",headerIcon:"page"===yt.kind?i.jsx(m.Check,{size:18,strokeWidth:2}):"Merged"===Mt?i.jsx(m.GitMerge,{size:18,strokeWidth:2}):"Split"===Mt?i.jsx(b.default,{width:18,height:18}):i.jsx(m.CircleCheck,{size:18,strokeWidth:2}),title:Lt,pageNo:"Page ".concat(yt.segment.start_page,"-").concat(yt.segment.end_page),summary:$t&&Xt?i.jsx(_.default,{icon:i.jsx(m.CircleCheck,{size:14,strokeWidth:2}),title:Lt,pageRange:"Page ".concat(yt.segment.start_page,"-").concat(yt.segment.end_page),description:null!=Zt?Zt:null,revertData:Xt,confirmDisabled:"page"===yt.kind?!Jt:null==De||!Jt,showDocumentHeader:!1,onRevert:function(){return t.__awaiter(ue,void 0,void 0,function(){var e,n,i,r,o,a,l;return t.__generator(this,function(t){switch(t.label){case 0:if("page"!==yt.kind)return[3,5];if(!Oe||0===Yt.length)throw e=new Error("SegmentReviewPdfWrapper requires onPageTypeRevert and at least one classification id to revert a page-type decision."),null==Ue||Ue(e,E(yt)),e;n=void 0,i=0,r=Yt,t.label=1;case 1:return i<r.length?(o=r[i],[4,Oe({classification_id:o,human_verdict:"No"},E(yt))]):[3,4];case 2:n=t.sent(),t.label=3;case 3:return i++,[3,1];case 4:return[2,n];case 5:if(!De)throw new Error("SegmentReviewPdfWrapper requires onRevert to handle a revert confirmation.");if(!Vt)throw new Error("There is no valid revert operation for this review.");if(a=Dt?"boundary":"label"===yt.kind?"label":"boundary"===yt.kind?"boundary":null,l=Wt(Vt.type),a&&l!==a)throw new Error("Cannot use ".concat(null!=l?l:"unknown"," revert metadata for this review. Expected ").concat(a,"."));return[2,De(Vt,E(yt))]}})})},onRevertError:function(e){null==Ue||Ue(e,E(yt))},onRevertComplete:function(e){var n,t,i,r,o,a;Zn(function(){return new Set}),"page"!==yt.kind&&(yn(function(){return new Set}),hn(function(){return new Map})),yt.id;var l=null!==(n=Xt.previousSegments[0])&&void 0!==n?n:Xt.currentSegment,u=null==zn?void 0:zn.getBoundingClientRect(),s=null===(t=vt.current)||void 0===t?void 0:t.getBoundingClientRect(),d=Math.min(x,Math.max(220,pt)),c=null!==(i=null==u?void 0:u.left)&&void 0!==i?i:(null!==(r=null==s?void 0:s.right)&&void 0!==r?r:window.innerWidth-d-8)+8,g=Math.max(8,Math.min(c,window.innerWidth-d-8)),v=null==(null==u?void 0:u.bottom)?Math.max(8,null!==(o=null==s?void 0:s.top)&&void 0!==o?o:8):u.bottom+8;Zn(function(){return new Set}),"page"!==yt.kind&&(st.current=null),at(!1),it({title:"Split"===Mt?"Split reverted":"Merged"===Mt?"Merge reverted":"Approval reverted",description:(null===(a=null==e?void 0:e.message)||void 0===a?void 0:a.trim())||null,segment:l,position:{top:v,left:g,width:d}}),ni()}},yt.id):void 0,additionalActions:Tt?i.jsx(h.default,{metadata:Tt.metadata,reviewAction:null!==(ie=yt.segment.review_action)&&void 0!==ie?ie:void 0,startPage:yt.segment.start_page,endPage:yt.segment.end_page,title:Lt,previousSegmentTitle:Et,nextSegmentTitle:Ct,disabled:Xe||!Ke||Yn===yt.id,onConfirm:function(e,n){ai(Tt,e,n)}}):void 0,cognitiveScore:yt.review_step.score,styles:{root:{borderColor:"#16A34A"},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:"#16A34A"}}},onCognitiveClick:At?function(){Wn(!0),null==rn||rn(E(yt))}:void 0,onClose:ni}):"boundary"===yt.kind?i.jsx(l.default,{width:"100%",maxWidth:"100%",totalPages:ge,title:yt.segment.label||yt.segment.title,pageNo:"Page ".concat(yt.pageNumber),content:null!==(re=yt.review_step.question)&&void 0!==re?re:null,revertSummary:Ut,cognitiveScore:yt.review_step.score,metadata:yt.metadata,reviewAction:null!==(oe=yt.segment.review_action)&&void 0!==oe?oe:void 0,previousSegmentTitle:Et,nextSegmentTitle:Ct,manualPrompt:null!=qe?qe:"Set a custom boundary",defaultStartPage:yt.segment.start_page,defaultEndPage:yt.segment.end_page,styles:{root:{borderColor:kt.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:kt.text}}},confirmDisabled:Xe||!Ke||Yn===yt.id,onConfirm:function(e,n,t){t&&l.isBoundaryReviewAction(n.id)&&ai(yt,n.id,t)},onAdjustManually:function(){return null==tn?void 0:tn(E(yt))},onCognitiveClick:At?function(){Wn(!0),null==rn||rn(E(yt))}:void 0,onClose:ni},yt.id):"label"===yt.kind?i.jsx(d.default,{width:"100%",maxWidth:"100%",title:yt.metadata.current_label||yt.segment.label||yt.segment.title,pageNo:"Pages ".concat(yt.segment.start_page,"-").concat(yt.segment.end_page),content:null!==(ae=yt.review_step.question)&&void 0!==ae?ae:null,revertSummary:Ut,cognitiveScore:yt.review_step.score,metadata:yt.metadata,styles:{root:{borderColor:kt.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:kt.text}}},confirmDisabled:Xe||!ze||Yn===yt.id,confirmationBlocked:bt,confirmationWarning:bt?"Please confirm the boundary before confirming the title.":void 0,onActionConfirm:function(e,n){ai(yt,e,n)},onAdjustManually:function(){return null==tn?void 0:tn(E(yt))},onCognitiveClick:At?function(){Wn(!0),null==rn||rn(E(yt))}:void 0,onClose:ni},yt.id):2===(null===(le=yt.metadata.type_choices)||void 0===le?void 0:le.length)?i.jsx(g.default,{width:"100%",maxWidth:"100%",title:yt.segment.label||yt.segment.title,pageNo:"Page ".concat(yt.pageNumber),content:yt.review_step.reason,choices:yt.metadata.type_choices,cognitiveScore:yt.review_step.score,styles:{root:{borderColor:kt.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:kt.text}}},confirmDisabled:Xe||!Ge||Yn===yt.id,onConfirm:function(e){oi(yt,e)},onCognitiveClick:At?function(){Wn(!0),null==rn||rn(E(yt))}:void 0,onClose:ni},yt.id):i.jsx(c.default,{width:"100%",maxWidth:"100%",title:yt.segment.label||yt.segment.title,pageNo:"Page ".concat(yt.pageNumber),content:yt.review_step.reason,cognitiveScore:yt.review_step.score,pageType:yt.metadata.page_type,metadata:yt.metadata,styles:{root:{borderColor:kt.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:kt.text}}},confirmDisabled:Xe||!Ge||Yn===yt.id,onActionConfirm:function(e,n){ai(yt,e,n)},onCognitiveClick:At?function(){Wn(!0),null==rn||rn(E(yt))}:void 0,onClose:ni},yt.id)}))]})),tt&&i.jsx(p.Portal,{children:i.jsx(p.Box,t.__assign({"aria-live":"polite",sx:{position:"fixed",top:tt.position.top,left:tt.position.left,zIndex:1600,width:tt.position.width,maxWidth:"calc(100vw - 16px)",opacity:ot?1:0,transform:ot?"translateY(0)":"translateY(-6px)",transition:"opacity 500ms ease, transform 500ms ease",filter:"drop-shadow(0 12px 24px rgba(15, 23, 42, 0.18))",pointerEvents:ot?"auto":"none"}},{children:i.jsx(w.default,{title:tt.title,description:tt.description,onReview:function(){return ti(tt.segment)}})}))})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n,t=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),o=require("@react-pdf-viewer/core"),a=require("../PdfViewer/PdfViewer.js"),l=require("./BoundaryCard.js"),u=require("./CardWrapper.js"),d=require("./CognitiveIntegrity.js"),s=require("./LabelCheck.js"),g=require("./PageCheck.js"),c=require("./reviewStepAdapters.js"),v=require("lucide-react"),m=require("@mui/material"),p=require("./ReviewedCard.js"),f=require("./ReviewedBoundaryActions.js"),w=require("./RevertCard.js"),_=require("./RevertSuccessCard.js"),h=require("./helper.js"),y=require("./ChartBreakoutCircle.js"),b=260;exports.SegmentPdfSpecialZoomLevel=void 0,(n=exports.SegmentPdfSpecialZoomLevel||(exports.SegmentPdfSpecialZoomLevel={})).ActualSize="ActualSize",n.PageFit="PageFit",n.PageWidth="PageWidth";var S=((e={})[exports.SegmentPdfSpecialZoomLevel.ActualSize]=o.SpecialZoomLevel.ActualSize,e[exports.SegmentPdfSpecialZoomLevel.PageFit]=o.SpecialZoomLevel.PageFit,e[exports.SegmentPdfSpecialZoomLevel.PageWidth]=o.SpecialZoomLevel.PageWidth,e),x=function(e){return{reviewId:e.id,segment:e.segment,pageNumber:e.pageNumber}};exports.default=function(e){var n,R,E,C,P,k,A,M,I,j,B,N,L,T,F,q,K,W,z,G,O,D,V,H,U,Z,X,Y,J,Q,$,ee,ne,te,ie=this,re=e.pdfUrl,oe=e.pdfName,ae=e.segments,le=e.totalPages,ue=e.styles,de=e.pdfViewerProps,se=e.specialZoomLevel,ge=e.showBadges,ce=void 0===ge||ge,ve=e.sortByConfidence,me=void 0===ve?"low":ve,pe=e.filterByConfidence,fe=void 0===pe?"all":pe,we=e.showBadgeNavigation,_e=void 0===we||we,he=e.autoSelectReviewOnPageChange,ye=void 0!==he&&he,be=e.autoAdvanceAfterConfirm,Se=void 0===be||be,xe=e.autoAdvanceScoreBand,Re=e.badgePreloadPages,Ee=void 0===Re?8:Re,Ce=e.badgeOffsetTop,Pe=void 0===Ce?20:Ce,ke=e.badgeOffsetRight,Ae=void 0===ke?68:ke,Me=e.badgeOffsetLeft,Ie=void 0===Me?0:Me,je=e.initialReviewId,Be=e.manualPrompt,Ne=e.heightBuffer,Le=e.onBoundaryAction,Te=e.onLabelAction,Fe=e.onPageAction,qe=e.onPageTypeRevert,Ke=e.onRevert,We=e.onActiveReviewChange,ze=e.onCurrentPageChange,Ge=e.onActionError,Oe=e.disableAllActions,De=void 0!==Oe&&Oe,Ve=e.disablePdfAnnotations,He=void 0!==Ve&&Ve,Ue=e.disablePdfTextLayer,Ze=void 0===Ue||Ue,Xe=e.disableTitleCheckUntilBoundaryCheckCompleted,Ye=void 0!==Xe&&Xe,Je=e.onAdjustManually,Qe=e.onCognitiveClick,$e=e.className,en=e.style,nn=e.viewerStyle,tn=e.railStyle,rn=e.redirectionData,on=e.onBadgeSelected;console.log("LOG: TOTAL PAGE IN PARENT",le);var an=r.useMemo(function(){return c.extractSegmentReviewData(ae)},[ae]),ln=an.boundaryReviews,un=an.labelReviews,dn=an.pageReviews,sn=r.useState(function(){return new Map}),gn=sn[0],cn=sn[1],vn=r.useState(function(){return new Set}),mn=vn[0],pn=vn[1],fn=r.useMemo(function(){var e=new Map,n=1;return ae.forEach(function(t,i){var r=c.getSegmentReviewKey(t,i);e.has(r)||(e.set(r,n),n+=1)}),e},[ae]),wn=r.useMemo(function(){return new Set(un.map(function(e){return c.getSegmentReviewKey(e.segment)}))},[un]),_n=r.useMemo(function(){return h.getPendingMergeImpactedSegmentKeys(ae)},[ae]);r.useEffect(function(){cn(function(e){var n=!1,t=new Map(e);return e.forEach(function(e,i){var r=ae.find(function(e){return c.getSegmentReviewKey(e)===i});r&&!h.hasPolledStructuralAction(r,e)||(t.delete(i),n=!0)}),n?t:e})},[ae]),r.useEffect(function(){pn(function(e){var n=!1,t=new Set(e);return e.forEach(function(e){gn.has(e)||(t.delete(e),n=!0)}),n?t:e})},[gn]);var hn=r.useMemo(function(){return h.getOptimisticMergeImpactedSegmentKeys(ae,gn,mn)},[mn,gn,ae]),yn=r.useRef(null),bn=r.useMemo(function(){return t.__spreadArray(t.__spreadArray(t.__spreadArray([],ln.filter(function(e){return!_n.has(c.getSegmentReviewKey(e.segment))&&!hn.has(c.getSegmentReviewKey(e.segment))&&!h.shouldHideStructuralBoundaryReview(e.review_step,e.segment,wn.has(c.getSegmentReviewKey(e.segment)),gn.get(c.getSegmentReviewKey(e.segment)))}).map(function(e){var n;return t.__assign(t.__assign({},e),{kind:"boundary",pageNumber:null!==(n=e.metadata.focus_page)&&void 0!==n?n:e.segment.start_page})}),!0),un.filter(function(e){return!_n.has(c.getSegmentReviewKey(e.segment))&&!hn.has(c.getSegmentReviewKey(e.segment))}).map(function(e){return t.__assign(t.__assign({},e),{kind:"label",pageNumber:e.segment.start_page})}),!0),dn.filter(function(e){return!_n.has(c.getSegmentReviewKey(e.segment))&&!hn.has(c.getSegmentReviewKey(e.segment))}).map(function(e){var n;return t.__assign(t.__assign({},e),{kind:"page",pageNumber:null!==(n=e.metadata.page_num)&&void 0!==n?n:e.segment.start_page})}),!0).sort(function(e,n){var t,i,r=null!==(t=fn.get(c.getSegmentReviewKey(e.segment)))&&void 0!==t?t:Number.MAX_SAFE_INTEGER,o=null!==(i=fn.get(c.getSegmentReviewKey(n.segment)))&&void 0!==i?i:Number.MAX_SAFE_INTEGER;return e.pageNumber-n.pageNumber||r-o||e.reviewStepIndex-n.reviewStepIndex||e.id.localeCompare(n.id)})},[ln,un,dn,hn,gn,_n,fn,wn]),Sn=r.useMemo(function(){return ae.map(function(e){var n,i;return t.__assign(t.__assign({},e),{title:(null===(n=e.label)||void 0===n?void 0:n.trim())||e.title,page_count:null!==(i=e.page_count)&&void 0!==i?i:e.end_page-e.start_page+1})})},[ae]),xn=r.useState(1),Rn=xn[0],En=xn[1],Cn=r.useState(null!=je?je:null),Pn=Cn[0],kn=Cn[1],An=r.useState(null!=je?je:null),Mn=An[0],In=An[1],jn=r.useState(!1),Bn=jn[0],Nn=jn[1],Ln=r.useState(null),Tn=Ln[0],Fn=Ln[1],qn=r.useState(null),Kn=qn[0],Wn=qn[1],zn=r.useState(function(){return new Set}),Gn=zn[0],On=zn[1],Dn=r.useState(null),Vn=Dn[0],Hn=Dn[1],Un=r.useState(null),Zn=Un[0],Xn=Un[1],Yn=r.useState(null),Jn=Yn[0],Qn=Yn[1],$n=r.useState(!1),et=$n[0],nt=$n[1],tt=r.useRef(0),it=r.useRef(null),rt=r.useRef(null),ot=r.useRef(new Map),at=r.useRef(null),lt=r.useRef(null),ut=r.useRef(null),dt=r.useState(b),st=dt[0],gt=dt[1],ct=null!==(R=null===(n=null==ue?void 0:ue.aside)||void 0===n?void 0:n.width)&&void 0!==R?R:"40%",vt="min(".concat("number"==typeof ct?"".concat(ct,"px"):ct,", ").concat(b,"px, 100%)");r.useEffect(function(){On(function(e){if(0===e.size)return e;var n=new Set(e),t=!1;return bn.forEach(function(e){var i;null!=(null===(i=e.review_step.review)||void 0===i?void 0:i.action)&&n.has(e.id)&&(n.delete(e.id),t=!0)}),t?n:e})},[bn]),r.useEffect(function(){var e=yn.current;if(e&&ce){var n=function(){var n=e.getBoundingClientRect().width;n>0&&gt(n)};n();var t="undefined"==typeof ResizeObserver?null:new ResizeObserver(n);return null==t||t.observe(e),function(){return null==t?void 0:t.disconnect()}}},[ce]);var mt=r.useMemo(function(){var e=new Set;return bn.forEach(function(n){var t;null!=(null===(t=n.review_step.review)||void 0===t?void 0:t.action)&&e.add(n.id)}),e},[bn]),pt=r.useMemo(function(){var e;return null!==(e=bn.find(function(e){return e.id===Pn}))&&void 0!==e?e:null},[Pn,bn]),ft=r.useMemo(function(){return!(!Ye||"label"!==(null==pt?void 0:pt.kind))&&ln.some(function(e){if(c.getSegmentReviewKey(e.segment)!==c.getSegmentReviewKey(pt.segment)||mt.has(e.id))return!1;var n=h.getResolvedScore(e.review_step.score,e.review_step.confidence);return null==n||n<85})},[pt,ln,Ye,mt]),wt=null==pt?-1:ae.findIndex(function(e){return c.getSegmentReviewKey(e)===c.getSegmentReviewKey(pt.segment)}),_t=wt>0?ae[wt-1]:void 0,ht=wt>=0?ae[wt+1]:void 0,yt=(null===(E=null==_t?void 0:_t.label)||void 0===E?void 0:E.trim())||(null==_t?void 0:_t.title),bt=(null===(C=null==ht?void 0:ht.label)||void 0===C?void 0:C.trim())||(null==ht?void 0:ht.title),St=h.getConfidenceColors(null==pt?void 0:pt.review_step.score,null==pt?void 0:pt.review_step.confidence,null===(P=null==pt?void 0:pt.segment.confidence)||void 0===P?void 0:P.awaiting_llm),xt=(null===(k=null==pt?void 0:pt.review_step.reasons)||void 0===k?void 0:k.length)?pt.review_step.reasons:null!==(M=null===(A=null==pt?void 0:pt.segment.confidence)||void 0===A?void 0:A.reasons)&&void 0!==M?M:[],Rt=Boolean(xt.some(function(e){return e.text.trim()&&["evidence","gap"].includes(e.type.trim().toLowerCase())})||(null===(I=null==pt?void 0:pt.review_step.reason)||void 0===I?void 0:I.trim())||(null===(j=null==pt?void 0:pt.review_step.gap)||void 0===j?void 0:j.trim())),Et=null==pt?null:"boundary"===pt.kind?h.getBoundaryReviewActionBadgeLabel(pt.review_step,pt.segment,gn.get(null!==(B=pt.segment.stable_key)&&void 0!==B?B:"")):h.getTitleReviewActionBadgeLabel(pt.review_step,pt.segment,gn.get(null!==(N=pt.segment.stable_key)&&void 0!==N?N:"")),Ct="label"===(null==pt?void 0:pt.kind)?[Et,pt.review_step.human_action_enum,null===(L=pt.review_step.review)||void 0===L?void 0:L.action,null===(T=pt.review_step.human_resolution)||void 0===T?void 0:T.action]:[],Pt="label"===(null==pt?void 0:pt.kind)&&Ct.some(function(e){var n,t=null!==(n=null==e?void 0:e.trim().toUpperCase())&&void 0!==n?n:"";return t.includes("MERGE")||t.includes("SPLIT")}),kt=null!=pt&&bn.some(function(e){return"boundary"===e.kind&&c.getSegmentReviewKey(e.segment)===c.getSegmentReviewKey(pt.segment)}),At=Pt&&!kt,Mt=("boundary"===(null==pt?void 0:pt.kind)||At)&&null!=pt?function(){var e,n,i,r,o,a;if("boundary"===pt.kind)return pt;var l=ln.find(function(e){return c.getSegmentReviewKey(e.segment)===c.getSegmentReviewKey(pt.segment)});return l?t.__assign(t.__assign({},l),{kind:"boundary",pageNumber:null!==(e=l.metadata.focus_page)&&void 0!==e?e:l.segment.start_page}):t.__assign(t.__assign({},pt),{kind:"boundary",pageNumber:null!==(i=null===(n=pt.segment.review_action)||void 0===n?void 0:n.focus_page)&&void 0!==i?i:pt.segment.start_page,metadata:{focus_page:null!==(o=null===(r=pt.segment.review_action)||void 0===r?void 0:r.focus_page)&&void 0!==o?o:null,boundary_margin:null!==(a=pt.segment.boundary_margin)&&void 0!==a?a:null,user_actions:[]}})}():void 0,It=null==pt?"":(null===(F=pt.segment.label)||void 0===F?void 0:F.trim())||pt.segment.title,jt=null==pt?void 0:pt.review_step.revert,Bt=null==pt?void 0:pt.segment.revert,Nt=function(e){return null==e?void 0:e.trim().toLowerCase()},Lt=null==pt||null===(K=t.__spreadArray([],null!==(q=pt.segment.review_steps)&&void 0!==q?q:[],!0).reverse().find(function(e){var n,t,i=null===(n=e.type)||void 0===n?void 0:n.trim().toLowerCase();return("page_boundary"===i||"page boundary review"===i)&&"boundary"===Nt(null===(t=e.revert)||void 0===t?void 0:t.type)}))||void 0===K?void 0:K.revert,Tt=null!==(W=null!=jt?jt:null==pt?void 0:pt.segment.revert)&&void 0!==W?W:Lt,Ft=null==Tt?void 0:Tt.decision.trim().toUpperCase(),qt=null!=Et?Et:(null==Ft?void 0:Ft.includes("SPLIT"))?"Split":(null==Ft?void 0:Ft.includes("MERGE"))?"Merged":null,Kt="label"===(null==pt?void 0:pt.kind)&&"SET_RANGE"===(null===(z=null==Lt?void 0:Lt.decision)||void 0===z?void 0:z.trim().toUpperCase())&&Lt.current_segment_ids.length!==Lt.previous_state.length,Wt="Merged"===Et||"Split"===Et||Kt,zt=null==pt?void 0:Wt?"boundary"===Nt(null==Lt?void 0:Lt.type)?Lt:"boundary"===Nt(null==Bt?void 0:Bt.type)?Bt:"boundary"===Nt(null==jt?void 0:jt.type)?jt:void 0:"label"===pt.kind?"label"===Nt(null==jt?void 0:jt.type)?jt:void 0:"boundary"===pt.kind?"boundary"===Nt(null==jt?void 0:jt.type)?jt:"boundary"===Nt(null==Lt?void 0:Lt.type)?Lt:"boundary"===Nt(null==Bt?void 0:Bt.type)?Bt:void 0:void 0,Gt=Wt&&(null==zt?void 0:zt.operation_id)?ae.flatMap(function(e){var n;return null!==(n=e.review_steps)&&void 0!==n?n:[]}).find(function(e){var n,t,i,r,o,a,l,u=null===(n=e.type)||void 0===n?void 0:n.trim().toLowerCase();return("page_boundary"===u||"page boundary review"===u)&&((null!==(o=null!==(i=null===(t=e.human_resolution)||void 0===t?void 0:t.operation_id)&&void 0!==i?i:null===(r=e.revert)||void 0===r?void 0:r.operation_id)&&void 0!==o?o:e.operation_id)===zt.operation_id&&Boolean(null===(l=null===(a=e.human_resolution)||void 0===a?void 0:a.change_summary)||void 0===l?void 0:l.trim()))}):void 0,Ot=(null===(G=null==zt?void 0:zt.summary)||void 0===G?void 0:G.trim())||null,Dt=Wt?(null===(D=null===(O=null==Gt?void 0:Gt.human_resolution)||void 0===O?void 0:O.change_summary)||void 0===D?void 0:D.trim())||(null===(V=null==zt?void 0:zt.summary)||void 0===V?void 0:V.trim())||"":(null===(Z=null===(U=null===(H=null==pt?void 0:pt.review_step)||void 0===H?void 0:H.human_resolution)||void 0===U?void 0:U.change_summary)||void 0===Z?void 0:Z.trim())||(null===(Y=null===(X=null==pt?void 0:pt.review_step)||void 0===X?void 0:X.summary)||void 0===Y?void 0:Y.trim())||"",Vt=null==pt?null:zt?{currentSegment:{title:It,startPage:pt.segment.start_page,endPage:pt.segment.end_page},previousSegments:zt.previous_state.map(function(e){var n,t;return{title:(null===(n=e.label)||void 0===n?void 0:n.trim())||(null===(t=e.title)||void 0===t?void 0:t.trim())||"Untitled document",startPage:e.start_page,endPage:e.end_page}})}:"Split"===qt?{currentSegment:{title:It,startPage:pt.segment.start_page,endPage:pt.segment.end_page},previousSegments:[{title:"Advice of Award",startPage:1,endPage:25},{title:It,startPage:pt.segment.start_page,endPage:pt.segment.end_page}]}:"Merged"===qt?{currentSegment:{title:It,startPage:pt.segment.start_page,endPage:pt.segment.end_page},previousSegments:[{title:"Advice of Award",startPage:1,endPage:25},{title:"Request for proposal (RFP)",startPage:26,endPage:76}]}:{currentSegment:{title:It,startPage:pt.segment.start_page,endPage:pt.segment.end_page},previousSegments:[]},Ht="page"===(null==pt?void 0:pt.kind)&&null!==(J=pt.metadata.classification_id)&&void 0!==J?J:null,Ut="page"===(null==pt?void 0:pt.kind)?Boolean(qe&&Ht):Boolean((null==zt?void 0:zt.operation_id)&&(null==zt?void 0:zt.type)&&!1!==(null==zt?void 0:zt.revertable));Boolean(Vt&&Ut&&("page"!==(null==pt?void 0:pt.kind)||Ht));var Zt=r.useCallback(function(e,n){tt.current+=1,it.current={requestId:tt.current,pageNumber:e,reviewId:n},Wn({pageNumber:e,requestId:tt.current})},[]),Xt=r.useCallback(function(e){var n,t;!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)&&(null==on||on({reviewId:e.id,segment_id:null!==(t=e.segment.segment_id)&&void 0!==t?t:null,reviewStepIndex:e.reviewStepIndex,kind:e.kind,pageNumber:e.pageNumber,metadata:e.metadata}),Xn(null),Qn(null),kn(e.id),In(e.id),Nn(!1),Fn(null),Zt(e.pageNumber,e.id),null==We||We(e.id,e.segment))},[We,on,Zt]);r.useEffect(function(){if(Jn){var e=requestAnimationFrame(function(){return nt(!0)}),n=window.setTimeout(function(){nt(!1)},3500),t=window.setTimeout(function(){Qn(null)},4e3);return function(){cancelAnimationFrame(e),window.clearTimeout(n),window.clearTimeout(t)}}},[Jn]),r.useEffect(function(){var e,n,t,i;if(rn){if("pageGroup"===rn.type){var r=null!==(e=rn.pages)&&void 0!==e?e:[],o=null!==(n=rn.pageIndex)&&void 0!==n?n:0,a=r[o];if(null==a)return;return Yt(),Xn({pages:r,index:o,label:null!==(t=rn.groupLabel)&&void 0!==t?t:""}),tt.current+=1,void Wn({pageNumber:a,requestId:tt.current})}if(Xn(null),rn.reviewId){var l=bn.find(function(e){return e.id===rn.reviewId&&(!rn.type||e.kind===rn.type)});if(l)return void Xt(l)}if(rn.classificationId){var u=bn.find(function(e){return!("page"!==e.kind||e.metadata.classification_id!==rn.classificationId||rn.segmentId&&e.segment.segment_id!==rn.segmentId||rn.type&&e.kind!==rn.type)});if(u)return void Xt(u)}if(rn.pageNumber&&rn.type){var d=Number(rn.pageNumber);if(Number.isInteger(d)&&!(d<1)){var s=null===(i=rn.pageType)||void 0===i?void 0:i.trim().toLowerCase(),g=bn.find(function(e){var n="page"===e.kind?e.pageNumber:e.segment.start_page,t="page"!==e.kind||!s||e.metadata.page_type===s;return(!rn.segmentId||e.segment.segment_id===rn.segmentId)&&n===d&&e.kind===rn.type&&t});g?Xt(g):"page"===rn.type&&(Yt(),tt.current+=1,Wn({pageNumber:d,requestId:tt.current}))}}}},[rn,Xt,bn]);var Yt=r.useCallback(function(){it.current=null,Nn(!1),kn(null),Fn(null),null==We||We(null,null)},[We]),Jt=r.useCallback(function(e){var n;nt(!1),Qn(null);var t=null!==(n=bn.find(function(n){return!mt.has(n.id)&&"boundary"===n.kind&&n.segment.start_page===e.startPage&&n.segment.end_page===e.endPage}))&&void 0!==n?n:bn.find(function(n){return!mt.has(n.id)&&n.segment.start_page<=e.startPage&&n.segment.end_page>=e.startPage});t?Xt(t):(Yt(),tt.current+=1,Wn({pageNumber:e.startPage,requestId:tt.current}))},[Yt,mt,bn,Xt]),Qt=r.useCallback(function(e,n){var t,i=h.getReviewScoreBand(e.review_step.score),r=null==xe||i===xe,o=Gn.has(e.id)&&h.isReviewStepResolutionCurrent(e.review_step,e.segment);return e.id!==n&&r&&!0!==(null===(t=e.segment.confidence)||void 0===t?void 0:t.awaiting_llm)&&!h.isReviewStepResolved(e.review_step,e.segment)&&!o},[xe,Gn]),$t=r.useCallback(function(e){var n;if(Se){var t=bn.findIndex(function(n){return n.id===e}),i=null!==(n=bn.find(function(n,i){return i>t&&Qt(n,e)}))&&void 0!==n?n:bn.find(function(n){return Qt(n,e)});i?requestAnimationFrame(function(){return Xt(i)}):Yt()}else Yt()},[Se,Yt,Qt,bn,Xt]),ei=r.useCallback(function(e,n,i){return t.__awaiter(ie,void 0,void 0,function(){var r,o,a,u,d,s,g,v,m,p;return t.__generator(this,function(t){switch(t.label){case 0:if(De)return[2];if("boundary"===e.kind&&!Le)return[2];if("label"===e.kind&&!Te)return[2];if("page"===e.kind&&!Fe)return[2];r=x(e),a=i,u=(o=n)===l.BoundaryReviewActionEnum.SET_RANGE?function(){var n=a.startPage,t=a.endPage;if(null==n||null==t)return null;var i=n<e.segment.start_page||t>e.segment.end_page,r=n>e.segment.start_page||t<e.segment.end_page;return i&&!r?n<e.segment.start_page?l.BoundaryReviewActionEnum.MERGE_PREV:l.BoundaryReviewActionEnum.MERGE_NEXT:r?l.BoundaryReviewActionEnum.SPLIT_HERE:null}():o,d="boundary"===e.kind&&null!=Le&&Se&&(u===l.BoundaryReviewActionEnum.SPLIT_HERE||u===l.BoundaryReviewActionEnum.MERGE_NEXT||u===l.BoundaryReviewActionEnum.MERGE_PREV||u===l.BoundaryReviewActionEnum.MERGE_PREVIOUS),s=d?ae.findIndex(function(n){return c.getSegmentReviewKey(n)===c.getSegmentReviewKey(e.segment)}):-1,d&&s>=0&&u&&(rt.current={action:u,originalSegmentIndex:s,segmentSignature:JSON.stringify(ae.map(function(e,n){var t;return{key:c.getSegmentReviewKey(e,n),startPage:e.start_page,endPage:e.end_page,version:null!==(t=e.version)&&void 0!==t?t:null}})),ready:!1}),Hn(e.id),t.label=1;case 1:return t.trys.push([1,8,9,10]),"boundary"!==e.kind?[3,3]:[4,null==Le?void 0:Le(n,i,r)];case 2:return t.sent(),[3,7];case 3:return"label"!==e.kind?[3,5]:[4,null==Te?void 0:Te(n,i,r)];case 4:return t.sent(),[3,7];case 5:return"page"!==e.kind?[3,7]:[4,null==Fe?void 0:Fe(n,i,r)];case 6:t.sent(),t.label=7;case 7:return On(function(n){var t=new Set(n);return t.add(e.id),t}),g="boundary"===e.kind&&(u===l.BoundaryReviewActionEnum.MERGE_NEXT||u===l.BoundaryReviewActionEnum.MERGE_PREV||u===l.BoundaryReviewActionEnum.MERGE_PREVIOUS),("boundary"===e.kind&&u===l.BoundaryReviewActionEnum.SPLIT_HERE||g)&&u&&(v=c.getSegmentReviewKey(e.segment),pn(function(e){var n=new Set(e);return o===l.BoundaryReviewActionEnum.SET_RANGE?n.add(v):n.delete(v),n}),cn(function(e){var n=new Map(e);return n.set(v,u),n})),rt.current?(rt.current.ready=!0,g&&(m=bn.find(function(n){return"label"===n.kind&&c.getSegmentReviewKey(n.segment)===c.getSegmentReviewKey(e.segment)}))&&requestAnimationFrame(function(){return Xt(m)})):$t(e.id),[3,10];case 8:return p=t.sent(),d&&(rt.current=null),null==Ge||Ge(p,r),[3,10];case 9:return Hn(null),[7];case 10:return[2]}})})},[Se,De,Ge,Le,Te,Fe,qe,bn,ae,Xt,$t]);r.useEffect(function(){var e=rt.current;if(null==e?void 0:e.ready){var n=JSON.stringify(ae.map(function(e,n){var t;return{key:c.getSegmentReviewKey(e,n),startPage:e.start_page,endPage:e.end_page,version:null!==(t=e.version)&&void 0!==t?t:null}}));if(n!==e.segmentSignature){var t=e.action===l.BoundaryReviewActionEnum.SPLIT_HERE?e.originalSegmentIndex+1:e.action===l.BoundaryReviewActionEnum.MERGE_PREV||e.action===l.BoundaryReviewActionEnum.MERGE_PREVIOUS?Math.max(0,e.originalSegmentIndex-1):e.originalSegmentIndex,i=new Map(ae.map(function(e,n){return[c.getSegmentReviewKey(e,n),n]})),r=bn.find(function(e){var n=i.get(c.getSegmentReviewKey(e.segment));return null!=n&&n>=t&&Qt(e)});if(!r)return rt.current=null,void Yt();requestAnimationFrame(function(){rt.current=null,Xt(r)})}}},[Yt,Qt,bn,ae,Xt]),r.useEffect(function(){rt.current||Pn&&!bn.some(function(e){return e.id===Pn})&&Yt()},[Pn,Yt,bn]),r.useEffect(function(){if(ye&&!rt.current){var e=bn.find(function(e){return e.pageNumber===Rn});e&&e.id!==Pn&&Xt(e)}},[Pn,ye,Rn,Xt,bn]),r.useEffect(function(){rt.current||Pn&&!bn.some(function(e){var n;return e.id===Pn&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)})&&Yt()},[Pn,Yt,bn]);var ni=r.useMemo(function(){var e=bn.filter(function(e){var n;return!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if("all"===fe)return e;var n=["low","medium","high"].filter(function(e){return e!==me}),i=t.__spreadArray([me],n,!0),r=new Map(i.map(function(e,n){return[e,n]}));return e.map(function(e,n){return{item:e,index:n}}).sort(function(e,n){var t,o,a,l,u=null===(t=e.item.review_step.confidence)||void 0===t?void 0:t.trim().toLowerCase(),d=null===(o=n.item.review_step.confidence)||void 0===o?void 0:o.trim().toLowerCase();return(null==u?i.length:null!==(a=r.get(u))&&void 0!==a?a:i.length)-(null==d?i.length:null!==(l=r.get(d))&&void 0!==l?l:i.length)||e.index-n.index}).map(function(e){return e.item})},[fe,me,bn]),ti=ni.findIndex(function(e){return e.id===Mn}),ii=r.useState(null),ri=ii[0],oi=ii[1],ai=r.useRef(!1),li=r.useCallback(function(e){var n=ni[e];n&&Xt(n)},[ni,Xt]);r.useCallback(function(e){if(!(!Zn||e<0||e>=Zn.pages.length)){var n=Zn.pages[e];null!=n&&(Yt(),Xn(function(n){return null==n?n:t.__assign(t.__assign({},n),{index:e})}),tt.current+=1,Wn({pageNumber:n,requestId:tt.current}))}},[Zn,Yt]),r.useEffect(function(){Mn&&!ni.some(function(e){return e.id===Mn})&&In(null)},[ni,Mn]),r.useEffect(function(){ai.current=!1,oi(ti>=0?String(ti+1):null)},[ti,ni.length]),r.useEffect(function(){if(ai.current&&null!=ri){var e=window.setTimeout(function(){var e=Number(ri.trim()),n=e-1;Number.isInteger(e)&&n>=0&&n<ni.length&&(ai.current=!1,li(n))},300);return function(){return window.clearTimeout(e)}}},[li,ri,ni.length]);var ui=r.useMemo(function(){var e=new Map;bn.forEach(function(n){var t,i=null!==(t=e.get(c.getSegmentReviewKey(n.segment)))&&void 0!==t?t:[];i.push(n),e.set(c.getSegmentReviewKey(n.segment),i)});var n=new Map;return e.forEach(function(e,t){var i,r=null!==(i=fn.get(t))&&void 0!==i?i:1;e.sort(function(e,n){return e.reviewStepIndex-n.reviewStepIndex}).forEach(function(e,t){n.set(e.id,"".concat(r).concat(function(e){for(var n=e+1,t="";n>0;)n-=1,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}(t)))})}),n},[bn,fn]),di=r.useMemo(function(){var e=new Map;bn.forEach(function(n){var t,i=null!==(t=e.get(n.pageNumber))&&void 0!==t?t:[];i.push(n),e.set(n.pageNumber,i)});var n=new Map;return e.forEach(function(e){e.forEach(function(e,t){return n.set(e.id,t)})}),n},[bn]),si=r.useCallback(function(e){return{startPage:Math.max(0,e.startPage-Ee),endPage:Math.min(e.numPages-1,e.endPage+Ee)}},[Ee]),gi=r.useCallback(function(){var e,n=lt.current,t=ut.current;if(n&&t){var i=n.getBoundingClientRect(),r=t.querySelector(".rpv-core__inner-pages"),o=null!==(e=null==r?void 0:r.getBoundingClientRect())&&void 0!==e?e:t.getBoundingClientRect();bn.forEach(function(e){var n,r=ot.current.get(e.id);if(r){var a=t.querySelector('[data-testid="core__page-layer-'.concat(e.pageNumber-1,'"]'));if(a){var l=a.getBoundingClientRect(),u=null!==(n=di.get(e.id))&&void 0!==n?n:0,d=l.top+Pe+40*u,s=d+(r.offsetHeight||32),g=d>=o.top&&s<=o.bottom;r.style.top="".concat(d-i.top,"px"),r.style.visibility=g?"visible":"hidden"}else r.style.visibility="hidden"}});var a=at.current;if(a){var l=null==Zn?void 0:Zn.pages[Zn.index],u=null==l?null:t.querySelector('[data-testid="core__page-layer-'.concat(l-1,'"]'));if(Zn&&u){var d=u.getBoundingClientRect().top+Pe,s=d+(a.offsetHeight||25),g=d>=o.top&&s<=o.bottom;a.style.top="".concat(d-i.top,"px"),a.style.visibility=g?"visible":"hidden"}else a.style.visibility="hidden"}if(Pn&&null==it.current){var c=ot.current.get(Pn);c&&"hidden"!==c.style.visibility&&Fn(function(e){return e===c?e:c})}}},[Zn,Pn,Pe,di,bn]),ci=r.useCallback(function(e){var n=it.current;n&&n.requestId===e.requestId&&n.pageNumber===e.pageNumber&&(it.current=null,gi(),requestAnimationFrame(function(){if(null==it.current){var e=ot.current.get(n.reviewId);e&&"hidden"!==e.style.visibility&&Fn(e)}}))},[gi]);return r.useEffect(function(){var e=ut.current;if(e&&ce){var n=null,t=function(){null==n&&(n=requestAnimationFrame(function(){n=null,gi()}))};e.addEventListener("scroll",t,!0),window.addEventListener("resize",t);var i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});var r="undefined"==typeof ResizeObserver?null:new ResizeObserver(t);return null==r||r.observe(e),t(),function(){null!=n&&cancelAnimationFrame(n),e.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t),i.disconnect(),null==r||r.disconnect()}}},[ce,gi]),i.jsxs("div",t.__assign({ref:lt,className:$e,style:t.__assign(t.__assign({},en),{display:"block",position:"relative",width:"100%",height:"100%",minWidth:0,overflowX:"auto",overflowY:"hidden"})},{children:[i.jsxs("div",t.__assign({className:"segment-review-wrapper__container",style:{display:"flex",alignItems:"stretch",gap:0,width:"100%",minWidth:700,height:"100%"}},{children:[i.jsx("div",t.__assign({ref:ut,style:t.__assign(t.__assign({},nn),{flex:"1 1 auto",width:ce?"auto":"100%",minWidth:0,height:"100%",boxSizing:"border-box"})},{children:i.jsx(a.default,t.__assign({highlightText:[],highlightPages:{},highlightCordinatePages:[],useCoordinates:!1,showRotateButton:!0},de,{defaultScale:void 0===se?null!==(Q=null==de?void 0:de.defaultScale)&&void 0!==Q?Q:o.SpecialZoomLevel.PageFit:S[se],disablePdfAnnotations:He,disablePdfTextLayer:Ze,pdfUrl:re,pdfName:oe,segments:Sn,navigationRequest:Kn,onNavigationSettled:ci,setRenderRange:si,onCurrentPageChange:function(e){En(e),null==it.current&&pt&&pt.pageNumber!==e&&Yt(),null==ze||ze(e)}}))})),ce&&i.jsxs("aside",t.__assign({"aria-label":"Page review badges",ref:yn,style:t.__assign(t.__assign({},tn),{position:"relative",width:vt,maxWidth:b,flex:"0 1 ".concat(vt),minHeight:0,overflow:"hidden",boxSizing:"border-box"})},{children:[Zn&&i.jsx("span",t.__assign({ref:at,style:{position:"absolute",top:0,left:10,visibility:"hidden",zIndex:2,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,minHeight:25,padding:"2px 8px",border:"1px solid #E2E8F0",borderRadius:16,backgroundColor:"#F8FAFC",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)",font:"inherit"}},{children:i.jsxs(m.Typography,t.__assign({fontFamily:"Inter",sx:{fontSize:11,fontWeight:500,color:"#475569",whiteSpace:"nowrap"}},{children:[Zn.label||"Pages"," Pg: ",Zn.index+1]}))})),_e&&ni.length>0&&!Zn&&i.jsxs("nav",t.__assign({"aria-label":"Review badge navigation",style:{position:"absolute",top:8,right:Ae||"auto",left:Ie||"auto",zIndex:2,display:"flex",alignItems:"center",gap:7,width:128,minHeight:40,padding:"4px 6px",border:"1px solid #CBD5E1",borderRadius:6,backgroundColor:"#FFFFFF",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.06)",font:"inherit"}},{children:[i.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:null!=ri?ri:"-","aria-label":"Review badge number",onChange:function(e){ai.current=!0,oi(e.target.value)},style:{width:30,height:28,padding:0,border:"1px solid #A5B4FC",borderRadius:3,color:"#4F46E5",backgroundColor:"#FFFFFF",textAlign:"center",font:"inherit",fontSize:15,outline:"none"}}),i.jsxs("span",t.__assign({"aria-label":"".concat(ni.length," reviews"),style:{flex:1,color:"#4F46E5",fontSize:14,whiteSpace:"nowrap",textAlign:"center"}},{children:["of ",ni.length]})),["previous","next"].map(function(e){var n="previous"===e,r=ti+(n?-1:1),o=r<0||r>=ni.length;return i.jsx("button",t.__assign({type:"button","aria-label":"".concat(n?"Previous":"Next"," review badge"),disabled:o,onClick:function(){return li(r)},style:{display:"grid",placeItems:"center",width:17,height:28,padding:0,border:0,background:"transparent",color:o?"#C7D2FE":"#4F46E5",cursor:o?"default":"pointer"}},{children:i.jsx("svg",t.__assign({width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},{children:i.jsx("path",{d:n?"M1 7L6 2L11 7":"M1 1L6 6L11 1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))}),e)})]})),!Zn&&bn.map(function(e){var n,r,o=Pn===e.id,a=null!==(n=ui.get(e.id))&&void 0!==n?n:"1A",l=e.review_step.score,u=e.review_step.confidence,d=h.formatScore(l,u),s="boundary"===e.kind?h.getBoundaryReviewActionBadgeLabel(e.review_step,e.segment,gn.get(c.getSegmentReviewKey(e.segment))):"label"===e.kind?h.getTitleReviewActionBadgeLabel(e.review_step,e.segment,gn.get(c.getSegmentReviewKey(e.segment))):null,g=null!=s?s:"N/A"===d?d:"".concat(d,"%"),p=!0===(null===(r=e.segment.confidence)||void 0===r?void 0:r.awaiting_llm),f=h.getConfidenceColors(l,u,p),w=mt.has(e.id),_=p;return i.jsx(m.Tooltip,t.__assign({title:p?"data is being processed":"",arrow:!0},{children:i.jsx("span",t.__assign({ref:function(n){n?ot.current.set(e.id,n):ot.current.delete(e.id)},style:{position:"absolute",top:0,left:10,visibility:"hidden",display:"inline-flex",cursor:_?"not-allowed":"pointer"}},{children:i.jsx("button",t.__assign({disabled:_,type:"button","aria-pressed":o,"aria-label":p?"".concat(e.review_step.type," · Page ").concat(e.pageNumber," · Data is being processed"):"".concat(e.review_step.type," · Page ").concat(e.pageNumber),onClick:function(){return Xt(e)},style:{cursor:"inherit",display:"flex",alignItems:"center",justifyContent:"space-around",gap:4,width:s?w&&!p?115:90:w&&!p?105:80,minHeight:25,padding:"2px 5px",border:"1px solid ".concat(w&&!p?"#E2E8F0":f.border),borderRadius:16,backgroundColor:w&&!p?"#F8FAFC":f.background,color:w&&!p?"#475569":f.text,font:"inherit",alignContent:"center",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)"}},{children:w&&!p?i.jsxs(m.Typography,t.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),i.jsxs("span",t.__assign({style:{display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:g}))]})),i.jsxs("span",t.__assign({style:{fontSize:11,fontWeight:500,display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{display:"flex",marginLeft:"7px",alignItems:"center"}},{children:i.jsx(v.CircleCheck,{height:14,width:14,strokeWidth:2,color:"#16A34A"})}))]}))]})):i.jsxs(m.Typography,t.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),i.jsxs("span",t.__assign({style:{display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:f.divider,strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:g}))]}))]}))}))}))}),e.id)})]}))]})),pt&&Tn&&i.jsxs(u.default,t.__assign({anchorElement:Tn,placement:"bottom-start",offset:{top:8},width:Math.min(st,b),maxWidth:b,heightBuffer:null!=Ne?Ne:25},{children:[Bn&&i.jsx(d.default,{width:"100%",maxWidth:"100%",score:pt.review_step.score,reasons:xt,reason:pt.review_step.reason,gap:pt.review_step.gap,onBack:function(){return Nn(!1)},onClose:Yt}),i.jsx("div",t.__assign({style:{display:Bn?"none":"block"}},{children:mt.has(pt.id)?i.jsx(p.default,{width:"100%",maxWidth:"100%",headerName:"page"===pt.kind?"Page format approved":"Split"===Et?"Split approved":"Merged"===Et?"Merge approved":"User approved",headerIcon:"page"===pt.kind?i.jsx(v.Check,{size:18,strokeWidth:2}):"Merged"===Et?i.jsx(v.GitMerge,{size:18,strokeWidth:2}):"Split"===Et?i.jsx(y.default,{width:18,height:18}):i.jsx(v.CircleCheck,{size:18,strokeWidth:2}),title:It,pageNo:"Page ".concat(pt.segment.start_page,"-").concat(pt.segment.end_page),summary:Vt?i.jsx(w.default,{icon:i.jsx(v.CircleCheck,{size:14,strokeWidth:2}),title:It,pageRange:"Page ".concat(pt.segment.start_page,"-").concat(pt.segment.end_page),description:null!=Dt?Dt:null,revertData:Vt,confirmDisabled:"page"===pt.kind?!Ut:null==Ke||!Ut,showDocumentHeader:!1,onRevert:function(){if("page"===pt.kind){if(!qe||!Ht){var e=new Error("SegmentReviewPdfWrapper requires onPageTypeRevert and a classification id to revert a page-type decision.");return null==Ge||Ge(e,x(pt)),Promise.reject(e)}return qe({classification_id:Ht,human_verdict:"No"},x(pt))}if(!Ke)throw new Error("SegmentReviewPdfWrapper requires onRevert to handle a revert confirmation.");if(!zt)throw new Error("There is no valid revert operation for this review.");var n=Wt?"boundary":"label"===pt.kind?"label":"boundary"===pt.kind?"boundary":null,t=Nt(zt.type);if(n&&t!==n)throw new Error("Cannot use ".concat(null!=t?t:"unknown"," revert metadata for this review. Expected ").concat(n,"."));return Ke(zt,x(pt))},onRevertError:function(e){null==Ge||Ge(e,x(pt))},onRevertComplete:function(e){var n,t,i,r,o,a;On(function(){return new Set}),"page"!==pt.kind&&(pn(function(){return new Set}),cn(function(){return new Map})),pt.id;var l=null!==(n=Vt.previousSegments[0])&&void 0!==n?n:Vt.currentSegment,u=null==Tn?void 0:Tn.getBoundingClientRect(),d=null===(t=ut.current)||void 0===t?void 0:t.getBoundingClientRect(),s=Math.min(b,Math.max(220,st)),g=null!==(i=null==u?void 0:u.left)&&void 0!==i?i:(null!==(r=null==d?void 0:d.right)&&void 0!==r?r:window.innerWidth-s-8)+8,c=Math.max(8,Math.min(g,window.innerWidth-s-8)),v=null==(null==u?void 0:u.bottom)?Math.max(8,null!==(o=null==d?void 0:d.top)&&void 0!==o?o:8):u.bottom+8;On(function(){return new Set}),"page"!==pt.kind&&(rt.current=null),nt(!1),Qn({title:"Split"===Et?"Split reverted":"Merged"===Et?"Merge reverted":"Approval reverted",description:(null===(a=null==e?void 0:e.message)||void 0===a?void 0:a.trim())||("Split"===Et?"Pages ".concat(pt.segment.start_page,"-").concat(pt.segment.end_page," are now part of “Advice of Award” again. Review the boundary and title to confirm the document."):"Merged"===Et?"The documents have been separated again. Review their boundaries and titles to confirm them.":"“".concat(It,"” is pending review again. Review the boundary and title to confirm the document.")),segment:l,position:{top:v,left:c,width:s}}),Yt()}},pt.id):void 0,additionalActions:Mt?i.jsx(f.default,{metadata:Mt.metadata,reviewAction:null!==($=pt.segment.review_action)&&void 0!==$?$:void 0,startPage:pt.segment.start_page,endPage:pt.segment.end_page,title:It,previousSegmentTitle:yt,nextSegmentTitle:bt,disabled:De||!Le||Vn===pt.id,onConfirm:function(e,n){ei(Mt,e,n)}}):void 0,cognitiveScore:pt.review_step.score,styles:{root:{borderColor:"#16A34A"},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:"#16A34A"}}},onCognitiveClick:Rt?function(){Nn(!0),null==Qe||Qe(x(pt))}:void 0,onClose:Yt}):"boundary"===pt.kind?i.jsx(l.default,{width:"100%",maxWidth:"100%",totalPages:le,title:pt.segment.label||pt.segment.title,pageNo:"Page ".concat(pt.pageNumber),content:null!==(ee=pt.review_step.question)&&void 0!==ee?ee:null,revertSummary:Ot,cognitiveScore:pt.review_step.score,metadata:pt.metadata,reviewAction:null!==(ne=pt.segment.review_action)&&void 0!==ne?ne:void 0,previousSegmentTitle:yt,nextSegmentTitle:bt,manualPrompt:null!=Be?Be:"Set a custom boundary",defaultStartPage:pt.segment.start_page,defaultEndPage:pt.segment.end_page,styles:{root:{borderColor:St.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:St.text}}},confirmDisabled:De||!Le||Vn===pt.id,onConfirm:function(e,n,t){t&&l.isBoundaryReviewAction(n.id)&&ei(pt,n.id,t)},onAdjustManually:function(){return null==Je?void 0:Je(x(pt))},onCognitiveClick:Rt?function(){Nn(!0),null==Qe||Qe(x(pt))}:void 0,onClose:Yt},pt.id):"label"===pt.kind?i.jsx(s.default,{width:"100%",maxWidth:"100%",title:pt.metadata.current_label||pt.segment.label||pt.segment.title,pageNo:"Pages ".concat(pt.segment.start_page,"-").concat(pt.segment.end_page),content:null!==(te=pt.review_step.question)&&void 0!==te?te:null,revertSummary:Ot,cognitiveScore:pt.review_step.score,metadata:pt.metadata,styles:{root:{borderColor:St.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:St.text}}},confirmDisabled:De||!Te||Vn===pt.id,confirmationBlocked:ft,confirmationWarning:ft?"Please confirm the boundary before confirming the title.":void 0,onActionConfirm:function(e,n){ei(pt,e,n)},onAdjustManually:function(){return null==Je?void 0:Je(x(pt))},onCognitiveClick:Rt?function(){Nn(!0),null==Qe||Qe(x(pt))}:void 0,onClose:Yt},pt.id):i.jsx(g.default,{width:"100%",maxWidth:"100%",title:pt.segment.label||pt.segment.title,pageNo:"Page ".concat(pt.pageNumber),content:pt.review_step.reason,cognitiveScore:pt.review_step.score,pageType:pt.metadata.page_type,metadata:pt.metadata,styles:{root:{borderColor:St.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:St.text}}},confirmDisabled:De||!Fe||Vn===pt.id,onActionConfirm:function(e,n){ei(pt,e,n)},onCognitiveClick:Rt?function(){Nn(!0),null==Qe||Qe(x(pt))}:void 0,onClose:Yt},pt.id)}))]})),Jn&&i.jsx(m.Portal,{children:i.jsx(m.Box,t.__assign({"aria-live":"polite",sx:{position:"fixed",top:Jn.position.top,left:Jn.position.left,zIndex:1600,width:Jn.position.width,maxWidth:"calc(100vw - 16px)",opacity:et?1:0,transform:et?"translateY(0)":"translateY(-6px)",transition:"opacity 500ms ease, transform 500ms ease",filter:"drop-shadow(0 12px 24px rgba(15, 23, 42, 0.18))",pointerEvents:et?"auto":"none"}},{children:i.jsx(_.default,{title:Jn.title,description:Jn.description,onReview:function(){return Jt(Jn.segment)}})}))})]}))};
2
2
  //# sourceMappingURL=SegmentReviewPdfWrapper.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("./reviewStepAdapters.js"),n=require("./reviewScore.js"),t=function(e){switch(null==e?void 0:e.trim().toLowerCase()){case"low":return 40;case"medium":return 70;case"high":return 95;default:return null}},i=function(e,r){var i;return null!==(i=n.getNumericScore(e))&&void 0!==i?i:t(r)},u=function(e){switch(null==e?void 0:e.trim().toUpperCase()){case"SPLIT":case"SPLIT_HERE":return"Split";case"MERGE":case"MERGE_NEXT":case"MERGE_PREV":case"MERGE_PREVIOUS":return"Merged";default:return null}},o=function(e){var r,n,t,i;if(![e.human_action_enum,null===(r=e.human_resolution)||void 0===r?void 0:r.action,null===(n=e.review)||void 0===n?void 0:n.action].some(function(e){return"SET_RANGE"===(null==e?void 0:e.trim().toUpperCase())}))return null;var u=null===(t=e.human_resolution)||void 0===t?void 0:t.before,o=null===(i=e.human_resolution)||void 0===i?void 0:i.after;if(null==(null==u?void 0:u.start_page)||null==u.end_page||null==(null==o?void 0:o.start_page)||null==o.end_page)return null;var l=o.start_page<u.start_page||o.end_page>u.end_page,a=o.start_page>u.start_page||o.end_page<u.end_page;if(l&&!a)return"Merged";if(a&&!l)return"Split";var d=u.end_page-u.start_page+1,v=o.end_page-o.start_page+1;return v>d?"Merged":v<d?"Split":null},l=function(e){switch(null==e?void 0:e.trim().toUpperCase()){case"SPLIT":case"SPLIT_HERE":return"SPLIT_HERE";case"MERGE_NEXT":return"MERGE_NEXT";case"MERGE_PREV":case"MERGE_PREVIOUS":return"MERGE_PREV";case"SET_RANGE":return"SET_RANGE";default:return null}},a=function(e){var r,n=null===(r=e.type)||void 0===r?void 0:r.trim().toLowerCase();return"page_boundary"===n||"page boundary review"===n},d=function(r){var n,t,i,o=(null!==(n=r.review_steps)&&void 0!==n?n:[]).filter(a);return null!==(i=null!==(t=e.__spreadArray([],o,!0).reverse().find(function(e){return null!=u(e.human_action_enum)}))&&void 0!==t?t:e.__spreadArray([],o,!0).reverse().find(_))&&void 0!==i?i:o[o.length-1]},v=function(e){var r,n,t,i,l;return null!==(i=null!==(n=null!==(r=o(e))&&void 0!==r?r:u(e.human_action_enum))&&void 0!==n?n:u(null===(t=e.human_resolution)||void 0===t?void 0:t.action))&&void 0!==i?i:u(null===(l=e.review)||void 0===l?void 0:l.action)},s=function(e,r){var n,t=e.type.trim().toLowerCase();if(!("label"===t||"label review"===t))return!0;var i=null===(n=e.human_resolution)||void 0===n?void 0:n.segment_version,u=r.version;return null==i||null==u||i===u},_=function(e){var r,n,t,i;return null!=u(e.human_action_enum)||null!=u(null===(r=e.human_resolution)||void 0===r?void 0:r.action)||null!=u(null===(n=e.review)||void 0===n?void 0:n.action)||!0===(null===(i=null===(t=e.metadata)||void 0===t?void 0:t.performed_actions)||void 0===i?void 0:i.some(function(e){return null!=u(e.action)}))},c=function(r){var n,t,i,a,v,s,_=d(r);if(!_)return null;var c=l(null===(n=_.human_resolution)||void 0===n?void 0:n.action),p=null===(t=_.human_resolution)||void 0===t?void 0:t.after,g=(null==p?void 0:p.start_page)===r.start_page&&(null==p?void 0:p.end_page)===r.end_page,f=o(_);if(f)return g?f:null;if("SPLIT_HERE"===c)return g?null:"Split";if("MERGE_NEXT"===c||"MERGE_PREV"===c)return g?"Merged":null;var E=function(e,r){var n,t,i,u=e.revert,o=r.revert,l="boundary"===(null===(n=null==u?void 0:u.type)||void 0===n?void 0:n.trim().toLowerCase())?u:"boundary"===(null===(t=null==o?void 0:o.type)||void 0===t?void 0:t.trim().toLowerCase())?o:null;if(!l)return null;var a=null===(i=l.decision)||void 0===i?void 0:i.trim().toUpperCase();if(null==a?void 0:a.includes("SPLIT"))return"Split";if(null==a?void 0:a.includes("MERGE"))return"Merged";if("SET_RANGE"===a){if(l.current_segment_ids.length>l.previous_state.length)return"Split";if(l.current_segment_ids.length<l.previous_state.length)return"Merged"}return null}(_,r);if(E)return E;var m=u(_.human_action_enum);if(m)return m;var S=u(null===(i=_.review)||void 0===i?void 0:i.action);if(S)return S;var R=e.__spreadArray([],null!==(a=r.human_action_log)&&void 0!==a?a:[],!0).filter(function(e){return null!=u(e.action)}).sort(function(e,r){var n,t;return r.human_revision-e.human_revision||(null===(n=r.performed_at)||void 0===n?void 0:n.localeCompare(null!==(t=e.performed_at)&&void 0!==t?t:""))})[0];if(!R)return null;var h=u(R.action),w=(null===(v=R.after)||void 0===v?void 0:v.start_page)===r.start_page&&(null===(s=R.after)||void 0===s?void 0:s.end_page)===r.end_page;return"Split"===h?w?null:h:w?h:null},p=function(e,r){return null!=u(r)||null!=c(e)},g=function(e,r){var n,t,i,o,a,v,s=l(r),_=d(e),p=null!==(i=null!==(n=l(null==_?void 0:_.human_action_enum))&&void 0!==n?n:l(null===(t=null==_?void 0:_.human_resolution)||void 0===t?void 0:t.action))&&void 0!==i?i:l(null===(o=null==_?void 0:_.review)||void 0===o?void 0:o.action),g=u(r),f=null===(a=null==_?void 0:_.human_resolution)||void 0===a?void 0:a.after,E="SPLIT_HERE"===s&&null!=(null===(v=null==_?void 0:_.human_resolution)||void 0===v?void 0:v.action)&&(null==f?void 0:f.start_page)===e.start_page&&(null==f?void 0:f.end_page)===e.end_page;return null!=s&&p===s&&null!=g&&(E||c(e)===g)};exports.getNumericScore=n.getNumericScore,exports.getReviewScoreBand=n.getReviewScoreBand,exports.formatScore=function(e,r){var n=i(e,r);return null==n?"N/A":Number.isInteger(n)?String(n):n.toFixed(2).replace(/\.?0+$/,"")},exports.getBoundaryReviewActionBadgeLabel=function(e,r,n){var t,i;return null!==(i=null!==(t=u(n))&&void 0!==t?t:v(e))&&void 0!==i?i:c(r)},exports.getConfidenceColors=function(e,r,t){var i={border:"#E5E7EB",cardBorder:"#374151",background:"#F9FAFB",text:"#374151",divider:"#D1D5DB"};if(t)return i;switch(n.getReviewScoreBand(e)){case"low":return{border:"#FECACA",cardBorder:"#B91C1C",background:"#FEF2F2",text:"#B91C1C",divider:"#FCA5A5"};case"medium":return{border:"#d9cda2",cardBorder:"#997800",background:"#fff1bf",text:"#997800",divider:"#e6b400"};case"high":return{border:"#16A34A",cardBorder:"#4F9E6C",background:"#F0FDF4",text:"#4F9E6C",divider:"#00A43C"}}return i},exports.getFallbackScore=t,exports.getHumanActionBadgeLabel=u,exports.getOptimisticMergeImpactedSegmentKeys=function(n,t,i){void 0===i&&(i=new Set);var u=e.__spreadArray([],n,!0).sort(function(e,r){return e.start_page-r.start_page||e.end_page-r.end_page}),o=new Set;return t.forEach(function(e,n){if(!i.has(n)){var a=u.findIndex(function(e){return r.getSegmentReviewKey(e)===n});if(!(a<0)){var d=u[a];if(!g(d,e)){var v=l(e),s=u["MERGE_PREV"===v?a-1:"MERGE_NEXT"===v?a+1:-1];if(s){var _=r.getSegmentReviewKey(s);p(s,t.get(_))||o.add(_)}}}}}),o},exports.getPendingMergeImpactedSegmentKeys=function(n){var t=e.__spreadArray([],n,!0).sort(function(e,r){return e.start_page-r.start_page||e.end_page-r.end_page}),i=new Set;return t.forEach(function(e,n){var u,o=(null!==(u=e.review_steps)&&void 0!==u?u:[]).find(function(r){var n,t,i;if(!a(r))return!1;var u=l(r.human_action_enum),o=l(null===(n=r.human_resolution)||void 0===n?void 0:n.action),d=null===(t=r.human_resolution)||void 0===t?void 0:t.before,v=null===(i=r.human_resolution)||void 0===i?void 0:i.after,s=null!=(null==d?void 0:d.start_page)&&null!=d.end_page&&null!=(null==v?void 0:v.start_page)&&null!=v.end_page&&(d.start_page!==v.start_page||d.end_page!==v.end_page),_=(null==v?void 0:v.start_page)===e.start_page&&(null==v?void 0:v.end_page)===e.end_page;return("MERGE_NEXT"===u||"MERGE_PREV"===u)&&!(o===u&&s&&_)});if(o){var d=l(o.human_action_enum),v=t["MERGE_PREV"===d?n-1:n+1];v&&!p(v)&&i.add(r.getSegmentReviewKey(v))}}),i},exports.getResolvedScore=i,exports.getReviewStepActionBadgeLabel=v,exports.getStructuralResultBadgeLabel=c,exports.getTitleReviewActionBadgeLabel=function(e,r,n){var t=u(n);if(t)return t;var i=v(e);return i||c(r)},exports.hasPolledStructuralAction=g,exports.hasStructuralBoundaryAction=_,exports.isReviewStepResolutionCurrent=s,exports.isReviewStepResolved=function(e,r){var n,t,i;if(!s(e,r))return!1;if(null!=(null===(n=e.review)||void 0===n?void 0:n.action))return!0;var u=null===(i=null===(t=e.human_resolution)||void 0===t?void 0:t.state)||void 0===i?void 0:i.trim().toLowerCase();return"resolved_by_human"===u||"approved"===u||"confirmed"===u},exports.shouldHideStructuralBoundaryReview=function(e,r,n,t){var i=u(t);if("Merged"===i)return n;if("Split"===i)return!0;if(function(e,r){var n,t,i;if("affected"!==(null===(n=r.sensitivity)||void 0===n?void 0:n.trim().toLowerCase()))return!1;var u=null!==(t=e.revert)&&void 0!==t?t:r.revert;if(!u)return!1;var o=null===(i=u.decision)||void 0===i?void 0:i.trim().toUpperCase();return u.current_segment_ids.length>u.previous_state.length&&("SET_RANGE"===o||"SPLIT"===o||"SPLIT_HERE"===o)}(e,r))return!0;var o=v(e);if("Split"===o)return!0;var l=c(r);return"Split"===l||"Merged"===o&&("Merged"!==l||n)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("./reviewStepAdapters.js"),n=function(e){if(null==e)return null;if("number"==typeof e)return Number.isFinite(e)?e:null;var r=e.trim();if(!r)return null;var n=Number.parseFloat(r);return Number.isFinite(n)?n:null},t=function(e){switch(null==e?void 0:e.trim().toLowerCase()){case"low":return 40;case"medium":return 70;case"high":return 95;default:return null}},i=function(e,r){var i;return null!==(i=n(e))&&void 0!==i?i:t(r)},u=function(e){var r=n(e);return null==r?null:r<=40?"low":r<=70?"medium":"high"},o=function(e){switch(null==e?void 0:e.trim().toUpperCase()){case"SPLIT":case"SPLIT_HERE":return"Split";case"MERGE":case"MERGE_NEXT":case"MERGE_PREV":case"MERGE_PREVIOUS":return"Merged";default:return null}},l=function(e){var r,n,t,i;if(![e.human_action_enum,null===(r=e.human_resolution)||void 0===r?void 0:r.action,null===(n=e.review)||void 0===n?void 0:n.action].some(function(e){return"SET_RANGE"===(null==e?void 0:e.trim().toUpperCase())}))return null;var u=null===(t=e.human_resolution)||void 0===t?void 0:t.before,o=null===(i=e.human_resolution)||void 0===i?void 0:i.after;if(null==(null==u?void 0:u.start_page)||null==u.end_page||null==(null==o?void 0:o.start_page)||null==o.end_page)return null;var l=o.start_page<u.start_page||o.end_page>u.end_page,a=o.start_page>u.start_page||o.end_page<u.end_page;if(l&&!a)return"Merged";if(a&&!l)return"Split";var d=u.end_page-u.start_page+1,v=o.end_page-o.start_page+1;return v>d?"Merged":v<d?"Split":null},a=function(e){switch(null==e?void 0:e.trim().toUpperCase()){case"SPLIT":case"SPLIT_HERE":return"SPLIT_HERE";case"MERGE_NEXT":return"MERGE_NEXT";case"MERGE_PREV":case"MERGE_PREVIOUS":return"MERGE_PREV";case"SET_RANGE":return"SET_RANGE";default:return null}},d=function(e){var r,n=null===(r=e.type)||void 0===r?void 0:r.trim().toLowerCase();return"page_boundary"===n||"page boundary review"===n},v=function(r){var n,t,i,u=(null!==(n=r.review_steps)&&void 0!==n?n:[]).filter(d);return null!==(i=null!==(t=e.__spreadArray([],u,!0).reverse().find(function(e){return null!=o(e.human_action_enum)}))&&void 0!==t?t:e.__spreadArray([],u,!0).reverse().find(c))&&void 0!==i?i:u[u.length-1]},s=function(e){var r,n,t,i,u;return null!==(i=null!==(n=null!==(r=l(e))&&void 0!==r?r:o(e.human_action_enum))&&void 0!==n?n:o(null===(t=e.human_resolution)||void 0===t?void 0:t.action))&&void 0!==i?i:o(null===(u=e.review)||void 0===u?void 0:u.action)},_=function(e,r){var n,t=e.type.trim().toLowerCase();if(!("label"===t||"label review"===t))return!0;var i=null===(n=e.human_resolution)||void 0===n?void 0:n.segment_version,u=r.version;return null==i||null==u||i===u},c=function(e){var r,n,t,i;return null!=o(e.human_action_enum)||null!=o(null===(r=e.human_resolution)||void 0===r?void 0:r.action)||null!=o(null===(n=e.review)||void 0===n?void 0:n.action)||!0===(null===(i=null===(t=e.metadata)||void 0===t?void 0:t.performed_actions)||void 0===i?void 0:i.some(function(e){return null!=o(e.action)}))},p=function(r){var n,t,i,u,d,s,_=v(r);if(!_)return null;var c=a(null===(n=_.human_resolution)||void 0===n?void 0:n.action),p=null===(t=_.human_resolution)||void 0===t?void 0:t.after,g=(null==p?void 0:p.start_page)===r.start_page&&(null==p?void 0:p.end_page)===r.end_page,f=l(_);if(f)return g?f:null;if("SPLIT_HERE"===c)return g?null:"Split";if("MERGE_NEXT"===c||"MERGE_PREV"===c)return g?"Merged":null;var m=function(e,r){var n,t,i,u=e.revert,o=r.revert,l="boundary"===(null===(n=null==u?void 0:u.type)||void 0===n?void 0:n.trim().toLowerCase())?u:"boundary"===(null===(t=null==o?void 0:o.type)||void 0===t?void 0:t.trim().toLowerCase())?o:null;if(!l)return null;var a=null===(i=l.decision)||void 0===i?void 0:i.trim().toUpperCase();if(null==a?void 0:a.includes("SPLIT"))return"Split";if(null==a?void 0:a.includes("MERGE"))return"Merged";if("SET_RANGE"===a){if(l.current_segment_ids.length>l.previous_state.length)return"Split";if(l.current_segment_ids.length<l.previous_state.length)return"Merged"}return null}(_,r);if(m)return m;var E=o(_.human_action_enum);if(E)return E;var R=o(null===(i=_.review)||void 0===i?void 0:i.action);if(R)return R;var h=e.__spreadArray([],null!==(u=r.human_action_log)&&void 0!==u?u:[],!0).filter(function(e){return null!=o(e.action)}).sort(function(e,r){var n,t;return r.human_revision-e.human_revision||(null===(n=r.performed_at)||void 0===n?void 0:n.localeCompare(null!==(t=e.performed_at)&&void 0!==t?t:""))})[0];if(!h)return null;var S=o(h.action),w=(null===(d=h.after)||void 0===d?void 0:d.start_page)===r.start_page&&(null===(s=h.after)||void 0===s?void 0:s.end_page)===r.end_page;return"Split"===S?w?null:S:w?S:null},g=function(e,r){return null!=o(r)||null!=p(e)},f=function(e,r){var n,t,i,u,l,d,s=a(r),_=v(e),c=null!==(i=null!==(n=a(null==_?void 0:_.human_action_enum))&&void 0!==n?n:a(null===(t=null==_?void 0:_.human_resolution)||void 0===t?void 0:t.action))&&void 0!==i?i:a(null===(u=null==_?void 0:_.review)||void 0===u?void 0:u.action),g=o(r),f=null===(l=null==_?void 0:_.human_resolution)||void 0===l?void 0:l.after,m="SPLIT_HERE"===s&&null!=(null===(d=null==_?void 0:_.human_resolution)||void 0===d?void 0:d.action)&&(null==f?void 0:f.start_page)===e.start_page&&(null==f?void 0:f.end_page)===e.end_page;return null!=s&&c===s&&null!=g&&(m||p(e)===g)};exports.formatScore=function(e,r){var n=i(e,r);return null==n?"N/A":Number.isInteger(n)?String(n):n.toFixed(2).replace(/\.?0+$/,"")},exports.getBoundaryReviewActionBadgeLabel=function(e,r,n){var t,i;return null!==(i=null!==(t=o(n))&&void 0!==t?t:s(e))&&void 0!==i?i:p(r)},exports.getConfidenceColors=function(e,r,n){var t={border:"#E5E7EB",cardBorder:"#374151",background:"#F9FAFB",text:"#374151",divider:"#D1D5DB"};if(n)return t;switch(u(e)){case"low":return{border:"#FECACA",cardBorder:"#B91C1C",background:"#FEF2F2",text:"#B91C1C",divider:"#FCA5A5"};case"medium":return{border:"#d9cda2",cardBorder:"#997800",background:"#fff1bf",text:"#997800",divider:"#e6b400"};case"high":return{border:"#16A34A",cardBorder:"#4F9E6C",background:"#F0FDF4",text:"#4F9E6C",divider:"#00A43C"}}return t},exports.getFallbackScore=t,exports.getHumanActionBadgeLabel=o,exports.getNumericScore=n,exports.getOptimisticMergeImpactedSegmentKeys=function(n,t,i){void 0===i&&(i=new Set);var u=e.__spreadArray([],n,!0).sort(function(e,r){return e.start_page-r.start_page||e.end_page-r.end_page}),o=new Set;return t.forEach(function(e,n){if(!i.has(n)){var l=u.findIndex(function(e){return r.getSegmentReviewKey(e)===n});if(!(l<0)){var d=u[l];if(!f(d,e)){var v=a(e),s=u["MERGE_PREV"===v?l-1:"MERGE_NEXT"===v?l+1:-1];if(s){var _=r.getSegmentReviewKey(s);g(s,t.get(_))||o.add(_)}}}}}),o},exports.getPendingMergeImpactedSegmentKeys=function(n){var t=e.__spreadArray([],n,!0).sort(function(e,r){return e.start_page-r.start_page||e.end_page-r.end_page}),i=new Set;return t.forEach(function(e,n){var u,o=(null!==(u=e.review_steps)&&void 0!==u?u:[]).find(function(r){var n,t,i;if(!d(r))return!1;var u=a(r.human_action_enum),o=a(null===(n=r.human_resolution)||void 0===n?void 0:n.action),l=null===(t=r.human_resolution)||void 0===t?void 0:t.before,v=null===(i=r.human_resolution)||void 0===i?void 0:i.after,s=null!=(null==l?void 0:l.start_page)&&null!=l.end_page&&null!=(null==v?void 0:v.start_page)&&null!=v.end_page&&(l.start_page!==v.start_page||l.end_page!==v.end_page),_=(null==v?void 0:v.start_page)===e.start_page&&(null==v?void 0:v.end_page)===e.end_page;return("MERGE_NEXT"===u||"MERGE_PREV"===u)&&!(o===u&&s&&_)});if(o){var l=a(o.human_action_enum),v=t["MERGE_PREV"===l?n-1:n+1];v&&!g(v)&&i.add(r.getSegmentReviewKey(v))}}),i},exports.getResolvedScore=i,exports.getReviewScoreBand=u,exports.getReviewStepActionBadgeLabel=s,exports.getStructuralResultBadgeLabel=p,exports.getTitleReviewActionBadgeLabel=function(e,r,n){var t=o(n);if(t)return t;var i=s(e);return i||p(r)},exports.hasPolledStructuralAction=f,exports.hasStructuralBoundaryAction=c,exports.isReviewStepResolutionCurrent=_,exports.isReviewStepResolved=function(e,r){var n,t,i;if(!_(e,r))return!1;if(null!=(null===(n=e.review)||void 0===n?void 0:n.action))return!0;var u=null===(i=null===(t=e.human_resolution)||void 0===t?void 0:t.state)||void 0===i?void 0:i.trim().toLowerCase();return"resolved_by_human"===u||"approved"===u||"confirmed"===u},exports.shouldHideStructuralBoundaryReview=function(e,r,n,t){var i=o(t);if("Merged"===i)return n;if("Split"===i)return!0;if(function(e,r){var n,t,i;if("affected"!==(null===(n=r.sensitivity)||void 0===n?void 0:n.trim().toLowerCase()))return!1;var u=null!==(t=e.revert)&&void 0!==t?t:r.revert;if(!u)return!1;var o=null===(i=u.decision)||void 0===i?void 0:i.trim().toUpperCase();return u.current_segment_ids.length>u.previous_state.length&&("SET_RANGE"===o||"SPLIT"===o||"SPLIT_HERE"===o)}(e,r))return!0;var u=s(e);if("Split"===u)return!0;var l=p(r);return"Split"===l||"Merged"===u&&("Merged"!==l||n)};
2
2
  //# sourceMappingURL=helper.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("./BoundaryCard.js"),n=require("./LabelCheck.js"),a=require("./PageCheck.js"),t=function(e){return"object"==typeof e&&null!==e?e:{}},o=function(e){return"string"==typeof e?e:null},l=function(e){return"number"==typeof e&&Number.isFinite(e)?e:null},c=function(e){return Array.isArray(e)?e.filter(function(e){return"string"==typeof e}):[]},r=function(e){var i="string"==typeof e?e.trim().toLowerCase():"";return"table"===i||"drawing"===i?i:null},d=function(e,i){return void 0===i&&(i=0),e.stable_key||e.segment_id||"".concat(e.start_page,"-").concat(e.end_page,"-").concat(i)},u=function(e){var i=t(e);return{current_label:o(i.current_label),custom_label:o(i.custom_label),group_id:o(i.group_id),user_actions:c(i.user_actions).filter(n.isLabelReviewAction)}},s=function(e){var i=t(e),n=Array.isArray(i.type_choices)?i.type_choices.flatMap(function(e){var i,n=t(e),a=r(n.page_type),l=null===(i=o(n.classification_id))||void 0===i?void 0:i.trim();return a&&l?[{page_type:a,classification_id:l}]:[]}):[];return{page_type:r(i.page_type),page_num:l(i.page_num),classification_id:o(i.classification_id),type_choices:n.length>1?n:void 0,user_actions:c(i.user_actions).filter(a.isPageCheckAction)}},v=function(e){var i,n,t=null===(n=null===(i=e.human_action)||void 0===i?void 0:i.verdict)||void 0===n?void 0:n.trim().toUpperCase();return t&&a.isPageCheckAction(t)?t:null};exports.extractSegmentReviewData=function(n){var o=[],_=[],p=[];return n.forEach(function(n,g){var f,m,h=d(n,g),y=null!==(f=n.review_steps)&&void 0!==f?f:[];y.forEach(function(e,a){var r,d,v=(r=e.type,"page_boundary"===(d=r.trim().toLowerCase())||"page boundary review"===d?"boundary":"label"===d||"label review"===d?"label":"page"===d?"page":null);if("boundary"===v){var g=function(e){var n=t(e);return{focus_page:l(n.focus_page),boundary_margin:l(n.boundary_margin),user_actions:c(n.user_actions).filter(i.isBoundaryReviewAction)}}(e.metadata);o.push({id:"".concat(h,":boundary:").concat(a),reviewStepIndex:a,segment:n,review_step:e,metadata:g})}"label"===v&&_.push({id:"".concat(h,":label:").concat(a),reviewStepIndex:a,segment:n,review_step:e,metadata:u(e.metadata)}),"page"===v&&p.push({id:"".concat(h,":page:").concat(a),reviewStepIndex:a,segment:n,review_step:e,metadata:s(e.metadata)})});var w=0;null===(m=n.page_classifications)||void 0===m||m.forEach(function(i,t){var o,l,c=null!==(o=i.page_num)&&void 0!==o?o:null,d=null!==(l=i.questions)&&void 0!==l?l:[],u=d.filter(function(e){return"table"===r(e.page_type)&&"string"==typeof e.id&&e.id.trim().length>0}),_=d.filter(function(e){return"drawing"===r(e.page_type)&&"string"==typeof e.id&&e.id.trim().length>0});if(2===d.length&&1===u.length&&1===_.length){var g=u[0],f=_[0],m=function(i,n,t,o){var l,c,r,d,u,s,_,p,g,f,m,h,y,w,b,A,C,E,k,P,S,x,R,I,Y,j,q,L,N,O=v(n),B=v(t),M=null!=O&&null!=B,T=e.__spreadArray(e.__spreadArray([],O===a.PageCheckActionEnum.YES?["table"]:[],!0),B===a.PageCheckActionEnum.YES?["drawing"]:[],!0),U=1===T.length?T[0]:null,D="drawing"===T[0]?t:n;return{type:"page",confirmed:M,title:"Page Type Check",summary:(null===(l=i.summary)||void 0===l?void 0:l.trim())||void 0,format:"pdf",confidence:null!==(_=null!==(u=null!==(r=null===(c=i.machine_classification)||void 0===c?void 0:c.confidence)&&void 0!==r?r:null===(d=n.machine_classification)||void 0===d?void 0:d.confidence)&&void 0!==u?u:null===(s=t.machine_classification)||void 0===s?void 0:s.confidence)&&void 0!==_?_:null,decided_by:null!==(y=null!==(m=null!==(g=null===(p=i.machine_classification)||void 0===p?void 0:p.decisioning_method)&&void 0!==g?g:null===(f=n.machine_classification)||void 0===f?void 0:f.decisioning_method)&&void 0!==m?m:null===(h=t.machine_classification)||void 0===h?void 0:h.decisioning_method)&&void 0!==y?y:null,human_action_enum:null,reason:"Please check the type of this page.",reasons:(null===(w=i.reasons)||void 0===w?void 0:w.length)?i.reasons:e.__spreadArray(e.__spreadArray([],null!==(b=n.reasons)&&void 0!==b?b:[],!0),null!==(A=t.reasons)&&void 0!==A?A:[],!0),score:null!==(Y=null!==(R=null!==(x=null!==(P=null!==(k=null!==(C=i.score)&&void 0!==C?C:null===(E=i.machine_classification)||void 0===E?void 0:E.score)&&void 0!==k?k:n.score)&&void 0!==P?P:null===(S=n.machine_classification)||void 0===S?void 0:S.score)&&void 0!==x?x:t.score)&&void 0!==R?R:null===(I=t.machine_classification)||void 0===I?void 0:I.score)&&void 0!==Y?Y:null,review:M?{action:T.length>0?a.PageCheckActionEnum.YES:a.PageCheckActionEnum.NO,reviewed_by:null!==(q=null===(j=D.human_action)||void 0===j?void 0:j.reviewed_by)&&void 0!==q?q:"",reviewed_at:null!==(N=null===(L=D.human_action)||void 0===L?void 0:L.reviewed_at)&&void 0!==N?N:""}:null,metadata:{page_type:U,page_num:o,classification_id:null,type_choices:[{page_type:"table",classification_id:n.id},{page_type:"drawing",classification_id:t.id}],user_actions:["YES","NO"]}}}(i,g,f,c);return p.push({id:"".concat(h,":page-classification-choice:").concat(g.id,":").concat(f.id),reviewStepIndex:y.length+w,segment:n,review_step:m,metadata:s(m.metadata)}),void(w+=1)}(d.length>0?d:i.severity?[i]:[]).forEach(function(e,o){var l,d,u,v;if(r(e.page_type)){var _=function(e,i,n,t){var o,l,c,d,u,s,v,_,p,g,f,m,h,y,w,b=r(e.page_type),A=null===(l=null===(o=e.human_action)||void 0===o?void 0:o.verdict)||void 0===l?void 0:l.trim().toUpperCase(),C=A&&a.isPageCheckAction(A)?A:null,E="drawing"===b?"an engineering drawing":b?"a ".concat(b):null;return{type:"page",confirmed:n,title:"Page Type Check",summary:(null==t?void 0:t.trim())||(C&&null!=i&&E?"Page ".concat(i," was confirmed as ").concat("YES"===C?E:"not ".concat(E),"."):void 0),format:"pdf",confidence:null!==(d=null===(c=e.machine_classification)||void 0===c?void 0:c.confidence)&&void 0!==d?d:null,decided_by:null!==(s=null===(u=e.machine_classification)||void 0===u?void 0:u.decisioning_method)&&void 0!==s?s:null,human_action_enum:null,reason:b?"We're not fully confident about the type of this page. Is this page a ".concat(b,"?"):null,reasons:null!==(v=e.reasons)&&void 0!==v?v:[],score:null!==(g=null!==(_=e.score)&&void 0!==_?_:null===(p=e.machine_classification)||void 0===p?void 0:p.score)&&void 0!==g?g:null,review:null==C?null:{action:C,reviewed_by:null!==(m=null===(f=e.human_action)||void 0===f?void 0:f.reviewed_by)&&void 0!==m?m:"",reviewed_at:null!==(y=null===(h=e.human_action)||void 0===h?void 0:h.reviewed_at)&&void 0!==y?y:""},metadata:{page_type:b,page_num:i,classification_id:null!==(w=e.id)&&void 0!==w?w:null,user_actions:["YES","NO"]}}}(e,c,null!==(d=null!==(l=e.confirmed)&&void 0!==l?l:i.confirmed)&&void 0!==d?d:null,null!==(u=i.summary)&&void 0!==u?u:null);p.push({id:"".concat(h,":page-classification:").concat(null!==(v=e.id)&&void 0!==v?v:"".concat(t,"-").concat(o)),reviewStepIndex:y.length+w,segment:n,review_step:_,metadata:s(_.metadata)}),w+=1}})})}),{boundaryReviews:o,labelReviews:_,pageReviews:p}},exports.getSegmentReviewKey=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./BoundaryCard.js"),n=require("./LabelCheck.js"),a=require("./PageCheck.js"),i=function(e){return"object"==typeof e&&null!==e?e:{}},t=function(e){return"string"==typeof e?e:null},o=function(e){return"number"==typeof e&&Number.isFinite(e)?e:null},r=function(e){return Array.isArray(e)?e.filter(function(e){return"string"==typeof e}):[]},l=function(e){var n="string"==typeof e?e.trim().toLowerCase():"";return"table"===n||"drawing"===n?n:null},u=function(e,n){return void 0===n&&(n=0),e.stable_key||e.segment_id||"".concat(e.start_page,"-").concat(e.end_page,"-").concat(n)},c=function(e){var a=i(e);return{current_label:t(a.current_label),custom_label:t(a.custom_label),group_id:t(a.group_id),user_actions:r(a.user_actions).filter(n.isLabelReviewAction)}},s=function(e){var n=i(e);return{page_type:l(n.page_type),page_num:o(n.page_num),classification_id:t(n.classification_id),user_actions:r(n.user_actions).filter(a.isPageCheckAction)}};exports.extractSegmentReviewData=function(n){var t=[],d=[],v=[];return n.forEach(function(n,p){var _,f,g=u(n,p),m=null!==(_=n.review_steps)&&void 0!==_?_:[];m.forEach(function(a,l){var u,p,_=(u=a.type,"page_boundary"===(p=u.trim().toLowerCase())||"page boundary review"===p?"boundary":"label"===p||"label review"===p?"label":"page"===p?"page":null);if("boundary"===_){var f=function(n){var a=i(n);return{focus_page:o(a.focus_page),boundary_margin:o(a.boundary_margin),user_actions:r(a.user_actions).filter(e.isBoundaryReviewAction)}}(a.metadata);t.push({id:"".concat(g,":boundary:").concat(l),reviewStepIndex:l,segment:n,review_step:a,metadata:f})}"label"===_&&d.push({id:"".concat(g,":label:").concat(l),reviewStepIndex:l,segment:n,review_step:a,metadata:c(a.metadata)}),"page"===_&&v.push({id:"".concat(g,":page:").concat(l),reviewStepIndex:l,segment:n,review_step:a,metadata:s(a.metadata)})});var y=0;null===(f=n.page_classifications)||void 0===f||f.forEach(function(e,i){var t,o,r=null!==(t=e.page_num)&&void 0!==t?t:null,u=null!==(o=e.questions)&&void 0!==o?o:[];(u.length>0?u:e.severity?[e]:[]).forEach(function(t,o){var u,c,d,p;if(l(t.page_type)){var _=function(e,n,i,t){var o,r,u,c,s,d,v,p,_,f,g,m,y,b,w,h=l(e.page_type),C=null===(r=null===(o=e.human_action)||void 0===o?void 0:o.verdict)||void 0===r?void 0:r.trim().toUpperCase(),x=C&&a.isPageCheckAction(C)?C:null,S="drawing"===h?"an engineering drawing":h?"a ".concat(h):null;return{type:"page",confirmed:i,title:"Page Type Check",summary:(null==t?void 0:t.trim())||(x&&null!=n&&S?"Page ".concat(n," was confirmed as ").concat("YES"===x?S:"not ".concat(S),"."):void 0),format:"pdf",confidence:null!==(c=null===(u=e.machine_classification)||void 0===u?void 0:u.confidence)&&void 0!==c?c:null,decided_by:null!==(d=null===(s=e.machine_classification)||void 0===s?void 0:s.decisioning_method)&&void 0!==d?d:null,human_action_enum:null,reason:h?"We're not fully confident about the type of this page. Is this page a ".concat(h,"?"):null,reasons:null!==(v=e.reasons)&&void 0!==v?v:[],score:null!==(f=null!==(p=e.score)&&void 0!==p?p:null===(_=e.machine_classification)||void 0===_?void 0:_.score)&&void 0!==f?f:null,review:null==x?null:{action:x,reviewed_by:null!==(m=null===(g=e.human_action)||void 0===g?void 0:g.reviewed_by)&&void 0!==m?m:"",reviewed_at:null!==(b=null===(y=e.human_action)||void 0===y?void 0:y.reviewed_at)&&void 0!==b?b:""},metadata:{page_type:h,page_num:n,classification_id:null!==(w=e.id)&&void 0!==w?w:null,user_actions:["YES","NO"]}}}(t,r,null!==(c=null!==(u=t.confirmed)&&void 0!==u?u:e.confirmed)&&void 0!==c?c:null,null!==(d=e.summary)&&void 0!==d?d:null);v.push({id:"".concat(g,":page-classification:").concat(null!==(p=t.id)&&void 0!==p?p:"".concat(i,"-").concat(o)),reviewStepIndex:m.length+y,segment:n,review_step:_,metadata:s(_.metadata)}),y+=1}})})}),{boundaryReviews:t,labelReviews:d,pageReviews:v}},exports.getSegmentReviewKey=u;
2
2
  //# sourceMappingURL=reviewStepAdapters.js.map
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/CodeCitation/CodeCitation.js"),t=require("./features/ProjectAccordion/ProjectAccordion.js"),i=require("./features/BookCitation/BookCitation.js"),r=require("./features/Bookemon/Bookemon.js"),a=require("./features/PdfEditorCitation/PdfEditorCitation.js"),o=require("./features/CitationRenderer/CitationRenderer.js"),n=require("./features/CitationRenderer/MarkdownRenderer.js"),s=require("./features/CodeCitation/_components/CodeEditor.js"),u=require("./features/PaginatedTable/PaginatedTable.js"),C=require("./features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js"),p=require("./features/ChatCitation/ChatCitationRenderer.js"),l=require("./features/CognitiveDecisioning/CognitiveDecisioningWrapper.js"),d=require("./features/PdfViewer/PdfViewer.js"),m=require("./features/SegmentReviewComponents/BoundaryCard.js");require("tslib"),require("react/jsx-runtime"),require("react"),require("@mui/material/Box"),require("@mui/material/Popper"),require("@mui/material/SvgIcon");var f=require("./features/SegmentReviewComponents/CognitiveIntegrity.js"),c=require("./features/SegmentReviewComponents/LabelCheck.js"),x=require("./features/SegmentReviewComponents/PageCheck.js");require("@mui/icons-material/ChevronRight"),require("@mui/icons-material/Close"),require("@mui/material/Button"),require("@mui/material/ButtonBase"),require("@mui/material/Checkbox"),require("@mui/material/Divider"),require("@mui/material/IconButton"),require("@mui/material/Paper"),require("@mui/material/Stack"),require("@mui/material/Typography");var g=require("./features/SegmentReviewComponents/reviewStepAdapters.js"),q=require("./features/SegmentReviewComponents/RevertCard.js"),R=require("./features/SegmentReviewComponents/RevertSuccessCard.js"),j=require("./features/SegmentReviewComponents/SegmentReviewPdfWrapper.js"),S=require("./features/CognitiveDecisioning/FaqCitation/FaqCitation.js"),w=require("./features/RequirementAiCitations/ImageCitation/ImageCitationContent.js"),v=require("./features/RequirementAiCitations/VideoCitation/VideoCitationContent.js"),P=require("./features/RequirementAiCitations/FileCitation/FileCitationContent.js"),I=require("./features/RequirementAiCitations/WebCitation/WebCitationWithImageContent.js"),b=require("./features/MarkdownWithImageCitation/MarkdownWithImageCitation.js"),D=require("./features/RequirementAiCitations/AiReasoning/AiReasoningCitation.js"),h=require("./features/TableCitation/TableCitationContent.js"),T=require("./features/ReviewPanel/ReviewPanel.js"),A=require("./features/CitationViewer/CitationsViewer.js"),B=require("./features/ExcelCitation/ExcelCitations.js"),k=require("./features/ScannedDocCitation/ScannedDocCitation.js"),y=require("./features/ChatDrawer/ChatDrawer.js"),W=require("./features/ChatDrawer/constants/ChatDrawer.js"),E=require("./features/SplitterCitations/SplitterCitationsComponent.js"),V=require("./features/DualCitation/SourceBQDataCompnent.js"),G=require("./features/CognitiveCompare/CognitiveCompare.js"),L=require("./features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),F=require("./features/TextualGuidelines/TextualGuideLinesComponent.js"),U=require("./features/RulebookCitations/RuleBookCitationWrapper.js"),O=require("./features/IngestionStatus/IngestionStatusComponent.js"),_=require("./features/ManageRemainders/ManageReminders.js"),M=require("./features/PromptemonBlockViewer/PromptemonBlockViewer.js"),N=require("./features/PromptemonViewer/PromptemonViewer.js"),H=require("./features/SPBAnalysisPanel/Spbanalysispanel.js"),Q=require("./features/GptWebCitation/GptWebCitation.js"),z=require("./hooks/useOnDemandCitationFetch.js"),X=require("./features/InstantLearningCitation/InstantLearningCitationComponent.js"),Y=require("./features/BPACitationRenderer/BPACitationRenderer.js"),Z=require("./features/GptWebCitation/utils/citationData.utils.js"),J=require("./features/GptWebCitation/types.js"),K=require("./features/PromptCitation/PromptCitation.js"),$=require("./features/PromptCitation/CitationDependencyGraph.js");exports.CodeCitation=e.default,exports.ProjectAccordian=t.default,exports.BookCitation=i.default,exports.Bookemon=r.default,exports.PdfCitation=a.PdfEditorCitation,exports.CitationRenderer=o.default,exports.MarkdownRenderer=n.default,Object.defineProperty(exports,"DiagnosticSeverity",{enumerable:!0,get:function(){return s.DiagnosticSeverity}}),exports.PaginatedTable=u.default,exports.InternalgptReasoningComponent=C.default,exports.NonWebReasoningComponent=C.default,exports.ChatCitation=p.default,exports.CognitiveDecisioningCard=l.default,exports.PdfViewer=d.default,exports.createBoundaryCardOptions=m.createBoundaryCardOptions,exports.isBoundaryReviewAction=m.isBoundaryReviewAction,exports.CognitiveIntegrity=f.default,exports.createLabelCheckOptions=c.createLabelCheckOptions,exports.isLabelReviewAction=c.isLabelReviewAction,exports.PageCheck=x.default,exports.isPageCheckAction=x.isPageCheckAction,exports.extractSegmentReviewData=g.extractSegmentReviewData,exports.RevertCard=q.default,exports.RevertSuccessCard=R.default,Object.defineProperty(exports,"SegmentPdfSpecialZoomLevel",{enumerable:!0,get:function(){return j.SegmentPdfSpecialZoomLevel}}),exports.SegmentReviewPdfWrapper=j.default,exports.FaqCitation=S.default,exports.ImageCitationContent=w.default,exports.VideoCitationContent=v.default,exports.FileCitationContent=P.default,exports.WebCitationWithImageContent=I.default,exports.MarkdownWithImageCitation=b.default,exports.AiReasoningCitation=D.default,exports.TableCitationContent=h.default,exports.ReviewPanel=T.ReviewPanel,exports.CitationsViewer=A.default,exports.ExcelCitation=B.default,exports.ScannedDocCitation=k.default,exports.ChatDrawer=y.default,exports.FILE_INGESTION_STATUS=W.FILE_INGESTION_STATUS,exports.SUMMARY_EXPAND_HEIGHT_NUDGE=W.SUMMARY_EXPAND_HEIGHT_NUDGE,exports.TRUNCATE_THRESHOLD=W.TRUNCATE_THRESHOLD,exports.SplitterCitationsComponent=E.default,exports.SourcesBQCitation=V.SourcesBQCitation,exports.findSourceCitation=V.findSourceCitation,exports.parseSourcesBQHref=V.parseSourcesBQHref,exports.CognitiveCompare=G.default,exports.CognitiveInternalgptCoreComponent=L.default,exports.TextualGuideLinesComponent=F.default,exports.RuleBookCitationWrapper=U.default,exports.IngestionStatusChip=O.IngestionStatusChip,exports.IngestionStatusComponent=O.IngestionStatusComponent,exports.ManageReminders=_.ManageReminders,exports.PromptemonBlockViewer=M.default,exports.PromptemonViewer=N.default,exports.SPBAnalysisPanel=H.default,exports.GptWebCitation=Q.default,exports.useOnDemandCitationFetch=z.useOnDemandCitationFetch,exports.InstantLearningCitationWrapper=X.default,exports.BPACitationRenderer=Y.default,exports.extractLearnedFromUrl=Z.extractLearnedFromUrl,exports.extractRelevanceScoreFromContent=Z.extractRelevanceScoreFromContent,exports.extractTopicFromContent=Z.extractTopicFromContent,exports.getWebCitationImageUrl=Z.getWebCitationImageUrl,exports.mapCitationDataToDisplay=Z.mapCitationDataToDisplay,exports.resolveSkeletonVisitUrl=Z.resolveSkeletonVisitUrl,exports.sanitizeExternalUrl=Z.sanitizeExternalUrl,Object.defineProperty(exports,"CitationType",{enumerable:!0,get:function(){return J.CitationType}}),exports.allowsGptCitationView=J.allowsGptCitationView,exports.allowsWebCitationView=J.allowsWebCitationView,exports.showsCitationViewToggle=J.showsCitationViewToggle,exports.PromptCitation=K.default,exports.CitationDependencyGraph=$.default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/CodeCitation/CodeCitation.js"),t=require("./features/ProjectAccordion/ProjectAccordion.js"),i=require("./features/BookCitation/BookCitation.js"),r=require("./features/Bookemon/Bookemon.js"),o=require("./features/PdfEditorCitation/PdfEditorCitation.js"),a=require("./features/CitationRenderer/CitationRenderer.js"),n=require("./features/CitationRenderer/MarkdownRenderer.js"),s=require("./features/CodeCitation/_components/CodeEditor.js"),u=require("./features/PaginatedTable/PaginatedTable.js"),C=require("./features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js"),p=require("./features/ChatCitation/ChatCitationRenderer.js"),l=require("./features/CognitiveDecisioning/CognitiveDecisioningWrapper.js"),d=require("./features/PdfViewer/PdfViewer.js"),f=require("./features/SegmentReviewComponents/BoundaryCard.js");require("tslib"),require("react/jsx-runtime"),require("react"),require("@mui/material/Box"),require("@mui/material/Popper"),require("@mui/material/SvgIcon");var m=require("./features/SegmentReviewComponents/CognitiveIntegrity.js"),x=require("./features/SegmentReviewComponents/LabelCheck.js"),c=require("./features/SegmentReviewComponents/PageCheck.js"),g=require("./features/SegmentReviewComponents/reviewStepAdapters.js"),q=require("./features/SegmentReviewComponents/RevertCard.js"),j=require("./features/SegmentReviewComponents/RevertSuccessCard.js"),R=require("./features/SegmentReviewComponents/SegmentReviewPdfWrapper.js"),S=require("./features/CognitiveDecisioning/FaqCitation/FaqCitation.js"),w=require("./features/RequirementAiCitations/ImageCitation/ImageCitationContent.js"),v=require("./features/RequirementAiCitations/VideoCitation/VideoCitationContent.js"),P=require("./features/RequirementAiCitations/FileCitation/FileCitationContent.js"),I=require("./features/RequirementAiCitations/WebCitation/WebCitationWithImageContent.js"),b=require("./features/MarkdownWithImageCitation/MarkdownWithImageCitation.js"),D=require("./features/RequirementAiCitations/AiReasoning/AiReasoningCitation.js"),A=require("./features/TableCitation/TableCitationContent.js"),T=require("./features/ReviewPanel/ReviewPanel.js"),h=require("./features/CitationViewer/CitationsViewer.js"),k=require("./features/ExcelCitation/ExcelCitations.js"),B=require("./features/ScannedDocCitation/ScannedDocCitation.js"),W=require("./features/ChatDrawer/ChatDrawer.js"),y=require("./features/ChatDrawer/constants/ChatDrawer.js"),E=require("./features/SplitterCitations/SplitterCitationsComponent.js"),V=require("./features/DualCitation/SourceBQDataCompnent.js"),G=require("./features/CognitiveCompare/CognitiveCompare.js"),L=require("./features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),F=require("./features/TextualGuidelines/TextualGuideLinesComponent.js"),U=require("./features/RulebookCitations/RuleBookCitationWrapper.js"),O=require("./features/IngestionStatus/IngestionStatusComponent.js"),_=require("./features/ManageRemainders/ManageReminders.js"),M=require("./features/PromptemonBlockViewer/PromptemonBlockViewer.js"),N=require("./features/PromptemonViewer/PromptemonViewer.js"),H=require("./features/SPBAnalysisPanel/Spbanalysispanel.js"),Q=require("./features/GptWebCitation/GptWebCitation.js"),z=require("./hooks/useOnDemandCitationFetch.js"),X=require("./features/InstantLearningCitation/InstantLearningCitationComponent.js"),Y=require("./features/BPACitationRenderer/BPACitationRenderer.js"),Z=require("./features/GptWebCitation/utils/citationData.utils.js"),J=require("./features/GptWebCitation/types.js"),K=require("./features/PromptCitation/PromptCitation.js"),$=require("./features/PromptCitation/CitationDependencyGraph.js");exports.CodeCitation=e.default,exports.ProjectAccordian=t.default,exports.BookCitation=i.default,exports.Bookemon=r.default,exports.PdfCitation=o.PdfEditorCitation,exports.CitationRenderer=a.default,exports.MarkdownRenderer=n.default,Object.defineProperty(exports,"DiagnosticSeverity",{enumerable:!0,get:function(){return s.DiagnosticSeverity}}),exports.PaginatedTable=u.default,exports.InternalgptReasoningComponent=C.default,exports.NonWebReasoningComponent=C.default,exports.ChatCitation=p.default,exports.CognitiveDecisioningCard=l.default,exports.PdfViewer=d.default,exports.createBoundaryCardOptions=f.createBoundaryCardOptions,exports.isBoundaryReviewAction=f.isBoundaryReviewAction,exports.CognitiveIntegrity=m.default,exports.createLabelCheckOptions=x.createLabelCheckOptions,exports.isLabelReviewAction=x.isLabelReviewAction,exports.PageCheck=c.default,exports.isPageCheckAction=c.isPageCheckAction,exports.extractSegmentReviewData=g.extractSegmentReviewData,exports.RevertCard=q.default,exports.RevertSuccessCard=j.default,Object.defineProperty(exports,"SegmentPdfSpecialZoomLevel",{enumerable:!0,get:function(){return R.SegmentPdfSpecialZoomLevel}}),exports.SegmentReviewPdfWrapper=R.default,exports.FaqCitation=S.default,exports.ImageCitationContent=w.default,exports.VideoCitationContent=v.default,exports.FileCitationContent=P.default,exports.WebCitationWithImageContent=I.default,exports.MarkdownWithImageCitation=b.default,exports.AiReasoningCitation=D.default,exports.TableCitationContent=A.default,exports.ReviewPanel=T.ReviewPanel,exports.CitationsViewer=h.default,exports.ExcelCitation=k.default,exports.ScannedDocCitation=B.default,exports.ChatDrawer=W.default,exports.FILE_INGESTION_STATUS=y.FILE_INGESTION_STATUS,exports.SUMMARY_EXPAND_HEIGHT_NUDGE=y.SUMMARY_EXPAND_HEIGHT_NUDGE,exports.TRUNCATE_THRESHOLD=y.TRUNCATE_THRESHOLD,exports.SplitterCitationsComponent=E.default,exports.SourcesBQCitation=V.SourcesBQCitation,exports.findSourceCitation=V.findSourceCitation,exports.parseSourcesBQHref=V.parseSourcesBQHref,exports.CognitiveCompare=G.default,exports.CognitiveInternalgptCoreComponent=L.default,exports.TextualGuideLinesComponent=F.default,exports.RuleBookCitationWrapper=U.default,exports.IngestionStatusChip=O.IngestionStatusChip,exports.IngestionStatusComponent=O.IngestionStatusComponent,exports.ManageReminders=_.ManageReminders,exports.PromptemonBlockViewer=M.default,exports.PromptemonViewer=N.default,exports.SPBAnalysisPanel=H.default,exports.GptWebCitation=Q.default,exports.useOnDemandCitationFetch=z.useOnDemandCitationFetch,exports.InstantLearningCitationWrapper=X.default,exports.BPACitationRenderer=Y.default,exports.extractLearnedFromUrl=Z.extractLearnedFromUrl,exports.extractRelevanceScoreFromContent=Z.extractRelevanceScoreFromContent,exports.extractTopicFromContent=Z.extractTopicFromContent,exports.getWebCitationImageUrl=Z.getWebCitationImageUrl,exports.mapCitationDataToDisplay=Z.mapCitationDataToDisplay,exports.resolveSkeletonVisitUrl=Z.resolveSkeletonVisitUrl,exports.sanitizeExternalUrl=Z.sanitizeExternalUrl,Object.defineProperty(exports,"CitationType",{enumerable:!0,get:function(){return J.CitationType}}),exports.allowsGptCitationView=J.allowsGptCitationView,exports.allowsWebCitationView=J.allowsWebCitationView,exports.showsCitationViewToggle=J.showsCitationViewToggle,exports.PromptCitation=K.default,exports.CitationDependencyGraph=$.default;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("axios"));exports.createRedlineDocument=async(e,o)=>{try{console.log("[createRedlineDocument] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/create`,{user_name:e.userName,user_email:e.userEmail,redline_config_id:e.redlineConfigId,changelog_config_id:e.changelogConfigId,artifact_id:e.artifactId,input_data:e.inputData,document_metadata:{comparison_id:e.comparisonId}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[createRedlineDocument] Response:",t),t}catch(e){console.log("[createRedlineDocument] Error:",e)}return null},exports.fetchRedlineDocumentSection=async(e,o)=>{try{console.log("[fetchRedlineDocumentSection] Request:",e);const{data:t}=await n.default.get(`${e.baseApiUrl}/redlining/segment/${e.documentId}/${e.sectionId}?redline_config_id=${e.redlineConfigId}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[fetchRedlineDocumentSection] Response:",t),t}catch(e){console.log("[fetchRedlineDocumentSection] Error:",e)}return null},exports.getRedlineDocumentId=async e=>{try{console.log("[getRedlineDocumentId] Request:",e);const{data:o}=await n.default.get(`${e.baseApiUrl}/book-finder-mode/get_comparison/${e.comparisonId}`);return console.log("[getRedlineDocumentId] Response:",o),o}catch(e){console.log("[getRedlineDocumentId] Error:",e)}return null},exports.resolveRedline=async(e,o)=>{try{console.log("[resolveRedline] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/resolve`,{document_id:e.documentId,user_name:e.userName,user_email:e.userEmail,redline_id:e.redlineId,action:e.action,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[resolveRedline] Response:",t),t}catch(e){console.log("[resolveRedline] Error:",e)}return null},exports.updateRedlineDocument=async(e,o)=>{try{console.log("[updateRedlineDocument] Request:",e);const{data:t}=await n.default.put(`${e.baseApiUrl}/redlining/update-manual`,{document_id:e.documentId,segment_id:e.sectionId,user_name:e.userName,user_email:e.userEmail,new_plain_content:e.updatedContent,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[updateRedlineDocument] Response:",t),t}catch(e){console.log("[updateRedlineDocument] Error:",e)}return null};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("axios"));exports.createRedlineDocument=async(e,t)=>{try{console.log("[createRedlineDocument] Request:",e);const{data:o}=await n.default.post(`${e.baseApiUrl}/redlining/create`,{user_name:e.userName,user_email:e.userEmail,redline_config_id:e.redlineConfigId,changelog_config_id:e.changelogConfigId,artifact_id:e.artifactId,input_data:e.inputData,document_metadata:{comparison_id:e.comparisonId}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return console.log("[createRedlineDocument] Response:",o),o}catch(e){console.log("[createRedlineDocument] Error:",e)}return null},exports.fetchRedlineDocumentSection=async(e,t)=>{if(!(e.documentId&&"string"==typeof e.documentId&&e.documentId.trim()&&e.sectionId&&"string"==typeof e.sectionId&&e.sectionId.trim()&&e.baseApiUrl&&"string"==typeof e.baseApiUrl&&e.baseApiUrl.trim()&&e.redlineConfigId&&"string"==typeof e.redlineConfigId&&e.redlineConfigId.trim()))return console.error("[fetchRedlineDocumentSection] Invalid or missing payload parameters"),null;try{console.log("[fetchRedlineDocumentSection] Request:",e);const{data:o}=await n.default.get(`${e.baseApiUrl}/redlining/segment/${e.documentId}/${e.sectionId}?redline_config_id=${e.redlineConfigId}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return console.log("[fetchRedlineDocumentSection] Response:",o),o}catch(e){console.log("[fetchRedlineDocumentSection] Error:",e)}return null},exports.getRedlineDocumentId=async e=>{try{console.log("[getRedlineDocumentId] Request:",e);const{data:t}=await n.default.get(`${e.baseApiUrl}/book-finder-mode/get_comparison/${e.comparisonId}`);return console.log("[getRedlineDocumentId] Response:",t),t}catch(e){console.log("[getRedlineDocumentId] Error:",e)}return null},exports.resolveRedline=async(e,t)=>{try{console.log("[resolveRedline] Request:",e);const{data:o}=await n.default.post(`${e.baseApiUrl}/redlining/resolve`,{document_id:e.documentId,user_name:e.userName,user_email:e.userEmail,redline_id:e.redlineId,action:e.action,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return console.log("[resolveRedline] Response:",o),o}catch(e){console.log("[resolveRedline] Error:",e)}return null},exports.updateRedlineDocument=async(e,t)=>{try{console.log("[updateRedlineDocument] Request:",e);const{data:o}=await n.default.put(`${e.baseApiUrl}/redlining/update-manual`,{document_id:e.documentId,segment_id:e.sectionId,user_name:e.userName,user_email:e.userEmail,new_plain_content:e.updatedContent,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return console.log("[updateRedlineDocument] Response:",o),o}catch(e){console.log("[updateRedlineDocument] Error:",e)}return null};
2
2
  //# sourceMappingURL=redlineService.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i,__awaiter as n,__generator as t}from"tslib";import{jsxs as o,jsx as e,Fragment as l}from"react/jsx-runtime";import{Globe as r,ChevronUp as a,ChevronDown as d,Maximize2 as u,X as c,ExternalLink as s}from"lucide-react";import{useState as v,useEffect as p,useMemo as m,useRef as h}from"react";import g from"./ResizableSplitPane.js";import f from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as b,DefaultFullScreenIcon as x}from"../../assests/svg/PdfViewerIcons.js";import _ from"react-markdown";import y from"rehype-raw";import{Dialog as w,Box as C}from"@mui/material";import{SHARED_MARKDOWN_STYLES as F}from"./CognitiveCompareConfig.js";import"react-dom";import{useCompareContext as D}from"./CompareContext.js";import{processGuidelinesMarkdown as P}from"./Guidelines/utils/processGuidelinesMarkdown.js";import T from"../GptWebCitation/GptWebCitation.js";import{CitationType as S}from"../GptWebCitation/types.js";import"./MoreFunctionsPopup.js";import"./components/SubSectionAccordion.js";import"./components/LHSSectionRow.js";import"./components/RHSSectionRow.js";var k=function(i){var n,t,o;return(null===(o=null===(t=null===(n=(null==i?void 0:i.extraMetaData)||i)||void 0===n?void 0:n.aiReasoningCitation)||void 0===t?void 0:t.gpt_citation)||void 0===o?void 0:o[0])||null},N="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",j="sai.siddhartha@techolution.com",I="672e32f7a0e8fe2e8e50bcba",R="TNV Sai Siddhartha",G="90vh",U="calc(".concat(G," - 120px)"),E=function(){var i;return"function"==typeof(null===(i=globalThis.crypto)||void 0===i?void 0:i.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var n=Math.floor(16*Math.random());return("x"===i?n:n%4+8).toString(16)})},M=function(i,n){var t=function(i){var n;return(null==i?void 0:i.payloadCitationId)||(null===(n=null==i?void 0:i.extraMetaData)||void 0===n?void 0:n.payloadCitationId)||""}(i)||n||E();return function(i,n){i&&"object"==typeof i&&(i.payloadCitationId=n,i.extraMetaData&&"object"==typeof i.extraMetaData&&(i.extraMetaData.payloadCitationId=n))}(i,t),t},A=function(o){var l,r=o.metaData,g=o.isFullscreen,f=void 0!==g&&g,b=D().gptWebCitationConfig,x=m(function(){return function(i){return{endpoint:(null==i?void 0:i.endpoint)||N,userEmail:(null==i?void 0:i.userEmail)||j,userId:(null==i?void 0:i.userId)||I,userName:(null==i?void 0:i.userName)||R,headers:null==i?void 0:i.headers}}(b)},[b]),_=null==r?void 0:r.webGpt,y=h(null);y.current||(y.current=E());var w=m(function(){return function(i,n,t){var o,e,l=k(i),r=(null==l?void 0:l.customMetaData)||{},a=(null==r?void 0:r.value)||{},d=(null==i?void 0:i.webSearchAnswer)||{},u=(null==i?void 0:i.extraMetaData)||i||{};return{userEmail:(null==i?void 0:i.userEmail)||(null==d?void 0:d.userEmail)||(null==n?void 0:n.userEmail)||"",userId:(null==i?void 0:i.userId)||(null==d?void 0:d.userId)||(null==n?void 0:n.userId)||"",userName:(null==i?void 0:i.userName)||(null==d?void 0:d.userName)||(null==n?void 0:n.userName)||"",citationId:M(i,t),citationUrl:(null==a?void 0:a.citationUrl)||(null==d?void 0:d.citationUrl)||"",content:(null==u?void 0:u.Reasoning)||(null==d?void 0:d.enhanced_content)||"",citationType:(null==a?void 0:a.citationType)||"web",citatioNumber:null!==(e=null!==(o=null==r?void 0:r.citation_number)&&void 0!==o?o:null==l?void 0:l.citation_number)&&void 0!==e?e:Number((null==i?void 0:i.reasoningId)||0)}}(_,x,y.current||void 0)},[_,x]),C=m(function(){return k(_)},[_]),F=(null===(l=null==C?void 0:C.customMetaData)||void 0===l?void 0:l.value)||{},P=(null==_?void 0:_.extraMetaData)||_||{},G=v(),A=G[0],H=G[1],W=v("pending"),z=W[0],O=W[1],V=v(!0),B=V[0],L=V[1];p(function(){var o=!0;return n(void 0,void 0,void 0,function(){var n,e,l,r;return t(this,function(t){switch(t.label){case 0:if(!x.endpoint||!(null==w?void 0:w.citationUrl)||!(null==w?void 0:w.content))return O("error"),[2];O("pending"),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(x.endpoint,{method:"POST",headers:i({"actor-id":w.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},x.headers||{}),body:JSON.stringify(w)})];case 2:if(!(n=t.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return e=t.sent(),l=(null==e?void 0:e.responseData)||(null==e?void 0:e.result)||(null==e?void 0:e.data)||e,o?(H(l),O("success"),[3,5]):[2];case 4:return r=t.sent(),o?(console.error("Failed to load GPT web citation",r),O("error"),[3,5]):[2];case 5:return[2]}})}),function(){o=!1}},[w,x]);var J=m(function(){return{item:{confidence_score:Number((null==P?void 0:P.Confidence_score)||0),text:(null==F?void 0:F.paraphrase)||"Web citation reasoning",dataSource:(null==F?void 0:F.text)||(null==P?void 0:P.Reasoning)||"",paraphrase:(null==F?void 0:F.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==w?void 0:w.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:d,ChevronUpIcon:a,MaximizeIcon:u,CloseIcon:c}}},[F,null==w?void 0:w.citatioNumber,P]),$=m(function(){return i(i({},J),f?{bodyHeight:U}:{})},[J,f]);return e(T,{gptCitation:$,defaultCitationUrl:(null==w?void 0:w.citationUrl)||"",citationType:S.GPT_WEB,webCitationData:A,webCitationStatus:z,showWebCitation:B,onToggleCitationView:function(){return L(function(i){return!i})},iconsConfig:{MaximizeIcon:u,ExternalLinkIcon:s},isFixedHeight:!0})},H=function(n){var t,o,r,a,d,u,c,s=n.href,v=n.metaData,p=n.citationTitle,h=n.citationType,b=n.citationReason,x=n.isFullscreen,w=D().guidelinesData,T=function(i){try{var n=function(i){var n=i.match(/^(?:pdf_citation|deviation_summary)\$(\d+)/);if(n)try{var t=i.indexOf("?"),o=t>=0?i.slice(t):"";return{citationNumber:n[1],parsedUrl:new URL(o||"./",window.location.origin)}}catch(i){return{citationNumber:n[1],parsedUrl:null}}try{var e=new URL(i,window.location.origin);return{citationNumber:e.searchParams.get("citationNumber")||e.searchParams.get("citation_number"),parsedUrl:e}}catch(i){return{citationNumber:null,parsedUrl:null}}}(i),t=n.citationNumber,o=n.parsedUrl;return{citationNumber:t,phraseToHighlight:(null==o?void 0:o.searchParams.get("phrase_to_highlight"))||null,citationTypeFromHref:(null==o?void 0:o.searchParams.get("citation_type"))||null}}catch(i){return{citationNumber:null,phraseToHighlight:null,citationTypeFromHref:null}}}(s),S=T.citationNumber,k=T.phraseToHighlight,N=T.citationTypeFromHref,j=h||N||void 0,I="il_rulebook_citation"===j?"rulebook_citation":j,R=S&&(null===(t=null==v?void 0:v.citations)||void 0===t?void 0:t[S])||{},G=(null===(o=null==v?void 0:v.docData)||void 0===o?void 0:o.documents)||{},U=(null===(r=null==v?void 0:v.docData)||void 0===r?void 0:r.input_index_map)||{},E=Object.keys((null==v?void 0:v.citations)||{}).length>0||Object.keys((null==v?void 0:v.docData)||{}).length>0,M=null==U?void 0:U[0],H=null==U?void 0:U[1],W=M?G[M]:null,z=H?G[H]:null,O=M?R[M]:null,V=H?R[H]:null,B=m(function(){var i,n,t,o;return O&&W?e(f,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==W?void 0:W.title,pdfUrl:null==W?void 0:W.signed_url,highlightText:[null!==(i=null==O?void 0:O.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==O?void 0:O.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==O?void 0:O.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==O?void 0:O.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==W?void 0:W.title,null==W?void 0:W.signed_url,null==O?void 0:O.highlighted_text,null===(a=null==O?void 0:O.custom_metadata)||void 0===a?void 0:a.pdf_start_page_number,null===(d=null==O?void 0:O.custom_metadata)||void 0===d?void 0:d.pdf_end_page_number]),L=m(function(){var i,n,t,o;return V&&z?e(f,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==z?void 0:z.title,pdfUrl:null==z?void 0:z.signed_url,jumpToPageValue:1,highlightText:[null!==(i=null==V?void 0:V.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==V?void 0:V.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==V?void 0:V.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==V?void 0:V.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==z?void 0:z.title,null==z?void 0:z.signed_url,null==V?void 0:V.highlighted_text,null===(u=null==V?void 0:V.custom_metadata)||void 0===u?void 0:u.pdf_start_page_number,null===(c=null==V?void 0:V.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]),J="dual_citation"===I,$=J&&!!(null==v?void 0:v.webGpt),q=m(function(){if(!B)return null;var n=$?e(A,{metaData:v,isFullscreen:x}):"rulebook_citation"===I?e(l,{children:e(C,i({sx:i(i({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},F),{overflow:"auto"})},{children:e(_,i({rehypePlugins:[y]},{children:P({guidelinesData:w,targetHighlights:[k],labelColor:"#FEF08A"})}))}))}):L;return n?e(g,{leftComponent:B,rightComponent:n,isFullscreen:x}):B},[B,L,I,$,v,x,w,k]);return(null==v?void 0:v.webGpt)&&!E?e(A,{metaData:v,isFullscreen:x}):S?"rulebook_citation"===I?e("div",O?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q}):i({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:b||"Rulebook citation selected."})):J?O||V?e("div",i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q})):(null==v?void 0:v.webGpt)?e(A,{metaData:v,isFullscreen:x}):e("div",{children:"Missing PDF Citation. Please try again later"}):["contract","clause"].includes(p)?e("div",O||V?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q}):{children:"Missing PDF Citation. Please try again later"}):e("div",{children:"No Citation Found. Please try again later"}):null},W=function(n){var t,l,u,c,s,m,h,g=n.href,f=n.children,_=n.citationType,y=n.citationReason,C=n.metaData,F=n.chevronUpComponent,D=void 0===F?null:F,P=n.chevronDownComponent,T=void 0===P?null:P,S=n.customStyle,k=void 0===S?{}:S,N=n.defaultState,j=void 0!==N&&N,I=n.onFullscreenChange,R=v(j),U=R[0],E=R[1],M=v(!1),A=M[0],W=M[1],z="string"==typeof f&&(null===(t=null==f?void 0:f.split("\n"))||void 0===t?void 0:t.length)>1?f.split("\n").join(" "):f;p(function(){if(null==I||I(A),A)return function(){null==I||I(!1)}},[A,I]);var O="string"==typeof f?f:f[0],V=null!=D?D:function(i){var n,t;return e(a,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(t=null==i?void 0:i.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(l=null==k?void 0:k.arrow)&&void 0!==l?l:{}),B=null!=T?T:function(i){var n,t;return e(d,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(t=null==i?void 0:i.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(u=null==k?void 0:k.arrow)&&void 0!==u?u:{}),L=o("div",i({style:{boxSizing:"border-box",border:A?"none":"1px solid #E4E7EC",borderRadius:A?0:"8px",overflow:"hidden",marginTop:A?0:"8px",display:"flex",flexDirection:"column",width:"100%",height:A?"100%":void 0,backgroundColor:"#FAFAFA"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:e("button",i({onClick:function(){W(function(i){return!i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:e(A?b:x,{})}))})),e("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:e(H,{href:g,children:f,metaData:C,citationTitle:O,citationType:_,citationReason:y,isFullscreen:A})}))]}));return o("span",i({style:i({display:"inline"},k.relativeWrapper||{})},{children:[e("div",i({style:i({display:"inline",marginTop:0},k.citationButtonWrapper||{})},{children:o("button",i({type:"button",onClick:function(){return E(function(i){return!i})},style:i({display:(null==C?void 0:C.webGpt)?"inline":"inline-flex",alignItems:(null==C?void 0:C.webGpt)?void 0:"center",gap:(null==C?void 0:C.webGpt)?void 0:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==C?void 0:C.webGpt)?600:700,color:(null==C?void 0:C.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},k.citationButton||{})},{children:[(null==C?void 0:C.webGpt)&&e(r,{size:null!==(s=null===(c=k.arrow)||void 0===c?void 0:c.fontSize)&&void 0!==s?s:"1em",color:null!==(h=null===(m=k.arrow)||void 0===m?void 0:m.color)&&void 0!==h?h:"#6D28D9",style:{display:"inline-block",width:"1em",height:"1em",marginRight:"3px",verticalAlign:"-0.125em",flexShrink:0}}),e("span",{children:z}),e("span",i({style:{display:"inline-flex",alignItems:"center",marginLeft:(null==C?void 0:C.webGpt)?"3px":void 0,verticalAlign:(null==C?void 0:C.webGpt)?"-0.125em":void 0}},{children:U?V:B}))]}))})),U&&(A?e(w,i({open:A,onClose:function(){return W(!1)},maxWidth:!1,BackdropProps:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"}},PaperProps:{sx:{backgroundColor:"#FAFAFA",borderRadius:"16px",height:G,m:0,maxHeight:G,maxWidth:"95vw",overflow:"hidden",width:"95vw"}}},{children:L})):L)]}))};export{W as default};
1
+ import{__assign as n}from"tslib";import{jsxs as o,jsx as i}from"react/jsx-runtime";import{Dialog as e}from"@mui/material";import{Globe as t,ChevronUp as l,ChevronDown as r}from"lucide-react";import{useState as d,useEffect as a,useMemo as u,useCallback as s}from"react";import{DefaultFullScreenCloseIcon as c,DefaultFullScreenIcon as p}from"../../assests/svg/PdfViewerIcons.js";import{useOptionalCompareContext as v}from"./CompareContext.js";import f from"./CitationRendererInner.js";var g="90vh",h={border:"1px solid #D0D5DD",borderRadius:"6px",background:"#FFFFFF",color:"#344054",cursor:"pointer",fontSize:"12px",fontWeight:600,padding:"3px 8px"},m=function(m){var x,b,y,C,w,F,D,k=m.href,S=m.children,z=m.citationType,R=m.citationReason,A=m.metaData,j=m.chevronUpComponent,B=void 0===j?null:j,G=m.chevronDownComponent,W=void 0===G?null:G,E=m.customStyle,I=void 0===E?{}:E,P=m.defaultState,T=void 0!==P&&P,O=m.onFullscreenChange,H=m.onDemandCitationContext,L=v(),U=null==L?void 0:L.onDemandCitationConfig,V=null==L?void 0:L.getOnDemandCitationCacheEntry,q=null==L?void 0:L.fetchOnDemandCitationContext,J=null==L?void 0:L.onDemandCitationCacheVersion,K=d(T),M=K[0],N=K[1],Q=d(!1),X=Q[0],Y=Q[1],Z="string"==typeof S&&(null===(x=null==S?void 0:S.split("\n"))||void 0===x?void 0:x.length)>1?S.split("\n").join(" "):S,$="string"==typeof S?S:S[0];a(function(){if(null==O||O(X),X)return function(){null==O||O(!1)}},[X,O]);var _=u(function(){return H&&V?V(H):void 0},[V,J,H]),nn=!!(null==U?void 0:U.enabled)&&!!H,on="success"===(null==_?void 0:_.status)&&_.data&&"object"==typeof _.data&&Object.keys(_.data).length>0,en=u(function(){return n(n({},A),{citations:nn?on?null==_?void 0:_.data:{}:null==A?void 0:A.citations})},[on,nn,A,null==_?void 0:_.data]),tn=nn&&(!_||"loading"===_.status)&&!on,ln=nn&&"error"===(null==_?void 0:_.status)&&!on,rn=nn&&"success"===(null==_?void 0:_.status)&&!on,dn=!nn||on,an=s(function(){(null==U?void 0:U.enabled)&&H&&q&&("loading"===(null==_?void 0:_.status)||"success"===(null==_?void 0:_.status)&&on||q(H).catch(function(n){U.debug&&console.error("[CognitiveCompare:onDemandCitations] citation fetch failed",n)}))},[q,on,null==_?void 0:_.status,U,H]),un=null!=B?B:function(n){var o,e;return i(l,{size:null!==(o=null==n?void 0:n.fontSize)&&void 0!==o?o:16,color:null!==(e=null==n?void 0:n.color)&&void 0!==e?e:"rgb(214, 51, 132)"})}(null!==(b=null==I?void 0:I.arrow)&&void 0!==b?b:{}),sn=null!=W?W:function(n){var o,e;return i(r,{size:null!==(o=null==n?void 0:n.fontSize)&&void 0!==o?o:16,color:null!==(e=null==n?void 0:n.color)&&void 0!==e?e:"rgb(214, 51, 132)"})}(null!==(y=null==I?void 0:I.arrow)&&void 0!==y?y:{}),cn=function(o){return i("button",n({type:"button",onClick:function(n){n.stopPropagation(),an()},style:n(n({},h),o)},{children:"Retry"}))},pn=o("div",n({style:{boxSizing:"border-box",border:X?"none":"1px solid #E4E7EC",borderRadius:X?0:"8px",overflow:"hidden",marginTop:X?0:"8px",display:"flex",flexDirection:"column",width:"100%",height:X?"100%":void 0,backgroundColor:"#FAFAFA"}},{children:[i("div",n({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:i("button",n({onClick:function(){Y(function(n){return!n})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:i(X?c:p,{})}))})),o("div",n({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:[tn&&i("div",n({style:{padding:"12px",fontSize:"13px",color:"#475467"}},{children:"Loading citation details..."})),ln&&o("div",n({style:{padding:"12px",fontSize:"13px",color:"#B42318",display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[i("span",{children:"Unable to load citation details. Please try again later."}),cn({border:"1px solid #FDA29B",color:"#B42318"})]})),rn&&o("div",n({style:{padding:"12px",fontSize:"13px",color:"#475467",display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[i("span",{children:"Citation details are not available for this source."}),cn()]})),dn&&i(f,{href:k,children:S,metaData:en,citationTitle:$,citationType:z,citationReason:R,isFullscreen:X})]}))]}));return o("span",n({style:n({display:"inline"},I.relativeWrapper||{})},{children:[i("div",n({style:n({display:"inline",marginTop:0},I.citationButtonWrapper||{})},{children:o("button",n({type:"button",onClick:function(){N(function(n){var o=!n;return o&&an(),o})},style:n({display:(null==A?void 0:A.webGpt)?"inline":"inline-flex",alignItems:(null==A?void 0:A.webGpt)?void 0:"center",gap:(null==A?void 0:A.webGpt)?void 0:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==A?void 0:A.webGpt)?600:700,color:(null==A?void 0:A.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},I.citationButton||{})},{children:[(null==A?void 0:A.webGpt)&&i(t,{size:null!==(w=null===(C=I.arrow)||void 0===C?void 0:C.fontSize)&&void 0!==w?w:"1em",color:null!==(D=null===(F=I.arrow)||void 0===F?void 0:F.color)&&void 0!==D?D:"#6D28D9",style:{display:"inline-block",width:"1em",height:"1em",marginRight:"3px",verticalAlign:"-0.125em",flexShrink:0}}),i("span",{children:Z}),i("span",n({style:{display:"inline-flex",alignItems:"center",marginLeft:(null==A?void 0:A.webGpt)?"3px":void 0,verticalAlign:(null==A?void 0:A.webGpt)?"-0.125em":void 0}},{children:M?un:sn}))]}))})),M&&(X?i(e,n({open:X,onClose:function(){Y(!1),null==O||O(!1)},maxWidth:!1,BackdropProps:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"}},PaperProps:{sx:{backgroundColor:"#FAFAFA",borderRadius:"16px",height:g,m:0,maxHeight:g,maxWidth:"95vw",overflow:"hidden",width:"95vw"}}},{children:pn})):pn)]}))};export{m as default};
2
2
  //# sourceMappingURL=CitationAnchor.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as n,__assign as r}from"tslib";import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useMemo as i}from"react";import{Box as o,Typography as a}from"@mui/material";import l from"react-markdown";import c from"rehype-raw";import u from"./CitationAnchor.js";import{mergeRulebookCitationsIntoMatchingLinks as d}from"./Guidelines/utils/helper.js";var s=function(n){return n?"./dual-citation?citationNumber=".concat(encodeURIComponent(n)):""};function f(f){var p=f.content,m=void 0===p?"":p,v=f.title,h=void 0===v?"":v,x=f.citations,g=void 0===x?{}:x,y=f.styles,D=void 0===y?{}:y,b=f.docData,w=void 0===b?{}:b,C=f.deviationData,S=void 0===C?null:C;f.open;var F=f.onCitationFullscreenChange,E=i(function(){return JSON.stringify(g||{})},[g]),_=i(function(){return g},[E]),j=i(function(){return JSON.stringify(w||{})},[w]),A=i(function(){return w},[j]),M=i(function(){return{citations:_,docData:A}},[_,A]),N=i(function(){var n=null==S?void 0:S.web_search_answer,r=(null==n?void 0:n.extraMetaData)||{};return Object.keys(r).reduce(function(n,r){var t=function(n,r){var t;if(!n||!r)return null;var e=null==n?void 0:n.web_search_answer,i=null===(t=null==e?void 0:e.extraMetaData)||void 0===t?void 0:t[r];return e&&i?{reasoningId:r,evaluation:n,webSearchAnswer:e,extraMetaData:i}:null}(S,r);return t&&(n[r]=t),n},{})},[S]),O=i(function(){return d(m)},[m]),R=i(function(){return{a:function(e){var i,o=e.href,a=void 0===o?"":o,l=e.children,c=e.type,d=e.reason,f=n(e,["href","children","type","reason"]),p=null==f?void 0:f["data-cognitive-reasoning"],m=!0===(i=null==f?void 0:f["dual-citation"])||"true"===i,v=m&&p?N[String(p)]:null;return t(u,{href:m?s(String(p||"")):a,children:l,citationType:m?"dual_citation":c,citationReason:d,metaData:r(r({},M),v?{webGpt:v}:{}),customStyle:v?{arrow:{color:"#6D28D9"}}:{},onFullscreenChange:F})}}},[M,N,F]);return e(o,r({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[t(o,r({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:t(a,r({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:h}))})),t(o,r({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:t(o,r({sx:{display:"flex",flexDirection:"column"}},{children:t(a,r({component:"div",sx:r({},D)},{children:t(l,r({components:R,rehypePlugins:[c]},{children:O}))}))}))}))]}))}export{f as default};
1
+ import{__rest as e,__assign as n}from"tslib";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{useMemo as i}from"react";import{Box as r,Typography as a}from"@mui/material";import l from"react-markdown";import d from"rehype-raw";import c from"./CitationAnchor.js";import{mergeRulebookCitationsIntoMatchingLinks as u}from"./Guidelines/utils/helper.js";import{useOptionalCompareContext as s}from"./CompareContext.js";import{buildOnDemandCitationContexts as f}from"./onDemandCitations/contextBuilder.js";import{getOnDemandCitationLinkKey as m}from"./onDemandCitations/href.js";import"./utils/normalizeRedlineMarkdown.js";var p=function(e){return e?"./dual-citation?citationNumber=".concat(encodeURIComponent(e)):""};function v(v){var h=v.content,x=void 0===h?"":h,C=v.title,D=void 0===C?"":C,y=v.citations,g=void 0===y?{}:y,b=v.styles,w=void 0===b?{}:b,I=v.docData,S=void 0===I?{}:I,j=v.deviationData,F=void 0===j?null:j;v.open;var M=v.onCitationFullscreenChange,E=v.tabKey,N=v.sectionTitle,T=v.referenceSectionTitle,_=v.sourceNodeId,K=v.deviationKey,R=v.baseContentId,k=v.compareContentIds,A=s(),O=null==A?void 0:A.treeData,q=null==A?void 0:A.onDemandCitationConfig,z=i(function(){return JSON.stringify(g||{})},[g]),B=i(function(){return g},[z]),G=i(function(){return JSON.stringify(S||{})},[S]),J=i(function(){return S},[G]),H=i(function(){return{citations:B,docData:J}},[B,J]),P=i(function(){return(null==q?void 0:q.enabled)?f({treeData:O,content:x,requestId:q.requestId,tabKey:E,popupNodeId:_||(null==F?void 0:F.nodeId),deviationKey:K,sectionTitle:N,referenceSectionTitle:T,docData:J,staticCitations:B,deviationData:F,cognitiveData:null,baseContentId:R,compareContentIds:k}).reduce(function(e,n){return e.set(m(n.href),n),e},new Map):new Map},[R,k,x,F,K,q,T,N,_,B,J,E,O]),U=i(function(){var e=null==F?void 0:F.web_search_answer,n=(null==e?void 0:e.extraMetaData)||{};return Object.keys(n).reduce(function(e,n){var t=function(e,n){var t;if(!e||!n)return null;var o=null==e?void 0:e.web_search_answer,i=null===(t=null==o?void 0:o.extraMetaData)||void 0===t?void 0:t[n];return o&&i?{reasoningId:n,evaluation:e,webSearchAnswer:o,extraMetaData:i}:null}(F,n);return t&&(e[n]=t),e},{})},[F]),W=i(function(){return u(x)},[x]),L=i(function(){return{a:function(o){var i,r=o.href,a=void 0===r?"":r,l=o.children,d=o.type,u=o.reason,s=e(o,["href","children","type","reason"]),f=null==s?void 0:s["data-cognitive-reasoning"],v=!0===(i=null==s?void 0:s["dual-citation"])||"true"===i,h=v&&f?U[String(f)]:null;return t(c,{href:v?p(String(f||"")):a,children:l,citationType:v?"dual_citation":d,citationReason:u,onDemandCitationContext:v?void 0:P.get(m(a)),metaData:n(n({},H),h?{webGpt:h}:{}),customStyle:h?{arrow:{color:"#6D28D9"}}:{},onFullscreenChange:M})}}},[P,H,U,M]);return o(r,n({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[t(r,n({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:t(a,n({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:D}))})),t(r,n({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:t(r,n({sx:{display:"flex",flexDirection:"column"}},{children:t(a,n({component:"div",sx:n({},w)},{children:t(l,n({components:L,rehypePlugins:[d]},{children:W}))}))}))}))]}))}export{v as default};
2
2
  //# sourceMappingURL=CitationRenderer.js.map