@viswa-test/test-citation 0.0.240 → 0.0.242
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/README.md +218 -0
- package/dist/cjs/features/ChatCitation/InternalChatCitationRenderer.js +1 -1
- package/dist/cjs/features/ChatCitation/components/ChatCitation.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
- package/dist/cjs/features/IngestionStatus/useIngestionStatus.js +1 -1
- package/dist/cjs/features/InstantLearningCitation/SlashLoader.js +2 -0
- package/dist/cjs/features/InstantLearningCitation/SlashLoader.js.map +1 -0
- package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js +2 -0
- package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js.map +1 -0
- 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/HistoryMenu.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.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/CitationPdfRendererWrapper.js +2 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js +2 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js +2 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js +2 -0
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/DeleteSegmentsDialog.js +2 -0
- package/dist/cjs/features/RequirementAI/components/segment/DeleteSegmentsDialog.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/segment/EditSegmentDialog.js +2 -0
- package/dist/cjs/features/RequirementAI/components/segment/EditSegmentDialog.js.map +1 -0
- 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/deleteSegmentDialog.module.css.js +2 -0
- package/dist/cjs/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js.map +1 -0
- 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 +2 -0
- package/dist/cjs/hooks/useOnDemandCitationFetch.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/service/apicache.service.js +2 -0
- package/dist/cjs/service/apicache.service.js.map +1 -0
- package/dist/cjs/service/onDemandApi.js +2 -0
- package/dist/cjs/service/onDemandApi.js.map +1 -0
- package/dist/cjs/types/onDemandApi.types.js +2 -0
- package/dist/cjs/types/onDemandApi.types.js.map +1 -0
- package/dist/features/ChatCitation/InternalChatCitationRenderer.js +1 -1
- package/dist/features/ChatCitation/components/ChatCitation.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -0
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
- package/dist/features/IngestionStatus/useIngestionStatus.js +1 -1
- package/dist/features/InstantLearningCitation/SlashLoader.js +2 -0
- package/dist/features/InstantLearningCitation/SlashLoader.js.map +1 -0
- package/dist/features/ParentCitationComponent/ParentCitationComponent.js +2 -0
- package/dist/features/ParentCitationComponent/ParentCitationComponent.js.map +1 -0
- 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/HistoryMenu.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.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/CitationPdfRendererWrapper.js +2 -0
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.js.map +1 -0
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js +2 -0
- package/dist/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.js.map +1 -0
- package/dist/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js +2 -0
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitation.module.css.js.map +1 -0
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js +2 -0
- package/dist/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.js.map +1 -0
- package/dist/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.js +1 -1
- package/dist/features/RequirementAI/components/segment/DeleteSegmentsDialog.js +2 -0
- package/dist/features/RequirementAI/components/segment/DeleteSegmentsDialog.js.map +1 -0
- package/dist/features/RequirementAI/components/segment/EditSegmentDialog.js +2 -0
- package/dist/features/RequirementAI/components/segment/EditSegmentDialog.js.map +1 -0
- 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/deleteSegmentDialog.module.css.js +2 -0
- package/dist/features/RequirementAI/components/segment/deleteSegmentDialog.module.css.js.map +1 -0
- 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 +2 -0
- package/dist/hooks/useOnDemandCitationFetch.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/service/apicache.service.js +2 -0
- package/dist/service/apicache.service.js.map +1 -0
- package/dist/service/onDemandApi.js +2 -0
- package/dist/service/onDemandApi.js.map +1 -0
- package/dist/types/onDemandApi.types.js +2 -0
- package/dist/types/onDemandApi.types.js.map +1 -0
- package/dist/types/src/DeviationSummaryTest.d.ts.map +1 -1
- package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
- package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
- package/dist/types/src/constants/deviationData.d.ts +887 -0
- package/dist/types/src/constants/deviationData.d.ts.map +1 -0
- package/dist/types/src/constants/treeData.d.ts +732 -0
- package/dist/types/src/constants/treeData.d.ts.map +1 -0
- package/dist/types/src/features/ChatCitation/InternalChatCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/components/ChatCitation.d.ts +1 -0
- package/dist/types/src/features/ChatCitation/components/ChatCitation.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/types/citations.types.d.ts +3 -0
- package/dist/types/src/features/ChatCitation/types/citations.types.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +8 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +2 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts +3 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +815 -7803
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +0 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
- package/dist/types/src/features/IngestionStatus/useIngestionStatus.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearningCitation/InstantLearningCitationTest.d.ts +2 -0
- package/dist/types/src/features/InstantLearningCitation/InstantLearningCitationTest.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearningCitation/types/Types.d.ts +2 -0
- package/dist/types/src/features/InstantLearningCitation/types/Types.d.ts.map +1 -1
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts +128 -0
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts.map +1 -0
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts +13 -0
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +13 -6
- 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.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +7 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts +8 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts +13 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts +17 -13
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +15 -3
- 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 +21 -2
- 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 +3 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.d.ts +11 -0
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfRendererWrapper.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.d.ts +25 -0
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/CitationPdfViewer.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts +3 -2
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.d.ts +31 -0
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/pdfCitationUtils.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.d.ts +1 -0
- package/dist/types/src/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/segment/DeleteSegmentsDialog.d.ts +13 -0
- package/dist/types/src/features/RequirementAI/components/segment/DeleteSegmentsDialog.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/segment/EditSegmentDialog.d.ts +12 -0
- package/dist/types/src/features/RequirementAI/components/segment/EditSegmentDialog.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts +8 -1
- 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 +5 -1
- 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 +3 -1
- 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 +3 -1
- 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 +2 -1
- 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 +18 -1
- 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 +32 -1
- 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 +8 -0
- package/dist/types/src/features/RequirementAI/types/segment.type.d.ts.map +1 -1
- package/dist/types/src/hooks/useOnDemandCitationFetch.d.ts +11 -0
- package/dist/types/src/hooks/useOnDemandCitationFetch.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnDemandCitationFetchTest.d.ts +4 -0
- package/dist/types/src/hooks/useOnDemandCitationFetchTest.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/methodsToExpose.d.ts +1 -1
- package/dist/types/src/service/ProjectService.d.ts +2 -2
- package/dist/types/src/service/SavedDataSetService.d.ts +3 -3
- package/dist/types/src/service/apicache.service.d.ts +43 -0
- package/dist/types/src/service/apicache.service.d.ts.map +1 -0
- package/dist/types/src/service/onDemandApi.d.ts +27 -0
- package/dist/types/src/service/onDemandApi.d.ts.map +1 -0
- package/dist/types/src/types/onDemandApi.types.d.ts +58 -0
- package/dist/types/src/types/onDemandApi.types.d.ts.map +1 -0
- package/dist/types/src/types/useOnDemandCitationFetch.types.d.ts +70 -0
- package/dist/types/src/types/useOnDemandCitationFetch.types.d.ts.map +1 -0
- package/package.json +15 -4
- package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
- package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
- package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
- package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
- package/dist/types/src/CitationAccordionTest.d.ts +0 -1
- package/dist/types/src/CitationAccordionTest.d.ts.map +0 -1
- package/dist/types/src/MockDeviationSummary.d.ts +0 -1
- package/dist/types/src/MockDeviationSummary.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as i,Fragment as t,jsxs as o}from"react/jsx-runtime";import{useRef as n,useMemo as e,Suspense as l}from"react";import a from"react-markdown";import c from"rehype-raw";import{ChevronDown as d,ChevronUp as s,Maximize2 as r,X as u,Info as m}from"lucide-react";import{Tooltip as v}from"@mui/material";import p from"./AiReasonMarkdownWrapper.module.css.js";import _ from"../../shared/ExpandableOl.js";import h from"../citations/web-citation/WebCitationWithImageRenderer.js";import g from"../citations/web-citation/WebCitationRenderer.js";import f from"../citations/image-citation/ImageCitationRenderer.js";import C from"../citations/file-citation/FileCitationRender.js";import{useRequirementAI as b}from"../RequirementAIWrapper/RequirementAIWrapper.js";import y from"../citations/stormee-citation/StormeeCitationRenderer.js";import I from"../citations/audio-citation/WaveformCitationRenderer.js";import S from"../citations/appmod-citation/AppmodCitationRenderer.js";import k from"../citations/rca-citation/RCACitationRenderer.js";import M from"../citations/readfile-citation/ReadFileCitationRenderer.js";import w from"../citations/chat-citation/ChatCitationRenderer.js";import{NonWebReasoningComponent as R}from"@e-llm-studio/citation";import j from"../citations/big-enough/BigEnoughCitationRenderer.js";import N from"./ScannedCitationRenderer.js";import $ from"../citations/gpt-web-citation/GptWebCitationRenderer.js";const W=["appmode_citation","appmode_citations","appmod_citation","appmod_citations","image_citation","image_citations","audio_citation","audio_citations","document_citation","document_citations","rca_citation","rca_citations","web_citation","web_citations","code_generated","chat_citation","readfile_citation","readfile_citations","gpt_citation","gpt_citations","big_enough_block","scanned_doc_citation","scanned_doc_citations"],x=(i,t,o)=>[...i.map((i,n)=>{const e=n>=t&&n<=o;return{...i,highlighted_text:e?i.message:""}})],L=({label:L,message:P,isExpandableOrderedListEnabled:T,customStyles:F,citationStyles:E,customIcons:A,onSelectProceed:D,isDisableProceedButton:G,big_enough_block:q})=>{const O=n(null),{citations:z,citationConfig:B,chatHistory:H,chatCitationConfigs:U,gptCitationConfigs:J}=b();console.log("Testing::Citations in Lib",z);const K=e(()=>({h1:({node:t,...o})=>i("h1",{className:p.h1,style:null==F?void 0:F.h1,children:null==o?void 0:o.children}),h2:({node:t,...o})=>i("h2",{className:p.h2,style:null==F?void 0:F.h2,children:null==o?void 0:o.children}),h3:({node:t,...o})=>i("h2",{className:p.h3,style:null==F?void 0:F.h3,children:null==o?void 0:o.children}),b:({node:t,...o})=>i("b",{className:p.bold,style:null==F?void 0:F.b}),p:({node:t,...o})=>i("p",{...o,className:p.paragraph,style:null==F?void 0:F.p,children:null==o?void 0:o.children}),ol:({node:t,...o})=>T?i(_,{label:L,customStyles:null==F?void 0:F.expandOlStyle,onProceed:D,isProceedDisabled:G,aiReasoningCitation:z,citationStyles:E,customIcons:A,children:null==o?void 0:o.children}):i("ol",{className:p.orderedList,style:null==F?void 0:F.ol,children:null==o?void 0:o.children}),ul:({node:t,...o})=>i("ul",{className:p.unorderedList,children:null==o?void 0:o.children}),a:({inline:n,children:e,node:a,...c})=>{var m,_,b,L,T,D,G,O,K,Q,V,X,Y,Z,ii,ti,oi,ni,ei,li,ai,ci,di,si,ri,ui,mi,vi,pi;const _i="true"===(null==c?void 0:c.table),hi=`${null==c?void 0:c.href}`,gi=null===(m=hi.split("$"))||void 0===m?void 0:m[0],fi=null===(_=hi.split("$"))||void 0===_?void 0:_[1],Ci=("appmode_citation"===gi||"appmode_citations"===gi?(null==z?void 0:z.appmod_citations)||[]:"image_citation"===gi||"image_citations"===gi?(null==z?void 0:z.image_citations)||[]:"audio_citation"===gi||"audio_citations"===gi?(null==z?void 0:z.audio_citations)||[]:"document_citation"===gi||"document_citations"===gi?(null==z?void 0:z.file_citations)||[]:"rca_citation"===gi||"rca_citations"===gi?(null==z?void 0:z.rca_citations)||[]:"web_citation"===gi||"web_citations"===gi?(null==z?void 0:z.web_citations)||[]:"code_generated"===gi?(null==z?void 0:z.code_generated)||[]:"readfile_citation"===gi||"readfile_citations"===gi?(null==z?void 0:z.readfile_citations)||[]:"gpt_citation"===gi||"gpt_citations"===gi?(null==z?void 0:z.gpt_citations)||[]:"scanned_doc_citation"===gi||"scanned_doc_citations"===gi?(null==z?void 0:z.scanned_doc_citations)||[]:"big_enough_block"===gi&&q||[]).find(i=>i.citation_number===decodeURIComponent(fi));console.log("TESTING::citation",Ci);const bi=W.includes(gi);if("big_enough_block"===gi&&Ci)return console.log("Rendering big enough block with citation:",E),i(j,{title:e,citation:Ci,customStyles:null==E?void 0:E.bigEnoughCitation,customIcons:A});if("chat_citation"===gi){if(!H||0===H.length)return null;let[t,o]=fi.split("-").map(Number);return t=t>0?t-1:t,o=o<H.length-1?o+1:o,i(w,{customIcon:null==A?void 0:A.chatCitationIcon,title:e,chatHistory:x(H,t,o),isTable:_i,chatCitationProps:null==U?void 0:U.chatCitationProps,onCitationClick:null==U?void 0:U.handleCitationClicked,customStyles:null==E?void 0:E.chatCitation})}if(("gpt_citation"===gi||"gpt_citations"===gi)&&Ci)return(null===(b=null==Ci?void 0:Ci.customMetadata)||void 0===b?void 0:b.value)?i($,{title:e,citation:Ci,customStyles:null==E?void 0:E.webCitation,customIcons:A,content:P}):i(R,{item:{text:"",dataSource:null===(T=null===(L=Ci.customMetadata)||void 0===L?void 0:L.data_sources)||void 0===T?void 0:T[0],trainingDataTitle:null===(G=null===(D=Ci.customMetadata)||void 0===D?void 0:D.training_data_title)||void 0===G?void 0:G[0],paraphrase:null===(K=null===(O=Ci.customMetadata)||void 0===O?void 0:O.paraphrase)||void 0===K?void 0:K[0]},headerTitle:(null==J?void 0:J.title)||"GPT - Gemini 2.5 Flash",iconsConfig:{ChevronDownIcon:d,ChevronUpIcon:s,MaximizeIcon:r,CloseIcon:u},...null==J?void 0:J.gptCitationProps});if("image_citation"===gi&&!Ci)return null;if("web_citation"===(null===(Q=null==Ci?void 0:Ci.customMetadata)||void 0===Q?void 0:Q.type))return(null===(V=Ci.customMetadata)||void 0===V?void 0:V.screenshot_url)?i(h,{title:e,citation:Ci,customStyles:null==E?void 0:E.webCitation,customIcons:A}):i(g,{label:e,url:null===(X=Ci.customMetadata)||void 0===X?void 0:X.link,customStyles:null==E?void 0:E.webCitation,customIcons:A});if("audio_transcript"===(null===(Y=null==Ci?void 0:Ci.customMetadata)||void 0===Y?void 0:Y.type))return"stormee"===(null==Ci?void 0:Ci.customMetadata.audio_citation_mode)?i(l,{fallback:i(t,{}),children:i(y,{title:`${e}`,citation:Ci,customStyles:null==E?void 0:E.stormeeCitation,customIcons:A})}):i(l,{fallback:i(t,{}),children:i(I,{title:`${e}`,citation:Ci,customStyles:null==E?void 0:E.waveformCitation,customIcons:A})});if("scanned_doc_citations"===(null===(Z=null==Ci?void 0:Ci.customMetadata)||void 0===Z?void 0:Z.type)||"scanned_doc_citation"===(null===(ii=null==Ci?void 0:Ci.customMetadata)||void 0===ii?void 0:ii.type))return i(l,{fallback:i(t,{}),children:i(N,{title:e,citation:Ci,customIcons:A,customStyles:null==E?void 0:E.scannedDocumentCitation})});if("image_citation"===(null==Ci?void 0:Ci.customMetadata.type))return i(l,{fallback:i(t,{}),children:i(f,{title:`${e}`,citation:Ci,customIcons:A,customStyles:null==E?void 0:E.imageCitation})});if("book_citation_doc"===(null===(ti=null==Ci?void 0:Ci.customMetadata)||void 0===ti?void 0:ti.type)||"book_citation_pdf"===(null==Ci?void 0:Ci.customMetadata.type))return i(l,{fallback:i(t,{}),children:i(C,{title:`${e}`,citation:Ci,customIcons:A,customStyles:null==E?void 0:E.fileCitation})});if("app_mod_rag_question"===(null===(oi=null==Ci?void 0:Ci.customMetadata)||void 0===oi?void 0:oi.type))return i(l,{fallback:i(t,{}),children:i(S,{title:`${e}`,citation:Ci,customIcons:A,customStyles:null==E?void 0:E.appModCitation,codeLinkConfig:null===(ni=null==B?void 0:B.appMod)||void 0===ni?void 0:ni.codeLinkConfig,isLoading:null===(ei=null==B?void 0:B.appMod)||void 0===ei?void 0:ei.isLoading})});if("rca_citation"===(null===(li=null==Ci?void 0:Ci.customMetadata)||void 0===li?void 0:li.type))return i(l,{fallback:i(t,{}),children:i(k,{title:`${e}`,citation:Ci,customIcons:A,customStyles:null==E?void 0:E.rcaCitation})});if("readfile_citation"===(null===(ai=null==Ci?void 0:Ci.customMetadata)||void 0===ai?void 0:ai.type))return i(l,{fallback:i(t,{}),children:i(M,{title:`${e}`,citation:Ci,customIcons:A,customStyles:null==E?void 0:E.readFileCitation,fileCallback:null===(ci=null==B?void 0:B.readFile)||void 0===ci?void 0:ci.fileCallback,editorConfig:null===(di=null==B?void 0:B.readFile)||void 0===di?void 0:di.editorConfig,customColors:null===(si=null==B?void 0:B.readFile)||void 0===si?void 0:si.customColors})});if(bi&&!Ci){const t=null!==(ri=null==A?void 0:A.citationLoadingIcon)&&void 0!==ri?ri:i("span",{className:p.citationSpinner,style:null===(ui=null==E?void 0:E.loadingCitations)||void 0===ui?void 0:ui.citationSpinner});return i(v,{title:null!==(vi=null===(mi=null==E?void 0:E.loadingCitations)||void 0===mi?void 0:mi.tooltipTitle)&&void 0!==vi?vi:`source ${gi.split("_")[0]} citations`,arrow:!0,children:o("span",{className:p.citationSpinnerWrapper,style:null===(pi=null==E?void 0:E.loadingCitations)||void 0===pi?void 0:pi.citationSpinnerWrapper,children:[e,t]})})}return i("span",{...c,className:p.paragraph,style:null==F?void 0:F.p,children:null==c?void 0:c.children})},code:({inline:t,children:o,className:n,node:e,...l})=>/language-(\w+)/.exec(n||"")||(null==n?void 0:n.includes("language-"))?i("div",{children:i("code",{className:p.blockCode,children:o})}):i("code",{className:p.inlineCode,style:null==F?void 0:F.code,children:o}),learned:({children:o})=>i(t,{children:i(v,{title:o,placement:"top",children:i(m,{size:16,className:p.learnedIcon})})})}),[z,T,B,H,q]);return i("div",{ref:O,className:"w-full",children:i(a,{components:K,rehypePlugins:[c],children:P})})};export{L as AiReasonMarkdownWrapper,x as formatChatData};
|
|
1
|
+
import{jsx as i,Fragment as t,jsxs as o}from"react/jsx-runtime";import{useRef as n,useMemo as e,Suspense as l}from"react";import a from"react-markdown";import c from"rehype-raw";import{ChevronDown as d,ChevronUp as s,Maximize2 as r,X as u,Info as m}from"lucide-react";import{Tooltip as v}from"@mui/material";import p from"./AiReasonMarkdownWrapper.module.css.js";import _ from"../../shared/ExpandableOl.js";import h from"../citations/web-citation/WebCitationWithImageRenderer.js";import g from"../citations/web-citation/WebCitationRenderer.js";import f from"../citations/image-citation/ImageCitationRenderer.js";import C from"../citations/file-citation/FileCitationRender.js";import{useRequirementAI as b}from"../RequirementAIWrapper/RequirementAIWrapper.js";import y from"../citations/stormee-citation/StormeeCitationRenderer.js";import I from"../citations/audio-citation/WaveformCitationRenderer.js";import k from"../citations/appmod-citation/AppmodCitationRenderer.js";import S from"../citations/rca-citation/RCACitationRenderer.js";import w from"../citations/readfile-citation/ReadFileCitationRenderer.js";import M from"../citations/chat-citation/ChatCitationRenderer.js";import{NonWebReasoningComponent as N}from"@e-llm-studio/citation";import R from"../citations/big-enough/BigEnoughCitationRenderer.js";import j from"./ScannedCitationRenderer.js";import F from"../citations/gpt-web-citation/GptWebCitationRenderer.js";const $=["appmode_citation","appmode_citations","appmod_citation","appmod_citations","image_citation","image_citations","audio_citation","audio_citations","document_citation","document_citations","rca_citation","rca_citations","web_citation","web_citations","code_generated","chat_citation","readfile_citation","readfile_citations","gpt_citation","gpt_citations","big_enough_block","scanned_doc_citation","scanned_doc_citations"],x=(i,t,o)=>{const n=Number.isFinite(t)&&Number.isFinite(o);return[...i.map((i,e)=>{const l=e>=t&&e<=o;return{...i,highlighted_text:n?l?i.message:"":i.highlighted_text}})]},W=({label:W,message:L,isExpandableOrderedListEnabled:P,customStyles:T,citationStyles:A,customIcons:E,onSelectProceed:D,isDisableProceedButton:O,big_enough_block:G})=>{const H=n(null),{citations:q,citationConfig:z,chatHistory:B,chatCitationConfigs:U,gptCitationConfigs:V}=b();console.log("Testing::Citations in Lib",q);const J=e(()=>({h1:({node:t,...o})=>i("h1",{className:p.h1,style:null==T?void 0:T.h1,children:null==o?void 0:o.children}),h2:({node:t,...o})=>i("h2",{className:p.h2,style:null==T?void 0:T.h2,children:null==o?void 0:o.children}),h3:({node:t,...o})=>i("h2",{className:p.h3,style:null==T?void 0:T.h3,children:null==o?void 0:o.children}),b:({node:t,...o})=>i("b",{className:p.bold,style:null==T?void 0:T.b}),p:({node:t,...o})=>i("p",{...o,className:p.paragraph,style:null==T?void 0:T.p,children:null==o?void 0:o.children}),ol:({node:t,...o})=>P?i(_,{label:W,customStyles:null==T?void 0:T.expandOlStyle,onProceed:D,isProceedDisabled:O,aiReasoningCitation:q,citationStyles:A,customIcons:E,children:null==o?void 0:o.children}):i("ol",{className:p.orderedList,style:null==T?void 0:T.ol,children:null==o?void 0:o.children}),ul:({node:t,...o})=>i("ul",{className:p.unorderedList,children:null==o?void 0:o.children}),a:({inline:n,children:e,node:a,...c})=>{var m,_,b,W,P,D,O,H,J,K,Q,X,Y,Z,ii,ti,oi,ni,ei,li,ai,ci,di,si,ri,ui,mi,vi,pi;const _i="true"===(null==c?void 0:c.table),hi=`${null==c?void 0:c.href}`,gi=null===(m=hi.split("$"))||void 0===m?void 0:m[0],fi=null===(_=hi.split("$"))||void 0===_?void 0:_[1],Ci=("appmode_citation"===gi||"appmode_citations"===gi?(null==q?void 0:q.appmod_citations)||[]:"image_citation"===gi||"image_citations"===gi?(null==q?void 0:q.image_citations)||[]:"audio_citation"===gi||"audio_citations"===gi?(null==q?void 0:q.audio_citations)||[]:"document_citation"===gi||"document_citations"===gi?(null==q?void 0:q.file_citations)||[]:"rca_citation"===gi||"rca_citations"===gi?(null==q?void 0:q.rca_citations)||[]:"web_citation"===gi||"web_citations"===gi?(null==q?void 0:q.web_citations)||[]:"code_generated"===gi?(null==q?void 0:q.code_generated)||[]:"readfile_citation"===gi||"readfile_citations"===gi?(null==q?void 0:q.readfile_citations)||[]:"gpt_citation"===gi||"gpt_citations"===gi?(null==q?void 0:q.gpt_citations)||[]:"scanned_doc_citation"===gi||"scanned_doc_citations"===gi?(null==q?void 0:q.scanned_doc_citations)||[]:"big_enough_block"===gi&&G||[]).find(i=>i.citation_number===decodeURIComponent(fi));console.log("TESTING::citation",Ci);const bi=$.includes(gi);if("big_enough_block"===gi&&Ci)return console.log("Rendering big enough block with citation:",A),i(R,{title:e,citation:Ci,customStyles:null==A?void 0:A.bigEnoughCitation,customIcons:E});if("chat_citation"===gi){if(!B||0===B.length)return null;let t=0,o=B.length-1;if("all"!==fi){const[i,n]=fi.split("-").map(Number);t=Number.isFinite(i)?i:0,o=Number.isFinite(n)?n:t,t=t>0?t-1:t,o=o<B.length-1?o+1:o}return i(M,{customIcon:null==E?void 0:E.chatCitationIcon,title:e,chatHistory:x(B,t,o),isTable:_i,chatCitationProps:null==U?void 0:U.chatCitationProps,onCitationClick:null==U?void 0:U.handleCitationClicked,customStyles:null==A?void 0:A.chatCitation,openInFullscreenOnClick:null==U?void 0:U.openInFullscreenOnClick})}if(("gpt_citation"===gi||"gpt_citations"===gi)&&Ci)return(null===(b=null==Ci?void 0:Ci.customMetadata)||void 0===b?void 0:b.value)?i(F,{title:e,citation:Ci,customStyles:null==A?void 0:A.webCitation,customIcons:E,content:L}):i(N,{item:{text:"",dataSource:null===(P=null===(W=Ci.customMetadata)||void 0===W?void 0:W.data_sources)||void 0===P?void 0:P[0],trainingDataTitle:null===(O=null===(D=Ci.customMetadata)||void 0===D?void 0:D.training_data_title)||void 0===O?void 0:O[0],paraphrase:null===(J=null===(H=Ci.customMetadata)||void 0===H?void 0:H.paraphrase)||void 0===J?void 0:J[0]},headerTitle:(null==V?void 0:V.title)||"GPT - Gemini 2.5 Flash",iconsConfig:{ChevronDownIcon:d,ChevronUpIcon:s,MaximizeIcon:r,CloseIcon:u},...null==V?void 0:V.gptCitationProps});if("image_citation"===gi&&!Ci)return null;if("web_citation"===(null===(K=null==Ci?void 0:Ci.customMetadata)||void 0===K?void 0:K.type))return(null===(Q=Ci.customMetadata)||void 0===Q?void 0:Q.screenshot_url)?i(h,{title:e,citation:Ci,customStyles:null==A?void 0:A.webCitation,customIcons:E}):i(g,{label:e,url:null===(X=Ci.customMetadata)||void 0===X?void 0:X.link,customStyles:null==A?void 0:A.webCitation,customIcons:E});if("audio_transcript"===(null===(Y=null==Ci?void 0:Ci.customMetadata)||void 0===Y?void 0:Y.type))return"stormee"===(null==Ci?void 0:Ci.customMetadata.audio_citation_mode)?i(l,{fallback:i(t,{}),children:i(y,{title:`${e}`,citation:Ci,customStyles:null==A?void 0:A.stormeeCitation,customIcons:E})}):i(l,{fallback:i(t,{}),children:i(I,{title:`${e}`,citation:Ci,customStyles:null==A?void 0:A.waveformCitation,customIcons:E})});if("scanned_doc_citations"===(null===(Z=null==Ci?void 0:Ci.customMetadata)||void 0===Z?void 0:Z.type)||"scanned_doc_citation"===(null===(ii=null==Ci?void 0:Ci.customMetadata)||void 0===ii?void 0:ii.type))return i(l,{fallback:i(t,{}),children:i(j,{title:e,citation:Ci,customIcons:E,customStyles:null==A?void 0:A.scannedDocumentCitation,pdfViewHeaderAction:null==z?void 0:z.pdfViewHeaderAction})});if("image_citation"===(null==Ci?void 0:Ci.customMetadata.type))return i(l,{fallback:i(t,{}),children:i(f,{title:`${e}`,citation:Ci,customIcons:E,customStyles:null==A?void 0:A.imageCitation})});if("book_citation_doc"===(null===(ti=null==Ci?void 0:Ci.customMetadata)||void 0===ti?void 0:ti.type)||"book_citation_pdf"===(null==Ci?void 0:Ci.customMetadata.type))return i(l,{fallback:i(t,{}),children:i(C,{title:`${e}`,citation:Ci,customIcons:E,customStyles:null==A?void 0:A.fileCitation})});if("app_mod_rag_question"===(null===(oi=null==Ci?void 0:Ci.customMetadata)||void 0===oi?void 0:oi.type))return i(l,{fallback:i(t,{}),children:i(k,{title:`${e}`,citation:Ci,customIcons:E,customStyles:null==A?void 0:A.appModCitation,codeLinkConfig:null===(ni=null==z?void 0:z.appMod)||void 0===ni?void 0:ni.codeLinkConfig,isLoading:null===(ei=null==z?void 0:z.appMod)||void 0===ei?void 0:ei.isLoading})});if("rca_citation"===(null===(li=null==Ci?void 0:Ci.customMetadata)||void 0===li?void 0:li.type))return i(l,{fallback:i(t,{}),children:i(S,{title:`${e}`,citation:Ci,customIcons:E,customStyles:null==A?void 0:A.rcaCitation})});if("readfile_citation"===(null===(ai=null==Ci?void 0:Ci.customMetadata)||void 0===ai?void 0:ai.type))return i(l,{fallback:i(t,{}),children:i(w,{title:`${e}`,citation:Ci,customIcons:E,customStyles:null==A?void 0:A.readFileCitation,fileCallback:null===(ci=null==z?void 0:z.readFile)||void 0===ci?void 0:ci.fileCallback,editorConfig:null===(di=null==z?void 0:z.readFile)||void 0===di?void 0:di.editorConfig,customColors:null===(si=null==z?void 0:z.readFile)||void 0===si?void 0:si.customColors})});if(bi&&!Ci){const t=null!==(ri=null==E?void 0:E.citationLoadingIcon)&&void 0!==ri?ri:i("span",{className:p.citationSpinner,style:null===(ui=null==A?void 0:A.loadingCitations)||void 0===ui?void 0:ui.citationSpinner});return i(v,{title:null!==(vi=null===(mi=null==A?void 0:A.loadingCitations)||void 0===mi?void 0:mi.tooltipTitle)&&void 0!==vi?vi:`source ${gi.split("_")[0]} citations`,arrow:!0,children:o("span",{className:p.citationSpinnerWrapper,style:null===(pi=null==A?void 0:A.loadingCitations)||void 0===pi?void 0:pi.citationSpinnerWrapper,children:[e,t]})})}return i("span",{...c,className:p.paragraph,style:null==T?void 0:T.p,children:null==c?void 0:c.children})},code:({inline:t,children:o,className:n,node:e,...l})=>/language-(\w+)/.exec(n||"")||(null==n?void 0:n.includes("language-"))?i("div",{children:i("code",{className:p.blockCode,children:o})}):i("code",{className:p.inlineCode,style:null==T?void 0:T.code,children:o}),learned:({children:o})=>i(t,{children:i(v,{title:o,placement:"top",children:i(m,{size:16,className:p.learnedIcon})})})}),[q,P,z,B,G]);return i("div",{ref:H,className:"w-full",children:i(a,{components:J,rehypePlugins:[c],children:L})})};export{W as AiReasonMarkdownWrapper,x as formatChatData};
|
|
2
2
|
//# sourceMappingURL=AiReasonMarkdownWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as i,jsxs as
|
|
1
|
+
import{jsx as i,jsxs as o,Fragment as n}from"react/jsx-runtime";import e from"../../icons/AiReasoningIcon.js";import l from"./AIReasonAccordion.js";import a from"../../icons/ReasoningBulbIcon.js";import{AiReasonMarkdownWrapper as t}from"./AiReasonMarkdownWrapper.js";import d from"../../icons/AiGapIcon.js";import{useState as s}from"react";import{ChevronUp as r,ChevronDown as v}from"lucide-react";import c from"./AiReasoningCitationContent.module.css.js";import{renderAIConfidenceDisplay as u}from"../../shared/CitationAIConfidenceDisplay.js";import{useRequirementAI as C}from"../RequirementAIWrapper/RequirementAIWrapper.js";const m=({label:m,aiReason:p,scenario:g,customStyles:h,customIcons:f,cognitiveDecisionHeaders:b,onSelectProceed:y,isDisableProceedButton:R,big_enough_block:w,isSegmentExplanation:S,handleViewExample:I,handleViewGlossary:N,isUpdatedSegment:A,footer:B})=>{var k,x,D,E,_,M,O,j,W,F,$,G,H,P,T,U,V,q,L,z,J,K;const{aiReasoningAccordionOpenStates:Q}=C(),X=(null==f?void 0:f.aireasonIcon)||i(e,{}),Y=(null==f?void 0:f.reasoningIcon)||i(a,{}),Z=(null==f?void 0:f.gapIcon)||i(d,{}),[ii,oi]=s(null!==(k=null==Q?void 0:Q.isBottomComponentDefaultOpen)&&void 0!==k&&k);return o("div",{className:`${c.container} ${"riskSideBar"===g?"":c.containerBordered}`,style:null===(x=null==h?void 0:h.aiReasoningContent)||void 0===x?void 0:x.container,children:[(null==p?void 0:p.explanation)&&i("div",{className:`${(null==p?void 0:p.explanation)&&"riskSideBar"!==g?"":c.explanationDivider}`,style:null===(D=null==h?void 0:h.aiReasoningContent)||void 0===D?void 0:D.explanationDivider,children:i(l,{icon:i(n,{}),title:"Explanation",subTitle:"",customStyles:null==h?void 0:h.aiReasoningAccordion,content:i(t,{label:m,message:p.explanation,isExpandableOrderedListEnabled:!0,customStyles:null==h?void 0:h.aiReasoningMarkdown,citationStyles:{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},customIcons:f,onSelectProceed:y,isDisableProceedButton:R,big_enough_block:w}),isSegmentExplanation:S,scenario:g,handleViewExample:I,handleViewGlossary:N,isUpdatedSegment:A})}),"riskSideBar"!==g&&o("div",{onClick:()=>{(null==Q?void 0:Q.isBottomComponentCollapsed)&&oi(i=>!i)},className:`${c.headerBar} ${"riskSideBar"===g?"":c.headerBarRounded}`,style:null===(E=null==h?void 0:h.aiReasoningContent)||void 0===E?void 0:E.headerBar,children:[o("div",{className:c.headerBrand,style:null===(_=null==h?void 0:h.aiReasoningContent)||void 0===_?void 0:_.headerBrand,children:[X,i("p",{children:null!==(M=null==b?void 0:b.mainHeader)&&void 0!==M?M:"Cognitive Decisioning AI"})]}),o("div",{className:c.headerScore,style:null===(O=null==h?void 0:h.aiReasoningContent)||void 0===O?void 0:O.headerScore,children:[!isNaN(null==p?void 0:p.relevance_score)&&u(p.relevance_score,p.relevance_score_diff,null===(j=null==h?void 0:h.aiReasoningContent)||void 0===j?void 0:j.confidenceDisplay,f),(null==Q?void 0:Q.isBottomComponentCollapsed)&&i("button",{className:c.chevronWrapper,style:null===(W=null==h?void 0:h.aiReasoningContent)||void 0===W?void 0:W.chevronWrapper,children:ii?i(r,{className:null==c?void 0:c.chevronIcon,style:null===(F=null==h?void 0:h.aiReasoningContent)||void 0===F?void 0:F.chevronIcon}):i(v,{className:null==c?void 0:c.chevronIcon,style:null===($=null==h?void 0:h.aiReasoningContent)||void 0===$?void 0:$.chevronIcon})})]})]}),"riskSideBar"!==g&&ii&&i("div",{className:c.bodyRow,style:{width:"100%",...null===(G=null==h?void 0:h.aiReasoningContent)||void 0===G?void 0:G.bodyRow},children:o("div",{className:`flex flex-col ${c.bodyFull}`,children:[i(l,{icon:i("div",{className:c.iconWrapper,style:null===(H=null==h?void 0:h.aiReasoningContent)||void 0===H?void 0:H.iconWrapper,children:Y}),isUpdatedSegment:A,title:null!==(P=null==b?void 0:b.decisionHeader)&&void 0!==P?P:"Decision Making Factors",subTitle:"",customStyles:null==h?void 0:h.aiReasoningAccordion,alwaysOpen:null===(T=null==Q?void 0:Q.reasoningAlwaysOpen)||void 0===T||T,defaultOpen:null===(U=null==Q?void 0:Q.reasoningDefaultOpen)||void 0===U||U,content:i(t,{message:(null==p?void 0:p.reason)||"No reasoning available.",customStyles:null==h?void 0:h.aiReasoningMarkdown,citationStyles:{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},customIcons:f,big_enough_block:w})}),i("div",{className:c.divider,style:null===(V=null==h?void 0:h.aiReasoningContent)||void 0===V?void 0:V.divider}),i(l,{icon:i("div",{className:c.iconWrapper,style:null===(q=null==h?void 0:h.aiReasoningContent)||void 0===q?void 0:q.iconWrapper,children:Z}),title:null!==(L=null==b?void 0:b.gapHeader)&&void 0!==L?L:"Gaps in Decision",subTitle:"",customStyles:null==h?void 0:h.aiReasoningAccordion,alwaysOpen:null!==(z=null==Q?void 0:Q.gapAlwaysOpen)&&void 0!==z&&z,defaultOpen:null!==(J=null==Q?void 0:Q.gapDefaultOpen)&&void 0!==J&&J,isUpdatedSegment:A,content:i(t,{message:(ni=p.relevance_score,ei=(null==p?void 0:p.gap)||"No gap available.",ni<100?`The decision strength is ${ni}% because: \n${ei}`:ei),customStyles:null==h?void 0:h.aiReasoningMarkdown,citationStyles:{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},customIcons:f,big_enough_block:w}),className:c.gapAccordion})]})}),B&&i("div",{className:c.footer,style:null===(K=null==h?void 0:h.aiReasoningContent)||void 0===K?void 0:K.footer,children:B})]});var ni,ei};export{m as default};
|
|
2
2
|
//# sourceMappingURL=AiReasoningCitationContent.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Loader2 as i}from"lucide-react";import{useState as t,useEffect as a}from"react";import{mapToHighlightAreas as o,citationViewerStyles as r}from"./pdfCitationUtils.js";import{useRequirementAI as n}from"../RequirementAIWrapper/RequirementAIWrapper.js";import l from"./pdfCitation.module.css.js";import d from"./CitationPdfViewer.js";function s({citation:s,isCitationLoading:c=!1,renderMode:u,pdfViewHeaderAction:g,citationId:f}){var h,m,p,v,C;const{queryClient:U,useGetSignedUrlQuery:w,useGetSignedUrlMutation:P}=n().apiCachingConfig,[V,_]=t(!1),x=null==s?void 0:s.customMetadata,y=null!==(h=null==x?void 0:x.value)&&void 0!==h?h:[],A=null!==(m=null==x?void 0:x.artifact_url)&&void 0!==m?m:"",j=null!==(p=null==x?void 0:x.artifact_title)&&void 0!==p?p:"",I=null!==(v=null==x?void 0:x.artifact_format)&&void 0!==v?v:"pdf",M=y.flatMap(e=>e.highlighted_text.map(e=>e.text)),N="docx"===I,S=["getSignedUrl",A],{data:D}=w(A,S),{mutate:H,isPending:q}=P(A),G=null!=D?D:"",R=!!A&&q&&!G;A||console.warn("Artifact preview details not found in header message or message data",A);return a(()=>{if(!A)return void _(!0);const e=U.getQueryData(S);e||q||H({gsUtilPath:A}),e&&_(!1)},[A,U,S,q,H]),a(()=>{G&&_(!1)},[G]),null!==(C=(()=>{try{const t=o(y),a=t.length>0;if(R||c)return e("div",{className:l.loaderContainer,children:e(i,{className:l.loaderIcon,size:28})});const n=y.some(e=>!!e.gs_url),s=y.some(e=>null!==e.page_no&&void 0!==e.page_no),h=y.some(e=>Array.isArray(e.highlighted_coordinates)&&e.highlighted_coordinates.length>0),m=t.length>0;return!(n||s||h||m)&&console.warn("No valid coordinates or gs_url found for this citation.",{hasValidGsUrl:n,hasValidPageNo:s,hasHighlightedCoords:h,hasCoordinatesPages:m,pages:y,artifactUrl:A}),(a||!s||V)&&(V||!a)?(console.warn("Error in loading PDF or no valid highlight coordinates found. Rendering fallback viewer without highlights.",{artifactUrl:A,hasValidCoordinates:a,coordinatesPages:t,pages:y}),e(d,{artifactUrl:A,pdfUrl:"",pdfName:j,pages:y,coordinatesPages:[],pdfViewHeaderAction:g,renderMode:null!=u?u:"fallback",isDocx:N,hasValidCoordinates:!1,customStyles:r,highlightText:M,citationId:f})):e(d,{artifactUrl:A,pdfUrl:G,pdfName:j,pages:y,coordinatesPages:t,pdfViewHeaderAction:g,renderMode:null!=u?u:"default",isDocx:N,hasValidCoordinates:a,jumpToPageValue:1,customStyles:r,highlightText:M,citationId:f})}catch(e){return console.warn("Error rendering citation",e),null}})())&&void 0!==C?C:null}export{s as default};
|
|
2
|
+
//# sourceMappingURL=CitationPdfRendererWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationPdfRendererWrapper.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Loader2 as i}from"lucide-react";import{PdfViewer as t}from"@e-llm-studio/citation";import{stringToNumber as o}from"./pdfCitationUtils.js";const a={pdfViewer:{height:"50%",maxHeight:"50%",display:"flex",flexDirection:"column",backgroundColor:"#FAFAFA",border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},pdfContainer:{flex:1,overflowY:"auto",padding:"8px"},header:{borderBottom:"1px solid #e5e7eb"}},l={pdfViewerWrapper:"shadow-sm"},r=()=>e("div",{className:"h-full flex items-center justify-center",children:e(i,{className:"animate-spin text-purple-500",size:28})}),n=({artifactUrl:i,pdfUrl:n,pdfName:s,pages:d,coordinatesPages:c,activeCitationIndex:f,onActiveCitationChange:h,pdfViewHeaderAction:p,isLoading:u,hasValidCoordinates:g,renderMode:m="default",useCoordinates:C=!0,jumpToPageValue:x,customStyles:b,customClasses:k,isDocx:v=!1,highlightText:A,citationId:w})=>{if(u)return e(r,{});const P=v||"fallback"===m?"":n,V="fallback"===m||!1===g?[]:c,j="fallback"!==m&&C,I=o(w),N=p?{icon:p.icon,tooltip:p.tooltip,onClick:()=>{p.onClick({artifactUrl:i,artifactId:i,fileName:null!=s?s:"",pages:d,currentCitationIndex:null!=I?I:0})}}:void 0;return e(t,{pdfUrl:P,pdfName:s,fallbackPages:d,highlightCordinatePages:V,highlightText:null!=A?A:[],highlightPages:{},useCoordinates:j,activeCitationIndex:f,headerAction:N,onActiveCitationChange:h,highlightColor:"oklch(0.78 0.16 95 / 0.35)",activeHighlightColor:"oklch(0.75 0.17 95 / 0.45)",jumpToPageValue:x,customStyles:null!=b?b:a,customClasses:null!=k?k:l})};export{n as default};
|
|
2
|
+
//# sourceMappingURL=CitationPdfViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationPdfViewer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import t from"../../../CitationRenderer/CitationRenderer.js";import i from"../../../RequirementAiCitations/AiReasoning/components/icons/DocumentCitationIcon.js";import o from"./CitationPdfRendererWrapper.js";const e=({title:e,citation:r,customIcons:c,customStyles:a,pdfViewHeaderAction:d})=>{var l;const m=null!==(l=null==c?void 0:c.ScannedDocumentIcon)&&void 0!==l?l:n(i,{});return n(t,{inLineCitation:!0,citationTitle:e,citationId:`scanned-doc-${r.citation_number}`,citationComponent:n(o,{citation:r,citationId:`${r.citation_number}`,pdfViewHeaderAction:d}),chevronDownComponent:m,chevronUpComponent:m,styles:{pillButton:{fontSize:"14px",margin:"0px",background:"#ffffff",color:"#526eff",cursor:"pointer",verticalAlign:"middle",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",border:"none",...null==a?void 0:a.pill},citationContent:{width:"100%",background:"transparent",minHeight:"10px",height:"fit-content",...null==a?void 0:a.content}}})};export{e as default};
|
|
2
2
|
//# sourceMappingURL=ScannedCitationRenderer.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={loaderContainer:"pdfCitation-module_loaderContainer__zqXic",loaderIcon:"pdfCitation-module_loaderIcon__3jTQ3",spin:"pdfCitation-module_spin__Ac7tQ"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".pdfCitation-module_loaderContainer__zqXic{align-items:center;display:flex;height:500px;justify-content:center}.pdfCitation-module_loaderIcon__3jTQ3{animation:pdfCitation-module_spin__Ac7tQ 1s linear infinite;color:#a855f7}@keyframes pdfCitation-module_spin__Ac7tQ{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}"));const n=document.head||document.getElementsByTagName("head")[0]||document.documentElement;n&&n.appendChild(e)}();export{e as default};
|
|
2
|
+
//# sourceMappingURL=pdfCitation.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfCitation.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=(e=[])=>Array.isArray(e)?null==e?void 0:e.flatMap(e=>{var i,r;const o=null==e?void 0:e.page_no;return!(null===(i=null==e?void 0:e.highlighted_coordinates)||void 0===i?void 0:i.length)&&o?[{pageNumber:o,pageIndex:o-1}]:o&&(null===(r=null==e?void 0:e.highlighted_coordinates)||void 0===r?void 0:r.length)?e.highlighted_coordinates.map(e=>({pageIndex:o-1,pageNumber:o,left:100*e.xmin,top:100*e.ymin,width:100*(e.xmax-e.xmin),height:100*(e.ymax-e.ymin)})):[]}):[],i={pdfViewer:{height:"550px",maxHeight:"550px",display:"flex",flexDirection:"column",backgroundColor:"#FAFAFA",border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},pdfContainer:{flex:1,overflowY:"auto",padding:"8px"},header:{borderBottom:"1px solid #e5e7eb"}};function r(e,i=0){if("number"==typeof e)return Number.isFinite(e)?e:i;if(!e||"string"!=typeof e||!e.trim())return i;let r="";try{r=e.trim().replace(/[^\d.-]/g,"").replace(/(?!^)-/g,"")}catch(e){return console.error("Regex processing failed",e),i}const o=Number(r);return Number.isFinite(o)?o:i}export{i as citationViewerStyles,e as mapToHighlightAreas,r as stringToNumber};
|
|
2
|
+
//# sourceMappingURL=pdfCitationUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfCitationUtils.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/features/RequirementAI/components/citations/chat-citation/ChatCitationRenderer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{ChatCitation as i,CitationRenderer as
|
|
1
|
+
import{jsx as t,jsxs as n,Fragment as e}from"react/jsx-runtime";import{ChatCitation as i,CitationRenderer as o}from"@e-llm-studio/citation";import r from"dayjs";import{stripHtmlAndMetadata as l}from"../../../utils/helpers.js";import c,{memo as a,useState as s,useRef as u,useCallback as d,useMemo as m,useEffect as p}from"react";const h=t=>{var n,e;return null!==(e=null!==(n=t.message)&&void 0!==n?n:t.content)&&void 0!==e?e:""},v=t=>{var n;return null!==(n=t.highlighted_text)&&void 0!==n?n:""},f=(t,n)=>{if(t.length!==n.length)return!1;for(let e=0;e<t.length;e+=1){const i=t[e],o=n[e];if(i.role!==o.role)return!1;if(h(i)!==h(o))return!1;if(v(i)!==v(o))return!1;if((i.timeStamp?String(i.timeStamp):"")!==(o.timeStamp?String(o.timeStamp):""))return!1}return!0},y=t=>{var n;return null==t?"":"string"==typeof t||"number"==typeof t?String(t):Array.isArray(t)?t.map(y).join(""):c.isValidElement(t)?y(null===(n=t.props)||void 0===n?void 0:n.children):""};var g=a(c=>{var a,y;const[g,C]=s(0),S=u(null),b=d(()=>{var t;null===(t=c.onCitationClick)||void 0===t||t.call(c,c.isTable)},[c.onCitationClick,c.isTable]),w=c.chatCitationProps,{chatContainer:k,rootContainer:x,...I}=null!=w?w:{},A=u(null),T=u([]);A.current&&f(A.current,c.chatHistory)||(A.current=c.chatHistory,T.current=c.chatHistory.map(t=>{const n=h(t),e=v(t);return{...t,message:l(n),timeStamp:r(t.timeStamp),highlighted_text:l(e)}}));const H=T.current,D=m(()=>({relevanceScore:100,...x}),[x]),E=m(()=>({summarizedTab:{chip:{show:!1,isActive:!1}},detailedTab:{chip:{isActive:!0}},...k,chatData:H}),[k,H]),F=m(()=>{var t,n;return{pillButton:{fontSize:"14px",margin:"0px",background:"#ffffff",color:"#526eff",cursor:"pointer",verticalAlign:"middle",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",border:"none",...null===(t=c.customStyles)||void 0===t?void 0:t.pill},citationContent:{width:"100%",background:"transparent",minHeight:"10px",height:"fit-content",color:"black",...null===(n=c.customStyles)||void 0===n?void 0:n.content}}},[c.customStyles]),j=m(()=>t(i,{rootContainer:D,chatContainer:E,...I}),[D,E]);p(()=>{if(!g)return;const t=window.innerWidth-document.documentElement.clientWidth;document.body.style.overflow="hidden",document.body.style.paddingRight=`${t}px`;const n=window.requestAnimationFrame(()=>{const t=S.current,n=null==t?void 0:t.querySelector(".lucide-maximize-2, svg[class*='maximize']"),e=null==n?void 0:n.parentElement;null==e||e.click()});return()=>{window.cancelAnimationFrame(n),document.body.style.overflow="auto",document.body.style.paddingRight="0px"}},[g]);const z=d(t=>{t.preventDefault(),t.stopPropagation(),b(),C(t=>t+1)},[b]);return!0===c.openInFullscreenOnClick?n(e,{children:[t("span",{onClick:z,style:F.pillButton,role:"button",tabIndex:0,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||z(t)},children:c.title}),g>0&&t("div",{ref:S,"aria-hidden":"true",style:{position:"fixed",left:-1e4,top:-1e4,width:1,height:1,opacity:0,pointerEvents:"none",overflow:"hidden"},children:j},g)]}):t("span",{onClickCapture:b,children:t(o,{inLineCitation:!0,citationTitle:c.title,chevronUpComponent:null===(a=c.customIcon)||void 0===a?void 0:a.chevronUp,chevronDownComponent:null===(y=c.customIcon)||void 0===y?void 0:y.chevronDown,citationComponent:j,styles:F})})},(t,n)=>t.isTable===n.isTable&&(t.onCitationClick===n.onCitationClick&&(t.customIcon===n.customIcon&&(t.customStyles===n.customStyles&&(t.chatCitationProps===n.chatCitationProps&&(t.openInFullscreenOnClick===n.openInFullscreenOnClick&&(!!f(t.chatHistory,n.chatHistory)&&y(t.title)===y(n.title))))))));export{g as default};
|
|
2
2
|
//# sourceMappingURL=ChatCitationRenderer.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useState as t,useEffect as o,useMemo as n}from"react";import i from"@mui/material/Dialog";import s from"@mui/material/DialogTitle";import a from"@mui/material/DialogContent";import c from"@mui/material/DialogActions";import m from"@mui/material/IconButton";import r from"@mui/material/Radio";import{X as d,Info as u}from"lucide-react";import p from"./deleteSegmentDialog.module.css.js";const y=[{key:"this-segment",label:"This segment"},{key:"all-occurrences",label:"All occurrences of this segment"}],h=({open:h,onHide:v,onDelete:f,customDeleteStyles:b,customDeleteIcons:N})=>{const[g,k]=t(null),[D,C]=t(!1),x=(null==N?void 0:N.closeIcon)||e(d,{size:20}),B=(null==N?void 0:N.infoIcon)||e(u,{className:p.infoIcon});o(()=>{h&&(k(null),C(!1))},[h]);const T=n(()=>y.map(e=>({...e,label:"all-occurrences"===e.key?`${e.label}`:e.label})),[]),$=!g||D;return l(i,{open:h,onClose:v,maxWidth:!1,PaperProps:{className:p.paper,style:null==b?void 0:b.paper},children:[l(s,{className:p.title,style:null==b?void 0:b.title,children:[e("span",{className:p.titleText,style:null==b?void 0:b.titleText,children:"Delete Segment"}),e(m,{"aria-label":"close",onClick:v,className:p.closeButton,style:null==b?void 0:b.closeButton,children:x})]}),l(a,{className:p.content,style:null==b?void 0:b.content,children:[e("p",{className:p.subtitle,style:null==b?void 0:b.subtitle,children:"Choose what you'd like to delete."}),e("div",{className:p.optionsContainer,style:null==b?void 0:b.optionsContainer,children:T.map(t=>{const o=g===t.key;return l("label",{htmlFor:`delete-segment-${t.key}`,className:`${p.optionLabel} ${o?p.optionSelected:""}`,style:{...null==b?void 0:b.optionLabel,...o?null==b?void 0:b.optionSelected:{}},children:[e(r,{inputProps:{id:`delete-segment-${t.key}`},name:"delete-segment-scope",value:t.key,checked:o,onChange:()=>k(t.key),className:p.radio}),e("span",{className:p.optionText,style:null==b?void 0:b.optionText,children:t.label})]},t.key)})}),l("div",{className:p.infoRow,style:null==b?void 0:b.infoRow,children:[B,e("span",{className:p.infoText,style:null==b?void 0:b.infoText,children:"This action permanently deletes the selected segment(s) and cannot be undone."})]})]}),l(c,{className:p.actions,style:null==b?void 0:b.actions,children:[e("button",{onClick:v,disabled:D,className:p.cancelButton,style:null==b?void 0:b.cancelButton,children:"Cancel"}),l("button",{onClick:async()=>{if(g){C(!0);try{await f(g),v()}finally{C(!1)}}},disabled:$,className:`${p.deleteButton} ${$?p.deleteButtonDisabled:""}`,style:{...null==b?void 0:b.deleteButton,...$?null==b?void 0:b.deleteButtonDisabled:{}},children:[D&&e("span",{className:p.spinner}),"Delete segment"]})]})]})};export{h as default};
|
|
2
|
+
//# sourceMappingURL=DeleteSegmentsDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteSegmentsDialog.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as l,useEffect as o}from"react";import n from"@mui/material/Dialog";import i from"@mui/material/DialogTitle";import s from"@mui/material/DialogContent";import a from"@mui/material/DialogActions";import r from"@mui/material/IconButton";import{X as m}from"lucide-react";import c from"./deleteSegmentDialog.module.css.js";import u from"./segment.module.css.js";const d=({open:d,onHide:p,onConfirm:h,customStyles:y,customIcons:g})=>{const[f,v]=l(!1),N=(null==g?void 0:g.closeIcon)||e(m,{size:20});o(()=>{d&&v(!1)},[d]);return t(n,{open:d,onClose:p,maxWidth:!1,PaperProps:{className:c.paper,style:null==y?void 0:y.paper},children:[t(i,{className:c.title,style:null==y?void 0:y.title,children:[e("span",{className:c.titleText,style:null==y?void 0:y.titleText,children:"Rename this segment everywhere?"}),e(r,{"aria-label":"close",onClick:p,className:c.closeButton,style:null==y?void 0:y.closeButton,children:N})]}),e(s,{className:c.content,style:null==y?void 0:y.content,children:t("p",{className:c.subtitle,style:{marginBottom:"24px",color:"#475569",...null==y?void 0:y.subtitle},children:["Renaming this segment will update its name across all ",e("strong",{children:"occurrences"})," where it is used. Do you want to continue?"]})}),t(a,{className:c.actions,style:null==y?void 0:y.actions,children:[e("button",{onClick:p,disabled:f,className:c.cancelButton,style:null==y?void 0:y.cancelButton,children:"Cancel"}),t("button",{onClick:async()=>{v(!0);try{await h(),p()}catch(e){console.error("Failed to rename segment:",e)}finally{v(!1)}},disabled:f,className:u.renameButton,style:{...null==y?void 0:y.renameButton},children:[f&&e("span",{className:c.spinner}),"Rename segment"]})]})]})};export{d as default};
|
|
2
|
+
//# sourceMappingURL=EditSegmentDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditSegmentDialog.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import l,{useContext as o,useMemo as i}from"react";import{Pencil as a,Check as s,X as r,ArrowUpRight as d,Trash2 as c}from"lucide-react";import{cn as m}from"../../../UserStoryImport/lib/cn.js";import p from"./segment.module.css.js";import u from"./deleteSegmentDialog.module.css.js";import g from"./ExampleComponentWrapper.js";import y from"../ai-reasoning/AiReasoningCitationContent.js";import h from"./SegmentLoader.js";import"./segment-common.css.js";import{MarkdownStateContext as v}from"../../store/markdown-context.js";import f from"@mui/material/Dialog";import C from"@mui/material/IconButton";import S from"./DeleteSegmentsDialog.js";import x from"@mui/material/Tooltip";import b from"./EditSegmentDialog.js";const I=({id:I="Segment",label:E,children:w,segmentUUID:D,decisionStrength:N=80,aiReason:k,customStyles:j,customIcons:B,aiReasoningCitationCustomStyles:$,segmentExampleComponent:z,handleViewGlossary:L,isUpdatedSegment:W,onOpen:A,onDelete:R,onEdit:U,customDeleteStyles:M,customDeleteIcons:T,enabledSegmentActions:G})=>{var V,F;const{citationsMetadata:H,updateCitationsMetadata:K}=o(v),[O,q]=l.useState(!1),[J,P]=l.useState(!1),[Q,X]=l.useState(!1),[Y,Z]=l.useState(""),[_,ee]=l.useState(!1),{prefix:te,inner:ne}=i(()=>(e=>{const t=e.match(/^(.*?)\s*\{([^}]+)\}\s*$/);return!t||t.length<3?{prefix:"",inner:e}:{prefix:t[1].trim(),inner:t[2].trim()}})(null!=E?E:""),[E]);l.useEffect(()=>{Q||Z(ne)},[Q,ne]);const le=async()=>{if(U){const e=Y.toLowerCase();await U(e)}X(!1),ee(!1)},oe=()=>X(!1),ie=(null==T?void 0:T.editIcon)||e(a,{size:14}),ae=(null==T?void 0:T.checkIcon)||e(s,{size:16,color:"#16A34A"}),se=(null==T?void 0:T.crossIcon)||e(r,{size:16,color:"#DC2626"}),re=i(()=>H.get(D),[H,D]),de=i(()=>(null==re?void 0:re.open)||!1,[re]),ce=i(()=>re&&"loading"===re.state,[re]),me=async()=>{const e=!de;if(q(!1),console.log("citation metadata::",e,k),e&&!(null==k?void 0:k.reason)){K(D,t=>{if(t){const e={...t};return e.state="loading",e}return{open:e,state:"loading"}});try{console.log("citation metadata:: onopen"),await(null==A?void 0:A())}finally{K(D,t=>{if(t){const n={...t};return n.state="ready",n.open=e,n}return{open:e,state:"ready"}})}}else console.log("citation metadata:: else block"),K(D,t=>{if(t){const n={...t};return n.open=e,n}return{open:e,state:ce?"loading":"ready"}})};return t("div",{className:`segment-wrapper-${I} ${p.segmentWrapper}`,style:{...null==j?void 0:j.segmentWrapper,display:"inline-flex",verticalAlign:"middle"},children:[t("div",{className:`segment-${I}-container segmentContainer ${W?"updatedSegmentContainer":""}`,style:{...null==j?void 0:j.container},children:[e("span",{className:`segment-${I} segmentLabel ${W?"updatedSegmentLabel":""}`,style:{...null==j?void 0:j.label},children:W?w:E}),e("button",{className:`${p.segmentExplanationButtonContainer}`,style:{...null==j?void 0:j.buttonContainer},onClick:me,children:e(d,{className:m(W&&p.updatedChevronIcon,p.cheveronIcon),style:{...null==j?void 0:j.cheveronIcon}})})]}),de&&e(f,{open:!0,onClose:me,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",maxWidth:"xl",container:document.getElementById("#root"),children:t("div",{style:{minWidth:"50vw",paddingLeft:16,paddingRight:16,paddingTop:24,paddingBottom:24},children:[t("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[t("div",Q?{style:{display:"flex",alignItems:"center",gap:"8px"},children:[te&&e("span",{className:"segmentLabel",style:{fontSize:18,fontWeight:600,...null==j?void 0:j.label},children:te}),t("div",{className:p.editInputWrapper,style:null==j?void 0:j.editInputWrapper,children:[e("input",{value:Y,onChange:e=>Z(e.target.value),className:p.editInput,style:{...null==j?void 0:j.editInput,color:(null===(V=null==j?void 0:j.label)||void 0===V?void 0:V.color)?String(j.label.color):"#3B82F6",textTransform:"uppercase"},autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&le(),"Escape"===e.key&&oe()}}),e(C,{onClick:()=>{Y!==ne?(K(D,e=>e?{...e,open:!1}:{open:!1,state:ce?"loading":"ready"}),ee(!0)):X(!1)},size:"small",style:null==j?void 0:j.editCheckIcon,children:ae}),e(C,{onClick:oe,size:"small",style:null==j?void 0:j.editCrossIcon,children:se})]})]}:{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e("span",{className:"segmentLabel",style:{fontSize:18,fontWeight:600,...null==j?void 0:j.label},children:null!=E?E:"SEGMENT NAME"}),(null==G?void 0:G.includes("edit"))&&e(x,{title:"Edit segment",placement:"top",arrow:!0,children:e("button",{onClick:()=>X(!0),className:p.headerEditButton,style:null==j?void 0:j.editIconButton,children:ie})})]}),t("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0,...null==j?void 0:j.headerActionsContainer},children:[(null==G?void 0:G.includes("delete"))&&e(x,{title:"Delete segment",placement:"top",arrow:!0,children:t("button",{onClick:()=>{q(!1),P(!0),K(D,e=>{if(e){const t={...e};return t.open=!1,t}return{open:!1,state:ce?"loading":"ready"}})},className:u.headerDeleteButton,children:[e(c,{size:14}),"Delete"]})}),e(C,{"aria-label":"close",onClick:me,sx:e=>({padding:"4px",color:e.palette.grey[500]}),children:e(r,{size:20})})]})]}),ce?e(h,{customStyles:null==j?void 0:j.loadingSkeleton}):t(n,{children:[O&&!W&&e("div",{style:{marginBottom:16},children:e(g,{label:null!=E?E:"",segmentExampleComponent:z,customStyles:{...null==j?void 0:j.segmentExample,exampleContainer:{...null===(F=null==j?void 0:j.segmentExample)||void 0===F?void 0:F.exampleContainer,width:"100%"}},handleCancelExample:()=>{q(!1)}})}),W&&e("div",{style:{marginBottom:16},children:e("div",{className:`segment-${I}-container segmentContainer updatedSegmentContainer`,style:{...null==j?void 0:j.container},children:e("span",{className:`segment-${I} segmentLabel updatedSegmentLabel`,style:{...null==j?void 0:j.label},children:w})})}),e("div",{children:e(y,{aiReason:k,customStyles:{...$,aiReasoningContent:{...null==$?void 0:$.aiReasoningContent,headerBar:{width:"auto"}},aiReasoningAccordion:{header:{width:"auto"}}},customIcons:B,isSegmentExplanation:!0,handleViewGlossary:L?()=>{K(D,e=>{if(e){const t={...e};return t.open=!1,t}return{open:!1,state:ce?"loading":"ready"}}),null==L||L(I)}:void 0,handleViewExample:z?()=>{q(!0)}:void 0,isUpdatedSegment:W})})]})]})}),e(S,{open:J,onHide:()=>{P(!1)},customDeleteStyles:M,customDeleteIcons:T,onDelete:async e=>{await(null==R?void 0:R(e))}}),e(b,{open:_,onHide:()=>{ee(!1),X(!1)},customStyles:M,customIcons:T,onConfirm:le})]})};export{I as default};
|
|
2
2
|
//# sourceMappingURL=Segment.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import n from"./Segment.js";import t from"dompurify";const
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import n from"./Segment.js";import t from"dompurify";const o=({id:o,children:l,props:i,segmentComponentConfig:d,customStyles:s,customIcons:a,extractText:u,isUpdatedSegment:r=!1,blockId:v,customDeleteStyles:m,customDeleteIcons:g})=>{var c,p,S,h,I,C,y,D,b,f,x,_,E,U,W,k,A,F,L;const w=(null==i?void 0:i.id)||"Segment",R=(null==i?void 0:i.decisionstrength)||"80",{segmentDataList:j,getSegmentExampleComponent:B,handleViewGlossary:G,upadatedSegmentDataList:O,handleFetchUpdatedSegmentDetails:T,handleFetchSegmentDetails:V,handleDeleteSegment:z,handleEditSegment:H,enabledSegmentActions:M}=d||{},q=r?null==O?void 0:O.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==w?void 0:w.split("-"))||void 0===n?void 0:n[0])}):null==j?void 0:j.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==w?void 0:w.split("-"))||void 0===n?void 0:n[0])}),J={id:w,reason:null!==(c=null==q?void 0:q.reason)&&void 0!==c?c:"",gap:null!==(p=null==q?void 0:q.gap)&&void 0!==p?p:"",explanation:null!==(S=null==q?void 0:q.explanation)&&void 0!==S?S:"",relevance_score:null!==(h=null==q?void 0:q.relevance_score)&&void 0!==h?h:0,isOpen:!1};let K;const N=u(l),P=i["data-table"];let Q="";if(P&&!r)try{Q=decodeURIComponent(atob(P))}catch(e){console.error("Failed to decode data-table for segment",w,e)}const X=t.sanitize(Q),Y=()=>e("div",{dangerouslySetInnerHTML:{__html:X}});return q||!V||r||null==V||V(w),w&&q&&B&&!r&&(K=P?e(Y,{}):B(w,N,q.segment_type)),e(n,{id:w,segmentUUID:o,label:null!==(I=null==q?void 0:q.label)&&void 0!==I?I:null==q?void 0:q.segment_name,decisionStrength:R,aiReason:J,customIcons:a,aiReasoningCitationCustomStyles:s,segmentExampleComponent:K,handleViewGlossary:G,customStyles:{segmentWrapper:null===(C=null==s?void 0:s.segment)||void 0===C?void 0:C.segmentWrapper,container:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.container,label:null===(D=null==s?void 0:s.segment)||void 0===D?void 0:D.label,decisionStrength:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.decisionStrength,buttonContainer:null===(f=null==s?void 0:s.segment)||void 0===f?void 0:f.buttonContainer,cheveronIcon:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.cheveronIcon,segmentExample:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.segmentExample,loadingSkeleton:null===(E=null==s?void 0:s.segment)||void 0===E?void 0:E.SegmentLoadingSkeletonStyles,editInputWrapper:null===(U=null==s?void 0:s.segment)||void 0===U?void 0:U.editInputWrapper,editInput:null===(W=null==s?void 0:s.segment)||void 0===W?void 0:W.editInput,editCheckIcon:null===(k=null==s?void 0:s.segment)||void 0===k?void 0:k.editCheckIcon,editCrossIcon:null===(A=null==s?void 0:s.segment)||void 0===A?void 0:A.editCrossIcon,headerActionsContainer:null===(F=null==s?void 0:s.segment)||void 0===F?void 0:F.headerActionsContainer,editIconButton:null===(L=null==s?void 0:s.segment)||void 0===L?void 0:L.editIconButton},isUpdatedSegment:r,onOpen:async()=>{!q&&r&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),await(null==T?void 0:T(w)))},onDelete:e=>{if(console.log("SegmentWrapper: onDelete",e,{...q,segment_uuid:w},v),q)return null==z?void 0:z(e,{...q,segment_uuid:w},v)},onEdit:e=>{if(console.log("SegmentWrapper: onEdit",q,e),q&&H)return null==H?void 0:H(q,e)},customDeleteStyles:m,customDeleteIcons:g,enabledSegmentActions:M,children:l},w)};export{o as default};
|
|
2
2
|
//# sourceMappingURL=SegmentWrapper.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={paper:"deleteSegmentDialog-module_paper__lRyck",title:"deleteSegmentDialog-module_title__Lw6--",titleText:"deleteSegmentDialog-module_titleText__-96hW",closeButton:"deleteSegmentDialog-module_closeButton__KuSd9",content:"deleteSegmentDialog-module_content__f909m",subtitle:"deleteSegmentDialog-module_subtitle__mNRwe",optionsContainer:"deleteSegmentDialog-module_optionsContainer__WOG18",optionLabel:"deleteSegmentDialog-module_optionLabel__3NwkJ",optionSelected:"deleteSegmentDialog-module_optionSelected__XN5c-",radio:"deleteSegmentDialog-module_radio__a0BAt",optionText:"deleteSegmentDialog-module_optionText__j6JEW",infoIcon:"deleteSegmentDialog-module_infoIcon__tPanl",infoRow:"deleteSegmentDialog-module_infoRow__SWCp8",infoText:"deleteSegmentDialog-module_infoText__Yg-sI",actions:"deleteSegmentDialog-module_actions__M93kR",cancelButton:"deleteSegmentDialog-module_cancelButton__e79NB",deleteButton:"deleteSegmentDialog-module_deleteButton__ovuoP",deleteButtonDisabled:"deleteSegmentDialog-module_deleteButtonDisabled__OdVY5",headerDeleteButton:"deleteSegmentDialog-module_headerDeleteButton__0GqvY",spinner:"deleteSegmentDialog-module_spinner__8uhh0",spin:"deleteSegmentDialog-module_spin__tJyu0"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".deleteSegmentDialog-module_paper__lRyck{border-radius:12px;max-width:calc(100vw - 32px);width:845px}.deleteSegmentDialog-module_title__Lw6--{padding:24px 32px 16px;position:relative}.deleteSegmentDialog-module_titleText__-96hW{color:#101828;font-family:Inter,sans-serif;font-size:18px;font-weight:600;line-height:28px}.deleteSegmentDialog-module_title__Lw6-- .deleteSegmentDialog-module_closeButton__KuSd9{background:#0000!important;color:#64748b!important;padding:4px!important;position:absolute!important;right:20px!important;top:20px!important}.deleteSegmentDialog-module_content__f909m{padding:0 32px 8px}.deleteSegmentDialog-module_subtitle__mNRwe{color:#334155;font-family:Inter,sans-serif;font-size:16px;font-weight:500;line-height:130%;margin:0 0 24px;overflow:hidden;text-overflow:ellipsis}.deleteSegmentDialog-module_optionsContainer__WOG18{display:flex;flex-direction:column;gap:10px}.deleteSegmentDialog-module_optionLabel__3NwkJ{align-items:center;align-self:stretch;background:#0000;border-radius:8px;cursor:pointer;display:flex;gap:16px;padding:8px;transition:background .15s ease}.deleteSegmentDialog-module_optionSelected__XN5c-{background:#f4f3ff}.deleteSegmentDialog-module_radio__a0BAt{height:16px;width:16px}.deleteSegmentDialog-module_radio__a0BAt .MuiSvgIcon-root{font-size:16px}.deleteSegmentDialog-module_radio__a0BAt.Mui-checked{color:#5928ed!important}.deleteSegmentDialog-module_optionText__j6JEW{color:#334155;font-family:Inter,sans-serif;font-size:16px;font-weight:600;line-height:130%;overflow:hidden;text-overflow:ellipsis}.deleteSegmentDialog-module_infoIcon__tPanl{color:#475569;flex-shrink:0;height:14px;width:14px}.deleteSegmentDialog-module_infoRow__SWCp8{align-items:center;display:flex;gap:8px;margin-top:24px}.deleteSegmentDialog-module_infoText__Yg-sI{color:#475569;font-family:Inter,sans-serif;font-size:14px;font-weight:400;line-height:130%;overflow:hidden;text-overflow:ellipsis}.deleteSegmentDialog-module_actions__M93kR{border-top:1px solid #e5e7eb;display:flex;gap:16px;justify-content:flex-end;padding:20px 32px 18px}.deleteSegmentDialog-module_cancelButton__e79NB{background:#0000;border:1px solid #e2e8f0;border-radius:6px;color:#64748b;min-width:96px}.deleteSegmentDialog-module_cancelButton__e79NB,.deleteSegmentDialog-module_deleteButton__ovuoP{align-items:center;cursor:pointer;display:flex;font-family:Inter,sans-serif;font-size:15.75px;font-weight:500;gap:7px;height:40px;justify-content:center;padding:8.75px 12.25px}.deleteSegmentDialog-module_deleteButton__ovuoP{background:#ef4444;border:1px solid #ef4444;border-radius:6px;color:#fff;min-width:176px}.deleteSegmentDialog-module_deleteButtonDisabled__OdVY5{cursor:not-allowed;opacity:.7}.deleteSegmentDialog-module_headerDeleteButton__0GqvY{align-items:center;background:#0000;border:none;border-radius:6px;color:#ef4444;cursor:pointer;display:flex;font-size:14px;font-weight:500;gap:4px;height:32px;justify-content:center;padding:6px 10px;transition:opacity .2s ease}.deleteSegmentDialog-module_headerDeleteButton__0GqvY:hover{opacity:.7}.deleteSegmentDialog-module_spinner__8uhh0{animation:deleteSegmentDialog-module_spin__tJyu0 1s linear infinite;border:2px solid #fff;border-radius:9999px;border-top-color:#0000;display:inline-block;height:16px;margin-right:8px;width:16px}@keyframes deleteSegmentDialog-module_spin__tJyu0{to{transform:rotate(1turn)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}();export{e as default};
|
|
2
|
+
//# sourceMappingURL=deleteSegmentDialog.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteSegmentDialog.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={segmentWrapper:"segment-module_segmentWrapper__PVOuq",segmentButtonContainer:"segment-module_segmentButtonContainer__X76sx",cheveronIcon:"segment-module_cheveronIcon__1njFy",updatedChevronIcon:"segment-module_updatedChevronIcon__8vN-t",cheveronIconRotated:"segment-module_cheveronIconRotated__qDYj7",segmentPopup:"segment-module_segmentPopup__YcHor",explanationPanel:"segment-module_explanationPanel__7YlpU",exampleWrapper:"segment-module_exampleWrapper__ptZzj",uppercase:"segment-module_uppercase__hjgxG",exampleContainer:"segment-module_exampleContainer__9tMXx",exampleHeader:"segment-module_exampleHeader__9P11O",loaderWrapper:"segment-module_loaderWrapper__SwIof",loaderContainer:"segment-module_loaderContainer__5Mhyz",loaderHeader:"segment-module_loaderHeader__J2JnY",skeleton:"segment-module_skeleton__2uZEf",pulse:"segment-module_pulse__A17cR",title:"segment-module_title__fW93U",icon:"segment-module_icon__Dvee3",lineFull:"segment-module_lineFull__MMmOD",line90:"segment-module_line90__OFStl",line75:"segment-module_line75__9r6Xp",line60:"segment-module_line60__bLRec",exampleHeaderText:"segment-module_exampleHeaderText__MWMG0",cancelButton:"segment-module_cancelButton__-F5aZ",spinner:"segment-module_spinner__kRnWD",spin:"segment-module_spin__MV6y5"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const
|
|
1
|
+
var e={segmentWrapper:"segment-module_segmentWrapper__PVOuq",segmentButtonContainer:"segment-module_segmentButtonContainer__X76sx",cheveronIcon:"segment-module_cheveronIcon__1njFy",updatedChevronIcon:"segment-module_updatedChevronIcon__8vN-t",cheveronIconRotated:"segment-module_cheveronIconRotated__qDYj7",segmentPopup:"segment-module_segmentPopup__YcHor",explanationPanel:"segment-module_explanationPanel__7YlpU",exampleWrapper:"segment-module_exampleWrapper__ptZzj",uppercase:"segment-module_uppercase__hjgxG",exampleContainer:"segment-module_exampleContainer__9tMXx",exampleHeader:"segment-module_exampleHeader__9P11O",loaderWrapper:"segment-module_loaderWrapper__SwIof",loaderContainer:"segment-module_loaderContainer__5Mhyz",loaderHeader:"segment-module_loaderHeader__J2JnY",skeleton:"segment-module_skeleton__2uZEf",pulse:"segment-module_pulse__A17cR",title:"segment-module_title__fW93U",icon:"segment-module_icon__Dvee3",lineFull:"segment-module_lineFull__MMmOD",line90:"segment-module_line90__OFStl",line75:"segment-module_line75__9r6Xp",line60:"segment-module_line60__bLRec",exampleHeaderText:"segment-module_exampleHeaderText__MWMG0",cancelButton:"segment-module_cancelButton__-F5aZ",spinner:"segment-module_spinner__kRnWD",spin:"segment-module_spin__MV6y5",editInputWrapper:"segment-module_editInputWrapper__Iny48",editInput:"segment-module_editInput__wFRUd",headerEditButton:"segment-module_headerEditButton__2X7yD",renameButton:"segment-module_renameButton__uOV00"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".segment-module_segmentWrapper__PVOuq{display:flex;flex-direction:column;gap:8px}.segment-module_segmentButtonContainer__X76sx{background-color:initial;border:none;cursor:pointer;padding:0}.segment-module_cheveronIcon__1njFy{color:#3b82f6;height:16px;transition:all .2s ease-in-out;width:16px}.segment-module_updatedChevronIcon__8vN-t{color:#16a34a}.segment-module_cheveronIconRotated__qDYj7{transform:rotate(180deg)}.segment-module_segmentPopup__YcHor{left:0;min-width:500px;position:absolute;top:calc(100% + 8px);z-index:1000}.segment-module_explanationPanel__7YlpU{background:#fff;left:0;position:absolute;top:100%;width:600px;z-index:100}.segment-module_exampleWrapper__ptZzj{align-items:flex-start;display:flex;flex-direction:column;gap:12px}.segment-module_uppercase__hjgxG{text-transform:uppercase}.segment-module_exampleContainer__9tMXx{align-items:flex-start;border:2px dashed #e2e8f0;border-radius:8px;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;padding:16px;width:100%}.segment-module_exampleHeader__9P11O{align-items:center;align-self:stretch;display:flex;justify-content:space-between}.segment-module_loaderContainer__5Mhyz,.segment-module_loaderWrapper__SwIof{border:1px solid #e5e7eb;border-radius:8px;padding:12px}.segment-module_loaderHeader__J2JnY{align-items:center;display:flex;justify-content:space-between;margin-bottom:16px}.segment-module_skeleton__2uZEf{animation:segment-module_pulse__A17cR 1.5s ease-in-out infinite;background:#e5e7eb;border-radius:6px}.segment-module_title__fW93U{height:18px;width:100px}.segment-module_icon__Dvee3{height:18px;width:18px}.segment-module_lineFull__MMmOD{height:14px;margin-bottom:10px;width:100%}.segment-module_line90__OFStl{height:14px;margin-bottom:10px;width:90%}.segment-module_line75__9r6Xp{height:14px;margin-bottom:10px;width:75%}.segment-module_line60__bLRec{height:14px;width:60%}@keyframes segment-module_pulse__A17cR{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.segment-module_exampleHeaderText__MWMG0{color:#334155;font-size:14px;font-weight:600;line-height:21px;margin:0}.segment-module_cancelButton__-F5aZ{align-items:center;align-self:stretch;background-color:initial;border:none;color:#334155;cursor:pointer;display:flex;height:fit-content;justify-content:space-between;padding:4px;transition:all .2s ease-in-out}.segment-module_cancelButton__-F5aZ:hover{background-color:#eff6ff}.segment-module_spinner__kRnWD{animation:segment-module_spin__MV6y5 1s linear infinite}.segment-module_editInputWrapper__Iny48{align-items:center;background-color:initial;border:1px solid #5928ed;border-radius:6px;display:flex;gap:4px;padding:2px 8px;width:400px}.segment-module_editInput__wFRUd{background:#0000;border:none;color:#5928ed;flex-grow:1;font-size:18px;font-weight:600;min-width:300px;outline:none}.segment-module_headerEditButton__2X7yD{align-items:center;background:#f8fafc;border:none;border-radius:6px;color:#64748b;cursor:pointer;display:flex;height:32px;justify-content:center;padding:6px 10px;transition:all .2s ease-in-out}.segment-module_headerEditButton__2X7yD:hover{opacity:.7}.segment-module_renameButton__uOV00{align-items:center;background:#5928ed;border:1px solid #5928ed;border-radius:6px;color:#fff;cursor:pointer;display:flex;font-family:Inter,sans-serif;font-size:15.75px;font-weight:500;gap:7px;height:40px;justify-content:center;min-width:176px;padding:8.75px 12.25px}@keyframes segment-module_spin__MV6y5{to{transform:rotate(1turn)}}"));const n=document.head||document.getElementsByTagName("head")[0]||document.documentElement;n&&n.appendChild(e)}();export{e as default};
|
|
2
2
|
//# sourceMappingURL=segment.module.css.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as e,jsx as o,Fragment as n}from"react/jsx-runtime";import{useState as t,useRef as l,useEffect as i}from"react";import r from"../ai-reasoning/AiReasoningCitationContent.js";import s from"./CompletionPanel.module.css.js";import a from"../../icons/CDIcon.js";import{Loader2 as c,Check as m}from"lucide-react";const d=({customIcons:d,customStyles:p,currentUserStory:u,panelStyles:v,showPanel:C=!1,children:h,onToggleStateChange:k,completionPanelConfig:g})=>{var f,y,w,_,P;const[S,N]=t(!!C),I=null!==(f=null==u?void 0:u.completion_percentage)&&void 0!==f?f:0,D=l(null),M=l(null),{isMarkingComplete:B=!1,markedComplete:E=!1,onMarkAsComplete:j}=null!=g?g:{},x=()=>{N(!1),null==k||k(!1)},L=e=>{e.stopPropagation(),N(e=>{const o=!e;return null==k||k(o),o})};return i(()=>{if(!S)return;const e=e=>{M.current&&!M.current.contains(e.target)&&x()},o=e=>{"Escape"===e.key&&(N(!1),null==k||k(!1))};return document.addEventListener("mousedown",e,!0),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",e,!0),document.removeEventListener("keydown",o)}},[S,k]),e("div",{ref:M,className:s.triggerWrapper,style:null==v?void 0:v.triggerWrapperStyle,children:[!C&&o(n,{children:h?o("div",{className:s.completionButton,style:null==v?void 0:v.completionButtonStyle,onClick:L,children:h}):o("button",{ref:D,className:s.completionIconButton,style:null==v?void 0:v.completionIconButtonStyle,onClick:L,children:o(a,{})})}),S&&o("div",{className:`${s.dropdown} ${C?s.showPanelDropdown:""}`,style:{...null==v?void 0:v.dropdownStyle,...C?null==v?void 0:v.showPanelDropdownStyle:{}},onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:o(r,{aiReason:{explanation:(null===(y=u.completion_decision_factors)||void 0===y?void 0:y.explanation)||"",relevance_score:(null===(w=u.completion_decision_factors)||void 0===w?void 0:w.relevance_score)||0,reason:(null===(_=u.completion_decision_factors)||void 0===_?void 0:_.score_reason)||"",gap:(null===(P=u.completion_decision_factors)||void 0===P?void 0:P.gap)||"",id:"completion-cd"},customIcons:d,customStyles:p,footer:e("div",{className:s.markCompleteContainer,children:[o("h4",{className:s.markCompleteTitle,children:"Mark this section as complete?"}),e("p",{className:s.markCompleteDescription,children:["AI estimates this section is"," ",I,"% complete. If you're satisfied with the content, you can mark it as complete."]}),e("button",{className:s.markCompleteButton,disabled:B||E,onClick:e=>{e.stopPropagation(),null==j||j(),x()},children:[B?o(c,{size:18,className:s.markCompleteSpinner}):o(m,{size:18,strokeWidth:3,className:s.markCompleteIcon}),o("span",{children:E?"Marked Complete":"Mark as Complete"})]})]})})})]})};export{d as CompletionPanel,d as default};
|
|
2
2
|
//# sourceMappingURL=CompletionPanel.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={completionButton:"CompletionPanel-module_completionButton__ORlGC",triggerWrapper:"CompletionPanel-module_triggerWrapper__PdQj6",chevron:"CompletionPanel-module_chevron__XDcBW",
|
|
1
|
+
var e={completionButton:"CompletionPanel-module_completionButton__ORlGC",triggerWrapper:"CompletionPanel-module_triggerWrapper__PdQj6",chevron:"CompletionPanel-module_chevron__XDcBW",dropdown:"CompletionPanel-module_dropdown__7iQ-8",showPanelDropdown:"CompletionPanel-module_showPanelDropdown__LhOPy",completionIconButton:"CompletionPanel-module_completionIconButton__sI9MX",markCompleteContainer:"CompletionPanel-module_markCompleteContainer__9q--o",markCompleteTitle:"CompletionPanel-module_markCompleteTitle__EM4s4",markCompleteDescription:"CompletionPanel-module_markCompleteDescription__FqRzk",markCompleteButton:"CompletionPanel-module_markCompleteButton__Xh2IV",markCompleteIcon:"CompletionPanel-module_markCompleteIcon__1O7Zs",markCompleteSpinner:"CompletionPanel-module_markCompleteSpinner__t-6yz",spin:"CompletionPanel-module_spin__s8-Bm"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const o=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;o&&e.setAttribute("nonce",o),e.appendChild(document.createTextNode(".CompletionPanel-module_completionButton__ORlGC{align-items:center;cursor:pointer;display:inline-flex;gap:4px}.CompletionPanel-module_triggerWrapper__PdQj6{align-items:center;display:inline-flex;position:relative}.CompletionPanel-module_chevron__XDcBW{color:#64748b;flex-shrink:0;transition:transform .2s ease}.CompletionPanel-module_dropdown__7iQ-8{background:#fff;border:1px solid #cbd5e1;border-radius:12px;box-shadow:0 4px 12px #0f172a14,0 2px 4px #0f172a0a;left:0;max-width:660px;min-width:660px;overflow:hidden;position:absolute;top:calc(100% + 6px);width:660px;z-index:1000}.CompletionPanel-module_showPanelDropdown__LhOPy{left:0;max-width:100%;position:relative;top:0;width:100%}.CompletionPanel-module_completionIconButton__sI9MX{align-items:center;background:#0000;border:none;cursor:pointer;display:inline-flex;gap:4px;height:28px;justify-content:center;min-width:28px;padding:0}.CompletionPanel-module_markCompleteContainer__9q--o{background:#f9fafb;border-top:1px solid #e5e7eb;padding:20px 24px}.CompletionPanel-module_markCompleteTitle__EM4s4{color:#111827;font-size:16px;font-weight:600;margin:0}.CompletionPanel-module_markCompleteDescription__FqRzk{color:#6b7280;font-size:15px;line-height:1.5;margin:10px 0 18px}.CompletionPanel-module_markCompleteButton__Xh2IV{align-items:center;background:#16a34a;border:none;border-radius:8px;color:#fff;cursor:pointer;display:inline-flex;font-size:15px;font-weight:600;gap:8px;padding:10px 18px;transition:background .2s}.CompletionPanel-module_markCompleteButton__Xh2IV:hover{background:#15803d}.CompletionPanel-module_markCompleteButton__Xh2IV:disabled{cursor:not-allowed;opacity:.6}.CompletionPanel-module_markCompleteIcon__1O7Zs{flex-shrink:0}.CompletionPanel-module_markCompleteSpinner__t-6yz{animation:CompletionPanel-module_spin__s8-Bm 1s linear infinite;flex-shrink:0}@keyframes CompletionPanel-module_spin__s8-Bm{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}"));const n=document.head||document.getElementsByTagName("head")[0]||document.documentElement;n&&n.appendChild(e)}();export{e as default};
|
|
2
2
|
//# sourceMappingURL=CompletionPanel.module.css.js.map
|
package/dist/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as n,useCallback as r,useMemo as i,useEffect as a}from"react";import s from"showdown";import{useRequirementAI as d}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{createUserStoriesForApproval as c,cloneUserStories as u}from"../../utils/userstory-approval-transform.utils.js";import{getFirstNonApprovedSegmentId as v,getFirstUnapprovedStoryId as p,approveAllSegments as m}from"../../utils/userstory-approval.utils.js";import{useApprovalStatus as h}from"../../hooks/useApprovalStatus.js";import{ContentSegment as S}from"./components/ContentSegment/ContentSegment.js";import{ApprovalBadge as y}from"./components/ApprovalBadge/ApprovalBadge.js";import g from"./UserStoryApprovalScreen.module.css.js";import{CheckIcon as f}from"../../icons/CheckIcon.js";import{BookmarkIcon as b}from"../../icons/BookmarkIcon.js";import{ApprovalSidebar as I}from"./components/ApprovalSidebar/ApprovalSidebar.js";import{ExternalLink as C,Download as A,Share2 as w,Copy as E,SidebarOpenIcon as N,SidebarCloseIcon as U}from"lucide-react";import{UserStoryApprovalScreenContext as x,useUserStoryApprovalScreen as T}from"./UserStoryApprovalContext.js";import{BigEnoughPanel as k}from"../story-screen/BigEnoughPanel.js";import B from"../../icons/BigEnoughIcon.js";import{Menu as D,MenuItem as F}from"@mui/material";import{formatMarkdown as j}from"../../utils/helpers.js";import{replaceTitleSection as P}from"../../utils/user-story.utils.js";const M={showApproveAllButton:!0,allowEditing:!0,allowDeletion:!0,showSidebar:!1,containerHeight:"calc(100vh - 100px)",useFullWidth:!1},_={approveAll:"Approve All",approved:"Approved",approve:"Approve",correctMe:"Correct Me",delete:"Delete",save:"Save",cancel:"Cancel",savingArtifact:"Saving Artifact...",artifactSavedTitle:"Artifact Saved Successfully",artifactSavedMessage:"Your changes have been saved.",saveFailedTitle:"Failed to Save the Artifact",saveFailedMessage:"An error occurred while saving your changes.",emptyContentWarning:"Saving empty content is not allowed",unsavedChangesWarning:"Please save the updated changes to proceed with Approve All"},R=Object.assign(({artifactTitleIds:o,config:t={},callbacks:s={},labels:m={},isDisabled:S=!1,children:y,classNames:f,selectedArtifactId:b})=>{var I;const{userStory:C,customStyles:A}=d(),w={...M,...t},E={..._,...m},[N,U]=l([]),[T,k]=l(""),[B,D]=l(""),[F,j]=l(!1),[P,R]=l(!0),z=n(void 0),W=r((e,o,t,l)=>{s.onShowNotification?s.onShowNotification(e,o,t,l):console.log(`[${e.toUpperCase()}] ${o}: ${t}`)},[s]),$=r(e=>{s.onScrollToElement?s.onScrollToElement(e):(e.style.scrollMarginTop="20px",e.scrollIntoView({behavior:"smooth",block:"start"}))},[s]),L=i(()=>{const e=N.findIndex(e=>e.artifactId===T);return e>=0?e:0},[N,T]),O=N[L];a(()=>{z.current=O},[O]),a(()=>{var e;if(!(null==C?void 0:C.length))return;null===(e=s.onInitialize)||void 0===e||e.call(s),1===C.length&&R(!1),C.length>0&&!T&&k(b||C[0].artifactId);const o=c(u(C));U(o)},[C,b]),a(()=>{b&&b!==T&&k(b)},[b,T]),a(()=>{if(!O)return;const e=v(O,"");D(e)},[null==O?void 0:O.artifactId]);const V=r((e,o)=>{U(t=>{const l=[...t];if("APPROVED"===o.approval_status&&"APPROVED"!==t[e].approval_status){const e=p(t,o.artifactId);e&&k(e)}return l[e]=o,l})},[]),q=r(e=>{const o=z.current;if(!o)return;const t=v(o,e);"NA"!==t&&(D(""),setTimeout(()=>{D(t)},0))},[]);h({userStoryForApproval:N,selectedUserStoryForApproval:O,userStoryIndex:L,callbacks:s,labels:E,onSaveUserStory:V});const H={height:w.containerHeight,...w.useFullWidth?{width:"100%",marginLeft:0,marginRight:0}:{width:"calc(100% + 40px)",marginLeft:"-20px",marginRight:"-20px"}},G={userStoryForApproval:N,setUserStoryForApproval:U,selectedStoryArtifactId:T,setSelectedStoryArtifactId:k,selectedUserStoryIndex:L,selectedUserStoryForApproval:O,currentContentId:B,setCurrentContentId:D,isEditingSegment:F,setIsEditingSegment:j,isSidebarExpanded:P,setIsSidebarExpanded:R,artifactTitleIds:o,config:w,labels:E,callbacks:s,isDisabled:S,handleSaveUserStory:V,handleUpdateContentId:q,showNotification:W,scrollToElement:$};return e(x.Provider,{value:G,children:e("div",{className:`${g.container} ${(null==f?void 0:f.container)||""}`,style:{...H,...null===(I=null==A?void 0:A.approvalScreen)||void 0===I?void 0:I.wrapperContainer},children:y})})},{Sidebar:({Component:o,config:t,className:l})=>{const{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:i,userStoryForApproval:a,isEditingSegment:s,artifactTitleIds:d}=T();return o?e(o,{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:i,userStoryForApproval:a,isEditingAnUserStorySegment:s,artifactTitleIds:d}):e(I,{config:t,className:l})},SidebarToggle:({OpenIcon:o,CloseIcon:t,className:l=""})=>{const{isSidebarExpanded:n,setIsSidebarExpanded:r}=T(),i=o||N,a=t||U;return e("div",{className:`${g.sidebarToggleWrapper} ${l}`,children:e("button",{onClick:()=>r(e=>!e),className:g.sidebarToggleBtn,"aria-label":n?"Collapse sidebar":"Expand sidebar",type:"button",children:e(n?a:i,{})})})},Content:({children:i,ButtonComponent:a,hideApproveAll:c=!1,pageTitle:u="Review Generated Requirements",showShareIcon:v=!1,handleDownloadUserStory:p,handleOpenSendDialog:h,pageDescription:S="This page displays automatically generated requirements for your project. Use this screen to review, refine, correct, or approve all generated requirements."})=>{var I,N,U,x,M,_,R,z,W,$,L,O,V,q,H,G,Y,J,K,Q,X,Z,ee,oe,te,le,ne,re,ie,ae,se;const{selectedUserStoryForApproval:de,selectedUserStoryIndex:ce,artifactTitleIds:ue,labels:ve,config:pe,isDisabled:me,isEditingSegment:he,handleSaveUserStory:Se,setCurrentContentId:ye,showNotification:ge}=T(),{userStory:fe,setUserStory:be}=d(),Ie=fe[0],[Ce,Ae]=l(null),we=()=>{Ae(null)},Ee=n(null),[Ne,Ue]=l(!1),{customStyles:xe,customIcons:Te}=d(),ke=null==xe?void 0:xe.userStoryCardStyles,[Be,De]=l(!1),Fe=r(()=>{if(!de)return;if(he)return void ge("warn","Warning!",ve.unsavedChangesWarning,3e3);const e=m(de);Se(ce,e),ye("")},[de,ce,he,ve,Se,ye,ge]);if(!de)return null;const je=ue[ce]||"",Pe="APPROVED"===de.approval_status,Me=null!=(null==de?void 0:de.big_enough)&&!Number.isNaN(de.big_enough)&&!!(null==de?void 0:de.big_enough_decision_factors);return o("div",{className:g.content,style:{...null===(N=null===(I=null==xe?void 0:xe.approvalScreen)||void 0===I?void 0:I.content)||void 0===N?void 0:N.content},"data-lsc-ui-page-title":u,"data-lsc-ui-page-description":S,children:[o("div",{className:g.header,style:{...null===(M=null===(x=null===(U=null==xe?void 0:xe.approvalScreen)||void 0===U?void 0:U.body)||void 0===x?void 0:x.contentSegment)||void 0===M?void 0:M.header},children:[o("div",{className:g.headerLeft,style:{...null===(R=null===(_=null==xe?void 0:xe.approvalScreen)||void 0===_?void 0:_.content)||void 0===R?void 0:R.headerLeft},children:[o("div",{className:g.headerMeta,style:{...null===($=null===(W=null===(z=null==xe?void 0:xe.approvalScreen)||void 0===z?void 0:z.body)||void 0===W?void 0:W.contentSegment)||void 0===$?void 0:$.headerMeta},children:[e(b,{size:16,color:(null===(V=null===(O=null===(L=null==xe?void 0:xe.approvalScreen)||void 0===L?void 0:L.body)||void 0===O?void 0:O.contentSegment)||void 0===V?void 0:V.bookMarkColor)||"#8C8C8C"}),e("h2",{className:g.headerArtifactId,style:{...null===(G=null===(H=null===(q=null==xe?void 0:xe.approvalScreen)||void 0===q?void 0:q.body)||void 0===H?void 0:H.contentSegment)||void 0===G?void 0:G.headerArtifactId},children:je})]}),e("p",{className:g.headerTitle,style:{...null===(K=null===(J=null===(Y=null==xe?void 0:xe.approvalScreen)||void 0===Y?void 0:Y.body)||void 0===J?void 0:J.contentSegment)||void 0===K?void 0:K.headerTitle},children:null==de?void 0:de.title})]}),o("div",{className:null==g?void 0:g.containerStyle,style:null===(X=null===(Q=null==xe?void 0:xe.approvalScreen)||void 0===Q?void 0:Q.BigEnoughStyles)||void 0===X?void 0:X.containerStyle,children:[Me&&e("button",{className:g.developerEffortButton,style:null===(ee=null===(Z=null==xe?void 0:xe.approvalScreen)||void 0===Z?void 0:Z.BigEnoughStyles)||void 0===ee?void 0:ee.buttonStyle,onClick:()=>De(!Be),children:e(B,{color:null===(te=null===(oe=null==xe?void 0:xe.approvalScreen)||void 0===oe?void 0:oe.BigEnoughStyles)||void 0===te?void 0:te.iconColor,size:null===(ne=null===(le=null==xe?void 0:xe.approvalScreen)||void 0===le?void 0:le.BigEnoughStyles)||void 0===ne?void 0:ne.iconSize})}),v&&o(t,{children:[e("button",{className:g.iconButton,style:null==ke?void 0:ke.iconButton,onClick:e=>{Ae(e.currentTarget)},children:e(C,{size:16})}),o(D,{id:"user-story-share-menu",anchorEl:Ce,open:!!Ce,onClose:()=>Ae(null),style:null==ke?void 0:ke.userStoryShareMenu,children:[e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{Ue(!0),p&&(await Promise.all([p("pdf"),p("doc")]),Ue(!1))},children:o("div",{ref:Ee,className:g.menuItemContent,style:null==ke?void 0:ke.menuItemContent,children:[e(A,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Download"})]})}),e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{let e=Ie;e={...Ie,value:`${P(null==Ie?void 0:Ie.value,Ie.title)} \n${Ie.value}`},null==h||h(!0,[e],Ie.artifactId),we()},children:o("div",{style:null==ke?void 0:ke.menuItemContent,className:g.menuItemContentPadded,children:[e(w,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Send"})]})}),e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{const e=(new s.Converter).makeHtml(j(Ie.value)||Ie.value),o=function(e){const o=(new s.Converter).makeHtml(e),t=document.createElement("div");return t.innerHTML=o,t.textContent||t.innerText||""}(j(Ie.value)||Ie.value),t=new ClipboardItem({"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([t]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{we()}},children:o("div",{style:null==ke?void 0:ke.menuItemContent,className:g.menuItemContentPadded,children:[e(E,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Copy"})]})})]})]}),!c&&pe.showApproveAllButton&&e("div",{className:g.headerRight,children:Pe?e(y,{status:"APPROVED",label:ve.approved}):a?e(a,{type:"fill",onClick:Fe,isDisable:me,className:g.approveAllButton,overrideStyles:!0,lscUIAgent:{id:"approve-all",lscUIType:"button",lscUILabel:ve.approveAll,lscUIDescription:"Clicks this button to approve all generated requirements on the page in a single action.",lscUIWhenToApply:"Apply when the user wants to accept all requirements without reviewing them individually, or when they say phrases like 'approve everything', 'finalize all', 'accept all', or 'this looks good, approve all'."},children:o("div",{className:g.approveAllContent,children:[e(f,{size:16,color:"white"}),e("span",{children:ve.approveAll})]})}):o("button",{onClick:Fe,disabled:me,className:g.approveAllButtonDefault,style:{...null===(ie=null===(re=null==xe?void 0:xe.approvalScreen)||void 0===re?void 0:re.content)||void 0===ie?void 0:ie.approveAllButtonDefault},children:[e(f,{size:16,color:"white"}),e("span",{children:ve.approveAll})]})})]})]}),Be&&Me&&e("div",{className:g.bigEnoughWrapper,children:e(k,{customIcons:null==Te?void 0:Te.userStoryIcons,customStyles:null===(ae=null==xe?void 0:xe.approvalScreen)||void 0===ae?void 0:ae.aiReasoningCitaionStyles,currentUserStory:de,panelStyles:null===(se=null==xe?void 0:xe.approvalScreen)||void 0===se?void 0:se.BigEnoughStyles,showPanel:Be})}),i]})},Body:({children:t,EditorComponent:l,ViewerComponent:n,handleDownloadUserStory:i,handleOpenSendDialog:a,showShareIcon:s=!1})=>{var c,u,v;const{selectedUserStoryForApproval:p,selectedUserStoryIndex:m,artifactTitleIds:h,handleSaveUserStory:y}=T(),{customStyles:f}=d(),b=r(e=>{y(m,e)},[m,y]),I=r((e,o)=>{var t;if(!p)return;const l={...p,sub_features:null===(t=p.sub_features)||void 0===t?void 0:t.map((t,l)=>l===e?o:t)};y(m,l)},[p,m,y]),C=r(e=>{var o;if(!p)return;const t={...p,sub_features:null===(o=p.sub_features)||void 0===o?void 0:o.filter((o,t)=>t!==e)};y(m,t)},[p,m,y]);if(!p)return null;const A=h[m]||"";return o("div",{className:g.body,style:{...null===(u=null===(c=null==f?void 0:f.approvalScreen)||void 0===c?void 0:c.body)||void 0===u?void 0:u.container},children:[e(S,{userStoryForApproval:p,artifactTitleId:A,onSaveMainStoryContent:b,EditorComponent:l,ViewerComponent:n}),null===(v=p.sub_features)||void 0===v?void 0:v.map((o,t)=>e(S,{userStoryForApproval:o,artifactTitleId:`${A} - ${String.fromCharCode(65+t)}`,isSubFeature:!0,subFeatureIndex:t,onSaveSubFeature:I,onDeleteSubFeature:C,EditorComponent:l,ViewerComponent:n,handleDownloadUserStory:i,handleOpenSendDialog:a,showShareIcon:s},o.artifactId)),t]})}});export{R as default};
|
|
1
|
+
import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as n,useCallback as r,useMemo as i,useEffect as a}from"react";import s from"showdown";import{useRequirementAI as d}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{createUserStoriesForApproval as c,cloneUserStories as u}from"../../utils/userstory-approval-transform.utils.js";import{getFirstNonApprovedSegmentId as v,getFirstUnapprovedStoryId as p,approveAllSegments as m}from"../../utils/userstory-approval.utils.js";import{useApprovalStatus as h}from"../../hooks/useApprovalStatus.js";import{ContentSegment as S}from"./components/ContentSegment/ContentSegment.js";import{ApprovalBadge as y}from"./components/ApprovalBadge/ApprovalBadge.js";import g from"./UserStoryApprovalScreen.module.css.js";import{CheckIcon as f}from"../../icons/CheckIcon.js";import{BookmarkIcon as b}from"../../icons/BookmarkIcon.js";import{ApprovalSidebar as I}from"./components/ApprovalSidebar/ApprovalSidebar.js";import{ExternalLink as C,Download as A,Share2 as w,Copy as E,SidebarOpenIcon as N,SidebarCloseIcon as U}from"lucide-react";import{UserStoryApprovalScreenContext as x,useUserStoryApprovalScreen as T}from"./UserStoryApprovalContext.js";import{BigEnoughPanel as k}from"../story-screen/BigEnoughPanel.js";import B from"../../icons/BigEnoughIcon.js";import{Menu as D,MenuItem as F}from"@mui/material";import{formatMarkdown as j}from"../../utils/helpers.js";import{replaceTitleSection as P}from"../../utils/user-story.utils.js";const M={showApproveAllButton:!0,allowEditing:!0,allowDeletion:!0,showSidebar:!1,containerHeight:"calc(100vh - 100px)",useFullWidth:!1},_={approveAll:"Approve All",approved:"Approved",approve:"Approve",correctMe:"Correct Me",delete:"Delete",save:"Save",cancel:"Cancel",savingArtifact:"Saving Artifact...",artifactSavedTitle:"Artifact Saved Successfully",artifactSavedMessage:"Your changes have been saved.",saveFailedTitle:"Failed to Save the Artifact",saveFailedMessage:"An error occurred while saving your changes.",emptyContentWarning:"Saving empty content is not allowed",unsavedChangesWarning:"Please save the updated changes to proceed with Approve All"},R=Object.assign(({artifactTitleIds:o,config:t={},callbacks:s={},labels:m={},isDisabled:S=!1,children:y,classNames:f,selectedArtifactId:b})=>{var I;const{userStory:C,customStyles:A}=d(),w={...M,...t},E={..._,...m},[N,U]=l([]),[T,k]=l(""),[B,D]=l(""),[F,j]=l(!1),[P,R]=l(!0),z=n(void 0),W=r((e,o,t,l)=>{s.onShowNotification?s.onShowNotification(e,o,t,l):console.log(`[${e.toUpperCase()}] ${o}: ${t}`)},[s]),$=r(e=>{s.onScrollToElement?s.onScrollToElement(e):(e.style.scrollMarginTop="20px",e.scrollIntoView({behavior:"smooth",block:"start"}))},[s]),L=i(()=>{const e=N.findIndex(e=>e.artifactId===T);return e>=0?e:0},[N,T]),O=N[L];a(()=>{z.current=O},[O]),a(()=>{var e;if(!(null==C?void 0:C.length))return;null===(e=s.onInitialize)||void 0===e||e.call(s),1===C.length&&R(!1),C.length>0&&!T&&k(b||C[0].artifactId);const o=c(u(C));U(o)},[C,b]),a(()=>{b&&b!==T&&k(b)},[b,T]),a(()=>{if(!O)return;const e=v(O,"");D(e)},[null==O?void 0:O.artifactId]);const V=r((e,o)=>{U(t=>{const l=[...t];if("APPROVED"===o.approval_status&&"APPROVED"!==t[e].approval_status){const e=p(t,o.artifactId);e&&k(e)}return l[e]=o,l})},[]),q=r(e=>{const o=z.current;if(!o)return;const t=v(o,e);"NA"!==t&&(D(""),setTimeout(()=>{D(t)},0))},[]);h({userStoryForApproval:N,selectedUserStoryForApproval:O,userStoryIndex:L,callbacks:s,labels:E,onSaveUserStory:V});const H={height:w.containerHeight,...w.useFullWidth?{width:"100%",marginLeft:0,marginRight:0}:{width:"calc(100% + 40px)",marginLeft:"-20px",marginRight:"-20px"}},G={userStoryForApproval:N,setUserStoryForApproval:U,selectedStoryArtifactId:T,setSelectedStoryArtifactId:k,selectedUserStoryIndex:L,selectedUserStoryForApproval:O,currentContentId:B,setCurrentContentId:D,isEditingSegment:F,setIsEditingSegment:j,isSidebarExpanded:P,setIsSidebarExpanded:R,artifactTitleIds:o,config:w,labels:E,callbacks:s,isDisabled:S,handleSaveUserStory:V,handleUpdateContentId:q,showNotification:W,scrollToElement:$};return e(x.Provider,{value:G,children:e("div",{className:`${g.container} ${(null==f?void 0:f.container)||""}`,style:{...H,...null===(I=null==A?void 0:A.approvalScreen)||void 0===I?void 0:I.wrapperContainer},children:y})})},{Sidebar:({Component:o,config:t,className:l})=>{const{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:i,userStoryForApproval:a,isEditingSegment:s,artifactTitleIds:d}=T();return o?e(o,{isSidebarExpanded:n,selectedStoryArtifactId:r,setSelectedStoryArtifactId:i,userStoryForApproval:a,isEditingAnUserStorySegment:s,artifactTitleIds:d}):e(I,{config:t,className:l})},SidebarToggle:({OpenIcon:o,CloseIcon:t,className:l=""})=>{const{isSidebarExpanded:n,setIsSidebarExpanded:r}=T(),i=o||N,a=t||U;return e("div",{className:`${g.sidebarToggleWrapper} ${l}`,children:e("button",{onClick:()=>r(e=>!e),className:g.sidebarToggleBtn,"aria-label":n?"Collapse sidebar":"Expand sidebar",type:"button",children:e(n?a:i,{})})})},Content:({children:i,ButtonComponent:a,hideApproveAll:c=!1,pageTitle:u="Review Generated Requirements",showShareIcon:v=!1,handleDownloadUserStory:p,handleOpenSendDialog:h,pageDescription:S="This page displays automatically generated requirements for your project. Use this screen to review, refine, correct, or approve all generated requirements."})=>{var I,N,U,x,M,_,R,z,W,$,L,O,V,q,H,G,Y,J,K,Q,X,Z,ee,oe,te,le,ne,re,ie,ae,se;const{selectedUserStoryForApproval:de,selectedUserStoryIndex:ce,artifactTitleIds:ue,labels:ve,config:pe,isDisabled:me,isEditingSegment:he,handleSaveUserStory:Se,setCurrentContentId:ye,showNotification:ge}=T(),{userStory:fe,setUserStory:be}=d(),Ie=fe[0],[Ce,Ae]=l(null),we=()=>{Ae(null)},Ee=n(null),[Ne,Ue]=l(!1),{customStyles:xe,customIcons:Te}=d(),ke=null==xe?void 0:xe.userStoryCardStyles,[Be,De]=l(!1),Fe=r(()=>{if(!de)return;if(he)return void ge("warn","Warning!",ve.unsavedChangesWarning,3e3);const e=m(de);Se(ce,e),ye("")},[de,ce,he,ve,Se,ye,ge]);if(!de)return null;const je=ue[ce]||"",Pe="APPROVED"===de.approval_status,Me=null!=(null==de?void 0:de.big_enough)&&!Number.isNaN(de.big_enough)&&!!(null==de?void 0:de.big_enough_decision_factors);return o("div",{className:g.content,style:{...null===(N=null===(I=null==xe?void 0:xe.approvalScreen)||void 0===I?void 0:I.content)||void 0===N?void 0:N.content},"data-lsc-ui-page-title":u,"data-lsc-ui-page-description":S,children:[o("div",{className:g.header,style:{...null===(M=null===(x=null===(U=null==xe?void 0:xe.approvalScreen)||void 0===U?void 0:U.body)||void 0===x?void 0:x.contentSegment)||void 0===M?void 0:M.header},children:[o("div",{className:g.headerLeft,style:{...null===(R=null===(_=null==xe?void 0:xe.approvalScreen)||void 0===_?void 0:_.content)||void 0===R?void 0:R.headerLeft},children:[o("div",{className:g.headerMeta,style:{...null===($=null===(W=null===(z=null==xe?void 0:xe.approvalScreen)||void 0===z?void 0:z.body)||void 0===W?void 0:W.contentSegment)||void 0===$?void 0:$.headerMeta},children:[e(b,{size:16,color:(null===(V=null===(O=null===(L=null==xe?void 0:xe.approvalScreen)||void 0===L?void 0:L.body)||void 0===O?void 0:O.contentSegment)||void 0===V?void 0:V.bookMarkColor)||"#8C8C8C"}),e("h2",{className:g.headerArtifactId,style:{...null===(G=null===(H=null===(q=null==xe?void 0:xe.approvalScreen)||void 0===q?void 0:q.body)||void 0===H?void 0:H.contentSegment)||void 0===G?void 0:G.headerArtifactId},children:je})]}),e("p",{className:g.headerTitle,style:{...null===(K=null===(J=null===(Y=null==xe?void 0:xe.approvalScreen)||void 0===Y?void 0:Y.body)||void 0===J?void 0:J.contentSegment)||void 0===K?void 0:K.headerTitle},children:null==de?void 0:de.title})]}),o("div",{className:null==g?void 0:g.containerStyle,style:null===(X=null===(Q=null==xe?void 0:xe.approvalScreen)||void 0===Q?void 0:Q.BigEnoughStyles)||void 0===X?void 0:X.containerStyle,children:[Me&&e("button",{className:g.developerEffortButton,style:null===(ee=null===(Z=null==xe?void 0:xe.approvalScreen)||void 0===Z?void 0:Z.BigEnoughStyles)||void 0===ee?void 0:ee.buttonStyle,onClick:()=>De(!Be),children:e(B,{color:null===(te=null===(oe=null==xe?void 0:xe.approvalScreen)||void 0===oe?void 0:oe.BigEnoughStyles)||void 0===te?void 0:te.iconColor,size:null===(ne=null===(le=null==xe?void 0:xe.approvalScreen)||void 0===le?void 0:le.BigEnoughStyles)||void 0===ne?void 0:ne.iconSize})}),v&&o(t,{children:[e("button",{className:g.iconButton,style:null==ke?void 0:ke.iconButton,onClick:e=>{Ae(e.currentTarget)},children:e(C,{size:16})}),o(D,{id:"user-story-share-menu",anchorEl:Ce,open:!!Ce,onClose:()=>Ae(null),style:null==ke?void 0:ke.userStoryShareMenu,children:[e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{Ue(!0),p&&(await Promise.all([p("pdf"),p("doc")]),Ue(!1))},children:o("div",{ref:Ee,className:g.menuItemContent,style:null==ke?void 0:ke.menuItemContent,children:[e(A,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Download"})]})}),e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{let e=Ie;e={...Ie,value:`${P(null==Ie?void 0:Ie.value,Ie.title)}`},null==h||h(!0,[e],Ie.artifactId),we()},children:o("div",{style:null==ke?void 0:ke.menuItemContent,className:g.menuItemContentPadded,children:[e(w,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Send"})]})}),e(F,{style:null==ke?void 0:ke.userStoryMenuItem,onClick:async()=>{const e=(new s.Converter).makeHtml(j(Ie.value)||Ie.value),o=function(e){const o=(new s.Converter).makeHtml(e),t=document.createElement("div");return t.innerHTML=o,t.textContent||t.innerText||""}(j(Ie.value)||Ie.value),t=new ClipboardItem({"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([t]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{we()}},children:o("div",{style:null==ke?void 0:ke.menuItemContent,className:g.menuItemContentPadded,children:[e(E,{size:16,color:null==ke?void 0:ke.menuIconColor}),e("p",{style:null==ke?void 0:ke.menuLabel,children:"Copy"})]})})]})]}),!c&&pe.showApproveAllButton&&e("div",{className:g.headerRight,children:Pe?e(y,{status:"APPROVED",label:ve.approved}):a?e(a,{type:"fill",onClick:Fe,isDisable:me,className:g.approveAllButton,overrideStyles:!0,lscUIAgent:{id:"approve-all",lscUIType:"button",lscUILabel:ve.approveAll,lscUIDescription:"Clicks this button to approve all generated requirements on the page in a single action.",lscUIWhenToApply:"Apply when the user wants to accept all requirements without reviewing them individually, or when they say phrases like 'approve everything', 'finalize all', 'accept all', or 'this looks good, approve all'."},children:o("div",{className:g.approveAllContent,children:[e(f,{size:16,color:"white"}),e("span",{children:ve.approveAll})]})}):o("button",{onClick:Fe,disabled:me,className:g.approveAllButtonDefault,style:{...null===(ie=null===(re=null==xe?void 0:xe.approvalScreen)||void 0===re?void 0:re.content)||void 0===ie?void 0:ie.approveAllButtonDefault},children:[e(f,{size:16,color:"white"}),e("span",{children:ve.approveAll})]})})]})]}),Be&&Me&&e("div",{className:g.bigEnoughWrapper,children:e(k,{customIcons:null==Te?void 0:Te.userStoryIcons,customStyles:null===(ae=null==xe?void 0:xe.approvalScreen)||void 0===ae?void 0:ae.aiReasoningCitaionStyles,currentUserStory:de,panelStyles:null===(se=null==xe?void 0:xe.approvalScreen)||void 0===se?void 0:se.BigEnoughStyles,showPanel:Be})}),i]})},Body:({children:t,EditorComponent:l,ViewerComponent:n,handleDownloadUserStory:i,handleOpenSendDialog:a,showShareIcon:s=!1})=>{var c,u,v;const{selectedUserStoryForApproval:p,selectedUserStoryIndex:m,artifactTitleIds:h,handleSaveUserStory:y}=T(),{customStyles:f}=d(),b=r(e=>{y(m,e)},[m,y]),I=r((e,o)=>{var t;if(!p)return;const l={...p,sub_features:null===(t=p.sub_features)||void 0===t?void 0:t.map((t,l)=>l===e?o:t)};y(m,l)},[p,m,y]),C=r(e=>{var o;if(!p)return;const t={...p,sub_features:null===(o=p.sub_features)||void 0===o?void 0:o.filter((o,t)=>t!==e)};y(m,t)},[p,m,y]);if(!p)return null;const A=h[m]||"";return o("div",{className:g.body,style:{...null===(u=null===(c=null==f?void 0:f.approvalScreen)||void 0===c?void 0:c.body)||void 0===u?void 0:u.container},children:[e(S,{userStoryForApproval:p,artifactTitleId:A,onSaveMainStoryContent:b,EditorComponent:l,ViewerComponent:n}),null===(v=p.sub_features)||void 0===v?void 0:v.map((o,t)=>e(S,{userStoryForApproval:o,artifactTitleId:`${A} - ${String.fromCharCode(65+t)}`,isSubFeature:!0,subFeatureIndex:t,onSaveSubFeature:I,onDeleteSubFeature:C,EditorComponent:l,ViewerComponent:n,handleDownloadUserStory:i,handleOpenSendDialog:a,showShareIcon:s},o.artifactId)),t]})}});export{R as default};
|
|
2
2
|
//# sourceMappingURL=UserStoryApprovalScreen.js.map
|
package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as i}from"react/jsx-runtime";import o,{createContext as t,useRef as l,useState as r,useCallback as d,useMemo as a,useEffect as s,useContext as c}from"react";import u from"react-markdown";import p from"rehype-raw";import g from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as h}from"../../shared/useMarkdownSearch.js";import{Info as v}from"lucide-react";import{Tooltip as m}from"@mui/material";import C from"dompurify";import f from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as S}from"../RequirementAIWrapper/RequirementAIWrapper.js";import b from"../../icons/CognitiveDecision.js";import I from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as $}from"../ai-reasoning/AiReasoningCitation.js";import x from"../../icons/RelevanceScoreIcon.js";import N from"../RecommendationBlock/RecommendationBlock.js";import k from"../UserStoryCard/AttachedContext.js";import A from"../ai-reasoning/AiReasoningCitationContent.js";import j from"./components/InlineUpdatedComponent.js";import U from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as E}from"../../store/markdown-context.js";import L from"./components/InlineManualComponent.js";import M from"./components/HighlightButtonComponent.js";import{escapeTagIds as T,splitTagAcrossParagraphs as P}from"../../../../utils/tagHelper.js";const D=t(!1),_=t({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),H=t({rowId:""}),F=({aiReason:n,isHighConfidence:o,customStyle:t,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=c(_),{rowId:u}=c(H),p=String(n.id);u&&s.current.set(p,u);const h=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===n.id,v=o?(null==l?void 0:l.highConfidence)||e(b,{}):(null==l?void 0:l.lowConfidence)||e(I,{});return i("button",{className:g.aiReasoningButton,style:t,onClick:e=>{e.stopPropagation(),e.preventDefault(),a(h?null:u,h?null:n)},children:[v,e("i",h?{className:`pi pi-angle-up ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`})]})},B=({children:n,node:o,customStyles:t,customIcons:r})=>{var d,a;const s=l(Math.random().toString(36).slice(2)).current,{expandedInfo:u}=c(_),p=(null==u?void 0:u.rowId)===s,h=Array.isArray(null==o?void 0:o.children)?o.children.filter(e=>"element"===e.type).length:1,v=null!==(a=null===(d=null==o?void 0:o.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return i(H.Provider,{value:{rowId:s},children:[e("tr",{style:v?{cssText:v}:void 0,children:n}),p&&(null==u?void 0:u.aiReason)&&e("tr",{style:{width:"100%"},children:e("td",{colSpan:h||1,className:g.tableExpandedCell,children:e("div",{className:g.tableExpandedCellInner,children:e("div",{className:g.tableExpandedCellContent,children:e(A,{aiReason:u.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==t?void 0:t.aiReasoningContent,aiReasoningAccordion:null==t?void 0:t.aiReasoningAccordion,aiReasoningMarkdown:null==t?void 0:t.aiReasoningMarkdown,aiReasoningPill:null==t?void 0:t.aiReasoningPill,webCitation:null==t?void 0:t.webCitation,stormeeCitation:null==t?void 0:t.stormeeCitation,waveformCitation:null==t?void 0:t.waveformCitation,imageCitation:null==t?void 0:t.imageCitation,fileCitation:null==t?void 0:t.fileCitation,appModCitation:null==t?void 0:t.appModCitation,rcaCitation:null==t?void 0:t.rcaCitation,readFileCitation:null==t?void 0:t.readFileCitation,loadingCitations:null==t?void 0:t.loadingCitations,chatCitation:null==t?void 0:t.chatCitation}})})})})})]})};const O=["del","ins"];function V(e){return function(e,n,i){const o=n.join("|");return e.replace(new RegExp(`<(${o})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,o)=>`<${n}>${i(o)}</${n}>`)}(e,O,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var o;return`<code>${t=null!==(o=n[Number(i)])&&void 0!==o?o:"",t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var t})}(e)).join(""))}const q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!o.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(q.has(d))return e;const a=null===(r=o.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?o.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const W=({message:t,noMarkdownContent:b,useMarkdown:I=!0,isParent:A,scenario:H,showUserStoryDiff:O=!1,aiReasoningsForBlock:q,isCitationLoadingDisplay:W=!1,className:G,highConfidenceIcon:Q,lowConfidenceIcon:J,customStyles:K,customIcons:X,contextVariant:Y,aiReasoningDiffView:Z,userStoryCitations:ee,artifactId:ne,isCraflow:ie,onCraAccept:oe,onCraReject:te,craFlowConfig:le,isDisplayHighlightControl:re=!1,showConfidenceScore:de=!0,CDNeededInChip:ae})=>{var se;const ce=l(null),{userStory:ue,inlineUpdateComponentConfig:pe,getAvgScoreForStory:ge,setUserStory:he,aiReasoning:ve,setAiReasoning:me,customIcons:Ce,searchQueryList:fe,searchQueryReasoningIdList:ye,currentHighlightIndex:we,segmentComponentConfig:Se,inlineManualComponentConfig:be,diffEditConfig:Ie}=S(),Re=null!=X?X:null==Ce?void 0:Ce.userStoryIcons;null==K||K.searchHighlight;const{search:$e,clear:xe}=h(ce),[Ne,ke]=r("1"),[Ae,je]=r(null),Ue=l(new Map),[Ee,Le]=r(new Set),Me=d((e,n)=>{je(e&&n?{rowId:e,aiReason:n}:null)},[]),Te=ne?ge(ne):0,[Pe,De]=r([]),_e=d(e=>{Le(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),He=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(He).join(""):o.isValidElement(e)?He(e.props.children):"",Fe=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,o,t)=>{const l=o.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,o,t)=>{const l=n.substring(0,t),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=o;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let o;const t=new RegExp(n.source,n.flags);for(;null!==(o=t.exec(e));){const e=o[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),t=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:o.index,endIndex:o.index+o[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==t?void 0:t[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],o=n.changedItemCount-n.deletedItemCount;if(0===o)continue;const t=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of t){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+o}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=V(n),n},Be=a(()=>t?Fe(t):t,[t]);s(()=>{De(q||ve)},[q,ve]);const Oe=a(()=>({span:({node:n,children:i,...o})=>{var t,l,r,d,a;const s=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t["highlight-id"])&&void 0!==l?l:null==o?void 0:o["highlight-id"],c="string"==typeof s&&Ee.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==o?void 0:o["highlight-color"];return e("span",{style:{...null!==(a=null==K?void 0:K.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:i,children:o,...t})=>{var l,r,d,a,s,c;const u=null!==(r=null===(l=null==i?void 0:i.properties)||void 0===l?void 0:l.action)&&void 0!==r?r:null==t?void 0:t.action,p=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(c=null===(s=null==i?void 0:i.properties)||void 0===s?void 0:s["highlight-type"])&&void 0!==c?c:null==t?void 0:t["highlight-type"];return"highlight"===u?e(M,{highlightId:p,handleHighlightSpan:_e,icon:"web"===g?null==Re?void 0:Re.webCitationIcon:"doc"===g?null==Re?void 0:Re.fileCitationIcon:e(n,{}),customStyles:"web"===g?null==K?void 0:K.webButton:"doc"===g?null==K?void 0:K.docButton:{}}):null},upt:({node:i,children:o,...t})=>{var l,r;const d=null==t?void 0:t.id,a=d?null===(r=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===r?void 0:r.replaceAll("@","<").replaceAll("#",">"):null,s=ve.find(e=>e.id.toString()===a);if(!s)return o||e(n,{});const c="data-main"in t,u=t["data-status"];return e(n,{children:e(j,{aiReason:s,customStyles:null==K?void 0:K.inlineUpdatedComponent,handleClickCognitiveDecision:null==pe?void 0:pe.handleClickCognitiveDecision,handleClickUpdatedPill:null==pe?void 0:pe.handleClickUpdatedPill,handleClickOutputValue:null==pe?void 0:pe.handleClickOutputValue,customIcons:null==pe?void 0:pe.customIcons,CDNeededInChip:ae,showChip:c,status:u,children:o||e(n,{})})})},del:({node:o,children:t,...l})=>{var r;const{cleanedChildren:d,extractedNodes:a}=z(t,["ins"]);return i(n,{children:[e("span",{className:g.deleted,style:null!==(r=null==K?void 0:K.deleted)&&void 0!==r?r:{},...l,onClick:()=>{l.onclick&&l.onclick()},children:d}),a]})},ins:({children:o,...t})=>{var l;const{cleanedChildren:r,extractedNodes:d}=z(o,["del"]);return i(n,{children:[e("span",{className:g.inserted,style:null!==(l=null==K?void 0:K.inserted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:r}),d]})},preserved:({children:n,...i})=>e("span",{className:g.preserved,style:null==K?void 0:K.preserved,...i,children:n}),manual:({children:i,...o})=>{var t;const l=null===(t=null==o?void 0:o.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),r=ve.find(e=>e.id.toString()===l),d=o["data-status"];return r?e(L,{aiReason:r,handleClick:null==be?void 0:be.handleClick,status:d,children:i}):i||e(n,{})},invisible:({children:i,...o})=>e(n,{}),h1:({node:n,...i})=>e("h1",{className:g.heading1,style:null==K?void 0:K.heading1,children:i.children}),h2:({node:n,...i})=>e("h2",{className:g.heading2,style:null==K?void 0:K.heading2,children:i.children}),h3:({node:n,...i})=>e("h3",{className:g.heading3,style:null==K?void 0:K.heading3,children:i.children}),b:({node:n,...i})=>e("b",{className:g.bold,style:null==K?void 0:K.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e("p",{...i,className:g.paragraph,style:null==K?void 0:K.paragraph,children:i.children}),updated:({node:n,...i})=>e(f,{...i,showUserStoryDiff:O,currentUpdatedTagId:Ne,setCurrentUpdatedTagId:ke,userStory:ue,setUserStory:he,setAiReasoning:me,node:n,isCraflow:ie,onCraAccept:oe,onCraReject:te,diffEditConfig:Ie,customStyles:null==K?void 0:K.updatedContent,craFlowConfig:le}),ol:({node:n,...i})=>{var o,t,l;const r=null!==(l=null!==(t=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.start)&&void 0!==t?t:null==i?void 0:i.start)&&void 0!==l?l:void 0;return e("ol",{className:g.orderedList,style:null==K?void 0:K.olist,...r?{start:Number(r)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e("ul",{className:g.unorderedList,style:null==K?void 0:K.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e("div",{className:g.tableWrapper,children:e("table",{className:g.table,style:null==K?void 0:K.table,children:n})}),tr:({node:n,children:i})=>e(B,{node:n,children:i,customStyles:K}),td:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(D.Provider,{value:!0,children:e("td",{...l,style:t?{cssText:t}:void 0,children:i})})},th:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(D.Provider,{value:!0,children:e("th",{...l,style:t?{cssText:t}:void 0,children:i})})},recommendation:({node:n,...i})=>{var o;const t=`The AI has selected this content based on: ${(null===(o=null==i?void 0:i.children)||void 0===o?void 0:o[0])||""}`;return e(N,{...i,customStyles:null==K?void 0:K.recommendationBlock,label:t})},a:({inline:n,children:i,node:o,...t})=>{var l,r,d;const a=c(D)||"true"==(null==t?void 0:t.table),s=`${null==t?void 0:t.href}`,u=null===(l=s.split("$"))||void 0===l?void 0:l[0],p=null===(r=s.split("$"))||void 0===r?void 0:r[1];if("ai_reasoning"===u){const n=(null!==(d=O?Z:ve)&&void 0!==d?d:[]).find(e=>e.id.toString()===decodeURIComponent(p)),o=ye.includes(p);if(n){if(a)return e(F,{aiReason:n,customStyle:null==K?void 0:K.tableAiReasoning,customIcons:Re,isHighConfidence:n.relevance_score>=$});const t=He(i),l="source"!==t.trim().toLowerCase();return e(R,{aiReason:n,isSourceHasHighlight:o,inlineLabel:t,isInlineCitation:l,customIcons:Re,customStyles:{aiReasoningContent:null==K?void 0:K.aiReasoningContent,aiReasoningAccordion:null==K?void 0:K.aiReasoningAccordion,aiReasoningMarkdown:null==K?void 0:K.aiReasoningMarkdown,aiReasoningPill:null==K?void 0:K.aiReasoningPill,webCitation:null==K?void 0:K.webCitation,stormeeCitation:null==K?void 0:K.stormeeCitation,waveformCitation:null==K?void 0:K.waveformCitation,imageCitation:null==K?void 0:K.imageCitation,fileCitation:null==K?void 0:K.fileCitation,appModCitation:null==K?void 0:K.appModCitation,rcaCitation:null==K?void 0:K.rcaCitation,readFileCitation:null==K?void 0:K.readFileCitation,loadingCitations:null==K?void 0:K.loadingCitations,chatCitation:null==K?void 0:K.chatCitation,bigEnoughCitation:null==K?void 0:K.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:o,node:t,...l})=>/language-(\w+)/.exec(o||"")||(null==o?void 0:o.includes("language-"))?e("div",{children:e("code",{className:g.blockCode,style:null==K?void 0:K.code,children:i})}):e("code",{className:g.inlineCode,style:null==K?void 0:K.code,children:i}),learned:({children:n})=>e(m,{title:n,placement:"top",children:e(v,{size:16,className:g.learned})}),generatedcode:({node:n,...i})=>{const o=(null==i?void 0:i.language)||"python",t=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e(y,{title:"Generated Code",code:t,language:o,customStyles:{pill:null==K?void 0:K.generatedCodePill,content:null==K?void 0:K.generatedCodeContent}})},updatedsegment:({node:n,children:i,...o})=>{var t,l,r,d;const a=`${null===(t=n.position)||void 0===t?void 0:t.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(o),c=e("div",s?{dangerouslySetInnerHTML:{__html:C.sanitize(s)}}:{children:i});return e(U,{id:a,node:n,children:c,props:o,segmentComponentConfig:Se,customStyles:K,customIcons:X,extractText:He,isUpdatedSegment:!0})},segment:({node:n,children:i,...o})=>{var t,l,r,d;const a=`${null===(t=n.position)||void 0===t?void 0:t.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e(U,{id:a,node:n,children:i,props:o,segmentComponentConfig:Se,customStyles:K,customIcons:X,extractText:He})}}),[Pe,le,ve,ee,Ne,O,t,X,fe,ye,K,Se,Ee,_e]),Ve=a(()=>{let e=T(Be,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=P(e,n,"upt"===n)}),e},[Be]);return s(()=>{if(!ce.current)return;if(!fe.length)return void xe();let e;if(0===ye.length||re)requestAnimationFrame(()=>{$e([fe[we].replace(/\*/g,"")])});else{const n=ce.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{$e([fe[we].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[fe,ye,we,re]),e(_.Provider,{value:{expandedInfo:Ae,setExpanded:Me,reasonToRow:Ue},children:i("div",{ref:ce,className:`${g.container} ${"approving"!==H?g.wrapper:""} ${G||""}`,style:null==K?void 0:K.container,children:[I?e(E,{children:e(u,{components:Oe,rehypePlugins:[p],children:Ve})}):b,Te>0&&de&&e("div",{className:g.confidenceScoreContainer,style:null==K?void 0:K.confidenceScoreContainer,children:i("span",{className:g.confidenceScore,style:null==K?void 0:K.confidenceScore,children:[e(x,{size:14,color:(null==K?void 0:K.confidenceScoreIconColor)||"#166534"}),Te,"%"]})}),W&&e("div",{className:g.citationLoader,style:null==K?void 0:K.citationLoaderContainer,children:e(w,{customStyles:{container:null==K?void 0:K.citationLoadingContainer,icon:null==K?void 0:K.citationLoadingIcon,text:null==K?void 0:K.citationLoadingText}})}),A&&e("div",{style:{...null===(se=null==K?void 0:K.attachedContext)||void 0===se?void 0:se.wrapper},className:"flex mt-5",children:e(k,{customStyles:null==K?void 0:K.attachedContext,variant:Y})})]})})};export{W as default,z as splitNestedDiffNodes};
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as i}from"react/jsx-runtime";import o,{createContext as t,useRef as l,useState as r,useCallback as d,useMemo as a,useEffect as s,useContext as c}from"react";import u from"react-markdown";import p from"rehype-raw";import g from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as h}from"../../shared/useMarkdownSearch.js";import{Info as v}from"lucide-react";import{Tooltip as m}from"@mui/material";import C from"dompurify";import f from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as I}from"../RequirementAIWrapper/RequirementAIWrapper.js";import S from"../../icons/CognitiveDecision.js";import b from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as $}from"../ai-reasoning/AiReasoningCitation.js";import x from"../../icons/RelevanceScoreIcon.js";import N from"../RecommendationBlock/RecommendationBlock.js";import k from"../UserStoryCard/AttachedContext.js";import A from"../ai-reasoning/AiReasoningCitationContent.js";import j from"./components/InlineUpdatedComponent.js";import U from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as E}from"../../store/markdown-context.js";import L from"./components/InlineManualComponent.js";import M from"./components/HighlightButtonComponent.js";import{escapeTagIds as T,splitTagAcrossParagraphs as P}from"../../../../utils/tagHelper.js";const D=t(!1),_=t({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),H=t({rowId:""}),F=({aiReason:n,isHighConfidence:o,customStyle:t,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=c(_),{rowId:u}=c(H),p=String(n.id);u&&s.current.set(p,u);const h=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===n.id,v=o?(null==l?void 0:l.highConfidence)||e(S,{}):(null==l?void 0:l.lowConfidence)||e(b,{});return i("button",{className:g.aiReasoningButton,style:t,onClick:e=>{e.stopPropagation(),e.preventDefault(),a(h?null:u,h?null:n)},children:[v,e("i",h?{className:`pi pi-angle-up ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`})]})},B=({children:n,node:o,customStyles:t,customIcons:r})=>{var d,a;const s=l(Math.random().toString(36).slice(2)).current,{expandedInfo:u}=c(_),p=(null==u?void 0:u.rowId)===s,h=Array.isArray(null==o?void 0:o.children)?o.children.filter(e=>"element"===e.type).length:1,v=null!==(a=null===(d=null==o?void 0:o.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return i(H.Provider,{value:{rowId:s},children:[e("tr",{style:v?{cssText:v}:void 0,children:n}),p&&(null==u?void 0:u.aiReason)&&e("tr",{style:{width:"100%"},children:e("td",{colSpan:h||1,className:g.tableExpandedCell,children:e("div",{className:g.tableExpandedCellInner,children:e("div",{className:g.tableExpandedCellContent,children:e(A,{aiReason:u.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==t?void 0:t.aiReasoningContent,aiReasoningAccordion:null==t?void 0:t.aiReasoningAccordion,aiReasoningMarkdown:null==t?void 0:t.aiReasoningMarkdown,aiReasoningPill:null==t?void 0:t.aiReasoningPill,webCitation:null==t?void 0:t.webCitation,stormeeCitation:null==t?void 0:t.stormeeCitation,waveformCitation:null==t?void 0:t.waveformCitation,imageCitation:null==t?void 0:t.imageCitation,fileCitation:null==t?void 0:t.fileCitation,appModCitation:null==t?void 0:t.appModCitation,rcaCitation:null==t?void 0:t.rcaCitation,readFileCitation:null==t?void 0:t.readFileCitation,loadingCitations:null==t?void 0:t.loadingCitations,chatCitation:null==t?void 0:t.chatCitation}})})})})})]})};const W=["del","ins"];function O(e){return function(e,n,i){const o=n.join("|");return e.replace(new RegExp(`<(${o})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,o)=>`<${n}>${i(o)}</${n}>`)}(e,W,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var o;return`<code>${t=null!==(o=n[Number(i)])&&void 0!==o?o:"",t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var t})}(e)).join(""))}const V=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function q(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!o.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(V.has(d))return e;const a=null===(r=o.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?o.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const z=({message:t,noMarkdownContent:S,useMarkdown:b=!0,isParent:A,scenario:H,showUserStoryDiff:W=!1,aiReasoningsForBlock:V,isCitationLoadingDisplay:z=!1,className:G,highConfidenceIcon:Q,lowConfidenceIcon:J,customStyles:K,customIcons:X,contextVariant:Y,aiReasoningDiffView:Z,userStoryCitations:ee,artifactId:ne,isCraflow:ie,onCraAccept:oe,onCraReject:te,craFlowConfig:le,isDisplayHighlightControl:re=!1,showConfidenceScore:de=!0,CDNeededInChip:ae,blockId:se,showWaitingIconInChip:ce})=>{var ue;console.log("userstorywithcitation blockid ",se);const pe=l(null),{userStory:ge,inlineUpdateComponentConfig:he,getAvgScoreForStory:ve,setUserStory:me,aiReasoning:Ce,setAiReasoning:fe,customIcons:ye,searchQueryList:we,searchQueryReasoningIdList:Ie,currentHighlightIndex:Se,segmentComponentConfig:be,inlineManualComponentConfig:Re,diffEditConfig:$e}=I(),xe=null!=X?X:null==ye?void 0:ye.userStoryIcons;null==K||K.searchHighlight;const{search:Ne,clear:ke}=h(pe),[Ae,je]=r("1"),[Ue,Ee]=r(null),Le=l(new Map),[Me,Te]=r(new Set),Pe=d((e,n)=>{Ee(e&&n?{rowId:e,aiReason:n}:null)},[]),De=ne?ve(ne):0,[_e,He]=r([]),Fe=d(e=>{Te(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Be=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Be).join(""):o.isValidElement(e)?Be(e.props.children):"",We=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,o,t)=>{const l=o.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,o,t)=>{const l=n.substring(0,t),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=o;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let o;const t=new RegExp(n.source,n.flags);for(;null!==(o=t.exec(e));){const e=o[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),t=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:o.index,endIndex:o.index+o[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==t?void 0:t[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],o=n.changedItemCount-n.deletedItemCount;if(0===o)continue;const t=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of t){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+o}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=O(n),n},Oe=a(()=>t?We(t):t,[t]);s(()=>{He(V||Ce)},[V,Ce]);const Ve=a(()=>({span:({node:n,children:i,...o})=>{var t,l,r,d,a;const s=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t["highlight-id"])&&void 0!==l?l:null==o?void 0:o["highlight-id"],c="string"==typeof s&&Me.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==o?void 0:o["highlight-color"];return e("span",{style:{...null!==(a=null==K?void 0:K.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:i,children:o,...t})=>{var l,r,d,a,s,c;const u=null!==(r=null===(l=null==i?void 0:i.properties)||void 0===l?void 0:l.action)&&void 0!==r?r:null==t?void 0:t.action,p=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(c=null===(s=null==i?void 0:i.properties)||void 0===s?void 0:s["highlight-type"])&&void 0!==c?c:null==t?void 0:t["highlight-type"];return"highlight"===u?e(M,{highlightId:p,handleHighlightSpan:Fe,icon:"web"===g?null==xe?void 0:xe.webCitationIcon:"doc"===g?null==xe?void 0:xe.fileCitationIcon:e(n,{}),customStyles:"web"===g?null==K?void 0:K.webButton:"doc"===g?null==K?void 0:K.docButton:{}}):null},upt:({node:i,children:o,...t})=>{var l,r;const d=null==t?void 0:t.id,a=d?null===(r=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===r?void 0:r.replaceAll("@","<").replaceAll("#",">"):null,s=Ce.find(e=>e.id.toString()===a);if(!s)return o||e(n,{});const c="data-main"in t,u=t["data-status"];return e(n,{children:e(j,{aiReason:s,customStyles:null==K?void 0:K.inlineUpdatedComponent,handleClickCognitiveDecision:null==he?void 0:he.handleClickCognitiveDecision,handleClickUpdatedPill:null==he?void 0:he.handleClickUpdatedPill,handleClickOutputValue:null==he?void 0:he.handleClickOutputValue,customIcons:null==he?void 0:he.customIcons,CDNeededInChip:ae,showWaitingIconInChip:ce,showChip:c,status:u,children:o||e(n,{})})})},del:({node:o,children:t,...l})=>{var r;const{cleanedChildren:d,extractedNodes:a}=q(t,["ins"]);return i(n,{children:[e("span",{className:g.deleted,style:null!==(r=null==K?void 0:K.deleted)&&void 0!==r?r:{},...l,onClick:()=>{l.onclick&&l.onclick()},children:d}),a]})},ins:({children:o,...t})=>{var l;const{cleanedChildren:r,extractedNodes:d}=q(o,["del"]);return i(n,{children:[e("span",{className:g.inserted,style:null!==(l=null==K?void 0:K.inserted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:r}),d]})},preserved:({children:n,...i})=>e("span",{className:g.preserved,style:null==K?void 0:K.preserved,...i,children:n}),manual:({children:i,...o})=>{var t;const l=null===(t=null==o?void 0:o.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),r=Ce.find(e=>e.id.toString()===l),d=o["data-status"];return r?e(L,{aiReason:r,handleClick:null==Re?void 0:Re.handleClick,status:d,children:i}):i||e(n,{})},invisible:({children:i,...o})=>e(n,{}),h1:({node:n,...i})=>e("h1",{className:g.heading1,style:null==K?void 0:K.heading1,children:i.children}),h2:({node:n,...i})=>e("h2",{className:g.heading2,style:null==K?void 0:K.heading2,children:i.children}),h3:({node:n,...i})=>e("h3",{className:g.heading3,style:null==K?void 0:K.heading3,children:i.children}),b:({node:n,...i})=>e("b",{className:g.bold,style:null==K?void 0:K.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e("p",{...i,className:g.paragraph,style:null==K?void 0:K.paragraph,children:i.children}),updated:({node:n,...i})=>e(f,{...i,showUserStoryDiff:W,currentUpdatedTagId:Ae,setCurrentUpdatedTagId:je,userStory:ge,setUserStory:me,setAiReasoning:fe,node:n,isCraflow:ie,onCraAccept:oe,onCraReject:te,diffEditConfig:$e,customStyles:null==K?void 0:K.updatedContent,craFlowConfig:le}),ol:({node:n,...i})=>{var o,t,l;const r=null!==(l=null!==(t=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.start)&&void 0!==t?t:null==i?void 0:i.start)&&void 0!==l?l:void 0;return e("ol",{className:g.orderedList,style:null==K?void 0:K.olist,...r?{start:Number(r)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e("ul",{className:g.unorderedList,style:null==K?void 0:K.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e("div",{className:g.tableWrapper,children:e("table",{className:g.table,style:null==K?void 0:K.table,children:n})}),tr:({node:n,children:i})=>e(B,{node:n,children:i,customStyles:K}),td:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(D.Provider,{value:!0,children:e("td",{...l,style:t?{cssText:t}:void 0,children:i})})},th:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(D.Provider,{value:!0,children:e("th",{...l,style:t?{cssText:t}:void 0,children:i})})},recommendation:({node:n,...i})=>{var o;const t=`The AI has selected this content based on: ${(null===(o=null==i?void 0:i.children)||void 0===o?void 0:o[0])||""}`;return e(N,{...i,customStyles:null==K?void 0:K.recommendationBlock,label:t})},a:({inline:n,children:i,node:o,...t})=>{var l,r,d;const a=c(D)||"true"==(null==t?void 0:t.table),s=`${null==t?void 0:t.href}`,u=null===(l=s.split("$"))||void 0===l?void 0:l[0],p=null===(r=s.split("$"))||void 0===r?void 0:r[1];if("ai_reasoning"===u){const n=(null!==(d=W?Z:Ce)&&void 0!==d?d:[]).find(e=>e.id.toString()===decodeURIComponent(p)),o=Ie.includes(p);if(n){if(a)return e(F,{aiReason:n,customStyle:null==K?void 0:K.tableAiReasoning,customIcons:xe,isHighConfidence:n.relevance_score>=$});const t=Be(i),l="source"!==t.trim().toLowerCase();return e(R,{aiReason:n,isSourceHasHighlight:o,inlineLabel:t,isInlineCitation:l,customIcons:xe,customStyles:{aiReasoningContent:null==K?void 0:K.aiReasoningContent,aiReasoningAccordion:null==K?void 0:K.aiReasoningAccordion,aiReasoningMarkdown:null==K?void 0:K.aiReasoningMarkdown,aiReasoningPill:null==K?void 0:K.aiReasoningPill,webCitation:null==K?void 0:K.webCitation,stormeeCitation:null==K?void 0:K.stormeeCitation,waveformCitation:null==K?void 0:K.waveformCitation,imageCitation:null==K?void 0:K.imageCitation,fileCitation:null==K?void 0:K.fileCitation,appModCitation:null==K?void 0:K.appModCitation,rcaCitation:null==K?void 0:K.rcaCitation,readFileCitation:null==K?void 0:K.readFileCitation,loadingCitations:null==K?void 0:K.loadingCitations,chatCitation:null==K?void 0:K.chatCitation,bigEnoughCitation:null==K?void 0:K.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:o,node:t,...l})=>/language-(\w+)/.exec(o||"")||(null==o?void 0:o.includes("language-"))?e("div",{children:e("code",{className:g.blockCode,style:null==K?void 0:K.code,children:i})}):e("code",{className:g.inlineCode,style:null==K?void 0:K.code,children:i}),learned:({children:n})=>e(m,{title:n,placement:"top",children:e(v,{size:16,className:g.learned})}),generatedcode:({node:n,...i})=>{const o=(null==i?void 0:i.language)||"python",t=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e(y,{title:"Generated Code",code:t,language:o,customStyles:{pill:null==K?void 0:K.generatedCodePill,content:null==K?void 0:K.generatedCodeContent}})},updatedsegment:({node:n,children:i,...o})=>{var t,l,r,d;const a=`${null===(t=n.position)||void 0===t?void 0:t.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(o),c=e("div",s?{dangerouslySetInnerHTML:{__html:C.sanitize(s)}}:{children:i});return e(U,{id:a,node:n,children:c,props:o,segmentComponentConfig:be,customStyles:K,customIcons:X,extractText:Be,isUpdatedSegment:!0})},segment:({node:n,children:i,...o})=>{var t,l,r,d;const a=`${null===(t=n.position)||void 0===t?void 0:t.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e(U,{id:a,node:n,children:i,props:o,segmentComponentConfig:be,customStyles:K,customIcons:X,extractText:Be,blockId:se})}}),[_e,le,Ce,ee,Ae,W,t,X,we,Ie,K,be,Me,Fe,se]),qe=a(()=>{let e=T(Oe,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=P(e,n,"upt"===n)}),e},[Oe]);return s(()=>{if(!pe.current)return;if(!we.length)return void ke();let e;if(0===Ie.length||re)requestAnimationFrame(()=>{Ne([we[Se].replace(/\*/g,"")])});else{const n=pe.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{Ne([we[Se].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[we,Ie,Se,re]),e(_.Provider,{value:{expandedInfo:Ue,setExpanded:Pe,reasonToRow:Le},children:i("div",{ref:pe,className:`${g.container} ${"approving"!==H?g.wrapper:""} ${G||""}`,style:null==K?void 0:K.container,children:[b?e(E,{children:e(u,{components:Ve,rehypePlugins:[p],children:qe})}):S,De>0&&de&&e("div",{className:g.confidenceScoreContainer,style:null==K?void 0:K.confidenceScoreContainer,children:i("span",{className:g.confidenceScore,style:null==K?void 0:K.confidenceScore,children:[e(x,{size:14,color:(null==K?void 0:K.confidenceScoreIconColor)||"#166534"}),De,"%"]})}),z&&e("div",{className:g.citationLoader,style:null==K?void 0:K.citationLoaderContainer,children:e(w,{customStyles:{container:null==K?void 0:K.citationLoadingContainer,icon:null==K?void 0:K.citationLoadingIcon,text:null==K?void 0:K.citationLoadingText}})}),A&&e("div",{style:{...null===(ue=null==K?void 0:K.attachedContext)||void 0===ue?void 0:ue.wrapper},className:"flex mt-5",children:e(k,{customStyles:null==K?void 0:K.attachedContext,variant:Y})})]})})};export{z as default,q as splitNestedDiffNodes};
|
|
2
2
|
//# sourceMappingURL=UserStoryWithCitation.js.map
|