@viswa-test/test-citation 0.0.113 → 0.0.114
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.
|
@@ -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"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),_=require("./hooks/useDeviationNavigation.js"),m=require("./components/CompareHeader.js"),R=require("./components/SectionAccordion.js"),y=require("./components/SubSectionAccordion.js"),S=require("./components/CognitiveSummaryPopup.js"),b=require("./components/connectedLines.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(A){var E,I,T,B,C,D,O,w,N,P,j,F,M,k,V,L,H,G,q,z,K,W,Y,U,X,$,J=A.componentHeaderText,Q=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Z=A.treeData,ee=A.comparisonConfig,ne=A.leftColumnTitleText,te=A.rightColumnTitleText,ie=A.markdownStyles,oe=A.resetTrigger,re=A.displayConfig,le=void 0===re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:re,ue=A.popupConfig,ce=A.deviationData,ae=void 0===ce?{}:ce,se=A.deviationNodeIdToView,de=A.resetDeviationNodeId,ve=A.isProposingFix,fe=void 0!==ve&&ve,ge=A.proposingFixNodeId,pe=t.useState(le.maintainRelativeOrder),he=pe[0],xe=pe[1],_e=!!he||!!(null==le?void 0:le.showDeviationBadges),me=t.useState(!1),Re=me[0],ye=me[1],Se=t.useState(!1),be=Se[0],Ae=Se[1],Ee=t.useState(null),Ie=Ee[0],Te=Ee[1],Be=t.useState(!1),Ce=Be[0],De=Be[1],Oe=t.useState(null===(I=null!==(E=null==Z?void 0:Z.newEvaluationResult)&&void 0!==E?E:null==le?void 0:le.enableDeviationSchemaBackwardCompatibility)||void 0===I||I)[0],we=t.useState(!1),Ne=we[0],Pe=we[1],je=t.useState(!1),Fe=je[0],Me=je[1],ke=t.useState(null),Ve=ke[0],Le=ke[1],He=t.useRef(!1),Ge=t.useState(new Set),qe=Ge[0],ze=Ge[1],Ke=t.useState([]),We=Ke[0],Ye=Ke[1],Ue=t.useRef(null),Xe=t.useRef(null),$e=t.useRef(new Set),Je=t.useRef(!1),Qe=t.useRef(null),Ze=t.useRef({}),en=t.useRef([]),nn=t.useRef(!1),tn=t.useRef(!1),on=t.useRef(null),rn=t.useRef(function(){}),ln=t.useMemo(function(){return(null==Z?void 0:Z.cognitive_decisioning)||{}},[Z]),un=t.useState({width:0,height:0}),cn=un[0],an=un[1],sn=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),ie)},[ie]),dn=t.useRef(null),vn=t.useRef(null),fn=t.useRef(null),gn=t.useRef(null),pn=t.useRef(null),hn=t.useRef(null),xn=t.useRef(null),_n=t.useRef(null),mn=t.useRef(!1),Rn=t.useRef(null),yn=t.useRef(null),Sn=p.useComparePopups(dn),bn=Sn.cognitivePopup,An=Sn.setCognitivePopup,En=Sn.moreFunctions,In=Sn.setMoreFunctions,Tn=Sn.position,Bn=Sn.setPosition,Cn=Sn.activeBadgeId,Dn=Sn.summaryPopup,On=Sn.setSummaryPopup,wn=Sn.closeSummaryPopup,Nn=Sn.setActiveBadgeId,Pn=Sn.popupRef,jn=Sn.closeCognitivePopup,Fn=Sn.closeMoreFunctionsPopup,Mn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ee?void 0:ee.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==ee?void 0:ee.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==ee?void 0:ee.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==ee?void 0:ee.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[ee]),kn=t.useState(null),Vn=kn[0];kn[1];var Ln=null===(C=null===(T=null==Z?void 0:Z.documents)||void 0===T?void 0:T[null===(B=null==Z?void 0:Z.input_index_map)||void 0===B?void 0:B[0]])||void 0===C?void 0:C.title,Hn=null===(w=null===(D=null==Z?void 0:Z.documents)||void 0===D?void 0:D[null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[1]])||void 0===w?void 0:w.title,Gn=u.safeStringify(ne||Ln||"Uploaded Contract"),qn=u.safeStringify(te||Hn||"Reference Template"),zn=g.useCognitiveTreeData(Z,he,ae,Mn,Oe),Kn=zn.activeProposed,Wn=zn.existingRule,Yn=zn.proposedSections,Un=zn.existingSections,Xn=zn.visibleFields,$n=zn.parentDeviationRecord,Jn=zn.deviationNumberRegistry,Qn=zn.parseError;t.useEffect(function(){Qn&&Te("Failed to load comparison: ".concat(Qn))},[Qn]);var Zn=Yn.length>0||Un.length>0,et=h.useSectionRefs(Xn.map(function(e){return e.key}),Math.max(Yn.length,Un.length)),nt=et.leftRefs,tt=et.rightRefs,it=et.sectionLeftRefs,ot=et.sectionRightRefs,rt=et.lhsBadgeRefs,lt=et.rhsBadgeRefs,ut=et.sectionRightRowRefs,ct=et.subSectionLeftRefs,at=et.subSectionRightRefs,st=et.sectionRowRefs,dt=et.getSectionRowRef,vt=et.getSubSectionRef,ft=et.getBadgeRef,gt=Wn.analysis,pt=u.safeStringify(null===(P=null===(N=null==gt?void 0:gt.rule_difference_comparison)||void 0===N?void 0:N.summary)||void 0===P?void 0:P.overall_summary),ht=!!pt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),xt=null!==(j=null==Z?void 0:Z.base_root_id)&&void 0!==j?j:"-1";null==Z||Z[xt];var _t=Oe?null!==(Y=null!==(z=ae&&(null===(q=null==ae?void 0:ae[xt])||void 0===q?void 0:q.evaluation_result))&&void 0!==z?z:null===(W=null===(K=null==Z?void 0:Z.nodes)||void 0===K?void 0:K[xt])||void 0===W?void 0:W.evaluation_result)&&void 0!==Y?Y:null:null!==(G=null!==(k=ae&&(null===(M=null===(F=null==ae?void 0:ae[xt])||void 0===F?void 0:F.evaluation_result)||void 0===M?void 0:M[0]))&&void 0!==k?k:null===(H=null===(L=null===(V=null==Z?void 0:Z.nodes)||void 0===V?void 0:V[xt])||void 0===L?void 0:L.evaluation_result)||void 0===H?void 0:H[0])&&void 0!==G?G:null,mt=u.extractDeviationScore(_t),Rt=u.generateColorPalette(null!==($=null===(X=null===(U=null==_t?void 0:_t.evaluation_outputs)||void 0===U?void 0:U.metadata)||void 0===X?void 0:X.label_color)&&void 0!==$?$:""),yt=function(){$e.current.forEach(function(e){u.resetClauseHighlight(e)}),$e.current.clear()},St=t.useCallback(function(){var e,n,t,i,o,r;yt(),De(!1),tn.current=!1;var l=on.current,c=Ht.current;if(null!==l)if("string"==typeof l&&l.includes(u.DEVIATION_BADGE_SEPARATOR)){var a=l.split(u.DEVIATION_BADGE_SEPARATOR);(s=(null===(e=ct.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=it.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=it.current[l])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(u.DEVIATION_BADGE_SEPARATOR)){a=c.split(u.DEVIATION_BADGE_SEPARATOR);(d=(null===(i=at.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=ot.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Le(null),on.current=null,Ht.current=null,Pe(!1),Ae(!1),gn.current&&(gn.current.style.height="0px"),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px")},[]),bt=t.useCallback(function(){yt(),St(),ze(new Set),Ye([]),en.current=[],Yt([]),$t(null),On(a.EMPTY_SUMMARY_POPUP_STATE),jn(),requestAnimationFrame(function(){var e;null===(e=rn.current)||void 0===e||e.call(rn)})},[]),At=t.useRef(bt);t.useEffect(function(){At.current=bt},[bt]),t.useEffect(function(){oe&&At.current()},[oe]);var Et=x.useAccordionState({maintainRelativeOrder:!!he,proposedSections:Yn,existingSections:Un,activeSideBySideSection:Ve,connectedSections:qe,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:en,svgContainerRef:Ue,isAnimatingRef:Je,animationTimerRef:Qe,calculateLinesRef:rn,sectionLeftRefs:it,sectionRightRefs:ot,subSectionLeftRefs:ct,subSectionRightRefs:at}),It=Et.expandedSections,Tt=Et.setExpandedSections,Bt=Et.expandedSubSections,Ct=Et.setExpandedSubSections,Dt=Et.toggleSection,Ot=t.useCallback(function(n,t,i,o,r,l,c){var a,s,d,v=u.safeStringify(null==t?void 0:t.id)||u.safeStringify(null==i?void 0:i.id)||"",f=(v?ln[v]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},g=null!==(s=null===(a=st.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==le?void 0:le.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:f,anchorEl:n,sectionAnchorEl:g,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Z?void 0:Z.documents,input_index_map:null==Z?void 0:Z.input_index_map},deviationData:function(){var n,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,c=function(n){var t=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var t=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(t&&n[t])return n[t]}var i=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(i.length&&e[i[0]])return e[i[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return t?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return c(l);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var s=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(n=null==s?void 0:s.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==s?void 0:s.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},s),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==s?void 0:s.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==s?void 0:s.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==s?void 0:s.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==s?void 0:s.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==s?void 0:s.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==s?void 0:s.cognitive_decisioning)}):c(l)}(),isOrphan:!!r}},[ln,Z]),wt=t.useCallback(function(e){Fn(),Bn(null),An(e)},[Fn]),Nt=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),En.open&&En.sectionIdx===o)Fn();else{var c=e.currentTarget,a="left";(null===(l=fn.current)||void 0===l?void 0:l.contains(c))&&(a="right");yt(),tn.current&&St(),ze(new Set),Ye([]),en.current=[],jn(),Dn.open?xi():wn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=o.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=lt.current[l])||void 0===e?void 0:e.current:null===(n=rt.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=lt.current[o])||void 0===t?void 0:t.current:null===(i=rt.current[o])||void 0===i?void 0:i.current}()||c;In(Ot(e,n,i,o,t,r))})}},Pt=t.useCallback(function(){null!==En.sectionIdx&&En.anchorEl?wt(e.__assign(e.__assign({},En),{open:!0})):Fn()},[En,Fn,wt]),jt=t.useCallback(function(){var e=En.sectionIdx,n=En.isOrphan;Fn(),wn(),null!==e&&(n?Te("No counterpart exists to connect to."):(yt(),tn.current&&St(),Ye([]),en.current=[],ze(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){rn.current&&rn.current()},50)))},[En.sectionIdx,En.isOrphan,Fn,wn,St]),Ft=t.useCallback(function(){var e=Xe.current;if(e){Xe.current=null;var n=Yn.findIndex(function(n){return n.id===e}),t=Un.findIndex(function(n){return n.id===e}),i=-1===n?u.findKeyPathByNodeId(Yn,e):null,o=-1===t?u.findKeyPathByNodeId(Un,e):null,r=-1!==n?n:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=function(e,n,t,i){var o,r,l,u;return-1!==e?null!==(r=null===(o=t.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=i.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,t){void 0===t&&(t=30);var i=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?($e.current.add(r),u.scrollAndHighlightClause(r,n)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(he)-1!==r&&_n.current&&a(function(){return c(n,i,it,ct)},_n.current),-1!==l&&fn.current&&a(function(){return c(t,o,ot,at)},fn.current);else{var s=dn.current;if(!s)return;a(function(){return-1!==r?c(n,i,it,ct):c(t,o,ot,at)},s)}}},[Yn,Un,he,it,ot,ct,at,_n,fn,dn]),Mt=t.useCallback(function(n){if(n){yt(),St(),ze(new Set),Ye([]),en.current=[],wn(),jn();var t=Yn.findIndex(function(e){return e.id===n}),i=Un.findIndex(function(e){return e.id===n}),o=-1===t?u.findKeyPathByNodeId(Yn,n):null,r=-1===i?u.findKeyPathByNodeId(Un,n):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=-1!==i?i:r?Number(r.split("-")[0]):-1;Xe.current=n,Tt(function(n){var t,i=e.__assign({},n),o=!1;-1!==l&&(i[t=he?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==c&&(i[t=he?"right-".concat(c):String(c)]||(i[t]=!0,o=!0));return o?i:n}),Ct(function(n){var t=e.__assign({},n),i=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:n}),setTimeout(function(){requestAnimationFrame(function(){Xe.current===n&&kt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Yn,Un,he,Tt,Ct,St,wn,jn]),kt=t.useRef(Ft);t.useEffect(function(){kt.current=Ft},[Ft]);var Vt=t.useRef(null),Lt=t.useRef(null),Ht=t.useRef(null),Gt=t.useRef(null),qt=t.useRef(null),zt=t.useRef(null),Kt=t.useState([]),Wt=Kt[0],Yt=Kt[1];t.useRef(null);var Ut=t.useState(null),Xt=Ut[0],$t=Ut[1];t.useEffect(function(){if(Vn){var e=Mn.fields.find(function(e){return e.analysisKey===Vn||e.key===Vn});if(e){var n=nt.current[e.key]||tt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Vn,Mn.fields]);var Jt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==gt?void 0:gt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[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===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[gt]),Qt=t.useCallback(function(n,t){var i,o,r;void 0===t&&(t="left");var l=null,c=null;if("left"===t)if(l=Yn[n],he&&l){var s=Un.filter(function(e){var n;return null===(n=l.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});c=s.find(function(e){return e.evaluationResult})||s[0]}else c=Un[n];else if(c=Un[n],he&&c){var d=Yn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)});l=d.find(function(e){return e.evaluationResult})||d[0]}else l=Yn[n];var v=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,f=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!v&&!f&&!g)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==c?void 0:c.evaluationResult)&&void 0!==o?o:null,h=u.getFirstDeviationOutputValue(p),x=u.getFirstDeviationColor(p);return null!=p?e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null!==(r=h)&&void 0!==r?r:""}):e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null})},[Yn,Un,ln,Mn,he]),Zt=t.useCallback(function(n){for(var t,i,o,r,l,c=n.split("-").map(Number),s=Yn[c[0]],d=Un[c[0]],v=1;v<c.length;v++)(null==s?void 0:s.subsections)&&(s=s.subsections[c[v]]),(null==d?void 0:d.subsections)&&(d=d.subsections[c[v]]);if(!s&&!d)return null;var f=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=u.safeStringify(null==s?void 0:s.id)||u.safeStringify(null==d?void 0:d.id)||"",h=!(!(null==s?void 0:s.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!f&&!g&&!h)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=ln[p])||void 0===o||o.relevance_score);var x=null!==(l=null!==(r=null==s?void 0:s.evaluationResult)&&void 0!==r?r:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,_=u.getFirstDeviationOutputValue(x),m=u.getFirstDeviationColor(x);return null!=x?e.__assign(e.__assign({},u.generateColorPalette(m)),{label:null!=_?_:""}):e.__assign(e.__assign({},u.generateColorPalette(m)),{label:null})},[Yn,Un,ln,Mn]),ei=t.useCallback(function(n,t){var i,o,r,l,c,s,d,v,f,g,p,h,x,_,m,R,y;if(!n||null==t)return null;var S=null!==(d=null!==(c=null!==(o=null===(i=null==ae?void 0:ae[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Z?void 0:Z.nodes)||void 0===r?void 0:r[n])||void 0===l?void 0:l.evaluation_result)&&void 0!==c?c:null===(s=null==Z?void 0:Z[n])||void 0===s?void 0:s.evaluation_result)&&void 0!==d?d:null;if(!S||"object"!=typeof S)return null;var b=null!==(p=null!==(f=null===(v=null==S?void 0:S.deviations)||void 0===v?void 0:v[t])&&void 0!==f?f:null===(g=null==S?void 0:S.deviation_entries)||void 0===g?void 0:g[t])&&void 0!==p?p:null==S?void 0:S[t],A=null!==(y=null!==(_=null===(x=null===(h=null==b?void 0:b.evaluation_outputs)||void 0===h?void 0:h.metadata)||void 0===x?void 0:x.label_color)&&void 0!==_?_:null===(R=null===(m=null==S?void 0:S.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===R?void 0:R.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR;return e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[ae,Z]),ni=t.useCallback(function(){yt(),Tt({}),Ct({}),St(),ze(new Set),Ye([]),en.current=[],wn(),jn(),Fn(),requestAnimationFrame(function(){rn.current&&rn.current()})},[Tt,Ct,St,wn,jn,Fn]),ti=t.useMemo(function(){return Object.values(It).some(Boolean)||Object.values(Bt).some(Boolean)},[It,Bt]),ii=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p,h,x,_,m,R,y,S,b;if(!mn.current&&!Je.current){mn.current=!0;try{if(!Vt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!It[t]&&!1===he)return!1;if(he&&!It["left-".concat(t)]&&!It["right-".concat(t)]&&!It[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Bt[i])return!1;return!0},E=Vt.current.getBoundingClientRect();an({width:E.width,height:E.height});var I=[];if(Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.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")}),!Je.current){for(var T=0;T<Math.max(Yn.length,Un.length);T++){var B=null===(e=it.current[T])||void 0===e?void 0:e.current,C=null===(n=ot.current[T])||void 0===n?void 0:n.current;B&&(B.style.height="auto",B.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}he||Object.keys(ct.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=at.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 D={};Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();D[i]=Math.max(l.height,u.height)}});var O={left:{},right:{}},w={};if(!Je.current)if(he){if(Ce&&null!==Ve)if("number"==typeof Ve){var N=Ve,P=Yn[N],j=null===(o=it.current[N])||void 0===o?void 0:o.current;j&&P&&(P.refIndexes||[]).forEach(function(e){var n,t=Un.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ot.current[t])||void 0===n?void 0:n.current;if(i&&(It["left-".concat(N)]||It["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);O.left[N]=Math.max(O.left[N]||0,o),O.right[t]=Math.max(O.right[t]||0,o)}})}else{var F=Ve.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(r=ct.current[F])||void 0===r?void 0:r.current,C=null===(l=at.current[F])||void 0===l?void 0:l.current;if(B&&C){M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,M)}}}}else{Object.keys(ct.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=at.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(),u=Math.max(r.height,l.height);w[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(T=0;T<Math.min(Yn.length,Un.length);T++){var B=null===(t=it.current[T])||void 0===t?void 0:t.current,C=null===(i=ot.current[T])||void 0===i?void 0:i.current;if(B&&C){var M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[T]=M,O.right[T]=M}}}if(Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=D[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Je.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=it.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ot.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),he||Object.keys(w).forEach(function(e){var n,t,i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=at.current[e])||void 0===t?void 0:t.current;if(i&&o&&w[e]){var r=w[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),he)Yn.forEach(function(e,n){var t;(null===(t=it.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,u,c,a,s,d,v=Un.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=rt.current[n])||void 0===t?void 0:t.current,g=null===(i=lt.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-E.left,_=h.left-E.left,m=p.top+p.height/2-E.top,R=h.top+h.height/2-E.top;if(Ce&&Ve===n){var y=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=fn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,b=y+(null!==(a=null===(c=_n.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=S+(null!==(d=null===(s=fn.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),T=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};m=C(T,y,b)-E.top,R=C(B,S,A)-E.top}var D=Qt(n);D&&I.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(T=0;T<Math.min(Yn.length,Un.length);T++){var k=null===(c=it.current[T])||void 0===c?void 0:c.current,V=null===(a=ot.current[T])||void 0===a?void 0:a.current;if(k&&V){var L=k.getBoundingClientRect(),H=V.getBoundingClientRect(),G=Math.max(L.top,H.top)+18-E.top,q=(null===(s=Un[T])||void 0===s?void 0:s.id)||"sec-".concat(T);(J=Qt(T))&&I.push({id:q,x1:L.right-E.left,y1:G,x2:H.left-E.left,y2:G,style:J,sectionIdx:T,hasCognitive:!!((null===(d=Yn[T])||void 0===d?void 0:d.cognitiveData)||(null===(v=Un[T])||void 0===v?void 0:v.cognitiveData)||q&&ln[q]),isSubSection:!1})}}Object.keys(ct.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=ct.current[e])||void 0===n?void 0:n.current,a=null===(t=at.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Yn[s[0]],v=Un[s[0]],f=1;f<s.length;f++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[f]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]);var g=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&u.hasValue(d.title)),p=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&u.hasValue(d.content)),h=!!v&&((null===(r=v.displayTitle)||void 0===r||r)&&u.hasValue(v.title)),x=!!v&&((null===(l=v.displayContent)||void 0===l||l)&&u.hasValue(v.content));if(g&&p||h&&x){var _=c.getBoundingClientRect(),m=a.getBoundingClientRect(),R=Math.max(_.top,m.top)+16-E.top,y=Zt(e);y&&"Not Defined"!==y.label&&I.push({id:"subsec-".concat(e),x1:_.right-E.left,y1:R,x2:m.left-E.left,y2:R,style:y,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(Ce&&"string"==typeof Ve&&Ve.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Ve.split(u.DEVIATION_BADGE_SEPARATOR),K=z[0],W=z[1],Y=z[2],U=(z[3],"".concat(K).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),X=null===(f=rt.current[U])||void 0===f?void 0:f.current,$=null===(g=lt.current[U])||void 0===g?void 0:g.current;if(X&&$){var J,Q=X.getBoundingClientRect(),Z=$.getBoundingClientRect(),ee=Q.right-E.left,ne=Z.left-E.left,te=Q.top+Q.height/2-E.top,ie=Z.top+Z.height/2-E.top;if(he){var oe=null!==(h=null===(p=_n.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(_=null===(x=fn.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==_?_:0,le=oe+(null!==(R=null===(m=_n.current)||void 0===m?void 0:m.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=fn.current)||void 0===y?void 0:y.clientHeight)&&void 0!==S?S:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,le)-E.top,ie=ce(Z.top+Z.height/2,re,ue)-E.top}(J=null!==(b=ei(K,W))&&void 0!==b?b:Zt(Y))&&I.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Ve})}}if(Yt(I),qt.current&&zt.current){var ae=qt.current.getBoundingClientRect(),se=zt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-E.top+se.top+se.height/2-E.top)/2;$t({x1:ae.right-E.left,x2:se.left-E.left,y:de})}else $t(null);if(qe.size>0){var ve=[],fe=_n.current,ge=fn.current;if(fe&&ge){var pe=[],xe=fe.getBoundingClientRect().top,_e=ge.getBoundingClientRect().top,me=xe+fe.clientHeight,Re=_e+ge.clientHeight,ye=fe.scrollTop,Se=ge.scrollTop,be=E.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};qe.forEach(function(e){var n,t,i,o,r,l;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var c=e.split(u.DEVIATION_BADGE_SEPARATOR),a=c[0],s=c[1],d=c[2],v=(c[3],"".concat(a).concat(u.DEVIATION_BADGE_SEPARATOR).concat(s)),f=null===(n=rt.current[v])||void 0===n?void 0:n.current,g=null===(t=lt.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=ei(a,s))&&void 0!==i?i:Zt(d),_=(j=p.right-E.left)+.5*((F=h.left-E.left-0)-j),m=p.top+p.height/2,R=h.top+h.height/2,y=m-xe+ye,S=R-_e+Se,b="conn-subsec-".concat(v);pe.push({lhsScrollY:y,rhsScrollY:S,x1:j,x2:F,containerTop:be,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:b});var A=Ae(m,xe,me),I=Ae(R,_e,Re),T=A-be,B=I-be,C=R>=_e-4&&R<=Re+4,D="";D=(M=m>=xe-4&&m<=me+4)&&C?u.getBentArrowPath(j,T,F,B):M&&!C?"M ".concat(j,",").concat(T," L ").concat(_,",").concat(T," L ").concat(_,",").concat(B):!M&&C?"M ".concat(_,",").concat(T," L ").concat(_,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(_,",").concat(T," L ").concat(_,",").concat(B),ve.push({id:b,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(he){var O=e,w=Yn[O];if(!(null===(l=null==w?void 0:w.refIndexes)||void 0===l?void 0:l.length))return;w.refIndexes.forEach(function(e){var n,t,i=Un.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=rt.current[O])||void 0===n?void 0:n.current,r=null===(t=lt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Qt(O),s=l.right-E.left,d=c.left-E.left-0,v=s+.5*(d-s),f=l.top+l.height/2,g=c.top+c.height/2,p=f-xe+ye,h=g-_e+Se,x="conn-".concat(O,"-").concat(i);pe.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:be,leftIdx:O,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var _=Ae(f,xe,me),m=Ae(g,_e,Re),R=_-be,y=m-be,S=f>=xe-4&&f<=me+4,b=g>=_e-4&&g<=Re+4,A="";A=S&&b?u.getBentArrowPath(s,R,d,y):S&&!b?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!S&&b?"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y),ve.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,P=N;f=null===(o=rt.current[N])||void 0===o?void 0:o.current,g=null===(r=lt.current[P])||void 0===r?void 0:r.current;if(!f||!g)return;var j,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=Qt(N),_=(j=p.right-E.left)+.5*((F=h.left-E.left-0)-j),m=p.top+p.height/2,R=h.top+h.height/2,y=m-xe+ye,S=R-_e+Se,b="conn-".concat(N,"-").concat(P);pe.push({lhsScrollY:y,rhsScrollY:S,x1:j,x2:F,containerTop:be,leftIdx:N,rhsArrayIdx:P,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:b});var M;A=Ae(m,xe,me),I=Ae(R,_e,Re),T=A-be,B=I-be,C=R>=_e-4&&R<=Re+4,D="";D=(M=m>=xe-4&&m<=me+4)&&C?u.getBentArrowPath(j,T,F,B):M&&!C?"M ".concat(j,",").concat(T," L ").concat(_,",").concat(T," L ").concat(_,",").concat(B):!M&&C?"M ".concat(_,",").concat(T," L ").concat(_,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(_,",").concat(T," L ").concat(_,",").concat(B),ve.push({id:b,pathD:D,style:x,leftIdx:N,rhsArrayIdx:P})}}),en.current=pe}Ye(ve)}else Ye([]),en.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{mn.current=!1}}},[Xn,Yn,Un,ln,Mn,Jt,Qt,ei,he,Ce,Ve,qe,It,Bt]),oi=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=en.current;if(p.length&&!Je.current){var h=null!==(n=null===(e=_n.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=fn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,_=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=fn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=_n.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=fn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+_,b=y+m,A=null!==(g=null===(f=Vt.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,E=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+R,t=e.rhsScrollY-x+y,i=Ze.current[e.styleId+"-stroke"],o=Ze.current[e.styleId+"-bg"];if(i||o){var r,l=E(n,R,S),c=E(t,y,b),a=l-A,s=c-A,d=n>=R-4&&n<=S+4,v=t>=y-4&&t<=b+4,f=e.x1+.5*(e.x2-e.x1);r=d&&v?u.getBentArrowPath(e.x1,a,e.x2,s):d&&!v?"M ".concat(e.x1,",").concat(a," L ").concat(f,",").concat(a," L ").concat(f,",").concat(s):!d&&v?"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);t.useEffect(function(){rn.current=ii},[ii]);var ri=t.useRef(null),li=t.useRef(null),ui=t.useCallback(function(){en.current.length>0&&!Je.current||(null!==ri.current&&clearTimeout(ri.current),ri.current=setTimeout(function(){rn.current(),ri.current=null},50))},[]),ci=t.useCallback(function(){Me(!0),Pe(!1),null!==li.current&&clearTimeout(li.current),null!==ri.current&&(clearTimeout(ri.current),ri.current=null),li.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s,d;try{if(en.current=[],tn.current&&null!==on.current&&null!==Ht.current){var v=on.current,f=Ht.current,g="string"==typeof v&&v.includes(u.DEVIATION_BADGE_SEPARATOR),p=null,h=null,x=null,_=null;if(g){var m=v.split(u.DEVIATION_BADGE_SEPARATOR),R="".concat(m[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(m[1]);p=(null===(e=rt.current[R])||void 0===e?void 0:e.current)||null,h=(null===(n=lt.current[R])||void 0===n?void 0:n.current)||null,x=(null===(t=ct.current[m[2]])||void 0===t?void 0:t.current)||(null===(i=it.current[Number(m[2])])||void 0===i?void 0:i.current)||null,_=(null===(o=at.current[m[3]])||void 0===o?void 0:o.current)||(null===(r=ot.current[Number(m[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=st.current[v])||void 0===l?void 0:l.current)||null,x=(null===(c=it.current[v])||void 0===c?void 0:c.current)||null,h=(null===(a=ut.current[f])||void 0===a?void 0:a.current)||null,_=(null===(s=ot.current[f])||void 0===s?void 0:s.current)||null;if(p&&h&&x&&_){if(x.style.paddingTop="0px",_.style.paddingTop="0px",!he){var y=p.getBoundingClientRect(),S=h.getBoundingClientRect(),b=y.top-S.top;b>0?_.style.paddingTop="".concat(b,"px"):b<0&&(x.style.paddingTop="".concat(Math.abs(b),"px"))}var A=_n.current,E=fn.current;if(A&&E){var I=p.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,T=h.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-(I-A.scrollTop);Math.abs(E.scrollTop-T)>1&&(E.scrollTop=T)}}}null===(d=rn.current)||void 0===d||d.call(rn),tn.current&&Pe(!0)}catch(e){console.error("Safely caught error during resize calculation:",e)}finally{Me(!1),li.current=null}},150)},[he,Yn,Un]),ai=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==Rn.current&&yn.current&&Math.abs(e.currentTarget.scrollTop-Rn.current)<=2){var v=yn.current;Rn.current=null,yn.current=null,v()}if(!He.current){if(he||ui(),tn.current){var f=on.current,g=Ht.current,p=_n.current,h=fn.current;if(null!==f&&null!==g&&p&&h){var x="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=rt.current["".concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===n?void 0:n.current:null===(t=st.current[f])||void 0===t?void 0:t.current,_="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=lt.current["".concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===i?void 0:i.current:null===(o=ut.current[g])||void 0===o?void 0:o.current;if(x&&_&&Gt.current){var m=void 0,R=void 0;if("string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)){var y=f.split(u.DEVIATION_BADGE_SEPARATOR),S="".concat(y[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(y[1]);m=null===(r=rt.current[S])||void 0===r?void 0:r.current,R=null===(l=lt.current[S])||void 0===l?void 0:l.current}else m=null===(c=rt.current[f])||void 0===c?void 0:c.current,R=null===(a=lt.current[g])||void 0===a?void 0:a.current;var b=null!==(d=null===(s=Vt.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==d?d:0,A=p.getBoundingClientRect().top,E=A+p.clientHeight;h.getBoundingClientRect().top;h.clientHeight;if(m&&R){var I=m.getBoundingClientRect(),T=R.getBoundingClientRect(),B=I.top+I.height/2;T.top,T.height;var C=((O=B,w=A,N=E,Math.max(w,Math.min(N,O)))-b).toString();Gt.current.setAttribute("y1",C),Gt.current.setAttribute("y2",C);var D=B>=A-4&&B<=E+4;Gt.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,N;en.current.length>0&&!nn.current&&(nn.current=!0,requestAnimationFrame(function(){oi(),nn.current=!1}))}},[oi,he,ui]),si=t.useRef(0),di=t.useRef(0),vi=t.useRef(0),fi=t.useRef(function(){});t.useRef(null),t.useEffect(function(){fi.current=ci},[ci]),t.useEffect(function(){var e=setTimeout(ui,250),n=function(){return fi.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==ri.current&&clearTimeout(ri.current),null!==li.current&&clearTimeout(li.current),window.removeEventListener("resize",n)}},[Kn,Wn,gt,Xn,It,Bt,Yn,Un,Mn,ui,Ce,Ve,Ne,qe]),t.useEffect(function(){var e=function(e,n,t,i,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,i())}})});return r.observe(e),r},n={current:null},t={current:null},i={current:null},o=[],r=[n,t,i];return vn.current&&o.push(e(vn.current,si,n,function(){return fi.current()},function(){})),dn.current&&o.push(e(dn.current,di,t,function(){return fi.current()},function(){return rn.current()})),Vt.current&&o.push(e(Vt.current,vi,i,function(){return fi.current()},function(){return rn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),t.useEffect(function(){tn.current=Ce},[Ce]),t.useEffect(function(){on.current=Ve},[Ve]);var gi=t.useCallback(function(e,n,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";Fn(),null!=e&&(n?Te("No counterpart exists for this section."):(yt(),Ce&&Ve===e?r?St():null==l||l():(ze(new Set([e])),Ye([]),en.current=[],Ae(!0),He.current=!0,Le(e),on.current=e,De(!0),tn.current=!0,Pe(!1),gn.current&&(gn.current.style.height="0px"),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var f=e.split(u.DEVIATION_BADGE_SEPARATOR),g="".concat(f[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f[1]);s=(null===(n=rt.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=lt.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=st.current[e])||void 0===i?void 0:i.current)||null,he){var p=Yn[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],_=Un.findIndex(function(e){return e.selfIndex===x});-1!==_&&(d=(null===(r=ut.current[_])||void 0===r?void 0:r.current)||null,v=_)}}else d=(null===(o=ut.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;Ht.current=v;var m=_n.current,R=fn.current,y=function(){!function(){var n,t,i,o,r,l,c,s,d,f,g,p,h=null,x=null,_=null,m=null;if(a){var R=e.split(u.DEVIATION_BADGE_SEPARATOR),y="".concat(R[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(R[1]);h=(null===(n=ct.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=it.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=at.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(R[3])])||void 0===o?void 0:o.current)||null,_=(null===(r=rt.current[y])||void 0===r?void 0:r.current)||h,m=(null===(l=lt.current[y])||void 0===l?void 0:l.current)||x}else{var S=Number(e),b=null!==v?Number(v):S;h=(null===(c=it.current[S])||void 0===c?void 0:c.current)||null,x=(null===(s=ot.current[b])||void 0===s?void 0:s.current)||null,_=(null===(d=rt.current[S])||void 0===d?void 0:d.current)||(null===(f=st.current[S])||void 0===f?void 0:f.current)||h,m=(null===(g=lt.current[b])||void 0===g?void 0:g.current)||(null===(p=ut.current[b])||void 0===p?void 0:p.current)||x}if(_&&m&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var A=_.getBoundingClientRect(),E=m.getBoundingClientRect(),I=A.top-E.top;I>0?x.style.paddingTop="".concat(I,"px"):I<0&&(h.style.paddingTop="".concat(Math.abs(I),"px"))}}(),Pe(!0),rn.current&&rn.current(),He.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Ae(!1),null==l||l()};if(!s||!m)return He.current=!1,Ae(!1),void(null==l||l());if(d&&R){if(!he){var S=0;S="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var b=dn.current,A=(null==b?void 0:b.getBoundingClientRect().top)||0,E=b?b.scrollTop+S-A-150:0;return b?void u.smoothScrollTo(b,E,200,y):void y()}var I=s.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,T=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=T-(I-m.scrollTop);C<0&&gn.current&&(gn.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=R.scrollHeight-R.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return pn.current&&(pn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(R,C,B,y)})}e=C}u.smoothScrollTo(R,e,B,y)})}else{var D=I-(T-R.scrollTop);D<0&&hn.current&&(hn.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return xn.current&&(xn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(m,D,B,y)})}e=D}u.smoothScrollTo(m,e,B,y)})}}else y()}))))},[Ve,Fn,Un,Ce,he,Yn,St]),pi=t.useCallback(function(e,n,t,i){var o,r="string"==typeof i?u.safeStringify(i).trim():u.safeStringify(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;jn();var c="left";(null===(o=fn.current)||void 0===o?void 0:o.contains(l))&&(c="right");var a=function(){var e,t,i,o;if("string"==typeof n&&n.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=n.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===c?null===(e=lt.current[l])||void 0===e?void 0:e.current:null===(t=rt.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=lt.current[n])||void 0===i?void 0:i.current:null===(o=rt.current[n])||void 0===o?void 0:o.current};if(t)return St(),ze(new Set),Ye([]),en.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;On({open:!0,anchorEl:e,summary:i})}));gi(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;On({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[gi,jn,On,St]),hi=t.useCallback(function(){var e,n=En.sectionIdx,t=En.isOrphan;if(wn(),null!=n){var i="left";En.anchorEl&&(null===(e=fn.current)||void 0===e?void 0:e.contains(En.anchorEl))&&(i="right"),gi(n,t,{sourceSide:i})}},[gi,En.isOrphan,En.sectionIdx,En.anchorEl,wn]),xi=t.useCallback(function(){wn(),St(),ze(new Set),Ye([]),en.current=[]},[wn,St]),_i=null!==En.sectionIdx&&qe.has(En.sectionIdx),mi=_.useDeviationNavigation({proposedSections:Yn,existingSections:Un,parentDeviationRecord:$n,expandedSections:It,maintainRelativeOrder:!!he,scrollContainerRef:dn,leftContainerRef:_n,lhsBadgeRefs:rt,rhsBadgeRefs:lt}),Ri=mi.showDeviationNavigation,yi=mi.showOpenNodeRef,Si=t.useMemo(function(){var e;if(!se)return null;var n=null===(e=null==se?void 0:se.id)||void 0===e?void 0:e.split(":")[0];for(var t in $n){if(($n[t]||[]).some(function(e){return e.id===n}))return t}return null},[se,$n]),bi=t.useRef({id:null,triggerMs:null}),Ai=t.useRef(null);t.useEffect(function(){var n;if(null==se?void 0:se.id){var t=Number(se.trigger),i=bi.current;if((null==i?void 0:i.triggerMs)!==t){if(!(se.id.includes(":")&&/:\d+$/.test(se.id)))return bi.current={id:se.id,triggerMs:t},void Mt(se.id);var o=null===(n=null==se?void 0:se.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],c=null!=l?l:"0";Ai.current!==se.id&&(wn(),jn(),St(),ze(new Set),Ye([]),en.current=[],Ai.current=se.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},g=function(){var n,i,o,l;if(!a){var p=function(){bi.current={id:se.id,triggerMs:t}},h=null,x=null;for(var _ in $n){var m=$n[_].find(function(e){return e.id===r});if(m){h=_,x=m;break}}if(x&&h){var R=Yn.findIndex(function(e){return e.id===h}),y=Un.findIndex(function(e){return e.id===h}),S=-1===R&&-1!==y,b=f(Yn,x.id),A=f(Un,x.id);if(b&&!A&&!S){var E=b.split("-"),I=Number(E[0]);if(he){var T=null===(i=null===(n=Yn[I])||void 0===n?void 0:n.refIndexes)||void 0===i?void 0:i[0],B=Un.findIndex(function(e){return e.selfIndex===T});-1!==B&&(I=B)}A=e.__spreadArray([I],E.slice(1),!0).join("-")}if(b||A){var C=S||!b&&!!A,D=b?Number(b.split("-")[0]):R,O=A?Number(A.split("-")[0]):y;if(C){if(!(he?!!It["right-".concat(O)]:!!It[String(O)])&&O>=0)return Dt(O,"right"),s+=1,void(d=setTimeout(g,450))}else if(!(he?!!It["left-".concat(D)]:!!It[String(D)])&&D>=0)return Dt(D,"left"),s+=1,void(d=setTimeout(g,450));var w,N=b||"",P=A||"",j="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(N).concat(u.DEVIATION_BADGE_SEPARATOR).concat(P),F="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c),M=null===(o=rt.current[F])||void 0===o?void 0:o.current,k=null===(l=lt.current[F])||void 0===l?void 0:l.current,V=C||!M&&!!k,L=V?k:M;if(w=he?V?fn.current:_n.current:dn.current,L&&w){var H=L.getBoundingClientRect();if(0===H.height)return void((s+=1)<2?d=setTimeout(g,v):p());var G=w.getBoundingClientRect(),q=H.top-G.top+w.scrollTop-G.height/2+H.height/2+150,z=function(){var n,t,i,o,r;if(!a){p();var l=window.getComputedStyle(L).color;M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(l)),k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){M&&(M.style.boxShadow=""),k&&(k.style.boxShadow="")},2e3);var u=(null===(t=null===(n=x.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[c])||x,s=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!M&&!!k)){var d=V?(null===(o=lt.current[F])||void 0===o?void 0:o.current)||k:(null===(r=rt.current[F])||void 0===r?void 0:r.current)||M;return On({open:!0,anchorEl:d,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})}),void(null==de||de())}gi(j,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t=(null===(n=rt.current[F])||void 0===n?void 0:n.current)||M;console.log("Summary data",s,u),On({open:!0,anchorEl:t,summary:e.__assign({},u)})}})}};Math.abs(w.scrollTop-q)<=2?z():(Rn.current=q,yn.current=z,w.scrollTo({top:q,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(yn.current){Rn.current=null;var e=yn.current;yn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}};return d=setTimeout(g,v),function(){a=!0,d&&clearTimeout(d)}}}},[se,$n,Yn,Un,he,It,Dt,gi,On,Mt]);var Ei=function(e){var t=e.section,i=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c;return n.jsx(y.default,{section:t,keyPath:i,depth:r,columnKey:u,parentNodeId:a,expandedSubSections:Bt,setExpandedSubSections:Ct,maintainRelativeOrder:he||!1,proposedSections:Yn,existingSections:Un,treeData:Z,deviationNumberRegistry:Jn,connectedSections:qe,activeSideBySideSection:Ve,resolvedMarkdownStyles:sn,getSubSectionRef:vt,getSubSectionCompareStyle:Zt,getBadgeRef:ft,openMoreFunctionsPopup:Nt,openSummaryPopup:pi,showDeviationBadges:_e,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:en,isProposingFix:fe,proposingFixNodeId:ge})};return n.jsxs(i.Box,e.__assign({ref:vn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},he?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&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,{})})),Dn.open&&n.jsx(S.default,{open:Dn.open,anchorEl:Dn.anchorEl,containerEl:Lt.current,clipTopEl:qt.current,scrollContainerEl:dn.current,onClose:xi,summary:Dn.summary}),n.jsx(d.default,{open:En.open,anchorEl:En.anchorEl,sectionTitle:En.sectionTitle,referenceSectionTitle:En.refSectionTitle,onClose:Fn,onOpenCognitiveCompare:Pt,onOpenSideBySide:hi,onConnect:jt,isConnected:_i,isOrphan:En.isOrphan}),bn.open&&n.jsx(s.default,{open:bn.open,popupRef:Pn,position:Tn,popupConfig:ue,onClose:function(){Bn(null),An(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Nn(null)},markdownStyles:ie,sectionTitle:bn.sectionTitle,referenceSectionTitle:bn.refSectionTitle,cognitiveData:bn.cognitiveData,anchorEl:bn.anchorEl,sectionAnchorEl:bn.sectionAnchorEl,scrollContainerEl:dn.current,badgeStyle:bn.badgeStyle,docData:bn.docData,deviationData:bn.deviationData,isLoading:bn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Ie,autoHideDuration:8e3,onClose:function(){return Te(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Te(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ie}))})),n.jsx(m.default,{componentHeaderText:Q,displayConfig:le,maintainRelativeOrder:he,onCollapseAll:ni,showCollapseAll:ti,onToggleView:function(e){ye(!0),setTimeout(function(){xe(!e),St(),wn(),ze(new Set),Ye([]),en.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ye(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:dn,onScroll:ai,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:he?"hidden":"auto",borderTop:pt&&ht?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},he?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Vt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ue,style:{position:"absolute",top:0,left:0,width:cn.width||"100%",height:cn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Fe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Xt&&n.jsx("g",{children:n.jsx("line",{x1:Xt.x1,y1:Xt.y,x2:Xt.x2,y2:Xt.y,stroke:Rt.badgeBorder,strokeWidth:"1.5"})}),Wt.map(function(t){var l,c,s,d,v,g,p=t.x1+.5*(t.x2-t.x1),h=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?Ce&&Ve===t.subSectionKeyPath&&Ne:Ce&&Ve===t.sectionIdx&&Ne)return null;if(!he){var x=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),_=Yn[t.sectionIdx]||{title:"",content:""},m=Un[t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",_,m),t.isSubSection&&t.subSectionKeyPath){var R=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],y=R[2]||t.subSectionKeyPath,S=R[3]||y,b=y.split("-").map(Number),A=S.split("-").map(Number),E=null,I=null;b.length>0&&(E=Yn[b[0]]),A.length>0&&(I=Un[A[0]]);var T=(null==E?void 0:E.title)||"",B=(null==I?void 0:I.title)||"";console.log("Root Parent Titles:",T,B);for(var C=1;C<b.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[b[C]]);for(C=1;C<A.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[A[C]]);E&&(_=e.__assign(e.__assign({},E),{title:T||E.title})),console.log("Base Section for Subsection Badge:",_),I&&(m=e.__assign(e.__assign({},I),{title:B||I.title})),console.log("Ref Section for Subsection Badge:",m)}var D=!(null===(l=_.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(s=null===(c=_.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===s?void 0:s.length),O=(null===(g=null===(v=null===(d=_.evaluationResult)||void 0===d?void 0:d.cognitive_decisioning)||void 0===v?void 0:v.decisioning_factors)||void 0===g?void 0:g.length)||!1,w=D||O;return n.jsxs("g",{children:[n.jsx("path",{d:x,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:p-100,y:h-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),w&&(bn.open&&Cn===t.id?jn():(Nn(t.id),wt(Ot(e.currentTarget,_,m,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:w?"pointer":"default"}},{children:[t.style.badgeText===a.DEFAULT_DEVIAION_COLOR&&null==t.style.label?n.jsx(f.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(r.ButtonCognitiveIcon,{})})),w&&n.jsx(o.ChevronDown,{size:11,style:{transform:bn.open&&Cn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),n.jsx(b.default,{connectedLines:We,pathRefs:Ze})]})),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)"},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:qt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{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",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Gn}))}))})),n.jsxs(i.Box,e.__assign({ref:_n,onScroll:ai,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{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:hn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Yn.map(function(t,r){var l,c,a=!t.title&&!t.content;if(he&&a)return null;var s=t,d=Qt(r,"left"),v=he?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Un[r],g=he?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=qe.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:dt(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:it.current[r],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:r,columnKey:"left",colRef:dt("left-accordion-".concat(r)),mb:0,treeData:Z,proposedSections:Yn,existingSections:Un,deviationNumberRegistry:Jn,getSectionCompareStyle:Qt,getBadgeRef:ft,connectedSections:qe,openMoreFunctionsPopup:Nt,openSummaryPopup:pi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,parentNodeId:(null===(c=null==Z?void 0:Z.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:he?!!It["left-".concat(r)]:!!It[String(r)],onToggle:function(){xi(),Dt(r,"left")},navigation:t.id?Ri[t.id]:null,showOpenNodeRef:yi,resolvedMarkdownStyles:sn,maintainRelativeOrder:he,showDeviationBadges:_e,renderSubSections:Ei,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Ve?Ve:""))})})),he&&d&&n.jsxs(i.Box,e.__assign({ref:rt.current[r],onClick:function(e){var n=he?Un.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Un[r]||{title:"",content:""};Nt(e,t,v,n,r,d)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.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:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=le.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;console.log("LOG: Printing evaluationResult",o,s),pi(e,String(r),v,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:v?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":v?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=g&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:g})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!le.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(f.default,{color:d.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=he?Un.find(function(e){var n;return(null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e))||{title:"",content:""}}):Un[r]||{title:"",content:""};Nt(e,t,v,n,r,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:xn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:Lt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({onClick:function(n){n.stopPropagation(),bn.open&&Cn===xt?jn():(Nn(xt),wt(Ot(n.currentTarget,{title:"",content:"",evaluationResult:_t,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,xt,!0,e.__assign(e.__assign({},Rt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Rt.badgeBg,color:Rt.badgeText,border:"1px solid ".concat(Rt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=mt?mt:n.jsx(f.default,{}),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:bn.open&&Cn===xt?"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},he?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[be&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:zt,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:qn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:qn}))}))})),n.jsxs(i.Box,e.__assign({ref:fn,onScroll:ai,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:gn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Un.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(he){u=Yn.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}),s=Yn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=Yn.findIndex(function(e,n){var t;return qe.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Qt(d))}else u=[o+1],(c=qe.has(o))&&(a=Qt(o));var v=Qt(he&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:ut.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:ot.current[o],sx:e.__assign({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:o,columnKey:"right",colRef:dt("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Z?void 0:Z.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:he?!!It["right-".concat(o)]:!!It[String(o)],treeData:Z,proposedSections:Yn,existingSections:Un,deviationNumberRegistry:Jn,getBadgeRef:ft,getSectionCompareStyle:Qt,connectedSections:qe,openMoreFunctionsPopup:Nt,openSummaryPopup:pi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,onToggle:function(){xi(),Dt(o,"right")},navigation:t.id?Ri[t.id]:null,showOpenNodeRef:yi,resolvedMarkdownStyles:sn,maintainRelativeOrder:he,showDeviationBadges:_e,renderSubSections:Ei,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Ve?Ve:""))})})),he&&v&&n.jsx(i.Box,e.__assign({ref:lt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:v.badgeBg,color:v.badgeText,border:"1px solid ".concat(v.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),_=require("./hooks/useDeviationNavigation.js"),m=require("./components/CompareHeader.js"),R=require("./components/SectionAccordion.js"),y=require("./components/SubSectionAccordion.js"),S=require("./components/CognitiveSummaryPopup.js"),b=require("./components/connectedLines.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(A){var E,I,T,B,C,D,O,w,N,P,j,F,M,k,V,L,H,G,q,z,K,W,Y,U,X,$,J=A.componentHeaderText,Q=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Z=A.treeData,ee=A.comparisonConfig,ne=A.leftColumnTitleText,te=A.rightColumnTitleText,ie=A.markdownStyles,oe=A.resetTrigger,re=A.displayConfig,le=void 0===re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:re,ue=A.popupConfig,ce=A.deviationData,ae=void 0===ce?{}:ce,se=A.deviationNodeIdToView,de=A.resetDeviationNodeId,ve=A.isProposingFix,fe=void 0!==ve&&ve,ge=A.proposingFixNodeId,pe=t.useState(le.maintainRelativeOrder),he=pe[0],xe=pe[1],_e=!!he||!!(null==le?void 0:le.showDeviationBadges),me=t.useState(!1),Re=me[0],ye=me[1],Se=t.useState(!1),be=Se[0],Ae=Se[1],Ee=t.useState(null),Ie=Ee[0],Te=Ee[1],Be=t.useState(!1),Ce=Be[0],De=Be[1],Oe=t.useState(null===(I=null!==(E=null==Z?void 0:Z.newEvaluationResult)&&void 0!==E?E:null==le?void 0:le.enableDeviationSchemaBackwardCompatibility)||void 0===I||I)[0],we=t.useState(!1),Ne=we[0],Pe=we[1],je=t.useState(!1),Fe=je[0],Me=je[1],ke=t.useState(null),Ve=ke[0],Le=ke[1],He=t.useRef(!1),Ge=t.useState(new Set),qe=Ge[0],ze=Ge[1],Ke=t.useState([]),We=Ke[0],Ye=Ke[1],Ue=t.useRef(null),Xe=t.useRef(null),$e=t.useRef(new Set),Je=t.useRef(!1),Qe=t.useRef(null),Ze=t.useRef({}),en=t.useRef([]),nn=t.useRef(!1),tn=t.useRef(!1),on=t.useRef(null),rn=t.useRef(function(){}),ln=t.useMemo(function(){return(null==Z?void 0:Z.cognitive_decisioning)||{}},[Z]),un=t.useState({width:0,height:0}),cn=un[0],an=un[1],sn=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),ie)},[ie]),dn=t.useRef(null),vn=t.useRef(null),fn=t.useRef(null),gn=t.useRef(null),pn=t.useRef(null),hn=t.useRef(null),xn=t.useRef(null),_n=t.useRef(null),mn=t.useRef(!1),Rn=t.useRef(null),yn=t.useRef(null),Sn=p.useComparePopups(dn),bn=Sn.cognitivePopup,An=Sn.setCognitivePopup,En=Sn.moreFunctions,In=Sn.setMoreFunctions,Tn=Sn.position,Bn=Sn.setPosition,Cn=Sn.activeBadgeId,Dn=Sn.summaryPopup,On=Sn.setSummaryPopup,wn=Sn.closeSummaryPopup,Nn=Sn.setActiveBadgeId,Pn=Sn.popupRef,jn=Sn.closeCognitivePopup,Fn=Sn.closeMoreFunctionsPopup,Mn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ee?void 0:ee.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==ee?void 0:ee.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==ee?void 0:ee.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==ee?void 0:ee.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[ee]),kn=t.useState(null),Vn=kn[0];kn[1];var Ln=null===(C=null===(T=null==Z?void 0:Z.documents)||void 0===T?void 0:T[null===(B=null==Z?void 0:Z.input_index_map)||void 0===B?void 0:B[0]])||void 0===C?void 0:C.title,Hn=null===(w=null===(D=null==Z?void 0:Z.documents)||void 0===D?void 0:D[null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[1]])||void 0===w?void 0:w.title,Gn=u.safeStringify(ne||Ln||"Uploaded Contract"),qn=u.safeStringify(te||Hn||"Reference Template"),zn=g.useCognitiveTreeData(Z,he,ae,Mn,Oe),Kn=zn.activeProposed,Wn=zn.existingRule,Yn=zn.proposedSections,Un=zn.existingSections,Xn=zn.visibleFields,$n=zn.parentDeviationRecord,Jn=zn.deviationNumberRegistry,Qn=zn.parseError;t.useEffect(function(){Qn&&Te("Failed to load comparison: ".concat(Qn))},[Qn]);var Zn=Yn.length>0||Un.length>0,et=h.useSectionRefs(Xn.map(function(e){return e.key}),Math.max(Yn.length,Un.length)),nt=et.leftRefs,tt=et.rightRefs,it=et.sectionLeftRefs,ot=et.sectionRightRefs,rt=et.lhsBadgeRefs,lt=et.rhsBadgeRefs,ut=et.sectionRightRowRefs,ct=et.subSectionLeftRefs,at=et.subSectionRightRefs,st=et.sectionRowRefs,dt=et.getSectionRowRef,vt=et.getSubSectionRef,ft=et.getBadgeRef,gt=Wn.analysis,pt=u.safeStringify(null===(P=null===(N=null==gt?void 0:gt.rule_difference_comparison)||void 0===N?void 0:N.summary)||void 0===P?void 0:P.overall_summary),ht=!!pt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),xt=null!==(j=null==Z?void 0:Z.base_root_id)&&void 0!==j?j:"-1";null==Z||Z[xt];var _t=Oe?null!==(Y=null!==(z=ae&&(null===(q=null==ae?void 0:ae[xt])||void 0===q?void 0:q.evaluation_result))&&void 0!==z?z:null===(W=null===(K=null==Z?void 0:Z.nodes)||void 0===K?void 0:K[xt])||void 0===W?void 0:W.evaluation_result)&&void 0!==Y?Y:null:null!==(G=null!==(k=ae&&(null===(M=null===(F=null==ae?void 0:ae[xt])||void 0===F?void 0:F.evaluation_result)||void 0===M?void 0:M[0]))&&void 0!==k?k:null===(H=null===(L=null===(V=null==Z?void 0:Z.nodes)||void 0===V?void 0:V[xt])||void 0===L?void 0:L.evaluation_result)||void 0===H?void 0:H[0])&&void 0!==G?G:null,mt=u.extractDeviationScore(_t),Rt=u.generateColorPalette(null!==($=null===(X=null===(U=null==_t?void 0:_t.evaluation_outputs)||void 0===U?void 0:U.metadata)||void 0===X?void 0:X.label_color)&&void 0!==$?$:""),yt=function(){$e.current.forEach(function(e){u.resetClauseHighlight(e)}),$e.current.clear()},St=t.useCallback(function(){var e,n,t,i,o,r;yt(),De(!1),tn.current=!1;var l=on.current,c=Ht.current;if(null!==l)if("string"==typeof l&&l.includes(u.DEVIATION_BADGE_SEPARATOR)){var a=l.split(u.DEVIATION_BADGE_SEPARATOR);(s=(null===(e=ct.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=it.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=it.current[l])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(u.DEVIATION_BADGE_SEPARATOR)){a=c.split(u.DEVIATION_BADGE_SEPARATOR);(d=(null===(i=at.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=ot.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Le(null),on.current=null,Ht.current=null,Pe(!1),Ae(!1),gn.current&&(gn.current.style.height="0px"),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px")},[]),bt=t.useCallback(function(){yt(),St(),ze(new Set),Ye([]),en.current=[],Yt([]),$t(null),On(a.EMPTY_SUMMARY_POPUP_STATE),jn(),requestAnimationFrame(function(){var e;null===(e=rn.current)||void 0===e||e.call(rn)})},[]),At=t.useRef(bt);t.useEffect(function(){At.current=bt},[bt]),t.useEffect(function(){oe&&At.current()},[oe]);var Et=x.useAccordionState({maintainRelativeOrder:!!he,proposedSections:Yn,existingSections:Un,activeSideBySideSection:Ve,connectedSections:qe,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:en,svgContainerRef:Ue,isAnimatingRef:Je,animationTimerRef:Qe,calculateLinesRef:rn,sectionLeftRefs:it,sectionRightRefs:ot,subSectionLeftRefs:ct,subSectionRightRefs:at}),It=Et.expandedSections,Tt=Et.setExpandedSections,Bt=Et.expandedSubSections,Ct=Et.setExpandedSubSections,Dt=Et.toggleSection,Ot=t.useCallback(function(n,t,i,o,r,l,c){var a,s,d,v=u.safeStringify(null==t?void 0:t.id)||u.safeStringify(null==i?void 0:i.id)||"",f=(v?ln[v]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},g=null!==(s=null===(a=st.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==le?void 0:le.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:f,anchorEl:n,sectionAnchorEl:g,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Z?void 0:Z.documents,input_index_map:null==Z?void 0:Z.input_index_map},deviationData:function(){var n,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,c=function(n){var t=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var t=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(t&&n[t])return n[t]}var i=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(i.length&&e[i[0]])return e[i[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return t?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return c(l);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var s=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(n=null==s?void 0:s.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==s?void 0:s.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},s),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==s?void 0:s.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==s?void 0:s.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==s?void 0:s.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==s?void 0:s.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==s?void 0:s.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==s?void 0:s.cognitive_decisioning)}):c(l)}(),isOrphan:!!r}},[ln,Z]),wt=t.useCallback(function(e){Fn(),Bn(null),An(e)},[Fn]),Nt=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),En.open&&En.sectionIdx===o)Fn();else{var c=e.currentTarget,a="left";(null===(l=fn.current)||void 0===l?void 0:l.contains(c))&&(a="right");yt(),tn.current&&St(),ze(new Set),Ye([]),en.current=[],jn(),Dn.open?xi():wn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=o.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=lt.current[l])||void 0===e?void 0:e.current:null===(n=rt.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=lt.current[o])||void 0===t?void 0:t.current:null===(i=rt.current[o])||void 0===i?void 0:i.current}()||c;In(Ot(e,n,i,o,t,r))})}},Pt=t.useCallback(function(){null!==En.sectionIdx&&En.anchorEl?wt(e.__assign(e.__assign({},En),{open:!0})):Fn()},[En,Fn,wt]),jt=t.useCallback(function(){var e=En.sectionIdx,n=En.isOrphan;Fn(),wn(),null!==e&&(n?Te("No counterpart exists to connect to."):(yt(),tn.current&&St(),Ye([]),en.current=[],ze(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){rn.current&&rn.current()},50)))},[En.sectionIdx,En.isOrphan,Fn,wn,St]),Ft=t.useCallback(function(){var e=Xe.current;if(e){Xe.current=null;var n=Yn.findIndex(function(n){return n.id===e}),t=Un.findIndex(function(n){return n.id===e}),i=-1===n?u.findKeyPathByNodeId(Yn,e):null,o=-1===t?u.findKeyPathByNodeId(Un,e):null,r=-1!==n?n:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=function(e,n,t,i){var o,r,l,u;return-1!==e?null!==(r=null===(o=t.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=i.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,t){void 0===t&&(t=30);var i=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?($e.current.add(r),u.scrollAndHighlightClause(r,n)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(he)-1!==r&&_n.current&&a(function(){return c(n,i,it,ct)},_n.current),-1!==l&&fn.current&&a(function(){return c(t,o,ot,at)},fn.current);else{var s=dn.current;if(!s)return;a(function(){return-1!==r?c(n,i,it,ct):c(t,o,ot,at)},s)}}},[Yn,Un,he,it,ot,ct,at,_n,fn,dn]),Mt=t.useCallback(function(n){if(n){yt(),St(),ze(new Set),Ye([]),en.current=[],wn(),jn();var t=Yn.findIndex(function(e){return e.id===n}),i=Un.findIndex(function(e){return e.id===n}),o=-1===t?u.findKeyPathByNodeId(Yn,n):null,r=-1===i?u.findKeyPathByNodeId(Un,n):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=-1!==i?i:r?Number(r.split("-")[0]):-1;Xe.current=n,Tt(function(n){var t,i=e.__assign({},n),o=!1;-1!==l&&(i[t=he?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==c&&(i[t=he?"right-".concat(c):String(c)]||(i[t]=!0,o=!0));return o?i:n}),Ct(function(n){var t=e.__assign({},n),i=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:n}),setTimeout(function(){requestAnimationFrame(function(){Xe.current===n&&kt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Yn,Un,he,Tt,Ct,St,wn,jn]),kt=t.useRef(Ft);t.useEffect(function(){kt.current=Ft},[Ft]);var Vt=t.useRef(null),Lt=t.useRef(null),Ht=t.useRef(null),Gt=t.useRef(null),qt=t.useRef(null),zt=t.useRef(null),Kt=t.useState([]),Wt=Kt[0],Yt=Kt[1];t.useRef(null);var Ut=t.useState(null),Xt=Ut[0],$t=Ut[1];t.useEffect(function(){if(Vn){var e=Mn.fields.find(function(e){return e.analysisKey===Vn||e.key===Vn});if(e){var n=nt.current[e.key]||tt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Vn,Mn.fields]);var Jt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==gt?void 0:gt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[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===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[gt]),Qt=t.useCallback(function(n,t){var i,o,r;void 0===t&&(t="left");var l=null,c=null;if("left"===t)if(l=Yn[n],he&&l){var s=Un.filter(function(e){var n;return null===(n=l.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});c=s.find(function(e){return e.evaluationResult})||s[0]}else c=Un[n];else if(c=Un[n],he&&c){var d=Yn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)});l=d.find(function(e){return e.evaluationResult})||d[0]}else l=Yn[n];var v=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,f=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!v&&!f&&!g)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==c?void 0:c.evaluationResult)&&void 0!==o?o:null,h=u.getFirstDeviationOutputValue(p),x=u.getFirstDeviationColor(p);return null!=p?e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null!==(r=h)&&void 0!==r?r:""}):e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null})},[Yn,Un,ln,Mn,he]),Zt=t.useCallback(function(n){for(var t,i,o,r,l,c=n.split("-").map(Number),s=Yn[c[0]],d=Un[c[0]],v=1;v<c.length;v++)(null==s?void 0:s.subsections)&&(s=s.subsections[c[v]]),(null==d?void 0:d.subsections)&&(d=d.subsections[c[v]]);if(!s&&!d)return null;var f=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=u.safeStringify(null==s?void 0:s.id)||u.safeStringify(null==d?void 0:d.id)||"",h=!(!(null==s?void 0:s.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!f&&!g&&!h)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=ln[p])||void 0===o||o.relevance_score);var x=null!==(l=null!==(r=null==s?void 0:s.evaluationResult)&&void 0!==r?r:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,_=u.getFirstDeviationOutputValue(x),m=u.getFirstDeviationColor(x);return null!=x?e.__assign(e.__assign({},u.generateColorPalette(m)),{label:null!=_?_:""}):e.__assign(e.__assign({},u.generateColorPalette(m)),{label:null})},[Yn,Un,ln,Mn]),ei=t.useCallback(function(n,t){var i,o,r,l,c,s,d,v,f,g,p,h,x,_,m,R,y;if(!n||null==t)return null;var S=null!==(d=null!==(c=null!==(o=null===(i=null==ae?void 0:ae[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Z?void 0:Z.nodes)||void 0===r?void 0:r[n])||void 0===l?void 0:l.evaluation_result)&&void 0!==c?c:null===(s=null==Z?void 0:Z[n])||void 0===s?void 0:s.evaluation_result)&&void 0!==d?d:null;if(!S||"object"!=typeof S)return null;var b=null!==(p=null!==(f=null===(v=null==S?void 0:S.deviations)||void 0===v?void 0:v[t])&&void 0!==f?f:null===(g=null==S?void 0:S.deviation_entries)||void 0===g?void 0:g[t])&&void 0!==p?p:null==S?void 0:S[t],A=null!==(y=null!==(_=null===(x=null===(h=null==b?void 0:b.evaluation_outputs)||void 0===h?void 0:h.metadata)||void 0===x?void 0:x.label_color)&&void 0!==_?_:null===(R=null===(m=null==S?void 0:S.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===R?void 0:R.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR;return e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[ae,Z]),ni=t.useCallback(function(){yt(),Tt({}),Ct({}),St(),ze(new Set),Ye([]),en.current=[],wn(),jn(),Fn(),requestAnimationFrame(function(){rn.current&&rn.current()})},[Tt,Ct,St,wn,jn,Fn]),ti=t.useMemo(function(){return Object.values(It).some(Boolean)||Object.values(Bt).some(Boolean)},[It,Bt]),ii=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p,h,x,_,m,R,y,S,b;if(!mn.current&&!Je.current){mn.current=!0;try{if(!Vt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!It[t]&&!1===he)return!1;if(he&&!It["left-".concat(t)]&&!It["right-".concat(t)]&&!It[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Bt[i])return!1;return!0},E=Vt.current.getBoundingClientRect();an({width:E.width,height:E.height});var I=[];if(Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.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")}),!Je.current){for(var T=0;T<Math.max(Yn.length,Un.length);T++){var B=null===(e=it.current[T])||void 0===e?void 0:e.current,C=null===(n=ot.current[T])||void 0===n?void 0:n.current;B&&(B.style.height="auto",B.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}he||Object.keys(ct.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=at.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 D={};Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();D[i]=Math.max(l.height,u.height)}});var O={left:{},right:{}},w={};if(!Je.current)if(he){if(Ce&&null!==Ve)if("number"==typeof Ve){var N=Ve,P=Yn[N],j=null===(o=it.current[N])||void 0===o?void 0:o.current;j&&P&&(P.refIndexes||[]).forEach(function(e){var n,t=Un.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ot.current[t])||void 0===n?void 0:n.current;if(i&&(It["left-".concat(N)]||It["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);O.left[N]=Math.max(O.left[N]||0,o),O.right[t]=Math.max(O.right[t]||0,o)}})}else{var F=Ve.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(r=ct.current[F])||void 0===r?void 0:r.current,C=null===(l=at.current[F])||void 0===l?void 0:l.current;if(B&&C){M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,M)}}}}else{Object.keys(ct.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=at.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(),u=Math.max(r.height,l.height);w[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(T=0;T<Math.min(Yn.length,Un.length);T++){var B=null===(t=it.current[T])||void 0===t?void 0:t.current,C=null===(i=ot.current[T])||void 0===i?void 0:i.current;if(B&&C){var M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[T]=M,O.right[T]=M}}}if(Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=D[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Je.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=it.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ot.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),he||Object.keys(w).forEach(function(e){var n,t,i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=at.current[e])||void 0===t?void 0:t.current;if(i&&o&&w[e]){var r=w[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),he)Yn.forEach(function(e,n){var t;(null===(t=it.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,u,c,a,s,d,v=Un.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=rt.current[n])||void 0===t?void 0:t.current,g=null===(i=lt.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-E.left,_=h.left-E.left,m=p.top+p.height/2-E.top,R=h.top+h.height/2-E.top;if(Ce&&Ve===n){var y=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=fn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,b=y+(null!==(a=null===(c=_n.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=S+(null!==(d=null===(s=fn.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),T=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};m=C(T,y,b)-E.top,R=C(B,S,A)-E.top}var D=Qt(n);D&&I.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(T=0;T<Math.min(Yn.length,Un.length);T++){var k=null===(c=it.current[T])||void 0===c?void 0:c.current,V=null===(a=ot.current[T])||void 0===a?void 0:a.current;if(k&&V){var L=k.getBoundingClientRect(),H=V.getBoundingClientRect(),G=Math.max(L.top,H.top)+18-E.top,q=(null===(s=Un[T])||void 0===s?void 0:s.id)||"sec-".concat(T);(J=Qt(T))&&I.push({id:q,x1:L.right-E.left,y1:G,x2:H.left-E.left,y2:G,style:J,sectionIdx:T,hasCognitive:!!((null===(d=Yn[T])||void 0===d?void 0:d.cognitiveData)||(null===(v=Un[T])||void 0===v?void 0:v.cognitiveData)||q&&ln[q]),isSubSection:!1})}}Object.keys(ct.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=ct.current[e])||void 0===n?void 0:n.current,a=null===(t=at.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Yn[s[0]],v=Un[s[0]],f=1;f<s.length;f++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[f]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]);var g=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&u.hasValue(d.title)),p=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&u.hasValue(d.content)),h=!!v&&((null===(r=v.displayTitle)||void 0===r||r)&&u.hasValue(v.title)),x=!!v&&((null===(l=v.displayContent)||void 0===l||l)&&u.hasValue(v.content));if(g&&p||h&&x){var _=c.getBoundingClientRect(),m=a.getBoundingClientRect(),R=Math.max(_.top,m.top)+16-E.top,y=Zt(e);y&&"Not Defined"!==y.label&&I.push({id:"subsec-".concat(e),x1:_.right-E.left,y1:R,x2:m.left-E.left,y2:R,style:y,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(Ce&&"string"==typeof Ve&&Ve.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Ve.split(u.DEVIATION_BADGE_SEPARATOR),K=z[0],W=z[1],Y=z[2],U=(z[3],"".concat(K).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),X=null===(f=rt.current[U])||void 0===f?void 0:f.current,$=null===(g=lt.current[U])||void 0===g?void 0:g.current;if(X&&$){var J,Q=X.getBoundingClientRect(),Z=$.getBoundingClientRect(),ee=Q.right-E.left,ne=Z.left-E.left,te=Q.top+Q.height/2-E.top,ie=Z.top+Z.height/2-E.top;if(he){var oe=null!==(h=null===(p=_n.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(_=null===(x=fn.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==_?_:0,le=oe+(null!==(R=null===(m=_n.current)||void 0===m?void 0:m.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=fn.current)||void 0===y?void 0:y.clientHeight)&&void 0!==S?S:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,le)-E.top,ie=ce(Z.top+Z.height/2,re,ue)-E.top}(J=null!==(b=ei(K,W))&&void 0!==b?b:Zt(Y))&&I.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Ve})}}if(Yt(I),qt.current&&zt.current){var ae=qt.current.getBoundingClientRect(),se=zt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-E.top+se.top+se.height/2-E.top)/2;$t({x1:ae.right-E.left,x2:se.left-E.left,y:de})}else $t(null);if(qe.size>0){var ve=[],fe=_n.current,ge=fn.current;if(fe&&ge){var pe=[],xe=fe.getBoundingClientRect().top,_e=ge.getBoundingClientRect().top,me=xe+fe.clientHeight,Re=_e+ge.clientHeight,ye=fe.scrollTop,Se=ge.scrollTop,be=E.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};qe.forEach(function(e){var n,t,i,o,r,l;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var c=e.split(u.DEVIATION_BADGE_SEPARATOR),a=c[0],s=c[1],d=c[2],v=(c[3],"".concat(a).concat(u.DEVIATION_BADGE_SEPARATOR).concat(s)),f=null===(n=rt.current[v])||void 0===n?void 0:n.current,g=null===(t=lt.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=ei(a,s))&&void 0!==i?i:Zt(d),_=(j=p.right-E.left)+.5*((F=h.left-E.left-0)-j),m=p.top+p.height/2,R=h.top+h.height/2,y=m-xe+ye,S=R-_e+Se,b="conn-subsec-".concat(v);pe.push({lhsScrollY:y,rhsScrollY:S,x1:j,x2:F,containerTop:be,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:b});var A=Ae(m,xe,me),I=Ae(R,_e,Re),T=A-be,B=I-be,C=R>=_e-4&&R<=Re+4,D="";D=(M=m>=xe-4&&m<=me+4)&&C?u.getBentArrowPath(j,T,F,B):M&&!C?"M ".concat(j,",").concat(T," L ").concat(_,",").concat(T," L ").concat(_,",").concat(B):!M&&C?"M ".concat(_,",").concat(T," L ").concat(_,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(_,",").concat(T," L ").concat(_,",").concat(B),ve.push({id:b,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(he){var O=e,w=Yn[O];if(!(null===(l=null==w?void 0:w.refIndexes)||void 0===l?void 0:l.length))return;w.refIndexes.forEach(function(e){var n,t,i=Un.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=rt.current[O])||void 0===n?void 0:n.current,r=null===(t=lt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Qt(O),s=l.right-E.left,d=c.left-E.left-0,v=s+.5*(d-s),f=l.top+l.height/2,g=c.top+c.height/2,p=f-xe+ye,h=g-_e+Se,x="conn-".concat(O,"-").concat(i);pe.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:be,leftIdx:O,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var _=Ae(f,xe,me),m=Ae(g,_e,Re),R=_-be,y=m-be,S=f>=xe-4&&f<=me+4,b=g>=_e-4&&g<=Re+4,A="";A=S&&b?u.getBentArrowPath(s,R,d,y):S&&!b?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!S&&b?"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y),ve.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,P=N;f=null===(o=rt.current[N])||void 0===o?void 0:o.current,g=null===(r=lt.current[P])||void 0===r?void 0:r.current;if(!f||!g)return;var j,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=Qt(N),_=(j=p.right-E.left)+.5*((F=h.left-E.left-0)-j),m=p.top+p.height/2,R=h.top+h.height/2,y=m-xe+ye,S=R-_e+Se,b="conn-".concat(N,"-").concat(P);pe.push({lhsScrollY:y,rhsScrollY:S,x1:j,x2:F,containerTop:be,leftIdx:N,rhsArrayIdx:P,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:b});var M;A=Ae(m,xe,me),I=Ae(R,_e,Re),T=A-be,B=I-be,C=R>=_e-4&&R<=Re+4,D="";D=(M=m>=xe-4&&m<=me+4)&&C?u.getBentArrowPath(j,T,F,B):M&&!C?"M ".concat(j,",").concat(T," L ").concat(_,",").concat(T," L ").concat(_,",").concat(B):!M&&C?"M ".concat(_,",").concat(T," L ").concat(_,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(_,",").concat(T," L ").concat(_,",").concat(B),ve.push({id:b,pathD:D,style:x,leftIdx:N,rhsArrayIdx:P})}}),en.current=pe}Ye(ve)}else Ye([]),en.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{mn.current=!1}}},[Xn,Yn,Un,ln,Mn,Jt,Qt,ei,he,Ce,Ve,qe,It,Bt]),oi=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=en.current;if(p.length&&!Je.current){var h=null!==(n=null===(e=_n.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=fn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,_=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=fn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=_n.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=fn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+_,b=y+m,A=null!==(g=null===(f=Vt.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,E=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+R,t=e.rhsScrollY-x+y,i=Ze.current[e.styleId+"-stroke"],o=Ze.current[e.styleId+"-bg"];if(i||o){var r,l=E(n,R,S),c=E(t,y,b),a=l-A,s=c-A,d=n>=R-4&&n<=S+4,v=t>=y-4&&t<=b+4,f=e.x1+.5*(e.x2-e.x1);r=d&&v?u.getBentArrowPath(e.x1,a,e.x2,s):d&&!v?"M ".concat(e.x1,",").concat(a," L ").concat(f,",").concat(a," L ").concat(f,",").concat(s):!d&&v?"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);t.useEffect(function(){rn.current=ii},[ii]);var ri=t.useRef(null),li=t.useRef(null),ui=t.useCallback(function(){en.current.length>0&&!Je.current||(null!==ri.current&&clearTimeout(ri.current),ri.current=setTimeout(function(){rn.current(),ri.current=null},50))},[]),ci=t.useCallback(function(){Me(!0),Pe(!1),null!==li.current&&clearTimeout(li.current),null!==ri.current&&(clearTimeout(ri.current),ri.current=null),li.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s,d;try{if(en.current=[],tn.current&&null!==on.current&&null!==Ht.current){var v=on.current,f=Ht.current,g="string"==typeof v&&v.includes(u.DEVIATION_BADGE_SEPARATOR),p=null,h=null,x=null,_=null;if(g){var m=v.split(u.DEVIATION_BADGE_SEPARATOR),R="".concat(m[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(m[1]);p=(null===(e=rt.current[R])||void 0===e?void 0:e.current)||null,h=(null===(n=lt.current[R])||void 0===n?void 0:n.current)||null,x=(null===(t=ct.current[m[2]])||void 0===t?void 0:t.current)||(null===(i=it.current[Number(m[2])])||void 0===i?void 0:i.current)||null,_=(null===(o=at.current[m[3]])||void 0===o?void 0:o.current)||(null===(r=ot.current[Number(m[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=st.current[v])||void 0===l?void 0:l.current)||null,x=(null===(c=it.current[v])||void 0===c?void 0:c.current)||null,h=(null===(a=ut.current[f])||void 0===a?void 0:a.current)||null,_=(null===(s=ot.current[f])||void 0===s?void 0:s.current)||null;if(p&&h&&x&&_){if(x.style.paddingTop="0px",_.style.paddingTop="0px",!he){var y=p.getBoundingClientRect(),S=h.getBoundingClientRect(),b=y.top-S.top;b>0?_.style.paddingTop="".concat(b,"px"):b<0&&(x.style.paddingTop="".concat(Math.abs(b),"px"))}var A=_n.current,E=fn.current;if(A&&E){var I=p.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,T=h.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-(I-A.scrollTop);Math.abs(E.scrollTop-T)>1&&(E.scrollTop=T)}}}null===(d=rn.current)||void 0===d||d.call(rn),tn.current&&Pe(!0)}catch(e){console.error("Safely caught error during resize calculation:",e)}finally{Me(!1),li.current=null}},150)},[he,Yn,Un]),ai=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==Rn.current&&yn.current&&Math.abs(e.currentTarget.scrollTop-Rn.current)<=2){var v=yn.current;Rn.current=null,yn.current=null,v()}if(!He.current){if(he||ui(),tn.current){var f=on.current,g=Ht.current,p=_n.current,h=fn.current;if(null!==f&&null!==g&&p&&h){var x="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=rt.current["".concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===n?void 0:n.current:null===(t=st.current[f])||void 0===t?void 0:t.current,_="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=lt.current["".concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===i?void 0:i.current:null===(o=ut.current[g])||void 0===o?void 0:o.current;if(x&&_&&Gt.current){var m=void 0,R=void 0;if("string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)){var y=f.split(u.DEVIATION_BADGE_SEPARATOR),S="".concat(y[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(y[1]);m=null===(r=rt.current[S])||void 0===r?void 0:r.current,R=null===(l=lt.current[S])||void 0===l?void 0:l.current}else m=null===(c=rt.current[f])||void 0===c?void 0:c.current,R=null===(a=lt.current[g])||void 0===a?void 0:a.current;var b=null!==(d=null===(s=Vt.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==d?d:0,A=p.getBoundingClientRect().top,E=A+p.clientHeight;h.getBoundingClientRect().top;h.clientHeight;if(m&&R){var I=m.getBoundingClientRect(),T=R.getBoundingClientRect(),B=I.top+I.height/2;T.top,T.height;var C=((O=B,w=A,N=E,Math.max(w,Math.min(N,O)))-b).toString();Gt.current.setAttribute("y1",C),Gt.current.setAttribute("y2",C);var D=B>=A-4&&B<=E+4;Gt.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,N;en.current.length>0&&!nn.current&&(nn.current=!0,requestAnimationFrame(function(){oi(),nn.current=!1}))}},[oi,he,ui]),si=t.useRef(0),di=t.useRef(0),vi=t.useRef(0),fi=t.useRef(function(){});t.useRef(null),t.useEffect(function(){fi.current=ci},[ci]),t.useEffect(function(){var e=setTimeout(ui,250),n=function(){return fi.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==ri.current&&clearTimeout(ri.current),null!==li.current&&clearTimeout(li.current),window.removeEventListener("resize",n)}},[Kn,Wn,gt,Xn,It,Bt,Yn,Un,Mn,ui,Ce,Ve,Ne,qe]),t.useEffect(function(){var e=function(e,n,t,i,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,i())}})});return r.observe(e),r},n={current:null},t={current:null},i={current:null},o=[],r=[n,t,i];return vn.current&&o.push(e(vn.current,si,n,function(){return fi.current()},function(){})),dn.current&&o.push(e(dn.current,di,t,function(){return fi.current()},function(){return rn.current()})),Vt.current&&o.push(e(Vt.current,vi,i,function(){return fi.current()},function(){return rn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),t.useEffect(function(){tn.current=Ce},[Ce]),t.useEffect(function(){on.current=Ve},[Ve]);var gi=t.useCallback(function(e,n,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";Fn(),null!=e&&(n?Te("No counterpart exists for this section."):(yt(),Ce&&Ve===e?r?St():null==l||l():(ze(new Set([e])),Ye([]),en.current=[],Ae(!0),He.current=!0,Le(e),on.current=e,De(!0),tn.current=!0,Pe(!1),gn.current&&(gn.current.style.height="0px"),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var f=e.split(u.DEVIATION_BADGE_SEPARATOR),g="".concat(f[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f[1]);s=(null===(n=rt.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=lt.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=st.current[e])||void 0===i?void 0:i.current)||null,he){var p=Yn[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],_=Un.findIndex(function(e){return e.selfIndex===x});-1!==_&&(d=(null===(r=ut.current[_])||void 0===r?void 0:r.current)||null,v=_)}}else d=(null===(o=ut.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;Ht.current=v;var m=_n.current,R=fn.current,y=function(){!function(){var n,t,i,o,r,l,c,s,d,f,g,p,h=null,x=null,_=null,m=null;if(a){var R=e.split(u.DEVIATION_BADGE_SEPARATOR),y="".concat(R[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(R[1]);h=(null===(n=ct.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=it.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=at.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(R[3])])||void 0===o?void 0:o.current)||null,_=(null===(r=rt.current[y])||void 0===r?void 0:r.current)||h,m=(null===(l=lt.current[y])||void 0===l?void 0:l.current)||x}else{var S=Number(e),b=null!==v?Number(v):S;h=(null===(c=it.current[S])||void 0===c?void 0:c.current)||null,x=(null===(s=ot.current[b])||void 0===s?void 0:s.current)||null,_=(null===(d=rt.current[S])||void 0===d?void 0:d.current)||(null===(f=st.current[S])||void 0===f?void 0:f.current)||h,m=(null===(g=lt.current[b])||void 0===g?void 0:g.current)||(null===(p=ut.current[b])||void 0===p?void 0:p.current)||x}if(_&&m&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var A=_.getBoundingClientRect(),E=m.getBoundingClientRect(),I=A.top-E.top;I>0?x.style.paddingTop="".concat(I,"px"):I<0&&(h.style.paddingTop="".concat(Math.abs(I),"px"))}}(),Pe(!0),rn.current&&rn.current(),He.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Ae(!1),null==l||l()};if(!s||!m)return He.current=!1,Ae(!1),void(null==l||l());if(d&&R){if(!he){var S=0;S="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var b=dn.current,A=(null==b?void 0:b.getBoundingClientRect().top)||0,E=b?b.scrollTop+S-A-150:0;return b?void u.smoothScrollTo(b,E,200,y):void y()}var I=s.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,T=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=T-(I-m.scrollTop);C<0&&gn.current&&(gn.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=R.scrollHeight-R.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return pn.current&&(pn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(R,C,B,y)})}e=C}u.smoothScrollTo(R,e,B,y)})}else{var D=I-(T-R.scrollTop);D<0&&hn.current&&(hn.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return xn.current&&(xn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(m,D,B,y)})}e=D}u.smoothScrollTo(m,e,B,y)})}}else y()}))))},[Ve,Fn,Un,Ce,he,Yn,St]),pi=t.useCallback(function(e,n,t,i){var o,r="string"==typeof i?u.safeStringify(i).trim():u.safeStringify(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;jn();var c="left";(null===(o=fn.current)||void 0===o?void 0:o.contains(l))&&(c="right");var a=function(){var e,t,i,o;if("string"==typeof n&&n.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=n.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===c?null===(e=lt.current[l])||void 0===e?void 0:e.current:null===(t=rt.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=lt.current[n])||void 0===i?void 0:i.current:null===(o=rt.current[n])||void 0===o?void 0:o.current};if(t)return St(),ze(new Set),Ye([]),en.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;On({open:!0,anchorEl:e,summary:i})}));gi(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;On({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[gi,jn,On,St]),hi=t.useCallback(function(){var e,n=En.sectionIdx,t=En.isOrphan;if(wn(),null!=n){var i="left";En.anchorEl&&(null===(e=fn.current)||void 0===e?void 0:e.contains(En.anchorEl))&&(i="right"),gi(n,t,{sourceSide:i})}},[gi,En.isOrphan,En.sectionIdx,En.anchorEl,wn]),xi=t.useCallback(function(){wn(),St(),ze(new Set),Ye([]),en.current=[]},[wn,St]),_i=null!==En.sectionIdx&&qe.has(En.sectionIdx),mi=_.useDeviationNavigation({proposedSections:Yn,existingSections:Un,parentDeviationRecord:$n,expandedSections:It,maintainRelativeOrder:!!he,scrollContainerRef:dn,leftContainerRef:_n,lhsBadgeRefs:rt,rhsBadgeRefs:lt}),Ri=mi.showDeviationNavigation,yi=mi.showOpenNodeRef,Si=t.useMemo(function(){var e;if(!se)return null;var n=null===(e=null==se?void 0:se.id)||void 0===e?void 0:e.split(":")[0];for(var t in $n){if(($n[t]||[]).some(function(e){return e.id===n}))return t}return null},[se,$n]),bi=t.useRef({id:null,triggerMs:null}),Ai=t.useRef(null);t.useEffect(function(){var n;if(null==se?void 0:se.id){var t=Number(se.trigger),i=bi.current;if((null==i?void 0:i.triggerMs)!==t){if(!(se.id.includes(":")&&/:\d+$/.test(se.id)))return bi.current={id:se.id,triggerMs:t},void Mt(se.id);var o=null===(n=null==se?void 0:se.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],c=null!=l?l:"0";Ai.current!==se.id&&(wn(),jn(),St(),ze(new Set),Ye([]),en.current=[],Ai.current=se.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},g=function(){var n,i,o,l;if(!a){var p=function(){bi.current={id:se.id,triggerMs:t}},h=null,x=null;for(var _ in $n){var m=$n[_].find(function(e){return e.id===r});if(m){h=_,x=m;break}}if(x&&h){var R=Yn.findIndex(function(e){return e.id===h}),y=Un.findIndex(function(e){return e.id===h}),S=-1===R&&-1!==y,b=f(Yn,x.id),A=f(Un,x.id);if(b&&!A&&!S){var E=b.split("-"),I=Number(E[0]);if(he){var T=null===(i=null===(n=Yn[I])||void 0===n?void 0:n.refIndexes)||void 0===i?void 0:i[0],B=Un.findIndex(function(e){return e.selfIndex===T});-1!==B&&(I=B)}A=e.__spreadArray([I],E.slice(1),!0).join("-")}if(b||A){var C=S||!b&&!!A,D=b?Number(b.split("-")[0]):R,O=A?Number(A.split("-")[0]):y;if(C){if(!(he?!!It["right-".concat(O)]:!!It[String(O)])&&O>=0)return Dt(O,"right"),s+=1,void(d=setTimeout(g,450))}else if(!(he?!!It["left-".concat(D)]:!!It[String(D)])&&D>=0)return Dt(D,"left"),s+=1,void(d=setTimeout(g,450));var w,N=b||"",P=A||"",j="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(N).concat(u.DEVIATION_BADGE_SEPARATOR).concat(P),F="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c),M=null===(o=rt.current[F])||void 0===o?void 0:o.current,k=null===(l=lt.current[F])||void 0===l?void 0:l.current,V=C||!M&&!!k,L=V?k:M;if(w=he?V?fn.current:_n.current:dn.current,L&&w){var H=L.getBoundingClientRect();if(0===H.height)return void((s+=1)<2?d=setTimeout(g,v):p());var G=w.getBoundingClientRect(),q=H.top-G.top+w.scrollTop-G.height/2+H.height/2+150,z=function(){var n,t,i,o,r;if(!a){p();var l=window.getComputedStyle(L).color;M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(l)),k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){M&&(M.style.boxShadow=""),k&&(k.style.boxShadow="")},2e3);var u=(null===(t=null===(n=x.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[c])||x,s=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!M&&!!k)){var d=V?(null===(o=lt.current[F])||void 0===o?void 0:o.current)||k:(null===(r=rt.current[F])||void 0===r?void 0:r.current)||M;return On({open:!0,anchorEl:d,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})}),void(null==de||de())}gi(j,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t=(null===(n=rt.current[F])||void 0===n?void 0:n.current)||M;console.log("Summary data",s,u),On({open:!0,anchorEl:t,summary:e.__assign({},u)})}})}};Math.abs(w.scrollTop-q)<=2?z():(Rn.current=q,yn.current=z,w.scrollTo({top:q,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(yn.current){Rn.current=null;var e=yn.current;yn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}};return d=setTimeout(g,v),function(){a=!0,d&&clearTimeout(d)}}}},[se,$n,Yn,Un,he,It,Dt,gi,On,Mt]);var Ei=function(e){var t=e.section,i=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c;return n.jsx(y.default,{section:t,keyPath:i,depth:r,columnKey:u,parentNodeId:a,expandedSubSections:Bt,setExpandedSubSections:Ct,maintainRelativeOrder:he||!1,proposedSections:Yn,existingSections:Un,treeData:Z,deviationNumberRegistry:Jn,connectedSections:qe,activeSideBySideSection:Ve,resolvedMarkdownStyles:sn,getSubSectionRef:vt,getSubSectionCompareStyle:Zt,getBadgeRef:ft,openMoreFunctionsPopup:Nt,openSummaryPopup:pi,showDeviationBadges:_e,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:en,isProposingFix:fe,proposingFixNodeId:ge})};return n.jsxs(i.Box,e.__assign({ref:vn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},he?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&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,{})})),Dn.open&&n.jsx(S.default,{open:Dn.open,anchorEl:Dn.anchorEl,containerEl:Lt.current,clipTopEl:qt.current,scrollContainerEl:dn.current,onClose:xi,summary:Dn.summary}),n.jsx(d.default,{open:En.open,anchorEl:En.anchorEl,sectionTitle:En.sectionTitle,referenceSectionTitle:En.refSectionTitle,onClose:Fn,onOpenCognitiveCompare:Pt,onOpenSideBySide:hi,onConnect:jt,isConnected:_i,isOrphan:En.isOrphan}),bn.open&&n.jsx(s.default,{open:bn.open,popupRef:Pn,position:Tn,popupConfig:ue,onClose:function(){Bn(null),An(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Nn(null)},markdownStyles:ie,sectionTitle:bn.sectionTitle,referenceSectionTitle:bn.refSectionTitle,cognitiveData:bn.cognitiveData,anchorEl:bn.anchorEl,sectionAnchorEl:bn.sectionAnchorEl,scrollContainerEl:dn.current,badgeStyle:bn.badgeStyle,docData:bn.docData,deviationData:bn.deviationData,isLoading:bn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Ie,autoHideDuration:8e3,onClose:function(){return Te(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Te(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ie}))})),n.jsx(m.default,{componentHeaderText:Q,displayConfig:le,maintainRelativeOrder:he,onCollapseAll:ni,showCollapseAll:ti,onToggleView:function(e){ye(!0),setTimeout(function(){xe(!e),St(),wn(),ze(new Set),Ye([]),en.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ye(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:dn,onScroll:ai,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:"hidden",borderTop:pt&&ht?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},he?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Vt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ue,style:{position:"absolute",top:0,left:0,width:cn.width||"100%",height:cn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Fe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Xt&&n.jsx("g",{children:n.jsx("line",{x1:Xt.x1,y1:Xt.y,x2:Xt.x2,y2:Xt.y,stroke:Rt.badgeBorder,strokeWidth:"1.5"})}),Wt.map(function(t){var l,c,s,d,v,g,p=t.x1+.5*(t.x2-t.x1),h=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?Ce&&Ve===t.subSectionKeyPath&&Ne:Ce&&Ve===t.sectionIdx&&Ne)return null;if(!he){var x=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),_=Yn[t.sectionIdx]||{title:"",content:""},m=Un[t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",_,m),t.isSubSection&&t.subSectionKeyPath){var R=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],y=R[2]||t.subSectionKeyPath,S=R[3]||y,b=y.split("-").map(Number),A=S.split("-").map(Number),E=null,I=null;b.length>0&&(E=Yn[b[0]]),A.length>0&&(I=Un[A[0]]);var T=(null==E?void 0:E.title)||"",B=(null==I?void 0:I.title)||"";console.log("Root Parent Titles:",T,B);for(var C=1;C<b.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[b[C]]);for(C=1;C<A.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[A[C]]);E&&(_=e.__assign(e.__assign({},E),{title:T||E.title})),console.log("Base Section for Subsection Badge:",_),I&&(m=e.__assign(e.__assign({},I),{title:B||I.title})),console.log("Ref Section for Subsection Badge:",m)}var D=!(null===(l=_.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(s=null===(c=_.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===s?void 0:s.length),O=(null===(g=null===(v=null===(d=_.evaluationResult)||void 0===d?void 0:d.cognitive_decisioning)||void 0===v?void 0:v.decisioning_factors)||void 0===g?void 0:g.length)||!1,w=D||O;return n.jsxs("g",{children:[n.jsx("path",{d:x,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:p-100,y:h-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),w&&(bn.open&&Cn===t.id?jn():(Nn(t.id),wt(Ot(e.currentTarget,_,m,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:w?"pointer":"default"}},{children:[t.style.badgeText===a.DEFAULT_DEVIAION_COLOR&&null==t.style.label?n.jsx(f.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(r.ButtonCognitiveIcon,{})})),w&&n.jsx(o.ChevronDown,{size:11,style:{transform:bn.open&&Cn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),n.jsx(b.default,{connectedLines:We,pathRefs:Ze})]})),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)"},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:qt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{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",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Gn}))}))})),n.jsxs(i.Box,e.__assign({ref:_n,onScroll:ai,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{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:hn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Yn.map(function(t,r){var l,c,a=!t.title&&!t.content;if(he&&a)return null;var s=t,d=Qt(r,"left"),v=he?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Un[r],g=he?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=qe.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:dt(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:it.current[r],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:r,columnKey:"left",colRef:dt("left-accordion-".concat(r)),mb:0,treeData:Z,proposedSections:Yn,existingSections:Un,deviationNumberRegistry:Jn,getSectionCompareStyle:Qt,getBadgeRef:ft,connectedSections:qe,openMoreFunctionsPopup:Nt,openSummaryPopup:pi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,parentNodeId:(null===(c=null==Z?void 0:Z.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:he?!!It["left-".concat(r)]:!!It[String(r)],onToggle:function(){xi(),Dt(r,"left")},navigation:t.id?Ri[t.id]:null,showOpenNodeRef:yi,resolvedMarkdownStyles:sn,maintainRelativeOrder:he,showDeviationBadges:_e,renderSubSections:Ei,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Ve?Ve:""))})})),he&&d&&n.jsxs(i.Box,e.__assign({ref:rt.current[r],onClick:function(e){var n=he?Un.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Un[r]||{title:"",content:""};Nt(e,t,v,n,r,d)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.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:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=le.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;console.log("LOG: Printing evaluationResult",o,s),pi(e,String(r),v,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:v?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":v?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=g&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:g})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!le.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(f.default,{color:d.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=he?Un.find(function(e){var n;return(null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e))||{title:"",content:""}}):Un[r]||{title:"",content:""};Nt(e,t,v,n,r,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:xn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:Lt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({onClick:function(n){n.stopPropagation(),bn.open&&Cn===xt?jn():(Nn(xt),wt(Ot(n.currentTarget,{title:"",content:"",evaluationResult:_t,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,xt,!0,e.__assign(e.__assign({},Rt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Rt.badgeBg,color:Rt.badgeText,border:"1px solid ".concat(Rt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=mt?mt:n.jsx(f.default,{}),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:bn.open&&Cn===xt?"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},he?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[be&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:zt,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:qn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:qn}))}))})),n.jsxs(i.Box,e.__assign({ref:fn,onScroll:ai,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:gn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Un.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(he){u=Yn.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}),s=Yn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=Yn.findIndex(function(e,n){var t;return qe.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Qt(d))}else u=[o+1],(c=qe.has(o))&&(a=Qt(o));var v=Qt(he&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:ut.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:ot.current[o],sx:e.__assign({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:o,columnKey:"right",colRef:dt("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Z?void 0:Z.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:he?!!It["right-".concat(o)]:!!It[String(o)],treeData:Z,proposedSections:Yn,existingSections:Un,deviationNumberRegistry:Jn,getBadgeRef:ft,getSectionCompareStyle:Qt,connectedSections:qe,openMoreFunctionsPopup:Nt,openSummaryPopup:pi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,onToggle:function(){xi(),Dt(o,"right")},navigation:t.id?Ri[t.id]:null,showOpenNodeRef:yi,resolvedMarkdownStyles:sn,maintainRelativeOrder:he,showDeviationBadges:_e,renderSubSections:Ei,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Ve?Ve:""))})})),he&&v&&n.jsx(i.Box,e.__assign({ref:lt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:v.badgeBg,color:v.badgeText,border:"1px solid ".concat(v.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as u,useCallback as c}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as f}from"@mui/material";import{ChevronDown as p,EllipsisVertical as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import x from"./OverlayComponent.js";import{safeStringify as m,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,findKeyPathByNodeId as R,getFirstDeviationOutputValue as C,getFirstDeviationColor as I,hasValue as w,getBentArrowPath as B,smoothScrollTo as T,resetClauseHighlight as _,scrollAndHighlightClause as E}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as F,DEFAULT_FIELD_CONFIG as A,DEFAULT_COMPARISON_CONFIG as D}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as M,DEFAULT_DEVIAION_COLOR as N,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import P from"./CognitivePopup.js";import H from"./MoreFunctionsPopup.js";import j from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as O}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as W}from"./hooks/useSectionRefs.js";import{useAccordionState as q}from"./hooks/useAccordionState.js";import{useDeviationNavigation as K}from"./hooks/useDeviationNavigation.js";import Y from"./components/CompareHeader.js";import V from"./components/SectionAccordion.js";import X from"./components/SubSectionAccordion.js";import $ from"./components/CognitiveSummaryPopup.js";import G from"./components/connectedLines.js";var J=function(J){var U,Q,Z,nn,en,tn,on,rn,ln,un,cn,dn,an,sn,vn,fn,pn,gn,hn,xn,mn,yn,bn,Sn,Rn,Cn,In=J.componentHeaderText,wn=void 0===In?k:In,Bn=J.treeData,Tn=J.comparisonConfig,_n=J.leftColumnTitleText,En=J.rightColumnTitleText,Fn=J.markdownStyles,An=J.resetTrigger,Dn=J.displayConfig,Mn=void 0===Dn?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:Dn,Nn=J.popupConfig,kn=J.deviationData,Pn=void 0===kn?{}:kn,Hn=J.deviationNodeIdToView,jn=J.resetDeviationNodeId,Ln=J.isProposingFix,On=void 0!==Ln&&Ln,zn=J.proposingFixNodeId,Wn=o(Mn.maintainRelativeOrder),qn=Wn[0],Kn=Wn[1],Yn=!!qn||!!(null==Mn?void 0:Mn.showDeviationBadges),Vn=o(!1),Xn=Vn[0],$n=Vn[1],Gn=o(!1),Jn=Gn[0],Un=Gn[1],Qn=o(null),Zn=Qn[0],ne=Qn[1],ee=o(!1),te=ee[0],ie=ee[1],oe=o(null===(Q=null!==(U=null==Bn?void 0:Bn.newEvaluationResult)&&void 0!==U?U:null==Mn?void 0:Mn.enableDeviationSchemaBackwardCompatibility)||void 0===Q||Q)[0],re=o(!1),le=re[0],ue=re[1],ce=o(!1),de=ce[0],ae=ce[1],se=o(null),ve=se[0],fe=se[1],pe=r(!1),ge=o(new Set),he=ge[0],xe=ge[1],me=o([]),ye=me[0],be=me[1],Se=r(null),Re=r(null),Ce=r(new Set),Ie=r(!1),we=r(null),Be=r({}),Te=r([]),_e=r(!1),Ee=r(!1),Fe=r(null),Ae=r(function(){}),De=l(function(){return(null==Bn?void 0:Bn.cognitive_decisioning)||{}},[Bn]),Me=o({width:0,height:0}),Ne=Me[0],ke=Me[1],Pe=l(function(){return n(n({},F),Fn)},[Fn]),He=r(null),je=r(null),Le=r(null),Oe=r(null),ze=r(null),We=r(null),qe=r(null),Ke=r(null),Ye=r(!1),Ve=r(null),Xe=r(null),$e=z(He),Ge=$e.cognitivePopup,Je=$e.setCognitivePopup,Ue=$e.moreFunctions,Qe=$e.setMoreFunctions,Ze=$e.position,nt=$e.setPosition,et=$e.activeBadgeId,tt=$e.summaryPopup,it=$e.setSummaryPopup,ot=$e.closeSummaryPopup,rt=$e.setActiveBadgeId,lt=$e.popupRef,ut=$e.closeCognitivePopup,ct=$e.closeMoreFunctionsPopup,dt=l(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==Tn?void 0:Tn.fields)&&void 0!==n?n:A,thresholds:{high:null!==(t=null===(e=null==Tn?void 0:Tn.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:D.thresholds.high,medium:null!==(o=null===(i=null==Tn?void 0:Tn.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:D.thresholds.medium,exact:null!==(l=null===(r=null==Tn?void 0:Tn.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:D.thresholds.exact}}},[Tn]),at=o(null),st=at[0];at[1];var vt=null===(en=null===(Z=null==Bn?void 0:Bn.documents)||void 0===Z?void 0:Z[null===(nn=null==Bn?void 0:Bn.input_index_map)||void 0===nn?void 0:nn[0]])||void 0===en?void 0:en.title,ft=null===(rn=null===(tn=null==Bn?void 0:Bn.documents)||void 0===tn?void 0:tn[null===(on=null==Bn?void 0:Bn.input_index_map)||void 0===on?void 0:on[1]])||void 0===rn?void 0:rn.title,pt=m(_n||vt||"Uploaded Contract"),gt=m(En||ft||"Reference Template"),ht=O(Bn,qn,Pn,dt,oe),xt=ht.activeProposed,mt=ht.existingRule,yt=ht.proposedSections,bt=ht.existingSections,St=ht.visibleFields,Rt=ht.parentDeviationRecord,Ct=ht.deviationNumberRegistry,It=ht.parseError;u(function(){It&&ne("Failed to load comparison: ".concat(It))},[It]);var wt=yt.length>0||bt.length>0,Bt=W(St.map(function(n){return n.key}),Math.max(yt.length,bt.length)),Tt=Bt.leftRefs,_t=Bt.rightRefs,Et=Bt.sectionLeftRefs,Ft=Bt.sectionRightRefs,At=Bt.lhsBadgeRefs,Dt=Bt.rhsBadgeRefs,Mt=Bt.sectionRightRowRefs,Nt=Bt.subSectionLeftRefs,kt=Bt.subSectionRightRefs,Pt=Bt.sectionRowRefs,Ht=Bt.getSectionRowRef,jt=Bt.getSubSectionRef,Lt=Bt.getBadgeRef,Ot=mt.analysis,zt=m(null===(un=null===(ln=null==Ot?void 0:Ot.rule_difference_comparison)||void 0===ln?void 0:ln.summary)||void 0===un?void 0:un.overall_summary),Wt=!!zt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),qt=null!==(cn=null==Bn?void 0:Bn.base_root_id)&&void 0!==cn?cn:"-1";null==Bn||Bn[qt];var Kt=oe?null!==(bn=null!==(xn=Pn&&(null===(hn=null==Pn?void 0:Pn[qt])||void 0===hn?void 0:hn.evaluation_result))&&void 0!==xn?xn:null===(yn=null===(mn=null==Bn?void 0:Bn.nodes)||void 0===mn?void 0:mn[qt])||void 0===yn?void 0:yn.evaluation_result)&&void 0!==bn?bn:null:null!==(gn=null!==(sn=Pn&&(null===(an=null===(dn=null==Pn?void 0:Pn[qt])||void 0===dn?void 0:dn.evaluation_result)||void 0===an?void 0:an[0]))&&void 0!==sn?sn:null===(pn=null===(fn=null===(vn=null==Bn?void 0:Bn.nodes)||void 0===vn?void 0:vn[qt])||void 0===fn?void 0:fn.evaluation_result)||void 0===pn?void 0:pn[0])&&void 0!==gn?gn:null,Yt=y(Kt),Vt=b(null!==(Cn=null===(Rn=null===(Sn=null==Kt?void 0:Kt.evaluation_outputs)||void 0===Sn?void 0:Sn.metadata)||void 0===Rn?void 0:Rn.label_color)&&void 0!==Cn?Cn:""),Xt=function(){Ce.current.forEach(function(n){_(n)}),Ce.current.clear()},$t=c(function(){var n,e,t,i,o,r;Xt(),ie(!1),Ee.current=!1;var l=Fe.current,u=fi.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var c=l.split(S);(d=(null===(n=Nt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=Et.current[Number(c[2])])||void 0===e?void 0:e.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=Et.current[l])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==u)if("string"==typeof u&&u.includes(S)){c=u.split(S);(a=(null===(i=kt.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=Ft.current[Number(c[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=Ft.current[u])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}fe(null),Fe.current=null,fi.current=null,ue(!1),Un(!1),Oe.current&&(Oe.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px")},[]),Gt=c(function(){Xt(),$t(),xe(new Set),be([]),Te.current=[],yi([]),Ri(null),it(M),ut(),requestAnimationFrame(function(){var n;null===(n=Ae.current)||void 0===n||n.call(Ae)})},[]),Jt=r(Gt);u(function(){Jt.current=Gt},[Gt]),u(function(){An&&Jt.current()},[An]);var Ut=q({maintainRelativeOrder:!!qn,proposedSections:yt,existingSections:bt,activeSideBySideSection:ve,connectedSections:he,resetSideBySide:$t,setConnectedSections:xe,setConnectedLines:be,cachedConnectedPositions:Te,svgContainerRef:Se,isAnimatingRef:Ie,animationTimerRef:we,calculateLinesRef:Ae,sectionLeftRefs:Et,sectionRightRefs:Ft,subSectionLeftRefs:Nt,subSectionRightRefs:kt}),Qt=Ut.expandedSections,Zt=Ut.setExpandedSections,ni=Ut.expandedSubSections,ei=Ut.setExpandedSubSections,ti=Ut.toggleSection,ii=c(function(e,t,i,o,r,l,u){var c,d,a,s=m(null==t?void 0:t.id)||m(null==i?void 0:i.id)||"",v=(s?De[s]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:s,decisioning:[],gap:[],relevance_score:0},f=null!==(d=null===(c=Pt.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null;return{isLoading:null!==(a=null==Mn?void 0:Mn.isLoading)&&void 0!==a&&a,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:f,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Bn?void 0:Bn.documents,input_index_map:null==Bn?void 0:Bn.input_index_map},deviationData:function(){var e,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,u=function(e){var t=function(n){if(!n||"object"!=typeof n)return null;var e=null==n?void 0:n.deviation_entries;if(e&&"object"==typeof e){var t=Object.keys(e).sort(function(n,e){return Number(n)-Number(e)})[0];if(t&&e[t])return e[t]}var i=Object.keys(n).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,e){return Number(n)-Number(e)});if(i.length&&n[i[0]])return n[i[0]];var o=null==n?void 0:n.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(n,e){return Number(n)-Number(e)})[0];if(r&&o[r])return o[r]}return null}(e);return t?n(n({},e),{deviation_summary:(null==e?void 0:e.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==e?void 0:e.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==e?void 0:e.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==e?void 0:e.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==e?void 0:e.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==e?void 0:e.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):e};if(!("string"==typeof o&&o.includes(S)))return u(l);var c=o.split(S)[1];if(!c)return l;var d=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},a=(null===(e=null==d?void 0:d.deviation_entries)||void 0===e?void 0:e[c])||(null===(r=null==d?void 0:d.deviations)||void 0===r?void 0:r[c])||null;return a?n(n(n({},d),a),{deviation_summary:(null==a?void 0:a.deviation_summary)||(null==d?void 0:d.deviation_summary),deviation_title:(null==a?void 0:a.deviation_title)||(null==d?void 0:d.deviation_title),deviation_impact:(null==a?void 0:a.deviation_impact)||(null==d?void 0:d.deviation_impact),deviation_explanation:(null==a?void 0:a.deviation_explanation)||(null==d?void 0:d.deviation_explanation),evaluation_outputs:(null==a?void 0:a.evaluation_outputs)||(null==d?void 0:d.evaluation_outputs),cognitive_decisioning:(null==a?void 0:a.cognitive_decisioning)||(null==d?void 0:d.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[De,Bn]),oi=c(function(n){ct(),nt(null),Je(n)},[ct]),ri=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),Ue.open&&Ue.sectionIdx===o)ct();else{var u=n.currentTarget,c="left";(null===(l=Le.current)||void 0===l?void 0:l.contains(u))&&(c="right");Xt(),Ee.current&&$t(),xe(new Set),be([]),Te.current=[],ut(),tt.open?qi():ot(),requestAnimationFrame(function(){var n=function(){var n,e,t,i;if("string"==typeof o&&o.includes(S)){var r=o.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(n=Dt.current[l])||void 0===n?void 0:n.current:null===(e=At.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=Dt.current[o])||void 0===t?void 0:t.current:null===(i=At.current[o])||void 0===i?void 0:i.current}()||u;Qe(ii(n,e,i,o,t,r))})}},li=c(function(){null!==Ue.sectionIdx&&Ue.anchorEl?oi(n(n({},Ue),{open:!0})):ct()},[Ue,ct,oi]),ui=c(function(){var n=Ue.sectionIdx,e=Ue.isOrphan;ct(),ot(),null!==n&&(e?ne("No counterpart exists to connect to."):(Xt(),Ee.current&&$t(),be([]),Te.current=[],xe(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Ae.current&&Ae.current()},50)))},[Ue.sectionIdx,Ue.isOrphan,ct,ot,$t]),ci=c(function(){var n=Re.current;if(n){Re.current=null;var e=yt.findIndex(function(e){return e.id===n}),t=bt.findIndex(function(e){return e.id===n}),i=-1===e?R(yt,n):null,o=-1===t?R(bt,n):null,r=-1!==e?e:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=function(n,e,t,i){var o,r,l,u;return-1!==n?null!==(r=null===(o=t.current[n])||void 0===o?void 0:o.current)&&void 0!==r?r:null:e&&null!==(u=null===(l=i.current[e])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(n,e,t){void 0===t&&(t=30);var i=0,o=function(){var r=n();r&&0!==r.getBoundingClientRect().height?(Ce.current.add(r),E(r,e)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(qn)-1!==r&&Ke.current&&c(function(){return u(e,i,Et,Nt)},Ke.current),-1!==l&&Le.current&&c(function(){return u(t,o,Ft,kt)},Le.current);else{var d=He.current;if(!d)return;c(function(){return-1!==r?u(e,i,Et,Nt):u(t,o,Ft,kt)},d)}}},[yt,bt,qn,Et,Ft,Nt,kt,Ke,Le,He]),di=c(function(e){if(e){Xt(),$t(),xe(new Set),be([]),Te.current=[],ot(),ut();var t=yt.findIndex(function(n){return n.id===e}),i=bt.findIndex(function(n){return n.id===e}),o=-1===t?R(yt,e):null,r=-1===i?R(bt,e):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=-1!==i?i:r?Number(r.split("-")[0]):-1;Re.current=e,Zt(function(e){var t,i=n({},e),o=!1;-1!==l&&(i[t=qn?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==u&&(i[t=qn?"right-".concat(u):String(u)]||(i[t]=!0,o=!0));return o?i:e}),ei(function(e){var t=n({},e),i=!1,l=function(n){for(var e=n.split("-"),o=e[0],r=1;r<e.length;r++)o+="-".concat(e[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:e}),setTimeout(function(){requestAnimationFrame(function(){Re.current===e&&ai.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(e,'" not found'))}},[yt,bt,qn,Zt,ei,$t,ot,ut]),ai=r(ci);u(function(){ai.current=ci},[ci]);var si=r(null),vi=r(null),fi=r(null),pi=r(null),gi=r(null),hi=r(null),xi=o([]),mi=xi[0],yi=xi[1];r(null);var bi=o(null),Si=bi[0],Ri=bi[1];u(function(){if(st){var n=dt.fields.find(function(n){return n.analysisKey===st||n.key===st});if(n){var e=Tt.current[n.key]||_t.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[st,dt.fields]);var Ci=c(function(n){var e,t,i,o,r,l,u,c,d,a=null===(e=null==Ot?void 0:Ot.rule_difference_comparison)||void 0===e?void 0:e.fields;if(!a||!a[n])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[n],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var f=s.mappings[0]||{};return{score:s.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[Ot]),Ii=c(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=yt[e],qn&&l){var c=bt.filter(function(n){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});u=c.find(function(n){return n.evaluationResult})||c[0]}else u=bt[e];else if(u=bt[e],qn&&u){var d=yt.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(u.selfIndex)});l=d.find(function(n){return n.evaluationResult})||d[0]}else l=yt[e];var a=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,s=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,v=!(!(null==l?void 0:l.cognitiveData)&&!(null==u?void 0:u.cognitiveData));if(!a&&!s&&!v)return n(n({},b(N)),{label:"Not Defined"});var f=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==u?void 0:u.evaluationResult)&&void 0!==o?o:null,p=C(f),g=I(f);return n(n({},b(g)),null!=f?{label:null!==(r=p)&&void 0!==r?r:""}:{label:null})},[yt,bt,De,dt,qn]),wi=c(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=yt[u[0]],d=bt[u[0]],a=1;a<u.length;a++)(null==c?void 0:c.subsections)&&(c=c.subsections[u[a]]),(null==d?void 0:d.subsections)&&(d=d.subsections[u[a]]);if(!c&&!d)return null;var s=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,v=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,f=m(null==c?void 0:c.id)||m(null==d?void 0:d.id)||"",p=!(!(null==c?void 0:c.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!s&&!v&&!p)return n(n({},b(N)),{label:"Not Defined"});null!==(i=null!==(t=null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||f&&(null===(o=De[f])||void 0===o||o.relevance_score);var g=null!==(l=null!==(r=null==c?void 0:c.evaluationResult)&&void 0!==r?r:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,h=C(g),x=I(g);return n(n({},b(x)),null!=g?{label:null!=h?h:""}:{label:null})},[yt,bt,De,dt]),Bi=c(function(e,t){var i,o,r,l,u,c,d,a,s,v,f,p,g,h,x,m,y;if(!e||null==t)return null;var S=null!==(d=null!==(u=null!==(o=null===(i=null==Pn?void 0:Pn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Bn?void 0:Bn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==Bn?void 0:Bn[e])||void 0===c?void 0:c.evaluation_result)&&void 0!==d?d:null;if(!S||"object"!=typeof S)return null;var R=null!==(f=null!==(s=null===(a=null==S?void 0:S.deviations)||void 0===a?void 0:a[t])&&void 0!==s?s:null===(v=null==S?void 0:S.deviation_entries)||void 0===v?void 0:v[t])&&void 0!==f?f:null==S?void 0:S[t],C=null!==(y=null!==(h=null===(g=null===(p=null==R?void 0:R.evaluation_outputs)||void 0===p?void 0:p.metadata)||void 0===g?void 0:g.label_color)&&void 0!==h?h:null===(m=null===(x=null==S?void 0:S.evaluation_outputs)||void 0===x?void 0:x.metadata)||void 0===m?void 0:m.label_color)&&void 0!==y?y:N;return n(n({},b(C)),{label:null})},[Pn,Bn]),Ti=c(function(){Xt(),Zt({}),ei({}),$t(),xe(new Set),be([]),Te.current=[],ot(),ut(),ct(),requestAnimationFrame(function(){Ae.current&&Ae.current()})},[Zt,ei,$t,ot,ut,ct]),_i=l(function(){return Object.values(Qt).some(Boolean)||Object.values(ni).some(Boolean)},[Qt,ni]),Ei=c(function(){var n,e,t,i,o,r,l,u,c,d,a,s,v,f,p,g,h,x,m,y,b,R,C;if(!Ye.current&&!Ie.current){Ye.current=!0;try{if(!si.current)return;var I=function(n){var e=n.split("-"),t=e[0];if(!Qt[t]&&!1===qn)return!1;if(qn&&!Qt["left-".concat(t)]&&!Qt["right-".concat(t)]&&!Qt[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!ni[i])return!1;return!0},T=si.current.getBoundingClientRect();ke({width:T.width,height:T.height});var _=[];if(St.forEach(function(n){var e,t,i=n.key,o=null===(e=Tt.current[i])||void 0===e?void 0:e.current,r=null===(t=_t.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")}),!Ie.current){for(var E=0;E<Math.max(yt.length,bt.length);E++){var F=null===(n=Et.current[E])||void 0===n?void 0:n.current,A=null===(e=Ft.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),A&&(A.style.height="auto",A.style.minHeight="0px")}qn||Object.keys(Nt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Nt.current[n])||void 0===e?void 0:e.current,o=null===(t=kt.current[n])||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 D={};St.forEach(function(n){var e,t,i=n.key,o=null===(e=Tt.current[i])||void 0===e?void 0:e.current,r=null===(t=_t.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();D[i]=Math.max(l.height,u.height)}});var M={left:{},right:{}},N={};if(!Ie.current)if(qn){if(te&&null!==ve)if("number"==typeof ve){var k=ve,P=yt[k],H=null===(o=Et.current[k])||void 0===o?void 0:o.current;H&&P&&(P.refIndexes||[]).forEach(function(n){var e,t=bt.findIndex(function(e){return e.selfIndex===n}),i=null===(e=Ft.current[t])||void 0===e?void 0:e.current;if(i&&(Qt["left-".concat(k)]||Qt["right-".concat(t)])){var o=Math.max(H.getBoundingClientRect().height,i.getBoundingClientRect().height);M.left[k]=Math.max(M.left[k]||0,o),M.right[t]=Math.max(M.right[t]||0,o)}})}else{var j=ve.split(S)[2];if(j){F=null===(r=Nt.current[j])||void 0===r?void 0:r.current,A=null===(l=kt.current[j])||void 0===l?void 0:l.current;if(F&&A){L=Math.max(F.getBoundingClientRect().height,A.getBoundingClientRect().height);N[j]=Math.max(N[j]||0,L)}}}}else{Object.keys(Nt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Nt.current[n])||void 0===e?void 0:e.current,o=null===(t=kt.current[n])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);N[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(yt.length,bt.length);E++){var F=null===(t=Et.current[E])||void 0===t?void 0:t.current,A=null===(i=Ft.current[E])||void 0===i?void 0:i.current;if(F&&A){var L=Math.max(F.getBoundingClientRect().height,A.getBoundingClientRect().height);M.left[E]=L,M.right[E]=L}}}if(St.forEach(function(n){var e,t,i=n.key,o=null===(e=Tt.current[i])||void 0===e?void 0:e.current,r=null===(t=_t.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=D[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Ie.current||(Object.entries(M.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Et.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(M.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Ft.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),qn||Object.keys(N).forEach(function(n){var e,t,i=null===(e=Nt.current[n])||void 0===e?void 0:e.current,o=null===(t=kt.current[n])||void 0===t?void 0:t.current;if(i&&o&&N[n]){var r=N[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),qn)yt.forEach(function(n,e){var t;(null===(t=Et.current[e])||void 0===t?void 0:t.current)&&(n.refIndexes||[]).forEach(function(n){var t,i,o,r,l,u,c,d,a,s,v=bt.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var f=null===(t=At.current[e])||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-T.left,m=h.left-T.left,y=g.top+g.height/2-T.top,b=h.top+h.height/2-T.top;if(te&&ve===e){var S=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=Le.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(d=null===(c=Ke.current)||void 0===c?void 0:c.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=Le.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),w=g.top+g.height/2,B=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(w,S,C)-T.top,b=E(B,R,I)-T.top}var F=Ii(e);F&&_.push({id:"line-".concat(e,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:F,sectionIdx:e,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(yt.length,bt.length);E++){var O=null===(u=Et.current[E])||void 0===u?void 0:u.current,z=null===(c=Ft.current[E])||void 0===c?void 0:c.current;if(O&&z){var W=O.getBoundingClientRect(),q=z.getBoundingClientRect(),K=Math.max(W.top,q.top)+18-T.top,Y=(null===(d=bt[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=Ii(E))&&_.push({id:Y,x1:W.right-T.left,y1:K,x2:q.left-T.left,y2:K,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=yt[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=bt[E])||void 0===s?void 0:s.cognitiveData)||Y&&De[Y]),isSubSection:!1})}}Object.keys(Nt.current).forEach(function(n){var e,t,i,o,r,l;if(I(n)){var u=null===(e=Nt.current[n])||void 0===e?void 0:e.current,c=null===(t=kt.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var d=n.split("-").map(Number),a=yt[d[0]],s=bt[d[0]],v=1;v<d.length;v++)(null==a?void 0:a.subsections)&&(a=a.subsections[d[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[d[v]]);var f=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&w(a.title)),p=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&w(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&w(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&w(s.content));if(f&&p||g&&h){var x=u.getBoundingClientRect(),m=c.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-T.top,b=wi(n);b&&"Not Defined"!==b.label&&_.push({id:"subsec-".concat(n),x1:x.right-T.left,y1:y,x2:m.left-T.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:n,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(te&&"string"==typeof ve&&ve.includes(S)){var V=ve.split(S),X=V[0],$=V[1],G=V[2],J=(V[3],"".concat(X).concat(S).concat($)),U=null===(v=At.current[J])||void 0===v?void 0:v.current,Q=null===(f=Dt.current[J])||void 0===f?void 0:f.current;if(U&&Q){var Z,nn=U.getBoundingClientRect(),en=Q.getBoundingClientRect(),tn=nn.right-T.left,on=en.left-T.left,rn=nn.top+nn.height/2-T.top,ln=en.top+en.height/2-T.top;if(qn){var un=null!==(g=null===(p=Ke.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(x=null===(h=Le.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,dn=un+(null!==(y=null===(m=Ke.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),an=cn+(null!==(R=null===(b=Le.current)||void 0===b?void 0:b.clientHeight)&&void 0!==R?R:1/0),sn=function(n,e,t){return Math.max(e,Math.min(t,n))};rn=sn(nn.top+nn.height/2,un,dn)-T.top,ln=sn(en.top+en.height/2,cn,an)-T.top}(Z=null!==(C=Bi(X,$))&&void 0!==C?C:wi(G))&&_.push({id:"line-subsec-".concat(J),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(G.split("-")[0]),isSubSection:!0,subSectionKeyPath:ve})}}if(yi(_),gi.current&&hi.current){var vn=gi.current.getBoundingClientRect(),fn=hi.current.getBoundingClientRect(),pn=(vn.top+vn.height/2-T.top+fn.top+fn.height/2-T.top)/2;Ri({x1:vn.right-T.left,x2:fn.left-T.left,y:pn})}else Ri(null);if(he.size>0){var gn=[],hn=Ke.current,xn=Le.current;if(hn&&xn){var mn=[],yn=hn.getBoundingClientRect().top,bn=xn.getBoundingClientRect().top,Sn=yn+hn.clientHeight,Rn=bn+xn.clientHeight,Cn=hn.scrollTop,In=xn.scrollTop,wn=T.top,Bn=function(n,e,t){return Math.max(e,Math.min(t,n))};he.forEach(function(n){var e,t,i,o,r,l;if("string"==typeof n&&n.includes(S)){var u=n.split(S),c=u[0],d=u[1],a=u[2],s=(u[3],"".concat(c).concat(S).concat(d)),v=null===(e=At.current[s])||void 0===e?void 0:e.current,f=null===(t=Dt.current[s])||void 0===t?void 0:t.current;if(!v||!f)return;var p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=null!==(i=Bi(c,d))&&void 0!==i?i:wi(a),x=(P=p.right-T.left)+.5*((H=g.left-T.left-0)-P),m=p.top+p.height/2,y=g.top+g.height/2,b=m-yn+Cn,R=y-bn+In,C="conn-subsec-".concat(s);mn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:H,containerTop:wn,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var I=Bn(m,yn,Sn),w=Bn(y,bn,Rn),_=I-wn,E=w-wn,F=y>=bn-4&&y<=Rn+4,A="";A=(j=m>=yn-4&&m<=Sn+4)&&F?B(P,_,H,E):j&&!F?"M ".concat(P,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!j&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(H,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:A,style:h,leftIdx:n,rhsArrayIdx:n})}else if(qn){var D=n,M=yt[D];if(!(null===(l=null==M?void 0:M.refIndexes)||void 0===l?void 0:l.length))return;M.refIndexes.forEach(function(n){var e,t,i=bt.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=At.current[D])||void 0===e?void 0:e.current,r=null===(t=Dt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=Ii(D),d=l.right-T.left,a=u.left-T.left-0,s=d+.5*(a-d),v=l.top+l.height/2,f=u.top+u.height/2,p=v-yn+Cn,g=f-bn+In,h="conn-".concat(D,"-").concat(i);mn.push({lhsScrollY:p,rhsScrollY:g,x1:d,x2:a,containerTop:wn,leftIdx:D,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var x=Bn(v,yn,Sn),m=Bn(f,bn,Rn),y=x-wn,b=m-wn,S=v>=yn-4&&v<=Sn+4,R=f>=bn-4&&f<=Rn+4,C="";C=S&&R?B(d,y,a,b):S&&!R?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(a,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),gn.push({id:h,pathD:C,style:c,leftIdx:D,rhsArrayIdx:i})}}})}else{var N=n,k=N;v=null===(o=At.current[N])||void 0===o?void 0:o.current,f=null===(r=Dt.current[k])||void 0===r?void 0:r.current;if(!v||!f)return;var P,H;p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=Ii(N),x=(P=p.right-T.left)+.5*((H=g.left-T.left-0)-P),m=p.top+p.height/2,y=g.top+g.height/2,b=m-yn+Cn,R=y-bn+In,C="conn-".concat(N,"-").concat(k);mn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:H,containerTop:wn,leftIdx:N,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var j;I=Bn(m,yn,Sn),w=Bn(y,bn,Rn),_=I-wn,E=w-wn,F=y>=bn-4&&y<=Rn+4,A="";A=(j=m>=yn-4&&m<=Sn+4)&&F?B(P,_,H,E):j&&!F?"M ".concat(P,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!j&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(H,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:A,style:h,leftIdx:N,rhsArrayIdx:k})}}),Te.current=mn}be(gn)}else be([]),Te.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{Ye.current=!1}}},[St,yt,bt,De,dt,Ci,Ii,Bi,qn,te,ve,he,Qt,ni]),Fi=c(function(){var n,e,t,i,o,r,l,u,c,d,a,s,v,f,p=Te.current;if(p.length&&!Ie.current){var g=null!==(e=null===(n=Ke.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=Le.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,m=null!==(u=null===(l=Le.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(d=null===(c=Ke.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=Le.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,C=null!==(f=null===(v=si.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,I=function(n,e,t){return Math.max(e,Math.min(t,n))};p.forEach(function(n){var e=n.lhsScrollY-g+y,t=n.rhsScrollY-h+b,i=Be.current[n.styleId+"-stroke"],o=Be.current[n.styleId+"-bg"];if(i||o){var r,l=I(e,y,S),u=I(t,b,R),c=l-C,d=u-C,a=e>=y-4&&e<=S+4,s=t>=b-4&&t<=R+4,v=n.x1+.5*(n.x2-n.x1);r=a&&s?B(n.x1,c,n.x2,d):a&&!s?"M ".concat(n.x1,",").concat(c," L ").concat(v,",").concat(c," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(c," L ").concat(v,",").concat(d," L ").concat(n.x2,",").concat(d):"M ".concat(v,",").concat(c," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);u(function(){Ae.current=Ei},[Ei]);var Ai=r(null),Di=r(null),Mi=c(function(){Te.current.length>0&&!Ie.current||(null!==Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(function(){Ae.current(),Ai.current=null},50))},[]),Ni=c(function(){ae(!0),ue(!1),null!==Di.current&&clearTimeout(Di.current),null!==Ai.current&&(clearTimeout(Ai.current),Ai.current=null),Di.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,d,a;try{if(Te.current=[],Ee.current&&null!==Fe.current&&null!==fi.current){var s=Fe.current,v=fi.current,f="string"==typeof s&&s.includes(S),p=null,g=null,h=null,x=null;if(f){var m=s.split(S),y="".concat(m[0]).concat(S).concat(m[1]);p=(null===(n=At.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=Dt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=Nt.current[m[2]])||void 0===t?void 0:t.current)||(null===(i=Et.current[Number(m[2])])||void 0===i?void 0:i.current)||null,x=(null===(o=kt.current[m[3]])||void 0===o?void 0:o.current)||(null===(r=Ft.current[Number(m[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=Pt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=Et.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=Mt.current[v])||void 0===c?void 0:c.current)||null,x=(null===(d=Ft.current[v])||void 0===d?void 0:d.current)||null;if(p&&g&&h&&x){if(h.style.paddingTop="0px",x.style.paddingTop="0px",!qn){var b=p.getBoundingClientRect(),R=g.getBoundingClientRect(),C=b.top-R.top;C>0?x.style.paddingTop="".concat(C,"px"):C<0&&(h.style.paddingTop="".concat(Math.abs(C),"px"))}var I=Ke.current,w=Le.current;if(I&&w){var B=p.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,T=g.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop-(B-I.scrollTop);Math.abs(w.scrollTop-T)>1&&(w.scrollTop=T)}}}null===(a=Ae.current)||void 0===a||a.call(Ae),Ee.current&&ue(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{ae(!1),Di.current=null}},150)},[qn,yt,bt]),ki=c(function(n){var e,t,i,o,r,l,u,c,d,a;if(null!==Ve.current&&Xe.current&&Math.abs(n.currentTarget.scrollTop-Ve.current)<=2){var s=Xe.current;Ve.current=null,Xe.current=null,s()}if(!pe.current){if(qn||Mi(),Ee.current){var v=Fe.current,f=fi.current,p=Ke.current,g=Le.current;if(null!==v&&null!==f&&p&&g){var h="string"==typeof v&&v.includes(S)?null===(e=At.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===e?void 0:e.current:null===(t=Pt.current[v])||void 0===t?void 0:t.current,x="string"==typeof f&&f.includes(S)?null===(i=Dt.current["".concat(f.split(S)[0]).concat(S).concat(f.split(S)[1])])||void 0===i?void 0:i.current:null===(o=Mt.current[f])||void 0===o?void 0:o.current;if(h&&x&&pi.current){var m=void 0,y=void 0;if("string"==typeof v&&v.includes(S)){var b=v.split(S),R="".concat(b[0]).concat(S).concat(b[1]);m=null===(r=At.current[R])||void 0===r?void 0:r.current,y=null===(l=Dt.current[R])||void 0===l?void 0:l.current}else m=null===(u=At.current[v])||void 0===u?void 0:u.current,y=null===(c=Dt.current[f])||void 0===c?void 0:c.current;var C=null!==(a=null===(d=si.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,I=p.getBoundingClientRect().top,w=I+p.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var B=m.getBoundingClientRect(),T=y.getBoundingClientRect(),_=B.top+B.height/2;T.top,T.height;var E=((A=_,D=I,M=w,Math.max(D,Math.min(M,A)))-C).toString();pi.current.setAttribute("y1",E),pi.current.setAttribute("y2",E);var F=_>=I-4&&_<=w+4;pi.current.setAttribute("visibility",F?"visible":"hidden")}}}}var A,D,M;Te.current.length>0&&!_e.current&&(_e.current=!0,requestAnimationFrame(function(){Fi(),_e.current=!1}))}},[Fi,qn,Mi]),Pi=r(0),Hi=r(0),ji=r(0),Li=r(function(){});r(null),u(function(){Li.current=Ni},[Ni]),u(function(){var n=setTimeout(Mi,250),e=function(){return Li.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==Ai.current&&clearTimeout(Ai.current),null!==Di.current&&clearTimeout(Di.current),window.removeEventListener("resize",e)}},[xt,mt,Ot,St,Qt,ni,yt,bt,dt,Mi,te,ve,le,he]),u(function(){var n=function(n,e,t,i,o){e.current=n.getBoundingClientRect().width;var r=new ResizeObserver(function(n){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=n[n.length-1];if(c){var d=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(d-e.current)<1?o():(e.current=d,i())}})});return r.observe(n),r},e={current:null},t={current:null},i={current:null},o=[],r=[e,t,i];return je.current&&o.push(n(je.current,Pi,e,function(){return Li.current()},function(){})),He.current&&o.push(n(He.current,Hi,t,function(){return Li.current()},function(){return Ae.current()})),si.current&&o.push(n(si.current,ji,i,function(){return Li.current()},function(){return Ae.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),u(function(){Ee.current=te},[te]),u(function(){Fe.current=ve},[ve]);var Oi=c(function(n,e,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,u=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";ct(),null!=n&&(e?ne("No counterpart exists for this section."):(Xt(),te&&ve===n?r?$t():null==l||l():(xe(new Set([n])),be([]),Te.current=[],Un(!0),pe.current=!0,fe(n),Fe.current=n,ie(!0),Ee.current=!0,ue(!1),Oe.current&&(Oe.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),requestAnimationFrame(function(){var e,t,i,o,r,c="string"==typeof n&&n.includes(S),d=null,a=null,s=null;if(c){var v=n.split(S),f="".concat(v[0]).concat(S).concat(v[1]);d=(null===(e=At.current[f])||void 0===e?void 0:e.current)||null,a=(null===(t=Dt.current[f])||void 0===t?void 0:t.current)||null,s=a?n:null}else if(d=(null===(i=Pt.current[n])||void 0===i?void 0:i.current)||null,qn){var p=yt[n],g=(null==p?void 0:p.refIndexes)||[];if(g.length>0){var h=g[0],x=bt.findIndex(function(n){return n.selfIndex===h});-1!==x&&(a=(null===(r=Mt.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else a=(null===(o=Mt.current[n])||void 0===o?void 0:o.current)||null,s=a?n:null;fi.current=s;var m=Ke.current,y=Le.current,b=function(){!function(){var e,t,i,o,r,l,u,d,a,v,f,p,g=null,h=null,x=null,m=null;if(c){var y=n.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(e=Nt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=Et.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=kt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=Ft.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=At.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=Dt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(n),C=null!==s?Number(s):R;g=(null===(u=Et.current[R])||void 0===u?void 0:u.current)||null,h=(null===(d=Ft.current[C])||void 0===d?void 0:d.current)||null,x=(null===(a=At.current[R])||void 0===a?void 0:a.current)||(null===(v=Pt.current[R])||void 0===v?void 0:v.current)||g,m=(null===(f=Dt.current[C])||void 0===f?void 0:f.current)||(null===(p=Mt.current[C])||void 0===p?void 0:p.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=x.getBoundingClientRect(),w=m.getBoundingClientRect(),B=I.top-w.top;B>0?h.style.paddingTop="".concat(B,"px"):B<0&&(g.style.paddingTop="".concat(Math.abs(B),"px"))}}(),ue(!0),Ae.current&&Ae.current(),pe.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Un(!1),null==l||l()};if(!d||!m)return pe.current=!1,Un(!1),void(null==l||l());if(a&&y){if(!qn){var R=0;R="right"===u?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=He.current,I=(null==C?void 0:C.getBoundingClientRect().top)||0,w=C?C.scrollTop+R-I-150:0;return C?void T(C,w,200,b):void b()}var B=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,_=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=_-(B-m.scrollTop);F<0&&Oe.current&&(Oe.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var n,e=y.scrollHeight-y.clientHeight;if(F<0)n=0;else{if(F>e){var t=F-e;return ze.current&&(ze.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(y,F,E,b)})}n=F}T(y,n,E,b)})}else{var A=B-(_-y.scrollTop);A<0&&We.current&&(We.current.style.height="".concat(Math.abs(A),"px")),requestAnimationFrame(function(){var n,e=m.scrollHeight-m.clientHeight;if(A<0)n=0;else{if(A>e){var t=A-e;return qe.current&&(qe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(m,A,E,b)})}n=A}T(m,n,E,b)})}}else b()}))))},[ve,ct,bt,te,qn,yt,$t]),zi=c(function(n,e,t,i){var o,r="string"==typeof i?m(i).trim():m(null==i?void 0:i.deviation_summary).trim(),l=n.currentTarget;ut();var u="left";(null===(o=Le.current)||void 0===o?void 0:o.contains(l))&&(u="right");var c=function(){var n,t,i,o;if("string"==typeof e&&e.includes(S)){var r=e.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===u?null===(n=Dt.current[l])||void 0===n?void 0:n.current:null===(t=At.current[l])||void 0===t?void 0:t.current}return"right"===u?null===(i=Dt.current[e])||void 0===i?void 0:i.current:null===(o=At.current[e])||void 0===o?void 0:o.current};if(t)return $t(),xe(new Set),be([]),Te.current=[],void(r&&requestAnimationFrame(function(){var n=c()||l;it({open:!0,anchorEl:n,summary:i})}));Oi(e,t,r?{toggleIfSame:!1,sourceSide:u,onReady:function(){var n=c()||l;it({open:!0,anchorEl:n,summary:i})}}:{toggleIfSame:!1,sourceSide:u})},[Oi,ut,it,$t]),Wi=c(function(){var n,e=Ue.sectionIdx,t=Ue.isOrphan;if(ot(),null!=e){var i="left";Ue.anchorEl&&(null===(n=Le.current)||void 0===n?void 0:n.contains(Ue.anchorEl))&&(i="right"),Oi(e,t,{sourceSide:i})}},[Oi,Ue.isOrphan,Ue.sectionIdx,Ue.anchorEl,ot]),qi=c(function(){ot(),$t(),xe(new Set),be([]),Te.current=[]},[ot,$t]),Ki=null!==Ue.sectionIdx&&he.has(Ue.sectionIdx),Yi=K({proposedSections:yt,existingSections:bt,parentDeviationRecord:Rt,expandedSections:Qt,maintainRelativeOrder:!!qn,scrollContainerRef:He,leftContainerRef:Ke,lhsBadgeRefs:At,rhsBadgeRefs:Dt}),Vi=Yi.showDeviationNavigation,Xi=Yi.showOpenNodeRef,$i=l(function(){var n;if(!Hn)return null;var e=null===(n=null==Hn?void 0:Hn.id)||void 0===n?void 0:n.split(":")[0];for(var t in Rt){if((Rt[t]||[]).some(function(n){return n.id===e}))return t}return null},[Hn,Rt]),Gi=r({id:null,triggerMs:null}),Ji=r(null);u(function(){var t;if(null==Hn?void 0:Hn.id){var i=Number(Hn.trigger),o=Gi.current;if((null==o?void 0:o.triggerMs)!==i){if(!(Hn.id.includes(":")&&/:\d+$/.test(Hn.id)))return Gi.current={id:Hn.id,triggerMs:i},void di(Hn.id);var r=null===(t=null==Hn?void 0:Hn.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";Ji.current!==Hn.id&&(ot(),ut(),$t(),xe(new Set),be([]),Te.current=[],Ji.current=Hn.id);var d=!1,a=0,s=null,v=150,f=function(n,e){for(var t=function(n,i){if(!n)return null;if(n.id===e)return i;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=t(n.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<n.length;i++){var o=t(n[i],String(i));if(o)return o}return null},p=function(){var t,o,r,u;if(!d){var g=function(){Gi.current={id:Hn.id,triggerMs:i}},h=null,x=null;for(var m in Rt){var y=Rt[m].find(function(n){return n.id===l});if(y){h=m,x=y;break}}if(x&&h){var b=yt.findIndex(function(n){return n.id===h}),R=bt.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==R,I=f(yt,x.id),w=f(bt,x.id);if(I&&!w&&!C){var B=I.split("-"),T=Number(B[0]);if(qn){var _=null===(o=null===(t=yt[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],E=bt.findIndex(function(n){return n.selfIndex===_});-1!==E&&(T=E)}w=e([T],B.slice(1),!0).join("-")}if(I||w){var F=C||!I&&!!w,A=I?Number(I.split("-")[0]):b,D=w?Number(w.split("-")[0]):R;if(F){if(!(qn?!!Qt["right-".concat(D)]:!!Qt[String(D)])&&D>=0)return ti(D,"right"),a+=1,void(s=setTimeout(p,450))}else if(!(qn?!!Qt["left-".concat(A)]:!!Qt[String(A)])&&A>=0)return ti(A,"left"),a+=1,void(s=setTimeout(p,450));var M,N=I||"",k=w||"",P="".concat(x.id).concat(S).concat(c).concat(S).concat(N).concat(S).concat(k),H="".concat(x.id).concat(S).concat(c),j=null===(r=At.current[H])||void 0===r?void 0:r.current,L=null===(u=Dt.current[H])||void 0===u?void 0:u.current,O=F||!j&&!!L,z=O?L:j;if(M=qn?O?Le.current:Ke.current:He.current,z&&M){var W=z.getBoundingClientRect();if(0===W.height)return void((a+=1)<2?s=setTimeout(p,v):g());var q=M.getBoundingClientRect(),K=W.top-q.top+M.scrollTop-q.height/2+W.height/2+150,Y=function(){var e,t,i,o,r;if(!d){g();var l=window.getComputedStyle(z).color;j&&(j.style.transition="box-shadow 300ms ease-in-out",j.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){j&&(j.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var u=(null===(t=null===(e=x.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[c])||x,a=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!j&&!!L)){var s=O?(null===(o=Dt.current[H])||void 0===o?void 0:o.current)||L:(null===(r=At.current[H])||void 0===r?void 0:r.current)||j;return it({open:!0,anchorEl:s,summary:n(n({},u),{evaluation_outputs:a})}),void(null==jn||jn())}Oi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t=(null===(e=At.current[H])||void 0===e?void 0:e.current)||j;console.log("Summary data",a,u),it({open:!0,anchorEl:t,summary:n({},u)})}})}};Math.abs(M.scrollTop-K)<=2?Y():(Ve.current=K,Xe.current=Y,M.scrollTo({top:K,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if(Xe.current){Ve.current=null;var n=Xe.current;Xe.current=null,n()}},800))}else(a+=1)<2?s=setTimeout(p,v):g()}else(a+=1)<2?s=setTimeout(p,v):g()}else(a+=1)<2?s=setTimeout(p,v):g()}};return s=setTimeout(p,v),function(){d=!0,s&&clearTimeout(s)}}}},[Hn,Rt,yt,bt,qn,Qt,ti,Oi,it,di]);var Ui=function(n){var e=n.section,t=n.keyPath,o=n.depth,r=void 0===o?0:o,l=n.columnKey,u=void 0===l?"left":l,c=n.parentNodeId;return i(X,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:void 0===c?"":c,expandedSubSections:ni,setExpandedSubSections:ei,maintainRelativeOrder:qn||!1,proposedSections:yt,existingSections:bt,treeData:Bn,deviationNumberRegistry:Ct,connectedSections:he,activeSideBySideSection:ve,resolvedMarkdownStyles:Pe,getSubSectionRef:jt,getSubSectionCompareStyle:wi,getBadgeRef:Lt,openMoreFunctionsPopup:ri,openSummaryPopup:zi,showDeviationBadges:Yn,resetSideBySide:$t,setConnectedSections:xe,setConnectedLines:be,cachedConnectedPositions:Te,isProposingFix:On,proposingFixNodeId:zn})};return t(d,n({ref:je,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},qn?{}:{overflow:"visible"}),{position:"relative"})},{children:[Xn&&i(d,n({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:i(j,{})})),tt.open&&i($,{open:tt.open,anchorEl:tt.anchorEl,containerEl:vi.current,clipTopEl:gi.current,scrollContainerEl:He.current,onClose:qi,summary:tt.summary}),i(H,{open:Ue.open,anchorEl:Ue.anchorEl,sectionTitle:Ue.sectionTitle,referenceSectionTitle:Ue.refSectionTitle,onClose:ct,onOpenCognitiveCompare:li,onOpenSideBySide:Wi,onConnect:ui,isConnected:Ki,isOrphan:Ue.isOrphan}),Ge.open&&i(P,{open:Ge.open,popupRef:lt,position:Ze,popupConfig:Nn,onClose:function(){nt(null),Je(function(e){return n(n({},e),{open:!1})}),rt(null)},markdownStyles:Fn,sectionTitle:Ge.sectionTitle,referenceSectionTitle:Ge.refSectionTitle,cognitiveData:Ge.cognitiveData,anchorEl:Ge.anchorEl,sectionAnchorEl:Ge.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Ge.badgeStyle,docData:Ge.docData,deviationData:Ge.deviationData,isLoading:Ge.isLoading}),i(a,n({open:!!Zn,autoHideDuration:8e3,onClose:function(){return ne(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,n({onClose:function(){return ne(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Zn}))})),i(Y,{componentHeaderText:wn,displayConfig:Mn,maintainRelativeOrder:qn,onCollapseAll:Ti,showCollapseAll:_i,onToggleView:function(n){$n(!0),setTimeout(function(){Kn(!n),$t(),ot(),xe(new Set),be([]),Te.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){$n(!1)},600)})})},50)}}),i(d,n({ref:He,onScroll:ki,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:qn?"hidden":"auto",borderTop:zt&&Wt?"none":"1.5px solid #EEF0F4"}},{children:i(d,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},qn?{flex:1,minHeight:0}:{})},{children:t(d,n({ref:si,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},qn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:Se,style:{position:"absolute",top:0,left:0,width:Ne.width||"100%",height:Ne.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:de?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Si&&i("g",{children:i("line",{x1:Si.x1,y1:Si.y,x2:Si.x2,y2:Si.y,stroke:Vt.badgeBorder,strokeWidth:"1.5"})}),mi.map(function(e){var o,r,l,u,c,a,s=e.x1+.5*(e.x2-e.x1),v=(e.y1+e.y2)/2;if("Not Defined"===e.style.label&&!e.hasCognitive)return null;if(e.isSubSection?te&&ve===e.subSectionKeyPath&&le:te&&ve===e.sectionIdx&&le)return null;if(!qn){var f=e.isSubSection?B(e.x1,e.y1,e.x2,e.y2):"M ".concat(e.x1," ").concat(e.y1," L ").concat(e.x2," ").concat(e.y2),g=yt[e.sectionIdx]||{title:"",content:""},x=bt[e.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,x),e.isSubSection&&e.subSectionKeyPath){var m=e.subSectionKeyPath.includes(S)?e.subSectionKeyPath.split(S):[],y=m[2]||e.subSectionKeyPath,b=m[3]||y,R=y.split("-").map(Number),C=b.split("-").map(Number),I=null,w=null;R.length>0&&(I=yt[R[0]]),C.length>0&&(w=bt[C[0]]);var T=(null==I?void 0:I.title)||"",_=(null==w?void 0:w.title)||"";console.log("Root Parent Titles:",T,_);for(var E=1;E<R.length;E++)(null==I?void 0:I.subsections)&&(I=I.subsections[R[E]]);for(E=1;E<C.length;E++)(null==w?void 0:w.subsections)&&(w=w.subsections[C[E]]);I&&(g=n(n({},I),{title:T||I.title})),console.log("Base Section for Subsection Badge:",g),w&&(x=n(n({},w),{title:_||w.title})),console.log("Ref Section for Subsection Badge:",x)}var F=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),A=(null===(a=null===(c=null===(u=g.evaluationResult)||void 0===u?void 0:u.cognitive_decisioning)||void 0===c?void 0:c.decisioning_factors)||void 0===a?void 0:a.length)||!1,D=F||A;return t("g",{children:[i("path",{d:f,fill:"none",stroke:e.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",n({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,n({onClick:function(n){n.stopPropagation(),D&&(Ge.open&&et===e.id?ut():(rt(e.id),oi(ii(n.currentTarget,g,x,e.sectionIdx,e.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:e.style.badgeBg,color:e.style.badgeText,border:"1px solid ".concat(e.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:D?"pointer":"default"}},{children:[e.style.badgeText===N&&null==e.style.label?i(L,{color:e.style.badgeText}):0===e.style.label?"Same":e.style.label,i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),D&&i(p,{size:11,style:{transform:Ge.open&&et===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),i(G,{connectedLines:ye,pathRefs:Be})]})),t(d,n({sx:n({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},qn?{flex:1,overflow:"visible"}:{})},{children:[i(d,n({ref:gi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,n({title:pt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:pt}))}))})),t(d,n({ref:Ke,onScroll:ki,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&yt.map(function(e,o){var r,l,u=!e.title&&!e.content;if(qn&&u)return null;var c=e,a=Ii(o,"left"),s=qn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!bt[o],v=qn?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:o+1,f=he.has(o),p=y(c.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,n({ref:Ht(o),sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Et.current[o],sx:n({width:"100%",display:"flex",flexDirection:"column",minWidth:0},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"left",colRef:Ht("left-accordion-".concat(o)),mb:0,treeData:Bn,proposedSections:yt,existingSections:bt,deviationNumberRegistry:Ct,getSectionCompareStyle:Ii,getBadgeRef:Lt,connectedSections:he,openMoreFunctionsPopup:ri,openSummaryPopup:zi,deviationNodeIdToView:null==Hn?void 0:Hn.id,deviationTargetParentId:$i,parentNodeId:(null===(l=null==Bn?void 0:Bn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:qn?!!Qt["left-".concat(o)]:!!Qt[String(o)],onToggle:function(){qi(),ti(o,"left")},navigation:e.id?Vi[e.id]:null,showOpenNodeRef:Xi,resolvedMarkdownStyles:Pe,maintainRelativeOrder:qn,showDeviationBadges:Yn,renderSubSections:Ui,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&a&&t(d,n({ref:At.current[o],onClick:function(n){var t=qn?bt.find(function(n){var e;return null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)})||{title:"",content:""}:bt[o]||{title:"",content:""};ri(n,e,s,t,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var r=Mn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;console.log("LOG: Printing evaluationResult",r,c),zi(n,String(o),s,r)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:s?"default":"pointer",borderRight:"1px solid ".concat(a.badgeBorder),"&:hover":s?{}:{bgColor:"".concat(a.badgeBorder,"22")}}},{children:[null!=v&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!Mn.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):i(L,{color:a.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var t=qn?bt.find(function(n){var e;return(null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n))||{title:"",content:""}}):bt[o]||{title:"",content:""};ri(n,e,s,t,o,a)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(a.badgeBorder,"22")}}},{children:i(g,{size:11,color:a.badgeText})}))]}))]}))}),"left-row-".concat(o))}),i("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,n({ref:vi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,n({onClick:function(e){e.stopPropagation(),Ge.open&&et===qt?ut():(rt(qt),oi(ii(e.currentTarget,{title:"",content:"",evaluationResult:Kt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,qt,!0,n(n({},Vt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Vt.badgeBg,color:Vt.badgeText,border:"1px solid ".concat(Vt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Yt?Yt:i(L,{}),i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(p,{size:11,style:{transform:Ge.open&&et===qt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,n({sx:n({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},qn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Jn&&i(x,{sections:11}),i(d,n({ref:hi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,n({title:gt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:gt}))}))})),t(d,n({ref:Le,onScroll:ki,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Oe,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&bt.map(function(e,o){var r,l=e,u=[],c=!1,a=null,s=-1;if(qn){u=yt.filter(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0}).map(function(n){return n.selfIndex+1}),s=yt.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0});var v=yt.findIndex(function(n,e){var t;return he.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==v)&&(a=Ii(v))}else u=[o+1],(c=he.has(o))&&(a=Ii(o));var f=Ii(qn&&-1!==s?s:o);return i(d,n({ref:Mt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Ft.current[o],sx:n({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"right",colRef:Ht("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Bn?void 0:Bn.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:qn?!!Qt["right-".concat(o)]:!!Qt[String(o)],treeData:Bn,proposedSections:yt,existingSections:bt,deviationNumberRegistry:Ct,getBadgeRef:Lt,getSectionCompareStyle:Ii,connectedSections:he,openMoreFunctionsPopup:ri,openSummaryPopup:zi,deviationNodeIdToView:null==Hn?void 0:Hn.id,deviationTargetParentId:$i,onToggle:function(){qi(),ti(o,"right")},navigation:e.id?Vi[e.id]:null,showOpenNodeRef:Xi,resolvedMarkdownStyles:Pe,maintainRelativeOrder:qn,showDeviationBadges:Yn,renderSubSections:Ui,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&f&&i(d,n({ref:Dt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:f.badgeBg,color:f.badgeText,border:"1px solid ".concat(f.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:ze,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{J as default};
|
|
1
|
+
import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as u,useCallback as c}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as f}from"@mui/material";import{ChevronDown as p,EllipsisVertical as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import x from"./OverlayComponent.js";import{safeStringify as m,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,findKeyPathByNodeId as R,getFirstDeviationOutputValue as C,getFirstDeviationColor as I,hasValue as w,getBentArrowPath as B,smoothScrollTo as T,resetClauseHighlight as _,scrollAndHighlightClause as E}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as F,DEFAULT_FIELD_CONFIG as A,DEFAULT_COMPARISON_CONFIG as D}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as M,DEFAULT_DEVIAION_COLOR as N,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import P from"./CognitivePopup.js";import H from"./MoreFunctionsPopup.js";import j from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as O}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as W}from"./hooks/useSectionRefs.js";import{useAccordionState as q}from"./hooks/useAccordionState.js";import{useDeviationNavigation as K}from"./hooks/useDeviationNavigation.js";import Y from"./components/CompareHeader.js";import V from"./components/SectionAccordion.js";import X from"./components/SubSectionAccordion.js";import $ from"./components/CognitiveSummaryPopup.js";import G from"./components/connectedLines.js";var J=function(J){var U,Q,Z,nn,en,tn,on,rn,ln,un,cn,dn,an,sn,vn,fn,pn,gn,hn,xn,mn,yn,bn,Sn,Rn,Cn,In=J.componentHeaderText,wn=void 0===In?k:In,Bn=J.treeData,Tn=J.comparisonConfig,_n=J.leftColumnTitleText,En=J.rightColumnTitleText,Fn=J.markdownStyles,An=J.resetTrigger,Dn=J.displayConfig,Mn=void 0===Dn?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:Dn,Nn=J.popupConfig,kn=J.deviationData,Pn=void 0===kn?{}:kn,Hn=J.deviationNodeIdToView,jn=J.resetDeviationNodeId,Ln=J.isProposingFix,On=void 0!==Ln&&Ln,zn=J.proposingFixNodeId,Wn=o(Mn.maintainRelativeOrder),qn=Wn[0],Kn=Wn[1],Yn=!!qn||!!(null==Mn?void 0:Mn.showDeviationBadges),Vn=o(!1),Xn=Vn[0],$n=Vn[1],Gn=o(!1),Jn=Gn[0],Un=Gn[1],Qn=o(null),Zn=Qn[0],ne=Qn[1],ee=o(!1),te=ee[0],ie=ee[1],oe=o(null===(Q=null!==(U=null==Bn?void 0:Bn.newEvaluationResult)&&void 0!==U?U:null==Mn?void 0:Mn.enableDeviationSchemaBackwardCompatibility)||void 0===Q||Q)[0],re=o(!1),le=re[0],ue=re[1],ce=o(!1),de=ce[0],ae=ce[1],se=o(null),ve=se[0],fe=se[1],pe=r(!1),ge=o(new Set),he=ge[0],xe=ge[1],me=o([]),ye=me[0],be=me[1],Se=r(null),Re=r(null),Ce=r(new Set),Ie=r(!1),we=r(null),Be=r({}),Te=r([]),_e=r(!1),Ee=r(!1),Fe=r(null),Ae=r(function(){}),De=l(function(){return(null==Bn?void 0:Bn.cognitive_decisioning)||{}},[Bn]),Me=o({width:0,height:0}),Ne=Me[0],ke=Me[1],Pe=l(function(){return n(n({},F),Fn)},[Fn]),He=r(null),je=r(null),Le=r(null),Oe=r(null),ze=r(null),We=r(null),qe=r(null),Ke=r(null),Ye=r(!1),Ve=r(null),Xe=r(null),$e=z(He),Ge=$e.cognitivePopup,Je=$e.setCognitivePopup,Ue=$e.moreFunctions,Qe=$e.setMoreFunctions,Ze=$e.position,nt=$e.setPosition,et=$e.activeBadgeId,tt=$e.summaryPopup,it=$e.setSummaryPopup,ot=$e.closeSummaryPopup,rt=$e.setActiveBadgeId,lt=$e.popupRef,ut=$e.closeCognitivePopup,ct=$e.closeMoreFunctionsPopup,dt=l(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==Tn?void 0:Tn.fields)&&void 0!==n?n:A,thresholds:{high:null!==(t=null===(e=null==Tn?void 0:Tn.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:D.thresholds.high,medium:null!==(o=null===(i=null==Tn?void 0:Tn.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:D.thresholds.medium,exact:null!==(l=null===(r=null==Tn?void 0:Tn.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:D.thresholds.exact}}},[Tn]),at=o(null),st=at[0];at[1];var vt=null===(en=null===(Z=null==Bn?void 0:Bn.documents)||void 0===Z?void 0:Z[null===(nn=null==Bn?void 0:Bn.input_index_map)||void 0===nn?void 0:nn[0]])||void 0===en?void 0:en.title,ft=null===(rn=null===(tn=null==Bn?void 0:Bn.documents)||void 0===tn?void 0:tn[null===(on=null==Bn?void 0:Bn.input_index_map)||void 0===on?void 0:on[1]])||void 0===rn?void 0:rn.title,pt=m(_n||vt||"Uploaded Contract"),gt=m(En||ft||"Reference Template"),ht=O(Bn,qn,Pn,dt,oe),xt=ht.activeProposed,mt=ht.existingRule,yt=ht.proposedSections,bt=ht.existingSections,St=ht.visibleFields,Rt=ht.parentDeviationRecord,Ct=ht.deviationNumberRegistry,It=ht.parseError;u(function(){It&&ne("Failed to load comparison: ".concat(It))},[It]);var wt=yt.length>0||bt.length>0,Bt=W(St.map(function(n){return n.key}),Math.max(yt.length,bt.length)),Tt=Bt.leftRefs,_t=Bt.rightRefs,Et=Bt.sectionLeftRefs,Ft=Bt.sectionRightRefs,At=Bt.lhsBadgeRefs,Dt=Bt.rhsBadgeRefs,Mt=Bt.sectionRightRowRefs,Nt=Bt.subSectionLeftRefs,kt=Bt.subSectionRightRefs,Pt=Bt.sectionRowRefs,Ht=Bt.getSectionRowRef,jt=Bt.getSubSectionRef,Lt=Bt.getBadgeRef,Ot=mt.analysis,zt=m(null===(un=null===(ln=null==Ot?void 0:Ot.rule_difference_comparison)||void 0===ln?void 0:ln.summary)||void 0===un?void 0:un.overall_summary),Wt=!!zt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),qt=null!==(cn=null==Bn?void 0:Bn.base_root_id)&&void 0!==cn?cn:"-1";null==Bn||Bn[qt];var Kt=oe?null!==(bn=null!==(xn=Pn&&(null===(hn=null==Pn?void 0:Pn[qt])||void 0===hn?void 0:hn.evaluation_result))&&void 0!==xn?xn:null===(yn=null===(mn=null==Bn?void 0:Bn.nodes)||void 0===mn?void 0:mn[qt])||void 0===yn?void 0:yn.evaluation_result)&&void 0!==bn?bn:null:null!==(gn=null!==(sn=Pn&&(null===(an=null===(dn=null==Pn?void 0:Pn[qt])||void 0===dn?void 0:dn.evaluation_result)||void 0===an?void 0:an[0]))&&void 0!==sn?sn:null===(pn=null===(fn=null===(vn=null==Bn?void 0:Bn.nodes)||void 0===vn?void 0:vn[qt])||void 0===fn?void 0:fn.evaluation_result)||void 0===pn?void 0:pn[0])&&void 0!==gn?gn:null,Yt=y(Kt),Vt=b(null!==(Cn=null===(Rn=null===(Sn=null==Kt?void 0:Kt.evaluation_outputs)||void 0===Sn?void 0:Sn.metadata)||void 0===Rn?void 0:Rn.label_color)&&void 0!==Cn?Cn:""),Xt=function(){Ce.current.forEach(function(n){_(n)}),Ce.current.clear()},$t=c(function(){var n,e,t,i,o,r;Xt(),ie(!1),Ee.current=!1;var l=Fe.current,u=fi.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var c=l.split(S);(d=(null===(n=Nt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=Et.current[Number(c[2])])||void 0===e?void 0:e.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=Et.current[l])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==u)if("string"==typeof u&&u.includes(S)){c=u.split(S);(a=(null===(i=kt.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=Ft.current[Number(c[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=Ft.current[u])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}fe(null),Fe.current=null,fi.current=null,ue(!1),Un(!1),Oe.current&&(Oe.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px")},[]),Gt=c(function(){Xt(),$t(),xe(new Set),be([]),Te.current=[],yi([]),Ri(null),it(M),ut(),requestAnimationFrame(function(){var n;null===(n=Ae.current)||void 0===n||n.call(Ae)})},[]),Jt=r(Gt);u(function(){Jt.current=Gt},[Gt]),u(function(){An&&Jt.current()},[An]);var Ut=q({maintainRelativeOrder:!!qn,proposedSections:yt,existingSections:bt,activeSideBySideSection:ve,connectedSections:he,resetSideBySide:$t,setConnectedSections:xe,setConnectedLines:be,cachedConnectedPositions:Te,svgContainerRef:Se,isAnimatingRef:Ie,animationTimerRef:we,calculateLinesRef:Ae,sectionLeftRefs:Et,sectionRightRefs:Ft,subSectionLeftRefs:Nt,subSectionRightRefs:kt}),Qt=Ut.expandedSections,Zt=Ut.setExpandedSections,ni=Ut.expandedSubSections,ei=Ut.setExpandedSubSections,ti=Ut.toggleSection,ii=c(function(e,t,i,o,r,l,u){var c,d,a,s=m(null==t?void 0:t.id)||m(null==i?void 0:i.id)||"",v=(s?De[s]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:s,decisioning:[],gap:[],relevance_score:0},f=null!==(d=null===(c=Pt.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null;return{isLoading:null!==(a=null==Mn?void 0:Mn.isLoading)&&void 0!==a&&a,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:f,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Bn?void 0:Bn.documents,input_index_map:null==Bn?void 0:Bn.input_index_map},deviationData:function(){var e,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,u=function(e){var t=function(n){if(!n||"object"!=typeof n)return null;var e=null==n?void 0:n.deviation_entries;if(e&&"object"==typeof e){var t=Object.keys(e).sort(function(n,e){return Number(n)-Number(e)})[0];if(t&&e[t])return e[t]}var i=Object.keys(n).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,e){return Number(n)-Number(e)});if(i.length&&n[i[0]])return n[i[0]];var o=null==n?void 0:n.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(n,e){return Number(n)-Number(e)})[0];if(r&&o[r])return o[r]}return null}(e);return t?n(n({},e),{deviation_summary:(null==e?void 0:e.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==e?void 0:e.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==e?void 0:e.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==e?void 0:e.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==e?void 0:e.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==e?void 0:e.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):e};if(!("string"==typeof o&&o.includes(S)))return u(l);var c=o.split(S)[1];if(!c)return l;var d=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},a=(null===(e=null==d?void 0:d.deviation_entries)||void 0===e?void 0:e[c])||(null===(r=null==d?void 0:d.deviations)||void 0===r?void 0:r[c])||null;return a?n(n(n({},d),a),{deviation_summary:(null==a?void 0:a.deviation_summary)||(null==d?void 0:d.deviation_summary),deviation_title:(null==a?void 0:a.deviation_title)||(null==d?void 0:d.deviation_title),deviation_impact:(null==a?void 0:a.deviation_impact)||(null==d?void 0:d.deviation_impact),deviation_explanation:(null==a?void 0:a.deviation_explanation)||(null==d?void 0:d.deviation_explanation),evaluation_outputs:(null==a?void 0:a.evaluation_outputs)||(null==d?void 0:d.evaluation_outputs),cognitive_decisioning:(null==a?void 0:a.cognitive_decisioning)||(null==d?void 0:d.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[De,Bn]),oi=c(function(n){ct(),nt(null),Je(n)},[ct]),ri=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),Ue.open&&Ue.sectionIdx===o)ct();else{var u=n.currentTarget,c="left";(null===(l=Le.current)||void 0===l?void 0:l.contains(u))&&(c="right");Xt(),Ee.current&&$t(),xe(new Set),be([]),Te.current=[],ut(),tt.open?qi():ot(),requestAnimationFrame(function(){var n=function(){var n,e,t,i;if("string"==typeof o&&o.includes(S)){var r=o.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(n=Dt.current[l])||void 0===n?void 0:n.current:null===(e=At.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=Dt.current[o])||void 0===t?void 0:t.current:null===(i=At.current[o])||void 0===i?void 0:i.current}()||u;Qe(ii(n,e,i,o,t,r))})}},li=c(function(){null!==Ue.sectionIdx&&Ue.anchorEl?oi(n(n({},Ue),{open:!0})):ct()},[Ue,ct,oi]),ui=c(function(){var n=Ue.sectionIdx,e=Ue.isOrphan;ct(),ot(),null!==n&&(e?ne("No counterpart exists to connect to."):(Xt(),Ee.current&&$t(),be([]),Te.current=[],xe(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Ae.current&&Ae.current()},50)))},[Ue.sectionIdx,Ue.isOrphan,ct,ot,$t]),ci=c(function(){var n=Re.current;if(n){Re.current=null;var e=yt.findIndex(function(e){return e.id===n}),t=bt.findIndex(function(e){return e.id===n}),i=-1===e?R(yt,n):null,o=-1===t?R(bt,n):null,r=-1!==e?e:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=function(n,e,t,i){var o,r,l,u;return-1!==n?null!==(r=null===(o=t.current[n])||void 0===o?void 0:o.current)&&void 0!==r?r:null:e&&null!==(u=null===(l=i.current[e])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(n,e,t){void 0===t&&(t=30);var i=0,o=function(){var r=n();r&&0!==r.getBoundingClientRect().height?(Ce.current.add(r),E(r,e)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(qn)-1!==r&&Ke.current&&c(function(){return u(e,i,Et,Nt)},Ke.current),-1!==l&&Le.current&&c(function(){return u(t,o,Ft,kt)},Le.current);else{var d=He.current;if(!d)return;c(function(){return-1!==r?u(e,i,Et,Nt):u(t,o,Ft,kt)},d)}}},[yt,bt,qn,Et,Ft,Nt,kt,Ke,Le,He]),di=c(function(e){if(e){Xt(),$t(),xe(new Set),be([]),Te.current=[],ot(),ut();var t=yt.findIndex(function(n){return n.id===e}),i=bt.findIndex(function(n){return n.id===e}),o=-1===t?R(yt,e):null,r=-1===i?R(bt,e):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=-1!==i?i:r?Number(r.split("-")[0]):-1;Re.current=e,Zt(function(e){var t,i=n({},e),o=!1;-1!==l&&(i[t=qn?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==u&&(i[t=qn?"right-".concat(u):String(u)]||(i[t]=!0,o=!0));return o?i:e}),ei(function(e){var t=n({},e),i=!1,l=function(n){for(var e=n.split("-"),o=e[0],r=1;r<e.length;r++)o+="-".concat(e[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:e}),setTimeout(function(){requestAnimationFrame(function(){Re.current===e&&ai.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(e,'" not found'))}},[yt,bt,qn,Zt,ei,$t,ot,ut]),ai=r(ci);u(function(){ai.current=ci},[ci]);var si=r(null),vi=r(null),fi=r(null),pi=r(null),gi=r(null),hi=r(null),xi=o([]),mi=xi[0],yi=xi[1];r(null);var bi=o(null),Si=bi[0],Ri=bi[1];u(function(){if(st){var n=dt.fields.find(function(n){return n.analysisKey===st||n.key===st});if(n){var e=Tt.current[n.key]||_t.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[st,dt.fields]);var Ci=c(function(n){var e,t,i,o,r,l,u,c,d,a=null===(e=null==Ot?void 0:Ot.rule_difference_comparison)||void 0===e?void 0:e.fields;if(!a||!a[n])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[n],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var f=s.mappings[0]||{};return{score:s.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[Ot]),Ii=c(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=yt[e],qn&&l){var c=bt.filter(function(n){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});u=c.find(function(n){return n.evaluationResult})||c[0]}else u=bt[e];else if(u=bt[e],qn&&u){var d=yt.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(u.selfIndex)});l=d.find(function(n){return n.evaluationResult})||d[0]}else l=yt[e];var a=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,s=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,v=!(!(null==l?void 0:l.cognitiveData)&&!(null==u?void 0:u.cognitiveData));if(!a&&!s&&!v)return n(n({},b(N)),{label:"Not Defined"});var f=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==u?void 0:u.evaluationResult)&&void 0!==o?o:null,p=C(f),g=I(f);return n(n({},b(g)),null!=f?{label:null!==(r=p)&&void 0!==r?r:""}:{label:null})},[yt,bt,De,dt,qn]),wi=c(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=yt[u[0]],d=bt[u[0]],a=1;a<u.length;a++)(null==c?void 0:c.subsections)&&(c=c.subsections[u[a]]),(null==d?void 0:d.subsections)&&(d=d.subsections[u[a]]);if(!c&&!d)return null;var s=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,v=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,f=m(null==c?void 0:c.id)||m(null==d?void 0:d.id)||"",p=!(!(null==c?void 0:c.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!s&&!v&&!p)return n(n({},b(N)),{label:"Not Defined"});null!==(i=null!==(t=null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||f&&(null===(o=De[f])||void 0===o||o.relevance_score);var g=null!==(l=null!==(r=null==c?void 0:c.evaluationResult)&&void 0!==r?r:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,h=C(g),x=I(g);return n(n({},b(x)),null!=g?{label:null!=h?h:""}:{label:null})},[yt,bt,De,dt]),Bi=c(function(e,t){var i,o,r,l,u,c,d,a,s,v,f,p,g,h,x,m,y;if(!e||null==t)return null;var S=null!==(d=null!==(u=null!==(o=null===(i=null==Pn?void 0:Pn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Bn?void 0:Bn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==Bn?void 0:Bn[e])||void 0===c?void 0:c.evaluation_result)&&void 0!==d?d:null;if(!S||"object"!=typeof S)return null;var R=null!==(f=null!==(s=null===(a=null==S?void 0:S.deviations)||void 0===a?void 0:a[t])&&void 0!==s?s:null===(v=null==S?void 0:S.deviation_entries)||void 0===v?void 0:v[t])&&void 0!==f?f:null==S?void 0:S[t],C=null!==(y=null!==(h=null===(g=null===(p=null==R?void 0:R.evaluation_outputs)||void 0===p?void 0:p.metadata)||void 0===g?void 0:g.label_color)&&void 0!==h?h:null===(m=null===(x=null==S?void 0:S.evaluation_outputs)||void 0===x?void 0:x.metadata)||void 0===m?void 0:m.label_color)&&void 0!==y?y:N;return n(n({},b(C)),{label:null})},[Pn,Bn]),Ti=c(function(){Xt(),Zt({}),ei({}),$t(),xe(new Set),be([]),Te.current=[],ot(),ut(),ct(),requestAnimationFrame(function(){Ae.current&&Ae.current()})},[Zt,ei,$t,ot,ut,ct]),_i=l(function(){return Object.values(Qt).some(Boolean)||Object.values(ni).some(Boolean)},[Qt,ni]),Ei=c(function(){var n,e,t,i,o,r,l,u,c,d,a,s,v,f,p,g,h,x,m,y,b,R,C;if(!Ye.current&&!Ie.current){Ye.current=!0;try{if(!si.current)return;var I=function(n){var e=n.split("-"),t=e[0];if(!Qt[t]&&!1===qn)return!1;if(qn&&!Qt["left-".concat(t)]&&!Qt["right-".concat(t)]&&!Qt[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!ni[i])return!1;return!0},T=si.current.getBoundingClientRect();ke({width:T.width,height:T.height});var _=[];if(St.forEach(function(n){var e,t,i=n.key,o=null===(e=Tt.current[i])||void 0===e?void 0:e.current,r=null===(t=_t.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")}),!Ie.current){for(var E=0;E<Math.max(yt.length,bt.length);E++){var F=null===(n=Et.current[E])||void 0===n?void 0:n.current,A=null===(e=Ft.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),A&&(A.style.height="auto",A.style.minHeight="0px")}qn||Object.keys(Nt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Nt.current[n])||void 0===e?void 0:e.current,o=null===(t=kt.current[n])||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 D={};St.forEach(function(n){var e,t,i=n.key,o=null===(e=Tt.current[i])||void 0===e?void 0:e.current,r=null===(t=_t.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();D[i]=Math.max(l.height,u.height)}});var M={left:{},right:{}},N={};if(!Ie.current)if(qn){if(te&&null!==ve)if("number"==typeof ve){var k=ve,P=yt[k],H=null===(o=Et.current[k])||void 0===o?void 0:o.current;H&&P&&(P.refIndexes||[]).forEach(function(n){var e,t=bt.findIndex(function(e){return e.selfIndex===n}),i=null===(e=Ft.current[t])||void 0===e?void 0:e.current;if(i&&(Qt["left-".concat(k)]||Qt["right-".concat(t)])){var o=Math.max(H.getBoundingClientRect().height,i.getBoundingClientRect().height);M.left[k]=Math.max(M.left[k]||0,o),M.right[t]=Math.max(M.right[t]||0,o)}})}else{var j=ve.split(S)[2];if(j){F=null===(r=Nt.current[j])||void 0===r?void 0:r.current,A=null===(l=kt.current[j])||void 0===l?void 0:l.current;if(F&&A){L=Math.max(F.getBoundingClientRect().height,A.getBoundingClientRect().height);N[j]=Math.max(N[j]||0,L)}}}}else{Object.keys(Nt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Nt.current[n])||void 0===e?void 0:e.current,o=null===(t=kt.current[n])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);N[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(yt.length,bt.length);E++){var F=null===(t=Et.current[E])||void 0===t?void 0:t.current,A=null===(i=Ft.current[E])||void 0===i?void 0:i.current;if(F&&A){var L=Math.max(F.getBoundingClientRect().height,A.getBoundingClientRect().height);M.left[E]=L,M.right[E]=L}}}if(St.forEach(function(n){var e,t,i=n.key,o=null===(e=Tt.current[i])||void 0===e?void 0:e.current,r=null===(t=_t.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=D[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Ie.current||(Object.entries(M.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Et.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(M.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Ft.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),qn||Object.keys(N).forEach(function(n){var e,t,i=null===(e=Nt.current[n])||void 0===e?void 0:e.current,o=null===(t=kt.current[n])||void 0===t?void 0:t.current;if(i&&o&&N[n]){var r=N[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),qn)yt.forEach(function(n,e){var t;(null===(t=Et.current[e])||void 0===t?void 0:t.current)&&(n.refIndexes||[]).forEach(function(n){var t,i,o,r,l,u,c,d,a,s,v=bt.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var f=null===(t=At.current[e])||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-T.left,m=h.left-T.left,y=g.top+g.height/2-T.top,b=h.top+h.height/2-T.top;if(te&&ve===e){var S=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=Le.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(d=null===(c=Ke.current)||void 0===c?void 0:c.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=Le.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),w=g.top+g.height/2,B=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(w,S,C)-T.top,b=E(B,R,I)-T.top}var F=Ii(e);F&&_.push({id:"line-".concat(e,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:F,sectionIdx:e,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(yt.length,bt.length);E++){var O=null===(u=Et.current[E])||void 0===u?void 0:u.current,z=null===(c=Ft.current[E])||void 0===c?void 0:c.current;if(O&&z){var W=O.getBoundingClientRect(),q=z.getBoundingClientRect(),K=Math.max(W.top,q.top)+18-T.top,Y=(null===(d=bt[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=Ii(E))&&_.push({id:Y,x1:W.right-T.left,y1:K,x2:q.left-T.left,y2:K,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=yt[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=bt[E])||void 0===s?void 0:s.cognitiveData)||Y&&De[Y]),isSubSection:!1})}}Object.keys(Nt.current).forEach(function(n){var e,t,i,o,r,l;if(I(n)){var u=null===(e=Nt.current[n])||void 0===e?void 0:e.current,c=null===(t=kt.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var d=n.split("-").map(Number),a=yt[d[0]],s=bt[d[0]],v=1;v<d.length;v++)(null==a?void 0:a.subsections)&&(a=a.subsections[d[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[d[v]]);var f=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&w(a.title)),p=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&w(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&w(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&w(s.content));if(f&&p||g&&h){var x=u.getBoundingClientRect(),m=c.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-T.top,b=wi(n);b&&"Not Defined"!==b.label&&_.push({id:"subsec-".concat(n),x1:x.right-T.left,y1:y,x2:m.left-T.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:n,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(te&&"string"==typeof ve&&ve.includes(S)){var V=ve.split(S),X=V[0],$=V[1],G=V[2],J=(V[3],"".concat(X).concat(S).concat($)),U=null===(v=At.current[J])||void 0===v?void 0:v.current,Q=null===(f=Dt.current[J])||void 0===f?void 0:f.current;if(U&&Q){var Z,nn=U.getBoundingClientRect(),en=Q.getBoundingClientRect(),tn=nn.right-T.left,on=en.left-T.left,rn=nn.top+nn.height/2-T.top,ln=en.top+en.height/2-T.top;if(qn){var un=null!==(g=null===(p=Ke.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(x=null===(h=Le.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,dn=un+(null!==(y=null===(m=Ke.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),an=cn+(null!==(R=null===(b=Le.current)||void 0===b?void 0:b.clientHeight)&&void 0!==R?R:1/0),sn=function(n,e,t){return Math.max(e,Math.min(t,n))};rn=sn(nn.top+nn.height/2,un,dn)-T.top,ln=sn(en.top+en.height/2,cn,an)-T.top}(Z=null!==(C=Bi(X,$))&&void 0!==C?C:wi(G))&&_.push({id:"line-subsec-".concat(J),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(G.split("-")[0]),isSubSection:!0,subSectionKeyPath:ve})}}if(yi(_),gi.current&&hi.current){var vn=gi.current.getBoundingClientRect(),fn=hi.current.getBoundingClientRect(),pn=(vn.top+vn.height/2-T.top+fn.top+fn.height/2-T.top)/2;Ri({x1:vn.right-T.left,x2:fn.left-T.left,y:pn})}else Ri(null);if(he.size>0){var gn=[],hn=Ke.current,xn=Le.current;if(hn&&xn){var mn=[],yn=hn.getBoundingClientRect().top,bn=xn.getBoundingClientRect().top,Sn=yn+hn.clientHeight,Rn=bn+xn.clientHeight,Cn=hn.scrollTop,In=xn.scrollTop,wn=T.top,Bn=function(n,e,t){return Math.max(e,Math.min(t,n))};he.forEach(function(n){var e,t,i,o,r,l;if("string"==typeof n&&n.includes(S)){var u=n.split(S),c=u[0],d=u[1],a=u[2],s=(u[3],"".concat(c).concat(S).concat(d)),v=null===(e=At.current[s])||void 0===e?void 0:e.current,f=null===(t=Dt.current[s])||void 0===t?void 0:t.current;if(!v||!f)return;var p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=null!==(i=Bi(c,d))&&void 0!==i?i:wi(a),x=(P=p.right-T.left)+.5*((H=g.left-T.left-0)-P),m=p.top+p.height/2,y=g.top+g.height/2,b=m-yn+Cn,R=y-bn+In,C="conn-subsec-".concat(s);mn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:H,containerTop:wn,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var I=Bn(m,yn,Sn),w=Bn(y,bn,Rn),_=I-wn,E=w-wn,F=y>=bn-4&&y<=Rn+4,A="";A=(j=m>=yn-4&&m<=Sn+4)&&F?B(P,_,H,E):j&&!F?"M ".concat(P,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!j&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(H,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:A,style:h,leftIdx:n,rhsArrayIdx:n})}else if(qn){var D=n,M=yt[D];if(!(null===(l=null==M?void 0:M.refIndexes)||void 0===l?void 0:l.length))return;M.refIndexes.forEach(function(n){var e,t,i=bt.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=At.current[D])||void 0===e?void 0:e.current,r=null===(t=Dt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=Ii(D),d=l.right-T.left,a=u.left-T.left-0,s=d+.5*(a-d),v=l.top+l.height/2,f=u.top+u.height/2,p=v-yn+Cn,g=f-bn+In,h="conn-".concat(D,"-").concat(i);mn.push({lhsScrollY:p,rhsScrollY:g,x1:d,x2:a,containerTop:wn,leftIdx:D,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var x=Bn(v,yn,Sn),m=Bn(f,bn,Rn),y=x-wn,b=m-wn,S=v>=yn-4&&v<=Sn+4,R=f>=bn-4&&f<=Rn+4,C="";C=S&&R?B(d,y,a,b):S&&!R?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(a,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),gn.push({id:h,pathD:C,style:c,leftIdx:D,rhsArrayIdx:i})}}})}else{var N=n,k=N;v=null===(o=At.current[N])||void 0===o?void 0:o.current,f=null===(r=Dt.current[k])||void 0===r?void 0:r.current;if(!v||!f)return;var P,H;p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=Ii(N),x=(P=p.right-T.left)+.5*((H=g.left-T.left-0)-P),m=p.top+p.height/2,y=g.top+g.height/2,b=m-yn+Cn,R=y-bn+In,C="conn-".concat(N,"-").concat(k);mn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:H,containerTop:wn,leftIdx:N,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var j;I=Bn(m,yn,Sn),w=Bn(y,bn,Rn),_=I-wn,E=w-wn,F=y>=bn-4&&y<=Rn+4,A="";A=(j=m>=yn-4&&m<=Sn+4)&&F?B(P,_,H,E):j&&!F?"M ".concat(P,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!j&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(H,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:A,style:h,leftIdx:N,rhsArrayIdx:k})}}),Te.current=mn}be(gn)}else be([]),Te.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{Ye.current=!1}}},[St,yt,bt,De,dt,Ci,Ii,Bi,qn,te,ve,he,Qt,ni]),Fi=c(function(){var n,e,t,i,o,r,l,u,c,d,a,s,v,f,p=Te.current;if(p.length&&!Ie.current){var g=null!==(e=null===(n=Ke.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=Le.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,m=null!==(u=null===(l=Le.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(d=null===(c=Ke.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=Le.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,C=null!==(f=null===(v=si.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,I=function(n,e,t){return Math.max(e,Math.min(t,n))};p.forEach(function(n){var e=n.lhsScrollY-g+y,t=n.rhsScrollY-h+b,i=Be.current[n.styleId+"-stroke"],o=Be.current[n.styleId+"-bg"];if(i||o){var r,l=I(e,y,S),u=I(t,b,R),c=l-C,d=u-C,a=e>=y-4&&e<=S+4,s=t>=b-4&&t<=R+4,v=n.x1+.5*(n.x2-n.x1);r=a&&s?B(n.x1,c,n.x2,d):a&&!s?"M ".concat(n.x1,",").concat(c," L ").concat(v,",").concat(c," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(c," L ").concat(v,",").concat(d," L ").concat(n.x2,",").concat(d):"M ".concat(v,",").concat(c," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);u(function(){Ae.current=Ei},[Ei]);var Ai=r(null),Di=r(null),Mi=c(function(){Te.current.length>0&&!Ie.current||(null!==Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(function(){Ae.current(),Ai.current=null},50))},[]),Ni=c(function(){ae(!0),ue(!1),null!==Di.current&&clearTimeout(Di.current),null!==Ai.current&&(clearTimeout(Ai.current),Ai.current=null),Di.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,d,a;try{if(Te.current=[],Ee.current&&null!==Fe.current&&null!==fi.current){var s=Fe.current,v=fi.current,f="string"==typeof s&&s.includes(S),p=null,g=null,h=null,x=null;if(f){var m=s.split(S),y="".concat(m[0]).concat(S).concat(m[1]);p=(null===(n=At.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=Dt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=Nt.current[m[2]])||void 0===t?void 0:t.current)||(null===(i=Et.current[Number(m[2])])||void 0===i?void 0:i.current)||null,x=(null===(o=kt.current[m[3]])||void 0===o?void 0:o.current)||(null===(r=Ft.current[Number(m[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=Pt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=Et.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=Mt.current[v])||void 0===c?void 0:c.current)||null,x=(null===(d=Ft.current[v])||void 0===d?void 0:d.current)||null;if(p&&g&&h&&x){if(h.style.paddingTop="0px",x.style.paddingTop="0px",!qn){var b=p.getBoundingClientRect(),R=g.getBoundingClientRect(),C=b.top-R.top;C>0?x.style.paddingTop="".concat(C,"px"):C<0&&(h.style.paddingTop="".concat(Math.abs(C),"px"))}var I=Ke.current,w=Le.current;if(I&&w){var B=p.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,T=g.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop-(B-I.scrollTop);Math.abs(w.scrollTop-T)>1&&(w.scrollTop=T)}}}null===(a=Ae.current)||void 0===a||a.call(Ae),Ee.current&&ue(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{ae(!1),Di.current=null}},150)},[qn,yt,bt]),ki=c(function(n){var e,t,i,o,r,l,u,c,d,a;if(null!==Ve.current&&Xe.current&&Math.abs(n.currentTarget.scrollTop-Ve.current)<=2){var s=Xe.current;Ve.current=null,Xe.current=null,s()}if(!pe.current){if(qn||Mi(),Ee.current){var v=Fe.current,f=fi.current,p=Ke.current,g=Le.current;if(null!==v&&null!==f&&p&&g){var h="string"==typeof v&&v.includes(S)?null===(e=At.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===e?void 0:e.current:null===(t=Pt.current[v])||void 0===t?void 0:t.current,x="string"==typeof f&&f.includes(S)?null===(i=Dt.current["".concat(f.split(S)[0]).concat(S).concat(f.split(S)[1])])||void 0===i?void 0:i.current:null===(o=Mt.current[f])||void 0===o?void 0:o.current;if(h&&x&&pi.current){var m=void 0,y=void 0;if("string"==typeof v&&v.includes(S)){var b=v.split(S),R="".concat(b[0]).concat(S).concat(b[1]);m=null===(r=At.current[R])||void 0===r?void 0:r.current,y=null===(l=Dt.current[R])||void 0===l?void 0:l.current}else m=null===(u=At.current[v])||void 0===u?void 0:u.current,y=null===(c=Dt.current[f])||void 0===c?void 0:c.current;var C=null!==(a=null===(d=si.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,I=p.getBoundingClientRect().top,w=I+p.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var B=m.getBoundingClientRect(),T=y.getBoundingClientRect(),_=B.top+B.height/2;T.top,T.height;var E=((A=_,D=I,M=w,Math.max(D,Math.min(M,A)))-C).toString();pi.current.setAttribute("y1",E),pi.current.setAttribute("y2",E);var F=_>=I-4&&_<=w+4;pi.current.setAttribute("visibility",F?"visible":"hidden")}}}}var A,D,M;Te.current.length>0&&!_e.current&&(_e.current=!0,requestAnimationFrame(function(){Fi(),_e.current=!1}))}},[Fi,qn,Mi]),Pi=r(0),Hi=r(0),ji=r(0),Li=r(function(){});r(null),u(function(){Li.current=Ni},[Ni]),u(function(){var n=setTimeout(Mi,250),e=function(){return Li.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==Ai.current&&clearTimeout(Ai.current),null!==Di.current&&clearTimeout(Di.current),window.removeEventListener("resize",e)}},[xt,mt,Ot,St,Qt,ni,yt,bt,dt,Mi,te,ve,le,he]),u(function(){var n=function(n,e,t,i,o){e.current=n.getBoundingClientRect().width;var r=new ResizeObserver(function(n){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=n[n.length-1];if(c){var d=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(d-e.current)<1?o():(e.current=d,i())}})});return r.observe(n),r},e={current:null},t={current:null},i={current:null},o=[],r=[e,t,i];return je.current&&o.push(n(je.current,Pi,e,function(){return Li.current()},function(){})),He.current&&o.push(n(He.current,Hi,t,function(){return Li.current()},function(){return Ae.current()})),si.current&&o.push(n(si.current,ji,i,function(){return Li.current()},function(){return Ae.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),u(function(){Ee.current=te},[te]),u(function(){Fe.current=ve},[ve]);var Oi=c(function(n,e,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,u=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";ct(),null!=n&&(e?ne("No counterpart exists for this section."):(Xt(),te&&ve===n?r?$t():null==l||l():(xe(new Set([n])),be([]),Te.current=[],Un(!0),pe.current=!0,fe(n),Fe.current=n,ie(!0),Ee.current=!0,ue(!1),Oe.current&&(Oe.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),requestAnimationFrame(function(){var e,t,i,o,r,c="string"==typeof n&&n.includes(S),d=null,a=null,s=null;if(c){var v=n.split(S),f="".concat(v[0]).concat(S).concat(v[1]);d=(null===(e=At.current[f])||void 0===e?void 0:e.current)||null,a=(null===(t=Dt.current[f])||void 0===t?void 0:t.current)||null,s=a?n:null}else if(d=(null===(i=Pt.current[n])||void 0===i?void 0:i.current)||null,qn){var p=yt[n],g=(null==p?void 0:p.refIndexes)||[];if(g.length>0){var h=g[0],x=bt.findIndex(function(n){return n.selfIndex===h});-1!==x&&(a=(null===(r=Mt.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else a=(null===(o=Mt.current[n])||void 0===o?void 0:o.current)||null,s=a?n:null;fi.current=s;var m=Ke.current,y=Le.current,b=function(){!function(){var e,t,i,o,r,l,u,d,a,v,f,p,g=null,h=null,x=null,m=null;if(c){var y=n.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(e=Nt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=Et.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=kt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=Ft.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=At.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=Dt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(n),C=null!==s?Number(s):R;g=(null===(u=Et.current[R])||void 0===u?void 0:u.current)||null,h=(null===(d=Ft.current[C])||void 0===d?void 0:d.current)||null,x=(null===(a=At.current[R])||void 0===a?void 0:a.current)||(null===(v=Pt.current[R])||void 0===v?void 0:v.current)||g,m=(null===(f=Dt.current[C])||void 0===f?void 0:f.current)||(null===(p=Mt.current[C])||void 0===p?void 0:p.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=x.getBoundingClientRect(),w=m.getBoundingClientRect(),B=I.top-w.top;B>0?h.style.paddingTop="".concat(B,"px"):B<0&&(g.style.paddingTop="".concat(Math.abs(B),"px"))}}(),ue(!0),Ae.current&&Ae.current(),pe.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Un(!1),null==l||l()};if(!d||!m)return pe.current=!1,Un(!1),void(null==l||l());if(a&&y){if(!qn){var R=0;R="right"===u?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=He.current,I=(null==C?void 0:C.getBoundingClientRect().top)||0,w=C?C.scrollTop+R-I-150:0;return C?void T(C,w,200,b):void b()}var B=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,_=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=_-(B-m.scrollTop);F<0&&Oe.current&&(Oe.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var n,e=y.scrollHeight-y.clientHeight;if(F<0)n=0;else{if(F>e){var t=F-e;return ze.current&&(ze.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(y,F,E,b)})}n=F}T(y,n,E,b)})}else{var A=B-(_-y.scrollTop);A<0&&We.current&&(We.current.style.height="".concat(Math.abs(A),"px")),requestAnimationFrame(function(){var n,e=m.scrollHeight-m.clientHeight;if(A<0)n=0;else{if(A>e){var t=A-e;return qe.current&&(qe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(m,A,E,b)})}n=A}T(m,n,E,b)})}}else b()}))))},[ve,ct,bt,te,qn,yt,$t]),zi=c(function(n,e,t,i){var o,r="string"==typeof i?m(i).trim():m(null==i?void 0:i.deviation_summary).trim(),l=n.currentTarget;ut();var u="left";(null===(o=Le.current)||void 0===o?void 0:o.contains(l))&&(u="right");var c=function(){var n,t,i,o;if("string"==typeof e&&e.includes(S)){var r=e.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===u?null===(n=Dt.current[l])||void 0===n?void 0:n.current:null===(t=At.current[l])||void 0===t?void 0:t.current}return"right"===u?null===(i=Dt.current[e])||void 0===i?void 0:i.current:null===(o=At.current[e])||void 0===o?void 0:o.current};if(t)return $t(),xe(new Set),be([]),Te.current=[],void(r&&requestAnimationFrame(function(){var n=c()||l;it({open:!0,anchorEl:n,summary:i})}));Oi(e,t,r?{toggleIfSame:!1,sourceSide:u,onReady:function(){var n=c()||l;it({open:!0,anchorEl:n,summary:i})}}:{toggleIfSame:!1,sourceSide:u})},[Oi,ut,it,$t]),Wi=c(function(){var n,e=Ue.sectionIdx,t=Ue.isOrphan;if(ot(),null!=e){var i="left";Ue.anchorEl&&(null===(n=Le.current)||void 0===n?void 0:n.contains(Ue.anchorEl))&&(i="right"),Oi(e,t,{sourceSide:i})}},[Oi,Ue.isOrphan,Ue.sectionIdx,Ue.anchorEl,ot]),qi=c(function(){ot(),$t(),xe(new Set),be([]),Te.current=[]},[ot,$t]),Ki=null!==Ue.sectionIdx&&he.has(Ue.sectionIdx),Yi=K({proposedSections:yt,existingSections:bt,parentDeviationRecord:Rt,expandedSections:Qt,maintainRelativeOrder:!!qn,scrollContainerRef:He,leftContainerRef:Ke,lhsBadgeRefs:At,rhsBadgeRefs:Dt}),Vi=Yi.showDeviationNavigation,Xi=Yi.showOpenNodeRef,$i=l(function(){var n;if(!Hn)return null;var e=null===(n=null==Hn?void 0:Hn.id)||void 0===n?void 0:n.split(":")[0];for(var t in Rt){if((Rt[t]||[]).some(function(n){return n.id===e}))return t}return null},[Hn,Rt]),Gi=r({id:null,triggerMs:null}),Ji=r(null);u(function(){var t;if(null==Hn?void 0:Hn.id){var i=Number(Hn.trigger),o=Gi.current;if((null==o?void 0:o.triggerMs)!==i){if(!(Hn.id.includes(":")&&/:\d+$/.test(Hn.id)))return Gi.current={id:Hn.id,triggerMs:i},void di(Hn.id);var r=null===(t=null==Hn?void 0:Hn.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";Ji.current!==Hn.id&&(ot(),ut(),$t(),xe(new Set),be([]),Te.current=[],Ji.current=Hn.id);var d=!1,a=0,s=null,v=150,f=function(n,e){for(var t=function(n,i){if(!n)return null;if(n.id===e)return i;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=t(n.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<n.length;i++){var o=t(n[i],String(i));if(o)return o}return null},p=function(){var t,o,r,u;if(!d){var g=function(){Gi.current={id:Hn.id,triggerMs:i}},h=null,x=null;for(var m in Rt){var y=Rt[m].find(function(n){return n.id===l});if(y){h=m,x=y;break}}if(x&&h){var b=yt.findIndex(function(n){return n.id===h}),R=bt.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==R,I=f(yt,x.id),w=f(bt,x.id);if(I&&!w&&!C){var B=I.split("-"),T=Number(B[0]);if(qn){var _=null===(o=null===(t=yt[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],E=bt.findIndex(function(n){return n.selfIndex===_});-1!==E&&(T=E)}w=e([T],B.slice(1),!0).join("-")}if(I||w){var F=C||!I&&!!w,A=I?Number(I.split("-")[0]):b,D=w?Number(w.split("-")[0]):R;if(F){if(!(qn?!!Qt["right-".concat(D)]:!!Qt[String(D)])&&D>=0)return ti(D,"right"),a+=1,void(s=setTimeout(p,450))}else if(!(qn?!!Qt["left-".concat(A)]:!!Qt[String(A)])&&A>=0)return ti(A,"left"),a+=1,void(s=setTimeout(p,450));var M,N=I||"",k=w||"",P="".concat(x.id).concat(S).concat(c).concat(S).concat(N).concat(S).concat(k),H="".concat(x.id).concat(S).concat(c),j=null===(r=At.current[H])||void 0===r?void 0:r.current,L=null===(u=Dt.current[H])||void 0===u?void 0:u.current,O=F||!j&&!!L,z=O?L:j;if(M=qn?O?Le.current:Ke.current:He.current,z&&M){var W=z.getBoundingClientRect();if(0===W.height)return void((a+=1)<2?s=setTimeout(p,v):g());var q=M.getBoundingClientRect(),K=W.top-q.top+M.scrollTop-q.height/2+W.height/2+150,Y=function(){var e,t,i,o,r;if(!d){g();var l=window.getComputedStyle(z).color;j&&(j.style.transition="box-shadow 300ms ease-in-out",j.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){j&&(j.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var u=(null===(t=null===(e=x.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[c])||x,a=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!j&&!!L)){var s=O?(null===(o=Dt.current[H])||void 0===o?void 0:o.current)||L:(null===(r=At.current[H])||void 0===r?void 0:r.current)||j;return it({open:!0,anchorEl:s,summary:n(n({},u),{evaluation_outputs:a})}),void(null==jn||jn())}Oi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t=(null===(e=At.current[H])||void 0===e?void 0:e.current)||j;console.log("Summary data",a,u),it({open:!0,anchorEl:t,summary:n({},u)})}})}};Math.abs(M.scrollTop-K)<=2?Y():(Ve.current=K,Xe.current=Y,M.scrollTo({top:K,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if(Xe.current){Ve.current=null;var n=Xe.current;Xe.current=null,n()}},800))}else(a+=1)<2?s=setTimeout(p,v):g()}else(a+=1)<2?s=setTimeout(p,v):g()}else(a+=1)<2?s=setTimeout(p,v):g()}};return s=setTimeout(p,v),function(){d=!0,s&&clearTimeout(s)}}}},[Hn,Rt,yt,bt,qn,Qt,ti,Oi,it,di]);var Ui=function(n){var e=n.section,t=n.keyPath,o=n.depth,r=void 0===o?0:o,l=n.columnKey,u=void 0===l?"left":l,c=n.parentNodeId;return i(X,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:void 0===c?"":c,expandedSubSections:ni,setExpandedSubSections:ei,maintainRelativeOrder:qn||!1,proposedSections:yt,existingSections:bt,treeData:Bn,deviationNumberRegistry:Ct,connectedSections:he,activeSideBySideSection:ve,resolvedMarkdownStyles:Pe,getSubSectionRef:jt,getSubSectionCompareStyle:wi,getBadgeRef:Lt,openMoreFunctionsPopup:ri,openSummaryPopup:zi,showDeviationBadges:Yn,resetSideBySide:$t,setConnectedSections:xe,setConnectedLines:be,cachedConnectedPositions:Te,isProposingFix:On,proposingFixNodeId:zn})};return t(d,n({ref:je,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},qn?{}:{overflow:"visible"}),{position:"relative"})},{children:[Xn&&i(d,n({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:i(j,{})})),tt.open&&i($,{open:tt.open,anchorEl:tt.anchorEl,containerEl:vi.current,clipTopEl:gi.current,scrollContainerEl:He.current,onClose:qi,summary:tt.summary}),i(H,{open:Ue.open,anchorEl:Ue.anchorEl,sectionTitle:Ue.sectionTitle,referenceSectionTitle:Ue.refSectionTitle,onClose:ct,onOpenCognitiveCompare:li,onOpenSideBySide:Wi,onConnect:ui,isConnected:Ki,isOrphan:Ue.isOrphan}),Ge.open&&i(P,{open:Ge.open,popupRef:lt,position:Ze,popupConfig:Nn,onClose:function(){nt(null),Je(function(e){return n(n({},e),{open:!1})}),rt(null)},markdownStyles:Fn,sectionTitle:Ge.sectionTitle,referenceSectionTitle:Ge.refSectionTitle,cognitiveData:Ge.cognitiveData,anchorEl:Ge.anchorEl,sectionAnchorEl:Ge.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Ge.badgeStyle,docData:Ge.docData,deviationData:Ge.deviationData,isLoading:Ge.isLoading}),i(a,n({open:!!Zn,autoHideDuration:8e3,onClose:function(){return ne(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,n({onClose:function(){return ne(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Zn}))})),i(Y,{componentHeaderText:wn,displayConfig:Mn,maintainRelativeOrder:qn,onCollapseAll:Ti,showCollapseAll:_i,onToggleView:function(n){$n(!0),setTimeout(function(){Kn(!n),$t(),ot(),xe(new Set),be([]),Te.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){$n(!1)},600)})})},50)}}),i(d,n({ref:He,onScroll:ki,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:"hidden",borderTop:zt&&Wt?"none":"1.5px solid #EEF0F4"}},{children:i(d,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},qn?{flex:1,minHeight:0}:{})},{children:t(d,n({ref:si,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},qn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:Se,style:{position:"absolute",top:0,left:0,width:Ne.width||"100%",height:Ne.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:de?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Si&&i("g",{children:i("line",{x1:Si.x1,y1:Si.y,x2:Si.x2,y2:Si.y,stroke:Vt.badgeBorder,strokeWidth:"1.5"})}),mi.map(function(e){var o,r,l,u,c,a,s=e.x1+.5*(e.x2-e.x1),v=(e.y1+e.y2)/2;if("Not Defined"===e.style.label&&!e.hasCognitive)return null;if(e.isSubSection?te&&ve===e.subSectionKeyPath&&le:te&&ve===e.sectionIdx&&le)return null;if(!qn){var f=e.isSubSection?B(e.x1,e.y1,e.x2,e.y2):"M ".concat(e.x1," ").concat(e.y1," L ").concat(e.x2," ").concat(e.y2),g=yt[e.sectionIdx]||{title:"",content:""},x=bt[e.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,x),e.isSubSection&&e.subSectionKeyPath){var m=e.subSectionKeyPath.includes(S)?e.subSectionKeyPath.split(S):[],y=m[2]||e.subSectionKeyPath,b=m[3]||y,R=y.split("-").map(Number),C=b.split("-").map(Number),I=null,w=null;R.length>0&&(I=yt[R[0]]),C.length>0&&(w=bt[C[0]]);var T=(null==I?void 0:I.title)||"",_=(null==w?void 0:w.title)||"";console.log("Root Parent Titles:",T,_);for(var E=1;E<R.length;E++)(null==I?void 0:I.subsections)&&(I=I.subsections[R[E]]);for(E=1;E<C.length;E++)(null==w?void 0:w.subsections)&&(w=w.subsections[C[E]]);I&&(g=n(n({},I),{title:T||I.title})),console.log("Base Section for Subsection Badge:",g),w&&(x=n(n({},w),{title:_||w.title})),console.log("Ref Section for Subsection Badge:",x)}var F=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),A=(null===(a=null===(c=null===(u=g.evaluationResult)||void 0===u?void 0:u.cognitive_decisioning)||void 0===c?void 0:c.decisioning_factors)||void 0===a?void 0:a.length)||!1,D=F||A;return t("g",{children:[i("path",{d:f,fill:"none",stroke:e.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",n({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,n({onClick:function(n){n.stopPropagation(),D&&(Ge.open&&et===e.id?ut():(rt(e.id),oi(ii(n.currentTarget,g,x,e.sectionIdx,e.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:e.style.badgeBg,color:e.style.badgeText,border:"1px solid ".concat(e.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:D?"pointer":"default"}},{children:[e.style.badgeText===N&&null==e.style.label?i(L,{color:e.style.badgeText}):0===e.style.label?"Same":e.style.label,i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),D&&i(p,{size:11,style:{transform:Ge.open&&et===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),i(G,{connectedLines:ye,pathRefs:Be})]})),t(d,n({sx:n({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},qn?{flex:1,overflow:"visible"}:{})},{children:[i(d,n({ref:gi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,n({title:pt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:pt}))}))})),t(d,n({ref:Ke,onScroll:ki,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&yt.map(function(e,o){var r,l,u=!e.title&&!e.content;if(qn&&u)return null;var c=e,a=Ii(o,"left"),s=qn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!bt[o],v=qn?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:o+1,f=he.has(o),p=y(c.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,n({ref:Ht(o),sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Et.current[o],sx:n({width:"100%",display:"flex",flexDirection:"column",minWidth:0},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"left",colRef:Ht("left-accordion-".concat(o)),mb:0,treeData:Bn,proposedSections:yt,existingSections:bt,deviationNumberRegistry:Ct,getSectionCompareStyle:Ii,getBadgeRef:Lt,connectedSections:he,openMoreFunctionsPopup:ri,openSummaryPopup:zi,deviationNodeIdToView:null==Hn?void 0:Hn.id,deviationTargetParentId:$i,parentNodeId:(null===(l=null==Bn?void 0:Bn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:qn?!!Qt["left-".concat(o)]:!!Qt[String(o)],onToggle:function(){qi(),ti(o,"left")},navigation:e.id?Vi[e.id]:null,showOpenNodeRef:Xi,resolvedMarkdownStyles:Pe,maintainRelativeOrder:qn,showDeviationBadges:Yn,renderSubSections:Ui,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&a&&t(d,n({ref:At.current[o],onClick:function(n){var t=qn?bt.find(function(n){var e;return null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)})||{title:"",content:""}:bt[o]||{title:"",content:""};ri(n,e,s,t,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var r=Mn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;console.log("LOG: Printing evaluationResult",r,c),zi(n,String(o),s,r)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:s?"default":"pointer",borderRight:"1px solid ".concat(a.badgeBorder),"&:hover":s?{}:{bgColor:"".concat(a.badgeBorder,"22")}}},{children:[null!=v&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!Mn.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):i(L,{color:a.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var t=qn?bt.find(function(n){var e;return(null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n))||{title:"",content:""}}):bt[o]||{title:"",content:""};ri(n,e,s,t,o,a)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(a.badgeBorder,"22")}}},{children:i(g,{size:11,color:a.badgeText})}))]}))]}))}),"left-row-".concat(o))}),i("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,n({ref:vi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,n({onClick:function(e){e.stopPropagation(),Ge.open&&et===qt?ut():(rt(qt),oi(ii(e.currentTarget,{title:"",content:"",evaluationResult:Kt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,qt,!0,n(n({},Vt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Vt.badgeBg,color:Vt.badgeText,border:"1px solid ".concat(Vt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Yt?Yt:i(L,{}),i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(p,{size:11,style:{transform:Ge.open&&et===qt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,n({sx:n({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},qn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Jn&&i(x,{sections:11}),i(d,n({ref:hi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,n({title:gt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:gt}))}))})),t(d,n({ref:Le,onScroll:ki,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Oe,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&bt.map(function(e,o){var r,l=e,u=[],c=!1,a=null,s=-1;if(qn){u=yt.filter(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0}).map(function(n){return n.selfIndex+1}),s=yt.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0});var v=yt.findIndex(function(n,e){var t;return he.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==v)&&(a=Ii(v))}else u=[o+1],(c=he.has(o))&&(a=Ii(o));var f=Ii(qn&&-1!==s?s:o);return i(d,n({ref:Mt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Ft.current[o],sx:n({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"right",colRef:Ht("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Bn?void 0:Bn.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:qn?!!Qt["right-".concat(o)]:!!Qt[String(o)],treeData:Bn,proposedSections:yt,existingSections:bt,deviationNumberRegistry:Ct,getBadgeRef:Lt,getSectionCompareStyle:Ii,connectedSections:he,openMoreFunctionsPopup:ri,openSummaryPopup:zi,deviationNodeIdToView:null==Hn?void 0:Hn.id,deviationTargetParentId:$i,onToggle:function(){qi(),ti(o,"right")},navigation:e.id?Vi[e.id]:null,showOpenNodeRef:Xi,resolvedMarkdownStyles:Pe,maintainRelativeOrder:qn,showDeviationBadges:Yn,renderSubSections:Ui,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&f&&i(d,n({ref:Dt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:f.badgeBg,color:f.badgeText,border:"1px solid ".concat(f.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:ze,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{J as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAkBlC,QAAA,MAAM,gBAAgB,8PAsBnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAkBlC,QAAA,MAAM,gBAAgB,8PAsBnB,qBAAqB,4CAgkHvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
|