@viswa-test/test-citation 0.0.381 → 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
@@ -0,0 +1,2 @@
1
+ import{__assign as i}from"tslib";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Box as l}from"@mui/material";import{useMemo as n}from"react";import o from"react-markdown";import r from"rehype-raw";import a from"../PdfViewer/PdfViewer.js";import{useCompareContext as u}from"./CompareContext.js";import{SHARED_MARKDOWN_STYLES as d}from"./CognitiveCompareConfig.js";import s from"./GptWebCitationPanel.js";import{processGuidelinesMarkdown as c}from"./Guidelines/utils/processGuidelinesMarkdown.js";import g from"./ResizableSplitPane.js";var h=function(e){var l=e.label;return t("div",i({style:{padding:"12px",fontSize:"13px",color:"#475467",lineHeight:1.5}},{children:["Citation text was returned for ",l,", but a signed PDF URL is not available."]}))},m=function(e){return i(i({},(null==e?void 0:e.customMetaData)||{}),(null==e?void 0:e.custom_metadata)||{})},p=function(i,e){var t,l,n=m(i);return n.signed_url||n.signedUrl||(null==e?void 0:e.signed_url)||(null==e?void 0:e.signedUrl)||(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.signed_url)||(null===(l=null==e?void 0:e.metadata)||void 0===l?void 0:l.signedUrl)||""},v=function(t){return e("div",i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:t}))},f=function(t){var f,_,b,P=t.href,F=t.metaData,w=t.citationTitle,x=t.citationType,y=t.citationReason,C=t.isFullscreen,D=u().guidelinesData,U=function(i){try{var e=function(i){var e=i.match(/^(?:pdf_citation|deviation_summary)\$(\d+)/);if(e)try{var t=i.indexOf("?"),l=t>=0?i.slice(t):"";return{citationNumber:e[1],parsedUrl:new URL(l||"./",window.location.origin)}}catch(i){return{citationNumber:e[1],parsedUrl:null}}try{var n=new URL(i,window.location.origin);return{citationNumber:n.searchParams.get("citationNumber")||n.searchParams.get("citation_number"),parsedUrl:n}}catch(i){return{citationNumber:null,parsedUrl:null}}}(i),t=e.citationNumber,l=e.parsedUrl;return{citationNumber:t,phraseToHighlight:(null==l?void 0:l.searchParams.get("phrase_to_highlight"))||null,citationTypeFromHref:(null==l?void 0:l.searchParams.get("citation_type"))||null}}catch(i){return{citationNumber:null,phraseToHighlight:null,citationTypeFromHref:null}}}(P),N=U.citationNumber,T=U.phraseToHighlight,j=U.citationTypeFromHref,H=x||j||void 0,k="il_rulebook_citation"===H?"rulebook_citation":H,R=N&&(null===(f=null==F?void 0:F.citations)||void 0===f?void 0:f[N])||{},S=(null===(_=null==F?void 0:F.docData)||void 0===_?void 0:_.documents)||{},G=(null===(b=null==F?void 0:F.docData)||void 0===b?void 0:b.input_index_map)||{},A=Object.keys((null==F?void 0:F.citations)||{}).length>0||Object.keys((null==F?void 0:F.docData)||{}).length>0,O=null==G?void 0:G[0],M=null==G?void 0:G[1],V=O?S[O]:null,z=M?S[M]:null,L=O?R[O]:null,W=M?R[M]:null,E=m(L),$=m(W),q=p(L,V),B=p(W,z),I=n(function(){var i;return L&&V?q?e(a,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==V?void 0:V.title,pdfUrl:q,highlightText:[null!==(i=null==L?void 0:L.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null==E?void 0:E.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null==E?void 0:E.pdf_start_page_number,null==E?void 0:E.pdf_end_page_number]}):e(h,{label:"the uploaded contract"}):null},[L,E,V,q]),J=n(function(){var i;return W&&z?B?e(a,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==z?void 0:z.title,pdfUrl:B,jumpToPageValue:1,highlightText:[null!==(i=null==W?void 0:W.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null==$?void 0:$.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null==$?void 0:$.pdf_start_page_number,null==$?void 0:$.pdf_end_page_number]}):e(h,{label:"the reference contract"}):null},[W,$,z,B]),K="dual_citation"===k,Q=K&&!!(null==F?void 0:F.webGpt),X=n(function(){var t=Q?e(s,{metaData:F,isFullscreen:C}):"rulebook_citation"===k?e(l,i({sx:i(i({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},d),{overflow:"auto"})},{children:e(o,i({rehypePlugins:[r]},{children:c({guidelinesData:D,targetHighlights:[T],labelColor:"#FEF08A"})}))})):J;return I||t?e(g,!I&&t?{rightComponent:t,isFullscreen:C}:I&&!t?{leftComponent:I,isFullscreen:C}:{leftComponent:I,rightComponent:t,isFullscreen:C}):null},[I,J,k,Q,F,C,D,T]);return(null==F?void 0:F.webGpt)&&!A?e(s,{metaData:F,isFullscreen:C}):N?"rulebook_citation"===k?X?v(X):e("div",i({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:y||"Rulebook citation selected."})):K?X?v(X):(null==F?void 0:F.webGpt)?e(s,{metaData:F,isFullscreen:C}):e("div",{children:"Missing PDF Citation. Please try again later"}):["contract","clause"].includes(w)?X?v(X):e("div",{children:"Missing PDF Citation. Please try again later"}):e("div",{children:"No Citation Found. Please try again later"}):null};export{f as default};
2
+ //# sourceMappingURL=CitationRendererInner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CitationRendererInner.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as c,useEffect as a,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g,Tabs as h,Tab as m}from"@mui/material";import{ChevronDown as S}from"lucide-react";import{ButtonCognitiveIcon as x}from"../../assests/svg/ButtonCognitiveIcon.js";import R from"./OverlayComponent.js";import{safeStringify as b,extractDeviationScore as y,generateColorPalette as C,findKeyPathByNodeId as w,DEVIATION_BADGE_SEPARATOR as B,hasMeaningfulRedlineTags as _,scrollAndHighlightClause as I,scrollAndWait as F,waitForScrollIdle as T}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as A,DEFAULT_COMPARISON_CONFIG as D}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as k,EMPTY_SUMMARY_POPUP_STATE as O,DEFAULT_COMPONENT_HEADER_TEXT as P}from"./CognitiveCompareConstants.js";import j from"./CognitivePopup.js";import L from"./MoreFunctionsPopup.js";import N from"./LoaderComponent.js";import M from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as H}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as W}from"./hooks/useSectionRefs.js";import{useAccordionState as q}from"./hooks/useAccordionState.js";import{useDeviationNavigation as G}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import K from"./components/SubSectionAccordion.js";import J from"./components/LHSSectionRow.js";import Y from"./components/RHSSectionRow.js";import X from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as $}from"./CompareContext.js";import{useStyleHelpers as U}from"./hooks/useStyles.js";import{useResizeHandler as Q}from"./hooks/useResizeHandler.js";import{useLinesCalculator as Z}from"./hooks/useLinesCalculator.js";import{useSideBySide as ee}from"./hooks/useSideBySide.js";import ne from"./components/SvgConnectors.js";import ie from"./Guidelines/components/GuidelinePanel.js";import te from"./Guidelines/components/WebGptPanel.js";var oe=function(oe){var re,le,ue,ce,ae,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ie,Fe,Te,Ee,Ae,De,ke,Oe,Pe,je,Le,Ne,Me,He=oe.componentHeaderText,ze=void 0===He?P:He,We=oe.treeData,qe=oe.comparisonConfig,Ge=oe.leftColumnTitleText,Ve=oe.rightColumnTitleText,Ke=oe.markdownStyles,Je=oe.resetTrigger,Ye=oe.displayConfig,Xe=void 0===Ye?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Ye,$e=oe.onMaintainRelativeOrderChange,Ue=oe.popupConfig,Qe=oe.deviationData,Ze=void 0===Qe?{}:Qe,en=oe.deviationNodeIdToView,nn=oe.resetDeviationNodeId,tn=oe.isProposingFix,on=void 0!==tn&&tn,rn=oe.proposingFixNodeId,ln=oe.isRedlineFlow,un=oe.badgeStyleOverride,cn=oe.guidelinesData,an=oe.gptWebCitationConfig,sn=l(Xe.maintainRelativeOrder),dn=sn[0],vn=sn[1],fn=null!==(re=null==Xe?void 0:Xe.expandLevels)&&void 0!==re?re:0,pn=!!(null==Xe?void 0:Xe.expandAllSections),gn=!!dn||!!(null==Xe?void 0:Xe.showDeviationBadges),hn=l(!1),mn=hn[0],Sn=hn[1],xn=l(null),Rn=xn[0],bn=xn[1],yn=l(null===(ue=null!==(le=null==We?void 0:We.newEvaluationResult)&&void 0!==le?le:null==Xe?void 0:Xe.enableDeviationSchemaBackwardCompatibility)||void 0===ue||ue)[0],Cn=l(new Set),wn=Cn[0],Bn=Cn[1],_n=l([]),In=_n[0],Fn=_n[1],Tn=l(!1),En=Tn[0],An=Tn[1],Dn=l(0),kn=Dn[0],On=Dn[1],Pn=u(null),jn=u(null),Ln=u(null),Nn=u(null),Mn=u(null),Hn=u(!1),zn=u(null),Wn=u({}),qn=u([]),Gn=u(function(){}),Vn=u(null),Kn=u(function(){}),Jn=c(function(){return JSON.stringify(Ze||{})},[JSON.stringify(Ze)]),Yn=c(function(){return Ze||{}},[Jn]),Xn=c(function(){return(null==We?void 0:We.cognitive_decisioning)||{}},[We]),$n=c(function(){return e(e({},E),Ke)},[Ke]),Un=u(null),Qn=u(null),Zn=u(null),ei=u(null),ni=u(null),ii=u(null),ti=u(null),oi=u(null),ri=u(null),li=u(null),ui=z(Un),ci=ui.cognitivePopup,ai=ui.setCognitivePopup,si=ui.moreFunctions,di=ui.setMoreFunctions,vi=ui.position,fi=ui.setPosition,pi=ui.activeBadgeId,gi=ui.summaryPopup,hi=ui.setSummaryPopup,mi=ui.closeSummaryPopup,Si=ui.setActiveBadgeId,xi=ui.popupRef,Ri=ui.handleOpenCognitiveCompare,bi=ui.openCognitivePopupFromState,yi=ui.closeCognitivePopup,Ci=ui.closeMoreFunctionsPopup,wi=c(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==qe?void 0:qe.fields)&&void 0!==e?e:A,thresholds:{high:null!==(i=null===(n=null==qe?void 0:qe.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:D.thresholds.high,medium:null!==(o=null===(t=null==qe?void 0:qe.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:D.thresholds.medium,exact:null!==(l=null===(r=null==qe?void 0:qe.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:D.thresholds.exact}}},[qe]),Bi=l(null),_i=Bi[0];Bi[1];var Ii=null===(se=null===(ce=null==We?void 0:We.documents)||void 0===ce?void 0:ce[null===(ae=null==We?void 0:We.input_index_map)||void 0===ae?void 0:ae[0]])||void 0===se?void 0:se.title,Fi=null===(fe=null===(de=null==We?void 0:We.documents)||void 0===de?void 0:de[null===(ve=null==We?void 0:We.input_index_map)||void 0===ve?void 0:ve[1]])||void 0===fe?void 0:fe.title,Ti=b(Ge||Ii||"Uploaded Contract"),Ei=null===(me=null===(he=null===(pe=null==We?void 0:We.documents)||void 0===pe?void 0:pe[null===(ge=null==We?void 0:We.input_index_map)||void 0===ge?void 0:ge[0]])||void 0===he?void 0:he.metadata)||void 0===me?void 0:me.file_name,Ai=b(Ei),Di=null===(be=null===(Re=null===(Se=null==We?void 0:We.documents)||void 0===Se?void 0:Se[null===(xe=null==We?void 0:We.input_index_map)||void 0===xe?void 0:xe[1]])||void 0===Re?void 0:Re.metadata)||void 0===be?void 0:be.file_name,ki=b(Di),Oi=b(Ve||Fi||"Reference Template"),Pi=H(We,dn,Yn,wi,yn,cn),ji=Pi.isGuidelineMode,Li=Pi.activeProposed,Ni=Pi.existingRule,Mi=Pi.proposedSections,Hi=Pi.existingSections,zi=Pi.visibleFields,Wi=Pi.parentDeviationRecord,qi=Pi.deviationNumberRegistry,Gi=Pi.deviationParentRegistry,Vi=Pi.parseError;a(function(){Vi&&bn("Failed to load comparison: ".concat(Vi))},[Vi]);var Ki=Mi.length>0||Hi.length>0,Ji=c(function(){if(!ln)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";_(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Mi),i(Hi),"".concat(e,":").concat(n)},[ln,Mi,Hi]);a(function(){if(Mi.length||Hi.length)if(pn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=dn?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(Mi,"left"),i(Hi,"right"),Tt(e),At(n)}else if(fn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=dn?"".concat(n,"-").concat(r):String(r);t[u]=!0}var c=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&c(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&c(e.subsections,String(r),2)})};r(Mi,"left",fn),r(Hi,"right",fn),Tt(t),At(o)}},[pn,fn,Mi,Hi,dn]);var Yi=W(zi.map(function(e){return e.key}),Math.max(Mi.length,Hi.length)),Xi=Yi.leftRefs,$i=Yi.rightRefs,Ui=Yi.sectionLeftRefs,Qi=Yi.sectionRightRefs,Zi=Yi.lhsBadgeRefs,et=Yi.rhsBadgeRefs,nt=Yi.sectionRightRowRefs,it=Yi.subSectionLeftRefs,tt=Yi.subSectionRightRefs,ot=Yi.sectionRowRefs,rt=Yi.getSectionRowRef,lt=Yi.getSubSectionRef,ut=Yi.getBadgeRef,ct=ee({isGuidelineMode:ji,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,leftContainerRef:oi,rightContainerRef:Zn,scrollContainerRef:Un,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,sectionRowRefs:ot,sectionRightRowRefs:nt,rhsTopSpacerRef:ei,rhsBottomSpacerRef:ni,lhsTopSpacerRef:ii,lhsBottomSpacerRef:ti,calculateLinesRef:Gn,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,closeMoreFunctionsPopup:Ci,setErrorToast:bn,moreFunctions:si,closeSummaryPopup:mi}),at=ct.isSideBySide,st=ct.isArrowVisible,dt=ct.setIsArrowVisible,vt=ct.isResizing,ft=ct.setIsResizing,pt=ct.isSideBySideLoading,gt=ct.activeSideBySideSection,ht=ct.scrollLock,mt=ct.sideBySideCacheRef,St=ct.isSideBySideRef,xt=ct.activeSideBySideRightSectionRef,Rt=ct.activeSideBySideSectionRef,bt=ct.sideBySideLineRef,yt=ct.highlightedClauseRefs,Ct=ct.clearClauseHighlight,wt=ct.resetSideBySide,Bt=ct.activateSideBySide,_t=u(Bt);a(function(){_t.current=Bt},[Bt]);var It=q({maintainRelativeOrder:!!dn,proposedSections:Mi,existingSections:Hi,activeSideBySideSection:gt,connectedSections:wn,resetSideBySide:wt,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,svgContainerRef:Pn,isAnimatingRef:Hn,animationTimerRef:zn,calculateLinesRef:Gn,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt}),Ft=It.expandedSections,Tt=It.setExpandedSections,Et=It.expandedSubSections,At=It.setExpandedSubSections,Dt=It.handleSubSectionToggle,kt=It.toggleSection,Ot=It.forceExpandCrossWiredSections,Pt=function(){var e,n;if(null!=gt){var i=null===(e=Ui.current[gt])||void 0===e?void 0:e.current,t=null===(n=Qi.current[gt])||void 0===n?void 0:n.current,o=Zn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),c=r.top-u.top,a=l.top-u.top-c;o.scrollBy({top:a,behavior:"smooth"})}}},jt=s(function(e){null==e||e.stopPropagation(),An(function(e){var n=!e;return n&&requestAnimationFrame(function(){Pt()}),n})},[Pt]);a(function(){ln&&"off"!==Ji&&"0:0"!==Ji&&(mt.current=null,qn.current=[],requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)}))},[ln,Ji]);var Lt=c(function(){var e=new Map,n=new Map,i=1;if(dn)Mi.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),Hi.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Mi.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Mi.length,Hi.length),o=0;o<t;o++){var r=Mi[o],l=Hi[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Mi,Hi,dn]),Nt=Ni.analysis,Mt=b(null===(Ce=null===(ye=null==Nt?void 0:Nt.rule_difference_comparison)||void 0===ye?void 0:ye.summary)||void 0===Ce?void 0:Ce.overall_summary),Ht=!!Mt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),zt=null!==(we=null==We?void 0:We.base_root_id)&&void 0!==we?we:"-1";null==We||We[zt];var Wt=yn?null!==(je=null!==(ke=Ze&&(null===(De=null==Ze?void 0:Ze[zt])||void 0===De?void 0:De.evaluation_result))&&void 0!==ke?ke:null===(Pe=null===(Oe=null==We?void 0:We.nodes)||void 0===Oe?void 0:Oe[zt])||void 0===Pe?void 0:Pe.evaluation_result)&&void 0!==je?je:null:null!==(Ae=null!==(Ie=Ze&&(null===(_e=null===(Be=null==Ze?void 0:Ze[zt])||void 0===Be?void 0:Be.evaluation_result)||void 0===_e?void 0:_e[0]))&&void 0!==Ie?Ie:null===(Ee=null===(Te=null===(Fe=null==We?void 0:We.nodes)||void 0===Fe?void 0:Fe[zt])||void 0===Te?void 0:Te.evaluation_result)||void 0===Ee?void 0:Ee[0])&&void 0!==Ae?Ae:null,qt=y(Wt),Gt=C(null!==(Me=null===(Ne=null===(Le=null==Wt?void 0:Wt.evaluation_outputs)||void 0===Le?void 0:Le.metadata)||void 0===Ne?void 0:Ne.label_color)&&void 0!==Me?Me:k);if(un){var Vt=un(qt);Vt&&(Gt=e(e({},Gt),{badgeBg:Vt.bg,badgeText:Vt.text,badgeBorder:Vt.border}))}var Kt=u(wt);a(function(){Kt.current=wt},[wt]);var Jt=u(yi);a(function(){Jt.current=yi},[yi]);var Yt=s(function(e,n,i,t,o,r){return or.current(e,n,i,t,o,r)},[]),Xt=s(function(e,n,i,t,o){return lr.current(e,n,i,t,o)},[]),$t=s(function(){return ur.current()},[]),Ut=s(function(e,n){return cr.current(e,n)},[]),Qt=s(function(e){return ar.current(e)},[]),Zt=s(function(e){return sr.current(e)},[]),eo=s(function(){return dr.current()},[]),no=s(function(){var e,n;Ct(),null===(e=Kt.current)||void 0===e||e.call(Kt),An(!1),Bn(new Set),Fn([]),qn.current=[],wo([]),_o(null),hi(O),null===(n=Jt.current)||void 0===n||n.call(Jt),requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)})},[]),io=u(no);a(function(){io.current=no},[no]),a(function(){Je&&io.current()},[Je]);var to=c(function(){return{documents:null==We?void 0:We.documents,input_index_map:null==We?void 0:We.input_index_map}},[JSON.stringify(null==We?void 0:We.documents),JSON.stringify(null==We?void 0:We.input_index_map)]),oo=l(""),ro=oo[0],lo=oo[1],uo=u(We);a(function(){var e,n,i;uo.current=We;var t=null===(e=null==We?void 0:We.input_index_map)||void 0===e?void 0:e[0],o=null===(i=null===(n=null==We?void 0:We.documents)||void 0===n?void 0:n[t])||void 0===i?void 0:i.title;lo(o)},[We]);var co=u(Xn);a(function(){co.current=Xn},[Xn]);var ao=s(function(n,i,t,o,r,l,u){var c,a,s,d,v,f,p,g,h,m,S=b(null==i?void 0:i.id)||b(null==t?void 0:t.id)||"",x=(S?null===(c=co.current)||void 0===c?void 0:c[S]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:S,decisioning:[],gap:[],relevance_score:0},R=null!==(s=null===(a=ot.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null,y=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(B)))return u(l);var c=o.split(B)[1];if(!c)return l;var a=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==a?void 0:a.deviation_entries)||void 0===n?void 0:n[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return s?e(e(e({},a),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),C=(null!==(f=null===(v=null===(d=null==y?void 0:y.cognitive_decisioning)||void 0===d?void 0:d.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==f?f:0)>0||(null!==(h=null===(g=null===(p=null==y?void 0:y.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===g?void 0:g.length)&&void 0!==h?h:0)>0,w=null!==(m=null==Xe?void 0:Xe.isLoading)&&void 0!==m&&m,_=!0;if(ji){var I=null==y?void 0:y.deviation_highlights;if(I&&"object"==typeof I)_=Object.values(I).some(function(e){return Array.isArray(e)&&e.length>0});else _=!1}return{isLoading:w&&!C,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:x,anchorEl:n,sectionAnchorEl:R,badgeStyle:l||null,sectionIdx:o,docData:to,deviationData:y,isOrphan:!!r,hasGuidelineMatches:_}},[to,null==Xe?void 0:Xe.isLoading,ji]),so=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),si.open&&si.sectionIdx===o)Ci();else{var u=e.currentTarget,c="left";(null===(l=Zn.current)||void 0===l?void 0:l.contains(u))&&(c="right");Ct(),St.current&&wt(),Bn(new Set),Fn([]),qn.current=[],yi(),gi.open?Mo():mi(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(B)){var r=o.split(B),l="".concat(r[0]).concat(B).concat(r[1]);return"right"===c?null===(e=et.current[l])||void 0===e?void 0:e.current:null===(n=Zi.current[l])||void 0===n?void 0:n.current}return"right"===c?null===(i=et.current[o])||void 0===i?void 0:i.current:null===(t=Zi.current[o])||void 0===t?void 0:t.current}()||u;di(ao(e,n,t,o,i,r))})}},[si.open,si.sectionIdx,Ci,mi,ao]),vo=s(function(){var e=si.sectionIdx;si.isOrphan,Ci(),mi(),null!==e&&(Ot(e),Ct(),St.current&&wt(),Fn([]),qn.current=[],ji&&null!==e&&On(jo(e)),Bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Gn.current&&Gn.current()},50))},[si.sectionIdx,si.isOrphan,Ci,mi,wt]),fo=s(function(){var e=Mn.current;if(e){Mn.current=null;var n=Mi.findIndex(function(n){return n.id===e}),i=Hi.findIndex(function(n){return n.id===e}),t=-1===n?w(Mi,e):null,o=-1===i?w(Hi,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(yt.current.add(r),I(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(dn)-1!==r&&oi.current&&c(function(){return u(n,t,Ui,it)},oi.current),-1!==l&&Zn.current&&c(function(){return u(i,o,Qi,tt)},Zn.current);else{var a=Un.current;if(!a)return;c(function(){return-1!==r?u(n,t,Ui,it):u(i,o,Qi,tt)},a)}}},[Mi,Hi,dn,Ui,Qi,it,tt,oi,Zn,Un]),po=s(function(n){if(n){Ct(),wt(),Bn(new Set),Fn([]),qn.current=[],mi(),yi();var i=Mi.findIndex(function(e){return e.id===n}),t=Hi.findIndex(function(e){return e.id===n}),o=-1===i?w(Mi,n):null,r=-1===t?w(Hi,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;Mn.current=n,Tt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=dn?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=dn?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),At(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){Mn.current===n&&go.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Mi,Hi,dn,Tt,At,wt,mi,yi]),go=u(fo);a(function(){go.current=fo},[fo]);var ho=u(null);a(function(){if(_i){var e=wi.fields.find(function(e){return e.analysisKey===_i||e.key===_i});if(e){var n=Xi.current[e.key]||$i.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[_i,wi.fields]);var mo=s(function(e){var n,i,t,o,r,l,u,c,a,s=null===(n=null==Nt?void 0:Nt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Nt]),So=U({proposedSections:Mi,existingSections:Hi,maintainRelativeOrder:dn,cognitiveMap:Xn,deviationData:Yn,treeData:We,resolvedComparisonConfig:wi,badgeStyleOverride:un}),xo=So.getSectionCompareStyle,Ro=So.getSubSectionCompareStyle,bo=So.getDeviationStyleByKey,yo=Z({containerRef:jn,leftContainerRef:oi,rightContainerRef:Zn,svgContainerRef:Pn,pathRefs:Wn,leftHeaderRef:Ln,rightHeaderRef:Nn,proposedSections:Mi,existingSections:Hi,visibleFields:zi,leftRefs:Xi,rightRefs:$i,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,sectionRowRefs:ot,expandedSections:Ft,expandedSubSections:Et,connectedSections:wn,isSideBySide:at,activeSideBySideSection:gt,maintainRelativeOrder:dn,isGuidelineMode:ji,cognitiveMap:Xn,getSectionCompareStyle:xo,getSubSectionCompareStyle:Ro,getDeviationStyleByKey:bo,isArrowVisible:st,isAnimatingRef:Hn,isSideBySideRef:St,sideBySideCacheRef:mt,sideBySideLineRef:bt,activeSideBySideSectionRef:Rt,activeSideBySideRightSectionRef:xt,connectedLines:In,setConnectedLines:Fn,cachedConnectedPositions:qn,calculateLinesRef:Gn,resizeTimerRef:Vn,scrollLock:ht,scrollSyncLocked:En,handleResizeRef:Kn,activeProposed:Li,existingRule:Ni,analysisData:Nt,pendingScrollTargetRef:ri,pendingScrollCallbackRef:li,resolvedComparisonConfig:wi,getFieldData:mo}),Co=yo.lines,wo=yo.setLines,Bo=yo.overallConnector,_o=yo.setOverallConnector,Io=yo.svgDimensions,Fo=yo.handleColumnScroll;a(function(){gi.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)})})},[gi.anchorEl,En]);var To=s(function(){Ct(),An(!1),Tt({}),At({}),wt(),Bn(new Set),Fn([]),qn.current=[],mi(),yi(),Ci(),requestAnimationFrame(function(){Gn.current&&Gn.current()})},[Tt,At,wt,mi,yi,Ci]);a(function(){at||0!==wn.size||An(!1)},[at,wn]);var Eo=c(function(){return Object.values(Ft).some(Boolean)||Object.values(Et).some(Boolean)},[Ft,Et]),Ao=u(null),Do=u(0),ko=u(0),Oo=u(0),Po=Q({timerRef:Ao,ruleComponentRef:Qn,scrollContainerRef:Un,containerRef:jn,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,isSideBySideRef:St,activeSideBySideSectionRef:Rt,activeSideBySideRightSectionRef:xt,sectionRowRefs:ot,sectionRightRowRefs:nt,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,leftContainerRef:oi,rightContainerRef:Zn,calculateLinesRef:Gn,handleResizeRef:Kn,setIsResizing:ft,setIsArrowVisible:dt,sideBySideCacheRef:mt,cachedConnectedPositions:qn}).handleResize;a(function(){Kn.current=Po},[Po,Kn]),a(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Qn.current&&o.push(e(Qn.current,Do,n,function(){return Kn.current()},function(){})),Un.current&&o.push(e(Un.current,ko,i,function(){return Kn.current()},function(){return Gn.current()})),jn.current&&o.push(e(jn.current,Oo,t,function(){return Kn.current()},function(){return Gn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),a(function(){St.current=at},[at]),a(function(){Rt.current=gt},[gt]);var jo=s(function(e){var n,i,t,o,r,l="",u="0";if("number"==typeof e)l=(null===(n=Mi[e])||void 0===n?void 0:n.nodeId)||(null===(i=Mi[e])||void 0===i?void 0:i.id)||"";else{var c=String(e).split(B);l=c[0],u=c[1]||"0"}var a=null===(t=null==Yn?void 0:Yn[l])||void 0===t?void 0:t.evaluation_result,s=Array.isArray(a)?a[parseInt(u,10)]:null==a?void 0:a[u];return!1===(null===(r=null===(o=null==s?void 0:s.evaluation_outputs)||void 0===o?void 0:o.guideline_flag)||void 0===r?void 0:r.rulebook_used)?1:0},[Mi,Yn]),Lo=s(function(e){var n,i,t=document.querySelectorAll('[id^="guideline-target-"], [data-web-gpt-active="true"]'),o=oi.current,r=Zn.current,l="string"==typeof e&&e.includes(B),u=e;if(l){var c=e.split(B);c.length>=2&&(u="".concat(c[0]).concat(B).concat(c[1]))}var a=(null===(n=Zi.current[u])||void 0===n?void 0:n.current)||(null===(i=Zi.current[e])||void 0===i?void 0:i.current);if(t.length>0&&a&&o&&r){var s=t[0];ii.current&&(ii.current.style.height="0px"),ei.current&&(ei.current.style.height="0px"),ti.current&&(ti.current.style.height="0px"),ni.current&&(ni.current.style.height="0px"),requestAnimationFrame(function(){var e=a.getBoundingClientRect(),n=s.getBoundingClientRect(),i=o.getBoundingClientRect(),t=r.getBoundingClientRect(),l=o.scrollTop+(e.top-i.top)+e.height/2,u=r.scrollTop+(n.top-t.top)+n.height/2,c=l-i.height/2,d=Math.max(0,c),v=o.scrollHeight-o.clientHeight,f=d>v?d-v:0,p=i.top+l-d,g=t.top+u-p,h=0;g<0&&(h=Math.abs(g),g=0);var m=r.scrollHeight-r.clientHeight+h,S=g>m?g-m:0;ti.current&&(ti.current.style.height="".concat(f,"px")),ei.current&&(ei.current.style.height="".concat(h,"px")),ni.current&&(ni.current.style.height="".concat(S,"px")),requestAnimationFrame(function(){o.scrollTo({top:d,behavior:"smooth"}),r.scrollTo({top:g,behavior:"smooth"}),Gn.current&&setTimeout(function(){return Gn.current()},50)})})}},[B]),No=s(function(){var e,n=si.sectionIdx,i=si.isOrphan;if(mi(),null!=n){var t="left";si.anchorEl&&(null===(e=Zn.current)||void 0===e?void 0:e.contains(si.anchorEl))&&(t="right"),Ot(n),ji&&(On(jo(n)),Bn(new Set([n]))),Bt(n,i,{sourceSide:t,onReady:function(){ji&&setTimeout(function(){return Lo(String(n))},150)}})}},[Bt,si.isOrphan,si.sectionIdx,si.anchorEl,mi,Ot,ji,Lo,jo]),Mo=s(function(){mi(),wt(),Bn(new Set),Fn([]),qn.current=[]},[mi,wt]),Ho=null!==si.sectionIdx&&wn.has(si.sectionIdx),zo=G({proposedSections:Mi,existingSections:Hi,parentDeviationRecord:Wi,expandedSections:Ft,maintainRelativeOrder:!!dn,scrollContainerRef:Un,leftContainerRef:oi,rightContainerRef:Zn,lhsBadgeRefs:Zi,rhsBadgeRefs:et}),Wo=zo.showDeviationNavigation,qo=zo.showOpenNodeRef,Go=zo.adjustScrollForPopup,Vo=s(function(e,n,i,t,o){var r,l="string"==typeof t?b(t).trim():b(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;yi();var c="left";(null===(r=Zn.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var e,i,t,o;if("string"==typeof n&&n.includes(B)){var r=n.split(B),l="".concat(r[0]).concat(B).concat(r[1]);return"right"===c?null===(e=et.current[l])||void 0===e?void 0:e.current:null===(i=Zi.current[l])||void 0===i?void 0:i.current}return"right"===c?null===(t=et.current[n])||void 0===t?void 0:t.current:null===(o=Zi.current[n])||void 0===o?void 0:o.current};if(i&&!ji)return wt(),Bn(new Set),Fn([]),qn.current=[],void(l&&(Ot(n),requestAnimationFrame(function(){var e=a()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));hi({open:!0,anchorEl:e,summary:t,displayImpact:o})})));Ot(n),ji&&(On(jo(n)),Bn(new Set([n]))),l?setTimeout(function(){Bt(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e,i,r,l=a()||u;if(ji)setTimeout(function(){return Lo(n)},150);else if(l){var c=l.getBoundingClientRect();if(c.top>.8*window.innerHeight||c.top<100){var s=c.top-window.innerHeight/2;dn?(null===(e=oi.current)||void 0===e||e.scrollBy({top:s,behavior:"smooth"}),null===(i=Zn.current)||void 0===i||i.scrollBy({top:s,behavior:"smooth"})):null===(r=Un.current)||void 0===r||r.scrollBy({top:s,behavior:"smooth"})}}hi({open:!0,anchorEl:l,summary:t,displayImpact:o})}})},350):setTimeout(function(){Bt(n,i,{toggleIfSame:!1,sourceSide:c}),ji&&setTimeout(function(){return Lo(n)},150)},350)},[Bt,yi,hi,wt,Ot,ji,dn,Lo,Yn]),Ko=c(function(){var e;if(!en)return null;var n=null===(e=null==en?void 0:en.id)||void 0===e?void 0:e.split(":")[0];for(var i in Wi){if((Wi[i]||[]).some(function(e){return e.id===n}))return i}return null},[en,Wi]),Jo=u({id:null,triggerMs:null}),Yo=u(null);a(function(){if(null==en?void 0:en.id){var o=Number(en.trigger),r=Jo.current;if((null==r?void 0:r.id)!==en.id||(null==r?void 0:r.triggerMs)!==o){if(en.id.includes(":")&&/:\d+$/.test(en.id)){var l=en.id.split(":"),u=l[0],c=l[1],a=null!=c?c:"0",s="".concat(en.id,":").concat(o);Yo.current!==s&&(mi(),yi(),wt(),Bn(new Set),Fn([]),qn.current=[],Yo.current=s);var d=!1,v=0,f=null,p=null,g=!1,h=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},m=function(){var r,l,c;if(!d){var s=function(){Jo.current={id:en.id,triggerMs:o}},S=null,x=null;for(var R in Wi){var b=Wi[R].find(function(e){var n;return e.id===u||e.nodeId===u||e.contentId===u||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===u});if(b){S=R,x=b;break}}if(x&&S){var y=Array.from(new Set([u,x.id,x.nodeId,x.contentId,null===(r=x.evaluationResult)||void 0===r?void 0:r.nodeId].filter(Boolean))),C=Mi.findIndex(function(e){return e.id===S}),w=Hi.findIndex(function(e){return e.id===S}),_=-1===C&&-1!==w,I=h(Mi,y),E=h(Hi,y);if(I&&!E&&!_){var A=I.split("-"),D=Number(A[0]);if(dn){var k=null===(c=null===(l=Mi[D])||void 0===l?void 0:l.refIndexes)||void 0===c?void 0:c[0],O=Hi.findIndex(function(e){return e.selfIndex===k});-1!==O&&(D=O)}E=n([D],A.slice(1),!0).join("-")}if(I||E){var P=I?Number(I.split("-")[0]):C,j=E?Number(E.split("-")[0]):w,L=j>=0?j:E?Number(E.split("-")[0]):-1,N=Mi[P],M=Hi[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,W=_||(!I&&!!E||H&&!z);if(W){if(!(dn?!!rr.current["right-".concat(j)]:!!rr.current[String(j)])&&j>=0)return kt(j,"right"),void(f=setTimeout(m,200))}else if(!(dn?!!rr.current["left-".concat(P)]:!!rr.current[String(P)])&&P>=0)return kt(P,"left"),void(f=setTimeout(m,200));var q=I||"",G=E||"",V=y.map(function(e){return"".concat(e).concat(B).concat(a)}),K=V[0],J=function(){for(var e,n,i=0,t=V;i<t.length;i++){var o=t[i],r=(null===(e=Zi.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=et.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:K,left:null,right:null}},Y=function(e){return"".concat(e).concat(B).concat(q).concat(B).concat(G)};if(!g){Ot(Y(K)),g=!0,v=0;var X=function(){var e=J(),n=e.left,i=e.right;return W||!n&&!!i?i:n};return null==p||p(),void(f=setTimeout(function(){var e,n,i,t,o,r,l,u;d||(e=X,n=function(){d||(p=null,m())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!d)if(performance.now()-l>3e3)n();else{var c=e();if(c&&0!==c.getBoundingClientRect().height){var a=c.getBoundingClientRect(),s=a.top,v=a.height,f=null!==o&&Math.abs(s-o)<.5,p=null!==r&&Math.abs(v-r)<.5;if(f&&p){if(++t>=5)return void n()}else t=0;o=s,r=v,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),p=function(){return cancelAnimationFrame(i)})},300))}var $=J(),U=$.refId,Q=$.left,Z=$.right,ee=Y(U);if(Q||Z){var ne=W||!Q&&!!Z,ie=ne?Z:Q,te=dn?ne?Zn.current:oi.current:Un.current;if(ie&&te){var oe=ie.getBoundingClientRect();if(0!==oe.height){var re=te.getBoundingClientRect(),le=oe.top-re.top+te.scrollTop-re.height/2+oe.height/2,ue=(null==I?void 0:I.includes("-"))||(null==E?void 0:E.includes("-")),ce=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,c,v,f,p;return t(this,function(t){switch(t.label){case 0:return d?[2]:(s(),n=ie instanceof Element?window.getComputedStyle(ie).color:"",[Q,Z].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[Q,Z].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(c=null===(u=x.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===c?void 0:c[a])||x,o=(null===(v=x.evaluationResult)||void 0===v?void 0:v.evaluation_outputs)||x.evaluation_outputs,!!Q&&!!Z||ji?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},dn?[4,Promise.all([oi.current?l(T(oi.current),600):Promise.resolve(),Zn.current?l(T(Zn.current),600):Promise.resolve()])]:[3,2]):(r=ne?(null===(f=et.current[ue?U:j])||void 0===f?void 0:f.current)||Z:(null===(p=Zi.current[ue?U:P])||void 0===p?void 0:p.current)||Q,Go(r,function(){hi({open:!0,anchorEl:r,displayImpact:en.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==nn||nn(),[2]));case 1:t.sent(),t.label=2;case 2:return ji&&(On(jo(ee)),Bn(new Set([ee]))),_t.current(ee,!1,{toggleIfSame:!1,sourceSide:_?"right":"left",onReady:function(){var n,t,o,r;s();var l=ne?(null===(n=et.current[U])||void 0===n?void 0:n.current)||Z:(null===(t=Zi.current[U])||void 0===t?void 0:t.current)||Q;if(ji)setTimeout(function(){return Lo(ee)},150);else{var u=(null===(o=Zi.current[U])||void 0===o?void 0:o.current)||Q,c=(null===(r=et.current[U])||void 0===r?void 0:r.current)||Z;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),c&&(c.style.scrollMarginTop="150px",c.scrollIntoView({behavior:"smooth",block:"start"}))}hi({open:!0,anchorEl:l,displayImpact:en.displayImpact,summary:e({},i)}),null==nn||nn()}}),[2]}})})};Math.abs(te.scrollTop-le)<=2?ce():F(te,le,ce)}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}};return f=setTimeout(m,100),function(){d=!0,f&&clearTimeout(f),null==p||p()}}Jo.current={id:en.id,triggerMs:o},po(en.id);var S=Mi.findIndex(function(e){return e.id===en.id}),x=Hi.findIndex(function(e){return e.id===en.id});-1===S&&-1===x||setTimeout(function(){var e=-1!==S?S:x,n=-1===S;ji&&On(jo(e)),Bn(new Set([e])),_t.current(e,n,{sourceSide:n?"right":"left",onReady:function(){ji&&setTimeout(function(){return Lo(String(e))},150)}})},400)}}},[null==en?void 0:en.id,null==en?void 0:en.trigger,null==en?void 0:en.displayImpact,Wi,Mi,Hi,dn,hi,po,ji,jo,Lo]),a(function(){var n,i,t;if(gi.open){var o=gi.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(Zi.current)||r(et.current);if(l){var u=(null===(i=et.current[l])||void 0===i?void 0:i.current)||(null===(t=Zi.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&hi(function(n){return e(e({},n),{anchorEl:u})})}}}},[gi.open,gi.anchorEl,En,wn,Ft]);var Xo=ci.open,$o=ci.sectionIdx,Uo=ci.isOrphan,Qo=ci.badgeStyle,Zo=ci.anchorEl,er=ci.sectionAnchorEl;a(function(){var n;if(Xe.isStreamingEnabled&&Xo&&null!=$o&&$o!==zt){var i="string"==typeof $o?$o.split(B)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(Mi,i):null,r=i&&"string"==typeof i?t(Hi,i):null,l="number"==typeof $o?Mi[$o]||null:o||i&&((null===(n=null==We?void 0:We.nodes)||void 0===n?void 0:n[i])||(null==We?void 0:We[i]))||null,u="number"==typeof $o?Hi[$o]||null:r,c=ao(Zo,l,u,$o,Uo,Qo);ai(function(n){return n.open?b(n.cognitiveData)===b(c.cognitiveData)&&b(n.deviationData)===b(c.deviationData)&&n.sectionTitle===c.sectionTitle&&n.refSectionTitle===c.refSectionTitle?n:e(e(e({},n),c),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Xo,$o,Uo,Qo,Zo,er,Mi,Hi,ao]);var nr=s(function(e){var n=e.section,i=e.keyPath,t=e.depth,r=void 0===t?0:t,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c,s=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return o(K,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:a,sectionOffset:s,rhsOrphanVisualIndexes:d})},[]),ir=c(function(){return Mi.map(function(e,n){var i,t,r=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),l=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return r&&l&&dn?null:o(J,{section:e,idx:n},null!==(t=null!==(i=null==e?void 0:e.layoutKey)&&void 0!==i?i:null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(n))})},[Mi,dn]),tr=c(function(){return Hi.map(function(e,n){var i,t,r=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),l=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return r&&l&&dn?null:o(Y,{section:e,idx:n},null!==(t=null!==(i=null==e?void 0:e.layoutKey)&&void 0!==i?i:null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(n))})},[Hi,dn]),or=u(so);a(function(){or.current=so},[so]);var rr=u(Ft);a(function(){rr.current=Ft},[Ft]);var lr=u(Vo);a(function(){lr.current=Vo},[Vo]);var ur=u(Mo);a(function(){ur.current=Mo},[Mo]);var cr=u(kt);a(function(){cr.current=kt},[kt]);var ar=u(Dt);a(function(){ar.current=Dt},[Dt]);var sr=u(nr);a(function(){sr.current=nr},[nr]);var dr=u(wt);a(function(){dr.current=wt},[wt]);var vr=c(function(){return{isGuidelineMode:ji,maintainRelativeOrder:!!dn,showDeviationBadges:gn,isProposingFix:on,proposingFixNodeId:rn,isRedlineFlow:ln,isSideBySide:at,activeSideBySideSection:gt,scrollSyncLocked:En,toggleScrollSyncLocked:jt,summaryPopupAnchorEl:gi.anchorEl,connectedSections:wn,proposedSections:Mi,existingSections:Hi,deviationNumberRegistry:qi,deviationParentRegistry:Gi,treeData:We,displayConfig:Xe,resolvedMarkdownStyles:$n,unifiedNumbering:Lt,expandedSections:Ft,expandedSubSections:Et,setExpandedSubSections:At,getSectionCompareStyle:xo,getSubSectionCompareStyle:Ro,getBadgeRef:ut,getSectionRowRef:rt,getSubSectionRef:lt,sectionLeftRefs:Ui,sectionRightRefs:Qi,sectionRowRefs:ot,sectionRightRowRefs:nt,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,openMoreFunctionsPopup:Yt,handleOpenSummaryPopup:Xt,openSummaryPopup:Xt,handleCloseSummaryPopup:$t,toggleSection:Ut,handleSubSectionToggle:Qt,renderSubSectionAccordion:Zt,resetSideBySide:eo,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,showDeviationNavigation:Wo,showOpenNodeRef:qo,deviationNodeIdToView:null==en?void 0:en.id,deviationTargetParentId:Ko,guidelinesData:cn,gptWebCitationConfig:an}},[ji,dn,gn,on,rn,ln,at,gt,En,jt,gi.anchorEl,wn,Mi,Hi,qi,Xe,$n,Lt,Ft,Et,At,xo,Ro,ut,rt,lt,Wo,qo,en,Ko,cn,an]),fr=b(ci.sectionTitle||Ai||Ti),pr=b(ji?ki||Oi||ci.refSectionTitle:ci.refSectionTitle||ki||Oi);return o($,e({value:vr},{children:r(d,e({ref:Qn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[mn&&o(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:o(N,{})})),gi.open&&o(X,{open:gi.open,anchorEl:gi.anchorEl,containerEl:ho.current,clipTopEl:Ln.current,scrollContainerEl:Un.current,onClose:Mo,summary:gi.summary,displayImpact:gi.displayImpact,isScrollLocked:En}),o(L,{open:si.open,anchorEl:si.anchorEl,maintainRelativeOrder:!!dn,sectionTitle:si.sectionTitle,referenceSectionTitle:si.refSectionTitle,onClose:Ci,onOpenCognitiveCompare:Ri,onOpenSideBySide:No,onConnect:vo,isConnected:Ho,isOrphan:!ji&&!!si.isOrphan,isGuidelineMode:ji,hasGuidelineMatches:si.hasGuidelineMatches}),ci.open&&o(j,{open:ci.open,popupRef:xi,position:vi,popupConfig:Ue,onClose:function(){fi(null),ai(function(n){return e(e({},n),{open:!1})}),Si(null)},markdownStyles:Ke,sectionTitle:fr,referenceSectionTitle:pr,cognitiveData:ci.cognitiveData,anchorEl:ci.anchorEl,sectionAnchorEl:ci.sectionAnchorEl,scrollContainerEl:Un.current,badgeStyle:ci.badgeStyle,docData:ci.docData,deviationData:ci.deviationData,isLoading:ci.isLoading}),o(v,e({open:!!Rn,autoHideDuration:8e3,onClose:function(){return bn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return bn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Rn}))})),o(V,{componentHeaderText:ze,displayConfig:Xe,maintainRelativeOrder:dn,onCollapseAll:To,showCollapseAll:Eo,onToggleView:function(e){Sn(!0),setTimeout(function(){vn(!e),null==$e||$e(!e),An(!1),wt(),mi(),Bn(new Set),Fn([]),qn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Sn(!1)},600)})})},50)}}),o(d,e({ref:Un,onScroll:Fo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:dn?"visible":"auto",borderTop:Mt&&Ht?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},dn?{flex:1}:{})},{children:r(d,e({ref:jn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},dn?{flex:1,overflow:"visible"}:{})},{children:[o(ne,{svgContainerRef:Pn,svgDimensions:Io,isResizing:vt,overallConnector:Bo,rootDeviationStyle:Gt,lines:Co,isSideBySide:at,activeSideBySideSection:gt,isArrowVisible:st,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,cognitivePopup:ci,activeBadgeId:pi,closeCognitivePopup:yi,setActiveBadgeId:Si,openCognitivePopupFromState:bi,buildSectionPopupState:ao,connectedLines:In,isGuidelineMode:ji,pathRefs:Wn}),r(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},dn?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:Ln,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:o(p,e({title:Ti,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ti}))}))})),r(d,e({ref:oi,onScroll:Fo,sx:e({p:"12px",display:"flex",flexDirection:"column"},dn?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:ii,style:{width:"100%",height:"0px",flexShrink:0}}),Ki&&ir,o("div",{ref:ti,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:ho,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:o(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:r(d,e({onClick:function(n){n.stopPropagation(),ci.open&&pi===zt?yi():(Si(zt),bi(ao(n.currentTarget,{title:ro,content:"",evaluationResult:Wt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,zt,!0,e(e({},Gt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Gt.badgeBg,color:Gt.badgeText,border:"1px solid ".concat(Gt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=qt?qt:o(M,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(x,{})})),o(S,{size:11,style:{transform:ci.open&&pi===zt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),r(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},dn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[pt&&o(R,{sections:11}),o(d,e({ref:Nn,sx:e({p:"8px",bgcolor:ji?"#F1F3F5":"#F7F8FA",borderBottom:"1px solid #D7DCE2",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},dn?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},ji?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:ji?r(h,e({value:kn,onChange:function(e,n){return On(n)},variant:"fullWidth",TabIndicatorProps:{sx:{display:"none"}},sx:{width:"100%",minHeight:"36px","& .MuiTab-root":{minHeight:"36px",px:1,py:0,borderRadius:"8px",fontSize:"14px",lineHeight:1,fontWeight:500,textTransform:"none",color:"#374151",minWidth:0,transition:"background-color 160ms ease, box-shadow 160ms ease"},"& .Mui-selected":{color:"#374151",bgcolor:"#FFFFFF"}}},{children:[o(m,{label:o(p,e({title:Oi,placement:"top"},{children:o(d,e({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Redline Guidelines"}))}))}),o(m,{label:o(p,e({title:"Web & GPT Sources",placement:"top"},{children:o(d,e({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Web & GPT Sources"}))}))})]})):o(p,e({title:Oi,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Oi}))}))})),r(d,e({ref:Zn,onScroll:Fo,sx:e({p:ji?"0px":"12px",display:"flex",flexDirection:"column"},dn?e(e({maxHeight:"calc(100vh - 250px)"},!ji&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:ei,style:{width:"100%",height:"0px",flexShrink:0}}),ji?0===kn?o(ie,{guidelinesData:cn,deviationData:Ze,connectedSections:wn,proposedSections:Mi}):o(te,{deviationData:Ze,connectedSections:wn,proposedSections:Mi}):Ki&&tr,o("div",{ref:ni,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{oe as default};
1
+ import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as c,useEffect as a,useCallback as d}from"react";import{Box as s,Snackbar as v,Alert as f,Tooltip as p,Typography as g,Tabs as h,Tab as m}from"@mui/material";import{ChevronDown as S}from"lucide-react";import{ButtonCognitiveIcon as x}from"../../assests/svg/ButtonCognitiveIcon.js";import R from"./OverlayComponent.js";import{safeStringify as y,extractDeviationScore as b,generateColorPalette as C,DEVIATION_BADGE_SEPARATOR as w,findKeyPathByNodeId as I,hasMeaningfulRedlineTags as _,scrollAndHighlightClause as B,scrollAndWait as F,waitForScrollIdle as T}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as A,DEFAULT_COMPARISON_CONFIG as D}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as O,EMPTY_SUMMARY_POPUP_STATE as k,DEFAULT_COMPONENT_HEADER_TEXT as P}from"./CognitiveCompareConstants.js";import j from"./CognitivePopup.js";import L from"./MoreFunctionsPopup.js";import N from"./LoaderComponent.js";import M from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as H}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as G}from"./hooks/useSectionRefs.js";import{useAccordionState as W}from"./hooks/useAccordionState.js";import{useDeviationNavigation as q}from"./hooks/useDeviationNavigation.js";import{useOnDemandCitationCache as V}from"./hooks/useOnDemandCitationCache.js";import K from"./components/CompareHeader.js";import J from"./components/SubSectionAccordion.js";import Y from"./components/LHSSectionRow.js";import X from"./components/RHSSectionRow.js";import $ from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as U}from"./CompareContext.js";import{useStyleHelpers as Q}from"./hooks/useStyles.js";import{useResizeHandler as Z}from"./hooks/useResizeHandler.js";import{useLinesCalculator as ee}from"./hooks/useLinesCalculator.js";import{useSideBySide as ne}from"./hooks/useSideBySide.js";import ie from"./components/SvgConnectors.js";import te from"./Guidelines/components/GuidelinePanel.js";import oe from"./Guidelines/components/WebGptPanel.js";import{GuidelineSkeleton as re}from"./components/GuidelineSkeletonLoader.js";import{getVisibleGuidelineTargets as le}from"./Guidelines/utils/guidelineTargets.js";import{hasGptCitationObjects as ue}from"./Guidelines/utils/hasGptCitationObjects.js";var ce=function(ce){var ae,de,se,ve,fe,pe,ge,he,me,Se,xe,Re,ye,be,Ce,we,Ie,_e,Be,Fe,Te,Ee,Ae,De,Oe,ke,Pe,je,Le,Ne,Me,He,ze,Ge,We,qe=ce.componentHeaderText,Ve=void 0===qe?P:qe,Ke=ce.treeData,Je=ce.comparisonConfig,Ye=ce.leftColumnTitleText,Xe=ce.rightColumnTitleText,$e=ce.markdownStyles,Ue=ce.resetTrigger,Qe=ce.displayConfig,Ze=void 0===Qe?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Qe,en=ce.onMaintainRelativeOrderChange,nn=ce.popupConfig,tn=ce.deviationData,on=void 0===tn?{}:tn,rn=ce.deviationNodeIdToView,ln=ce.resetDeviationNodeId,un=ce.isProposingFix,cn=void 0!==un&&un,an=ce.proposingFixNodeId,dn=ce.isRedlineFlow,sn=ce.badgeStyleOverride,vn=ce.guidelinesData,fn=ce.isGuidelineMode,pn=ce.gptWebCitationConfig,gn=ce.onDemandCitationConfig,hn=l(Ze.maintainRelativeOrder),mn=hn[0],Sn=hn[1],xn=null!==(ae=null==Ze?void 0:Ze.expandLevels)&&void 0!==ae?ae:0,Rn=!!(null==Ze?void 0:Ze.expandAllSections),yn=!!mn||!!(null==Ze?void 0:Ze.showDeviationBadges),bn=l(!1),Cn=bn[0],wn=bn[1],In=l(null),_n=In[0],Bn=In[1],Fn=l(null===(se=null!==(de=null==Ke?void 0:Ke.newEvaluationResult)&&void 0!==de?de:null==Ze?void 0:Ze.enableDeviationSchemaBackwardCompatibility)||void 0===se||se)[0],Tn=l(new Set),En=Tn[0],An=Tn[1],Dn=l([]),On=Dn[0],kn=Dn[1],Pn=l(!1),jn=Pn[0],Ln=Pn[1],Nn=l(0),Mn=Nn[0],Hn=Nn[1],zn=u(null),Gn=u(null),Wn=u(null),qn=u(null),Vn=u(null),Kn=u(!1),Jn=u(null),Yn=u({}),Xn=u([]),$n=u(function(){}),Un=u(null),Qn=u(function(){}),Zn=c(function(){return JSON.stringify(on||{})},[JSON.stringify(on)]),ei=c(function(){return on||{}},[Zn]),ni=c(function(){return ue(ei)},[ei]),ii=c(function(){return(null==Ke?void 0:Ke.cognitive_decisioning)||{}},[Ke]),ti=c(function(){return e(e({},E),$e)},[$e]),oi=u(null),ri=u(null),li=u(null),ui=u(null),ci=u(null),ai=u(null),di=u(null),si=u(null),vi=u(null),fi=u(null),pi=z(oi),gi=pi.cognitivePopup,hi=pi.setCognitivePopup,mi=pi.moreFunctions,Si=pi.setMoreFunctions,xi=pi.position,Ri=pi.setPosition,yi=pi.activeBadgeId,bi=pi.summaryPopup,Ci=pi.setSummaryPopup,wi=pi.closeSummaryPopup,Ii=pi.setActiveBadgeId,_i=pi.popupRef,Bi=pi.handleOpenCognitiveCompare,Fi=pi.openCognitivePopupFromState,Ti=pi.closeCognitivePopup,Ei=pi.closeMoreFunctionsPopup,Ai=c(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==Je?void 0:Je.fields)&&void 0!==e?e:A,thresholds:{high:null!==(i=null===(n=null==Je?void 0:Je.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:D.thresholds.high,medium:null!==(o=null===(t=null==Je?void 0:Je.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:D.thresholds.medium,exact:null!==(l=null===(r=null==Je?void 0:Je.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:D.thresholds.exact}}},[Je]),Di=l(null),Oi=Di[0];Di[1];var ki=null===(pe=null===(ve=null==Ke?void 0:Ke.documents)||void 0===ve?void 0:ve[null===(fe=null==Ke?void 0:Ke.input_index_map)||void 0===fe?void 0:fe[0]])||void 0===pe?void 0:pe.title,Pi=null===(me=null===(ge=null==Ke?void 0:Ke.documents)||void 0===ge?void 0:ge[null===(he=null==Ke?void 0:Ke.input_index_map)||void 0===he?void 0:he[1]])||void 0===me?void 0:me.title,ji=y(Ye||ki||"Uploaded Contract"),Li=null===(ye=null===(Re=null===(Se=null==Ke?void 0:Ke.documents)||void 0===Se?void 0:Se[null===(xe=null==Ke?void 0:Ke.input_index_map)||void 0===xe?void 0:xe[0]])||void 0===Re?void 0:Re.metadata)||void 0===ye?void 0:ye.file_name,Ni=y(Li),Mi=null===(Ie=null===(we=null===(be=null==Ke?void 0:Ke.documents)||void 0===be?void 0:be[null===(Ce=null==Ke?void 0:Ke.input_index_map)||void 0===Ce?void 0:Ce[1]])||void 0===we?void 0:we.metadata)||void 0===Ie?void 0:Ie.file_name,Hi=y(Mi),zi=y(Xe||Pi||"Reference Template"),Gi=H(Ke,mn,ei,Ai,Fn,vn,fn),Wi=Gi.isGuidelineMode,qi=Gi.activeProposed,Vi=Gi.existingRule,Ki=Gi.proposedSections,Ji=Gi.existingSections,Yi=Gi.visibleFields,Xi=Gi.parentDeviationRecord,$i=Gi.deviationNumberRegistry,Ui=Gi.deviationParentRegistry,Qi=Gi.parseError;a(function(){Qi&&Bn("Failed to load comparison: ".concat(Qi))},[Qi]);var Zi=Ki.length>0||Ji.length>0,et=c(function(){if(!dn)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";_(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Ki),i(Ji),"".concat(e,":").concat(n)},[dn,Ki,Ji]);a(function(){if(Ki.length||Ji.length)if(Rn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=mn?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(Ki,"left"),i(Ji,"right"),jt(e),Nt(n)}else if(xn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=mn?"".concat(n,"-").concat(r):String(r);t[u]=!0}var c=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&c(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&c(e.subsections,String(r),2)})};r(Ki,"left",xn),r(Ji,"right",xn),jt(t),Nt(o)}},[Rn,xn,Ki,Ji,mn]);var nt=G(Yi.map(function(e){return e.key}),Math.max(Ki.length,Ji.length)),it=nt.leftRefs,tt=nt.rightRefs,ot=nt.sectionLeftRefs,rt=nt.sectionRightRefs,lt=nt.lhsBadgeRefs,ut=nt.rhsBadgeRefs,ct=nt.sectionRightRowRefs,at=nt.subSectionLeftRefs,dt=nt.subSectionRightRefs,st=nt.sectionRowRefs,vt=nt.getSectionRowRef,ft=nt.getSubSectionRef,pt=nt.getBadgeRef,gt=ne({isGuidelineMode:Wi,maintainRelativeOrder:mn,proposedSections:Ki,existingSections:Ji,leftContainerRef:si,rightContainerRef:li,scrollContainerRef:oi,sectionLeftRefs:ot,sectionRightRefs:rt,subSectionLeftRefs:at,subSectionRightRefs:dt,lhsBadgeRefs:lt,rhsBadgeRefs:ut,sectionRowRefs:st,sectionRightRowRefs:ct,rhsTopSpacerRef:ui,rhsBottomSpacerRef:ci,lhsTopSpacerRef:ai,lhsBottomSpacerRef:di,calculateLinesRef:$n,setConnectedSections:An,setConnectedLines:kn,cachedConnectedPositions:Xn,closeMoreFunctionsPopup:Ei,setErrorToast:Bn,moreFunctions:mi,closeSummaryPopup:wi}),ht=gt.isSideBySide,mt=gt.isArrowVisible,St=gt.setIsArrowVisible,xt=gt.isResizing,Rt=gt.setIsResizing,yt=gt.isSideBySideLoading,bt=gt.activeSideBySideSection,Ct=gt.scrollLock,wt=gt.sideBySideCacheRef,It=gt.isSideBySideRef,_t=gt.activeSideBySideRightSectionRef,Bt=gt.activeSideBySideSectionRef,Ft=gt.sideBySideLineRef,Tt=gt.highlightedClauseRefs,Et=gt.clearClauseHighlight,At=gt.resetSideBySide,Dt=gt.activateSideBySide,Ot=u(Dt);a(function(){Ot.current=Dt},[Dt]);var kt=W({maintainRelativeOrder:!!mn,proposedSections:Ki,existingSections:Ji,activeSideBySideSection:bt,connectedSections:En,resetSideBySide:At,setConnectedSections:An,setConnectedLines:kn,cachedConnectedPositions:Xn,svgContainerRef:zn,isAnimatingRef:Kn,animationTimerRef:Jn,calculateLinesRef:$n,sectionLeftRefs:ot,sectionRightRefs:rt,subSectionLeftRefs:at,subSectionRightRefs:dt}),Pt=kt.expandedSections,jt=kt.setExpandedSections,Lt=kt.expandedSubSections,Nt=kt.setExpandedSubSections,Mt=kt.handleSubSectionToggle,Ht=kt.toggleSection,zt=kt.forceExpandCrossWiredSections,Gt=function(){var e,n;if(null!=bt){var i=null===(e=ot.current[bt])||void 0===e?void 0:e.current,t=null===(n=rt.current[bt])||void 0===n?void 0:n.current,o=li.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),c=r.top-u.top,a=l.top-u.top-c;o.scrollBy({top:a,behavior:"smooth"})}}},Wt=d(function(e){null==e||e.stopPropagation(),Ln(function(e){var n=!e;return n&&requestAnimationFrame(function(){Gt()}),n})},[Gt]);a(function(){dn&&"off"!==et&&"0:0"!==et&&(wt.current=null,Xn.current=[],requestAnimationFrame(function(){var e;null===(e=$n.current)||void 0===e||e.call($n)}))},[dn,et]);var qt=c(function(){var e=new Map,n=new Map,i=1;if(mn)Ki.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),Ji.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Ki.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Ki.length,Ji.length),o=0;o<t;o++){var r=Ki[o],l=Ji[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Ki,Ji,mn]),Vt=Vi.analysis,Kt=y(null===(Be=null===(_e=null==Vt?void 0:Vt.rule_difference_comparison)||void 0===_e?void 0:_e.summary)||void 0===Be?void 0:Be.overall_summary),Jt=!!Kt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Yt=null!==(Fe=null==Ke?void 0:Ke.base_root_id)&&void 0!==Fe?Fe:"-1";null==Ke||Ke[Yt];var Xt=Fn?null!==(He=null!==(Le=on&&(null===(je=null==on?void 0:on[Yt])||void 0===je?void 0:je.evaluation_result))&&void 0!==Le?Le:null===(Me=null===(Ne=null==Ke?void 0:Ke.nodes)||void 0===Ne?void 0:Ne[Yt])||void 0===Me?void 0:Me.evaluation_result)&&void 0!==He?He:null:null!==(Pe=null!==(Ae=on&&(null===(Ee=null===(Te=null==on?void 0:on[Yt])||void 0===Te?void 0:Te.evaluation_result)||void 0===Ee?void 0:Ee[0]))&&void 0!==Ae?Ae:null===(ke=null===(Oe=null===(De=null==Ke?void 0:Ke.nodes)||void 0===De?void 0:De[Yt])||void 0===Oe?void 0:Oe.evaluation_result)||void 0===ke?void 0:ke[0])&&void 0!==Pe?Pe:null,$t=b(Xt),Ut=C(null!==(We=null===(Ge=null===(ze=null==Xt?void 0:Xt.evaluation_outputs)||void 0===ze?void 0:ze.metadata)||void 0===Ge?void 0:Ge.label_color)&&void 0!==We?We:O);if(sn){var Qt=sn($t);Qt&&(Ut=e(e({},Ut),{badgeBg:Qt.bg,badgeText:Qt.text,badgeBorder:Qt.border}))}var Zt=u(At);a(function(){Zt.current=At},[At]);var eo=u(Ti);a(function(){eo.current=Ti},[Ti]);var no=d(function(e,n,i,t,o,r){return pr.current(e,n,i,t,o,r)},[]),io=d(function(e,n,i,t,o){return hr.current(e,n,i,t,o)},[]),to=d(function(){return mr.current()},[]),oo=d(function(e,n){return Sr.current(e,n)},[]),ro=d(function(e){return xr.current(e)},[]),lo=d(function(e){return Rr.current(e)},[]),uo=d(function(){return yr.current()},[]),co=d(function(){var e,n;Et(),null===(e=Zt.current)||void 0===e||e.call(Zt),Ln(!1),An(new Set),kn([]),Xn.current=[],Do([]),ko(null),Ci(k),null===(n=eo.current)||void 0===n||n.call(eo),requestAnimationFrame(function(){var e;null===(e=$n.current)||void 0===e||e.call($n)})},[]),ao=u(co);a(function(){ao.current=co},[co]),a(function(){Ue&&ao.current()},[Ue]);var so=c(function(){return{documents:null==Ke?void 0:Ke.documents,input_index_map:null==Ke?void 0:Ke.input_index_map}},[JSON.stringify(null==Ke?void 0:Ke.documents),JSON.stringify(null==Ke?void 0:Ke.input_index_map)]),vo=l(""),fo=vo[0],po=vo[1],go=y(Pi),ho=u(Ke);a(function(){var e,n,i;ho.current=Ke;var t=null===(e=null==Ke?void 0:Ke.input_index_map)||void 0===e?void 0:e[0],o=null===(i=null===(n=null==Ke?void 0:Ke.documents)||void 0===n?void 0:n[t])||void 0===i?void 0:i.title;po(o)},[Ke]);var mo=u(ii);a(function(){mo.current=ii},[ii]);var So=d(function(i,t,o,r,l,u,c){var a,d,s,v,f,p,g,h,m,S,x=y(null==t?void 0:t.id)||y(null==o?void 0:o.id)||"",R="string"==typeof r?r.split(w):[],b=R[0]||y(null==t?void 0:t.nodeId)||y(null==o?void 0:o.nodeId)||y(null==t?void 0:t.id).split(w)[0]||y(null==o?void 0:o.id).split(w)[0]||void 0,C=R.length>1&&void 0!==R[1]?R[1]:void 0,I=(x?null===(a=mo.current)||void 0===a?void 0:a[x]:null)||(null==t?void 0:t.cognitiveData)||(null==o?void 0:o.cognitiveData)||{section_id:x,decisioning:[],gap:[],relevance_score:0},_=null!==(s=null===(d=st.current[r])||void 0===d?void 0:d.current)&&void 0!==s?s:null,B=function(){var n,i,l=(null==t?void 0:t.evaluationResult)||(null==o?void 0:o.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof r&&r.includes(w)))return u(l);var c=r.split(w)[1];if(!c)return l;var a=(null==t?void 0:t.evaluationResult)||(null==o?void 0:o.evaluationResult)||{},d=(null===(n=null==a?void 0:a.deviation_entries)||void 0===n?void 0:n[c])||(null===(i=null==a?void 0:a.deviations)||void 0===i?void 0:i[c])||null;return d?e(e(e({},a),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),F=(null!==(p=null===(f=null===(v=null==B?void 0:B.cognitive_decisioning)||void 0===v?void 0:v.decisioning_factors)||void 0===f?void 0:f.length)&&void 0!==p?p:0)>0||(null!==(m=null===(h=null===(g=null==B?void 0:B.cognitive_decisioning)||void 0===g?void 0:g.gaps_in_decision)||void 0===h?void 0:h.length)&&void 0!==m?m:0)>0,T=null!==(S=null==Ze?void 0:Ze.isLoading)&&void 0!==S&&S,E=!0;if(Wi){var A=null==B?void 0:B.deviation_highlights;if(A&&"object"==typeof A)E=Object.values(A).some(function(e){return Array.isArray(e)&&e.length>0});else E=!1}return{isLoading:T&&!F,open:!0,sectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",refSectionTitle:(null==o?void 0:o.title)?null==o?void 0:o.title:"No Counterpart",cognitiveData:I,anchorEl:i,sectionAnchorEl:_,badgeStyle:u||null,sectionIdx:r,docData:so,deviationData:B,isOrphan:!!l,hasGuidelineMatches:E,sourceNodeId:b,deviationKey:C,baseContentId:null==t?void 0:t.contentId,compareContentIds:n(n(n([],(null==o?void 0:o.contentId)?[o.contentId]:[],!0),(null==t?void 0:t.refContentIds)||[],!0),(null==o?void 0:o.refContentIds)||[],!0).filter(Boolean)}},[so,null==Ze?void 0:Ze.isLoading,Wi]),xo=d(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),mi.open&&mi.sectionIdx===o)Ei();else{var u=e.currentTarget,c="left";(null===(l=li.current)||void 0===l?void 0:l.contains(u))&&(c="right");Et(),It.current&&At(),An(new Set),kn([]),Xn.current=[],Ti(),bi.open?Xo():wi(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(w)){var r=o.split(w),l="".concat(r[0]).concat(w).concat(r[1]);return"right"===c?null===(e=ut.current[l])||void 0===e?void 0:e.current:null===(n=lt.current[l])||void 0===n?void 0:n.current}return"right"===c?null===(i=ut.current[o])||void 0===i?void 0:i.current:null===(t=lt.current[o])||void 0===t?void 0:t.current}()||u;Si(So(e,n,t,o,i,r))})}},[mi.open,mi.sectionIdx,Ei,wi,So]),Ro=d(function(){var e=mi.sectionIdx;mi.isOrphan,Ei(),wi(),null!==e&&(zt(e),Et(),It.current&&At(),kn([]),Xn.current=[],Wi&&null!==e&&Hn(qo(e)),An(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){$n.current&&$n.current()},50))},[mi.sectionIdx,mi.isOrphan,Ei,wi,At]),yo=d(function(){var e=Vn.current;if(e){Vn.current=null;var n=Ki.findIndex(function(n){return n.id===e}),i=Ji.findIndex(function(n){return n.id===e}),t=-1===n?I(Ki,e):null,o=-1===i?I(Ji,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Tt.current.add(r),B(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(mn)-1!==r&&si.current&&c(function(){return u(n,t,ot,at)},si.current),-1!==l&&li.current&&c(function(){return u(i,o,rt,dt)},li.current);else{var a=oi.current;if(!a)return;c(function(){return-1!==r?u(n,t,ot,at):u(i,o,rt,dt)},a)}}},[Ki,Ji,mn,ot,rt,at,dt,si,li,oi]),bo=d(function(n){if(n){Et(),At(),An(new Set),kn([]),Xn.current=[],wi(),Ti();var i=Ki.findIndex(function(e){return e.id===n}),t=Ji.findIndex(function(e){return e.id===n}),o=-1===i?I(Ki,n):null,r=-1===t?I(Ji,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;Vn.current=n,jt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=mn?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=mn?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Nt(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){Vn.current===n&&Co.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Ki,Ji,mn,jt,Nt,At,wi,Ti]),Co=u(yo);a(function(){Co.current=yo},[yo]);var wo=u(null);a(function(){if(Oi){var e=Ai.fields.find(function(e){return e.analysisKey===Oi||e.key===Oi});if(e){var n=it.current[e.key]||tt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Oi,Ai.fields]);var Io=d(function(e){var n,i,t,o,r,l,u,c,a,d=null===(n=null==Vt?void 0:Vt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!d||!d[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[e],v=(null==s?void 0:s.relation)||(null===(t=null===(i=null==s?void 0:s.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var f=s.mappings[0]||{};return{score:s.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Vt]),_o=Q({proposedSections:Ki,existingSections:Ji,maintainRelativeOrder:mn,cognitiveMap:ii,deviationData:ei,treeData:Ke,resolvedComparisonConfig:Ai,badgeStyleOverride:sn}),Bo=_o.getSectionCompareStyle,Fo=_o.getSubSectionCompareStyle,To=_o.getDeviationStyleByKey,Eo=ee({containerRef:Gn,leftContainerRef:si,rightContainerRef:li,svgContainerRef:zn,pathRefs:Yn,leftHeaderRef:Wn,rightHeaderRef:qn,proposedSections:Ki,existingSections:Ji,visibleFields:Yi,leftRefs:it,rightRefs:tt,sectionLeftRefs:ot,sectionRightRefs:rt,subSectionLeftRefs:at,subSectionRightRefs:dt,lhsBadgeRefs:lt,rhsBadgeRefs:ut,sectionRowRefs:st,expandedSections:Pt,expandedSubSections:Lt,connectedSections:En,isSideBySide:ht,activeSideBySideSection:bt,maintainRelativeOrder:mn,isGuidelineMode:Wi,cognitiveMap:ii,getSectionCompareStyle:Bo,getSubSectionCompareStyle:Fo,getDeviationStyleByKey:To,isArrowVisible:mt,isAnimatingRef:Kn,isSideBySideRef:It,sideBySideCacheRef:wt,sideBySideLineRef:Ft,activeSideBySideSectionRef:Bt,activeSideBySideRightSectionRef:_t,connectedLines:On,setConnectedLines:kn,cachedConnectedPositions:Xn,calculateLinesRef:$n,resizeTimerRef:Un,scrollLock:Ct,scrollSyncLocked:jn,handleResizeRef:Qn,activeProposed:qi,existingRule:Vi,analysisData:Vt,pendingScrollTargetRef:vi,pendingScrollCallbackRef:fi,resolvedComparisonConfig:Ai,getFieldData:Io}),Ao=Eo.lines,Do=Eo.setLines,Oo=Eo.overallConnector,ko=Eo.setOverallConnector,Po=Eo.svgDimensions,jo=Eo.handleColumnScroll;a(function(){bi.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=$n.current)||void 0===e||e.call($n)})})},[bi.anchorEl,jn]);var Lo=d(function(){Et(),Ln(!1),jt({}),Nt({}),At(),An(new Set),kn([]),Xn.current=[],wi(),Ti(),Ei(),requestAnimationFrame(function(){$n.current&&$n.current()})},[jt,Nt,At,wi,Ti,Ei]);a(function(){ht||0!==En.size||Ln(!1)},[ht,En]);var No=c(function(){return Object.values(Pt).some(Boolean)||Object.values(Lt).some(Boolean)},[Pt,Lt]),Mo=u(null),Ho=u(0),zo=u(0),Go=u(0),Wo=Z({timerRef:Mo,ruleComponentRef:ri,scrollContainerRef:oi,containerRef:Gn,maintainRelativeOrder:mn,proposedSections:Ki,existingSections:Ji,isSideBySideRef:It,activeSideBySideSectionRef:Bt,activeSideBySideRightSectionRef:_t,sectionRowRefs:st,sectionRightRowRefs:ct,sectionLeftRefs:ot,sectionRightRefs:rt,subSectionLeftRefs:at,subSectionRightRefs:dt,lhsBadgeRefs:lt,rhsBadgeRefs:ut,leftContainerRef:si,rightContainerRef:li,calculateLinesRef:$n,handleResizeRef:Qn,setIsResizing:Rt,setIsArrowVisible:St,sideBySideCacheRef:wt,cachedConnectedPositions:Xn}).handleResize;a(function(){Qn.current=Wo},[Wo,Qn]),a(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return ri.current&&o.push(e(ri.current,Ho,n,function(){return Qn.current()},function(){})),oi.current&&o.push(e(oi.current,zo,i,function(){return Qn.current()},function(){return $n.current()})),Gn.current&&o.push(e(Gn.current,Go,t,function(){return Qn.current()},function(){return $n.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),a(function(){It.current=ht},[ht]),a(function(){Bt.current=bt},[bt]);var qo=d(function(e){var n,i,t,o,r,l="",u="0";if("number"==typeof e)l=(null===(n=Ki[e])||void 0===n?void 0:n.nodeId)||(null===(i=Ki[e])||void 0===i?void 0:i.id)||"";else{var c=String(e).split(w);l=c[0],u=c[1]||"0"}var a=null===(t=null==ei?void 0:ei[l])||void 0===t?void 0:t.evaluation_result,d=Array.isArray(a)?a[parseInt(u,10)]:null==a?void 0:a[u];return!1===(null===(r=null===(o=null==d?void 0:d.evaluation_outputs)||void 0===o?void 0:o.guideline_flag)||void 0===r?void 0:r.rulebook_used)&&ue(d)?1:0},[Ki,ei]),Vo=d(function(){At(),An(new Set),kn([]),Xn.current=[]},[At]),Ko=d(function(e,n){n!==Mn&&(Vo(),Hn(n))},[Mn,Vo]);a(function(){ni||0===Mn||(Vo(),Hn(0))},[Mn,ni,Vo]);var Jo=d(function(e){var n,i,t=si.current,o=li.current,r=le(o);if(o){var l="string"==typeof e&&e.includes(w),u=e;if(l){var c=e.split(w);c.length>=2&&(u="".concat(c[0]).concat(w).concat(c[1]))}var a=(null===(n=lt.current[u])||void 0===n?void 0:n.current)||(null===(i=lt.current[e])||void 0===i?void 0:i.current);if(r.length>0&&a&&t&&o){var d=r[0];ai.current&&(ai.current.style.height="0px"),ui.current&&(ui.current.style.height="0px"),di.current&&(di.current.style.height="0px"),ci.current&&(ci.current.style.height="0px"),requestAnimationFrame(function(){var e=a.getBoundingClientRect(),n=d.getBoundingClientRect(),i=t.getBoundingClientRect(),r=o.getBoundingClientRect(),l=t.scrollTop+(e.top-i.top)+e.height/2,u=o.scrollTop+(n.top-r.top)+n.height/2,c=l-i.height/2,s=Math.max(0,c),v=t.scrollHeight-t.clientHeight,f=s>v?s-v:0,p=i.top+l-s,g=r.top+u-p,h=0;g<0&&(h=Math.abs(g),g=0);var m=o.scrollHeight-o.clientHeight+h,S=g>m?g-m:0;di.current&&(di.current.style.height="".concat(f,"px")),ui.current&&(ui.current.style.height="".concat(h,"px")),ci.current&&(ci.current.style.height="".concat(S,"px")),requestAnimationFrame(function(){t.scrollTo({top:s,behavior:"smooth"}),o.scrollTo({top:g,behavior:"smooth"}),$n.current&&setTimeout(function(){return $n.current()},50)})})}}},[w]),Yo=d(function(){var e,n=mi.sectionIdx,i=mi.isOrphan;if(wi(),null!=n){var t="left";mi.anchorEl&&(null===(e=li.current)||void 0===e?void 0:e.contains(mi.anchorEl))&&(t="right"),zt(n),Wi&&(Hn(qo(n)),An(new Set([n]))),Dt(n,i,{sourceSide:t,onReady:function(){Wi&&setTimeout(function(){return Jo(String(n))},150)}})}},[Dt,mi.isOrphan,mi.sectionIdx,mi.anchorEl,wi,zt,Wi,Jo,qo]),Xo=d(function(){wi(),At(),An(new Set),kn([]),Xn.current=[]},[wi,At]),$o=null!==mi.sectionIdx&&En.has(mi.sectionIdx),Uo=q({proposedSections:Ki,existingSections:Ji,parentDeviationRecord:Xi,expandedSections:Pt,maintainRelativeOrder:!!mn,scrollContainerRef:oi,leftContainerRef:si,rightContainerRef:li,lhsBadgeRefs:lt,rhsBadgeRefs:ut}),Qo=Uo.showDeviationNavigation,Zo=Uo.showOpenNodeRef,er=Uo.adjustScrollForPopup,nr=d(function(e,n,i,t,o){var r,l="string"==typeof t?y(t).trim():y(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;Ti();var c="left";(null===(r=li.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var e,i,t,o;if("string"==typeof n&&n.includes(w)){var r=n.split(w),l="".concat(r[0]).concat(w).concat(r[1]);return"right"===c?null===(e=ut.current[l])||void 0===e?void 0:e.current:null===(i=lt.current[l])||void 0===i?void 0:i.current}return"right"===c?null===(t=ut.current[n])||void 0===t?void 0:t.current:null===(o=lt.current[n])||void 0===o?void 0:o.current};if(i&&!Wi)return At(),An(new Set),kn([]),Xn.current=[],void(l&&(zt(n),requestAnimationFrame(function(){var e=a()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));Ci({open:!0,anchorEl:e,summary:t,displayImpact:o})})));zt(n),Wi&&(Hn(qo(n)),An(new Set([n]))),l?setTimeout(function(){Dt(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e,i,r,l=a()||u;if(Wi)setTimeout(function(){return Jo(n)},150);else if(l){var c=l.getBoundingClientRect();if(c.top>.8*window.innerHeight||c.top<100){var d=c.top-window.innerHeight/2;mn?(null===(e=si.current)||void 0===e||e.scrollBy({top:d,behavior:"smooth"}),null===(i=li.current)||void 0===i||i.scrollBy({top:d,behavior:"smooth"})):null===(r=oi.current)||void 0===r||r.scrollBy({top:d,behavior:"smooth"})}}Ci({open:!0,anchorEl:l,summary:t,displayImpact:o})}})},350):setTimeout(function(){Dt(n,i,{toggleIfSame:!1,sourceSide:c}),Wi&&setTimeout(function(){return Jo(n)},150)},350)},[Dt,Ti,Ci,At,zt,Wi,mn,Jo,ei]),ir=c(function(){var e;if(!rn)return null;var n=null===(e=null==rn?void 0:rn.id)||void 0===e?void 0:e.split(":")[0];for(var i in Xi){if((Xi[i]||[]).some(function(e){return e.id===n}))return i}return null},[rn,Xi]),tr=u({id:null,triggerMs:null}),or=u(null);a(function(){if(null==rn?void 0:rn.id){var o=Number(rn.trigger),r=tr.current;if((null==r?void 0:r.id)!==rn.id||(null==r?void 0:r.triggerMs)!==o){if(rn.id.includes(":")&&/:\d+$/.test(rn.id)){var l=rn.id.split(":"),u=l[0],c=l[1],a=null!=c?c:"0",d="".concat(rn.id,":").concat(o);or.current!==d&&(wi(),Ti(),At(),An(new Set),kn([]),Xn.current=[],or.current=d);var s=!1,v=0,f=null,p=null,g=!1,h=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},m=function(){var r,l,c;if(!s){var d=function(){tr.current={id:rn.id,triggerMs:o}},S=null,x=null;for(var R in Xi){var y=Xi[R].find(function(e){var n;return e.id===u||e.nodeId===u||e.contentId===u||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===u});if(y){S=R,x=y;break}}if(x&&S){var b=Array.from(new Set([u,x.id,x.nodeId,x.contentId,null===(r=x.evaluationResult)||void 0===r?void 0:r.nodeId].filter(Boolean))),C=Ki.findIndex(function(e){return e.id===S}),I=Ji.findIndex(function(e){return e.id===S}),_=-1===C&&-1!==I,B=h(Ki,b),E=h(Ji,b);if(B&&!E&&!_){var A=B.split("-"),D=Number(A[0]);if(mn){var O=null===(c=null===(l=Ki[D])||void 0===l?void 0:l.refIndexes)||void 0===c?void 0:c[0],k=Ji.findIndex(function(e){return e.selfIndex===O});-1!==k&&(D=k)}E=n([D],A.slice(1),!0).join("-")}if(B||E){var P=B?Number(B.split("-")[0]):C,j=E?Number(E.split("-")[0]):I,L=j>=0?j:E?Number(E.split("-")[0]):-1,N=Ki[P],M=Ji[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,G=_||(!B&&!!E||H&&!z);if(G){if(!(mn?!!gr.current["right-".concat(j)]:!!gr.current[String(j)])&&j>=0)return Ht(j,"right"),void(f=setTimeout(m,200))}else if(!(mn?!!gr.current["left-".concat(P)]:!!gr.current[String(P)])&&P>=0)return Ht(P,"left"),void(f=setTimeout(m,200));var W=B||"",q=E||"",V=b.map(function(e){return"".concat(e).concat(w).concat(a)}),K=V[0],J=function(){for(var e,n,i=0,t=V;i<t.length;i++){var o=t[i],r=(null===(e=lt.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=ut.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:K,left:null,right:null}},Y=function(e){return"".concat(e).concat(w).concat(W).concat(w).concat(q)};if(!g){zt(Y(K)),g=!0,v=0;var X=function(){var e=J(),n=e.left,i=e.right;return G||!n&&!!i?i:n};return null==p||p(),void(f=setTimeout(function(){var e,n,i,t,o,r,l,u;s||(e=X,n=function(){s||(p=null,m())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!s)if(performance.now()-l>3e3)n();else{var c=e();if(c&&0!==c.getBoundingClientRect().height){var a=c.getBoundingClientRect(),d=a.top,v=a.height,f=null!==o&&Math.abs(d-o)<.5,p=null!==r&&Math.abs(v-r)<.5;if(f&&p){if(++t>=5)return void n()}else t=0;o=d,r=v,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),p=function(){return cancelAnimationFrame(i)})},300))}var $=J(),U=$.refId,Q=$.left,Z=$.right,ee=Y(U);if(Q||Z){var ne=G||!Q&&!!Z,ie=ne?Z:Q,te=mn?ne?li.current:si.current:oi.current;if(ie&&te){var oe=ie.getBoundingClientRect();if(0!==oe.height){var re=te.getBoundingClientRect(),le=oe.top-re.top+te.scrollTop-re.height/2+oe.height/2,ue=(null==B?void 0:B.includes("-"))||(null==E?void 0:E.includes("-")),ce=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,c,v,f,p;return t(this,function(t){switch(t.label){case 0:return s?[2]:(d(),n=ie instanceof Element?window.getComputedStyle(ie).color:"",[Q,Z].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[Q,Z].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(c=null===(u=x.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===c?void 0:c[a])||x,o=(null===(v=x.evaluationResult)||void 0===v?void 0:v.evaluation_outputs)||x.evaluation_outputs,!!Q&&!!Z||Wi?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},mn?[4,Promise.all([si.current?l(T(si.current),600):Promise.resolve(),li.current?l(T(li.current),600):Promise.resolve()])]:[3,2]):(r=ne?(null===(f=ut.current[ue?U:j])||void 0===f?void 0:f.current)||Z:(null===(p=lt.current[ue?U:P])||void 0===p?void 0:p.current)||Q,er(r,function(){Ci({open:!0,anchorEl:r,displayImpact:rn.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==ln||ln(),[2]));case 1:t.sent(),t.label=2;case 2:return Wi&&(Hn(qo(ee)),An(new Set([ee]))),Ot.current(ee,!1,{toggleIfSame:!1,sourceSide:_?"right":"left",onReady:function(){var n,t,o,r;d();var l=ne?(null===(n=ut.current[U])||void 0===n?void 0:n.current)||Z:(null===(t=lt.current[U])||void 0===t?void 0:t.current)||Q;if(Wi)setTimeout(function(){return Jo(ee)},150);else{var u=(null===(o=lt.current[U])||void 0===o?void 0:o.current)||Q,c=(null===(r=ut.current[U])||void 0===r?void 0:r.current)||Z;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),c&&(c.style.scrollMarginTop="150px",c.scrollIntoView({behavior:"smooth",block:"start"}))}Ci({open:!0,anchorEl:l,displayImpact:rn.displayImpact,summary:e({},i)}),null==ln||ln()}}),[2]}})})};Math.abs(te.scrollTop-le)<=2?ce():F(te,le,ce)}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}};return f=setTimeout(m,100),function(){s=!0,f&&clearTimeout(f),null==p||p()}}tr.current={id:rn.id,triggerMs:o},bo(rn.id);var S=Ki.findIndex(function(e){return e.id===rn.id}),x=Ji.findIndex(function(e){return e.id===rn.id});-1===S&&-1===x||setTimeout(function(){var e=-1!==S?S:x,n=-1===S;Wi&&Hn(qo(e)),An(new Set([e])),Ot.current(e,n,{sourceSide:n?"right":"left",onReady:function(){Wi&&setTimeout(function(){return Jo(String(e))},150)}})},400)}}},[null==rn?void 0:rn.id,null==rn?void 0:rn.trigger,null==rn?void 0:rn.displayImpact,Xi,Ki,Ji,mn,Ci,bo,Wi,qo,Jo]),a(function(){var n,i,t;if(bi.open){var o=bi.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(lt.current)||r(ut.current);if(l){var u=(null===(i=ut.current[l])||void 0===i?void 0:i.current)||(null===(t=lt.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&Ci(function(n){return e(e({},n),{anchorEl:u})})}}}},[bi.open,bi.anchorEl,jn,En,Pt]);var rr=gi.open,lr=gi.sectionIdx,ur=gi.isOrphan,cr=gi.badgeStyle,ar=gi.anchorEl,dr=gi.sectionAnchorEl;a(function(){var n;if(Ze.isStreamingEnabled&&rr&&null!=lr&&lr!==Yt){var i="string"==typeof lr?lr.split(w)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(Ki,i):null,r=i&&"string"==typeof i?t(Ji,i):null,l="number"==typeof lr?Ki[lr]||null:o||i&&((null===(n=null==Ke?void 0:Ke.nodes)||void 0===n?void 0:n[i])||(null==Ke?void 0:Ke[i]))||null,u="number"==typeof lr?Ji[lr]||null:r,c=So(ar,l,u,lr,ur,cr);hi(function(n){return n.open?y(n.cognitiveData)===y(c.cognitiveData)&&y(n.deviationData)===y(c.deviationData)&&n.sectionTitle===c.sectionTitle&&n.refSectionTitle===c.refSectionTitle?n:e(e(e({},n),c),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[rr,lr,ur,cr,ar,dr,Ki,Ji,So]);var sr=d(function(e){var n=e.section,i=e.keyPath,t=e.depth,r=void 0===t?0:t,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c,d=e.sectionOffset,s=e.rhsOrphanVisualIndexes;return o(J,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:a,sectionOffset:d,rhsOrphanVisualIndexes:s})},[]),vr=c(function(){return Ki.map(function(e,n){var i,t,r=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),l=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return r&&l&&mn?null:o(Y,{section:e,idx:n},null!==(t=null!==(i=null==e?void 0:e.layoutKey)&&void 0!==i?i:null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(n))})},[Ki,mn]),fr=c(function(){return Ji.map(function(e,n){var i,t,r=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),l=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return r&&l&&mn?null:o(X,{section:e,idx:n},null!==(t=null!==(i=null==e?void 0:e.layoutKey)&&void 0!==i?i:null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(n))})},[Ji,mn]),pr=u(xo);a(function(){pr.current=xo},[xo]);var gr=u(Pt);a(function(){gr.current=Pt},[Pt]);var hr=u(nr);a(function(){hr.current=nr},[nr]);var mr=u(Xo);a(function(){mr.current=Xo},[Xo]);var Sr=u(Ht);a(function(){Sr.current=Ht},[Ht]);var xr=u(Mt);a(function(){xr.current=Mt},[Mt]);var Rr=u(sr);a(function(){Rr.current=sr},[sr]);var yr=u(At);a(function(){yr.current=At},[At]);var br=V(gn),Cr=br.cacheVersion,wr=br.getCacheKey,Ir=br.getCacheEntry,_r=br.fetchCitationContext,Br=br.prefetchCitationContexts,Fr=br.abortCitationContexts,Tr=c(function(){return{isGuidelineMode:Wi,maintainRelativeOrder:!!mn,showDeviationBadges:yn,isProposingFix:cn,proposingFixNodeId:an,isRedlineFlow:dn,isSideBySide:ht,activeSideBySideSection:bt,scrollSyncLocked:jn,toggleScrollSyncLocked:Wt,summaryPopupAnchorEl:bi.anchorEl,connectedSections:En,proposedSections:Ki,existingSections:Ji,deviationNumberRegistry:$i,deviationParentRegistry:Ui,treeData:Ke,displayConfig:Ze,resolvedMarkdownStyles:ti,unifiedNumbering:qt,expandedSections:Pt,expandedSubSections:Lt,setExpandedSubSections:Nt,getSectionCompareStyle:Bo,getSubSectionCompareStyle:Fo,getBadgeRef:pt,getSectionRowRef:vt,getSubSectionRef:ft,sectionLeftRefs:ot,sectionRightRefs:rt,sectionRowRefs:st,sectionRightRowRefs:ct,subSectionLeftRefs:at,subSectionRightRefs:dt,lhsBadgeRefs:lt,rhsBadgeRefs:ut,openMoreFunctionsPopup:no,handleOpenSummaryPopup:io,openSummaryPopup:io,handleCloseSummaryPopup:to,toggleSection:oo,handleSubSectionToggle:ro,renderSubSectionAccordion:lo,resetSideBySide:uo,setConnectedSections:An,setConnectedLines:kn,cachedConnectedPositions:Xn,showDeviationNavigation:Qo,showOpenNodeRef:Zo,deviationNodeIdToView:null==rn?void 0:rn.id,deviationTargetParentId:ir,guidelinesData:vn,gptWebCitationConfig:pn,onDemandCitationConfig:gn,onDemandCitationCacheVersion:Cr,getOnDemandCitationCacheKey:wr,getOnDemandCitationCacheEntry:Ir,fetchOnDemandCitationContext:_r,prefetchOnDemandCitationContexts:Br,abortOnDemandCitationContexts:Fr}},[Wi,mn,yn,cn,an,dn,ht,bt,jn,Wt,bi.anchorEl,En,Ki,Ji,$i,Ze,ti,qt,Pt,Lt,Nt,Bo,Fo,pt,vt,ft,Qo,Zo,rn,ir,vn,pn,gn,Cr,wr,Ir,_r,Br,Fr]),Er=y(gi.sectionTitle||Ni||ji),Ar=y(Wi?Hi||zi||gi.refSectionTitle:gi.refSectionTitle||Hi||zi);return o(U,e({value:Tr},{children:r(s,e({ref:ri,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[Cn&&o(s,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:o(N,{})})),bi.open&&o($,{open:bi.open,anchorEl:bi.anchorEl,containerEl:wo.current,clipTopEl:Wn.current,scrollContainerEl:oi.current,onClose:Xo,summary:bi.summary,displayImpact:bi.displayImpact,isScrollLocked:jn}),o(L,{open:mi.open,anchorEl:mi.anchorEl,maintainRelativeOrder:!!mn,sectionTitle:mi.sectionTitle,referenceSectionTitle:mi.refSectionTitle,onClose:Ei,onOpenCognitiveCompare:Bi,onOpenSideBySide:Yo,onConnect:Ro,isConnected:$o,isOrphan:!Wi&&!!mi.isOrphan,isGuidelineMode:Wi,hasGuidelineMatches:mi.hasGuidelineMatches}),gi.open&&o(j,{open:gi.open,popupRef:_i,position:xi,popupConfig:nn,onClose:function(){Ri(null),hi(function(n){return e(e({},n),{open:!1})}),Ii(null)},markdownStyles:$e,sectionTitle:Er,referenceSectionTitle:Ar,cognitiveData:gi.cognitiveData,anchorEl:gi.anchorEl,sectionAnchorEl:gi.sectionAnchorEl,scrollContainerEl:oi.current,badgeStyle:gi.badgeStyle,docData:gi.docData,deviationData:gi.deviationData,isLoading:gi.isLoading,sourceNodeId:gi.sourceNodeId,deviationKey:gi.deviationKey,baseContentId:gi.baseContentId,compareContentIds:gi.compareContentIds}),o(v,e({open:!!_n,autoHideDuration:8e3,onClose:function(){return Bn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return Bn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:_n}))})),o(K,{componentHeaderText:Ve,displayConfig:Ze,maintainRelativeOrder:mn,onCollapseAll:Lo,showCollapseAll:No,onToggleView:function(e){wn(!0),setTimeout(function(){Sn(!e),null==en||en(!e),Ln(!1),At(),wi(),An(new Set),kn([]),Xn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){wn(!1)},600)})})},50)}}),o(s,e({ref:oi,onScroll:jo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:mn?"stretch":"flex-start",bgcolor:"#FFFFFF",overflowY:mn?"visible":"auto",borderTop:Kt&&Jt?"none":"1.5px solid #EEF0F4"}},{children:o(s,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px",minHeight:0},mn?{flex:1}:{})},{children:r(s,e({ref:Gn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},mn?{flex:1,overflow:"visible"}:{})},{children:[o(ie,{svgContainerRef:zn,svgDimensions:Po,isResizing:xt,overallConnector:Oo,rootDeviationStyle:Ut,lines:Ao,isSideBySide:ht,activeSideBySideSection:bt,isArrowVisible:mt,maintainRelativeOrder:mn,proposedSections:Ki,existingSections:Ji,cognitivePopup:gi,activeBadgeId:yi,closeCognitivePopup:Ti,setActiveBadgeId:Ii,openCognitivePopupFromState:Fi,buildSectionPopupState:So,connectedLines:On,isGuidelineMode:Wi,pathRefs:Yn}),r(s,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},mn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[o(s,e({ref:Wn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:o(p,e({title:ji,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:ji}))}))})),r(s,e({ref:si,onScroll:jo,sx:e({p:"12px",display:"flex",flexDirection:"column"},mn?{flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:ai,style:{width:"100%",height:"0px",flexShrink:0}}),Zi&&vr,o("div",{ref:di,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(s,e({ref:wo,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:o(s,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:r(s,e({onClick:function(n){n.stopPropagation(),gi.open&&yi===Yt?Ti():(Ii(Yt),Fi(So(n.currentTarget,{title:fo,content:"",evaluationResult:Xt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},{title:go,content:""},Yt,!0,e(e({},Ut),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Ut.badgeBg,color:Ut.badgeText,border:"1px solid ".concat(Ut.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=$t?$t:o(M,{}),o(s,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(x,{})})),o(S,{size:11,style:{transform:gi.open&&yi===Yt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),r(s,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},mn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[yt&&o(R,{sections:11}),o(s,e({ref:qn,sx:{p:"8px",bgcolor:Wi?"#F1F3F5":"#F7F8FA",borderBottom:"1px solid #D7DCE2",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",flexShrink:0}},{children:Wi?r(h,e({value:Mn,onChange:Ko,variant:"fullWidth",TabIndicatorProps:{sx:{display:"none"}},sx:{width:"100%",minHeight:"36px","& .MuiTab-root":{minHeight:"36px",px:1,py:0,borderRadius:"8px",fontSize:"14px",lineHeight:1,fontWeight:500,textTransform:"none",color:"#374151",minWidth:0,transition:"background-color 160ms ease, box-shadow 160ms ease"},"& .Mui-selected":{color:"#374151",bgcolor:"#FFFFFF"}}},{children:[o(m,{label:o(p,e({title:zi,placement:"top"},{children:o(s,e({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Redline Guidelines"}))}))}),ni&&o(m,{label:o(p,e({title:"Web & GPT Sources",placement:"top"},{children:o(s,e({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Web & GPT Sources"}))}))})]})):o(p,e({title:zi,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:zi}))}))})),r(s,e({ref:li,onScroll:jo,sx:e({p:Wi?"0px":"12px",display:"flex",flexDirection:"column"},mn?{flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:ui,style:{width:"100%",height:"0px",flexShrink:0}}),Wi?vn?0!==Mn&&ni?o(oe,{deviationData:on,connectedSections:En,proposedSections:Ki}):o(te,{guidelinesData:vn,deviationData:on,connectedSections:En,proposedSections:Ki}):o(re,{}):Zi&&fr,o("div",{ref:ci,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ce as default};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- var l="#3730A3",n=12,a=680,o=12,t=10,e="Contract Comparison",i={isLoading:!1,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},c={open:!1,anchorEl:null,summary:"",markdownStyles:{},displayImpact:!1};export{t as ARROW_SIZE,e as DEFAULT_COMPONENT_HEADER_TEXT,l as DEFAULT_DEVIAION_COLOR,i as EMPTY_SECTION_POPUP_STATE,c as EMPTY_SUMMARY_POPUP_STATE,n as POPUP_GAP,a as POPUP_WIDTH,o as VIEWPORT_MARGIN};
1
+ var l="#3730A3",n=12,a=1050,o=12,t=10,e="Contract Comparison",i={isLoading:!1,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},c={open:!1,anchorEl:null,summary:"",markdownStyles:{},displayImpact:!1};export{t as ARROW_SIZE,e as DEFAULT_COMPONENT_HEADER_TEXT,l as DEFAULT_DEVIAION_COLOR,i as EMPTY_SECTION_POPUP_STATE,c as EMPTY_SUMMARY_POPUP_STATE,n as POPUP_GAP,a as POPUP_WIDTH,o as VIEWPORT_MARGIN};
2
2
  //# sourceMappingURL=CognitiveCompareConstants.js.map
@@ -1,2 +1,2 @@
1
- import{DEFAULT_DEVIAION_COLOR as n}from"./CognitiveCompareConstants.js";var t=function(n){return null==n?"":"string"==typeof n?n:Array.isArray(n)?n.map(t).join("\n\n"):"object"==typeof n?JSON.stringify(n):String(n)},e=function(n){return null!=n&&("string"==typeof n?n.trim().length>0:!Array.isArray(n)||n.length>0&&n.some(function(n){return e(n)}))},o=function(n){for(var t=n+1,e="";t>0;){t-=1;e=String.fromCharCode(97+t%26)+e,t=Math.floor(t/26)}return e},r=function(n){var t=n.section,e=n.proposedSections,r=n.leftNums,i=n.fallbackNumber,u=n.firstOnly,l=void 0!==u&&u;if(!(null==t?void 0:t.id))return i;var a=(e||[]).map(function(n){var e=Array.isArray(null==n?void 0:n.refIndexes)?n.refIndexes:[],i=e.findIndex(function(n){return n===t.selfIndex});if(-1===i)return null;var u=(null==n?void 0:n.id)?r.get(n.id):void 0;return null==u?null:e.length>1?"".concat(u).concat(o(i)):String(u)}).filter(Boolean);return 0===a.length?i:l?a[0]:a.join(", ")},i=function(n,t){return null!=(null==n?void 0:n.selfIndex)&&1===(t||[]).filter(function(t){return Array.isArray(null==t?void 0:t.refIndexes)&&t.refIndexes.includes(n.selfIndex)}).length},u=function(n,t,e,o){var r;void 0===o&&(o={});var i=e[t],u=null===(r=null==n?void 0:n.comparison_inputs)||void 0===r?void 0:r[i];return u?(Array.isArray(u)?u:[u]).map(function(n,t){if(n&&"string"==typeof n&&n.trim()){var e=o[n];return e&&"object"==typeof e&&e?{contentId:n,data:e,attributes:e.additional_attributes||{}}:null}return n&&"object"==typeof n?{contentId:n.content_id||n.id||"".concat(i,"-direct-").concat(t),data:n,attributes:n.additional_attributes||{}}:null}).filter(Boolean):[]},l=function(n,e,o,r){var i,l,a;void 0===r&&(r={});var s=u(n,e,o,r),c=(null===(i=s[0])||void 0===i?void 0:i.data)||{},d=(null===(l=s[0])||void 0===l?void 0:l.attributes)||null;return{title:t((null==c?void 0:c.title)||""),content:t((null==c?void 0:c.content)||""),change_history:t((null==c?void 0:c.change_history)||""),attributes:d,subsections:(null==c?void 0:c.subsections)||[],contentId:null===(a=s[0])||void 0===a?void 0:a.contentId,allItems:s}},a=function(n){if(!n.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var t=n.mapping_rationale,e=parseInt(t.decision_strength||"0");return{cognitiveData:{decisioning:t.decisioning_factors||[],gap:t.gaps_in_decision||[],relevance_score:e,citations:t.citations},score:0,relation:"N/A"}};function s(n){var t=function(n,t){var e=function(n){var t=function(n){return 4===n.length?"#"+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]:n}(n).replace("#",""),e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}}(n),o=e.r,r=e.g,i=e.b;return function(n,t,e){return"#"+[n,t,e].map(function(n){return n.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(o+(255-o)*t),Math.round(r+(255-r)*t),Math.round(i+(255-i)*t))};return{bg:t(n,.8),border:t(n,.5),badgeBg:t(n,.8),badgeBorder:t(n,.5),badgeText:n.toUpperCase(),highlightBg:t(n,.8)}}function c(n,t){var e;return function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var i=this;clearTimeout(e),e=setTimeout(function(){return n.apply(i,o)},t)}}var d=function(n,t){var e,o,r,i,u,l;if(n.content!==t.content)return!1;if(n.overlayContent!==t.overlayContent)return!1;if(n.sxStyles!==t.sxStyles)return!1;if(n.maintainRelativeOrder!==t.maintainRelativeOrder)return!1;if(n.highlightBg!==t.highlightBg)return!1;if(n.suppressHighlightBg!==t.suppressHighlightBg)return!1;if(n.collisionKey!==t.collisionKey)return!1;var a=n.highlights||[],s=t.highlights||[];if(a.length!==s.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==s[c])return!1;var d=n.deviationBadges||[],v=t.deviationBadges||[];if(d.length!==v.length)return!1;for(c=0;c<d.length;c++){if(d[c].id!==v[c].id)return!1;if(d[c].actionId!==v[c].actionId)return!1;if(d[c].label!==v[c].label)return!1;if(d[c].score!==v[c].score)return!1;if(d[c].isOrphan!==v[c].isOrphan)return!1;if(d[c].isConnected!==v[c].isConnected)return!1;if(d[c].showScrollLockToggle!==v[c].showScrollLockToggle)return!1;if(d[c].scrollSyncLocked!==v[c].scrollSyncLocked)return!1;if((null===(e=d[c].style)||void 0===e?void 0:e.badgeBg)!==(null===(o=v[c].style)||void 0===o?void 0:o.badgeBg))return!1;if((null===(r=d[c].style)||void 0===r?void 0:r.badgeBorder)!==(null===(i=v[c].style)||void 0===i?void 0:i.badgeBorder))return!1;if((null===(u=d[c].style)||void 0===u?void 0:u.badgeText)!==(null===(l=v[c].style)||void 0===l?void 0:l.badgeText))return!1}return!0},v="::",f=function(n){if(!n)return!0;var t=n.trim().toLowerCase();return t.includes("no equivalent")||"n/a"===t||"na"===t||"none"===t},g=function(n){var t;if("string"!=typeof n||!n)return!1;for(var e=/<(updated|deleted|changed|change)\b[^>]*>([\s\S]*?)<\/\1>/gi,o=null;null!==(o=e.exec(n));){if((null!==(t=o[2])&&void 0!==t?t:"").replace(/<[^>]*>/g,"").trim().length>0)return!0}return!1},h=function(n){return"string"==typeof n&&n?n.replace(/<\/?(updated|deleted|changed|change)\b[^>]*>/gi,""):""},p=function(n,e,o){var r=new Map;if(!e)return r;var i=function(n){var e=g(n)?h(n):t(n||"");return t(e).replace(/\\n/g,"\n")};return(n||[]).forEach(function(n){var t=new Map,u=function(n){var r;if(n){var l=i(n.content);((null===(r=n.evaluationResults)||void 0===r?void 0:r.length)?n.evaluationResults:n.evaluationResult?[n.evaluationResult]:[]).forEach(function(r){var u=(null==r?void 0:r.nodeId)||n.nodeId||n.id;Object.entries((null==r?void 0:r.deviations)||{}).forEach(function(n){var r=n[0],a=n[1][e],s=i(a);if(s&&!f(a)&&l.includes(s)){var c="".concat(u).concat("::").concat(r),d=o[c];null!=d&&t.set(c,d)}})}),(n.subsections||[]).forEach(u)}};if(u(n),0!==t.size){var l=Math.min.apply(Math,Array.from(t.values()));t.forEach(function(n,t){r.set(t,n-l+1)})}}),r},b=function(n,t){var e,o,r,i,u,l,a;if(!n)return t;var s=null!==(l=null!==(i=null!==(o=null===(e=n.evaluation_output)||void 0===e?void 0:e.output_score)&&void 0!==o?o:null===(r=n.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==i?i:null===(u=n.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==l?l:n.output_score;return null!==(a=null!=s?s:t)&&void 0!==a?a:""},m=function(n,t,e,o,r){void 0===r&&(r=14);var i=n+.5*(e-n),u=o-t;if(Math.abs(u)<3)return"M ".concat(n," ").concat(t," H ").concat(e);var l=u>0?1:-1,a=Math.min(r,Math.abs(u)/2,Math.abs(i-n)/2,Math.abs(e-i)/2);return["M ".concat(n," ").concat(t),"H ".concat(i-a),"Q ".concat(i," ").concat(t," ").concat(i," ").concat(t+l*a),"V ".concat(o-l*a),"Q ".concat(i," ").concat(o," ").concat(i+a," ").concat(o),"H ".concat(e)].join(" ")},y=function(n,t,e,o,r){void 0===e&&(e=300);var i=n.style.scrollBehavior;n.style.scrollBehavior="auto";var u=n.scrollTop,l=t-u,a=null,s=function(c){null===a&&(a=c);var d,v=c-a;v<e?(n.scrollTop=(d=v,d/=e,l*(--d*d*d+1)+u),r&&r(),requestAnimationFrame(s)):(n.scrollTop=t,n.style.scrollBehavior=i,r&&r(),o&&o())};requestAnimationFrame(s)},_=["#B91C1C","#A16207","#1D4ED8","#000000"],T=function(n){var t=_.findIndex(function(t){return t.toLowerCase()===n.toLowerCase()});return-1===t?_.length:t},I=function(t){for(var e,o,r,i,u,l,a,s,c,d,v,f,g,h=[],p=0,b=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(n,t){return Number(n)-Number(t)});p<b.length;p++){var m=b[p];(A=null===(i=null===(r=null===(o=null===(e=null==t?void 0:t.deviations)||void 0===e?void 0:e[m])||void 0===o?void 0:o.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.label_color)&&h.push(A)}for(var y=0,_=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(n,t){return Number(n)-Number(t)});y<_.length;y++){m=_[y];(A=null===(s=null===(a=null===(l=null===(u=null==t?void 0:t.deviation_entries)||void 0===u?void 0:u[m])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===s?void 0:s.label_color)&&h.push(A)}for(var I=0,x=Object.keys(t||{}).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,t){return Number(n)-Number(t)});I<x.length;I++){var A;m=x[I];(A=null===(v=null===(d=null===(c=null==t?void 0:t[m])||void 0===c?void 0:c.evaluation_outputs)||void 0===d?void 0:d.metadata)||void 0===v?void 0:v.label_color)&&h.push(A)}return 0===h.length?(null===(g=null===(f=null==t?void 0:t.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)?t.evaluation_outputs.metadata.label_color:n:h.sort(function(n,t){return T(n)-T(t)})[0]},x=function(n){for(var t,e,o,r,i,u,l,a,s,c=0,d=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(n,t){return Number(n)-Number(t)});c<d.length;c++){var v=d[c];if(b=null===(o=null===(e=null===(t=null==n?void 0:n.deviations)||void 0===t?void 0:t[v])||void 0===e?void 0:e.evaluation_outputs)||void 0===o?void 0:o.output_value)return b}for(var f=0,g=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(n,t){return Number(n)-Number(t)});f<g.length;f++){v=g[f];if(b=null===(u=null===(i=null===(r=null==n?void 0:n.deviation_entries)||void 0===r?void 0:r[v])||void 0===i?void 0:i.evaluation_outputs)||void 0===u?void 0:u.output_value)return b}for(var h=0,p=Object.keys(n||{}).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,t){return Number(n)-Number(t)});h<p.length;h++){var b;v=p[h];if(b=null===(a=null===(l=null==n?void 0:n[v])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(s=null==n?void 0:n.evaluation_outputs)||void 0===s?void 0:s.output_value)?n.evaluation_outputs.output_value:null},A=function(n,t){var e=function(n){var t=n.replace("#","");return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]},o=function(n){var t=Math.round(n).toString(16);return 1===t.length?"0"+t:t};try{var r=e(n),i=e(t),u=(r[0]+i[0])/2*.95,l=(r[1]+i[1])/2*.95,a=(r[2]+i[2])/2*.95;return"#".concat(o(u)).concat(o(l)).concat(o(a))}catch(n){return"#FDE68A"}},B=function(n,t,e){if(!n)return null;if(n.id===e||n.nodeId===e||n.contentId===e)return t;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=B(n.subsections[o],"".concat(t,"-").concat(o),e);if(r)return r}return null},M=function(n,t){for(var e=0;e<n.length;e++){var o=B(n[e],String(e),t);if(o)return o}return null},C=new WeakMap,S=function(n){if(n){var t=C.get(n);null!=t&&(clearTimeout(t),C.delete(n)),n.style.transition="box-shadow 300ms ease-out, outline 300ms ease-out",requestAnimationFrame(function(){n.style.outline="",n.style.boxShadow=""}),window.setTimeout(function(){n.style.transition="",n.style.borderRadius=""},300)}},w=function(n){if(n){var t=C.get(n);null!=t&&clearTimeout(t),n.style.transition="box-shadow 300ms ease-in-out, outline 300ms ease-in-out",n.style.outline="2px solid #ff9494",n.style.borderRadius="6px",n.style.boxShadow="0 0 12px 2px rgba(244, 113, 113, 0.33)";var e=window.setTimeout(function(){S(n)},3e3);C.set(n,e)}},N=function(n,t){var e=t.getBoundingClientRect(),o=n.getBoundingClientRect(),r=t.scrollTop+o.top-e.top-e.height/2+o.height/2;t.scrollTo({top:r,behavior:"smooth"});var i=function(){return w(n)};if("onscrollend"in t)t.addEventListener("scrollend",i,{once:!0});else{var u=t.scrollTop,l=function(){t.scrollTop===u?i():(u=t.scrollTop,requestAnimationFrame(l))};requestAnimationFrame(l)}},j=function(n,t,e){if(Math.abs(n.scrollTop-t)<=2)e();else{var o,r=!1,i=function(){r||(r=!0,clearTimeout(o),n.removeEventListener("scrollend",u),e())},u=function(){return i()};n.addEventListener("scrollend",u),n.scrollTo({top:t,behavior:"smooth"}),o=setTimeout(i,800)}},O=function(n,t){return void 0===t&&(t=100),new Promise(function(e){var o,r=!1,i=function(){r||(r=!0,n.removeEventListener("scroll",u),e())},u=function(){clearTimeout(o),o=setTimeout(i,t)};n.addEventListener("scroll",u),o=setTimeout(i,t)})};export{v as DEVIATION_BADGE_SEPARATOR,d as areMarkdownPropsEqual,c as debounce,b as extractDeviationScore,M as findKeyPathByNodeId,s as generateColorPalette,o as getAlphabeticSuffix,m as getBentArrowPath,I as getFirstDeviationColor,x as getFirstDeviationOutputValue,p as getLhsDeviationDisplayIndexes,a as getRationale,r as getRhsMappedSectionNumber,l as getSideData,g as hasMeaningfulRedlineTags,i as hasSingleMappedLhsSection,e as hasValue,w as highlightClause,f as isMissingStr,A as mixHexColors,B as recursivelyFindSubSectionIdxById,S as resetClauseHighlight,u as resolveComparisonInputItems,t as safeStringify,N as scrollAndHighlightClause,j as scrollAndWait,y as smoothScrollTo,h as stripRedlineTags,O as waitForScrollIdle};
1
+ import{DEFAULT_DEVIAION_COLOR as t}from"./CognitiveCompareConstants.js";import{normalizeRedlineMarkdown as n}from"./utils/normalizeRedlineMarkdown.js";var e=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(e).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},r=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return r(t)}))},o=function(t){for(var n=t+1,e="";n>0;){n-=1;e=String.fromCharCode(97+n%26)+e,n=Math.floor(n/26)}return e},i=function(t){var n=t.section,e=t.proposedSections,r=t.leftNums,i=t.fallbackNumber,u=t.firstOnly,l=void 0!==u&&u;if(!(null==n?void 0:n.id))return i;var a=(e||[]).map(function(t){var e=Array.isArray(null==t?void 0:t.refIndexes)?t.refIndexes:[],i=e.findIndex(function(t){return t===n.selfIndex});if(-1===i)return null;var u=(null==t?void 0:t.id)?r.get(t.id):void 0;return null==u?null:e.length>1?"".concat(u).concat(o(i)):String(u)}).filter(Boolean);return 0===a.length?i:l?a[0]:a.join(", ")},u=function(t,n){return null!=(null==t?void 0:t.selfIndex)&&1===(n||[]).filter(function(n){return Array.isArray(null==n?void 0:n.refIndexes)&&n.refIndexes.includes(t.selfIndex)}).length},l=function(t,n,e,r){var o;void 0===r&&(r={});var i=e[n],u=null===(o=null==t?void 0:t.comparison_inputs)||void 0===o?void 0:o[i];return u?(Array.isArray(u)?u:[u]).map(function(t,n){if(t&&"string"==typeof t&&t.trim()){var e=r[t];return e&&"object"==typeof e&&e?{contentId:t,data:e,attributes:e.additional_attributes||{}}:null}return t&&"object"==typeof t?{contentId:t.content_id||t.id||"".concat(i,"-direct-").concat(n),data:t,attributes:t.additional_attributes||{}}:null}).filter(Boolean):[]},a=function(t,n,r,o){var i,u,a;void 0===o&&(o={});var s=l(t,n,r,o),c=(null===(i=s[0])||void 0===i?void 0:i.data)||{},d=(null===(u=s[0])||void 0===u?void 0:u.attributes)||null;return{title:e((null==c?void 0:c.title)||""),content:e((null==c?void 0:c.content)||""),change_history:e((null==c?void 0:c.change_history)||""),attributes:d,subsections:(null==c?void 0:c.subsections)||[],contentId:null===(a=s[0])||void 0===a?void 0:a.contentId,allItems:s}},s=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=t.mapping_rationale,e=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:e,citations:n.citations},score:0,relation:"N/A"}};function c(t){var n=function(t,n){var e=function(t){var n=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),e=parseInt(n,16);return{r:e>>16&255,g:e>>8&255,b:255&e}}(t),r=e.r,o=e.g,i=e.b;return function(t,n,e){return"#"+[t,n,e].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(r+(255-r)*n),Math.round(o+(255-o)*n),Math.round(i+(255-i)*n))};return{bg:n(t,.8),border:n(t,.5),badgeBg:n(t,.8),badgeBorder:n(t,.5),badgeText:t.toUpperCase(),highlightBg:n(t,.8)}}function d(t,n){var e;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=this;clearTimeout(e),e=setTimeout(function(){return t.apply(i,r)},n)}}var v=function(t,n){var e,r,o,i,u,l;if(t.content!==n.content)return!1;if(t.overlayContent!==n.overlayContent)return!1;if(t.fallbackContent!==n.fallbackContent)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;if(t.suppressHighlightBg!==n.suppressHighlightBg)return!1;if(t.collisionKey!==n.collisionKey)return!1;var a=t.highlights||[],s=n.highlights||[];if(a.length!==s.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==s[c])return!1;var d=t.deviationBadges||[],v=n.deviationBadges||[];if(d.length!==v.length)return!1;for(c=0;c<d.length;c++){if(d[c].id!==v[c].id)return!1;if(d[c].actionId!==v[c].actionId)return!1;if(d[c].label!==v[c].label)return!1;if(d[c].score!==v[c].score)return!1;if(d[c].isOrphan!==v[c].isOrphan)return!1;if(d[c].isConnected!==v[c].isConnected)return!1;if(d[c].showScrollLockToggle!==v[c].showScrollLockToggle)return!1;if(d[c].scrollSyncLocked!==v[c].scrollSyncLocked)return!1;if((null===(e=d[c].style)||void 0===e?void 0:e.badgeBg)!==(null===(r=v[c].style)||void 0===r?void 0:r.badgeBg))return!1;if((null===(o=d[c].style)||void 0===o?void 0:o.badgeBorder)!==(null===(i=v[c].style)||void 0===i?void 0:i.badgeBorder))return!1;if((null===(u=d[c].style)||void 0===u?void 0:u.badgeText)!==(null===(l=v[c].style)||void 0===l?void 0:l.badgeText))return!1}return!0},f="::",g=function(t){if(!t)return!0;var n=t.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},h=function(t){var n;if("string"!=typeof t||!t)return!1;for(var e=/<(updated|deleted|changed|change)\b[^>]*>([\s\S]*?)<\/\1>/gi,r=null;null!==(r=e.exec(t));){if((null!==(n=r[2])&&void 0!==n?n:"").replace(/<[^>]*>/g,"").trim().length>0)return!0}return!1},p=function(t){return"string"==typeof t&&t?t.replace(/<\/?(updated|deleted|changed|change)\b[^>]*>/gi,""):""},b=function(t,n){for(var e="",r=[],o=[],i=0;i<t.length;i+=1){var u=t[i],l=n&&/[\.,;:]/.test(u),a=/\s/.test(u)||l?" ":/[’‘`]/.test(u)?"'":/[”“]/.test(u)?'"':/[—–]/.test(u)?"-":u;" "===a&&e.endsWith(" ")?o[o.length-1]=i+1:(e+=a,r.push(i),o.push(i+1))}return{text:e,starts:r,ends:o}},m=function(t,n,e){if(void 0===e&&(e=!1),!t||!n)return null;var r=t.toLowerCase().indexOf(n.toLowerCase());if(-1!==r)return{start:r,end:r+n.length};var o=b(t,e),i=b(n,e).text.trim().toLowerCase();if(!i)return null;var u=o.text.toLowerCase().indexOf(i);if(-1===u)return null;var l=u+i.length-1,a=o.starts[u],s=o.ends[l];return void 0===a||void 0===s?null:{start:a,end:s}},y=function(t,n){var e=m(t,n,!0);if(e)return e;for(var r=0,o=n.split(/\n+/).map(function(t){return t.trim()}).filter(function(t){return!(t.length<12)&&!(""===t.replace(/[|:\-\s]/g,""))});r<o.length;r++){var i=o[r],u=m(t,i,!0);if(u)return u}return null},_=function(t,r,o){var i=new Map;if(!r)return i;var u=function(t){var r=e(t||"").replace(/\\n/g,"\n");return h(r)?p(n(r)):r};return(t||[]).forEach(function(t){var n=new Map,e=function(t){var i;if(t){var l=u(t.content);((null===(i=t.evaluationResults)||void 0===i?void 0:i.length)?t.evaluationResults:t.evaluationResult?[t.evaluationResult]:[]).forEach(function(e){var i=(null==e?void 0:e.nodeId)||t.nodeId||t.id;Object.entries((null==e?void 0:e.deviations)||{}).forEach(function(t){var e=t[0],a=t[1][r],s=u(a);if(s&&!g(a)&&m(l,s)){var c="".concat(i).concat("::").concat(e),d=o[c];null!=d&&n.set(c,d)}})}),(t.subsections||[]).forEach(e)}};if(e(t),0!==n.size){var l=Math.min.apply(Math,Array.from(n.values()));n.forEach(function(t,n){i.set(n,t-l+1)})}}),i},x=function(t,n){var e,r,o,i,u,l,a;if(!t)return n;var s=null!==(l=null!==(i=null!==(r=null===(e=t.evaluation_output)||void 0===e?void 0:e.output_score)&&void 0!==r?r:null===(o=t.evaluation_outputs)||void 0===o?void 0:o.output_score)&&void 0!==i?i:null===(u=t.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==l?l:t.output_score;return null!==(a=null!=s?s:n)&&void 0!==a?a:""},T=function(t,n,e,r,o){void 0===o&&(o=14);var i=t+.5*(e-t),u=r-n;if(Math.abs(u)<3)return"M ".concat(t," ").concat(n," H ").concat(e);var l=u>0?1:-1,a=Math.min(o,Math.abs(u)/2,Math.abs(i-t)/2,Math.abs(e-i)/2);return["M ".concat(t," ").concat(n),"H ".concat(i-a),"Q ".concat(i," ").concat(n," ").concat(i," ").concat(n+l*a),"V ".concat(r-l*a),"Q ".concat(i," ").concat(r," ").concat(i+a," ").concat(r),"H ".concat(e)].join(" ")},I=function(t,n,e,r,o){void 0===e&&(e=300);var i=t.style.scrollBehavior;t.style.scrollBehavior="auto";var u=t.scrollTop,l=n-u,a=null,s=function(c){null===a&&(a=c);var d,v=c-a;v<e?(t.scrollTop=(d=v,d/=e,l*(--d*d*d+1)+u),o&&o(),requestAnimationFrame(s)):(t.scrollTop=n,t.style.scrollBehavior=i,o&&o(),r&&r())};requestAnimationFrame(s)},C=["#B91C1C","#A16207","#1D4ED8","#000000"],w=function(t){var n=C.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?C.length:n},A=function(n){for(var e,r,o,i,u,l,a,s,c,d,v,f,g,h=[],p=0,b=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});p<b.length;p++){var m=b[p];(I=null===(i=null===(o=null===(r=null===(e=null==n?void 0:n.deviations)||void 0===e?void 0:e[m])||void 0===r?void 0:r.evaluation_outputs)||void 0===o?void 0:o.metadata)||void 0===i?void 0:i.label_color)&&h.push(I)}for(var y=0,_=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});y<_.length;y++){m=_[y];(I=null===(s=null===(a=null===(l=null===(u=null==n?void 0:n.deviation_entries)||void 0===u?void 0:u[m])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===s?void 0:s.label_color)&&h.push(I)}for(var x=0,T=Object.keys(n||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});x<T.length;x++){var I;m=T[x];(I=null===(v=null===(d=null===(c=null==n?void 0:n[m])||void 0===c?void 0:c.evaluation_outputs)||void 0===d?void 0:d.metadata)||void 0===v?void 0:v.label_color)&&h.push(I)}return 0===h.length?(null===(g=null===(f=null==n?void 0:n.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)?n.evaluation_outputs.metadata.label_color:t:h.sort(function(t,n){return w(t)-w(n)})[0]},B=function(t){for(var n,e,r,o,i,u,l,a,s,c=0,d=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});c<d.length;c++){var v=d[c];if(b=null===(r=null===(e=null===(n=null==t?void 0:t.deviations)||void 0===n?void 0:n[v])||void 0===e?void 0:e.evaluation_outputs)||void 0===r?void 0:r.output_value)return b}for(var f=0,g=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});f<g.length;f++){v=g[f];if(b=null===(u=null===(i=null===(o=null==t?void 0:t.deviation_entries)||void 0===o?void 0:o[v])||void 0===i?void 0:i.evaluation_outputs)||void 0===u?void 0:u.output_value)return b}for(var h=0,p=Object.keys(t||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});h<p.length;h++){var b;v=p[h];if(b=null===(a=null===(l=null==t?void 0:t[v])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(s=null==t?void 0:t.evaluation_outputs)||void 0===s?void 0:s.output_value)?t.evaluation_outputs.output_value:null},M=function(t,n){var e=function(t){var n=t.replace("#","");return[parseInt(n.substring(0,2),16),parseInt(n.substring(2,4),16),parseInt(n.substring(4,6),16)]},r=function(t){var n=Math.round(t).toString(16);return 1===n.length?"0"+n:n};try{var o=e(t),i=e(n),u=(o[0]+i[0])/2*.95,l=(o[1]+i[1])/2*.95,a=(o[2]+i[2])/2*.95;return"#".concat(r(u)).concat(r(l)).concat(r(a))}catch(t){return"#FDE68A"}},S=function(t,n,e){if(!t)return null;if(t.id===e||t.nodeId===e||t.contentId===e)return n;if(!Array.isArray(t.subsections))return null;for(var r=0;r<t.subsections.length;r++){var o=S(t.subsections[r],"".concat(n,"-").concat(r),e);if(o)return o}return null},N=function(t,n){for(var e=0;e<t.length;e++){var r=S(t[e],String(e),n);if(r)return r}return null},j=new WeakMap,L=function(t){if(t){var n=j.get(t);null!=n&&(clearTimeout(n),j.delete(t)),t.style.transition="box-shadow 300ms ease-out, outline 300ms ease-out",requestAnimationFrame(function(){t.style.outline="",t.style.boxShadow=""}),window.setTimeout(function(){t.style.transition="",t.style.borderRadius=""},300)}},k=function(t){if(t){var n=j.get(t);null!=n&&clearTimeout(n),t.style.transition="box-shadow 300ms ease-in-out, outline 300ms ease-in-out",t.style.outline="2px solid #ff9494",t.style.borderRadius="6px",t.style.boxShadow="0 0 12px 2px rgba(244, 113, 113, 0.33)";var e=window.setTimeout(function(){L(t)},3e3);j.set(t,e)}},O=function(t,n){var e=n.getBoundingClientRect(),r=t.getBoundingClientRect(),o=n.scrollTop+r.top-e.top-e.height/2+r.height/2;n.scrollTo({top:o,behavior:"smooth"});var i=function(){return k(t)};if("onscrollend"in n)n.addEventListener("scrollend",i,{once:!0});else{var u=n.scrollTop,l=function(){n.scrollTop===u?i():(u=n.scrollTop,requestAnimationFrame(l))};requestAnimationFrame(l)}},E=function(t,n,e){if(Math.abs(t.scrollTop-n)<=2)e();else{var r,o=!1,i=function(){o||(o=!0,clearTimeout(r),t.removeEventListener("scrollend",u),e())},u=function(){return i()};t.addEventListener("scrollend",u),t.scrollTo({top:n,behavior:"smooth"}),r=setTimeout(i,800)}},R=function(t,n){return void 0===n&&(n=100),new Promise(function(e){var r,o=!1,i=function(){o||(o=!0,t.removeEventListener("scroll",u),e())},u=function(){clearTimeout(r),r=setTimeout(i,n)};t.addEventListener("scroll",u),r=setTimeout(i,n)})};export{f as DEVIATION_BADGE_SEPARATOR,v as areMarkdownPropsEqual,d as debounce,x as extractDeviationScore,N as findKeyPathByNodeId,y as findRedlineTextAnchorRange,m as findTextMatchRange,c as generateColorPalette,o as getAlphabeticSuffix,T as getBentArrowPath,A as getFirstDeviationColor,B as getFirstDeviationOutputValue,_ as getLhsDeviationDisplayIndexes,s as getRationale,i as getRhsMappedSectionNumber,a as getSideData,h as hasMeaningfulRedlineTags,u as hasSingleMappedLhsSection,r as hasValue,k as highlightClause,g as isMissingStr,M as mixHexColors,S as recursivelyFindSubSectionIdxById,L as resetClauseHighlight,l as resolveComparisonInputItems,e as safeStringify,O as scrollAndHighlightClause,E as scrollAndWait,I as smoothScrollTo,p as stripRedlineTags,R as waitForScrollIdle};
2
2
  //# sourceMappingURL=CognitiveComparehelpers.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from"tslib";import{jsxs as i,Fragment as n,jsx as e}from"react/jsx-runtime";import{useMemo as t,useState as r,useCallback as a,useEffect as l}from"react";import{Box as c,Typography as s,IconButton as d,Tooltip as p}from"@mui/material";import{X as v}from"lucide-react";import x from"react-dom";import h from"../../assests/svg/SparkleIcon.js";import{SHARED_MARKDOWN_STYLES as u,DEFAULT_POPUP_CONFIG as g}from"./CognitiveCompareConfig.js";import b from"./CitationRenderer.js";var f=10,m=function(m){var y,w,F,k,C,S,D,_,E,R,z,W,I,T,j,A,B,L,H,M,O=m.open,G=m.onClose,N=m.sectionTitle,P=m.referenceSectionTitle,Y=m.cognitiveData,q=m.relevanceScore,J=m.anchorEl,K=m.badgeStyle,Q=m.popupRef,U=m.position,V=m.markdownStyles,X=m.docData,Z=m.popupConfig,$=m.deviationData,oo=void 0===$?null:$,io=m.isLoading,no=o(o({},u),V),eo=t(function(){var i,n;return o(o(o({},g),Z),{tabs:{deviation:o(o({},g.tabs.deviation),null===(i=null==Z?void 0:Z.tabs)||void 0===i?void 0:i.deviation),association:o(o({},g.tabs.association),null===(n=null==Z?void 0:Z.tabs)||void 0===n?void 0:n.association)},sectionTitles:o(o({},g.sectionTitles),null==Z?void 0:Z.sectionTitles)})},[Z]),to=null==Y?void 0:Y.isMissingRationale,ro=r(to?eo.tabs.deviation.key:eo.tabs.association.key),ao=ro[0],lo=ro[1],co=r(!1),so=co[0],po=co[1],vo=a(function(o){po(o)},[]);l(function(){O?lo(to?eo.tabs.deviation.key:eo.tabs.association.key):po(!1)},[O,to,eo.tabs.deviation.key,eo.tabs.association.key]);var xo=t(function(){if(!K)return{border:eo.accentColor,shadow:"".concat(eo.accentColor,"2E")};var o=K.badgeText;return"#9F1239"===o||"#B42318"===o?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===o?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===o?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:eo.accentColor,shadow:"".concat(eo.accentColor,"2E")}},[K,eo.accentColor]);l(function(){if(O&&!so){var o=function(o){var i;(null===(i=Q.current)||void 0===i?void 0:i.contains(o.target))||(null==J?void 0:J.contains(o.target))||G()};return document.addEventListener("mousedown",o),function(){return document.removeEventListener("mousedown",o)}}},[O,G,J,Q,so]);var ho=to?[]:[eo.tabs.deviation,eo.tabs.association];if(1===ho.length&&ho[0].key===eo.tabs.deviation.key)return null;if(!O||!Y)return null;var uo=null!==(F=null!==(w=ao===eo.tabs.deviation.key?null===(y=null==oo?void 0:oo.cognitive_decisioning)||void 0===y?void 0:y.decision_strength:Y.relevance_score)&&void 0!==w?w:q)&&void 0!==F?F:0,go=Y.decisioning,bo=Array.isArray(go)?go:"string"==typeof go&&go.trim()?[go]:[],fo=Y.gap,mo=Array.isArray(fo)?fo:"string"==typeof fo&&fo.trim()?[fo]:[],yo=U?U.left-150:-9999,wo=(null!==(k=null==U?void 0:U.arrowLeft)&&void 0!==k?k:60)+150,Fo=i(c,o({ref:Q,sx:{position:"fixed",top:null!==(C=null==U?void 0:U.top)&&void 0!==C?C:-9999,left:yo,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(yo>0?yo:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(xo.border),boxShadow:"0px 8px 32px ".concat(xo.shadow,", 0px 0px 0px 3px ").concat(xo.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==U?void 0:U.maxHeight)?"min(60vh, ".concat(U.maxHeight,"px)"):"60vh",visibility:!so&&U?"visible":"hidden",pointerEvents:so?"none":"auto"}},{children:[U&&(U.openAbove?i(n,{children:[e(c,{sx:{position:"absolute",bottom:-11,left:wo-f,width:0,height:0,borderLeft:"".concat(f,"px solid transparent"),borderRight:"".concat(f,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(xo.border),zIndex:1}}),e(c,{sx:{position:"absolute",bottom:-9,left:wo-f+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(f,"px solid #FFFFFF"),zIndex:2}})]}):i(n,{children:[e(c,{sx:{position:"absolute",top:-11,left:wo-f,width:0,height:0,borderLeft:"".concat(f,"px solid transparent"),borderRight:"".concat(f,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(xo.border),zIndex:1}}),e(c,{sx:{position:"absolute",top:-9,left:wo-f+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(f,"px solid #FFFFFF"),zIndex:2}})]})),i(c,o({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[i(c,o({sx:{flex:1,minWidth:0}},{children:[("no counterpart"!==N||"no counterpart"!==P)&&i(s,o({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[e(c,o({component:"span",title:N,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:N})),e(c,o({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),e(c,o({component:"span",title:P||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:P||"Reference Section"}))]})),e(c,o({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:e(s,o({sx:{fontSize:"no counterpart"!==N||"no counterpart"!==P?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(S=Object.values(eo.tabs).find(function(o){return o.key===ao}))||void 0===S?void 0:S.subtitle}))}))]})),i(c,o({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[i(c,o({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[e(h,{}),eo.decisionStrengthLabel," ",uo,"%"]})),e(d,o({onClick:G,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:e(v,{size:22})}))]}))]})),e(c,o({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:ho.map(function(i){var n=ao===i.key,t=i.key===eo.tabs.deviation.key,r=ho.length>1&&t&&io,a=e(c,o({onClick:function(){r||lo(i.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:r?"not-allowed":"pointer",opacity:r?.5:1,fontSize:"14px",fontWeight:n?600:400,color:n?eo.accentColor:"#667085",backgroundColor:n?"".concat(eo.accentColor,"14"):"transparent",borderBottom:n?"2px solid ".concat(eo.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:i.label}),i.key);return r?e(p,o({title:"Fetching deviation data",arrow:!0,placement:"top"},{children:e("span",{children:a})}),i.key):a})})),e(c,o({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(xo.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:xo.border},scrollbarWidth:"thin",scrollbarColor:"".concat(xo.border,"55 transparent")}},{children:ao===eo.tabs.deviation.key?oo?i(n,{children:[(null===(_=(null===(D=null==oo?void 0:oo.cognitive_decisioning)||void 0===D?void 0:D.decisioning_factors)||[])||void 0===_?void 0:_.length)>0&&e(b,{title:"Decision Making Factors",content:null===(R=null===(E=null==oo?void 0:oo.cognitive_decisioning)||void 0===E?void 0:E.decisioning_factors)||void 0===R?void 0:R.join("\n\n"),citations:null===(z=null==oo?void 0:oo.cognitive_decisioning)||void 0===z?void 0:z.citations,styles:no,docData:X,deviationData:oo,open:O,onCitationFullscreenChange:vo}),(null===(I=(null===(W=null==oo?void 0:oo.cognitive_decisioning)||void 0===W?void 0:W.gaps_in_decision)||[])||void 0===I?void 0:I.length)>0&&e(b,{title:"Gaps in Decision",content:null===(j=null===(T=null==oo?void 0:oo.cognitive_decisioning)||void 0===T?void 0:T.gaps_in_decision)||void 0===j?void 0:j.join("\n\n"),citations:null===(A=null==oo?void 0:oo.cognitive_decisioning)||void 0===A?void 0:A.citations,styles:no,docData:X,deviationData:oo,open:O,onCitationFullscreenChange:vo}),0===(null===(L=(null===(B=null==oo?void 0:oo.cognitive_decisioning)||void 0===B?void 0:B.decisioning_factors)||[])||void 0===L?void 0:L.length)&&0===(null===(M=(null===(H=null==oo?void 0:oo.cognitive_decisioning)||void 0===H?void 0:H.gaps_in_decision)||[])||void 0===M?void 0:M.length)&&e(c,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:e(s,o({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):e(b,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:no,docData:X,open:O,onCitationFullscreenChange:vo}):i(n,{children:[bo.length>0&&e(b,{title:eo.sectionTitles.decisioningFactors,content:bo.join("\n\n"),citations:Y.citations,styles:no,open:O,docData:X,onCitationFullscreenChange:vo}),mo.length>0&&e(b,{title:eo.sectionTitles.gaps,content:mo.join("\n\n"),citations:Y.citations,styles:no,open:O,docData:X,onCitationFullscreenChange:vo}),0===bo.length&&0===mo.length&&e(c,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:e(s,o({sx:{fontSize:"13px",color:"#64748B"}},{children:eo.emptyStateMessage}))}))]})}))]}));return x.createPortal(Fo,document.body)};export{m as default};
1
+ import{__assign as o,__spreadArray as e}from"tslib";import{jsxs as i,Fragment as n,jsx as t}from"react/jsx-runtime";import{useMemo as a,useState as r,useCallback as l,useEffect as d}from"react";import{Box as s,Typography as c,IconButton as p,Tooltip as v}from"@mui/material";import{X as u}from"lucide-react";import g from"react-dom";import x from"../../assests/svg/SparkleIcon.js";import{SHARED_MARKDOWN_STYLES as b,DEFAULT_POPUP_CONFIG as h}from"./CognitiveCompareConfig.js";import f from"./CitationRenderer.js";import{POPUP_WIDTH as m,VIEWPORT_MARGIN as y,ARROW_SIZE as C}from"./CognitiveCompareConstants.js";import{useCompareContext as w}from"./CompareContext.js";import{buildOnDemandCitationContexts as F}from"./onDemandCitations/contextBuilder.js";import"./utils/normalizeRedlineMarkdown.js";import{buildOnDemandCitationPayload as k}from"./onDemandCitations/payload.js";var D=function(o){return Array.isArray(o)?o.filter(function(o){return"string"==typeof o&&o.trim().length>0}):"string"==typeof o&&o.trim().length>0?[o]:[]},I=function(I){var S,_,T,E,W,z,j,R,A,K,B,L,N,O,H,M,P,q,X,G,Y,J=I.open,Q=I.onClose,U=I.sectionTitle,V=I.referenceSectionTitle,Z=I.cognitiveData,$=I.relevanceScore,oo=I.anchorEl,eo=I.badgeStyle,io=I.popupRef,no=I.position,to=I.markdownStyles,ao=I.docData,ro=I.popupConfig,lo=I.deviationData,so=void 0===lo?null:lo,co=I.isLoading,po=I.sourceNodeId,vo=I.deviationKey,uo=I.baseContentId,go=I.compareContentIds,xo=w(),bo=xo.treeData,ho=xo.onDemandCitationConfig,fo=xo.prefetchOnDemandCitationContexts,mo=xo.abortOnDemandCitationContexts,yo=xo.getOnDemandCitationCacheEntry,Co=o(o({},b),to),wo=a(function(){var e,i;return o(o(o({},h),ro),{tabs:{deviation:o(o({},h.tabs.deviation),null===(e=null==ro?void 0:ro.tabs)||void 0===e?void 0:e.deviation),association:o(o({},h.tabs.association),null===(i=null==ro?void 0:ro.tabs)||void 0===i?void 0:i.association)},sectionTitles:o(o({},h.sectionTitles),null==ro?void 0:ro.sectionTitles)})},[ro]),Fo=null==Z?void 0:Z.isMissingRationale,ko=r(Fo?wo.tabs.deviation.key:wo.tabs.association.key),Do=ko[0],Io=ko[1],So=r(!1),_o=So[0],To=So[1],Eo=l(function(o){To(o)},[]);d(function(){J?Io(Fo?wo.tabs.deviation.key:wo.tabs.association.key):To(!1)},[J,Fo,wo.tabs.deviation.key,wo.tabs.association.key]),d(function(){var o,i;if(J&&(null==ho?void 0:ho.enabled)){var n=function(o){var i,n,t,a="deviation"===o,r=a?e(e([],D(null===(i=null==so?void 0:so.cognitive_decisioning)||void 0===i?void 0:i.decisioning_factors),!0),D(null===(n=null==so?void 0:so.cognitive_decisioning)||void 0===n?void 0:n.gaps_in_decision),!0):e(e([],D(null==Z?void 0:Z.decisioning),!0),D(null==Z?void 0:Z.gap),!0);return F({treeData:bo,content:r,requestId:ho.requestId,tabKey:o,popupNodeId:po||(null==so?void 0:so.nodeId)||(null==Z?void 0:Z.section_id),deviationKey:vo,sectionTitle:U,referenceSectionTitle:V,docData:ao,staticCitations:a?null===(t=null==so?void 0:so.cognitive_decisioning)||void 0===t?void 0:t.citations:null==Z?void 0:Z.citations,deviationData:so,cognitiveData:Z,baseContentId:uo,compareContentIds:go})},t=Do===wo.tabs.deviation.key,a="prefetchAllTabs"===ho.strategy?e(e([],n("deviation"),!0),n("association"),!0):n(t?"deviation":"association"),r=a.map(function(o){return k(ho,o)});return null===(o=ho.onContextsBuilt)||void 0===o||o.call(ho,a),null===(i=ho.onPayloadsBuilt)||void 0===i||i.call(ho,r,a),ho.debug&&(console.groupCollapsed("[CognitiveCompare:onDemandCitations]"),console.log("contexts",a),console.log("payloads",r),console.log("cacheEntries",a.map(function(o){return yo(o)})),console.groupEnd()),"prefetchActiveTab"!==ho.strategy&&"prefetchAllTabs"!==ho.strategy||fo(a).catch(function(o){ho.debug&&console.error("[CognitiveCompare:onDemandCitations] prefetch failed",o)}),function(){ho.abortOnPopupClose&&mo(a)}}},[mo,Do,wo.tabs.deviation.key,Z,so,ao,yo,ho,J,fo,V,U,po,vo,uo,go,bo]);var Wo=a(function(){if(!eo)return{border:wo.accentColor,shadow:"".concat(wo.accentColor,"2E")};var o=eo.badgeText;return"#9F1239"===o||"#B42318"===o?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===o?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===o?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:wo.accentColor,shadow:"".concat(wo.accentColor,"2E")}},[eo,wo.accentColor]);d(function(){if(J&&!_o){var o=function(o){var e;(null===(e=io.current)||void 0===e?void 0:e.contains(o.target))||(null==oo?void 0:oo.contains(o.target))||Q()};return document.addEventListener("mousedown",o),function(){return document.removeEventListener("mousedown",o)}}},[J,Q,oo,io,_o]);var zo=Fo?[]:[wo.tabs.deviation,wo.tabs.association];if(1===zo.length&&zo[0].key===wo.tabs.deviation.key)return null;if(!J||!Z)return null;var jo=null!==(T=null!==(_=Do===wo.tabs.deviation.key?null===(S=null==so?void 0:so.cognitive_decisioning)||void 0===S?void 0:S.decision_strength:Z.relevance_score)&&void 0!==_?_:$)&&void 0!==T?T:0,Ro=Z.decisioning,Ao=Array.isArray(Ro)?Ro:"string"==typeof Ro&&Ro.trim()?[Ro]:[],Ko=Z.gap,Bo=Array.isArray(Ko)?Ko:"string"==typeof Ko&&Ko.trim()?[Ko]:[],Lo=null!==(E=null==no?void 0:no.arrowLeft)&&void 0!==E?E:60,No=i(s,o({ref:io,sx:{position:"fixed",top:null!==(W=null==no?void 0:no.top)&&void 0!==W?W:-9999,left:null!==(z=null==no?void 0:no.left)&&void 0!==z?z:-9999,zIndex:9999,width:"min(".concat(m,"px, calc(100vw - ").concat(2*y,"px))"),maxWidth:"calc(100vw - ".concat(2*y,"px)"),boxSizing:"border-box",bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(Wo.border),boxShadow:"0px 8px 32px ".concat(Wo.shadow,", 0px 0px 0px 3px ").concat(Wo.shadow),overflow:"visible",display:_o?"none":"flex",flexDirection:"column",maxHeight:(null==no?void 0:no.maxHeight)?"min(60vh, ".concat(no.maxHeight,"px)"):"60vh",visibility:no?"visible":"hidden",pointerEvents:_o?"none":"auto"}},{children:[no&&(no.openAbove?i(n,{children:[t(s,{sx:{position:"absolute",bottom:-(C+1),left:Lo-C,width:0,height:0,borderLeft:"".concat(C,"px solid transparent"),borderRight:"".concat(C,"px solid transparent"),borderTop:"".concat(C+1,"px solid ").concat(Wo.border),zIndex:1}}),t(s,{sx:{position:"absolute",bottom:-(C-1),left:Lo-C+1,width:0,height:0,borderLeft:"".concat(C-1,"px solid transparent"),borderRight:"".concat(C-1,"px solid transparent"),borderTop:"".concat(C,"px solid #FFFFFF"),zIndex:2}})]}):i(n,{children:[t(s,{sx:{position:"absolute",top:-(C+1),left:Lo-C,width:0,height:0,borderLeft:"".concat(C,"px solid transparent"),borderRight:"".concat(C,"px solid transparent"),borderBottom:"".concat(C+1,"px solid ").concat(Wo.border),zIndex:1}}),t(s,{sx:{position:"absolute",top:-(C-1),left:Lo-C+1,width:0,height:0,borderLeft:"".concat(C-1,"px solid transparent"),borderRight:"".concat(C-1,"px solid transparent"),borderBottom:"".concat(C,"px solid #FFFFFF"),zIndex:2}})]})),i(s,o({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexWrap:{xs:"wrap",sm:"nowrap"},flexShrink:0}},{children:[i(s,o({sx:{flex:{xs:"1 1 100%",sm:1},minWidth:0}},{children:[("no counterpart"!==U||"no counterpart"!==V)&&i(c,o({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[t(s,o({component:"span",title:U,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:U})),t(s,o({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),t(s,o({component:"span",title:V||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:V||"Reference Section"}))]})),t(s,o({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:t(c,o({sx:{fontSize:"no counterpart"!==U||"no counterpart"!==V?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(j=Object.values(wo.tabs).find(function(o){return o.key===Do}))||void 0===j?void 0:j.subtitle}))}))]})),i(s,o({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0,maxWidth:"100%",ml:{xs:"auto",sm:0}}},{children:[i(s,o({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED",maxWidth:"100%",whiteSpace:"nowrap",overflow:"hidden"}},{children:[t(x,{}),wo.decisionStrengthLabel," ",jo,"%"]})),t(p,o({onClick:Q,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:t(u,{size:22})}))]}))]})),t(s,o({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0,maxWidth:"100%",overflowX:"auto"}},{children:zo.map(function(e){var i=Do===e.key,n=e.key===wo.tabs.deviation.key,a=zo.length>1&&n&&co,r=t(s,o({onClick:function(){a||Io(e.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:a?"not-allowed":"pointer",opacity:a?.5:1,fontSize:"14px",fontWeight:i?600:400,color:i?wo.accentColor:"#667085",backgroundColor:i?"".concat(wo.accentColor,"14"):"transparent",borderBottom:i?"2px solid ".concat(wo.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none",flexShrink:0}},{children:e.label}),e.key);return a?t(v,o({title:"Fetching deviation data",arrow:!0,placement:"top"},{children:t("span",{children:r})}),e.key):r})})),t(s,o({sx:{flex:1,minHeight:0,overflowY:"auto",overflowX:"auto",maxWidth:"100%",boxSizing:"border-box",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(Wo.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:Wo.border},scrollbarWidth:"thin",scrollbarColor:"".concat(Wo.border,"55 transparent")}},{children:Do===wo.tabs.deviation.key?so?i(n,{children:[(null===(A=(null===(R=null==so?void 0:so.cognitive_decisioning)||void 0===R?void 0:R.decisioning_factors)||[])||void 0===A?void 0:A.length)>0&&t(f,{title:"Decision Making Factors",content:null===(B=null===(K=null==so?void 0:so.cognitive_decisioning)||void 0===K?void 0:K.decisioning_factors)||void 0===B?void 0:B.join("\n\n"),citations:null===(L=null==so?void 0:so.cognitive_decisioning)||void 0===L?void 0:L.citations,styles:Co,docData:ao,deviationData:so,open:J,onCitationFullscreenChange:Eo,tabKey:"deviation",sectionTitle:U,referenceSectionTitle:V,sourceNodeId:po,deviationKey:vo,baseContentId:uo,compareContentIds:go}),(null===(O=(null===(N=null==so?void 0:so.cognitive_decisioning)||void 0===N?void 0:N.gaps_in_decision)||[])||void 0===O?void 0:O.length)>0&&t(f,{title:"Gaps in Decision",content:null===(M=null===(H=null==so?void 0:so.cognitive_decisioning)||void 0===H?void 0:H.gaps_in_decision)||void 0===M?void 0:M.join("\n\n"),citations:null===(P=null==so?void 0:so.cognitive_decisioning)||void 0===P?void 0:P.citations,styles:Co,docData:ao,deviationData:so,open:J,onCitationFullscreenChange:Eo,tabKey:"deviation",sectionTitle:U,referenceSectionTitle:V,sourceNodeId:po,deviationKey:vo,baseContentId:uo,compareContentIds:go}),0===(null===(X=(null===(q=null==so?void 0:so.cognitive_decisioning)||void 0===q?void 0:q.decisioning_factors)||[])||void 0===X?void 0:X.length)&&0===(null===(Y=(null===(G=null==so?void 0:so.cognitive_decisioning)||void 0===G?void 0:G.gaps_in_decision)||[])||void 0===Y?void 0:Y.length)&&t(s,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:t(c,o({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):t(f,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:Co,docData:ao,open:J,onCitationFullscreenChange:Eo,tabKey:"deviation",sectionTitle:U,referenceSectionTitle:V,sourceNodeId:po,deviationKey:vo,baseContentId:uo,compareContentIds:go}):i(n,{children:[Ao.length>0&&t(f,{title:wo.sectionTitles.decisioningFactors,content:Ao.join("\n\n"),citations:Z.citations,styles:Co,open:J,docData:ao,onCitationFullscreenChange:Eo,tabKey:"association",sectionTitle:U,referenceSectionTitle:V,sourceNodeId:po,deviationKey:vo,baseContentId:uo,compareContentIds:go}),Bo.length>0&&t(f,{title:wo.sectionTitles.gaps,content:Bo.join("\n\n"),citations:Z.citations,styles:Co,open:J,docData:ao,onCitationFullscreenChange:Eo,tabKey:"association",sectionTitle:U,referenceSectionTitle:V,sourceNodeId:po,deviationKey:vo,baseContentId:uo,compareContentIds:go}),0===Ao.length&&0===Bo.length&&t(s,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:t(c,o({sx:{fontSize:"13px",color:"#64748B"}},{children:wo.emptyStateMessage}))}))]})}))]}));return g.createPortal(No,document.body)};export{I as default};
2
2
  //# sourceMappingURL=CognitivePopup.js.map
@@ -1,2 +1,2 @@
1
- import{createContext as r,useContext as e}from"react";var o=r(null),t=o.Provider,n=function(){var r=e(o);if(!r)throw new Error("useCompareContext must be used within CompareContextProvider");return r};export{t as CompareContextProvider,n as useCompareContext};
1
+ import{createContext as r,useContext as e}from"react";var t=r(null),o=t.Provider,n=function(){return e(t)},i=function(){var r=e(t);if(!r)throw new Error("useCompareContext must be used within CompareContextProvider");return r};export{o as CompareContextProvider,i as useCompareContext,n as useOptionalCompareContext};
2
2
  //# sourceMappingURL=CompareContext.js.map
@@ -0,0 +1,2 @@
1
+ import{__assign as t,__awaiter as n,__generator as i}from"tslib";import{jsx as o}from"react/jsx-runtime";import{ChevronDown as e,ChevronUp as a,Maximize2 as r,X as l,ExternalLink as u}from"lucide-react";import{useMemo as d,useRef as c,useState as s,useEffect as v}from"react";import p from"../GptWebCitation/GptWebCitation.js";import{CitationType as x}from"../GptWebCitation/types.js";import{useCompareContext as m}from"./CompareContext.js";var f="calc(".concat("90vh"," - 120px)"),h="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",b="sai.siddhartha@techolution.com",C="672e32f7a0e8fe2e8e50bcba",g="TNV Sai Siddhartha",y=function(t){var n,i,o;return(null===(o=null===(i=null===(n=(null==t?void 0:t.extraMetaData)||t)||void 0===n?void 0:n.aiReasoningCitation)||void 0===i?void 0:i.gpt_citation)||void 0===o?void 0:o[0])||null},I=function(){var t;return"function"==typeof(null===(t=globalThis.crypto)||void 0===t?void 0:t.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=Math.floor(16*Math.random());return("x"===t?n:n%4+8).toString(16)})},w=function(t,n){var i=function(t){var n;return(null==t?void 0:t.payloadCitationId)||(null===(n=null==t?void 0:t.extraMetaData)||void 0===n?void 0:n.payloadCitationId)||""}(t)||n||I();return function(t,n){t&&"object"==typeof t&&(t.payloadCitationId=n,t.extraMetaData&&"object"==typeof t.extraMetaData&&(t.extraMetaData.payloadCitationId=n))}(t,i),i},D=function(D){var N,T=D.metaData,M=D.isFullscreen,U=void 0!==M&&M,E=m().gptWebCitationConfig,j=d(function(){return function(t){return{endpoint:(null==t?void 0:t.endpoint)||h,userEmail:(null==t?void 0:t.userEmail)||b,userId:(null==t?void 0:t.userId)||C,userName:(null==t?void 0:t.userName)||g,headers:null==t?void 0:t.headers}}(E)},[E]),G=null==T?void 0:T.webGpt,S=c(null);S.current||(S.current=I());var W=d(function(){return function(t,n,i){var o,e,a=y(t),r=(null==a?void 0:a.customMetaData)||{},l=(null==r?void 0:r.value)||{},u=(null==t?void 0:t.webSearchAnswer)||{},d=(null==t?void 0:t.extraMetaData)||t||{};return{userEmail:(null==t?void 0:t.userEmail)||(null==u?void 0:u.userEmail)||(null==n?void 0:n.userEmail)||"",userId:(null==t?void 0:t.userId)||(null==u?void 0:u.userId)||(null==n?void 0:n.userId)||"",userName:(null==t?void 0:t.userName)||(null==u?void 0:u.userName)||(null==n?void 0:n.userName)||"",citationId:w(t,i),citationUrl:(null==l?void 0:l.citationUrl)||(null==u?void 0:u.citationUrl)||"",content:(null==d?void 0:d.Reasoning)||(null==u?void 0:u.enhanced_content)||"",citationType:(null==l?void 0:l.citationType)||"web",citatioNumber:null!==(e=null!==(o=null==r?void 0:r.citation_number)&&void 0!==o?o:null==a?void 0:a.citation_number)&&void 0!==e?e:Number((null==t?void 0:t.reasoningId)||0)}}(G,j,S.current||void 0)},[G,j]),_=d(function(){return y(G)},[G]),P=(null===(N=null==_?void 0:_.customMetaData)||void 0===N?void 0:N.value)||{},F=(null==G?void 0:G.extraMetaData)||G||{},k=s(),R=k[0],z=k[1],A=s("pending"),H=A[0],O=A[1],V=s(!0),B=V[0],J=V[1];v(function(){var o=!0;return n(void 0,void 0,void 0,function(){var n,e,a,r;return i(this,function(i){switch(i.label){case 0:if(!j.endpoint||!(null==W?void 0:W.citationUrl)||!(null==W?void 0:W.content))return O("error"),[2];O("pending"),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,fetch(j.endpoint,{method:"POST",headers:t({"actor-id":W.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},j.headers||{}),body:JSON.stringify(W)})];case 2:if(!(n=i.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return e=i.sent(),a=(null==e?void 0:e.responseData)||(null==e?void 0:e.result)||(null==e?void 0:e.data)||e,o?(z(a),O("success"),[3,5]):[2];case 4:return r=i.sent(),o?(console.error("Failed to load GPT web citation",r),O("error"),[3,5]):[2];case 5:return[2]}})}),function(){o=!1}},[W,j]);var L=d(function(){return{item:{confidence_score:Number((null==F?void 0:F.Confidence_score)||0),text:(null==P?void 0:P.paraphrase)||"Web citation reasoning",dataSource:(null==P?void 0:P.text)||(null==F?void 0:F.Reasoning)||"",paraphrase:(null==P?void 0:P.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==W?void 0:W.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:e,ChevronUpIcon:a,MaximizeIcon:r,CloseIcon:l}}},[P,null==W?void 0:W.citatioNumber,F]),q=d(function(){return t(t({},L),U?{bodyHeight:f}:{})},[L,U]);return o(p,{gptCitation:q,defaultCitationUrl:(null==W?void 0:W.citationUrl)||"",citationType:x.GPT_WEB,webCitationData:R,webCitationStatus:H,showWebCitation:B,onToggleCitationView:function(){return J(function(t){return!t})},iconsConfig:{MaximizeIcon:r,ExternalLinkIcon:u},isFixedHeight:!0})};export{D as default};
2
+ //# sourceMappingURL=GptWebCitationPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GptWebCitationPanel.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{__spreadArray as o,__assign as i}from"tslib";import{jsx as r}from"react/jsx-runtime";import{useMemo as e}from"react";import{Box as t}from"@mui/material";import l from"react-markdown";import a from"rehype-raw";import{SHARED_MARKDOWN_STYLES as n}from"../../CognitiveCompareConfig.js";import{DEVIATION_BADGE_SEPARATOR as u,generateColorPalette as d}from"../../CognitiveComparehelpers.js";import{processGuidelinesMarkdown as s}from"../utils/processGuidelinesMarkdown.js";var g=function(g){var v=g.guidelinesData,p=g.deviationData,m=g.connectedSections,f=g.proposedSections,h=Array.from(m)[0],c=e(function(){var i;if(null==h||!p)return{targetHighlights:[],labelColor:""};var r="";"number"==typeof h?r=(null===(i=f[h])||void 0===i?void 0:i.nodeId)||"":"string"==typeof h&&(r=h.includes(u)?h.split(u)[0]:h.split("::")[0].split(":")[0]);var e=p[r];if(!e)return{targetHighlights:[],labelColor:""};var t=[],l=e.evaluation_result||{},a="";return Object.values(l).forEach(function(i){var r,e,l,n,u;(null===(r=null==i?void 0:i.deviation_highlights)||void 0===r?void 0:r.rulebook_guidelines)&&(t=o(o([],t,!0),i.deviation_highlights.rulebook_guidelines,!0),a=(null===(l=null===(e=i.evaluation_outputs)||void 0===e?void 0:e.metadata)||void 0===l?void 0:l.label_color)?d(null===(u=null===(n=i.evaluation_outputs)||void 0===n?void 0:n.metadata)||void 0===u?void 0:u.label_color).bg:"")}),{targetHighlights:t.filter(Boolean),labelColor:a}},[h,p,f]),b=c.targetHighlights,C=c.labelColor,_=e(function(){return s({guidelinesData:v,targetHighlights:b,labelColor:C||"#FEF08A"})},[v,b,C]);return r(t,i({sx:i(i({padding:"0px 12px",backgroundColor:"#FFFFFF",borderRadius:"8px"},n),{overflow:"visible"})},{children:r(l,i({rehypePlugins:[a]},{children:_}))}))};export{g as default};
1
+ import{__assign as r}from"tslib";import{jsx as o}from"react/jsx-runtime";import{useMemo as i}from"react";import{Box as e}from"@mui/material";import t from"react-markdown";import l from"rehype-raw";import{SHARED_MARKDOWN_STYLES as a}from"../../CognitiveCompareConfig.js";import{generateColorPalette as n}from"../../CognitiveComparehelpers.js";import{processGuidelinesMarkdown as s}from"../utils/processGuidelinesMarkdown.js";import{resolveGuidelineSelection as m}from"../utils/resolveGuidelineSelection.js";var p=function(p){var g=p.guidelinesData,u=p.deviationData,d=p.connectedSections,f=p.proposedSections,c=Array.from(d)[0],h=i(function(){if(null==c||!u)return{targetHighlights:[],labelColor:""};var r=m({activeIdentifier:c,deviationData:u,proposedSections:f}),o=r.labelColor?n(r.labelColor):null;return{targetHighlights:r.targetHighlights,labelColor:(null==o?void 0:o.bg)||""}},[c,u,f]),v=h.targetHighlights,C=h.labelColor,b=i(function(){return s({guidelinesData:g,targetHighlights:v,labelColor:C||"#FEF08A"})},[g,v,C]);return o(e,r({sx:r(r({padding:"0px 12px",marginTop:"12px",backgroundColor:"#FFFFFF",borderRadius:"8px"},a),{overflow:"visible"})},{children:o(t,r({rehypePlugins:[l]},{children:b}))}))};export{p as default};
2
2
  //# sourceMappingURL=GuidelinePanel.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__rest as r}from"tslib";import{jsx as n}from"react/jsx-runtime";import{useMemo as o}from"react";import{Box as t,Typography as a}from"@mui/material";import i from"react-markdown";import d from"rehype-raw";import{SHARED_MARKDOWN_STYLES as l}from"../../CognitiveCompareConfig.js";import{DEVIATION_BADGE_SEPARATOR as u,generateColorPalette as c}from"../../CognitiveComparehelpers.js";import s from"../../CitationAnchor.js";var v=function(e){var r,n,o=e.evalNode;return!1===(null===(n=null===(r=null==o?void 0:o.evaluation_outputs)||void 0===r?void 0:r.guideline_flag)||void 0===n?void 0:n.rulebook_used)},p=function(e,r,n){return"".concat(e,"::").concat(r,"::").concat(n)},f=function(e,r){return"".concat(e,"::").concat(r)},m={relativeWrapper:{verticalAlign:"baseline"},arrow:{color:"#6D28D9"}},w=function(w){var b=w.deviationData,y=w.connectedSections,h=w.proposedSections,g=Array.from(y||[])[0],x=o(function(){return function(e,r){var n;return"number"==typeof e?(null===(n=r[e])||void 0===n?void 0:n.nodeId)||"":e&&"string"==typeof e&&e.trim()?e.includes(u)?e.split(u)[0]:e.split("::")[0].split(":")[0]:""}(g,h||[])},[g,h]),K=o(function(){if(!b||"object"!=typeof b)return[];return Object.entries(b).flatMap(function(e){var r=e[0];return function(e){var r=e&&"object"==typeof e?e.evaluation_result:null;return!r||"object"!=typeof r&&!Array.isArray(r)?[]:Array.isArray(r)?r.map(function(e,r){return{evalNode:e,evaluationKey:String(r)}}):"object"==typeof r?Object.entries(r).map(function(e){var r=e[0];return{evalNode:e[1],evaluationKey:r}}):[]}(e[1]).filter(v).map(function(e){var n,o,t,a=e.evalNode,i=e.evaluationKey;return{nodeId:r,evaluationKey:i,answerKey:f(r,i),evaluation:a,webSearchAnswer:a.web_search_answer,colorPalette:null!==(t=c((null===(o=null===(n=null==a?void 0:a.evaluation_outputs)||void 0===n?void 0:n.metadata)||void 0===o?void 0:o.label_color)||""))&&void 0!==t?t:{border:m.arrow.color}}}).filter(function(e){var r=e.webSearchAnswer;return!!(null==r?void 0:r.enhanced_content)})}).map(function(r,n){return e(e({},r),{answerOrder:n})})},[b]),A=o(function(){return K.reduce(function(e,r){var n,o=(null===(n=r.webSearchAnswer)||void 0===n?void 0:n.extraMetaData)||{};return Object.entries(o).forEach(function(n){var o=n[0],t=n[1],a=p(r.nodeId,r.evaluationKey,o);e[a]={nodeId:r.nodeId,evaluationKey:r.evaluationKey,answerKey:r.answerKey,answerOrder:r.answerOrder,reasoningId:o,evaluation:r.evaluation,webSearchAnswer:r.webSearchAnswer,extraMetaData:t}}),e},{})},[K]),F=o(function(){return K.reduce(function(e,o){return e[o.answerKey]={a:function(e){var t=e.href,a=void 0===t?"":t,i=e.children,d=e.type,l=e.reason,u=r(e,["href","children","type","reason"]),c=null==u?void 0:u["data-cognitive-reasoning"],v=c?p(o.nodeId,o.evaluationKey,String(c)):"",f=v?A[v]:null;return n(s,{href:a,children:i,citationType:d,citationReason:l,metaData:{webGpt:f,webGptMetaKey:v},customStyle:m})}},e},{})},[K,A]);return n(t,e({sx:e(e({padding:"12px 12px 12px 0px",backgroundColor:"#FFFFFF",borderRadius:"8px"},l),{overflow:"visible"})},{children:K.length>0?K.map(function(r,o){return n(t,e({id:r.nodeId===x?"guideline-target-0":void 0,"data-web-gpt-node-id":r.nodeId,"data-web-gpt-evaluation-key":r.evaluationKey,"data-web-gpt-answer-order":r.answerOrder,"data-web-gpt-active":r.nodeId===x?"true":"false",sx:{mb:1.5,border:r.nodeId===x?"2px solid ".concat(r.colorPalette.border):"1px solid #d3d3d3",borderRadius:"6px",padding:"8px",backgroundColor:"#FFFFFF"}},{children:n(i,e({rehypePlugins:[d],components:F[r.answerKey]},{children:r.webSearchAnswer.enhanced_content}))}),r.answerKey)}):n(a,e({sx:{color:"#64748B",fontSize:"14px",py:1}},{children:"No web GPT data available."}))}))};export{w as default};
1
+ import{__assign as e,__rest as r}from"tslib";import{jsx as n}from"react/jsx-runtime";import{useMemo as o}from"react";import{Box as t,Typography as a}from"@mui/material";import i from"react-markdown";import d from"rehype-raw";import{SHARED_MARKDOWN_STYLES as u}from"../../CognitiveCompareConfig.js";import{generateColorPalette as l}from"../../CognitiveComparehelpers.js";import c from"../../CitationAnchor.js";import{resolveGuidelineSelection as v}from"../utils/resolveGuidelineSelection.js";var s=function(e){var r,n,o=e.evalNode;return!1===(null===(n=null===(r=null==o?void 0:o.evaluation_outputs)||void 0===r?void 0:r.guideline_flag)||void 0===n?void 0:n.rulebook_used)},p=function(e,r,n){return"".concat(e,"::").concat(r,"::").concat(n)},f=function(e,r){return"".concat(e,"::").concat(r)},w={relativeWrapper:{verticalAlign:"baseline"},arrow:{color:"#6D28D9"}},y=function(y){var b=y.deviationData,m=y.connectedSections,h=y.proposedSections,g=Array.from(m||[])[0],K=o(function(){return v({activeIdentifier:g,deviationData:b,proposedSections:h||[]})},[g,b,h]),x=o(function(){if(!b||"object"!=typeof b)return[];return Object.entries(b).flatMap(function(e){var r=e[0];return function(e){var r=e&&"object"==typeof e?e.evaluation_result:null;return!r||"object"!=typeof r&&!Array.isArray(r)?[]:Array.isArray(r)?r.map(function(e,r){return{evalNode:e,evaluationKey:String(r)}}):"object"==typeof r?Object.entries(r).map(function(e){var r=e[0];return{evalNode:e[1],evaluationKey:r}}):[]}(e[1]).filter(s).map(function(e){var n,o,t,a=e.evalNode,i=e.evaluationKey;return{nodeId:r,evaluationKey:i,answerKey:f(r,i),evaluation:a,webSearchAnswer:a.web_search_answer,colorPalette:null!==(t=l((null===(o=null===(n=null==a?void 0:a.evaluation_outputs)||void 0===n?void 0:n.metadata)||void 0===o?void 0:o.label_color)||""))&&void 0!==t?t:{border:w.arrow.color}}}).filter(function(e){var r=e.webSearchAnswer;return!!(null==r?void 0:r.enhanced_content)})}).map(function(r,n){return e(e({},r),{answerOrder:n})})},[b]),S=o(function(){var e;return null===(e=(null==K.evaluationKey?void 0:x.find(function(e){return e.nodeId===K.baseNodeId&&e.evaluationKey===K.evaluationKey}))||x.find(function(e){return e.nodeId===K.baseNodeId}))||void 0===e?void 0:e.answerKey},[K.baseNodeId,K.evaluationKey,x]),A=o(function(){return x.reduce(function(e,r){var n,o=(null===(n=r.webSearchAnswer)||void 0===n?void 0:n.extraMetaData)||{};return Object.entries(o).forEach(function(n){var o=n[0],t=n[1],a=p(r.nodeId,r.evaluationKey,o);e[a]={nodeId:r.nodeId,evaluationKey:r.evaluationKey,answerKey:r.answerKey,answerOrder:r.answerOrder,reasoningId:o,evaluation:r.evaluation,webSearchAnswer:r.webSearchAnswer,extraMetaData:t}}),e},{})},[x]),I=o(function(){return x.reduce(function(e,o){return e[o.answerKey]={a:function(e){var t=e.href,a=void 0===t?"":t,i=e.children,d=e.type,u=e.reason,l=r(e,["href","children","type","reason"]),v=null==l?void 0:l["data-cognitive-reasoning"],s=v?p(o.nodeId,o.evaluationKey,String(v)):"",f=s?A[s]:null;return n(c,{href:a,children:i,citationType:d,citationReason:u,metaData:{webGpt:f,webGptMetaKey:s},customStyle:w})}},e},{})},[x,A]);return n(t,e({sx:e(e({padding:"12px 12px 12px 0px",backgroundColor:"#FFFFFF",borderRadius:"8px"},u),{overflow:"visible"})},{children:x.length>0?x.map(function(r){var o=r.answerKey===S;return n(t,e({id:o?"guideline-target-0":void 0,"data-web-gpt-node-id":r.nodeId,"data-web-gpt-evaluation-key":r.evaluationKey,"data-web-gpt-answer-order":r.answerOrder,"data-web-gpt-active":o?"true":"false",sx:{mb:1.5,border:o?"2px solid ".concat(r.colorPalette.border):"1px solid #d3d3d3",borderRadius:"6px",padding:"8px",backgroundColor:"#FFFFFF"}},{children:n(i,e({rehypePlugins:[d],components:I[r.answerKey]},{children:r.webSearchAnswer.enhanced_content}))}),r.answerKey)}):n(a,e({sx:{color:"#64748B",fontSize:"14px",py:1}},{children:"No web GPT data available."}))}))};export{y as default};
2
2
  //# sourceMappingURL=WebGptPanel.js.map
@@ -1,2 +1,2 @@
1
- var a=function(a){var n,t,e=a.guidelinesData,i=a.targetHighlights,o=void 0===i?[]:i,l=a.labelColor,r=void 0===l?"#FEF08A":l,c="";if((null==e?void 0:e.learnings_data)&&Object.keys(e.learnings_data).length>0){var u=Object.keys(e.learnings_data)[0],d=e.learnings_data[u];(null==d?void 0:d.instruction_prompt)&&(c=d.instruction_prompt)}else{((null===(t=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.artifactData)||void 0===t?void 0:t.userStorySnapshot)||[]).forEach(function(a){var n;a.title&&(c+="### ".concat(a.title,"\n\n")),a.value&&(c+="".concat(a.value,"\n\n")),null===(n=a.sub_features)||void 0===n||n.forEach(function(a){a.title&&(c+="#### ".concat(a.title,"\n\n")),a.value&&(c+="".concat(a.value,"\n\n"))})})}return o.forEach(function(a,n){var t=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),e=new RegExp("(".concat(t,")"),"g");c=c.replace(e,'<mark id="guideline-target-'.concat(n,'" style="background-color: ').concat(r,'; border-radius: 3px; padding: 2px;">$1</mark>'))}),c};export{a as processGuidelinesMarkdown};
1
+ var n=function(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},t=function(n){return n.trim().replace(/\s+/g," ")},a=function(a){var r,i,o=a.guidelinesData,e=a.targetHighlights,c=void 0===e?[]:e,l=a.labelColor,u=void 0===l?"#FEF08A":l,d="";return"string"==typeof o?d=o:(null==o?void 0:o.learnings_data)&&"object"==typeof o.learnings_data?(r=o.learnings_data,i=new Set,d=Object.values(r).map(function(n){var a="string"==typeof(null==n?void 0:n.title)?n.title.trim():"",r="string"==typeof(null==n?void 0:n.instruction_prompt)?n.instruction_prompt.trim():"";if(!r)return"";var o="".concat(t(a),"\n").concat(t(r));return i.has(o)?"":(i.add(o),a?"# ".concat(a,"\n\n").concat(r):r)}).filter(Boolean).join("\n\n")):d=function(n){var t,a,r=null===(a=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.artifactData)||void 0===a?void 0:a.userStorySnapshot;if(!Array.isArray(r))return"";var i="";return r.forEach(function(n){(null==n?void 0:n.title)&&(i+="### ".concat(n.title,"\n\n")),(null==n?void 0:n.value)&&(i+="".concat(n.value,"\n\n")),Array.isArray(null==n?void 0:n.sub_features)&&n.sub_features.forEach(function(n){(null==n?void 0:n.title)&&(i+="#### ".concat(n.title,"\n\n")),(null==n?void 0:n.value)&&(i+="".concat(n.value,"\n\n"))})}),i.trim()}(o),function(a,r,i){var o=a,e=new Set,c=0;return r.forEach(function(a){if("string"==typeof a){var r=a.trim(),l=t(r).toLocaleLowerCase();if(l&&!e.has(l)){e.add(l);var u=r.split(/\s+/).map(n).join("\\s+"),d=new RegExp(u,"i").exec(o);if(console.log("LOG: Printing match",d,r,u,o),d){var s='<mark id="guideline-target-'.concat(c,'" style="background-color: ').concat(i,'; border-radius: 3px; padding: 2px;">').concat(d[0],"</mark>");o="".concat(o.slice(0,d.index)).concat(s).concat(o.slice(d.index+d[0].length)),c+=1}}}}),o}(d,Array.isArray(c)?c:[],u||"#FEF08A")};export{a as processGuidelinesMarkdown};
2
2
  //# sourceMappingURL=processGuidelinesMarkdown.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,hasSingleMappedLhsSection as m,generateColorPalette as I,getLhsDeviationDisplayIndexes as y,isMissingStr as b,getRhsMappedSectionNumber as w,safeStringify as S,DEVIATION_BADGE_SEPARATOR as R}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as _}from"../CognitiveCompareConstants.js";var F=function(F){var M,k,N,B,C,E,A,O,j,W,T,D,P,K,z,G=F.section,L=F.idx,X=F.columnKey,H=F.colRef,V=F.mb,Y=void 0===V?1:V,q=F.isExpanded,J=F.onToggle,Q=F.navigation,U=F.parentNodeId,Z=void 0===U?"":U,$=p(),nn=$.showOpenNodeRef,en=$.resolvedMarkdownStyles,on=$.maintainRelativeOrder,tn=$.showDeviationBadges,ln=void 0!==tn&&tn,dn=$.renderSubSectionAccordion,rn=$.treeData,an=$.proposedSections,un=$.existingSections,cn=$.deviationNumberRegistry,sn=$.deviationParentRegistry,vn=$.getBadgeRef,fn=$.openSummaryPopup,pn=$.getSectionCompareStyle,hn=$.connectedSections,gn=$.openMoreFunctionsPopup,xn=$.isProposingFix,mn=$.proposingFixNodeId,In=$.isRedlineFlow,yn=$.isSideBySide,bn=$.activeSideBySideSection,wn=$.scrollSyncLocked,Sn=$.unifiedNumbering,Rn=$.toggleScrollSyncLocked,_n=$.summaryPopupAnchorEl,Fn="".concat(yn?"1":"0","-").concat(String(null!=bn?bn:"")),Mn=(null===(M=G.displayTitle)||void 0===M||M)&&h(G.title),kn=!(!xn||!mn||"left"!==X||G.id!==mn&&G.nodeId!==mn),Nn=g(G.content),Bn="boolean"==typeof In?In:Nn,Cn=Nn,En=Bn&&Nn,An=En?x(G.content):G.content,On=En?G.content:void 0,jn=(null===(k=G.displayContent)||void 0===k||k||Nn)&&h(G.content),Wn=!Mn&&!jn,Tn=G.title;Mn||(Tn=jn?"No Title Found":"No Matching Section Found");var Dn="left"===X&&(G.isMultipleMapping||(null!==(B=null===(N=G.refContentIds)||void 0===N?void 0:N.length)&&void 0!==B?B:1)>1),Pn="left"===X&&Tn.length>29?"".concat(Tn.slice(0,29).trimEnd(),"..."):Tn,Kn=G.evaluationResult;if(!Kn&&"right"===X)if(on){var zn=null===(C=G.refIndexes)||void 0===C?void 0:C[0],Gn=an.find(function(n){return n.selfIndex===zn});Kn=null==Gn?void 0:Gn.evaluationResult}else Kn=null===(E=an[L])||void 0===E?void 0:E.evaluationResult;var Ln=null===(A=null==rn?void 0:rn.input_index_map)||void 0===A?void 0:A[0],Xn=null===(O=null==rn?void 0:rn.input_index_map)||void 0===O?void 0:O[1],Hn="left"===X?Xn:Ln,Vn=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Vn(l.subsections,e);if(d)return d}}return null},Yn="left"===X?G:Vn(an,G.id),qn="right"===X?G:Vn(un,G.id),Jn=o.useMemo(function(){if(!on)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return S(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===X){var a=an.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});a.length>0&&(r=a[0].nodeId||a[0].id)}var u=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,a=null===(d=s[i])||void 0===d?void 0:d[Z];if(function(n,i){if("string"!=typeof i||b(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===X?t||o:l||o,a)){var c="".concat(r).concat(R).concat(i),v=null==cn?void 0:cn[c];null!=v&&v<n&&(n=v);var f="".concat(u).concat(R).concat(i),p=null==cn?void 0:cn[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}},o="right"===X?an.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(G.selfIndex)}):[];if(1===o.length){var t=o[0];(t.refIndexes||[]).map(function(n){return un.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,t,n,!0)})}else i(G,Yn,qn,!0);return n!==1/0?n-1:0},[G,Yn,qn,X,Z,cn,on,an,un]);if(on)if("left"===X){var Qn=null===(j=G.refIndexes)||void 0===j?void 0:j[0],Un=un.findIndex(function(n){return n.selfIndex===Qn});qn=-1!==Un?un[Un]:Vn(un,G.id)}else{var Zn=null===(W=G.refIndexes)||void 0===W?void 0:W[0],$n=an.findIndex(function(n){return n.selfIndex===Zn});Yn=-1!==$n?an[$n]:Vn(an,G.id)}var ne="left"===X?!qn:!Yn,ee=on&&"right"===X&&m(G,an),ie=Kn||(null==Yn?void 0:Yn.evaluationResult)||(null==qn?void 0:qn.evaluationResult),oe=null!==(P=null===(D=null===(T=null==ie?void 0:ie.evaluation_outputs)||void 0===T?void 0:T.metadata)||void 0===D?void 0:D.label_color)&&void 0!==P?P:_,te=I(oe).highlightBg,le=(null==ie?void 0:ie.deviations)||{},de=o.useMemo(function(){return on&&"right"===X?y(an,Ln,cn):new Map},[on,X,an,Ln,cn]),re=G.nodeId||G.id;if(on&&"left"!==X){var ae=an.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(G.selfIndex)});ae.length>0?re=ae[0].nodeId||ae[0].id:(null==Yn?void 0:Yn.id)&&(re=Yn.nodeId||Yn.id)}var ue=o.useMemo(function(){var n,e=new Map;if(!on||"right"!==X)return e;var i=1,o=an.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(G.selfIndex)}),t=1===o.length&&1===(null===(n=o[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return S(n||"").replace(/\\n/g,"\n")},d=function(n,e){var i=e?o[0]:Vn(an,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(t){var r=function(n,e){if(void 0===e&&(e=!1),n){var o=d(n,e),t=o.lhsNode,a=o.evalResult,u=o.registryNodeId,c=l(n.content);Object.entries((null==a?void 0:a.deviations)||{}).forEach(function(n){var e=n[0],o=n[1],d=o[Z],r=l(d);if(!!t&&!b(o[Hn])&&r&&c.includes(r)){var a="".concat(u).concat(R).concat(e),s=cn[a];null!=s&&(i=Math.max(i,Math.max(1,s-(Jn||0))+1))}}),(n.subsections||[]).forEach(function(n){return r(n)})}};r(G,!0)}var a=function(n,o){if(void 0===o&&(o=!1),n){var t=d(n,o),r=t.lhsNode,u=t.evalResult,c=t.registryNodeId,s=(null==u?void 0:u.deviations)||{},v=l(n.content);Object.entries(s).map(function(n){var e,i=n[0],o=n[1],t=o[Z],d=!r||b(o[Hn]),a=l(t),u=a?v.indexOf(a):-1,s="".concat(c).concat(R).concat(i);return{refId:s,isRenderable:d&&!!a&&!b(t),position:u,registryIndex:null!==(e=cn[s])&&void 0!==e?e:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return a(n)})}};return a(G,!0),e},[on,X,G,an,Z,Hn,cn,Jn]),ce=Object.keys(le)[0],se=ce?"".concat(re).concat(R).concat(ce):null,ve=se?null==sn?void 0:sn[se]:null,fe=L+1;if(on&&Sn){var pe="left"===X?Sn.leftNums.get(null==G?void 0:G.id):Sn.rightNums.get(null==G?void 0:G.id);ne&&void 0!==pe?fe=pe:null!=ve&&ve>=0?fe=ve:void 0!==pe&&(fe=pe)}else null!=ve&&ve>=0&&(fe=ve);var he=Object.entries(le).map(function(n){var e=n[0],i=n[1],o="".concat(re).concat(R).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:cn[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});he.sort(function(n,e){return n.currentIndex-e.currentIndex});var ge,xe,me=he.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,u=e.deviationMap,c=e.refId,s=e.currentIndex,v=u[Z],f=b(v);if(f)v="";else if(!v)return null;var p=L,h=L;if(on)if("left"===X){var g=null===(i=G.refIndexes)||void 0===i?void 0:i[0],x=un.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var m=un.findIndex(function(n){return n.id===G.id||n.nodeId===G.nodeId||n.contentId===G.contentId});h=-1!==m?m:L}}else{var y=null===(o=G.refIndexes)||void 0===o?void 0:o[0],S=an.findIndex(function(n){return n.selfIndex===y});if(-1!==S)p=S;else p=-1!==(A=an.findIndex(function(n){return n.id===G.id||n.nodeId===G.nodeId||n.contentId===G.contentId}))?A:L}var _="".concat(re).concat(R).concat(a).concat(R).concat(p).concat(R).concat(h),F=u[Hn],M=ne||b(F),k=ue.get(c),N=de.get(c);on&&"right"===X&&M&&void 0!==k?s=k:on&&"right"===X&&!M&&void 0!==N?s=N:on&&void 0!==Jn&&("right"!==X||M||ee)&&(s-=Jn),s=Math.max(1,s);var B=on&&"right"===X&&M&&Sn?w({section:G,proposedSections:an,leftNums:Sn.leftNums,fallbackNumber:String(fe),firstOnly:!0}):fe,C="".concat(B,".").concat(s),E=L;if("right"===X&&on){var A,O=null===(t=G.refIndexes)||void 0===t?void 0:t[0],j=an.findIndex(function(n){return n.selfIndex===O});if(-1!==j)E=j;else-1!==(A=an.findIndex(function(n){return n.id===G.id||n.nodeId===G.nodeId||n.contentId===G.contentId}))&&(E=A)}var W=pn?pn(E):null,T=(null==u?void 0:u.evaluation_outputs)||(null==ie?void 0:ie.evaluation_outputs),D=null!==(l=null==T?void 0:T.output_value)&&void 0!==l?l:null,P=null!==(r=null===(d=null==T?void 0:T.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:oe,K=I(P),z=W?n(n({},W),{badgeBg:K.badgeBg,badgeBorder:K.badgeBorder,badgeText:K.badgeText}):n({},K),H=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==ie?void 0:ie.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==ie?void 0:ie.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==ie?void 0:ie.deviation_explanation),evaluation_outputs:T,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==ie?void 0:ie.cognitive_decisioning)}:null,V=0,Y=An||"";if(v&&Y){var q=Y.split(/\n{2,}/),J=q.findIndex(function(n){return n.includes(v)});if(-1!==J){var Q=Object.entries(le).filter(function(n){n[0];var e=n[1][Z];return e&&q[J].includes(e)}).sort(function(n,e){return q[J].indexOf(n[1][Z])-q[J].indexOf(e[1][Z])}),U=Q.filter(function(n){n[0];var e=n[1][Z];return e&&(e.includes(v)||v.includes(e))});U.length>1&&(V=Math.max(0,U.findIndex(function(n){return n[0]===a})))}}var $=vn(X,c);return{id:c,actionId:_,label:C,highlight:v,side:X,style:z,stackIndex:V,score:D,isConnected:null==hn?void 0:hn.has(_),showScrollLockToggle:(null==hn?void 0:hn.has(_))||yn&&bn===_||!!_n&&_n===$.current,scrollSyncLocked:wn,toggleScrollSyncLocked:Rn,isOrphan:M,isMissingClause:f,badgeRef:$,onClick:function(n){n.stopPropagation(),gn&&gn(n,Yn||{id:"orphan-left",title:"",content:""},M,qn||{id:"orphan-right",title:"",content:""},_,z)},onSummaryClick:function(n){n.stopPropagation(),fn(n,_,M,H)}}}).filter(Boolean),Ie=ln||!Bn&&kn?me:[],ye=me.map(function(n){return n.highlight}).filter(Boolean),be=G.id&&X===(null==Q?void 0:Q.columnKey)?Q:null,we=o.useRef(!1);return t(function(){q||(we.current=!1)},[q]),e(l,n({ref:H,sx:{mb:Y,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[q&&(null==be?void 0:be.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==be?void 0:be.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===X?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===X?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(K=null==be?void 0:be.showAboveRef)||void 0===K?void 0:K.current)?window.getComputedStyle(be.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!Wn&&q,onChange:function(){Wn||(J(),nn.current=G.id)},sx:{boxShadow:"none",border:Wn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Wn?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[i(r,n({expandIcon:Wn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Wn?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:Mn&&i(a,n({title:Tn,placement:"top"},{children:i(u,n({component:"div",sx:{fontSize:"12px",color:Wn?"#94A3B8":"#19213D",fontWeight:Wn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ge=Pn,xe=Dn,void 0===xe&&(xe=!1),ge?S(ge).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",n({style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:o})),xe&&i("span",n({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",flexShrink:0,lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!Wn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[jn&&i(f,{content:An,overlayContent:On,sxStyles:en,highlights:ye,maintainRelativeOrder:on,highlightBg:te,suppressHighlightBg:Cn,deviationBadges:Ie,collisionKey:Fn}),(G.subsections||[]).map(function(n,e){return dn({section:n,keyPath:"".concat(L,"-").concat(e),depth:0,columnKey:X,parentNodeId:Z,sectionOffset:Jn,rhsOrphanVisualIndexes:ue})})]}))]})),q&&(null==be?void 0:be.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==be?void 0:be.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===X?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===X?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(z=null==be?void 0:be.showBelowRef)||void 0===z?void 0:z.current)?window.getComputedStyle(be.showBelowRef.current).color:void 0})}))}))]}),"".concat(X,"-sec-").concat(L))};export{F as default};
1
+ import{__spreadArray as n,__assign as e}from"tslib";import{jsxs as i,jsx as o}from"react/jsx-runtime";import t,{useEffect as l}from"react";import{Box as r,Accordion as d,AccordionSummary as a,Tooltip as u,Typography as c,AccordionDetails as s}from"@mui/material";import{ChevronUp as v,ChevronDown as f}from"lucide-react";import{MemoizedMarkdown as p}from"../hooks/memoizedMarkdown.js";import{useCompareContext as h}from"../CompareContext.js";import{hasValue as g,hasMeaningfulRedlineTags as m,safeStringify as x,stripRedlineTags as I,hasSingleMappedLhsSection as y,generateColorPalette as b,getLhsDeviationDisplayIndexes as w,DEVIATION_BADGE_SEPARATOR as S,isMissingStr as R,getRhsMappedSectionNumber as M,findTextMatchRange as _}from"../CognitiveComparehelpers.js";import{findTextRangeWithFormatting as k}from"../utils/normalizeInlineMarkdown.js";import{DEFAULT_DEVIAION_COLOR as F}from"../CognitiveCompareConstants.js";import{normalizeRedlineMarkdown as N}from"../utils/normalizeRedlineMarkdown.js";var B=function(B){var C,E,A,O,j,W,T,D,P,z,K,G,L,X,H,V=B.section,Y=B.idx,q=B.columnKey,J=B.colRef,Q=B.mb,U=void 0===Q?1:Q,Z=B.isExpanded,$=B.onToggle,nn=B.navigation,en=B.parentNodeId,on=void 0===en?"":en,tn=h(),ln=tn.showOpenNodeRef,rn=tn.resolvedMarkdownStyles,dn=tn.maintainRelativeOrder,an=tn.showDeviationBadges,un=void 0!==an&&an,cn=tn.renderSubSectionAccordion,sn=tn.treeData,vn=tn.proposedSections,fn=tn.existingSections,pn=tn.deviationNumberRegistry,hn=tn.deviationParentRegistry,gn=tn.getBadgeRef,mn=tn.openSummaryPopup,xn=tn.getSectionCompareStyle,In=tn.connectedSections,yn=tn.openMoreFunctionsPopup,bn=tn.isProposingFix,wn=tn.proposingFixNodeId,Sn=tn.isRedlineFlow,Rn=tn.isSideBySide,Mn=tn.activeSideBySideSection,_n=tn.scrollSyncLocked,kn=tn.unifiedNumbering,Fn=tn.toggleScrollSyncLocked,Nn=tn.summaryPopupAnchorEl,Bn="".concat(Rn?"1":"0","-").concat(String(null!=Mn?Mn:"")),Cn=(null===(C=V.displayTitle)||void 0===C||C)&&g(V.title),En=!(!bn||!wn||"left"!==q||V.id!==wn&&V.nodeId!==wn&&V.contentId!==wn),An=m(V.content),On="boolean"==typeof Sn?Sn:An,jn=An,Wn=V.change_history,Tn=On&&An,Dn=t.useMemo(function(){return Tn?N(x(V.content)):x(V.content)},[V.content,Tn]),Pn=Tn?I(Dn):V.content,zn=Tn?Dn:void 0,Kn=An&&g(Wn)?x(Wn):void 0,Gn=(null===(E=V.displayContent)||void 0===E||E||An)&&g(V.content),Ln=!Cn&&!Gn,Xn=V.title;Cn||(Xn=Gn?"No Title Found":"No Matching Section Found");var Hn="left"===q&&(V.isMultipleMapping||(null!==(O=null===(A=V.refContentIds)||void 0===A?void 0:A.length)&&void 0!==O?O:1)>1),Vn="left"===q&&Xn.length>29?"".concat(Xn.slice(0,29).trimEnd(),"..."):Xn,Yn=V.evaluationResult;if(!Yn&&"right"===q)if(dn){var qn=null===(j=V.refIndexes)||void 0===j?void 0:j[0],Jn=vn.find(function(n){return n.selfIndex===qn});Yn=null==Jn?void 0:Jn.evaluationResult}else Yn=null===(W=vn[Y])||void 0===W?void 0:W.evaluationResult;var Qn=null===(T=null==sn?void 0:sn.input_index_map)||void 0===T?void 0:T[0],Un=null===(D=null==sn?void 0:sn.input_index_map)||void 0===D?void 0:D[1],Zn="left"===q?Un:Qn,$n=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var r=$n(l.subsections,e);if(r)return r}}return null},ne="left"===q?V:$n(vn,V.id),ee="right"===q?V:$n(fn,V.id),ie=t.useMemo(function(){if(!dn)return 0;var n=1/0,e=function(n){var e=x(n||"").replace(/\\n/g,"\n");return m(e)?I(N(e)):e},i=function(o,t,l,r){if(o){var d=o.nodeId||o.id;if(r&&"right"===q){var a=vn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});a.length>0&&(d=a[0].nodeId||a[0].id)}var u=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var r,a=null===(r=s[i])||void 0===r?void 0:r[on];if(function(n,i){if("string"!=typeof i||R(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&!!_(o,t)}("left"===q?t||o:l||o,a)){var c="".concat(d).concat(S).concat(i),v=null==pn?void 0:pn[c];null!=v&&v<n&&(n=v);var f="".concat(u).concat(S).concat(i),p=null==pn?void 0:pn[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}},o="right"===q?vn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(V.selfIndex)}):[];if(1===o.length){var t=o[0];(t.refIndexes||[]).map(function(n){return fn.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,t,n,!0)})}else i(V,ne,ee,!0);return n!==1/0?n-1:0},[V,ne,ee,q,on,pn,dn,vn,fn]);if(dn)if("left"===q){var oe=null===(P=V.refIndexes)||void 0===P?void 0:P[0],te=fn.findIndex(function(n){return n.selfIndex===oe});ee=-1!==te?fn[te]:$n(fn,V.id)}else{var le=null===(z=V.refIndexes)||void 0===z?void 0:z[0],re=vn.findIndex(function(n){return n.selfIndex===le});ne=-1!==re?vn[re]:$n(vn,V.id)}var de="left"===q?!ee:!ne,ae=dn&&"right"===q&&y(V,vn),ue=Yn||(null==ne?void 0:ne.evaluationResult)||(null==ee?void 0:ee.evaluationResult),ce=null!==(L=null===(G=null===(K=null==ue?void 0:ue.evaluation_outputs)||void 0===K?void 0:K.metadata)||void 0===G?void 0:G.label_color)&&void 0!==L?L:F,se=b(ce).highlightBg,ve=(null==ue?void 0:ue.deviations)||{},fe=t.useMemo(function(){return dn&&"right"===q?w(vn,Qn,pn):new Map},[dn,q,vn,Qn,pn]),pe=V.nodeId||V.id;if(dn&&"left"!==q){var he=vn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(V.selfIndex)});he.length>0?pe=he[0].nodeId||he[0].id:(null==ne?void 0:ne.id)&&(pe=ne.nodeId||ne.id)}var ge=t.useMemo(function(){var n,e=new Map;if(!dn||"right"!==q)return e;var i=1,o=vn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(V.selfIndex)}),t=1===o.length&&1===(null===(n=o[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return x(n||"").replace(/\\n/g,"\n")},r=function(n,e){var i=e?o[0]:$n(vn,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(t){var d=function(n,e){if(void 0===e&&(e=!1),n){var o=r(n,e),t=o.lhsNode,a=o.evalResult,u=o.registryNodeId,c=l(n.content);Object.entries((null==a?void 0:a.deviations)||{}).forEach(function(n){var e=n[0],o=n[1],r=o[on],d=l(r);if(!!t&&!R(o[Zn])&&d&&_(c,d)){var a="".concat(u).concat(S).concat(e),s=pn[a];null!=s&&(i=Math.max(i,Math.max(1,s-(ie||0))+1))}}),(n.subsections||[]).forEach(function(n){return d(n)})}};d(V,!0)}var a=function(n,o){if(void 0===o&&(o=!1),n){var t=r(n,o),d=t.lhsNode,u=t.evalResult,c=t.registryNodeId,s=(null==u?void 0:u.deviations)||{},v=l(n.content);Object.entries(s).map(function(n){var e,i,o,t,r,a=n[0],u=n[1],s=u[on],f=!d||R(u[Zn]),p=l(s),h=-1;p&&-1===(h=null!==(i=null===(e=_(v,p))||void 0===e?void 0:e.start)&&void 0!==i?i:-1)&&(h=null!==(t=null===(o=k(v,p))||void 0===o?void 0:o.start)&&void 0!==t?t:-1);var g="".concat(c).concat(S).concat(a);return{refId:g,isRenderable:f&&!!p&&!R(s),position:h,registryIndex:null!==(r=pn[g])&&void 0!==r?r:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return a(n)})}};return a(V,!0),e},[dn,q,V,vn,on,Zn,pn,ie]),me=Object.keys(ve)[0],xe=me?"".concat(pe).concat(S).concat(me):null,Ie=xe?null==hn?void 0:hn[xe]:null,ye=Y+1;if(dn&&kn){var be="left"===q?kn.leftNums.get(null==V?void 0:V.id):kn.rightNums.get(null==V?void 0:V.id);de&&void 0!==be?ye=be:null!=Ie&&Ie>=0?ye=Ie:void 0!==be&&(ye=be)}else null!=Ie&&Ie>=0&&(ye=Ie);var we=Math.max.apply(Math,n([0],Object.keys(ve).map(function(n){return pn["".concat(pe).concat(S).concat(n)]}).filter(function(n){return"number"==typeof n&&Number.isFinite(n)}),!1))+1,Se=Object.entries(ve).map(function(n){var e,i=n[0],o=n[1],t="".concat(pe).concat(S).concat(i);return{deviationKey:i,deviationMap:o,refId:t,currentIndex:null!==(e=pn[t])&&void 0!==e?e:we++}});Se.sort(function(n,e){return n.currentIndex-e.currentIndex});var Re,Me,_e=Se.map(function(n){var i,o,t,l,r,d,a=n.deviationKey,u=n.deviationMap,c=n.refId,s=n.currentIndex,v=u[on],f=R(v);if(f)v="";else if(!v)return null;var p=Y,h=Y;if(dn)if("left"===q){var g=null===(i=V.refIndexes)||void 0===i?void 0:i[0],m=fn.findIndex(function(n){return n.selfIndex===g});if(-1!==m)h=m;else{var x=fn.findIndex(function(n){return n.id===V.id||n.nodeId===V.nodeId||n.contentId===V.contentId});h=-1!==x?x:Y}}else{var I=null===(o=V.refIndexes)||void 0===o?void 0:o[0],y=vn.findIndex(function(n){return n.selfIndex===I});if(-1!==y)p=y;else p=-1!==(A=vn.findIndex(function(n){return n.id===V.id||n.nodeId===V.nodeId||n.contentId===V.contentId}))?A:Y}var w="".concat(pe).concat(S).concat(a).concat(S).concat(p).concat(S).concat(h),_=u[Zn],k=de||R(_),F=ge.get(c),N=fe.get(c);dn&&"right"===q&&k&&void 0!==F?s=F:dn&&"right"===q&&!k&&void 0!==N?s=N:dn&&void 0!==ie&&("right"!==q||k||ae)&&(s-=ie),s=Math.max(1,s);var B=dn&&"right"===q&&k&&kn?M({section:V,proposedSections:vn,leftNums:kn.leftNums,fallbackNumber:String(ye),firstOnly:!0}):ye,C="".concat(B,".").concat(s),E=Y;if("right"===q&&dn){var A,O=null===(t=V.refIndexes)||void 0===t?void 0:t[0],j=vn.findIndex(function(n){return n.selfIndex===O});if(-1!==j)E=j;else-1!==(A=vn.findIndex(function(n){return n.id===V.id||n.nodeId===V.nodeId||n.contentId===V.contentId}))&&(E=A)}var W=xn?xn(E):null,T=(null==u?void 0:u.evaluation_outputs)||(null==ue?void 0:ue.evaluation_outputs),D=null!==(l=null==T?void 0:T.output_value)&&void 0!==l?l:null,P=null!==(d=null===(r=null==T?void 0:T.metadata)||void 0===r?void 0:r.label_color)&&void 0!==d?d:ce,z=b(P),K=W?e(e({},W),{badgeBg:z.badgeBg,badgeBorder:z.badgeBorder,badgeText:z.badgeText}):e({},z),G=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==ue?void 0:ue.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==ue?void 0:ue.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==ue?void 0:ue.deviation_explanation),evaluation_outputs:T,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==ue?void 0:ue.cognitive_decisioning)}:null,L=0,X=Pn||"";if(v&&X){var H=X.split(/\n{2,}/),J=H.findIndex(function(n){return n.includes(v)});if(-1!==J){var Q=Object.entries(ve).filter(function(n){n[0];var e=n[1][on];return e&&H[J].includes(e)}).sort(function(n,e){return H[J].indexOf(n[1][on])-H[J].indexOf(e[1][on])}),U=Q.filter(function(n){n[0];var e=n[1][on];return e&&(e.includes(v)||v.includes(e))});U.length>1&&(L=Math.max(0,U.findIndex(function(n){return n[0]===a})))}}var Z=gn(q,c);return{id:c,actionId:w,label:C,highlight:v,side:q,style:K,stackIndex:L,score:D,isConnected:null==In?void 0:In.has(w),showScrollLockToggle:(null==In?void 0:In.has(w))||Rn&&Mn===w||!!Nn&&Nn===Z.current,scrollSyncLocked:_n,toggleScrollSyncLocked:Fn,isOrphan:k,isMissingClause:f,badgeRef:Z,onClick:function(n){n.stopPropagation(),yn&&yn(n,ne||{id:"orphan-left",title:"",content:""},k,ee||{id:"orphan-right",title:"",content:""},w,K)},onSummaryClick:function(n){n.stopPropagation(),mn(n,w,k,G)}}}).filter(Boolean),ke=un||En?_e:[],Fe=_e.map(function(n){return n.highlight}).filter(Boolean),Ne=V.id&&q===(null==nn?void 0:nn.columnKey)?nn:null,Be=t.useRef(!1);return l(function(){Z||(Be.current=!1)},[Z]),i(r,e({ref:J,sx:{mb:U,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[Z&&(null==Ne?void 0:Ne.showAbove)&&o("div",e({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==Ne?void 0:Ne.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:o("div",e({style:e({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===q?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===q?{right:"-20px"}:{left:"-20px"})},{children:o(v,{color:(null===(X=null==Ne?void 0:Ne.showAboveRef)||void 0===X?void 0:X.current)?window.getComputedStyle(Ne.showAboveRef.current).color:void 0})}))})),i(d,e({disableGutters:!0,expanded:!Ln&&Z,onChange:function(){Ln||($(),ln.current=V.id)},sx:{boxShadow:"none",border:Ln?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Ln?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[o(a,e({expandIcon:Ln?null:o(f,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Ln?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:Cn&&o(u,e({title:Xn,placement:"top"},{children:o(c,e({component:"div",sx:{fontSize:"12px",color:Ln?"#94A3B8":"#19213D",fontWeight:Ln?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Re=Vn,Me=Hn,void 0===Me&&(Me=!1),Re?x(Re).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(n,t){return n.startsWith("**")&&n.endsWith("**")?o("strong",{children:n.slice(2,-2)},t):i("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[o("span",e({style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:n})),Me&&o("span",e({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",flexShrink:0,lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!Ln&&i(s,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Gn&&o(p,{content:Pn,overlayContent:zn,fallbackContent:Kn,sxStyles:rn,highlights:Fe,maintainRelativeOrder:dn,highlightBg:se,suppressHighlightBg:jn,deviationBadges:ke,collisionKey:Bn}),(V.subsections||[]).map(function(n,e){return cn({section:n,keyPath:"".concat(Y,"-").concat(e),depth:0,columnKey:q,parentNodeId:on,sectionOffset:ie,rhsOrphanVisualIndexes:ge})})]}))]})),Z&&(null==Ne?void 0:Ne.showBelow)&&o("div",e({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==Ne?void 0:Ne.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:o("div",e({style:e({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===q?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===q?{right:"-20px"}:{left:"-20px"})},{children:o(f,{color:(null===(H=null==Ne?void 0:Ne.showBelowRef)||void 0===H?void 0:H.current)?window.getComputedStyle(Ne.showBelowRef.current).color:void 0})}))}))]}),"".concat(q,"-sec-").concat(Y))};export{B as default};
2
2
  //# sourceMappingURL=SectionAccordion.js.map