@viswa-test/test-citation 0.0.45 → 0.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,42 +1,41 @@
1
1
  # 📚 e-llm-studio/citation
2
2
 
3
-
4
3
  ## Table of Contents
5
4
 
6
5
  1. [Project Overview](#project-overview)
7
6
  2. [Installation](#installation)
8
7
  3. [Available Components](#available-citations)
9
8
  - [Citation Components](#citation-components)
10
- - [BookCitation](#bookcitation) [<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/BookCitation/README.MD)
11
- - [ChatCitation](#chatcitation) [<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/ChatCitation/ChatCitationReadme.md)
12
- - [CitationRenderer](#citationrenderer) [<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/CitationRenderer/CitationRendererReadme.md)
13
- - [EmailCitation](#emailcitation) [<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/EmailCitation/EmailCitation.md)
14
- - [CognitiveDecisioningCard](#cognitivedecisioningcard) [<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/CognitiveDecisioning/CognitiveDecisioningReadme.md)
15
- - [CognitiveInternalGPTReasoning](#cognitiveinternalgptreasoning) [<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/CognitiveInternalgptReasoning/README.md)
16
- - [CodeCitation](#codecitation) [<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/CodeCitation/README.md)
17
- - [ChatDrawer](#chatdrawer) [<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/ChatDrawer/ChatDrawerReadme.md)
18
- - [CitationsViewer](#citationsviewer) [<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/CitationViewer/CitationViewerReadme.md)
19
- - [PdfEditorCitation](#pdfeditorcitation) [<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/PdfEditorCitation/README.md)
20
- - [RequirementAICitation](#requirementaicitation) [<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/RequirementAiCitations/RequirementAiCitationsReadme.md)
21
- - [VideoCitationContent](#videocitationcontent) [<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/RequirementAiCitations/RequirementAiCitationsReadme.md)
22
- - [MarkdownWithImageCitation](#markdownwithimagecitation) [<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/MarkdownWithImageCitation/README.md)
23
- - [ScannedDocCitation](#scanneddoccitation) [<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/ScannedDocCitation/README.md)
9
+ - [BookCitation](#bookcitation) [<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/BookCitation/README.MD)
10
+ - [ChatCitation](#chatcitation) [<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/ChatCitation/ChatCitationReadme.md)
11
+ - [CitationRenderer](#citationrenderer) [<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/CitationRenderer/CitationRendererReadme.md)
12
+ - [EmailCitation](#emailcitation) [<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/EmailCitation/EmailCitation.md)
13
+ - [CognitiveDecisioningCard](#cognitivedecisioningcard) [<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/CognitiveDecisioning/CognitiveDecisioningReadme.md)
14
+ - [CognitiveCompare](#cognitivecompare) [<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/new-compare-ui/citation/src/features/CognitiveCompare/README.md)
15
+ - [CognitiveInternalGPTReasoning](#cognitiveinternalgptreasoning) [<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/CognitiveInternalgptReasoning/README.md)
16
+ - [CodeCitation](#codecitation) [<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/CodeCitation/README.md)
17
+ - [ChatDrawer](#chatdrawer) [<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/ChatDrawer/ChatDrawerReadme.md)
18
+ - [CitationsViewer](#citationsviewer) [<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/CitationViewer/CitationViewerReadme.md)
19
+ - [PdfEditorCitation](#pdfeditorcitation) [<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/PdfEditorCitation/README.md)
20
+ - [RequirementAICitation](#requirementaicitation) [<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/RequirementAiCitations/RequirementAiCitationsReadme.md)
21
+ - [VideoCitationContent](#videocitationcontent) [<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/RequirementAiCitations/RequirementAiCitationsReadme.md)
22
+ - [MarkdownWithImageCitation](#markdownwithimagecitation) [<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/MarkdownWithImageCitation/README.md)
23
+ - [ScannedDocCitation](#scanneddoccitation) [<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/ScannedDocCitation/README.md)
24
24
  - [Other Components](#other-components)
25
- - [Bookemon](#bookemon) [<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/Bookemon/BookemonReadme.md)
26
- - [DatagestMon](#datagestmon) [<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/DatagestMon/README.md)
27
- - [DataSelector](#dataselector)[<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/DataSelector/DataSelectorReadme.md)
28
- - [PaginatedTable](#paginatedtable) [<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/PaginatedTable/PaginatedTableReadme.md)
29
- - [PdfViewer](#pdfviewer) [<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/PdfViewer/PdfViewerReadme.md)
30
- - [ProjectAccordion](#projectaccordion) [<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/ProjectAccordion/README.md)
31
- - [UploadData](#uploaddata) [<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/UploadData/README.md)
32
- - [ReviewPanel](#reviewpanel) [<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/ReviewPanel/README.md)
33
- - [TableCitationContent](#tablecitationcontent) [<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/TableCitation/README.md)
34
- - [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)
25
+ - [Bookemon](#bookemon) [<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/Bookemon/BookemonReadme.md)
26
+ - [DatagestMon](#datagestmon) [<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/DatagestMon/README.md)
27
+ - [DataSelector](#dataselector)[<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/DataSelector/DataSelectorReadme.md)
28
+ - [PaginatedTable](#paginatedtable) [<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/PaginatedTable/PaginatedTableReadme.md)
29
+ - [PdfViewer](#pdfviewer) [<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/PdfViewer/PdfViewerReadme.md)
30
+ - [ProjectAccordion](#projectaccordion) [<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/ProjectAccordion/README.md)
31
+ - [UploadData](#uploaddata) [<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/UploadData/README.md)
32
+ - [ReviewPanel](#reviewpanel) [<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/ReviewPanel/README.md)
33
+ - [TableCitationContent](#tablecitationcontent) [<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/TableCitation/README.md)
34
+ - [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)
35
35
  4. [Common Use Cases](#common-use-cases)
36
36
  5. [Development & Contribution](#development--contribution)
37
37
  6. [License](#license)
38
38
 
39
-
40
39
  ## Project Overview
41
40
 
42
41
  The @e-llm-studio/citation library is a comprehensive React component library designed to render various types of citations and related UI elements within the e-LLM Studio ecosystem. It provides a robust set of reusable, production-ready components that enable developers to display citations, reasoning chains, code snippets, PDFs, and other content types with rich interactive features and highly customizable styling.
@@ -136,8 +135,8 @@ pnpm add @e-llm-studio/citation
136
135
 
137
136
  ---
138
137
 
139
-
140
138
  # Citation Components
139
+
141
140
  ## BookCitation
142
141
 
143
142
  ### Overview
@@ -190,7 +189,136 @@ import BookCitation from '@e-llm-studio/citation/BookCitation'
190
189
  | `useDropdown` | `boolean` | Optional flag to render the citation as a dropdown (default: `true`) |
191
190
 
192
191
  ---
192
+ ---
193
+
194
+ ### CognitiveCompare (Main Component)
195
+
196
+ A side-by-side document comparison component with cognitive analysis, deviation badges, citation-linked PDF previews, and two layout modes (Standard and Relative Order). For full documentation see the [dedicated README](https://github.com/Techolution/e-llm-studio-lib/blob/new-compare-ui/citation/src/features/CognitiveCompare/README.md).
197
+
198
+ ### Props
199
+
200
+ | Prop | Type | Default | Description |
201
+ | --------------------- | ----------------------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
202
+ | `treeData` | `Record<string, any> \| null` | — | **Required.** Backend tree structure powering both columns. |
203
+ | `displayConfig` | [`IDisplayConfig`](#idisplayconfig) | — | **Required.** Controls header/toggle visibility and initial layout mode. |
204
+ | `componentHeaderText` | `string` | `"Contract Comparison"` | Text shown in the top header bar. |
205
+ | `deviationData` | `Record<string, any>` | `{}` | Per-node deviation analysis results keyed by node ID. Populates the Deviation Analysis tab in the cognitive popup and drives inline text highlights within section content. |
206
+
207
+ ---
208
+
209
+ #### IDisplayConfig
210
+
211
+ | Property | Type | Default | Description |
212
+ | ----------------------- | --------- | ------- | ---------------------------------------------------------------------- |
213
+ | `isHeaderVisible` | `boolean` | `true` | Show or hide the top header bar. |
214
+ | `isToggleVisible` | `boolean` | `true` | Show or hide the Standard / Relative Order toggle switch. |
215
+ | `maintainRelativeOrder` | `boolean` | `false` | Initial layout mode — `true` for Relative Order, `false` for Standard. |
216
+
217
+ ---
218
+
219
+ ### treeData Shape
220
+
221
+ `treeData` is the primary data contract. It must be a flat object where every key is a node ID, plus four reserved keys.
222
+
223
+ ```ts
224
+ {
225
+ // Top-level metadata keys
226
+ base_root_id: string, // ID of the root node (looked up inside nodes)
227
+ input_index_map: { // Maps side index to document UUID
228
+ "0": string, // left side UUID
229
+ "1": string, // right side UUID
230
+ },
231
+ documents: { // Document metadata keyed by UUID
232
+ [uuid: string]: {
233
+ title: string,
234
+ signed_url: string, // PDF URL used by CitationAnchor / PdfViewer
235
+ }
236
+ },
237
+
238
+ // All node data lives under the `nodes` key
239
+ nodes: {
240
+ // Root node (identified by base_root_id)
241
+ [rootId: string]: {
242
+ display_node?: boolean,
243
+ comparison_inputs: {
244
+ [uuid: string]: { title: string } // column titles
245
+ },
246
+ decision_scope_description?: string,
247
+ next?: Record<string, string>, // child node IDs
248
+ },
249
+
250
+ // Section nodes
251
+ [nodeId: string]: {
252
+ display_node?: boolean, // set false to hide the node
253
+ evaluation_result?: DeviationDataEntry, // deviation result attached directly to node
254
+ comparison_inputs: {
255
+ [uuid: string]: {
256
+ title: string,
257
+ content: string,
258
+ additional_attributes?: {
259
+ display_index?: number, // used in Relative Order mode for sorting
260
+ display_title?: boolean, // set false to suppress rendering the title
261
+ display_content?: boolean, // set false to suppress rendering the content
262
+ }
263
+ }
264
+ },
265
+ next?: Record<string, string>, // child node IDs (for subsections)
266
+ mapping_rationale?: {
267
+ decision_strength?: string, // numeric string, e.g. "72"
268
+ decisioning_factors?: string[],
269
+ gaps_in_decision?: string[],
270
+ citations?: Record<string, Record<string, CitationEntry>>
271
+ }
272
+ }
273
+ }
274
+ }
275
+ ```
276
+
277
+ > All node data (root and section nodes) lives under the `nodes` key. The top-level `base_root_id`, `input_index_map`, and `documents` keys remain directly on `treeData`.
278
+
279
+ #### deviationData Shape
280
+
281
+ ```ts
282
+ // deviationData[nodeId]
283
+ {
284
+ evaluation_outputs?: {
285
+ output_value?: string, // badge label text
286
+ metadata?: { label_color?: string } // hex — drives badge/highlight colors
287
+ },
288
+ cognitive_decisioning?: {
289
+ decisioning_factors?: string[],
290
+ gaps_in_decision?: string[],
291
+ citations?: Record<string, any>,
292
+ decision_strength?: string | null,
293
+ },
294
+ deviations?: Record<string, any>, // { devKey: { [docUuid]: highlightText } }
295
+ }
296
+ ```
297
+
298
+ #### Usage
299
+
300
+ ```tsx
301
+ import CognitiveCompare from "@e-llm-studio/citation/CognitiveCompare";
302
+
303
+ <CognitiveCompare
304
+ treeData={myTreeData}
305
+ displayConfig={{
306
+ isHeaderVisible: true,
307
+ isToggleVisible: true,
308
+ maintainRelativeOrder: false,
309
+ }}
310
+ deviationData={myDeviationData}
311
+ />;
312
+ ```
313
+
314
+ #### Key Behaviours
193
315
 
316
+ - Badge and highlight colors are generated dynamically from `evaluation_outputs.metadata.label_color` via `generateColorPalette()`. The static `relationStyles` map has been removed.
317
+ - Clicking a badge in **Standard mode** opens `CognitivePopup` directly. In **Relative Order mode** it opens `MoreFunctionsPopup` offering Connect, Side by Side, and Cognitive Decisioning actions.
318
+ - The **Deviation Analysis** tab is shown first in the popup and displays `cognitive_decisioning.decisioning_factors` and `gaps_in_decision` with inline citation anchors that open split PDF viewers.
319
+ - `deviations` entries drive inline `<mark>` highlights inside section content, colored using the same `label_color`-derived palette.
320
+
321
+ ---
194
322
 
195
323
  ## ChatCitation
196
324
 
@@ -926,6 +1054,7 @@ This visual captures a clean product collaboration workspace prepared for planni
926
1054
  ```
927
1055
 
928
1056
  **With CitationRenderer (Expandable Pill):**
1057
+
929
1058
  ```tsx
930
1059
  import { CitationRenderer } from '@e-llm-studio/citation/CitationRenderer'
931
1060
  import { MarkdownWithImageCitation } from '@e-llm-studio/citation/MarkdownWithImageCitation'
@@ -2263,4 +2392,4 @@ npm install @e-llm-studio/citation@latest
2263
2392
 
2264
2393
  This library is released under the MIT License. See the LICENSE file for more details.
2265
2394
 
2266
- The license information is also available in the `citation/package.json` file under the 'license' field.
2395
+ The license information is also available in the `citation/package.json` file under the 'license' field.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),s=require("react-markdown"),a=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),u=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("rehype-raw");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=p(t),g=p(s),x=p(f),_="::",m=h.default.memo(function(o){var l=o.content,s=o.sxStyles,c=o.deviationBadges,u=void 0===c?[]:c,d=o.highlights,v=void 0===d?[]:d,f=o.maintainRelativeOrder,p=void 0===f||f,h=t.useMemo(function(){return u.reduce(function(n,t){var i;return e.__assign(e.__assign({},n),((i={})[t.id]=t,i))},{})},[u]),_=t.useMemo(function(){return{mark:function(t){var i=t.children;return n.jsx("span",e.__assign({style:{backgroundColor:"#fccccc",borderRadius:"2px"}},{children:i}))},span:function(t){var o,l,s,a,c,u=t.children,d=e.__rest(t,["children"]),v=d["data-badge-id"];if(!v)return n.jsx("span",e.__assign({},d,{children:u}));var f=h[v];return f?n.jsxs(i.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[u,n.jsx(i.Box,e.__assign({ref:f.badgeRef,onClick:f.onClick,sx:e.__assign(e.__assign({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",bgcolor:(null===(o=f.style)||void 0===o?void 0:o.badgeBg)||"#EEF2FF",color:(null===(l=f.style)||void 0===l?void 0:l.badgeText)||"#3730A3",border:"1px solid ".concat((null===(s=f.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),borderRadius:"12px",px:1,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},"left"===f.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),f.isConnected&&f.style&&{outline:"2px solid ".concat(f.style.badgeBorder),outlineOffset:"1px"})},{children:n.jsxs(n.Fragment,{children:[n.jsx(i.Box,e.__assign({component:"span",sx:e.__assign({fontSize:"10px",fontWeight:700},"left"===f.side?{pr:.5,borderRight:"1px solid ".concat((null===(a=f.style)||void 0===a?void 0:a.badgeBorder)||"#C7D2FE")}:{})},{children:f.label})),"left"===f.side&&n.jsxs(n.Fragment,{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"10px",px:.25}},{children:null!=f.score&&"N/A"!==f.score&&"NA"!==f.score&&0!==f.score?"".concat(f.score):f.isOrphan?"No Deviation Found":"N/A"===f.score||"NA"===f.score?"N/A":"Same"})),n.jsx(r.EllipsisVertical,{size:10,color:(null===(c=f.style)||void 0===c?void 0:c.badgeText)||"#3730A3"})]})]})}))]})):n.jsx("span",e.__assign({},d,{children:u}))}}},[h,p]),m=t.useMemo(function(){var e=l||"",n=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")};return u.forEach(function(t){if(t.highlight){var i=t.highlight.replace(/\\(['’])/g,"$1");e=e.replace(new RegExp(n(i),"g"),'<span data-badge-id="'.concat(t.id,'"><mark>').concat(i,"</mark></span>"))}}),v.forEach(function(t){t&&(e=e.replace(new RegExp(n(t),"g"),"<mark>".concat(t,"</mark>")))}),e},[l,u,v]);return n.jsx(i.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},s),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:n.jsx(g.default,e.__assign({components:_,rehypePlugins:[x.default]},{children:a.safeStringify(m).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;if(e.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}),y=function(e,n,t,i,r){void 0===r&&(r=14);var o=e+.5*(t-e),l=i-n;if(Math.abs(l)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var s=l>0?1:-1,a=Math.min(r,Math.abs(l)/2,Math.abs(o-e)/2,Math.abs(t-o)/2);return["M ".concat(e," ").concat(n),"H ".concat(o-a),"Q ".concat(o," ").concat(n," ").concat(o," ").concat(n+s*a),"V ".concat(i-s*a),"Q ".concat(o," ").concat(i," ").concat(o+a," ").concat(i),"H ".concat(t)].join(" ")},b={id:"",title:""},S={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},R=function(e,n,t,i,r){void 0===t&&(t=300);var o=e.style.scrollBehavior;e.style.scrollBehavior="auto";var l=e.scrollTop,s=n-l,a=null,c=function(u){null===a&&(a=u);var d,v=u-a;v<t?(e.scrollTop=(d=v,d/=t,s*(--d*d*d+1)+l),r&&r(),requestAnimationFrame(c)):(e.scrollTop=n,e.style.scrollBehavior=o,r&&r(),i&&i())};requestAnimationFrame(c)};exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(s){var f,p,g,x,C,I,w,F,B=s.componentHeaderText,j=void 0===B?"Contract Comparison":B,E=s.treeData,T=s.comparisonConfig,A=s.leftColumnTitleText,M=s.rightColumnTitleText,k=s.markdownStyles,D=s.displayConfig,O=void 0===D?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:D,N=s.popupConfig,H=s.deviationData,L=void 0===H?{}:H,W=t.useState(O.maintainRelativeOrder),z=W[0],P=W[1],q=t.useState(!1),Y=q[0],V=q[1],K=t.useState(!1),U=K[0],G=K[1],X=t.useState(null),J=X[0],$=X[1],Q=t.useState(!1),Z=Q[0],ee=Q[1],ne=t.useState(!1),te=ne[0],ie=ne[1],re=t.useRef(!1),oe=t.useState(null),le=oe[0],se=oe[1],ae=t.useState(new Set),ce=ae[0],ue=ae[1],de=t.useState([]),ve=de[0],fe=de[1],pe=t.useRef(null),he=t.useRef(!1),ge=t.useRef(null),xe=t.useRef({}),_e=t.useRef([]),me=t.useRef(!1),ye=t.useRef(!1),be=t.useRef(null),Se=t.useMemo(function(){return(null==E?void 0:E.cognitive_decisioning)||{}},[E]),Re=t.useState(null),Ce=Re[0],Ie=Re[1],we=t.useRef(null),Fe=t.useState({width:0,height:0}),Be=Fe[0],je=Fe[1],Ee=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),k)},[k]),Te=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),Ae=Te[0],Me=Te[1],ke=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),De=ke[0],Oe=ke[1],Ne=t.useRef(null),He=t.useRef(null),Le=t.useRef(null),We=t.useRef(null),ze=t.useRef(null),Pe=t.useRef(null),qe=t.useRef(null),Ye=t.useRef(null),Ve=t.useRef(!1),Ke=t.useRef(null);t.useEffect(function(){Ke.current=null},[Ae.sectionIdx,Ae.open]);var Ue=t.useCallback(function(){Ie(null),Me(S),se(null)},[]),Ge=t.useCallback(function(){Oe(S)},[]),Xe=t.useCallback(function(){var e;if(Ae.anchorEl&&Ae.refSectionTitle){var n=Ae.anchorEl.getBoundingClientRect(),t=(null===(e=null==we?void 0:we.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),r=window.innerHeight-n.bottom-12-12,o=n.top-12-12,l=r<t&&o>r;null!==Ke.current?!0===Ke.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),Ke.current=l;var s=l?o:r,a=Math.min(t||9999,s),c=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,d=u-i/2,v=Math.max(12,Math.min(d,window.innerWidth-i-12)),f=Math.max(14,Math.min(u-v,i-10-4));Ie({top:c,left:v,arrowLeft:f,openAbove:l,maxHeight:s})}},[Ae.anchorEl,Ae.refSectionTitle]);t.useEffect(function(){if(Ae.open){window.addEventListener("resize",Xe);var e=requestAnimationFrame(Xe),n=null;return we.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(Xe)})).observe(we.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",Xe),n&&n.disconnect()}}},[Ae.open,Xe]),t.useEffect(function(){var e=Ne.current;if(e&&Ae.open){var n=function(e){we.current&&we.current.contains(e.target)||(Ie(null),Ue())};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[Ae.open,Ue]),t.useEffect(function(){var e=Ne.current;if(e&&De.open){var n=function(){Ge()};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[De.open,Ge]);var Je=t.useMemo(function(){var n,t,i,r,o,l,s,a,u,d,v,f;return{fields:null!==(n=null==T?void 0:T.fields)&&void 0!==n?n:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(t=null==T?void 0:T.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(r=null==T?void 0:T.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==T?void 0:T.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},c.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(a=null==T?void 0:T.relationStyles)||void 0===a?void 0:a.noContent)||{}),high:e.__assign(e.__assign({},c.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==T?void 0:T.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},c.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==T?void 0:T.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},c.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(v=null==T?void 0:T.relationStyles)||void 0===v?void 0:v.medium)||{}),low:e.__assign(e.__assign({},c.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(f=null==T?void 0:T.relationStyles)||void 0===f?void 0:f.low)||{})}}},[T]),$e=t.useMemo(function(){if(E&&Object.keys(E).length>0)try{var n=function(n,t,i){var r,o,l,s;void 0===t&&(t=!1),void 0===i&&(i=null);var c=n.nodes||n,u=[],d=[],v=n.base_root_id,f=n.input_index_map||{0:"left",1:"right"},p=n[v]||c[v];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,r){var o,l,s,u=n[t]||c[t];if(!u||!1===u.display_node)return null;var d=a.getSideData(u,r,f),v=!1!==(null===(o=d.attributes)||void 0===o?void 0:o.display_title),p=!1!==(null===(l=d.attributes)||void 0===l?void 0:l.display_content),g=!!d.title.trim(),x=!!d.content.trim(),_=a.getRationale(u),m=(null===(s=null==i?void 0:i[t])||void 0===s?void 0:s.evaluation_result)||u.evaluation_result||null,y=[];u.next&&Object.values(u.next).forEach(function(e){var n=c[e];if(n&&!1!==n.display_node){var t=h(e,r);t&&y.push(t)}});var b=!(!g&&!x);return e.__assign(e.__assign({id:t,title:g?d.title:"",content:x?d.content:"",displayTitle:v,displayContent:p,subsections:y},b?_:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(t){var g=function(t,r){var o,l,s,u,d,v,p,h,x,_,m,y,b,S,R,C,I,w,F,B,j;void 0===r&&(r=0);var E=[],T=[];if(!t)return{refSections:E,baseSections:T};var A={},M={},k=-1,D=-1;for(var O in t){var N=t[O],H=n[N]||c[N];if(H&&!1!==H.display_node){var L=a.getRationale(H),W=(null===(o=null==i?void 0:i[N])||void 0===o?void 0:o.evaluation_result)||H.evaluation_result||null,z=a.getSideData(H,"1",f),P=a.getSideData(H,"0",f),q=!1!==(null===(l=z.attributes)||void 0===l?void 0:l.display_title)&&z.title.trim()||!1!==(null===(s=z.attributes)||void 0===s?void 0:s.display_content)&&z.content.trim(),Y=!1!==(null===(u=P.attributes)||void 0===u?void 0:u.display_title)&&P.title.trim()||!1!==(null===(d=P.attributes)||void 0===d?void 0:d.display_content)&&P.content.trim(),V=Number(null!==(p=null===(v=z.attributes)||void 0===v?void 0:v.display_index)&&void 0!==p?p:k--),K=Number(null!==(x=null===(h=P.attributes)||void 0===h?void 0:h.display_index)&&void 0!==x?x:D--),U=A[V]||e.__assign(e.__assign({id:N,title:!1!==(null===(_=z.attributes)||void 0===_?void 0:_.display_title)?z.title:"",content:!1!==(null===(m=z.attributes)||void 0===m?void 0:m.display_content)?z.content:"",subsections:[]},q?L:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:V,evaluationResult:W,displayContent:null===(y=z.attributes)||void 0===y?void 0:y.display_content,displayTitle:null===(b=z.attributes)||void 0===b?void 0:b.display_title}),G=M[K]||e.__assign(e.__assign({id:N,title:!1!==(null===(S=P.attributes)||void 0===S?void 0:S.display_title)?P.title:"",content:!1!==(null===(R=P.attributes)||void 0===R?void 0:R.display_content)?P.content:"",subsections:[]},Y?L:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:K,evaluationResult:W,displayContent:null===(C=P.attributes)||void 0===C?void 0:C.display_content,displayTitle:null===(I=P.attributes)||void 0===I?void 0:I.display_title});Number(V)>=0&&Number(K)>=0&&((null===(w=U.refIndexes)||void 0===w?void 0:w.includes(Number(K)))||null===(F=U.refIndexes)||void 0===F||F.push(Number(K)),(null===(B=G.refIndexes)||void 0===B?void 0:B.includes(Number(V)))||null===(j=G.refIndexes)||void 0===j||j.push(Number(V))),A[V]=U,M[K]=G;var X=g(H.next,r+1),J=X.refSections,$=X.baseSections;J.length>0&&(U.subsections=e.__spreadArray(e.__spreadArray([],U.subsections||[],!0),J,!0)),$.length>0&&(G.subsections=e.__spreadArray(e.__spreadArray([],G.subsections||[],!0),$,!0))}}return E=Object.values(A).map(function(e){return e}),T=Object.values(M).map(function(e){return e}),E.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),T.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),{refSections:E,baseSections:T}},x=g(p.next),_=x.refSections,m=x.baseSections;d=_,u=m}else p.next&&Object.values(p.next).forEach(function(e){var t=n[e]||c[e];t&&!1!==t.display_node&&(u.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),d.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(o=null===(r=p.comparison_inputs)||void 0===r?void 0:r[f[0]])||void 0===o?void 0:o.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:u},activeVariants:[{id:"tree-variant-1",title:(null===(s=null===(l=p.comparison_inputs)||void 0===l?void 0:l[f[1]])||void 0===s?void 0:s.title)||"Reference Template",similarity:0,sections:d,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}}]}}(E,z,L);return e.__assign(e.__assign({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[JSON.stringify(E),z,JSON.stringify(L)]),Qe=$e.activeProposed,Ze=$e.activeVariants,en=$e.parseError;t.useEffect(function(){en&&$("Failed to load comparison: ".concat(en))},[en]);var nn=t.useState(null),tn=nn[0];nn[1];var rn=t.useState({}),on=rn[0],ln=rn[1],sn=t.useState({}),an=sn[0],cn=sn[1],un=(null==Ze?void 0:Ze[0])||b,dn=null===(g=null===(f=null==E?void 0:E.documents)||void 0===f?void 0:f[null===(p=null==E?void 0:E.input_index_map)||void 0===p?void 0:p[0]])||void 0===g?void 0:g.title,vn=null===(I=null===(x=null==E?void 0:E.documents)||void 0===x?void 0:x[null===(C=null==E?void 0:E.input_index_map)||void 0===C?void 0:C[1]])||void 0===I?void 0:I.title,fn=a.safeStringify(A||dn||"Uploaded Contract"),pn=a.safeStringify(M||vn||"Reference Template"),hn=t.useMemo(function(){return(null==Qe?void 0:Qe.sections)||[]},[null==Qe?void 0:Qe.sections]),gn=t.useMemo(function(){return un.sections||[]},[un.sections]),xn=hn.length>0||gn.length>0,_n=un.analysis,mn=a.safeStringify(null===(F=null===(w=null==_n?void 0:_n.rule_difference_comparison)||void 0===w?void 0:w.summary)||void 0===F?void 0:F.overall_summary),yn=!!mn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),bn=t.useRef({}),Sn=function(e){return bn.current[e]||(bn.current[e]=h.default.createRef()),bn.current[e]},Rn=t.useCallback(function(){var e,n,t,i;ee(!1),ye.current=!1;var r=be.current,o=En.current;if(null!==r){var l="string"==typeof r?null===(e=$n.current[r.split(_)[0]])||void 0===e?void 0:e.current:null===(n=Kn.current[r])||void 0===n?void 0:n.current;l&&(l.style.paddingTop="0px")}if(null!==o){var s="string"==typeof o?null===(t=Qn.current[o.split(_)[0]])||void 0===t?void 0:t.current:null===(i=Un.current[o])||void 0===i?void 0:i.current;s&&(s.style.paddingTop="0px")}Ln(null),be.current=null,En.current=null,ie(!1),G(!1),We.current&&(We.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),Pe.current&&(Pe.current.style.height="0px"),qe.current&&(qe.current.style.height="0px")},[]),Cn=t.useCallback(function(e,n,t,i,r,o){var l,s,c=a.safeStringify(n.id)||a.safeStringify(t.id)||"",u=(c?Se[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},d=null!==(s=null===(l=bn.current[i])||void 0===l?void 0:l.current)&&void 0!==s?s:null;return{open:!0,sectionTitle:n.displayTitle?n.title:"no title",refSectionTitle:n.displayTitle?n.title:"no title",cognitiveData:u,anchorEl:e,sectionAnchorEl:d,badgeStyle:o||null,sectionIdx:i,docData:{documents:null==E?void 0:E.documents,input_index_map:null==E?void 0:E.input_index_map},deviationData:n.evaluationResult||t.evaluationResult||null,isOrphan:!!r}},[Se,E]),In=t.useCallback(function(e){Ge(),Ie(null),Me(e)},[Ge]),wn=function(e,n,t,i,r,o){e.stopPropagation(),De.open&&De.sectionIdx===r?Ge():(Ue(),Oe(Cn(e.currentTarget,n,i,r,t,o)))},Fn=t.useCallback(function(){null!==De.sectionIdx&&De.anchorEl?In(e.__assign(e.__assign({},De),{open:!0})):Ge()},[De,Ge,In]),Bn=t.useCallback(function(){var e=De.sectionIdx,n=De.isOrphan;Ge(),null!==e&&(n?$("No counterpart exists to connect to."):(ye.current&&Rn(),ue(function(n){return n.has(e)?new Set:new Set([e])})))},[De.sectionIdx,Ge,Rn]),jn=t.useRef(null),En=t.useRef(null),Tn=t.useRef(null),An=t.useRef(null),Mn=t.useRef(null),kn=t.useState([]),Dn=kn[0],On=kn[1],Nn=t.useState(null),Hn=Nn[0],Ln=Nn[1];t.useRef(null);var Wn=t.useState(null),zn=Wn[0],Pn=Wn[1],qn=t.useMemo(function(){return Je.fields.filter(function(e){var n=e.key;return(!xn||"description"!==n)&&(a.hasValue(null==Qe?void 0:Qe[n])||a.hasValue(un[n]))})},[Qe,un,xn,Je.fields]),Yn=t.useRef({}),Vn=t.useRef({}),Kn=t.useRef({}),Un=t.useRef({}),Gn=t.useRef({}),Xn=t.useRef({}),Jn=t.useRef({}),$n=t.useRef({}),Qn=t.useRef({});qn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(hn.length,gn.length);t+=1)Kn.current[t]||(Kn.current[t]=h.default.createRef()),Un.current[t]||(Un.current[t]=h.default.createRef()),Gn.current[t]||(Gn.current[t]=h.default.createRef()),Xn.current[t]||(Xn.current[t]=h.default.createRef()),Jn.current[t]||(Jn.current[t]=h.default.createRef());Yn.current[n]||(Yn.current[n]=h.default.createRef()),Vn.current[n]||(Vn.current[n]=h.default.createRef())});for(var Zn=0;Zn<Math.max(hn.length,gn.length);Zn+=1)Kn.current[Zn]||(Kn.current[Zn]=h.default.createRef()),Un.current[Zn]||(Un.current[Zn]=h.default.createRef()),Gn.current[Zn]||(Gn.current[Zn]=h.default.createRef()),Xn.current[Zn]||(Xn.current[Zn]=h.default.createRef()),Jn.current[Zn]||(Jn.current[Zn]=h.default.createRef());t.useEffect(function(){if(tn){var e=Je.fields.find(function(e){return e.analysisKey===tn||e.key===tn});if(e){var n=Yn.current[e.key]||Vn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[tn,Je.fields]);var et=t.useCallback(function(e){var n,t,i,r,o,l,s,a,c,u=null===(n=null==_n?void 0:_n.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(o=null===(r=null==d?void 0:d.highlights)||void 0===r?void 0:r.ruleB_spans)||void 0===o?void 0:o.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=f.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[_n]),nt=t.useCallback(function(n){var t,i,r,o=hn[n],l=gn[n],s=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,c=(null==l?void 0:l.relation)&&"not_defined"!==l.relation;a.safeStringify(null==o?void 0:o.id)||a.safeStringify(null==l?void 0:l.id);var u=!(!(null==o?void 0:o.cognitiveData)&&!(null==l?void 0:l.cognitiveData));if(!s&&!c&&!u)return e.__assign(e.__assign({},Je.relationStyles.noContent),{label:"Not Defined"});var d=null!==(i=null!==(t=null==o?void 0:o.evaluationResult)&&void 0!==t?t:null==l?void 0:l.evaluationResult)&&void 0!==i?i:null,v=null===(r=null==d?void 0:d.evaluation_outputs)||void 0===r?void 0:r.output_value;return null!=d?e.__assign(e.__assign({},Je.relationStyles.low),{label:null!=v?v:""}):e.__assign(e.__assign({},Je.relationStyles.low),{label:"N/A"})},[hn,gn,Se,Je,et]),tt=t.useCallback(function(n){for(var t,i,r,o,l,s,c=n.split("-").map(Number),u=hn[c[0]],d=gn[c[0]],v=1;v<c.length;v++)(null==u?void 0:u.subsections)&&(u=u.subsections[c[v]]),(null==d?void 0:d.subsections)&&(d=d.subsections[c[v]]);if(!u&&!d)return null;var f=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,p=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,h=a.safeStringify(null==u?void 0:u.id)||a.safeStringify(null==d?void 0:d.id)||"",g=!(!(null==u?void 0:u.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!f&&!p&&!g)return e.__assign(e.__assign({},Je.relationStyles.noContent),{label:"Not Defined"});null!==(i=null!==(t=null==u?void 0:u.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||h&&(null===(r=Se[h])||void 0===r||r.relevance_score);var x=null!==(l=null!==(o=null==u?void 0:u.evaluationResult)&&void 0!==o?o:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,_=null===(s=null==x?void 0:x.evaluation_outputs)||void 0===s?void 0:s.output_value;return null!=x?e.__assign(e.__assign({},Je.relationStyles.low),{label:null!=_?_:""}):e.__assign(e.__assign({},Je.relationStyles.low),{label:"N/A"})},[hn,gn,Se,Je]),it=t.useCallback(function(){var e,n,t,i,r,o,l,s,a,c,u,d,v,f,p,h,g,x,m,b,S,R;if(!Ve.current&&!he.current){Ve.current=!0;try{if(!jn.current)return;var C=function(e){var n=e.split("-"),t=n[0];if(!on[t]&&!1===z)return!1;if(z&&!on["left-".concat(t)]&&!on["right-".concat(t)]&&!on[t])return!1;for(var i=t,r=1;r<n.length-1;r++)if(i+="-".concat(n[r]),!an[i])return!1;return!0},I=jn.current.getBoundingClientRect();je({width:I.width,height:I.height});var w=[];if(qn.forEach(function(e){var n,t,i=e.key,r=null===(n=Yn.current[i])||void 0===n?void 0:n.current,o=null===(t=Vn.current[i])||void 0===t?void 0:t.current;r&&o&&(r.style.height="auto",o.style.height="auto",r.style.minHeight="0px",o.style.minHeight="0px")}),!he.current){for(var F=0;F<Math.max(hn.length,gn.length);F++){var B=null===(e=Kn.current[F])||void 0===e?void 0:e.current,j=null===(n=Un.current[F])||void 0===n?void 0:n.current;B&&(B.style.height="auto",B.style.minHeight="0px"),j&&(j.style.height="auto",j.style.minHeight="0px")}z||Object.keys($n.current).forEach(function(e){var n,t;if(C(e)){var i=null===(n=$n.current[e])||void 0===n?void 0:n.current,r=null===(t=Qn.current[e])||void 0===t?void 0:t.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var E={};qn.forEach(function(e){var n,t,i=e.key,r=null===(n=Yn.current[i])||void 0===n?void 0:n.current,o=null===(t=Vn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),s=o.getBoundingClientRect();E[i]=Math.max(l.height,s.height)}});var T={left:{},right:{}},A={};if(!he.current)if(z){if(Z&&null!==Hn)if("number"==typeof Hn){var M=Hn,k=hn[M],D=null===(r=Kn.current[M])||void 0===r?void 0:r.current;D&&k&&(k.refIndexes||[]).forEach(function(e){var n,t=gn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Un.current[t])||void 0===n?void 0:n.current;if(i&&(on["left-".concat(M)]||on["right-".concat(t)])){var r=Math.max(D.getBoundingClientRect().height,i.getBoundingClientRect().height);T.left[M]=Math.max(T.left[M]||0,r),T.right[t]=Math.max(T.right[t]||0,r)}})}else{var O=Hn.split(_)[0];B=null===(o=$n.current[O])||void 0===o?void 0:o.current,j=null===(l=Qn.current[O])||void 0===l?void 0:l.current;if(B&&j){N=Math.max(B.getBoundingClientRect().height,j.getBoundingClientRect().height);A[O]=Math.max(A[O]||0,N)}}}else{Object.keys($n.current).forEach(function(e){var n,t;if(C(e)){var i=null===(n=$n.current[e])||void 0===n?void 0:n.current,r=null===(t=Qn.current[e])||void 0===t?void 0:t.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var o=i.getBoundingClientRect(),l=r.getBoundingClientRect(),s=Math.max(o.height,l.height);A[e]=s,i.style.minHeight="".concat(s,"px"),r.style.minHeight="".concat(s,"px")}}});for(F=0;F<Math.min(hn.length,gn.length);F++){var B=null===(t=Kn.current[F])||void 0===t?void 0:t.current,j=null===(i=Un.current[F])||void 0===i?void 0:i.current;if(B&&j){var N=Math.max(B.getBoundingClientRect().height,j.getBoundingClientRect().height);T.left[F]=N,T.right[F]=N}}}if(qn.forEach(function(e){var n,t,i=e.key,r=null===(n=Yn.current[i])||void 0===n?void 0:n.current,o=null===(t=Vn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=E[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),he.current||(Object.entries(T.left).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=Kn.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(T.right).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=Un.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),z||Object.keys(A).forEach(function(e){var n,t,i=null===(n=$n.current[e])||void 0===n?void 0:n.current,r=null===(t=Qn.current[e])||void 0===t?void 0:t.current;if(i&&r&&A[e]){var o=A[e];i.style.minHeight="".concat(o,"px"),r.style.minHeight="".concat(o,"px")}})),z)hn.forEach(function(e,n){var t;(null===(t=Kn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r,o,l,s,a,c,u,d,v=gn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=Gn.current[n])||void 0===t?void 0:t.current,p=null===(i=Xn.current[v])||void 0===i?void 0:i.current;if(f&&p){var h=f.getBoundingClientRect(),g=p.getBoundingClientRect(),x=h.right-I.left,_=g.left-I.left,m=h.top+h.height/2-I.top,y=g.top+g.height/2-I.top;if(Z&&Hn===n){var b=null!==(o=null===(r=Ye.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==o?o:0,S=null!==(s=null===(l=Le.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==s?s:0,R=b+(null!==(c=null===(a=Ye.current)||void 0===a?void 0:a.clientHeight)&&void 0!==c?c:1/0),C=S+(null!==(d=null===(u=Le.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),F=h.top+h.height/2,B=function(e,n,t){return Math.max(n,Math.min(t,e))};m=B(F,b,R)-I.top,y=B(F,S,C)-I.top}var j=nt(n);j&&w.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:y,style:j,sectionIdx:n,targetRightIdx:v})}}})});else for(F=0;F<Math.min(hn.length,gn.length);F++){var H=null===(s=Kn.current[F])||void 0===s?void 0:s.current,L=null===(a=Un.current[F])||void 0===a?void 0:a.current;if(H&&L){var W=H.getBoundingClientRect(),P=L.getBoundingClientRect(),q=Math.max(W.top,P.top)+18-I.top,Y=(null===(c=gn[F])||void 0===c?void 0:c.id)||"sec-".concat(F);(G=nt(F))&&w.push({id:Y,x1:W.right-I.left,y1:q,x2:P.left-I.left,y2:q,style:G,sectionIdx:F,hasCognitive:!!((null===(u=hn[F])||void 0===u?void 0:u.cognitiveData)||(null===(d=gn[F])||void 0===d?void 0:d.cognitiveData)||Y&&Se[Y]),isSubSection:!1})}}if(Z&&"string"==typeof Hn){var V=Hn,K=(O=V.split(_)[0],null===(v=Gn.current[V])||void 0===v?void 0:v.current),U=null===(f=Xn.current[V])||void 0===f?void 0:f.current;if(K&&U){var G,X=K.getBoundingClientRect(),J=U.getBoundingClientRect(),$=X.right-I.left,Q=J.left-I.left,ee=X.top+X.height/2-I.top,ne=J.top+J.height/2-I.top;if(z){var te=null!==(h=null===(p=Ye.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,ie=null!==(x=null===(g=Le.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==x?x:0,re=te+(null!==(b=null===(m=Ye.current)||void 0===m?void 0:m.clientHeight)&&void 0!==b?b:1/0),oe=ie+(null!==(R=null===(S=Le.current)||void 0===S?void 0:S.clientHeight)&&void 0!==R?R:1/0),le=function(e,n,t){return Math.max(n,Math.min(t,e))};ee=le(X.top+X.height/2,te,re)-I.top,ne=le(J.top+J.height/2,ie,oe)-I.top}(G=tt(O))&&w.push({id:"line-subsec-".concat(V),x1:$,y1:ee,x2:Q,y2:ne,style:G,sectionIdx:Number(O.split("-")[0]),isSubSection:!0,subSectionKeyPath:V})}}if(On(w),An.current&&Mn.current){var se=An.current.getBoundingClientRect(),ae=Mn.current.getBoundingClientRect(),ue=(se.top+se.height/2-I.top+ae.top+ae.height/2-I.top)/2;Pn({x1:se.right-I.left,x2:ae.left-I.left,y:ue})}else Pn(null);if(ce.size>0){var de=[],ve=Ye.current,pe=Le.current;if(ve&&pe){var ge=[],xe=ve.getBoundingClientRect().top,me=pe.getBoundingClientRect().top,ye=xe+ve.clientHeight,be=me+pe.clientHeight,Re=ve.scrollTop,Ce=pe.scrollTop,Ie=I.top,we=function(e,n,t){return Math.max(n,Math.min(t,e))};ce.forEach(function(e){var n,t,i,r,o;if("string"==typeof e){var l=e,s=l.split(_)[0],a=null===(n=Gn.current[l])||void 0===n?void 0:n.current,c=null===(t=Xn.current[l])||void 0===t?void 0:t.current;if(!a||!c)return;var u=a.getBoundingClientRect(),d=c.getBoundingClientRect(),v=tt(s),f=(E=u.right-I.left)+.5*((T=d.left-I.left-0)-E),p=u.top+u.height/2,h=d.top+d.height/2,g=p-xe+Re,x=h-me+Ce,m="conn-subsec-".concat(l);ge.push({lhsScrollY:g,rhsScrollY:x,x1:E,x2:T,containerTop:Ie,leftIdx:l,rhsArrayIdx:l,styleColor:(null==v?void 0:v.badgeBorder)||"#6366F1",styleId:m});var b=we(p,xe,ye),S=we(h,me,be),R=b-Ie,C=S-Ie,w=h>=me-4&&h<=be+4,F="";F=(A=p>=xe-4&&p<=ye+4)&&w?y(E,R,T,C):A&&!w?"M ".concat(E,",").concat(R," L ").concat(f,",").concat(R," L ").concat(f,",").concat(C):!A&&w?"M ".concat(f,",").concat(R," L ").concat(f,",").concat(C," L ").concat(T,",").concat(C):"M ".concat(f,",").concat(R," L ").concat(f,",").concat(C),de.push({id:m,pathD:F,style:v,leftIdx:l,rhsArrayIdx:l})}else if(z){var B=hn[e];if(!(null===(o=null==B?void 0:B.refIndexes)||void 0===o?void 0:o.length))return;B.refIndexes.forEach(function(n){var t,i,r=gn.findIndex(function(e){return e.selfIndex===n});if(-1!==r){var o=null===(t=Gn.current[e])||void 0===t?void 0:t.current,l=null===(i=Xn.current[r])||void 0===i?void 0:i.current;if(o&&l){var s=o.getBoundingClientRect(),a=l.getBoundingClientRect(),c=nt(e),u=s.right-I.left,d=a.left-I.left-0,v=u+.5*(d-u),f=s.top+s.height/2,p=a.top+a.height/2,h=f-xe+Re,g=p-me+Ce,x="conn-".concat(e,"-").concat(r);ge.push({lhsScrollY:h,rhsScrollY:g,x1:u,x2:d,containerTop:Ie,leftIdx:e,rhsArrayIdx:r,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:x});var _=we(f,xe,ye),m=we(p,me,be),b=_-Ie,S=m-Ie,R=f>=xe-4&&f<=ye+4,C=p>=me-4&&p<=be+4,w="";w=R&&C?y(u,b,d,S):R&&!C?"M ".concat(u,",").concat(b," L ").concat(v,",").concat(b," L ").concat(v,",").concat(S):!R&&C?"M ".concat(v,",").concat(b," L ").concat(v,",").concat(S," L ").concat(d,",").concat(S):"M ".concat(v,",").concat(b," L ").concat(v,",").concat(S),de.push({id:x,pathD:w,style:c,leftIdx:e,rhsArrayIdx:r})}}})}else{var j=e;a=null===(i=Gn.current[e])||void 0===i?void 0:i.current,c=null===(r=Xn.current[j])||void 0===r?void 0:r.current;if(!a||!c)return;var E,T;u=a.getBoundingClientRect(),d=c.getBoundingClientRect(),v=nt(e),f=(E=u.right-I.left)+.5*((T=d.left-I.left-0)-E),p=u.top+u.height/2,h=d.top+d.height/2,g=p-xe+Re,x=h-me+Ce,m="conn-".concat(e,"-").concat(j);ge.push({lhsScrollY:g,rhsScrollY:x,x1:E,x2:T,containerTop:Ie,leftIdx:e,rhsArrayIdx:j,styleColor:(null==v?void 0:v.badgeBorder)||"#6366F1",styleId:m});var A;b=we(p,xe,ye),S=we(h,me,be),R=b-Ie,C=S-Ie,w=h>=me-4&&h<=be+4,F="";F=(A=p>=xe-4&&p<=ye+4)&&w?y(E,R,T,C):A&&!w?"M ".concat(E,",").concat(R," L ").concat(f,",").concat(R," L ").concat(f,",").concat(C):!A&&w?"M ".concat(f,",").concat(R," L ").concat(f,",").concat(C," L ").concat(T,",").concat(C):"M ".concat(f,",").concat(R," L ").concat(f,",").concat(C),de.push({id:m,pathD:F,style:v,leftIdx:e,rhsArrayIdx:j})}}),_e.current=ge}fe(de)}else fe([]),_e.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Ve.current=!1}}},[qn,hn,gn,Se,Je,et,nt,z,Z,Hn,ce,on,an]),rt=t.useCallback(function(){var e,n,t,i,r,o,l,s,a,c,u,d,v,f,p=_e.current;if(p.length&&!he.current){var h=null!==(n=null===(e=Ye.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=Le.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(o=null===(r=Ye.current)||void 0===r?void 0:r.clientHeight)&&void 0!==o?o:1/0,_=null!==(s=null===(l=Le.current)||void 0===l?void 0:l.clientHeight)&&void 0!==s?s:1/0,m=null!==(c=null===(a=Ye.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==c?c:0,b=null!==(d=null===(u=Le.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,S=m+x,R=b+_,C=null!==(f=null===(v=jn.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,I=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+m,t=e.rhsScrollY-g+b,i=xe.current[e.styleId+"-stroke"],r=xe.current[e.styleId+"-bg"];if(i||r){var o,l=I(n,m,S),s=I(t,b,R),a=l-C,c=s-C,u=n>=m-4&&n<=S+4,d=t>=b-4&&t<=R+4,v=e.x1+.5*(e.x2-e.x1);o=u&&d?y(e.x1,a,e.x2,c):u&&!d?"M ".concat(e.x1,",").concat(a," L ").concat(v,",").concat(a," L ").concat(v,",").concat(c):!u&&d?"M ".concat(v,",").concat(a," L ").concat(v,",").concat(c," L ").concat(e.x2,",").concat(c):"M ".concat(v,",").concat(a," L ").concat(v,",").concat(c),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",o)),r&&(r.setAttribute("visibility","visible"),r.setAttribute("d",o))}})}},[]),ot=t.useRef(it);t.useEffect(function(){ot.current=it},[it]);var lt=t.useRef(null),st=t.useCallback(function(){null!==lt.current&&clearTimeout(lt.current),lt.current=setTimeout(function(){ot.current(),lt.current=null},50)},[]),at=t.useCallback(function(e){var n,t,i,r,o,l,s,a;if(!re.current){if(z||st(),ye.current){var c=be.current,u=En.current,d=Ye.current,v=Le.current;if(null!==c&&null!==u&&d&&v){var f="string"==typeof c?null===(n=Gn.current[c])||void 0===n?void 0:n.current:null===(t=bn.current[c])||void 0===t?void 0:t.current,p="string"==typeof u?null===(i=Xn.current[u])||void 0===i?void 0:i.current:null===(r=Jn.current[u])||void 0===r?void 0:r.current;if(f&&p){var h=f.getBoundingClientRect().top-d.getBoundingClientRect().top+d.scrollTop,g=p.getBoundingClientRect().top-v.getBoundingClientRect().top+v.scrollTop;if(e.currentTarget===d){var x=g-(h-d.scrollTop),_=v.scrollHeight-v.clientHeight,m=Math.max(0,Math.min(x,_));Math.abs(v.scrollTop-m)>1&&(v.scrollTop=m)}else if(e.currentTarget===v){var y=h-(g-v.scrollTop),b=d.scrollHeight-d.clientHeight,S=Math.max(0,Math.min(y,b));Math.abs(d.scrollTop-S)>1&&(d.scrollTop=S)}if(Tn.current){var R=null===(o=Gn.current[c])||void 0===o?void 0:o.current,C=null===(l=Xn.current[u])||void 0===l?void 0:l.current,I=null!==(a=null===(s=jn.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==a?a:0,w=d.getBoundingClientRect().top,F=w+d.clientHeight,B=v.getBoundingClientRect().top,j=B+v.clientHeight,E=function(e,n,t){return Math.max(n,Math.min(t,e))};if(R&&C){var T=R.getBoundingClientRect(),A=C.getBoundingClientRect(),M=T.top+T.height/2,k=A.top+A.height/2,D=E(M,w,F),O=E(k,B,j);Tn.current.setAttribute("y1",(D-I).toString()),Tn.current.setAttribute("y2",(O-I).toString());var N=M>=w-4&&M<=F+4;Tn.current.setAttribute("visibility",N?"visible":"hidden")}}}}}_e.current.length>0&&!me.current&&(me.current=!0,requestAnimationFrame(function(){rt(),me.current=!1}))}},[rt,z,st]);t.useEffect(function(){var e=setTimeout(st,250);window.addEventListener("resize",st);var n=null,t=null;return Ne.current&&(n=new ResizeObserver(st)).observe(Ne.current),jn.current&&(t=new ResizeObserver(st)).observe(jn.current),function(){clearTimeout(e),window.removeEventListener("resize",st),null==n||n.disconnect(),null==t||t.disconnect()}},[Qe,un,_n,qn,on,an,hn,gn,Je,st,Z,Hn,te,ce]),t.useEffect(function(){ye.current=Z},[Z]),t.useEffect(function(){be.current=Hn},[Hn]);var ct=t.useCallback(function(){var e,n,t,i,r=De.sectionIdx,o=De.isOrphan;if(Ge(),null!=r)if(o)$("No counterpart exists for this section.");else if(Z&&Hn===r)Rn();else{if(!z){var l=be.current,s=En.current;if(null!==l){var a="string"==typeof l?null===(e=$n.current[l.split(_)[0]])||void 0===e?void 0:e.current:null===(n=Kn.current[l])||void 0===n?void 0:n.current;a&&(a.style.paddingTop="0px")}if(null!==s){var c="string"==typeof s?null===(t=Qn.current[s.split(_)[0]])||void 0===t?void 0:t.current:null===(i=Un.current[s])||void 0===i?void 0:i.current;c&&(c.style.paddingTop="0px")}}ue(new Set),fe([]),_e.current=[],G(!0),re.current=!0,Ln(r),be.current=r,ee(!0),ye.current=!0,ie(!1),We.current&&(We.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),Pe.current&&(Pe.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),requestAnimationFrame(function(){var e,n,t,i,o,l,s,a,c,u,d,v=null,f=null,p=null,h=null,g=null;if("string"==typeof r){v=(null===(e=Gn.current[r])||void 0===e?void 0:e.current)||null,g=(f=(null===(n=Xn.current[r])||void 0===n?void 0:n.current)||null)?r:null;var x=r.split(_)[0];p=(null===(t=$n.current[x])||void 0===t?void 0:t.current)||null,h=(null===(i=Qn.current[x])||void 0===i?void 0:i.current)||null}else if(v=(null===(o=bn.current[r])||void 0===o?void 0:o.current)||null,p=(null===(l=Kn.current[r])||void 0===l?void 0:l.current)||null,z){var m=hn[r],y=(null==m?void 0:m.refIndexes)||[];if(y.length>0){var b=y[0],S=gn.findIndex(function(e){return e.selfIndex===b});-1!==S&&(f=(null===(c=Jn.current[S])||void 0===c?void 0:c.current)||null,h=(null===(u=Un.current[S])||void 0===u?void 0:u.current)||null,g=S)}}else f=(null===(s=Jn.current[r])||void 0===s?void 0:s.current)||null,h=(null===(a=Un.current[r])||void 0===a?void 0:a.current)||null,g=f?r:null;En.current=g;var C=Ye.current,I=Le.current;if(!v||!C)return re.current=!1,void G(!1);if(!f||!I)return ie(!0),ot.current(),re.current=!1,void G(!1);if(!z){var w=v.getBoundingClientRect(),F=f.getBoundingClientRect(),B=w.top-F.top;p&&h&&(p.style.paddingTop="0px",h.style.paddingTop="0px",B>0?h.style.paddingTop="".concat(B,"px"):B<0&&(p.style.paddingTop="".concat(Math.abs(B),"px")));var j=v?v.getBoundingClientRect().top:(null==p?void 0:p.getBoundingClientRect().top)||0;return null===(d=Ne.current)||void 0===d||d.scrollTo({top:Ne.current.scrollTop+j-150,behavior:"smooth"}),ie(!0),ot.current(),re.current=!1,void G(!1)}var E=v.getBoundingClientRect().top-C.getBoundingClientRect().top+C.scrollTop,T=f.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop-(E-C.scrollTop);T<0&&We.current&&(We.current.style.height="".concat(Math.abs(T),"px"));requestAnimationFrame(function(){var e,n=I.scrollHeight-I.clientHeight;if(T<0)e=0;else{if(T>n){var t=T-n;return ze.current&&(ze.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){R(I,T,200,function(){ie(!0),ot.current(),re.current=!1,G(!1)})})}e=T}R(I,e,200,function(){ie(!0),ot.current(),re.current=!1,G(!1)})})})}},[Ge,De.sectionIdx,Z,Hn,hn,gn,st,Rn]),ut=null!==De.sectionIdx&&ce.has(De.sectionIdx),dt=function(t){var o,l,s,c=t.section,u=t.idx,d=t.columnKey,v=t.colRef,f=t.mb,p=void 0===f?1:f,g=t.parentNodeId,x=void 0===g?"":g,_=z?!!on["".concat(d,"-").concat(u)]:!!on[String(u)],y=(null===(o=c.displayTitle)||void 0===o||o)&&a.hasValue(c.title),b=(null===(l=c.displayContent)||void 0===l||l)&&a.hasValue(c.content),S=!y&&!b,R={current:1},C=c.title;y||(C=b?"No Title Found":"No Matching Section Found");var I,w=[];if(null===(s=c.evaluationResult)||void 0===s?void 0:s.deviations){var F=c.evaluationResult.deviations;for(var B in F){var j=F[B][x];j&&w.push(j)}}return n.jsx(i.Box,e.__assign({ref:v,sx:{mb:p,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!S&&_,onChange:function(){return!S&&function(n,t){var i,r;he.current=!0,ge.current&&clearTimeout(ge.current),pe.current&&(pe.current.style.opacity="0");var o=null===(i=Kn.current[n])||void 0===i?void 0:i.current,l=null===(r=Un.current[n])||void 0===r?void 0:r.current;o&&(o.style.minHeight="0px"),l&&(l.style.minHeight="0px"),ge.current=setTimeout(function(){he.current=!1,ot.current(),pe.current&&(pe.current.style.opacity="1")},650),ln(function(i){var r=e.__assign({},i),o=z?"".concat(t,"-").concat(n):String(n),l=!i[o];if(!l){var s=String(Hn||""),a=Hn===n||s.startsWith("".concat(n,"-")),c=!1;ce.forEach(function(e){(e===n||String(e).startsWith("".concat(n,"-")))&&(c=!0)}),(a||c)&&(Rn(),ue(new Set),fe([]),_e.current=[])}if(!z)return r[String(n)]=l,r;if(r[o]=l,"left"===t)((null==(u=hn[n])?void 0:u.refIndexes)||[]).forEach(function(e){var n=gn.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=l)});else{var u,d=null==(u=gn[n])?void 0:u.selfIndex;hn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(d))&&(r["left-".concat(n)]=l)})}return r})}(u,d)},sx:{boxShadow:"none",border:S?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:S?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:S?null:n.jsx(r.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:S?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:y&&n.jsx(i.Tooltip,e.__assign({title:C,placement:"top"},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:S?"#94A3B8":"#19213D",fontWeight:S?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(I=C,I?a.safeStringify(I).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},t):n.jsx(h.default.Fragment,{children:e},t)}):null)}))}))})),!S&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[b&&n.jsx(m,{content:c.content,sxStyles:Ee,highlights:w,maintainRelativeOrder:z}),(c.subsections||[]).map(function(e,n){return vt({section:e,keyPath:"".concat(u,"-").concat(n),depth:0,columnKey:d,parentNodeId:x,devCounter:R})})]}))]}))}),"".concat(d,"-sec-").concat(u))},vt=function(t){var o,l,s,c,u,d,v,f,p,g=t.section,x=t.keyPath,y=t.depth,b=void 0===y?0:y,S=t.columnKey,R=void 0===S?"left":S,C=t.parentNodeId,I=void 0===C?"":C,w=t.devCounter,F=void 0===w?{current:1}:w,B=(null===(o=g.displayTitle)||void 0===o||o)&&a.hasValue(g.title),j=(null===(l=g.displayContent)||void 0===l||l)&&a.hasValue(g.content),T=!B&&!j,A=B?g.title:j?"No Title Found":"No Matching Section Found",M=!!an[x];"left"!==R||$n.current[x]||($n.current[x]=h.default.createRef()),"right"!==R||Qn.current[x]||(Qn.current[x]=h.default.createRef());var k,D="left"===R?$n.current[x]:Qn.current[x],O=tt(x),N=x.split("-").map(Number),H=hn[N[0]];k=z&&void 0!==(null==H?void 0:H.selfIndex)&&H.selfIndex>=0?H.selfIndex+1:N[0]+1;for(var L=hn[N[0]],W=gn[N[0]],P=1;P<N.length;P++)(null==L?void 0:L.subsections)&&(L=L.subsections[N[P]]),(null==W?void 0:W.subsections)&&(W=W.subsections[N[P]]);var q=null===(s=null==E?void 0:E.input_index_map)||void 0===s?void 0:s[0],Y=null===(c=null==E?void 0:E.input_index_map)||void 0===c?void 0:c[1],V="left"===R?Y:q,K=z?!(null===(u=g.refIndexes)||void 0===u?void 0:u.length)||void 0!==g.selfIndex&&g.selfIndex<0:"left"===R?!W:!L,U=null!==(f=null===(v=null===(d=g.evaluationResult)||void 0===d?void 0:d.evaluation_outputs)||void 0===v?void 0:v.output_value)&&void 0!==f?f:null,G=Object.entries((null===(p=g.evaluationResult)||void 0===p?void 0:p.deviations)||{}).map(function(e){var n=e[0],t=e[1],i=F.current++,r=t[I],o="No equivalent clause present."===r;if(o)r="";else if(!r)return null;var l=function(e,n){return"".concat(e).concat(_).concat(n)}(x,n),s=t[V],a=K||!s||"No equivalent clause present."===s,c="".concat(k,".").concat(i);return"left"!==R||Gn.current[l]||(Gn.current[l]=h.default.createRef()),"right"!==R||Xn.current[l]||(Xn.current[l]=h.default.createRef()),{id:l,label:c,highlight:r,side:R,style:O,score:U,isConnected:ce.has(l),isOrphan:a,isMissingClause:o,badgeRef:"left"===R?Gn.current[l]:Xn.current[l],onClick:function(e){e.stopPropagation(),wn(e,L||{title:"",content:""},a,W||{title:"",content:""},l,O)}}}).filter(Boolean),X=G.some(function(e){return ce.has(e.id)});return B||j||g.subsections&&0!==g.subsections.length?B?n.jsx(i.Box,e.__assign({ref:D,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({width:"100%"},X&&O&&{borderRadius:"4px",outline:"2px solid ".concat(O.badgeBorder),outlineOffset:"1px"})},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!T&&M,onChange:function(){if(!T){if(M){var n=String(Hn||"").startsWith(x);n||ce.forEach(function(e){String(e).startsWith(x)&&(n=!0)}),n&&(Rn(),ue(new Set),fe([]),_e.current=[])}cn(function(n){var t;return e.__assign(e.__assign({},n),((t={})[x]=!n[x],t))})}},sx:{mt:0,boxShadow:"none",border:T?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:T?null:n.jsx(r.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:T?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:A||"Untitled Subsection"}))})),!T&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[j&&n.jsx(m,{content:g.content,sxStyles:Ee,deviationBadges:G,maintainRelativeOrder:z}),(g.subsections||[]).map(function(e,n){return vt({section:e,keyPath:"".concat(x,"-").concat(n),depth:b+1,columnKey:R,parentNodeId:I,devCounter:F})})]}))]}))}))}),x):n.jsx(i.Box,e.__assign({ref:D,sx:{mt:0===b?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!T&&n.jsxs(i.Box,e.__assign({sx:e.__assign({width:"100%"},X&&O&&{borderRadius:"4px",outline:"2px solid ".concat(O.badgeBorder),outlineOffset:"1px"})},{children:[j&&n.jsx(m,{content:g.content,sxStyles:Ee,deviationBadges:G,maintainRelativeOrder:z}),(g.subsections||[]).map(function(e,n){return vt({section:e,keyPath:"".concat(x,"-").concat(n),depth:b+1,columnKey:R,parentNodeId:I,devCounter:F})})]}))}),x):null};return n.jsxs(i.Box,e.__assign({ref:He,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},z?{}:{overflow:"visible"}),{position:"relative"})},{children:[Y&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),n.jsx(d.default,{open:De.open,anchorEl:De.anchorEl,sectionTitle:De.sectionTitle,referenceSectionTitle:De.refSectionTitle,onClose:Ge,onOpenCognitiveCompare:Fn,onOpenSideBySide:ct,onConnect:Bn,isConnected:ut,isOrphan:De.isOrphan}),Ae.open&&n.jsx(u.default,{open:Ae.open,popupRef:we,position:Ce,popupConfig:N,onClose:function(){Ie(null),Me(function(n){return e.__assign(e.__assign({},n),{open:!1})}),se(null)},markdownStyles:k,sectionTitle:Ae.sectionTitle,referenceSectionTitle:Ae.refSectionTitle,cognitiveData:Ae.cognitiveData,anchorEl:Ae.anchorEl,sectionAnchorEl:Ae.sectionAnchorEl,scrollContainerEl:Ne.current,badgeStyle:Ae.badgeStyle,docData:Ae.docData,deviationData:Ae.deviationData}),n.jsx(i.Snackbar,e.__assign({open:!!J,autoHideDuration:8e3,onClose:function(){return $(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return $(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:J}))})),(O.isHeaderVisible||O.isToggleVisible)&&n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:O.isHeaderVisible&&n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:j}))})),O.isToggleVisible&&n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center"}},{children:n.jsx(i.FormControlLabel,{control:n.jsx(i.Switch,{checked:!z,onChange:function(e){var n=e.target.checked;V(!0),setTimeout(function(){P(!n),Rn(),ue(new Set),fe([]),_e.current=[],setTimeout(function(){V(!1)},400)},50)},color:"primary",size:"small",sx:{width:100,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"3px",transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(75px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:"#5928ED",opacity:1,border:0,"&::before":{content:'"Side by Side"',position:"absolute",left:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px"}}}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:20,height:20},"& .MuiSwitch-track":{borderRadius:13,backgroundColor:"#9e9e9e",opacity:1,position:"relative","&::after":{content:'"Side by Side"',position:"absolute",right:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px",opacity:1,transition:"opacity 0.2s"}},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{"&::after":{opacity:0}}}}),label:"",labelPlacement:"start",sx:{m:0,gap:1}})}))]})),n.jsx(i.Box,e.__assign({ref:Ne,onScroll:at,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:z?"hidden":"auto",borderTop:mn&&yn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},z?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:jn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},z?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:pe,style:{position:"absolute",top:0,left:0,width:Be.width||"100%",height:Be.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[zn&&!Z&&n.jsxs("g",{children:[n.jsx("line",{x1:zn.x1,y1:zn.y,x2:Math.max(zn.x1,(zn.x1+zn.x2)/2-70),y2:zn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(zn.x2,(zn.x1+zn.x2)/2+70),y1:zn.y,x2:zn.x2,y2:zn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Dn.map(function(t){var l,s=t.x1+.5*(t.x2-t.x1),a=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;var c=!1;if(t.isSubSection)c=Z&&Hn===t.subSectionKeyPath&&te;else{var u=hn[t.sectionIdx];(z?!(null===(l=null==u?void 0:u.refIndexes)||void 0===l?void 0:l.length)||(null==u?void 0:u.selfIndex)<0:!gn[t.sectionIdx])||(c=Z&&Hn===t.sectionIdx&&te)}if(c)return n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:Tn,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id);if(!z){var d=t.isSubSection?y(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2);return n.jsxs("g",{children:[n.jsx("path",{d:d,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:s-100,y:a-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){if(e.stopPropagation(),Ae.open&&le===t.id)Ue();else{var n=hn[t.sectionIdx]||{title:"",content:""},i=gn[t.sectionIdx]||{title:"",content:""};if(t.isSubSection&&t.subSectionKeyPath){for(var r=t.subSectionKeyPath.split("-").map(Number),o=hn[r[0]],l=gn[r[0]],s=1;s<r.length;s++)(null==o?void 0:o.subsections)&&(o=o.subsections[r[s]]),(null==l?void 0:l.subsections)&&(l=l.subsections[r[s]]);o&&(n=o),l&&(i=l)}se(t.id),In(Cn(e.currentTarget,n,i,t.sectionIdx,t.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[0===t.style.label?"Same":t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(o.ButtonCognitiveIcon,{})})),n.jsx(r.ChevronDown,{size:11,style:{transform:Ae.open&&le===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),ve.map(function(t){var i,r=t.pathD,o=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),s="".concat(t.id,"-bg"),a="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:o})}))}))}),n.jsx("path",{ref:function(e){xe.current[s]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){xe.current[a]=e},d:r,fill:"none",stroke:o,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},z?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:An,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:fn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:fn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ye,onScroll:at,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},z?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Pe,style:{width:"100%",height:"0px",flexShrink:0}}),xn&&hn.map(function(t,o){var l,s,a=!t.title&&!t.content;if(z&&a)return null;var c=t,u=nt(o),d=z?!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)||c.selfIndex<0:!gn[o],v=z?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:o+1,f=ce.has(o),p=function(e,n){var t,i,r,o,l,s;if(!e)return n;var a=null!==(s=null!==(o=null!==(i=null===(t=e.evaluation_output)||void 0===t?void 0:t.output_score)&&void 0!==i?i:null===(r=e.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==o?o:null===(l=e.evaluation_outputs)||void 0===l?void 0:l.output_value)&&void 0!==s?s:e.output_score;return null!=a?a:n}(c.evaluationResult,null==u?void 0:u.deviationLabel);return n.jsx(i.Box,e.__assign({ref:Sn(o),sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Kn.current[o],sx:e.__assign({width:"100%",display:"flex"},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==u?void 0:u.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:dt({section:t,idx:o,columnKey:"left",colRef:h.default.createRef(),mb:0,parentNodeId:(null===(s=null==E?void 0:E.input_index_map)||void 0===s?void 0:s[0])||""})})),z&&u&&n.jsxs(i.Box,e.__assign({ref:Gn.current[o],onClick:function(e){var n=z?gn.find(function(e){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:gn[o]||{title:"",content:""};wn(e,t,d,n,o,u)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:u.badgeBg,color:u.badgeText,border:"1px solid ".concat(u.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==v&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(u.badgeBorder)}},{children:v})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:d?"No Deviation Found":"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p)})),n.jsx(r.EllipsisVertical,{size:11,color:u.badgeText})]}))]}))}),"left-row-".concat(o))}),n.jsx("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(o.ButtonCognitiveIcon,{})})),0,"% Similarity",n.jsx(r.ChevronDown,{size:11})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},z?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[U&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Mn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:pn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:pn}))}))})),n.jsxs(i.Box,e.__assign({ref:Le,onScroll:at,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},z?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-25px",pl:"45px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),xn&&gn.map(function(t,r){var o,l=t,s=[],a=!1,c=null;if(z){s=hn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var u=hn.findIndex(function(e,n){var t;return ce.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(a=-1!==u)&&(c=nt(u))}else s=[r+1],(a=ce.has(r))&&(c=nt(r));return n.jsx(i.Box,e.__assign({ref:Jn.current[r],sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Un.current[r],sx:e.__assign({width:"100%",display:"flex"},a&&c&&{borderRadius:"6px",outline:"2px solid ".concat(c.badgeBorder),outlineOffset:"1px"})},{children:dt({section:t,idx:r,columnKey:"right",colRef:h.default.createRef(),mb:0,parentNodeId:(null===(o=null==E?void 0:E.input_index_map)||void 0===o?void 0:o[1])||""})})),z&&!U&&n.jsx(i.Box,e.__assign({ref:Xn.current[r],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:"#EEF2FF",color:"#3730A3",border:"1px solid #C7D2FE",borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:s.length>0?s.join(", "):"-"}))]}))}),"right-row-".concat(r))}),n.jsx("div",{ref:ze,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),a=require("react-markdown"),s=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),u=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("rehype-raw");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=p(t),g=p(a),x=p(f),_="::",m=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},y=h.default.memo(function(r){var l=r.content,a=r.sxStyles,c=r.deviationBadges,u=void 0===c?[]:c,d=r.highlights,v=void 0===d?[]:d,f=r.maintainRelativeOrder,p=void 0===f||f,h=r.highlightBg,_=t.useMemo(function(){return u.reduce(function(n,t){var i;return e.__assign(e.__assign({},n),((i={})[t.id]=t,i))},{})},[u]),m=t.useMemo(function(){return{mark:function(t){var i=t.children;return n.jsx("span",e.__assign({style:{backgroundColor:h,borderRadius:"2px"}},{children:i}))},span:function(t){var r,l,a,s,c,u=t.children,d=e.__rest(t,["children"]),v=d["data-badge-id"];if(!v)return n.jsx("span",e.__assign({},d,{children:u}));var f=_[v];return f?n.jsxs(i.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[u,n.jsx(i.Box,e.__assign({ref:f.badgeRef,onClick:f.onClick,sx:e.__assign(e.__assign({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",bgcolor:(null===(r=f.style)||void 0===r?void 0:r.badgeBg)||"#EEF2FF",color:(null===(l=f.style)||void 0===l?void 0:l.badgeText)||"#3730A3",border:"1px solid ".concat((null===(a=f.style)||void 0===a?void 0:a.badgeBorder)||"#C7D2FE"),borderRadius:"12px",px:1,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},"left"===f.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),f.isConnected&&f.style&&{outline:"2px solid ".concat(f.style.badgeBorder),outlineOffset:"1px"})},{children:n.jsxs(n.Fragment,{children:[n.jsx(i.Box,e.__assign({component:"span",sx:e.__assign({fontSize:"10px",fontWeight:700},"left"===f.side?{pr:.5,borderRight:"1px solid ".concat((null===(s=f.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE")}:{})},{children:f.label})),"left"===f.side&&n.jsxs(n.Fragment,{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"10px",px:.25}},{children:null!=f.score&&"N/A"!==f.score&&"NA"!==f.score&&0!==f.score?"".concat(f.score):"N/A"===f.score||"NA"===f.score?"N/A":"Same"})),n.jsx(o.EllipsisVertical,{size:10,color:(null===(c=f.style)||void 0===c?void 0:c.badgeText)||"#3730A3"})]})]})}))]})):n.jsx("span",e.__assign({},d,{children:u}))}}},[_,p]),y=t.useMemo(function(){var e=l||"",n={},t=0;return function(){var i=null==u?void 0:u[0];if(i&&i.highlight){var o=i.highlight.replace(/\\(['’])/g,"$1"),r="__DEV_TOKEN_".concat(t++,"__");n[r]='<span data-badge-id="'.concat(i.id,'"><mark>').concat(o,"</mark></span>"),e=e.replace(o,r)}}(),v.forEach(function(i){if(i){var o=i.replace(/\\(['’])/g,"$1"),r="__HL_TOKEN_".concat(t++,"__");n[r]="<mark>".concat(o,"</mark>"),e=e.split(o).join(r)}}),Object.keys(n).forEach(function(t){e=e.split(t).join(n[t])}),e},[l,u,v]);return n.jsx(i.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},a),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:n.jsx(g.default,e.__assign({components:m,rehypePlugins:[x.default]},{children:s.safeStringify(y).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;if(e.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var o=0;o<t.length;o++)if(t[o]!==i[o])return!1;var r=e.deviationBadges||[],l=n.deviationBadges||[];if(r.length!==l.length)return!1;for(o=0;o<r.length;o++){if(r[o].id!==l[o].id)return!1;if(r[o].label!==l[o].label)return!1;if(r[o].isConnected!==l[o].isConnected)return!1}return!0}),b=function(e,n,t,i,o){void 0===o&&(o=14);var r=e+.5*(t-e),l=i-n;if(Math.abs(l)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var a=l>0?1:-1,s=Math.min(o,Math.abs(l)/2,Math.abs(r-e)/2,Math.abs(t-r)/2);return["M ".concat(e," ").concat(n),"H ".concat(r-s),"Q ".concat(r," ").concat(n," ").concat(r," ").concat(n+a*s),"V ".concat(i-a*s),"Q ".concat(r," ").concat(i," ").concat(r+s," ").concat(i),"H ".concat(t)].join(" ")},S={id:"",title:""},R={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},I="#3730A3",C=function(e,n,t,i,o){void 0===t&&(t=300);var r=e.style.scrollBehavior;e.style.scrollBehavior="auto";var l=e.scrollTop,a=n-l,s=null,c=function(u){null===s&&(s=u);var d,v=u-s;v<t?(e.scrollTop=(d=v,d/=t,a*(--d*d*d+1)+l),o&&o(),requestAnimationFrame(c)):(e.scrollTop=n,e.style.scrollBehavior=r,o&&o(),i&&i())};requestAnimationFrame(c)};exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(a){var f,p,g,x,B,w,j,E,F=a.componentHeaderText,T=void 0===F?"Contract Comparison":F,M=a.treeData,k=a.comparisonConfig,A=a.leftColumnTitleText,D=a.rightColumnTitleText,O=a.markdownStyles,H=a.displayConfig,N=void 0===H?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:H,L=a.popupConfig,W=a.deviationData,z=void 0===W?{}:W,P=t.useState(N.maintainRelativeOrder),q=P[0],V=P[1],Y=t.useState(!1),K=Y[0],X=Y[1],U=t.useState(!1),G=U[0],$=U[1],J=t.useState(null),Q=J[0],Z=J[1],ee=t.useState(!1),ne=ee[0],te=ee[1],ie=t.useState(!1),oe=ie[0],re=ie[1],le=t.useRef(!1),ae=t.useState(null),se=ae[0],ce=ae[1],ue=t.useState(new Set),de=ue[0],ve=ue[1],fe=t.useState([]),pe=fe[0],he=fe[1],ge=t.useRef(null),xe=t.useRef(!1),_e=t.useRef(null),me=t.useRef({}),ye=t.useRef([]),be=t.useRef(!1),Se=t.useRef(!1),Re=t.useRef(null),Ie=t.useMemo(function(){return(null==M?void 0:M.cognitive_decisioning)||{}},[M]),Ce=t.useState(null),Be=Ce[0],we=Ce[1],je=t.useRef(null),Ee=t.useState({width:0,height:0}),Fe=Ee[0],Te=Ee[1],Me=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),O)},[O]),ke=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),Ae=ke[0],De=ke[1],Oe=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),He=Oe[0],Ne=Oe[1],Le=t.useRef(null),We=t.useRef(null),ze=t.useRef(null),Pe=t.useRef(null),qe=t.useRef(null),Ve=t.useRef(null),Ye=t.useRef(null),Ke=t.useRef(null),Xe=t.useRef(!1),Ue=t.useRef(null);t.useEffect(function(){Ue.current=null},[Ae.sectionIdx,Ae.open]);var Ge=t.useCallback(function(){we(null),De(R),ce(null)},[]),$e=t.useCallback(function(){Ne(R)},[]),Je=t.useCallback(function(){var e;if(Ae.anchorEl&&Ae.refSectionTitle){var n=Ae.anchorEl.getBoundingClientRect(),t=(null===(e=null==je?void 0:je.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<t&&r>o;null!==Ue.current?!0===Ue.current&&(l=r>=t||r>=o):l=!(o>=t||o>=r),Ue.current=l;var a=l?r:o,s=Math.min(t||9999,a),c=l?n.top-12-s:n.bottom+12,u=n.left+n.width/2,d=u-i/2,v=Math.max(12,Math.min(d,window.innerWidth-i-12)),f=Math.max(14,Math.min(u-v,i-10-4));we({top:c,left:v,arrowLeft:f,openAbove:l,maxHeight:a})}},[Ae.anchorEl,Ae.refSectionTitle]);t.useEffect(function(){if(Ae.open){window.addEventListener("resize",Je);var e=requestAnimationFrame(Je),n=null;return je.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(Je)})).observe(je.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",Je),n&&n.disconnect()}}},[Ae.open,Je]),t.useEffect(function(){var e=Le.current;if(e&&Ae.open){var n=function(e){je.current&&je.current.contains(e.target)||(we(null),Ge())};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[Ae.open,Ge]),t.useEffect(function(){var e=Le.current;if(e&&He.open){var n=function(){$e()};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[He.open,$e]);var Qe=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==k?void 0:k.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==k?void 0:k.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==k?void 0:k.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==k?void 0:k.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[k]),Ze=t.useMemo(function(){if(M&&Object.keys(M).length>0)try{var n=function(n,t,i){var o,r,l,a;void 0===t&&(t=!1),void 0===i&&(i=null);var c=n.nodes||n,u=[],d=[],v=n.base_root_id,f=n.input_index_map||{0:"left",1:"right"},p=n[v]||c[v];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,o){var r,l,a,u=n[t]||c[t];if(!u||!1===u.display_node)return null;var d=s.getSideData(u,o,f),v=!1!==(null===(r=d.attributes)||void 0===r?void 0:r.display_title),p=!1!==(null===(l=d.attributes)||void 0===l?void 0:l.display_content),g=!!d.title.trim(),x=!!d.content.trim(),_=s.getRationale(u),m=(null===(a=null==i?void 0:i[t])||void 0===a?void 0:a.evaluation_result)||u.evaluation_result||null,y=[];u.next&&Object.values(u.next).forEach(function(e){var n=c[e];if(n&&!1!==n.display_node){var t=h(e,o);t&&y.push(t)}});var b=!(!g&&!x);return e.__assign(e.__assign({id:t,title:g?d.title:"",content:x?d.content:"",displayTitle:v,displayContent:p,subsections:y},b?_:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(t){var g=function(t,o){var r,l,a,u,d,v,p,h,x,_,m,y,b,S,R,I,C,B,w,j,E;void 0===o&&(o=0);var F=[],T=[];if(!t)return{refSections:F,baseSections:T};var M={},k={},A=-1,D=-1;for(var O in t){var H=t[O],N=n[H]||c[H];if(N&&!1!==N.display_node){var L=s.getRationale(N),W=(null===(r=null==i?void 0:i[H])||void 0===r?void 0:r.evaluation_result)||N.evaluation_result||null,z=s.getSideData(N,"1",f),P=s.getSideData(N,"0",f),q=!1!==(null===(l=z.attributes)||void 0===l?void 0:l.display_title)&&z.title.trim()||!1!==(null===(a=z.attributes)||void 0===a?void 0:a.display_content)&&z.content.trim(),V=!1!==(null===(u=P.attributes)||void 0===u?void 0:u.display_title)&&P.title.trim()||!1!==(null===(d=P.attributes)||void 0===d?void 0:d.display_content)&&P.content.trim(),Y=Number(null!==(p=null===(v=z.attributes)||void 0===v?void 0:v.display_index)&&void 0!==p?p:A--),K=Number(null!==(x=null===(h=P.attributes)||void 0===h?void 0:h.display_index)&&void 0!==x?x:D--),X=M[Y]||e.__assign(e.__assign({id:H,title:!1!==(null===(_=z.attributes)||void 0===_?void 0:_.display_title)?z.title:"",content:!1!==(null===(m=z.attributes)||void 0===m?void 0:m.display_content)?z.content:"",subsections:[]},q?L:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:Y,evaluationResult:W,displayContent:null===(y=z.attributes)||void 0===y?void 0:y.display_content,displayTitle:null===(b=z.attributes)||void 0===b?void 0:b.display_title}),U=k[K]||e.__assign(e.__assign({id:H,title:!1!==(null===(S=P.attributes)||void 0===S?void 0:S.display_title)?P.title:"",content:!1!==(null===(R=P.attributes)||void 0===R?void 0:R.display_content)?P.content:"",subsections:[]},V?L:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:K,evaluationResult:W,displayContent:null===(I=P.attributes)||void 0===I?void 0:I.display_content,displayTitle:null===(C=P.attributes)||void 0===C?void 0:C.display_title});Number(Y)>=0&&Number(K)>=0&&((null===(B=X.refIndexes)||void 0===B?void 0:B.includes(Number(K)))||null===(w=X.refIndexes)||void 0===w||w.push(Number(K)),(null===(j=U.refIndexes)||void 0===j?void 0:j.includes(Number(Y)))||null===(E=U.refIndexes)||void 0===E||E.push(Number(Y))),M[Y]=X,k[K]=U;var G=g(N.next,o+1),$=G.refSections,J=G.baseSections;$.length>0&&(X.subsections=e.__spreadArray(e.__spreadArray([],X.subsections||[],!0),$,!0)),J.length>0&&(U.subsections=e.__spreadArray(e.__spreadArray([],U.subsections||[],!0),J,!0))}}return F=Object.values(M).map(function(e){return e}),T=Object.values(k).map(function(e){return e}),F.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),T.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),{refSections:F,baseSections:T}},x=g(p.next),_=x.refSections,m=x.baseSections;d=_,u=m}else p.next&&Object.values(p.next).forEach(function(e){var t=n[e]||c[e];t&&!1!==t.display_node&&(u.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),d.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(r=null===(o=p.comparison_inputs)||void 0===o?void 0:o[f[0]])||void 0===r?void 0:r.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:u},activeVariants:[{id:"tree-variant-1",title:(null===(a=null===(l=p.comparison_inputs)||void 0===l?void 0:l[f[1]])||void 0===a?void 0:a.title)||"Reference Template",similarity:0,sections:d,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}}]}}(M,q,z);return e.__assign(e.__assign({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[JSON.stringify(M),q,JSON.stringify(z)]),en=Ze.activeProposed,nn=Ze.activeVariants,tn=Ze.parseError;t.useEffect(function(){tn&&Z("Failed to load comparison: ".concat(tn))},[tn]);var on=t.useState(null),rn=on[0];on[1];var ln=t.useState({}),an=ln[0],sn=ln[1],cn=t.useState({}),un=cn[0],dn=cn[1],vn=(null==nn?void 0:nn[0])||S,fn=null===(g=null===(f=null==M?void 0:M.documents)||void 0===f?void 0:f[null===(p=null==M?void 0:M.input_index_map)||void 0===p?void 0:p[0]])||void 0===g?void 0:g.title,pn=null===(w=null===(x=null==M?void 0:M.documents)||void 0===x?void 0:x[null===(B=null==M?void 0:M.input_index_map)||void 0===B?void 0:B[1]])||void 0===w?void 0:w.title,hn=s.safeStringify(A||fn||"Uploaded Contract"),gn=s.safeStringify(D||pn||"Reference Template"),xn=t.useMemo(function(){return(null==en?void 0:en.sections)||[]},[null==en?void 0:en.sections]),_n=t.useMemo(function(){return vn.sections||[]},[vn.sections]),mn=xn.length>0||_n.length>0,yn=vn.analysis,bn=s.safeStringify(null===(E=null===(j=null==yn?void 0:yn.rule_difference_comparison)||void 0===j?void 0:j.summary)||void 0===E?void 0:E.overall_summary),Sn=!!bn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Rn=t.useMemo(function(){var e,n,t={},i={},o=null===(e=null==M?void 0:M.input_index_map)||void 0===e?void 0:e[0],r=null===(n=null==M?void 0:M.input_index_map)||void 0===n?void 0:n[1],l=new Map,a=function(e){return e&&e.id?(l.has(e.id)||l.set(e.id,s.safeStringify(e.content||"").replace(/\\n/g,"\n")),l.get(e.id)):""},c=function(e,n,s,u,d){var v,f,p,h,g,x,y,b;e&&!d&&function(e,n,s,c){var u,d=(null===(u=null==e?void 0:e.evaluationResult)||void 0===u?void 0:u.deviations)||{};Object.keys(d).sort().forEach(function(u){var v=d[u];if(v){var f=v[o],p=v[r],h=!1,g=!1;if(!m(f)){var x=f.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n&&x){var y=a(n);y.includes(x)&&(h=!0,l.set(n.id,y.replace(x,"__TOKEN__")))}}if(!m(p)){var b=p.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(s&&b){var S=a(s);S.includes(b)&&(g=!0,l.set(s.id,S.replace(b,"__TOKEN__")))}}if(h||g){var R="".concat(e.id).concat(_).concat(u);void 0===t[R]&&(void 0===i[c]&&(i[c]=1),t[R]=i[c]++)}}})}(e,n,s,u);for(var S=Math.max((null===(v=null==n?void 0:n.subsections)||void 0===v?void 0:v.length)||0,(null===(f=null==s?void 0:s.subsections)||void 0===f?void 0:f.length)||0,(null===(p=null==e?void 0:e.subsections)||void 0===p?void 0:p.length)||0),R=0;R<S;R++)c((null===(h=null==e?void 0:e.subsections)||void 0===h?void 0:h[R])||(null===(g=null==n?void 0:n.subsections)||void 0===g?void 0:g[R])||(null===(x=null==s?void 0:s.subsections)||void 0===x?void 0:x[R]),null===(y=null==n?void 0:n.subsections)||void 0===y?void 0:y[R],null===(b=null==s?void 0:s.subsections)||void 0===b?void 0:b[R],u,!1)};return xn.forEach(function(e,n){var t,i=n+1;q&&void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1);var o=null;if(q){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0];o=_n.find(function(e){return e.selfIndex===r})}else o=_n[n];c(e,e,o,i,!0)}),_n.forEach(function(e,n){var t,i=n+1,o=!1;if(q){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0],l=xn.find(function(e){return e.selfIndex===r});l&&void 0!==l.selfIndex&&l.selfIndex>=0?i=l.selfIndex+1:(o=!0,void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1))}else n>=xn.length&&(o=!0);o&&c(e,null,e,i,!0)}),t},[xn,_n,q,M]),In=t.useRef({}),Cn=function(e){return In.current[e]||(In.current[e]=h.default.createRef()),In.current[e]},Bn=t.useCallback(function(){var e,n,t,i;te(!1),Se.current=!1;var o=Re.current,r=kn.current;if(null!==o)if("string"==typeof o&&o.includes(_)){var l=o.split(_);(a=null===(e=et.current[l[2]])||void 0===e?void 0:e.current)&&(a.style.paddingTop="0px")}else{var a;(a=null===(n=Gn.current[o])||void 0===n?void 0:n.current)&&(a.style.paddingTop="0px")}if(null!==r)if("string"==typeof r&&r.includes(_)){l=r.split(_);(s=null===(t=nt.current[l[3]])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}else{var s;(s=null===(i=$n.current[r])||void 0===i?void 0:i.current)&&(s.style.paddingTop="0px")}Pn(null),Re.current=null,kn.current=null,re(!1),$(!1),Pe.current&&(Pe.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ve.current&&(Ve.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px")},[]),wn=t.useCallback(function(e,n,t,i,o,r){var l,a,c=s.safeStringify(n.id)||s.safeStringify(t.id)||"",u=(c?Ie[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},d=null!==(a=null===(l=In.current[i])||void 0===l?void 0:l.current)&&void 0!==a?a:null;return{open:!0,sectionTitle:n.displayTitle?n.title:"no title",refSectionTitle:n.displayTitle?n.title:"no title",cognitiveData:u,anchorEl:e,sectionAnchorEl:d,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==M?void 0:M.documents,input_index_map:null==M?void 0:M.input_index_map},deviationData:n.evaluationResult||t.evaluationResult||null,isOrphan:!!o}},[Ie,M]),jn=t.useCallback(function(e){$e(),we(null),De(e)},[$e]),En=function(e,n,t,i,o,r){e.stopPropagation(),He.open&&He.sectionIdx===o?$e():(Ge(),Ne(wn(e.currentTarget,n,i,o,t,r)))},Fn=t.useCallback(function(){null!==He.sectionIdx&&He.anchorEl?jn(e.__assign(e.__assign({},He),{open:!0})):$e()},[He,$e,jn]),Tn=t.useCallback(function(){var e=He.sectionIdx,n=He.isOrphan;$e(),null!==e&&(n?Z("No counterpart exists to connect to."):(Se.current&&Bn(),ve(function(n){return n.has(e)?new Set:new Set([e])})))},[He.sectionIdx,$e,Bn]),Mn=t.useRef(null),kn=t.useRef(null),An=t.useRef(null),Dn=t.useRef(null),On=t.useRef(null),Hn=t.useState([]),Nn=Hn[0],Ln=Hn[1],Wn=t.useState(null),zn=Wn[0],Pn=Wn[1];t.useRef(null);var qn=t.useState(null),Vn=qn[0],Yn=qn[1],Kn=t.useMemo(function(){return Qe.fields.filter(function(e){var n=e.key;return(!mn||"description"!==n)&&(s.hasValue(null==en?void 0:en[n])||s.hasValue(vn[n]))})},[en,vn,mn,Qe.fields]),Xn=t.useRef({}),Un=t.useRef({}),Gn=t.useRef({}),$n=t.useRef({}),Jn=t.useRef({}),Qn=t.useRef({}),Zn=t.useRef({}),et=t.useRef({}),nt=t.useRef({});Kn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(xn.length,_n.length);t+=1)Gn.current[t]||(Gn.current[t]=h.default.createRef()),$n.current[t]||($n.current[t]=h.default.createRef()),Jn.current[t]||(Jn.current[t]=h.default.createRef()),Qn.current[t]||(Qn.current[t]=h.default.createRef()),Zn.current[t]||(Zn.current[t]=h.default.createRef());Xn.current[n]||(Xn.current[n]=h.default.createRef()),Un.current[n]||(Un.current[n]=h.default.createRef())});for(var tt=0;tt<Math.max(xn.length,_n.length);tt+=1)Gn.current[tt]||(Gn.current[tt]=h.default.createRef()),$n.current[tt]||($n.current[tt]=h.default.createRef()),Jn.current[tt]||(Jn.current[tt]=h.default.createRef()),Qn.current[tt]||(Qn.current[tt]=h.default.createRef()),Zn.current[tt]||(Zn.current[tt]=h.default.createRef());t.useEffect(function(){if(rn){var e=Qe.fields.find(function(e){return e.analysisKey===rn||e.key===rn});if(e){var n=Xn.current[e.key]||Un.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[rn,Qe.fields]);var it=t.useCallback(function(e){var n,t,i,o,r,l,a,s,c,u=null===(n=null==yn?void 0:yn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(a=f.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[yn]),ot=t.useCallback(function(n){var t,i,o,r,l,a,c,u=xn[n],d=_n[n],v=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,f=(null==d?void 0:d.relation)&&"not_defined"!==d.relation;s.safeStringify(null==u?void 0:u.id)||s.safeStringify(null==d?void 0:d.id);var p=!(!(null==u?void 0:u.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!v&&!f&&!p)return e.__assign(e.__assign({},s.generateColorPalette(I)),{label:"Not Defined"});var h=null!==(i=null!==(t=null==u?void 0:u.evaluationResult)&&void 0!==t?t:null==d?void 0:d.evaluationResult)&&void 0!==i?i:null,g=null===(o=null==h?void 0:h.evaluation_outputs)||void 0===o?void 0:o.output_value,x=null!==(a=null===(l=null===(r=null==h?void 0:h.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===l?void 0:l.label_color)&&void 0!==a?a:I;return null!=h?e.__assign(e.__assign({},s.generateColorPalette(x)),{label:null!==(c=g)&&void 0!==c?c:""}):e.__assign(e.__assign({},s.generateColorPalette(x)),{label:"N/A"})},[xn,_n,Ie,Qe,it]),rt=t.useCallback(function(n){for(var t,i,o,r,l,a,c,u,d,v=n.split("-").map(Number),f=xn[v[0]],p=_n[v[0]],h=1;h<v.length;h++)(null==f?void 0:f.subsections)&&(f=f.subsections[v[h]]),(null==p?void 0:p.subsections)&&(p=p.subsections[v[h]]);if(!f&&!p)return null;var g=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,x=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,_=s.safeStringify(null==f?void 0:f.id)||s.safeStringify(null==p?void 0:p.id)||"",m=!(!(null==f?void 0:f.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!g&&!x&&!m)return e.__assign(e.__assign({},s.generateColorPalette(I)),{label:"Not Defined"});null!==(i=null!==(t=null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||_&&(null===(o=Ie[_])||void 0===o||o.relevance_score);var y=null!==(l=null!==(r=null==f?void 0:f.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,b=null===(a=null==y?void 0:y.evaluation_outputs)||void 0===a?void 0:a.output_value,S=null!==(d=null===(u=null===(c=null==y?void 0:y.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===u?void 0:u.label_color)&&void 0!==d?d:I;return null!=y?e.__assign(e.__assign({},s.generateColorPalette(S)),{label:null!=b?b:""}):e.__assign(e.__assign({},s.generateColorPalette(S)),{label:"N/A"})},[xn,_n,Ie,Qe]),lt=t.useCallback(function(){var e,n,t,i,o,r,l,a,s,c,u,d,v,f,p,h,g,x,m,y,S,R;if(!Xe.current&&!xe.current){Xe.current=!0;try{if(!Mn.current)return;var I=function(e){var n=e.split("-"),t=n[0];if(!an[t]&&!1===q)return!1;if(q&&!an["left-".concat(t)]&&!an["right-".concat(t)]&&!an[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!un[i])return!1;return!0},C=Mn.current.getBoundingClientRect();Te({width:C.width,height:C.height});var B=[];if(Kn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!xe.current){for(var w=0;w<Math.max(xn.length,_n.length);w++){var j=null===(e=Gn.current[w])||void 0===e?void 0:e.current,E=null===(n=$n.current[w])||void 0===n?void 0:n.current;j&&(j.style.height="auto",j.style.minHeight="0px"),E&&(E.style.height="auto",E.style.minHeight="0px")}q||Object.keys(et.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=et.current[e])||void 0===n?void 0:n.current,o=null===(t=nt.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var F={};Kn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),a=r.getBoundingClientRect();F[i]=Math.max(l.height,a.height)}});var T={left:{},right:{}},M={};if(!xe.current)if(q){if(ne&&null!==zn)if("number"==typeof zn){var k=zn,A=xn[k],D=null===(o=Gn.current[k])||void 0===o?void 0:o.current;D&&A&&(A.refIndexes||[]).forEach(function(e){var n,t=_n.findIndex(function(n){return n.selfIndex===e}),i=null===(n=$n.current[t])||void 0===n?void 0:n.current;if(i&&(an["left-".concat(k)]||an["right-".concat(t)])){var o=Math.max(D.getBoundingClientRect().height,i.getBoundingClientRect().height);T.left[k]=Math.max(T.left[k]||0,o),T.right[t]=Math.max(T.right[t]||0,o)}})}else{var O=zn.split(_)[2];if(O){j=null===(r=et.current[O])||void 0===r?void 0:r.current,E=null===(l=nt.current[O])||void 0===l?void 0:l.current;if(j&&E){H=Math.max(j.getBoundingClientRect().height,E.getBoundingClientRect().height);M[O]=Math.max(M[O]||0,H)}}}}else{Object.keys(et.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=et.current[e])||void 0===n?void 0:n.current,o=null===(t=nt.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),a=Math.max(r.height,l.height);M[e]=a,i.style.minHeight="".concat(a,"px"),o.style.minHeight="".concat(a,"px")}}});for(w=0;w<Math.min(xn.length,_n.length);w++){var j=null===(t=Gn.current[w])||void 0===t?void 0:t.current,E=null===(i=$n.current[w])||void 0===i?void 0:i.current;if(j&&E){var H=Math.max(j.getBoundingClientRect().height,E.getBoundingClientRect().height);T.left[w]=H,T.right[w]=H}}}if(Kn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=F[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),xe.current||(Object.entries(T.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Gn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(T.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=$n.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),q||Object.keys(M).forEach(function(e){var n,t,i=null===(n=et.current[e])||void 0===n?void 0:n.current,o=null===(t=nt.current[e])||void 0===t?void 0:t.current;if(i&&o&&M[e]){var r=M[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),q)xn.forEach(function(e,n){var t;(null===(t=Gn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,a,s,c,u,d,v=_n.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=Jn.current[n])||void 0===t?void 0:t.current,p=null===(i=Qn.current[v])||void 0===i?void 0:i.current;if(f&&p){var h=f.getBoundingClientRect(),g=p.getBoundingClientRect(),x=h.right-C.left,_=g.left-C.left,m=h.top+h.height/2-C.top,y=g.top+g.height/2-C.top;if(ne&&zn===n){var b=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(a=null===(l=ze.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==a?a:0,R=b+(null!==(c=null===(s=Ke.current)||void 0===s?void 0:s.clientHeight)&&void 0!==c?c:1/0),I=S+(null!==(d=null===(u=ze.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),w=h.top+h.height/2,j=function(e,n,t){return Math.max(n,Math.min(t,e))};m=j(w,b,R)-C.top,y=j(w,S,I)-C.top}var E=ot(n);E&&B.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:y,style:E,sectionIdx:n,targetRightIdx:v})}}})});else for(w=0;w<Math.min(xn.length,_n.length);w++){var N=null===(a=Gn.current[w])||void 0===a?void 0:a.current,L=null===(s=$n.current[w])||void 0===s?void 0:s.current;if(N&&L){var W=N.getBoundingClientRect(),z=L.getBoundingClientRect(),P=Math.max(W.top,z.top)+18-C.top,V=(null===(c=_n[w])||void 0===c?void 0:c.id)||"sec-".concat(w);(Q=ot(w))&&B.push({id:V,x1:W.right-C.left,y1:P,x2:z.left-C.left,y2:P,style:Q,sectionIdx:w,hasCognitive:!!((null===(u=xn[w])||void 0===u?void 0:u.cognitiveData)||(null===(d=_n[w])||void 0===d?void 0:d.cognitiveData)||V&&Ie[V]),isSubSection:!1})}}if(ne&&"string"==typeof zn&&zn.includes(_)){var Y=zn.split(_),K=Y[0],X=Y[1],U=Y[2],G=(Y[3],"".concat(K).concat(_).concat(X)),$=null===(v=Jn.current[G])||void 0===v?void 0:v.current,J=null===(f=Qn.current[G])||void 0===f?void 0:f.current;if($&&J){var Q,Z=$.getBoundingClientRect(),ee=J.getBoundingClientRect(),te=Z.right-C.left,ie=ee.left-C.left,oe=Z.top+Z.height/2-C.top,re=ee.top+ee.height/2-C.top;if(q){var le=null!==(h=null===(p=Ke.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,ae=null!==(x=null===(g=ze.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==x?x:0,se=le+(null!==(y=null===(m=Ke.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ce=ae+(null!==(R=null===(S=ze.current)||void 0===S?void 0:S.clientHeight)&&void 0!==R?R:1/0),ue=function(e,n,t){return Math.max(n,Math.min(t,e))};oe=ue(Z.top+Z.height/2,le,se)-C.top,re=ue(ee.top+ee.height/2,ae,ce)-C.top}(Q=rt(U))&&B.push({id:"line-subsec-".concat(G),x1:te,y1:oe,x2:ie,y2:re,style:Q,sectionIdx:Number(U.split("-")[0]),isSubSection:!0,subSectionKeyPath:zn})}}if(Ln(B),Dn.current&&On.current){var ve=Dn.current.getBoundingClientRect(),fe=On.current.getBoundingClientRect(),pe=(ve.top+ve.height/2-C.top+fe.top+fe.height/2-C.top)/2;Yn({x1:ve.right-C.left,x2:fe.left-C.left,y:pe})}else Yn(null);if(de.size>0){var ge=[],_e=Ke.current,me=ze.current;if(_e&&me){var be=[],Se=_e.getBoundingClientRect().top,Re=me.getBoundingClientRect().top,Ce=Se+_e.clientHeight,Be=Re+me.clientHeight,we=_e.scrollTop,je=me.scrollTop,Ee=C.top,Fe=function(e,n,t){return Math.max(n,Math.min(t,e))};de.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(_)){var l=e.split(_),a=l[0],s=l[1],c=l[2],u=(l[3],"".concat(a).concat(_).concat(s)),d=null===(n=Jn.current[u])||void 0===n?void 0:n.current,v=null===(t=Qn.current[u])||void 0===t?void 0:t.current;if(!d||!v)return;var f=d.getBoundingClientRect(),p=v.getBoundingClientRect(),h=rt(c),g=(D=f.right-C.left)+.5*((O=p.left-C.left-0)-D),x=f.top+f.height/2,m=p.top+p.height/2,y=x-Se+we,S=m-Re+je,R="conn-subsec-".concat(u);be.push({lhsScrollY:y,rhsScrollY:S,x1:D,x2:O,containerTop:Ee,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:R});var I=Fe(x,Se,Ce),B=Fe(m,Re,Be),w=I-Ee,j=B-Ee,E=m>=Re-4&&m<=Be+4,F="";F=(H=x>=Se-4&&x<=Ce+4)&&E?b(D,w,O,j):H&&!E?"M ".concat(D,",").concat(w," L ").concat(g,",").concat(w," L ").concat(g,",").concat(j):!H&&E?"M ".concat(g,",").concat(w," L ").concat(g,",").concat(j," L ").concat(O,",").concat(j):"M ".concat(g,",").concat(w," L ").concat(g,",").concat(j),ge.push({id:R,pathD:F,style:h,leftIdx:e,rhsArrayIdx:e})}else if(q){var T=e,M=xn[T];if(!(null===(r=null==M?void 0:M.refIndexes)||void 0===r?void 0:r.length))return;M.refIndexes.forEach(function(e){var n,t,i=_n.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Jn.current[T])||void 0===n?void 0:n.current,r=null===(t=Qn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),a=r.getBoundingClientRect(),s=ot(T),c=l.right-C.left,u=a.left-C.left-0,d=c+.5*(u-c),v=l.top+l.height/2,f=a.top+a.height/2,p=v-Se+we,h=f-Re+je,g="conn-".concat(T,"-").concat(i);be.push({lhsScrollY:p,rhsScrollY:h,x1:c,x2:u,containerTop:Ee,leftIdx:T,rhsArrayIdx:i,styleColor:(null==s?void 0:s.badgeBorder)||"#6366F1",styleId:g});var x=Fe(v,Se,Ce),_=Fe(f,Re,Be),m=x-Ee,y=_-Ee,S=v>=Se-4&&v<=Ce+4,R=f>=Re-4&&f<=Be+4,I="";I=S&&R?b(c,m,u,y):S&&!R?"M ".concat(c,",").concat(m," L ").concat(d,",").concat(m," L ").concat(d,",").concat(y):!S&&R?"M ".concat(d,",").concat(m," L ").concat(d,",").concat(y," L ").concat(u,",").concat(y):"M ".concat(d,",").concat(m," L ").concat(d,",").concat(y),ge.push({id:g,pathD:I,style:s,leftIdx:T,rhsArrayIdx:i})}}})}else{var k=e,A=k;d=null===(i=Jn.current[k])||void 0===i?void 0:i.current,v=null===(o=Qn.current[A])||void 0===o?void 0:o.current;if(!d||!v)return;var D,O;f=d.getBoundingClientRect(),p=v.getBoundingClientRect(),h=ot(k),g=(D=f.right-C.left)+.5*((O=p.left-C.left-0)-D),x=f.top+f.height/2,m=p.top+p.height/2,y=x-Se+we,S=m-Re+je,R="conn-".concat(k,"-").concat(A);be.push({lhsScrollY:y,rhsScrollY:S,x1:D,x2:O,containerTop:Ee,leftIdx:k,rhsArrayIdx:A,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:R});var H;I=Fe(x,Se,Ce),B=Fe(m,Re,Be),w=I-Ee,j=B-Ee,E=m>=Re-4&&m<=Be+4,F="";F=(H=x>=Se-4&&x<=Ce+4)&&E?b(D,w,O,j):H&&!E?"M ".concat(D,",").concat(w," L ").concat(g,",").concat(w," L ").concat(g,",").concat(j):!H&&E?"M ".concat(g,",").concat(w," L ").concat(g,",").concat(j," L ").concat(O,",").concat(j):"M ".concat(g,",").concat(w," L ").concat(g,",").concat(j),ge.push({id:R,pathD:F,style:h,leftIdx:k,rhsArrayIdx:A})}}),ye.current=be}he(ge)}else he([]),ye.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Xe.current=!1}}},[Kn,xn,_n,Ie,Qe,it,ot,q,ne,zn,de,an,un]),at=t.useCallback(function(){var e,n,t,i,o,r,l,a,s,c,u,d,v,f,p=ye.current;if(p.length&&!xe.current){var h=null!==(n=null===(e=Ke.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=ze.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,_=null!==(a=null===(l=ze.current)||void 0===l?void 0:l.clientHeight)&&void 0!==a?a:1/0,m=null!==(c=null===(s=Ke.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==c?c:0,y=null!==(d=null===(u=ze.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,S=m+x,R=y+_,I=null!==(f=null===(v=Mn.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,C=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+m,t=e.rhsScrollY-g+y,i=me.current[e.styleId+"-stroke"],o=me.current[e.styleId+"-bg"];if(i||o){var r,l=C(n,m,S),a=C(t,y,R),s=l-I,c=a-I,u=n>=m-4&&n<=S+4,d=t>=y-4&&t<=R+4,v=e.x1+.5*(e.x2-e.x1);r=u&&d?b(e.x1,s,e.x2,c):u&&!d?"M ".concat(e.x1,",").concat(s," L ").concat(v,",").concat(s," L ").concat(v,",").concat(c):!u&&d?"M ".concat(v,",").concat(s," L ").concat(v,",").concat(c," L ").concat(e.x2,",").concat(c):"M ".concat(v,",").concat(s," L ").concat(v,",").concat(c),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]),st=t.useRef(lt);t.useEffect(function(){st.current=lt},[lt]);var ct=t.useRef(null),ut=t.useCallback(function(){null!==ct.current&&clearTimeout(ct.current),ct.current=setTimeout(function(){st.current(),ct.current=null},50)},[]),dt=t.useCallback(function(e){var n,t,i,o,r,l,a,s,c,u;if(!le.current){if(q||ut(),Se.current){var d=Re.current,v=kn.current,f=Ke.current,p=ze.current;if(null!==d&&null!==v&&f&&p){var h="string"==typeof d&&d.includes(_)?null===(n=Jn.current["".concat(d.split(_)[0]).concat(_).concat(d.split(_)[1])])||void 0===n?void 0:n.current:null===(t=In.current[d])||void 0===t?void 0:t.current,g="string"==typeof v&&v.includes(_)?null===(i=Qn.current["".concat(v.split(_)[0]).concat(_).concat(v.split(_)[1])])||void 0===i?void 0:i.current:null===(o=Zn.current[v])||void 0===o?void 0:o.current;if(h&&g){var x=h.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop,m=g.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop;if(e.currentTarget===f){var y=m-(x-f.scrollTop),b=p.scrollHeight-p.clientHeight,S=Math.max(0,Math.min(y,b));Math.abs(p.scrollTop-S)>1&&(p.scrollTop=S)}else if(e.currentTarget===p){var R=x-(m-p.scrollTop),I=f.scrollHeight-f.clientHeight,C=Math.max(0,Math.min(R,I));Math.abs(f.scrollTop-C)>1&&(f.scrollTop=C)}if(An.current){var B=void 0,w=void 0;if("string"==typeof d&&d.includes(_)){var j=d.split(_),E="".concat(j[0]).concat(_).concat(j[1]);B=null===(r=Jn.current[E])||void 0===r?void 0:r.current,w=null===(l=Qn.current[E])||void 0===l?void 0:l.current}else B=null===(a=Jn.current[d])||void 0===a?void 0:a.current,w=null===(s=Qn.current[v])||void 0===s?void 0:s.current;var F=null!==(u=null===(c=Mn.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==u?u:0,T=f.getBoundingClientRect().top,M=T+f.clientHeight,k=p.getBoundingClientRect().top,A=k+p.clientHeight,D=function(e,n,t){return Math.max(n,Math.min(t,e))};if(B&&w){var O=B.getBoundingClientRect(),H=w.getBoundingClientRect(),N=O.top+O.height/2,L=H.top+H.height/2,W=D(N,T,M),z=D(L,k,A);An.current.setAttribute("y1",(W-F).toString()),An.current.setAttribute("y2",(z-F).toString());var P=N>=T-4&&N<=M+4;An.current.setAttribute("visibility",P?"visible":"hidden")}}}}}ye.current.length>0&&!be.current&&(be.current=!0,requestAnimationFrame(function(){at(),be.current=!1}))}},[at,q,ut]);t.useEffect(function(){var e=setTimeout(ut,250);window.addEventListener("resize",ut);var n=null,t=null;return Le.current&&(n=new ResizeObserver(ut)).observe(Le.current),Mn.current&&(t=new ResizeObserver(ut)).observe(Mn.current),function(){clearTimeout(e),window.removeEventListener("resize",ut),null==n||n.disconnect(),null==t||t.disconnect()}},[en,vn,yn,Kn,an,un,xn,_n,Qe,ut,ne,zn,oe,de]),t.useEffect(function(){Se.current=ne},[ne]),t.useEffect(function(){Re.current=zn},[zn]);var vt=t.useCallback(function(){var e,n,t,i,o=He.sectionIdx,r=He.isOrphan;if($e(),null!=o)if(r)Z("No counterpart exists for this section.");else if(ne&&zn===o)Bn();else{if(!q){var l=Re.current,a=kn.current;if(null!==l)if("string"==typeof l&&l.includes(_)){var s=l.split(_);(c=null===(e=et.current[s[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=Gn.current[l])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==a)if("string"==typeof a&&a.includes(_)){s=a.split(_);(u=null===(t=nt.current[s[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=$n.current[a])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}}ve(new Set),he([]),ye.current=[],$(!0),le.current=!0,Pn(o),Re.current=o,te(!0),Se.current=!0,re(!1),Pe.current&&(Pe.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ve.current&&(Ve.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),requestAnimationFrame(function(){var e,n,t,i,r,l,a,s,c,u,d,v=null,f=null,p=null,h=null,g=null;if("string"==typeof o&&o.includes(_)){var x=o.split(_),m="".concat(x[0]).concat(_).concat(x[1]);v=(null===(e=Jn.current[m])||void 0===e?void 0:e.current)||null,g=(f=(null===(n=Qn.current[m])||void 0===n?void 0:n.current)||null)?o:null,p=(null===(t=et.current[x[2]])||void 0===t?void 0:t.current)||null,h=(null===(i=nt.current[x[3]])||void 0===i?void 0:i.current)||null}else if(v=(null===(r=In.current[o])||void 0===r?void 0:r.current)||null,p=(null===(l=Gn.current[o])||void 0===l?void 0:l.current)||null,q){var y=xn[o],b=(null==y?void 0:y.refIndexes)||[];if(b.length>0){var S=b[0],R=_n.findIndex(function(e){return e.selfIndex===S});-1!==R&&(f=(null===(c=Zn.current[R])||void 0===c?void 0:c.current)||null,h=(null===(u=$n.current[R])||void 0===u?void 0:u.current)||null,g=R)}}else f=(null===(a=Zn.current[o])||void 0===a?void 0:a.current)||null,h=(null===(s=$n.current[o])||void 0===s?void 0:s.current)||null,g=f?o:null;kn.current=g;var I=Ke.current,B=ze.current;if(!v||!I)return le.current=!1,void $(!1);if(!f||!B)return re(!0),st.current(),le.current=!1,void $(!1);if(!q){var w=v.getBoundingClientRect(),j=f.getBoundingClientRect(),E=w.top-j.top;p&&h&&(p.style.paddingTop="0px",h.style.paddingTop="0px",E>0?h.style.paddingTop="".concat(E,"px"):E<0&&(p.style.paddingTop="".concat(Math.abs(E),"px")));var F=v?v.getBoundingClientRect().top:(null==p?void 0:p.getBoundingClientRect().top)||0;return null===(d=Le.current)||void 0===d||d.scrollTo({top:Le.current.scrollTop+F-150,behavior:"smooth"}),re(!0),st.current(),le.current=!1,void $(!1)}var T=v.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,M=f.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(T-I.scrollTop);M<0&&Pe.current&&(Pe.current.style.height="".concat(Math.abs(M),"px"));requestAnimationFrame(function(){var e,n=B.scrollHeight-B.clientHeight;if(M<0)e=0;else{if(M>n){var t=M-n;return qe.current&&(qe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){C(B,M,200,function(){re(!0),st.current(),le.current=!1,$(!1)})})}e=M}C(B,e,200,function(){re(!0),st.current(),le.current=!1,$(!1)})})})}},[$e,He.sectionIdx,ne,zn,xn,_n,ut,Bn]),ft=null!==He.sectionIdx&&de.has(He.sectionIdx),pt=function(t){var r,l,a,c,u,d,v,f=t.section,p=t.idx,g=t.columnKey,x=t.colRef,_=t.mb,m=void 0===_?1:_,b=t.parentNodeId,S=void 0===b?"":b,R=q?!!an["".concat(g,"-").concat(p)]:!!an[String(p)],C=(null===(r=f.displayTitle)||void 0===r||r)&&s.hasValue(f.title),B=(null===(l=f.displayContent)||void 0===l||l)&&s.hasValue(f.content),w=!C&&!B,j={current:1},E=f.title;C||(E=B?"No Title Found":"No Matching Section Found");var F,T=null!==(d=null===(u=null===(c=null===(a=f.evaluationResult)||void 0===a?void 0:a.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===u?void 0:u.label_color)&&void 0!==d?d:I,M=s.generateColorPalette(T).highlightBg,k=[];if(null===(v=f.evaluationResult)||void 0===v?void 0:v.deviations){var A=f.evaluationResult.deviations;for(var D in A){var O=A[D][S];O&&k.push(O)}}return n.jsx(i.Box,e.__assign({ref:x,sx:{mb:m,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!w&&R,onChange:function(){return!w&&function(n,t){var i,o;xe.current=!0,_e.current&&clearTimeout(_e.current),ge.current&&(ge.current.style.opacity="0");var r=null===(i=Gn.current[n])||void 0===i?void 0:i.current,l=null===(o=$n.current[n])||void 0===o?void 0:o.current;r&&(r.style.minHeight="0px"),l&&(l.style.minHeight="0px"),_e.current=setTimeout(function(){xe.current=!1,st.current(),ge.current&&(ge.current.style.opacity="1")},650),sn(function(i){var o=e.__assign({},i),r=q?"".concat(t,"-").concat(n):String(n),l=!i[r];if(!l){var a=String(zn||""),s=zn===n||a.startsWith("".concat(n,"-")),c=!1;de.forEach(function(e){(e===n||String(e).startsWith("".concat(n,"-")))&&(c=!0)}),(s||c)&&(Bn(),ve(new Set),he([]),ye.current=[])}if(!q)return o[String(n)]=l,o;if(o[r]=l,"left"===t)((null==(u=xn[n])?void 0:u.refIndexes)||[]).forEach(function(e){var n=_n.findIndex(function(n){return n.selfIndex===e});-1!==n&&(o["right-".concat(n)]=l)});else{var u,d=null==(u=_n[n])?void 0:u.selfIndex;xn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(d))&&(o["left-".concat(n)]=l)})}return o})}(p,g)},sx:{boxShadow:"none",border:w?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:w?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:w?null:n.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:w?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:C&&n.jsx(i.Tooltip,e.__assign({title:E,placement:"top"},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:w?"#94A3B8":"#19213D",fontWeight:w?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(F=E,F?s.safeStringify(F).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},t):n.jsx(h.default.Fragment,{children:e},t)}):null)}))}))})),!w&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[B&&n.jsx(y,{content:f.content,sxStyles:Me,highlights:k,maintainRelativeOrder:q,highlightBg:M}),(f.subsections||[]).map(function(e,n){return ht({section:e,keyPath:"".concat(p,"-").concat(n),depth:0,columnKey:g,parentNodeId:S,devCounter:j})})]}))]}))}),"".concat(g,"-sec-").concat(p))},ht=function(t){var r,l,a,c,u,d,v,f,p,g,x,b,S,R,C,B=t.section,w=t.keyPath,j=t.depth,E=void 0===j?0:j,F=t.columnKey,T=void 0===F?"left":F,k=t.parentNodeId,A=void 0===k?"":k,D=(null===(r=B.displayTitle)||void 0===r||r)&&s.hasValue(B.title),O=(null===(l=B.displayContent)||void 0===l||l)&&s.hasValue(B.content),H=!D&&!O,N=D?B.title:O?"No Title Found":"No Matching Section Found",L=!!un[w];"left"!==T||et.current[w]||(et.current[w]=h.default.createRef()),"right"!==T||nt.current[w]||(nt.current[w]=h.default.createRef());var W="left"===T?et.current[w]:nt.current[w],z=rt(w),P=w.split("-").map(Number),V=P[0],Y=xn[V],K=_n[V],X=w,U=w;if(q)if("left"===T){var G=null===(a=null==Y?void 0:Y.refIndexes)||void 0===a?void 0:a[0],$=_n.findIndex(function(e){return e.selfIndex===G});-1!==$&&(K=_n[$],U=e.__spreadArray([$],P.slice(1),!0).join("-"))}else{var J=null===(c=null==K?void 0:K.refIndexes)||void 0===c?void 0:c[0],Q=xn.findIndex(function(e){return e.selfIndex===J});-1!==Q&&(Y=xn[Q],X=e.__spreadArray([Q],P.slice(1),!0).join("-"))}var Z,ee="left"===T?Y:K;Z=q&&void 0!==(null==ee?void 0:ee.selfIndex)&&ee.selfIndex>=0?ee.selfIndex+1:V+1;for(var ne=Y,te=K,ie=1;ie<P.length;ie++)(null==ne?void 0:ne.subsections)&&(ne=ne.subsections[P[ie]]),(null==te?void 0:te.subsections)&&(te=te.subsections[P[ie]]);var oe=null===(u=null==M?void 0:M.input_index_map)||void 0===u?void 0:u[0],re=null===(d=null==M?void 0:M.input_index_map)||void 0===d?void 0:d[1],le="left"===T?re:oe,ae=q?!(null===(v=B.refIndexes)||void 0===v?void 0:v.length)||void 0!==B.selfIndex&&B.selfIndex<0:"left"===T?!te:!ne,se=null!==(g=null===(p=null===(f=B.evaluationResult)||void 0===f?void 0:f.evaluation_outputs)||void 0===p?void 0:p.output_value)&&void 0!==g?g:null,ce=B.id,ue=null!==(R=null===(S=null===(b=null===(x=B.evaluationResult)||void 0===x?void 0:x.evaluation_outputs)||void 0===b?void 0:b.metadata)||void 0===S?void 0:S.label_color)&&void 0!==R?R:I,fe=s.generateColorPalette(ue).highlightBg,pe=(null===(C=B.evaluationResult)||void 0===C?void 0:C.deviations)||{},ge=Object.entries(pe).map(function(n){var t=n[0],i=n[1],o="".concat(ce).concat(_).concat(t),r=Rn[o];if(!r)return null;var l=i[A],a=m(l);if(a)l="";else if(!l)return null;var s=i[le],c=ae||m(s),u="".concat(Z,".").concat(r),d="".concat(ce).concat(_).concat(t).concat(_).concat(X).concat(_).concat(U);return"left"!==T||Jn.current[o]||(Jn.current[o]=h.default.createRef()),"right"!==T||Qn.current[o]||(Qn.current[o]=h.default.createRef()),{id:o,actionId:d,label:u,highlight:l,side:T,style:z,score:se,isConnected:de.has(d),isOrphan:c,isMissingClause:a,badgeRef:"left"===T?Jn.current[o]:Qn.current[o],onClick:function(n){n.stopPropagation();var t=e.__assign(e.__assign({},ne||{title:"",content:""}),{title:(null==Y?void 0:Y.title)||(null==ne?void 0:ne.title)||""}),i=e.__assign(e.__assign({},te||{title:"",content:""}),{title:(null==K?void 0:K.title)||(null==te?void 0:te.title)||""});En(n,t,c,i,d,z)}}}).filter(Boolean),xe=ge.some(function(e){return de.has(e.actionId)});if(!(D||O||B.subsections&&0!==B.subsections.length))return null;var _e=function(){var e,n=[];if(null===(e=B.evaluationResult)||void 0===e?void 0:e.deviations){var t=B.evaluationResult.deviations;for(var i in t){var o=t[i][A];o&&n.push(o)}}return n}();return D?n.jsx(i.Box,e.__assign({ref:W,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({width:"100%"},xe&&z&&{borderRadius:"4px",outline:"2px solid ".concat(z.badgeBorder),outlineOffset:"1px"})},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!H&&L,onChange:function(){if(!H){if(L){var n=String(zn||""),t=n.includes(X)||n.includes(U);t||de.forEach(function(e){(String(e).includes(X)||String(e).includes(U))&&(t=!0)}),t&&(Bn(),ve(new Set),he([]),ye.current=[])}dn(function(n){var t;return e.__assign(e.__assign({},n),((t={})[w]=!n[w],t))})}},sx:{mt:0,boxShadow:"none",border:H?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:H?null:n.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:H?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:N||"Untitled Subsection"}))})),!H&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[O&&n.jsx(y,{content:B.content,sxStyles:Me,deviationBadges:ge,maintainRelativeOrder:q,highlightBg:fe,highlights:_e}),(B.subsections||[]).map(function(e,n){return ht({section:e,keyPath:"".concat(w,"-").concat(n),depth:E+1,columnKey:T,parentNodeId:A})})]}))]}))}))}),w):n.jsx(i.Box,e.__assign({ref:W,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!H&&n.jsxs(i.Box,e.__assign({sx:e.__assign({width:"100%"},xe&&z&&{borderRadius:"4px",outline:"2px solid ".concat(z.badgeBorder),outlineOffset:"1px"})},{children:[O&&n.jsx(y,{content:B.content,sxStyles:Me,deviationBadges:ge,maintainRelativeOrder:q,highlightBg:fe,highlights:_e}),(B.subsections||[]).map(function(e,n){return ht({section:e,keyPath:"".concat(w,"-").concat(n),depth:E+1,columnKey:T,parentNodeId:A})})]}))}),w)};return n.jsxs(i.Box,e.__assign({ref:We,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},q?{}:{overflow:"visible"}),{position:"relative"})},{children:[K&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),n.jsx(d.default,{open:He.open,anchorEl:He.anchorEl,sectionTitle:He.sectionTitle,referenceSectionTitle:He.refSectionTitle,onClose:$e,onOpenCognitiveCompare:Fn,onOpenSideBySide:vt,onConnect:Tn,isConnected:ft,isOrphan:He.isOrphan}),Ae.open&&n.jsx(u.default,{open:Ae.open,popupRef:je,position:Be,popupConfig:L,onClose:function(){we(null),De(function(n){return e.__assign(e.__assign({},n),{open:!1})}),ce(null)},markdownStyles:O,sectionTitle:Ae.sectionTitle,referenceSectionTitle:Ae.refSectionTitle,cognitiveData:Ae.cognitiveData,anchorEl:Ae.anchorEl,sectionAnchorEl:Ae.sectionAnchorEl,scrollContainerEl:Le.current,badgeStyle:Ae.badgeStyle,docData:Ae.docData,deviationData:Ae.deviationData}),n.jsx(i.Snackbar,e.__assign({open:!!Q,autoHideDuration:8e3,onClose:function(){return Z(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Z(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Q}))})),(N.isHeaderVisible||N.isToggleVisible)&&n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:N.isHeaderVisible&&n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:T}))})),N.isToggleVisible&&n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center"}},{children:n.jsx(i.FormControlLabel,{control:n.jsx(i.Switch,{checked:!q,onChange:function(e){var n=e.target.checked;X(!0),setTimeout(function(){V(!n),Bn(),ve(new Set),he([]),ye.current=[],setTimeout(function(){X(!1)},400)},50)},color:"primary",size:"small",sx:{width:100,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"3px",transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(75px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:"#5928ED",opacity:1,border:0,"&::before":{content:'"Side by Side"',position:"absolute",left:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px"}}}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:20,height:20},"& .MuiSwitch-track":{borderRadius:13,backgroundColor:"#9e9e9e",opacity:1,position:"relative","&::after":{content:'"Side by Side"',position:"absolute",right:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px",opacity:1,transition:"opacity 0.2s"}},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{"&::after":{opacity:0}}}}),label:"",labelPlacement:"start",sx:{m:0,gap:1}})}))]})),n.jsx(i.Box,e.__assign({ref:Le,onScroll:dt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:q?"hidden":"auto",borderTop:bn&&Sn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},q?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Mn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},q?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:ge,style:{position:"absolute",top:0,left:0,width:Fe.width||"100%",height:Fe.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[Vn&&!ne&&n.jsxs("g",{children:[n.jsx("line",{x1:Vn.x1,y1:Vn.y,x2:Math.max(Vn.x1,(Vn.x1+Vn.x2)/2-70),y2:Vn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(Vn.x2,(Vn.x1+Vn.x2)/2+70),y1:Vn.y,x2:Vn.x2,y2:Vn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Nn.map(function(t){var l,a=t.x1+.5*(t.x2-t.x1),s=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;var c=!1;if(t.isSubSection)c=ne&&zn===t.subSectionKeyPath&&oe;else{var u=xn[t.sectionIdx];(q?!(null===(l=null==u?void 0:u.refIndexes)||void 0===l?void 0:l.length)||(null==u?void 0:u.selfIndex)<0:!_n[t.sectionIdx])||(c=ne&&zn===t.sectionIdx&&oe)}if(c)return n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:An,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id);if(!q){var d=t.isSubSection?b(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2);return n.jsxs("g",{children:[n.jsx("path",{d:d,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:a-100,y:s-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(n){if(n.stopPropagation(),Ae.open&&se===t.id)Ge();else{var i=xn[t.sectionIdx]||{title:"",content:""},o=_n[t.sectionIdx]||{title:"",content:""};if(t.isSubSection&&t.subSectionKeyPath){for(var r=t.subSectionKeyPath.split(_)[2].split("-").map(Number),l=xn[r[0]],a=_n[r[0]],s=(null==l?void 0:l.title)||"",c=(null==a?void 0:a.title)||"",u=1;u<r.length;u++)(null==l?void 0:l.subsections)&&(l=l.subsections[r[u]]),(null==a?void 0:a.subsections)&&(a=a.subsections[r[u]]);l&&(i=e.__assign(e.__assign({},l),{title:s||l.title})),a&&(o=e.__assign(e.__assign({},a),{title:c||a.title}))}ce(t.id),jn(wn(n.currentTarget,i,o,t.sectionIdx,t.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[0===t.style.label?"Same":t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:Ae.open&&se===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),pe.map(function(t){var i,o=t.pathD,r=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),a="".concat(t.id,"-bg"),s="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:r})}))}))}),n.jsx("path",{ref:function(e){me.current[a]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){me.current[s]=e},d:o,fill:"none",stroke:r,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},q?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Dn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:hn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:hn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ke,onScroll:dt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},q?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Ve,style:{width:"100%",height:"0px",flexShrink:0}}),mn&&xn.map(function(t,r){var l,a,s=!t.title&&!t.content;if(q&&s)return null;var c=t,u=ot(r),d=q?!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)||c.selfIndex<0:!_n[r],v=q?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:r+1,f=de.has(r),p=function(e,n){var t,i,o,r,l,a;if(!e)return n;var s=null!==(a=null!==(r=null!==(i=null===(t=e.evaluation_output)||void 0===t?void 0:t.output_score)&&void 0!==i?i:null===(o=e.evaluation_outputs)||void 0===o?void 0:o.output_score)&&void 0!==r?r:null===(l=e.evaluation_outputs)||void 0===l?void 0:l.output_value)&&void 0!==a?a:e.output_score;return null!=s?s:n}(c.evaluationResult,null==u?void 0:u.deviationLabel);return n.jsx(i.Box,e.__assign({ref:Cn(r),sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Gn.current[r],sx:e.__assign({width:"100%",display:"flex"},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==u?void 0:u.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:pt({section:t,idx:r,columnKey:"left",colRef:h.default.createRef(),mb:0,parentNodeId:(null===(a=null==M?void 0:M.input_index_map)||void 0===a?void 0:a[0])||""})})),q&&u&&n.jsxs(i.Box,e.__assign({ref:Jn.current[r],onClick:function(e){var n=q?_n.find(function(e){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:_n[r]||{title:"",content:""};En(e,t,d,n,r,u)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:u.badgeBg,color:u.badgeText,border:"1px solid ".concat(u.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==v&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(u.badgeBorder)}},{children:v})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:d?"No Deviation Found":"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p)})),n.jsx(o.EllipsisVertical,{size:11,color:u.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),0,"% Similarity",n.jsx(o.ChevronDown,{size:11})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},q?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[G&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:On,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:gn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:gn}))}))})),n.jsxs(i.Box,e.__assign({ref:ze,onScroll:dt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},q?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-25px",pl:"45px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Pe,style:{width:"100%",height:"0px",flexShrink:0}}),mn&&_n.map(function(t,o){var r,l=t,a=[],s=!1,c=null;if(q){a=xn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var u=xn.findIndex(function(e,n){var t;return de.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(s=-1!==u)&&(c=ot(u))}else a=[o+1],(s=de.has(o))&&(c=ot(o));return n.jsx(i.Box,e.__assign({ref:Zn.current[o],sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:$n.current[o],sx:e.__assign({width:"100%",display:"flex"},s&&c&&{borderRadius:"6px",outline:"2px solid ".concat(c.badgeBorder),outlineOffset:"1px"})},{children:pt({section:t,idx:o,columnKey:"right",colRef:h.default.createRef(),mb:0,parentNodeId:(null===(r=null==M?void 0:M.input_index_map)||void 0===r?void 0:r[1])||""})})),q&&!G&&n.jsx(i.Box,e.__assign({ref:Qn.current[o],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:"#EEF2FF",color:"#3730A3",border:"1px solid #C7D2FE",borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:a.length>0?a.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map