@viswa-test/test-citation 0.0.254 → 0.0.255
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.
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/helper.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +1 -1
- package/dist/cjs/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/Segment.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/segment.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/story-screen/CompletionPanel.js +1 -1
- package/dist/cjs/features/RequirementAI/components/story-screen/CompletionPanel.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
- package/dist/cjs/hooks/useOnDemandCitationFetch.js +1 -1
- package/dist/cjs/service/onDemandApi.js +1 -1
- package/dist/cjs/service/redlineService.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/helper.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.module.css.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +1 -1
- package/dist/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.js +1 -1
- package/dist/features/RequirementAI/components/segment/Segment.js +1 -1
- package/dist/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
- package/dist/features/RequirementAI/components/segment/segment.module.css.js +1 -1
- package/dist/features/RequirementAI/components/story-screen/CompletionPanel.js +1 -1
- package/dist/features/RequirementAI/components/story-screen/CompletionPanel.module.css.js +1 -1
- package/dist/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
- package/dist/hooks/useOnDemandCitationFetch.js +1 -1
- package/dist/service/onDemandApi.js +1 -1
- package/dist/service/redlineService.js +1 -1
- package/dist/types/src/CitationAccordionTest.d.ts +1 -0
- package/dist/types/src/CitationAccordionTest.d.ts.map +1 -0
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +0 -8553
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/DeviationSummaryTest.d.ts.map +1 -1
- package/dist/types/src/MockDeviationSummary.d.ts +1 -0
- package/dist/types/src/MockDeviationSummary.d.ts.map +1 -0
- package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
- package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +1446 -905
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/new-guidelines.mockData.d.ts +33 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/new-guidelines.mockData.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/helper.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +7 -23
- package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.d.ts +0 -8
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +1 -7
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts +13 -17
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +3 -15
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +2 -21
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts +1 -3
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts +2 -3
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.d.ts +0 -1
- package/dist/types/src/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts +1 -8
- package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts +1 -5
- package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/story-screen/CompletionPanel.d.ts +1 -3
- package/dist/types/src/features/RequirementAI/components/story-screen/CompletionPanel.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +1 -3
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts +1 -2
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/interfaces/citation.interface.d.ts +1 -18
- package/dist/types/src/features/RequirementAI/interfaces/citation.interface.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +1 -32
- package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/types/segment.type.d.ts +0 -8
- package/dist/types/src/features/RequirementAI/types/segment.type.d.ts.map +1 -1
- package/dist/types/src/service/onDemandApi.d.ts.map +1 -1
- package/dist/types/src/service/redlineService.d.ts +0 -6
- package/dist/types/src/service/redlineService.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
- package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +0 -2
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +0 -2
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +0 -2
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +0 -2
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +0 -2
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +0 -2
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js +0 -2
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js +0 -2
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js +0 -2
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js +0 -2
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/segment/DeleteSegmentsDialog.js +0 -2
- package/dist/cjs/features/RequirementAI/components/segment/DeleteSegmentsDialog.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/segment/EditSegmentDialog.js +0 -2
- package/dist/cjs/features/RequirementAI/components/segment/EditSegmentDialog.js.map +0 -1
- package/dist/cjs/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js +0 -2
- package/dist/cjs/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js.map +0 -1
- package/dist/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
- package/dist/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +0 -2
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js.map +0 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +0 -2
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +0 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +0 -2
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +0 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +0 -2
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +0 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +0 -2
- package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +0 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +0 -2
- package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +0 -1
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js +0 -2
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map +0 -1
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js +0 -2
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js.map +0 -1
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js +0 -2
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js.map +0 -1
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js +0 -2
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js.map +0 -1
- package/dist/features/RequirementAI/components/segment/DeleteSegmentsDialog.js +0 -2
- package/dist/features/RequirementAI/components/segment/DeleteSegmentsDialog.js.map +0 -1
- package/dist/features/RequirementAI/components/segment/EditSegmentDialog.js +0 -2
- package/dist/features/RequirementAI/components/segment/EditSegmentDialog.js.map +0 -1
- package/dist/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js +0 -2
- package/dist/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js.map +0 -1
- package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
- package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
- package/dist/types/src/RedlineEditorTest2.d.ts +0 -3
- package/dist/types/src/RedlineEditorTest2.d.ts.map +0 -1
- package/dist/types/src/commonConstants.d.ts +0 -31103
- package/dist/types/src/commonConstants.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts +0 -128
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts +0 -13
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts +0 -5445
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts +0 -13
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts +0 -10
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts +0 -14
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts +0 -10
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts +0 -30
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts +0 -4
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts +0 -2
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.d.ts +0 -11
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.d.ts +0 -25
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.d.ts +0 -31
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/segment/DeleteSegmentsDialog.d.ts +0 -13
- package/dist/types/src/features/RequirementAI/components/segment/DeleteSegmentsDialog.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/segment/EditSegmentDialog.d.ts +0 -12
- package/dist/types/src/features/RequirementAI/components/segment/EditSegmentDialog.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("showdown"),o=require("../RequirementAIWrapper/RequirementAIWrapper.js"),n=require("../../utils/userstory-approval-transform.utils.js"),r=require("../../utils/userstory-approval.utils.js"),a=require("../../hooks/useApprovalStatus.js"),i=require("./components/ContentSegment/ContentSegment.js"),s=require("./components/ApprovalBadge/ApprovalBadge.js"),d=require("./UserStoryApprovalScreen.module.css.js"),u=require("../../icons/CheckIcon.js"),c=require("../../icons/BookmarkIcon.js"),v=require("./components/ApprovalSidebar/ApprovalSidebar.js"),p=require("lucide-react"),S=require("./UserStoryApprovalContext.js"),h=require("../story-screen/BigEnoughPanel.js"),m=require("../../icons/BigEnoughIcon.js"),y=require("@mui/material"),f=require("../../utils/helpers.js"),g=require("../../utils/user-story.utils.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var I=b(l);const A={showApproveAllButton:!0,allowEditing:!0,allowDeletion:!0,showSidebar:!1,containerHeight:"calc(100vh - 100px)",useFullWidth:!1},C={approveAll:"Approve All",approved:"Approved",approve:"Approve",correctMe:"Correct Me",delete:"Delete",save:"Save",cancel:"Cancel",savingArtifact:"Saving Artifact...",artifactSavedTitle:"Artifact Saved Successfully",artifactSavedMessage:"Your changes have been saved.",saveFailedTitle:"Failed to Save the Artifact",saveFailedMessage:"An error occurred while saving your changes.",emptyContentWarning:"Saving empty content is not allowed",unsavedChangesWarning:"Please save the updated changes to proceed with Approve All"},x=Object.assign(({artifactTitleIds:l,config:i={},callbacks:s={},labels:u={},isDisabled:c=!1,children:v,classNames:p,selectedArtifactId:h})=>{var m;const{userStory:y,customStyles:f}=o.useRequirementAI(),g={...A,...i},b={...C,...u},[I,x]=t.useState([]),[j,w]=t.useState(""),[E,k]=t.useState(""),[U,N]=t.useState(!1),[q,T]=t.useState(!0),B=t.useRef(void 0),F=t.useCallback((e,t,l,o)=>{s.onShowNotification?s.onShowNotification(e,t,l,o):console.log(`[${e.toUpperCase()}] ${t}: ${l}`)},[s]),D=t.useCallback(e=>{s.onScrollToElement?s.onScrollToElement(e):(e.style.scrollMarginTop="20px",e.scrollIntoView({behavior:"smooth",block:"start"}))},[s]),M=t.useMemo(()=>{const e=I.findIndex(e=>e.artifactId===j);return e>=0?e:0},[I,j]),R=I[M];t.useEffect(()=>{B.current=R},[R]),t.useEffect(()=>{var e;if(!(null==y?void 0:y.length))return;null===(e=s.onInitialize)||void 0===e||e.call(s),1===y.length&&T(!1),y.length>0&&!j&&w(h||y[0].artifactId);const t=n.createUserStoriesForApproval(n.cloneUserStories(y));x(t)},[y,h]),t.useEffect(()=>{h&&h!==j&&w(h)},[h,j]),t.useEffect(()=>{if(!R)return;const e=r.getFirstNonApprovedSegmentId(R,"");k(e)},[null==R?void 0:R.artifactId]);const P=t.useCallback((e,t)=>{x(l=>{const o=[...l];if("APPROVED"===t.approval_status&&"APPROVED"!==l[e].approval_status){const e=r.getFirstUnapprovedStoryId(l,t.artifactId);e&&w(e)}return o[e]=t,o})},[]),_=t.useCallback(e=>{const t=B.current;if(!t)return;const l=r.getFirstNonApprovedSegmentId(t,e);"NA"!==l&&(k(""),setTimeout(()=>{k(l)},0))},[]);a.useApprovalStatus({userStoryForApproval:I,selectedUserStoryForApproval:R,userStoryIndex:M,callbacks:s,labels:b,onSaveUserStory:P});const z={height:g.containerHeight,...g.useFullWidth?{width:"100%",marginLeft:0,marginRight:0}:{width:"calc(100% + 40px)",marginLeft:"-20px",marginRight:"-20px"}},O={userStoryForApproval:I,setUserStoryForApproval:x,selectedStoryArtifactId:j,setSelectedStoryArtifactId:w,selectedUserStoryIndex:M,selectedUserStoryForApproval:R,currentContentId:E,setCurrentContentId:k,isEditingSegment:U,setIsEditingSegment:N,isSidebarExpanded:q,setIsSidebarExpanded:T,artifactTitleIds:l,config:g,labels:b,callbacks:s,isDisabled:c,handleSaveUserStory:P,handleUpdateContentId:_,showNotification:F,scrollToElement:D};return e.jsx(S.UserStoryApprovalScreenContext.Provider,{value:O,children:e.jsx("div",{className:`${d.default.container} ${(null==p?void 0:p.container)||""}`,style:{...z,...null===(m=null==f?void 0:f.approvalScreen)||void 0===m?void 0:m.wrapperContainer},children:v})})},{Sidebar:({Component:t,config:l,className:o})=>{const{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:a,userStoryForApproval:i,isEditingSegment:s,artifactTitleIds:d}=S.useUserStoryApprovalScreen();return t?e.jsx(t,{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:a,userStoryForApproval:i,isEditingAnUserStorySegment:s,artifactTitleIds:d}):e.jsx(v.ApprovalSidebar,{config:l,className:o})},SidebarToggle:({OpenIcon:t,CloseIcon:l,className:o=""})=>{const{isSidebarExpanded:n,setIsSidebarExpanded:r}=S.useUserStoryApprovalScreen(),a=t||p.SidebarOpenIcon,i=l||p.SidebarCloseIcon;return e.jsx("div",{className:`${d.default.sidebarToggleWrapper} ${o}`,children:e.jsx("button",{onClick:()=>r(e=>!e),className:d.default.sidebarToggleBtn,"aria-label":n?"Collapse sidebar":"Expand sidebar",type:"button",children:n?e.jsx(i,{}):e.jsx(a,{})})})},Content:({children:l,ButtonComponent:n,hideApproveAll:a=!1,pageTitle:i="Review Generated Requirements",showShareIcon:v=!1,handleDownloadUserStory:b,handleOpenSendDialog:A,pageDescription:C="This page displays automatically generated requirements for your project. Use this screen to review, refine, correct, or approve all generated requirements."})=>{var x,j,w,E,k,U,N,q,T,B,F,D,M,R,P,_,z,O,W,L,$,V,H,G,Y,J,K,Q,X,Z,ee;const{selectedUserStoryForApproval:te,selectedUserStoryIndex:le,artifactTitleIds:oe,labels:ne,config:re,isDisabled:ae,isEditingSegment:ie,handleSaveUserStory:se,setCurrentContentId:de,showNotification:ue}=S.useUserStoryApprovalScreen(),{userStory:ce,setUserStory:ve}=o.useRequirementAI(),pe=ce[0],[Se,he]=t.useState(null),me=()=>{he(null)},ye=t.useRef(null),[fe,ge]=t.useState(!1),{customStyles:be,customIcons:Ie}=o.useRequirementAI(),Ae=null==be?void 0:be.userStoryCardStyles,[Ce,xe]=t.useState(!1),je=t.useCallback(()=>{if(!te)return;if(ie)return void ue("warn","Warning!",ne.unsavedChangesWarning,3e3);const e=r.approveAllSegments(te);se(le,e),de("")},[te,le,ie,ne,se,de,ue]);if(!te)return null;const we=oe[le]||"",Ee="APPROVED"===te.approval_status,ke=null!=(null==te?void 0:te.big_enough)&&!Number.isNaN(te.big_enough)&&!!(null==te?void 0:te.big_enough_decision_factors);return e.jsxs("div",{className:d.default.content,style:{...null===(j=null===(x=null==be?void 0:be.approvalScreen)||void 0===x?void 0:x.content)||void 0===j?void 0:j.content},"data-lsc-ui-page-title":i,"data-lsc-ui-page-description":C,children:[e.jsxs("div",{className:d.default.header,style:{...null===(k=null===(E=null===(w=null==be?void 0:be.approvalScreen)||void 0===w?void 0:w.body)||void 0===E?void 0:E.contentSegment)||void 0===k?void 0:k.header},children:[e.jsxs("div",{className:d.default.headerLeft,style:{...null===(N=null===(U=null==be?void 0:be.approvalScreen)||void 0===U?void 0:U.content)||void 0===N?void 0:N.headerLeft},children:[e.jsxs("div",{className:d.default.headerMeta,style:{...null===(B=null===(T=null===(q=null==be?void 0:be.approvalScreen)||void 0===q?void 0:q.body)||void 0===T?void 0:T.contentSegment)||void 0===B?void 0:B.headerMeta},children:[e.jsx(c.BookmarkIcon,{size:16,color:(null===(M=null===(D=null===(F=null==be?void 0:be.approvalScreen)||void 0===F?void 0:F.body)||void 0===D?void 0:D.contentSegment)||void 0===M?void 0:M.bookMarkColor)||"#8C8C8C"}),e.jsx("h2",{className:d.default.headerArtifactId,style:{...null===(_=null===(P=null===(R=null==be?void 0:be.approvalScreen)||void 0===R?void 0:R.body)||void 0===P?void 0:P.contentSegment)||void 0===_?void 0:_.headerArtifactId},children:we})]}),e.jsx("p",{className:d.default.headerTitle,style:{...null===(W=null===(O=null===(z=null==be?void 0:be.approvalScreen)||void 0===z?void 0:z.body)||void 0===O?void 0:O.contentSegment)||void 0===W?void 0:W.headerTitle},children:null==te?void 0:te.title})]}),e.jsxs("div",{className:null===d.default||void 0===d.default?void 0:d.default.containerStyle,style:null===($=null===(L=null==be?void 0:be.approvalScreen)||void 0===L?void 0:L.BigEnoughStyles)||void 0===$?void 0:$.containerStyle,children:[ke&&e.jsx("button",{className:d.default.developerEffortButton,style:null===(H=null===(V=null==be?void 0:be.approvalScreen)||void 0===V?void 0:V.BigEnoughStyles)||void 0===H?void 0:H.buttonStyle,onClick:()=>xe(!Ce),children:e.jsx(m.default,{color:null===(Y=null===(G=null==be?void 0:be.approvalScreen)||void 0===G?void 0:G.BigEnoughStyles)||void 0===Y?void 0:Y.iconColor,size:null===(K=null===(J=null==be?void 0:be.approvalScreen)||void 0===J?void 0:J.BigEnoughStyles)||void 0===K?void 0:K.iconSize})}),v&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:d.default.iconButton,style:null==Ae?void 0:Ae.iconButton,onClick:e=>{he(e.currentTarget)},children:e.jsx(p.ExternalLink,{size:16})}),e.jsxs(y.Menu,{id:"user-story-share-menu",anchorEl:Se,open:!!Se,onClose:()=>he(null),style:null==Ae?void 0:Ae.userStoryShareMenu,children:[e.jsx(y.MenuItem,{style:null==Ae?void 0:Ae.userStoryMenuItem,onClick:async()=>{ge(!0),b&&(await Promise.all([b("pdf"),b("doc")]),ge(!1))},children:e.jsxs("div",{ref:ye,className:d.default.menuItemContent,style:null==Ae?void 0:Ae.menuItemContent,children:[e.jsx(p.Download,{size:16,color:null==Ae?void 0:Ae.menuIconColor}),e.jsx("p",{style:null==Ae?void 0:Ae.menuLabel,children:"Download"})]})}),e.jsx(y.MenuItem,{style:null==Ae?void 0:Ae.userStoryMenuItem,onClick:async()=>{let e=pe;e={...pe,value:`${g.replaceTitleSection(null==pe?void 0:pe.value,pe.title)}`},null==A||A(!0,[e],pe.artifactId),me()},children:e.jsxs("div",{style:null==Ae?void 0:Ae.menuItemContent,className:d.default.menuItemContentPadded,children:[e.jsx(p.Share2,{size:16,color:null==Ae?void 0:Ae.menuIconColor}),e.jsx("p",{style:null==Ae?void 0:Ae.menuLabel,children:"Send"})]})}),e.jsx(y.MenuItem,{style:null==Ae?void 0:Ae.userStoryMenuItem,onClick:async()=>{const e=(new I.default.Converter).makeHtml(f.formatMarkdown(pe.value)||pe.value),t=function(e){const t=(new I.default.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(f.formatMarkdown(pe.value)||pe.value),l=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([l]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{me()}},children:e.jsxs("div",{style:null==Ae?void 0:Ae.menuItemContent,className:d.default.menuItemContentPadded,children:[e.jsx(p.Copy,{size:16,color:null==Ae?void 0:Ae.menuIconColor}),e.jsx("p",{style:null==Ae?void 0:Ae.menuLabel,children:"Copy"})]})})]})]}),!a&&re.showApproveAllButton&&e.jsx("div",{className:d.default.headerRight,children:Ee?e.jsx(s.ApprovalBadge,{status:"APPROVED",label:ne.approved}):n?e.jsx(n,{type:"fill",onClick:je,isDisable:ae,className:d.default.approveAllButton,overrideStyles:!0,lscUIAgent:{id:"approve-all",lscUIType:"button",lscUILabel:ne.approveAll,lscUIDescription:"Clicks this button to approve all generated requirements on the page in a single action.",lscUIWhenToApply:"Apply when the user wants to accept all requirements without reviewing them individually, or when they say phrases like 'approve everything', 'finalize all', 'accept all', or 'this looks good, approve all'."},children:e.jsxs("div",{className:d.default.approveAllContent,children:[e.jsx(u.CheckIcon,{size:16,color:"white"}),e.jsx("span",{children:ne.approveAll})]})}):e.jsxs("button",{onClick:je,disabled:ae,className:d.default.approveAllButtonDefault,style:{...null===(X=null===(Q=null==be?void 0:be.approvalScreen)||void 0===Q?void 0:Q.content)||void 0===X?void 0:X.approveAllButtonDefault},children:[e.jsx(u.CheckIcon,{size:16,color:"white"}),e.jsx("span",{children:ne.approveAll})]})})]})]}),Ce&&ke&&e.jsx("div",{className:d.default.bigEnoughWrapper,children:e.jsx(h.BigEnoughPanel,{customIcons:null==Ie?void 0:Ie.userStoryIcons,customStyles:null===(Z=null==be?void 0:be.approvalScreen)||void 0===Z?void 0:Z.aiReasoningCitaionStyles,currentUserStory:te,panelStyles:null===(ee=null==be?void 0:be.approvalScreen)||void 0===ee?void 0:ee.BigEnoughStyles,showPanel:Ce})}),l]})},Body:({children:l,EditorComponent:n,ViewerComponent:r,handleDownloadUserStory:a,handleOpenSendDialog:s,showShareIcon:u=!1})=>{var c,v,p;const{selectedUserStoryForApproval:h,selectedUserStoryIndex:m,artifactTitleIds:y,handleSaveUserStory:f}=S.useUserStoryApprovalScreen(),{customStyles:g}=o.useRequirementAI(),b=t.useCallback(e=>{f(m,e)},[m,f]),I=t.useCallback((e,t)=>{var l;if(!h)return;const o={...h,sub_features:null===(l=h.sub_features)||void 0===l?void 0:l.map((l,o)=>o===e?t:l)};f(m,o)},[h,m,f]),A=t.useCallback(e=>{var t;if(!h)return;const l={...h,sub_features:null===(t=h.sub_features)||void 0===t?void 0:t.filter((t,l)=>l!==e)};f(m,l)},[h,m,f]);if(!h)return null;const C=y[m]||"";return e.jsxs("div",{className:d.default.body,style:{...null===(v=null===(c=null==g?void 0:g.approvalScreen)||void 0===c?void 0:c.body)||void 0===v?void 0:v.container},children:[e.jsx(i.ContentSegment,{userStoryForApproval:h,artifactTitleId:C,onSaveMainStoryContent:b,EditorComponent:n,ViewerComponent:r}),null===(p=h.sub_features)||void 0===p?void 0:p.map((t,l)=>e.jsx(i.ContentSegment,{userStoryForApproval:t,artifactTitleId:`${C} - ${String.fromCharCode(65+l)}`,isSubFeature:!0,subFeatureIndex:l,onSaveSubFeature:I,onDeleteSubFeature:A,EditorComponent:n,ViewerComponent:r,handleDownloadUserStory:a,handleOpenSendDialog:s,showShareIcon:u},t.artifactId)),l]})}});exports.default=x;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("showdown"),o=require("../RequirementAIWrapper/RequirementAIWrapper.js"),n=require("../../utils/userstory-approval-transform.utils.js"),r=require("../../utils/userstory-approval.utils.js"),a=require("../../hooks/useApprovalStatus.js"),i=require("./components/ContentSegment/ContentSegment.js"),s=require("./components/ApprovalBadge/ApprovalBadge.js"),d=require("./UserStoryApprovalScreen.module.css.js"),u=require("../../icons/CheckIcon.js"),c=require("../../icons/BookmarkIcon.js"),v=require("./components/ApprovalSidebar/ApprovalSidebar.js"),p=require("lucide-react"),S=require("./UserStoryApprovalContext.js"),h=require("../story-screen/BigEnoughPanel.js"),m=require("../../icons/BigEnoughIcon.js"),y=require("@mui/material"),f=require("../../utils/helpers.js"),g=require("../../utils/user-story.utils.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var I=b(l);const A={showApproveAllButton:!0,allowEditing:!0,allowDeletion:!0,showSidebar:!1,containerHeight:"calc(100vh - 100px)",useFullWidth:!1},C={approveAll:"Approve All",approved:"Approved",approve:"Approve",correctMe:"Correct Me",delete:"Delete",save:"Save",cancel:"Cancel",savingArtifact:"Saving Artifact...",artifactSavedTitle:"Artifact Saved Successfully",artifactSavedMessage:"Your changes have been saved.",saveFailedTitle:"Failed to Save the Artifact",saveFailedMessage:"An error occurred while saving your changes.",emptyContentWarning:"Saving empty content is not allowed",unsavedChangesWarning:"Please save the updated changes to proceed with Approve All"},x=Object.assign(({artifactTitleIds:l,config:i={},callbacks:s={},labels:u={},isDisabled:c=!1,children:v,classNames:p,selectedArtifactId:h})=>{var m;const{userStory:y,customStyles:f}=o.useRequirementAI(),g={...A,...i},b={...C,...u},[I,x]=t.useState([]),[j,w]=t.useState(""),[E,k]=t.useState(""),[U,N]=t.useState(!1),[q,T]=t.useState(!0),B=t.useRef(void 0),F=t.useCallback((e,t,l,o)=>{s.onShowNotification?s.onShowNotification(e,t,l,o):console.log(`[${e.toUpperCase()}] ${t}: ${l}`)},[s]),D=t.useCallback(e=>{s.onScrollToElement?s.onScrollToElement(e):(e.style.scrollMarginTop="20px",e.scrollIntoView({behavior:"smooth",block:"start"}))},[s]),M=t.useMemo(()=>{const e=I.findIndex(e=>e.artifactId===j);return e>=0?e:0},[I,j]),R=I[M];t.useEffect(()=>{B.current=R},[R]),t.useEffect(()=>{var e;if(!(null==y?void 0:y.length))return;null===(e=s.onInitialize)||void 0===e||e.call(s),1===y.length&&T(!1),y.length>0&&!j&&w(h||y[0].artifactId);const t=n.createUserStoriesForApproval(n.cloneUserStories(y));x(t)},[y,h]),t.useEffect(()=>{h&&h!==j&&w(h)},[h,j]),t.useEffect(()=>{if(!R)return;const e=r.getFirstNonApprovedSegmentId(R,"");k(e)},[null==R?void 0:R.artifactId]);const P=t.useCallback((e,t)=>{x(l=>{const o=[...l];if("APPROVED"===t.approval_status&&"APPROVED"!==l[e].approval_status){const e=r.getFirstUnapprovedStoryId(l,t.artifactId);e&&w(e)}return o[e]=t,o})},[]),_=t.useCallback(e=>{const t=B.current;if(!t)return;const l=r.getFirstNonApprovedSegmentId(t,e);"NA"!==l&&(k(""),setTimeout(()=>{k(l)},0))},[]);a.useApprovalStatus({userStoryForApproval:I,selectedUserStoryForApproval:R,userStoryIndex:M,callbacks:s,labels:b,onSaveUserStory:P});const z={height:g.containerHeight,...g.useFullWidth?{width:"100%",marginLeft:0,marginRight:0}:{width:"calc(100% + 40px)",marginLeft:"-20px",marginRight:"-20px"}},O={userStoryForApproval:I,setUserStoryForApproval:x,selectedStoryArtifactId:j,setSelectedStoryArtifactId:w,selectedUserStoryIndex:M,selectedUserStoryForApproval:R,currentContentId:E,setCurrentContentId:k,isEditingSegment:U,setIsEditingSegment:N,isSidebarExpanded:q,setIsSidebarExpanded:T,artifactTitleIds:l,config:g,labels:b,callbacks:s,isDisabled:c,handleSaveUserStory:P,handleUpdateContentId:_,showNotification:F,scrollToElement:D};return e.jsx(S.UserStoryApprovalScreenContext.Provider,{value:O,children:e.jsx("div",{className:`${d.default.container} ${(null==p?void 0:p.container)||""}`,style:{...z,...null===(m=null==f?void 0:f.approvalScreen)||void 0===m?void 0:m.wrapperContainer},children:v})})},{Sidebar:({Component:t,config:l,className:o})=>{const{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:a,userStoryForApproval:i,isEditingSegment:s,artifactTitleIds:d}=S.useUserStoryApprovalScreen();return t?e.jsx(t,{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:a,userStoryForApproval:i,isEditingAnUserStorySegment:s,artifactTitleIds:d}):e.jsx(v.ApprovalSidebar,{config:l,className:o})},SidebarToggle:({OpenIcon:t,CloseIcon:l,className:o=""})=>{const{isSidebarExpanded:n,setIsSidebarExpanded:r}=S.useUserStoryApprovalScreen(),a=t||p.SidebarOpenIcon,i=l||p.SidebarCloseIcon;return e.jsx("div",{className:`${d.default.sidebarToggleWrapper} ${o}`,children:e.jsx("button",{onClick:()=>r(e=>!e),className:d.default.sidebarToggleBtn,"aria-label":n?"Collapse sidebar":"Expand sidebar",type:"button",children:n?e.jsx(i,{}):e.jsx(a,{})})})},Content:({children:l,ButtonComponent:n,hideApproveAll:a=!1,pageTitle:i="Review Generated Requirements",showShareIcon:v=!1,handleDownloadUserStory:b,handleOpenSendDialog:A,pageDescription:C="This page displays automatically generated requirements for your project. Use this screen to review, refine, correct, or approve all generated requirements."})=>{var x,j,w,E,k,U,N,q,T,B,F,D,M,R,P,_,z,O,W,$,L,V,H,G,Y,J,K,Q,X,Z,ee;const{selectedUserStoryForApproval:te,selectedUserStoryIndex:le,artifactTitleIds:oe,labels:ne,config:re,isDisabled:ae,isEditingSegment:ie,handleSaveUserStory:se,setCurrentContentId:de,showNotification:ue}=S.useUserStoryApprovalScreen(),{userStory:ce,setUserStory:ve}=o.useRequirementAI(),pe=ce[0],[Se,he]=t.useState(null),me=()=>{he(null)},ye=t.useRef(null),[fe,ge]=t.useState(!1),{customStyles:be,customIcons:Ie}=o.useRequirementAI(),Ae=null==be?void 0:be.userStoryCardStyles,[Ce,xe]=t.useState(!1),je=t.useCallback(()=>{if(!te)return;if(ie)return void ue("warn","Warning!",ne.unsavedChangesWarning,3e3);const e=r.approveAllSegments(te);se(le,e),de("")},[te,le,ie,ne,se,de,ue]);if(!te)return null;const we=oe[le]||"",Ee="APPROVED"===te.approval_status,ke=null!=(null==te?void 0:te.big_enough)&&!Number.isNaN(te.big_enough)&&!!(null==te?void 0:te.big_enough_decision_factors);return e.jsxs("div",{className:d.default.content,style:{...null===(j=null===(x=null==be?void 0:be.approvalScreen)||void 0===x?void 0:x.content)||void 0===j?void 0:j.content},"data-lsc-ui-page-title":i,"data-lsc-ui-page-description":C,children:[e.jsxs("div",{className:d.default.header,style:{...null===(k=null===(E=null===(w=null==be?void 0:be.approvalScreen)||void 0===w?void 0:w.body)||void 0===E?void 0:E.contentSegment)||void 0===k?void 0:k.header},children:[e.jsxs("div",{className:d.default.headerLeft,style:{...null===(N=null===(U=null==be?void 0:be.approvalScreen)||void 0===U?void 0:U.content)||void 0===N?void 0:N.headerLeft},children:[e.jsxs("div",{className:d.default.headerMeta,style:{...null===(B=null===(T=null===(q=null==be?void 0:be.approvalScreen)||void 0===q?void 0:q.body)||void 0===T?void 0:T.contentSegment)||void 0===B?void 0:B.headerMeta},children:[e.jsx(c.BookmarkIcon,{size:16,color:(null===(M=null===(D=null===(F=null==be?void 0:be.approvalScreen)||void 0===F?void 0:F.body)||void 0===D?void 0:D.contentSegment)||void 0===M?void 0:M.bookMarkColor)||"#8C8C8C"}),e.jsx("h2",{className:d.default.headerArtifactId,style:{...null===(_=null===(P=null===(R=null==be?void 0:be.approvalScreen)||void 0===R?void 0:R.body)||void 0===P?void 0:P.contentSegment)||void 0===_?void 0:_.headerArtifactId},children:we})]}),e.jsx("p",{className:d.default.headerTitle,style:{...null===(W=null===(O=null===(z=null==be?void 0:be.approvalScreen)||void 0===z?void 0:z.body)||void 0===O?void 0:O.contentSegment)||void 0===W?void 0:W.headerTitle},children:null==te?void 0:te.title})]}),e.jsxs("div",{className:null===d.default||void 0===d.default?void 0:d.default.containerStyle,style:null===(L=null===($=null==be?void 0:be.approvalScreen)||void 0===$?void 0:$.BigEnoughStyles)||void 0===L?void 0:L.containerStyle,children:[ke&&e.jsx("button",{className:d.default.developerEffortButton,style:null===(H=null===(V=null==be?void 0:be.approvalScreen)||void 0===V?void 0:V.BigEnoughStyles)||void 0===H?void 0:H.buttonStyle,onClick:()=>xe(!Ce),children:e.jsx(m.default,{color:null===(Y=null===(G=null==be?void 0:be.approvalScreen)||void 0===G?void 0:G.BigEnoughStyles)||void 0===Y?void 0:Y.iconColor,size:null===(K=null===(J=null==be?void 0:be.approvalScreen)||void 0===J?void 0:J.BigEnoughStyles)||void 0===K?void 0:K.iconSize})}),v&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:d.default.iconButton,style:null==Ae?void 0:Ae.iconButton,onClick:e=>{he(e.currentTarget)},children:e.jsx(p.ExternalLink,{size:16})}),e.jsxs(y.Menu,{id:"user-story-share-menu",anchorEl:Se,open:!!Se,onClose:()=>he(null),style:null==Ae?void 0:Ae.userStoryShareMenu,children:[e.jsx(y.MenuItem,{style:null==Ae?void 0:Ae.userStoryMenuItem,onClick:async()=>{ge(!0),b&&(await Promise.all([b("pdf"),b("doc")]),ge(!1))},children:e.jsxs("div",{ref:ye,className:d.default.menuItemContent,style:null==Ae?void 0:Ae.menuItemContent,children:[e.jsx(p.Download,{size:16,color:null==Ae?void 0:Ae.menuIconColor}),e.jsx("p",{style:null==Ae?void 0:Ae.menuLabel,children:"Download"})]})}),e.jsx(y.MenuItem,{style:null==Ae?void 0:Ae.userStoryMenuItem,onClick:async()=>{let e=pe;e={...pe,value:`${g.replaceTitleSection(null==pe?void 0:pe.value,pe.title)} \n${pe.value}`},null==A||A(!0,[e],pe.artifactId),me()},children:e.jsxs("div",{style:null==Ae?void 0:Ae.menuItemContent,className:d.default.menuItemContentPadded,children:[e.jsx(p.Share2,{size:16,color:null==Ae?void 0:Ae.menuIconColor}),e.jsx("p",{style:null==Ae?void 0:Ae.menuLabel,children:"Send"})]})}),e.jsx(y.MenuItem,{style:null==Ae?void 0:Ae.userStoryMenuItem,onClick:async()=>{const e=(new I.default.Converter).makeHtml(f.formatMarkdown(pe.value)||pe.value),t=function(e){const t=(new I.default.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(f.formatMarkdown(pe.value)||pe.value),l=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([l]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{me()}},children:e.jsxs("div",{style:null==Ae?void 0:Ae.menuItemContent,className:d.default.menuItemContentPadded,children:[e.jsx(p.Copy,{size:16,color:null==Ae?void 0:Ae.menuIconColor}),e.jsx("p",{style:null==Ae?void 0:Ae.menuLabel,children:"Copy"})]})})]})]}),!a&&re.showApproveAllButton&&e.jsx("div",{className:d.default.headerRight,children:Ee?e.jsx(s.ApprovalBadge,{status:"APPROVED",label:ne.approved}):n?e.jsx(n,{type:"fill",onClick:je,isDisable:ae,className:d.default.approveAllButton,overrideStyles:!0,lscUIAgent:{id:"approve-all",lscUIType:"button",lscUILabel:ne.approveAll,lscUIDescription:"Clicks this button to approve all generated requirements on the page in a single action.",lscUIWhenToApply:"Apply when the user wants to accept all requirements without reviewing them individually, or when they say phrases like 'approve everything', 'finalize all', 'accept all', or 'this looks good, approve all'."},children:e.jsxs("div",{className:d.default.approveAllContent,children:[e.jsx(u.CheckIcon,{size:16,color:"white"}),e.jsx("span",{children:ne.approveAll})]})}):e.jsxs("button",{onClick:je,disabled:ae,className:d.default.approveAllButtonDefault,style:{...null===(X=null===(Q=null==be?void 0:be.approvalScreen)||void 0===Q?void 0:Q.content)||void 0===X?void 0:X.approveAllButtonDefault},children:[e.jsx(u.CheckIcon,{size:16,color:"white"}),e.jsx("span",{children:ne.approveAll})]})})]})]}),Ce&&ke&&e.jsx("div",{className:d.default.bigEnoughWrapper,children:e.jsx(h.BigEnoughPanel,{customIcons:null==Ie?void 0:Ie.userStoryIcons,customStyles:null===(Z=null==be?void 0:be.approvalScreen)||void 0===Z?void 0:Z.aiReasoningCitaionStyles,currentUserStory:te,panelStyles:null===(ee=null==be?void 0:be.approvalScreen)||void 0===ee?void 0:ee.BigEnoughStyles,showPanel:Ce})}),l]})},Body:({children:l,EditorComponent:n,ViewerComponent:r,handleDownloadUserStory:a,handleOpenSendDialog:s,showShareIcon:u=!1})=>{var c,v,p;const{selectedUserStoryForApproval:h,selectedUserStoryIndex:m,artifactTitleIds:y,handleSaveUserStory:f}=S.useUserStoryApprovalScreen(),{customStyles:g}=o.useRequirementAI(),b=t.useCallback(e=>{f(m,e)},[m,f]),I=t.useCallback((e,t)=>{var l;if(!h)return;const o={...h,sub_features:null===(l=h.sub_features)||void 0===l?void 0:l.map((l,o)=>o===e?t:l)};f(m,o)},[h,m,f]),A=t.useCallback(e=>{var t;if(!h)return;const l={...h,sub_features:null===(t=h.sub_features)||void 0===t?void 0:t.filter((t,l)=>l!==e)};f(m,l)},[h,m,f]);if(!h)return null;const C=y[m]||"";return e.jsxs("div",{className:d.default.body,style:{...null===(v=null===(c=null==g?void 0:g.approvalScreen)||void 0===c?void 0:c.body)||void 0===v?void 0:v.container},children:[e.jsx(i.ContentSegment,{userStoryForApproval:h,artifactTitleId:C,onSaveMainStoryContent:b,EditorComponent:n,ViewerComponent:r}),null===(p=h.sub_features)||void 0===p?void 0:p.map((t,l)=>e.jsx(i.ContentSegment,{userStoryForApproval:t,artifactTitleId:`${C} - ${String.fromCharCode(65+l)}`,isSubFeature:!0,subFeatureIndex:l,onSaveSubFeature:I,onDeleteSubFeature:A,EditorComponent:n,ViewerComponent:r,handleDownloadUserStory:a,handleOpenSendDialog:s,showShareIcon:u},t.artifactId)),l]})}});exports.default=x;
|
|
2
2
|
//# sourceMappingURL=UserStoryApprovalScreen.js.map
|
package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),t=require("rehype-raw"),o=require("./UserStoryWithCitation.module.css.js"),l=require("../../shared/useMarkdownSearch.js"),d=require("lucide-react"),a=require("@mui/material"),r=require("dompurify"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),g=require("../RequirementAIWrapper/RequirementAIWrapper.js"),h=require("../../icons/CognitiveDecision.js"),p=require("../../icons/BrainRed.js"),v=require("../ai-reasoning/AiReasoningCitation.js"),m=require("../../icons/RelevanceScoreIcon.js"),f=require("../RecommendationBlock/RecommendationBlock.js"),C=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),j=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),w=require("./components/InlineManualComponent.js"),I=require("./components/HighlightButtonComponent.js"),b=require("../../../../utils/tagHelper.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=R(n),$=R(i),k=R(t),A=R(r);const q=n.createContext(!1),E=n.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),M=n.createContext({rowId:""}),T=({aiReason:i,isHighConfidence:t,customStyle:l,customIcons:d})=>{var a;const{expandedInfo:r,setExpanded:s,reasonToRow:c}=n.useContext(E),{rowId:u}=n.useContext(M),g=String(i.id);u&&c.current.set(g,u);const v=(null===(a=null==r?void 0:r.aiReason)||void 0===a?void 0:a.id)===i.id,m=t?(null==d?void 0:d.highConfidence)||e.jsx(h.default,{}):(null==d?void 0:d.lowConfidence)||e.jsx(p.default,{});return e.jsxs("button",{className:o.default.aiReasoningButton,style:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),s(v?null:u,v?null:i)},children:[m,v?e.jsx("i",{className:`pi pi-angle-up ${t?o.default.aiReasoningIconHighConfidence:o.default.aiReasoningIconLowConfidence}`}):e.jsx("i",{className:`pi pi-angle-down ${t?o.default.aiReasoningIconHighConfidence:o.default.aiReasoningIconLowConfidence}`})]})},_=({children:i,node:t,customStyles:l,customIcons:d})=>{var a,r;const s=n.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=n.useContext(E),u=(null==c?void 0:c.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,h=null!==(r=null===(a=null==t?void 0:t.properties)||void 0===a?void 0:a.style)&&void 0!==r?r:void 0;return e.jsxs(M.Provider,{value:{rowId:s},children:[e.jsx("tr",{style:h?{cssText:h}:void 0,children:i}),u&&(null==c?void 0:c.aiReason)&&e.jsx("tr",{style:{width:"100%"},children:e.jsx("td",{colSpan:g||1,className:o.default.tableExpandedCell,children:e.jsx("div",{className:o.default.tableExpandedCellInner,children:e.jsx("div",{className:o.default.tableExpandedCellContent,children:e.jsx(x.default,{aiReason:c.aiReason,customIcons:d,customStyles:{aiReasoningContent:null==l?void 0:l.aiReasoningContent,aiReasoningAccordion:null==l?void 0:l.aiReasoningAccordion,aiReasoningMarkdown:null==l?void 0:l.aiReasoningMarkdown,aiReasoningPill:null==l?void 0:l.aiReasoningPill,webCitation:null==l?void 0:l.webCitation,stormeeCitation:null==l?void 0:l.stormeeCitation,waveformCitation:null==l?void 0:l.waveformCitation,imageCitation:null==l?void 0:l.imageCitation,fileCitation:null==l?void 0:l.fileCitation,appModCitation:null==l?void 0:l.appModCitation,rcaCitation:null==l?void 0:l.rcaCitation,readFileCitation:null==l?void 0:l.readFileCitation,loadingCitations:null==l?void 0:l.loadingCitations,chatCitation:null==l?void 0:l.chatCitation}})})})})})]})};const U=["del","ins"];function L(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,U,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var t;return`<code>${o=null!==(t=n[Number(i)])&&void 0!==t?t:"",o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var o})}(e)).join(""))}const F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function P(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),o=e=>{var n,l;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>o(e)).flat().filter(e=>null!=e);if(!N.default.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(F.has(d))return e;const a=null===(l=N.default.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,o))||void 0===l?void 0:l.flat().filter(e=>null!=e);return a&&0!==a.length?N.default.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:o(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:i,noMarkdownContent:t,useMarkdown:r=!0,isParent:h,scenario:p,showUserStoryDiff:x=!1,aiReasoningsForBlock:R,isCitationLoadingDisplay:M=!1,className:U,highConfidenceIcon:F,lowConfidenceIcon:D,customStyles:H,customIcons:O,contextVariant:B,aiReasoningDiffView:W,userStoryCitations:V,artifactId:z,isCraflow:G,onCraAccept:Q,onCraReject:J,craFlowConfig:K,isDisplayHighlightControl:X=!1,showConfidenceScore:Y=!0,CDNeededInChip:Z,blockId:ee,showWaitingIconInChip:ne})=>{var ie;console.log("userstorywithcitation blockid ",ee);const te=n.useRef(null),{userStory:oe,inlineUpdateComponentConfig:le,getAvgScoreForStory:de,setUserStory:ae,aiReasoning:re,setAiReasoning:se,customIcons:ce,searchQueryList:ue,searchQueryReasoningIdList:ge,currentHighlightIndex:he,segmentComponentConfig:pe,inlineManualComponentConfig:ve,diffEditConfig:me}=g.useRequirementAI(),fe=null!=O?O:null==ce?void 0:ce.userStoryIcons;null==H||H.searchHighlight;const{search:Ce,clear:xe}=l.useMarkdownSearch(te),[je,ye]=n.useState("1"),[Se,we]=n.useState(null),Ie=n.useRef(new Map),[be,Re]=n.useState(new Set),Ne=n.useCallback((e,n)=>{we(e&&n?{rowId:e,aiReason:n}:null)},[]),$e=z?de(z):0,[ke,Ae]=n.useState([]),qe=n.useCallback(e=>{Re(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Ee=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Ee).join(""):N.default.isValidElement(e)?Ee(e.props.children):"",Me=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,t,o)=>{const l=t.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,t,o)=>{const l=n.substring(0,o),d=l.lastIndexOf("\n"),a=/^\s+[-*]\s/.test(l.substring(d+1))||/^\s+\d+\.\s/.test(l.substring(d+1)),r=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(d+1));if(a||r){let e=t;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let t;const o=new RegExp(n.source,n.flags);for(;null!==(t=o.exec(e));){const e=t[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),o=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const o=l.substring(0,n.index).split("\n").reverse();let d=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(d=!0);break}}if(!d)continue;const a=n.endIndex,r=e+1<i.length?i[e+1].index:l.length;let s=l.substring(a,r);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),l=l.substring(0,a)+s+l.substring(r)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=L(n),n},Te=n.useMemo(()=>i?Me(i):i,[i]);n.useEffect(()=>{Ae(R||re)},[R,re]);const _e=n.useMemo(()=>({span:({node:n,children:i,...t})=>{var o,l,d,a,r;const s=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==l?l:null==t?void 0:t["highlight-id"],c="string"==typeof s&&be.has(s),u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-color"])&&void 0!==a?a:null==t?void 0:t["highlight-color"];return e.jsx("span",{style:{...null!==(r=null==H?void 0:H.span)&&void 0!==r?r:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:n,children:i,...t})=>{var o,l,d,a,r,s;const c=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.action)&&void 0!==l?l:null==t?void 0:t.action,u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(s=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-type"])&&void 0!==s?s:null==t?void 0:t["highlight-type"];return"highlight"===c?e.jsx(I.default,{highlightId:u,handleHighlightSpan:qe,icon:"web"===g?null==fe?void 0:fe.webCitationIcon:"doc"===g?null==fe?void 0:fe.fileCitationIcon:e.jsx(e.Fragment,{}),customStyles:"web"===g?null==H?void 0:H.webButton:"doc"===g?null==H?void 0:H.docButton:{}}):null},upt:({node:n,children:i,...t})=>{var o,l;const d=null==t?void 0:t.id,a=d?null===(l=null===(o=d.split("$"))||void 0===o?void 0:o[1])||void 0===l?void 0:l.replaceAll("@","<").replaceAll("#",">"):null,r=re.find(e=>e.id.toString()===a);if(!r)return i||e.jsx(e.Fragment,{});const s="data-main"in t,c=t["data-status"];return e.jsx(e.Fragment,{children:e.jsx(j.default,{aiReason:r,customStyles:null==H?void 0:H.inlineUpdatedComponent,handleClickCognitiveDecision:null==le?void 0:le.handleClickCognitiveDecision,handleClickUpdatedPill:null==le?void 0:le.handleClickUpdatedPill,handleClickOutputValue:null==le?void 0:le.handleClickOutputValue,customIcons:null==le?void 0:le.customIcons,CDNeededInChip:Z,showWaitingIconInChip:ne,showChip:s,status:c,children:i||e.jsx(e.Fragment,{})})})},del:({node:n,children:i,...t})=>{var l;const{cleanedChildren:d,extractedNodes:a}=P(i,["ins"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:o.default.deleted,style:null!==(l=null==H?void 0:H.deleted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:d}),a]})},ins:({children:n,...i})=>{var t;const{cleanedChildren:l,extractedNodes:d}=P(n,["del"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:o.default.inserted,style:null!==(t=null==H?void 0:H.inserted)&&void 0!==t?t:{},...i,onClick:()=>{i.onclick&&i.onclick()},children:l}),d]})},preserved:({children:n,...i})=>e.jsx("span",{className:o.default.preserved,style:null==H?void 0:H.preserved,...i,children:n}),manual:({children:n,...i})=>{var t;const o=null===(t=null==i?void 0:i.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),l=re.find(e=>e.id.toString()===o),d=i["data-status"];return l?e.jsx(w.default,{aiReason:l,handleClick:null==ve?void 0:ve.handleClick,status:d,children:n}):n||e.jsx(e.Fragment,{})},invisible:({children:n,...i})=>e.jsx(e.Fragment,{}),h1:({node:n,...i})=>e.jsx("h1",{className:o.default.heading1,style:null==H?void 0:H.heading1,children:i.children}),h2:({node:n,...i})=>e.jsx("h2",{className:o.default.heading2,style:null==H?void 0:H.heading2,children:i.children}),h3:({node:n,...i})=>e.jsx("h3",{className:o.default.heading3,style:null==H?void 0:H.heading3,children:i.children}),b:({node:n,...i})=>e.jsx("b",{className:o.default.bold,style:null==H?void 0:H.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e.jsx("p",{...i,className:o.default.paragraph,style:null==H?void 0:H.paragraph,children:i.children}),updated:({node:n,...i})=>e.jsx(s.default,{...i,showUserStoryDiff:x,currentUpdatedTagId:je,setCurrentUpdatedTagId:ye,userStory:oe,setUserStory:ae,setAiReasoning:se,node:n,isCraflow:G,onCraAccept:Q,onCraReject:J,diffEditConfig:me,customStyles:null==H?void 0:H.updatedContent,craFlowConfig:K}),ol:({node:n,...i})=>{var t,l,d;const a=null!==(d=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==l?l:null==i?void 0:i.start)&&void 0!==d?d:void 0;return e.jsx("ol",{className:o.default.orderedList,style:null==H?void 0:H.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e.jsx("ul",{className:o.default.unorderedList,style:null==H?void 0:H.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e.jsx("div",{className:o.default.tableWrapper,children:e.jsx("table",{className:o.default.table,style:null==H?void 0:H.table,children:n})}),tr:({node:n,children:i})=>e.jsx(_,{node:n,children:i,customStyles:H}),td:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("td",{...l,style:o?{cssText:o}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("th",{...l,style:o?{cssText:o}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const o=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e.jsx(f.default,{...i,customStyles:null==H?void 0:H.recommendationBlock,label:o})},a:({inline:i,children:t,node:o,...l})=>{var d,a,r;const s=n.useContext(q)||"true"==(null==l?void 0:l.table),c=`${null==l?void 0:l.href}`,u=null===(d=c.split("$"))||void 0===d?void 0:d[0],g=null===(a=c.split("$"))||void 0===a?void 0:a[1];if("ai_reasoning"===u){const n=(null!==(r=x?W:re)&&void 0!==r?r:[]).find(e=>e.id.toString()===decodeURIComponent(g)),i=ge.includes(g);if(n){if(s)return e.jsx(T,{aiReason:n,customStyle:null==H?void 0:H.tableAiReasoning,customIcons:fe,isHighConfidence:n.relevance_score>=v.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const o=Ee(t),l="source"!==o.trim().toLowerCase();return e.jsx(v.default,{aiReason:n,isSourceHasHighlight:i,inlineLabel:o,isInlineCitation:l,customIcons:fe,customStyles:{aiReasoningContent:null==H?void 0:H.aiReasoningContent,aiReasoningAccordion:null==H?void 0:H.aiReasoningAccordion,aiReasoningMarkdown:null==H?void 0:H.aiReasoningMarkdown,aiReasoningPill:null==H?void 0:H.aiReasoningPill,webCitation:null==H?void 0:H.webCitation,stormeeCitation:null==H?void 0:H.stormeeCitation,waveformCitation:null==H?void 0:H.waveformCitation,imageCitation:null==H?void 0:H.imageCitation,fileCitation:null==H?void 0:H.fileCitation,appModCitation:null==H?void 0:H.appModCitation,rcaCitation:null==H?void 0:H.rcaCitation,readFileCitation:null==H?void 0:H.readFileCitation,loadingCitations:null==H?void 0:H.loadingCitations,chatCitation:null==H?void 0:H.chatCitation,bigEnoughCitation:null==H?void 0:H.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:t,node:l,...d})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e.jsx("div",{children:e.jsx("code",{className:o.default.blockCode,style:null==H?void 0:H.code,children:i})}):e.jsx("code",{className:o.default.inlineCode,style:null==H?void 0:H.code,children:i}),learned:({children:n})=>e.jsx(a.Tooltip,{title:n,placement:"top",children:e.jsx(d.Info,{size:16,className:o.default.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",o=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e.jsx(c.default,{title:"Generated Code",code:o,language:t,customStyles:{pill:null==H?void 0:H.generatedCodePill,content:null==H?void 0:H.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var o,l,d,a;const r=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(t),c=s?e.jsx("div",{dangerouslySetInnerHTML:{__html:A.default.sanitize(s)}}):e.jsx("div",{children:i});return e.jsx(y.default,{id:r,node:n,children:c,props:t,segmentComponentConfig:pe,customStyles:H,customIcons:O,extractText:Ee,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var o,l,d,a;const r=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`;return e.jsx(y.default,{id:r,node:n,children:i,props:t,segmentComponentConfig:pe,customStyles:H,customIcons:O,extractText:Ee,blockId:ee})}}),[ke,K,re,V,je,x,i,O,ue,ge,H,pe,be,qe,ee]),Ue=n.useMemo(()=>{let e=b.escapeTagIds(Te,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=b.splitTagAcrossParagraphs(e,n,"upt"===n)}),e},[Te]);return n.useEffect(()=>{if(!te.current)return;if(!ue.length)return void xe();let e;if(0===ge.length||X)requestAnimationFrame(()=>{Ce([ue[he].replace(/\*/g,"")])});else{const n=te.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{Ce([ue[he].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[ue,ge,he,X]),e.jsx(E.Provider,{value:{expandedInfo:Se,setExpanded:Ne,reasonToRow:Ie},children:e.jsxs("div",{ref:te,className:`${o.default.container} ${"approving"!==p?o.default.wrapper:""} ${U||""}`,style:null==H?void 0:H.container,children:[r?e.jsx(S.MarkdownContextProvider,{children:e.jsx($.default,{components:_e,rehypePlugins:[k.default],children:Ue})}):t,$e>0&&Y&&e.jsx("div",{className:o.default.confidenceScoreContainer,style:null==H?void 0:H.confidenceScoreContainer,children:e.jsxs("span",{className:o.default.confidenceScore,style:null==H?void 0:H.confidenceScore,children:[e.jsx(m.default,{size:14,color:(null==H?void 0:H.confidenceScoreIconColor)||"#166534"}),$e,"%"]})}),M&&e.jsx("div",{className:o.default.citationLoader,style:null==H?void 0:H.citationLoaderContainer,children:e.jsx(u.default,{customStyles:{container:null==H?void 0:H.citationLoadingContainer,icon:null==H?void 0:H.citationLoadingIcon,text:null==H?void 0:H.citationLoadingText}})}),h&&e.jsx("div",{style:{...null===(ie=null==H?void 0:H.attachedContext)||void 0===ie?void 0:ie.wrapper},className:"flex mt-5",children:e.jsx(C.default,{customStyles:null==H?void 0:H.attachedContext,variant:B})})]})})},exports.splitNestedDiffNodes=P;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),t=require("rehype-raw"),l=require("./UserStoryWithCitation.module.css.js"),o=require("../../shared/useMarkdownSearch.js"),d=require("lucide-react"),a=require("@mui/material"),r=require("dompurify"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),g=require("../RequirementAIWrapper/RequirementAIWrapper.js"),p=require("../../icons/CognitiveDecision.js"),h=require("../../icons/BrainRed.js"),v=require("../ai-reasoning/AiReasoningCitation.js"),m=require("../../icons/RelevanceScoreIcon.js"),f=require("../RecommendationBlock/RecommendationBlock.js"),C=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),j=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),w=require("./components/InlineManualComponent.js"),I=require("./components/HighlightButtonComponent.js"),b=require("../../../../utils/tagHelper.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=R(n),$=R(i),k=R(t),A=R(r);const q=n.createContext(!1),E=n.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),M=n.createContext({rowId:""}),T=({aiReason:i,isHighConfidence:t,customStyle:o,customIcons:d})=>{var a;const{expandedInfo:r,setExpanded:s,reasonToRow:c}=n.useContext(E),{rowId:u}=n.useContext(M),g=String(i.id);u&&c.current.set(g,u);const v=(null===(a=null==r?void 0:r.aiReason)||void 0===a?void 0:a.id)===i.id,m=t?(null==d?void 0:d.highConfidence)||e.jsx(p.default,{}):(null==d?void 0:d.lowConfidence)||e.jsx(h.default,{});return e.jsxs("button",{className:l.default.aiReasoningButton,style:o,onClick:e=>{e.stopPropagation(),e.preventDefault(),s(v?null:u,v?null:i)},children:[m,v?e.jsx("i",{className:`pi pi-angle-up ${t?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`}):e.jsx("i",{className:`pi pi-angle-down ${t?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`})]})},_=({children:i,node:t,customStyles:o,customIcons:d})=>{var a,r;const s=n.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=n.useContext(E),u=(null==c?void 0:c.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,p=null!==(r=null===(a=null==t?void 0:t.properties)||void 0===a?void 0:a.style)&&void 0!==r?r:void 0;return e.jsxs(M.Provider,{value:{rowId:s},children:[e.jsx("tr",{style:p?{cssText:p}:void 0,children:i}),u&&(null==c?void 0:c.aiReason)&&e.jsx("tr",{style:{width:"100%"},children:e.jsx("td",{colSpan:g||1,className:l.default.tableExpandedCell,children:e.jsx("div",{className:l.default.tableExpandedCellInner,children:e.jsx("div",{className:l.default.tableExpandedCellContent,children:e.jsx(x.default,{aiReason:c.aiReason,customIcons:d,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})})})})})]})};const U=["del","ins"];function L(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,U,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var t;return`<code>${l=null!==(t=n[Number(i)])&&void 0!==t?t:"",l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var l})}(e)).join(""))}const F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function P(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,o;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!N.default.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(F.has(d))return e;const a=null===(o=N.default.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===o?void 0:o.flat().filter(e=>null!=e);return a&&0!==a.length?N.default.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:i,noMarkdownContent:t,useMarkdown:r=!0,isParent:p,scenario:h,showUserStoryDiff:x=!1,aiReasoningsForBlock:R,isCitationLoadingDisplay:M=!1,className:U,highConfidenceIcon:F,lowConfidenceIcon:D,customStyles:H,customIcons:O,contextVariant:B,aiReasoningDiffView:V,userStoryCitations:W,artifactId:z,isCraflow:G,onCraAccept:Q,onCraReject:J,craFlowConfig:K,isDisplayHighlightControl:X=!1,showConfidenceScore:Y=!0,CDNeededInChip:Z})=>{var ee;const ne=n.useRef(null),{userStory:ie,inlineUpdateComponentConfig:te,getAvgScoreForStory:le,setUserStory:oe,aiReasoning:de,setAiReasoning:ae,customIcons:re,searchQueryList:se,searchQueryReasoningIdList:ce,currentHighlightIndex:ue,segmentComponentConfig:ge,inlineManualComponentConfig:pe,diffEditConfig:he}=g.useRequirementAI(),ve=null!=O?O:null==re?void 0:re.userStoryIcons;null==H||H.searchHighlight;const{search:me,clear:fe}=o.useMarkdownSearch(ne),[Ce,xe]=n.useState("1"),[je,ye]=n.useState(null),Se=n.useRef(new Map),[we,Ie]=n.useState(new Set),be=n.useCallback((e,n)=>{ye(e&&n?{rowId:e,aiReason:n}:null)},[]),Re=z?le(z):0,[Ne,$e]=n.useState([]),ke=n.useCallback(e=>{Ie(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Ae=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Ae).join(""):N.default.isValidElement(e)?Ae(e.props.children):"",qe=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,t,l)=>{const o=t.match(/<table[\s\S]*?<\/table>/i);if(o){return`<segment${i} data-table="${btoa(encodeURIComponent(o[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,t,l)=>{const o=n.substring(0,l),d=o.lastIndexOf("\n"),a=/^\s+[-*]\s/.test(o.substring(d+1))||/^\s+\d+\.\s/.test(o.substring(d+1)),r=/^\s*(\d+\.|\s*[-*])\s+$/.test(o.substring(d+1));if(a||r){let e=t;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let t;const l=new RegExp(n.source,n.flags);for(;null!==(t=l.exec(e));){const e=t[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),l=e.match(/<changed>([\s\S]*?)<\/changed>/i),o=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:o((null==n?void 0:n[1])||""),changedItemCount:o((null==l?void 0:l[1])||"")})}if(0===i.length)return e;let o=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const l=o.substring(0,n.index).split("\n").reverse();let d=!1;for(const e of l){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(d=!0);break}}if(!d)continue;const a=n.endIndex,r=e+1<i.length?i[e+1].index:o.length;let s=o.substring(a,r);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),o=o.substring(0,a)+s+o.substring(r)}return o}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=L(n),n},Ee=n.useMemo(()=>i?qe(i):i,[i]);n.useEffect(()=>{$e(R||de)},[R,de]);const Me=n.useMemo(()=>({span:({node:n,children:i,...t})=>{var l,o,d,a,r;const s=null!==(o=null===(l=null==n?void 0:n.properties)||void 0===l?void 0:l["highlight-id"])&&void 0!==o?o:null==t?void 0:t["highlight-id"],c="string"==typeof s&&we.has(s),u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-color"])&&void 0!==a?a:null==t?void 0:t["highlight-color"];return e.jsx("span",{style:{...null!==(r=null==H?void 0:H.span)&&void 0!==r?r:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:n,children:i,...t})=>{var l,o,d,a,r,s;const c=null!==(o=null===(l=null==n?void 0:n.properties)||void 0===l?void 0:l.action)&&void 0!==o?o:null==t?void 0:t.action,u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(s=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-type"])&&void 0!==s?s:null==t?void 0:t["highlight-type"];return"highlight"===c?e.jsx(I.default,{highlightId:u,handleHighlightSpan:ke,icon:"web"===g?null==ve?void 0:ve.webCitationIcon:"doc"===g?null==ve?void 0:ve.fileCitationIcon:e.jsx(e.Fragment,{}),customStyles:"web"===g?null==H?void 0:H.webButton:"doc"===g?null==H?void 0:H.docButton:{}}):null},upt:({node:n,children:i,...t})=>{var l,o;const d=null==t?void 0:t.id,a=d?null===(o=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===o?void 0:o.replaceAll("@","<").replaceAll("#",">"):null,r=de.find(e=>e.id.toString()===a);if(!r)return i||e.jsx(e.Fragment,{});const s="data-main"in t,c=t["data-status"];return e.jsx(e.Fragment,{children:e.jsx(j.default,{aiReason:r,customStyles:null==H?void 0:H.inlineUpdatedComponent,handleClickCognitiveDecision:null==te?void 0:te.handleClickCognitiveDecision,handleClickUpdatedPill:null==te?void 0:te.handleClickUpdatedPill,handleClickOutputValue:null==te?void 0:te.handleClickOutputValue,customIcons:null==te?void 0:te.customIcons,CDNeededInChip:Z,showChip:s,status:c,children:i||e.jsx(e.Fragment,{})})})},del:({node:n,children:i,...t})=>{var o;const{cleanedChildren:d,extractedNodes:a}=P(i,["ins"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.default.deleted,style:null!==(o=null==H?void 0:H.deleted)&&void 0!==o?o:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:d}),a]})},ins:({children:n,...i})=>{var t;const{cleanedChildren:o,extractedNodes:d}=P(n,["del"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.default.inserted,style:null!==(t=null==H?void 0:H.inserted)&&void 0!==t?t:{},...i,onClick:()=>{i.onclick&&i.onclick()},children:o}),d]})},preserved:({children:n,...i})=>e.jsx("span",{className:l.default.preserved,style:null==H?void 0:H.preserved,...i,children:n}),manual:({children:n,...i})=>{var t;const l=null===(t=null==i?void 0:i.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),o=de.find(e=>e.id.toString()===l),d=i["data-status"];return o?e.jsx(w.default,{aiReason:o,handleClick:null==pe?void 0:pe.handleClick,status:d,children:n}):n||e.jsx(e.Fragment,{})},invisible:({children:n,...i})=>e.jsx(e.Fragment,{}),h1:({node:n,...i})=>e.jsx("h1",{className:l.default.heading1,style:null==H?void 0:H.heading1,children:i.children}),h2:({node:n,...i})=>e.jsx("h2",{className:l.default.heading2,style:null==H?void 0:H.heading2,children:i.children}),h3:({node:n,...i})=>e.jsx("h3",{className:l.default.heading3,style:null==H?void 0:H.heading3,children:i.children}),b:({node:n,...i})=>e.jsx("b",{className:l.default.bold,style:null==H?void 0:H.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e.jsx("p",{...i,className:l.default.paragraph,style:null==H?void 0:H.paragraph,children:i.children}),updated:({node:n,...i})=>e.jsx(s.default,{...i,showUserStoryDiff:x,currentUpdatedTagId:Ce,setCurrentUpdatedTagId:xe,userStory:ie,setUserStory:oe,setAiReasoning:ae,node:n,isCraflow:G,onCraAccept:Q,onCraReject:J,diffEditConfig:he,customStyles:null==H?void 0:H.updatedContent,craFlowConfig:K}),ol:({node:n,...i})=>{var t,o,d;const a=null!==(d=null!==(o=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==o?o:null==i?void 0:i.start)&&void 0!==d?d:void 0;return e.jsx("ol",{className:l.default.orderedList,style:null==H?void 0:H.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e.jsx("ul",{className:l.default.unorderedList,style:null==H?void 0:H.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e.jsx("div",{className:l.default.tableWrapper,children:e.jsx("table",{className:l.default.table,style:null==H?void 0:H.table,children:n})}),tr:({node:n,children:i})=>e.jsx(_,{node:n,children:i,customStyles:H}),td:({node:n,children:i})=>{var t;const{style:l,...o}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("td",{...o,style:l?{cssText:l}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:l,...o}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("th",{...o,style:l?{cssText:l}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const l=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e.jsx(f.default,{...i,customStyles:null==H?void 0:H.recommendationBlock,label:l})},a:({inline:i,children:t,node:l,...o})=>{var d,a,r;const s=n.useContext(q)||"true"==(null==o?void 0:o.table),c=`${null==o?void 0:o.href}`,u=null===(d=c.split("$"))||void 0===d?void 0:d[0],g=null===(a=c.split("$"))||void 0===a?void 0:a[1];if("ai_reasoning"===u){const n=(null!==(r=x?V:de)&&void 0!==r?r:[]).find(e=>e.id.toString()===decodeURIComponent(g)),i=ce.includes(g);if(n){if(s)return e.jsx(T,{aiReason:n,customStyle:null==H?void 0:H.tableAiReasoning,customIcons:ve,isHighConfidence:n.relevance_score>=v.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const l=Ae(t),o="source"!==l.trim().toLowerCase();return e.jsx(v.default,{aiReason:n,isSourceHasHighlight:i,inlineLabel:l,isInlineCitation:o,customIcons:ve,customStyles:{aiReasoningContent:null==H?void 0:H.aiReasoningContent,aiReasoningAccordion:null==H?void 0:H.aiReasoningAccordion,aiReasoningMarkdown:null==H?void 0:H.aiReasoningMarkdown,aiReasoningPill:null==H?void 0:H.aiReasoningPill,webCitation:null==H?void 0:H.webCitation,stormeeCitation:null==H?void 0:H.stormeeCitation,waveformCitation:null==H?void 0:H.waveformCitation,imageCitation:null==H?void 0:H.imageCitation,fileCitation:null==H?void 0:H.fileCitation,appModCitation:null==H?void 0:H.appModCitation,rcaCitation:null==H?void 0:H.rcaCitation,readFileCitation:null==H?void 0:H.readFileCitation,loadingCitations:null==H?void 0:H.loadingCitations,chatCitation:null==H?void 0:H.chatCitation,bigEnoughCitation:null==H?void 0:H.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:t,node:o,...d})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e.jsx("div",{children:e.jsx("code",{className:l.default.blockCode,style:null==H?void 0:H.code,children:i})}):e.jsx("code",{className:l.default.inlineCode,style:null==H?void 0:H.code,children:i}),learned:({children:n})=>e.jsx(a.Tooltip,{title:n,placement:"top",children:e.jsx(d.Info,{size:16,className:l.default.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",l=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e.jsx(c.default,{title:"Generated Code",code:l,language:t,customStyles:{pill:null==H?void 0:H.generatedCodePill,content:null==H?void 0:H.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var l,o,d,a;const r=`${null===(l=n.position)||void 0===l?void 0:l.start.line}-${null===(o=n.position)||void 0===o?void 0:o.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(t),c=s?e.jsx("div",{dangerouslySetInnerHTML:{__html:A.default.sanitize(s)}}):e.jsx("div",{children:i});return e.jsx(y.default,{id:r,node:n,children:c,props:t,segmentComponentConfig:ge,customStyles:H,customIcons:O,extractText:Ae,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var l,o,d,a;const r=`${null===(l=n.position)||void 0===l?void 0:l.start.line}-${null===(o=n.position)||void 0===o?void 0:o.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`;return e.jsx(y.default,{id:r,node:n,children:i,props:t,segmentComponentConfig:ge,customStyles:H,customIcons:O,extractText:Ae})}}),[Ne,K,de,W,Ce,x,i,O,se,ce,H,ge,we,ke]),Te=n.useMemo(()=>{let e=b.escapeTagIds(Ee,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=b.splitTagAcrossParagraphs(e,n,"upt"===n)}),e},[Ee]);return n.useEffect(()=>{if(!ne.current)return;if(!se.length)return void fe();let e;if(0===ce.length||X)requestAnimationFrame(()=>{me([se[ue].replace(/\*/g,"")])});else{const n=ne.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{me([se[ue].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[se,ce,ue,X]),e.jsx(E.Provider,{value:{expandedInfo:je,setExpanded:be,reasonToRow:Se},children:e.jsxs("div",{ref:ne,className:`${l.default.container} ${"approving"!==h?l.default.wrapper:""} ${U||""}`,style:null==H?void 0:H.container,children:[r?e.jsx(S.MarkdownContextProvider,{children:e.jsx($.default,{components:Me,rehypePlugins:[k.default],children:Te})}):t,Re>0&&Y&&e.jsx("div",{className:l.default.confidenceScoreContainer,style:null==H?void 0:H.confidenceScoreContainer,children:e.jsxs("span",{className:l.default.confidenceScore,style:null==H?void 0:H.confidenceScore,children:[e.jsx(m.default,{size:14,color:(null==H?void 0:H.confidenceScoreIconColor)||"#166534"}),Re,"%"]})}),M&&e.jsx("div",{className:l.default.citationLoader,style:null==H?void 0:H.citationLoaderContainer,children:e.jsx(u.default,{customStyles:{container:null==H?void 0:H.citationLoadingContainer,icon:null==H?void 0:H.citationLoadingIcon,text:null==H?void 0:H.citationLoadingText}})}),p&&e.jsx("div",{style:{...null===(ee=null==H?void 0:H.attachedContext)||void 0===ee?void 0:ee.wrapper},className:"flex mt-5",children:e.jsx(C.default,{customStyles:null==H?void 0:H.attachedContext,variant:B})})]})})},exports.splitNestedDiffNodes=P;
|
|
2
2
|
//# sourceMappingURL=UserStoryWithCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("@mui/material"),n=require("../../../utils/css.utils.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("@mui/material"),n=require("../../../utils/css.utils.js"),o=require("./InlineUpdatedComponent.module.css.js"),i=require("../../../icons/CognitiveDecision.js"),t=require("lucide-react"),r=require("react");exports.default=({aiReason:d,children:a,customStyles:s,handleClickCognitiveDecision:u,handleClickUpdatedPill:c,handleClickOutputValue:v,customIcons:p,CDNeededInChip:f=!0,showChip:g,status:h})=>{var m,x,j,C,y,b,w,k,D,N,P,_,S,T,q,O,$,I,L;const R=r.useRef(null),z=r.useRef(null),[E,A]=r.useState(null),W=r.useCallback(()=>{var e;const l=z.current,n=(null===(e=R.current)||void 0===e?void 0:e.offsetParent)||(null==l?void 0:l.offsetParent);if(!(l&&n instanceof HTMLElement))return;const o=l.getBoundingClientRect(),i=n.getBoundingClientRect(),t=o.top-i.top+o.height/2;A(e=>null!==e&&Math.abs(e-t)<.5?e:t)},[]);r.useLayoutEffect(()=>{W()}),r.useLayoutEffect(()=>{var e,l;if("undefined"==typeof window)return;const n=window.requestAnimationFrame(W);window.addEventListener("resize",W);const o="undefined"!=typeof ResizeObserver?new ResizeObserver(W):null;z.current&&(null==o||o.observe(z.current));const i=(null===(e=R.current)||void 0===e?void 0:e.offsetParent)||(null===(l=z.current)||void 0===l?void 0:l.offsetParent);return i instanceof HTMLElement&&(null==o||o.observe(i)),()=>{window.cancelAnimationFrame(n),window.removeEventListener("resize",W),null==o||o.disconnect()}},[W]);const F="pending"!==h?"#303030":null===(j=null===(x=null===(m=d.redlining_details)||void 0===m?void 0:m.evaluation_outputs)||void 0===x?void 0:x.metadata)||void 0===j?void 0:j.label_color,M={color:F||"#000000",background:n.hexToOpacity(F||"#000000",25),border:`1px solid ${n.hexToOpacity(F||"#000000",75)}`},U=F||"#000000",B=n.hexToOpacity(F||"#000000",25),H={background:n.hexToOpacity(F||"#000000",75),...null==s?void 0:s.dividerStyle};let V=null;"accepted"===h?V=null!==(C=null==p?void 0:p.accepted)&&void 0!==C?C:e.jsx(t.Check,{color:"#16A34A"}):"rejected"===h?V=null!==(y=null==p?void 0:p.rejected)&&void 0!==y?y:e.jsx(t.X,{color:"#DC2626"}):"reverted"===h&&(V=null!==(b=null==p?void 0:p.reverted)&&void 0!==b?b:e.jsx(t.Undo2,{color:"#475569"}));const X=null===E?{}:{"--inline-update-anchor-top":`${E}px`},G=null===E?"":` ${o.default.anchorAligned}`;return e.jsxs("span",{className:o.default.inlineUpdatedWrapper,children:[g&&e.jsxs(e.Fragment,{children:[V&&e.jsx("span",{className:`${o.default.resolvedStatus}${G}`,style:{...X,...null==s?void 0:s.resolvedIcon},children:V}),e.jsx("span",{ref:R,id:d.id.toString(),onClick:e=>{e.stopPropagation(),null==c||c(e.currentTarget,d)},className:`${o.default.pillWrapper}${G}`,style:{...X,...null==s?void 0:s.pillStyleWrapper},children:e.jsxs("span",{className:o.default.pillComponent,style:{...M,...null===(w=null==s?void 0:s.pillComponent)||void 0===w?void 0:w.commonStyle},children:[e.jsx("span",{children:(null===(N=null===(D=null===(k=d.redlining_details)||void 0===k?void 0:k.evaluation_outputs)||void 0===D?void 0:D.metadata)||void 0===N?void 0:N.label_text)||""}),e.jsx(l.Divider,{className:o.default.dividerStyle,style:H}),e.jsx("span",{className:o.default["output-container"],onClick:e=>{v&&(e.stopPropagation(),null==v||v(e.currentTarget,d))},children:d.resolving?e.jsx(l.CircularProgress,{size:(null===(P=null==s?void 0:s.loader)||void 0===P?void 0:P.size)||18,"aria-label":"Loading…",sx:{color:(null===(_=null==s?void 0:s.loader)||void 0===_?void 0:_.color)||F}}):"pending"!==h?V:null===(T=null===(S=null==d?void 0:d.redlining_details)||void 0===S?void 0:S.evaluation_outputs)||void 0===T?void 0:T.output_value}),f&&e.jsxs(e.Fragment,{children:[e.jsx(l.Divider,{className:o.default.dividerStyle,style:H}),e.jsx("span",{onClick:e=>{e.stopPropagation(),null==u||u(e.currentTarget,d)},className:o.default.cognitiveDecisionWrapper,style:null===(q=null==s?void 0:s.cognitiveDecisionIcon)||void 0===q?void 0:q.wrapper,children:e.jsx(i.default,{color:(null===(O=null==s?void 0:s.cognitiveDecisionIcon)||void 0===O?void 0:O.color)||U,backgroundColor:(null===($=null==s?void 0:s.cognitiveDecisionIcon)||void 0===$?void 0:$.backgroundColor)||B})}),e.jsx("span",{className:o.default.chevronWrapper,style:null===(I=null==s?void 0:s.Chevron)||void 0===I?void 0:I.wrapper,children:e.jsx(t.ChevronDown,{color:(null===(L=null==s?void 0:s.Chevron)||void 0===L?void 0:L.color)||F})})]})]})})]}),e.jsx("span",{ref:z,className:o.default[`upt-${h}`],onClick:e=>{e.preventDefault(),e.stopPropagation(),R.current&&(null==c||c(R.current,d))},children:a})]})};
|
|
2
2
|
//# sourceMappingURL=InlineUpdatedComponent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const n=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;n&&e.setAttribute("nonce",n),e.appendChild(document.createTextNode(".InlineUpdatedComponent-module_insertedComponentText__kzsSI{background-color:#dbeafe;color:#1e40af}.InlineUpdatedComponent-module_inlineUpdatedWrapper__aFuzM{display:inline}.InlineUpdatedComponent-module_pillWrapper__QRLYT{align-items:flex-end;display:flex;flex-direction:column;gap:4px;position:absolute;right:-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const n=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;n&&e.setAttribute("nonce",n),e.appendChild(document.createTextNode(".InlineUpdatedComponent-module_insertedComponentText__kzsSI{background-color:#dbeafe;color:#1e40af}.InlineUpdatedComponent-module_inlineUpdatedWrapper__aFuzM{display:inline}.InlineUpdatedComponent-module_pillWrapper__QRLYT{align-items:flex-end;display:flex;flex-direction:column;gap:4px;position:absolute;right:-165px}.InlineUpdatedComponent-module_resolvedStatus__aqmur{align-items:center;display:flex;justify-content:center;position:absolute;right:-6px}.InlineUpdatedComponent-module_anchorAligned__Mj2dK{top:var(--inline-update-anchor-top);transform:translateY(-50%)}.InlineUpdatedComponent-module_pillComponent__otvgL{align-items:center;background:#fff0f0;border:1.5px solid #f5b8b8;border-radius:100px;color:#c0392b;cursor:pointer;display:flex;font-size:14;font-weight:500;gap:6px;outline:none;padding:6px 14px;width:fit-content}.InlineUpdatedComponent-module_cognitiveDecisionWrapper__Jw0UK{align-items:center;display:flex;margin-left:2px}.InlineUpdatedComponent-module_chevronWrapper__bncFg{align-items:center;display:flex;margin-left:4px}.InlineUpdatedComponent-module_dividerStyle__MFuEO{background:#fca5a5;height:20px;width:1px}.InlineUpdatedComponent-module_upt-accepted__6OTYS{background-color:#f3e8ff;-webkit-box-decoration-break:clone;box-decoration-break:clone;cursor:pointer;display:inline}.InlineUpdatedComponent-module_upt-pending__sLKuc,.InlineUpdatedComponent-module_upt-rejected__yvaiJ,.InlineUpdatedComponent-module_upt-reverted__s-l-4{cursor:pointer}.InlineUpdatedComponent-module_output-container__ATdUF{align-items:center;display:flex;justify-content:center}"));const t=document.head||document.getElementsByTagName("head")[0]||document.documentElement;t&&t.appendChild(e)}(),exports.default={insertedComponentText:"InlineUpdatedComponent-module_insertedComponentText__kzsSI",inlineUpdatedWrapper:"InlineUpdatedComponent-module_inlineUpdatedWrapper__aFuzM",pillWrapper:"InlineUpdatedComponent-module_pillWrapper__QRLYT",resolvedStatus:"InlineUpdatedComponent-module_resolvedStatus__aqmur",anchorAligned:"InlineUpdatedComponent-module_anchorAligned__Mj2dK",pillComponent:"InlineUpdatedComponent-module_pillComponent__otvgL",cognitiveDecisionWrapper:"InlineUpdatedComponent-module_cognitiveDecisionWrapper__Jw0UK",chevronWrapper:"InlineUpdatedComponent-module_chevronWrapper__bncFg",dividerStyle:"InlineUpdatedComponent-module_dividerStyle__MFuEO","upt-accepted":"InlineUpdatedComponent-module_upt-accepted__6OTYS","upt-rejected":"InlineUpdatedComponent-module_upt-rejected__yvaiJ","upt-reverted":"InlineUpdatedComponent-module_upt-reverted__s-l-4","upt-pending":"InlineUpdatedComponent-module_upt-pending__sLKuc","output-container":"InlineUpdatedComponent-module_output-container__ATdUF"};
|
|
2
2
|
//# sourceMappingURL=InlineUpdatedComponent.module.css.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),i=require("react"),t=require("@tanstack/react-query"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),i=require("react"),t=require("@tanstack/react-query"),e=require("../service/onDemandApi.js"),o=function(n,i,t){var e;return Array.isArray(n)?Array.isArray(i)&&0!==i.length?Number.isNaN(t)?(console.warn("[findCitation] citationNumber is NaN"),null):null!==(e=n.find(function(n){var e,o=function(n){var i,t,e,o,a;if(null==n)return console.warn("[getCitationType] received null or undefined citation"),"";var l=null!==(a=null!==(o=null!==(t=null===(i=null==n?void 0:n.customMetaData)||void 0===i?void 0:i.type)&&void 0!==t?t:null===(e=null==n?void 0:n.customMetadata)||void 0===e?void 0:e.type)&&void 0!==o?o:null==n?void 0:n.type)&&void 0!==a?a:"";return l||console.warn("[getCitationType] citation has no resolvable type field",n),l}(n);return(null===(e=function(n){var i;return null==n?(console.warn("[getCitationNumber] received null or undefined citation"),""):(null==n.citation_number&&console.warn("[getCitationNumber] citation is missing citation_number field",n),null!==(i=null==n?void 0:n.citation_number)&&void 0!==i?i:"")}(n))||void 0===e?void 0:e.toString())===t.toString()&&i.some(function(n){return null==o?void 0:o.includes(n)})}))&&void 0!==e?e:null:(console.warn("[findCitation] citationTypes is empty or falsy",i),null):(console.warn("[findCitation] citations is not an array",n),null)};exports.useOnDemandCitationFetch=function(a){var l=a.msg,r=a.citationType,u=a.citationNumber,c=a.enabled,s=void 0!==c&&c,d=a.accessToken,v=a.baseUrl,_=a.orgName,f=a.citationAssistantProcessingName,m=a.citationAgentName,h=(null==l?void 0:l.requestId)||(null==l?void 0:l.id)||"",y=i.useMemo(function(){return function(n){switch(n){case"artifact_chunks":return["artifact_chunks","scanned_doc_citation","scanned_doc_citations"];case"rai_artifact_citation":return["rai_artifact_citation","rai_artifact_citations"];case"json_chunks":return["json_chunks"];case"scanned_doc_citation":return["scanned_doc_citation","scanned_doc_citations","artifact_chunks"];case"scanned_doc_citations":return["scanned_doc_citations","scanned_doc_citation","artifact_chunks"];default:return[n]}}(r)},[r]),g=function(){switch(r){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";default:return r}}(),p=(null==l?void 0:l.isEcgPayloadActive)?i.useMemo(function(){return["onDemandCitationFetch",h,g,null==l?void 0:l.customCitationId,null==l?void 0:l.ecg_agent_name]},[h,g,null==l?void 0:l.customCitationId,null==l?void 0:l.ecg_agent_name]):i.useMemo(function(){return["onDemandCitationFetch",h,g,u]},[h,g,u]),C=i.useMemo(function(){return o(null==l?void 0:l.citations,y,u)},[null==l?void 0:l.citations,y,u]),b=Boolean(s&&h&&g&&v&&_&&!Number.isNaN(u)&&!C),N=d,w=!0===(null==l?void 0:l.isStreamEnd),A=t.useQuery({queryKey:p,queryFn:function(){return n.__awaiter(void 0,void 0,void 0,function(){var i,t,o,a,r,c,s,d;return n.__generator(this,function(n){switch(n.label){case 0:return[4,e.fetchOnDemandCitation(h,g,u,null!==(t=null==l?void 0:l.content)&&void 0!==t?t:"",N,v,null!=f?f:"",_,null!=m?m:"",null!==(o=null==l?void 0:l.isEcgPayloadActive)&&void 0!==o&&o,null!==(a=null==l?void 0:l.ecg_agent_name)&&void 0!==a?a:"",null!==(r=null==l?void 0:l.customCitationId)&&void 0!==r?r:"",null!==(c=null==l?void 0:l.plan_id)&&void 0!==c?c:"",null!==(s=null==l?void 0:l.ui_chat_history)&&void 0!==s?s:void 0)];case 1:if((i=n.sent()).error||!i.responseData)throw new Error((null===(d=i.error)||void 0===d?void 0:d.errorMessage)||"Failed to fetch on-demand citation");return[2,i.responseData]}})})},enabled:b&&w&&Boolean(null==l?void 0:l.content),staleTime:1/0,cacheTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,retry:!1}),M=i.useMemo(function(){var n,i,t,e,a,r,c,s=null!==(t=null===(i=null===(n=A.data)||void 0===n?void 0:n.result)||void 0===i?void 0:i.citations)&&void 0!==t?t:[];return Array.isArray(s)&&0!==s.length?(null==l?void 0:l.customCitationId)?null!==(a=null!==(e=s.find(function(n){var i,t,e=null!==(t=null!==(i=null==n?void 0:n.title)&&void 0!==i?i:null==n?void 0:n.display_name)&&void 0!==t?t:"";return"string"==typeof e&&e.includes(l.customCitationId)}))&&void 0!==e?e:s[0])&&void 0!==a?a:null:null!==(c=null!==(r=o(s,y,u))&&void 0!==r?r:s[0])&&void 0!==c?c:null:null},[null==l?void 0:l.customCitationId,u,y,A.data]);return{citation:null!=C?C:M,isFetching:A.isFetching,isLoading:A.isLoading,isComplete:A.isSuccess,status:A.status,refetch:A.refetch}};
|
|
2
2
|
//# sourceMappingURL=useOnDemandCitationFetch.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("axios"),t=require("./apicache.service.js"),n=require("../types/onDemandApi.types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(r),o=72e5,i=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},c=function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){if(s.default.isAxiosError(r)){if("ECONNABORTED"===(t=r).code)return[2,{type:n.NetworkErrorType.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:r}];if(t.message.includes("net::ERR_NETWORK_CHANGED")||t.message.includes("net::ERR_INTERNET_DISCONNECTED")||t.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:n.NetworkErrorType.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:r}];if(t.message.includes("Network Error")||"ERR_NETWORK"===t.code||t.message.includes("net::ERR_CONNECTION_REFUSED")||t.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:n.NetworkErrorType.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:r}];if(t.response&&t.response.status>=500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(t.response.status,")."),status:t.response.status,originalError:r}];if(t.response&&t.response.status>=400&&t.response.status<500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:i(t.response.data)||"Request failed with status code ".concat(t.response.status),status:t.response.status,originalError:r}]}return[2,{type:n.NetworkErrorType.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:r}]})})},u=function(r,t){void 0===t&&(t=18e4);var n=s.default.create({baseURL:r,timeout:t});return n.interceptors.request.use(function(r){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return[2,r]})})},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),[2,Promise.reject(t)]}})})}),n.interceptors.response.use(function(e){return e},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),console.error("API Request Failed:",t),[2,Promise.reject(t)]}})})}),n},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},l=u(),_=function(r,t,a){return e.__awaiter(void 0,void 0,void 0,function(){var s,o,i,p,_,d,E;return e.__generator(this,function(g){switch(g.label){case 0:switch(g.trys.push([0,13,,15]),s=(null==a?void 0:a.baseURL)?u(a.baseURL):l,i=(o=a||{}).data,p=o.config,_=void 0,r.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,s.get(t,p)];case 2:case 4:case 6:case 8:case 10:return _=g.sent(),[3,12];case 3:return[4,s.post(t,i,p)];case 5:return[4,s.put(t,i,p)];case 7:return[4,s.patch(t,i,p)];case 9:return d=e.__assign(e.__assign({},p),{data:i}),[4,s.delete(t,d)];case 11:throw new Error("Unsupported method: ".concat(r));case 12:return[2,{responseData:_.data,error:null}];case 13:return(E=g.sent()).type&&Object.values(n.NetworkErrorType).includes(E.type)?[2,{responseData:null,error:E}]:[4,c(E)];case 14:return[2,{responseData:null,error:g.sent()}];case 15:return[2]}})})},d=function(r,a,s){return e.__awaiter(void 0,void 0,void 0,function(){var i,c,u,l,d,E,g,f,y,h,v,R,m,N;return e.__generator(this,function(T){switch(T.label){case 0:return c=(i=s||{}).data,u=i.params,l=i.config,d=i.errorMessage,E=i.baseURL,g=i.cacheOption,f=i.shouldCache,y=null!==(N=null==g?void 0:g.ttl)&&void 0!==N?N:o,h=(null==g?void 0:g.key)||p(r,a,u),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,t.apiCache.get(h)];case 1:if(v=T.sent())return[2,{responseData:v.data,error:null,cacheMeta:{isFromCache:!0,timestamp:v.timestamp,ttl:v.ttl,cacheKey:h}}];T.label=2;case 2:return R=e.__assign(e.__assign({},l),u&&{params:u}),[4,_(r,a,{data:c,config:R,baseURL:E})];case 3:return m=T.sent(),!(null==g?void 0:g.skipCache)&&null!=m.responseData&&(!f||f(m.responseData))?[4,t.apiCache.set(h,m.responseData,y)]:[3,5];case 4:T.sent(),T.label=5;case 5:return[2,{responseData:m.responseData,error:m.error?{errorMessage:m.error.type===n.NetworkErrorType.INTERNET_DISCONNECTED||m.error.type===n.NetworkErrorType.SLOW_CONNECTION||m.error.type===n.NetworkErrorType.TIMEOUT?m.error.message:m.error.type===n.NetworkErrorType.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":d||m.error.message,errorObjData:m.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:y,cacheKey:h}}]}})})};Object.defineProperty(exports,"NetworkErrorType",{enumerable:!0,get:function(){return n.NetworkErrorType}}),exports.DEFAULT_CACHE_TTL=o,exports.createApiInstance=u,exports.fetchOnDemandCitation=function(r,t,n,a,s,o,i,c,u,p,l,_,E,g){return e.__awaiter(void 0,void 0,void 0,function(){var s,f,y,h;return e.__generator(this,function(v){return s="artifact_chunks"===t||"scanned_doc_citation"===t?"artifact_chunks":t,f=p?_:"".concat(s,"_").concat(n),[2,d(y="post",h="/api/chat/chatResponse",{baseURL:o,data:{name:i||"citationsprocessing",organizationName:c,prompt:"",useAgent:{agent_name:u||"ProcessCitationsAgent",arguments:e.__assign(e.__assign({citation_type:t,is_primary_agent_request:!1},p&&{check_possible_citation_payload:!1}),{ui_request_body:e.__assign(e.__assign(e.__assign({llm_formatted_response:a,request_id:r,max_concurrent_citations:10,citation_id:f},p&&l&&{ecg_agent_name:l}),p&&E&&{plan_id:E}),p&&g&&{ui_chat_history:g})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(y,":").concat(h,":onDemandCitation:").concat(r,":").concat(t,":").concat(p?_:n)},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},exports.generateCacheKey=p,exports.makeApiRequest=_,exports.makeApiRequestWithTTLCache=d;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("axios"),t=require("./apicache.service.js"),n=require("../types/onDemandApi.types.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(r),o=72e5,i=function(e){if(e&&"object"==typeof e){var r=e;return"string"==typeof r.message?r.message:"string"==typeof r.errorMessage?r.errorMessage:"string"==typeof r.error?r.error:r.error&&"object"==typeof r.error&&"string"==typeof r.error.message?r.error.message:"string"==typeof r.details?r.details:r}},c=function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){if(s.default.isAxiosError(r)){if("ECONNABORTED"===(t=r).code)return[2,{type:n.NetworkErrorType.TIMEOUT,message:"The request took too long to complete. Please try again.",originalError:r}];if(t.message.includes("net::ERR_NETWORK_CHANGED")||t.message.includes("net::ERR_INTERNET_DISCONNECTED")||t.message.includes("net::ERR_NAME_NOT_RESOLVED"))return[2,{type:n.NetworkErrorType.INTERNET_DISCONNECTED,message:"Internet connection issue detected. Please check your network.",originalError:r}];if(t.message.includes("Network Error")||"ERR_NETWORK"===t.code||t.message.includes("net::ERR_CONNECTION_REFUSED")||t.message.includes("net::ERR_EMPTY_RESPONSE"))return[2,{type:n.NetworkErrorType.SERVER_UNREACHABLE,message:"Unable to connect to server. The service may be down or unreachable.",originalError:r}];if(t.response&&t.response.status>=500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:"Service Unavailable. Server error (".concat(t.response.status,")."),status:t.response.status,originalError:r}];if(t.response&&t.response.status>=400&&t.response.status<500)return[2,{type:n.NetworkErrorType.SERVER_ERROR,message:i(t.response.data)||"Request failed with status code ".concat(t.response.status),status:t.response.status,originalError:r}]}return[2,{type:n.NetworkErrorType.UNKNOWN_ERROR,message:"An unexpected error occurred. Please try again later.",originalError:r}]})})},u=function(r,t){void 0===t&&(t=18e4);var n=s.default.create({baseURL:r,timeout:t});return n.interceptors.request.use(function(r){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return[2,r]})})},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),[2,Promise.reject(t)]}})})}),n.interceptors.response.use(function(e){return e},function(r){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return[4,c(r)];case 1:return t=e.sent(),console.error("API Request Failed:",t),[2,Promise.reject(t)]}})})}),n},p=function(e,r,t){return"".concat(e,":").concat(r,":").concat(JSON.stringify(t||{}))},l=u(),_=function(r,t,a){return e.__awaiter(void 0,void 0,void 0,function(){var s,o,i,p,_,d,E;return e.__generator(this,function(g){switch(g.label){case 0:switch(g.trys.push([0,13,,15]),s=(null==a?void 0:a.baseURL)?u(a.baseURL):l,i=(o=a||{}).data,p=o.config,_=void 0,r.toLowerCase()){case"get":return[3,1];case"post":return[3,3];case"put":return[3,5];case"patch":return[3,7];case"delete":return[3,9]}return[3,11];case 1:return[4,s.get(t,p)];case 2:case 4:case 6:case 8:case 10:return _=g.sent(),[3,12];case 3:return[4,s.post(t,i,p)];case 5:return[4,s.put(t,i,p)];case 7:return[4,s.patch(t,i,p)];case 9:return d=e.__assign(e.__assign({},p),{data:i}),[4,s.delete(t,d)];case 11:throw new Error("Unsupported method: ".concat(r));case 12:return[2,{responseData:_.data,error:null}];case 13:return(E=g.sent()).type&&Object.values(n.NetworkErrorType).includes(E.type)?[2,{responseData:null,error:E}]:[4,c(E)];case 14:return[2,{responseData:null,error:g.sent()}];case 15:return[2]}})})},d=function(r,a,s){return e.__awaiter(void 0,void 0,void 0,function(){var i,c,u,l,d,E,g,f,y,h,v,R,m,N;return e.__generator(this,function(T){switch(T.label){case 0:return c=(i=s||{}).data,u=i.params,l=i.config,d=i.errorMessage,E=i.baseURL,g=i.cacheOption,f=i.shouldCache,y=null!==(N=null==g?void 0:g.ttl)&&void 0!==N?N:o,h=(null==g?void 0:g.key)||p(r,a,u),(null==g?void 0:g.forceRefresh)||(null==g?void 0:g.skipCache)?[3,2]:[4,t.apiCache.get(h)];case 1:if(v=T.sent())return[2,{responseData:v.data,error:null,cacheMeta:{isFromCache:!0,timestamp:v.timestamp,ttl:v.ttl,cacheKey:h}}];T.label=2;case 2:return R=e.__assign(e.__assign({},l),u&&{params:u}),[4,_(r,a,{data:c,config:R,baseURL:E})];case 3:return m=T.sent(),!(null==g?void 0:g.skipCache)&&null!=m.responseData&&(!f||f(m.responseData))?[4,t.apiCache.set(h,m.responseData,y)]:[3,5];case 4:T.sent(),T.label=5;case 5:return[2,{responseData:m.responseData,error:m.error?{errorMessage:m.error.type===n.NetworkErrorType.INTERNET_DISCONNECTED||m.error.type===n.NetworkErrorType.SLOW_CONNECTION||m.error.type===n.NetworkErrorType.TIMEOUT?m.error.message:m.error.type===n.NetworkErrorType.SERVER_UNREACHABLE?"Unable to connect to server. Please try again later.":d||m.error.message,errorObjData:m.error}:null,cacheMeta:{isFromCache:!1,timestamp:Date.now(),ttl:y,cacheKey:h}}]}})})};Object.defineProperty(exports,"NetworkErrorType",{enumerable:!0,get:function(){return n.NetworkErrorType}}),exports.DEFAULT_CACHE_TTL=o,exports.createApiInstance=u,exports.fetchOnDemandCitation=function(r,t,n,a,s,o,i,c,u,p,l,_,E,g){return e.__awaiter(void 0,void 0,void 0,function(){var s,f,y,h;return e.__generator(this,function(v){return s="artifact_chunks"===t||"scanned_doc_citation"===t?"artifact_chunks":t,f=p?_:"".concat(s,"_").concat(n),[2,d(y="post",h="/api/chat/chatResponse",{baseURL:o,data:{name:i||"citationsprocessing",organizationName:c,prompt:"",useAgent:{agent_name:u||"ProcessCitationsAgent",arguments:e.__assign(e.__assign({citation_type:t,is_primary_agent_request:!1},p&&{check_possible_citation_payload:!1}),{ui_request_body:e.__assign(e.__assign(e.__assign({llm_formatted_response:a,request_id:r,max_concurrent_citations:10,citation_id:f},p&&l&&{ecg_agent_name:l}),p&&E&&{plan_id:E}),p&&g&&{ui_chat_history:g})})}},config:{headers:{"Content-Type":"application/json"},withCredentials:!0},errorMessage:"Failed to fetch on-demand citation",cacheOption:{key:"".concat(y,":").concat(h,":onDemandCitation:").concat(r,":").concat(t,":").concat(p?_:n,":").concat(p?l:"")},shouldCache:function(e){var r;return Array.isArray(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.citations)&&Boolean(e.result.citations[0])}})]})})},exports.generateCacheKey=p,exports.makeApiRequest=_,exports.makeApiRequestWithTTLCache=d;
|
|
2
2
|
//# sourceMappingURL=onDemandApi.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("axios"));exports.createRedlineDocument=async(e,o)=>{try{console.log("[createRedlineDocument] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/create`,{user_name:e.userName,user_email:e.userEmail,redline_config_id:e.redlineConfigId,changelog_config_id:e.changelogConfigId,artifact_id:e.artifactId,input_data:e.inputData,document_metadata:{comparison_id:e.comparisonId}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[createRedlineDocument] Response:",t),t}catch(e){console.log("[createRedlineDocument] Error:",e)}return null},exports.
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("axios"));exports.createRedlineDocument=async(e,o)=>{try{console.log("[createRedlineDocument] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/create`,{user_name:e.userName,user_email:e.userEmail,redline_config_id:e.redlineConfigId,changelog_config_id:e.changelogConfigId,artifact_id:e.artifactId,input_data:e.inputData,document_metadata:{comparison_id:e.comparisonId}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[createRedlineDocument] Response:",t),t}catch(e){console.log("[createRedlineDocument] Error:",e)}return null},exports.getRedlineDocumentId=async e=>{try{console.log("[getRedlineDocumentId] Request:",e);const{data:o}=await n.default.get(`${e.baseApiUrl}/book-finder-mode/get_comparison/${e.comparisonId}`);return console.log("[getRedlineDocumentId] Response:",o),o}catch(e){console.log("[getRedlineDocumentId] Error:",e)}return null},exports.resolveRedline=async(e,o)=>{try{console.log("[resolveRedline] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/resolve`,{document_id:e.documentId,user_name:e.userName,user_email:e.userEmail,redline_id:e.redlineId,action:e.action,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[resolveRedline] Response:",t),t}catch(e){console.log("[resolveRedline] Error:",e)}return null},exports.updateRedlineDocument=async(e,o)=>{try{console.log("[updateRedlineDocument] Request:",e);const{data:t}=await n.default.put(`${e.baseApiUrl}/redlining/update-manual`,{document_id:e.documentId,segment_id:e.sectionId,user_name:e.userName,user_email:e.userEmail,new_plain_content:e.updatedContent,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[updateRedlineDocument] Response:",t),t}catch(e){console.log("[updateRedlineDocument] Error:",e)}return null};
|
|
2
2
|
//# sourceMappingURL=redlineService.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t=function(t){if("string"!=typeof t||""===t.trim())return null;try{var r="undefined"!=typeof window?window.location.origin:"http://localhost";return new URL(t,r)}catch(t){return null}},r=function(t,r){var n;if("string"!=typeof t||"string"!=typeof r||""===r.trim())return"";try{var e=t.match(new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i"));return null!==(n=null==e?void 0:e[2])&&void 0!==n?n:""}catch(t){return""}},n=function(t){if("string"!=typeof t||""===t)return"";try{return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}catch(r){return t}},e=function(t,r,e){if("string"!=typeof t||""===t.trim())return t;if("string"!=typeof r||""===r.trim())return t;if(!e||"string"!=typeof e)return t;try{var a=n(e),i=new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i");return i.test(t)?t.replace(i,function(){return"".concat(r,'="').concat(a,'"')}):t.replace(/<a\b/i,function(){return"<a ".concat(r,'="').concat(a,'"')})}catch(r){return t}},a=function(a){if("string"!=typeof a||!a||!a.includes("
|
|
1
|
+
var t=function(t){if("string"!=typeof t||""===t.trim())return null;try{var r="undefined"!=typeof window?window.location.origin:"http://localhost";return new URL(t,r)}catch(t){return null}},r=function(t,r){var n;if("string"!=typeof t||"string"!=typeof r||""===r.trim())return"";try{var e=t.match(new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i"));return null!==(n=null==e?void 0:e[2])&&void 0!==n?n:""}catch(t){return""}},n=function(t){if("string"!=typeof t||""===t)return"";try{return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}catch(r){return t}},e=function(t,r,e){if("string"!=typeof t||""===t.trim())return t;if("string"!=typeof r||""===r.trim())return t;if(!e||"string"!=typeof e)return t;try{var a=n(e),i=new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i");return i.test(t)?t.replace(i,function(){return"".concat(r,'="').concat(a,'"')}):t.replace(/<a\b/i,function(){return"<a ".concat(r,'="').concat(a,'"')})}catch(r){return t}},a=function(a){if("string"!=typeof a||!a||!a.includes("citation_type"))return a;try{var i=a;return Array.from(a.matchAll(/<a\b([^>]*?)>([\s\S]*?)<\/a>/gi)).forEach(function(a){var c=a[0],o=a[1]||"",u=r(o,"href").replace(/&/gi,"&"),l=t(u),s=r(o,"type"),f=null==l?void 0:l.searchParams.get("citation_type");if("rulebook_citation"===s||"il_rulebook_citation"===f){s||(s=f||"rulebook_citation");var h=r(o,"reason"),p=(null==l?void 0:l.searchParams.get("citationNumber"))||(null==l?void 0:l.searchParams.get("citation_number"))||"",g=p.match(/^rb_(.+)$/),v=g?g[1]:p;if(v){var y={citation_type:f||"",phrase_to_highlight:(null==l?void 0:l.searchParams.get("phrase_to_highlight"))||""};if(y.citation_type||y.phrase_to_highlight){var m=!1,_=function(r){return function(r){if("string"!=typeof r||!r)return null;var n=r.match(/^(?:pdf_citation|deviation_summary)\$(\d+)/);if(n)return n[1];try{var e=t(r.replace(/&/gi,"&"));return(null==e?void 0:e.searchParams.get("citationNumber"))||(null==e?void 0:e.searchParams.get("citation_number"))||null}catch(t){return null}}(r)!==v?r:(m=!0,function(r,n){if("string"!=typeof r||""===r.trim())return r;if(!n||"object"!=typeof n)return r;try{var e=t(r);if(!e)return r;Object.entries(n).forEach(function(t){var r=t[0],n=t[1];n&&e.searchParams.set(r,n)});var a="".concat(e.pathname).concat(e.search).concat(e.hash);return r.startsWith("./")?".".concat(a):!r.startsWith("/")&&a.startsWith("/")?a.slice(1):a}catch(t){return r}}(r,y))};i=i.replace(/\[([^\]]+)\]\(([^)\n]+)\)/g,function(t,r,e){var a=_(e);return a===e?t:'<a type="'.concat(n(s),'" reason="').concat(n(h),'" href="').concat(n(a),'">').concat(r,"</a>")}),m||(i=i.replace(/<a\b([^>]*?)>/gi,function(n,a){var i,c=r(a,"type")||(null===(i=t(r(a,"href")))||void 0===i?void 0:i.searchParams.get("citation_type"));if("rulebook_citation"===c||"il_rulebook_citation"===c)return n;var o=r(a,"href"),u=_(o);if(u===o)return n;var l=n.replace(/\bhref\s*=\s*(['"])(.*?)\1/i,function(t,r){return"href=".concat(r).concat(u).concat(r)});return e(e(l,"type",s),"reason",h)})),i=i.split(c).join("")}else i=i.split(c).join("")}else i=i.split(c).join("")}}),i}catch(t){return a}};export{a as mergeRulebookCitationsIntoMatchingLinks};
|
|
2
2
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var a=function(a){var t,
|
|
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};
|
|
2
2
|
//# sourceMappingURL=processGuidelinesMarkdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__spreadArray as e}from"tslib";import{useMemo as t}from"react";import{isMissingStr as i,safeStringify as o,getRationale as r,resolveComparisonInputItems as a,getSideData as d,hasValue as l,DEVIATION_BADGE_SEPARATOR as s}from"../CognitiveComparehelpers.js";var u={id:"",title:"",similarity:0,sections:[]},v=function(v,c,f,p,I,_){var h,g;void 0===I&&(I=!0);var m="string"==typeof f?f:JSON.stringify(f||{}),x=Boolean(_&&(null===(g=null===(h=_.data)||void 0===h?void 0:h.artifactData)||void 0===g?void 0:g.userStorySnapshot)),b=t(function(){var t;if(!v||0===Object.keys(v).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var l=JSON.parse(m);try{var s=v.nodes||v,u=[],f=[],p=v.base_root_id,h=v.input_index_map||{0:"left",1:"right"},g=v[p]||s[p];if(!g||!1===g.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var b=v.content_mapping||{},y=function(n){return v[n]||s[n]},R=function(e,t,o){if(!e||"object"!=typeof e)return e||null;if(e.deviations)return e;if(I)return e;var r=Object.keys(e).filter(function(n){return/^\d+$/.test(n)});if(!r.length)return e;var a=r.sort(function(n,e){return Number(n)-Number(e)}),d={},l={},s=null;return a.forEach(function(n){var r,a,u,v,c,f=e[n];if(f&&"object"==typeof f){s||(s=f);var p=!(null==f?void 0:f.status)||"pending"===f.status,I=function(n){var e,t=(null===(e=null==f?void 0:f.cognitive_decisioning)||void 0===e?void 0:e.citations)||(null==f?void 0:f.citations)||{};return Object.values(t).map(function(e){var t;return null===(t=null==e?void 0:e[n])||void 0===t?void 0:t.highlighted_text}).filter(function(n){return"string"==typeof n&&n.trim().length>0})},_=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t=0,o=n;t<o.length;t++){var r=o[t];if(Array.isArray(r)&&r.some(function(n){return!i(n)}))return r}return[]},g=p?_((null===(a=null==f?void 0:f.deviation_highlights)||void 0===a?void 0:a[t])||(null===(u=null==f?void 0:f.deviation_highlights)||void 0===u?void 0:u[h[0]]),I(t),I(h[0])):[],m=p?_((null===(v=null==f?void 0:f.deviation_highlights)||void 0===v?void 0:v[o])||(null===(c=null==f?void 0:f.deviation_highlights)||void 0===c?void 0:c[h[1]]),I(o),I(h[1])):[];d[n]=((r={})[h[0]]=g[0]||"",r[h[1]]=m[0]||"",r.deviation_summary=(null==f?void 0:f.deviation_summary)||"",r.deviation_title=null==f?void 0:f.deviation_title,r.deviation_impact=null==f?void 0:f.deviation_impact,r.deviation_explanation=null==f?void 0:f.deviation_explanation,r.evaluation_outputs=null==f?void 0:f.evaluation_outputs,r.cognitive_decisioning=null==f?void 0:f.cognitive_decisioning,r.deviation_highlights=null==f?void 0:f.deviation_highlights,r),l[n]=f}}),n(n({},e),{deviation_title:(null==s?void 0:s.deviation_title)||(null==e?void 0:e.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==e?void 0:e.deviation_impact),deviation_summary:(null==s?void 0:s.deviation_summary)||(null==e?void 0:e.deviation_summary),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==e?void 0:e.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==e?void 0:e.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==e?void 0:e.cognitive_decisioning),deviations:d,deviation_entries:l})},C=function(n){var e=new Map,t=function(n){n.forEach(function(n){var i;n.id&&e.set(n.id,n),(null===(i=n.subsections)||void 0===i?void 0:i.length)&&t(n.subsections)})};t(n);var i=function(n,t){for(var o,r=[],a=function(n){var a=n.ref_parent_section_node_id;if(a&&e.has(a)&&a!==(null==t?void 0:t.id)){var d=e.get(a);d.subsections||(d.subsections=[]),d.subsections.some(function(e){return e.id===n.id})||d.subsections.push(n)}else(null===(o=n.subsections)||void 0===o?void 0:o.length)&&(n.subsections=i(n.subsections,n)),r.push(n)},d=0,l=n;d<l.length;d++){a(l[d])}return r},o=i(n),r=function(n){n.forEach(function(n){n.subsections&&n.subsections.length>0&&(n.subsections.sort(function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:(n.selfIndex||0)-(e.selfIndex||0)}),r(n.subsections))})};return r(o),o},E=function(n){var e=n.comparison_inputs?Object.keys(n.comparison_inputs):[],t=h[0],i=h[1];return e.length>0&&(t=e.includes(h[0])?h[0]:e[0],i=e.includes(h[1])?h[1]:e.length>1?e[1]:e[0]),{nodeLeftId:t,nodeRightId:i}},O=function(e,t,i,r){var a=t.attributes||{},d=t.data||{},l=!1!==a.display_title,s=!1!==a.display_content,u=l?o(d.title||""):"",v=s?o(d.content||""):"",c=s?o(d.change_history||""):"",f=void 0!==a.display_index&&null!==a.display_index?Number(a.display_index):-1,p=function(n){return(null==n?void 0:n.entity_id)||(null==n?void 0:n.ref_parent_section_node_id)||(null==n?void 0:n.parent_entity_id)||null}(a),I=!(!u.trim()&&!v.trim());return n(n({id:"".concat(e,"::").concat(t.contentId),nodeId:e,contentId:t.contentId,parentContentId:p,title:u,content:v,change_history:c,displayTitle:l,displayContent:s,subsections:[]},I?r:{score:void 0,relation:"not_defined"}),{evaluationResult:i,evaluationResults:i?[i]:[],selfIndex:f,refIndexes:[],refContentIds:[],ref_parent_section_node_id:p})},N=function(n,t){n.refIndexes=Array.from(new Set(e(e([],n.refIndexes||[],!0),t.refIndexes||[],!0))),n.refContentIds=Array.from(new Set(e(e([],n.refContentIds||[],!0),t.refContentIds||[],!0)));var i=new Set((n.subsections||[]).map(function(n){return n.id||n.contentId||n.nodeId}));(t.subsections||[]).forEach(function(t){var o=t.id||t.contentId||t.nodeId;i.has(o)||(n.subsections=e(e([],n.subsections||[],!0),[t],!1),i.add(o))});var o=e(e([],n.evaluationResults||(n.evaluationResult?[n.evaluationResult]:[]),!0),t.evaluationResults||(t.evaluationResult?[t.evaluationResult]:[]),!0).filter(Boolean),r=new Set;return n.evaluationResults=o.filter(function(n){var e=(null==n?void 0:n.nodeId)||JSON.stringify(Object.keys((null==n?void 0:n.deviations)||n||{}));return!r.has(e)&&(r.add(e),!0)}),!n.evaluationResult&&t.evaluationResult&&(n.evaluationResult=t.evaluationResult),!n.cognitiveData&&t.cognitiveData&&(n.cognitiveData=t.cognitiveData),n},S=function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:n.selfIndex-e.selfIndex},j=function(e,t){var i,o=y(e);if(!o||!1===o.display_node)return[];if(x&&"1"===t)return[];var d=E(o),s=d.nodeLeftId,u=d.nodeRightId,v=r(o),c=(null===(i=null==l?void 0:l[e])||void 0===i?void 0:i.evaluation_result)||o.evaluation_result||null,f=R(c,s,u),p=f&&"object"==typeof f?n(n({},f),{nodeId:e}):f,I=a(o,t,h,b).map(function(n){return O(e,n,p,v)});if(o.next){var _=Object.values(o.next).flatMap(function(n){return j(n,t)});I.forEach(function(n){var e=_.filter(function(e){return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId});n.subsections=e.length?e:_})}return I};if(c){var D=function(e,t){var i;void 0===t&&(t=0);var o=[],d=[];if(!e)return{refSections:o,baseSections:d};var s={},u={},v=-1,c=-1,f=function(o){var d=e[o],f=y(d);if(!f||!1===f.display_node)return"continue";var p=E(f),I=p.nodeLeftId,_=p.nodeRightId,g=r(f),m=(null===(i=null==l?void 0:l[d])||void 0===i?void 0:i.evaluation_result)||f.evaluation_result||null,C=R(m,I,_),S=C&&"object"==typeof C?n(n({},C),{nodeId:d}):C,j=D(f.next,t+1),P=j.refSections,k=j.baseSections,K=a(f,"0",h,b).map(function(n){var e=O(d,n,S,g);return-1===e.selfIndex&&(e.selfIndex=c--),e}),w=[];if(!x){var V=a(f,"1",h,b);w=V.map(function(n){var e=O(d,n,S,g);return-1===e.selfIndex&&(e.selfIndex=v--),e})}K.forEach(function(n){w.forEach(function(e){var t,i,o,r,a,d,l,s;Number(e.selfIndex)>=0&&Number(n.selfIndex)>=0&&((null===(t=e.refIndexes)||void 0===t?void 0:t.includes(Number(n.selfIndex)))||null===(i=e.refIndexes)||void 0===i||i.push(Number(n.selfIndex)),(null===(o=n.refIndexes)||void 0===o?void 0:o.includes(Number(e.selfIndex)))||null===(r=n.refIndexes)||void 0===r||r.push(Number(e.selfIndex))),n.contentId&&!(null===(a=e.refContentIds)||void 0===a?void 0:a.includes(n.contentId))&&(null===(d=e.refContentIds)||void 0===d||d.push(n.contentId)),e.contentId&&!(null===(l=n.refContentIds)||void 0===l?void 0:l.includes(e.contentId))&&(null===(s=n.refContentIds)||void 0===s||s.push(e.contentId))})}),w.forEach(function(n){var e=P.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var i=0===t?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||d);s[i]=s[i]?N(s[i],n):n}),K.forEach(function(n){var e=k.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var i=0===t?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||d);u[i]=u[i]?N(u[i],n):n})};for(var p in e)f(p);return o=Object.values(s),d=Object.values(u),o.sort(S),d.sort(S),{refSections:o,baseSections:d}},P=D(g.next),k=P.refSections,K=P.baseSections;x||(f=C(k)),u=K}else g.next&&Object.values(g.next).forEach(function(n){var e=y(n);e&&!1!==e.display_node&&(u.push.apply(u,j(n,"0")),x||f.push.apply(f,j(n,"1")))}),x||(f=C(f));var w=d(g,"0",h,b),V=d(g,"1",h,b);return{activeProposed:{title:w.title||"Uploaded Contract",description:g.decision_scope_description||"",sections:u},activeVariants:[{id:"tree-variant-1",title:x?(null===(t=null==_?void 0:_.data)||void 0===t?void 0:t.artifactTitle)||"Rulebook Guidelines":V.title||"Reference Template",similarity:0,sections:f,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:g.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(n){return console.error("Data Transformation Error: ",n),{activeProposed:{},activeVariants:[],parseError:n instanceof Error?n.message:"Unknown Parsing Error"}}},[v,c,m,I,_]),y=b.activeProposed,R=b.activeVariants,C=b.parseError,E=(null==R?void 0:R[0])||u,O=t(function(){return(null==y?void 0:y.sections)||[]},[null==y?void 0:y.sections]),N=t(function(){return E.sections||[]},[E.sections]),S=O.length>0||N.length>0,j=t(function(){return p.fields.filter(function(n){var e=n.key;return(!S||"description"!==e)&&(l(null==y?void 0:y[e])||l(E[e]))})},[y,E,S,p.fields]),D=t(function(){var n,e,t={},o={},r={},a=0,d=null===(n=null==v?void 0:v.input_index_map)||void 0===n?void 0:n[0],l=null===(e=null==v?void 0:v.input_index_map)||void 0===e?void 0:e[1],u=function(n,e){if(!c){var t="left"===e?O.indexOf(n):N.indexOf(n);return{rootKey:"".concat(e,":").concat(t),parentNum:t+1}}if("left"===e){var i=n.selfIndex,o=void 0!==i&&i>=0?i+1:O.indexOf(n)+1;return{rootKey:"left-root:".concat(n.id),parentNum:o}}var r=n.selfIndex,a=O.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(r)});if(a){var d=a.selfIndex,l=void 0!==d&&d>=0?d+1:O.indexOf(a)+1;return{rootKey:"left-root:".concat(a.id),parentNum:l}}var s=void 0!==r&&r>=0?r+1:N.indexOf(n)+1;return{rootKey:"right-orphan-root:".concat(n.id),parentNum:s}},f=function(n,e){if(n&&e)return n.find(function(n){return n.id===e.id||n.nodeId&&n.nodeId===e.nodeId||n.contentId&&n.contentId===e.contentId})||void 0},p=function(n,e,u,v,c,I,_){if(e&&function(n,e,t){var a;((null===(a=null==n?void 0:n.evaluationResults)||void 0===a?void 0:a.length)?n.evaluationResults:(null==n?void 0:n.evaluationResult)?[n.evaluationResult]:[]).forEach(function(a){var u=(null==a?void 0:a.deviations)||{};Object.keys(u).sort().forEach(function(v){var c=u[v];if(c){var f=!i(c[d]),p=!i(c[l]);if(f||p){var I=(null==a?void 0:a.nodeId)||n.nodeId||n.id,_="".concat(I).concat(s).concat(v);void 0===o[_]&&(void 0===r[e]&&(r[e]=1),o[_]={index:r[e]++,rootKey:e,parentNum:t})}}})})}(e,v,c),e&&!I){var h=(null==_?void 0:_.id)||"fallback_parent_".concat(a++);t[h]||(t[h]=[]),t[h].push(e)}((null==e?void 0:e.subsections)||(null==n?void 0:n.subsections)||(null==u?void 0:u.subsections)||[]).forEach(function(t){var i=f(null==n?void 0:n.subsections,t),o=f(null==u?void 0:u.subsections,t);p(t,i,o,v,c,!1,e||_)})};O.forEach(function(n){var e,t=u(n,"left"),i=t.rootKey,o=t.parentNum,r=null;if(c){var a=null===(e=n.refIndexes)||void 0===e?void 0:e[0];r=N.find(function(n){return n.selfIndex===a})}else r=N[O.indexOf(n)];p(n,n,r,i,o,!0,n)}),x||N.forEach(function(n){var e=u(n,"right"),t=e.rootKey,i=e.parentNum;t.startsWith("right-orphan-root:")&&p(n,null,n,t,i,!0,n)});var I=Object.fromEntries(Object.entries(o).map(function(n){return[n[0],n[1].index]})),_=Object.fromEntries(Object.entries(o).map(function(n){return[n[0],n[1].parentNum]}));return{parentDeviationRecord:t,registry:I,deviationParentRegistry:_}},[O,N,c,v,x]),P=D.parentDeviationRecord,k=D.registry,K=D.deviationParentRegistry;return{isGuidelineMode:x,activeProposed:y,activeVariants:R,existingRule:E,proposedSections:O,existingSections:N,visibleFields:j,parentDeviationRecord:P,deviationNumberRegistry:k,deviationParentRegistry:K,parseError:C}};export{v as useCognitiveTreeData};
|
|
1
|
+
import{__assign as n,__spreadArray as e}from"tslib";import{useMemo as t}from"react";import{isMissingStr as i,safeStringify as o,getRationale as r,resolveComparisonInputItems as a,getSideData as d,hasValue as l,DEVIATION_BADGE_SEPARATOR as s}from"../CognitiveComparehelpers.js";var u={id:"",title:"",similarity:0,sections:[]},v=function(v,c,f,p,I,_){var h,g;void 0===I&&(I=!0);var m="string"==typeof f?f:JSON.stringify(f||{}),x=Boolean(_&&(_.learnings_data||(null===(g=null===(h=_.data)||void 0===h?void 0:h.artifactData)||void 0===g?void 0:g.userStorySnapshot))),b=t(function(){if(!v||0===Object.keys(v).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var t=JSON.parse(m);try{var l=v.nodes||v,s=[],u=[],f=v.base_root_id,p=v.input_index_map||{0:"left",1:"right"},h=v[f]||l[f];if(!h||!1===h.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var g=v.content_mapping||{},b=function(n){return v[n]||l[n]},y=function(e,t,o){if(!e||"object"!=typeof e)return e||null;if(e.deviations)return e;if(I)return e;var r=Object.keys(e).filter(function(n){return/^\d+$/.test(n)});if(!r.length)return e;var a=r.sort(function(n,e){return Number(n)-Number(e)}),d={},l={},s=null;return a.forEach(function(n){var r,a,u,v,c,f=e[n];if(f&&"object"==typeof f){s||(s=f);var I=!(null==f?void 0:f.status)||"pending"===f.status,_=function(n){var e,t=(null===(e=null==f?void 0:f.cognitive_decisioning)||void 0===e?void 0:e.citations)||(null==f?void 0:f.citations)||{};return Object.values(t).map(function(e){var t;return null===(t=null==e?void 0:e[n])||void 0===t?void 0:t.highlighted_text}).filter(function(n){return"string"==typeof n&&n.trim().length>0})},h=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t=0,o=n;t<o.length;t++){var r=o[t];if(Array.isArray(r)&&r.some(function(n){return!i(n)}))return r}return[]},g=I?h((null===(a=null==f?void 0:f.deviation_highlights)||void 0===a?void 0:a[t])||(null===(u=null==f?void 0:f.deviation_highlights)||void 0===u?void 0:u[p[0]]),_(t),_(p[0])):[],m=I?h((null===(v=null==f?void 0:f.deviation_highlights)||void 0===v?void 0:v[o])||(null===(c=null==f?void 0:f.deviation_highlights)||void 0===c?void 0:c[p[1]]),_(o),_(p[1])):[];d[n]=((r={})[p[0]]=g[0]||"",r[p[1]]=m[0]||"",r.deviation_summary=(null==f?void 0:f.deviation_summary)||"",r.deviation_title=null==f?void 0:f.deviation_title,r.deviation_impact=null==f?void 0:f.deviation_impact,r.deviation_explanation=null==f?void 0:f.deviation_explanation,r.evaluation_outputs=null==f?void 0:f.evaluation_outputs,r.cognitive_decisioning=null==f?void 0:f.cognitive_decisioning,r.deviation_highlights=null==f?void 0:f.deviation_highlights,r),l[n]=f}}),n(n({},e),{deviation_title:(null==s?void 0:s.deviation_title)||(null==e?void 0:e.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==e?void 0:e.deviation_impact),deviation_summary:(null==s?void 0:s.deviation_summary)||(null==e?void 0:e.deviation_summary),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==e?void 0:e.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==e?void 0:e.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==e?void 0:e.cognitive_decisioning),deviations:d,deviation_entries:l})},R=function(n){var e=new Map,t=function(n){n.forEach(function(n){var i;n.id&&e.set(n.id,n),(null===(i=n.subsections)||void 0===i?void 0:i.length)&&t(n.subsections)})};t(n);var i=function(n,t){for(var o,r=[],a=function(n){var a=n.ref_parent_section_node_id;if(a&&e.has(a)&&a!==(null==t?void 0:t.id)){var d=e.get(a);d.subsections||(d.subsections=[]),d.subsections.some(function(e){return e.id===n.id})||d.subsections.push(n)}else(null===(o=n.subsections)||void 0===o?void 0:o.length)&&(n.subsections=i(n.subsections,n)),r.push(n)},d=0,l=n;d<l.length;d++){a(l[d])}return r},o=i(n),r=function(n){n.forEach(function(n){n.subsections&&n.subsections.length>0&&(n.subsections.sort(function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:(n.selfIndex||0)-(e.selfIndex||0)}),r(n.subsections))})};return r(o),o},C=function(n){var e=n.comparison_inputs?Object.keys(n.comparison_inputs):[],t=p[0],i=p[1];return e.length>0&&(t=e.includes(p[0])?p[0]:e[0],i=e.includes(p[1])?p[1]:e.length>1?e[1]:e[0]),{nodeLeftId:t,nodeRightId:i}},E=function(e,t,i,r){var a=t.attributes||{},d=t.data||{},l=!1!==a.display_title,s=!1!==a.display_content,u=l?o(d.title||""):"",v=s?o(d.content||""):"",c=s?o(d.change_history||""):"",f=void 0!==a.display_index&&null!==a.display_index?Number(a.display_index):-1,p=function(n){return(null==n?void 0:n.entity_id)||(null==n?void 0:n.ref_parent_section_node_id)||(null==n?void 0:n.parent_entity_id)||null}(a),I=!(!u.trim()&&!v.trim());return n(n({id:"".concat(e,"::").concat(t.contentId),nodeId:e,contentId:t.contentId,parentContentId:p,title:u,content:v,change_history:c,displayTitle:l,displayContent:s,subsections:[]},I?r:{score:void 0,relation:"not_defined"}),{evaluationResult:i,evaluationResults:i?[i]:[],selfIndex:f,refIndexes:[],refContentIds:[],ref_parent_section_node_id:p})},O=function(n,t){n.refIndexes=Array.from(new Set(e(e([],n.refIndexes||[],!0),t.refIndexes||[],!0))),n.refContentIds=Array.from(new Set(e(e([],n.refContentIds||[],!0),t.refContentIds||[],!0)));var i=new Set((n.subsections||[]).map(function(n){return n.id||n.contentId||n.nodeId}));(t.subsections||[]).forEach(function(t){var o=t.id||t.contentId||t.nodeId;i.has(o)||(n.subsections=e(e([],n.subsections||[],!0),[t],!1),i.add(o))});var o=e(e([],n.evaluationResults||(n.evaluationResult?[n.evaluationResult]:[]),!0),t.evaluationResults||(t.evaluationResult?[t.evaluationResult]:[]),!0).filter(Boolean),r=new Set;return n.evaluationResults=o.filter(function(n){var e=(null==n?void 0:n.nodeId)||JSON.stringify(Object.keys((null==n?void 0:n.deviations)||n||{}));return!r.has(e)&&(r.add(e),!0)}),!n.evaluationResult&&t.evaluationResult&&(n.evaluationResult=t.evaluationResult),!n.cognitiveData&&t.cognitiveData&&(n.cognitiveData=t.cognitiveData),n},N=function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:n.selfIndex-e.selfIndex},j=function(e,i){var o,d=b(e);if(!d||!1===d.display_node)return[];if(x&&"1"===i)return[];var l=C(d),s=l.nodeLeftId,u=l.nodeRightId,v=r(d),c=(null===(o=null==t?void 0:t[e])||void 0===o?void 0:o.evaluation_result)||d.evaluation_result||null,f=y(c,s,u),I=f&&"object"==typeof f?n(n({},f),{nodeId:e}):f,_=a(d,i,p,g).map(function(n){return E(e,n,I,v)});if(d.next){var h=Object.values(d.next).flatMap(function(n){return j(n,i)});_.forEach(function(n){var e=h.filter(function(e){return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId});n.subsections=e.length?e:h})}return _};if(c){var S=function(e,i){var o;void 0===i&&(i=0);var d=[],l=[];if(!e)return{refSections:d,baseSections:l};var s={},u={},v=-1,c=-1,f=function(d){var l=e[d],f=b(l);if(!f||!1===f.display_node)return"continue";var I=C(f),_=I.nodeLeftId,h=I.nodeRightId,m=r(f),R=(null===(o=null==t?void 0:t[l])||void 0===o?void 0:o.evaluation_result)||f.evaluation_result||null,N=y(R,_,h),j=N&&"object"==typeof N?n(n({},N),{nodeId:l}):N,k=S(f.next,i+1),D=k.refSections,P=k.baseSections,K=a(f,"0",p,g).map(function(n){var e=E(l,n,j,m);return-1===e.selfIndex&&(e.selfIndex=c--),e}),w=[];if(!x){var V=a(f,"1",p,g);w=V.map(function(n){var e=E(l,n,j,m);return-1===e.selfIndex&&(e.selfIndex=v--),e})}K.forEach(function(n){w.forEach(function(e){var t,i,o,r,a,d,l,s;Number(e.selfIndex)>=0&&Number(n.selfIndex)>=0&&((null===(t=e.refIndexes)||void 0===t?void 0:t.includes(Number(n.selfIndex)))||null===(i=e.refIndexes)||void 0===i||i.push(Number(n.selfIndex)),(null===(o=n.refIndexes)||void 0===o?void 0:o.includes(Number(e.selfIndex)))||null===(r=n.refIndexes)||void 0===r||r.push(Number(e.selfIndex))),n.contentId&&!(null===(a=e.refContentIds)||void 0===a?void 0:a.includes(n.contentId))&&(null===(d=e.refContentIds)||void 0===d||d.push(n.contentId)),e.contentId&&!(null===(l=n.refContentIds)||void 0===l?void 0:l.includes(e.contentId))&&(null===(s=n.refContentIds)||void 0===s||s.push(e.contentId))})}),w.forEach(function(n){var e=D.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===i?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||l);s[t]=s[t]?O(s[t],n):n}),K.forEach(function(n){var e=P.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===i?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||l);u[t]=u[t]?O(u[t],n):n})};for(var I in e)f(I);return d=Object.values(s),l=Object.values(u),d.sort(N),l.sort(N),{refSections:d,baseSections:l}},k=S(h.next),D=k.refSections,P=k.baseSections;x||(u=R(D)),s=P}else h.next&&Object.values(h.next).forEach(function(n){var e=b(n);e&&!1!==e.display_node&&(s.push.apply(s,j(n,"0")),x||u.push.apply(u,j(n,"1")))}),x||(u=R(u));var K=d(h,"0",p,g),w=d(h,"1",p,g),V={title:K.title||"Uploaded Contract",description:h.decision_scope_description||"",sections:s},T={id:"tree-variant-1",title:x?function(){var n,e;if((null==_?void 0:_.learnings_data)&&Object.keys(_.learnings_data).length>0){var t=Object.keys(_.learnings_data)[0];return(null===(n=_.learnings_data[t])||void 0===n?void 0:n.title)||"Rulebook Guidelines"}return(null===(e=null==_?void 0:_.data)||void 0===e?void 0:e.artifactTitle)||"Rulebook Guidelines"}():w.title||"Reference Template",similarity:0,sections:u,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:h.decision_scope_description||""},fields:{}}}};return{activeProposed:V,activeVariants:[T],parseError:null}}catch(n){return console.error("Data Transformation Error: ",n),{activeProposed:{},activeVariants:[],parseError:n instanceof Error?n.message:"Unknown Parsing Error"}}},[v,c,m,I,_]),y=b.activeProposed,R=b.activeVariants,C=b.parseError,E=(null==R?void 0:R[0])||u,O=t(function(){return(null==y?void 0:y.sections)||[]},[null==y?void 0:y.sections]),N=t(function(){return E.sections||[]},[E.sections]),j=O.length>0||N.length>0,S=t(function(){return p.fields.filter(function(n){var e=n.key;return(!j||"description"!==e)&&(l(null==y?void 0:y[e])||l(E[e]))})},[y,E,j,p.fields]),k=t(function(){var n,e,t={},o={},r={},a=0,d=null===(n=null==v?void 0:v.input_index_map)||void 0===n?void 0:n[0],l=null===(e=null==v?void 0:v.input_index_map)||void 0===e?void 0:e[1],u=function(n,e){if(!c){var t="left"===e?O.indexOf(n):N.indexOf(n);return{rootKey:"".concat(e,":").concat(t),parentNum:t+1}}if("left"===e){var i=n.selfIndex,o=void 0!==i&&i>=0?i+1:O.indexOf(n)+1;return{rootKey:"left-root:".concat(n.id),parentNum:o}}var r=n.selfIndex,a=O.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(r)});if(a){var d=a.selfIndex,l=void 0!==d&&d>=0?d+1:O.indexOf(a)+1;return{rootKey:"left-root:".concat(a.id),parentNum:l}}var s=void 0!==r&&r>=0?r+1:N.indexOf(n)+1;return{rootKey:"right-orphan-root:".concat(n.id),parentNum:s}},f=function(n,e){if(n&&e)return n.find(function(n){return n.id===e.id||n.nodeId&&n.nodeId===e.nodeId||n.contentId&&n.contentId===e.contentId})||void 0},p=function(n,e,u,v,c,I,_){if(e&&function(n,e,t){var a;((null===(a=null==n?void 0:n.evaluationResults)||void 0===a?void 0:a.length)?n.evaluationResults:(null==n?void 0:n.evaluationResult)?[n.evaluationResult]:[]).forEach(function(a){var u=(null==a?void 0:a.deviations)||{};Object.keys(u).sort().forEach(function(v){var c=u[v];if(c){var f=!i(c[d]),p=!i(c[l]);if(f||p){var I=(null==a?void 0:a.nodeId)||n.nodeId||n.id,_="".concat(I).concat(s).concat(v);void 0===o[_]&&(void 0===r[e]&&(r[e]=1),o[_]={index:r[e]++,rootKey:e,parentNum:t})}}})})}(e,v,c),e&&!I){var h=(null==_?void 0:_.id)||"fallback_parent_".concat(a++);t[h]||(t[h]=[]),t[h].push(e)}((null==e?void 0:e.subsections)||(null==n?void 0:n.subsections)||(null==u?void 0:u.subsections)||[]).forEach(function(t){var i=f(null==n?void 0:n.subsections,t),o=f(null==u?void 0:u.subsections,t);p(t,i,o,v,c,!1,e||_)})};O.forEach(function(n){var e,t=u(n,"left"),i=t.rootKey,o=t.parentNum,r=null;if(c){var a=null===(e=n.refIndexes)||void 0===e?void 0:e[0];r=N.find(function(n){return n.selfIndex===a})}else r=N[O.indexOf(n)];p(n,n,r,i,o,!0,n)}),x||N.forEach(function(n){var e=u(n,"right"),t=e.rootKey,i=e.parentNum;t.startsWith("right-orphan-root:")&&p(n,null,n,t,i,!0,n)});var I=Object.fromEntries(Object.entries(o).map(function(n){return[n[0],n[1].index]})),_=Object.fromEntries(Object.entries(o).map(function(n){return[n[0],n[1].parentNum]}));return{parentDeviationRecord:t,registry:I,deviationParentRegistry:_}},[O,N,c,v,x]),D=k.parentDeviationRecord,P=k.registry,K=k.deviationParentRegistry;return{isGuidelineMode:x,activeProposed:y,activeVariants:R,existingRule:E,proposedSections:O,existingSections:N,visibleFields:S,parentDeviationRecord:D,deviationNumberRegistry:P,deviationParentRegistry:K,parseError:C}};export{v as useCognitiveTreeData};
|
|
2
2
|
//# sourceMappingURL=useCompareData.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{createContext as n,useState as t,useMemo as i,useCallback as o,useContext as r}from"react";import{RefProvider as s}from"../../store/ref.context.js";var a;!function(e){e.WAITING="waiting",e.IN_PROGRESS="in_progress",e.GENERATED="generated",e.FAILED="failed",e.GENERATE="generate",e.APPROVED="approved"}(a||(a={}));const c=n(null),g=({children:n,userStory:r,setUserStory:a,aiReasoning:g,setAiReasoning:u,citations:d,setCitations:l,apiCachingConfig:f,customStyles:C,customIcons:m,searchQueryList:h,searchQueryReasoningIdList:p,citationConfig:R,chatHistory:I,chatCitationConfigs:S,gptCitationConfigs:y,diffEditConfig:E,aiReasoningAccordionOpenStates:A,persistedDataFiles:v,inlineUpdateComponentConfig:D,segmentComponentConfig:x,onEditBlocked:N,inlineManualComponentConfig:P,redlineConfig:L,sectionStatusConfig:_,customSectionConfig:w,updateRedlineDataParent:F})=>{const[G,H]=t(0),[O,Q]=t(""),U=i(()=>{if(0===r.length||0===g.length)return Array(r.length).fill(0);const e=Array.from({length:r.length},()=>[]);return g.forEach(n=>{const t=Number(n.relevance_score);if(isNaN(t)||t<=0)return;const i=`ai_reasoning$${n.id}`,o=r.findIndex(e=>{var n;return e.value.includes(i)||(null===(n=e.sub_features)||void 0===n?void 0:n.some(e=>e.value.includes(i)))});-1!==o&&e[o].push(t)}),e.map(e=>0===e.length?0:Math.round(e.reduce((e,n)=>e+n,0)/e.length))},[r,g]),b=o(e=>{var n;const t=r.findIndex(n=>n.artifactId===e);return-1===t?0:null!==(n=U[t])&&void 0!==n?n:0},[r,U]);return e(c.Provider,{value:{chatHistory:I,userStory:r,setUserStory:a,aiReasoning:g,setAiReasoning:u,citations:d,setCitations:l,apiCachingConfig:f,customStyles:C,customIcons:m,searchQueryList:h,searchQueryReasoningIdList:p,citationConfig:R,getAvgScoreForStory:b,chatCitationConfigs:S,gptCitationConfigs:y,diffEditConfig:E,aiReasoningAccordionOpenStates:A,persistedDataFiles:v,currentHighlightIndex:G,setCurrentHighlightIndex:H,inlineUpdateComponentConfig:D,segmentComponentConfig:x,onEditBlocked:N,inlineManualComponentConfig:P,redlineConfig:L,redlineDcoumentId:O,setRedlineDocumentId:Q,sectionStatusConfig:_,customSectionConfig:w,updateRedlineDataParent:F},children:e(s,{children:n})})},u=()=>{const e=r(c);if(!e)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return e};export{a as SectionStatus,g as default,u as useRequirementAI};
|
|
2
2
|
//# sourceMappingURL=RequirementAIWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useRef as n,useState as o,useEffect as a,useImperativeHandle as l}from"react";import{DEFAULT_TOOLBAR_CONFIG as i}from"./Editor/constants/editorConfig.js";import c from"./Editor/Editor.js";import{useRefStore as s}from"../../store/ref.context.js";import{$generateHtmlFromNodes as u}from"@lexical/html";import d from"turndown";import{tables as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useRef as n,useState as o,useEffect as a,useImperativeHandle as l}from"react";import{DEFAULT_TOOLBAR_CONFIG as i}from"./Editor/constants/editorConfig.js";import c from"./Editor/Editor.js";import{useRefStore as s}from"../../store/ref.context.js";import{$generateHtmlFromNodes as u}from"@lexical/html";import d from"turndown";import{tables as h}from"turndown-plugin-gfm";import{UnsavedChangesPopup as p}from"../UnsavedChangesPopup/UnsavedChangesPopup.js";import{mergeTagAcrossParagraphs as m,unescapeTagIds as g}from"../../../../utils/tagHelper.js";const f=new d({headingStyle:"atx",codeBlockStyle:"fenced"});f.keep(["ins","del","mark"]),f.keep(e=>{var t,r;return"A"===e.nodeName&&null!==(r=null===(t=e.getAttribute("href"))||void 0===t?void 0:t.includes("ai_reasoning$"))&&void 0!==r&&r}),f.keep(e=>"SPAN"===e.nodeName&&e.hasAttribute("highlight-id")),f.addRule("md-table-passthrough",{filter:e=>"PRE"===e.nodeName&&"true"===e.getAttribute("data-md-table"),replacement:(e,t)=>t.textContent||""}),f.use(h);const E=e=>(e||"").replace(/\r\n/g,"\n").trim(),v=r(({type:r,value:d,handleUpdateState:h,onBlur:v,placeholder:A,minHeight:S,height:$,mode:y,doNotShowBorderInViewMode:w,onEditBlocked:b,onSaveUnsavedChanges:x,onDiscardUnsavedChanges:C,isSavingUnsavedChanges:N=!1},B)=>{const T=n(null),[L,q]=o({type:r,value:d}),[H,I]=o(0),[R,_]=o(!1),j=n(d),k=n(d),M=n(Boolean(d)),{contentRef:U,setContentRef:V}=s();a(()=>{q(e=>({...e,value:d})),j.current=d,k.current=d,M.current=Boolean(d),_(!1)},[d]),l(B,()=>({requestClose:()=>!("edit"===y&&E(j.current)!==E(k.current))||(_(!0),!1)}),[y]);return a(()=>{const e=()=>{U&&U.current&&I(U.current.clientHeight-60)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[U]),e("div",{style:{position:"relative",width:"100%",height:$,minHeight:S},children:[R&&t(p,{isSaving:N,onSave:async()=>{await(null==x?void 0:x()),j.current=k.current,_(!1)},onDiscard:()=>{k.current=j.current,null==C||C(),_(!1)}}),t(c,{minHeight:S,height:$,placeholder:A||"Enter some text...",onChange:(e,t)=>{e.read(()=>{const e=u(t,null),r=(new DOMParser).parseFromString(e,"text/html");r.querySelectorAll("span").forEach(e=>{const t=e.getAttribute("style")||"";t.includes("background-color")&&t.includes("rgb(219, 234, 254)")&&e.setAttribute("data-review","insert"),t.includes("text-decoration")&&t.includes("line-through")&&e.setAttribute("data-review","delete")}),r.querySelectorAll("strong code").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll("code strong").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const n=["upt","manual","ins","del","preserved"];function o(e,t){const r=e.cloneNode(!0),a=new Map;r.querySelectorAll(n.join(",")).forEach(e=>{if(e===r)return;const n=`%%NESTED${a.size}%%`;a.set(n,o(e,t)),e.replaceWith(n)});let l=t.turndown(r.innerHTML);a.forEach((e,t)=>{l=l.replace(t,e)});const i=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),c=e.tagName.toLowerCase();return i?`<${c} ${i}>${l}</${c}>`:`<${c}>${l}</${c}>`}r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const a=[];r.querySelectorAll("invisible").forEach((e,t)=>{a.push(e.outerHTML),e.replaceWith(r.createTextNode(`%%INVISIBLE_${t}%%`))});const l=[];["manual","upt"].forEach(e=>{r.querySelectorAll(e).forEach((e,t)=>{l.push(o(e,f)),e.replaceWith(r.createTextNode(`%%REVIEW_${l.length-1}%%`))})});const i=[];r.querySelectorAll("table").forEach((e,t)=>{i.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let c=f.turndown(r.body.innerHTML);for(let e=l.length-1;e>=0;e--)c=c.replace(`%%REVIEW\\_${e}%%`,` ${l[e]} `);a.forEach((e,t)=>{c=c.replace(new RegExp(`%%INVISIBLE\\\\*_${t}%%`,"g"),` ${e} `)}),i.forEach((e,t)=>{c=c.replace(`%%TABLE\\_${t}%%`,`\n\n${e}\n\n`)}),c=c.replace(/\*{4}([^*]+)\*{4}/g,"**$1**");["upt","manual","del","ins","preserved"].forEach(e=>{c=m(c,e)}),c=g(c,["manual","upt"]),M.current&&(j.current=c,M.current=!1),k.current=c,((e,t)=>{h(e,t)})("prompt",c)})},toolbarConfig:i,editorRef:T,mode:y,initialString:{type:L.type,value:L.value},dynamicHeight:H,onBlur:v,doNotShowBorderInViewMode:w||!1,onEditBlocked:b})]})});v.displayName="RichTextEditor";export{v as default};
|
|
2
2
|
//# sourceMappingURL=RichTextEditor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as l,Fragment as a}from"react/jsx-runtime";import{Info as n,X as i,LoaderCircle as s,Save as t}from"lucide-react";import d from"./ClinicalTrialSection.module.css.js";const o=({title:o,note:r="This content is provided by the scientific team and not generated from uploaded documents.",fields:c,value:u,readonly:m=!0,isSaving:v=!1,styles:y,onChange:h,onSave:p,onCancel:N})=>{const b=(e,l)=>{m||null==h||h({...u,[e]:l})},f=c.find(e=>"summary"===e.key),C=c.filter(e=>"summary"!==e.key)
|
|
1
|
+
import{jsxs as e,jsx as l,Fragment as a}from"react/jsx-runtime";import{Info as n,X as i,LoaderCircle as s,Save as t}from"lucide-react";import d from"./ClinicalTrialSection.module.css.js";const o=({title:o,note:r="This content is provided by the scientific team and not generated from uploaded documents.",fields:c,value:u,readonly:m=!0,isSaving:v=!1,styles:y,onChange:h,onSave:p,onCancel:N})=>{const b=(e,l)=>{m||null==h||h({...u,[e]:l})},f=c.find(e=>"summary"===e.key),C=c.filter(e=>"summary"!==e.key);return e("div",{className:d.container,style:null==y?void 0:y.container,children:[e("div",{className:d.noteContainer,style:null==y?void 0:y.noteContainer,children:[l(n,{size:18,className:d.noteIcon,style:null==y?void 0:y.noteIcon}),e("span",{className:d.noteText,style:null==y?void 0:y.noteText,children:[l("strong",{children:"Note:"})," ",r]})]}),e(a,m?{children:[l("div",{className:d.fieldsRow,style:null==y?void 0:y.fieldsRow,children:C.map(a=>e("div",{className:d.field,style:null==y?void 0:y.field,children:[l("label",{className:d.label,style:null==y?void 0:y.label,children:a.label}),l("div",{className:d.readonlyValue,style:null==y?void 0:y.readonlyValue,children:u[a.key]||"-"})]},a.key))}),f&&e("div",{className:d.field,style:null==y?void 0:y.field,children:[l("label",{className:d.label,style:null==y?void 0:y.label,children:f.label}),l("div",{className:d.readonlySummary,style:null==y?void 0:y.readonlySummary,children:u.summary||"-"})]})]}:{children:[l("div",{className:d.fieldsRow,style:null==y?void 0:y.fieldsRow,children:C.map(a=>{var n;return e("div",{className:d.field,style:null==y?void 0:y.field,children:[l("label",{className:d.label,style:null==y?void 0:y.label,children:a.label}),"select"===a.type?e("select",{className:d.input,style:null==y?void 0:y.input,value:u[a.key]||"",onChange:e=>b(a.key,e.target.value),children:[e("option",{value:"",children:["Select ",a.label]}),null===(n=a.options)||void 0===n?void 0:n.map(e=>l("option",{value:e.value,children:e.label},e.value))]}):l("input",{className:d.input,style:null==y?void 0:y.input,placeholder:a.placeholder,value:u[a.key]||"",onChange:e=>b(a.key,e.target.value)})]},a.key)})}),f&&l("div",{className:d.summaryContainer,style:null==y?void 0:y.summaryContainer,children:l("textarea",{className:d.summaryTextarea,style:null==y?void 0:y.summaryTextarea,placeholder:(null==f?void 0:f.placeholder)||"Add section summary here",value:u.summary||"",onChange:e=>b("summary",e.target.value)})}),e("div",{className:d.actionBar,style:null==y?void 0:y.actionBar,children:[e("button",{type:"button",className:d.cancelButton,style:null==y?void 0:y.cancelButton,onClick:N,children:[l(i,{size:18}),l("span",{children:"Cancel"})]}),l("button",{type:"button",className:d.saveButton,style:null==y?void 0:y.saveButton,onClick:p,disabled:v,children:e(a,v?{children:[l(s,{size:18,className:d.spinner,style:null==y?void 0:y.spinner}),l("span",{children:"Saving..."})]}:{children:[l(t,{size:18}),l("span",{children:"Save"})]})})]})]})]})};export{o as default};
|
|
2
2
|
//# sourceMappingURL=ClinicalTrialSection.js.map
|
package/dist/features/RequirementAI/components/UserStoryCard/ClinicalTrialSection.module.css.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={container:"ClinicalTrialSection-module_container__oXyDo",noteContainer:"ClinicalTrialSection-module_noteContainer__fjKfZ",noteIcon:"ClinicalTrialSection-module_noteIcon__uO955",noteText:"ClinicalTrialSection-module_noteText__ZNtmw",fieldsRow:"ClinicalTrialSection-module_fieldsRow__S5DzE",field:"ClinicalTrialSection-module_field__KuTr6",label:"ClinicalTrialSection-module_label__xPB0g",input:"ClinicalTrialSection-module_input__nGvpX",summaryContainer:"ClinicalTrialSection-module_summaryContainer__kdXAi",summaryTextarea:"ClinicalTrialSection-module_summaryTextarea__QbEXd",actionBar:"ClinicalTrialSection-module_actionBar__V8LoA",cancelButton:"ClinicalTrialSection-module_cancelButton__GsyN4",saveButton:"ClinicalTrialSection-module_saveButton__P5AIo",readonlyValue:"ClinicalTrialSection-module_readonlyValue__31toE",readonlySummary:"ClinicalTrialSection-module_readonlySummary__WF5q6",spinner:"ClinicalTrialSection-module_spinner__AL39r",spin:"ClinicalTrialSection-module_spin__kH9hF"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const i=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;i&&e.setAttribute("nonce",i),e.appendChild(document.createTextNode(".ClinicalTrialSection-module_container__oXyDo{display:flex;flex-direction:column;gap:20px;padding:20px;width:100%}.ClinicalTrialSection-module_noteContainer__fjKfZ{align-items:center;background:#f8fafc;border:1px solid #e5e7eb;border-radius:12px;display:flex;gap:8px;padding:12px 16px}.ClinicalTrialSection-module_noteIcon__uO955{color:#6b7280;flex-shrink:0}.ClinicalTrialSection-module_noteText__ZNtmw{color:#4b5563;font-size:14px;line-height:20px}.ClinicalTrialSection-module_fieldsRow__S5DzE{display:flex;gap:24px;width:100%}.ClinicalTrialSection-module_field__KuTr6{display:flex;flex:1;flex-direction:column}.ClinicalTrialSection-module_label__xPB0g{color:#111827;font-size:14px;font-weight:600;line-height:20px;margin-bottom:8px}.ClinicalTrialSection-module_input__nGvpX{background:#fff;border:1px solid #d1d5db;border-radius:10px;box-sizing:border-box;color:#111827;font-size:14px;height:48px;outline:none;padding:0 16px;transition:border-color .2s ease;width:100%}.ClinicalTrialSection-module_input__nGvpX::placeholder{color:#9ca3af}.ClinicalTrialSection-module_input__nGvpX:focus{border-color:#3b82f6}.ClinicalTrialSection-module_summaryContainer__kdXAi{width:100%}.ClinicalTrialSection-module_summaryTextarea__QbEXd{background:#fff;border:1px solid #d1d5db;border-radius:10px;box-sizing:border-box;color:#111827;font-size:14px;line-height:20px;min-height:150px;outline:none;padding:16px;resize:vertical;transition:border-color .2s ease;width:100%}.ClinicalTrialSection-module_summaryTextarea__QbEXd::placeholder{color:#9ca3af}.ClinicalTrialSection-module_summaryTextarea__QbEXd:focus{border-color:#3b82f6}.ClinicalTrialSection-module_actionBar__V8LoA{align-items:center;display:flex;gap:24px;justify-content:flex-end;margin-top:20px}.ClinicalTrialSection-module_cancelButton__GsyN4{align-items:center;background:#0000;border:none;color:#ef4444;cursor:pointer;display:flex;font-size:16px;font-weight:500;gap:6px}.ClinicalTrialSection-module_cancelButton__GsyN4:hover{opacity:.8}.ClinicalTrialSection-module_saveButton__P5AIo{align-items:center;background:#0000;border:none;color:#4f46e5;cursor:pointer;display:flex;font-size:16px;font-weight:600;gap:6px}.ClinicalTrialSection-module_saveButton__P5AIo:hover{opacity:.8}.ClinicalTrialSection-
|
|
1
|
+
var e={container:"ClinicalTrialSection-module_container__oXyDo",noteContainer:"ClinicalTrialSection-module_noteContainer__fjKfZ",noteIcon:"ClinicalTrialSection-module_noteIcon__uO955",noteText:"ClinicalTrialSection-module_noteText__ZNtmw",fieldsRow:"ClinicalTrialSection-module_fieldsRow__S5DzE",field:"ClinicalTrialSection-module_field__KuTr6",label:"ClinicalTrialSection-module_label__xPB0g",input:"ClinicalTrialSection-module_input__nGvpX",summaryContainer:"ClinicalTrialSection-module_summaryContainer__kdXAi",summaryTextarea:"ClinicalTrialSection-module_summaryTextarea__QbEXd",actionBar:"ClinicalTrialSection-module_actionBar__V8LoA",cancelButton:"ClinicalTrialSection-module_cancelButton__GsyN4",saveButton:"ClinicalTrialSection-module_saveButton__P5AIo",readonlyValue:"ClinicalTrialSection-module_readonlyValue__31toE",readonlySummary:"ClinicalTrialSection-module_readonlySummary__WF5q6",spinner:"ClinicalTrialSection-module_spinner__AL39r",spin:"ClinicalTrialSection-module_spin__kH9hF"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const i=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;i&&e.setAttribute("nonce",i),e.appendChild(document.createTextNode(".ClinicalTrialSection-module_container__oXyDo{display:flex;flex-direction:column;gap:20px;padding:20px;width:100%}.ClinicalTrialSection-module_noteContainer__fjKfZ{align-items:center;background:#f8fafc;border:1px solid #e5e7eb;border-radius:12px;display:flex;gap:8px;padding:12px 16px}.ClinicalTrialSection-module_noteIcon__uO955{color:#6b7280;flex-shrink:0}.ClinicalTrialSection-module_noteText__ZNtmw{color:#4b5563;font-size:14px;line-height:20px}.ClinicalTrialSection-module_fieldsRow__S5DzE{display:flex;gap:24px;width:100%}.ClinicalTrialSection-module_field__KuTr6{display:flex;flex:1;flex-direction:column}.ClinicalTrialSection-module_label__xPB0g{color:#111827;font-size:14px;font-weight:600;line-height:20px;margin-bottom:8px}.ClinicalTrialSection-module_input__nGvpX{background:#fff;border:1px solid #d1d5db;border-radius:10px;box-sizing:border-box;color:#111827;font-size:14px;height:48px;outline:none;padding:0 16px;transition:border-color .2s ease;width:100%}.ClinicalTrialSection-module_input__nGvpX::placeholder{color:#9ca3af}.ClinicalTrialSection-module_input__nGvpX:focus{border-color:#3b82f6}.ClinicalTrialSection-module_summaryContainer__kdXAi{width:100%}.ClinicalTrialSection-module_summaryTextarea__QbEXd{background:#fff;border:1px solid #d1d5db;border-radius:10px;box-sizing:border-box;color:#111827;font-size:14px;line-height:20px;min-height:150px;outline:none;padding:16px;resize:vertical;transition:border-color .2s ease;width:100%}.ClinicalTrialSection-module_summaryTextarea__QbEXd::placeholder{color:#9ca3af}.ClinicalTrialSection-module_summaryTextarea__QbEXd:focus{border-color:#3b82f6}.ClinicalTrialSection-module_actionBar__V8LoA{align-items:center;display:flex;gap:24px;justify-content:flex-end;margin-top:20px}.ClinicalTrialSection-module_cancelButton__GsyN4{align-items:center;background:#0000;border:none;color:#ef4444;cursor:pointer;display:flex;font-size:16px;font-weight:500;gap:6px}.ClinicalTrialSection-module_cancelButton__GsyN4:hover{opacity:.8}.ClinicalTrialSection-module_saveButton__P5AIo{align-items:center;background:#0000;border:none;color:#4f46e5;cursor:pointer;display:flex;font-size:16px;font-weight:600;gap:6px}.ClinicalTrialSection-module_saveButton__P5AIo:hover{opacity:.8}.ClinicalTrialSection-module_readonlyValue__31toE{align-items:center;background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;color:#111827;display:flex;font-size:14px;line-height:20px;min-height:48px;padding:0 16px}.ClinicalTrialSection-module_readonlySummary__WF5q6{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;color:#111827;font-size:14px;line-height:22px;min-height:150px;padding:16px;white-space:pre-wrap;word-break:break-word}.ClinicalTrialSection-module_spinner__AL39r{animation:ClinicalTrialSection-module_spin__kH9hF 1s linear infinite}@keyframes ClinicalTrialSection-module_spin__kH9hF{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}();export{e as default};
|
|
2
2
|
//# sourceMappingURL=ClinicalTrialSection.module.css.js.map
|