@viswa-test/test-citation 0.0.50 → 0.0.52
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/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/ThreeDotsLoader.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/ThreeDotsLoader.js.map +1 -0
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/components/ThreeDotsLoader.js +2 -0
- package/dist/features/CognitiveCompare/components/ThreeDotsLoader.js.map +1 -0
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +390 -3371
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +4 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/ThreeDotsLoader.d.ts +8 -0
- package/dist/types/src/features/CognitiveCompare/components/ThreeDotsLoader.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),a=require("react-markdown"),s=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),u=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("rehype-raw");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=p(t),h=p(a),x=p(f),_="::",m=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},y=g.default.memo(function(r){var l=r.content,a=r.sxStyles,c=r.deviationBadges,u=void 0===c?[]:c,d=r.highlights,v=void 0===d?[]:d,f=r.maintainRelativeOrder,p=void 0===f||f,g=r.highlightBg,_=t.useMemo(function(){return u.reduce(function(n,t){var i;return e.__assign(e.__assign({},n),((i={})[t.id]=t,i))},{})},[u]),m=t.useMemo(function(){return{mark:function(t){var i=t.children;return n.jsx("span",e.__assign({style:{backgroundColor:g,borderRadius:"2px"}},{children:i}))},span:function(t){var r,l,a,s,c,u=t.children,d=e.__rest(t,["children"]),v=d["data-badge-id"];if(!v)return n.jsx("span",e.__assign({},d,{children:u}));var f=_[v];return f?n.jsxs(i.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[u,n.jsx(i.Box,e.__assign({ref:f.badgeRef,onClick:f.onClick,sx:e.__assign(e.__assign({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",bgcolor:(null===(r=f.style)||void 0===r?void 0:r.badgeBg)||"#EEF2FF",color:(null===(l=f.style)||void 0===l?void 0:l.badgeText)||I,border:"1px solid ".concat((null===(a=f.style)||void 0===a?void 0:a.badgeBorder)||"#C7D2FE"),borderRadius:"12px",px:1,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},"left"===f.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),f.isConnected&&f.style&&{outline:"2px solid ".concat(f.style.badgeBorder),outlineOffset:"1px"})},{children:n.jsxs(n.Fragment,{children:[n.jsx(i.Box,e.__assign({component:"span",sx:e.__assign({fontSize:"10px",fontWeight:700},"left"===f.side?{pr:.5,borderRight:"1px solid ".concat((null===(s=f.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE")}:{})},{children:f.label})),"left"===f.side&&n.jsxs(n.Fragment,{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"10px",px:.25}},{children:null!=f.score&&"N/A"!==f.score&&"NA"!==f.score&&0!==f.score?"".concat(f.score):"N/A"===f.score||"NA"===f.score?"N/A":"Same"})),n.jsx(o.EllipsisVertical,{size:10,color:(null===(c=f.style)||void 0===c?void 0:c.badgeText)||"#3730A3"})]})]})}))]})):n.jsx("span",e.__assign({},d,{children:u}))}}},[_,p]),y=t.useMemo(function(){var e=l||"",n={},t=0;return function(){var i=null==u?void 0:u[0];if(i&&i.highlight){var o=i.highlight.replace(/\\(['’])/g,"$1"),r="__DEV_TOKEN_".concat(t++,"__");n[r]='<span data-badge-id="'.concat(i.id,'"><mark>').concat(o,"</mark></span>"),e=e.replace(o,r)}}(),v.forEach(function(i){if(i){var o=i.replace(/\\(['’])/g,"$1"),r="__HL_TOKEN_".concat(t++,"__");n[r]="<mark>".concat(o,"</mark>"),e=e.split(o).join(r)}}),Object.keys(n).forEach(function(t){e=e.split(t).join(n[t])}),e},[l,u,v]);return n.jsx(i.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},a),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:n.jsx(h.default,e.__assign({components:m,rehypePlugins:[x.default]},{children:s.safeStringify(y).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;if(e.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var o=0;o<t.length;o++)if(t[o]!==i[o])return!1;var r=e.deviationBadges||[],l=n.deviationBadges||[];if(r.length!==l.length)return!1;for(o=0;o<r.length;o++){if(r[o].id!==l[o].id)return!1;if(r[o].label!==l[o].label)return!1;if(r[o].isConnected!==l[o].isConnected)return!1}return!0}),b=function(e,n,t,i,o){void 0===o&&(o=14);var r=e+.5*(t-e),l=i-n;if(Math.abs(l)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var a=l>0?1:-1,s=Math.min(o,Math.abs(l)/2,Math.abs(r-e)/2,Math.abs(t-r)/2);return["M ".concat(e," ").concat(n),"H ".concat(r-s),"Q ".concat(r," ").concat(n," ").concat(r," ").concat(n+a*s),"V ".concat(i-a*s),"Q ".concat(r," ").concat(i," ").concat(r+s," ").concat(i),"H ".concat(t)].join(" ")},S={id:"",title:""},R={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},I="#3730A3",C=function(e,n,t,i,o){void 0===t&&(t=300);var r=e.style.scrollBehavior;e.style.scrollBehavior="auto";var l=e.scrollTop,a=n-l,s=null,c=function(u){null===s&&(s=u);var d,v=u-s;v<t?(e.scrollTop=(d=v,d/=t,a*(--d*d*d+1)+l),o&&o(),requestAnimationFrame(c)):(e.scrollTop=n,e.style.scrollBehavior=r,o&&o(),i&&i())};requestAnimationFrame(c)};exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(a){var f,p,h,x,B,w,j,E,F=a.componentHeaderText,T=void 0===F?"Contract Comparison":F,M=a.treeData,k=a.comparisonConfig,A=a.leftColumnTitleText,D=a.rightColumnTitleText,O=a.markdownStyles,H=a.displayConfig,N=void 0===H?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:H,L=a.popupConfig,W=a.deviationData,z=void 0===W?{}:W,P=t.useState(N.maintainRelativeOrder),q=P[0],V=P[1],Y=t.useState(!1),K=Y[0],X=Y[1],U=t.useState(!1),G=U[0],$=U[1],J=t.useState(null),Q=J[0],Z=J[1],ee=t.useState(!1),ne=ee[0],te=ee[1],ie=t.useState(!1),oe=ie[0],re=ie[1],le=t.useRef(!1),ae=t.useState(null),se=ae[0],ce=ae[1],ue=t.useState(new Set),de=ue[0],ve=ue[1],fe=t.useState([]),pe=fe[0],ge=fe[1],he=t.useRef(null),xe=t.useRef(!1),_e=t.useRef(null),me=t.useRef({}),ye=t.useRef([]),be=t.useRef(!1),Se=t.useRef(!1),Re=t.useRef(null),Ie=t.useMemo(function(){return(null==M?void 0:M.cognitive_decisioning)||{}},[M]),Ce=t.useState(null),Be=Ce[0],we=Ce[1],je=t.useRef(null),Ee=t.useState({width:0,height:0}),Fe=Ee[0],Te=Ee[1],Me=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),O)},[O]),ke=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),Ae=ke[0],De=ke[1],Oe=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),He=Oe[0],Ne=Oe[1],Le=t.useRef(null),We=t.useRef(null),ze=t.useRef(null),Pe=t.useRef(null),qe=t.useRef(null),Ve=t.useRef(null),Ye=t.useRef(null),Ke=t.useRef(null),Xe=t.useRef(!1),Ue=t.useRef(null);t.useEffect(function(){Ue.current=null},[Ae.sectionIdx,Ae.open]);var Ge=t.useCallback(function(){we(null),De(R),ce(null)},[]),$e=t.useCallback(function(){Ne(R)},[]),Je=t.useCallback(function(){var e;if(Ae.anchorEl&&Ae.refSectionTitle){var n=Ae.anchorEl.getBoundingClientRect(),t=(null===(e=null==je?void 0:je.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<t&&r>o;null!==Ue.current?!0===Ue.current&&(l=r>=t||r>=o):l=!(o>=t||o>=r),Ue.current=l;var a=l?r:o,s=Math.min(t||9999,a),c=l?n.top-12-s:n.bottom+12,u=n.left+n.width/2,d=u-i/2,v=Math.max(12,Math.min(d,window.innerWidth-i-12)),f=Math.max(14,Math.min(u-v,i-10-4));we({top:c,left:v,arrowLeft:f,openAbove:l,maxHeight:a})}},[Ae.anchorEl,Ae.refSectionTitle]);t.useEffect(function(){if(Ae.open){window.addEventListener("resize",Je);var e=requestAnimationFrame(Je),n=null;return je.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(Je)})).observe(je.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",Je),n&&n.disconnect()}}},[Ae.open,Je]),t.useEffect(function(){var e=Le.current;if(e&&Ae.open){var n=function(e){je.current&&je.current.contains(e.target)||(we(null),Ge())};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[Ae.open,Ge]),t.useEffect(function(){var e=Le.current;if(e&&He.open){var n=function(){$e()};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[He.open,$e]);var Qe=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==k?void 0:k.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==k?void 0:k.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==k?void 0:k.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==k?void 0:k.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[k]),Ze=t.useMemo(function(){if(M&&Object.keys(M).length>0)try{var n=function(n,t,i){var o,r,l,a,c;void 0===t&&(t=!1),void 0===i&&(i=null);var u=n.nodes||n,d=[],v=[],f=n.base_root_id,p=n.input_index_map||{0:"left",1:"right"},g=n[f]||u[f];if((null===(o=null==i?void 0:i[f])||void 0===o?void 0:o.evaluation_result)||f.evaluation_result,!g||!1===g.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,o){var r,l,a,c=n[t]||u[t];if(!c||!1===c.display_node)return null;var d=s.getSideData(c,o,p),v=!1!==(null===(r=d.attributes)||void 0===r?void 0:r.display_title),f=!1!==(null===(l=d.attributes)||void 0===l?void 0:l.display_content),g=!!d.title.trim(),x=!!d.content.trim(),_=s.getRationale(c),m=(null===(a=null==i?void 0:i[t])||void 0===a?void 0:a.evaluation_result)||c.evaluation_result||null,y=[];c.next&&Object.values(c.next).forEach(function(e){var n=u[e];if(n&&!1!==n.display_node){var t=h(e,o);t&&y.push(t)}});var b=!(!g&&!x);return e.__assign(e.__assign({id:t,title:g?d.title:"",content:x?d.content:"",displayTitle:v,displayContent:f,subsections:y},b?_:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(t){var x=function(t,o){var r,l,a,c,d,v,f,g,h,_,m,y,b,S,R,I,C,B,w,j,E;void 0===o&&(o=0);var F=[],T=[];if(!t)return{refSections:F,baseSections:T};var M={},k={},A=-1,D=-1;for(var O in t){var H=t[O],N=n[H]||u[H];if(N&&!1!==N.display_node){var L=s.getRationale(N),W=(null===(r=null==i?void 0:i[H])||void 0===r?void 0:r.evaluation_result)||N.evaluation_result||null,z=s.getSideData(N,"1",p),P=s.getSideData(N,"0",p),q=!1!==(null===(l=z.attributes)||void 0===l?void 0:l.display_title)&&z.title.trim()||!1!==(null===(a=z.attributes)||void 0===a?void 0:a.display_content)&&z.content.trim(),V=!1!==(null===(c=P.attributes)||void 0===c?void 0:c.display_title)&&P.title.trim()||!1!==(null===(d=P.attributes)||void 0===d?void 0:d.display_content)&&P.content.trim(),Y=Number(null!==(f=null===(v=z.attributes)||void 0===v?void 0:v.display_index)&&void 0!==f?f:A--),K=Number(null!==(h=null===(g=P.attributes)||void 0===g?void 0:g.display_index)&&void 0!==h?h:D--),X=M[Y]||e.__assign(e.__assign({id:H,title:!1!==(null===(_=z.attributes)||void 0===_?void 0:_.display_title)?z.title:"",content:!1!==(null===(m=z.attributes)||void 0===m?void 0:m.display_content)?z.content:"",subsections:[]},q?L:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:Y,evaluationResult:W,displayContent:null===(y=z.attributes)||void 0===y?void 0:y.display_content,displayTitle:null===(b=z.attributes)||void 0===b?void 0:b.display_title}),U=k[K]||e.__assign(e.__assign({id:H,title:!1!==(null===(S=P.attributes)||void 0===S?void 0:S.display_title)?P.title:"",content:!1!==(null===(R=P.attributes)||void 0===R?void 0:R.display_content)?P.content:"",subsections:[]},V?L:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:K,evaluationResult:W,displayContent:null===(I=P.attributes)||void 0===I?void 0:I.display_content,displayTitle:null===(C=P.attributes)||void 0===C?void 0:C.display_title});Number(Y)>=0&&Number(K)>=0&&((null===(B=X.refIndexes)||void 0===B?void 0:B.includes(Number(K)))||null===(w=X.refIndexes)||void 0===w||w.push(Number(K)),(null===(j=U.refIndexes)||void 0===j?void 0:j.includes(Number(Y)))||null===(E=U.refIndexes)||void 0===E||E.push(Number(Y))),M[Y]=X,k[K]=U;var G=x(N.next,o+1),$=G.refSections,J=G.baseSections;$.length>0&&(X.subsections=e.__spreadArray(e.__spreadArray([],X.subsections||[],!0),$,!0)),J.length>0&&(U.subsections=e.__spreadArray(e.__spreadArray([],U.subsections||[],!0),J,!0))}}return F=Object.values(M).map(function(e){return e}),T=Object.values(k).map(function(e){return e}),F.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),T.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),{refSections:F,baseSections:T}},_=x(g.next),m=_.refSections,y=_.baseSections;v=m,d=y}else g.next&&Object.values(g.next).forEach(function(e){var t=n[e]||u[e];t&&!1!==t.display_node&&(d.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),v.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(r=g.comparison_inputs)||void 0===r?void 0:r[p[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:g.decision_scope_description||"",sections:d},activeVariants:[{id:"tree-variant-1",title:(null===(c=null===(a=g.comparison_inputs)||void 0===a?void 0:a[p[1]])||void 0===c?void 0:c.title)||"Reference Template",similarity:0,sections:v,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:g.decision_scope_description||""},fields:{}}}}]}}(M,q,z);return e.__assign(e.__assign({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[JSON.stringify(M),q,JSON.stringify(z)]),en=Ze.activeProposed,nn=Ze.activeVariants,tn=Ze.parseError;t.useEffect(function(){tn&&Z("Failed to load comparison: ".concat(tn))},[tn]);var on=t.useState(null),rn=on[0];on[1];var ln=t.useState({}),an=ln[0],sn=ln[1],cn=t.useState({}),un=cn[0],dn=cn[1],vn=(null==nn?void 0:nn[0])||S,fn=null===(h=null===(f=null==M?void 0:M.documents)||void 0===f?void 0:f[null===(p=null==M?void 0:M.input_index_map)||void 0===p?void 0:p[0]])||void 0===h?void 0:h.title,pn=null===(w=null===(x=null==M?void 0:M.documents)||void 0===x?void 0:x[null===(B=null==M?void 0:M.input_index_map)||void 0===B?void 0:B[1]])||void 0===w?void 0:w.title,gn=s.safeStringify(A||fn||"Uploaded Contract"),hn=s.safeStringify(D||pn||"Reference Template"),xn=t.useMemo(function(){return(null==en?void 0:en.sections)||[]},[null==en?void 0:en.sections]),_n=t.useMemo(function(){return vn.sections||[]},[vn.sections]),mn=xn.length>0||_n.length>0,yn=vn.analysis,bn=s.safeStringify(null===(E=null===(j=null==yn?void 0:yn.rule_difference_comparison)||void 0===j?void 0:j.summary)||void 0===E?void 0:E.overall_summary),Sn=!!bn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Rn=t.useMemo(function(){var e,n,t={},i={},o=null===(e=null==M?void 0:M.input_index_map)||void 0===e?void 0:e[0],r=null===(n=null==M?void 0:M.input_index_map)||void 0===n?void 0:n[1],l=new Map,a=function(e){return e&&e.id?(l.has(e.id)||l.set(e.id,s.safeStringify(e.content||"").replace(/\\n/g,"\n")),l.get(e.id)):""},c=function(e,n,s,u,d){var v,f,p,g,h,x,y,b;e&&!d&&function(e,n,s,c){var u,d=(null===(u=null==e?void 0:e.evaluationResult)||void 0===u?void 0:u.deviations)||{};Object.keys(d).sort().forEach(function(u){var v=d[u];if(v){var f=v[o],p=v[r],g=!1,h=!1;if(!m(f)){var x=f.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n&&x){var y=a(n);y.includes(x)&&(g=!0,l.set(n.id,y.replace(x,"__TOKEN__")))}}if(!m(p)){var b=p.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(s&&b){var S=a(s);S.includes(b)&&(h=!0,l.set(s.id,S.replace(b,"__TOKEN__")))}}if(g||h){var R="".concat(e.id).concat(_).concat(u);void 0===t[R]&&(void 0===i[c]&&(i[c]=1),t[R]=i[c]++)}}})}(e,n,s,u);for(var S=Math.max((null===(v=null==n?void 0:n.subsections)||void 0===v?void 0:v.length)||0,(null===(f=null==s?void 0:s.subsections)||void 0===f?void 0:f.length)||0,(null===(p=null==e?void 0:e.subsections)||void 0===p?void 0:p.length)||0),R=0;R<S;R++)c((null===(g=null==e?void 0:e.subsections)||void 0===g?void 0:g[R])||(null===(h=null==n?void 0:n.subsections)||void 0===h?void 0:h[R])||(null===(x=null==s?void 0:s.subsections)||void 0===x?void 0:x[R]),null===(y=null==n?void 0:n.subsections)||void 0===y?void 0:y[R],null===(b=null==s?void 0:s.subsections)||void 0===b?void 0:b[R],u,!1)};return xn.forEach(function(e,n){var t,i=n+1;q&&void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1);var o=null;if(q){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0];o=_n.find(function(e){return e.selfIndex===r})}else o=_n[n];c(e,e,o,i,!0)}),_n.forEach(function(e,n){var t,i=n+1,o=!1;if(q){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0],l=xn.find(function(e){return e.selfIndex===r});l&&void 0!==l.selfIndex&&l.selfIndex>=0?i=l.selfIndex+1:(o=!0,void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1))}else n>=xn.length&&(o=!0);o&&c(e,null,e,i,!0)}),t},[xn,_n,q,M]),In=t.useRef({}),Cn=function(e){return In.current[e]||(In.current[e]=g.default.createRef()),In.current[e]},Bn=t.useCallback(function(){var e,n,t,i;te(!1),Se.current=!1;var o=Re.current,r=kn.current;if(null!==o)if("string"==typeof o&&o.includes(_)){var l=o.split(_);(a=null===(e=et.current[l[2]])||void 0===e?void 0:e.current)&&(a.style.paddingTop="0px")}else{var a;(a=null===(n=Gn.current[o])||void 0===n?void 0:n.current)&&(a.style.paddingTop="0px")}if(null!==r)if("string"==typeof r&&r.includes(_)){l=r.split(_);(s=null===(t=nt.current[l[3]])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}else{var s;(s=null===(i=$n.current[r])||void 0===i?void 0:i.current)&&(s.style.paddingTop="0px")}Pn(null),Re.current=null,kn.current=null,re(!1),$(!1),Pe.current&&(Pe.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ve.current&&(Ve.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px")},[]),wn=t.useCallback(function(e,n,t,i,o,r){var l,a,c=s.safeStringify(n.id)||s.safeStringify(t.id)||"",u=(c?Ie[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},d=null!==(a=null===(l=In.current[i])||void 0===l?void 0:l.current)&&void 0!==a?a:null;return{open:!0,sectionTitle:n.displayTitle?n.title:"no title",refSectionTitle:t.displayTitle?t.title:"no title",cognitiveData:u,anchorEl:e,sectionAnchorEl:d,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==M?void 0:M.documents,input_index_map:null==M?void 0:M.input_index_map},deviationData:n.evaluationResult||t.evaluationResult||null,isOrphan:!!o}},[Ie,M]),jn=t.useCallback(function(e){$e(),we(null),De(e)},[$e]),En=function(e,n,t,i,o,r){e.stopPropagation(),He.open&&He.sectionIdx===o?$e():(Ge(),Ne(wn(e.currentTarget,n,i,o,t,r)))},Fn=t.useCallback(function(){null!==He.sectionIdx&&He.anchorEl?jn(e.__assign(e.__assign({},He),{open:!0})):$e()},[He,$e,jn]),Tn=t.useCallback(function(){var e=He.sectionIdx,n=He.isOrphan;$e(),null!==e&&(n?Z("No counterpart exists to connect to."):(Se.current&&Bn(),ve(function(n){return n.has(e)?new Set:new Set([e])})))},[He.sectionIdx,$e,Bn]),Mn=t.useRef(null),kn=t.useRef(null),An=t.useRef(null),Dn=t.useRef(null),On=t.useRef(null),Hn=t.useState([]),Nn=Hn[0],Ln=Hn[1],Wn=t.useState(null),zn=Wn[0],Pn=Wn[1];t.useRef(null);var qn=t.useState(null),Vn=qn[0],Yn=qn[1],Kn=t.useMemo(function(){return Qe.fields.filter(function(e){var n=e.key;return(!mn||"description"!==n)&&(s.hasValue(null==en?void 0:en[n])||s.hasValue(vn[n]))})},[en,vn,mn,Qe.fields]),Xn=t.useRef({}),Un=t.useRef({}),Gn=t.useRef({}),$n=t.useRef({}),Jn=t.useRef({}),Qn=t.useRef({}),Zn=t.useRef({}),et=t.useRef({}),nt=t.useRef({});Kn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(xn.length,_n.length);t+=1)Gn.current[t]||(Gn.current[t]=g.default.createRef()),$n.current[t]||($n.current[t]=g.default.createRef()),Jn.current[t]||(Jn.current[t]=g.default.createRef()),Qn.current[t]||(Qn.current[t]=g.default.createRef()),Zn.current[t]||(Zn.current[t]=g.default.createRef());Xn.current[n]||(Xn.current[n]=g.default.createRef()),Un.current[n]||(Un.current[n]=g.default.createRef())});for(var tt=0;tt<Math.max(xn.length,_n.length);tt+=1)Gn.current[tt]||(Gn.current[tt]=g.default.createRef()),$n.current[tt]||($n.current[tt]=g.default.createRef()),Jn.current[tt]||(Jn.current[tt]=g.default.createRef()),Qn.current[tt]||(Qn.current[tt]=g.default.createRef()),Zn.current[tt]||(Zn.current[tt]=g.default.createRef());t.useEffect(function(){if(rn){var e=Qe.fields.find(function(e){return e.analysisKey===rn||e.key===rn});if(e){var n=Xn.current[e.key]||Un.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[rn,Qe.fields]);var it=t.useCallback(function(e){var n,t,i,o,r,l,a,s,c,u=null===(n=null==yn?void 0:yn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(a=f.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[yn]),ot=t.useCallback(function(n){var t,i,o,r,l,a,c,u=xn[n],d=_n[n],v=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,f=(null==d?void 0:d.relation)&&"not_defined"!==d.relation;s.safeStringify(null==u?void 0:u.id)||s.safeStringify(null==d?void 0:d.id);var p=!(!(null==u?void 0:u.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!v&&!f&&!p)return e.__assign(e.__assign({},s.generateColorPalette(I)),{label:"Not Defined"});var g=null!==(i=null!==(t=null==u?void 0:u.evaluationResult)&&void 0!==t?t:null==d?void 0:d.evaluationResult)&&void 0!==i?i:null,h=null===(o=null==g?void 0:g.evaluation_outputs)||void 0===o?void 0:o.output_value,x=null!==(a=null===(l=null===(r=null==g?void 0:g.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===l?void 0:l.label_color)&&void 0!==a?a:I;return null!=g?e.__assign(e.__assign({},s.generateColorPalette(x)),{label:null!==(c=h)&&void 0!==c?c:""}):e.__assign(e.__assign({},s.generateColorPalette(x)),{label:"N/A"})},[xn,_n,Ie,Qe,it]),rt=t.useCallback(function(n){for(var t,i,o,r,l,a,c,u,d,v=n.split("-").map(Number),f=xn[v[0]],p=_n[v[0]],g=1;g<v.length;g++)(null==f?void 0:f.subsections)&&(f=f.subsections[v[g]]),(null==p?void 0:p.subsections)&&(p=p.subsections[v[g]]);if(!f&&!p)return null;var h=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,x=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,_=s.safeStringify(null==f?void 0:f.id)||s.safeStringify(null==p?void 0:p.id)||"",m=!(!(null==f?void 0:f.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!h&&!x&&!m)return e.__assign(e.__assign({},s.generateColorPalette(I)),{label:"Not Defined"});null!==(i=null!==(t=null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||_&&(null===(o=Ie[_])||void 0===o||o.relevance_score);var y=null!==(l=null!==(r=null==f?void 0:f.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,b=null===(a=null==y?void 0:y.evaluation_outputs)||void 0===a?void 0:a.output_value,S=null!==(d=null===(u=null===(c=null==y?void 0:y.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===u?void 0:u.label_color)&&void 0!==d?d:I;return null!=y?e.__assign(e.__assign({},s.generateColorPalette(S)),{label:null!=b?b:""}):e.__assign(e.__assign({},s.generateColorPalette(S)),{label:"N/A"})},[xn,_n,Ie,Qe]),lt=t.useCallback(function(){var e,n,t,i,o,r,l,a,s,c,u,d,v,f,p,g,h,x,m,y,S,R;if(!Xe.current&&!xe.current){Xe.current=!0;try{if(!Mn.current)return;var I=function(e){var n=e.split("-"),t=n[0];if(!an[t]&&!1===q)return!1;if(q&&!an["left-".concat(t)]&&!an["right-".concat(t)]&&!an[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!un[i])return!1;return!0},C=Mn.current.getBoundingClientRect();Te({width:C.width,height:C.height});var B=[];if(Kn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!xe.current){for(var w=0;w<Math.max(xn.length,_n.length);w++){var j=null===(e=Gn.current[w])||void 0===e?void 0:e.current,E=null===(n=$n.current[w])||void 0===n?void 0:n.current;j&&(j.style.height="auto",j.style.minHeight="0px"),E&&(E.style.height="auto",E.style.minHeight="0px")}q||Object.keys(et.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=et.current[e])||void 0===n?void 0:n.current,o=null===(t=nt.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var F={};Kn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),a=r.getBoundingClientRect();F[i]=Math.max(l.height,a.height)}});var T={left:{},right:{}},M={};if(!xe.current)if(q){if(ne&&null!==zn)if("number"==typeof zn){var k=zn,A=xn[k],D=null===(o=Gn.current[k])||void 0===o?void 0:o.current;D&&A&&(A.refIndexes||[]).forEach(function(e){var n,t=_n.findIndex(function(n){return n.selfIndex===e}),i=null===(n=$n.current[t])||void 0===n?void 0:n.current;if(i&&(an["left-".concat(k)]||an["right-".concat(t)])){var o=Math.max(D.getBoundingClientRect().height,i.getBoundingClientRect().height);T.left[k]=Math.max(T.left[k]||0,o),T.right[t]=Math.max(T.right[t]||0,o)}})}else{var O=zn.split(_)[2];if(O){j=null===(r=et.current[O])||void 0===r?void 0:r.current,E=null===(l=nt.current[O])||void 0===l?void 0:l.current;if(j&&E){H=Math.max(j.getBoundingClientRect().height,E.getBoundingClientRect().height);M[O]=Math.max(M[O]||0,H)}}}}else{Object.keys(et.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=et.current[e])||void 0===n?void 0:n.current,o=null===(t=nt.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),a=Math.max(r.height,l.height);M[e]=a,i.style.minHeight="".concat(a,"px"),o.style.minHeight="".concat(a,"px")}}});for(w=0;w<Math.min(xn.length,_n.length);w++){var j=null===(t=Gn.current[w])||void 0===t?void 0:t.current,E=null===(i=$n.current[w])||void 0===i?void 0:i.current;if(j&&E){var H=Math.max(j.getBoundingClientRect().height,E.getBoundingClientRect().height);T.left[w]=H,T.right[w]=H}}}if(Kn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=F[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),xe.current||(Object.entries(T.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Gn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(T.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=$n.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),q||Object.keys(M).forEach(function(e){var n,t,i=null===(n=et.current[e])||void 0===n?void 0:n.current,o=null===(t=nt.current[e])||void 0===t?void 0:t.current;if(i&&o&&M[e]){var r=M[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),q)xn.forEach(function(e,n){var t;(null===(t=Gn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,a,s,c,u,d,v=_n.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=Jn.current[n])||void 0===t?void 0:t.current,p=null===(i=Qn.current[v])||void 0===i?void 0:i.current;if(f&&p){var g=f.getBoundingClientRect(),h=p.getBoundingClientRect(),x=g.right-C.left,_=h.left-C.left,m=g.top+g.height/2-C.top,y=h.top+h.height/2-C.top;if(ne&&zn===n){var b=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(a=null===(l=ze.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==a?a:0,R=b+(null!==(c=null===(s=Ke.current)||void 0===s?void 0:s.clientHeight)&&void 0!==c?c:1/0),I=S+(null!==(d=null===(u=ze.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),w=g.top+g.height/2,j=function(e,n,t){return Math.max(n,Math.min(t,e))};m=j(w,b,R)-C.top,y=j(w,S,I)-C.top}var E=ot(n);E&&B.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:y,style:E,sectionIdx:n,targetRightIdx:v})}}})});else for(w=0;w<Math.min(xn.length,_n.length);w++){var N=null===(a=Gn.current[w])||void 0===a?void 0:a.current,L=null===(s=$n.current[w])||void 0===s?void 0:s.current;if(N&&L){var W=N.getBoundingClientRect(),z=L.getBoundingClientRect(),P=Math.max(W.top,z.top)+18-C.top,V=(null===(c=_n[w])||void 0===c?void 0:c.id)||"sec-".concat(w);(Q=ot(w))&&B.push({id:V,x1:W.right-C.left,y1:P,x2:z.left-C.left,y2:P,style:Q,sectionIdx:w,hasCognitive:!!((null===(u=xn[w])||void 0===u?void 0:u.cognitiveData)||(null===(d=_n[w])||void 0===d?void 0:d.cognitiveData)||V&&Ie[V]),isSubSection:!1})}}if(ne&&"string"==typeof zn&&zn.includes(_)){var Y=zn.split(_),K=Y[0],X=Y[1],U=Y[2],G=(Y[3],"".concat(K).concat(_).concat(X)),$=null===(v=Jn.current[G])||void 0===v?void 0:v.current,J=null===(f=Qn.current[G])||void 0===f?void 0:f.current;if($&&J){var Q,Z=$.getBoundingClientRect(),ee=J.getBoundingClientRect(),te=Z.right-C.left,ie=ee.left-C.left,oe=Z.top+Z.height/2-C.top,re=ee.top+ee.height/2-C.top;if(q){var le=null!==(g=null===(p=Ke.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==g?g:0,ae=null!==(x=null===(h=ze.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,se=le+(null!==(y=null===(m=Ke.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ce=ae+(null!==(R=null===(S=ze.current)||void 0===S?void 0:S.clientHeight)&&void 0!==R?R:1/0),ue=function(e,n,t){return Math.max(n,Math.min(t,e))};oe=ue(Z.top+Z.height/2,le,se)-C.top,re=ue(ee.top+ee.height/2,ae,ce)-C.top}(Q=rt(U))&&B.push({id:"line-subsec-".concat(G),x1:te,y1:oe,x2:ie,y2:re,style:Q,sectionIdx:Number(U.split("-")[0]),isSubSection:!0,subSectionKeyPath:zn})}}if(Ln(B),Dn.current&&On.current){var ve=Dn.current.getBoundingClientRect(),fe=On.current.getBoundingClientRect(),pe=(ve.top+ve.height/2-C.top+fe.top+fe.height/2-C.top)/2;Yn({x1:ve.right-C.left,x2:fe.left-C.left,y:pe})}else Yn(null);if(de.size>0){var he=[],_e=Ke.current,me=ze.current;if(_e&&me){var be=[],Se=_e.getBoundingClientRect().top,Re=me.getBoundingClientRect().top,Ce=Se+_e.clientHeight,Be=Re+me.clientHeight,we=_e.scrollTop,je=me.scrollTop,Ee=C.top,Fe=function(e,n,t){return Math.max(n,Math.min(t,e))};de.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(_)){var l=e.split(_),a=l[0],s=l[1],c=l[2],u=(l[3],"".concat(a).concat(_).concat(s)),d=null===(n=Jn.current[u])||void 0===n?void 0:n.current,v=null===(t=Qn.current[u])||void 0===t?void 0:t.current;if(!d||!v)return;var f=d.getBoundingClientRect(),p=v.getBoundingClientRect(),g=rt(c),h=(D=f.right-C.left)+.5*((O=p.left-C.left-0)-D),x=f.top+f.height/2,m=p.top+p.height/2,y=x-Se+we,S=m-Re+je,R="conn-subsec-".concat(u);be.push({lhsScrollY:y,rhsScrollY:S,x1:D,x2:O,containerTop:Ee,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var I=Fe(x,Se,Ce),B=Fe(m,Re,Be),w=I-Ee,j=B-Ee,E=m>=Re-4&&m<=Be+4,F="";F=(H=x>=Se-4&&x<=Ce+4)&&E?b(D,w,O,j):H&&!E?"M ".concat(D,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(j):!H&&E?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(j," L ").concat(O,",").concat(j):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(j),he.push({id:R,pathD:F,style:g,leftIdx:e,rhsArrayIdx:e})}else if(q){var T=e,M=xn[T];if(!(null===(r=null==M?void 0:M.refIndexes)||void 0===r?void 0:r.length))return;M.refIndexes.forEach(function(e){var n,t,i=_n.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Jn.current[T])||void 0===n?void 0:n.current,r=null===(t=Qn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),a=r.getBoundingClientRect(),s=ot(T),c=l.right-C.left,u=a.left-C.left-0,d=c+.5*(u-c),v=l.top+l.height/2,f=a.top+a.height/2,p=v-Se+we,g=f-Re+je,h="conn-".concat(T,"-").concat(i);be.push({lhsScrollY:p,rhsScrollY:g,x1:c,x2:u,containerTop:Ee,leftIdx:T,rhsArrayIdx:i,styleColor:(null==s?void 0:s.badgeBorder)||"#6366F1",styleId:h});var x=Fe(v,Se,Ce),_=Fe(f,Re,Be),m=x-Ee,y=_-Ee,S=v>=Se-4&&v<=Ce+4,R=f>=Re-4&&f<=Be+4,I="";I=S&&R?b(c,m,u,y):S&&!R?"M ".concat(c,",").concat(m," L ").concat(d,",").concat(m," L ").concat(d,",").concat(y):!S&&R?"M ".concat(d,",").concat(m," L ").concat(d,",").concat(y," L ").concat(u,",").concat(y):"M ".concat(d,",").concat(m," L ").concat(d,",").concat(y),he.push({id:h,pathD:I,style:s,leftIdx:T,rhsArrayIdx:i})}}})}else{var k=e,A=k;d=null===(i=Jn.current[k])||void 0===i?void 0:i.current,v=null===(o=Qn.current[A])||void 0===o?void 0:o.current;if(!d||!v)return;var D,O;f=d.getBoundingClientRect(),p=v.getBoundingClientRect(),g=ot(k),h=(D=f.right-C.left)+.5*((O=p.left-C.left-0)-D),x=f.top+f.height/2,m=p.top+p.height/2,y=x-Se+we,S=m-Re+je,R="conn-".concat(k,"-").concat(A);be.push({lhsScrollY:y,rhsScrollY:S,x1:D,x2:O,containerTop:Ee,leftIdx:k,rhsArrayIdx:A,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var H;I=Fe(x,Se,Ce),B=Fe(m,Re,Be),w=I-Ee,j=B-Ee,E=m>=Re-4&&m<=Be+4,F="";F=(H=x>=Se-4&&x<=Ce+4)&&E?b(D,w,O,j):H&&!E?"M ".concat(D,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(j):!H&&E?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(j," L ").concat(O,",").concat(j):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(j),he.push({id:R,pathD:F,style:g,leftIdx:k,rhsArrayIdx:A})}}),ye.current=be}ge(he)}else ge([]),ye.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Xe.current=!1}}},[Kn,xn,_n,Ie,Qe,it,ot,q,ne,zn,de,an,un]),at=t.useCallback(function(){var e,n,t,i,o,r,l,a,s,c,u,d,v,f,p=ye.current;if(p.length&&!xe.current){var g=null!==(n=null===(e=Ke.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=ze.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,_=null!==(a=null===(l=ze.current)||void 0===l?void 0:l.clientHeight)&&void 0!==a?a:1/0,m=null!==(c=null===(s=Ke.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==c?c:0,y=null!==(d=null===(u=ze.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,S=m+x,R=y+_,I=null!==(f=null===(v=Mn.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,C=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-g+m,t=e.rhsScrollY-h+y,i=me.current[e.styleId+"-stroke"],o=me.current[e.styleId+"-bg"];if(i||o){var r,l=C(n,m,S),a=C(t,y,R),s=l-I,c=a-I,u=n>=m-4&&n<=S+4,d=t>=y-4&&t<=R+4,v=e.x1+.5*(e.x2-e.x1);r=u&&d?b(e.x1,s,e.x2,c):u&&!d?"M ".concat(e.x1,",").concat(s," L ").concat(v,",").concat(s," L ").concat(v,",").concat(c):!u&&d?"M ".concat(v,",").concat(s," L ").concat(v,",").concat(c," L ").concat(e.x2,",").concat(c):"M ".concat(v,",").concat(s," L ").concat(v,",").concat(c),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]),st=t.useRef(lt);t.useEffect(function(){st.current=lt},[lt]);var ct=t.useRef(null),ut=t.useCallback(function(){null!==ct.current&&clearTimeout(ct.current),ct.current=setTimeout(function(){st.current(),ct.current=null},50)},[]),dt=t.useCallback(function(e){var n,t,i,o,r,l,a,s,c,u;if(!le.current){if(q||ut(),Se.current){var d=Re.current,v=kn.current,f=Ke.current,p=ze.current;if(null!==d&&null!==v&&f&&p){var g="string"==typeof d&&d.includes(_)?null===(n=Jn.current["".concat(d.split(_)[0]).concat(_).concat(d.split(_)[1])])||void 0===n?void 0:n.current:null===(t=In.current[d])||void 0===t?void 0:t.current,h="string"==typeof v&&v.includes(_)?null===(i=Qn.current["".concat(v.split(_)[0]).concat(_).concat(v.split(_)[1])])||void 0===i?void 0:i.current:null===(o=Zn.current[v])||void 0===o?void 0:o.current;if(g&&h){var x=g.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop,m=h.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop;if(e.currentTarget===f){var y=m-(x-f.scrollTop),b=p.scrollHeight-p.clientHeight,S=Math.max(0,Math.min(y,b));Math.abs(p.scrollTop-S)>1&&(p.scrollTop=S)}else if(e.currentTarget===p){var R=x-(m-p.scrollTop),I=f.scrollHeight-f.clientHeight,C=Math.max(0,Math.min(R,I));Math.abs(f.scrollTop-C)>1&&(f.scrollTop=C)}if(An.current){var B=void 0,w=void 0;if("string"==typeof d&&d.includes(_)){var j=d.split(_),E="".concat(j[0]).concat(_).concat(j[1]);B=null===(r=Jn.current[E])||void 0===r?void 0:r.current,w=null===(l=Qn.current[E])||void 0===l?void 0:l.current}else B=null===(a=Jn.current[d])||void 0===a?void 0:a.current,w=null===(s=Qn.current[v])||void 0===s?void 0:s.current;var F=null!==(u=null===(c=Mn.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==u?u:0,T=f.getBoundingClientRect().top,M=T+f.clientHeight,k=p.getBoundingClientRect().top,A=k+p.clientHeight,D=function(e,n,t){return Math.max(n,Math.min(t,e))};if(B&&w){var O=B.getBoundingClientRect(),H=w.getBoundingClientRect(),N=O.top+O.height/2,L=H.top+H.height/2,W=D(N,T,M),z=D(L,k,A);An.current.setAttribute("y1",(W-F).toString()),An.current.setAttribute("y2",(z-F).toString());var P=N>=T-4&&N<=M+4;An.current.setAttribute("visibility",P?"visible":"hidden")}}}}}ye.current.length>0&&!be.current&&(be.current=!0,requestAnimationFrame(function(){at(),be.current=!1}))}},[at,q,ut]);t.useEffect(function(){var e=setTimeout(ut,250);window.addEventListener("resize",ut);var n=null,t=null;return Le.current&&(n=new ResizeObserver(ut)).observe(Le.current),Mn.current&&(t=new ResizeObserver(ut)).observe(Mn.current),function(){clearTimeout(e),window.removeEventListener("resize",ut),null==n||n.disconnect(),null==t||t.disconnect()}},[en,vn,yn,Kn,an,un,xn,_n,Qe,ut,ne,zn,oe,de]),t.useEffect(function(){Se.current=ne},[ne]),t.useEffect(function(){Re.current=zn},[zn]);var vt=t.useCallback(function(){var e,n,t,i,o=He.sectionIdx,r=He.isOrphan;if($e(),null!=o)if(r)Z("No counterpart exists for this section.");else if(ne&&zn===o)Bn();else{if(!q){var l=Re.current,a=kn.current;if(null!==l)if("string"==typeof l&&l.includes(_)){var s=l.split(_);(c=null===(e=et.current[s[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=Gn.current[l])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==a)if("string"==typeof a&&a.includes(_)){s=a.split(_);(u=null===(t=nt.current[s[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=$n.current[a])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}}ve(new Set),ge([]),ye.current=[],$(!0),le.current=!0,Pn(o),Re.current=o,te(!0),Se.current=!0,re(!1),Pe.current&&(Pe.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ve.current&&(Ve.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),requestAnimationFrame(function(){var e,n,t,i,r,l,a,s,c,u,d,v=null,f=null,p=null,g=null,h=null;if("string"==typeof o&&o.includes(_)){var x=o.split(_),m="".concat(x[0]).concat(_).concat(x[1]);v=(null===(e=Jn.current[m])||void 0===e?void 0:e.current)||null,h=(f=(null===(n=Qn.current[m])||void 0===n?void 0:n.current)||null)?o:null,p=(null===(t=et.current[x[2]])||void 0===t?void 0:t.current)||null,g=(null===(i=nt.current[x[3]])||void 0===i?void 0:i.current)||null}else if(v=(null===(r=In.current[o])||void 0===r?void 0:r.current)||null,p=(null===(l=Gn.current[o])||void 0===l?void 0:l.current)||null,q){var y=xn[o],b=(null==y?void 0:y.refIndexes)||[];if(b.length>0){var S=b[0],R=_n.findIndex(function(e){return e.selfIndex===S});-1!==R&&(f=(null===(c=Zn.current[R])||void 0===c?void 0:c.current)||null,g=(null===(u=$n.current[R])||void 0===u?void 0:u.current)||null,h=R)}}else f=(null===(a=Zn.current[o])||void 0===a?void 0:a.current)||null,g=(null===(s=$n.current[o])||void 0===s?void 0:s.current)||null,h=f?o:null;kn.current=h;var I=Ke.current,B=ze.current;if(!v||!I)return le.current=!1,void $(!1);if(!f||!B)return re(!0),st.current(),le.current=!1,void $(!1);if(!q){var w=v.getBoundingClientRect(),j=f.getBoundingClientRect(),E=w.top-j.top;p&&g&&(p.style.paddingTop="0px",g.style.paddingTop="0px",E>0?g.style.paddingTop="".concat(E,"px"):E<0&&(p.style.paddingTop="".concat(Math.abs(E),"px")));var F=v?v.getBoundingClientRect().top:(null==p?void 0:p.getBoundingClientRect().top)||0;return null===(d=Le.current)||void 0===d||d.scrollTo({top:Le.current.scrollTop+F-150,behavior:"smooth"}),re(!0),st.current(),le.current=!1,void $(!1)}var T=v.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,M=f.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(T-I.scrollTop);M<0&&Pe.current&&(Pe.current.style.height="".concat(Math.abs(M),"px"));requestAnimationFrame(function(){var e,n=B.scrollHeight-B.clientHeight;if(M<0)e=0;else{if(M>n){var t=M-n;return qe.current&&(qe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){C(B,M,200,function(){re(!0),st.current(),le.current=!1,$(!1)})})}e=M}C(B,e,200,function(){re(!0),st.current(),le.current=!1,$(!1)})})})}},[$e,He.sectionIdx,ne,zn,xn,_n,ut,Bn]),ft=null!==He.sectionIdx&&de.has(He.sectionIdx),pt=function(t){var r,l,a,c,u,d,v,f=t.section,p=t.idx,h=t.columnKey,x=t.colRef,_=t.mb,m=void 0===_?1:_,b=t.parentNodeId,S=void 0===b?"":b,R=q?!!an["".concat(h,"-").concat(p)]:!!an[String(p)],C=(null===(r=f.displayTitle)||void 0===r||r)&&s.hasValue(f.title),B=(null===(l=f.displayContent)||void 0===l||l)&&s.hasValue(f.content),w=!C&&!B,j={current:1},E=f.title;C||(E=B?"No Title Found":"No Matching Section Found");var F,T=null!==(d=null===(u=null===(c=null===(a=f.evaluationResult)||void 0===a?void 0:a.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===u?void 0:u.label_color)&&void 0!==d?d:I,M=s.generateColorPalette(T).highlightBg,k=[];if(null===(v=f.evaluationResult)||void 0===v?void 0:v.deviations){var A=f.evaluationResult.deviations;for(var D in A){var O=A[D][S];O&&k.push(O)}}return n.jsx(i.Box,e.__assign({ref:x,sx:{mb:m,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!w&&R,onChange:function(){return!w&&function(n,t){var i,o;xe.current=!0,_e.current&&clearTimeout(_e.current),he.current&&(he.current.style.opacity="0");var r=null===(i=Gn.current[n])||void 0===i?void 0:i.current,l=null===(o=$n.current[n])||void 0===o?void 0:o.current;r&&(r.style.minHeight="0px"),l&&(l.style.minHeight="0px"),_e.current=setTimeout(function(){xe.current=!1,st.current(),he.current&&(he.current.style.opacity="1")},650),sn(function(i){var o=e.__assign({},i),r=q?"".concat(t,"-").concat(n):String(n),l=!i[r];if(!l){var a=String(zn||""),s=zn===n||a.startsWith("".concat(n,"-")),c=!1;de.forEach(function(e){(e===n||String(e).startsWith("".concat(n,"-")))&&(c=!0)}),(s||c)&&(Bn(),ve(new Set),ge([]),ye.current=[])}if(!q)return o[String(n)]=l,o;if(o[r]=l,"left"===t)((null==(u=xn[n])?void 0:u.refIndexes)||[]).forEach(function(e){var n=_n.findIndex(function(n){return n.selfIndex===e});-1!==n&&(o["right-".concat(n)]=l)});else{var u,d=null==(u=_n[n])?void 0:u.selfIndex;xn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(d))&&(o["left-".concat(n)]=l)})}return o})}(p,h)},sx:{boxShadow:"none",border:w?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:w?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:w?null:n.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:w?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:C&&n.jsx(i.Tooltip,e.__assign({title:E,placement:"top"},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:w?"#94A3B8":"#19213D",fontWeight:w?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(F=E,F?s.safeStringify(F).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},t):n.jsx(g.default.Fragment,{children:e},t)}):null)}))}))})),!w&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[B&&n.jsx(y,{content:f.content,sxStyles:Me,highlights:k,maintainRelativeOrder:q,highlightBg:M}),(f.subsections||[]).map(function(e,n){return gt({section:e,keyPath:"".concat(p,"-").concat(n),depth:0,columnKey:h,parentNodeId:S,devCounter:j})})]}))]}))}),"".concat(h,"-sec-").concat(p))},gt=function(t){var r,l,a,c,u,d,v,f,p,h,x,b,S,R,C,B=t.section,w=t.keyPath,j=t.depth,E=void 0===j?0:j,F=t.columnKey,T=void 0===F?"left":F,k=t.parentNodeId,A=void 0===k?"":k,D=(null===(r=B.displayTitle)||void 0===r||r)&&s.hasValue(B.title),O=(null===(l=B.displayContent)||void 0===l||l)&&s.hasValue(B.content),H=!D&&!O,N=D?B.title:O?"No Title Found":"No Matching Section Found",L=!!un[w];"left"!==T||et.current[w]||(et.current[w]=g.default.createRef()),"right"!==T||nt.current[w]||(nt.current[w]=g.default.createRef());var W="left"===T?et.current[w]:nt.current[w],z=rt(w),P=w.split("-").map(Number),V=P[0],Y=xn[V],K=_n[V],X=w,U=w;if(q)if("left"===T){var G=null===(a=null==Y?void 0:Y.refIndexes)||void 0===a?void 0:a[0],$=_n.findIndex(function(e){return e.selfIndex===G});-1!==$&&(K=_n[$],U=e.__spreadArray([$],P.slice(1),!0).join("-"))}else{var J=null===(c=null==K?void 0:K.refIndexes)||void 0===c?void 0:c[0],Q=xn.findIndex(function(e){return e.selfIndex===J});-1!==Q&&(Y=xn[Q],X=e.__spreadArray([Q],P.slice(1),!0).join("-"))}var Z,ee="left"===T?Y:K;Z=q&&void 0!==(null==ee?void 0:ee.selfIndex)&&ee.selfIndex>=0?ee.selfIndex+1:V+1;for(var ne=Y,te=K,ie=1;ie<P.length;ie++)(null==ne?void 0:ne.subsections)&&(ne=ne.subsections[P[ie]]),(null==te?void 0:te.subsections)&&(te=te.subsections[P[ie]]);var oe=null===(u=null==M?void 0:M.input_index_map)||void 0===u?void 0:u[0],re=null===(d=null==M?void 0:M.input_index_map)||void 0===d?void 0:d[1],le="left"===T?re:oe,ae=q?!(null===(v=B.refIndexes)||void 0===v?void 0:v.length)||void 0!==B.selfIndex&&B.selfIndex<0:"left"===T?!te:!ne,se=null!==(h=null===(p=null===(f=B.evaluationResult)||void 0===f?void 0:f.evaluation_outputs)||void 0===p?void 0:p.output_value)&&void 0!==h?h:null,ce=B.id,ue=null!==(R=null===(S=null===(b=null===(x=B.evaluationResult)||void 0===x?void 0:x.evaluation_outputs)||void 0===b?void 0:b.metadata)||void 0===S?void 0:S.label_color)&&void 0!==R?R:I,fe=s.generateColorPalette(ue).highlightBg,pe=(null===(C=B.evaluationResult)||void 0===C?void 0:C.deviations)||{},he=Object.entries(pe).map(function(n){var t=n[0],i=n[1],o="".concat(ce).concat(_).concat(t),r=Rn[o];if(!r)return null;var l=i[A],a=m(l);if(a)l="";else if(!l)return null;var s=i[le],c=ae||m(s),u="".concat(Z,".").concat(r),d="".concat(ce).concat(_).concat(t).concat(_).concat(X).concat(_).concat(U);return"left"!==T||Jn.current[o]||(Jn.current[o]=g.default.createRef()),"right"!==T||Qn.current[o]||(Qn.current[o]=g.default.createRef()),{id:o,actionId:d,label:u,highlight:l,side:T,style:z,score:se,isConnected:de.has(d),isOrphan:c,isMissingClause:a,badgeRef:"left"===T?Jn.current[o]:Qn.current[o],onClick:function(n){n.stopPropagation();var t=e.__assign(e.__assign({},ne||{title:"",content:""}),{title:(null==Y?void 0:Y.title)||(null==ne?void 0:ne.title)||""}),i=e.__assign(e.__assign({},te||{title:"",content:""}),{title:(null==K?void 0:K.title)||(null==te?void 0:te.title)||""});En(n,t,c,i,d,z)}}}).filter(Boolean),xe=he.some(function(e){return de.has(e.actionId)});if(!(D||O||B.subsections&&0!==B.subsections.length))return null;var _e=function(){var e,n=[];if(null===(e=B.evaluationResult)||void 0===e?void 0:e.deviations){var t=B.evaluationResult.deviations;for(var i in t){var o=t[i][A];o&&n.push(o)}}return n}();return D?n.jsx(i.Box,e.__assign({ref:W,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({width:"100%"},xe&&z&&{borderRadius:"4px",outline:"2px solid ".concat(z.badgeBorder),outlineOffset:"1px"})},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!H&&L,onChange:function(){if(!H){if(L){var n=String(zn||""),t=n.includes(X)||n.includes(U);t||de.forEach(function(e){(String(e).includes(X)||String(e).includes(U))&&(t=!0)}),t&&(Bn(),ve(new Set),ge([]),ye.current=[])}dn(function(n){var t;return e.__assign(e.__assign({},n),((t={})[w]=!n[w],t))})}},sx:{mt:0,boxShadow:"none",border:H?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:H?null:n.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:H?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:N||"Untitled Subsection"}))})),!H&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[O&&n.jsx(y,{content:B.content,sxStyles:Me,deviationBadges:he,maintainRelativeOrder:q,highlightBg:fe,highlights:_e}),(B.subsections||[]).map(function(e,n){return gt({section:e,keyPath:"".concat(w,"-").concat(n),depth:E+1,columnKey:T,parentNodeId:A})})]}))]}))}))}),w):n.jsx(i.Box,e.__assign({ref:W,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!H&&n.jsxs(i.Box,e.__assign({sx:e.__assign({width:"100%"},xe&&z&&{borderRadius:"4px",outline:"2px solid ".concat(z.badgeBorder),outlineOffset:"1px"})},{children:[O&&n.jsx(y,{content:B.content,sxStyles:Me,deviationBadges:he,maintainRelativeOrder:q,highlightBg:fe,highlights:_e}),(B.subsections||[]).map(function(e,n){return gt({section:e,keyPath:"".concat(w,"-").concat(n),depth:E+1,columnKey:T,parentNodeId:A})})]}))}),w)};return n.jsxs(i.Box,e.__assign({ref:We,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},q?{}:{overflow:"visible"}),{position:"relative"})},{children:[K&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),n.jsx(d.default,{open:He.open,anchorEl:He.anchorEl,sectionTitle:He.sectionTitle,referenceSectionTitle:He.refSectionTitle,onClose:$e,onOpenCognitiveCompare:Fn,onOpenSideBySide:vt,onConnect:Tn,isConnected:ft,isOrphan:He.isOrphan}),Ae.open&&n.jsx(u.default,{open:Ae.open,popupRef:je,position:Be,popupConfig:L,onClose:function(){we(null),De(function(n){return e.__assign(e.__assign({},n),{open:!1})}),ce(null)},markdownStyles:O,sectionTitle:Ae.sectionTitle,referenceSectionTitle:Ae.refSectionTitle,cognitiveData:Ae.cognitiveData,anchorEl:Ae.anchorEl,sectionAnchorEl:Ae.sectionAnchorEl,scrollContainerEl:Le.current,badgeStyle:Ae.badgeStyle,docData:Ae.docData,deviationData:Ae.deviationData}),n.jsx(i.Snackbar,e.__assign({open:!!Q,autoHideDuration:8e3,onClose:function(){return Z(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Z(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Q}))})),(N.isHeaderVisible||N.isToggleVisible)&&n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:N.isHeaderVisible&&n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:T}))})),N.isToggleVisible&&n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center"}},{children:n.jsx(i.FormControlLabel,{control:n.jsx(i.Switch,{checked:!q,onChange:function(e){var n=e.target.checked;X(!0),setTimeout(function(){V(!n),Bn(),ve(new Set),ge([]),ye.current=[],setTimeout(function(){X(!1)},400)},50)},color:"primary",size:"small",sx:{width:100,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"3px",transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(75px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:"#5928ED",opacity:1,border:0,"&::before":{content:'"Side by Side"',position:"absolute",left:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px"}}}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:20,height:20},"& .MuiSwitch-track":{borderRadius:13,backgroundColor:"#9e9e9e",opacity:1,position:"relative","&::after":{content:'"Side by Side"',position:"absolute",right:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px",opacity:1,transition:"opacity 0.2s"}},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{"&::after":{opacity:0}}}}),label:"",labelPlacement:"start",sx:{m:0,gap:1}})}))]})),n.jsx(i.Box,e.__assign({ref:Le,onScroll:dt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:q?"hidden":"auto",borderTop:bn&&Sn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},q?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Mn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},q?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:he,style:{position:"absolute",top:0,left:0,width:Fe.width||"100%",height:Fe.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[Vn&&!ne&&n.jsxs("g",{children:[n.jsx("line",{x1:Vn.x1,y1:Vn.y,x2:Math.max(Vn.x1,(Vn.x1+Vn.x2)/2-70),y2:Vn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(Vn.x2,(Vn.x1+Vn.x2)/2+70),y1:Vn.y,x2:Vn.x2,y2:Vn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Nn.map(function(t){var l,a=t.x1+.5*(t.x2-t.x1),s=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;var c=!1;if(t.isSubSection)c=ne&&zn===t.subSectionKeyPath&&oe;else{var u=xn[t.sectionIdx];(q?!(null===(l=null==u?void 0:u.refIndexes)||void 0===l?void 0:l.length)||(null==u?void 0:u.selfIndex)<0:!_n[t.sectionIdx])||(c=ne&&zn===t.sectionIdx&&oe)}if(c)return n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:An,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id);if(!q){var d=t.isSubSection?b(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2);return n.jsxs("g",{children:[n.jsx("path",{d:d,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:a-100,y:s-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(n){if(n.stopPropagation(),Ae.open&&se===t.id)Ge();else{var i=xn[t.sectionIdx]||{title:"",content:""},o=_n[t.sectionIdx]||{title:"",content:""};if(t.isSubSection&&t.subSectionKeyPath){for(var r=t.subSectionKeyPath.split(_)[2].split("-").map(Number),l=xn[r[0]],a=_n[r[0]],s=(null==l?void 0:l.title)||"",c=(null==a?void 0:a.title)||"",u=1;u<r.length;u++)(null==l?void 0:l.subsections)&&(l=l.subsections[r[u]]),(null==a?void 0:a.subsections)&&(a=a.subsections[r[u]]);l&&(i=e.__assign(e.__assign({},l),{title:s||l.title})),a&&(o=e.__assign(e.__assign({},a),{title:c||a.title}))}ce(t.id),jn(wn(n.currentTarget,i,o,t.sectionIdx,t.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[0===t.style.label?"Same":t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:Ae.open&&se===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),pe.map(function(t){var i,o=t.pathD,r=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),a="".concat(t.id,"-bg"),s="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:r})}))}))}),n.jsx("path",{ref:function(e){me.current[a]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){me.current[s]=e},d:o,fill:"none",stroke:r,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},q?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Dn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:gn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:gn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ke,onScroll:dt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},q?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Ve,style:{width:"100%",height:"0px",flexShrink:0}}),mn&&xn.map(function(t,r){var l,a,s=!t.title&&!t.content;if(q&&s)return null;var c=t,u=ot(r),d=q?!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)||c.selfIndex<0:!_n[r],v=q?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:r+1,f=de.has(r),p=function(e,n){var t,i,o,r,l,a;if(!e)return n;var s=null!==(a=null!==(r=null!==(i=null===(t=e.evaluation_output)||void 0===t?void 0:t.output_score)&&void 0!==i?i:null===(o=e.evaluation_outputs)||void 0===o?void 0:o.output_score)&&void 0!==r?r:null===(l=e.evaluation_outputs)||void 0===l?void 0:l.output_value)&&void 0!==a?a:e.output_score;return null!=s?s:n}(c.evaluationResult,null==u?void 0:u.deviationLabel);return n.jsx(i.Box,e.__assign({ref:Cn(r),sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Gn.current[r],sx:e.__assign({width:"100%",display:"flex"},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==u?void 0:u.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:pt({section:t,idx:r,columnKey:"left",colRef:g.default.createRef(),mb:0,parentNodeId:(null===(a=null==M?void 0:M.input_index_map)||void 0===a?void 0:a[0])||""})})),q&&u&&n.jsxs(i.Box,e.__assign({ref:Jn.current[r],onClick:function(e){var n=q?_n.find(function(e){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:_n[r]||{title:"",content:""};En(e,t,d,n,r,u)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:u.badgeBg,color:u.badgeText,border:"1px solid ".concat(u.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==v&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(u.badgeBorder)}},{children:v})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:d?"No Deviation Found":"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p)})),n.jsx(o.EllipsisVertical,{size:11,color:u.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),0,"% Similarity",n.jsx(o.ChevronDown,{size:11})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},q?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[G&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:On,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:hn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:hn}))}))})),n.jsxs(i.Box,e.__assign({ref:ze,onScroll:dt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},q?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-25px",pl:"45px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Pe,style:{width:"100%",height:"0px",flexShrink:0}}),mn&&_n.map(function(t,o){var r,l=t,a=[],s=!1,c=null;if(q){a=xn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var u=xn.findIndex(function(e,n){var t;return de.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(s=-1!==u)&&(c=ot(u))}else a=[o+1],(s=de.has(o))&&(c=ot(o));var d=ot(o);return n.jsx(i.Box,e.__assign({ref:Zn.current[o],sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:$n.current[o],sx:e.__assign({width:"100%",display:"flex"},s&&c&&{borderRadius:"6px",outline:"2px solid ".concat(c.badgeBorder),outlineOffset:"1px"})},{children:pt({section:t,idx:o,columnKey:"right",colRef:g.default.createRef(),mb:0,parentNodeId:(null===(r=null==M?void 0:M.input_index_map)||void 0===r?void 0:r[1])||""})})),q&&!G&&d&&n.jsx(i.Box,e.__assign({ref:Qn.current[o],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:a.length>0?a.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),l=require("../../assests/svg/ButtonCognitiveIcon.js"),r=require("./OverlayComponent.js"),a=require("react-markdown"),s=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),u=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("rehype-raw"),p=require("./components/ThreeDotsLoader.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=g(t),x=g(a),_=g(f),m="::",y=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},b=function(e,n){var t,i,o,l,r,a,s;if(!e)return n;var c=null!==(a=null!==(l=null!==(i=null===(t=e.evaluation_output)||void 0===t?void 0:t.output_score)&&void 0!==i?i:null===(o=e.evaluation_outputs)||void 0===o?void 0:o.output_score)&&void 0!==l?l:null===(r=e.evaluation_outputs)||void 0===r?void 0:r.output_value)&&void 0!==a?a:e.output_score;return null!==(s=null!=c?c:n)&&void 0!==s?s:""},S=h.default.memo(function(l){var r=l.content,a=l.sxStyles,c=l.deviationBadges,u=void 0===c?[]:c,d=l.highlights,v=void 0===d?[]:d,f=l.maintainRelativeOrder,p=void 0===f||f,g=l.highlightBg,h=t.useMemo(function(){return u.reduce(function(n,t){var i;return e.__assign(e.__assign({},n),((i={})[t.id]=t,i))},{})},[u]),m=t.useMemo(function(){return{mark:function(t){var i=t.children;return n.jsx("span",e.__assign({style:{backgroundColor:g,borderRadius:"2px"}},{children:i}))},span:function(t){var l,r,a,s,c,u=t.children,d=e.__rest(t,["children"]),v=d["data-badge-id"];if(!v)return n.jsx("span",e.__assign({},d,{children:u}));var f=h[v];return f?n.jsxs(i.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[u,n.jsx(i.Box,e.__assign({ref:f.badgeRef,onClick:f.onClick,sx:e.__assign(e.__assign({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",bgcolor:(null===(l=f.style)||void 0===l?void 0:l.badgeBg)||"#EEF2FF",color:(null===(r=f.style)||void 0===r?void 0:r.badgeText)||B,border:"1px solid ".concat((null===(a=f.style)||void 0===a?void 0:a.badgeBorder)||"#C7D2FE"),borderRadius:"12px",px:1,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},"left"===f.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),f.isConnected&&f.style&&{outline:"2px solid ".concat(f.style.badgeBorder),outlineOffset:"1px"})},{children:n.jsxs(n.Fragment,{children:[n.jsx(i.Box,e.__assign({component:"span",sx:e.__assign({fontSize:"10px",fontWeight:700},"left"===f.side?{pr:.5,borderRight:"1px solid ".concat((null===(s=f.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE")}:{})},{children:f.label})),"left"===f.side&&n.jsxs(n.Fragment,{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"10px",px:.25}},{children:null!=f.score&&"N/A"!==f.score&&"NA"!==f.score&&0!==f.score?"".concat(f.score):"N/A"===f.score||"NA"===f.score?"N/A":"Same"})),n.jsx(o.EllipsisVertical,{size:10,color:(null===(c=f.style)||void 0===c?void 0:c.badgeText)||"#3730A3"})]})]})}))]})):n.jsx("span",e.__assign({},d,{children:u}))}}},[h,p]),y=t.useMemo(function(){var e=r||"",n={},t=0;return function(){var i=null==u?void 0:u[0];if(i&&i.highlight){var o=i.highlight.replace(/\\(['’])/g,"$1"),l="__DEV_TOKEN_".concat(t++,"__");n[l]='<span data-badge-id="'.concat(i.id,'"><mark>').concat(o,"</mark></span>"),e=e.replace(o,l)}}(),v.forEach(function(i){if(i){var o=i.replace(/\\(['’])/g,"$1"),l="__HL_TOKEN_".concat(t++,"__");n[l]="<mark>".concat(o,"</mark>"),e=e.split(o).join(l)}}),Object.keys(n).forEach(function(t){e=e.split(t).join(n[t])}),e},[r,u,v]);return n.jsx(i.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},a),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:n.jsx(x.default,e.__assign({components:m,rehypePlugins:[_.default]},{children:s.safeStringify(y).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;if(e.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var o=0;o<t.length;o++)if(t[o]!==i[o])return!1;var l=e.deviationBadges||[],r=n.deviationBadges||[];if(l.length!==r.length)return!1;for(o=0;o<l.length;o++){if(l[o].id!==r[o].id)return!1;if(l[o].label!==r[o].label)return!1;if(l[o].isConnected!==r[o].isConnected)return!1}return!0}),R=function(e,n,t,i,o){void 0===o&&(o=14);var l=e+.5*(t-e),r=i-n;if(Math.abs(r)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var a=r>0?1:-1,s=Math.min(o,Math.abs(r)/2,Math.abs(l-e)/2,Math.abs(t-l)/2);return["M ".concat(e," ").concat(n),"H ".concat(l-s),"Q ".concat(l," ").concat(n," ").concat(l," ").concat(n+a*s),"V ".concat(i-a*s),"Q ".concat(l," ").concat(i," ").concat(l+s," ").concat(i),"H ".concat(t)].join(" ")},I={id:"",title:""},C={isLoading:!1,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},B="#3730A3",j=function(e,n,t,i,o){void 0===t&&(t=300);var l=e.style.scrollBehavior;e.style.scrollBehavior="auto";var r=e.scrollTop,a=n-r,s=null,c=function(u){null===s&&(s=u);var d,v=u-s;v<t?(e.scrollTop=(d=v,d/=t,a*(--d*d*d+1)+r),o&&o(),requestAnimationFrame(c)):(e.scrollTop=n,e.style.scrollBehavior=l,o&&o(),i&&i())};requestAnimationFrame(c)};exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(a){var f,g,x,_,w,E,T,F,M,k,A,D,O,H,L,N=a.componentHeaderText,W=void 0===N?"Contract Comparison":N,z=a.treeData,P=a.comparisonConfig,q=a.leftColumnTitleText,V=a.rightColumnTitleText,Y=a.markdownStyles,K=a.displayConfig,X=void 0===K?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:K,U=a.popupConfig,G=a.deviationData,$=void 0===G?{}:G,J=t.useState(X.maintainRelativeOrder),Q=J[0],Z=J[1],ee=t.useState(!1),ne=ee[0],te=ee[1],ie=t.useState(!1),oe=ie[0],le=ie[1],re=t.useState(null),ae=re[0],se=re[1],ce=t.useState(!1),ue=ce[0],de=ce[1],ve=t.useState(!1),fe=ve[0],pe=ve[1],ge=t.useRef(!1),he=t.useState(null),xe=he[0],_e=he[1],me=t.useState(new Set),ye=me[0],be=me[1],Se=t.useState([]),Re=Se[0],Ie=Se[1],Ce=t.useRef(null),Be=t.useRef(!1),je=t.useRef(null),we=t.useRef({}),Ee=t.useRef([]),Te=t.useRef(!1),Fe=t.useRef(!1),Me=t.useRef(null),ke=t.useMemo(function(){return(null==z?void 0:z.cognitive_decisioning)||{}},[z]),Ae=t.useState(null),De=Ae[0],Oe=Ae[1],He=t.useRef(null),Le=t.useState({width:0,height:0}),Ne=Le[0],We=Le[1],ze=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),Y)},[Y]),Pe=t.useState({isLoading:null!==(f=null==X?void 0:X.isLoading)&&void 0!==f&&f,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),qe=Pe[0],Ve=Pe[1],Ye=t.useState({isLoading:null!==(g=null==X?void 0:X.isLoading)&&void 0!==g&&g,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),Ke=Ye[0],Xe=Ye[1],Ue=t.useRef(null),Ge=t.useRef(null),$e=t.useRef(null),Je=t.useRef(null),Qe=t.useRef(null),Ze=t.useRef(null),en=t.useRef(null),nn=t.useRef(null),tn=t.useRef(!1),on=t.useRef(null);t.useEffect(function(){on.current=null},[qe.sectionIdx,qe.open]);var ln=t.useCallback(function(){Oe(null),Ve(C),_e(null)},[]),rn=t.useCallback(function(){Xe(C)},[]),an=t.useCallback(function(){var e;if(qe.anchorEl&&qe.refSectionTitle){var n=qe.anchorEl.getBoundingClientRect(),t=(null===(e=null==He?void 0:He.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,l=n.top-12-12,r=o<t&&l>o;null!==on.current?!0===on.current&&(r=l>=t||l>=o):r=!(o>=t||o>=l),on.current=r;var a=r?l:o,s=Math.min(t||9999,a),c=r?n.top-12-s:n.bottom+12,u=n.left+n.width/2,d=u-i/2,v=Math.max(12,Math.min(d,window.innerWidth-i-12)),f=Math.max(14,Math.min(u-v,i-10-4));Oe({top:c,left:v,arrowLeft:f,openAbove:r,maxHeight:a})}},[qe.anchorEl,qe.refSectionTitle]);t.useEffect(function(){if(qe.open){window.addEventListener("resize",an);var e=requestAnimationFrame(an),n=null;return He.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(an)})).observe(He.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",an),n&&n.disconnect()}}},[qe.open,an]),t.useEffect(function(){var e=Ue.current;if(e&&qe.open){var n=function(e){He.current&&He.current.contains(e.target)||(Oe(null),ln())};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})}}},[qe.open,ln]),t.useEffect(function(){var e=Ue.current;if(e&&Ke.open){var n=function(){rn()};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})}}},[Ke.open,rn]);var sn=t.useMemo(function(){var e,n,t,i,o,l,r;return{fields:null!==(e=null==P?void 0:P.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==P?void 0:P.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==P?void 0:P.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(r=null===(l=null==P?void 0:P.thresholds)||void 0===l?void 0:l.exact)&&void 0!==r?r:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[P]),cn=t.useMemo(function(){if(z&&Object.keys(z).length>0)try{var n=function(n,t,i){var o,l,r,a;void 0===t&&(t=!1),void 0===i&&(i=null);var c=n.nodes||n,u=[],d=[],v=n.base_root_id,f=n.input_index_map||{0:"left",1:"right"},p=n[v]||c[v];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var g=function(t,o){var l,r,a,u=n[t]||c[t];if(!u||!1===u.display_node)return null;var d=s.getSideData(u,o,f),v=!1!==(null===(l=d.attributes)||void 0===l?void 0:l.display_title),p=!1!==(null===(r=d.attributes)||void 0===r?void 0:r.display_content),h=!!d.title.trim(),x=!!d.content.trim(),_=s.getRationale(u),m=(null===(a=null==i?void 0:i[t])||void 0===a?void 0:a.evaluation_result)||u.evaluation_result||null,y=[];u.next&&Object.values(u.next).forEach(function(e){var n=c[e];if(n&&!1!==n.display_node){var t=g(e,o);t&&y.push(t)}});var b=!(!h&&!x);return e.__assign(e.__assign({id:t,title:h?d.title:"",content:x?d.content:"",displayTitle:v,displayContent:p,subsections:y},b?_:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(t){var h=function(t,o){var l,r,a,u,d,v,p,g,x,_,m,y,b,S,R,I,C,B,j,w,E;void 0===o&&(o=0);var T=[],F=[];if(!t)return{refSections:T,baseSections:F};var M={},k={},A=-1,D=-1;for(var O in t){var H=t[O],L=n[H]||c[H];if(L&&!1!==L.display_node){var N=s.getRationale(L),W=(null===(l=null==i?void 0:i[H])||void 0===l?void 0:l.evaluation_result)||L.evaluation_result||null,z=s.getSideData(L,"1",f),P=s.getSideData(L,"0",f),q=!1!==(null===(r=z.attributes)||void 0===r?void 0:r.display_title)&&z.title.trim()||!1!==(null===(a=z.attributes)||void 0===a?void 0:a.display_content)&&z.content.trim(),V=!1!==(null===(u=P.attributes)||void 0===u?void 0:u.display_title)&&P.title.trim()||!1!==(null===(d=P.attributes)||void 0===d?void 0:d.display_content)&&P.content.trim(),Y=Number(null!==(p=null===(v=z.attributes)||void 0===v?void 0:v.display_index)&&void 0!==p?p:A--),K=Number(null!==(x=null===(g=P.attributes)||void 0===g?void 0:g.display_index)&&void 0!==x?x:D--),X=M[Y]||e.__assign(e.__assign({id:H,title:!1!==(null===(_=z.attributes)||void 0===_?void 0:_.display_title)?z.title:"",content:!1!==(null===(m=z.attributes)||void 0===m?void 0:m.display_content)?z.content:"",subsections:[]},q?N:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:Y,evaluationResult:W,displayContent:null===(y=z.attributes)||void 0===y?void 0:y.display_content,displayTitle:null===(b=z.attributes)||void 0===b?void 0:b.display_title}),U=k[K]||e.__assign(e.__assign({id:H,title:!1!==(null===(S=P.attributes)||void 0===S?void 0:S.display_title)?P.title:"",content:!1!==(null===(R=P.attributes)||void 0===R?void 0:R.display_content)?P.content:"",subsections:[]},V?N:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:K,evaluationResult:W,displayContent:null===(I=P.attributes)||void 0===I?void 0:I.display_content,displayTitle:null===(C=P.attributes)||void 0===C?void 0:C.display_title});Number(Y)>=0&&Number(K)>=0&&((null===(B=X.refIndexes)||void 0===B?void 0:B.includes(Number(K)))||null===(j=X.refIndexes)||void 0===j||j.push(Number(K)),(null===(w=U.refIndexes)||void 0===w?void 0:w.includes(Number(Y)))||null===(E=U.refIndexes)||void 0===E||E.push(Number(Y))),M[Y]=X,k[K]=U;var G=h(L.next,o+1),$=G.refSections,J=G.baseSections;$.length>0&&(X.subsections=e.__spreadArray(e.__spreadArray([],X.subsections||[],!0),$,!0)),J.length>0&&(U.subsections=e.__spreadArray(e.__spreadArray([],U.subsections||[],!0),J,!0))}}return T=Object.values(M).map(function(e){return e}),F=Object.values(k).map(function(e){return e}),T.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}),{refSections:T,baseSections:F}},x=h(p.next),_=x.refSections,m=x.baseSections;d=_,u=m}else p.next&&Object.values(p.next).forEach(function(e){var t=n[e]||c[e];t&&!1!==t.display_node&&(u.push(g(e,"0")||{id:e,title:"",content:"",subsections:[]}),d.push(g(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(o=p.comparison_inputs)||void 0===o?void 0:o[f[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:u},activeVariants:[{id:"tree-variant-1",title:(null===(a=null===(r=p.comparison_inputs)||void 0===r?void 0:r[f[1]])||void 0===a?void 0:a.title)||"Reference Template",similarity:0,sections:d,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}}]}}(z,Q,$);return e.__assign(e.__assign({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[JSON.stringify(z),Q,JSON.stringify($)]),un=cn.activeProposed,dn=cn.activeVariants,vn=cn.parseError;t.useEffect(function(){vn&&se("Failed to load comparison: ".concat(vn))},[vn]);var fn=t.useState(null),pn=fn[0];fn[1];var gn=t.useState({}),hn=gn[0],xn=gn[1],_n=t.useState({}),mn=_n[0],yn=_n[1],bn=(null==dn?void 0:dn[0])||I,Sn=null===(w=null===(x=null==z?void 0:z.documents)||void 0===x?void 0:x[null===(_=null==z?void 0:z.input_index_map)||void 0===_?void 0:_[0]])||void 0===w?void 0:w.title,Rn=null===(F=null===(E=null==z?void 0:z.documents)||void 0===E?void 0:E[null===(T=null==z?void 0:z.input_index_map)||void 0===T?void 0:T[1]])||void 0===F?void 0:F.title,In=s.safeStringify(q||Sn||"Uploaded Contract"),Cn=s.safeStringify(V||Rn||"Reference Template"),Bn=t.useMemo(function(){return(null==un?void 0:un.sections)||[]},[null==un?void 0:un.sections]),jn=t.useMemo(function(){return bn.sections||[]},[bn.sections]),wn=Bn.length>0||jn.length>0,En=bn.analysis,Tn=s.safeStringify(null===(k=null===(M=null==En?void 0:En.rule_difference_comparison)||void 0===M?void 0:M.summary)||void 0===k?void 0:k.overall_summary),Fn=!!Tn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Mn=null!==(A=null==z?void 0:z.base_root_id)&&void 0!==A?A:"-1",kn=(null===(D=null==$?void 0:$[Mn])||void 0===D?void 0:D.evaluation_result)||Mn.evaluation_result||null,An=b(kn),Dn=s.generateColorPalette(null!==(L=null===(H=null===(O=null==kn?void 0:kn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===H?void 0:H.label_color)&&void 0!==L?L:""),On=t.useMemo(function(){var e,n,t={},i={},o=null===(e=null==z?void 0:z.input_index_map)||void 0===e?void 0:e[0],l=null===(n=null==z?void 0:z.input_index_map)||void 0===n?void 0:n[1],r=new Map,a=function(e){return e&&e.id?(r.has(e.id)||r.set(e.id,s.safeStringify(e.content||"").replace(/\\n/g,"\n")),r.get(e.id)):""},c=function(e,n,s,u,d){var v,f,p,g,h,x,_,b;e&&!d&&function(e,n,s,c){var u,d=(null===(u=null==e?void 0:e.evaluationResult)||void 0===u?void 0:u.deviations)||{};Object.keys(d).sort().forEach(function(u){var v=d[u];if(v){var f=v[o],p=v[l],g=!1,h=!1;if(!y(f)){var x=f.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n&&x){var _=a(n);_.includes(x)&&(g=!0,r.set(n.id,_.replace(x,"__TOKEN__")))}}if(!y(p)){var b=p.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(s&&b){var S=a(s);S.includes(b)&&(h=!0,r.set(s.id,S.replace(b,"__TOKEN__")))}}if(g||h){var R="".concat(e.id).concat(m).concat(u);void 0===t[R]&&(void 0===i[c]&&(i[c]=1),t[R]=i[c]++)}}})}(e,n,s,u);for(var S=Math.max((null===(v=null==n?void 0:n.subsections)||void 0===v?void 0:v.length)||0,(null===(f=null==s?void 0:s.subsections)||void 0===f?void 0:f.length)||0,(null===(p=null==e?void 0:e.subsections)||void 0===p?void 0:p.length)||0),R=0;R<S;R++)c((null===(g=null==e?void 0:e.subsections)||void 0===g?void 0:g[R])||(null===(h=null==n?void 0:n.subsections)||void 0===h?void 0:h[R])||(null===(x=null==s?void 0:s.subsections)||void 0===x?void 0:x[R]),null===(_=null==n?void 0:n.subsections)||void 0===_?void 0:_[R],null===(b=null==s?void 0:s.subsections)||void 0===b?void 0:b[R],u,!1)};return Bn.forEach(function(e,n){var t,i=n+1;Q&&void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1);var o=null;if(Q){var l=null===(t=e.refIndexes)||void 0===t?void 0:t[0];o=jn.find(function(e){return e.selfIndex===l})}else o=jn[n];c(e,e,o,i,!0)}),jn.forEach(function(e,n){var t,i=n+1,o=!1;if(Q){var l=null===(t=e.refIndexes)||void 0===t?void 0:t[0],r=Bn.find(function(e){return e.selfIndex===l});r&&void 0!==r.selfIndex&&r.selfIndex>=0?i=r.selfIndex+1:(o=!0,void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1))}else n>=Bn.length&&(o=!0);o&&c(e,null,e,i,!0)}),t},[Bn,jn,Q,z]),Hn=t.useRef({}),Ln=function(e){return Hn.current[e]||(Hn.current[e]=h.default.createRef()),Hn.current[e]},Nn=t.useCallback(function(){var e,n,t,i;de(!1),Fe.current=!1;var o=Me.current,l=Kn.current;if(null!==o)if("string"==typeof o&&o.includes(m)){var r=o.split(m);(a=null===(e=ft.current[r[2]])||void 0===e?void 0:e.current)&&(a.style.paddingTop="0px")}else{var a;(a=null===(n=st.current[o])||void 0===n?void 0:n.current)&&(a.style.paddingTop="0px")}if(null!==l)if("string"==typeof l&&l.includes(m)){r=l.split(m);(s=null===(t=pt.current[r[3]])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}else{var s;(s=null===(i=ct.current[l])||void 0===i?void 0:i.current)&&(s.style.paddingTop="0px")}nt(null),Me.current=null,Kn.current=null,pe(!1),le(!1),Je.current&&(Je.current.style.height="0px"),Qe.current&&(Qe.current.style.height="0px"),Ze.current&&(Ze.current.style.height="0px"),en.current&&(en.current.style.height="0px")},[]),Wn=t.useCallback(function(e,n,t,i,o,l,r){var a,c,u,d=s.safeStringify(null==n?void 0:n.id)||s.safeStringify(null==t?void 0:t.id)||"",v=(d?ke[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},f=null!==(c=null===(a=Hn.current[i])||void 0===a?void 0:a.current)&&void 0!==c?c:null;return{isLoading:null!==(u=null==X?void 0:X.isLoading)&&void 0!==u&&u,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:f,badgeStyle:l||null,sectionIdx:i,docData:{documents:null==z?void 0:z.documents,input_index_map:null==z?void 0:z.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[ke,z]),zn=t.useCallback(function(e){rn(),Oe(null),Ve(e)},[rn]),Pn=function(e,n,t,i,o,l){e.stopPropagation(),Ke.open&&Ke.sectionIdx===o?rn():(ln(),Xe(Wn(e.currentTarget,n,i,o,t,l)))},qn=t.useCallback(function(){null!==Ke.sectionIdx&&Ke.anchorEl?zn(e.__assign(e.__assign({},Ke),{open:!0})):rn()},[Ke,rn,zn]),Vn=t.useCallback(function(){var e=Ke.sectionIdx,n=Ke.isOrphan;rn(),null!==e&&(n?se("No counterpart exists to connect to."):(Fe.current&&Nn(),be(function(n){return n.has(e)?new Set:new Set([e])})))},[Ke.sectionIdx,rn,Nn]),Yn=t.useRef(null),Kn=t.useRef(null),Xn=t.useRef(null),Un=t.useRef(null),Gn=t.useRef(null),$n=t.useState([]),Jn=$n[0],Qn=$n[1],Zn=t.useState(null),et=Zn[0],nt=Zn[1];t.useRef(null);var tt=t.useState(null),it=tt[0],ot=tt[1],lt=t.useMemo(function(){return sn.fields.filter(function(e){var n=e.key;return(!wn||"description"!==n)&&(s.hasValue(null==un?void 0:un[n])||s.hasValue(bn[n]))})},[un,bn,wn,sn.fields]),rt=t.useRef({}),at=t.useRef({}),st=t.useRef({}),ct=t.useRef({}),ut=t.useRef({}),dt=t.useRef({}),vt=t.useRef({}),ft=t.useRef({}),pt=t.useRef({});lt.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Bn.length,jn.length);t+=1)st.current[t]||(st.current[t]=h.default.createRef()),ct.current[t]||(ct.current[t]=h.default.createRef()),ut.current[t]||(ut.current[t]=h.default.createRef()),dt.current[t]||(dt.current[t]=h.default.createRef()),vt.current[t]||(vt.current[t]=h.default.createRef());rt.current[n]||(rt.current[n]=h.default.createRef()),at.current[n]||(at.current[n]=h.default.createRef())});for(var gt=0;gt<Math.max(Bn.length,jn.length);gt+=1)st.current[gt]||(st.current[gt]=h.default.createRef()),ct.current[gt]||(ct.current[gt]=h.default.createRef()),ut.current[gt]||(ut.current[gt]=h.default.createRef()),dt.current[gt]||(dt.current[gt]=h.default.createRef()),vt.current[gt]||(vt.current[gt]=h.default.createRef());t.useEffect(function(){if(pn){var e=sn.fields.find(function(e){return e.analysisKey===pn||e.key===pn});if(e){var n=rt.current[e.key]||at.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[pn,sn.fields]);var ht=t.useCallback(function(e){var n,t,i,o,l,r,a,s,c,u=null===(n=null==En?void 0:En.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(l=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===l?void 0:l.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(r=f.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(a=f.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[En]),xt=t.useCallback(function(n){var t,i,o,l,r,a,c,u=Bn[n],d=jn[n],v=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,f=(null==d?void 0:d.relation)&&"not_defined"!==d.relation;s.safeStringify(null==u?void 0:u.id)||s.safeStringify(null==d?void 0:d.id);var p=!(!(null==u?void 0:u.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!v&&!f&&!p)return e.__assign(e.__assign({},s.generateColorPalette(B)),{label:"Not Defined"});var g=null!==(i=null!==(t=null==u?void 0:u.evaluationResult)&&void 0!==t?t:null==d?void 0:d.evaluationResult)&&void 0!==i?i:null,h=null===(o=null==g?void 0:g.evaluation_outputs)||void 0===o?void 0:o.output_value,x=null!==(a=null===(r=null===(l=null==g?void 0:g.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===r?void 0:r.label_color)&&void 0!==a?a:B;return null!=g?e.__assign(e.__assign({},s.generateColorPalette(x)),{label:null!==(c=h)&&void 0!==c?c:""}):e.__assign(e.__assign({},s.generateColorPalette(x)),{label:"N/A"})},[Bn,jn,ke,sn,ht]),_t=t.useCallback(function(n){for(var t,i,o,l,r,a,c,u,d,v=n.split("-").map(Number),f=Bn[v[0]],p=jn[v[0]],g=1;g<v.length;g++)(null==f?void 0:f.subsections)&&(f=f.subsections[v[g]]),(null==p?void 0:p.subsections)&&(p=p.subsections[v[g]]);if(!f&&!p)return null;var h=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,x=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,_=s.safeStringify(null==f?void 0:f.id)||s.safeStringify(null==p?void 0:p.id)||"",m=!(!(null==f?void 0:f.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!h&&!x&&!m)return e.__assign(e.__assign({},s.generateColorPalette(B)),{label:"Not Defined"});null!==(i=null!==(t=null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||_&&(null===(o=ke[_])||void 0===o||o.relevance_score);var y=null!==(r=null!==(l=null==f?void 0:f.evaluationResult)&&void 0!==l?l:null==p?void 0:p.evaluationResult)&&void 0!==r?r:null,b=null===(a=null==y?void 0:y.evaluation_outputs)||void 0===a?void 0:a.output_value,S=null!==(d=null===(u=null===(c=null==y?void 0:y.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===u?void 0:u.label_color)&&void 0!==d?d:B;return null!=y?e.__assign(e.__assign({},s.generateColorPalette(S)),{label:null!=b?b:""}):e.__assign(e.__assign({},s.generateColorPalette(S)),{label:"N/A"})},[Bn,jn,ke,sn]),mt=t.useCallback(function(){var e,n,t,i,o,l,r,a,s,c,u,d,v,f,p,g,h,x,_,y,b,S;if(!tn.current&&!Be.current){tn.current=!0;try{if(!Yn.current)return;var I=function(e){var n=e.split("-"),t=n[0];if(!hn[t]&&!1===Q)return!1;if(Q&&!hn["left-".concat(t)]&&!hn["right-".concat(t)]&&!hn[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!mn[i])return!1;return!0},C=Yn.current.getBoundingClientRect();We({width:C.width,height:C.height});var B=[];if(lt.forEach(function(e){var n,t,i=e.key,o=null===(n=rt.current[i])||void 0===n?void 0:n.current,l=null===(t=at.current[i])||void 0===t?void 0:t.current;o&&l&&(o.style.height="auto",l.style.height="auto",o.style.minHeight="0px",l.style.minHeight="0px")}),!Be.current){for(var j=0;j<Math.max(Bn.length,jn.length);j++){var w=null===(e=st.current[j])||void 0===e?void 0:e.current,E=null===(n=ct.current[j])||void 0===n?void 0:n.current;w&&(w.style.height="auto",w.style.minHeight="0px"),E&&(E.style.height="auto",E.style.minHeight="0px")}Q||Object.keys(ft.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=ft.current[e])||void 0===n?void 0:n.current,o=null===(t=pt.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var T={};lt.forEach(function(e){var n,t,i=e.key,o=null===(n=rt.current[i])||void 0===n?void 0:n.current,l=null===(t=at.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),a=l.getBoundingClientRect();T[i]=Math.max(r.height,a.height)}});var F={left:{},right:{}},M={};if(!Be.current)if(Q){if(ue&&null!==et)if("number"==typeof et){var k=et,A=Bn[k],D=null===(o=st.current[k])||void 0===o?void 0:o.current;D&&A&&(A.refIndexes||[]).forEach(function(e){var n,t=jn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ct.current[t])||void 0===n?void 0:n.current;if(i&&(hn["left-".concat(k)]||hn["right-".concat(t)])){var o=Math.max(D.getBoundingClientRect().height,i.getBoundingClientRect().height);F.left[k]=Math.max(F.left[k]||0,o),F.right[t]=Math.max(F.right[t]||0,o)}})}else{var O=et.split(m)[2];if(O){w=null===(l=ft.current[O])||void 0===l?void 0:l.current,E=null===(r=pt.current[O])||void 0===r?void 0:r.current;if(w&&E){H=Math.max(w.getBoundingClientRect().height,E.getBoundingClientRect().height);M[O]=Math.max(M[O]||0,H)}}}}else{Object.keys(ft.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=ft.current[e])||void 0===n?void 0:n.current,o=null===(t=pt.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var l=i.getBoundingClientRect(),r=o.getBoundingClientRect(),a=Math.max(l.height,r.height);M[e]=a,i.style.minHeight="".concat(a,"px"),o.style.minHeight="".concat(a,"px")}}});for(j=0;j<Math.min(Bn.length,jn.length);j++){var w=null===(t=st.current[j])||void 0===t?void 0:t.current,E=null===(i=ct.current[j])||void 0===i?void 0:i.current;if(w&&E){var H=Math.max(w.getBoundingClientRect().height,E.getBoundingClientRect().height);F.left[j]=H,F.right[j]=H}}}if(lt.forEach(function(e){var n,t,i=e.key,o=null===(n=rt.current[i])||void 0===n?void 0:n.current,l=null===(t=at.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=T[i];o.style.minHeight="".concat(r,"px"),l.style.minHeight="".concat(r,"px")}}),Be.current||(Object.entries(F.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=st.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(F.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ct.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Q||Object.keys(M).forEach(function(e){var n,t,i=null===(n=ft.current[e])||void 0===n?void 0:n.current,o=null===(t=pt.current[e])||void 0===t?void 0:t.current;if(i&&o&&M[e]){var l=M[e];i.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}})),Q)Bn.forEach(function(e,n){var t;(null===(t=st.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,l,r,a,s,c,u,d,v=jn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=ut.current[n])||void 0===t?void 0:t.current,p=null===(i=dt.current[v])||void 0===i?void 0:i.current;if(f&&p){var g=f.getBoundingClientRect(),h=p.getBoundingClientRect(),x=g.right-C.left,_=h.left-C.left,m=g.top+g.height/2-C.top,y=h.top+h.height/2-C.top;if(ue&&et===n){var b=null!==(l=null===(o=nn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,S=null!==(a=null===(r=$e.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==a?a:0,R=b+(null!==(c=null===(s=nn.current)||void 0===s?void 0:s.clientHeight)&&void 0!==c?c:1/0),I=S+(null!==(d=null===(u=$e.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),j=g.top+g.height/2,w=function(e,n,t){return Math.max(n,Math.min(t,e))};m=w(j,b,R)-C.top,y=w(j,S,I)-C.top}var E=xt(n);E&&B.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:y,style:E,sectionIdx:n,targetRightIdx:v})}}})});else for(j=0;j<Math.min(Bn.length,jn.length);j++){var L=null===(a=st.current[j])||void 0===a?void 0:a.current,N=null===(s=ct.current[j])||void 0===s?void 0:s.current;if(L&&N){var W=L.getBoundingClientRect(),z=N.getBoundingClientRect(),P=Math.max(W.top,z.top)+18-C.top,q=(null===(c=jn[j])||void 0===c?void 0:c.id)||"sec-".concat(j);(J=xt(j))&&B.push({id:q,x1:W.right-C.left,y1:P,x2:z.left-C.left,y2:P,style:J,sectionIdx:j,hasCognitive:!!((null===(u=Bn[j])||void 0===u?void 0:u.cognitiveData)||(null===(d=jn[j])||void 0===d?void 0:d.cognitiveData)||q&&ke[q]),isSubSection:!1})}}if(ue&&"string"==typeof et&&et.includes(m)){var V=et.split(m),Y=V[0],K=V[1],X=V[2],U=(V[3],"".concat(Y).concat(m).concat(K)),G=null===(v=ut.current[U])||void 0===v?void 0:v.current,$=null===(f=dt.current[U])||void 0===f?void 0:f.current;if(G&&$){var J,Z=G.getBoundingClientRect(),ee=$.getBoundingClientRect(),ne=Z.right-C.left,te=ee.left-C.left,ie=Z.top+Z.height/2-C.top,oe=ee.top+ee.height/2-C.top;if(Q){var le=null!==(g=null===(p=nn.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==g?g:0,re=null!==(x=null===(h=$e.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,ae=le+(null!==(y=null===(_=nn.current)||void 0===_?void 0:_.clientHeight)&&void 0!==y?y:1/0),se=re+(null!==(S=null===(b=$e.current)||void 0===b?void 0:b.clientHeight)&&void 0!==S?S:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};ie=ce(Z.top+Z.height/2,le,ae)-C.top,oe=ce(ee.top+ee.height/2,re,se)-C.top}(J=_t(X))&&B.push({id:"line-subsec-".concat(U),x1:ne,y1:ie,x2:te,y2:oe,style:J,sectionIdx:Number(X.split("-")[0]),isSubSection:!0,subSectionKeyPath:et})}}if(Qn(B),Un.current&&Gn.current){var de=Un.current.getBoundingClientRect(),ve=Gn.current.getBoundingClientRect(),fe=(de.top+de.height/2-C.top+ve.top+ve.height/2-C.top)/2;ot({x1:de.right-C.left,x2:ve.left-C.left,y:fe})}else ot(null);if(ye.size>0){var pe=[],ge=nn.current,he=$e.current;if(ge&&he){var xe=[],_e=ge.getBoundingClientRect().top,me=he.getBoundingClientRect().top,be=_e+ge.clientHeight,Se=me+he.clientHeight,Re=ge.scrollTop,Ce=he.scrollTop,je=C.top,we=function(e,n,t){return Math.max(n,Math.min(t,e))};ye.forEach(function(e){var n,t,i,o,l;if("string"==typeof e&&e.includes(m)){var r=e.split(m),a=r[0],s=r[1],c=r[2],u=(r[3],"".concat(a).concat(m).concat(s)),d=null===(n=ut.current[u])||void 0===n?void 0:n.current,v=null===(t=dt.current[u])||void 0===t?void 0:t.current;if(!d||!v)return;var f=d.getBoundingClientRect(),p=v.getBoundingClientRect(),g=_t(c),h=(D=f.right-C.left)+.5*((O=p.left-C.left-0)-D),x=f.top+f.height/2,_=p.top+p.height/2,y=x-_e+Re,b=_-me+Ce,S="conn-subsec-".concat(u);xe.push({lhsScrollY:y,rhsScrollY:b,x1:D,x2:O,containerTop:je,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:S});var I=we(x,_e,be),B=we(_,me,Se),j=I-je,w=B-je,E=_>=me-4&&_<=Se+4,T="";T=(H=x>=_e-4&&x<=be+4)&&E?R(D,j,O,w):H&&!E?"M ".concat(D,",").concat(j," L ").concat(h,",").concat(j," L ").concat(h,",").concat(w):!H&&E?"M ".concat(h,",").concat(j," L ").concat(h,",").concat(w," L ").concat(O,",").concat(w):"M ".concat(h,",").concat(j," L ").concat(h,",").concat(w),pe.push({id:S,pathD:T,style:g,leftIdx:e,rhsArrayIdx:e})}else if(Q){var F=e,M=Bn[F];if(!(null===(l=null==M?void 0:M.refIndexes)||void 0===l?void 0:l.length))return;M.refIndexes.forEach(function(e){var n,t,i=jn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=ut.current[F])||void 0===n?void 0:n.current,l=null===(t=dt.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),a=l.getBoundingClientRect(),s=xt(F),c=r.right-C.left,u=a.left-C.left-0,d=c+.5*(u-c),v=r.top+r.height/2,f=a.top+a.height/2,p=v-_e+Re,g=f-me+Ce,h="conn-".concat(F,"-").concat(i);xe.push({lhsScrollY:p,rhsScrollY:g,x1:c,x2:u,containerTop:je,leftIdx:F,rhsArrayIdx:i,styleColor:(null==s?void 0:s.badgeBorder)||"#6366F1",styleId:h});var x=we(v,_e,be),_=we(f,me,Se),m=x-je,y=_-je,b=v>=_e-4&&v<=be+4,S=f>=me-4&&f<=Se+4,I="";I=b&&S?R(c,m,u,y):b&&!S?"M ".concat(c,",").concat(m," L ").concat(d,",").concat(m," L ").concat(d,",").concat(y):!b&&S?"M ".concat(d,",").concat(m," L ").concat(d,",").concat(y," L ").concat(u,",").concat(y):"M ".concat(d,",").concat(m," L ").concat(d,",").concat(y),pe.push({id:h,pathD:I,style:s,leftIdx:F,rhsArrayIdx:i})}}})}else{var k=e,A=k;d=null===(i=ut.current[k])||void 0===i?void 0:i.current,v=null===(o=dt.current[A])||void 0===o?void 0:o.current;if(!d||!v)return;var D,O;f=d.getBoundingClientRect(),p=v.getBoundingClientRect(),g=xt(k),h=(D=f.right-C.left)+.5*((O=p.left-C.left-0)-D),x=f.top+f.height/2,_=p.top+p.height/2,y=x-_e+Re,b=_-me+Ce,S="conn-".concat(k,"-").concat(A);xe.push({lhsScrollY:y,rhsScrollY:b,x1:D,x2:O,containerTop:je,leftIdx:k,rhsArrayIdx:A,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:S});var H;I=we(x,_e,be),B=we(_,me,Se),j=I-je,w=B-je,E=_>=me-4&&_<=Se+4,T="";T=(H=x>=_e-4&&x<=be+4)&&E?R(D,j,O,w):H&&!E?"M ".concat(D,",").concat(j," L ").concat(h,",").concat(j," L ").concat(h,",").concat(w):!H&&E?"M ".concat(h,",").concat(j," L ").concat(h,",").concat(w," L ").concat(O,",").concat(w):"M ".concat(h,",").concat(j," L ").concat(h,",").concat(w),pe.push({id:S,pathD:T,style:g,leftIdx:k,rhsArrayIdx:A})}}),Ee.current=xe}Ie(pe)}else Ie([]),Ee.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{tn.current=!1}}},[lt,Bn,jn,ke,sn,ht,xt,Q,ue,et,ye,hn,mn]),yt=t.useCallback(function(){var e,n,t,i,o,l,r,a,s,c,u,d,v,f,p=Ee.current;if(p.length&&!Be.current){var g=null!==(n=null===(e=nn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=$e.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(l=null===(o=nn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==l?l:1/0,_=null!==(a=null===(r=$e.current)||void 0===r?void 0:r.clientHeight)&&void 0!==a?a:1/0,m=null!==(c=null===(s=nn.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==c?c:0,y=null!==(d=null===(u=$e.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=m+x,S=y+_,I=null!==(f=null===(v=Yn.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,C=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-g+m,t=e.rhsScrollY-h+y,i=we.current[e.styleId+"-stroke"],o=we.current[e.styleId+"-bg"];if(i||o){var l,r=C(n,m,b),a=C(t,y,S),s=r-I,c=a-I,u=n>=m-4&&n<=b+4,d=t>=y-4&&t<=S+4,v=e.x1+.5*(e.x2-e.x1);l=u&&d?R(e.x1,s,e.x2,c):u&&!d?"M ".concat(e.x1,",").concat(s," L ").concat(v,",").concat(s," L ").concat(v,",").concat(c):!u&&d?"M ".concat(v,",").concat(s," L ").concat(v,",").concat(c," L ").concat(e.x2,",").concat(c):"M ".concat(v,",").concat(s," L ").concat(v,",").concat(c),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",l)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",l))}})}},[]),bt=t.useRef(mt);t.useEffect(function(){bt.current=mt},[mt]);var St=t.useRef(null),Rt=t.useCallback(function(){null!==St.current&&clearTimeout(St.current),St.current=setTimeout(function(){bt.current(),St.current=null},50)},[]),It=t.useCallback(function(e){var n,t,i,o,l,r,a,s,c,u;if(!ge.current){if(Q||Rt(),Fe.current){var d=Me.current,v=Kn.current,f=nn.current,p=$e.current;if(null!==d&&null!==v&&f&&p){var g="string"==typeof d&&d.includes(m)?null===(n=ut.current["".concat(d.split(m)[0]).concat(m).concat(d.split(m)[1])])||void 0===n?void 0:n.current:null===(t=Hn.current[d])||void 0===t?void 0:t.current,h="string"==typeof v&&v.includes(m)?null===(i=dt.current["".concat(v.split(m)[0]).concat(m).concat(v.split(m)[1])])||void 0===i?void 0:i.current:null===(o=vt.current[v])||void 0===o?void 0:o.current;if(g&&h){var x=g.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop,_=h.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop;if(e.currentTarget===f){var y=_-(x-f.scrollTop),b=p.scrollHeight-p.clientHeight,S=Math.max(0,Math.min(y,b));Math.abs(p.scrollTop-S)>1&&(p.scrollTop=S)}else if(e.currentTarget===p){var R=x-(_-p.scrollTop),I=f.scrollHeight-f.clientHeight,C=Math.max(0,Math.min(R,I));Math.abs(f.scrollTop-C)>1&&(f.scrollTop=C)}if(Xn.current){var B=void 0,j=void 0;if("string"==typeof d&&d.includes(m)){var w=d.split(m),E="".concat(w[0]).concat(m).concat(w[1]);B=null===(l=ut.current[E])||void 0===l?void 0:l.current,j=null===(r=dt.current[E])||void 0===r?void 0:r.current}else B=null===(a=ut.current[d])||void 0===a?void 0:a.current,j=null===(s=dt.current[v])||void 0===s?void 0:s.current;var T=null!==(u=null===(c=Yn.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==u?u:0,F=f.getBoundingClientRect().top,M=F+f.clientHeight,k=p.getBoundingClientRect().top,A=k+p.clientHeight,D=function(e,n,t){return Math.max(n,Math.min(t,e))};if(B&&j){var O=B.getBoundingClientRect(),H=j.getBoundingClientRect(),L=O.top+O.height/2,N=H.top+H.height/2,W=D(L,F,M),z=D(N,k,A);Xn.current.setAttribute("y1",(W-T).toString()),Xn.current.setAttribute("y2",(z-T).toString());var P=L>=F-4&&L<=M+4;Xn.current.setAttribute("visibility",P?"visible":"hidden")}}}}}Ee.current.length>0&&!Te.current&&(Te.current=!0,requestAnimationFrame(function(){yt(),Te.current=!1}))}},[yt,Q,Rt]);t.useEffect(function(){var e=setTimeout(Rt,250);window.addEventListener("resize",Rt);var n=null,t=null;return Ue.current&&(n=new ResizeObserver(Rt)).observe(Ue.current),Yn.current&&(t=new ResizeObserver(Rt)).observe(Yn.current),function(){clearTimeout(e),window.removeEventListener("resize",Rt),null==n||n.disconnect(),null==t||t.disconnect()}},[un,bn,En,lt,hn,mn,Bn,jn,sn,Rt,ue,et,fe,ye]),t.useEffect(function(){Fe.current=ue},[ue]),t.useEffect(function(){Me.current=et},[et]);var Ct=t.useCallback(function(){var e,n,t,i,o=Ke.sectionIdx,l=Ke.isOrphan;if(rn(),null!=o)if(l)se("No counterpart exists for this section.");else if(ue&&et===o)Nn();else{if(!Q){var r=Me.current,a=Kn.current;if(null!==r)if("string"==typeof r&&r.includes(m)){var s=r.split(m);(c=null===(e=ft.current[s[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=st.current[r])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==a)if("string"==typeof a&&a.includes(m)){s=a.split(m);(u=null===(t=pt.current[s[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=ct.current[a])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}}be(new Set),Ie([]),Ee.current=[],le(!0),ge.current=!0,nt(o),Me.current=o,de(!0),Fe.current=!0,pe(!1),Je.current&&(Je.current.style.height="0px"),Qe.current&&(Qe.current.style.height="0px"),Ze.current&&(Ze.current.style.height="0px"),en.current&&(en.current.style.height="0px"),requestAnimationFrame(function(){var e,n,t,i,l,r,a,s,c,u,d,v=null,f=null,p=null,g=null,h=null;if("string"==typeof o&&o.includes(m)){var x=o.split(m),_="".concat(x[0]).concat(m).concat(x[1]);v=(null===(e=ut.current[_])||void 0===e?void 0:e.current)||null,h=(f=(null===(n=dt.current[_])||void 0===n?void 0:n.current)||null)?o:null,p=(null===(t=ft.current[x[2]])||void 0===t?void 0:t.current)||null,g=(null===(i=pt.current[x[3]])||void 0===i?void 0:i.current)||null}else if(v=(null===(l=Hn.current[o])||void 0===l?void 0:l.current)||null,p=(null===(r=st.current[o])||void 0===r?void 0:r.current)||null,Q){var y=Bn[o],b=(null==y?void 0:y.refIndexes)||[];if(b.length>0){var S=b[0],R=jn.findIndex(function(e){return e.selfIndex===S});-1!==R&&(f=(null===(c=vt.current[R])||void 0===c?void 0:c.current)||null,g=(null===(u=ct.current[R])||void 0===u?void 0:u.current)||null,h=R)}}else f=(null===(a=vt.current[o])||void 0===a?void 0:a.current)||null,g=(null===(s=ct.current[o])||void 0===s?void 0:s.current)||null,h=f?o:null;Kn.current=h;var I=nn.current,C=$e.current;if(!v||!I)return ge.current=!1,void le(!1);if(!f||!C)return pe(!0),bt.current(),ge.current=!1,void le(!1);if(!Q){var B=v.getBoundingClientRect(),w=f.getBoundingClientRect(),E=B.top-w.top;p&&g&&(p.style.paddingTop="0px",g.style.paddingTop="0px",E>0?g.style.paddingTop="".concat(E,"px"):E<0&&(p.style.paddingTop="".concat(Math.abs(E),"px")));var T=v?v.getBoundingClientRect().top:(null==p?void 0:p.getBoundingClientRect().top)||0;return null===(d=Ue.current)||void 0===d||d.scrollTo({top:Ue.current.scrollTop+T-150,behavior:"smooth"}),pe(!0),bt.current(),ge.current=!1,void le(!1)}var F=v.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,M=f.getBoundingClientRect().top-C.getBoundingClientRect().top+C.scrollTop-(F-I.scrollTop);M<0&&Je.current&&(Je.current.style.height="".concat(Math.abs(M),"px"));requestAnimationFrame(function(){var e,n=C.scrollHeight-C.clientHeight;if(M<0)e=0;else{if(M>n){var t=M-n;return Qe.current&&(Qe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){j(C,M,200,function(){pe(!0),bt.current(),ge.current=!1,le(!1)})})}e=M}j(C,e,200,function(){pe(!0),bt.current(),ge.current=!1,le(!1)})})})}},[rn,Ke.sectionIdx,ue,et,Bn,jn,Rt,Nn]),Bt=null!==Ke.sectionIdx&&ye.has(Ke.sectionIdx),jt=function(t){var l,r,a,c,u,d,v,f=t.section,p=t.idx,g=t.columnKey,x=t.colRef,_=t.mb,m=void 0===_?1:_,y=t.parentNodeId,b=void 0===y?"":y,R=Q?!!hn["".concat(g,"-").concat(p)]:!!hn[String(p)],I=(null===(l=f.displayTitle)||void 0===l||l)&&s.hasValue(f.title),C=(null===(r=f.displayContent)||void 0===r||r)&&s.hasValue(f.content),j=!I&&!C,w={current:1},E=f.title;I||(E=C?"No Title Found":"No Matching Section Found");var T,F=null!==(d=null===(u=null===(c=null===(a=f.evaluationResult)||void 0===a?void 0:a.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===u?void 0:u.label_color)&&void 0!==d?d:B,M=s.generateColorPalette(F).highlightBg,k=[];if(null===(v=f.evaluationResult)||void 0===v?void 0:v.deviations){var A=f.evaluationResult.deviations;for(var D in A){var O=A[D][b];O&&k.push(O)}}return n.jsx(i.Box,e.__assign({ref:x,sx:{mb:m,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!j&&R,onChange:function(){return!j&&function(n,t){var i,o;Be.current=!0,je.current&&clearTimeout(je.current),Ce.current&&(Ce.current.style.opacity="0");var l=null===(i=st.current[n])||void 0===i?void 0:i.current,r=null===(o=ct.current[n])||void 0===o?void 0:o.current;l&&(l.style.minHeight="0px"),r&&(r.style.minHeight="0px"),je.current=setTimeout(function(){Be.current=!1,bt.current(),Ce.current&&(Ce.current.style.opacity="1")},650),xn(function(i){var o=e.__assign({},i),l=Q?"".concat(t,"-").concat(n):String(n),r=!i[l];if(!r){var a=String(et||""),s=et===n||a.startsWith("".concat(n,"-")),c=!1;ye.forEach(function(e){(e===n||String(e).startsWith("".concat(n,"-")))&&(c=!0)}),(s||c)&&(Nn(),be(new Set),Ie([]),Ee.current=[])}if(!Q)return o[String(n)]=r,o;if(o[l]=r,"left"===t)((null==(u=Bn[n])?void 0:u.refIndexes)||[]).forEach(function(e){var n=jn.findIndex(function(n){return n.selfIndex===e});-1!==n&&(o["right-".concat(n)]=r)});else{var u,d=null==(u=jn[n])?void 0:u.selfIndex;Bn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(d))&&(o["left-".concat(n)]=r)})}return o})}(p,g)},sx:{boxShadow:"none",border:j?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:j?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:j?null:n.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:j?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:I&&n.jsx(i.Tooltip,e.__assign({title:E,placement:"top"},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:j?"#94A3B8":"#19213D",fontWeight:j?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(T=E,T?s.safeStringify(T).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},t):n.jsx(h.default.Fragment,{children:e},t)}):null)}))}))})),!j&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[C&&n.jsx(S,{content:f.content,sxStyles:ze,highlights:k,maintainRelativeOrder:Q,highlightBg:M}),(f.subsections||[]).map(function(e,n){return wt({section:e,keyPath:"".concat(p,"-").concat(n),depth:0,columnKey:g,parentNodeId:b,devCounter:w})})]}))]}))}),"".concat(g,"-sec-").concat(p))},wt=function(t){var l,r,a,c,u,d,v,f,p,g,x,_,b,R,I,C=t.section,j=t.keyPath,w=t.depth,E=void 0===w?0:w,T=t.columnKey,F=void 0===T?"left":T,M=t.parentNodeId,k=void 0===M?"":M,A=(null===(l=C.displayTitle)||void 0===l||l)&&s.hasValue(C.title),D=(null===(r=C.displayContent)||void 0===r||r)&&s.hasValue(C.content),O=!A&&!D,H=A?C.title:D?"No Title Found":"No Matching Section Found",L=!!mn[j];"left"!==F||ft.current[j]||(ft.current[j]=h.default.createRef()),"right"!==F||pt.current[j]||(pt.current[j]=h.default.createRef());var N="left"===F?ft.current[j]:pt.current[j],W=_t(j),P=j.split("-").map(Number),q=P[0],V=Bn[q],Y=jn[q],K=j,X=j;if(Q)if("left"===F){var U=null===(a=null==V?void 0:V.refIndexes)||void 0===a?void 0:a[0],G=jn.findIndex(function(e){return e.selfIndex===U});-1!==G&&(Y=jn[G],X=e.__spreadArray([G],P.slice(1),!0).join("-"))}else{var $=null===(c=null==Y?void 0:Y.refIndexes)||void 0===c?void 0:c[0],J=Bn.findIndex(function(e){return e.selfIndex===$});-1!==J&&(V=Bn[J],K=e.__spreadArray([J],P.slice(1),!0).join("-"))}var Z,ee="left"===F?V:Y;Z=Q&&void 0!==(null==ee?void 0:ee.selfIndex)&&ee.selfIndex>=0?ee.selfIndex+1:q+1;for(var ne=V,te=Y,ie=1;ie<P.length;ie++)(null==ne?void 0:ne.subsections)&&(ne=ne.subsections[P[ie]]),(null==te?void 0:te.subsections)&&(te=te.subsections[P[ie]]);var oe=null===(u=null==z?void 0:z.input_index_map)||void 0===u?void 0:u[0],le=null===(d=null==z?void 0:z.input_index_map)||void 0===d?void 0:d[1],re="left"===F?le:oe,ae=Q?!(null===(v=C.refIndexes)||void 0===v?void 0:v.length)||void 0!==C.selfIndex&&C.selfIndex<0:"left"===F?!te:!ne,se=null!==(g=null===(p=null===(f=C.evaluationResult)||void 0===f?void 0:f.evaluation_outputs)||void 0===p?void 0:p.output_value)&&void 0!==g?g:null,ce=C.id,ue=null!==(R=null===(b=null===(_=null===(x=C.evaluationResult)||void 0===x?void 0:x.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===b?void 0:b.label_color)&&void 0!==R?R:B,de=s.generateColorPalette(ue).highlightBg,ve=(null===(I=C.evaluationResult)||void 0===I?void 0:I.deviations)||{},fe=Object.entries(ve).map(function(n){var t=n[0],i=n[1],o="".concat(ce).concat(m).concat(t),l=On[o];if(!l)return null;var r=i[k],a=y(r);if(a)r="";else if(!r)return null;var s=i[re],c=ae||y(s),u="".concat(Z,".").concat(l),d="".concat(ce).concat(m).concat(t).concat(m).concat(K).concat(m).concat(X);return"left"!==F||ut.current[o]||(ut.current[o]=h.default.createRef()),"right"!==F||dt.current[o]||(dt.current[o]=h.default.createRef()),{id:o,actionId:d,label:u,highlight:r,side:F,style:W,score:se,isConnected:ye.has(d),isOrphan:c,isMissingClause:a,badgeRef:"left"===F?ut.current[o]:dt.current[o],onClick:function(n){n.stopPropagation();var t=e.__assign(e.__assign({},ne||{title:"",content:""}),{title:(null==V?void 0:V.title)||(null==ne?void 0:ne.title)||""}),i=e.__assign(e.__assign({},te||{title:"",content:""}),{title:(null==Y?void 0:Y.title)||(null==te?void 0:te.title)||""});Pn(n,t,c,i,d,W)}}}).filter(Boolean),pe=fe.some(function(e){return ye.has(e.actionId)});if(!(A||D||C.subsections&&0!==C.subsections.length))return null;var ge=function(){var e,n=[];if(null===(e=C.evaluationResult)||void 0===e?void 0:e.deviations){var t=C.evaluationResult.deviations;for(var i in t){var o=t[i][k];o&&n.push(o)}}return n}();return A?n.jsx(i.Box,e.__assign({ref:N,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({width:"100%"},pe&&W&&{borderRadius:"4px",outline:"2px solid ".concat(W.badgeBorder),outlineOffset:"1px"})},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!O&&L,onChange:function(){if(!O){if(L){var n=String(et||""),t=n.includes(K)||n.includes(X);t||ye.forEach(function(e){(String(e).includes(K)||String(e).includes(X))&&(t=!0)}),t&&(Nn(),be(new Set),Ie([]),Ee.current=[])}yn(function(n){var t;return e.__assign(e.__assign({},n),((t={})[j]=!n[j],t))})}},sx:{mt:0,boxShadow:"none",border:O?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:O?null:n.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:O?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:H||"Untitled Subsection"}))})),!O&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[D&&n.jsx(S,{content:C.content,sxStyles:ze,deviationBadges:fe,maintainRelativeOrder:Q,highlightBg:de,highlights:ge}),(C.subsections||[]).map(function(e,n){return wt({section:e,keyPath:"".concat(j,"-").concat(n),depth:E+1,columnKey:F,parentNodeId:k})})]}))]}))}))}),j):n.jsx(i.Box,e.__assign({ref:N,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!O&&n.jsxs(i.Box,e.__assign({sx:e.__assign({width:"100%"},pe&&W&&{borderRadius:"4px",outline:"2px solid ".concat(W.badgeBorder),outlineOffset:"1px"})},{children:[D&&n.jsx(S,{content:C.content,sxStyles:ze,deviationBadges:fe,maintainRelativeOrder:Q,highlightBg:de,highlights:ge}),(C.subsections||[]).map(function(e,n){return wt({section:e,keyPath:"".concat(j,"-").concat(n),depth:E+1,columnKey:F,parentNodeId:k})})]}))}),j)};return n.jsxs(i.Box,e.__assign({ref:Ge,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Q?{}:{overflow:"visible"}),{position:"relative"})},{children:[ne&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),n.jsx(d.default,{open:Ke.open,anchorEl:Ke.anchorEl,sectionTitle:Ke.sectionTitle,referenceSectionTitle:Ke.refSectionTitle,onClose:rn,onOpenCognitiveCompare:qn,onOpenSideBySide:Ct,onConnect:Vn,isConnected:Bt,isOrphan:Ke.isOrphan}),qe.open&&n.jsx(u.default,{open:qe.open,popupRef:He,position:De,popupConfig:U,onClose:function(){Oe(null),Ve(function(n){return e.__assign(e.__assign({},n),{open:!1})}),_e(null)},markdownStyles:Y,sectionTitle:qe.sectionTitle,referenceSectionTitle:qe.refSectionTitle,cognitiveData:qe.cognitiveData,anchorEl:qe.anchorEl,sectionAnchorEl:qe.sectionAnchorEl,scrollContainerEl:Ue.current,badgeStyle:qe.badgeStyle,docData:qe.docData,deviationData:qe.deviationData,isLoading:qe.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!ae,autoHideDuration:8e3,onClose:function(){return se(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return se(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ae}))})),(X.isHeaderVisible||X.isToggleVisible)&&n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:X.isHeaderVisible&&n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:W}))})),X.isToggleVisible&&n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center"}},{children:n.jsx(i.FormControlLabel,{control:n.jsx(i.Switch,{checked:!Q,onChange:function(e){var n=e.target.checked;te(!0),setTimeout(function(){Z(!n),Nn(),be(new Set),Ie([]),Ee.current=[],setTimeout(function(){te(!1)},400)},50)},color:"primary",size:"small",sx:{width:100,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"3px",transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(75px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:"#5928ED",opacity:1,border:0,"&::before":{content:'"Side by Side"',position:"absolute",left:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px"}}}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:20,height:20},"& .MuiSwitch-track":{borderRadius:13,backgroundColor:"#9e9e9e",opacity:1,position:"relative","&::after":{content:'"Side by Side"',position:"absolute",right:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px",opacity:1,transition:"opacity 0.2s"}},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{"&::after":{opacity:0}}}}),label:"",labelPlacement:"start",sx:{m:0,gap:1}})}))]})),n.jsx(i.Box,e.__assign({ref:Ue,onScroll:It,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Q?"hidden":"auto",borderTop:Tn&&Fn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Q?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Yn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Q?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ce,style:{position:"absolute",top:0,left:0,width:Ne.width||"100%",height:Ne.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[it&&!ue&&n.jsxs("g",{children:[n.jsx("line",{x1:it.x1,y1:it.y,x2:Math.max(it.x1,(it.x1+it.x2)/2-70),y2:it.y,stroke:Dn.badgeBorder,strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(it.x2,(it.x1+it.x2)/2+70),y1:it.y,x2:it.x2,y2:it.y,stroke:Dn.badgeBorder,strokeWidth:"1.5"})]}),Jn.map(function(t){var r,a=t.x1+.5*(t.x2-t.x1),s=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;var c=!1;if(t.isSubSection)c=ue&&et===t.subSectionKeyPath&&fe;else{var u=Bn[t.sectionIdx];(Q?!(null===(r=null==u?void 0:u.refIndexes)||void 0===r?void 0:r.length)||(null==u?void 0:u.selfIndex)<0:!jn[t.sectionIdx])||(c=ue&&et===t.sectionIdx&&fe)}if(c)return n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:Xn,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id);if(!Q){var d=t.isSubSection?R(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2);return n.jsxs("g",{children:[n.jsx("path",{d:d,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:a-100,y:s-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(n){if(n.stopPropagation(),qe.open&&xe===t.id)ln();else{var i=Bn[t.sectionIdx]||{title:"",content:""},o=jn[t.sectionIdx]||{title:"",content:""};if(t.isSubSection&&t.subSectionKeyPath){for(var l=t.subSectionKeyPath.split(m)[2].split("-").map(Number),r=Bn[l[0]],a=jn[l[0]],s=(null==r?void 0:r.title)||"",c=(null==a?void 0:a.title)||"",u=1;u<l.length;u++)(null==r?void 0:r.subsections)&&(r=r.subsections[l[u]]),(null==a?void 0:a.subsections)&&(a=a.subsections[l[u]]);r&&(i=e.__assign(e.__assign({},r),{title:s||r.title})),a&&(o=e.__assign(e.__assign({},a),{title:c||a.title}))}_e(t.id),zn(Wn(n.currentTarget,i,o,t.sectionIdx,t.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[t.style.badgeText===B?n.jsx(p.default,{color:t.style.badgeText}):0===t.style.label?"Same":t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:qe.open&&xe===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Re.map(function(t){var i,o=t.pathD,l=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",r="conn-marker-".concat(t.id),a="".concat(t.id,"-bg"),s="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:r,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),n.jsx("path",{ref:function(e){we.current[a]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){we.current[s]=e},d:o,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(r,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},Q?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Un,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:In,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:In}))}))})),n.jsxs(i.Box,e.__assign({ref:nn,onScroll:It,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},Q?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Ze,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&Bn.map(function(t,l){var r,a,s=!t.title&&!t.content;if(Q&&s)return null;var c=t,u=xt(l),d=Q?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!jn[l],v=Q?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:l+1,f=ye.has(l),g=b(c.evaluationResult,null==u?void 0:u.deviationLabel);return n.jsx(i.Box,e.__assign({ref:Ln(l),sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:st.current[l],sx:e.__assign({width:"100%",display:"flex"},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==u?void 0:u.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:jt({section:t,idx:l,columnKey:"left",colRef:h.default.createRef(),mb:0,parentNodeId:(null===(a=null==z?void 0:z.input_index_map)||void 0===a?void 0:a[0])||""})})),Q&&u&&n.jsxs(i.Box,e.__assign({ref:ut.current[l],onClick:function(e){var n=Q?jn.find(function(e){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:jn[l]||{title:"",content:""};Pn(e,t,d,n,l,u)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:u.badgeBg,color:u.badgeText,border:"1px solid ".concat(u.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==v&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(u.badgeBorder)}},{children:v})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!X.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?d?"No Deviation Found":"N/A"===g||"NA"===g?"N/A":0==g||null==g?"Same":"".concat(g):n.jsx(p.default,{color:u.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:u.badgeText})]}))]}))}),"left-row-".concat(l))}),n.jsx("div",{ref:en,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:Dn.badgeBg,color:Dn.badgeText,border:"1px solid ".concat(Dn.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[An,n.jsx(i.Box,e.__assign({component:"span",onClick:function(n){n.stopPropagation(),qe.open&&xe===Mn?ln():(_e(Mn),zn(Wn(n.currentTarget,{title:"",content:"",evaluationResult:kn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Mn,!0,e.__assign(e.__assign({},Dn),{label:""}))))},sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:qe.open&&xe===Mn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},Q?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[oe&&n.jsx(r.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Gn,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:Cn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:Cn}))}))})),n.jsxs(i.Box,e.__assign({ref:$e,onScroll:It,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},Q?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-25px",pl:"45px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Je,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&jn.map(function(t,o){var l,r=t,a=[],s=!1,c=null;if(Q){a=Bn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(r.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var u=Bn.findIndex(function(e,n){var t;return ye.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(r.selfIndex))});(s=-1!==u)&&(c=xt(u))}else a=[o+1],(s=ye.has(o))&&(c=xt(o));var d=xt(o);return n.jsx(i.Box,e.__assign({ref:vt.current[o],sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:ct.current[o],sx:e.__assign({width:"100%",display:"flex"},s&&c&&{borderRadius:"6px",outline:"2px solid ".concat(c.badgeBorder),outlineOffset:"1px"})},{children:jt({section:t,idx:o,columnKey:"right",colRef:h.default.createRef(),mb:0,parentNodeId:(null===(l=null==z?void 0:z.input_index_map)||void 0===l?void 0:l[1])||""})})),Q&&!oe&&d&&n.jsx(i.Box,e.__assign({ref:dt.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:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:a.length>0?a.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:Qe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),o=require("react/jsx-runtime"),e=require("react"),n=require("@mui/material"),t=require("lucide-react"),s=require("react-dom"),a=require("../../assests/svg/SparkleIcon.js"),r=require("./CognitiveCompareConfig.js"),l=require("./CitationRenderer.js");function c(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var d=c(s),x=10;exports.default=function(s){var c,p,g,u,v,h,b,f,_,m,y,F,j,w,k,B,S,C,D,E,T=s.open,I=s.onClose,R=s.sectionTitle,A=s.referenceSectionTitle,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),o=require("react/jsx-runtime"),e=require("react"),n=require("@mui/material"),t=require("lucide-react"),s=require("react-dom"),a=require("../../assests/svg/SparkleIcon.js"),r=require("./CognitiveCompareConfig.js"),l=require("./CitationRenderer.js");function c(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var d=c(s),x=10;exports.default=function(s){var c,p,g,u,v,h,b,f,_,m,y,F,j,w,k,B,S,C,D,E,T=s.open,I=s.onClose,R=s.sectionTitle,A=s.referenceSectionTitle,L=s.cognitiveData,P=s.relevanceScore,z=s.anchorEl,O=s.badgeStyle,W=s.popupRef,q=s.position,U=s.markdownStyles,H=s.docData,M=s.popupConfig,N=s.deviationData,G=void 0===N?null:N,Y=s.isLoading,K=i.__assign(i.__assign({},r.SHARED_MARKDOWN_STYLES),U),X=e.useMemo(function(){var o,e;return i.__assign(i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG),M),{tabs:{deviation:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.deviation),null===(o=null==M?void 0:M.tabs)||void 0===o?void 0:o.deviation),association:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.association),null===(e=null==M?void 0:M.tabs)||void 0===e?void 0:e.association)},sectionTitles:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.sectionTitles),null==M?void 0:M.sectionTitles)})},[M]),J=null==L?void 0:L.isMissingRationale,Q=e.useState(J?X.tabs.deviation.key:X.tabs.association.key),V=Q[0],Z=Q[1];e.useEffect(function(){T&&Z(J?X.tabs.deviation.key:X.tabs.association.key)},[T,J,X.tabs.deviation.key,X.tabs.association.key]);var $=e.useMemo(function(){if(!O)return{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")};var i=O.badgeText;return"#9F1239"===i||"#B42318"===i?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===i?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===i?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")}},[O,X.accentColor]);e.useEffect(function(){if(T){var i=function(i){var o;(null===(o=W.current)||void 0===o?void 0:o.contains(i.target))||(null==z?void 0:z.contains(i.target))||I()};return document.addEventListener("mousedown",i),function(){return document.removeEventListener("mousedown",i)}}},[T,I,z,W]);var ii=J?[]:[X.tabs.deviation,X.tabs.association];if(1===ii.length&&ii[0].key===X.tabs.deviation.key)return null;if(!T||!L)return null;var oi=null!==(g=null!==(p=V===X.tabs.deviation.key?null===(c=null==G?void 0:G.cognitive_decisioning)||void 0===c?void 0:c.decision_strength:L.relevance_score)&&void 0!==p?p:P)&&void 0!==g?g:0,ei=L.decisioning,ni=Array.isArray(ei)?ei:"string"==typeof ei&&ei.trim()?[ei]:[],ti=L.gap,si=Array.isArray(ti)?ti:"string"==typeof ti&&ti.trim()?[ti]:[],ai=q?q.left-150:-9999,ri=(null!==(u=null==q?void 0:q.arrowLeft)&&void 0!==u?u:60)+150,li=o.jsxs(n.Box,i.__assign({ref:W,sx:{position:"fixed",top:null!==(v=null==q?void 0:q.top)&&void 0!==v?v:-9999,left:ai,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(ai>0?ai:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat($.border),boxShadow:"0px 8px 32px ".concat($.shadow,", 0px 0px 0px 3px ").concat($.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==q?void 0:q.maxHeight)?"min(60vh, ".concat(q.maxHeight,"px)"):"60vh",visibility:q?"visible":"hidden"}},{children:[q&&(q.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:ri-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat($.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:ri-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:ri-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat($.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:ri-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,i.__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,i.__assign({sx:{flex:1,minWidth:0}},{children:[("no title"!==R||"no title"!==A)&&o.jsxs(n.Typography,i.__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,i.__assign({component:"span",title:R,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:R})),o.jsx(n.Box,i.__assign({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),o.jsx(n.Box,i.__assign({component:"span",title:A||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:A||"Reference Section"}))]})),o.jsx(n.Box,i.__assign({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"no title"!==R||"no title"!==A?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(h=Object.values(X.tabs).find(function(i){return i.key===V}))||void 0===h?void 0:h.subtitle}))}))]})),o.jsxs(n.Box,i.__assign({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o.jsxs(n.Box,i.__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(a.default,{}),X.decisionStrengthLabel," ",oi,"%"]})),o.jsx(n.IconButton,i.__assign({onClick:I,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:o.jsx(t.X,{size:22})}))]}))]})),o.jsx(n.Box,i.__assign({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:ii.map(function(e){var t=V===e.key,s=e.key===X.tabs.deviation.key,a=ii.length>1&&s&&Y&&null==G;return o.jsx(n.Box,i.__assign({onClick:function(){a||Z(e.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:a?"not-allowed":"pointer",opacity:a?.5:1,fontSize:"14px",fontWeight:t?600:400,color:t?X.accentColor:"#667085",backgroundColor:t?"".concat(X.accentColor,"14"):"transparent",borderBottom:t?"2px solid ".concat(X.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:e.label}),e.key)})})),o.jsx(n.Box,i.__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($.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:$.border},scrollbarWidth:"thin",scrollbarColor:"".concat($.border,"55 transparent")}},{children:V===X.tabs.deviation.key?G?o.jsxs(o.Fragment,{children:[(null===(f=(null===(b=null==G?void 0:G.cognitive_decisioning)||void 0===b?void 0:b.decisioning_factors)||[])||void 0===f?void 0:f.length)>0&&o.jsx(l.default,{title:"Decision Making Factors",content:null===(m=null===(_=null==G?void 0:G.cognitive_decisioning)||void 0===_?void 0:_.decisioning_factors)||void 0===m?void 0:m.join("\n\n"),citations:null===(y=null==G?void 0:G.cognitive_decisioning)||void 0===y?void 0:y.citations,styles:K,docData:H,open:T}),(null===(j=(null===(F=null==G?void 0:G.cognitive_decisioning)||void 0===F?void 0:F.gaps_in_decision)||[])||void 0===j?void 0:j.length)>0&&o.jsx(l.default,{title:"Gaps in Decision",content:null===(k=null===(w=null==G?void 0:G.cognitive_decisioning)||void 0===w?void 0:w.gaps_in_decision)||void 0===k?void 0:k.join("\n\n"),citations:null===(B=null==G?void 0:G.cognitive_decisioning)||void 0===B?void 0:B.citations,styles:K,docData:H,open:T}),0===(null===(C=(null===(S=null==G?void 0:G.cognitive_decisioning)||void 0===S?void 0:S.decisioning_factors)||[])||void 0===C?void 0:C.length)&&0===(null===(E=(null===(D=null==G?void 0:G.cognitive_decisioning)||void 0===D?void 0:D.gaps_in_decision)||[])||void 0===E?void 0:E.length)&&o.jsx(n.Box,i.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):o.jsx(l.default,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:K,docData:H,open:T}):o.jsxs(o.Fragment,{children:[ni.length>0&&o.jsx(l.default,{title:X.sectionTitles.decisioningFactors,content:ni.join("\n\n"),citations:L.citations,styles:K,open:T,docData:H}),si.length>0&&o.jsx(l.default,{title:X.sectionTitles.gaps,content:si.join("\n\n"),citations:L.citations,styles:K,open:T,docData:H}),0===ni.length&&0===si.length&&o.jsx(n.Box,i.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:X.emptyStateMessage}))}))]})}))]}));return d.default.createPortal(li,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"),t=require("react/jsx-runtime"),r=require("@mui/material");exports.default=function(i){var o=i.size,a=void 0===o?6:o,s=i.color,n=void 0===s?"text.secondary":s,c=i.gap,u=void 0===c?.5:c;return t.jsx(r.Box,e.__assign({sx:{display:"flex",gap:u,alignItems:"center"}},{children:[0,.16,.32].map(function(e,i){return t.jsx(r.Box,{sx:{width:a,height:a,bgcolor:n,borderRadius:"50%",animation:"threeDotsBounce 1.4s infinite ease-in-out both",animationDelay:"".concat(e,"s"),"@keyframes threeDotsBounce":{"0%, 80%, 100%":{transform:"scale(0)",opacity:.3},"40%":{transform:"scale(1)",opacity:1}}}},i)})}))};
|
|
2
|
+
//# sourceMappingURL=ThreeDotsLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreeDotsLoader.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|