@viswa-test/test-citation 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +2 -0
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConfig.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/MoreFunctionsPopup.js +2 -0
- package/dist/cjs/features/CognitiveCompare/MoreFunctionsPopup.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/ResizableSplitPane.js +2 -0
- package/dist/cjs/features/CognitiveCompare/ResizableSplitPane.js.map +1 -0
- package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +2 -0
- package/dist/features/CognitiveCompare/CitationAnchor.js.map +1 -0
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConfig.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/MoreFunctionsPopup.js +2 -0
- package/dist/features/CognitiveCompare/MoreFunctionsPopup.js.map +1 -0
- package/dist/features/CognitiveCompare/ResizableSplitPane.js +2 -0
- package/dist/features/CognitiveCompare/ResizableSplitPane.js.map +1 -0
- package/dist/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +1 -0
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts +27 -0
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareConfig.d.ts +23 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareConfig.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +44 -2
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +4 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitivePopup.d.ts +4 -2
- package/dist/types/src/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/MoreFunctionsPopup.d.ts +13 -0
- package/dist/types/src/features/CognitiveCompare/MoreFunctionsPopup.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/ResizableSplitPane.d.ts +8 -0
- package/dist/types/src/features/CognitiveCompare/ResizableSplitPane.d.ts.map +1 -0
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts +3 -2
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfStyle.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts +3 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts +5 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("lucide-react"),l=require("react"),t=require("./ResizableSplitPane.js"),o=require("../PdfViewer/PdfViewer.js");exports.default=function(r){var a,u,d,s=r.href,c=r.children,g=r.metaData,v=r.chevronUpComponent,h=void 0===v?null:v,p=r.chevronDownComponent,f=void 0===p?null:p,m=r.customStyle,_=void 0===m?{}:m,x=r.defaultState,j=void 0!==x&&x,b=l.useState(j),w=b[0],y=b[1],P="string"==typeof c&&(null===(a=null==c?void 0:c.split("\n"))||void 0===a?void 0:a.length)>1?c.split("\n").join(" "):c,C=null!=h?h:function(e){var l,t;return n.jsx(i.ChevronUp,{size:null!==(l=null==e?void 0:e.fontSize)&&void 0!==l?l:16,color:null!==(t=null==e?void 0:e.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(u=null==_?void 0:_.arrow)&&void 0!==u?u:{}),S=null!=f?f:function(e){var l,t;return n.jsx(i.ChevronDown,{size:null!==(l=null==e?void 0:e.fontSize)&&void 0!==l?l:16,color:null!==(t=null==e?void 0:e.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(d=null==_?void 0:_.arrow)&&void 0!==d?d:{}),D=["contract","clause"];return n.jsxs("span",e.__assign({style:e.__assign({display:"inline"},_.relativeWrapper||{})},{children:[n.jsx("div",e.__assign({style:e.__assign({display:"inline",marginTop:0},_.citationButtonWrapper||{})},{children:n.jsxs("button",e.__assign({type:"button",onClick:function(){return y(function(e){return!e})},style:e.__assign({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},_.citationButton||{})},{children:[n.jsx("span",{children:P}),n.jsx("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:w?C:S}))]}))})),w&&n.jsx(n.Fragment,{children:n.jsx(function(){var e,i,l,r,a,u,d;console.log("citation details",s,c,g,P);var v=function(e){try{return new URL(e,window.location.origin).searchParams.get("citationNumber")}catch(e){return null}}(s);if(!v)return null;var h=(null===(e=null==g?void 0:g.citations)||void 0===e?void 0:e[v])||{},p=(null===(i=null==g?void 0:g.docData)||void 0===i?void 0:i.documents)||{},f=(null===(l=null==g?void 0:g.docData)||void 0===l?void 0:l.input_index_map)||{},m=null==f?void 0:f[0],_=null==f?void 0:f[1],x=m?p[m]:null,j=_?p[_]:null,b=m?h[m]:null,w=_?h[_]:null;if(D.includes(P[0])){console.log("leftDocument",x,"rightDocument",j);var y=b?n.jsx(o.default,{defaultScale:"PageWidth",showHighlightsAction:!1,pdfName:x.title,pdfUrl:x.signed_url,highlightText:[null!==(r=null==b?void 0:b.highlighted_text)&&void 0!==r?r:""],highlightPages:{1:null===(a=null==b?void 0:b.custom_metadata)||void 0===a?void 0:a.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,C=w?n.jsx(o.default,{defaultScale:"PageWidth",showHighlightsAction:!1,pdfName:j.title,pdfUrl:j.signed_url,jumpToPageValue:1,highlightText:[null!==(u=null==w?void 0:w.highlighted_text)&&void 0!==u?u:""],highlightPages:{1:null===(d=null==w?void 0:w.custom_metadata)||void 0===d?void 0:d.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null;return n.jsx("div",{children:n.jsx(t.default,{leftComponent:y,rightComponent:C})})}return n.jsx(n.Fragment,{children:"HEllo issue here"})},{})})]}))};
|
|
2
|
+
//# sourceMappingURL=CitationAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationAnchor.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("react-markdown"),s=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),c=require("./CognitivePopup.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(i),g=u(l),h={id:"",title:""};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(l){var u,v,x,f,p,_,m,y,F=l.componentHeaderText,S=void 0===F?"Learning Comparison":F,E=l.treeData,b=l.comparisonConfig,w=l.leftColumnTitleText,C=l.rightColumnTitleText,j=l.markdownStyles,R=i.useState(null),A=R[0],D=R[1],I=i.useMemo(function(){return(null==E?void 0:E.cognitive_decisioning)||{}},[E]);i.useRef(null);var B=i.useState(null),T=B[0],M=B[1],O=i.useRef(null),k=i.useState({width:0,height:0}),N=k[0],L=k[1],z=i.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),j)},[j]),H=i.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null}),W=H[0],P=H[1],q=i.useRef(null),U=i.useRef(null),G=i.useRef(!1),V=i.useRef(null);i.useEffect(function(){V.current=null},[W.sectionIdx,W.open]);var K=i.useCallback(function(){var e;if(W.anchorEl&&W.refSectionTitle){var n=W.anchorEl.getBoundingClientRect(),i=(null===(e=null==O?void 0:O.current)||void 0===e?void 0:e.offsetHeight)||0,t=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<i&&r>o;null!==V.current?!0===V.current&&(l=r>=i||r>=o):l=!(o>=i||o>=r),V.current=l;var s=l?r:o,a=Math.min(i||9999,s),c=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,d=u-t/2,g=Math.max(12,Math.min(d,window.innerWidth-t-12)),h=Math.max(14,Math.min(u-g,t-10-4));M({top:c,left:g,arrowLeft:h,openAbove:l,maxHeight:s})}},[W.anchorEl,W.refSectionTitle]);i.useEffect(function(){if(W.open){window.addEventListener("resize",K);var e=requestAnimationFrame(K),n=null;return O.current&&(n=new ResizeObserver(function(){e=requestAnimationFrame(K)})).observe(O.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",K),n&&n.disconnect()}}},[W.open,K]),i.useEffect(function(){var n=q.current;if(n&&W.open){var i=function(n){O.current&&O.current.contains(n.target)||(console.log("Scroll event detected on:",n.target,"- closing CognitivePopup"),M(null),P(function(n){return e.__assign(e.__assign({},n),{open:!1,anchorEl:null,sectionAnchorEl:null})}))};return n.addEventListener("scroll",i,{capture:!0}),window.addEventListener("scroll",i,{capture:!0}),function(){n.removeEventListener("scroll",i,{capture:!0}),window.removeEventListener("scroll",i,{capture:!0})}}},[W.open]);var Y=i.useMemo(function(){var n,i,t,o,r,l,s,c,u,d,g,h;return{fields:null!==(n=null==b?void 0:b.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(i=null==b?void 0:b.thresholds)||void 0===i?void 0:i.high)&&void 0!==t?t:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(r=null===(o=null==b?void 0:b.thresholds)||void 0===o?void 0:o.medium)&&void 0!==r?r:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==b?void 0:b.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:a.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(c=null==b?void 0:b.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==b?void 0:b.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==b?void 0:b.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(g=null==b?void 0:b.relationStyles)||void 0===g?void 0:g.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(h=null==b?void 0:b.relationStyles)||void 0===h?void 0:h.low)||{})}}},[b]),J=i.useMemo(function(){if(E&&Object.keys(E).length>0)try{var n=function(n){var i,t,o,r,l=[],a=[],c=n.base_root_id,u=n.input_index_map||{0:"left",1:"right"},d=n[c];if(!d||!1===d.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var g=function(i){var t=n[i];if(t&&!1!==t.display_node){var o=s.getRationale(t),r=s.getSideData(t,"0",u),c=s.getSideData(t,"1",u),d=r.title.trim()||r.content.trim(),h=c.title.trim()||c.content.trim();l.push(e.__assign({id:i,title:d?r.title:"",content:d?r.content:"",subsections:[]},d?o:{score:void 0,relation:"not_defined"})),a.push(e.__assign({id:i,title:h?c.title:"",content:h?c.content:"",subsections:[]},h?o:{score:void 0,relation:"not_defined"})),t.next&&Object.values(t.next).forEach(g)}};return d.next&&Object.values(d.next).forEach(g),{activeProposed:{title:(null===(t=null===(i=d.comparison_inputs)||void 0===i?void 0:i[u[0]])||void 0===t?void 0:t.title)||"Uploaded Contract",description:d.decision_scope_description||"",sections:l},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(o=d.comparison_inputs)||void 0===o?void 0:o[u[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:a,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:d.decision_scope_description||""},fields:{}}}}]}}(E);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"}},[E]),Q=J.activeProposed,X=J.activeVariants,Z=J.parseError;i.useEffect(function(){Z&&D("Failed to load comparison: ".concat(Z))},[Z]);var $=i.useState(null),ee=$[0];$[1];var ne=i.useState({}),ie=ne[0],te=ne[1],oe=X[0]||h,re=null===(x=null===(u=null==E?void 0:E.documents)||void 0===u?void 0:u[null===(v=null==E?void 0:E.input_index_map)||void 0===v?void 0:v[0]])||void 0===x?void 0:x.title,le=null===(_=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[1]])||void 0===_?void 0:_.title,se=s.safeStringify(w||re||"Uploaded Contract"),ae=s.safeStringify(C||le||"Reference Template"),ce=i.useMemo(function(){return Q.sections||[]},[Q.sections]),ue=i.useMemo(function(){return oe.sections||[]},[oe.sections]),de=ce.length>0||ue.length>0,ge=oe.analysis,he=s.safeStringify(null===(y=null===(m=null==ge?void 0:ge.rule_difference_comparison)||void 0===m?void 0:m.summary)||void 0===y?void 0:y.overall_summary),ve=!!he.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),xe=i.useRef({}),fe=function(e){return xe.current[e]||(xe.current[e]=d.default.createRef()),xe.current[e]},pe=i.useRef(null),_e=i.useRef(null),me=i.useRef(null),ye=i.useState([]),Fe=ye[0],Se=ye[1],Ee=i.useState(null),be=Ee[0],we=Ee[1],Ce=i.useMemo(function(){return Y.fields.filter(function(e){var n=e.key;return(!de||"description"!==n)&&(s.hasValue(Q[n])||s.hasValue(oe[n]))})},[Q,oe,de,Y.fields]),je=i.useRef({}),Re=i.useRef({}),Ae=i.useRef({}),De=i.useRef({});Ce.forEach(function(e){var n=e.key;je.current[n]||(je.current[n]=d.default.createRef()),Re.current[n]||(Re.current[n]=d.default.createRef())});for(var Ie=0;Ie<Math.max(ce.length,ue.length);Ie+=1)Ae.current[Ie]||(Ae.current[Ie]=d.default.createRef()),De.current[Ie]||(De.current[Ie]=d.default.createRef());i.useEffect(function(){if(ee){var e=Y.fields.find(function(e){return e.analysisKey===ee||e.key===ee});if(e){var n=je.current[e.key]||Re.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[ee,Y.fields]);var Be=i.useCallback(function(e){var n,i,t,o,r,l,s,a,c,u=null===(n=null==ge?void 0:ge.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],g=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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 h=d.mappings[0]||{};return{score:d.score,relation:h.relation||"",highlightsA:(null===(l=h.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=h.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!g}}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:!!g}},[ge]),Te=i.useCallback(function(n){var i,t,o=ce[n],r=ue[n],l=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,a=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,c=!(!(null==o?void 0:o.cognitiveData)&&!(null==r?void 0:r.cognitiveData));if(!l&&!a&&!c)return e.__assign(e.__assign({},Y.relationStyles.noContent),{label:"Not Defined"});var u=Be("description");if(null!=(null!==(i=null==o?void 0:o.cognitiveRelevanceScore)&&void 0!==i?i:null==r?void 0:r.cognitiveRelevanceScore)){var d=s.cognitiveScoreToRelation(),g=d.score,h=d.relation;return s.getStyleForRelation(g,h,!0,Y)}var v=l?o.relation:a?r.relation:u.relation,x=null!==(t=null==o?void 0:o.score)&&void 0!==t?t:null==r?void 0:r.score,f="number"==typeof x?x:u.score;return s.getStyleForRelation(f,v,!0,Y)},[ce,ue,Y,Be]),Me=i.useCallback(function(){var e,n,i,t,o,r,l,a,c,u,d;if(!G.current){G.current=!0;try{if(!pe.current)return;var g=pe.current.getBoundingClientRect();L({width:g.width,height:g.height});var h=[];Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")});for(var v=0;v<Math.min(ce.length,ue.length);v++){var x=null===(e=Ae.current[v])||void 0===e?void 0:e.current,f=null===(n=De.current[v])||void 0===n?void 0:n.current;x&&f&&(x.style.height="auto",f.style.height="auto",x.style.minHeight="0px",f.style.minHeight="0px")}var p={};Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(o&&r){var l=o.getBoundingClientRect(),s=r.getBoundingClientRect();p[t]=Math.max(l.height,s.height)}});var _=[];for(v=0;v<Math.min(ce.length,ue.length);v++){x=null===(i=Ae.current[v])||void 0===i?void 0:i.current,f=null===(t=De.current[v])||void 0===t?void 0:t.current;if(x&&f){var m=x.getBoundingClientRect(),y=f.getBoundingClientRect();_[v]=Math.max(m.height,y.height)}}Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(o&&r){var l=p[t];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}});for(v=0;v<_.length;v++){x=null===(o=Ae.current[v])||void 0===o?void 0:o.current,f=null===(r=De.current[v])||void 0===r?void 0:r.current;if(x&&f){var F=_[v];x.style.minHeight="".concat(F,"px"),f.style.minHeight="".concat(F,"px")}}Ce.forEach(function(e){var n,i,t=e.key,o=e.analysisKey,r=null===(n=je.current[t])||void 0===n?void 0:n.current,l=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(r&&l){var a=r.getBoundingClientRect(),c=l.getBoundingClientRect(),u=Be(o),d=s.getStyleForRelation(u.score,u.relation,u.hasContent,Y);if(!d)return;var v=a.top+a.height/2-g.top;h.push({id:"field-".concat(t),x1:a.right-g.left,y1:v,x2:c.left-g.left,y2:v,style:d})}});for(v=0;v<Math.min(ce.length,ue.length);v++){var S=null===(l=Ae.current[v])||void 0===l?void 0:l.current,E=null===(a=De.current[v])||void 0===a?void 0:a.current;if(S&&E){var b=S.querySelector(".MuiAccordionSummary-root"),w=E.querySelector(".MuiAccordionSummary-root");if(b&&w){var C=b.getBoundingClientRect(),j=w.getBoundingClientRect(),R=(C.top+C.height/2-g.top+j.top+j.height/2-g.top)/2,A=(null===(c=ue[v])||void 0===c?void 0:c.id)||"sec-".concat(v),D=Te(v);D&&h.push({id:A,x1:C.right-g.left,y1:R,x2:j.left-g.left,y2:R,style:D,sectionIdx:v,hasCognitive:!(!(null===(u=ce[v])||void 0===u?void 0:u.cognitiveData)&&!(null===(d=ue[v])||void 0===d?void 0:d.cognitiveData))})}}}if(Se(h),_e.current&&me.current){var I=_e.current.getBoundingClientRect(),B=me.current.getBoundingClientRect(),T=(I.top+I.height/2-g.top+B.top+B.height/2-g.top)/2;we({x1:I.right-g.left,x2:B.left-g.left,y:T})}else we(null)}catch(e){console.error("Line render safe fail: ",e)}finally{G.current=!1}}},[Ce,ce,ue,Y,Be,Te]),Oe=i.useCallback(function(){window.requestAnimationFrame(Me)},[Me]);i.useEffect(function(){var e=setTimeout(Oe,250);window.addEventListener("resize",Oe);var n=null,i=null;return q.current&&(n=new ResizeObserver(Oe)).observe(q.current),pe.current&&(i=new ResizeObserver(Oe)).observe(pe.current),function(){clearTimeout(e),window.removeEventListener("resize",Oe),null==n||n.disconnect(),null==i||i.disconnect()}},[Q,oe,ge,Ce,ie,ce,ue,Y,Oe]);var ke=function(i,r,l,a){var c,u=!s.hasValue(i.title)&&!s.hasValue(i.content);return n.jsx(t.Box,e.__assign({ref:a,sx:{mb:1,minHeight:0,display:"flex",flexDirection:"column"}},{children:n.jsxs(t.Accordion,e.__assign({disableGutters:!0,expanded:!u&&!!ie[r],onChange:function(){return!u&&(n=r,void te(function(i){var t;return e.__assign(e.__assign({},i),((t={})[n]=!i[n],t))}));var n},sx:{boxShadow:"none",border:u?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:u?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[n.jsx(t.AccordionSummary,e.__assign({expandIcon:u?null:n.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:u?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:n.jsx(t.Tooltip,e.__assign({title:i.title||"No Matching Section Found",placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"12px",color:u?"#94A3B8":"#19213D",fontWeight:u?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(c=i.title||"No Matching Section Found",c?s.safeStringify(c).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(d.default.Fragment,{children:e},i)}):null)}))}))})),!u&&n.jsxs(t.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[n.jsx(t.Typography,e.__assign({component:"div",sx:z},{children:n.jsx(g.default,{children:s.safeStringify(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(i,o){return n.jsx(t.Box,e.__assign({sx:{mt:1,pt:1,borderTop:"1px solid #EEF2F7"}},{children:n.jsx(t.Typography,e.__assign({component:"div",sx:z},{children:n.jsx(g.default,{children:s.safeStringify(i).replace(/\\n/g,"\n")})}))}),"".concat(l,"-sub-").concat(r,"-").concat(o))})]}))]}))}),"".concat(l,"-sec-").concat(r))};return n.jsxs(t.Box,e.__assign({ref:U,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[W.open&&n.jsx(c.default,{open:W.open,popupRef:O,position:T,onClose:function(){M(null),P(function(n){return e.__assign(e.__assign({},n),{open:!1})})},markdownStyles:j,sectionTitle:W.sectionTitle,referenceSectionTitle:W.refSectionTitle,cognitiveData:W.cognitiveData,anchorEl:W.anchorEl,sectionAnchorEl:W.sectionAnchorEl,scrollContainerEl:q.current,badgeStyle:W.badgeStyle}),n.jsx(t.Snackbar,e.__assign({open:!!A,autoHideDuration:8e3,onClose:function(){return D(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return D(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:A}))})),n.jsx(t.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:S}))}))})),n.jsx(t.Box,e.__assign({ref:q,sx:{flex:1,overflowY:"auto",minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:he&&ve?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:n.jsxs(t.Box,e.__assign({ref:pe,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0}},{children:[n.jsxs("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:N.width||"100%",height:N.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[be&&n.jsxs("g",{children:[n.jsx("line",{x1:be.x1,y1:be.y,x2:Math.max(be.x1,(be.x1+be.x2)/2-70),y2:be.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(be.x2,(be.x1+be.x2)/2+70),y1:be.y,x2:be.x2,y2:be.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Fe.map(function(i,l){var a=(i.x1+i.x2)/2;return"Not Defined"!==i.style.label||i.hasCognitive?n.jsxs("g",{children:[n.jsx("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder,strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:a-75,y:i.y1-14,width:"150",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(t.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n.jsxs(t.Box,e.__assign({onClick:function(n){if(n.stopPropagation(),W.open&&W.sectionIdx===i.sectionIdx)return M(null),void P(function(n){return e.__assign(e.__assign({},n),{open:!1})});!function(e,n,i,t,o){var r,l;e.stopPropagation(),M(null);var a=s.safeStringify(n.id)||s.safeStringify(i.id)||"",c=(a?I[a]:null)||n.cognitiveData||i.cognitiveData||null,u=null!==(l=null===(r=xe.current[t])||void 0===r?void 0:r.current)&&void 0!==l?l:null;P({open:!0,sectionTitle:n.title||"N/A",refSectionTitle:i.title||"NA",cognitiveData:c,anchorEl:e.currentTarget,sectionAnchorEl:u,badgeStyle:o||null,sectionIdx:t})}(n,ce[i.sectionIdx]||{title:"",content:""},ue[i.sectionIdx]||{title:"",content:""},i.sectionIdx,i.style)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",cursor:"pointer",verticalAlign:"middle"}},{children:[i.hasCognitive&&void 0!==i.sectionIdx&&n.jsx(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",color:i.style.badgeText}},{children:n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(r.ButtonCognitiveIcon,{})}))})),W.open&&W.sectionIdx===i.sectionIdx?n.jsx(o.ChevronUp,{size:12,color:i.style.badgeText}):n.jsx(o.ChevronDown,{size:12,color:i.style.badgeText})]}))]}))}))}))]},l):null})]})),n.jsxs(t.Box,e.__assign({sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(t.Box,e.__assign({ref:_e,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center",overflow:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:se,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:se}))}))})),n.jsx(t.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:de&&ce.map(function(e,n){return{section:e,idx:n}}).map(function(i){var o=i.section,r=i.idx;return n.jsx(t.Box,e.__assign({ref:fe(r)},{children:ke(o,r,"left",Ae.current[r]||d.default.createRef())}),"left-row-".concat(r))})}))]})),n.jsx(t.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.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(t.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(t.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(t.Box,e.__assign({ref:me,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center",overflow:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:ae,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:ae}))}))})),n.jsx(t.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:de&&ue.map(function(e,n){return{section:e,idx:n}}).map(function(e){var n=e.section,i=e.idx;return ke(n,i,"right",De.current[i]||d.default.createRef())})}))]}))]}))}))}))]}))};
|
|
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("react-markdown"),s=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),c=require("./CognitivePopup.js"),u=require("./MoreFunctionsPopup.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(t),x=d(l),h={id:"",title:""},p={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null},g=function(e,n,t,i){void 0===t&&(t=300);var r=e.style.scrollBehavior;e.style.scrollBehavior="auto";var o=e.scrollTop,l=n-o,s=null,a=function(c){null===s&&(s=c);var u,d=c-s;d<t?(e.scrollTop=(u=d,u/=t,l*(--u*u*u+1)+o),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=r,i&&i())};requestAnimationFrame(a)};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(l){var d,v,_,m,y,b,S,F,w=l.componentHeaderText,E=void 0===w?"Learning Comparison":w,I=l.treeData,j=l.comparisonConfig,C=l.leftColumnTitleText,R=l.rightColumnTitleText,B=l.markdownStyles,T=l.maintainRelativeOrder,A=void 0!==T&&T,D=l.popupConfig,k=t.useState(A),M=k[0],O=k[1],N=t.useState(null),H=N[0],L=N[1],z=t.useState(!1),W=z[0],q=z[1],P=t.useState(!1),U=P[0],V=P[1],G=t.useRef(!1),Y=t.useMemo(function(){return(null==I?void 0:I.cognitive_decisioning)||{}},[I]),X=t.useState(null),K=X[0],J=X[1],Q=t.useRef(null),Z=t.useState({width:0,height:0}),$=Z[0],ee=Z[1],ne=t.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),B)},[B]),te=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),ie=te[0],re=te[1],oe=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),le=oe[0],se=oe[1],ae=t.useRef(null),ce=t.useRef(null),ue=t.useRef(null),de=t.useRef(null),fe=t.useRef(null),xe=t.useRef(!1),he=t.useRef(null);t.useEffect(function(){he.current=null},[ie.sectionIdx,ie.open]);var pe=t.useCallback(function(){J(null),re(p)},[]),ge=t.useCallback(function(){se(p)},[]),ve=t.useCallback(function(){var e;if(ie.anchorEl&&ie.refSectionTitle){var n=ie.anchorEl.getBoundingClientRect(),t=(null===(e=null==Q?void 0:Q.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!==he.current?!0===he.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),he.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,f=Math.max(12,Math.min(d,window.innerWidth-i-12)),x=Math.max(14,Math.min(u-f,i-10-4));J({top:c,left:f,arrowLeft:x,openAbove:l,maxHeight:s})}},[ie.anchorEl,ie.refSectionTitle]);t.useEffect(function(){if(ie.open){window.addEventListener("resize",ve);var e=requestAnimationFrame(ve),n=null;return Q.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(ve)})).observe(Q.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",ve),n&&n.disconnect()}}},[ie.open,ve]),t.useEffect(function(){var e=ae.current;if(e&&ie.open){var n=function(e){Q.current&&Q.current.contains(e.target)||(J(null),pe())};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})}}},[ie.open,pe]),t.useEffect(function(){var e=ae.current;if(e&&le.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})}}},[le.open,ge]);var _e=t.useMemo(function(){var n,t,i,r,o,l,s,c,u,d,f,x;return{fields:null!==(n=null==j?void 0:j.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(t=null==j?void 0:j.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(r=null==j?void 0:j.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==j?void 0:j.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:a.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(c=null==j?void 0:j.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==j?void 0:j.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==j?void 0:j.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(f=null==j?void 0:j.relationStyles)||void 0===f?void 0:f.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(x=null==j?void 0:j.relationStyles)||void 0===x?void 0:x.low)||{})}}},[j]),me=t.useMemo(function(){if(I&&Object.keys(I).length>0)try{var n=function(n,t){var i,r,o,l,a,c,u,d;void 0===t&&(t=!1);var f=[],x=[],h=n.base_root_id,p=n.input_index_map||{0:"left",1:"right"},g=n[h];if(!g||!1===g.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var v=function(t,i){var r=n[t];if(!r)return null;var o=s.getSideData(r,i,p),l=!!o.title.trim(),a=!!o.content.trim(),c=s.getRationale(r),u=[];r.next&&Object.values(r.next).forEach(function(e){if(n[e]){var t=v(e,i);t&&u.push(t)}});var d=!(!l&&!a);return e.__assign({id:t,title:l?o.title:"",content:a?o.content:"",subsections:u},d?c:{score:void 0,relation:"not_defined"})};if(t){var _={},m={},y=-1,b=-1;for(var S in n)if(!["base_root_id","documents","input_index_map",h].includes(S)){var F=n[S];if(F&&!1!==F.display_node){var w=s.getRationale(F),E=s.getSideData(F,"0",p),I=s.getSideData(F,"1",p),j=E.title.trim()||E.content.trim(),C=I.title.trim()||I.content.trim(),R=Number(null!==(r=null===(i=E.attributes)||void 0===i?void 0:i.display_index)&&void 0!==r?r:y--),B=Number(null!==(l=null===(o=I.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:b--),T=m[B]||e.__assign(e.__assign({id:S,title:C?I.title:"",content:C?I.content:"",subsections:[]},C?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:B}),A=_[R]||e.__assign(e.__assign({id:S,title:j?E.title:"",content:j?E.content:"",subsections:[]},j?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:R});Number(B)>=0&&Number(R)>=0&&(T.refIndexes.includes(Number(R))||T.refIndexes.push(Number(R)),A.refIndexes.includes(Number(B))||A.refIndexes.push(Number(B))),m[B]=T,_[R]=A}}x=Object.values(m).map(function(e){return e}),f=Object.values(_).map(function(e){return e}),x.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),f.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex})}else g.next&&Object.values(g.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(f.push(v(e,"0")||{id:e,title:"",content:"",subsections:[]}),x.push(v(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(c=null===(a=g.comparison_inputs)||void 0===a?void 0:a[p[0]])||void 0===c?void 0:c.title)||"Uploaded Contract",description:g.decision_scope_description||"",sections:f},activeVariants:[{id:"tree-variant-1",title:(null===(d=null===(u=g.comparison_inputs)||void 0===u?void 0:u[p[1]])||void 0===d?void 0:d.title)||"Reference Template",similarity:0,sections:x,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:g.decision_scope_description||""},fields:{}}}}]}}(I,M);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"}},[I,M]),ye=me.activeProposed,be=me.activeVariants,Se=me.parseError;t.useEffect(function(){Se&&L("Failed to load comparison: ".concat(Se))},[Se]);var Fe=t.useState(null),we=Fe[0];Fe[1];var Ee=t.useState({}),Ie=Ee[0],je=Ee[1],Ce=t.useState({}),Re=Ce[0],Be=Ce[1],Te=(null==be?void 0:be[0])||h,Ae=null===(_=null===(d=null==I?void 0:I.documents)||void 0===d?void 0:d[null===(v=null==I?void 0:I.input_index_map)||void 0===v?void 0:v[0]])||void 0===_?void 0:_.title,De=null===(b=null===(m=null==I?void 0:I.documents)||void 0===m?void 0:m[null===(y=null==I?void 0:I.input_index_map)||void 0===y?void 0:y[1]])||void 0===b?void 0:b.title,ke=s.safeStringify(C||Ae||"Uploaded Contract"),Me=s.safeStringify(R||De||"Reference Template"),Oe=t.useMemo(function(){return(null==ye?void 0:ye.sections)||[]},[null==ye?void 0:ye.sections]),Ne=t.useMemo(function(){return Te.sections||[]},[Te.sections]),He=Oe.length>0||Ne.length>0,Le=Te.analysis,ze=s.safeStringify(null===(F=null===(S=null==Le?void 0:Le.rule_difference_comparison)||void 0===S?void 0:S.summary)||void 0===F?void 0:F.overall_summary),We=!!ze.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),qe=t.useRef({}),Pe=function(e){return qe.current[e]||(qe.current[e]=f.default.createRef()),qe.current[e]},Ue=t.useCallback(function(e,n,t,i,r){var o,l,a=s.safeStringify(n.id)||s.safeStringify(t.id)||"",c=(a?Y[a]:null)||n.cognitiveData||t.cognitiveData||{section_id:a,decisioning:[],gap:[],relevance_score:0},u=null!==(l=null===(o=qe.current[i])||void 0===o?void 0:o.current)&&void 0!==l?l:null;return{open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:c,anchorEl:e,sectionAnchorEl:u,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==I?void 0:I.documents,input_index_map:null==I?void 0:I.input_index_map}}},[Y]),Ve=t.useCallback(function(e){ge(),J(null),re(e)},[ge]),Ge=t.useCallback(function(){null!==le.sectionIdx&&le.anchorEl?Ve(e.__assign(e.__assign({},le),{open:!0})):ge()},[le,ge,Ve]);t.useCallback(function(e){ge(),L("".concat(e," is coming soon."))},[ge]);var Ye=t.useRef(null),Xe=t.useRef(null),Ke=t.useRef(null),Je=t.useState([]),Qe=Je[0],Ze=Je[1],$e=t.useState(null),en=$e[0],nn=$e[1],tn=t.useRef(null),rn=t.useState(null),on=rn[0],ln=rn[1],sn=t.useCallback(function(){null!==tn.current&&window.cancelAnimationFrame(tn.current),tn.current=window.requestAnimationFrame(function(){yn(),tn.current=null})},[]),an=t.useCallback(function(){var e=le.sectionIdx;ge(),null!==e&&(W&&en===e?(q(!1),nn(null),V(!1),de.current&&(de.current.style.height="0px"),fe.current&&(fe.current.style.height="0px")):(G.current=!0,nn(e),q(!0),V(!1),de.current&&(de.current.style.height="0px"),fe.current&&(fe.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i=null===(n=qe.current[e])||void 0===n?void 0:n.current,r=Oe[e],o=(null==r?void 0:r.refIndexes)||[],l=null;if(o.length>0){var s=o[0],a=Ne.findIndex(function(e){return e.selfIndex===s});l=null===(t=gn.current[a])||void 0===t?void 0:t.current}var c=null==i?void 0:i.parentElement,u=ue.current;if(i&&c){var d=c.clientHeight,f=i.offsetTop-(d/2-i.offsetHeight/2),x=c.scrollHeight-d,h=Math.max(0,Math.min(f,x)),p=i.offsetTop-h,v=null;if(l&&u){var _=l.offsetTop-p;if(_<0)de.current&&(de.current.style.height="".concat(Math.abs(_),"px")),v=0;else{var m=u.scrollHeight-u.clientHeight;_>m?(fe.current&&(fe.current.style.height="".concat(_-m+150,"px")),v=_):v=_}}g(c,h,300),u&&null!==v?g(u,v,300,function(){V(!0),sn(),setTimeout(function(){G.current=!1},50)}):setTimeout(function(){V(!0),sn(),G.current=!1},350)}})))},[ge,le.sectionIdx,W,en,Oe,Ne,sn]),cn=t.useMemo(function(){return _e.fields.filter(function(e){var n=e.key;return(!He||"description"!==n)&&(s.hasValue(null==ye?void 0:ye[n])||s.hasValue(Te[n]))})},[ye,Te,He,_e.fields]),un=t.useRef({}),dn=t.useRef({}),fn=t.useRef({}),xn=t.useRef({}),hn=t.useRef({}),pn=t.useRef({}),gn=t.useRef({});cn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Oe.length,Ne.length);t+=1)fn.current[t]||(fn.current[t]=f.default.createRef()),xn.current[t]||(xn.current[t]=f.default.createRef()),hn.current[t]||(hn.current[t]=f.default.createRef()),pn.current[t]||(pn.current[t]=f.default.createRef()),gn.current[t]||(gn.current[t]=f.default.createRef());un.current[n]||(un.current[n]=f.default.createRef()),dn.current[n]||(dn.current[n]=f.default.createRef())});for(var vn=0;vn<Math.max(Oe.length,Ne.length);vn+=1)fn.current[vn]||(fn.current[vn]=f.default.createRef()),xn.current[vn]||(xn.current[vn]=f.default.createRef()),hn.current[vn]||(hn.current[vn]=f.default.createRef()),pn.current[vn]||(pn.current[vn]=f.default.createRef()),gn.current[vn]||(gn.current[vn]=f.default.createRef());t.useEffect(function(){if(we){var e=_e.fields.find(function(e){return e.analysisKey===we||e.key===we});if(e){var n=un.current[e.key]||dn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[we,_e.fields]);var _n=t.useCallback(function(e){var n,t,i,r,o,l,s,a,c,u=null===(n=null==Le?void 0:Le.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],f=(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 x=d.mappings[0]||{};return{score:d.score,relation:x.relation||"",highlightsA:(null===(l=x.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=x.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}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:!!f}},[Le]),mn=t.useCallback(function(n){var t,i,r,o,l=Oe[n],a=Ne[n],c=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,u=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,d=s.safeStringify(null==l?void 0:l.id)||s.safeStringify(null==a?void 0:a.id)||"",f=!(!(null==l?void 0:l.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!c&&!u&&!f)return e.__assign(e.__assign({},_e.relationStyles.noContent),{label:"Not Defined"});var x=_n("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i?i:d?null===(r=Y[d])||void 0===r?void 0:r.relevance_score:void 0)){var h=s.cognitiveScoreToRelation(),p=h.score,g=h.relation;return s.getStyleForRelation(p,g,!0,_e)}var v=c?l.relation:u?a.relation:x.relation,_=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==a?void 0:a.score,m="number"==typeof _?_:x.score;return s.getStyleForRelation(m,v,!0,_e)},[Oe,Ne,Y,_e,_n]),yn=t.useCallback(function(){var e,n,t,i,r,o,l,a,c,u,d;if(!xe.current){xe.current=!0;try{if(!Ye.current)return;var f=Ye.current.getBoundingClientRect();ee({width:f.width,height:f.height});var x=[];if(cn.forEach(function(e){var n,t,i=e.key,r=null===(n=un.current[i])||void 0===n?void 0:n.current,o=null===(t=dn.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")}),!M)for(var h=0;h<Math.min(Oe.length,Ne.length);h++){var p=null===(e=fn.current[h])||void 0===e?void 0:e.current,g=null===(n=xn.current[h])||void 0===n?void 0:n.current;p&&g&&(p.style.height="auto",g.style.height="auto",p.style.minHeight="0px",g.style.minHeight="0px")}var v={};cn.forEach(function(e){var n,t,i=e.key,r=null===(n=un.current[i])||void 0===n?void 0:n.current,o=null===(t=dn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),s=o.getBoundingClientRect();v[i]=Math.max(l.height,s.height)}});var _=[];if(!M)for(h=0;h<Math.min(Oe.length,Ne.length);h++){p=null===(t=fn.current[h])||void 0===t?void 0:t.current,g=null===(i=xn.current[h])||void 0===i?void 0:i.current;if(p&&g){var m=p.getBoundingClientRect(),y=g.getBoundingClientRect();_[h]=Math.max(m.height,y.height)}}if(cn.forEach(function(e){var n,t,i=e.key,r=null===(n=un.current[i])||void 0===n?void 0:n.current,o=null===(t=dn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=v[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),!M)for(h=0;h<_.length;h++){p=null===(r=fn.current[h])||void 0===r?void 0:r.current,g=null===(o=xn.current[h])||void 0===o?void 0:o.current;if(p&&g){var b=_[h];p.style.minHeight="".concat(b,"px"),g.style.minHeight="".concat(b,"px")}}if(cn.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=un.current[i])||void 0===n?void 0:n.current,l=null===(t=dn.current[i])||void 0===t?void 0:t.current;if(o&&l){var a=o.getBoundingClientRect(),c=l.getBoundingClientRect(),u=_n(r),d=s.getStyleForRelation(u.score,u.relation,u.hasContent,_e);if(!d)return;var h=a.top+a.height/2-f.top;x.push({id:"field-".concat(i),x1:a.right-f.left,y1:h,x2:c.left-f.left,y2:h,style:d})}}),M)Oe.forEach(function(e,n){var t;(null===(t=fn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r=Ne.findIndex(function(n){return n.selfIndex===e});if(-1!==r){var o=null===(t=hn.current[n])||void 0===t?void 0:t.current,l=null===(i=pn.current[r])||void 0===i?void 0:i.current;if(o&&l){var s=o.getBoundingClientRect(),a=l.getBoundingClientRect(),c=s.right-f.left,u=a.left-f.left,d=s.top+s.height/2-f.top,h=a.top+a.height/2-f.top;W&&en===n&&(h=d);var p=mn(n);p&&x.push({id:"line-".concat(n,"-").concat(r),x1:c,y1:d,x2:u,y2:h,style:p,sectionIdx:n,targetRightIdx:r})}}})});else for(h=0;h<Math.min(Oe.length,Ne.length);h++){var S=null===(l=fn.current[h])||void 0===l?void 0:l.current,F=null===(a=xn.current[h])||void 0===a?void 0:a.current;if(S&&F){var w=S.querySelector(".MuiAccordionSummary-root"),E=F.querySelector(".MuiAccordionSummary-root");if(w&&E){var I=w.getBoundingClientRect(),j=E.getBoundingClientRect(),C=(I.top+I.height/2-f.top+j.top+j.height/2-f.top)/2,R=(null===(c=Ne[h])||void 0===c?void 0:c.id)||"sec-".concat(h),B=mn(h);B&&x.push({id:R,x1:I.right-f.left,y1:C,x2:j.left-f.left,y2:C,style:B,sectionIdx:h,hasCognitive:!!((null===(u=Oe[h])||void 0===u?void 0:u.cognitiveData)||(null===(d=Ne[h])||void 0===d?void 0:d.cognitiveData)||R&&Y[R])})}}}if(Ze(x),Xe.current&&Ke.current){var T=Xe.current.getBoundingClientRect(),A=Ke.current.getBoundingClientRect(),D=(T.top+T.height/2-f.top+A.top+A.height/2-f.top)/2;ln({x1:T.right-f.left,x2:A.left-f.left,y:D})}else ln(null)}catch(e){console.error("Line render safe fail: ",e)}finally{xe.current=!1}}},[cn,Oe,Ne,Y,_e,_n,mn,M,W,en]),bn=t.useCallback(function(){G.current||(sn(),W&&!G.current&&(q(!1),nn(null),V(!1),de.current&&(de.current.style.height="0px"),fe.current&&(fe.current.style.height="0px")))},[sn,W]);t.useEffect(function(){var e=setTimeout(sn,250);window.addEventListener("resize",sn);var n=null,t=null;return ae.current&&(n=new ResizeObserver(sn)).observe(ae.current),Ye.current&&(t=new ResizeObserver(sn)).observe(Ye.current),function(){clearTimeout(e),window.removeEventListener("resize",sn),null==n||n.disconnect(),null==t||t.disconnect()}},[ye,Te,Le,cn,Ie,Re,Oe,Ne,_e,sn,W,en,U]);var Sn=function(t,o,l,a,c){void 0===c&&(c=1);var u,d=M?!!Ie["".concat(l,"-").concat(o)]:!!Ie[String(o)],h=s.hasValue(t.title),p=s.hasValue(t.content),g=!h&&!p,v=t.title;return h||(v=p?"No Title Found":"No Matching Section Found"),n.jsx(i.Box,e.__assign({ref:a,sx:e.__assign(e.__assign({mb:c},M?{height:"fit-content"}:{minHeight:0}),{display:"flex",flexDirection:"column",position:"relative"})},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!g&&d,onChange:function(){return!g&&function(n,t){je(function(i){var r=e.__assign({},i);if(!M){var o=!!i[String(n)];return r[String(n)]=!o,r}var l="".concat(t,"-").concat(n),s=!i[l];if(r[l]=s,"left"===t)((null==(a=Oe[n])?void 0:a.refIndexes)||[]).forEach(function(e){var n=Ne.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=s)});else{var a,c=null==(a=Ne[n])?void 0:a.selfIndex;Oe.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c))&&(r["left-".concat(n)]=s)})}return r})}(o,l)},sx:{boxShadow:"none",border:g?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:g?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:g?null:n.jsx(r.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:g?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:n.jsx(i.Tooltip,e.__assign({title:v,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:g?"#94A3B8":"#19213D",fontWeight:g?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=v,u?s.safeStringify(u).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(f.default.Fragment,{children:e},t)}):null)}))}))})),!g&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[n.jsx(i.Typography,e.__assign({component:"div",sx:ne},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return Fn(e,"".concat(o,"-").concat(n),0)})]}))]}))}),"".concat(l,"-sec-").concat(o))},Fn=function(t,o,l){void 0===l&&(l=0);var a=s.hasValue(t.title),c=s.hasValue(t.content),u=!a&&!c,d=a?t.title:c?"No Title Found":"No Matching Section Found",f=!!Re[o];return t.title?n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!u&&f,onChange:function(){return!u&&Be(function(n){var t;return e.__assign(e.__assign({},n),((t={})[o]=!n[o],t))})},sx:{mt:1,boxShadow:"none",border:u?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF","&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:u?null:n.jsx(r.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5}}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:600,color:u?"#94A3B8":"#19213D"}},{children:d||"Untitled Subsection"}))})),!u&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1}},{children:[c&&n.jsx(i.Typography,e.__assign({component:"div",sx:ne},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return Fn(e,"".concat(o,"-").concat(n),l+1)})]}))]}),o):n.jsx(i.Box,e.__assign({sx:{mt:0===l?1:.75}},{children:!u&&n.jsxs("div",{children:[c&&n.jsx(i.Typography,e.__assign({component:"div",sx:ne},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return Fn(e,"".concat(o,"-").concat(n),l+1)})]})}),o)};return n.jsxs(i.Box,e.__assign({ref:ce,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},M?{}:{overflow:"visible"}),{position:"relative"})},{children:[M&&n.jsx(u.default,{open:le.open,anchorEl:le.anchorEl,sectionTitle:le.sectionTitle,referenceSectionTitle:le.refSectionTitle,onClose:ge,onOpenCognitiveCompare:Ge,onOpenSideBySide:an}),ie.open&&n.jsx(c.default,{open:ie.open,popupRef:Q,position:K,popupConfig:D,onClose:function(){J(null),re(function(n){return e.__assign(e.__assign({},n),{open:!1})})},markdownStyles:B,sectionTitle:ie.sectionTitle,referenceSectionTitle:ie.refSectionTitle,cognitiveData:ie.cognitiveData,anchorEl:ie.anchorEl,sectionAnchorEl:ie.sectionAnchorEl,scrollContainerEl:ae.current,badgeStyle:ie.badgeStyle,docData:ie.docData}),n.jsx(i.Snackbar,e.__assign({open:!!H,autoHideDuration:8e3,onClose:function(){return L(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return L(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:H}))})),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.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:E}))})),n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center"}},{children:n.jsx(i.FormControlLabel,{control:n.jsx(i.Switch,{checked:M,onChange:function(e){return O(e.target.checked)},color:"primary",size:"small"}),label:n.jsx(i.Typography,e.__assign({sx:{fontSize:"13px",fontWeight:500,color:"#64748B"}},{children:"Relative Order"})),labelPlacement:"start",sx:{m:0,gap:1}})}))]})),n.jsx(i.Box,e.__assign({ref:ae,onScroll:bn,sx:{flex:1,minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:M?"hidden":"auto",borderTop:ze&&We?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},M?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Ye,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},M?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:$.width||"100%",height:$.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[on&&n.jsxs("g",{children:[n.jsx("line",{x1:on.x1,y1:on.y,x2:Math.max(on.x1,(on.x1+on.x2)/2-70),y2:on.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(on.x2,(on.x1+on.x2)/2+70),y1:on.y,x2:on.x2,y2:on.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Qe.map(function(t){var l,s=(t.x1+t.x2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(!M)return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:s-100,y:t.y1-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){var n=Oe[t.sectionIdx]||{title:"",content:""},i=Ne[t.sectionIdx]||{title:"",content:""};Ve(Ue(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:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[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})]}))}))}))]},t.id);var a=Oe[t.sectionIdx];return!(null===(l=null==a?void 0:a.refIndexes)||void 0===l?void 0:l.length)||(null==a?void 0:a.selfIndex)<0?null:W&&en===t.sectionIdx&&U?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",{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):null})]})),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)"},M?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Xe,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:ke,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:ke}))}))})),n.jsx(i.Box,e.__assign({onScroll:bn,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},M?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:He&&Oe.map(function(t,o){var l;if(!M)return n.jsx(i.Box,e.__assign({ref:Pe(o)},{children:Sn(t,o,"left",fn.current[o])}),"left-row-".concat(o));var s=t,a=mn(o),c=!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0,u="number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null;return n.jsx(i.Box,e.__assign({ref:Pe(o),sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:fn.current[o],sx:{width:"100%"}},{children:Sn(t,o,"left",f.default.createRef(),0)})),a&&n.jsxs(i.Box,e.__assign({ref:hn.current[o],onClick:function(e){var n=Ne.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),le.open&&le.sectionIdx===i?ge():(pe(),se(Ue(e.currentTarget,n,t,i,r)))}(e,t,n,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.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!==u&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:u})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:c?"No Deviation Found":0==a.deviationLabel||void 0===a.deviationLabel?"Same":"".concat(a.deviationLabel,"% Deviation")})),n.jsx(r.EllipsisVertical,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))})}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",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},M?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Ke,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:Me,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Me}))}))})),n.jsxs(i.Box,e.__assign({ref:ue,onScroll:bn,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},M?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-160px",pl:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:de,style:{width:"100%",height:"0px",flexShrink:0}}),He&&Ne.map(function(t,r){if(!M)return Sn(t,r,"right",xn.current[r]);var o=t,l=Oe.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(o.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});return n.jsx(i.Box,e.__assign({ref:gn.current[r],sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:xn.current[r],sx:{width:"100%"}},{children:Sn(t,r,"right",f.default.createRef(),0)})),n.jsx(i.Box,e.__assign({ref:pn.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:l.length>0?l.join(", "):"-"}))]}))}),"right-row-".concat(r))}),n.jsx("div",{ref:fe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],i={fields:e,thresholds:{exact:90,high:70,medium:40},relationStyles:{noContent:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F8FAFC",badgeBorder:"#F1F5F9",badgeText:"#64748B",highlightBg:"transparent"},exact:{bg:"#FFF1F2",border:"#FECDD3",badgeBg:"#FFE4E6",badgeBorder:"#FEE2E2",badgeText:"#9F1239",highlightBg:"#FECDD3"},high:{bg:"#FFF5F5",border:"#FECACA",badgeBg:"#FEECEC",badgeBorder:"#F8C2C2",badgeText:"#B42318",highlightBg:"#FDD5D5"},medium:{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3"},low:{bg:"#F5F9FF",border:"#CFE0FF",badgeBg:"#EEF4FF",badgeBorder:"#BFD3FF",badgeText:"#1D4ED8",highlightBg:"#DCEAFF"}}};exports.DEFAULT_COMPARISON_CONFIG=i,exports.DEFAULT_FIELD_CONFIG=e,exports.DEFAULT_POPUP_CONFIG={tabs:{deviation:{key:"deviation",label:"Deviation Analysis",subtitle:"Why this is a deviation?",placeholderTitle:"Deviation Analysis",placeholderBody:"Deviation analysis content will appear here..."},association:{key:"association",label:"Association Logic",subtitle:"Why these sections are paired?"}},decisionStrengthLabel:"Decision Strength",sectionTitles:{decisioningFactors:"Decision Making Factors",gaps:"Gaps in Decision"},emptyStateMessage:"No cognitive decisioning data available for this section.",accentColor:"#5928ED"},exports.SHARED_MARKDOWN_STYLES={fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden","& p":{mt:0,mb:1.5},"& p:last-child":{mb:0},"& ul":{mt:0,mb:1.5,pl:2.5,listStyleType:"disc"},"& ol":{mt:0,mb:1.5,pl:2.5,listStyleType:"decimal"},"& li":{mb:.5},"& strong":{fontWeight:600},"& code":{whiteSpace:"pre-wrap",wordBreak:"break-word"}};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompareConfig.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),n=function(i){return null==i?"":"string"==typeof i?i:Array.isArray(i)?i.map(n).join("\n\n"):"object"==typeof i?JSON.stringify(i):String(i)},e=function(i){return null!=i&&("string"==typeof i?i.trim().length>0:!Array.isArray(i)||i.length>0&&i.some(function(i){return e(i)}))},t=function(i){return i&&"string"==typeof i?"N/A"===i.toUpperCase()?"N/A":i.split("_").map(function(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}).join(" "):"Unknown"};exports.cognitiveScoreToRelation=function(i){return{score:0,relation:"N/A"}},exports.formatRelationToLabel=t,exports.getRationale=function(i){if(!i.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=i.mapping_rationale,e=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:e,citations:n.citations},score:0,relation:"N/A"}},exports.getSideData=function(i,e,t){var s,o=t[e],r=null===(s=null==i?void 0:i.comparison_inputs)||void 0===s?void 0:s[o];return{title:n((null==r?void 0:r.title)||""),content:n((null==r?void 0:r.content)||""),attributes:(null==r?void 0:r.additional_attributes)||null,subsections:(null==r?void 0:r.subsections)||[]}},exports.getStyleForRelation=function(n,e,s,o){var r=100*(n||0),a=o.thresholds,l=o.relationStyles;if(!s)return null;var c=t(e),u=(e||"").toLowerCase();return"n/a"===u||u.includes("no_deviation")?i.__assign(i.__assign({},l.low),{label:c}):u.includes("deviation")||u.includes("high_risk")||u.includes("critical")?i.__assign(i.__assign({},l.high),{label:c}):r>=a.exact?i.__assign(i.__assign({},l.exact),{label:c}):r>=a.high?i.__assign(i.__assign({},l.high),{label:c}):r>=a.medium?i.__assign(i.__assign({},l.medium),{label:c}):i.__assign(i.__assign({},l.low),{label:c})},exports.hasValue=e,exports.safeStringify=n;
|
|
2
2
|
//# sourceMappingURL=CognitiveComparehelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),s=require("lucide-react"),t=require("react-dom"),r=require("../../assests/svg/SparkleIcon.js"),a=require("react-markdown"),l=require("./CitationAnchor.js"),c=require("./CognitiveCompareConfig.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=d(t),p=d(a),g=10;exports.default=function(t){var a,d,h,u,f,b,_=t.open,v=t.onClose,m=t.sectionTitle,y=t.referenceSectionTitle,j=t.cognitiveData,F=t.relevanceScore,w=t.anchorEl,B=t.badgeStyle,E=t.popupRef,C=t.position,S=t.markdownStyles,k=t.docData,D=t.popupConfig,T=e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),S),R=i.useMemo(function(){var o,i;return e.__assign(e.__assign(e.__assign({},c.DEFAULT_POPUP_CONFIG),D),{tabs:{deviation:e.__assign(e.__assign({},c.DEFAULT_POPUP_CONFIG.tabs.deviation),null===(o=null==D?void 0:D.tabs)||void 0===o?void 0:o.deviation),association:e.__assign(e.__assign({},c.DEFAULT_POPUP_CONFIG.tabs.association),null===(i=null==D?void 0:D.tabs)||void 0===i?void 0:i.association)},sectionTitles:e.__assign(e.__assign({},c.DEFAULT_POPUP_CONFIG.sectionTitles),null==D?void 0:D.sectionTitles)})},[D]),z=null==j?void 0:j.isMissingRationale,A=i.useState(z?R.tabs.deviation.key:R.tabs.association.key),I=A[0],W=A[1];i.useEffect(function(){_&&W(z?R.tabs.deviation.key:R.tabs.association.key)},[_,z,R.tabs.deviation.key,R.tabs.association.key]);var P=i.useMemo(function(){if(!B)return{border:R.accentColor,shadow:"".concat(R.accentColor,"2E")};var e=B.badgeText;return"#9F1239"===e||"#B42318"===e?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===e?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===e?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:R.accentColor,shadow:"".concat(R.accentColor,"2E")}},[B,R.accentColor]);i.useEffect(function(){if(_){var e=function(e){var o;(null===(o=E.current)||void 0===o?void 0:o.contains(e.target))||(null==w?void 0:w.contains(e.target))||v()};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[_,v,w,E]);var L=i.useMemo(function(){return{a:function(e){var i=e.href,n=void 0===i?"":i,s=e.children;return o.jsx(l.default,{href:n,children:s,metaData:{citations:null==j?void 0:j.citations,docData:k}})}}},[_,j]);if(!_||!j)return null;var O=null!==(d=null!==(a=j.relevance_score)&&void 0!==a?a:F)&&void 0!==d?d:0,q=j.decisioning,H=Array.isArray(q)?q:"string"==typeof q&&q.trim()?[q]:[],U=j.gap,M=Array.isArray(U)?U:"string"==typeof U&&U.trim()?[U]:[],N=null!==(h=null==C?void 0:C.arrowLeft)&&void 0!==h?h:60,G=o.jsxs(n.Box,e.__assign({ref:E,sx:{position:"fixed",top:null!==(u=null==C?void 0:C.top)&&void 0!==u?u:-9999,left:null!==(f=null==C?void 0:C.left)&&void 0!==f?f:-9999,zIndex:9999,width:"min(".concat(880,"px, calc(100vw - ").concat(24,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(P.border),boxShadow:"0px 8px 32px ".concat(P.shadow,", 0px 0px 0px 3px ").concat(P.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==C?void 0:C.maxHeight)?"min(60vh, ".concat(C.maxHeight,"px)"):"60vh",visibility:C?"visible":"hidden"}},{children:[C&&(C.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:N-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(P.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:N-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:N-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(P.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:N-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,e.__assign({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o.jsxs(n.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[o.jsxs(n.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[o.jsx(n.Box,e.__assign({component:"span",title:m,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:m})),o.jsx(n.Box,e.__assign({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),o.jsx(n.Box,e.__assign({component:"span",title:y||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:y||"Reference Section"}))]})),o.jsx(n.Box,e.__assign({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"13px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(b=Object.values(R.tabs).find(function(e){return e.key===I}))||void 0===b?void 0:b.subtitle}))}))]})),o.jsxs(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o.jsxs(n.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[o.jsx(r.default,{}),R.decisionStrengthLabel," ",O,"%"]})),o.jsx(n.IconButton,e.__assign({onClick:v,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:o.jsx(s.X,{size:22})}))]}))]})),o.jsx(n.Box,e.__assign({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:(z?[R.tabs.deviation]:[R.tabs.deviation,R.tabs.association]).map(function(i){var s=I===i.key;return o.jsx(n.Box,e.__assign({onClick:function(){return W(i.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:"pointer",fontSize:"14px",fontWeight:s?600:400,color:s?R.accentColor:"#667085",backgroundColor:s?"".concat(R.accentColor,"14"):"transparent",borderBottom:s?"2px solid ".concat(R.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:i.label}),i.key)})})),o.jsx(n.Box,e.__assign({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(P.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:P.border},scrollbarWidth:"thin",scrollbarColor:"".concat(P.border,"55 transparent")}},{children:I===R.tabs.deviation.key?o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD",p:2,display:"flex",flexDirection:"column",gap:1}},{children:[o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054"}},{children:R.tabs.deviation.placeholderTitle})),o.jsx(n.Typography,e.__assign({sx:{fontSize:"14px",color:"#667085",lineHeight:1.6}},{children:R.tabs.deviation.placeholderBody}))]})):o.jsxs(o.Fragment,{children:[H.length>0&&o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[o.jsx(n.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:R.sectionTitles.decisioningFactors}))})),o.jsx(n.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:o.jsx(n.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:o.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign({},T)},{children:o.jsx(p.default,e.__assign({components:L},{children:H.join("\n\n")}))}))}))}))]})),M.length>0&&o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[o.jsx(n.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:R.sectionTitles.gaps}))})),o.jsx(n.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:o.jsx(n.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:o.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign({},T)},{children:o.jsx(p.default,e.__assign({components:L},{children:M.join("\n\n")}))}))}))}))]})),0===H.length&&0===M.length&&o.jsx(n.Box,e.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:R.emptyStateMessage}))}))]})}))]}));return x.default.createPortal(G,document.body)};
|
|
2
2
|
//# sourceMappingURL=CognitivePopup.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("@mui/material"),t=require("../../assests/svg/ButtonCognitiveIcon.js"),o=[{key:"connect",title:"Connect",icon:i.jsx("svg",e.__assign({width:"15",height:"18",viewBox:"0 0 15 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M14.8237 3.89331C14.547 5.57188 13.0559 6.77501 11.3572 6.69242C9.65857 6.60983 8.2925 5.26384 8.18312 3.56742C4.75678 3.67456 3.54027 4.4759 3.73893 6.10536C3.81259 6.71474 4.18089 7.04063 4.85723 7.19911C5.26794 7.2951 5.7233 7.30849 6.13625 7.27054C6.17419 7.26608 6.21437 7.26385 6.25232 7.25938C6.50455 7.19911 6.76125 7.14777 7.01794 7.1076C7.77911 6.9826 8.55366 6.9201 9.29027 6.96027C11.3617 7.07188 12.7724 7.98483 12.8438 9.92233C12.913 11.7996 11.6229 13.1299 9.5425 14.0205C8.87509 14.3063 8.1675 14.5272 7.45991 14.6946C7.14071 14.7705 6.87286 14.8219 6.67419 14.8554C6.49786 16.5496 5.07821 17.842 3.37509 17.8554C1.67196 17.8688 0.229997 16.6031 0.0246403 14.9112C-0.180717 13.2192 0.917498 11.6455 2.57375 11.2527C4.23 10.8598 5.91973 11.7728 6.49562 13.3755C6.70544 13.3375 6.91303 13.2951 7.12062 13.246C7.75009 13.0987 8.37955 12.9022 8.95991 12.6522C10.538 11.9781 11.3996 11.0875 11.3595 9.9759C11.3237 8.98036 10.6095 8.52054 9.21214 8.44465C8.5983 8.41117 7.92643 8.46474 7.26348 8.57411C7.07821 8.60536 6.90857 8.63661 6.75902 8.6701C6.67196 8.68795 6.61169 8.70358 6.58491 8.71027L6.51571 8.72367C6.4666 8.73036 6.38402 8.74152 6.27687 8.75268C5.71884 8.80402 5.11393 8.78617 4.52464 8.65001C3.2925 8.36206 2.42866 7.59643 2.26794 6.2884C1.9175 3.47143 4.02241 2.16563 8.42866 2.07188C9.07821 0.500452 10.8037 -0.336602 12.4376 0.129916C14.0737 0.596434 15.1005 2.21474 14.8237 3.89331V3.89331ZM3.34161 12.6478C3.09741 12.6478 2.85562 12.6959 2.63002 12.7894C2.40442 12.8828 2.19944 13.0198 2.02678 13.1925C1.85412 13.3652 1.71717 13.5702 1.62373 13.7958C1.5303 14.0214 1.48222 14.2632 1.48223 14.5074C1.48224 14.7516 1.53036 14.9934 1.62382 15.219C1.71728 15.4446 1.85426 15.6495 2.02694 15.8222C2.19962 15.9949 2.40462 16.1318 2.63022 16.2252C2.85583 16.3187 3.09764 16.3668 3.34183 16.3667C3.83499 16.3667 4.30795 16.1708 4.65665 15.822C5.00535 15.4733 5.20123 15.0003 5.2012 14.5071C5.20117 14.014 5.00524 13.541 4.65649 13.1923C4.30775 12.8436 3.83477 12.6477 3.34161 12.6478ZM11.5224 1.49152C11.2782 1.49154 11.0364 1.53965 10.8108 1.63311C10.5852 1.72657 10.3802 1.86355 10.2076 2.03623C10.0349 2.20891 9.89797 2.41391 9.80454 2.63952C9.7111 2.86513 9.66302 3.10693 9.66303 3.35112C9.66305 3.59531 9.71116 3.83711 9.80462 4.06271C9.89808 4.28831 10.0351 4.49329 10.2077 4.66594C10.3804 4.8386 10.5854 4.97556 10.811 5.06899C11.0366 5.16243 11.2784 5.21051 11.5226 5.2105C12.0158 5.21047 12.4888 5.01453 12.8375 4.66579C13.1862 4.31704 13.382 3.84406 13.382 3.3509C13.382 2.85773 13.186 2.38478 12.8373 2.03608C12.4886 1.68738 12.0156 1.49149 11.5224 1.49152V1.49152Z",fill:"#1D2939","fill-opacity":"0.85"})}))},{key:"side-by-side",title:"Side by Side",icon:i.jsx("svg",e.__assign({width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M3.19922 8.19922H13.1992M3.19922 8.19922L4.86589 10.6992M3.19922 8.19922L4.86589 5.69922M13.1992 8.19922L11.5326 10.6992M13.1992 8.19922L11.5326 5.69922M15.6992 0.699219V15.6992M0.699219 0.699219V15.6992",stroke:"#3F4957","stroke-width":"1.4","stroke-linecap":"round","stroke-linejoin":"round"})}))},{key:"cognitive-decisioning",title:"Cognitive Decisioning",icon:i.jsx(t.ButtonCognitiveIcon,{})}];exports.default=function(t){var s=t.open,r=t.anchorEl;t.sectionTitle,t.referenceSectionTitle;var C=t.onClose,l=t.onOpenCognitiveCompare,c=t.onOpenSideBySide;return i.jsx(n.Menu,e.__assign({open:s,anchorEl:r,onClose:C,disableScrollLock:!0,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},PaperProps:{sx:{ml:.75,minWidth:190,maxWidth:220,borderRadius:"12px",border:"1px solid #E4E7EC",boxShadow:"0px 12px 28px rgba(16, 24, 40, 0.12)",overflow:"hidden"}},MenuListProps:{sx:{p:.5,bgcolor:"#FFFFFF"}}},{children:o.map(function(t){return i.jsxs(n.MenuItem,e.__assign({onClick:function(){var e;"connect"!==(e=t.key)?"side-by-side"!==e?l():c():C()},sx:{px:1.25,py:1,minHeight:40,borderRadius:"10px",display:"flex",alignItems:"center",gap:1,"&:hover":{bgcolor:"#F9FAFB"}}},{children:[i.jsx(n.Box,e.__assign({sx:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{display:"block"}}},{children:t.icon})),i.jsx(n.Box,e.__assign({sx:{minWidth:0,display:"flex",alignItems:"center"}},{children:i.jsx(n.Typography,e.__assign({sx:{fontSize:"12px",fontWeight:500,color:"#101828",lineHeight:1.2,whiteSpace:"nowrap"}},{children:t.title}))}))]}),t.key)})}))};
|
|
2
|
+
//# sourceMappingURL=MoreFunctionsPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoreFunctionsPopup.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),s=require("react");exports.default=function(n){var t=n.leftComponent,l=n.rightComponent,r=s.useRef(null),a=s.useState(50),o=a[0],d=a[1],u=s.useState(!1),c=u[0],_=u[1],h=null!=t,g=null!=l,x=s.useCallback(function(){h&&g&&_(!0)},[h,g]),f=s.useCallback(function(e){if(c&&r.current){var i=r.current.getBoundingClientRect(),s=(e.clientX-i.left)/i.width*100;s=Math.max(25,Math.min(75,s)),d(s)}},[c]),v=s.useCallback(function(){_(!1)},[]),p={minWidth:0,minHeight:0,height:"100%",overflow:"hidden",display:"flex",flexDirection:"column"};return i.jsxs("div",e.__assign({ref:r,onMouseMove:f,onMouseUp:v,onMouseLeave:v,style:{display:"flex",width:"calc(100% - 4px)",height:"400px",border:"1px solid #ddd",overflow:"hidden",userSelect:c?"none":"auto"}},{children:[h&&!g&&i.jsx("div",e.__assign({style:e.__assign(e.__assign({},p),{width:"100%"})},{children:t})),!h&&g&&i.jsx("div",e.__assign({style:e.__assign(e.__assign({},p),{width:"100%"})},{children:l})),h&&g&&i.jsxs(i.Fragment,{children:[i.jsx("div",e.__assign({style:e.__assign(e.__assign({},p),{width:"".concat(o,"%"),flexShrink:0})},{children:t})),i.jsx("div",{onMouseDown:x,style:{width:"6px",background:"#D0D5DD",cursor:"col-resize",flexShrink:0}}),i.jsx("div",e.__assign({style:e.__assign(e.__assign({},p),{flex:1})},{children:l}))]})]}))};
|
|
2
|
+
//# sourceMappingURL=ResizableSplitPane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizableSplitPane.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),s=require("@react-pdf-viewer/core"),i=require("./PdfStyle.js"),n="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js";exports.default=function(t){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),s=require("@react-pdf-viewer/core"),i=require("./PdfStyle.js"),n="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js";exports.default=function(t){var l=t.pdfUrl,o=t.plugins,a=t.onLoad,d=t.customStyles,u=t.onPageChange,p=t.defaultScale;return r.jsx("div",e.__assign({style:e.__assign(e.__assign({},i.pdfStyles.pdfConatiner),null==d?void 0:d.pdfContainer)},{children:r.jsx(s.Worker,e.__assign({workerUrl:n},{children:r.jsx(s.Viewer,{fileUrl:l,defaultScale:p,plugins:o,onDocumentLoad:a,onPageChange:u})}))}))},exports.pdfWorker=n;
|
|
2
2
|
//# sourceMappingURL=PdfContainer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative"},title:{fontSize:"14px",fontWeight:600,color:"#60A3F8",fontFamily:'Roboto, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif'},toolbar:{display:"flex",alignItems:"center",gap:"8px",position:"relative"},button:{border:"1px solid #DFE5EC",borderRadius:"6px",padding:"4px 8px",fontSize:"12px",cursor:"pointer",backgroundColor:"#FFFFFF"},buttonDisabled:{opacity:.4,cursor:"not-allowed"},counter:{fontSize:"13px",color:"#64748B",margin:"0 6px"},viewerWrapper:{height:"30rem",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid #DEE4EB",borderRadius:"8px"},emptyState:{fontSize:"14px",color:"#EF4444"},pdfConatiner:{height:"100%",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center"}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%",minWidth:0,boxSizing:"border-box",overflow:"hidden"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%",minWidth:0,boxSizing:"border-box",overflow:"hidden"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative",width:"100%",minWidth:0,boxSizing:"border-box"},title:{fontSize:"14px",fontWeight:600,color:"#60A3F8",fontFamily:'Roboto, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif'},toolbar:{display:"flex",alignItems:"center",gap:"8px",position:"relative"},button:{border:"1px solid #DFE5EC",borderRadius:"6px",padding:"4px 8px",fontSize:"12px",cursor:"pointer",backgroundColor:"#FFFFFF"},buttonDisabled:{opacity:.4,cursor:"not-allowed"},counter:{fontSize:"13px",color:"#64748B",margin:"0 6px"},viewerWrapper:{height:"30rem",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid #DEE4EB",borderRadius:"8px"},emptyState:{fontSize:"14px",color:"#EF4444"},pdfConatiner:{height:"100%",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center"}};
|
|
2
2
|
//# sourceMappingURL=PdfStyle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("./PdfStyle.js"),s=require("../../assests/svg/PdfViewerIcons.js"),t=require("@mui/material");exports.default=function(o){o.highlightIndex;var l=o.totalHighlights,r=o.controls,d=o.currentPosition,a=o.pdfName,c=o.onClose,p=o.pdfUrl,x=o.viewerRef,g=o.customStyles,u=o.customClasses,h=o.customIcons,f=o.headerAction,_=o.isZoomEnabled,j=void 0===_||_,v=o.showHighlightsAction,m=void 0===v||v,y=r.ZoomInButton,b=r.ZoomOutButton,w=r.ZoomPopover,k=r.goToPrevious,I=r.goToNext,C={padding:"4px",borderRadius:"6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0};return n.jsxs("div",e.__assign({style:e.__assign(e.__assign({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px",background:"#FAFAFA",borderBottom:"1px solid #F3F4F6",borderTopLeftRadius:"12px",borderTopRightRadius:"12px"},i.pdfStyles.header),null==g?void 0:g.header)},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",flex:1,minWidth:0,overflow:"hidden"}},{children:[n.jsx("div",e.__assign({style:e.__assign(e.__assign(e.__assign({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==g?void 0:g.pdfIconWrapper),{flexShrink:0})},{children:(null==h?void 0:h.pdfIcon)||n.jsx(s.DefaultPdfIcon,{})})),n.jsx(t.Tooltip,e.__assign({title:a||"",arrow:!0,placement:"top"},{children:n.jsx("div",e.__assign({style:{flex:1,minWidth:0,overflow:"hidden"}},{children:n.jsx("span",e.__assign({style:e.__assign({display:"block",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:500,cursor:"default"},null==g?void 0:g.pdfName),className:null==u?void 0:u.pdfName},{children:a}))}))}))]})),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:m?"16px":"2px",color:"#4B5563",flexShrink:0,whiteSpace:"nowrap",minWidth:"fit-content"}},{children:[j&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsx(b,{}),n.jsx("div",e.__assign({style:{fontSize:"14px",fontWeight:500,width:"56px",textAlign:"center"}},{children:n.jsx(w,{})})),n.jsx(y,{})]})),!!l&&m&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("span",e.__assign({style:{fontSize:"14px",color:"#475467",fontWeight:500,lineHeight:1}},{children:[d," of ",l]})),n.jsx("button",e.__assign({style:{background:"none",border:"none",cursor:d<=1?"not-allowed":"pointer",padding:"2px 4px",color:d<=1?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:k,disabled:d<=1},{children:n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n.jsx("path",{d:"M2 8L6 4L10 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))})),n.jsx("button",e.__assign({style:{background:"none",border:"none",cursor:d===l?"not-allowed":"pointer",padding:"2px 4px",color:d===l?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:I,disabled:d===l},{children:n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n.jsx("path",{d:"M2 4L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))}))]})),n.jsx("div",{style:{width:"1px",height:"20px",background:"#D1D5DB",margin:"0 4px",flexShrink:0}}),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0,whiteSpace:"nowrap"}},{children:[(null==f?void 0:f.icon)&&(null==f?void 0:f.onClick)?n.jsx(t.Tooltip,e.__assign({title:(null==f?void 0:f.tooltip)||"",arrow:!0,placement:"top"},{children:n.jsx("div",e.__assign({onClick:f.onClick,style:e.__assign({display:"flex",alignItems:"center",cursor:"pointer"},C)},{children:f.icon}))})):n.jsx("button",e.__assign({onClick:function(){var e=null==x?void 0:x.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},style:C,title:"Full Screen"},{children:(null==h?void 0:h.fullScreenIcon)||n.jsx(s.DefaultFullScreenIcon,{})})),p&&n.jsx("a",e.__assign({href:p,target:"_blank",rel:"noopener noreferrer",style:C,title:"Open in new tab"},{children:(null==h?void 0:h.downloadIcon)||n.jsx(s.DefaultDownloadIcon,{})})),c&&n.jsx("button",e.__assign({onClick:c,style:C,title:"Close"},{children:(null==h?void 0:h.closeIcon)||n.jsx(s.DefaultCloseIcon,{})}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=PdfToolbar.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@react-pdf-viewer/core"),o=require("./PdfContainer.js"),r=require("./PdfToolbar.js"),n=require("./PdfStyle.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@react-pdf-viewer/core"),o=require("./PdfContainer.js"),r=require("./PdfToolbar.js"),n=require("./PdfStyle.js"),a=require("./usePdfHighlight.js");require("@react-pdf-viewer/zoom/lib/styles/index.css"),require("@react-pdf-viewer/page-navigation/lib/styles/index.css"),require("@react-pdf-viewer/core/lib/styles/index.css"),require("@react-pdf-viewer/search/lib/styles/index.css");var l=require("react"),s=require("../ScannedDocCitation/ScannedDocCitation.js"),c=function(e){switch(e){case"ActualSize":return t.SpecialZoomLevel.ActualSize;case"PageFit":return t.SpecialZoomLevel.PageFit;case"PageWidth":return t.SpecialZoomLevel.PageWidth;default:return null!=e?e:t.SpecialZoomLevel.PageWidth}};exports.default=function(u){var d,g=u.pdfUrl,h=u.highlightText,f=u.highlightPages,v=u.highlightCordinatePages,p=u.highlightColor,m=void 0===p?"yellow":p,x=u.activeHighlightColor,C=void 0===x?"#f7dc51":x,S=u.jumpToPageValue,P=void 0===S?0:S,y=u.pdfName,T=u.onClose,_=u.customStyles,q=u.customClasses,w=u.customIcons,A=u.useCoordinates,b=u.fallbackPages,j=u.activeCitationIndex,H=u.onActiveCitationChange,I=u.headerAction,Z=u.isZoomEnabled,L=void 0===Z||Z,z=u.showHighlightsAction,F=void 0===z||z,N=u.defaultScale,E=void 0===N?t.SpecialZoomLevel.ActualSize:N,R=l.useRef(null),V=l.useMemo(function(){if(A)return new Set(v.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(f).forEach(function(i){i>0&&e.add(i-1)}),e},[f]),W=(d=h)&&0!==d.length?d.filter(function(e){return!d.some(function(i){return i!==e&&i.includes(e)})}):d,D=a.PdfHighlightControls(W,A?{}:f,R,V,A,A?v:[],m,C),B=D.highlightIndex,O=D.cursorIndex,U=D.setCursorIndex,k=D.orderedKeys,M=D.totalHighlights,J=D.getValidPosition,K=D.tryJump,G=D.jumpToPage,Q=D.zoomTo,X=D.plugins,Y=D.controls,$=D.hideNonTargetHighlights,ee=D.deduplicateHighlights,ie=J(O);l.useEffect(function(){void 0!==j&&j!==O&&U(j)},[j]);var te=e.__assign(e.__assign({},Y),{goToNext:function(){Y.goToNext(),H&&H(O+1)},goToPrevious:function(){Y.goToPrevious(),H&&H(O-1)}});if(!g)return i.jsx(s.default,{pages:b,activeCitationIndex:j,onActiveCitationChange:H,headerAction:I});return i.jsxs("div",e.__assign({ref:R,className:(null==q?void 0:q.pdfViewerWrapper)||"",style:e.__assign(e.__assign(e.__assign({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},n.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==_?void 0:_.pdfViewer)},{children:[i.jsx(r.default,{highlightIndex:B,totalHighlights:M,controls:te,currentPosition:ie,pdfName:y,onClose:T,pdfUrl:g,viewerRef:R,customStyles:_,customClasses:q,customIcons:w,headerAction:I,isZoomEnabled:L,showHighlightsAction:F}),i.jsx(o.default,{defaultScale:c(E),pdfUrl:g,plugins:X,customStyles:_,onLoad:function(){if(Q(t.SpecialZoomLevel.ActualSize),P>0){var e=P-1,i=k[e],o=f[i],r=v[e];U(e),console.log(r,"cordinateTargetHighlight"),A&&r.pageIndex>0&&G(r.pageIndex),o>0&&(setTimeout(function(){$(V),ee(o-1)},1e3),A||G(o-1))}else if(!A&&f){var n=k.find(function(e){return f[e]>0});if(void 0!==n){var a=f[n]-1;G(a),setTimeout(function(){$(V),ee(a)},1e3)}}requestAnimationFrame(function(){K(),A||function(){if(R.current){var e=P-1,i=k[e],t=f[i],o=t>0?t-1:0,r={};k.forEach(function(e,i){var t=f[e];t>0&&(r[t]||(r[t]=[]),r[t].push(i))});var n=(r[t]||[]).indexOf(e),a=0,l=function(){var e,i;if(!(++a>40)){var t=null===(e=R.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(t){var r=null===(i=R.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(o,'"]'));if(r){var s=t.getBoundingClientRect(),c=r.getBoundingClientRect();if(c.top<s.bottom&&c.bottom>s.top){var u=r.querySelectorAll(".rpv-search__highlight")[n];if(u){var d=u.getBoundingClientRect(),g=t.scrollTop+(d.top-s.top)-t.clientHeight/2+d.height/2;t.scrollTo({top:g,behavior:"smooth"})}else setTimeout(l,100)}else setTimeout(l,100)}else setTimeout(l,100)}else setTimeout(l,100)}};setTimeout(l,500)}}()})},onPageChange:function(e){var i=e.currentPage;V.has(i)?(ee(i),$(V)):$(V)}})]}))};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as l}from"tslib";import{jsxs as i,jsx as n,Fragment as o}from"react/jsx-runtime";import{ChevronUp as t,ChevronDown as e}from"lucide-react";import{useState as r}from"react";import a from"./ResizableSplitPane.js";import d from"../PdfViewer/PdfViewer.js";var u=function(u){var c,s,v,h=u.href,g=u.children,p=u.metaData,m=u.chevronUpComponent,f=void 0===m?null:m,b=u.chevronDownComponent,_=void 0===b?null:b,w=u.customStyle,y=void 0===w?{}:w,x=u.defaultState,P=r(void 0!==x&&x),C=P[0],S=P[1],D="string"==typeof g&&(null===(c=null==g?void 0:g.split("\n"))||void 0===c?void 0:c.length)>1?g.split("\n").join(" "):g,j=null!=f?f:function(l){var i,o;return n(t,{size:null!==(i=null==l?void 0:l.fontSize)&&void 0!==i?i:16,color:null!==(o=null==l?void 0:l.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(s=null==y?void 0:y.arrow)&&void 0!==s?s:{}),z=null!=_?_:function(l){var i,o;return n(e,{size:null!==(i=null==l?void 0:l.fontSize)&&void 0!==i?i:16,color:null!==(o=null==l?void 0:l.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(v=null==y?void 0:y.arrow)&&void 0!==v?v:{}),T=["contract","clause"];return i("span",l({style:l({display:"inline"},y.relativeWrapper||{})},{children:[n("div",l({style:l({display:"inline",marginTop:0},y.citationButtonWrapper||{})},{children:i("button",l({type:"button",onClick:function(){return S(function(l){return!l})},style:l({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},y.citationButton||{})},{children:[n("span",{children:D}),n("span",l({style:{display:"flex",alignItems:"center"}},{children:C?j:z}))]}))})),C&&n(o,{children:n(function(){var l,i,t,e,r,u,c;console.log("citation details",h,g,p,D);var s=function(l){try{return new URL(l,window.location.origin).searchParams.get("citationNumber")}catch(l){return null}}(h);if(!s)return null;var v=(null===(l=null==p?void 0:p.citations)||void 0===l?void 0:l[s])||{},m=(null===(i=null==p?void 0:p.docData)||void 0===i?void 0:i.documents)||{},f=(null===(t=null==p?void 0:p.docData)||void 0===t?void 0:t.input_index_map)||{},b=null==f?void 0:f[0],_=null==f?void 0:f[1],w=b?m[b]:null,y=_?m[_]:null,x=b?v[b]:null,P=_?v[_]:null;if(T.includes(D[0])){console.log("leftDocument",w,"rightDocument",y);var C=x?n(d,{defaultScale:"PageWidth",showHighlightsAction:!1,pdfName:w.title,pdfUrl:w.signed_url,highlightText:[null!==(e=null==x?void 0:x.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(r=null==x?void 0:x.custom_metadata)||void 0===r?void 0:r.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,S=P?n(d,{defaultScale:"PageWidth",showHighlightsAction:!1,pdfName:y.title,pdfUrl:y.signed_url,jumpToPageValue:1,highlightText:[null!==(u=null==P?void 0:P.highlighted_text)&&void 0!==u?u:""],highlightPages:{1:null===(c=null==P?void 0:P.custom_metadata)||void 0===c?void 0:c.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null;return n("div",{children:n(a,{leftComponent:C,rightComponent:S})})}return n(o,{children:"HEllo issue here"})},{})})]}))};export{u as default};
|
|
2
|
+
//# sourceMappingURL=CitationAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationAnchor.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import i,{useState as o,useMemo as r,useRef as l,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as s,Alert as u,Typography as h,Tooltip as v,Accordion as p,AccordionSummary as f,AccordionDetails as g}from"@mui/material";import{ChevronUp as x,ChevronDown as m}from"lucide-react";import{ButtonCognitiveIcon as y}from"../../assests/svg/ButtonCognitiveIcon.js";import w from"react-markdown";import{safeStringify as F,hasValue as b,getStyleForRelation as E,cognitiveScoreToRelation as S,getRationale as C,getSideData as _}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as A,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as I}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import R from"./CognitivePopup.js";var T={id:"",title:""},B=function(B){var k,M,z,H,W,j,L,O,P=B.componentHeaderText,N=void 0===P?"Learning Comparison":P,q=B.treeData,V=B.comparisonConfig,K=B.leftColumnTitleText,U=B.rightColumnTitleText,Y=B.markdownStyles,G=o(null),J=G[0],Q=G[1],X=r(function(){return(null==q?void 0:q.cognitive_decisioning)||{}},[q]);l(null);var Z=o(null),$=Z[0],ee=Z[1],ne=l(null),te=o({width:0,height:0}),ie=te[0],oe=te[1],re=r(function(){return e(e({},A),Y)},[Y]),le=o({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null}),ce=le[0],ae=le[1],de=l(null),se=l(null),ue=l(!1),he=l(null);c(function(){he.current=null},[ce.sectionIdx,ce.open]);var ve=a(function(){var e;if(ce.anchorEl&&ce.refSectionTitle){var n=ce.anchorEl.getBoundingClientRect(),t=(null===(e=null==ne?void 0:ne.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!==he.current?!0===he.current&&(l=r>=t||r>=o):l=!(o>=t||o>=r),he.current=l;var c=l?r:o,a=Math.min(t||9999,c),d=l?n.top-12-a:n.bottom+12,s=n.left+n.width/2,u=s-i/2,h=Math.max(12,Math.min(u,window.innerWidth-i-12)),v=Math.max(14,Math.min(s-h,i-10-4));ee({top:d,left:h,arrowLeft:v,openAbove:l,maxHeight:c})}},[ce.anchorEl,ce.refSectionTitle]);c(function(){if(ce.open){window.addEventListener("resize",ve);var e=requestAnimationFrame(ve),n=null;return ne.current&&(n=new ResizeObserver(function(){e=requestAnimationFrame(ve)})).observe(ne.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",ve),n&&n.disconnect()}}},[ce.open,ve]),c(function(){var n=de.current;if(n&&ce.open){var t=function(n){ne.current&&ne.current.contains(n.target)||(console.log("Scroll event detected on:",n.target,"- closing CognitivePopup"),ee(null),ae(function(n){return e(e({},n),{open:!1,anchorEl:null,sectionAnchorEl:null})}))};return n.addEventListener("scroll",t,{capture:!0}),window.addEventListener("scroll",t,{capture:!0}),function(){n.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("scroll",t,{capture:!0})}}},[ce.open]);var pe=r(function(){var n,t,i,o,r,l,c,a,d,s,u,h;return{fields:null!==(n=null==V?void 0:V.fields)&&void 0!==n?n:D,thresholds:{high:null!==(i=null===(t=null==V?void 0:V.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:I.thresholds.high,medium:null!==(r=null===(o=null==V?void 0:V.thresholds)||void 0===o?void 0:o.medium)&&void 0!==r?r:I.thresholds.medium,exact:null!==(c=null===(l=null==V?void 0:V.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:I.thresholds.exact},relationStyles:{noContent:e(e({},I.relationStyles.noContent),(null===(a=null==V?void 0:V.relationStyles)||void 0===a?void 0:a.noContent)||{}),high:e(e({},I.relationStyles.high),(null===(d=null==V?void 0:V.relationStyles)||void 0===d?void 0:d.high)||{}),exact:e(e({},I.relationStyles.exact),(null===(s=null==V?void 0:V.relationStyles)||void 0===s?void 0:s.exact)||{}),medium:e(e({},I.relationStyles.medium),(null===(u=null==V?void 0:V.relationStyles)||void 0===u?void 0:u.medium)||{}),low:e(e({},I.relationStyles.low),(null===(h=null==V?void 0:V.relationStyles)||void 0===h?void 0:h.low)||{})}}},[V]),fe=r(function(){if(q&&Object.keys(q).length>0)try{var n=function(n){var t,i,o,r,l=[],c=[],a=n.base_root_id,d=n.input_index_map||{0:"left",1:"right"},s=n[a];if(!s||!1===s.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var u=function(t){var i=n[t];if(i&&!1!==i.display_node){var o=C(i),r=_(i,"0",d),a=_(i,"1",d),s=r.title.trim()||r.content.trim(),h=a.title.trim()||a.content.trim();l.push(e({id:t,title:s?r.title:"",content:s?r.content:"",subsections:[]},s?o:{score:void 0,relation:"not_defined"})),c.push(e({id:t,title:h?a.title:"",content:h?a.content:"",subsections:[]},h?o:{score:void 0,relation:"not_defined"})),i.next&&Object.values(i.next).forEach(u)}};return s.next&&Object.values(s.next).forEach(u),{activeProposed:{title:(null===(i=null===(t=s.comparison_inputs)||void 0===t?void 0:t[d[0]])||void 0===i?void 0:i.title)||"Uploaded Contract",description:s.decision_scope_description||"",sections:l},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(o=s.comparison_inputs)||void 0===o?void 0:o[d[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:c,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:s.decision_scope_description||""},fields:{}}}}]}}(q);return e(e({},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"}},[q]),ge=fe.activeProposed,xe=fe.activeVariants,me=fe.parseError;c(function(){me&&Q("Failed to load comparison: ".concat(me))},[me]);var ye=o(null),we=ye[0];ye[1];var Fe=o({}),be=Fe[0],Ee=Fe[1],Se=xe[0]||T,Ce=null===(z=null===(k=null==q?void 0:q.documents)||void 0===k?void 0:k[null===(M=null==q?void 0:q.input_index_map)||void 0===M?void 0:M[0]])||void 0===z?void 0:z.title,_e=null===(j=null===(H=null==q?void 0:q.documents)||void 0===H?void 0:H[null===(W=null==q?void 0:q.input_index_map)||void 0===W?void 0:W[1]])||void 0===j?void 0:j.title,Ae=F(K||Ce||"Uploaded Contract"),De=F(U||_e||"Reference Template"),Ie=r(function(){return ge.sections||[]},[ge.sections]),Re=r(function(){return Se.sections||[]},[Se.sections]),Te=Ie.length>0||Re.length>0,Be=Se.analysis,ke=F(null===(O=null===(L=null==Be?void 0:Be.rule_difference_comparison)||void 0===L?void 0:L.summary)||void 0===O?void 0:O.overall_summary),Me=!!ke.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ze=l({}),He=function(e){return ze.current[e]||(ze.current[e]=i.createRef()),ze.current[e]},We=l(null),je=l(null),Le=l(null),Oe=o([]),Pe=Oe[0],Ne=Oe[1],qe=o(null),Ve=qe[0],Ke=qe[1],Ue=r(function(){return pe.fields.filter(function(e){var n=e.key;return(!Te||"description"!==n)&&(b(ge[n])||b(Se[n]))})},[ge,Se,Te,pe.fields]),Ye=l({}),Ge=l({}),Je=l({}),Qe=l({});Ue.forEach(function(e){var n=e.key;Ye.current[n]||(Ye.current[n]=i.createRef()),Ge.current[n]||(Ge.current[n]=i.createRef())});for(var Xe=0;Xe<Math.max(Ie.length,Re.length);Xe+=1)Je.current[Xe]||(Je.current[Xe]=i.createRef()),Qe.current[Xe]||(Qe.current[Xe]=i.createRef());c(function(){if(we){var e=pe.fields.find(function(e){return e.analysisKey===we||e.key===we});if(e){var n=Ye.current[e.key]||Ge.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[we,pe.fields]);var Ze=a(function(e){var n,t,i,o,r,l,c,a,d,s=null===(n=null==Be?void 0:Be.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var u=s[e],h=(null==u?void 0:u.relation)||(null===(i=null===(t=null==u?void 0:u.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==u?void 0:u.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==u?void 0:u.mappings)&&u.mappings.length>0;if(u.mappings){var v=u.mappings[0]||{};return{score:u.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=v.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!h}}return{score:u.score,relation:u.relation||"",highlightsA:(null===(a=u.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(d=u.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!h}},[Be]),$e=a(function(n){var t,i,o=Ie[n],r=Re[n],l=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,c=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,a=!(!(null==o?void 0:o.cognitiveData)&&!(null==r?void 0:r.cognitiveData));if(!l&&!c&&!a)return e(e({},pe.relationStyles.noContent),{label:"Not Defined"});var d=Ze("description");if(null!=(null!==(t=null==o?void 0:o.cognitiveRelevanceScore)&&void 0!==t?t:null==r?void 0:r.cognitiveRelevanceScore)){var s=S(),u=s.score,h=s.relation;return E(u,h,!0,pe)}var v=l?o.relation:c?r.relation:d.relation,p=null!==(i=null==o?void 0:o.score)&&void 0!==i?i:null==r?void 0:r.score,f="number"==typeof p?p:d.score;return E(f,v,!0,pe)},[Ie,Re,pe,Ze]),en=a(function(){var e,n,t,i,o,r,l,c,a,d,s;if(!ue.current){ue.current=!0;try{if(!We.current)return;var u=We.current.getBoundingClientRect();oe({width:u.width,height:u.height});var h=[];Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.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")});for(var v=0;v<Math.min(Ie.length,Re.length);v++){var p=null===(e=Je.current[v])||void 0===e?void 0:e.current,f=null===(n=Qe.current[v])||void 0===n?void 0:n.current;p&&f&&(p.style.height="auto",f.style.height="auto",p.style.minHeight="0px",f.style.minHeight="0px")}var g={};Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();g[i]=Math.max(l.height,c.height)}});var x=[];for(v=0;v<Math.min(Ie.length,Re.length);v++){p=null===(t=Je.current[v])||void 0===t?void 0:t.current,f=null===(i=Qe.current[v])||void 0===i?void 0:i.current;if(p&&f){var m=p.getBoundingClientRect(),y=f.getBoundingClientRect();x[v]=Math.max(m.height,y.height)}}Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=g[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}});for(v=0;v<x.length;v++){p=null===(o=Je.current[v])||void 0===o?void 0:o.current,f=null===(r=Qe.current[v])||void 0===r?void 0:r.current;if(p&&f){var w=x[v];p.style.minHeight="".concat(w,"px"),f.style.minHeight="".concat(w,"px")}}Ue.forEach(function(e){var n,t,i=e.key,o=e.analysisKey,r=null===(n=Ye.current[i])||void 0===n?void 0:n.current,l=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(r&&l){var c=r.getBoundingClientRect(),a=l.getBoundingClientRect(),d=Ze(o),s=E(d.score,d.relation,d.hasContent,pe);if(!s)return;var v=c.top+c.height/2-u.top;h.push({id:"field-".concat(i),x1:c.right-u.left,y1:v,x2:a.left-u.left,y2:v,style:s})}});for(v=0;v<Math.min(Ie.length,Re.length);v++){var F=null===(l=Je.current[v])||void 0===l?void 0:l.current,b=null===(c=Qe.current[v])||void 0===c?void 0:c.current;if(F&&b){var S=F.querySelector(".MuiAccordionSummary-root"),C=b.querySelector(".MuiAccordionSummary-root");if(S&&C){var _=S.getBoundingClientRect(),A=C.getBoundingClientRect(),D=(_.top+_.height/2-u.top+A.top+A.height/2-u.top)/2,I=(null===(a=Re[v])||void 0===a?void 0:a.id)||"sec-".concat(v),R=$e(v);R&&h.push({id:I,x1:_.right-u.left,y1:D,x2:A.left-u.left,y2:D,style:R,sectionIdx:v,hasCognitive:!(!(null===(d=Ie[v])||void 0===d?void 0:d.cognitiveData)&&!(null===(s=Re[v])||void 0===s?void 0:s.cognitiveData))})}}}if(Ne(h),je.current&&Le.current){var T=je.current.getBoundingClientRect(),B=Le.current.getBoundingClientRect(),k=(T.top+T.height/2-u.top+B.top+B.height/2-u.top)/2;Ke({x1:T.right-u.left,x2:B.left-u.left,y:k})}else Ke(null)}catch(e){console.error("Line render safe fail: ",e)}finally{ue.current=!1}}},[Ue,Ie,Re,pe,Ze,$e]),nn=a(function(){window.requestAnimationFrame(en)},[en]);c(function(){var e=setTimeout(nn,250);window.addEventListener("resize",nn);var n=null,t=null;return de.current&&(n=new ResizeObserver(nn)).observe(de.current),We.current&&(t=new ResizeObserver(nn)).observe(We.current),function(){clearTimeout(e),window.removeEventListener("resize",nn),null==n||n.disconnect(),null==t||t.disconnect()}},[ge,Se,Be,Ue,be,Ie,Re,pe,nn]);var tn=function(o,r,l,c){var a,s=!b(o.title)&&!b(o.content);return t(d,e({ref:c,sx:{mb:1,minHeight:0,display:"flex",flexDirection:"column"}},{children:n(p,e({disableGutters:!0,expanded:!s&&!!be[r],onChange:function(){return!s&&(n=r,void Ee(function(t){var i;return e(e({},t),((i={})[n]=!t[n],i))}));var n},sx:{boxShadow:"none",border:s?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:s?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[t(f,e({expandIcon:s?null:t(m,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:s?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:t(v,e({title:o.title||"No Matching Section Found",placement:"top"},{children:t(h,e({sx:{fontSize:"12px",color:s?"#94A3B8":"#19213D",fontWeight:s?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(a=o.title||"No Matching Section Found",a?F(a).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(i.Fragment,{children:e},n)}):null)}))}))})),!s&&n(g,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[t(h,e({component:"div",sx:re},{children:t(w,{children:F(o.content).replace(/\\n/g,"\n")})})),(o.subsections||[]).map(function(n,i){return t(d,e({sx:{mt:1,pt:1,borderTop:"1px solid #EEF2F7"}},{children:t(h,e({component:"div",sx:re},{children:t(w,{children:F(n).replace(/\\n/g,"\n")})}))}),"".concat(l,"-sub-").concat(r,"-").concat(i))})]}))]}))}),"".concat(l,"-sec-").concat(r))};return n(d,e({ref:se,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[ce.open&&t(R,{open:ce.open,popupRef:ne,position:$,onClose:function(){ee(null),ae(function(n){return e(e({},n),{open:!1})})},markdownStyles:Y,sectionTitle:ce.sectionTitle,referenceSectionTitle:ce.refSectionTitle,cognitiveData:ce.cognitiveData,anchorEl:ce.anchorEl,sectionAnchorEl:ce.sectionAnchorEl,scrollContainerEl:de.current,badgeStyle:ce.badgeStyle}),t(s,e({open:!!J,autoHideDuration:8e3,onClose:function(){return Q(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(u,e({onClose:function(){return Q(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:J}))})),t(d,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:t(d,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:t(h,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:N}))}))})),t(d,e({ref:de,sx:{flex:1,overflowY:"auto",minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:ke&&Me?"none":"1.5px solid #EEF0F4"}},{children:t(d,e({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:n(d,e({ref:We,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0}},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:ie.width||"100%",height:ie.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Ve&&n("g",{children:[t("line",{x1:Ve.x1,y1:Ve.y,x2:Math.max(Ve.x1,(Ve.x1+Ve.x2)/2-70),y2:Ve.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),t("line",{x1:Math.min(Ve.x2,(Ve.x1+Ve.x2)/2+70),y1:Ve.y,x2:Ve.x2,y2:Ve.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Pe.map(function(i,o){var r=(i.x1+i.x2)/2;return"Not Defined"!==i.style.label||i.hasCognitive?n("g",{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder,strokeWidth:"1.5"}),t("foreignObject",e({x:r-75,y:i.y1-14,width:"150",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(d,e({sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n(d,e({onClick:function(n){if(n.stopPropagation(),ce.open&&ce.sectionIdx===i.sectionIdx)return ee(null),void ae(function(n){return e(e({},n),{open:!1})});!function(e,n,t,i,o){var r,l;e.stopPropagation(),ee(null);var c=F(n.id)||F(t.id)||"",a=(c?X[c]:null)||n.cognitiveData||t.cognitiveData||null,d=null!==(l=null===(r=ze.current[i])||void 0===r?void 0:r.current)&&void 0!==l?l:null;ae({open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:a,anchorEl:e.currentTarget,sectionAnchorEl:d,badgeStyle:o||null,sectionIdx:i})}(n,Ie[i.sectionIdx]||{title:"",content:""},Re[i.sectionIdx]||{title:"",content:""},i.sectionIdx,i.style)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",cursor:"pointer",verticalAlign:"middle"}},{children:[i.hasCognitive&&void 0!==i.sectionIdx&&t(d,e({sx:{display:"flex",alignItems:"center",justifyContent:"center",color:i.style.badgeText}},{children:t("div",e({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:t(y,{})}))})),ce.open&&ce.sectionIdx===i.sectionIdx?t(x,{size:12,color:i.style.badgeText}):t(m,{size:12,color:i.style.badgeText})]}))]}))}))}))]},o):null})]})),n(d,e({sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[t(d,e({ref:je,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center",overflow:"hidden"}},{children:t(v,e({title:Ae,placement:"top"},{children:t(h,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:Ae}))}))})),t(d,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:Te&&Ie.map(function(e,n){return{section:e,idx:n}}).map(function(n){var o=n.section,r=n.idx;return t(d,e({ref:He(r)},{children:tn(o,r,"left",Je.current[r]||i.createRef())}),"left-row-".concat(r))})}))]})),t(d,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(d,e({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:[t(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(y,{})})),0,"% Similarity",t(m,{size:11})]}))}))})),n(d,e({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[t(d,e({ref:Le,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center",overflow:"hidden"}},{children:t(v,e({title:De,placement:"top"},{children:t(h,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:De}))}))})),t(d,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:Te&&Re.map(function(e,n){return{section:e,idx:n}}).map(function(e){var n=e.section,t=e.idx;return tn(n,t,"right",Qe.current[t]||i.createRef())})}))]}))]}))}))}))]}))};export{B as default};
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import i,{useState as r,useRef as o,useMemo as l,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as u,Alert as s,Typography as f,FormControlLabel as h,Switch as v,Tooltip as p,Accordion as x,AccordionSummary as g,AccordionDetails as m}from"@mui/material";import{ChevronDown as y,EllipsisVertical as b}from"lucide-react";import{ButtonCognitiveIcon as w}from"../../assests/svg/ButtonCognitiveIcon.js";import F from"react-markdown";import{safeStringify as I,hasValue as E,getStyleForRelation as S,getRationale as C,getSideData as R,cognitiveScoreToRelation as _}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as T,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import B from"./CognitivePopup.js";import k from"./MoreFunctionsPopup.js";var H={id:"",title:""},z={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null},M=function(e,n,t,i){void 0===t&&(t=300);var r=e.style.scrollBehavior;e.style.scrollBehavior="auto";var o=e.scrollTop,l=n-o,c=null,a=function(d){null===c&&(c=d);var u,s=d-c;s<t?(e.scrollTop=(u=s,u/=t,l*(--u*u*u+1)+o),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=r,i&&i())};requestAnimationFrame(a)},W=function(W){var L,j,N,O,P,q,X,Y,V=W.componentHeaderText,U=void 0===V?"Learning Comparison":V,K=W.treeData,G=W.comparisonConfig,J=W.leftColumnTitleText,Q=W.rightColumnTitleText,Z=W.markdownStyles,$=W.maintainRelativeOrder,ee=void 0!==$&&$,ne=W.popupConfig,te=r(ee),ie=te[0],re=te[1],oe=r(null),le=oe[0],ce=oe[1],ae=r(!1),de=ae[0],ue=ae[1],se=r(!1),fe=se[0],he=se[1],ve=o(!1),pe=l(function(){return(null==K?void 0:K.cognitive_decisioning)||{}},[K]),xe=r(null),ge=xe[0],me=xe[1],ye=o(null),be=r({width:0,height:0}),we=be[0],Fe=be[1],Ie=l(function(){return e(e({},T),Z)},[Z]),Ee=r({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),Se=Ee[0],Ce=Ee[1],Re=r({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),_e=Re[0],Te=Re[1],De=o(null),Ae=o(null),Be=o(null),ke=o(null),He=o(null),ze=o(!1),Me=o(null);c(function(){Me.current=null},[Se.sectionIdx,Se.open]);var We=a(function(){me(null),Ce(z)},[]),Le=a(function(){Te(z)},[]),je=a(function(){var e;if(Se.anchorEl&&Se.refSectionTitle){var n=Se.anchorEl.getBoundingClientRect(),t=(null===(e=null==ye?void 0:ye.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!==Me.current?!0===Me.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),Me.current=l;var c=l?o:r,a=Math.min(t||9999,c),d=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,s=u-i/2,f=Math.max(12,Math.min(s,window.innerWidth-i-12)),h=Math.max(14,Math.min(u-f,i-10-4));me({top:d,left:f,arrowLeft:h,openAbove:l,maxHeight:c})}},[Se.anchorEl,Se.refSectionTitle]);c(function(){if(Se.open){window.addEventListener("resize",je);var e=requestAnimationFrame(je),n=null;return ye.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(je)})).observe(ye.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",je),n&&n.disconnect()}}},[Se.open,je]),c(function(){var e=De.current;if(e&&Se.open){var n=function(e){ye.current&&ye.current.contains(e.target)||(me(null),We())};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})}}},[Se.open,We]),c(function(){var e=De.current;if(e&&_e.open){var n=function(){Le()};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})}}},[_e.open,Le]);var Ne=l(function(){var n,t,i,r,o,l,c,a,d,u,s,f;return{fields:null!==(n=null==G?void 0:G.fields)&&void 0!==n?n:D,thresholds:{high:null!==(i=null===(t=null==G?void 0:G.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:A.thresholds.high,medium:null!==(o=null===(r=null==G?void 0:G.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(c=null===(l=null==G?void 0:G.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:A.thresholds.exact},relationStyles:{noContent:e(e({},A.relationStyles.noContent),(null===(a=null==G?void 0:G.relationStyles)||void 0===a?void 0:a.noContent)||{}),high:e(e({},A.relationStyles.high),(null===(d=null==G?void 0:G.relationStyles)||void 0===d?void 0:d.high)||{}),exact:e(e({},A.relationStyles.exact),(null===(u=null==G?void 0:G.relationStyles)||void 0===u?void 0:u.exact)||{}),medium:e(e({},A.relationStyles.medium),(null===(s=null==G?void 0:G.relationStyles)||void 0===s?void 0:s.medium)||{}),low:e(e({},A.relationStyles.low),(null===(f=null==G?void 0:G.relationStyles)||void 0===f?void 0:f.low)||{})}}},[G]),Oe=l(function(){if(K&&Object.keys(K).length>0)try{var n=function(n,t){var i,r,o,l,c,a,d,u;void 0===t&&(t=!1);var s=[],f=[],h=n.base_root_id,v=n.input_index_map||{0:"left",1:"right"},p=n[h];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var x=function(t,i){var r=n[t];if(!r)return null;var o=R(r,i,v),l=!!o.title.trim(),c=!!o.content.trim(),a=C(r),d=[];r.next&&Object.values(r.next).forEach(function(e){if(n[e]){var t=x(e,i);t&&d.push(t)}});var u=!(!l&&!c);return e({id:t,title:l?o.title:"",content:c?o.content:"",subsections:d},u?a:{score:void 0,relation:"not_defined"})};if(t){var g={},m={},y=-1,b=-1;for(var w in n)if(!["base_root_id","documents","input_index_map",h].includes(w)){var F=n[w];if(F&&!1!==F.display_node){var I=C(F),E=R(F,"0",v),S=R(F,"1",v),_=E.title.trim()||E.content.trim(),T=S.title.trim()||S.content.trim(),D=Number(null!==(r=null===(i=E.attributes)||void 0===i?void 0:i.display_index)&&void 0!==r?r:y--),A=Number(null!==(l=null===(o=S.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:b--),B=m[A]||e(e({id:w,title:T?S.title:"",content:T?S.content:"",subsections:[]},T?I:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:A}),k=g[D]||e(e({id:w,title:_?E.title:"",content:_?E.content:"",subsections:[]},_?I:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:D});Number(A)>=0&&Number(D)>=0&&(B.refIndexes.includes(Number(D))||B.refIndexes.push(Number(D)),k.refIndexes.includes(Number(A))||k.refIndexes.push(Number(A))),m[A]=B,g[D]=k}}f=Object.values(m).map(function(e){return e}),s=Object.values(g).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}),s.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex})}else p.next&&Object.values(p.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(s.push(x(e,"0")||{id:e,title:"",content:"",subsections:[]}),f.push(x(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(a=null===(c=p.comparison_inputs)||void 0===c?void 0:c[v[0]])||void 0===a?void 0:a.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:s},activeVariants:[{id:"tree-variant-1",title:(null===(u=null===(d=p.comparison_inputs)||void 0===d?void 0:d[v[1]])||void 0===u?void 0:u.title)||"Reference Template",similarity:0,sections:f,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}}]}}(K,ie);return e(e({},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"}},[K,ie]),Pe=Oe.activeProposed,qe=Oe.activeVariants,Xe=Oe.parseError;c(function(){Xe&&ce("Failed to load comparison: ".concat(Xe))},[Xe]);var Ye=r(null),Ve=Ye[0];Ye[1];var Ue=r({}),Ke=Ue[0],Ge=Ue[1],Je=r({}),Qe=Je[0],Ze=Je[1],$e=(null==qe?void 0:qe[0])||H,en=null===(N=null===(L=null==K?void 0:K.documents)||void 0===L?void 0:L[null===(j=null==K?void 0:K.input_index_map)||void 0===j?void 0:j[0]])||void 0===N?void 0:N.title,nn=null===(q=null===(O=null==K?void 0:K.documents)||void 0===O?void 0:O[null===(P=null==K?void 0:K.input_index_map)||void 0===P?void 0:P[1]])||void 0===q?void 0:q.title,tn=I(J||en||"Uploaded Contract"),rn=I(Q||nn||"Reference Template"),on=l(function(){return(null==Pe?void 0:Pe.sections)||[]},[null==Pe?void 0:Pe.sections]),ln=l(function(){return $e.sections||[]},[$e.sections]),cn=on.length>0||ln.length>0,an=$e.analysis,dn=I(null===(Y=null===(X=null==an?void 0:an.rule_difference_comparison)||void 0===X?void 0:X.summary)||void 0===Y?void 0:Y.overall_summary),un=!!dn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),sn=o({}),fn=function(e){return sn.current[e]||(sn.current[e]=i.createRef()),sn.current[e]},hn=a(function(e,n,t,i,r){var o,l,c=I(n.id)||I(t.id)||"",a=(c?pe[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},d=null!==(l=null===(o=sn.current[i])||void 0===o?void 0:o.current)&&void 0!==l?l:null;return{open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:a,anchorEl:e,sectionAnchorEl:d,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==K?void 0:K.documents,input_index_map:null==K?void 0:K.input_index_map}}},[pe]),vn=a(function(e){Le(),me(null),Ce(e)},[Le]),pn=a(function(){null!==_e.sectionIdx&&_e.anchorEl?vn(e(e({},_e),{open:!0})):Le()},[_e,Le,vn]);a(function(e){Le(),ce("".concat(e," is coming soon."))},[Le]);var xn=o(null),gn=o(null),mn=o(null),yn=r([]),bn=yn[0],wn=yn[1],Fn=r(null),In=Fn[0],En=Fn[1],Sn=o(null),Cn=r(null),Rn=Cn[0],_n=Cn[1],Tn=a(function(){null!==Sn.current&&window.cancelAnimationFrame(Sn.current),Sn.current=window.requestAnimationFrame(function(){Pn(),Sn.current=null})},[]),Dn=a(function(){var e=_e.sectionIdx;Le(),null!==e&&(de&&In===e?(ue(!1),En(null),he(!1),ke.current&&(ke.current.style.height="0px"),He.current&&(He.current.style.height="0px")):(ve.current=!0,En(e),ue(!0),he(!1),ke.current&&(ke.current.style.height="0px"),He.current&&(He.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i=null===(n=sn.current[e])||void 0===n?void 0:n.current,r=on[e],o=(null==r?void 0:r.refIndexes)||[],l=null;if(o.length>0){var c=o[0],a=ln.findIndex(function(e){return e.selfIndex===c});l=null===(t=Ln.current[a])||void 0===t?void 0:t.current}var d=null==i?void 0:i.parentElement,u=Be.current;if(i&&d){var s=d.clientHeight,f=i.offsetTop-(s/2-i.offsetHeight/2),h=d.scrollHeight-s,v=Math.max(0,Math.min(f,h)),p=i.offsetTop-v,x=null;if(l&&u){var g=l.offsetTop-p;if(g<0)ke.current&&(ke.current.style.height="".concat(Math.abs(g),"px")),x=0;else{var m=u.scrollHeight-u.clientHeight;g>m?(He.current&&(He.current.style.height="".concat(g-m+150,"px")),x=g):x=g}}M(d,v,300),u&&null!==x?M(u,x,300,function(){he(!0),Tn(),setTimeout(function(){ve.current=!1},50)}):setTimeout(function(){he(!0),Tn(),ve.current=!1},350)}})))},[Le,_e.sectionIdx,de,In,on,ln,Tn]),An=l(function(){return Ne.fields.filter(function(e){var n=e.key;return(!cn||"description"!==n)&&(E(null==Pe?void 0:Pe[n])||E($e[n]))})},[Pe,$e,cn,Ne.fields]),Bn=o({}),kn=o({}),Hn=o({}),zn=o({}),Mn=o({}),Wn=o({}),Ln=o({});An.forEach(function(e){for(var n=e.key,t=0;t<Math.max(on.length,ln.length);t+=1)Hn.current[t]||(Hn.current[t]=i.createRef()),zn.current[t]||(zn.current[t]=i.createRef()),Mn.current[t]||(Mn.current[t]=i.createRef()),Wn.current[t]||(Wn.current[t]=i.createRef()),Ln.current[t]||(Ln.current[t]=i.createRef());Bn.current[n]||(Bn.current[n]=i.createRef()),kn.current[n]||(kn.current[n]=i.createRef())});for(var jn=0;jn<Math.max(on.length,ln.length);jn+=1)Hn.current[jn]||(Hn.current[jn]=i.createRef()),zn.current[jn]||(zn.current[jn]=i.createRef()),Mn.current[jn]||(Mn.current[jn]=i.createRef()),Wn.current[jn]||(Wn.current[jn]=i.createRef()),Ln.current[jn]||(Ln.current[jn]=i.createRef());c(function(){if(Ve){var e=Ne.fields.find(function(e){return e.analysisKey===Ve||e.key===Ve});if(e){var n=Bn.current[e.key]||kn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Ve,Ne.fields]);var Nn=a(function(e){var n,t,i,r,o,l,c,a,d,u=null===(n=null==an?void 0:an.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=u[e],f=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(o=null===(r=null==s?void 0:s.highlights)||void 0===r?void 0:r.ruleB_spans)||void 0===o?void 0:o.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var h=s.mappings[0]||{};return{score:s.score,relation:h.relation||"",highlightsA:(null===(l=h.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=h.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!f}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(a=s.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!f}},[an]),On=a(function(n){var t,i,r,o,l=on[n],c=ln[n],a=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,d=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,u=I(null==l?void 0:l.id)||I(null==c?void 0:c.id)||"",s=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!a&&!d&&!s)return e(e({},Ne.relationStyles.noContent),{label:"Not Defined"});var f=Nn("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==i?i:u?null===(r=pe[u])||void 0===r?void 0:r.relevance_score:void 0)){var h=_(),v=h.score,p=h.relation;return S(v,p,!0,Ne)}var x=a?l.relation:d?c.relation:f.relation,g=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==c?void 0:c.score,m="number"==typeof g?g:f.score;return S(m,x,!0,Ne)},[on,ln,pe,Ne,Nn]),Pn=a(function(){var e,n,t,i,r,o,l,c,a,d,u;if(!ze.current){ze.current=!0;try{if(!xn.current)return;var s=xn.current.getBoundingClientRect();Fe({width:s.width,height:s.height});var f=[];if(An.forEach(function(e){var n,t,i=e.key,r=null===(n=Bn.current[i])||void 0===n?void 0:n.current,o=null===(t=kn.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")}),!ie)for(var h=0;h<Math.min(on.length,ln.length);h++){var v=null===(e=Hn.current[h])||void 0===e?void 0:e.current,p=null===(n=zn.current[h])||void 0===n?void 0:n.current;v&&p&&(v.style.height="auto",p.style.height="auto",v.style.minHeight="0px",p.style.minHeight="0px")}var x={};An.forEach(function(e){var n,t,i=e.key,r=null===(n=Bn.current[i])||void 0===n?void 0:n.current,o=null===(t=kn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),c=o.getBoundingClientRect();x[i]=Math.max(l.height,c.height)}});var g=[];if(!ie)for(h=0;h<Math.min(on.length,ln.length);h++){v=null===(t=Hn.current[h])||void 0===t?void 0:t.current,p=null===(i=zn.current[h])||void 0===i?void 0:i.current;if(v&&p){var m=v.getBoundingClientRect(),y=p.getBoundingClientRect();g[h]=Math.max(m.height,y.height)}}if(An.forEach(function(e){var n,t,i=e.key,r=null===(n=Bn.current[i])||void 0===n?void 0:n.current,o=null===(t=kn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=x[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),!ie)for(h=0;h<g.length;h++){v=null===(r=Hn.current[h])||void 0===r?void 0:r.current,p=null===(o=zn.current[h])||void 0===o?void 0:o.current;if(v&&p){var b=g[h];v.style.minHeight="".concat(b,"px"),p.style.minHeight="".concat(b,"px")}}if(An.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=Bn.current[i])||void 0===n?void 0:n.current,l=null===(t=kn.current[i])||void 0===t?void 0:t.current;if(o&&l){var c=o.getBoundingClientRect(),a=l.getBoundingClientRect(),d=Nn(r),u=S(d.score,d.relation,d.hasContent,Ne);if(!u)return;var h=c.top+c.height/2-s.top;f.push({id:"field-".concat(i),x1:c.right-s.left,y1:h,x2:a.left-s.left,y2:h,style:u})}}),ie)on.forEach(function(e,n){var t;(null===(t=Hn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r=ln.findIndex(function(n){return n.selfIndex===e});if(-1!==r){var o=null===(t=Mn.current[n])||void 0===t?void 0:t.current,l=null===(i=Wn.current[r])||void 0===i?void 0:i.current;if(o&&l){var c=o.getBoundingClientRect(),a=l.getBoundingClientRect(),d=c.right-s.left,u=a.left-s.left,h=c.top+c.height/2-s.top,v=a.top+a.height/2-s.top;de&&In===n&&(v=h);var p=On(n);p&&f.push({id:"line-".concat(n,"-").concat(r),x1:d,y1:h,x2:u,y2:v,style:p,sectionIdx:n,targetRightIdx:r})}}})});else for(h=0;h<Math.min(on.length,ln.length);h++){var w=null===(l=Hn.current[h])||void 0===l?void 0:l.current,F=null===(c=zn.current[h])||void 0===c?void 0:c.current;if(w&&F){var I=w.querySelector(".MuiAccordionSummary-root"),E=F.querySelector(".MuiAccordionSummary-root");if(I&&E){var C=I.getBoundingClientRect(),R=E.getBoundingClientRect(),_=(C.top+C.height/2-s.top+R.top+R.height/2-s.top)/2,T=(null===(a=ln[h])||void 0===a?void 0:a.id)||"sec-".concat(h),D=On(h);D&&f.push({id:T,x1:C.right-s.left,y1:_,x2:R.left-s.left,y2:_,style:D,sectionIdx:h,hasCognitive:!!((null===(d=on[h])||void 0===d?void 0:d.cognitiveData)||(null===(u=ln[h])||void 0===u?void 0:u.cognitiveData)||T&&pe[T])})}}}if(wn(f),gn.current&&mn.current){var A=gn.current.getBoundingClientRect(),B=mn.current.getBoundingClientRect(),k=(A.top+A.height/2-s.top+B.top+B.height/2-s.top)/2;_n({x1:A.right-s.left,x2:B.left-s.left,y:k})}else _n(null)}catch(e){console.error("Line render safe fail: ",e)}finally{ze.current=!1}}},[An,on,ln,pe,Ne,Nn,On,ie,de,In]),qn=a(function(){ve.current||(Tn(),de&&!ve.current&&(ue(!1),En(null),he(!1),ke.current&&(ke.current.style.height="0px"),He.current&&(He.current.style.height="0px")))},[Tn,de]);c(function(){var e=setTimeout(Tn,250);window.addEventListener("resize",Tn);var n=null,t=null;return De.current&&(n=new ResizeObserver(Tn)).observe(De.current),xn.current&&(t=new ResizeObserver(Tn)).observe(xn.current),function(){clearTimeout(e),window.removeEventListener("resize",Tn),null==n||n.disconnect(),null==t||t.disconnect()}},[Pe,$e,an,An,Ke,Qe,on,ln,Ne,Tn,de,In,fe]);var Xn=function(r,o,l,c,a){void 0===a&&(a=1);var u,s=ie?!!Ke["".concat(l,"-").concat(o)]:!!Ke[String(o)],h=E(r.title),v=E(r.content),b=!h&&!v,w=r.title;return h||(w=v?"No Title Found":"No Matching Section Found"),t(d,e({ref:c,sx:e(e({mb:a},ie?{height:"fit-content"}:{minHeight:0}),{display:"flex",flexDirection:"column",position:"relative"})},{children:n(x,e({disableGutters:!0,expanded:!b&&s,onChange:function(){return!b&&function(n,t){Ge(function(i){var r=e({},i);if(!ie){var o=!!i[String(n)];return r[String(n)]=!o,r}var l="".concat(t,"-").concat(n),c=!i[l];if(r[l]=c,"left"===t)((null==(a=on[n])?void 0:a.refIndexes)||[]).forEach(function(e){var n=ln.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=c)});else{var a,d=null==(a=ln[n])?void 0:a.selfIndex;on.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(d))&&(r["left-".concat(n)]=c)})}return r})}(o,l)},sx:{boxShadow:"none",border:b?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:b?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[t(g,e({expandIcon:b?null:t(y,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:b?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:t(p,e({title:w,placement:"top"},{children:t(f,e({sx:{fontSize:"12px",color:b?"#94A3B8":"#19213D",fontWeight:b?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=w,u?I(u).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(i.Fragment,{children:e},n)}):null)}))}))})),!b&&n(m,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[t(f,e({component:"div",sx:Ie},{children:t(F,{children:I(r.content).replace(/\\n/g,"\n")})})),(r.subsections||[]).map(function(e,n){return Yn(e,"".concat(o,"-").concat(n),0)})]}))]}))}),"".concat(l,"-sec-").concat(o))},Yn=function(i,r,o){void 0===o&&(o=0);var l=E(i.title),c=E(i.content),a=!l&&!c,u=l?i.title:c?"No Title Found":"No Matching Section Found",s=!!Qe[r];return i.title?n(x,e({disableGutters:!0,expanded:!a&&s,onChange:function(){return!a&&Ze(function(n){var t;return e(e({},n),((t={})[r]=!n[r],t))})},sx:{mt:1,boxShadow:"none",border:a?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF","&:before":{display:"none"}}},{children:[t(g,e({expandIcon:a?null:t(y,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5}}},{children:t(f,e({sx:{fontSize:"11px",fontWeight:600,color:a?"#94A3B8":"#19213D"}},{children:u||"Untitled Subsection"}))})),!a&&n(m,e({sx:{pt:0,pb:1}},{children:[c&&t(f,e({component:"div",sx:Ie},{children:t(F,{children:I(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(e,n){return Yn(e,"".concat(r,"-").concat(n),o+1)})]}))]}),r):t(d,e({sx:{mt:0===o?1:.75}},{children:!a&&n("div",{children:[c&&t(f,e({component:"div",sx:Ie},{children:t(F,{children:I(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(e,n){return Yn(e,"".concat(r,"-").concat(n),o+1)})]})}),r)};return n(d,e({ref:Ae,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ie?{}:{overflow:"visible"}),{position:"relative"})},{children:[ie&&t(k,{open:_e.open,anchorEl:_e.anchorEl,sectionTitle:_e.sectionTitle,referenceSectionTitle:_e.refSectionTitle,onClose:Le,onOpenCognitiveCompare:pn,onOpenSideBySide:Dn}),Se.open&&t(B,{open:Se.open,popupRef:ye,position:ge,popupConfig:ne,onClose:function(){me(null),Ce(function(n){return e(e({},n),{open:!1})})},markdownStyles:Z,sectionTitle:Se.sectionTitle,referenceSectionTitle:Se.refSectionTitle,cognitiveData:Se.cognitiveData,anchorEl:Se.anchorEl,sectionAnchorEl:Se.sectionAnchorEl,scrollContainerEl:De.current,badgeStyle:Se.badgeStyle,docData:Se.docData}),t(u,e({open:!!le,autoHideDuration:8e3,onClose:function(){return ce(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(s,e({onClose:function(){return ce(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:le}))})),n(d,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[t(d,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:t(f,e({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:U}))})),t(d,e({sx:{display:"flex",alignItems:"center"}},{children:t(h,{control:t(v,{checked:ie,onChange:function(e){return re(e.target.checked)},color:"primary",size:"small"}),label:t(f,e({sx:{fontSize:"13px",fontWeight:500,color:"#64748B"}},{children:"Relative Order"})),labelPlacement:"start",sx:{m:0,gap:1}})}))]})),t(d,e({ref:De,onScroll:qn,sx:{flex:1,minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ie?"hidden":"auto",borderTop:dn&&un?"none":"1.5px solid #EEF0F4"}},{children:t(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ie?{flex:1,minHeight:0}:{})},{children:n(d,e({ref:xn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ie?{flex:1,overflow:"visible"}:{})},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:we.width||"100%",height:we.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Rn&&n("g",{children:[t("line",{x1:Rn.x1,y1:Rn.y,x2:Math.max(Rn.x1,(Rn.x1+Rn.x2)/2-70),y2:Rn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),t("line",{x1:Math.min(Rn.x2,(Rn.x1+Rn.x2)/2+70),y1:Rn.y,x2:Rn.x2,y2:Rn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),bn.map(function(i){var r,o=(i.x1+i.x2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;if(!ie)return n("g",{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),t("foreignObject",e({x:o-100,y:i.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(d,e({onClick:function(e){var n=on[i.sectionIdx]||{title:"",content:""},t=ln[i.sectionIdx]||{title:"",content:""};vn(hn(e.currentTarget,n,t,i.sectionIdx,i.style))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,t(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(w,{})})),t(y,{size:11})]}))}))}))]},i.id);var l=on[i.sectionIdx];return!(null===(r=null==l?void 0:l.refIndexes)||void 0===r?void 0:r.length)||(null==l?void 0:l.selfIndex)<0?null:de&&In===i.sectionIdx&&fe?n("g",e({style:{transition:"opacity 0.2s"}},{children:[t("defs",{children:t("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:t("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(i.id,")")})]}),i.id):null})]})),n(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},ie?{flex:1,overflow:"visible"}:{})},{children:[t(d,e({ref:gn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:t(p,e({title:tn,placement:"top"},{children:t(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:tn}))}))})),t(d,e({onScroll:qn,sx:e({p:"12px",display:"flex",flexDirection:"column"},ie?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:cn&&on.map(function(r,o){var l;if(!ie)return t(d,e({ref:fn(o)},{children:Xn(r,o,"left",Hn.current[o])}),"left-row-".concat(o));var c=r,a=On(o),u=!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)||c.selfIndex<0,s="number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null;return t(d,e({ref:fn(o),sx:{mb:1}},{children:n(d,e({sx:{position:"relative",width:"100%"}},{children:[t(d,e({ref:Hn.current[o],sx:{width:"100%"}},{children:Xn(r,o,"left",i.createRef(),0)})),a&&n(d,e({ref:Mn.current[o],onClick:function(e){var n=ln.find(function(e){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),_e.open&&_e.sectionIdx===i?Le():(We(),Te(hn(e.currentTarget,n,t,i,r)))}(e,r,n,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.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!==s&&t(d,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:s})),t(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:u?"No Deviation Found":0==a.deviationLabel||void 0===a.deviationLabel?"Same":"".concat(a.deviationLabel,"% Deviation")})),t(b,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))})}))]})),t(d,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(d,e({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:[t(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(w,{})})),0,"% Similarity",t(y,{size:11})]}))}))})),n(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},ie?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[t(d,e({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:t(p,e({title:rn,placement:"top"},{children:t(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:rn}))}))})),n(d,e({ref:Be,onScroll:qn,sx:e({p:"12px",display:"flex",flexDirection:"column"},ie?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-160px",pl:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[t("div",{ref:ke,style:{width:"100%",height:"0px",flexShrink:0}}),cn&&ln.map(function(r,o){if(!ie)return Xn(r,o,"right",zn.current[o]);var l=r,c=on.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});return t(d,e({ref:Ln.current[o],sx:{mb:1}},{children:n(d,e({sx:{position:"relative",width:"100%"}},{children:[t(d,e({ref:zn.current[o],sx:{width:"100%"}},{children:Xn(r,o,"right",i.createRef(),0)})),t(d,e({ref:Wn.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:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),t("div",{ref:He,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{W as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],
|
|
1
|
+
var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],i={fields:e,thresholds:{exact:90,high:70,medium:40},relationStyles:{noContent:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F8FAFC",badgeBorder:"#F1F5F9",badgeText:"#64748B",highlightBg:"transparent"},exact:{bg:"#FFF1F2",border:"#FECDD3",badgeBg:"#FFE4E6",badgeBorder:"#FEE2E2",badgeText:"#9F1239",highlightBg:"#FECDD3"},high:{bg:"#FFF5F5",border:"#FECACA",badgeBg:"#FEECEC",badgeBorder:"#F8C2C2",badgeText:"#B42318",highlightBg:"#FDD5D5"},medium:{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3"},low:{bg:"#F5F9FF",border:"#CFE0FF",badgeBg:"#EEF4FF",badgeBorder:"#BFD3FF",badgeText:"#1D4ED8",highlightBg:"#DCEAFF"}}},t={fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden","& p":{mt:0,mb:1.5},"& p:last-child":{mb:0},"& ul":{mt:0,mb:1.5,pl:2.5,listStyleType:"disc"},"& ol":{mt:0,mb:1.5,pl:2.5,listStyleType:"decimal"},"& li":{mb:.5},"& strong":{fontWeight:600},"& code":{whiteSpace:"pre-wrap",wordBreak:"break-word"}},a={tabs:{deviation:{key:"deviation",label:"Deviation Analysis",subtitle:"Why this is a deviation?",placeholderTitle:"Deviation Analysis",placeholderBody:"Deviation analysis content will appear here..."},association:{key:"association",label:"Association Logic",subtitle:"Why these sections are paired?"}},decisionStrengthLabel:"Decision Strength",sectionTitles:{decisioningFactors:"Decision Making Factors",gaps:"Gaps in Decision"},emptyStateMessage:"No cognitive decisioning data available for this section.",accentColor:"#5928ED"};export{i as DEFAULT_COMPARISON_CONFIG,e as DEFAULT_FIELD_CONFIG,a as DEFAULT_POPUP_CONFIG,t as SHARED_MARKDOWN_STYLES};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompareConfig.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";var i=function(n){return null==n?"":"string"==typeof n?n:Array.isArray(n)?n.map(i).join("\n\n"):"object"==typeof n?JSON.stringify(n):String(n)},
|
|
1
|
+
import{__assign as n}from"tslib";var i=function(n){return null==n?"":"string"==typeof n?n:Array.isArray(n)?n.map(i).join("\n\n"):"object"==typeof n?JSON.stringify(n):String(n)},t=function(n){return null!=n&&("string"==typeof n?n.trim().length>0:!Array.isArray(n)||n.length>0&&n.some(function(n){return t(n)}))},e=function(n,t,e){var r,o=e[t],a=null===(r=null==n?void 0:n.comparison_inputs)||void 0===r?void 0:r[o];return{title:i((null==a?void 0:a.title)||""),content:i((null==a?void 0:a.content)||""),attributes:(null==a?void 0:a.additional_attributes)||null,subsections:(null==a?void 0:a.subsections)||[]}},r=function(n){if(!n.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var i=n.mapping_rationale,t=parseInt(i.decision_strength||"0");return{cognitiveData:{decisioning:i.decisioning_factors||[],gap:i.gaps_in_decision||[],relevance_score:t,citations:i.citations},score:0,relation:"N/A"}},o=function(n){return n&&"string"==typeof n?"N/A"===n.toUpperCase()?"N/A":n.split("_").map(function(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}).join(" "):"Unknown"},a=function(i,t,e,r){var a=100*(i||0),l=r.thresholds,s=r.relationStyles;if(!e)return null;var c=o(t),u=(t||"").toLowerCase();return"n/a"===u||u.includes("no_deviation")?n(n({},s.low),{label:c}):u.includes("deviation")||u.includes("high_risk")||u.includes("critical")?n(n({},s.high),{label:c}):a>=l.exact?n(n({},s.exact),{label:c}):a>=l.high?n(n({},s.high),{label:c}):a>=l.medium?n(n({},s.medium),{label:c}):n(n({},s.low),{label:c})},l=function(n){return{score:0,relation:"N/A"}};export{l as cognitiveScoreToRelation,o as formatRelationToLabel,r as getRationale,e as getSideData,a as getStyleForRelation,t as hasValue,i as safeStringify};
|
|
2
2
|
//# sourceMappingURL=CognitiveComparehelpers.js.map
|