@e-llm-studio/citation 0.0.251-beta.1 → 0.0.252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRenderer.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRenderer.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRendererInner.js +2 -0
- package/dist/cjs/features/CognitiveCompare/CitationRendererInner.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CompareContext.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CompareContext.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/GptWebCitationPanel.js +2 -0
- package/dist/cjs/features/CognitiveCompare/GptWebCitationPanel.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/GuidelineSkeletonLoader.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/GuidelineSkeletonLoader.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useOnDemandCitationCache.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useOnDemandCitationCache.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/cacheKey.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/cacheKey.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/contextBuilder.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/contextBuilder.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/href.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/href.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/payload.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/payload.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/response.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/response.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js +2 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeInlineMarkdown.js +2 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeInlineMarkdown.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js +2 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js.map +1 -0
- package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js.map +1 -1
- package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js.map +1 -1
- package/dist/features/CognitiveCompare/CitationRenderer.js +1 -1
- package/dist/features/CognitiveCompare/CitationRenderer.js.map +1 -1
- package/dist/features/CognitiveCompare/CitationRendererInner.js +2 -0
- package/dist/features/CognitiveCompare/CitationRendererInner.js.map +1 -0
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js.map +1 -1
- package/dist/features/CognitiveCompare/CompareContext.js +1 -1
- package/dist/features/CognitiveCompare/CompareContext.js.map +1 -1
- package/dist/features/CognitiveCompare/GptWebCitationPanel.js +2 -0
- package/dist/features/CognitiveCompare/GptWebCitationPanel.js.map +1 -0
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js.map +1 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js.map +1 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js.map +1 -0
- package/dist/features/CognitiveCompare/components/GuidelineSkeletonLoader.js +2 -0
- package/dist/features/CognitiveCompare/components/GuidelineSkeletonLoader.js.map +1 -0
- package/dist/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
- package/dist/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -1
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SvgConnectors.js +1 -1
- package/dist/features/CognitiveCompare/components/SvgConnectors.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useOnDemandCitationCache.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useOnDemandCitationCache.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -1
- package/dist/features/CognitiveCompare/onDemandCitations/cacheKey.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/cacheKey.js.map +1 -0
- package/dist/features/CognitiveCompare/onDemandCitations/contextBuilder.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/contextBuilder.js.map +1 -0
- package/dist/features/CognitiveCompare/onDemandCitations/href.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/href.js.map +1 -0
- package/dist/features/CognitiveCompare/onDemandCitations/payload.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/payload.js.map +1 -0
- package/dist/features/CognitiveCompare/onDemandCitations/response.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/response.js.map +1 -0
- package/dist/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js +2 -0
- package/dist/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js.map +1 -0
- package/dist/features/CognitiveCompare/utils/normalizeInlineMarkdown.js +2 -0
- package/dist/features/CognitiveCompare/utils/normalizeInlineMarkdown.js.map +1 -0
- package/dist/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js +2 -0
- package/dist/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js.map +1 -0
- package/dist/features/SegmentReviewComponents/BoundaryCard.js +1 -1
- package/dist/features/SegmentReviewComponents/BoundaryCard.js.map +1 -1
- package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
- package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +1 -1
- package/dist/types/features/CognitiveCompare/CitationAnchor.d.ts +2 -0
- package/dist/types/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CitationRenderer.d.ts +8 -1
- package/dist/types/features/CognitiveCompare/CitationRenderer.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CitationRendererInner.d.ts +13 -0
- package/dist/types/features/CognitiveCompare/CitationRendererInner.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareConstants.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareConstants.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareTypes.d.ts +14 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveComparehelpers.d.ts +12 -0
- package/dist/types/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CompareContext.d.ts +10 -1
- package/dist/types/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/GptWebCitationPanel.d.ts +7 -0
- package/dist/types/features/CognitiveCompare/GptWebCitationPanel.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/utils/guidelineTargets.d.ts +3 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/guidelineTargets.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.d.ts +3 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +14 -1
- package/dist/types/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts +19 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/components/GuidelineSkeletonLoader.d.ts +8 -0
- package/dist/types/features/CognitiveCompare/components/GuidelineSkeletonLoader.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/components/LHSSectionRow.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SvgConnectors.d.ts +3 -2
- package/dist/types/features/CognitiveCompare/components/SvgConnectors.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +2 -1
- package/dist/types/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useOnDemandCitationCache.d.ts +10 -0
- package/dist/types/features/CognitiveCompare/hooks/useOnDemandCitationCache.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/onDemandCitations/cacheKey.d.ts +3 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/cacheKey.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/contextBuilder.d.ts +16 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/contextBuilder.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/href.d.ts +6 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/href.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/index.d.ts +7 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/index.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/payload.d.ts +4 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/payload.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/response.d.ts +3 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/response.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/types.d.ts +134 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/types.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeCompactedGfmTables.d.ts +7 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeCompactedGfmTables.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeInlineMarkdown.d.ts +6 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeInlineMarkdown.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeRedlineMarkdown.d.ts +6 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeRedlineMarkdown.d.ts.map +1 -0
- package/dist/types/features/SegmentReviewComponents/BoundaryCard.d.ts.map +1 -1
- package/dist/types/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts +3 -1
- package/dist/types/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubSectionAccordion.js","sources":["../../../../../src/features/CognitiveCompare/components/SubSectionAccordion.tsx"],"sourcesContent":["import React, { useMemo, useEffect, useRef } from \"react\";\nimport {\n Box,\n Typography,\n Accordion,\n AccordionSummary,\n AccordionDetails,\n Tooltip,\n} from \"@mui/material\";\nimport { ChevronDown, EllipsisVertical } from \"lucide-react\";\n\nimport { ButtonCognitiveIcon } from \"../../../assests/svg/ButtonCognitiveIcon\";\nimport { MemoizedMarkdown } from \"../hooks/memoizedMarkdown\";\nimport { useCompareContext } from \"../CompareContext\";\nimport {\n hasValue,\n safeStringify,\n generateColorPalette,\n isMissingStr,\n DEVIATION_BADGE_SEPARATOR,\n hasMeaningfulRedlineTags,\n stripRedlineTags,\n getRhsMappedSectionNumber,\n hasSingleMappedLhsSection,\n getLhsDeviationDisplayIndexes,\n} from \"../CognitiveComparehelpers\";\nimport { DEFAULT_DEVIAION_COLOR } from \"../CognitiveCompareConstants\";\nimport { DeviationDataEntry, SectionBlock, StyleVariant } from \"../CognitiveCompareTypes\";\n\ninterface SubSectionAccordionProps {\n section: SectionBlock;\n keyPath: string;\n depth?: number;\n columnKey?: \"left\" | \"right\";\n parentNodeId?: string;\n sectionOffset?: number;\n rhsOrphanVisualIndexes?: ReadonlyMap<string, number>;\n}\n\nconst SubSectionAccordion: React.FC<SubSectionAccordionProps> = React.memo((props) => {\n const {\n section,\n keyPath,\n depth = 0,\n columnKey = \"left\",\n parentNodeId = \"\",\n sectionOffset,\n rhsOrphanVisualIndexes,\n } = props;\n const {\n expandedSubSections,\n setExpandedSubSections,\n maintainRelativeOrder,\n showDeviationBadges = false,\n proposedSections,\n existingSections,\n treeData,\n deviationNumberRegistry,\n deviationParentRegistry,\n connectedSections,\n activeSideBySideSection,\n isSideBySide,\n scrollSyncLocked,\n toggleScrollSyncLocked,\n summaryPopupAnchorEl,\n resolvedMarkdownStyles,\n getSubSectionRef,\n getSubSectionCompareStyle,\n getBadgeRef,\n openMoreFunctionsPopup,\n openSummaryPopup,\n resetSideBySide,\n setConnectedSections,\n setConnectedLines,\n cachedConnectedPositions,\n isProposingFix,\n proposingFixNodeId,\n isRedlineFlow,\n unifiedNumbering,\n } = useCompareContext();\n\n const collisionKey = activeSideBySideSection ?? \"\";\n\n const hasTitle = (section.displayTitle ?? true) && hasValue(section.title);\n const isProposedFixTarget =\n !!isProposingFix &&\n !!proposingFixNodeId &&\n columnKey === \"left\" &&\n (section.id === proposingFixNodeId || section.nodeId === proposingFixNodeId);\n \n const hasRedlineTags = hasMeaningfulRedlineTags(section.content);\n const inferredRedlineFlow = hasRedlineTags;\n const resolvedRedlineFlow =\n typeof isRedlineFlow === \"boolean\" ? isRedlineFlow : inferredRedlineFlow;\n const suppressHighlightBg = hasRedlineTags;\n\n // Use history as the base when redlines exist so badge matching still works.\n const shouldOverlayContent = resolvedRedlineFlow && hasRedlineTags;\n const baseContent = shouldOverlayContent\n ? stripRedlineTags(section.content)\n : section.content;\n const overlayContent = shouldOverlayContent ? section.content : undefined;\n const hasContent = ((section.displayContent ?? true) || hasRedlineTags) && hasValue(section.content);\n const isEmpty = !hasTitle && !hasContent;\n\n const displayTitle = hasTitle ? section.title : hasContent ? \"No Title Found\" : \"No Matching Section Found\";\n const isExpanded = !!expandedSubSections[keyPath];\n const colRef = getSubSectionRef(columnKey, keyPath);\n \n const pathParts = keyPath.split('-').map(Number);\n const rootIndex = pathParts[0];\n\n let baseRoot: any = proposedSections[rootIndex];\n let refRoot: any = existingSections[rootIndex];\n let leftRootIndex = rootIndex;\n let rightRootIndex = rootIndex;\n let isRootOrphan = false;\n\n const findSectionPathById = (\n root: any,\n targetId: string | undefined,\n rootPath: string,\n ): { section: any; keyPath: string } | null => {\n if (!root || !targetId) return null;\n if (root.id === targetId || root.nodeId === targetId || root.contentId === targetId) return { section: root, keyPath: rootPath };\n\n const stack = (root.subsections || []).map((child: any, idx: number) => ({\n section: child,\n keyPath: `${rootPath}-${idx}`,\n }));\n\n while (stack.length > 0) {\n const current = stack.shift();\n if (!current?.section) continue;\n if (\n current.section.id === targetId ||\n current.section.nodeId === targetId ||\n current.section.contentId === targetId\n ) return current;\n\n (current.section.subsections || []).forEach((child: any, idx: number) => {\n stack.push({\n section: child,\n keyPath: `${current.keyPath}-${idx}`,\n });\n });\n }\n\n return null;\n };\n\n if (maintainRelativeOrder) {\n if (columnKey === \"left\") {\n const rhsSelfIndex = baseRoot?.refIndexes?.[0];\n const rhsArrayIdx = existingSections.findIndex((s: any) => s.selfIndex === rhsSelfIndex);\n if (rhsArrayIdx !== -1) {\n refRoot = existingSections[rhsArrayIdx];\n rightRootIndex = rhsArrayIdx;\n } else {\n isRootOrphan = true;\n }\n } else {\n const lhsSelfIndex = refRoot?.refIndexes?.[0];\n const lhsArrayIdx = proposedSections.findIndex((s: any) => s.selfIndex === lhsSelfIndex);\n if (lhsArrayIdx !== -1) {\n baseRoot = proposedSections[lhsArrayIdx];\n leftRootIndex = lhsArrayIdx;\n } else {\n isRootOrphan = true;\n }\n }\n }\n\n // --- UNIFIED COUNTERPART LOOKUP ENGINE ---\n const findGlobalPathById = (sections: any[], targetId: string | undefined) => {\n if (!targetId || !sections) return null;\n for (let i = 0; i < sections.length; i++) {\n const match = findSectionPathById(sections[i], targetId, String(i));\n if (match) return match;\n }\n return null;\n };\n\n let bSec: any = null;\n let rSec: any = null;\n let leftKeyPath = \"\";\n let rightKeyPath = \"\";\n\n if (maintainRelativeOrder) {\n if (columnKey === \"left\") {\n bSec = section;\n leftKeyPath = keyPath;\n\n // Try looking within the relative matched root section first\n let rightMatch = findSectionPathById(refRoot, section.nodeId || section.id, String(rightRootIndex));\n \n // Fallback globally across the entire RHS tree if cross-wired or mismatched\n if (!rightMatch) {\n rightMatch = findGlobalPathById(existingSections, section.nodeId || section.id);\n }\n\n rSec = rightMatch?.section || null;\n rightKeyPath = rightMatch?.keyPath || \"\";\n } else {\n rSec = section;\n rightKeyPath = keyPath;\n\n // Try looking within the relative matched root section first\n let leftMatch = findSectionPathById(baseRoot, section.nodeId || section.id, String(leftRootIndex));\n \n // Fallback globally across the entire LHS tree if cross-wired or mismatched\n if (!leftMatch) {\n leftMatch = findGlobalPathById(proposedSections, section.nodeId || section.id);\n }\n\n bSec = leftMatch?.section || null;\n leftKeyPath = leftMatch?.keyPath || \"\";\n }\n } else {\n // When maintainRelativeOrder is false, absolute structural paths diverge completely.\n // Index path crawling fails here. Execute absolute global ID tracing to handle re-routed clauses.\n if (columnKey === \"left\") {\n bSec = section;\n leftKeyPath = keyPath;\n\n const rightMatch = findGlobalPathById(existingSections, section.nodeId || section.id);\n rSec = rightMatch?.section || null;\n rightKeyPath = rightMatch?.keyPath || \"\";\n } else {\n rSec = section;\n rightKeyPath = keyPath;\n\n const leftMatch = findGlobalPathById(proposedSections, section.nodeId || section.id);\n bSec = leftMatch?.section || null;\n leftKeyPath = leftMatch?.keyPath || \"\";\n }\n }\n\n const style = (leftKeyPath ? getSubSectionCompareStyle(leftKeyPath) : null) || getSubSectionCompareStyle(keyPath);\n const leftDocId = treeData?.input_index_map?.[\"0\"];\n const rightDocId = treeData?.input_index_map?.[\"1\"];\n const counterpartNodeId = columnKey === \"left\" ? rightDocId : leftDocId;\n\n const isSecOrphan = columnKey === \"left\" ? !rSec : !bSec;\n const hasSingleMappedLhs =\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n hasSingleMappedLhsSection(refRoot, proposedSections);\n \n const targetEvalResult = section.evaluationResult || bSec?.evaluationResult || rSec?.evaluationResult;\n\n const deviations = targetEvalResult?.deviations || {};\n const lhsDeviationDisplayIndexes = useMemo(\n () =>\n maintainRelativeOrder && columnKey === \"right\"\n ? getLhsDeviationDisplayIndexes(\n proposedSections,\n leftDocId,\n deviationNumberRegistry,\n )\n : new Map<string, number>(),\n [\n maintainRelativeOrder,\n columnKey,\n proposedSections,\n leftDocId,\n deviationNumberRegistry,\n ],\n );\n let nodeId = section.nodeId || section.id || bSec?.nodeId || bSec?.id || rSec?.nodeId || rSec?.id;\n\n // For Subsections, use the exact LHS counterpart subsection (bSec) ID for registry lookup\n if (maintainRelativeOrder && columnKey !== \"left\") {\n if (bSec?.id) {\n nodeId = bSec.nodeId || bSec.id;\n }\n }\n\n // Derive validatedParentNum from registry\n const firstDeviationKey = Object.keys(deviations)[0];\n const firstRefId = firstDeviationKey ? `${nodeId}${DEVIATION_BADGE_SEPARATOR}${firstDeviationKey}` : null;\n const registeredParentNum = firstRefId ? (deviationParentRegistry?.[firstRefId] as number) : null;\n\n let validatedParentNum: string | number = rootIndex + 1;\n\n if (maintainRelativeOrder && unifiedNumbering) {\n const unifiedNum = columnKey === \"left\" \n ? unifiedNumbering.leftNums.get(baseRoot?.id) \n : unifiedNumbering.rightNums.get(refRoot?.id);\n\n if (isRootOrphan && unifiedNum !== undefined) {\n validatedParentNum = unifiedNum;\n } else if (registeredParentNum !== null && registeredParentNum !== undefined && registeredParentNum >= 0) {\n validatedParentNum = registeredParentNum;\n } else if (unifiedNum !== undefined) {\n validatedParentNum = unifiedNum;\n }\n } else if (registeredParentNum !== null && registeredParentNum !== undefined && registeredParentNum >= 0) {\n validatedParentNum = registeredParentNum;\n }\n\n const deviationColorData = targetEvalResult?.evaluation_outputs?.metadata?.label_color ?? DEFAULT_DEVIAION_COLOR;\n const deviationPalette = generateColorPalette(deviationColorData);\n const { highlightBg } = deviationPalette;\n\n \n const highlights: string[] = [];\n \n const rawDeviationEntries = Object.entries(deviations).map(([deviationKey, deviationMap]: [string, any]) => {\n const refId = `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`;\n const currentIndex = deviationNumberRegistry[refId];\n return { deviationKey, deviationMap, refId, currentIndex };\n }).filter(item => item.currentIndex !== undefined && item.currentIndex !== null);\n\n rawDeviationEntries.sort((a, b) => a.currentIndex - b.currentIndex);\n\n const localRhsOrphanVisualIndexes = new Map<string, number>();\n if (\n !rhsOrphanVisualIndexes &&\n maintainRelativeOrder &&\n columnKey === \"right\"\n ) {\n const normalizedContent = safeStringify(baseContent || \"\").replace(/\\\\n/g, \"\\n\");\n rawDeviationEntries\n .filter(({ deviationMap }) => {\n const ownHighlight = deviationMap[parentNodeId];\n const isOrphan =\n isSecOrphan || isMissingStr(deviationMap[counterpartNodeId as string]);\n return isOrphan && !!ownHighlight && !isMissingStr(ownHighlight);\n })\n .map((entry) => {\n const normalizedHighlight = safeStringify(\n entry.deviationMap[parentNodeId] || \"\",\n ).replace(/\\\\n/g, \"\\n\");\n const position = normalizedHighlight\n ? normalizedContent.indexOf(normalizedHighlight)\n : -1;\n return { ...entry, position };\n })\n .sort((a, b) => {\n const aPosition = a.position === -1 ? Number.MAX_SAFE_INTEGER : a.position;\n const bPosition = b.position === -1 ? Number.MAX_SAFE_INTEGER : b.position;\n return aPosition - bPosition || a.currentIndex - b.currentIndex;\n })\n .forEach((entry, index) => {\n localRhsOrphanVisualIndexes.set(entry.refId, index + 1);\n });\n }\n\n const deviationEntries = rawDeviationEntries\n .map((item) => {\n const { deviationKey, deviationMap, refId } = item;\n let currentIndex = item.currentIndex;\n\n // if (maintainRelativeOrder && sectionOffset !== undefined) {\n // currentIndex = currentIndex - sectionOffset;\n // }\n // currentIndex = Math.max(1, currentIndex);\n\n let highlight = deviationMap[parentNodeId];\n const isMissingClause = isMissingStr(highlight);\n\n if (isMissingClause) highlight = \"\";\n else if (!highlight) return null;\n\n highlights.push(highlight);\n\n const counterpartHighlight = deviationMap[counterpartNodeId as string];\n\n const isDeviationOrphan = isSecOrphan || isMissingStr(counterpartHighlight);\n const orphanVisualIndex =\n rhsOrphanVisualIndexes?.get(refId) ??\n localRhsOrphanVisualIndexes.get(refId);\n const mappedLhsIndex = lhsDeviationDisplayIndexes.get(refId);\n if (\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n isDeviationOrphan &&\n orphanVisualIndex !== undefined\n ) {\n currentIndex = orphanVisualIndex;\n } else if (\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n !isDeviationOrphan &&\n mappedLhsIndex !== undefined\n ) {\n currentIndex = mappedLhsIndex;\n } else if (\n maintainRelativeOrder &&\n sectionOffset !== undefined &&\n (columnKey !== \"right\" || isDeviationOrphan || hasSingleMappedLhs)\n ) {\n currentIndex = currentIndex - sectionOffset;\n }\n currentIndex = Math.max(1, currentIndex);\n\n const badgeParentNum =\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n isDeviationOrphan &&\n unifiedNumbering\n ? getRhsMappedSectionNumber({\n section: refRoot,\n proposedSections,\n leftNums: unifiedNumbering.leftNums,\n fallbackNumber: String(validatedParentNum),\n firstOnly: true,\n })\n : validatedParentNum;\n const badgeLabel = `${badgeParentNum}.${currentIndex}`;\n const actionId = `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}${DEVIATION_BADGE_SEPARATOR}${leftKeyPath}${DEVIATION_BADGE_SEPARATOR}${rightKeyPath}`;\n const deviationOutput = deviationMap?.evaluation_outputs || targetEvalResult?.evaluation_outputs;\n const deviationScore = deviationOutput?.output_value ?? null;\n const deviationColorForBadge = deviationOutput?.metadata?.label_color ?? deviationColorData;\n const deviationPaletteForBadge = generateColorPalette(deviationColorForBadge);\n let badgeStyle = { ...deviationPaletteForBadge } as StyleVariant;\n\n const summaryPayload = deviationMap?.deviation_summary\n ? {\n deviation_summary: deviationMap.deviation_summary || targetEvalResult?.deviation_summary,\n deviation_title: deviationMap?.deviation_title || targetEvalResult?.deviation_title,\n deviation_impact: deviationMap?.deviation_impact || targetEvalResult?.deviation_impact,\n deviation_explanation:\n deviationMap?.deviation_explanation || targetEvalResult?.deviation_explanation,\n evaluation_outputs: deviationOutput,\n cognitive_decisioning:\n deviationMap?.cognitive_decisioning || targetEvalResult?.cognitive_decisioning,\n }\n : null;\n\n let stackIndex = 0;\n const contentStr = baseContent || \"\";\n if (highlight && contentStr) {\n const paragraphs = contentStr.split(/\\n{2,}/);\n const paraIndex = paragraphs.findIndex(p => p.includes(highlight));\n if (paraIndex !== -1) {\n const devsInPara = Object.entries(deviations)\n .filter(([_, dMap]: any) => {\n const hl = dMap[parentNodeId];\n return hl && paragraphs[paraIndex].includes(hl);\n })\n .sort((a: any, b: any) => paragraphs[paraIndex].indexOf(a[1][parentNodeId]) - paragraphs[paraIndex].indexOf(b[1][parentNodeId]));\n const overlappingDevs = devsInPara.filter(([_, dMap]: any) => {\n const hl = dMap[parentNodeId];\n return hl && (hl.includes(highlight) || highlight.includes(hl));\n });\n if (overlappingDevs.length > 1) {\n stackIndex = Math.max(0, overlappingDevs.findIndex(([k]) => k === deviationKey));\n }\n }\n }\n\n const badgeRef = getBadgeRef(columnKey, refId);\n\n return {\n id: refId,\n actionId: actionId,\n label: badgeLabel,\n highlight,\n side: columnKey,\n style: badgeStyle,\n stackIndex,\n score: deviationScore,\n isConnected: connectedSections.has(actionId as any),\n showScrollLockToggle:\n connectedSections.has(actionId as any) ||\n (isSideBySide && activeSideBySideSection === actionId) ||\n (!!summaryPopupAnchorEl && summaryPopupAnchorEl === badgeRef.current),\n scrollSyncLocked,\n toggleScrollSyncLocked,\n isOrphan: isDeviationOrphan,\n isMissingClause,\n badgeRef,\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n const popupBaseSec = bSec ? { ...bSec, title: baseRoot?.title || bSec?.title || \"\" } : { id: \"orphan-left\", title: \"\", content: \"\" };\n const popupRefSec = rSec ? { ...rSec, title: refRoot?.title || rSec?.title || \"\" } : { id: \"orphan-right\", title: \"\", content: \"\" };\n \n openMoreFunctionsPopup(e, popupBaseSec, isDeviationOrphan, popupRefSec, actionId, badgeStyle); \n },\n onSummaryClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n openSummaryPopup(e, actionId, isDeviationOrphan, summaryPayload);\n }\n };\n })\n .filter(Boolean)\n .sort((a: any, b: any) => {\n const numA = parseFloat(a.label);\n const numB = parseFloat(b.label);\n return numA - numB;\n });\n\n const deduplicatedEntries = useMemo(() => {\n const seenRefIds = new Set<string>();\n return deviationEntries.filter((entry: any) => {\n if (seenRefIds.has(entry.id)) return false;\n seenRefIds.add(entry.id);\n return true;\n });\n }, [deviationEntries]);\n\n\n const baseShouldRenderBadges =\n showDeviationBadges || (!resolvedRedlineFlow && isProposedFixTarget);\n const shouldRenderBadges = baseShouldRenderBadges;\n const deviationBadgesToRender = shouldRenderBadges ? deduplicatedEntries : [];\nconst highlightsToRender = deduplicatedEntries.map((b: any) => b.highlight).filter(Boolean);\n\n // const hasScrolledRef = useRef(false);\n\n // useEffect(() => {\n // if (!isExpanded) {\n // hasScrolledRef.current = false;\n // }\n // }, [isExpanded]);\n\n // useEffect(() => {\n // if (!isExpanded || hasScrolledRef.current) return;\n\n // const timer = setTimeout(() => {\n // hasScrolledRef.current = true;\n \n // const firstBadgeRef = deviationEntries[0]?.badgeRef?.current;\n \n // if (firstBadgeRef) {\n // firstBadgeRef.scrollIntoView({\n // behavior: \"smooth\",\n // block: \"center\",\n // });\n // }\n // }, 350); \n\n // return () => clearTimeout(timer);\n // }, [isExpanded, deviationEntries]);\n\n const connectedBadge = deviationEntries.find((b: any) => connectedSections.has(b.actionId));\n const isConnected = !!connectedBadge;\n\n if (!hasTitle && !hasContent && (!section.subsections || section.subsections.length === 0)) return null;\n\n const handleToggle = () => {\n if (!isEmpty) {\n if (isExpanded) {\n const activeBadgeIdStr = String(activeSideBySideSection || \"\");\n let needsReset = activeBadgeIdStr.includes(leftKeyPath) || activeBadgeIdStr.includes(rightKeyPath);\n\n if (!needsReset) {\n connectedSections.forEach((id) => {\n if (String(id).includes(leftKeyPath) || String(id).includes(rightKeyPath)) needsReset = true;\n });\n }\n\n if (needsReset) {\n resetSideBySide();\n setConnectedSections(new Set());\n setConnectedLines([]);\n cachedConnectedPositions.current = [];\n }\n }\n setExpandedSubSections((prev) => ({ ...prev, [keyPath]: !prev[keyPath] }));\n }\n };\n const outlineColor = connectedBadge?.style?.badgeBorder || style?.badgeBorder;\n const outlineStyles = isConnected && outlineColor\n ? { borderRadius: \"4px\", outline: `2px solid ${outlineColor}`, outlineOffset: \"1px\" }\n : {};\n\n if (!hasTitle) {\n return (\n <Box ref={colRef} sx={{ mt: depth === 0 ? 1 : 0.75, width: \"100%\", minWidth: 0, position: \"relative\" }}>\n {!isEmpty && (\n <Box sx={{ width: \"100%\", ...outlineStyles }}>\n {hasContent && (\n <MemoizedMarkdown\n content={baseContent}\n overlayContent={overlayContent}\n sxStyles={resolvedMarkdownStyles}\n deviationBadges={deviationBadgesToRender}\n maintainRelativeOrder={maintainRelativeOrder}\n highlightBg={highlightBg}\n suppressHighlightBg={suppressHighlightBg}\n highlights={highlightsToRender} \n collisionKey={collisionKey}\n />\n )}\n {(section.subsections || []).map((sub, subIdx) => (\n <SubSectionAccordion\n key={`${keyPath}-${subIdx}`}\n section={sub}\n keyPath={`${keyPath}-${subIdx}`}\n depth={depth + 1}\n columnKey={columnKey}\n parentNodeId={parentNodeId}\n sectionOffset={sectionOffset}\n rhsOrphanVisualIndexes={rhsOrphanVisualIndexes}\n />\n ))}\n </Box>\n )}\n </Box>\n );\n }\n\n return (\n <Box ref={colRef} sx={{ mt: 1, width: \"100%\", minWidth: 0, position: \"relative\" }}>\n <Box sx={{ width: \"100%\", ...outlineStyles }}>\n <Accordion\n disableGutters\n expanded={isEmpty ? false : isExpanded}\n onChange={handleToggle}\n sx={{\n mt: 0,\n boxShadow: \"none\",\n border: isEmpty ? \"1px dashed #E2E8F0\" : \"1px solid #EEF2F7\",\n borderRadius: \"4px !important\",\n bgcolor: \"#FFFFFF\",\n minWidth: 0,\n \"&:before\": { display: \"none\" },\n }}\n >\n <AccordionSummary expandIcon={isEmpty ? null : <ChevronDown size={14} />} sx={{ minHeight: \"32px\", \"& .MuiAccordionSummary-content\": { my: 0.5, display: \"grid\", alignItems: \"center\", minWidth: 0, width: \"100%\" } }}>\n <Typography component=\"div\" sx={{ fontSize: \"11px\", fontWeight: 600, color: isEmpty ? \"#94A3B8\" : \"#19213D\", overflow: \"hidden\", textOverflow: \"ellipsis\", whiteSpace: \"nowrap\", width: \"100%\", minWidth: 0 }}>\n {displayTitle || \"Untitled Subsection\"}\n </Typography>\n </AccordionSummary>\n {!isEmpty && (\n <AccordionDetails sx={{ pt: 0, pb: 1, minWidth: 0 }}>\n {hasContent && (\n <MemoizedMarkdown\n content={baseContent}\n overlayContent={overlayContent}\n sxStyles={resolvedMarkdownStyles}\n deviationBadges={deviationBadgesToRender}\n maintainRelativeOrder={maintainRelativeOrder}\n highlightBg={highlightBg}\n suppressHighlightBg={suppressHighlightBg}\n highlights={highlightsToRender}\n collisionKey={collisionKey}\n />\n )}\n {(section.subsections || []).map((sub, subIdx) => (\n <SubSectionAccordion\n key={`${keyPath}-${subIdx}`}\n section={sub}\n keyPath={`${keyPath}-${subIdx}`}\n depth={depth + 1}\n columnKey={columnKey}\n parentNodeId={parentNodeId}\n sectionOffset={sectionOffset}\n rhsOrphanVisualIndexes={rhsOrphanVisualIndexes}\n />\n ))}\n </AccordionDetails>\n )}\n </Accordion>\n </Box>\n </Box>\n );\n});\n\nexport default SubSectionAccordion;\n"],"names":["SubSectionAccordion","memo","props","section","keyPath","depth","columnKey","parentNodeId","sectionOffset","rhsOrphanVisualIndexes","expandedSubSections","setExpandedSubSections","maintainRelativeOrder","showDeviationBadges","proposedSections","existingSections","treeData","deviationNumberRegistry","deviationParentRegistry","connectedSections","activeSideBySideSection","isSideBySide","scrollSyncLocked","toggleScrollSyncLocked","summaryPopupAnchorEl","resolvedMarkdownStyles","getSubSectionRef","getSubSectionCompareStyle","getBadgeRef","openMoreFunctionsPopup","openSummaryPopup","resetSideBySide","setConnectedSections","setConnectedLines","cachedConnectedPositions","isProposingFix","proposingFixNodeId","isRedlineFlow","unifiedNumbering","useCompareContext","collisionKey","hasTitle","displayTitle","hasValue","title","isProposedFixTarget","id","nodeId","hasRedlineTags","hasMeaningfulRedlineTags","content","resolvedRedlineFlow","suppressHighlightBg","shouldOverlayContent","baseContent","stripRedlineTags","overlayContent","hasContent","displayContent","isEmpty","isExpanded","colRef","rootIndex","split","map","Number","baseRoot","refRoot","leftRootIndex","rightRootIndex","isRootOrphan","findSectionPathById","root","targetId","rootPath","contentId","stack","subsections","child","idx","length","current","shift","forEach","push","rhsSelfIndex","refIndexes","rhsArrayIdx","findIndex","s","selfIndex","lhsSelfIndex","lhsArrayIdx","findGlobalPathById","sections","i","match","String","bSec","rSec","leftKeyPath","rightKeyPath","rightMatch","leftMatch","style","leftDocId","input_index_map","rightDocId","counterpartNodeId","isSecOrphan","hasSingleMappedLhs","hasSingleMappedLhsSection","targetEvalResult","evaluationResult","deviations","lhsDeviationDisplayIndexes","useMemo","getLhsDeviationDisplayIndexes","Map","firstDeviationKey","Object","keys","firstRefId","DEVIATION_BADGE_SEPARATOR","registeredParentNum","validatedParentNum","unifiedNum","leftNums","get","rightNums","deviationColorData","evaluation_outputs","metadata","label_color","DEFAULT_DEVIAION_COLOR","deviationPalette","generateColorPalette","highlightBg","rawDeviationEntries","entries","deviationKey","deviationMap","refId","currentIndex","filter","item","sort","a","b","localRhsOrphanVisualIndexes","normalizedContent","safeStringify","replace","ownHighlight","isMissingStr","entry","normalizedHighlight","position","indexOf","MAX_SAFE_INTEGER","index","set","deviationEntries","highlight","isMissingClause","counterpartHighlight","isDeviationOrphan","orphanVisualIndex","mappedLhsIndex","Math","max","badgeLabel","getRhsMappedSectionNumber","fallbackNumber","firstOnly","actionId","deviationOutput","deviationScore","output_value","deviationColorForBadge","badgeStyle","summaryPayload","deviation_summary","deviation_title","deviation_impact","deviation_explanation","cognitive_decisioning","stackIndex","contentStr","paragraphs","paraIndex","p","includes","overlappingDevs","_","dMap","hl","k","badgeRef","label","side","score","isConnected","has","showScrollLockToggle","isOrphan","onClick","e","stopPropagation","popupBaseSec","popupRefSec","onSummaryClick","Boolean","parseFloat","deduplicatedEntries","seenRefIds","Set","add","deviationBadgesToRender","highlightsToRender","connectedBadge","find","outlineColor","badgeBorder","outlineStyles","borderRadius","outline","outlineOffset","jsx","Box","ref","sx","mt","width","minWidth","children","jsxs","Accordion","disableGutters","expanded","onChange","activeBadgeIdStr","needsReset","prev","boxShadow","border","bgcolor","display","AccordionSummary","expandIcon","ChevronDown","size","minHeight","my","alignItems","Typography","component","fontSize","fontWeight","color","overflow","textOverflow","whiteSpace","AccordionDetails","pt","pb","MemoizedMarkdown","sxStyles","deviationBadges","highlights","sub","subIdx"],"mappings":"2ZAuCA,MAAMA,OAA0D,QAAMC,KAAMC,IACpE,MAAAC,QACJA,EAAAC,QACAA,EAAAC,MACAA,EAAQ,EAAAC,UACRA,EAAY,OAAAC,aACZA,EAAe,GAAAC,cACfA,EAAAC,uBACAA,GACEP,GACEQ,oBACJA,EAAAC,uBACAA,EAAAC,sBACAA,EAAAC,oBACAA,GAAsB,EAAAC,iBACtBA,EAAAC,iBACAA,EAAAC,SACAA,EAAAC,wBACAA,EAAAC,wBACAA,EAAAC,kBACAA,E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EACVmP,gBAAiBlD,GACjB9M,wBACA6H,eACArF,sBACAyN,WAAYlD,GACZnL,kBAGFrC,EAAQ0E,aAAe,IAAIb,IAAI,CAAC8M,EAAKC,IACnC3C,EAAAA,IAACpO,EAAA,CAECG,QAAS2Q,EACT1Q,QAAS,GAAGA,KAAW2Q,IACvB1Q,MAAOA,EAAQ,EACfC,YACAC,eACAC,gBACAC,0BAPK,GAAGL,KAAW2Q"}
|
|
1
|
+
{"version":3,"file":"SubSectionAccordion.js","sources":["../../../../../src/features/CognitiveCompare/components/SubSectionAccordion.tsx"],"sourcesContent":["import React, { useMemo, useEffect, useRef } from \"react\";\nimport {\n Box,\n Typography,\n Accordion,\n AccordionSummary,\n AccordionDetails,\n Tooltip,\n} from \"@mui/material\";\nimport { ChevronDown, EllipsisVertical } from \"lucide-react\";\n\nimport { ButtonCognitiveIcon } from \"../../../assests/svg/ButtonCognitiveIcon\";\nimport { MemoizedMarkdown } from \"../hooks/memoizedMarkdown\";\nimport { useCompareContext } from \"../CompareContext\";\nimport {\n hasValue,\n safeStringify,\n generateColorPalette,\n isMissingStr,\n DEVIATION_BADGE_SEPARATOR,\n hasMeaningfulRedlineTags,\n stripRedlineTags,\n findTextMatchRange,\n getRhsMappedSectionNumber,\n hasSingleMappedLhsSection,\n getLhsDeviationDisplayIndexes,\n} from \"../CognitiveComparehelpers\";\nimport { DEFAULT_DEVIAION_COLOR } from \"../CognitiveCompareConstants\";\nimport { DeviationDataEntry, SectionBlock, StyleVariant } from \"../CognitiveCompareTypes\";\nimport { normalizeRedlineMarkdown } from \"../utils/normalizeRedlineMarkdown\";\nimport { findTextRangeWithFormatting } from \"../utils/normalizeInlineMarkdown\";\n\ninterface SubSectionAccordionProps {\n section: SectionBlock;\n keyPath: string;\n depth?: number;\n columnKey?: \"left\" | \"right\";\n parentNodeId?: string;\n sectionOffset?: number;\n rhsOrphanVisualIndexes?: ReadonlyMap<string, number>;\n}\n\nconst SubSectionAccordion: React.FC<SubSectionAccordionProps> = React.memo((props) => {\n const {\n section,\n keyPath,\n depth = 0,\n columnKey = \"left\",\n parentNodeId = \"\",\n sectionOffset,\n rhsOrphanVisualIndexes,\n } = props;\n const {\n expandedSubSections,\n setExpandedSubSections,\n maintainRelativeOrder,\n showDeviationBadges = false,\n proposedSections,\n existingSections,\n treeData,\n deviationNumberRegistry,\n deviationParentRegistry,\n connectedSections,\n activeSideBySideSection,\n isSideBySide,\n scrollSyncLocked,\n toggleScrollSyncLocked,\n summaryPopupAnchorEl,\n resolvedMarkdownStyles,\n getSubSectionRef,\n getSubSectionCompareStyle,\n getBadgeRef,\n openMoreFunctionsPopup,\n openSummaryPopup,\n resetSideBySide,\n setConnectedSections,\n setConnectedLines,\n cachedConnectedPositions,\n isProposingFix,\n proposingFixNodeId,\n isRedlineFlow,\n unifiedNumbering,\n } = useCompareContext();\n\n const collisionKey = activeSideBySideSection ?? \"\";\n\n const hasTitle = (section.displayTitle ?? true) && hasValue(section.title);\n const isProposedFixTarget =\n !!isProposingFix &&\n !!proposingFixNodeId &&\n columnKey === \"left\" &&\n (section.id === proposingFixNodeId ||\n section.nodeId === proposingFixNodeId ||\n section.contentId === proposingFixNodeId);\n \n const hasRedlineTags = hasMeaningfulRedlineTags(section.content);\n const inferredRedlineFlow = hasRedlineTags;\n const resolvedRedlineFlow =\n typeof isRedlineFlow === \"boolean\" ? isRedlineFlow : inferredRedlineFlow;\n const suppressHighlightBg = hasRedlineTags;\n const changeHistoryContent = section.change_history;\n\n // Use all visible redline text as the base so changed-only highlights can match.\n const shouldOverlayContent = resolvedRedlineFlow && hasRedlineTags;\n const normalizedRedlineContent = useMemo(\n () => shouldOverlayContent\n ? normalizeRedlineMarkdown(safeStringify(section.content))\n : safeStringify(section.content),\n [section.content, shouldOverlayContent],\n );\n const baseContent = shouldOverlayContent\n ? stripRedlineTags(normalizedRedlineContent)\n : section.content;\n const overlayContent = shouldOverlayContent ? normalizedRedlineContent : undefined;\n const fallbackContent =\n hasRedlineTags && hasValue(changeHistoryContent)\n ? safeStringify(changeHistoryContent)\n : undefined;\n const hasContent = ((section.displayContent ?? true) || hasRedlineTags) && hasValue(section.content);\n const isEmpty = !hasTitle && !hasContent;\n\n const displayTitle = hasTitle ? section.title : hasContent ? \"No Title Found\" : \"No Matching Section Found\";\n const isExpanded = !!expandedSubSections[keyPath];\n const colRef = getSubSectionRef(columnKey, keyPath);\n \n const pathParts = keyPath.split('-').map(Number);\n const rootIndex = pathParts[0];\n\n let baseRoot: any = proposedSections[rootIndex];\n let refRoot: any = existingSections[rootIndex];\n let leftRootIndex = rootIndex;\n let rightRootIndex = rootIndex;\n let isRootOrphan = false;\n\n const findSectionPathById = (\n root: any,\n targetId: string | undefined,\n rootPath: string,\n ): { section: any; keyPath: string } | null => {\n if (!root || !targetId) return null;\n if (root.id === targetId || root.nodeId === targetId || root.contentId === targetId) return { section: root, keyPath: rootPath };\n\n const stack = (root.subsections || []).map((child: any, idx: number) => ({\n section: child,\n keyPath: `${rootPath}-${idx}`,\n }));\n\n while (stack.length > 0) {\n const current = stack.shift();\n if (!current?.section) continue;\n if (\n current.section.id === targetId ||\n current.section.nodeId === targetId ||\n current.section.contentId === targetId\n ) return current;\n\n (current.section.subsections || []).forEach((child: any, idx: number) => {\n stack.push({\n section: child,\n keyPath: `${current.keyPath}-${idx}`,\n });\n });\n }\n\n return null;\n };\n\n if (maintainRelativeOrder) {\n if (columnKey === \"left\") {\n const rhsSelfIndex = baseRoot?.refIndexes?.[0];\n const rhsArrayIdx = existingSections.findIndex((s: any) => s.selfIndex === rhsSelfIndex);\n if (rhsArrayIdx !== -1) {\n refRoot = existingSections[rhsArrayIdx];\n rightRootIndex = rhsArrayIdx;\n } else {\n isRootOrphan = true;\n }\n } else {\n const lhsSelfIndex = refRoot?.refIndexes?.[0];\n const lhsArrayIdx = proposedSections.findIndex((s: any) => s.selfIndex === lhsSelfIndex);\n if (lhsArrayIdx !== -1) {\n baseRoot = proposedSections[lhsArrayIdx];\n leftRootIndex = lhsArrayIdx;\n } else {\n isRootOrphan = true;\n }\n }\n }\n\n // --- UNIFIED COUNTERPART LOOKUP ENGINE ---\n const findGlobalPathById = (sections: any[], targetId: string | undefined) => {\n if (!targetId || !sections) return null;\n for (let i = 0; i < sections.length; i++) {\n const match = findSectionPathById(sections[i], targetId, String(i));\n if (match) return match;\n }\n return null;\n };\n\n let bSec: any = null;\n let rSec: any = null;\n let leftKeyPath = \"\";\n let rightKeyPath = \"\";\n\n if (maintainRelativeOrder) {\n if (columnKey === \"left\") {\n bSec = section;\n leftKeyPath = keyPath;\n\n // Try looking within the relative matched root section first\n let rightMatch = findSectionPathById(refRoot, section.nodeId || section.id, String(rightRootIndex));\n \n // Fallback globally across the entire RHS tree if cross-wired or mismatched\n if (!rightMatch) {\n rightMatch = findGlobalPathById(existingSections, section.nodeId || section.id);\n }\n\n rSec = rightMatch?.section || null;\n rightKeyPath = rightMatch?.keyPath || \"\";\n } else {\n rSec = section;\n rightKeyPath = keyPath;\n\n // Try looking within the relative matched root section first\n let leftMatch = findSectionPathById(baseRoot, section.nodeId || section.id, String(leftRootIndex));\n \n // Fallback globally across the entire LHS tree if cross-wired or mismatched\n if (!leftMatch) {\n leftMatch = findGlobalPathById(proposedSections, section.nodeId || section.id);\n }\n\n bSec = leftMatch?.section || null;\n leftKeyPath = leftMatch?.keyPath || \"\";\n }\n } else {\n // When maintainRelativeOrder is false, absolute structural paths diverge completely.\n // Index path crawling fails here. Execute absolute global ID tracing to handle re-routed clauses.\n if (columnKey === \"left\") {\n bSec = section;\n leftKeyPath = keyPath;\n\n const rightMatch = findGlobalPathById(existingSections, section.nodeId || section.id);\n rSec = rightMatch?.section || null;\n rightKeyPath = rightMatch?.keyPath || \"\";\n } else {\n rSec = section;\n rightKeyPath = keyPath;\n\n const leftMatch = findGlobalPathById(proposedSections, section.nodeId || section.id);\n bSec = leftMatch?.section || null;\n leftKeyPath = leftMatch?.keyPath || \"\";\n }\n }\n\n const style = (leftKeyPath ? getSubSectionCompareStyle(leftKeyPath) : null) || getSubSectionCompareStyle(keyPath);\n const leftDocId = treeData?.input_index_map?.[\"0\"];\n const rightDocId = treeData?.input_index_map?.[\"1\"];\n const counterpartNodeId = columnKey === \"left\" ? rightDocId : leftDocId;\n\n const isSecOrphan = columnKey === \"left\" ? !rSec : !bSec;\n const hasSingleMappedLhs =\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n hasSingleMappedLhsSection(refRoot, proposedSections);\n \n const targetEvalResult = section.evaluationResult || bSec?.evaluationResult || rSec?.evaluationResult;\n\n const deviations = targetEvalResult?.deviations || {};\n const lhsDeviationDisplayIndexes = useMemo(\n () =>\n maintainRelativeOrder && columnKey === \"right\"\n ? getLhsDeviationDisplayIndexes(\n proposedSections,\n leftDocId,\n deviationNumberRegistry,\n )\n : new Map<string, number>(),\n [\n maintainRelativeOrder,\n columnKey,\n proposedSections,\n leftDocId,\n deviationNumberRegistry,\n ],\n );\n let nodeId = section.nodeId || section.id || bSec?.nodeId || bSec?.id || rSec?.nodeId || rSec?.id;\n\n // For Subsections, use the exact LHS counterpart subsection (bSec) ID for registry lookup\n if (maintainRelativeOrder && columnKey !== \"left\") {\n if (bSec?.id) {\n nodeId = bSec.nodeId || bSec.id;\n }\n }\n\n // Derive validatedParentNum from registry\n const firstDeviationKey = Object.keys(deviations)[0];\n const firstRefId = firstDeviationKey ? `${nodeId}${DEVIATION_BADGE_SEPARATOR}${firstDeviationKey}` : null;\n const registeredParentNum = firstRefId ? (deviationParentRegistry?.[firstRefId] as number) : null;\n\n let validatedParentNum: string | number = rootIndex + 1;\n\n if (maintainRelativeOrder && unifiedNumbering) {\n const unifiedNum = columnKey === \"left\" \n ? unifiedNumbering.leftNums.get(baseRoot?.id) \n : unifiedNumbering.rightNums.get(refRoot?.id);\n\n if (isRootOrphan && unifiedNum !== undefined) {\n validatedParentNum = unifiedNum;\n } else if (registeredParentNum !== null && registeredParentNum !== undefined && registeredParentNum >= 0) {\n validatedParentNum = registeredParentNum;\n } else if (unifiedNum !== undefined) {\n validatedParentNum = unifiedNum;\n }\n } else if (registeredParentNum !== null && registeredParentNum !== undefined && registeredParentNum >= 0) {\n validatedParentNum = registeredParentNum;\n }\n\n const deviationColorData = targetEvalResult?.evaluation_outputs?.metadata?.label_color ?? DEFAULT_DEVIAION_COLOR;\n const deviationPalette = generateColorPalette(deviationColorData);\n const { highlightBg } = deviationPalette;\n\n \n const highlights: string[] = [];\n \n let nextFallbackDeviationIndex = Math.max(\n 0,\n ...Object.keys(deviations).map(\n (deviationKey) =>\n deviationNumberRegistry[\n `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`\n ],\n ).filter(\n (value): value is number => typeof value === \"number\" && Number.isFinite(value),\n ),\n ) + 1;\n const rawDeviationEntries = Object.entries(deviations).map(([deviationKey, deviationMap]: [string, any]) => {\n const refId = `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`;\n // Missing numbering metadata must not suppress an otherwise renderable\n // inline deviation badge.\n const currentIndex = deviationNumberRegistry[refId] ?? nextFallbackDeviationIndex++;\n return { deviationKey, deviationMap, refId, currentIndex };\n });\n\n rawDeviationEntries.sort((a, b) => a.currentIndex - b.currentIndex);\n\n const localRhsOrphanVisualIndexes = new Map<string, number>();\n if (\n !rhsOrphanVisualIndexes &&\n maintainRelativeOrder &&\n columnKey === \"right\"\n ) {\n const normalizedContent = safeStringify(baseContent || \"\").replace(/\\\\n/g, \"\\n\");\n rawDeviationEntries\n .filter(({ deviationMap }) => {\n const ownHighlight = deviationMap[parentNodeId];\n const isOrphan =\n isSecOrphan || isMissingStr(deviationMap[counterpartNodeId as string]);\n return isOrphan && !!ownHighlight && !isMissingStr(ownHighlight);\n })\n .map((entry) => {\n const normalizedHighlight = safeStringify(\n entry.deviationMap[parentNodeId] || \"\",\n ).replace(/\\\\n/g, \"\\n\");\n let position = -1;\n if (normalizedHighlight) {\n position = findTextMatchRange(normalizedContent, normalizedHighlight)?.start ?? -1;\n if (position === -1) {\n position = findTextRangeWithFormatting(normalizedContent, normalizedHighlight)?.start ?? -1;\n }\n }\n return { ...entry, position };\n })\n .sort((a, b) => {\n const aPosition = a.position === -1 ? Number.MAX_SAFE_INTEGER : a.position;\n const bPosition = b.position === -1 ? Number.MAX_SAFE_INTEGER : b.position;\n return aPosition - bPosition || a.currentIndex - b.currentIndex;\n })\n .forEach((entry, index) => {\n localRhsOrphanVisualIndexes.set(entry.refId, index + 1);\n });\n }\n\n const deviationEntries = rawDeviationEntries\n .map((item) => {\n const { deviationKey, deviationMap, refId } = item;\n let currentIndex = item.currentIndex;\n\n // if (maintainRelativeOrder && sectionOffset !== undefined) {\n // currentIndex = currentIndex - sectionOffset;\n // }\n // currentIndex = Math.max(1, currentIndex);\n\n let highlight = deviationMap[parentNodeId];\n const isMissingClause = isMissingStr(highlight);\n\n if (isMissingClause) highlight = \"\";\n else if (!highlight) return null;\n\n highlights.push(highlight);\n\n const counterpartHighlight = deviationMap[counterpartNodeId as string];\n\n const isDeviationOrphan = isSecOrphan || isMissingStr(counterpartHighlight);\n const orphanVisualIndex =\n rhsOrphanVisualIndexes?.get(refId) ??\n localRhsOrphanVisualIndexes.get(refId);\n const mappedLhsIndex = lhsDeviationDisplayIndexes.get(refId);\n if (\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n isDeviationOrphan &&\n orphanVisualIndex !== undefined\n ) {\n currentIndex = orphanVisualIndex;\n } else if (\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n !isDeviationOrphan &&\n mappedLhsIndex !== undefined\n ) {\n currentIndex = mappedLhsIndex;\n } else if (\n maintainRelativeOrder &&\n sectionOffset !== undefined &&\n (columnKey !== \"right\" || isDeviationOrphan || hasSingleMappedLhs)\n ) {\n currentIndex = currentIndex - sectionOffset;\n }\n currentIndex = Math.max(1, currentIndex);\n\n const badgeParentNum =\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n isDeviationOrphan &&\n unifiedNumbering\n ? getRhsMappedSectionNumber({\n section: refRoot,\n proposedSections,\n leftNums: unifiedNumbering.leftNums,\n fallbackNumber: String(validatedParentNum),\n firstOnly: true,\n })\n : validatedParentNum;\n const badgeLabel = `${badgeParentNum}.${currentIndex}`;\n const actionId = `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}${DEVIATION_BADGE_SEPARATOR}${leftKeyPath}${DEVIATION_BADGE_SEPARATOR}${rightKeyPath}`;\n const deviationOutput = deviationMap?.evaluation_outputs || targetEvalResult?.evaluation_outputs;\n const deviationScore = deviationOutput?.output_value ?? null;\n const deviationColorForBadge = deviationOutput?.metadata?.label_color ?? deviationColorData;\n const deviationPaletteForBadge = generateColorPalette(deviationColorForBadge);\n let badgeStyle = { ...deviationPaletteForBadge } as StyleVariant;\n\n const summaryPayload = deviationMap?.deviation_summary\n ? {\n deviation_summary: deviationMap.deviation_summary || targetEvalResult?.deviation_summary,\n deviation_title: deviationMap?.deviation_title || targetEvalResult?.deviation_title,\n deviation_impact: deviationMap?.deviation_impact || targetEvalResult?.deviation_impact,\n deviation_explanation:\n deviationMap?.deviation_explanation || targetEvalResult?.deviation_explanation,\n evaluation_outputs: deviationOutput,\n cognitive_decisioning:\n deviationMap?.cognitive_decisioning || targetEvalResult?.cognitive_decisioning,\n }\n : null;\n\n let stackIndex = 0;\n const contentStr = baseContent || \"\";\n if (highlight && contentStr) {\n const paragraphs = contentStr.split(/\\n{2,}/);\n const paraIndex = paragraphs.findIndex(p => p.includes(highlight));\n if (paraIndex !== -1) {\n const devsInPara = Object.entries(deviations)\n .filter(([_, dMap]: any) => {\n const hl = dMap[parentNodeId];\n return hl && paragraphs[paraIndex].includes(hl);\n })\n .sort((a: any, b: any) => paragraphs[paraIndex].indexOf(a[1][parentNodeId]) - paragraphs[paraIndex].indexOf(b[1][parentNodeId]));\n const overlappingDevs = devsInPara.filter(([_, dMap]: any) => {\n const hl = dMap[parentNodeId];\n return hl && (hl.includes(highlight) || highlight.includes(hl));\n });\n if (overlappingDevs.length > 1) {\n stackIndex = Math.max(0, overlappingDevs.findIndex(([k]) => k === deviationKey));\n }\n }\n }\n\n const badgeRef = getBadgeRef(columnKey, refId);\n\n return {\n id: refId,\n actionId: actionId,\n label: badgeLabel,\n highlight,\n side: columnKey,\n style: badgeStyle,\n stackIndex,\n score: deviationScore,\n isConnected: connectedSections.has(actionId as any),\n showScrollLockToggle:\n connectedSections.has(actionId as any) ||\n (isSideBySide && activeSideBySideSection === actionId) ||\n (!!summaryPopupAnchorEl && summaryPopupAnchorEl === badgeRef.current),\n scrollSyncLocked,\n toggleScrollSyncLocked,\n isOrphan: isDeviationOrphan,\n isMissingClause,\n badgeRef,\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n const matchedBaseRoot = leftKeyPath\n ? proposedSections[Number(leftKeyPath.split(\"-\")[0])] || baseRoot\n : baseRoot;\n const matchedRefRoot = rightKeyPath\n ? existingSections[Number(rightKeyPath.split(\"-\")[0])] || refRoot\n : refRoot;\n const popupBaseSec = bSec ? { ...bSec, title: matchedBaseRoot?.title || bSec?.title || \"\" } : { id: \"orphan-left\", title: \"\", content: \"\" };\n const popupRefSec = rSec ? { ...rSec, title: matchedRefRoot?.title || rSec?.title || \"\" } : { id: \"orphan-right\", title: \"\", content: \"\" };\n \n openMoreFunctionsPopup(e, popupBaseSec, isDeviationOrphan, popupRefSec, actionId, badgeStyle); \n },\n onSummaryClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n openSummaryPopup(e, actionId, isDeviationOrphan, summaryPayload);\n }\n };\n })\n .filter(Boolean)\n .sort((a: any, b: any) => {\n const numA = parseFloat(a.label);\n const numB = parseFloat(b.label);\n return numA - numB;\n });\n\n const deduplicatedEntries = useMemo(() => {\n const seenRefIds = new Set<string>();\n return deviationEntries.filter((entry: any) => {\n if (seenRefIds.has(entry.id)) return false;\n seenRefIds.add(entry.id);\n return true;\n });\n }, [deviationEntries]);\n\n\n const baseShouldRenderBadges = showDeviationBadges || isProposedFixTarget;\n const shouldRenderBadges = baseShouldRenderBadges;\n const deviationBadgesToRender = shouldRenderBadges ? deduplicatedEntries : [];\nconst highlightsToRender = deduplicatedEntries.map((b: any) => b.highlight).filter(Boolean);\n\n // const hasScrolledRef = useRef(false);\n\n // useEffect(() => {\n // if (!isExpanded) {\n // hasScrolledRef.current = false;\n // }\n // }, [isExpanded]);\n\n // useEffect(() => {\n // if (!isExpanded || hasScrolledRef.current) return;\n\n // const timer = setTimeout(() => {\n // hasScrolledRef.current = true;\n \n // const firstBadgeRef = deviationEntries[0]?.badgeRef?.current;\n \n // if (firstBadgeRef) {\n // firstBadgeRef.scrollIntoView({\n // behavior: \"smooth\",\n // block: \"center\",\n // });\n // }\n // }, 350); \n\n // return () => clearTimeout(timer);\n // }, [isExpanded, deviationEntries]);\n\n const connectedBadge = deviationEntries.find((b: any) => connectedSections.has(b.actionId));\n const isConnected = !!connectedBadge;\n\n if (!hasTitle && !hasContent && (!section.subsections || section.subsections.length === 0)) return null;\n\n const handleToggle = () => {\n if (!isEmpty) {\n if (isExpanded) {\n const activeBadgeIdStr = String(activeSideBySideSection || \"\");\n let needsReset = activeBadgeIdStr.includes(leftKeyPath) || activeBadgeIdStr.includes(rightKeyPath);\n\n if (!needsReset) {\n connectedSections.forEach((id) => {\n if (String(id).includes(leftKeyPath) || String(id).includes(rightKeyPath)) needsReset = true;\n });\n }\n\n if (needsReset) {\n resetSideBySide();\n setConnectedSections(new Set());\n setConnectedLines([]);\n cachedConnectedPositions.current = [];\n }\n }\n setExpandedSubSections((prev) => ({ ...prev, [keyPath]: !prev[keyPath] }));\n }\n };\n const outlineColor = connectedBadge?.style?.badgeBorder || style?.badgeBorder;\n const outlineStyles = isConnected && outlineColor\n ? { borderRadius: \"4px\", outline: `2px solid ${outlineColor}`, outlineOffset: \"1px\" }\n : {};\n\n if (!hasTitle) {\n return (\n <Box ref={colRef} sx={{ mt: depth === 0 ? 1 : 0.75, width: \"100%\", minWidth: 0, position: \"relative\" }}>\n {!isEmpty && (\n <Box sx={{ width: \"100%\", ...outlineStyles }}>\n {hasContent && (\n <MemoizedMarkdown\n content={baseContent}\n overlayContent={overlayContent}\n fallbackContent={fallbackContent}\n sxStyles={resolvedMarkdownStyles}\n deviationBadges={deviationBadgesToRender}\n maintainRelativeOrder={maintainRelativeOrder}\n highlightBg={highlightBg}\n suppressHighlightBg={suppressHighlightBg}\n highlights={highlightsToRender} \n collisionKey={collisionKey}\n />\n )}\n {(section.subsections || []).map((sub, subIdx) => (\n <SubSectionAccordion\n key={`${keyPath}-${subIdx}`}\n section={sub}\n keyPath={`${keyPath}-${subIdx}`}\n depth={depth + 1}\n columnKey={columnKey}\n parentNodeId={parentNodeId}\n sectionOffset={sectionOffset}\n rhsOrphanVisualIndexes={rhsOrphanVisualIndexes}\n />\n ))}\n </Box>\n )}\n </Box>\n );\n }\n\n return (\n <Box ref={colRef} sx={{ mt: 1, width: \"100%\", minWidth: 0, position: \"relative\" }}>\n <Box sx={{ width: \"100%\", ...outlineStyles }}>\n <Accordion\n disableGutters\n expanded={isEmpty ? false : isExpanded}\n onChange={handleToggle}\n sx={{\n mt: 0,\n boxShadow: \"none\",\n border: isEmpty ? \"1px dashed #E2E8F0\" : \"1px solid #EEF2F7\",\n borderRadius: \"4px !important\",\n bgcolor: \"#FFFFFF\",\n minWidth: 0,\n \"&:before\": { display: \"none\" },\n }}\n >\n <AccordionSummary expandIcon={isEmpty ? null : <ChevronDown size={14} />} sx={{ minHeight: \"32px\", \"& .MuiAccordionSummary-content\": { my: 0.5, display: \"grid\", alignItems: \"center\", minWidth: 0, width: \"100%\" } }}>\n <Typography component=\"div\" sx={{ fontSize: \"11px\", fontWeight: 600, color: isEmpty ? \"#94A3B8\" : \"#19213D\", overflow: \"hidden\", textOverflow: \"ellipsis\", whiteSpace: \"nowrap\", width: \"100%\", minWidth: 0 }}>\n {displayTitle || \"Untitled Subsection\"}\n </Typography>\n </AccordionSummary>\n {!isEmpty && (\n <AccordionDetails sx={{ pt: 0, pb: 1, minWidth: 0 }}>\n {hasContent && (\n <MemoizedMarkdown\n content={baseContent}\n overlayContent={overlayContent}\n fallbackContent={fallbackContent}\n sxStyles={resolvedMarkdownStyles}\n deviationBadges={deviationBadgesToRender}\n maintainRelativeOrder={maintainRelativeOrder}\n highlightBg={highlightBg}\n suppressHighlightBg={suppressHighlightBg}\n highlights={highlightsToRender}\n collisionKey={collisionKey}\n />\n )}\n {(section.subsections || []).map((sub, subIdx) => (\n <SubSectionAccordion\n key={`${keyPath}-${subIdx}`}\n section={sub}\n keyPath={`${keyPath}-${subIdx}`}\n depth={depth + 1}\n columnKey={columnKey}\n parentNodeId={parentNodeId}\n sectionOffset={sectionOffset}\n rhsOrphanVisualIndexes={rhsOrphanVisualIndexes}\n />\n ))}\n </AccordionDetails>\n )}\n </Accordion>\n </Box>\n </Box>\n );\n});\n\nexport default SubSectionAccordion;\n"],"names":["SubSectionAccordion","memo","props","section","keyPath","depth","columnKey","parentNodeId","sectionOffset","rhsOrphanVisualIndexes","expandedSubSections","setExpandedSubSections","maintainRelativeOrder","showDeviationBadges","proposedSections","existingSections","treeData","deviationNumberRegistry","deviationParentRegistry","connectedSections","activeSideBySideSection","isSideBySide","scrollSyncLocked","toggleScrollSyncLocked","summaryPopupAnchorEl","resolvedMarkdownStyles","getSubSectionRef","getSubSectionCompareStyle","getBadgeRef","openMoreFunctionsPopup","openSummaryPopup","resetSideBySide","setConnectedSections","setConnectedLines","cachedConnectedPositions","isProposingFix","proposingFixNodeId","isRedlineFlow","unifiedNumbering","useCompareContext","collisionKey","hasTitle","displayTitle","hasValue","title","isProposedFixTarget","id","nodeId","contentId","hasRedlineTags","hasMeaningfulRedlineTags","content","resolvedRedlineFlow","suppressHighlightBg","changeHistoryContent","change_history","shouldOverlayContent","normalizedRedlineContent","useMemo","normalizeRedlineMarkdown","safeStringify","baseContent","stripRedlineTags","overlayContent","fallbackContent","hasContent","displayContent","isEmpty","isExpanded","colRef","rootIndex","split","map","Number","baseRoot","refRoot","leftRootIndex","rightRootIndex","isRootOrphan","findSectionPathById","root","targetId","rootPath","stack","subsections","child","idx","length","current","shift","forEach","push","rhsSelfIndex","refIndexes","rhsArrayIdx","findIndex","s","selfIndex","lhsSelfIndex","lhsArrayIdx","findGlobalPathById","sections","i","match","String","bSec","rSec","leftKeyPath","rightKeyPath","rightMatch","leftMatch","style","leftDocId","input_index_map","rightDocId","counterpartNodeId","isSecOrphan","hasSingleMappedLhs","hasSingleMappedLhsSection","targetEvalResult","evaluationResult","deviations","lhsDeviationDisplayIndexes","getLhsDeviationDisplayIndexes","Map","firstDeviationKey","Object","keys","firstRefId","DEVIATION_BADGE_SEPARATOR","registeredParentNum","validatedParentNum","unifiedNum","leftNums","get","rightNums","deviationColorData","evaluation_outputs","metadata","label_color","DEFAULT_DEVIAION_COLOR","deviationPalette","generateColorPalette","highlightBg","nextFallbackDeviationIndex","Math","max","deviationKey","filter","value","isFinite","rawDeviationEntries","entries","deviationMap","refId","currentIndex","sort","a","b","localRhsOrphanVisualIndexes","normalizedContent","replace","ownHighlight","isMissingStr","entry","normalizedHighlight","position","findTextMatchRange","start","findTextRangeWithFormatting","MAX_SAFE_INTEGER","index","set","deviationEntries","item","highlight","isMissingClause","counterpartHighlight","isDeviationOrphan","orphanVisualIndex","mappedLhsIndex","badgeLabel","getRhsMappedSectionNumber","fallbackNumber","firstOnly","actionId","deviationOutput","deviationScore","output_value","deviationColorForBadge","badgeStyle","summaryPayload","deviation_summary","deviation_title","deviation_impact","deviation_explanation","cognitive_decisioning","stackIndex","contentStr","paragraphs","paraIndex","p","includes","overlappingDevs","_","dMap","hl","indexOf","k","badgeRef","label","side","score","isConnected","has","showScrollLockToggle","isOrphan","onClick","e","stopPropagation","matchedBaseRoot","matchedRefRoot","popupBaseSec","popupRefSec","onSummaryClick","Boolean","parseFloat","deduplicatedEntries","seenRefIds","Set","add","deviationBadgesToRender","highlightsToRender","connectedBadge","find","outlineColor","badgeBorder","outlineStyles","borderRadius","outline","outlineOffset","jsx","Box","ref","sx","mt","width","minWidth","children","jsxs","Accordion","disableGutters","expanded","onChange","activeBadgeIdStr","needsReset","prev","boxShadow","border","bgcolor","display","AccordionSummary","expandIcon","ChevronDown","size","minHeight","my","alignItems","Typography","component","fontSize","fontWeight","color","overflow","textOverflow","whiteSpace","AccordionDetails","pt","pb","MemoizedMarkdown","sxStyles","deviationBadges","highlights","sub","subIdx"],"mappings":"8fA0CA,MAAMA,OAA0D,QAAMC,KAAMC,IACpE,MAAAC,QACJA,EAAAC,QACAA,EAAAC,MACAA,EAAQ,EAAAC,UACRA,EAAY,OAAAC,aACZA,EAAe,GAAAC,cACfA,EAAAC,uBACAA,GACEP,GACEQ,oBACJA,EAAAC,uBACAA,EAAAC,sBACAA,EAAAC,oBACAA,GAAsB,EAAAC,iBACtBA,EAAAC,iBACAA,EAAAC,SACAA,EAAAC,wBACAA,EAAAC,wBACAA,EAAAC,kBACAA,EAAAC,wBACAA,EAAAC,aACAA,EAAAC,iBACAA,EAAAC,uBACAA,EAAAC,qBACAA,EAAAC,uBACAA,EAAAC,iBACAA,EAAAC,0BACAA,EAAAC,YACAA,EAAAC,uBACAA,EAAAC,iBACAA,EAAAC,gBACAA,EAAAC,qBACAA,EAAAC,kBACAA,EAAAC,yBACAA,EAAAC,eACAA,EAAAC,mBACAA,EAAAC,cACAA,EAAAC,iBACAA,GACEC,EAAkBA,oBAEhBC,EAAepB,GAA2B,GAE1CqB,GAAYtC,EAAQuC,eAAgB,IAASC,WAASxC,EAAQyC,OAC9DC,KACFV,IACAC,GACY,SAAd9B,GACCH,EAAQ2C,KAAOV,GACdjC,EAAQ4C,SAAWX,GACnBjC,EAAQ6C,YAAcZ,GAEpBa,EAAiBC,EAAAA,yBAAyB/C,EAAQgD,SAElDC,EACqB,kBAAlBf,EAA8BA,EAFXY,EAGtBI,EAAsBJ,EACtBK,GAAuBnD,EAAQoD,eAG/BC,GAAuBJ,GAAuBH,EAC9CQ,GAA2BC,EAAAA,QAC/B,IAAMF,GACFG,2BAAyBC,EAAAA,cAAczD,EAAQgD,UAC/CS,EAAAA,cAAczD,E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N,EAAKC,IACnC3C,EAAAA,IAACjP,EAAA,CAECG,QAASwR,EACTvR,QAAS,GAAGA,KAAWwR,IACvBvR,MAAOA,EAAQ,EACfC,YACAC,eACAC,gBACAC,0BAPK,GAAGL,KAAWwR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lucide-react"),i=require("../../../assests/svg/ButtonCognitiveIcon.js"),n=require("../CognitiveComparehelpers.js"),o=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lucide-react"),i=require("../../../assests/svg/ButtonCognitiveIcon.js"),n=require("../CognitiveComparehelpers.js"),o=require("./ThreeDotsLoader.js"),s=require("./connectedLines.js"),l=require("@mui/material");exports.default=function({svgContainerRef:r,svgDimensions:a,isResizing:c,overallConnector:d,rootDeviationStyle:u,lines:p,isSideBySide:g,activeSideBySideSection:x,isArrowVisible:h,maintainRelativeOrder:y,proposedSections:v,existingSections:b,cognitivePopup:f,activeBadgeId:S,closeCognitivePopup:m,setActiveBadgeId:j,openCognitivePopupFromState:B,buildSectionPopupState:I,connectedLines:C,pathRefs:R,isGuidelineMode:P,deviationAnalysisStatus:w}){const A=[...p].sort((e,t)=>Number(Boolean(t.isMappingContinuation))-Number(Boolean(e.isMappingContinuation)));return e.jsxs("svg",{ref:r,style:{position:"absolute",top:0,left:0,width:a.width||"100%",height:a.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:c?0:1,transition:"opacity 0.15s ease-in-out"},children:[d&&e.jsx("g",{children:e.jsx("line",{x1:d.x1,y1:d.y,x2:d.x2,y2:d.y,stroke:u.badgeBorder,strokeWidth:"1.5"})}),A.map(s=>{const r=s.x1+.5*(s.x2-s.x1),a=(s.y1+s.y2)/2,c=r;if("Not Defined"===s.style.label&&!s.hasCognitive)return null;if(s.isSubSection?g&&x===s.subSectionKeyPath&&h:g&&x===s.sectionIdx&&h)return null;if(y)return null;const d=s.isMappingContinuation?`M ${c} ${s.y1} L ${c} ${s.y2} L ${s.x2} ${s.y2}`:s.isSubSection?n.getBentArrowPath(s.x1,s.y1,s.x2,s.y2):`M ${s.x1} ${s.y1} L ${s.x2} ${s.y2}`;let u=v[s.sectionIdx]||{title:"",content:""},p=b[s.targetRightIdx??s.sectionIdx]||{title:"",content:""};if(s.isSubSection&&s.subSectionKeyPath){const e=s.subSectionKeyPath.includes(n.DEVIATION_BADGE_SEPARATOR)?s.subSectionKeyPath.split(n.DEVIATION_BADGE_SEPARATOR):[],t=e[2]||s.subSectionKeyPath,i=e[3]||t,o=t.split("-").map(Number),l=i.split("-").map(Number);let r=null,a=null;o.length>0&&(r=v[o[0]]||null),l.length>0&&(a=b[l[0]]||null);const c=r?.title||"",d=a?.title||"";for(let e=1;e<o.length;e+=1)r?.subsections&&(r=r.subsections[o[e]]||null);for(let e=1;e<l.length;e+=1)a?.subsections&&(a=a.subsections[l[e]]||null);r&&(u={...r,title:c||r.title}),a&&(p={...a,title:d||a.title})}const C=!u.cognitiveData?.isMissingRationale||Boolean(u.cognitiveData?.decisioning?.length),R=u.evaluationResult?.cognitive_decisioning?.decisioning_factors?.length||!1,P=C||R,A=null!=u.evaluationResult||null!=p.evaluationResult,D=("mapping_ready"===w||"deviations_streaming"===w)&&!A,$="complete"!==w||A?null:"Same";return e.jsxs("g",{children:[e.jsx("path",{d:d,fill:"none",stroke:s.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),!s.isMappingContinuation&&e.jsx("foreignObject",{x:r-100,y:a-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"},children:e.jsx(l.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsxs(l.Box,{onClick:e=>{e.stopPropagation(),P&&(f.open&&S===s.id?m():(j(s.id),B(I(e.currentTarget,u,p,s.sectionIdx,!1,s.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:s.style.badgeBg,color:s.style.badgeText,border:`1px solid ${s.style.badgeBorder}`,borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:P?"pointer":"default"},children:[D?e.jsx(l.Tooltip,{title:"Deviation data generation in progress",placement:"top",arrow:!0,children:e.jsx(l.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center"},children:e.jsx(o.default,{color:s.style.badgeText})})}):null==s.style.label?$:"0"===String(s.style.label)?"Same":s.style.label,e.jsx(l.Box,{component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}},children:e.jsx(i.ButtonCognitiveIcon,{})}),P&&e.jsx(t.ChevronDown,{size:11,style:{transform:f.open&&S===s.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]})})})]},s.id)}),e.jsx(s.default,{maintainRelativeOrder:y,connectedLines:C,pathRefs:R,isGuidelineMode:P})]})};
|
|
2
2
|
//# sourceMappingURL=SvgConnectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SvgConnectors.js","sources":["../../../../../src/features/CognitiveCompare/components/SvgConnectors.tsx"],"sourcesContent":["import { ChevronDown } from \"lucide-react\";\nimport { ButtonCognitiveIcon } from \"../../../assests/svg/ButtonCognitiveIcon\";\nimport { DEVIATION_BADGE_SEPARATOR, getBentArrowPath } from \"../CognitiveComparehelpers\";\nimport { DEFAULT_DEVIAION_COLOR } from \"../CognitiveCompareConstants\";\nimport ThreeDotsLoader from \"./ThreeDotsLoader\";\nimport ConnectedLinesComp from \"./connectedLines\";\nimport { Box } from \"@mui/material\";\nimport {\n SectionBlock,\n SectionPopupState,\n StyleVariant,\n} from \"../CognitiveCompareTypes\";\n\ntype SvgConnectorLine = {\n id: string;\n x1: number;\n x2: number;\n y1: number;\n y2: number;\n style: StyleVariant;\n sectionIdx: number | string;\n targetRightIdx?: number;\n isSubSection?: boolean;\n isMappingContinuation?: boolean;\n subSectionKeyPath?: string;\n hasCognitive?: boolean;\n};\n\ntype SvgConnectorsProps = {\n svgContainerRef: React.MutableRefObject<SVGSVGElement | null>;\n svgDimensions: { width: number; height: number };\n isResizing: boolean;\n overallConnector: { x1: number; x2: number; y: number } | null;\n rootDeviationStyle: { badgeBorder: string };\n lines: Record<string, any>[];\n isSideBySide: boolean;\n activeSideBySideSection: number | string | null;\n isArrowVisible: boolean;\n maintainRelativeOrder: boolean | undefined;\n proposedSections: SectionBlock[];\n existingSections: SectionBlock[];\n cognitivePopup: SectionPopupState;\n activeBadgeId: string | null;\n closeCognitivePopup: () => void;\n setActiveBadgeId: React.Dispatch<React.SetStateAction<string | null>>;\n openCognitivePopupFromState: (nextPopup: SectionPopupState) => void;\n buildSectionPopupState: (\n anchorEl: HTMLElement | null,\n baseSec: SectionBlock | null,\n refSec: SectionBlock | null,\n sectionIdx: number | string,\n isOrphan?: boolean,\n style?: StyleVariant | null,\n rootNode?: boolean,\n ) => SectionPopupState;\n connectedLines: Record<string, any>[];\n pathRefs: React.MutableRefObject<Record<string, SVGPathElement | null>>;\n isGuidelineMode ?: boolean;\n};\n\nexport default function SvgConnectors({\n svgContainerRef,\n svgDimensions,\n isResizing,\n overallConnector,\n rootDeviationStyle,\n lines,\n isSideBySide,\n activeSideBySideSection,\n isArrowVisible,\n maintainRelativeOrder,\n proposedSections,\n existingSections,\n cognitivePopup,\n activeBadgeId,\n closeCognitivePopup,\n setActiveBadgeId,\n openCognitivePopupFromState,\n buildSectionPopupState,\n connectedLines,\n pathRefs,\n isGuidelineMode,\n}: SvgConnectorsProps) {\n const orderedLines = [...lines].sort(\n (left, right) =>\n Number(Boolean(right.isMappingContinuation)) -\n Number(Boolean(left.isMappingContinuation)),\n );\n\n return (\n <svg\n ref={svgContainerRef}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n width: svgDimensions.width || \"100%\",\n height: svgDimensions.height || \"100%\",\n pointerEvents: \"none\",\n zIndex: 10,\n overflow: \"visible\",\n opacity: isResizing ? 0 : 1,\n transition: \"opacity 0.15s ease-in-out\",\n }}\n >\n {overallConnector && (\n <g>\n <line\n x1={overallConnector.x1}\n y1={overallConnector.y}\n x2={overallConnector.x2}\n y2={overallConnector.y}\n stroke={rootDeviationStyle.badgeBorder}\n strokeWidth=\"1.5\"\n />\n </g>\n )}\n\n {orderedLines.map((line) => {\n const bendX = line.x1 + (line.x2 - line.x1) * 0.5;\n const midY = (line.y1 + line.y2) / 2;\n const continuationJunctionX = bendX;\n\n if (line.style.label === \"Not Defined\" && !line.hasCognitive) {\n return null;\n }\n\n const isActive = line.isSubSection\n ? isSideBySide &&\n activeSideBySideSection === line.subSectionKeyPath &&\n isArrowVisible\n : isSideBySide &&\n activeSideBySideSection === line.sectionIdx &&\n isArrowVisible;\n\n if (isActive) {\n return null;\n }\n\n if (maintainRelativeOrder) {\n return null;\n }\n\n const pathD = line.isMappingContinuation\n ? `M ${continuationJunctionX} ${line.y1} L ${continuationJunctionX} ${line.y2} L ${line.x2} ${line.y2}`\n : !line.isSubSection\n ? `M ${line.x1} ${line.y1} L ${line.x2} ${line.y2}`\n : getBentArrowPath(line.x1, line.y1, line.x2, line.y2);\n\n let baseSec = proposedSections[line.sectionIdx as number] || { title: \"\", content: \"\" };\n let refSec = existingSections[line.targetRightIdx ?? (line.sectionIdx as number)] || {\n title: \"\",\n content: \"\",\n };\n\n if (line.isSubSection && line.subSectionKeyPath) {\n const pathParts = line.subSectionKeyPath.includes(DEVIATION_BADGE_SEPARATOR)\n ? line.subSectionKeyPath.split(DEVIATION_BADGE_SEPARATOR)\n : [];\n const leftPath = pathParts[2] || line.subSectionKeyPath;\n const rightPath = pathParts[3] || leftPath;\n const leftPathParts = leftPath.split(\"-\").map(Number);\n const rightPathParts = rightPath.split(\"-\").map(Number);\n let leftSection: SectionBlock | null = null;\n let rightSection: SectionBlock | null = null;\n\n if (leftPathParts.length > 0) {\n leftSection = proposedSections[leftPathParts[0]] || null;\n }\n if (rightPathParts.length > 0) {\n rightSection = existingSections[rightPathParts[0]] || null;\n }\n\n const rootParentTitle = leftSection?.title || \"\";\n const rootRefParentTitle = rightSection?.title || \"\";\n\n for (let i = 1; i < leftPathParts.length; i += 1) {\n if (leftSection?.subsections) leftSection = leftSection.subsections[leftPathParts[i]] || null;\n }\n for (let i = 1; i < rightPathParts.length; i += 1) {\n if (rightSection?.subsections) rightSection = rightSection.subsections[rightPathParts[i]] || null;\n }\n\n if (leftSection) baseSec = { ...leftSection, title: rootParentTitle || leftSection.title };\n if (rightSection) refSec = { ...rightSection, title: rootRefParentTitle || rightSection.title };\n }\n\n const isMappingCD =\n !baseSec.cognitiveData?.isMissingRationale ||\n Boolean(baseSec.cognitiveData?.decisioning?.length);\n const isDeviationCD =\n baseSec.evaluationResult?.cognitive_decisioning?.decisioning_factors?.length || false;\n const hasMapping = isMappingCD || isDeviationCD;\n\n return (\n <g key={line.id}>\n <path\n d={pathD}\n fill=\"none\"\n stroke={line.style.badgeBorder || \"#E2E8F0\"}\n strokeWidth=\"1.5\"\n />\n {!line.isMappingContinuation && (\n <foreignObject\n x={bendX - 100}\n y={midY - 14}\n width=\"200\"\n height=\"28\"\n style={{ pointerEvents: \"auto\", overflow: \"visible\" }}\n >\n <Box\n sx={{\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n height: \"100%\",\n }}\n >\n <Box\n onClick={(e) => {\n e.stopPropagation();\n if (!hasMapping) return;\n if (cognitivePopup.open && activeBadgeId === line.id) {\n closeCognitivePopup();\n return;\n }\n\n setActiveBadgeId(line.id);\n openCognitivePopupFromState(\n buildSectionPopupState(\n e.currentTarget as HTMLElement,\n baseSec,\n refSec,\n line.sectionIdx,\n false,\n line.style,\n ),\n );\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n fontSize: \"11px\",\n bgcolor: line.style.badgeBg,\n color: line.style.badgeText,\n border: `1px solid ${line.style.badgeBorder}`,\n borderRadius: \"12px\",\n px: 1.5,\n py: 0.5,\n fontWeight: 600,\n textAlign: \"center\",\n whiteSpace: \"nowrap\",\n cursor: !hasMapping ? \"default\" : \"pointer\",\n }}\n >\n {line.style.badgeText === DEFAULT_DEVIAION_COLOR && line.style.label == null\n ? <ThreeDotsLoader color={line.style.badgeText} />\n : line.style.label == null\n ? null\n : String(line.style.label) === \"0\"\n ? \"Same\"\n : line.style.label}\n <Box\n component=\"span\"\n sx={{\n width: 14,\n height: 14,\n display: \"flex\",\n alignItems: \"center\",\n \"& svg\": { width: \"14px\", height: \"14px\" },\n }}\n >\n <ButtonCognitiveIcon />\n </Box>\n\n {hasMapping && (\n <ChevronDown\n size={11}\n style={{\n transform:\n cognitivePopup.open && activeBadgeId === line.id\n ? \"rotate(180deg)\"\n : \"rotate(0deg)\",\n transition: \"transform 0.25s ease\",\n }}\n />\n )}\n </Box>\n </Box>\n </foreignObject>\n )}\n </g>\n );\n })}\n\n <ConnectedLinesComp \n maintainRelativeOrder={maintainRelativeOrder} \n connectedLines={connectedLines} \n pathRefs={pathRefs} \n isGuidelineMode={isGuidelineMode}\n />\n </svg>\n );\n}\n"],"names":["svgContainerRef","svgDimensions","isResizing","overallConnector","rootDeviationStyle","lines","isSideBySide","activeSideBySideSection","isArrowVisible","maintainRelativeOrder","proposedSections","existingSections","cognitivePopup","activeBadgeId","closeCognitivePopup","setActiveBadgeId","openCognitivePopupFromState","buildSectionPopupState","connectedLines","pathRefs","isGuidelineMode","orderedLines","sort","left","right","Number","Boolean","isMappingContinuation","jsxs","ref","style","position","top","width","height","pointerEvents","zIndex","overflow","opacity","transition","children","jsx","x1","y1","y","x2","y2","stroke","badgeBorder","strokeWidth","map","line","bendX","midY","continuationJunctionX","label","hasCognitive","isSubSection","subSectionKeyPath","sectionIdx","pathD","getBentArrowPath","baseSec","title","content","refSec","targetRightIdx","pathParts","includes","DEVIATION_BADGE_SEPARATOR","split","leftPath","rightPath","leftPathParts","rightPathParts","leftSection","rightSection","length","rootParentTitle","rootRefParentTitle","i","subsections","isMappingCD","cognitiveData","isMissingRationale","decisioning","isDeviationCD","evaluationResult","cognitive_decisioning","decisioning_factors","hasMapping","d","fill","x","Box","sx","display","justifyContent","alignItems","onClick","e","stopPropagation","open","id","currentTarget","gap","fontSize","bgcolor","badgeBg","color","badgeText","border","borderRadius","px","py","fontWeight","textAlign","whiteSpace","cursor","DEFAULT_DEVIAION_COLOR","ThreeDotsLoader","String","component","ButtonCognitiveIcon","ChevronDown","size","transform","ConnectedLinesComp"],"mappings":"gYA4DA,UAAsCA,gBACpCA,EAAAC,cACAA,EAAAC,WACAA,EAAAC,iBACAA,EAAAC,mBACAA,EAAAC,MACAA,EAAAC,aACAA,EAAAC,wBACAA,EAAAC,eACAA,EAAAC,sBACAA,EAAAC,iBACAA,EAAAC,iBACAA,EAAAC,eACAA,EAAAC,cACAA,EAAAC,oBACAA,EAAAC,iBACAA,EAAAC,4BACAA,EAAAC,uBACAA,EAAAC,eACAA,EAAAC,SACAA,EAAAC,gBACAA,IAEA,MAAMC,EAAe,IAAIhB,GAAOiB,KAC9B,CAACC,EAAMC,IACLC,OAAOC,QAAQF,EAAMG,wBACrBF,OAAOC,QAAQH,EAAKI,yBAItB,OAAAC,EAAAA,KAAC,MAAA,CACCC,IAAK7B,EACL8B,MAAO,CACLC,SAAU,WACVC,IAAK,EACLT,KAAM,EACNU,MAAOhC,EAAcgC,OAAS,OAC9BC,OAAQjC,EAAciC,QAAU,OAChCC,cAAe,OACfC,OAAQ,GACRC,SAAU,UACVC,QAASpC,EAAa,EAAI,EAC1BqC,WAAY,6BAGbC,SAAA,CAAArC,SACE,IACC,CAAAqC,SAAAC,EAAAA,IAAC,OAAA,CACCC,GAAIvC,EAAiBuC,GACrBC,GAAIxC,EAAiByC,EACrBC,GAAI1C,EAAiB0C,GACrBC,GAAI3C,EAAiByC,EACrBG,OAAQ3C,EAAmB4C,YAC3BC,YAAY,UAKjB5B,EAAa6B,IAAKC,IACjB,MAAMC,EAAQD,EAAKT,GAA2B,IAArBS,EAA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ACpBC,MAAO1D,EAAKrB,MAAMgF,UAClBC,OAAQ,aAAa5D,EAAKrB,MAAMkB,cAChCgE,aAAc,OACdC,GAAI,IACJC,GAAI,GACJC,WAAY,IACZC,UAAW,SACXC,WAAY,SACZC,OAAS5B,EAAyB,UAAZ,WAGvBlD,SAAA,CAAKW,EAAArB,MAAMgF,YAAcS,EAAAA,wBAA8C,MAApBpE,EAAKrB,MAAMyB,MAC1Dd,EAAAA,IAAA+E,EAAAA,QAAA,CAAgBX,MAAO1D,EAAKrB,MAAMgF,YACf,MAApB3D,EAAKrB,MAAMyB,MACT,KAC6B,MAA7BkE,OAAOtE,EAAKrB,MAAMyB,OAChB,OACAJ,EAAKrB,MAAMyB,MACnBd,EAAAA,IAACqD,EAAAA,IAAA,CACC4B,UAAU,OACV3B,GAAI,CACF9D,MAAO,GACPC,OAAQ,GACR8D,QAAS,OACTE,WAAY,SACZ,QAAS,CAAEjE,MAAO,OAAQC,OAAQ,SAGpCM,eAACmF,EAAoBA,oBAAA,MAGtBjC,GACCjD,EAAAA,IAACmF,EAAAA,YAAA,CACCC,KAAM,GACN/F,MAAO,CACLgG,UACElH,EAAe0F,MAAQzF,IAAkBsC,EAAKoD,GAC1C,iBACA,eACNhE,WAAY,mCAzFpBY,EAAKoD,MAqGjB9D,EAAAA,IAACsF,EAAA,QAAA,CACCtH,wBAAAS,eACAA,EACAC,WACAC,sBAIR"}
|
|
1
|
+
{"version":3,"file":"SvgConnectors.js","sources":["../../../../../src/features/CognitiveCompare/components/SvgConnectors.tsx"],"sourcesContent":["import { ChevronDown } from \"lucide-react\";\nimport { ButtonCognitiveIcon } from \"../../../assests/svg/ButtonCognitiveIcon\";\nimport { DEVIATION_BADGE_SEPARATOR, getBentArrowPath } from \"../CognitiveComparehelpers\";\nimport ThreeDotsLoader from \"./ThreeDotsLoader\";\nimport ConnectedLinesComp from \"./connectedLines\";\nimport { Box, Tooltip } from \"@mui/material\";\nimport {\n DeviationAnalysisStatus,\n SectionBlock,\n SectionPopupState,\n StyleVariant,\n} from \"../CognitiveCompareTypes\";\n\ntype SvgConnectorLine = {\n id: string;\n x1: number;\n x2: number;\n y1: number;\n y2: number;\n style: StyleVariant;\n sectionIdx: number | string;\n targetRightIdx?: number;\n isSubSection?: boolean;\n isMappingContinuation?: boolean;\n subSectionKeyPath?: string;\n hasCognitive?: boolean;\n};\n\ntype SvgConnectorsProps = {\n svgContainerRef: React.MutableRefObject<SVGSVGElement | null>;\n svgDimensions: { width: number; height: number };\n isResizing: boolean;\n overallConnector: { x1: number; x2: number; y: number } | null;\n rootDeviationStyle: { badgeBorder: string };\n lines: Record<string, any>[];\n isSideBySide: boolean;\n activeSideBySideSection: number | string | null;\n isArrowVisible: boolean;\n maintainRelativeOrder: boolean | undefined;\n proposedSections: SectionBlock[];\n existingSections: SectionBlock[];\n cognitivePopup: SectionPopupState;\n activeBadgeId: string | null;\n closeCognitivePopup: () => void;\n setActiveBadgeId: React.Dispatch<React.SetStateAction<string | null>>;\n openCognitivePopupFromState: (nextPopup: SectionPopupState) => void;\n buildSectionPopupState: (\n anchorEl: HTMLElement | null,\n baseSec: SectionBlock | null,\n refSec: SectionBlock | null,\n sectionIdx: number | string,\n isOrphan?: boolean,\n style?: StyleVariant | null,\n rootNode?: boolean,\n ) => SectionPopupState;\n connectedLines: Record<string, any>[];\n pathRefs: React.MutableRefObject<Record<string, SVGPathElement | null>>;\n isGuidelineMode ?: boolean;\n deviationAnalysisStatus: DeviationAnalysisStatus;\n};\n\nexport default function SvgConnectors({\n svgContainerRef,\n svgDimensions,\n isResizing,\n overallConnector,\n rootDeviationStyle,\n lines,\n isSideBySide,\n activeSideBySideSection,\n isArrowVisible,\n maintainRelativeOrder,\n proposedSections,\n existingSections,\n cognitivePopup,\n activeBadgeId,\n closeCognitivePopup,\n setActiveBadgeId,\n openCognitivePopupFromState,\n buildSectionPopupState,\n connectedLines,\n pathRefs,\n isGuidelineMode,\n deviationAnalysisStatus,\n}: SvgConnectorsProps) {\n const orderedLines = [...lines].sort(\n (left, right) =>\n Number(Boolean(right.isMappingContinuation)) -\n Number(Boolean(left.isMappingContinuation)),\n );\n\n return (\n <svg\n ref={svgContainerRef}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n width: svgDimensions.width || \"100%\",\n height: svgDimensions.height || \"100%\",\n pointerEvents: \"none\",\n zIndex: 10,\n overflow: \"visible\",\n opacity: isResizing ? 0 : 1,\n transition: \"opacity 0.15s ease-in-out\",\n }}\n >\n {overallConnector && (\n <g>\n <line\n x1={overallConnector.x1}\n y1={overallConnector.y}\n x2={overallConnector.x2}\n y2={overallConnector.y}\n stroke={rootDeviationStyle.badgeBorder}\n strokeWidth=\"1.5\"\n />\n </g>\n )}\n\n {orderedLines.map((line) => {\n const bendX = line.x1 + (line.x2 - line.x1) * 0.5;\n const midY = (line.y1 + line.y2) / 2;\n const continuationJunctionX = bendX;\n\n if (line.style.label === \"Not Defined\" && !line.hasCognitive) {\n return null;\n }\n\n const isActive = line.isSubSection\n ? isSideBySide &&\n activeSideBySideSection === line.subSectionKeyPath &&\n isArrowVisible\n : isSideBySide &&\n activeSideBySideSection === line.sectionIdx &&\n isArrowVisible;\n\n if (isActive) {\n return null;\n }\n\n if (maintainRelativeOrder) {\n return null;\n }\n\n const pathD = line.isMappingContinuation\n ? `M ${continuationJunctionX} ${line.y1} L ${continuationJunctionX} ${line.y2} L ${line.x2} ${line.y2}`\n : !line.isSubSection\n ? `M ${line.x1} ${line.y1} L ${line.x2} ${line.y2}`\n : getBentArrowPath(line.x1, line.y1, line.x2, line.y2);\n\n let baseSec = proposedSections[line.sectionIdx as number] || { title: \"\", content: \"\" };\n let refSec = existingSections[line.targetRightIdx ?? (line.sectionIdx as number)] || {\n title: \"\",\n content: \"\",\n };\n\n if (line.isSubSection && line.subSectionKeyPath) {\n const pathParts = line.subSectionKeyPath.includes(DEVIATION_BADGE_SEPARATOR)\n ? line.subSectionKeyPath.split(DEVIATION_BADGE_SEPARATOR)\n : [];\n const leftPath = pathParts[2] || line.subSectionKeyPath;\n const rightPath = pathParts[3] || leftPath;\n const leftPathParts = leftPath.split(\"-\").map(Number);\n const rightPathParts = rightPath.split(\"-\").map(Number);\n let leftSection: SectionBlock | null = null;\n let rightSection: SectionBlock | null = null;\n\n if (leftPathParts.length > 0) {\n leftSection = proposedSections[leftPathParts[0]] || null;\n }\n if (rightPathParts.length > 0) {\n rightSection = existingSections[rightPathParts[0]] || null;\n }\n\n const rootParentTitle = leftSection?.title || \"\";\n const rootRefParentTitle = rightSection?.title || \"\";\n\n for (let i = 1; i < leftPathParts.length; i += 1) {\n if (leftSection?.subsections) leftSection = leftSection.subsections[leftPathParts[i]] || null;\n }\n for (let i = 1; i < rightPathParts.length; i += 1) {\n if (rightSection?.subsections) rightSection = rightSection.subsections[rightPathParts[i]] || null;\n }\n\n if (leftSection) baseSec = { ...leftSection, title: rootParentTitle || leftSection.title };\n if (rightSection) refSec = { ...rightSection, title: rootRefParentTitle || rightSection.title };\n }\n\n const isMappingCD =\n !baseSec.cognitiveData?.isMissingRationale ||\n Boolean(baseSec.cognitiveData?.decisioning?.length);\n const isDeviationCD =\n baseSec.evaluationResult?.cognitive_decisioning?.decisioning_factors?.length || false;\n const hasMapping = isMappingCD || isDeviationCD;\n const hasDeviationResult =\n baseSec.evaluationResult != null ||\n refSec.evaluationResult != null;\n const isDeviationGenerationInProgress =\n deviationAnalysisStatus === \"mapping_ready\" ||\n deviationAnalysisStatus === \"deviations_streaming\";\n const shouldShowDeviationLoader =\n isDeviationGenerationInProgress && !hasDeviationResult;\n const fallbackLabel =\n deviationAnalysisStatus === \"complete\" && !hasDeviationResult\n ? \"Same\"\n : null;\n\n return (\n <g key={line.id}>\n <path\n d={pathD}\n fill=\"none\"\n stroke={line.style.badgeBorder || \"#E2E8F0\"}\n strokeWidth=\"1.5\"\n />\n {!line.isMappingContinuation && (\n <foreignObject\n x={bendX - 100}\n y={midY - 14}\n width=\"200\"\n height=\"28\"\n style={{ pointerEvents: \"auto\", overflow: \"visible\" }}\n >\n <Box\n sx={{\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n height: \"100%\",\n }}\n >\n <Box\n onClick={(e) => {\n e.stopPropagation();\n if (!hasMapping) return;\n if (cognitivePopup.open && activeBadgeId === line.id) {\n closeCognitivePopup();\n return;\n }\n\n setActiveBadgeId(line.id);\n openCognitivePopupFromState(\n buildSectionPopupState(\n e.currentTarget as HTMLElement,\n baseSec,\n refSec,\n line.sectionIdx,\n false,\n line.style,\n ),\n );\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n fontSize: \"11px\",\n bgcolor: line.style.badgeBg,\n color: line.style.badgeText,\n border: `1px solid ${line.style.badgeBorder}`,\n borderRadius: \"12px\",\n px: 1.5,\n py: 0.5,\n fontWeight: 600,\n textAlign: \"center\",\n whiteSpace: \"nowrap\",\n cursor: !hasMapping ? \"default\" : \"pointer\",\n }}\n >\n {shouldShowDeviationLoader\n ? (\n <Tooltip title=\"Deviation data generation in progress\" placement=\"top\" arrow>\n <Box component=\"span\" sx={{ display: \"inline-flex\", alignItems: \"center\" }}>\n <ThreeDotsLoader color={line.style.badgeText} />\n </Box>\n </Tooltip>\n )\n : line.style.label == null\n ? fallbackLabel\n : String(line.style.label) === \"0\"\n ? \"Same\"\n : line.style.label}\n <Box\n component=\"span\"\n sx={{\n width: 14,\n height: 14,\n display: \"flex\",\n alignItems: \"center\",\n \"& svg\": { width: \"14px\", height: \"14px\" },\n }}\n >\n <ButtonCognitiveIcon />\n </Box>\n\n {hasMapping && (\n <ChevronDown\n size={11}\n style={{\n transform:\n cognitivePopup.open && activeBadgeId === line.id\n ? \"rotate(180deg)\"\n : \"rotate(0deg)\",\n transition: \"transform 0.25s ease\",\n }}\n />\n )}\n </Box>\n </Box>\n </foreignObject>\n )}\n </g>\n );\n })}\n\n <ConnectedLinesComp \n maintainRelativeOrder={maintainRelativeOrder} \n connectedLines={connectedLines} \n pathRefs={pathRefs} \n isGuidelineMode={isGuidelineMode}\n />\n </svg>\n );\n}\n"],"names":["svgContainerRef","svgDimensions","isResizing","overallConnector","rootDeviationStyle","lines","isSideBySide","activeSideBySideSection","isArrowVisible","maintainRelativeOrder","proposedSections","existingSections","cognitivePopup","activeBadgeId","closeCognitivePopup","setActiveBadgeId","openCognitivePopupFromState","buildSectionPopupState","connectedLines","pathRefs","isGuidelineMode","deviationAnalysisStatus","orderedLines","sort","left","right","Number","Boolean","isMappingContinuation","jsxs","ref","style","position","top","width","height","pointerEvents","zIndex","overflow","opacity","transition","children","jsx","x1","y1","y","x2","y2","stroke","badgeBorder","strokeWidth","map","line","bendX","midY","continuationJunctionX","label","hasCognitive","isSubSection","subSectionKeyPath","sectionIdx","pathD","getBentArrowPath","baseSec","title","content","refSec","targetRightIdx","pathParts","includes","DEVIATION_BADGE_SEPARATOR","split","leftPath","rightPath","leftPathParts","rightPathParts","leftSection","rightSection","length","rootParentTitle","rootRefParentTitle","i","subsections","isMappingCD","cognitiveData","isMissingRationale","decisioning","isDeviationCD","evaluationResult","cognitive_decisioning","decisioning_factors","hasMapping","hasDeviationResult","shouldShowDeviationLoader","fallbackLabel","d","fill","x","Box","sx","display","justifyContent","alignItems","onClick","e","stopPropagation","open","id","currentTarget","gap","fontSize","bgcolor","badgeBg","color","badgeText","border","borderRadius","px","py","fontWeight","textAlign","whiteSpace","cursor","Tooltip","placement","arrow","component","ThreeDotsLoader","String","ButtonCognitiveIcon","ChevronDown","size","transform","ConnectedLinesComp"],"mappings":"mVA6DA,UAAsCA,gBACpCA,EAAAC,cACAA,EAAAC,WACAA,EAAAC,iBACAA,EAAAC,mBACAA,EAAAC,MACAA,EAAAC,aACAA,EAAAC,wBACAA,EAAAC,eACAA,EAAAC,sBACAA,EAAAC,iBACAA,EAAAC,iBACAA,EAAAC,eACAA,EAAAC,cACAA,EAAAC,oBACAA,EAAAC,iBACAA,EAAAC,4BACAA,EAAAC,uBACAA,EAAAC,eACAA,EAAAC,SACAA,EAAAC,gBACAA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MmF,gBAInB,MAApB9D,EAAKrB,MAAMyB,MACTsC,EAC6B,MAA7BkC,OAAO5E,EAAKrB,MAAMyB,OAChB,OACAJ,EAAKrB,MAAMyB,MACnBd,EAAAA,IAACwD,EAAAA,IAAA,CACC4B,UAAU,OACV3B,GAAI,CACFjE,MAAO,GACPC,OAAQ,GACRiE,QAAS,OACTE,WAAY,SACZ,QAAS,CAAEpE,MAAO,OAAQC,OAAQ,SAGpCM,eAACwF,EAAoBA,oBAAA,MAGtBtC,GACCjD,EAAAA,IAACwF,EAAAA,YAAA,CACCC,KAAM,GACNpG,MAAO,CACLqG,UACExH,EAAe8F,MAAQ7F,IAAkBuC,EAAKuD,GAC1C,iBACA,eACNnE,WAAY,mCA/FpBY,EAAKuD,MA2GjBjE,EAAAA,IAAC2F,EAAA,QAAA,CACC5H,wBAAAS,eACAA,EACAC,WACAC,sBAIR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@mui/material"),r=require("react"),n=require("../CognitiveCompareConstants.js"),i=require("lucide-react"),o=require("react-markdown"),a=require("../CognitiveComparehelpers.js"),s=require("rehype-raw"),l=require("remark-gfm");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(r),h=d(o),p=d(s);const g=e=>"function"==typeof e?e:e?.default||e,u=[g(d(l).default)],x=[g(p.default)],m=c.default.memo(({content:o,overlayContent:s,sxStyles:l,deviationBadges:d=[],highlights:p=[],maintainRelativeOrder:g=!0,highlightBg:m,suppressHighlightBg:f=!1,collisionKey:b})=>{const y=r.useRef(null),B=!!s,v=r.useMemo(()=>d.reduce((e,t)=>({...e,[t.id]:t}),{}),[d]),E=r.useRef({badgeMap:v,highlightBg:m,hideHighlightBg:B,suppressHighlightBg:f});E.current={badgeMap:v,highlightBg:m,hideHighlightBg:B,suppressHighlightBg:f};const j=(e,t)=>c.default.Children.map(e,e=>{if(!c.default.isValidElement(e))return e;const r=e.props?.children?j(e.props.children,t):e.props.children,n=c.default.cloneElement(e,{...e.props,children:r});return t(n)}),w=r.useMemo(()=>({mark:({children:t,...r})=>{const{badgeMap:n,highlightBg:i,hideHighlightBg:o,suppressHighlightBg:a}=E.current,s=r["data-badge-id"],l=s?n[s]:null,d=r["data-highlight-color"]??l?.style?.highlightBg??l?.style?.badgeBg??i,c="true"===r["data-is-suggested-deviation-fix"]||a;return e.jsx("span",{style:{...c?{}:{backgroundColor:d},borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px",...o?{color:"transparent"}:{}},children:t})},span:({children:r,...o})=>{const{badgeMap:a}=E.current,s=o["data-badge-id"];if(!s)return e.jsx("span",{...o,children:r});const l=a[s];if(!l)return e.jsx("span",{...o,children:r});const d="number"==typeof l.stackIndex?l.stackIndex:0,c=`translateY(calc(-20% + ${12*d}px + var(--badge-nudge, 0px)))`;return e.jsxs(t.Box,{component:"span",sx:{position:"static",display:"inline"},children:[e.jsxs(t.Box,{ref:l.badgeRef,className:"deviation-badge","data-side":l.side||"right",sx:{fontStyle:"normal",position:"absolute",zIndex:30+d,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:l.style?.badgeBg||"#EEF2FF",color:l.style?.badgeText||n.DEFAULT_DEVIAION_COLOR,border:`1px solid ${l.style?.badgeBorder||"#C7D2FE"}`,borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none",..."left"===l.side?{right:"-16px",transform:`${c} translateX(calc(100% + 8px))`}:{left:"-16px",transform:`${c} translateX(calc(-100% - 8px))`},...l.isConnected&&l.style&&{outline:`2px solid ${l.style.badgeBorder}`,outlineOffset:"1px"}},children:[e.jsxs(t.Box,{onClick:e=>{e.stopPropagation(),l.onSummaryClick&&l.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}},children:[e.jsx(t.Box,{component:"span",sx:{fontSize:"10px",fontWeight:700},children:l.label}),("left"===l.side||l.isOrphan)&&e.jsx(t.Box,{component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:`1px solid ${l.style?.badgeBorder||"#C7D2FE"}`},children:null!=l.score&&"N/A"!==l.score&&"NA"!==l.score&&0!==l.score?`${l.score}`:"N/A"===l.score||"NA"===l.score?"N/A":"Same"})]}),("left"===l.side||l.isOrphan)&&e.jsx(t.Box,{onClick:e=>{e.stopPropagation(),l.onClick&&l.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:`1px solid ${l.style?.badgeBorder||"#C7D2FE"}`,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}},children:e.jsx(i.EllipsisVertical,{size:12,color:l.style?.badgeText||"#3730A3"})})]}),r]})},table:({children:r})=>e.jsx(t.Box,{sx:{display:"block",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",contain:"inline-size",overflowX:"auto",overflowY:"hidden",overscrollBehaviorX:"contain",WebkitOverflowScrolling:"touch",my:1},children:e.jsx(t.Box,{component:"table",sx:{width:"600px",minWidth:"600px",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"inherit"},children:r})}),thead:({children:r})=>e.jsx(t.Box,{component:"thead",children:r}),tbody:({children:r})=>e.jsx(t.Box,{component:"tbody",children:r}),tr:({children:r})=>e.jsx(t.Box,{component:"tr",sx:{borderBottom:"1px solid #E5E7EB"},children:r}),th:({children:r})=>e.jsx(t.Box,{component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",verticalAlign:"top",fontWeight:600,backgroundColor:"#F9FAFB",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"},children:r}),td:({children:r})=>e.jsx(t.Box,{component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"},children:r}),code:({children:t})=>e.jsx("span",{style:{fontFamily:"inherit",fontSize:"inherit"},children:t}),pre:({children:t})=>e.jsx("span",{style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"},children:t}),updated:({children:t})=>e.jsx(e.Fragment,{children:t}),deleted:({children:t})=>{const r=j(t,e=>c.default.cloneElement(e,{"data-is-suggested-deviation-fix":"true"}));return e.jsx("span",{style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"},children:r})},changed:({children:t})=>{const r=j(t,e=>c.default.cloneElement(e,{"data-is-suggested-deviation-fix":"true"}));return e.jsx("span",{style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"},children:r})},ul:({children:r,...n})=>e.jsx(t.Box,{component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"},...n,children:r}),ol:({children:r,...n})=>e.jsx(t.Box,{component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"},...n,children:r}),li:({children:r,...n})=>e.jsx(t.Box,{component:"li",sx:{mb:.5,display:"list-item"},...n,children:r})}),[]),k=e=>{if(!e||"string"!=typeof e)return"";let t=e;t=t.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1"),t=t.replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n"),t=t.replace(/^(\d+\.)(\s{2,})/gm,(e,t,r)=>`${t.slice(0,-1)}\\.${r}`),t=t.replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,(e,t,r,n)=>`${t} ${n}`),t=t.replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2"),t=t.replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2"),t=t.replace(/\n{3,}/g,"\n\n"),t=t.replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,e=>e.replace(/ /g," ").replace(/\t/g," "));const r=t.split(/(\n{2,})/);return t=r.map(e=>/^\n+$/.test(e)||/\|.*\|/.test(e)&&/\|[\s:|-]+\|/.test(e)||/^#{1,6} /.test(e.trimStart())?e:e.replace(/\n(?=[^\n])/g,(t,r)=>{const n=e.slice(r+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(n)?"\n":" "})).join(""),t.trim()},C=e=>e.replace(/[\.,;:]/g," "),S=r.useMemo(()=>d.map(e=>({id:e.id,connected:e.isConnected,stackIndex:e.stackIndex,size:e.size})),[d]),F=r.useMemo(()=>{let e=k(o||"");const t=f?C(e):e,r=(d||[]).map(e=>({id:e?.id,highlight:k(e?.highlight||""),highlightColor:e?.style?.highlightBg||e?.style?.badgeBg||m})).filter(e=>e.id&&e.highlight),n={};r.forEach(e=>{n[e.highlight]||(n[e.highlight]=[]),n[e.highlight].push(e)});const i=(e,t="",r,n=[])=>{let i=!1;const o=e=>{const o=((e,t="",r)=>{const n=e.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!n)return e;const i=n[1]??"",o=n[2]??"",a=n[3]??"";return o?i+((e="",t)=>`<mark${e?` data-badge-id="${e}"`:""}${t?` data-highlight-color="${t}"`:""}>`)(t,r)+o+"</mark>"+a:e})(e,t,r);let a=o;if(!i&&n.length>0){i=!0;let e="",t="";n.forEach(r=>{e+=(e=>`<span data-badge-id="${e}">`)(r.id),t="</span>"+t}),a=e+o+t}return""+a};return e.split(/(\n+)/).map(e=>{if(/^\n+$/.test(e))return e;if(!e.trim())return e;return""===e.replace(/[|:\-\s]/g,"")&&e.includes("-")?e:e.includes("|")?e.split(/(\|)/).map(e=>"|"!==e&&e.trim()?o(e):e).join(""):o(e)}).join("")},s=[];Object.entries(n).forEach(([r,n])=>{let i=e.indexOf(r),o=!1;if(-1===i&&f){const e=C(r);i=t.indexOf(e),-1!==i&&(o=!0)}if(-1===i)return;let l=n[0].highlightColor;for(let e=1;e<n.length;e++)l=a.mixHexColors(l,n[e].highlightColor||"");s.push({highlight:r,start:i,end:i+r.length,badges:n,color:l,usedLooseMatch:o})});const l=new Set(Object.keys(n));(p||[]).forEach(r=>{if(!r)return;const n=k(r);if(!n||l.has(n))return;let i=e.indexOf(n),o=!1;if(-1===i&&f){const e=C(n);i=t.indexOf(e),-1!==i&&(o=!0)}if(-1===i)return;const a=e.slice(0,i);(a.match(/</g)||[]).length===(a.match(/>/g)||[]).length&&s.push({highlight:n,start:i,end:i+n.length,badges:[],color:m||"",usedLooseMatch:o})}),s.sort((e,t)=>e.start-t.start||t.end-e.end);const c=[],h={};s.forEach((e,t)=>{let r=e.start,n=e.end;for(const i of c){const o=i.start,a=i.end,s=r<a&&n>a&&r>=o,l=r<o&&n>o&&n<=a;if(r>=o&&n<=a){e.orphaned=!0,h[t]=i.matchIdx;break}s&&(r=a),l&&(n=o)}e.trimmedStart=r,e.trimmedEnd=n,!e.orphaned&&r<n&&c.push({start:r,end:n,matchIdx:t})});const g={};Object.entries(h).forEach(([e,t])=>{const r=Number(e);g[t]||(g[t]=[]),g[t].push(r)});return s.map((e,t)=>({...e,idx:t})).filter(e=>!e.orphaned).sort((e,t)=>(t.trimmedStart??t.start)-(e.trimmedStart??e.start)).forEach(t=>{const r=t.trimmedStart??t.start,n=t.trimmedEnd??t.end;if(r>=n)return;const o=e.slice(r,n),l=((e,t,r,n)=>{if(!r.length)return e;const o=r.map(e=>s[e]).sort((e,t)=>e.start-t.start);let l="",d=0;return o.forEach(r=>{const o=Math.max(d,r.start-t),s=Math.max(o,r.end-t);if(o>=s)return;const c=a.mixHexColors(n,r.color||"");l+=e.slice(d,o),l+=i(e.slice(o,s),r.badges?.[0]?.id||"",c,r.badges||[]),d=s}),l+=e.slice(d),l})(t.usedLooseMatch||r!==t.start||n!==t.end?o:t.highlight,t.start,g[t.idx]||[],t.color),d=i(l,t.badges?.[0]?.id||"",t.color,t.badges||[]);e=e.slice(0,r)+d+e.slice(n)}),e},[o,d,p,m,f]),$=r.useMemo(()=>s?k(s||""):"",[s]),z=!!s,A={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},M={...l,...A,position:"relative",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2,...z?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}},T={...l,...A,position:"relative",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"};return r.useLayoutEffect(()=>{if(!y.current)return;const e=()=>{const e=Array.from(y.current.querySelectorAll(".deviation-badge"));if(0===e.length)return;e.forEach(e=>{e.style.setProperty("--badge-nudge","0px")});const t=e.filter(e=>"left"===e.dataset.side),r=e.filter(e=>"left"!==e.dataset.side),n=y.current.getBoundingClientRect(),i=n.bottom-4,o=n.top+4,a=e=>{if(0===e.length)return;const t=e.map(e=>{const t=e.getBoundingClientRect();return{el:e,naturalTop:t.top,height:t.height,currentTop:t.top}});t.sort((e,t)=>e.naturalTop-t.naturalTop);const r=[];let n=[];t.forEach(e=>{if(0===n.length)n.push(e);else{const t=n[n.length-1],i=t.currentTop+t.height;e.naturalTop<i+8?(e.currentTop=i+8,n.push(e)):(r.push(n),n=[e])}}),n.length>0&&r.push(n),r.forEach(e=>{const t=e[e.length-1],r=t.currentTop+t.height;if(r>i){const t=r-i,n=e[0].currentTop-o,a=Math.max(0,Math.min(t,n));e.forEach(e=>{e.currentTop-=a})}}),r.flat().forEach(e=>{const t=e.currentTop-e.naturalTop;e.el.style.setProperty("--badge-nudge",`${t}px`)})};a(t),a(r)},t=requestAnimationFrame(()=>{requestAnimationFrame(()=>{e()})}),r=new ResizeObserver(()=>{requestAnimationFrame(e)});return r.observe(y.current),()=>{r.disconnect(),cancelAnimationFrame(t)}},[F,b,S]),e.jsxs(t.Box,{ref:y,sx:{position:"relative",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",width:"100%",maxWidth:"100%",minWidth:0},children:[e.jsx(t.Typography,{component:"div",sx:{...M,padding:"3px"},children:e.jsx(h.default,{components:w,remarkPlugins:u,rehypePlugins:x,children:F.replace(/#{3}/g,"")})}),z&&e.jsx(t.Typography,{component:"div",sx:T,children:e.jsx(h.default,{components:w,remarkPlugins:u,rehypePlugins:x,children:$})})]})},a.areMarkdownPropsEqual);exports.MemoizedMarkdown=m;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@mui/material"),r=require("react"),n=require("../CognitiveCompareConstants.js"),i=require("lucide-react"),o=require("react-markdown"),l=require("../CognitiveComparehelpers.js"),a=require("../utils/normalizeInlineMarkdown.js"),s=require("rehype-raw"),d=require("remark-gfm"),c=require("../utils/normalizeRedlineMarkdown.js"),h=require("../utils/normalizeCompactedGfmTables.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=p(r),u=p(o),m=p(s);const x=e=>"function"==typeof e?e:e?.default||e,f=[x(p(d).default)],b=[x(m.default)],y=g.default.memo(({content:o,overlayContent:s,fallbackContent:d,sxStyles:p,deviationBadges:m=[],highlights:x=[],maintainRelativeOrder:y=!0,highlightBg:v,suppressHighlightBg:B=!1,collisionKey:E})=>{const j=r.useRef(null),k=!!s,w=r.useMemo(()=>m.reduce((e,t)=>({...e,[t.id]:t}),{}),[m]),S=r.useRef({badgeMap:w,highlightBg:v,hideHighlightBg:k,suppressHighlightBg:B});S.current={badgeMap:w,highlightBg:v,hideHighlightBg:k,suppressHighlightBg:B};const C=(e,t)=>g.default.Children.map(e,e=>{if(!g.default.isValidElement(e))return e;const r=e.props?.children?C(e.props.children,t):e.props.children,n=g.default.cloneElement(e,{...e.props,children:r});return t(n)}),F=r.useMemo(()=>({mark:({children:t,...r})=>{const{badgeMap:n,highlightBg:i,hideHighlightBg:o,suppressHighlightBg:l}=S.current,a=r["data-badge-id"],s=a?n[a]:null,d=r["data-highlight-color"]??s?.style?.highlightBg??s?.style?.badgeBg??i,c="true"===r["data-is-suggested-deviation-fix"]||l;return e.jsx("span",{style:{...c?{}:{backgroundColor:d},borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px",...o?{color:"transparent"}:{}},children:t})},br:()=>e.jsx("br",{}),span:({children:r,...o})=>{const{badgeMap:l}=S.current,a=o["data-badge-id"];if(!a)return e.jsx("span",{...o,children:r});const s=l[a];if(!s)return e.jsx("span",{...o,children:r});const d="number"==typeof s.stackIndex?s.stackIndex:0,c=`translateY(calc(-20% + ${12*d}px + var(--badge-nudge, 0px)))`;return e.jsxs(t.Box,{component:"span",sx:{position:"static",display:"inline"},children:[e.jsxs(t.Box,{ref:s.badgeRef,className:"deviation-badge","data-side":s.side||"right",sx:{fontStyle:"normal",position:"absolute",zIndex:30+d,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:s.style?.badgeBg||"#EEF2FF",color:s.style?.badgeText||n.DEFAULT_DEVIAION_COLOR,border:`1px solid ${s.style?.badgeBorder||"#C7D2FE"}`,borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none",..."left"===s.side?{right:"-16px",transform:`${c} translateX(calc(100% + 8px))`}:{left:"-16px",transform:`${c} translateX(calc(-100% - 8px))`},...s.isConnected&&s.style&&{outline:`2px solid ${s.style.badgeBorder}`,outlineOffset:"1px"}},children:[e.jsxs(t.Box,{onClick:e=>{e.stopPropagation(),s.onSummaryClick&&s.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}},children:[e.jsx(t.Box,{component:"span",sx:{fontSize:"10px",fontWeight:700},children:s.label}),("left"===s.side||s.isOrphan)&&e.jsx(t.Box,{component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:`1px solid ${s.style?.badgeBorder||"#C7D2FE"}`},children:null!=s.score&&"N/A"!==s.score&&"NA"!==s.score&&0!==s.score?`${s.score}`:"N/A"===s.score||"NA"===s.score?"N/A":"Same"})]}),("left"===s.side||s.isOrphan)&&e.jsx(t.Box,{onClick:e=>{e.stopPropagation(),s.onClick&&s.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:`1px solid ${s.style?.badgeBorder||"#C7D2FE"}`,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}},children:e.jsx(i.EllipsisVertical,{size:12,color:s.style?.badgeText||"#3730A3"})})]}),r]})},table:({children:r})=>e.jsx(t.Box,{sx:{display:"block",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",contain:"inline-size",overflowX:"auto",overflowY:"hidden",overscrollBehaviorX:"contain",WebkitOverflowScrolling:"touch",my:1},children:e.jsx(t.Box,{component:"table",sx:{width:"600px",minWidth:"600px",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"inherit"},children:r})}),thead:({children:r})=>e.jsx(t.Box,{component:"thead",children:r}),tbody:({children:r})=>e.jsx(t.Box,{component:"tbody",children:r}),tr:({children:r})=>e.jsx(t.Box,{component:"tr",sx:{borderBottom:"1px solid #E5E7EB"},children:r}),th:({children:r})=>e.jsx(t.Box,{component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",verticalAlign:"top",fontWeight:600,backgroundColor:"#F9FAFB",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"},children:r}),td:({children:r})=>e.jsx(t.Box,{component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"},children:r}),code:({children:t})=>e.jsx("span",{style:{fontFamily:"inherit",fontSize:"inherit"},children:t}),pre:({children:t})=>e.jsx("span",{style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"},children:t}),updated:({children:t})=>e.jsx(e.Fragment,{children:t}),deleted:({children:t})=>{const r=C(t,e=>g.default.cloneElement(e,{"data-is-suggested-deviation-fix":"true"}));return e.jsx("span",{style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"},children:r})},changed:({children:t})=>{const r=C(t,e=>g.default.cloneElement(e,{"data-is-suggested-deviation-fix":"true"}));return e.jsx("span",{style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"},children:r})},ul:({children:r,...n})=>e.jsx(t.Box,{component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"},...n,children:r}),ol:({children:r,...n})=>e.jsx(t.Box,{component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"},...n,children:r}),li:({children:r,...n})=>e.jsx(t.Box,{component:"li",sx:{mb:.5,display:"list-item"},...n,children:r})}),[]),M=e=>{if(!e||"string"!=typeof e)return"";let t=h.normalizeCompactedGfmTables(e);t=t.replace(/((?:<\/?(?:updated|changed|deleted|manual)\b[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1"),t=t.replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n"),t=t.replace(/^([ \t]*)(\d+\.)(\s{2,})/gm,(e,t,r,n)=>`${t}${r.slice(0,-1)}\\.${n}`),t=t.replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,(e,t,r,n)=>`${t} ${n}`),t=t.replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2"),t=t.replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2"),t=t.replace(/\n{3,}/g,"\n\n"),t=t.replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,e=>e.replace(/ /g," ").replace(/\t/g," "));const r=t.split(/(\n{2,})/);return t=r.map(e=>/^\n+$/.test(e)||/\|.*\|/.test(e)&&/\|[\s:|-]+\|/.test(e)||/^#{1,6} /.test(e.trimStart())?e:e.replace(/\n(?=[^\n])/g,(t,r)=>{const n=e.slice(r+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(n)?"\n":" "})).join(""),t.trim()},T=r.useMemo(()=>m.map(e=>({id:e.id,connected:e.isConnected,stackIndex:e.stackIndex,size:e.size})),[m]),$=e=>M(c.normalizeRedlineMarkdown(e||"")),z=r.useMemo(()=>{let e=M(c.normalizeRedlineMarkdown(o||""));const t=d?M(c.normalizeRedlineMarkdown(d)):"",r=(m||[]).map(e=>({id:e?.id,highlight:$(e?.highlight||""),highlightColor:e?.style?.highlightBg||e?.style?.badgeBg||v})).filter(e=>e.id&&e.highlight);if(t&&r.length>0){const n=(e,t)=>B?l.findRedlineTextAnchorRange(e,t):l.findTextMatchRange(e,t,!1),i=r.some(({highlight:t})=>!n(e,t)),o=r.every(({highlight:e})=>!!n(t,e));i&&o&&(e=t)}const n={};r.forEach(e=>{n[e.highlight]||(n[e.highlight]=[]),n[e.highlight].push(e)});const i=(e,t="",r,n=[])=>{let i=!1;const o=e=>{const o=((e,t="",r)=>{const n=e.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!n)return e;const i=n[1]??"",o=n[2]??"",l=n[3]??"";return o?i+((e="",t)=>`<mark${e?` data-badge-id="${e}"`:""}${t?` data-highlight-color="${t}"`:""}>`)(t,r)+o+"</mark>"+l:e})(e,t,r);let l=o;if(!i&&n.length>0){i=!0;let e="",t="";n.forEach(r=>{e+=(e=>`<span data-badge-id="${e}">`)(r.id),t="</span>"+t}),l=e+o+t}return""+l};return e.split(/(\n+)/).map(e=>{if(/^\n+$/.test(e))return e;if(!e.trim())return e;return""===e.replace(/[|:\-\s]/g,"")&&e.includes("-")?e:e.includes("|")?e.split(/(\|)/).map(e=>"|"!==e&&e.trim()?o(e):e).join(""):o(e)}).join("")},s=[];Object.entries(n).forEach(([t,r])=>{let n=B?l.findRedlineTextAnchorRange(e,t):l.findTextMatchRange(e,t,!1);if(n||B||(n=a.findTextRangeWithFormatting(e,t)),!n)return;const i=e.slice(n.start,n.end)!==t;let o=r[0].highlightColor;for(let e=1;e<r.length;e++)o=l.mixHexColors(o,r[e].highlightColor||"");s.push({highlight:t,start:n.start,end:n.end,badges:r,color:o,usedLooseMatch:i})});const h=new Set(Object.keys(n));(x||[]).forEach(t=>{if(!t)return;const r=$(t);if(!r||h.has(r))return;const n=B?l.findRedlineTextAnchorRange(e,r):l.findTextMatchRange(e,r,!1);if(!n)return;const i=e.slice(n.start,n.end)!==r,o=e.slice(0,n.start);(o.match(/</g)||[]).length===(o.match(/>/g)||[]).length&&s.push({highlight:r,start:n.start,end:n.end,badges:[],color:v||"",usedLooseMatch:i})}),s.sort((e,t)=>e.start-t.start||t.end-e.end);const p=[],g={};s.forEach((e,t)=>{let r=e.start,n=e.end;for(const i of p){const o=i.start,l=i.end,a=r<l&&n>l&&r>=o,s=r<o&&n>o&&n<=l;if(r>=o&&n<=l){e.orphaned=!0,g[t]=i.matchIdx;break}a&&(r=l),s&&(n=o)}e.trimmedStart=r,e.trimmedEnd=n,!e.orphaned&&r<n&&p.push({start:r,end:n,matchIdx:t})});const u={};Object.entries(g).forEach(([e,t])=>{const r=Number(e);u[t]||(u[t]=[]),u[t].push(r)});return s.map((e,t)=>({...e,idx:t})).filter(e=>!e.orphaned).sort((e,t)=>(t.trimmedStart??t.start)-(e.trimmedStart??e.start)).forEach(t=>{const r=t.trimmedStart??t.start,n=t.trimmedEnd??t.end;if(r>=n)return;const o=e.slice(r,n),a=((e,t,r,n)=>{if(!r.length)return e;const o=r.map(e=>s[e]).sort((e,t)=>e.start-t.start);let a="",d=0;return o.forEach(r=>{const o=Math.max(d,r.start-t),s=Math.max(o,r.end-t);if(o>=s)return;const c=l.mixHexColors(n,r.color||"");a+=e.slice(d,o),a+=i(e.slice(o,s),r.badges?.[0]?.id||"",c,r.badges||[]),d=s}),a+=e.slice(d),a})(t.usedLooseMatch||r!==t.start||n!==t.end?o:t.highlight,t.start,u[t.idx]||[],t.color),d=i(a,t.badges?.[0]?.id||"",t.color,t.badges||[]);e=e.slice(0,r)+d+e.slice(n)}),e},[o,d,m,x,v,B]),A=r.useMemo(()=>s?M(c.normalizeRedlineMarkdown(s||"")):"",[s]),R=!!s,q={...p,"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap",lineHeight:"1.5"},position:"relative",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"inherit",fontWeight:"400",lineHeight:"1.5",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",padding:"3px"},W={...q,zIndex:2,...R?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto",visibility:"visible"},"& table":{visibility:"hidden"}}:{}},I={...q,zIndex:1,pointerEvents:"auto"};return r.useLayoutEffect(()=>{if(!j.current)return;const e=()=>{const e=Array.from(j.current.querySelectorAll(".deviation-badge"));if(0===e.length)return;e.forEach(e=>{e.style.setProperty("--badge-nudge","0px")});const t=j.current.getBoundingClientRect(),r=t.bottom-4,n=t.top+4,i=j.current.querySelector('div[data-layer="base"]')||j.current.querySelector("div")?.firstElementChild,o=R?j.current.querySelector('div[data-layer="overlay"]')||j.current.querySelector("div")?.lastElementChild:null,l=i?Array.from(i.querySelectorAll(".deviation-badge")):[],a=o?Array.from(o.querySelectorAll(".deviation-badge")):[],s=e.length>0?e.filter(e=>"left"===e.dataset.side):l.filter(e=>"left"===e.dataset.side),d=e.length>0?e.filter(e=>"left"!==e.dataset.side):l.filter(e=>"left"!==e.dataset.side),c=e=>{if(0===e.length)return;const t=e.map(e=>{const t=e.getBoundingClientRect();return{el:e,naturalTop:t.top,height:t.height,currentTop:t.top}});t.sort((e,t)=>e.naturalTop-t.naturalTop);const i=[];let o=[];t.forEach(e=>{if(0===o.length)o.push(e);else{const t=o[o.length-1],r=t.currentTop+t.height;e.naturalTop<r+8?(e.currentTop=r+8,o.push(e)):(i.push(o),o=[e])}}),o.length>0&&i.push(o),i.forEach(e=>{const t=e[e.length-1],i=t.currentTop+t.height;if(i>r){const t=i-r,o=e[0].currentTop-n,l=Math.max(0,Math.min(t,o));e.forEach(e=>{e.currentTop-=l})}}),i.flat().forEach(e=>{const t=e.currentTop-e.naturalTop;e.el.style.setProperty("--badge-nudge",`${t}px`)})};if(R&&(l.length>0||a.length>0)){const e=l.filter(e=>"left"===e.dataset.side),t=l.filter(e=>"left"!==e.dataset.side),r=a.filter(e=>"left"===e.dataset.side),n=a.filter(e=>"left"!==e.dataset.side);c(e),c(t),c(r),c(n)}else c(s),c(d)},t=requestAnimationFrame(()=>{requestAnimationFrame(()=>{e()})}),r=new ResizeObserver(()=>{requestAnimationFrame(e)});return r.observe(j.current),()=>{r.disconnect(),cancelAnimationFrame(t)}},[z,E,T]),e.jsxs(t.Box,{ref:j,sx:{position:"relative",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",width:"100%",maxWidth:"100%",minWidth:0},children:[e.jsx(t.Typography,{component:"div",sx:W,children:e.jsx(u.default,{components:F,remarkPlugins:f,rehypePlugins:b,children:z.replace(/#{3}/g,"")})}),R&&e.jsx(t.Typography,{component:"div",sx:I,children:e.jsx(u.default,{components:F,remarkPlugins:f,rehypePlugins:b,children:A})})]})},l.areMarkdownPropsEqual);exports.MemoizedMarkdown=y;
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|