@viswa-test/test-citation 0.0.252 → 0.0.254

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +202 -26
  2. package/dist/cjs/features/BPACitationRenderer/BPACitationRenderer.js +2 -0
  3. package/dist/cjs/features/BPACitationRenderer/BPACitationRenderer.js.map +1 -0
  4. package/dist/cjs/features/BPACitationRenderer/citationTypes.js +2 -0
  5. package/dist/cjs/features/BPACitationRenderer/citationTypes.js.map +1 -0
  6. package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
  7. package/dist/cjs/features/CognitiveCompare/CitationRenderer.js +1 -1
  8. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  9. package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  10. package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
  11. package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
  12. package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  13. package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
  14. package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js +1 -1
  15. package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
  16. package/dist/cjs/features/DualCitation/RuleBookCitationApiComponent.js +2 -0
  17. package/dist/cjs/features/DualCitation/RuleBookCitationApiComponent.js.map +1 -0
  18. package/dist/cjs/features/DualCitation/RuleBookCitationComponent.js +2 -0
  19. package/dist/cjs/features/DualCitation/RuleBookCitationComponent.js.map +1 -0
  20. package/dist/cjs/features/DualCitation/SourceBQDataCompnent.js +2 -0
  21. package/dist/cjs/features/DualCitation/SourceBQDataCompnent.js.map +1 -0
  22. package/dist/cjs/features/DualCitation/SourceBQDataCompnent.module.css.js +2 -0
  23. package/dist/cjs/features/DualCitation/SourceBQDataCompnent.module.css.js.map +1 -0
  24. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
  25. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
  26. package/dist/cjs/features/InstantLearningCitation/InstantLearningCitationComponent.js +1 -1
  27. package/dist/cjs/features/PromptemonBlockViewer/PromptemonBlockViewer.js +2 -0
  28. package/dist/cjs/features/PromptemonBlockViewer/PromptemonBlockViewer.js.map +1 -0
  29. package/dist/cjs/features/PromptemonViewer/PromptemonViewer.js +2 -0
  30. package/dist/cjs/features/PromptemonViewer/PromptemonViewer.js.map +1 -0
  31. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  32. package/dist/cjs/features/RulebookCitations/RuleBookCitationApi.js +1 -1
  33. package/dist/cjs/features/RulebookCitations/RuleBookCitationWrapper.js +1 -1
  34. package/dist/cjs/features/SplitterCitations/SplitterCitationsComponent.js +1 -1
  35. package/dist/cjs/features/SplitterCitations/icons/icons.js +2 -0
  36. package/dist/cjs/features/SplitterCitations/icons/icons.js.map +1 -0
  37. package/dist/cjs/features/TextualGuidelines/TextualGuideLinesComponent.js +1 -1
  38. package/dist/cjs/features/TextualGuidelines/TextualGuidelines.module.css.js +1 -1
  39. package/dist/cjs/index.js +1 -1
  40. package/dist/features/BPACitationRenderer/BPACitationRenderer.js +2 -0
  41. package/dist/features/BPACitationRenderer/BPACitationRenderer.js.map +1 -0
  42. package/dist/features/BPACitationRenderer/citationTypes.js +2 -0
  43. package/dist/features/BPACitationRenderer/citationTypes.js.map +1 -0
  44. package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
  45. package/dist/features/CognitiveCompare/CitationRenderer.js +1 -1
  46. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  47. package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  48. package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
  49. package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
  50. package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  51. package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
  52. package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js +1 -1
  53. package/dist/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
  54. package/dist/features/DualCitation/RuleBookCitationApiComponent.js +2 -0
  55. package/dist/features/DualCitation/RuleBookCitationApiComponent.js.map +1 -0
  56. package/dist/features/DualCitation/RuleBookCitationComponent.js +2 -0
  57. package/dist/features/DualCitation/RuleBookCitationComponent.js.map +1 -0
  58. package/dist/features/DualCitation/SourceBQDataCompnent.js +2 -0
  59. package/dist/features/DualCitation/SourceBQDataCompnent.js.map +1 -0
  60. package/dist/features/DualCitation/SourceBQDataCompnent.module.css.js +2 -0
  61. package/dist/features/DualCitation/SourceBQDataCompnent.module.css.js.map +1 -0
  62. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
  63. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
  64. package/dist/features/InstantLearningCitation/InstantLearningCitationComponent.js +1 -1
  65. package/dist/features/PromptemonBlockViewer/PromptemonBlockViewer.js +2 -0
  66. package/dist/features/PromptemonBlockViewer/PromptemonBlockViewer.js.map +1 -0
  67. package/dist/features/PromptemonViewer/PromptemonViewer.js +2 -0
  68. package/dist/features/PromptemonViewer/PromptemonViewer.js.map +1 -0
  69. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  70. package/dist/features/RulebookCitations/RuleBookCitationApi.js +1 -1
  71. package/dist/features/RulebookCitations/RuleBookCitationWrapper.js +1 -1
  72. package/dist/features/SplitterCitations/SplitterCitationsComponent.js +1 -1
  73. package/dist/features/SplitterCitations/icons/icons.js +2 -0
  74. package/dist/features/SplitterCitations/icons/icons.js.map +1 -0
  75. package/dist/features/TextualGuidelines/TextualGuideLinesComponent.js +1 -1
  76. package/dist/features/TextualGuidelines/TextualGuidelines.module.css.js +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/types/node_modules/react-markdown/lib/complex-types.d.ts +23 -0
  79. package/dist/types/node_modules/react-markdown/lib/complex-types.d.ts.map +1 -0
  80. package/dist/types/src/Background.d.ts +7 -0
  81. package/dist/types/src/Background.d.ts.map +1 -0
  82. package/dist/types/src/CommonConstants/CommonConstants.d.ts +8553 -0
  83. package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
  84. package/dist/types/src/PromptemonBlockViewerTest.d.ts +3 -0
  85. package/dist/types/src/PromptemonBlockViewerTest.d.ts.map +1 -0
  86. package/dist/types/src/PromptemonViewerTest.d.ts +3 -0
  87. package/dist/types/src/PromptemonViewerTest.d.ts.map +1 -0
  88. package/dist/types/src/RedlineApprovalCardTest.d.ts +1 -0
  89. package/dist/types/src/RedlineApprovalCardTest.d.ts.map +1 -0
  90. package/dist/types/src/commonConstants.d.ts +31103 -0
  91. package/dist/types/src/commonConstants.d.ts.map +1 -0
  92. package/dist/types/src/features/BPACitationRenderer/BPACitationRenderer.d.ts +5 -0
  93. package/dist/types/src/features/BPACitationRenderer/BPACitationRenderer.d.ts.map +1 -0
  94. package/dist/types/src/features/BPACitationRenderer/BPACitationRenderer.types.d.ts +229 -0
  95. package/dist/types/src/features/BPACitationRenderer/BPACitationRenderer.types.d.ts.map +1 -0
  96. package/dist/types/src/features/BPACitationRenderer/BPACitationRendererTest.d.ts +6 -0
  97. package/dist/types/src/features/BPACitationRenderer/BPACitationRendererTest.d.ts.map +1 -0
  98. package/dist/types/src/features/BPACitationRenderer/DualRuleBookBqCitationTest.d.ts +4 -0
  99. package/dist/types/src/features/BPACitationRenderer/DualRuleBookBqCitationTest.d.ts.map +1 -0
  100. package/dist/types/src/features/BPACitationRenderer/DualRuleBookGptCitationTest.d.ts +4 -0
  101. package/dist/types/src/features/BPACitationRenderer/DualRuleBookGptCitationTest.d.ts.map +1 -0
  102. package/dist/types/src/features/BPACitationRenderer/ILRuleBookCitationTest.d.ts +4 -0
  103. package/dist/types/src/features/BPACitationRenderer/ILRuleBookCitationTest.d.ts.map +1 -0
  104. package/dist/types/src/features/BPACitationRenderer/citationTypes.d.ts +15 -0
  105. package/dist/types/src/features/BPACitationRenderer/citationTypes.d.ts.map +1 -0
  106. package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts +1 -0
  107. package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
  108. package/dist/types/src/features/CognitiveCompare/CitationRenderer.d.ts +2 -1
  109. package/dist/types/src/features/CognitiveCompare/CitationRenderer.d.ts.map +1 -1
  110. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  111. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +7 -7
  112. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
  113. package/dist/types/src/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
  114. package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts +6 -1
  115. package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
  116. package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
  117. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +0 -1
  118. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
  119. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts +4 -0
  120. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts.map +1 -1
  121. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.d.ts +2 -0
  122. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.d.ts.map +1 -1
  123. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.types.d.ts +162 -0
  124. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.types.d.ts.map +1 -0
  125. package/dist/types/src/features/DualCitation/RuleBookCitationApiComponent.d.ts +20 -0
  126. package/dist/types/src/features/DualCitation/RuleBookCitationApiComponent.d.ts.map +1 -0
  127. package/dist/types/src/features/DualCitation/RuleBookCitationComponent.d.ts +31 -0
  128. package/dist/types/src/features/DualCitation/RuleBookCitationComponent.d.ts.map +1 -0
  129. package/dist/types/src/features/DualCitation/SourceBQDataCompnent.d.ts +36 -0
  130. package/dist/types/src/features/DualCitation/SourceBQDataCompnent.d.ts.map +1 -0
  131. package/dist/types/src/features/InstantLearningCitation/InstantLearningCitationComponent.d.ts +15 -2
  132. package/dist/types/src/features/InstantLearningCitation/InstantLearningCitationComponent.d.ts.map +1 -1
  133. package/dist/types/src/features/InstantLearningCitation/InstantLearningCitationTest.d.ts.map +1 -1
  134. package/dist/types/src/features/InstantLearningCitation/types/Types.d.ts +5 -1
  135. package/dist/types/src/features/InstantLearningCitation/types/Types.d.ts.map +1 -1
  136. package/dist/types/src/features/PromptemonBlockViewer/PromptemonBlockViewer.d.ts +11 -0
  137. package/dist/types/src/features/PromptemonBlockViewer/PromptemonBlockViewer.d.ts.map +1 -0
  138. package/dist/types/src/features/PromptemonBlockViewer/index.d.ts +3 -0
  139. package/dist/types/src/features/PromptemonBlockViewer/index.d.ts.map +1 -0
  140. package/dist/types/src/features/PromptemonViewer/PromptemonViewer.d.ts +43 -0
  141. package/dist/types/src/features/PromptemonViewer/PromptemonViewer.d.ts.map +1 -0
  142. package/dist/types/src/features/PromptemonViewer/index.d.ts +3 -0
  143. package/dist/types/src/features/PromptemonViewer/index.d.ts.map +1 -0
  144. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +1 -1
  145. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  146. package/dist/types/src/features/RulebookCitations/RuleBookCitation.types.d.ts +40 -0
  147. package/dist/types/src/features/RulebookCitations/RuleBookCitation.types.d.ts.map +1 -0
  148. package/dist/types/src/features/RulebookCitations/RuleBookCitationApi.d.ts +2 -15
  149. package/dist/types/src/features/RulebookCitations/RuleBookCitationApi.d.ts.map +1 -1
  150. package/dist/types/src/features/RulebookCitations/RuleBookCitationWrapper.d.ts +19 -5
  151. package/dist/types/src/features/RulebookCitations/RuleBookCitationWrapper.d.ts.map +1 -1
  152. package/dist/types/src/features/RulebookCitations/RuleBookCitationWrapperTest.d.ts +0 -2
  153. package/dist/types/src/features/RulebookCitations/RuleBookCitationWrapperTest.d.ts.map +1 -1
  154. package/dist/types/src/features/SplitterCitations/SplitterCitationsComponent.d.ts +1 -20
  155. package/dist/types/src/features/SplitterCitations/SplitterCitationsComponent.d.ts.map +1 -1
  156. package/dist/types/src/features/SplitterCitations/icons/icons.d.ts +17 -0
  157. package/dist/types/src/features/SplitterCitations/icons/icons.d.ts.map +1 -0
  158. package/dist/types/src/features/SplitterCitations/types.d.ts +78 -0
  159. package/dist/types/src/features/SplitterCitations/types.d.ts.map +1 -0
  160. package/dist/types/src/features/TextualGuidelines/TextualGuideLinesComponent.d.ts +13 -1
  161. package/dist/types/src/features/TextualGuidelines/TextualGuideLinesComponent.d.ts.map +1 -1
  162. package/dist/types/src/features/TextualGuidelines/TextualGuidelines.types.d.ts +81 -0
  163. package/dist/types/src/features/TextualGuidelines/TextualGuidelines.types.d.ts.map +1 -0
  164. package/dist/types/src/index.d.ts +10 -1
  165. package/dist/types/src/index.d.ts.map +1 -1
  166. package/package.json +17 -7
package/README.md CHANGED
@@ -37,6 +37,8 @@
37
37
  - [SplitterCitationsComponent](#splittercitationscomponent) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/SplitterCitations/README.md)
38
38
  - [RuleBookCitationWrapper](#RuleBookCitationWrapper) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/RuleBookCitations/README.md)
39
39
  -[ManageReminders](#ManageReminders) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ManageRemainders/README.md)
40
+ - [PromptemonBlockViewer](#promptemonblockviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PromptemonBlockViewer/PromptemonBlockViewerReadme.md)
41
+ - [PromptemonViewer](#promptemonviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PromptemonViewer/PromptemonViewerReadme.md)
40
42
  4. [Common Use Cases](#common-use-cases)
41
43
  5. [Development & Contribution](#development--contribution)
42
44
  6. [License](#license)
@@ -644,6 +646,7 @@ The CognitiveInternalgptReasoningComponent is a React component designed to rend
644
646
  - **Fullscreen Modal View** - Open a fullscreen modal for detailed examination of reasoning data
645
647
  - **Text Formatting Support** - Handle bold text, list items, headers, and special highlight tags
646
648
  - **Custom Icon Support** - Replace default icons with custom React components
649
+ - **Theming Support** - Customize component appearance using `themeTokens`, `classNames`, and `styles`
647
650
 
648
651
  ### Usage
649
652
 
@@ -673,6 +676,17 @@ const reasoningData = {
673
676
  - Auto-scrolls to active highlight
674
677
  - previewCallback we can use this to pass a callback for external link opening or pdf opening
675
678
  - DocumentTitle : pdf title or document title
679
+ - `themeTokens` can be used to pass CSS variable based theming
680
+ - `classNames` can be used to override classes for individual sections
681
+ - `styles` can be used to pass inline style overrides for individual sections
682
+
683
+ ### Additional Props
684
+
685
+ | Prop | Type | Default | Description |
686
+ |------|------|---------|-------------|
687
+ | `themeTokens` | `CognitiveReasoningThemeTokens` | `undefined` | Optional CSS variable based theme tokens |
688
+ | `classNames` | `CognitiveReasoningClassNames` | `undefined` | Optional class overrides for individual sections |
689
+ | `styles` | `CognitiveReasoningStyles` | `undefined` | Optional inline style overrides for individual sections |
676
690
 
677
691
  ---
678
692
 
@@ -2623,54 +2637,106 @@ function App() {
2623
2637
 
2624
2638
  A React component used to render Rule Book citation content with highlighted citation phrases.
2625
2639
 
2626
- The component fetches citation metadata, resolves the associated Rule Book file, extracts textual guideline content, and displays it using the `TextualGuideLinesComponent`.
2640
+ The component resolves Rule Book citation information either from the provided `data.fileDetails` or from `msg.artifactSearchData.ruleBookData.rulebook_citations`. It then locates the corresponding guideline file, fetches its contents, extracts the Rule Book text, and renders it using `TextualGuideLinesComponent`.
2641
+
2627
2642
 
2628
2643
  ### Usage
2629
2644
 
2630
2645
  ```tsx
2631
- import { RuleBookCitationWrapper } from "<library-name>";
2646
+ import RuleBookCitationWrapper from "<library-name>";
2632
2647
 
2633
- const sourceAttachments = [
2634
- {
2635
- id: "file-001",
2636
- name: "RuleBook.json",
2637
- gcsUrl: "gs://bucket/rulebook.json",
2638
- is_guideline_file: true,
2639
- },
2640
- ];
2648
+ <RuleBookCitationWrapper
2649
+ data={{
2650
+ citationNumber: 1,
2651
+ }}
2652
+ msg={message}
2653
+ guidelines={guidelines}
2654
+ getSignedUrl={getSignedUrl}
2655
+ getFileContent={getFileContent}
2656
+ />
2657
+ ```
2658
+
2659
+ ---
2660
+
2661
+ #### Using Direct File Details
2641
2662
 
2663
+ If the citation metadata is already available, it can be passed directly:
2664
+
2665
+ ```tsx
2642
2666
  <RuleBookCitationWrapper
2643
- requestId="citation-request-id"
2644
- citationIndex={0}
2645
- accessToken="access-token"
2646
- sourceAttachments={sourceAttachments}
2667
+ data={{
2668
+ citationNumber: 1,
2669
+ fileDetails: {
2670
+ file_id: "rulebook-file-id",
2671
+ phrase_to_highlight: "Expected Behaviour",
2672
+ },
2673
+ }}
2674
+ guidelines={guidelines}
2675
+ getSignedUrl={getSignedUrl}
2676
+ getFileContent={getFileContent}
2647
2677
  />
2648
2678
  ```
2649
2679
 
2680
+ In this case, the component skips citation lookup from `msg` and directly loads the corresponding Rule Book file.
2681
+
2650
2682
  ### Props
2651
2683
 
2652
- ### `RuleBookCitationWrapperProps`
2684
+ #### `RuleBookCitationWrapperProps`
2653
2685
 
2654
2686
  | Prop | Type | Default | Description |
2655
- |---|---|---|---|
2656
- | `requestId` | `string \| null` | `undefined` | Identifier used to fetch citation metadata |
2657
- | `citationIndex` | `number` | `0` | Index of the citation to display |
2658
- | `accessToken` | `string` | — | Authentication token used for citation API requests |
2659
- | `sourceAttachments` | `SourceAttachment[] \| Record<string, SourceAttachment[]>` | `[]` | Source files containing Rule Book metadata |
2687
+ |------|------|---------|-------------|
2688
+ | `data` | `RuleBookCitationData` | `undefined` | Citation metadata. If `fileDetails` is provided, citation lookup is skipped. |
2689
+ | `msg` | `any` | `undefined` | Message object containing `artifactSearchData.ruleBookData.rulebook_citations`. Used when `fileDetails` is absent. |
2690
+ | `citationIndex` | `number` | `undefined` | Optional fallback citation index when `data.citationNumber` is unavailable. |
2691
+ | `guidelines` | `Guidelines` | `[]` | Guideline attachments used to locate the Rule Book file. |
2692
+ | `additionalClassNames` | `{ container?: string }` | `undefined` | Additional CSS classes applied to the outer container. |
2693
+ | `getSignedUrl` | `(gcsUrl: string) => Promise<SignedUrlResponse>` | `Required` | Consumer-provided function that returns a signed URL response. |
2694
+ | `getFileContent` | `(filePath: string) => Promise<string>` | `Required` | Consumer-provided function that returns the JSON file contents. |
2695
+ | `themeTokens` | `RuleBookCitationThemeTokens` | `undefined` | CSS custom properties used for theming. |
2696
+ | `classNames` | `RuleBookCitationClassNames` | `undefined` | Custom CSS classes for internal elements. |
2697
+ | `styles` | `RuleBookCitationStyles` | `undefined` | Inline style overrides for internal elements. |
2698
+
2699
+ ---
2700
+
2701
+ ### RuleBookCitationData
2702
+
2703
+ | Property | Type | Description |
2704
+ |----------|------|-------------|
2705
+ | `citationNumber` | `number` | Citation number (1-based). Internally converted to a zero-based index. |
2706
+ | `fileDetails.file_id` | `string` | File identifier corresponding to a guideline attachment. |
2707
+ | `fileDetails.phrase_to_highlight` | `string` | Phrase highlighted inside the Rule Book content. |
2708
+
2709
+ ---
2710
+
2711
+ ### Guidelines
2712
+
2713
+ The component supports both of the following formats:
2714
+
2715
+ ```ts
2716
+ type Guidelines =
2717
+ | SourceAttachment[]
2718
+ | Record<string, SourceAttachment[]>;
2719
+ ```
2660
2720
 
2661
2721
  ---
2662
2722
 
2663
2723
  ### SourceAttachment
2664
2724
 
2665
- | Prop | Type | Description |
2666
- |---|---|---|
2667
- | `id` | `string` | File identifier matching citation `file_id` |
2668
- | `gcsUrl` | `string` | GCS location of the Rule Book file |
2669
- | `name` | `string` | Optional file name |
2670
- | `is_guideline_file` | `boolean` | Indicates whether the file contains guideline/rule book content |
2725
+ | Property | Type | Description |
2726
+ |----------|------|-------------|
2727
+ | `id` | `string` | Unique identifier matching the citation `file_id`. |
2728
+ | `gcsUrl` | `string` | GCS path of the Rule Book file. |
2729
+ | `name` | `string` | File name used to determine the file extension. |
2730
+ | `is_guideline_file` | `boolean` | Indicates whether the attachment is a guideline file. |
2671
2731
 
2672
2732
  ---
2673
2733
 
2734
+ ### Notes
2735
+ - `url` is no longer required
2736
+ - The component no longer makes network calls directly
2737
+ - Signed URL resolution and file content fetching must be provided through `getSignedUrl` and `getFileContent`
2738
+ - Theming can also be applied to the nested `TextualGuideLinesComponent` through `themeTokens`, `classNames`, and `styles`
2739
+
2674
2740
  ## SplitterCitationsComponent
2675
2741
 
2676
2742
  A responsive, draggable split-pane layout component for React. Renders two panels side-by-side (horizontal) or stacked (vertical) with a draggable divider. Automatically switches to vertical layout when the container is narrower than 500 px. Supports panel collapse/expand and an optional header with a confidence score badge.
@@ -3046,6 +3112,116 @@ Renders: `[3] ⠋` (spinner) until `isStreaming` becomes `false`.
3046
3112
 
3047
3113
  ---
3048
3114
 
3115
+
3116
+ ---
3117
+
3118
+ ## PromptemonBlockViewer
3119
+
3120
+ ### Overview
3121
+
3122
+ A Monaco-based code editor component for viewing and highlighting prompt blocks. Supports XML tag highlighting, variable highlighting, dark/light theme toggling, and a fullscreen dialog with a description panel.
3123
+
3124
+ ### Features
3125
+
3126
+ - **Monaco editor with custom syntax highlighting** — XML tags and `{{variables}}` highlighted with custom token colors
3127
+ - **XML tag highlighting** — Scrolls to and highlights a specific XML tag block
3128
+ - **Variable highlighting** — Highlights all occurrences of a `{{variable}}`
3129
+ - **Dark/light theme toggle** — Switch between themes with a toggle
3130
+ - **Fullscreen dialog** — Description panel on left, full editor on right
3131
+
3132
+ ### Usage
3133
+
3134
+ ```tsx
3135
+ import PromptemonBlockViewer from '@e-llm-studio/citation/PromptemonBlockViewer'
3136
+
3137
+ <PromptemonBlockViewer
3138
+ title="role"
3139
+ description="This APB establishes the core identity of the AI Assistant."
3140
+ content={`<Role>\nYou are a {{ORGANIZATION_NAME}} AI Assistant.\n</Role>`}
3141
+ height={300}
3142
+ selectedTag="Role"
3143
+ highlightVariable="{{ORGANIZATION_NAME}}"
3144
+ />
3145
+ ```
3146
+
3147
+ ### Props
3148
+
3149
+ | Prop Name | Type | Required | Default | Description |
3150
+ |-----------|------|----------|---------|-------------|
3151
+ | `title` | `string` | ✅ | — | Title shown in header and fullscreen dialog |
3152
+ | `content` | `string` | ✅ | — | Prompt content to display in the editor |
3153
+ | `description` | `string` | ❌ | — | Description shown in fullscreen left panel |
3154
+ | `height` | `number` | ❌ | `250` | Height of mini editor in pixels |
3155
+ | `selectedTag` | `string` | ❌ | — | XML tag name to highlight and scroll to |
3156
+ | `highlightVariable` | `string` | ❌ | — | Variable string to highlight |
3157
+
3158
+ ---
3159
+
3160
+ ## PromptemonViewer
3161
+
3162
+ ### Overview
3163
+
3164
+ A full-featured interface for viewing, editing, and managing Functional Prompt Blocks (FPBs). Combines a detailed left panel showing FPB metadata with a Monaco-based right panel for viewing prompt content and extracted segments. Consumer-controlled — all API calls and state management are handled by the consumer.
3165
+
3166
+ ### Features
3167
+
3168
+ - **Full FPB metadata panel** — Title, description, categories, APBs, applicability, specifications
3169
+ - **Edit mode** — Inline editing with confirm/cancel flow
3170
+ - **Segment chips** — Shows extracted `{{variable}}` segments per APB after extraction
3171
+ - **Monaco editor** — Switches to segmentized content after extraction
3172
+ - **Extract Segments flow** — Loading overlay while extracting
3173
+ - **Save FPB** — Enabled after extraction, locks editing after save
3174
+ - **Category/Sub-category selection** — Consumer provides categories and handles creation
3175
+
3176
+ ### Usage
3177
+
3178
+ ```tsx
3179
+ import PromptemonViewer from '@e-llm-studio/citation/PromptemonViewer'
3180
+
3181
+ <PromptemonViewer
3182
+ block={myFPBBlock}
3183
+ onBlockUpdate={setBlock}
3184
+ isExtracting={isExtracting}
3185
+ isExtracted={isExtracted}
3186
+ onExtractSegments={handleExtractSegments}
3187
+ isSaving={isSaving}
3188
+ isSaved={isSaved}
3189
+ onSave={handleSave}
3190
+ onBack={() => navigate(-1)}
3191
+ categories={categories}
3192
+ subCategories={subCategories}
3193
+ selectedCategoryId={selectedCategoryId}
3194
+ selectedSubCategoryId={selectedSubCategoryId}
3195
+ onCategoryChange={(id) => setSelectedCategoryId(id)}
3196
+ onSubCategoryChange={(id) => setSelectedSubCategoryId(id)}
3197
+ />
3198
+ ```
3199
+
3200
+ ### Props
3201
+
3202
+ | Prop Name | Type | Required | Description |
3203
+ |-----------|------|----------|-------------|
3204
+ | `block` | `any` | ✅ | FPB block object |
3205
+ | `onBlockUpdate` | `(updatedBlock: any) => void` | ✅ | Called when user confirms edits |
3206
+ | `isExtracting` | `boolean` | ✅ | Shows loading overlay while true |
3207
+ | `isExtracted` | `boolean` | ✅ | Shows segment chips and enables Save when true |
3208
+ | `onExtractSegments` | `() => void` | ✅ | Called when Extract Segments is clicked |
3209
+ | `isSaving` | `boolean` | ✅ | Shows "Saving..." while true |
3210
+ | `isSaved` | `boolean` | ✅ | Shows "Saved ✓" and locks editing when true |
3211
+ | `onSave` | `() => void` | ✅ | Called when Save FPB is clicked |
3212
+ | `onBack` | `() => void` | ✅ | Called when back/close is clicked |
3213
+ | `title` | `string` | ❌ | Title shown in top bar (default: "FPB Promptemon") |
3214
+ | `categories` | `SPBCategory[]` | ✅ | List of categories |
3215
+ | `subCategories` | `SPBSubCategory[]` | ✅ | List of sub-categories |
3216
+ | `selectedCategoryId` | `string` | ✅ | Currently selected category ID |
3217
+ | `selectedSubCategoryId` | `string` | ✅ | Currently selected sub-category ID |
3218
+ | `onCategoryChange` | `(id: string) => void` | ✅ | Called when category is selected |
3219
+ | `onSubCategoryChange` | `(id: string) => void` | ✅ | Called when sub-category is selected |
3220
+ | `onAddCategory` | `(data: { name: string; description: string }) => Promise<void>` | ❌ | Called when new category is created |
3221
+ | `onAddSubCategory` | `(data: { name: string; description: string; categoryId: string }) => Promise<void>` | ❌ | Called when new sub-category is created |
3222
+ | `showEditMode` | `boolean` | ❌ | `true` | Show/hide the edit pencil icon and edit mode |
3223
+ | `showExtractSegments` | `boolean` | ❌ | `true` | Show/hide the Extract Segments button and Show Segments toggle |
3224
+
3049
3225
  ## EmailCitation
3050
3226
 
3051
3227
  A composable React UI component for rendering email-style citations with rich formatting, attachments, and highlight/quote handling. Part of the `@e-llm-studio/citation` package, this component is designed to display email content (subject, sender, recipients, body, attachments, timestamps) in an expandable, accessible, and customizable way.
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),e=require("lucide-react"),a=require("@mui/material/Dialog"),o=require("@mui/material/DialogTitle"),l=require("@mui/material/DialogContent"),r=require("@mui/material/IconButton"),s=require("dayjs"),u=require("../ScannedDocCitation/ScannedDocCitation.js"),d=require("../InstantLearningCitation/InstantLearningCitationComponent.js"),c=require("../InstantLearningCitation/SlashLoader.js"),g=require("../CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js"),v=require("../RequirementAiCitations/ImageCitation/ImageCitationContent.js"),C=require("../RequirementAiCitations/WebCitation/WebCitationWithImageContent.js"),h=require("../ChatCitation/ChatCitationRenderer.js"),T=require("../DualCitation/RuleBookCitationComponent.js"),_=require("../CitationRenderer/CitationRenderer.js"),f=require("../SplitterCitations/SplitterCitationsComponent.js"),p=require("../DualCitation/SourceBQDataCompnent.js"),I=require("./citationTypes.js");function m(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var D=m(a),S=m(o),P=m(l),x=m(r),A=m(s),j=function(i,n,t){if(!i)throw new Error("[BPACitationRenderer] ".concat(n,': missing required field "').concat(t,'" in customMetaData'))},O=function(i,n){if(!Object.values(i).some(Boolean))throw new Error("[BPACitationRenderer] ".concat(n,': missing one of "').concat(Object.keys(i).join('", "'),'" in customMetaData'))},E=function(a){var o=a.children,l=a.content,r=t.useState(!1),s=r[0],u=r[1];return n.jsxs(n.Fragment,{children:[n.jsx("span",i.__assign({style:{display:"inline-flex",alignItems:"center",cursor:"pointer",fontSize:"14px",fontWeight:400,color:"#526eff"},onClick:function(){return u(!0)}},{children:o})),n.jsxs(D.default,i.__assign({open:s,onClose:function(){return u(!1)},maxWidth:"md",fullWidth:!0},{children:[n.jsxs(S.default,i.__assign({style:{fontWeight:"bold"}},{children:["Guidelines",n.jsx(x.default,i.__assign({edge:"end",onClick:function(){return u(!1)},"aria-label":"close",style:{position:"absolute",top:5,right:16},size:"large"},{children:n.jsx(e.X,{})}))]})),n.jsx(P.default,i.__assign({style:{maxHeight:"70vh",overflow:"auto"}},{children:l}))]}))]})},b=function(a){var o,l,r,s,m,D,S,P,x,N,R,L,w,y,U,B,q,Y,k,H,G,W,z,F,M,K,Q,X=a.href,J=a.children,V=a.isStreaming,Z=a.onCitationToggle,$=a.chatCitationConfig,ii=a.scannedDocCitationConfig,ni=a.ruleBookCitationConfig,ti=a.ilCitationConfig,ei=a.gptCitationConfig,ai=a.scannedDocCitationData,oi=a.ilCitationData,li=a.chatCitationData,ri=a.gptCitationData,si=a.webCitationData,ui=a.imageCitationData,di=a.bqCitationData,ci=a.title,gi=a.citationIcon,vi=a.isDualCitationFlag,Ci=void 0!==vi&&vi,hi=t.useState(!1),Ti=hi[0],_i=hi[1];if(V)return n.jsxs("span",i.__assign({style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontWeight:500,color:"#6D28D9"}},{children:[n.jsx("span",{children:J}),n.jsx(c.default,{})]}));try{var fi=new URL(X,"http://example.com"),pi=null!==(o=fi.searchParams.get("citationNumber"))&&void 0!==o?o:fi.searchParams.get("citation_number"),Ii=null!==(l=fi.searchParams.get("decisionStrength"))&&void 0!==l?l:fi.searchParams.get("decision_strength"),mi=fi.searchParams.get("citation_type"),Di=Ci||mi===I.CITATION_TYPES.DUAL;if(!pi)return null;if(mi===I.CITATION_TYPES.SCANNED_DOC){var Si=null==ai?void 0:ai.pages;if(null==Si?void 0:Si.length)return n.jsx(u.default,i.__assign({pages:Si,subHeadingText:null==ai?void 0:ai.artifactTitle},ii));j(null==ai?void 0:ai.gsUrl,"scanned_doc_citation","gs_url");var Pi=[ai.gsUrl],xi=(null!==(r=null==ai?void 0:ai.highlightedCoordinates)&&void 0!==r?r:[]).map(function(i,n){return{pageIndex:n,bboxes:[i]}});return n.jsx(u.default,i.__assign({images:Pi,highlights:xi},ii))}if(mi===I.CITATION_TYPES.IL){j(null==oi?void 0:oi.ilLearning,"IL","il_learning");var Ai=J||(null==oi?void 0:oi.linkText)||(null==oi?void 0:oi.citationSource)||String(null!==(s=null==oi?void 0:oi.citationNumber)&&void 0!==s?s:1);return n.jsx(d.default,{ilLearning:oi.ilLearning,ilLearningHighlights:null==oi?void 0:oi.ilLearningHighlights,comparisonHighlights:null==oi?void 0:oi.comparisonHighlights,decisionStrength:Ii||(null==oi?void 0:oi.decisionStrength)||"",linkTitle:Ai,onCitationToggle:null!=Z?Z:function(){},config:ti})}if(mi===I.CITATION_TYPES.CHAT){var ji=null!=$?$:{},Oi=null===(D=null!==(m=null==li?void 0:li.chatData)&&void 0!==m?m:[])||void 0===D?void 0:D.map(function(n){return i.__assign(i.__assign({},n),{timeStamp:A.default(n.timeStamp)})}),Ei=!!(null==li?void 0:li.ruleBookContent);return n.jsx(h.default,{showRootContainer:null===(S=ji.showRootContainer)||void 0===S||S,reversePanels:ji.reversePanels,isRenderedCustomComponent:ji.isRenderedCustomComponent,modalContainerStyle:ji.modalContainerStyle,additionalData:ji.additionalData,closePreview:ji.closePreview,selectedIdFromReason:null!==(P=ji.selectedIdFromReason)&&void 0!==P?P:void 0,rootContainer:i.__assign(i.__assign({},ji.rootContainer),{relevanceScore:null==li?void 0:li.relevanceScore}),chatContainer:i.__assign(i.__assign({},ji.chatContainer),{chatData:Oi,summarizedTab:i.__assign(i.__assign({},null===(x=ji.chatContainer)||void 0===x?void 0:x.summarizedTab),{chip:i.__assign({isActive:!0,show:!0},null===(R=null===(N=ji.chatContainer)||void 0===N?void 0:N.summarizedTab)||void 0===R?void 0:R.chip)}),detailedTab:i.__assign(i.__assign({},null===(L=ji.chatContainer)||void 0===L?void 0:L.detailedTab),{chip:i.__assign({isActive:!1},null===(y=null===(w=ji.chatContainer)||void 0===w?void 0:w.detailedTab)||void 0===y?void 0:y.chip)})}),ruleBookContainer:Ei?i.__assign(i.__assign({},ji.ruleBookContainer),{data:{content:li.ruleBookContent,highlighted_texts:null!==(U=null==li?void 0:li.ruleBookHighlights)&&void 0!==U?U:[]}}):void 0})}if(mi===I.CITATION_TYPES.GPT){var bi=null==ri?void 0:ri.value,Ni=null!==(B=null==bi?void 0:bi.text)&&void 0!==B?B:null===(q=null==ri?void 0:ri.dataSources)||void 0===q?void 0:q[0],Ri=null!==(Y=null==bi?void 0:bi.label)&&void 0!==Y?Y:null===(k=null==ri?void 0:ri.trainingDataTitle)||void 0===k?void 0:k[0],Li=null!==(H=null==bi?void 0:bi.paraphrase)&&void 0!==H?H:null===(G=null==ri?void 0:ri.paraphrase)||void 0===G?void 0:G[0];O({data_sources:Ni,training_data_title:Ri},I.CITATION_TYPES.GPT);var wi={text:"",dataSource:Ni,trainingDataTitle:Ri,paraphrase:Li},yi=null!==(W=null==ei?void 0:ei.iconsConfig)&&void 0!==W?W:{ChevronDownIcon:e.ChevronDown,ChevronUpIcon:e.ChevronUp,MaximizeIcon:e.Maximize2,CloseIcon:e.X};return n.jsx(g.default,{item:wi,headerTitle:null!==(z=null==ei?void 0:ei.headerTitle)&&void 0!==z?z:"GPT - Gemini 3.5 Flash",iconsConfig:yi,previewCallback:null==ei?void 0:ei.previewCallback,DocumentTitle:null==ei?void 0:ei.DocumentTitle,disableMaximize:Di})}if(mi===I.CITATION_TYPES.WEB){!function(i,n,t){j(i,n,t);try{new URL(i)}catch(e){throw new Error("[BPACitationRenderer] ".concat(n,': "').concat(t,'" is not a valid URL: "').concat(i,'"'))}}(null==si?void 0:si.link,I.CITATION_TYPES.WEB,"link");var Ui=si.link,Bi=J||(null==si?void 0:si.citationSource)||Ui;return(null==si?void 0:si.screenshotUrl)?n.jsx(C.default,{url:Ui,label:Bi,gsUtilPath:null==si?void 0:si.gsUtilPath,signedUrl:si.screenshotUrl,relevanceScore:null==si?void 0:si.relevanceScore,visitIcon:e.ExternalLink,PreviewDialogCloseIcon:e.X}):n.jsx("a",i.__assign({href:Ui,target:"_blank",rel:"noreferrer"},{children:Bi}))}if(mi===I.CITATION_TYPES.IMAGE)return O({gs_util_path:null==ui?void 0:ui.gsUtilPath,signed_url:null==ui?void 0:ui.signedUrl},I.CITATION_TYPES.IMAGE),n.jsx(v.default,{citationTitle:J||(null==ui?void 0:ui.citationSource),gsUtilPath:null==ui?void 0:ui.gsUtilPath,signedUrl:null==ui?void 0:ui.signedUrl,relevanceScore:null==ui?void 0:ui.relevanceScore});if(mi===I.CITATION_TYPES.BQ_DATA)return O({href_params:null==di?void 0:di.hrefParams,source_obj:null==di?void 0:di.sourceObj},I.CITATION_TYPES.BQ_DATA),n.jsx(p.SourcesBQCitation,i.__assign({hrefParams:di.hrefParams,sourceObj:di.sourceObj,showChevron:!1,defaultOpen:!0},{children:J||""}));if(mi===I.CITATION_TYPES.RULEBOOK||mi===I.CITATION_TYPES.RULEBOOK_CHUNK){var qi=pi?parseInt(pi,10):0,Yi=n.jsx(T.default,{url:null!==(F=null==ni?void 0:ni.url)&&void 0!==F?F:"",data:{citationNumber:null!==(K=null===(M=null==ni?void 0:ni.data)||void 0===M?void 0:M.citationNumber)&&void 0!==K?K:qi,fileDetails:null===(Q=null==ni?void 0:ni.data)||void 0===Q?void 0:Q.fileDetails},msg:null==ni?void 0:ni.msg,citationIndex:null==ni?void 0:ni.citationIndex,guidelines:null==ni?void 0:ni.guidelines,additionalClassNames:null==ni?void 0:ni.additionalClassNames,headerTitle:null==ni?void 0:ni.headerTitle,InternalGptReasoningData:null==ni?void 0:ni.InternalGptReasoningData,isDataProvided:null==ni?void 0:ni.isDataProvided,textualContent:null==ni?void 0:ni.textualContent,phraseToHighlight:null==ni?void 0:ni.phraseToHighlight,IgptHeaderTitle:null==ni?void 0:ni.IgptHeaderTitle,isInternalGptReasoningLoading:null==ni?void 0:ni.isInternalGptReasoningLoading,onAccordionToggle:null==ni?void 0:ni.onAccordionToggle});return Ci?Yi:n.jsx(E,i.__assign({content:Yi},{children:J}))}if(mi===I.CITATION_TYPES.IL_RULEBOOK){var ki=n.jsx(T.default,{headerTitle:null==ni?void 0:ni.headerTitle,InternalGptReasoningData:null==ni?void 0:ni.InternalGptReasoningData,isDataProvided:null==ni?void 0:ni.isDataProvided,textualContent:null==ni?void 0:ni.textualContent,phraseToHighlight:null==ni?void 0:ni.phraseToHighlight,IgptHeaderTitle:null==ni?void 0:ni.IgptHeaderTitle,onAccordionToggle:null==ni?void 0:ni.onAccordionToggle,isInternalGptReasoningLoading:null==ni?void 0:ni.isInternalGptReasoningLoading});return Ci?ki:n.jsx(E,i.__assign({content:ki},{children:J}))}if(mi===I.CITATION_TYPES.DUAL){var Hi=fi.searchParams.get("left_citation_type"),Gi=fi.searchParams.get("right_citation_type");if(Hi===I.CITATION_TYPES.DUAL||Gi===I.CITATION_TYPES.DUAL)return console.error("left or right citation type cant be dual_citation"),null;var Wi=function(i,n){var t="".concat(i,"."),e="left"===i?"right.":"left.",a=new URLSearchParams;return fi.searchParams.forEach(function(i,n){"citation_type"!==n&&"left_citation_type"!==n&&"right_citation_type"!==n&&(n.startsWith(t)||n.startsWith(e)||a.set(n,i))}),fi.searchParams.forEach(function(i,n){n.startsWith(t)&&a.set(n.slice(t.length),i)}),n&&a.set("citation_type",n),"?".concat(a.toString())},zi=Wi("left",Hi),Fi=Wi("right",Gi),Mi=J||ci||"Source and Guidelines",Ki=function(i){switch(i){case I.CITATION_TYPES.SCANNED_DOC:return{scannedDocCitationData:ai,scannedDocCitationConfig:ii};case I.CITATION_TYPES.IL:return{ilCitationData:oi,ilCitationConfig:ti};case I.CITATION_TYPES.CHAT:return{chatCitationData:li,chatCitationConfig:$};case I.CITATION_TYPES.GPT:return{gptCitationData:ri,gptCitationConfig:ei};case I.CITATION_TYPES.WEB:return{webCitationData:si};case I.CITATION_TYPES.IMAGE:return{imageCitationData:ui};case I.CITATION_TYPES.BQ_DATA:return{bqCitationData:di};case I.CITATION_TYPES.RULEBOOK:return{ruleBookCitationConfig:ni};default:return{}}};return n.jsx(_.default,{inLineCitation:!0,citationTitle:Mi,citationIcon:gi,isOpen:Ti,onToggle:function(){return _i(function(i){return!i})},styles:{pillButton:{fontSize:"14px",margin:"0px",padding:"0px",color:"#526eff",cursor:"pointer",verticalAlign:"middle",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",background:"white",border:"none"},citationContent:{width:"100%",background:"transparent",minHeight:"10px",height:"fit-content"}},citationComponent:n.jsx(f.default,{left:n.jsx(b,i.__assign({href:zi,onCitationToggle:Z},Ki(Hi),{isDualCitationFlag:!0})),right:n.jsx(b,i.__assign({href:Fi,onCitationToggle:Z,isDualCitationFlag:!0},Ki(Gi))),header:{title:Mi,showDocIcon:!1},openInFullscreen:!0,fullscreenOnly:!0,onFullscreenClose:function(){return _i(!1)}})})}console.warn('[BPACitationRenderer] unhandled citation_type: "'.concat(mi,'"'))}catch(i){return console.error(i),null}return null};exports.default=b;
2
+ //# sourceMappingURL=BPACitationRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BPACitationRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.CITATION_TYPES={SCANNED_DOC:"scanned_doc_citation",IL:"IL",CHAT:"chat_citation",GPT:"gpt_citation",WEB:"web_citation",IMAGE:"image_citation",BQ_DATA:"bq_data",RULEBOOK:"rulebook_citation",RULEBOOK_CHUNK:"rulebook_chunk",IL_RULEBOOK:"il_rulebook_citation",DUAL:"dual_citation"};
2
+ //# sourceMappingURL=citationTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"citationTypes.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("lucide-react"),t=require("react"),o=require("./ResizableSplitPane.js"),l=require("../PdfViewer/PdfViewer.js"),a=require("../../assests/svg/PdfViewerIcons.js"),r=require("react-markdown"),u=require("rehype-raw"),d=require("@mui/material"),s=require("./CognitiveCompareConfig.js");require("react-dom");var c=require("./CompareContext.js"),v=require("./Guidelines/utils/processGuidelinesMarkdown.js"),p=require("../GptWebCitation/GptWebCitation.js"),g=require("../GptWebCitation/types.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./MoreFunctionsPopup.js"),require("./components/SubSectionAccordion.js"),require("./components/LHSSectionRow.js"),require("./components/RHSSectionRow.js");var x=h(r),m=h(u),f=function(e){var i,n,t;return(null===(t=null===(n=null===(i=(null==e?void 0:e.extraMetaData)||e)||void 0===i?void 0:i.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)||void 0===t?void 0:t[0])||null},_="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",b="sai.siddhartha@techolution.com",y="672e32f7a0e8fe2e8e50bcba",w="TNV Sai Siddhartha",C="90vh",j="calc(".concat(C," - 120px)"),D=function(){var e;return"function"==typeof(null===(e=globalThis.crypto)||void 0===e?void 0:e.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var i=Math.floor(16*Math.random());return("x"===e?i:i%4+8).toString(16)})},F=function(e,i){var n=function(e){var i;return(null==e?void 0:e.payloadCitationId)||(null===(i=null==e?void 0:e.extraMetaData)||void 0===i?void 0:i.payloadCitationId)||""}(e)||i||D();return function(e,i){e&&"object"==typeof e&&(e.payloadCitationId=i,e.extraMetaData&&"object"==typeof e.extraMetaData&&(e.extraMetaData.payloadCitationId=i))}(e,n),n},S=function(o){var l,a=o.metaData,r=o.isFullscreen,u=void 0!==r&&r,d=c.useCompareContext().gptWebCitationConfig,s=t.useMemo(function(){return function(e){return{endpoint:(null==e?void 0:e.endpoint)||_,userEmail:(null==e?void 0:e.userEmail)||b,userId:(null==e?void 0:e.userId)||y,userName:(null==e?void 0:e.userName)||w,headers:null==e?void 0:e.headers}}(d)},[d]),v=null==a?void 0:a.webGpt,h=t.useRef(null);h.current||(h.current=D());var x=t.useMemo(function(){return function(e,i,n){var t,o,l=f(e),a=(null==l?void 0:l.customMetaData)||{},r=(null==a?void 0:a.value)||{},u=(null==e?void 0:e.webSearchAnswer)||{},d=(null==e?void 0:e.extraMetaData)||e||{};return{userEmail:(null==e?void 0:e.userEmail)||(null==u?void 0:u.userEmail)||(null==i?void 0:i.userEmail)||"",userId:(null==e?void 0:e.userId)||(null==u?void 0:u.userId)||(null==i?void 0:i.userId)||"",userName:(null==e?void 0:e.userName)||(null==u?void 0:u.userName)||(null==i?void 0:i.userName)||"",citationId:F(e,n),citationUrl:(null==r?void 0:r.citationUrl)||(null==u?void 0:u.citationUrl)||"",content:(null==d?void 0:d.Reasoning)||(null==u?void 0:u.enhanced_content)||"",citationType:(null==r?void 0:r.citationType)||"web",citatioNumber:null!==(o=null!==(t=null==a?void 0:a.citation_number)&&void 0!==t?t:null==l?void 0:l.citation_number)&&void 0!==o?o:Number((null==e?void 0:e.reasoningId)||0)}}(v,s,h.current||void 0)},[v,s]),m=t.useMemo(function(){return f(v)},[v]),C=(null===(l=null==m?void 0:m.customMetaData)||void 0===l?void 0:l.value)||{},S=(null==v?void 0:v.extraMetaData)||v||{},P=t.useState(),M=P[0],T=P[1],k=t.useState("pending"),I=k[0],R=k[1],G=t.useState(!0),N=G[0],E=G[1];t.useEffect(function(){var i=!0;return e.__awaiter(void 0,void 0,void 0,function(){var n,t,o,l;return e.__generator(this,function(a){switch(a.label){case 0:if(!s.endpoint||!(null==x?void 0:x.citationUrl)||!(null==x?void 0:x.content))return R("error"),[2];R("pending"),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(s.endpoint,{method:"POST",headers:e.__assign({"actor-id":x.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},s.headers||{}),body:JSON.stringify(x)})];case 2:if(!(n=a.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return t=a.sent(),o=(null==t?void 0:t.responseData)||(null==t?void 0:t.result)||(null==t?void 0:t.data)||t,i?(T(o),R("success"),[3,5]):[2];case 4:return l=a.sent(),i?(console.error("Failed to load GPT web citation",l),R("error"),[3,5]):[2];case 5:return[2]}})}),function(){i=!1}},[x,s]);var q=t.useMemo(function(){return{item:{confidence_score:Number((null==S?void 0:S.Confidence_score)||0),text:(null==C?void 0:C.paraphrase)||"Web citation reasoning",dataSource:(null==C?void 0:C.text)||(null==S?void 0:S.Reasoning)||"",paraphrase:(null==C?void 0:C.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==x?void 0:x.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:n.ChevronDown,ChevronUpIcon:n.ChevronUp,MaximizeIcon:n.Maximize2,CloseIcon:n.X}}},[C,null==x?void 0:x.citatioNumber,S]),A=t.useMemo(function(){return e.__assign(e.__assign({},q),u?{bodyHeight:j}:{})},[q,u]);return i.jsx(p.default,{gptCitation:A,defaultCitationUrl:(null==x?void 0:x.citationUrl)||"",citationType:g.CitationType.GPT_WEB,webCitationData:M,webCitationStatus:I,showWebCitation:N,onToggleCitationView:function(){return E(function(e){return!e})},iconsConfig:{MaximizeIcon:n.Maximize2,ExternalLinkIcon:n.ExternalLink},isFixedHeight:!0})},P=function(n){var a,r,u,p,g,h,f,_=n.href,b=n.metaData,y=n.citationTitle,w=n.citationType,C=n.citationReason,j=n.isFullscreen,D=c.useCompareContext().guidelinesData,F=function(e){try{var i=new URL(e,window.location.origin);return{citationNumber:i.searchParams.get("citationNumber"),phraseToHighlight:i.searchParams.get("phrase_to_highlight")}}catch(e){return{citationNumber:null,phraseToHighlight:null}}}(_),P=F.citationNumber,M=F.phraseToHighlight,T=P&&(null===(a=null==b?void 0:b.citations)||void 0===a?void 0:a[P])||{},k=(null===(r=null==b?void 0:b.docData)||void 0===r?void 0:r.documents)||{},I=(null===(u=null==b?void 0:b.docData)||void 0===u?void 0:u.input_index_map)||{},R=Object.keys((null==b?void 0:b.citations)||{}).length>0||Object.keys((null==b?void 0:b.docData)||{}).length>0,G=null==I?void 0:I[0],N=null==I?void 0:I[1],E=G?k[G]:null,q=N?k[N]:null,A=G?T[G]:null,U=N?T[N]:null,W=t.useMemo(function(){var e,n,t,o;return A&&E?i.jsx(l.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==E?void 0:E.title,pdfUrl:null==E?void 0:E.signed_url,highlightText:[null!==(e=null==A?void 0:A.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(n=null==A?void 0:A.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==A?void 0:A.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==A?void 0:A.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==E?void 0:E.title,null==E?void 0:E.signed_url,null==A?void 0:A.highlighted_text,null===(p=null==A?void 0:A.custom_metadata)||void 0===p?void 0:p.pdf_start_page_number,null===(g=null==A?void 0:A.custom_metadata)||void 0===g?void 0:g.pdf_end_page_number]),z=t.useMemo(function(){var e,n,t,o;return U&&q?i.jsx(l.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==q?void 0:q.title,pdfUrl:null==q?void 0:q.signed_url,jumpToPageValue:1,highlightText:[null!==(e=null==U?void 0:U.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(n=null==U?void 0:U.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==U?void 0:U.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==U?void 0:U.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==q?void 0:q.title,null==q?void 0:q.signed_url,null==U?void 0:U.highlighted_text,null===(h=null==U?void 0:U.custom_metadata)||void 0===h?void 0:h.pdf_start_page_number,null===(f=null==U?void 0:U.custom_metadata)||void 0===f?void 0:f.pdf_end_page_number]),H="dual_citation"===w,O=H&&!!(null==b?void 0:b.webGpt),B=t.useMemo(function(){if(!W)return null;var n=O?i.jsx(S,{metaData:b,isFullscreen:j}):"rulebook_citation"===w?i.jsx(i.Fragment,{children:i.jsx(d.Box,e.__assign({sx:e.__assign(e.__assign({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},s.SHARED_MARKDOWN_STYLES),{overflow:"auto"})},{children:i.jsx(x.default,e.__assign({rehypePlugins:[m.default]},{children:v.processGuidelinesMarkdown({guidelinesData:D,targetHighlights:[M],labelColor:"#FEF08A"})}))}))}):z;return n?i.jsx(o.default,{leftComponent:W,rightComponent:n,isFullscreen:j}):W},[W,z,w,O,b,j]);return(null==b?void 0:b.webGpt)&&!R?i.jsx(S,{metaData:b,isFullscreen:j}):P?"rulebook_citation"===w?A?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:B})):i.jsx("div",e.__assign({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:C||"Rulebook citation selected."})):H?A||U?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:B})):(null==b?void 0:b.webGpt)?i.jsx(S,{metaData:b,isFullscreen:j}):i.jsx("div",{children:"Missing PDF Citation. Please try again later"}):["contract","clause"].includes(y)?A||U?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:B})):i.jsx("div",{children:"Missing PDF Citation. Please try again later"}):i.jsx("div",{children:"No Citation Found. Please try again later"}):null};exports.default=function(o){var l,r,u,s,c,v,p,g=o.href,h=o.children,x=o.citationType,m=o.citationReason,f=o.metaData,_=o.chevronUpComponent,b=void 0===_?null:_,y=o.chevronDownComponent,w=void 0===y?null:y,j=o.customStyle,D=void 0===j?{}:j,F=o.defaultState,S=void 0!==F&&F,M=t.useState(S),T=M[0],k=M[1],I=t.useState(!1),R=I[0],G=I[1],N="string"==typeof h&&(null===(l=null==h?void 0:h.split("\n"))||void 0===l?void 0:l.length)>1?h.split("\n").join(" "):h,E="string"==typeof h?h:h[0],q=null!=b?b:function(e){var t,o;return i.jsx(n.ChevronUp,{size:null!==(t=null==e?void 0:e.fontSize)&&void 0!==t?t:16,color:null!==(o=null==e?void 0:e.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(r=null==D?void 0:D.arrow)&&void 0!==r?r:{}),A=null!=w?w:function(e){var t,o;return i.jsx(n.ChevronDown,{size:null!==(t=null==e?void 0:e.fontSize)&&void 0!==t?t:16,color:null!==(o=null==e?void 0:e.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(u=null==D?void 0:D.arrow)&&void 0!==u?u:{}),U=i.jsxs("div",e.__assign({style:{boxSizing:"border-box",border:R?"none":"1px solid #E4E7EC",borderRadius:R?0:"8px",overflow:"hidden",marginTop:R?0:"8px",display:"flex",flexDirection:"column",width:"100%",height:R?"100%":void 0,backgroundColor:"#FAFAFA"}},{children:[i.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:i.jsx("button",e.__assign({onClick:function(){G(function(e){return!e})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:R?i.jsx(a.DefaultFullScreenCloseIcon,{}):i.jsx(a.DefaultFullScreenIcon,{})}))})),i.jsx("div",e.__assign({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:i.jsx(P,{href:g,children:h,metaData:f,citationTitle:E,citationType:x,citationReason:m,isFullscreen:R})}))]}));return i.jsxs("span",e.__assign({style:e.__assign({display:"inline"},D.relativeWrapper||{})},{children:[i.jsx("div",e.__assign({style:e.__assign({display:"inline",marginTop:0},D.citationButtonWrapper||{})},{children:i.jsxs("button",e.__assign({type:"button",onClick:function(){return k(function(e){return!e})},style:e.__assign({display:(null==f?void 0:f.webGpt)?"inline":"inline-flex",alignItems:(null==f?void 0:f.webGpt)?void 0:"center",gap:(null==f?void 0:f.webGpt)?void 0:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==f?void 0:f.webGpt)?600:700,color:(null==f?void 0:f.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},D.citationButton||{})},{children:[(null==f?void 0:f.webGpt)&&i.jsx(n.Globe,{size:null!==(c=null===(s=D.arrow)||void 0===s?void 0:s.fontSize)&&void 0!==c?c:"1em",color:null!==(p=null===(v=D.arrow)||void 0===v?void 0:v.color)&&void 0!==p?p:"#6D28D9",style:{display:"inline-block",width:"1em",height:"1em",marginRight:"3px",verticalAlign:"-0.125em",flexShrink:0}}),i.jsx("span",{children:N}),i.jsx("span",e.__assign({style:{display:"inline-flex",alignItems:"center",marginLeft:(null==f?void 0:f.webGpt)?"3px":void 0,verticalAlign:(null==f?void 0:f.webGpt)?"-0.125em":void 0}},{children:T?q:A}))]}))})),T&&(R?i.jsx(d.Dialog,e.__assign({open:R,onClose:function(){return G(!1)},maxWidth:!1,BackdropProps:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"}},PaperProps:{sx:{backgroundColor:"#FAFAFA",borderRadius:"16px",height:C,m:0,maxHeight:C,maxWidth:"95vw",overflow:"hidden",width:"95vw"}}},{children:U})):U)]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("lucide-react"),t=require("react"),o=require("./ResizableSplitPane.js"),l=require("../PdfViewer/PdfViewer.js"),a=require("../../assests/svg/PdfViewerIcons.js"),r=require("react-markdown"),u=require("rehype-raw"),d=require("@mui/material"),s=require("./CognitiveCompareConfig.js");require("react-dom");var c=require("./CompareContext.js"),v=require("./Guidelines/utils/processGuidelinesMarkdown.js"),p=require("../GptWebCitation/GptWebCitation.js"),g=require("../GptWebCitation/types.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./MoreFunctionsPopup.js"),require("./components/SubSectionAccordion.js"),require("./components/LHSSectionRow.js"),require("./components/RHSSectionRow.js");var x=h(r),m=h(u),f=function(e){var i,n,t;return(null===(t=null===(n=null===(i=(null==e?void 0:e.extraMetaData)||e)||void 0===i?void 0:i.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)||void 0===t?void 0:t[0])||null},_="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",b="sai.siddhartha@techolution.com",y="672e32f7a0e8fe2e8e50bcba",C="TNV Sai Siddhartha",w="90vh",j="calc(".concat(w," - 120px)"),D=function(){var e;return"function"==typeof(null===(e=globalThis.crypto)||void 0===e?void 0:e.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var i=Math.floor(16*Math.random());return("x"===e?i:i%4+8).toString(16)})},F=function(e,i){var n=function(e){var i;return(null==e?void 0:e.payloadCitationId)||(null===(i=null==e?void 0:e.extraMetaData)||void 0===i?void 0:i.payloadCitationId)||""}(e)||i||D();return function(e,i){e&&"object"==typeof e&&(e.payloadCitationId=i,e.extraMetaData&&"object"==typeof e.extraMetaData&&(e.extraMetaData.payloadCitationId=i))}(e,n),n},S=function(o){var l,a=o.metaData,r=o.isFullscreen,u=void 0!==r&&r,d=c.useCompareContext().gptWebCitationConfig,s=t.useMemo(function(){return function(e){return{endpoint:(null==e?void 0:e.endpoint)||_,userEmail:(null==e?void 0:e.userEmail)||b,userId:(null==e?void 0:e.userId)||y,userName:(null==e?void 0:e.userName)||C,headers:null==e?void 0:e.headers}}(d)},[d]),v=null==a?void 0:a.webGpt,h=t.useRef(null);h.current||(h.current=D());var x=t.useMemo(function(){return function(e,i,n){var t,o,l=f(e),a=(null==l?void 0:l.customMetaData)||{},r=(null==a?void 0:a.value)||{},u=(null==e?void 0:e.webSearchAnswer)||{},d=(null==e?void 0:e.extraMetaData)||e||{};return{userEmail:(null==e?void 0:e.userEmail)||(null==u?void 0:u.userEmail)||(null==i?void 0:i.userEmail)||"",userId:(null==e?void 0:e.userId)||(null==u?void 0:u.userId)||(null==i?void 0:i.userId)||"",userName:(null==e?void 0:e.userName)||(null==u?void 0:u.userName)||(null==i?void 0:i.userName)||"",citationId:F(e,n),citationUrl:(null==r?void 0:r.citationUrl)||(null==u?void 0:u.citationUrl)||"",content:(null==d?void 0:d.Reasoning)||(null==u?void 0:u.enhanced_content)||"",citationType:(null==r?void 0:r.citationType)||"web",citatioNumber:null!==(o=null!==(t=null==a?void 0:a.citation_number)&&void 0!==t?t:null==l?void 0:l.citation_number)&&void 0!==o?o:Number((null==e?void 0:e.reasoningId)||0)}}(v,s,h.current||void 0)},[v,s]),m=t.useMemo(function(){return f(v)},[v]),w=(null===(l=null==m?void 0:m.customMetaData)||void 0===l?void 0:l.value)||{},S=(null==v?void 0:v.extraMetaData)||v||{},P=t.useState(),M=P[0],T=P[1],k=t.useState("pending"),I=k[0],R=k[1],G=t.useState(!0),E=G[0],N=G[1];t.useEffect(function(){var i=!0;return e.__awaiter(void 0,void 0,void 0,function(){var n,t,o,l;return e.__generator(this,function(a){switch(a.label){case 0:if(!s.endpoint||!(null==x?void 0:x.citationUrl)||!(null==x?void 0:x.content))return R("error"),[2];R("pending"),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(s.endpoint,{method:"POST",headers:e.__assign({"actor-id":x.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},s.headers||{}),body:JSON.stringify(x)})];case 2:if(!(n=a.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return t=a.sent(),o=(null==t?void 0:t.responseData)||(null==t?void 0:t.result)||(null==t?void 0:t.data)||t,i?(T(o),R("success"),[3,5]):[2];case 4:return l=a.sent(),i?(console.error("Failed to load GPT web citation",l),R("error"),[3,5]):[2];case 5:return[2]}})}),function(){i=!1}},[x,s]);var q=t.useMemo(function(){return{item:{confidence_score:Number((null==S?void 0:S.Confidence_score)||0),text:(null==w?void 0:w.paraphrase)||"Web citation reasoning",dataSource:(null==w?void 0:w.text)||(null==S?void 0:S.Reasoning)||"",paraphrase:(null==w?void 0:w.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==x?void 0:x.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:n.ChevronDown,ChevronUpIcon:n.ChevronUp,MaximizeIcon:n.Maximize2,CloseIcon:n.X}}},[w,null==x?void 0:x.citatioNumber,S]),A=t.useMemo(function(){return e.__assign(e.__assign({},q),u?{bodyHeight:j}:{})},[q,u]);return i.jsx(p.default,{gptCitation:A,defaultCitationUrl:(null==x?void 0:x.citationUrl)||"",citationType:g.CitationType.GPT_WEB,webCitationData:M,webCitationStatus:I,showWebCitation:E,onToggleCitationView:function(){return N(function(e){return!e})},iconsConfig:{MaximizeIcon:n.Maximize2,ExternalLinkIcon:n.ExternalLink},isFixedHeight:!0})},P=function(n){var a,r,u,p,g,h,f,_=n.href,b=n.metaData,y=n.citationTitle,C=n.citationType,w=n.citationReason,j=n.isFullscreen,D=c.useCompareContext().guidelinesData,F=function(e){try{var i=new URL(e,window.location.origin);return{citationNumber:i.searchParams.get("citationNumber"),phraseToHighlight:i.searchParams.get("phrase_to_highlight")}}catch(e){return{citationNumber:null,phraseToHighlight:null}}}(_),P=F.citationNumber,M=F.phraseToHighlight,T=P&&(null===(a=null==b?void 0:b.citations)||void 0===a?void 0:a[P])||{},k=(null===(r=null==b?void 0:b.docData)||void 0===r?void 0:r.documents)||{},I=(null===(u=null==b?void 0:b.docData)||void 0===u?void 0:u.input_index_map)||{},R=Object.keys((null==b?void 0:b.citations)||{}).length>0||Object.keys((null==b?void 0:b.docData)||{}).length>0,G=null==I?void 0:I[0],E=null==I?void 0:I[1],N=G?k[G]:null,q=E?k[E]:null,A=G?T[G]:null,U=E?T[E]:null,W=t.useMemo(function(){var e,n,t,o;return A&&N?i.jsx(l.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==N?void 0:N.title,pdfUrl:null==N?void 0:N.signed_url,highlightText:[null!==(e=null==A?void 0:A.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(n=null==A?void 0:A.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==A?void 0:A.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==A?void 0:A.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==N?void 0:N.title,null==N?void 0:N.signed_url,null==A?void 0:A.highlighted_text,null===(p=null==A?void 0:A.custom_metadata)||void 0===p?void 0:p.pdf_start_page_number,null===(g=null==A?void 0:A.custom_metadata)||void 0===g?void 0:g.pdf_end_page_number]),z=t.useMemo(function(){var e,n,t,o;return U&&q?i.jsx(l.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==q?void 0:q.title,pdfUrl:null==q?void 0:q.signed_url,jumpToPageValue:1,highlightText:[null!==(e=null==U?void 0:U.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(n=null==U?void 0:U.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==U?void 0:U.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==U?void 0:U.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==q?void 0:q.title,null==q?void 0:q.signed_url,null==U?void 0:U.highlighted_text,null===(h=null==U?void 0:U.custom_metadata)||void 0===h?void 0:h.pdf_start_page_number,null===(f=null==U?void 0:U.custom_metadata)||void 0===f?void 0:f.pdf_end_page_number]),H="dual_citation"===C,O=H&&!!(null==b?void 0:b.webGpt),B=t.useMemo(function(){if(!W)return null;var n=O?i.jsx(S,{metaData:b,isFullscreen:j}):"rulebook_citation"===C?i.jsx(i.Fragment,{children:i.jsx(d.Box,e.__assign({sx:e.__assign(e.__assign({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},s.SHARED_MARKDOWN_STYLES),{overflow:"auto"})},{children:i.jsx(x.default,e.__assign({rehypePlugins:[m.default]},{children:v.processGuidelinesMarkdown({guidelinesData:D,targetHighlights:[M],labelColor:"#FEF08A"})}))}))}):z;return n?i.jsx(o.default,{leftComponent:W,rightComponent:n,isFullscreen:j}):W},[W,z,C,O,b,j]);return(null==b?void 0:b.webGpt)&&!R?i.jsx(S,{metaData:b,isFullscreen:j}):P?"rulebook_citation"===C?A?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:B})):i.jsx("div",e.__assign({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:w||"Rulebook citation selected."})):H?A||U?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:B})):(null==b?void 0:b.webGpt)?i.jsx(S,{metaData:b,isFullscreen:j}):i.jsx("div",{children:"Missing PDF Citation. Please try again later"}):["contract","clause"].includes(y)?A||U?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:B})):i.jsx("div",{children:"Missing PDF Citation. Please try again later"}):i.jsx("div",{children:"No Citation Found. Please try again later"}):null};exports.default=function(o){var l,r,u,s,c,v,p,g=o.href,h=o.children,x=o.citationType,m=o.citationReason,f=o.metaData,_=o.chevronUpComponent,b=void 0===_?null:_,y=o.chevronDownComponent,C=void 0===y?null:y,j=o.customStyle,D=void 0===j?{}:j,F=o.defaultState,S=void 0!==F&&F,M=o.onFullscreenChange,T=t.useState(S),k=T[0],I=T[1],R=t.useState(!1),G=R[0],E=R[1],N="string"==typeof h&&(null===(l=null==h?void 0:h.split("\n"))||void 0===l?void 0:l.length)>1?h.split("\n").join(" "):h;t.useEffect(function(){if(null==M||M(G),G)return function(){null==M||M(!1)}},[G,M]);var q="string"==typeof h?h:h[0],A=null!=b?b:function(e){var t,o;return i.jsx(n.ChevronUp,{size:null!==(t=null==e?void 0:e.fontSize)&&void 0!==t?t:16,color:null!==(o=null==e?void 0:e.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(r=null==D?void 0:D.arrow)&&void 0!==r?r:{}),U=null!=C?C:function(e){var t,o;return i.jsx(n.ChevronDown,{size:null!==(t=null==e?void 0:e.fontSize)&&void 0!==t?t:16,color:null!==(o=null==e?void 0:e.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(u=null==D?void 0:D.arrow)&&void 0!==u?u:{}),W=i.jsxs("div",e.__assign({style:{boxSizing:"border-box",border:G?"none":"1px solid #E4E7EC",borderRadius:G?0:"8px",overflow:"hidden",marginTop:G?0:"8px",display:"flex",flexDirection:"column",width:"100%",height:G?"100%":void 0,backgroundColor:"#FAFAFA"}},{children:[i.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:i.jsx("button",e.__assign({onClick:function(){E(function(e){return!e})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:G?i.jsx(a.DefaultFullScreenCloseIcon,{}):i.jsx(a.DefaultFullScreenIcon,{})}))})),i.jsx("div",e.__assign({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:i.jsx(P,{href:g,children:h,metaData:f,citationTitle:q,citationType:x,citationReason:m,isFullscreen:G})}))]}));return i.jsxs("span",e.__assign({style:e.__assign({display:"inline"},D.relativeWrapper||{})},{children:[i.jsx("div",e.__assign({style:e.__assign({display:"inline",marginTop:0},D.citationButtonWrapper||{})},{children:i.jsxs("button",e.__assign({type:"button",onClick:function(){return I(function(e){return!e})},style:e.__assign({display:(null==f?void 0:f.webGpt)?"inline":"inline-flex",alignItems:(null==f?void 0:f.webGpt)?void 0:"center",gap:(null==f?void 0:f.webGpt)?void 0:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==f?void 0:f.webGpt)?600:700,color:(null==f?void 0:f.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},D.citationButton||{})},{children:[(null==f?void 0:f.webGpt)&&i.jsx(n.Globe,{size:null!==(c=null===(s=D.arrow)||void 0===s?void 0:s.fontSize)&&void 0!==c?c:"1em",color:null!==(p=null===(v=D.arrow)||void 0===v?void 0:v.color)&&void 0!==p?p:"#6D28D9",style:{display:"inline-block",width:"1em",height:"1em",marginRight:"3px",verticalAlign:"-0.125em",flexShrink:0}}),i.jsx("span",{children:N}),i.jsx("span",e.__assign({style:{display:"inline-flex",alignItems:"center",marginLeft:(null==f?void 0:f.webGpt)?"3px":void 0,verticalAlign:(null==f?void 0:f.webGpt)?"-0.125em":void 0}},{children:k?A:U}))]}))})),k&&(G?i.jsx(d.Dialog,e.__assign({open:G,onClose:function(){return E(!1)},maxWidth:!1,BackdropProps:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"}},PaperProps:{sx:{backgroundColor:"#FAFAFA",borderRadius:"16px",height:w,m:0,maxHeight:w,maxWidth:"95vw",overflow:"hidden",width:"95vw"}}},{children:W})):W)]}))};
2
2
  //# sourceMappingURL=CitationAnchor.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material"),t=require("react-markdown"),o=require("rehype-raw"),a=require("./CitationAnchor.js"),s=require("./Guidelines/utils/helper.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(t),c=u(o),d=function(e){return e?"./dual-citation?citationNumber=".concat(encodeURIComponent(e)):""};exports.default=function(t){var o=t.content,u=void 0===o?"":o,f=t.title,x=void 0===f?"":f,p=t.citations,v=void 0===p?{}:p,_=t.styles,g=void 0===_?{}:_,h=t.docData,m=void 0===h?{}:h,y=t.deviationData,b=void 0===y?null:y;t.open;var j=r.useMemo(function(){return JSON.stringify(v||{})},[v]),M=r.useMemo(function(){return v},[j]),D=r.useMemo(function(){return JSON.stringify(m||{})},[m]),w=r.useMemo(function(){return m},[D]),q=r.useMemo(function(){return{citations:M,docData:w}},[M,w]),C=r.useMemo(function(){var e=null==b?void 0:b.web_search_answer,n=(null==e?void 0:e.extraMetaData)||{};return Object.keys(n).reduce(function(e,n){var r=function(e,n){var r;if(!e||!n)return null;var i=null==e?void 0:e.web_search_answer,t=null===(r=null==i?void 0:i.extraMetaData)||void 0===r?void 0:r[n];return i&&t?{reasoningId:n,evaluation:e,webSearchAnswer:i,extraMetaData:t}:null}(b,n);return r&&(e[n]=r),e},{})},[b]),S=r.useMemo(function(){return s.mergeRulebookCitationsIntoMatchingLinks(u)},[u]),B=r.useMemo(function(){return{a:function(r){var i,t=r.href,o=void 0===t?"":t,s=r.children,u=r.type,l=r.reason,c=e.__rest(r,["href","children","type","reason"]),f=null==c?void 0:c["data-cognitive-reasoning"],x=!0===(i=null==c?void 0:c["dual-citation"])||"true"===i,p=x&&f?C[String(f)]:null;return n.jsx(a.default,{href:x?d(String(f||"")):o,children:s,citationType:x?"dual_citation":u,citationReason:l,metaData:e.__assign(e.__assign({},q),p?{webGpt:p}:{}),customStyle:p?{arrow:{color:"#6D28D9"}}:{}})}}},[q,C]);return n.jsxs(i.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[n.jsx(i.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:x}))})),n.jsx(i.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:e.__assign({},g)},{children:n.jsx(l.default,e.__assign({components:B,rehypePlugins:[c.default]},{children:S}))}))}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material"),t=require("react-markdown"),o=require("rehype-raw"),a=require("./CitationAnchor.js"),s=require("./Guidelines/utils/helper.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(t),c=u(o),d=function(e){return e?"./dual-citation?citationNumber=".concat(encodeURIComponent(e)):""};exports.default=function(t){var o=t.content,u=void 0===o?"":o,f=t.title,x=void 0===f?"":f,p=t.citations,v=void 0===p?{}:p,_=t.styles,g=void 0===_?{}:_,h=t.docData,m=void 0===h?{}:h,y=t.deviationData,b=void 0===y?null:y;t.open;var j=t.onCitationFullscreenChange,M=r.useMemo(function(){return JSON.stringify(v||{})},[v]),D=r.useMemo(function(){return v},[M]),w=r.useMemo(function(){return JSON.stringify(m||{})},[m]),C=r.useMemo(function(){return m},[w]),q=r.useMemo(function(){return{citations:D,docData:C}},[D,C]),S=r.useMemo(function(){var e=null==b?void 0:b.web_search_answer,n=(null==e?void 0:e.extraMetaData)||{};return Object.keys(n).reduce(function(e,n){var r=function(e,n){var r;if(!e||!n)return null;var i=null==e?void 0:e.web_search_answer,t=null===(r=null==i?void 0:i.extraMetaData)||void 0===r?void 0:r[n];return i&&t?{reasoningId:n,evaluation:e,webSearchAnswer:i,extraMetaData:t}:null}(b,n);return r&&(e[n]=r),e},{})},[b]),F=r.useMemo(function(){return s.mergeRulebookCitationsIntoMatchingLinks(u)},[u]),B=r.useMemo(function(){return{a:function(r){var i,t=r.href,o=void 0===t?"":t,s=r.children,u=r.type,l=r.reason,c=e.__rest(r,["href","children","type","reason"]),f=null==c?void 0:c["data-cognitive-reasoning"],x=!0===(i=null==c?void 0:c["dual-citation"])||"true"===i,p=x&&f?S[String(f)]:null;return n.jsx(a.default,{href:x?d(String(f||"")):o,children:s,citationType:x?"dual_citation":u,citationReason:l,metaData:e.__assign(e.__assign({},q),p?{webGpt:p}:{}),customStyle:p?{arrow:{color:"#6D28D9"}}:{},onFullscreenChange:j})}}},[q,S,j]);return n.jsxs(i.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[n.jsx(i.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:x}))})),n.jsx(i.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:e.__assign({},g)},{children:n.jsx(l.default,e.__assign({components:B,rehypePlugins:[c.default]},{children:F}))}))}))}))]}))};
2
2
  //# sourceMappingURL=CitationRenderer.js.map