@viswa-test/test-citation 0.0.101 → 0.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),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");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(b){var A,E,T,I,B,C,D,O,w,N,j,P,F,k,M,V,L,G,H,q,z,W,Y,K,U,X,J=b.componentHeaderText,$=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Q=b.treeData,Z=b.comparisonConfig,ee=b.leftColumnTitleText,ne=b.rightColumnTitleText,te=b.markdownStyles,ie=b.resetTrigger,oe=b.displayConfig,re=void 0===oe?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!0}:oe,le=b.popupConfig,ue=b.deviationData,ce=void 0===ue?{}:ue,ae=b.deviationNodeIdToView,se=b.resetDeviationNodeId,de=t.useState(re.maintainRelativeOrder),ve=de[0],fe=de[1],ge=!!ve||!!(null==re?void 0:re.showDeviationBadges),pe=t.useState(!1),he=pe[0],xe=pe[1],_e=t.useState(!1),me=_e[0],Re=_e[1],ye=t.useState(null),Se=ye[0],be=ye[1],Ae=t.useState(!1),Ee=Ae[0],Te=Ae[1],Ie=t.useState(null===(E=null!==(A=null==Q?void 0:Q.newEvaluationResult)&&void 0!==A?A:null==re?void 0:re.enableDeviationSchemaBackwardCompatibility)||void 0===E||E)[0],Be=t.useState(!1),Ce=Be[0],De=Be[1],Oe=t.useState(!1),we=Oe[0],Ne=Oe[1],je=t.useState(null),Pe=je[0],Fe=je[1],ke=t.useRef(!1),Me=t.useState(new Set),Ve=Me[0],Le=Me[1],Ge=t.useState([]),He=Ge[0],qe=Ge[1],ze=t.useRef(null),We=t.useRef(!1),Ye=t.useRef(null),Ke=t.useRef({}),Ue=t.useRef([]),Xe=t.useRef(!1),Je=t.useRef(!1),$e=t.useRef(null),Qe=t.useRef(function(){}),Ze=t.useMemo(function(){return(null==Q?void 0:Q.cognitive_decisioning)||{}},[Q]),en=t.useState({width:0,height:0}),nn=en[0],tn=en[1],on=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),te)},[te]),rn=t.useRef(null),ln=t.useRef(null),un=t.useRef(null),cn=t.useRef(null),an=t.useRef(null),sn=t.useRef(null),dn=t.useRef(null),vn=t.useRef(null),fn=t.useRef(!1),gn=t.useRef(null),pn=t.useRef(null),hn=p.useComparePopups(rn),xn=hn.cognitivePopup,_n=hn.setCognitivePopup,mn=hn.moreFunctions,Rn=hn.setMoreFunctions,yn=hn.position,Sn=hn.setPosition,bn=hn.activeBadgeId,An=hn.summaryPopup,En=hn.setSummaryPopup,Tn=hn.closeSummaryPopup,In=hn.setActiveBadgeId,Bn=hn.popupRef,Cn=hn.closeCognitivePopup,Dn=hn.closeMoreFunctionsPopup,On=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==Z?void 0:Z.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==Z?void 0:Z.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==Z?void 0:Z.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==Z?void 0:Z.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[Z]),wn=t.useState(null),Nn=wn[0];wn[1];var jn=null===(B=null===(T=null==Q?void 0:Q.documents)||void 0===T?void 0:T[null===(I=null==Q?void 0:Q.input_index_map)||void 0===I?void 0:I[0]])||void 0===B?void 0:B.title,Pn=null===(O=null===(C=null==Q?void 0:Q.documents)||void 0===C?void 0:C[null===(D=null==Q?void 0:Q.input_index_map)||void 0===D?void 0:D[1]])||void 0===O?void 0:O.title,Fn=u.safeStringify(ee||jn||"Uploaded Contract"),kn=u.safeStringify(ne||Pn||"Reference Template"),Mn=g.useCognitiveTreeData(Q,ve,ce,On,Ie),Vn=Mn.activeProposed,Ln=Mn.existingRule,Gn=Mn.proposedSections,Hn=Mn.existingSections,qn=Mn.visibleFields,zn=Mn.parentDeviationRecord,Wn=Mn.deviationNumberRegistry,Yn=Mn.parseError;t.useEffect(function(){Yn&&be("Failed to load comparison: ".concat(Yn))},[Yn]);var Kn=Gn.length>0||Hn.length>0,Un=h.useSectionRefs(qn.map(function(e){return e.key}),Math.max(Gn.length,Hn.length)),Xn=Un.leftRefs,Jn=Un.rightRefs,$n=Un.sectionLeftRefs,Qn=Un.sectionRightRefs,Zn=Un.lhsBadgeRefs,et=Un.rhsBadgeRefs,nt=Un.sectionRightRowRefs,tt=Un.subSectionLeftRefs,it=Un.subSectionRightRefs,ot=Un.sectionRowRefs,rt=Un.getSectionRowRef,lt=Un.getSubSectionRef,ut=Un.getBadgeRef,ct=Ln.analysis,at=u.safeStringify(null===(N=null===(w=null==ct?void 0:ct.rule_difference_comparison)||void 0===w?void 0:w.summary)||void 0===N?void 0:N.overall_summary),st=!!at.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),dt=null!==(j=null==Q?void 0:Q.base_root_id)&&void 0!==j?j:"-1";null==Q||Q[dt];var vt=Ie?null!==(Y=null!==(q=ce&&(null===(H=null==ce?void 0:ce[dt])||void 0===H?void 0:H.evaluation_result))&&void 0!==q?q:null===(W=null===(z=null==Q?void 0:Q.nodes)||void 0===z?void 0:z[dt])||void 0===W?void 0:W.evaluation_result)&&void 0!==Y?Y:null:null!==(G=null!==(k=ce&&(null===(F=null===(P=null==ce?void 0:ce[dt])||void 0===P?void 0:P.evaluation_result)||void 0===F?void 0:F[0]))&&void 0!==k?k:null===(L=null===(V=null===(M=null==Q?void 0:Q.nodes)||void 0===M?void 0:M[dt])||void 0===V?void 0:V.evaluation_result)||void 0===L?void 0:L[0])&&void 0!==G?G:null,ft=u.extractDeviationScore(vt),gt=u.generateColorPalette(null!==(X=null===(U=null===(K=null==vt?void 0:vt.evaluation_outputs)||void 0===K?void 0:K.metadata)||void 0===U?void 0:U.label_color)&&void 0!==X?X:""),pt=t.useCallback(function(){var e,n,t,i,o,r;Te(!1),Je.current=!1;var l=$e.current,c=Dt.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=tt.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=$n.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=$n.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=it.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=Qn.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Qn.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Fe(null),$e.current=null,Dt.current=null,De(!1),Re(!1),cn.current&&(cn.current.style.height="0px"),an.current&&(an.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),dn.current&&(dn.current.style.height="0px")},[]),ht=t.useCallback(function(){pt(),Le(new Set),qe([]),Ue.current=[],En(a.EMPTY_SUMMARY_POPUP_STATE)},[]);t.useEffect(function(){ht()},[ie]);var xt=x.useAccordionState({maintainRelativeOrder:!!ve,proposedSections:Gn,existingSections:Hn,activeSideBySideSection:Pe,connectedSections:Ve,resetSideBySide:pt,setConnectedSections:Le,setConnectedLines:qe,cachedConnectedPositions:Ue,svgContainerRef:ze,isAnimatingRef:We,animationTimerRef:Ye,calculateLinesRef:Qe,sectionLeftRefs:$n,sectionRightRefs:Qn,subSectionLeftRefs:tt,subSectionRightRefs:it}),_t=xt.expandedSections,mt=xt.setExpandedSections,Rt=xt.expandedSubSections,yt=xt.setExpandedSubSections,St=xt.toggleSection,bt=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?Ze[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=ot.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==re?void 0:re.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==Q?void 0:Q.documents,input_index_map:null==Q?void 0:Q.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}},[Ze,Q]),At=t.useCallback(function(e){Dn(),Sn(null),_n(e)},[Dn]),Et=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),mn.open&&mn.sectionIdx===o)Dn();else{var c=e.currentTarget,a="left";(null===(l=un.current)||void 0===l?void 0:l.contains(c))&&(a="right");Je.current&&pt(),Le(new Set),qe([]),Ue.current=[],Cn(),An.open?li():Tn(),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=et.current[l])||void 0===e?void 0:e.current:null===(n=Zn.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=et.current[o])||void 0===t?void 0:t.current:null===(i=Zn.current[o])||void 0===i?void 0:i.current}()||c;Rn(bt(e,n,i,o,t,r))})}},Tt=t.useCallback(function(){null!==mn.sectionIdx&&mn.anchorEl?At(e.__assign(e.__assign({},mn),{open:!0})):Dn()},[mn,Dn,At]),It=t.useCallback(function(){var e=mn.sectionIdx,n=mn.isOrphan;Dn(),Tn(),null!==e&&(n?be("No counterpart exists to connect to."):(Je.current&&pt(),qe([]),Ue.current=[],Le(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Qe.current&&Qe.current()},50)))},[mn.sectionIdx,mn.isOrphan,Dn,Tn,pt]),Bt=t.useRef(null),Ct=t.useRef(null),Dt=t.useRef(null),Ot=t.useRef(null),wt=t.useRef(null),Nt=t.useRef(null),jt=t.useState([]),Pt=jt[0],Ft=jt[1];t.useRef(null);var kt=t.useState(null),Mt=kt[0],Vt=kt[1];t.useEffect(function(){if(Nn){var e=On.fields.find(function(e){return e.analysisKey===Nn||e.key===Nn});if(e){var n=Xn.current[e.key]||Jn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Nn,On.fields]);var Lt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==ct?void 0:ct.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}},[ct]),Gt=t.useCallback(function(n,t){var i,o,r;void 0===t&&(t="left");var l=null,c=null;if("left"===t)if(l=Gn[n],ve&&l){var s=Hn.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=Hn[n];else if(c=Hn[n],ve&&c){var d=Gn.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=Gn[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})},[Gn,Hn,Ze,On,ve]),Ht=t.useCallback(function(n){for(var t,i,o,r,l,c=n.split("-").map(Number),s=Gn[c[0]],d=Hn[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=Ze[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})},[Gn,Hn,Ze,On]),qt=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==ce?void 0:ce[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Q?void 0:Q.nodes)||void 0===r?void 0:r[n])||void 0===l?void 0:l.evaluation_result)&&void 0!==c?c:null===(s=null==Q?void 0:Q[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})},[ce,Q]),zt=t.useCallback(function(){mt({}),yt({}),pt(),Le(new Set),qe([]),Ue.current=[],Tn(),Cn(),Dn(),requestAnimationFrame(function(){Qe.current&&Qe.current()})},[mt,yt,pt,Tn,Cn,Dn]),Wt=t.useMemo(function(){return Object.values(_t).some(Boolean)||Object.values(Rt).some(Boolean)},[_t,Rt]),Yt=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(!fn.current&&!We.current){fn.current=!0;try{if(!Bt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!_t[t]&&!1===ve)return!1;if(ve&&!_t["left-".concat(t)]&&!_t["right-".concat(t)]&&!_t[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Rt[i])return!1;return!0},E=Bt.current.getBoundingClientRect();tn({width:E.width,height:E.height});var T=[];if(qn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Jn.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")}),!We.current){for(var I=0;I<Math.max(Gn.length,Hn.length);I++){var B=null===(e=$n.current[I])||void 0===e?void 0:e.current,C=null===(n=Qn.current[I])||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")}ve||Object.keys(tt.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=tt.current[e])||void 0===n?void 0:n.current,o=null===(t=it.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={};qn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Jn.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(!We.current)if(ve){if(Ee&&null!==Pe)if("number"==typeof Pe){var N=Pe,j=Gn[N],P=null===(o=$n.current[N])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Hn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Qn.current[t])||void 0===n?void 0:n.current;if(i&&(_t["left-".concat(N)]||_t["right-".concat(t)])){var o=Math.max(P.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=Pe.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(r=tt.current[F])||void 0===r?void 0:r.current,C=null===(l=it.current[F])||void 0===l?void 0:l.current;if(B&&C){k=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,k)}}}}else{Object.keys(tt.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=tt.current[e])||void 0===n?void 0:n.current,o=null===(t=it.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(I=0;I<Math.min(Gn.length,Hn.length);I++){var B=null===(t=$n.current[I])||void 0===t?void 0:t.current,C=null===(i=Qn.current[I])||void 0===i?void 0:i.current;if(B&&C){var k=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[I]=k,O.right[I]=k}}}if(qn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Jn.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")}}),We.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=$n.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Qn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ve||Object.keys(w).forEach(function(e){var n,t,i=null===(n=tt.current[e])||void 0===n?void 0:n.current,o=null===(t=it.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")}})),ve)Gn.forEach(function(e,n){var t;(null===(t=$n.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=Hn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=Zn.current[n])||void 0===t?void 0:t.current,g=null===(i=et.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(Ee&&Pe===n){var y=null!==(r=null===(o=vn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=un.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,b=y+(null!==(a=null===(c=vn.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=S+(null!==(d=null===(s=un.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),I=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(I,y,b)-E.top,R=C(B,S,A)-E.top}var D=Gt(n);D&&T.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(I=0;I<Math.min(Gn.length,Hn.length);I++){var M=null===(c=$n.current[I])||void 0===c?void 0:c.current,V=null===(a=Qn.current[I])||void 0===a?void 0:a.current;if(M&&V){var L=M.getBoundingClientRect(),G=V.getBoundingClientRect(),H=Math.max(L.top,G.top)+18-E.top,q=(null===(s=Hn[I])||void 0===s?void 0:s.id)||"sec-".concat(I);($=Gt(I))&&T.push({id:q,x1:L.right-E.left,y1:H,x2:G.left-E.left,y2:H,style:$,sectionIdx:I,hasCognitive:!!((null===(d=Gn[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Hn[I])||void 0===v?void 0:v.cognitiveData)||q&&Ze[q]),isSubSection:!1})}}Object.keys(tt.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=tt.current[e])||void 0===n?void 0:n.current,a=null===(t=it.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Gn[s[0]],v=Hn[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=Ht(e);y&&"Not Defined"!==y.label&&T.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(Ee&&"string"==typeof Pe&&Pe.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Pe.split(u.DEVIATION_BADGE_SEPARATOR),W=z[0],Y=z[1],K=z[2],U=(z[3],"".concat(W).concat(u.DEVIATION_BADGE_SEPARATOR).concat(Y)),X=null===(f=Zn.current[U])||void 0===f?void 0:f.current,J=null===(g=et.current[U])||void 0===g?void 0:g.current;if(X&&J){var $,Q=X.getBoundingClientRect(),Z=J.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(ve){var oe=null!==(h=null===(p=vn.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(_=null===(x=un.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==_?_:0,le=oe+(null!==(R=null===(m=vn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=un.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}($=null!==(b=qt(W,Y))&&void 0!==b?b:Ht(K))&&T.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:$,sectionIdx:Number(K.split("-")[0]),isSubSection:!0,subSectionKeyPath:Pe})}}if(Ft(T),wt.current&&Nt.current){var ae=wt.current.getBoundingClientRect(),se=Nt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-E.top+se.top+se.height/2-E.top)/2;Vt({x1:ae.right-E.left,x2:se.left-E.left,y:de})}else Vt(null);if(Ve.size>0){var fe=[],ge=vn.current,pe=un.current;if(ge&&pe){var he=[],xe=ge.getBoundingClientRect().top,_e=pe.getBoundingClientRect().top,me=xe+ge.clientHeight,Re=_e+pe.clientHeight,ye=ge.scrollTop,Se=pe.scrollTop,be=E.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};Ve.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=Zn.current[v])||void 0===n?void 0:n.current,g=null===(t=et.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=qt(a,s))&&void 0!==i?i:Ht(d),_=(P=p.right-E.left)+.5*((F=h.left-E.left-0)-P),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);he.push({lhsScrollY:y,rhsScrollY:S,x1:P,x2:F,containerTop:be,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:b});var A=Ae(m,xe,me),T=Ae(R,_e,Re),I=A-be,B=T-be,C=R>=_e-4&&R<=Re+4,D="";D=(k=m>=xe-4&&m<=me+4)&&C?u.getBentArrowPath(P,I,F,B):k&&!C?"M ".concat(P,",").concat(I," L ").concat(_,",").concat(I," L ").concat(_,",").concat(B):!k&&C?"M ".concat(_,",").concat(I," L ").concat(_,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(_,",").concat(I," L ").concat(_,",").concat(B),fe.push({id:b,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(ve){var O=e,w=Gn[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=Hn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Zn.current[O])||void 0===n?void 0:n.current,r=null===(t=et.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Gt(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);he.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),fe.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,j=N;f=null===(o=Zn.current[N])||void 0===o?void 0:o.current,g=null===(r=et.current[j])||void 0===r?void 0:r.current;if(!f||!g)return;var P,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=Gt(N),_=(P=p.right-E.left)+.5*((F=h.left-E.left-0)-P),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(j);he.push({lhsScrollY:y,rhsScrollY:S,x1:P,x2:F,containerTop:be,leftIdx:N,rhsArrayIdx:j,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:b});var k;A=Ae(m,xe,me),T=Ae(R,_e,Re),I=A-be,B=T-be,C=R>=_e-4&&R<=Re+4,D="";D=(k=m>=xe-4&&m<=me+4)&&C?u.getBentArrowPath(P,I,F,B):k&&!C?"M ".concat(P,",").concat(I," L ").concat(_,",").concat(I," L ").concat(_,",").concat(B):!k&&C?"M ".concat(_,",").concat(I," L ").concat(_,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(_,",").concat(I," L ").concat(_,",").concat(B),fe.push({id:b,pathD:D,style:x,leftIdx:N,rhsArrayIdx:j})}}),Ue.current=he}qe(fe)}else qe([]),Ue.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{fn.current=!1}}},[qn,Gn,Hn,Ze,On,Lt,Gt,qt,ve,Ee,Pe,Ve,_t,Rt]),Kt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=Ue.current;if(p.length&&!We.current){var h=null!==(n=null===(e=vn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=un.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,_=null!==(r=null===(o=vn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=un.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=vn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=un.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+_,b=y+m,A=null!==(g=null===(f=Bt.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=Ke.current[e.styleId+"-stroke"],o=Ke.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(){Qe.current=Yt},[Yt]);var Ut=t.useRef(null),Xt=t.useRef(null),Jt=t.useCallback(function(){Ue.current.length>0&&!We.current||(null!==Ut.current&&clearTimeout(Ut.current),Ut.current=setTimeout(function(){Qe.current(),Ut.current=null},50))},[]),$t=t.useCallback(function(){Ne(!0),De(!1),null!==Xt.current&&clearTimeout(Xt.current),null!==Ut.current&&(clearTimeout(Ut.current),Ut.current=null),Xt.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s;if(Ue.current=[],Je.current&&null!==$e.current&&null!==Dt.current){var d=$e.current,v=Dt.current,f=null,g=null,p=null,h=null;if("string"==typeof d&&d.includes(u.DEVIATION_BADGE_SEPARATOR)){var x=d.split(u.DEVIATION_BADGE_SEPARATOR),_="".concat(x[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(x[1]);f=(null===(e=Zn.current[_])||void 0===e?void 0:e.current)||null,g=(null===(n=et.current[_])||void 0===n?void 0:n.current)||null,p=(null===(t=tt.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=$n.current[Number(x[2])])||void 0===i?void 0:i.current)||null,h=(null===(o=it.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=Qn.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else f=(null===(l=ot.current[d])||void 0===l?void 0:l.current)||null,p=(null===(c=$n.current[d])||void 0===c?void 0:c.current)||null,g=(null===(a=nt.current[v])||void 0===a?void 0:a.current)||null,h=(null===(s=Qn.current[v])||void 0===s?void 0:s.current)||null;if(f&&g&&p&&h){if(p.style.paddingTop="0px",h.style.paddingTop="0px",!ve){var m=f.getBoundingClientRect(),R=g.getBoundingClientRect(),y=m.top-R.top;y>0?h.style.paddingTop="".concat(y,"px"):y<0&&(p.style.paddingTop="".concat(Math.abs(y),"px"))}var S=vn.current,b=un.current;if(S&&b){var A=f.getBoundingClientRect().top-S.getBoundingClientRect().top+S.scrollTop,E=g.getBoundingClientRect().top-b.getBoundingClientRect().top+b.scrollTop-(A-S.scrollTop);Math.abs(b.scrollTop-E)>1&&(b.scrollTop=E)}}}Qe.current(),Je.current&&De(!0),Ne(!1),Xt.current=null},150)},[ve,Gn,Hn]),Qt=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==gn.current&&pn.current&&Math.abs(e.currentTarget.scrollTop-gn.current)<=2){var v=pn.current;gn.current=null,pn.current=null,v()}if(!ke.current){if(ve||Jt(),Je.current){var f=$e.current,g=Dt.current,p=vn.current,h=un.current;if(null!==f&&null!==g&&p&&h){var x="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=Zn.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=ot.current[f])||void 0===t?void 0:t.current,_="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=et.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=nt.current[g])||void 0===o?void 0:o.current;if(x&&_&&Ot.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=Zn.current[S])||void 0===r?void 0:r.current,R=null===(l=et.current[S])||void 0===l?void 0:l.current}else m=null===(c=Zn.current[f])||void 0===c?void 0:c.current,R=null===(a=et.current[g])||void 0===a?void 0:a.current;var b=null!==(d=null===(s=Bt.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 T=m.getBoundingClientRect(),I=R.getBoundingClientRect(),B=T.top+T.height/2;I.top,I.height;var C=((O=B,w=A,N=E,Math.max(w,Math.min(N,O)))-b).toString();Ot.current.setAttribute("y1",C),Ot.current.setAttribute("y2",C);var D=B>=A-4&&B<=E+4;Ot.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,N;Ue.current.length>0&&!Xe.current&&(Xe.current=!0,requestAnimationFrame(function(){Kt(),Xe.current=!1}))}},[Kt,ve,Jt]),Zt=t.useRef(0),ei=t.useRef(0),ni=t.useRef(0),ti=t.useRef(function(){});t.useRef(null),t.useEffect(function(){ti.current=$t},[$t]),t.useEffect(function(){var e=setTimeout(Jt,250),n=function(){return ti.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==Ut.current&&clearTimeout(Ut.current),null!==Xt.current&&clearTimeout(Xt.current),window.removeEventListener("resize",n)}},[Vn,Ln,ct,qn,_t,Rt,Gn,Hn,On,Jt,Ee,Pe,Ce,Ve]),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 ln.current&&o.push(e(ln.current,Zt,n,function(){return ti.current()},function(){})),rn.current&&o.push(e(rn.current,ei,t,function(){return ti.current()},function(){return Qe.current()})),Bt.current&&o.push(e(Bt.current,ni,i,function(){return ti.current()},function(){return Qe.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(){Je.current=Ee},[Ee]),t.useEffect(function(){$e.current=Pe},[Pe]);var ii=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";Dn(),null!=e&&(n?be("No counterpart exists for this section."):Ee&&Pe===e?r?pt():null==l||l():(Le(new Set([e])),qe([]),Ue.current=[],Re(!0),ke.current=!0,Fe(e),$e.current=e,Te(!0),Je.current=!0,De(!1),cn.current&&(cn.current.style.height="0px"),an.current&&(an.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),dn.current&&(dn.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=Zn.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=et.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=ot.current[e])||void 0===i?void 0:i.current)||null,ve){var p=Gn[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],_=Hn.findIndex(function(e){return e.selfIndex===x});-1!==_&&(d=(null===(r=nt.current[_])||void 0===r?void 0:r.current)||null,v=_)}}else d=(null===(o=nt.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;Dt.current=v;var m=vn.current,R=un.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=tt.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=$n.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=it.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=Qn.current[Number(R[3])])||void 0===o?void 0:o.current)||null,_=(null===(r=Zn.current[y])||void 0===r?void 0:r.current)||h,m=(null===(l=et.current[y])||void 0===l?void 0:l.current)||x}else{var S=Number(e),b=null!==v?Number(v):S;h=(null===(c=$n.current[S])||void 0===c?void 0:c.current)||null,x=(null===(s=Qn.current[b])||void 0===s?void 0:s.current)||null,_=(null===(d=Zn.current[S])||void 0===d?void 0:d.current)||(null===(f=ot.current[S])||void 0===f?void 0:f.current)||h,m=(null===(g=et.current[b])||void 0===g?void 0:g.current)||(null===(p=nt.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(),T=A.top-E.top;T>0?x.style.paddingTop="".concat(T,"px"):T<0&&(h.style.paddingTop="".concat(Math.abs(T),"px"))}}(),De(!0),Qe.current&&Qe.current(),ke.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Re(!1),null==l||l()};if(!s||!m)return ke.current=!1,Re(!1),void(null==l||l());if(d&&R){if(!ve){var S=0;S="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var b=rn.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 T=s.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,I=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=I-(T-m.scrollTop);C<0&&cn.current&&(cn.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 an.current&&(an.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=T-(I-R.scrollTop);D<0&&sn.current&&(sn.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 dn.current&&(dn.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()})))},[Pe,Dn,Hn,Ee,ve,Gn,pt]),oi=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;Cn();var c="left";(null===(o=un.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=et.current[l])||void 0===e?void 0:e.current:null===(t=Zn.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=et.current[n])||void 0===i?void 0:i.current:null===(o=Zn.current[n])||void 0===o?void 0:o.current};if(t)return pt(),Le(new Set),qe([]),Ue.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;En({open:!0,anchorEl:e,summary:i})}));ii(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;En({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[ii,Cn,En,pt]),ri=t.useCallback(function(){var e,n=mn.sectionIdx,t=mn.isOrphan;if(Tn(),null!=n){var i="left";mn.anchorEl&&(null===(e=un.current)||void 0===e?void 0:e.contains(mn.anchorEl))&&(i="right"),ii(n,t,{sourceSide:i})}},[ii,mn.isOrphan,mn.sectionIdx,mn.anchorEl,Tn]),li=t.useCallback(function(){Tn(),pt(),Le(new Set),qe([]),Ue.current=[]},[Tn,pt]),ui=null!==mn.sectionIdx&&Ve.has(mn.sectionIdx),ci=_.useDeviationNavigation({proposedSections:Gn,existingSections:Hn,parentDeviationRecord:zn,expandedSections:_t,maintainRelativeOrder:!!ve,scrollContainerRef:rn,leftContainerRef:vn,lhsBadgeRefs:Zn,rhsBadgeRefs:et}),ai=ci.showDeviationNavigation,si=ci.showOpenNodeRef,di=t.useMemo(function(){if(!ae)return null;var e=ae.id.split(":")[0];for(var n in zn){if((zn[n]||[]).some(function(n){return n.id===e}))return n}return null},[ae,zn]),vi=t.useRef({id:null,triggerMs:null}),fi=t.useRef(null);t.useEffect(function(){if(null==ae?void 0:ae.id){var n=Number(ae.trigger),t=vi.current;if(!(t.id===ae.id&&null!=t.triggerMs&&n-t.triggerMs<=1e3)){vi.current={id:ae.id,triggerMs:n};var i=ae.id.split(":"),o=i[0],r=i[1],l=null!=r?r:"0";fi.current!==ae.id&&(Tn(),Cn(),pt(),Le(new Set),qe([]),Ue.current=[],fi.current=ae.id);var c=!1,a=0,s=null,d=150,v=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},f=function(){var n,t,i,r;if(!c){var g=null,p=null;for(var h in zn){var x=zn[h].find(function(e){return e.id===o});if(x){g=h,p=x;break}}if(p&&g){var _=Gn.findIndex(function(e){return e.id===g}),m=Hn.findIndex(function(e){return e.id===g}),R=-1===_&&-1!==m,y=v(Gn,p.id),S=v(Hn,p.id);if(y&&!S&&!R){var b=y.split("-"),A=Number(b[0]);if(ve){var E=null===(t=null===(n=Gn[A])||void 0===n?void 0:n.refIndexes)||void 0===t?void 0:t[0],T=Hn.findIndex(function(e){return e.selfIndex===E});-1!==T&&(A=T)}S=e.__spreadArray([A],b.slice(1),!0).join("-")}if(y||S){var I=R||!y&&!!S,B=y?Number(y.split("-")[0]):_,C=S?Number(S.split("-")[0]):m;if(I){if(!(ve?!!_t["right-".concat(C)]:!!_t[String(C)])&&C>=0)return St(C,"right"),a+=1,void(s=setTimeout(f,450))}else if(!(ve?!!_t["left-".concat(B)]:!!_t[String(B)])&&B>=0)return St(B,"left"),a+=1,void(s=setTimeout(f,450));var D,O=y||"",w=S||"",N="".concat(p.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l).concat(u.DEVIATION_BADGE_SEPARATOR).concat(O).concat(u.DEVIATION_BADGE_SEPARATOR).concat(w),j="".concat(p.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l),P=null===(i=Zn.current[j])||void 0===i?void 0:i.current,F=null===(r=et.current[j])||void 0===r?void 0:r.current,k=I||!P&&!!F,M=k?F:P;if(D=ve?k?un.current:vn.current:rn.current,M&&D){var V=M.getBoundingClientRect();if(0===V.height)return void((a+=1)<20&&(s=setTimeout(f,d)));var L=D.getBoundingClientRect(),G=V.top-L.top+D.scrollTop-L.height/2+V.height/2,H=function(){var n,t,i,o,r;if(!c){var u=window.getComputedStyle(M).color;P&&(P.style.transition="box-shadow 300ms ease-in-out",P.style.boxShadow="0 0 10px ".concat(u)),F&&(F.style.transition="box-shadow 300ms ease-in-out",F.style.boxShadow="0 0 10px ".concat(u)),setTimeout(function(){P&&(P.style.boxShadow=""),F&&(F.style.boxShadow="")},2e3);var a=(null===(t=null===(n=p.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[l])||p,s=(null===(i=p.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||p.evaluation_outputs;if(!(!!P&&!!F)){var d=k?(null===(o=et.current[j])||void 0===o?void 0:o.current)||F:(null===(r=Zn.current[j])||void 0===r?void 0:r.current)||P;return En({open:!0,anchorEl:d,summary:e.__assign(e.__assign({},a),{evaluation_outputs:s})}),void(null==se||se())}ii(N,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t=(null===(n=Zn.current[j])||void 0===n?void 0:n.current)||P;En({open:!0,anchorEl:t,summary:e.__assign(e.__assign({},a),{evaluation_outputs:s})})}})}};Math.abs(D.scrollTop-G)<=2?H():(gn.current=G,pn.current=H,D.scrollTo({top:G,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if(pn.current){gn.current=null;var e=pn.current;pn.current=null,e()}},800))}else(a+=1)<20&&(s=setTimeout(f,d))}else(a+=1)<20&&(s=setTimeout(f,d))}else(a+=1)<20&&(s=setTimeout(f,d))}};return s=setTimeout(f,d),function(){c=!0,s&&clearTimeout(s)}}}},[ae,zn,Gn,Hn,ve,_t,St,ii,En]);var gi=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:Rt,setExpandedSubSections:yt,maintainRelativeOrder:ve||!1,proposedSections:Gn,existingSections:Hn,treeData:Q,deviationNumberRegistry:Wn,connectedSections:Ve,activeSideBySideSection:Pe,resolvedMarkdownStyles:on,getSubSectionRef:lt,getSubSectionCompareStyle:Ht,getBadgeRef:ut,openMoreFunctionsPopup:Et,openSummaryPopup:oi,showDeviationBadges:ge,resetSideBySide:pt,setConnectedSections:Le,setConnectedLines:qe,cachedConnectedPositions:Ue})};return n.jsxs(i.Box,e.__assign({ref:ln,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ve?{}:{overflow:"visible"}),{position:"relative"})},{children:[he&&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,{})})),An.open&&n.jsx(S.default,{open:An.open,anchorEl:An.anchorEl,containerEl:Ct.current,clipTopEl:wt.current,scrollContainerEl:rn.current,onClose:li,summary:An.summary}),n.jsx(d.default,{open:mn.open,anchorEl:mn.anchorEl,sectionTitle:mn.sectionTitle,referenceSectionTitle:mn.refSectionTitle,onClose:Dn,onOpenCognitiveCompare:Tt,onOpenSideBySide:ri,onConnect:It,isConnected:ui,isOrphan:mn.isOrphan}),xn.open&&n.jsx(s.default,{open:xn.open,popupRef:Bn,position:yn,popupConfig:le,onClose:function(){Sn(null),_n(function(n){return e.__assign(e.__assign({},n),{open:!1})}),In(null)},markdownStyles:te,sectionTitle:xn.sectionTitle,referenceSectionTitle:xn.refSectionTitle,cognitiveData:xn.cognitiveData,anchorEl:xn.anchorEl,sectionAnchorEl:xn.sectionAnchorEl,scrollContainerEl:rn.current,badgeStyle:xn.badgeStyle,docData:xn.docData,deviationData:xn.deviationData,isLoading:xn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Se,autoHideDuration:8e3,onClose:function(){return be(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return be(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Se}))})),n.jsx(m.default,{componentHeaderText:$,displayConfig:re,maintainRelativeOrder:ve,onCollapseAll:zt,showCollapseAll:Wt,onToggleView:function(e){xe(!0),setTimeout(function(){fe(!e),pt(),Tn(),Le(new Set),qe([]),Ue.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){xe(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:rn,onScroll:Qt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ve?"hidden":"auto",borderTop:at&&st?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ve?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Bt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ve?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:ze,style:{position:"absolute",top:0,left:0,width:nn.width||"100%",height:nn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:we?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Mt&&n.jsx("g",{children:n.jsx("line",{x1:Mt.x1,y1:Mt.y,x2:Mt.x2,y2:Mt.y,stroke:gt.badgeBorder,strokeWidth:"1.5"})}),Pt.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?Ee&&Pe===t.subSectionKeyPath&&Ce:Ee&&Pe===t.sectionIdx&&Ce)return null;if(!ve){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),_=Gn[t.sectionIdx]||{title:"",content:""},m=Hn[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,T=null;b.length>0&&(E=Gn[b[0]]),A.length>0&&(T=Hn[A[0]]);var I=(null==E?void 0:E.title)||"",B=(null==T?void 0:T.title)||"";console.log("Root Parent Titles:",I,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==T?void 0:T.subsections)&&(T=T.subsections[A[C]]);E&&(_=e.__assign(e.__assign({},E),{title:I||E.title})),console.log("Base Section for Subsection Badge:",_),T&&(m=e.__assign(e.__assign({},T),{title:B||T.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&&(xn.open&&bn===t.id?Cn():(In(t.id),At(bt(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:xn.open&&bn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),He.map(function(t){var i,o=t.pathD,r=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),u="".concat(t.id,"-bg"),c="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:r})}))}))}),n.jsx("path",{ref:function(e){Ke.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){Ke.current[c]=e},d:o,fill:"none",stroke:r,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},ve?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:wt,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:Fn,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:Fn}))}))})),n.jsxs(i.Box,e.__assign({ref:vn,onScroll:Qt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},ve?{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:sn,style:{width:"100%",height:"0px",flexShrink:0}}),Kn&&Gn.map(function(t,r){var l,c,a=!t.title&&!t.content;if(ve&&a)return null;var s=t,d=Gt(r,"left"),v=ve?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Hn[r],g=ve?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ve.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:rt(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:$n.current[r],sx:e.__assign({width:"100%",display:"flex"},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:rt("left-accordion-".concat(r)),mb:0,treeData:Q,proposedSections:Gn,existingSections:Hn,deviationNumberRegistry:Wn,getSectionCompareStyle:Gt,getBadgeRef:ut,connectedSections:Ve,openMoreFunctionsPopup:Et,openSummaryPopup:oi,deviationNodeIdToView:null==ae?void 0:ae.id,deviationTargetParentId:di,parentNodeId:(null===(c=null==Q?void 0:Q.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:ve?!!_t["left-".concat(r)]:!!_t[String(r)],onToggle:function(){li(),St(r,"left")},navigation:t.id?ai[t.id]:null,showOpenNodeRef:si,resolvedMarkdownStyles:on,maintainRelativeOrder:ve,showDeviationBadges:ge,renderSubSections:gi})})),ve&&d&&n.jsxs(i.Box,e.__assign({ref:Zn.current[r],onClick:function(e){var n=ve?Hn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Hn[r]||{title:"",content:""};Et(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:[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:!re.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?v?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(f.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:dn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:Ct,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(),xn.open&&bn===dt?Cn():(In(dt),At(bt(n.currentTarget,{title:"",content:"",evaluationResult:vt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,dt,!0,e.__assign(e.__assign({},gt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:gt.badgeBg,color:gt.badgeText,border:"1px solid ".concat(gt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=ft?ft: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:xn.open&&bn===dt?"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},ve?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[me&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Nt,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:kn,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:kn}))}))})),n.jsxs(i.Box,e.__assign({ref:un,onScroll:Qt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},ve?{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:cn,style:{width:"100%",height:"0px",flexShrink:0}}),Kn&&Hn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(ve){u=Gn.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=Gn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=Gn.findIndex(function(e,n){var t;return Ve.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Gt(d))}else u=[o+1],(c=Ve.has(o))&&(a=Gt(o));var v=Gt(ve&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:nt.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:Qn.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:rt("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Q?void 0:Q.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:ve?!!_t["right-".concat(o)]:!!_t[String(o)],treeData:Q,proposedSections:Gn,existingSections:Hn,deviationNumberRegistry:Wn,getBadgeRef:ut,getSectionCompareStyle:Gt,connectedSections:Ve,openMoreFunctionsPopup:Et,openSummaryPopup:oi,deviationNodeIdToView:null==ae?void 0:ae.id,deviationTargetParentId:di,onToggle:function(){li(),St(o,"right")},navigation:t.id?ai[t.id]:null,showOpenNodeRef:si,resolvedMarkdownStyles:on,maintainRelativeOrder:ve,showDeviationBadges:ge,renderSubSections:gi})})),ve&&v&&n.jsx(i.Box,e.__assign({ref:et.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:an,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");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(b){var A,E,T,I,B,C,D,O,w,N,j,P,F,k,M,V,L,G,H,q,z,W,Y,K,U,X,J=b.componentHeaderText,$=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Q=b.treeData,Z=b.comparisonConfig,ee=b.leftColumnTitleText,ne=b.rightColumnTitleText,te=b.markdownStyles,ie=b.resetTrigger,oe=b.displayConfig,re=void 0===oe?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!0}:oe,le=b.popupConfig,ue=b.deviationData,ce=void 0===ue?{}:ue,ae=b.deviationNodeIdToView,se=b.resetDeviationNodeId,de=t.useState(re.maintainRelativeOrder),ve=de[0],fe=de[1],ge=!!ve||!!(null==re?void 0:re.showDeviationBadges),pe=t.useState(!1),he=pe[0],xe=pe[1],_e=t.useState(!1),me=_e[0],Re=_e[1],ye=t.useState(null),Se=ye[0],be=ye[1],Ae=t.useState(!1),Ee=Ae[0],Te=Ae[1],Ie=t.useState(null===(E=null!==(A=null==Q?void 0:Q.newEvaluationResult)&&void 0!==A?A:null==re?void 0:re.enableDeviationSchemaBackwardCompatibility)||void 0===E||E)[0],Be=t.useState(!1),Ce=Be[0],De=Be[1],Oe=t.useState(!1),we=Oe[0],Ne=Oe[1],je=t.useState(null),Pe=je[0],Fe=je[1],ke=t.useRef(!1),Me=t.useState(new Set),Ve=Me[0],Le=Me[1],Ge=t.useState([]),He=Ge[0],qe=Ge[1],ze=t.useRef(null),We=t.useRef(!1),Ye=t.useRef(null),Ke=t.useRef({}),Ue=t.useRef([]),Xe=t.useRef(!1),Je=t.useRef(!1),$e=t.useRef(null),Qe=t.useRef(function(){}),Ze=t.useMemo(function(){return(null==Q?void 0:Q.cognitive_decisioning)||{}},[Q]),en=t.useState({width:0,height:0}),nn=en[0],tn=en[1],on=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),te)},[te]),rn=t.useRef(null),ln=t.useRef(null),un=t.useRef(null),cn=t.useRef(null),an=t.useRef(null),sn=t.useRef(null),dn=t.useRef(null),vn=t.useRef(null),fn=t.useRef(!1),gn=t.useRef(null),pn=t.useRef(null),hn=p.useComparePopups(rn),xn=hn.cognitivePopup,_n=hn.setCognitivePopup,mn=hn.moreFunctions,Rn=hn.setMoreFunctions,yn=hn.position,Sn=hn.setPosition,bn=hn.activeBadgeId,An=hn.summaryPopup,En=hn.setSummaryPopup,Tn=hn.closeSummaryPopup,In=hn.setActiveBadgeId,Bn=hn.popupRef,Cn=hn.closeCognitivePopup,Dn=hn.closeMoreFunctionsPopup,On=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==Z?void 0:Z.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==Z?void 0:Z.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==Z?void 0:Z.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==Z?void 0:Z.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[Z]),wn=t.useState(null),Nn=wn[0];wn[1];var jn=null===(B=null===(T=null==Q?void 0:Q.documents)||void 0===T?void 0:T[null===(I=null==Q?void 0:Q.input_index_map)||void 0===I?void 0:I[0]])||void 0===B?void 0:B.title,Pn=null===(O=null===(C=null==Q?void 0:Q.documents)||void 0===C?void 0:C[null===(D=null==Q?void 0:Q.input_index_map)||void 0===D?void 0:D[1]])||void 0===O?void 0:O.title,Fn=u.safeStringify(ee||jn||"Uploaded Contract"),kn=u.safeStringify(ne||Pn||"Reference Template"),Mn=g.useCognitiveTreeData(Q,ve,ce,On,Ie),Vn=Mn.activeProposed,Ln=Mn.existingRule,Gn=Mn.proposedSections,Hn=Mn.existingSections,qn=Mn.visibleFields,zn=Mn.parentDeviationRecord,Wn=Mn.deviationNumberRegistry,Yn=Mn.parseError;t.useEffect(function(){Yn&&be("Failed to load comparison: ".concat(Yn))},[Yn]);var Kn=Gn.length>0||Hn.length>0,Un=h.useSectionRefs(qn.map(function(e){return e.key}),Math.max(Gn.length,Hn.length)),Xn=Un.leftRefs,Jn=Un.rightRefs,$n=Un.sectionLeftRefs,Qn=Un.sectionRightRefs,Zn=Un.lhsBadgeRefs,et=Un.rhsBadgeRefs,nt=Un.sectionRightRowRefs,tt=Un.subSectionLeftRefs,it=Un.subSectionRightRefs,ot=Un.sectionRowRefs,rt=Un.getSectionRowRef,lt=Un.getSubSectionRef,ut=Un.getBadgeRef,ct=Ln.analysis,at=u.safeStringify(null===(N=null===(w=null==ct?void 0:ct.rule_difference_comparison)||void 0===w?void 0:w.summary)||void 0===N?void 0:N.overall_summary),st=!!at.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),dt=null!==(j=null==Q?void 0:Q.base_root_id)&&void 0!==j?j:"-1";null==Q||Q[dt];var vt=Ie?null!==(Y=null!==(q=ce&&(null===(H=null==ce?void 0:ce[dt])||void 0===H?void 0:H.evaluation_result))&&void 0!==q?q:null===(W=null===(z=null==Q?void 0:Q.nodes)||void 0===z?void 0:z[dt])||void 0===W?void 0:W.evaluation_result)&&void 0!==Y?Y:null:null!==(G=null!==(k=ce&&(null===(F=null===(P=null==ce?void 0:ce[dt])||void 0===P?void 0:P.evaluation_result)||void 0===F?void 0:F[0]))&&void 0!==k?k:null===(L=null===(V=null===(M=null==Q?void 0:Q.nodes)||void 0===M?void 0:M[dt])||void 0===V?void 0:V.evaluation_result)||void 0===L?void 0:L[0])&&void 0!==G?G:null,ft=u.extractDeviationScore(vt),gt=u.generateColorPalette(null!==(X=null===(U=null===(K=null==vt?void 0:vt.evaluation_outputs)||void 0===K?void 0:K.metadata)||void 0===U?void 0:U.label_color)&&void 0!==X?X:""),pt=t.useCallback(function(){var e,n,t,i,o,r;Te(!1),Je.current=!1;var l=$e.current,c=Dt.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=tt.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=$n.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=$n.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=it.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=Qn.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Qn.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Fe(null),$e.current=null,Dt.current=null,De(!1),Re(!1),cn.current&&(cn.current.style.height="0px"),an.current&&(an.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),dn.current&&(dn.current.style.height="0px")},[]),ht=t.useCallback(function(){pt(),Le(new Set),qe([]),Ue.current=[],Ft([]),Vt(null),En(a.EMPTY_SUMMARY_POPUP_STATE),Cn(),requestAnimationFrame(function(){var e;null===(e=Qe.current)||void 0===e||e.call(Qe)})},[]);t.useEffect(function(){ht()},[ie]);var xt=x.useAccordionState({maintainRelativeOrder:!!ve,proposedSections:Gn,existingSections:Hn,activeSideBySideSection:Pe,connectedSections:Ve,resetSideBySide:pt,setConnectedSections:Le,setConnectedLines:qe,cachedConnectedPositions:Ue,svgContainerRef:ze,isAnimatingRef:We,animationTimerRef:Ye,calculateLinesRef:Qe,sectionLeftRefs:$n,sectionRightRefs:Qn,subSectionLeftRefs:tt,subSectionRightRefs:it}),_t=xt.expandedSections,mt=xt.setExpandedSections,Rt=xt.expandedSubSections,yt=xt.setExpandedSubSections,St=xt.toggleSection,bt=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?Ze[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=ot.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==re?void 0:re.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==Q?void 0:Q.documents,input_index_map:null==Q?void 0:Q.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}},[Ze,Q]),At=t.useCallback(function(e){Dn(),Sn(null),_n(e)},[Dn]),Et=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),mn.open&&mn.sectionIdx===o)Dn();else{var c=e.currentTarget,a="left";(null===(l=un.current)||void 0===l?void 0:l.contains(c))&&(a="right");Je.current&&pt(),Le(new Set),qe([]),Ue.current=[],Cn(),An.open?li():Tn(),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=et.current[l])||void 0===e?void 0:e.current:null===(n=Zn.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=et.current[o])||void 0===t?void 0:t.current:null===(i=Zn.current[o])||void 0===i?void 0:i.current}()||c;Rn(bt(e,n,i,o,t,r))})}},Tt=t.useCallback(function(){null!==mn.sectionIdx&&mn.anchorEl?At(e.__assign(e.__assign({},mn),{open:!0})):Dn()},[mn,Dn,At]),It=t.useCallback(function(){var e=mn.sectionIdx,n=mn.isOrphan;Dn(),Tn(),null!==e&&(n?be("No counterpart exists to connect to."):(Je.current&&pt(),qe([]),Ue.current=[],Le(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Qe.current&&Qe.current()},50)))},[mn.sectionIdx,mn.isOrphan,Dn,Tn,pt]),Bt=t.useRef(null),Ct=t.useRef(null),Dt=t.useRef(null),Ot=t.useRef(null),wt=t.useRef(null),Nt=t.useRef(null),jt=t.useState([]),Pt=jt[0],Ft=jt[1];t.useRef(null);var kt=t.useState(null),Mt=kt[0],Vt=kt[1];t.useEffect(function(){if(Nn){var e=On.fields.find(function(e){return e.analysisKey===Nn||e.key===Nn});if(e){var n=Xn.current[e.key]||Jn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Nn,On.fields]);var Lt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==ct?void 0:ct.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}},[ct]),Gt=t.useCallback(function(n,t){var i,o,r;void 0===t&&(t="left");var l=null,c=null;if("left"===t)if(l=Gn[n],ve&&l){var s=Hn.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=Hn[n];else if(c=Hn[n],ve&&c){var d=Gn.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=Gn[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})},[Gn,Hn,Ze,On,ve]),Ht=t.useCallback(function(n){for(var t,i,o,r,l,c=n.split("-").map(Number),s=Gn[c[0]],d=Hn[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=Ze[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})},[Gn,Hn,Ze,On]),qt=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==ce?void 0:ce[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Q?void 0:Q.nodes)||void 0===r?void 0:r[n])||void 0===l?void 0:l.evaluation_result)&&void 0!==c?c:null===(s=null==Q?void 0:Q[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})},[ce,Q]),zt=t.useCallback(function(){mt({}),yt({}),pt(),Le(new Set),qe([]),Ue.current=[],Tn(),Cn(),Dn(),requestAnimationFrame(function(){Qe.current&&Qe.current()})},[mt,yt,pt,Tn,Cn,Dn]),Wt=t.useMemo(function(){return Object.values(_t).some(Boolean)||Object.values(Rt).some(Boolean)},[_t,Rt]),Yt=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(!fn.current&&!We.current){fn.current=!0;try{if(!Bt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!_t[t]&&!1===ve)return!1;if(ve&&!_t["left-".concat(t)]&&!_t["right-".concat(t)]&&!_t[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Rt[i])return!1;return!0},E=Bt.current.getBoundingClientRect();tn({width:E.width,height:E.height});var T=[];if(qn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Jn.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")}),!We.current){for(var I=0;I<Math.max(Gn.length,Hn.length);I++){var B=null===(e=$n.current[I])||void 0===e?void 0:e.current,C=null===(n=Qn.current[I])||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")}ve||Object.keys(tt.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=tt.current[e])||void 0===n?void 0:n.current,o=null===(t=it.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={};qn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Jn.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(!We.current)if(ve){if(Ee&&null!==Pe)if("number"==typeof Pe){var N=Pe,j=Gn[N],P=null===(o=$n.current[N])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Hn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Qn.current[t])||void 0===n?void 0:n.current;if(i&&(_t["left-".concat(N)]||_t["right-".concat(t)])){var o=Math.max(P.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=Pe.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(r=tt.current[F])||void 0===r?void 0:r.current,C=null===(l=it.current[F])||void 0===l?void 0:l.current;if(B&&C){k=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,k)}}}}else{Object.keys(tt.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=tt.current[e])||void 0===n?void 0:n.current,o=null===(t=it.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(I=0;I<Math.min(Gn.length,Hn.length);I++){var B=null===(t=$n.current[I])||void 0===t?void 0:t.current,C=null===(i=Qn.current[I])||void 0===i?void 0:i.current;if(B&&C){var k=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[I]=k,O.right[I]=k}}}if(qn.forEach(function(e){var n,t,i=e.key,o=null===(n=Xn.current[i])||void 0===n?void 0:n.current,r=null===(t=Jn.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")}}),We.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=$n.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Qn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ve||Object.keys(w).forEach(function(e){var n,t,i=null===(n=tt.current[e])||void 0===n?void 0:n.current,o=null===(t=it.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")}})),ve)Gn.forEach(function(e,n){var t;(null===(t=$n.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=Hn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=Zn.current[n])||void 0===t?void 0:t.current,g=null===(i=et.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(Ee&&Pe===n){var y=null!==(r=null===(o=vn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=un.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,b=y+(null!==(a=null===(c=vn.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=S+(null!==(d=null===(s=un.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),I=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(I,y,b)-E.top,R=C(B,S,A)-E.top}var D=Gt(n);D&&T.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(I=0;I<Math.min(Gn.length,Hn.length);I++){var M=null===(c=$n.current[I])||void 0===c?void 0:c.current,V=null===(a=Qn.current[I])||void 0===a?void 0:a.current;if(M&&V){var L=M.getBoundingClientRect(),G=V.getBoundingClientRect(),H=Math.max(L.top,G.top)+18-E.top,q=(null===(s=Hn[I])||void 0===s?void 0:s.id)||"sec-".concat(I);($=Gt(I))&&T.push({id:q,x1:L.right-E.left,y1:H,x2:G.left-E.left,y2:H,style:$,sectionIdx:I,hasCognitive:!!((null===(d=Gn[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Hn[I])||void 0===v?void 0:v.cognitiveData)||q&&Ze[q]),isSubSection:!1})}}Object.keys(tt.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=tt.current[e])||void 0===n?void 0:n.current,a=null===(t=it.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Gn[s[0]],v=Hn[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=Ht(e);y&&"Not Defined"!==y.label&&T.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(Ee&&"string"==typeof Pe&&Pe.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Pe.split(u.DEVIATION_BADGE_SEPARATOR),W=z[0],Y=z[1],K=z[2],U=(z[3],"".concat(W).concat(u.DEVIATION_BADGE_SEPARATOR).concat(Y)),X=null===(f=Zn.current[U])||void 0===f?void 0:f.current,J=null===(g=et.current[U])||void 0===g?void 0:g.current;if(X&&J){var $,Q=X.getBoundingClientRect(),Z=J.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(ve){var oe=null!==(h=null===(p=vn.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(_=null===(x=un.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==_?_:0,le=oe+(null!==(R=null===(m=vn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=un.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}($=null!==(b=qt(W,Y))&&void 0!==b?b:Ht(K))&&T.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:$,sectionIdx:Number(K.split("-")[0]),isSubSection:!0,subSectionKeyPath:Pe})}}if(Ft(T),wt.current&&Nt.current){var ae=wt.current.getBoundingClientRect(),se=Nt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-E.top+se.top+se.height/2-E.top)/2;Vt({x1:ae.right-E.left,x2:se.left-E.left,y:de})}else Vt(null);if(Ve.size>0){var fe=[],ge=vn.current,pe=un.current;if(ge&&pe){var he=[],xe=ge.getBoundingClientRect().top,_e=pe.getBoundingClientRect().top,me=xe+ge.clientHeight,Re=_e+pe.clientHeight,ye=ge.scrollTop,Se=pe.scrollTop,be=E.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};Ve.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=Zn.current[v])||void 0===n?void 0:n.current,g=null===(t=et.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=qt(a,s))&&void 0!==i?i:Ht(d),_=(P=p.right-E.left)+.5*((F=h.left-E.left-0)-P),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);he.push({lhsScrollY:y,rhsScrollY:S,x1:P,x2:F,containerTop:be,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:b});var A=Ae(m,xe,me),T=Ae(R,_e,Re),I=A-be,B=T-be,C=R>=_e-4&&R<=Re+4,D="";D=(k=m>=xe-4&&m<=me+4)&&C?u.getBentArrowPath(P,I,F,B):k&&!C?"M ".concat(P,",").concat(I," L ").concat(_,",").concat(I," L ").concat(_,",").concat(B):!k&&C?"M ".concat(_,",").concat(I," L ").concat(_,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(_,",").concat(I," L ").concat(_,",").concat(B),fe.push({id:b,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(ve){var O=e,w=Gn[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=Hn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Zn.current[O])||void 0===n?void 0:n.current,r=null===(t=et.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Gt(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);he.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),fe.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,j=N;f=null===(o=Zn.current[N])||void 0===o?void 0:o.current,g=null===(r=et.current[j])||void 0===r?void 0:r.current;if(!f||!g)return;var P,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=Gt(N),_=(P=p.right-E.left)+.5*((F=h.left-E.left-0)-P),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(j);he.push({lhsScrollY:y,rhsScrollY:S,x1:P,x2:F,containerTop:be,leftIdx:N,rhsArrayIdx:j,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:b});var k;A=Ae(m,xe,me),T=Ae(R,_e,Re),I=A-be,B=T-be,C=R>=_e-4&&R<=Re+4,D="";D=(k=m>=xe-4&&m<=me+4)&&C?u.getBentArrowPath(P,I,F,B):k&&!C?"M ".concat(P,",").concat(I," L ").concat(_,",").concat(I," L ").concat(_,",").concat(B):!k&&C?"M ".concat(_,",").concat(I," L ").concat(_,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(_,",").concat(I," L ").concat(_,",").concat(B),fe.push({id:b,pathD:D,style:x,leftIdx:N,rhsArrayIdx:j})}}),Ue.current=he}qe(fe)}else qe([]),Ue.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{fn.current=!1}}},[qn,Gn,Hn,Ze,On,Lt,Gt,qt,ve,Ee,Pe,Ve,_t,Rt]),Kt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=Ue.current;if(p.length&&!We.current){var h=null!==(n=null===(e=vn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=un.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,_=null!==(r=null===(o=vn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=un.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=vn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=un.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+_,b=y+m,A=null!==(g=null===(f=Bt.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=Ke.current[e.styleId+"-stroke"],o=Ke.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(){Qe.current=Yt},[Yt]);var Ut=t.useRef(null),Xt=t.useRef(null),Jt=t.useCallback(function(){Ue.current.length>0&&!We.current||(null!==Ut.current&&clearTimeout(Ut.current),Ut.current=setTimeout(function(){Qe.current(),Ut.current=null},50))},[]),$t=t.useCallback(function(){Ne(!0),De(!1),null!==Xt.current&&clearTimeout(Xt.current),null!==Ut.current&&(clearTimeout(Ut.current),Ut.current=null),Xt.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s,d;try{if(Ue.current=[],Je.current&&null!==$e.current&&null!==Dt.current){var v=$e.current,f=Dt.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=Zn.current[R])||void 0===e?void 0:e.current)||null,h=(null===(n=et.current[R])||void 0===n?void 0:n.current)||null,x=(null===(t=tt.current[m[2]])||void 0===t?void 0:t.current)||(null===(i=$n.current[Number(m[2])])||void 0===i?void 0:i.current)||null,_=(null===(o=it.current[m[3]])||void 0===o?void 0:o.current)||(null===(r=Qn.current[Number(m[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=ot.current[v])||void 0===l?void 0:l.current)||null,x=(null===(c=$n.current[v])||void 0===c?void 0:c.current)||null,h=(null===(a=nt.current[f])||void 0===a?void 0:a.current)||null,_=(null===(s=Qn.current[f])||void 0===s?void 0:s.current)||null;if(p&&h&&x&&_){if(x.style.paddingTop="0px",_.style.paddingTop="0px",!ve){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=vn.current,E=un.current;if(A&&E){var T=p.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,I=h.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-(T-A.scrollTop);Math.abs(E.scrollTop-I)>1&&(E.scrollTop=I)}}}null===(d=Qe.current)||void 0===d||d.call(Qe),Je.current&&De(!0)}catch(e){console.error("Safely caught error during resize calculation:",e)}finally{Ne(!1),Xt.current=null}},150)},[ve,Gn,Hn]),Qt=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==gn.current&&pn.current&&Math.abs(e.currentTarget.scrollTop-gn.current)<=2){var v=pn.current;gn.current=null,pn.current=null,v()}if(!ke.current){if(ve||Jt(),Je.current){var f=$e.current,g=Dt.current,p=vn.current,h=un.current;if(null!==f&&null!==g&&p&&h){var x="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=Zn.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=ot.current[f])||void 0===t?void 0:t.current,_="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=et.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=nt.current[g])||void 0===o?void 0:o.current;if(x&&_&&Ot.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=Zn.current[S])||void 0===r?void 0:r.current,R=null===(l=et.current[S])||void 0===l?void 0:l.current}else m=null===(c=Zn.current[f])||void 0===c?void 0:c.current,R=null===(a=et.current[g])||void 0===a?void 0:a.current;var b=null!==(d=null===(s=Bt.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 T=m.getBoundingClientRect(),I=R.getBoundingClientRect(),B=T.top+T.height/2;I.top,I.height;var C=((O=B,w=A,N=E,Math.max(w,Math.min(N,O)))-b).toString();Ot.current.setAttribute("y1",C),Ot.current.setAttribute("y2",C);var D=B>=A-4&&B<=E+4;Ot.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,N;Ue.current.length>0&&!Xe.current&&(Xe.current=!0,requestAnimationFrame(function(){Kt(),Xe.current=!1}))}},[Kt,ve,Jt]),Zt=t.useRef(0),ei=t.useRef(0),ni=t.useRef(0),ti=t.useRef(function(){});t.useRef(null),t.useEffect(function(){ti.current=$t},[$t]),t.useEffect(function(){var e=setTimeout(Jt,250),n=function(){return ti.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==Ut.current&&clearTimeout(Ut.current),null!==Xt.current&&clearTimeout(Xt.current),window.removeEventListener("resize",n)}},[Vn,Ln,ct,qn,_t,Rt,Gn,Hn,On,Jt,Ee,Pe,Ce,Ve]),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 ln.current&&o.push(e(ln.current,Zt,n,function(){return ti.current()},function(){})),rn.current&&o.push(e(rn.current,ei,t,function(){return ti.current()},function(){return Qe.current()})),Bt.current&&o.push(e(Bt.current,ni,i,function(){return ti.current()},function(){return Qe.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(){Je.current=Ee},[Ee]),t.useEffect(function(){$e.current=Pe},[Pe]);var ii=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";Dn(),null!=e&&(n?be("No counterpart exists for this section."):Ee&&Pe===e?r?pt():null==l||l():(Le(new Set([e])),qe([]),Ue.current=[],Re(!0),ke.current=!0,Fe(e),$e.current=e,Te(!0),Je.current=!0,De(!1),cn.current&&(cn.current.style.height="0px"),an.current&&(an.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),dn.current&&(dn.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=Zn.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=et.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=ot.current[e])||void 0===i?void 0:i.current)||null,ve){var p=Gn[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],_=Hn.findIndex(function(e){return e.selfIndex===x});-1!==_&&(d=(null===(r=nt.current[_])||void 0===r?void 0:r.current)||null,v=_)}}else d=(null===(o=nt.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;Dt.current=v;var m=vn.current,R=un.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=tt.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=$n.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=it.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=Qn.current[Number(R[3])])||void 0===o?void 0:o.current)||null,_=(null===(r=Zn.current[y])||void 0===r?void 0:r.current)||h,m=(null===(l=et.current[y])||void 0===l?void 0:l.current)||x}else{var S=Number(e),b=null!==v?Number(v):S;h=(null===(c=$n.current[S])||void 0===c?void 0:c.current)||null,x=(null===(s=Qn.current[b])||void 0===s?void 0:s.current)||null,_=(null===(d=Zn.current[S])||void 0===d?void 0:d.current)||(null===(f=ot.current[S])||void 0===f?void 0:f.current)||h,m=(null===(g=et.current[b])||void 0===g?void 0:g.current)||(null===(p=nt.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(),T=A.top-E.top;T>0?x.style.paddingTop="".concat(T,"px"):T<0&&(h.style.paddingTop="".concat(Math.abs(T),"px"))}}(),De(!0),Qe.current&&Qe.current(),ke.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Re(!1),null==l||l()};if(!s||!m)return ke.current=!1,Re(!1),void(null==l||l());if(d&&R){if(!ve){var S=0;S="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var b=rn.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 T=s.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,I=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=I-(T-m.scrollTop);C<0&&cn.current&&(cn.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 an.current&&(an.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=T-(I-R.scrollTop);D<0&&sn.current&&(sn.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 dn.current&&(dn.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()})))},[Pe,Dn,Hn,Ee,ve,Gn,pt]),oi=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;Cn();var c="left";(null===(o=un.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=et.current[l])||void 0===e?void 0:e.current:null===(t=Zn.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=et.current[n])||void 0===i?void 0:i.current:null===(o=Zn.current[n])||void 0===o?void 0:o.current};if(t)return pt(),Le(new Set),qe([]),Ue.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;En({open:!0,anchorEl:e,summary:i})}));ii(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;En({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[ii,Cn,En,pt]),ri=t.useCallback(function(){var e,n=mn.sectionIdx,t=mn.isOrphan;if(Tn(),null!=n){var i="left";mn.anchorEl&&(null===(e=un.current)||void 0===e?void 0:e.contains(mn.anchorEl))&&(i="right"),ii(n,t,{sourceSide:i})}},[ii,mn.isOrphan,mn.sectionIdx,mn.anchorEl,Tn]),li=t.useCallback(function(){Tn(),pt(),Le(new Set),qe([]),Ue.current=[]},[Tn,pt]),ui=null!==mn.sectionIdx&&Ve.has(mn.sectionIdx),ci=_.useDeviationNavigation({proposedSections:Gn,existingSections:Hn,parentDeviationRecord:zn,expandedSections:_t,maintainRelativeOrder:!!ve,scrollContainerRef:rn,leftContainerRef:vn,lhsBadgeRefs:Zn,rhsBadgeRefs:et}),ai=ci.showDeviationNavigation,si=ci.showOpenNodeRef,di=t.useMemo(function(){var e;if(!ae)return null;var n=null===(e=null==ae?void 0:ae.id)||void 0===e?void 0:e.split(":")[0];for(var t in zn){if((zn[t]||[]).some(function(e){return e.id===n}))return t}return null},[ae,zn]),vi=t.useRef({id:null,triggerMs:null}),fi=t.useRef(null);t.useEffect(function(){var n;if(null==ae?void 0:ae.id){var t=Number(ae.trigger),i=vi.current;if((null==i?void 0:i.triggerMs)!==t){var o=null===(n=null==ae?void 0:ae.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],c=null!=l?l:"0";fi.current!==ae.id&&(Tn(),Cn(),pt(),Le(new Set),qe([]),Ue.current=[],fi.current=ae.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(){vi.current={id:ae.id,triggerMs:t}},h=null,x=null;for(var _ in zn){var m=zn[_].find(function(e){return e.id===r});if(m){h=_,x=m;break}}if(x&&h){var R=Gn.findIndex(function(e){return e.id===h}),y=Hn.findIndex(function(e){return e.id===h}),S=-1===R&&-1!==y,b=f(Gn,x.id),A=f(Hn,x.id);if(b&&!A&&!S){var E=b.split("-"),T=Number(E[0]);if(ve){var I=null===(i=null===(n=Gn[T])||void 0===n?void 0:n.refIndexes)||void 0===i?void 0:i[0],B=Hn.findIndex(function(e){return e.selfIndex===I});-1!==B&&(T=B)}A=e.__spreadArray([T],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(!(ve?!!_t["right-".concat(O)]:!!_t[String(O)])&&O>=0)return St(O,"right"),s+=1,void(d=setTimeout(g,450))}else if(!(ve?!!_t["left-".concat(D)]:!!_t[String(D)])&&D>=0)return St(D,"left"),s+=1,void(d=setTimeout(g,450));var w,N=b||"",j=A||"",P="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(N).concat(u.DEVIATION_BADGE_SEPARATOR).concat(j),F="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c),k=null===(o=Zn.current[F])||void 0===o?void 0:o.current,M=null===(l=et.current[F])||void 0===l?void 0:l.current,V=C||!k&&!!M,L=V?M:k;if(w=ve?V?un.current:vn.current:rn.current,L&&w){var G=L.getBoundingClientRect();if(0===G.height)return void((s+=1)<2?d=setTimeout(g,v):p());var H=w.getBoundingClientRect(),q=G.top-H.top+w.scrollTop-H.height/2+G.height/2,z=function(){var n,t,i,o,r;if(!a){p();var l=window.getComputedStyle(L).color;k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){k&&(k.style.boxShadow=""),M&&(M.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(!(!!k&&!!M)){var d=V?(null===(o=et.current[F])||void 0===o?void 0:o.current)||M:(null===(r=Zn.current[F])||void 0===r?void 0:r.current)||k;return En({open:!0,anchorEl:d,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})}),void(null==se||se())}ii(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t=(null===(n=Zn.current[F])||void 0===n?void 0:n.current)||k;En({open:!0,anchorEl:t,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})})}})}};Math.abs(w.scrollTop-q)<=2?z():(gn.current=q,pn.current=z,w.scrollTo({top:q,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(pn.current){gn.current=null;var e=pn.current;pn.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)}}}},[ae,zn,Gn,Hn,ve,_t,St,ii,En]);var gi=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:Rt,setExpandedSubSections:yt,maintainRelativeOrder:ve||!1,proposedSections:Gn,existingSections:Hn,treeData:Q,deviationNumberRegistry:Wn,connectedSections:Ve,activeSideBySideSection:Pe,resolvedMarkdownStyles:on,getSubSectionRef:lt,getSubSectionCompareStyle:Ht,getBadgeRef:ut,openMoreFunctionsPopup:Et,openSummaryPopup:oi,showDeviationBadges:ge,resetSideBySide:pt,setConnectedSections:Le,setConnectedLines:qe,cachedConnectedPositions:Ue})};return n.jsxs(i.Box,e.__assign({ref:ln,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ve?{}:{overflow:"visible"}),{position:"relative"})},{children:[he&&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,{})})),An.open&&n.jsx(S.default,{open:An.open,anchorEl:An.anchorEl,containerEl:Ct.current,clipTopEl:wt.current,scrollContainerEl:rn.current,onClose:li,summary:An.summary}),n.jsx(d.default,{open:mn.open,anchorEl:mn.anchorEl,sectionTitle:mn.sectionTitle,referenceSectionTitle:mn.refSectionTitle,onClose:Dn,onOpenCognitiveCompare:Tt,onOpenSideBySide:ri,onConnect:It,isConnected:ui,isOrphan:mn.isOrphan}),xn.open&&n.jsx(s.default,{open:xn.open,popupRef:Bn,position:yn,popupConfig:le,onClose:function(){Sn(null),_n(function(n){return e.__assign(e.__assign({},n),{open:!1})}),In(null)},markdownStyles:te,sectionTitle:xn.sectionTitle,referenceSectionTitle:xn.refSectionTitle,cognitiveData:xn.cognitiveData,anchorEl:xn.anchorEl,sectionAnchorEl:xn.sectionAnchorEl,scrollContainerEl:rn.current,badgeStyle:xn.badgeStyle,docData:xn.docData,deviationData:xn.deviationData,isLoading:xn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Se,autoHideDuration:8e3,onClose:function(){return be(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return be(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Se}))})),n.jsx(m.default,{componentHeaderText:$,displayConfig:re,maintainRelativeOrder:ve,onCollapseAll:zt,showCollapseAll:Wt,onToggleView:function(e){xe(!0),setTimeout(function(){fe(!e),pt(),Tn(),Le(new Set),qe([]),Ue.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){xe(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:rn,onScroll:Qt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ve?"hidden":"auto",borderTop:at&&st?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ve?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Bt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ve?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:ze,style:{position:"absolute",top:0,left:0,width:nn.width||"100%",height:nn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:we?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Mt&&n.jsx("g",{children:n.jsx("line",{x1:Mt.x1,y1:Mt.y,x2:Mt.x2,y2:Mt.y,stroke:gt.badgeBorder,strokeWidth:"1.5"})}),Pt.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?Ee&&Pe===t.subSectionKeyPath&&Ce:Ee&&Pe===t.sectionIdx&&Ce)return null;if(!ve){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),_=Gn[t.sectionIdx]||{title:"",content:""},m=Hn[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,T=null;b.length>0&&(E=Gn[b[0]]),A.length>0&&(T=Hn[A[0]]);var I=(null==E?void 0:E.title)||"",B=(null==T?void 0:T.title)||"";console.log("Root Parent Titles:",I,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==T?void 0:T.subsections)&&(T=T.subsections[A[C]]);E&&(_=e.__assign(e.__assign({},E),{title:I||E.title})),console.log("Base Section for Subsection Badge:",_),T&&(m=e.__assign(e.__assign({},T),{title:B||T.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&&(xn.open&&bn===t.id?Cn():(In(t.id),At(bt(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:xn.open&&bn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),He.map(function(t){var i,o=t.pathD,r=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),u="".concat(t.id,"-bg"),c="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:r})}))}))}),n.jsx("path",{ref:function(e){Ke.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){Ke.current[c]=e},d:o,fill:"none",stroke:r,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},ve?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:wt,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:Fn,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:Fn}))}))})),n.jsxs(i.Box,e.__assign({ref:vn,onScroll:Qt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},ve?{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:sn,style:{width:"100%",height:"0px",flexShrink:0}}),Kn&&Gn.map(function(t,r){var l,c,a=!t.title&&!t.content;if(ve&&a)return null;var s=t,d=Gt(r,"left"),v=ve?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Hn[r],g=ve?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ve.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:rt(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:$n.current[r],sx:e.__assign({width:"100%",display:"flex"},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:rt("left-accordion-".concat(r)),mb:0,treeData:Q,proposedSections:Gn,existingSections:Hn,deviationNumberRegistry:Wn,getSectionCompareStyle:Gt,getBadgeRef:ut,connectedSections:Ve,openMoreFunctionsPopup:Et,openSummaryPopup:oi,deviationNodeIdToView:null==ae?void 0:ae.id,deviationTargetParentId:di,parentNodeId:(null===(c=null==Q?void 0:Q.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:ve?!!_t["left-".concat(r)]:!!_t[String(r)],onToggle:function(){li(),St(r,"left")},navigation:t.id?ai[t.id]:null,showOpenNodeRef:si,resolvedMarkdownStyles:on,maintainRelativeOrder:ve,showDeviationBadges:ge,renderSubSections:gi})})),ve&&d&&n.jsxs(i.Box,e.__assign({ref:Zn.current[r],onClick:function(e){var n=ve?Hn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Hn[r]||{title:"",content:""};Et(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:[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:!re.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?v?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(f.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:dn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:Ct,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(),xn.open&&bn===dt?Cn():(In(dt),At(bt(n.currentTarget,{title:"",content:"",evaluationResult:vt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,dt,!0,e.__assign(e.__assign({},gt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:gt.badgeBg,color:gt.badgeText,border:"1px solid ".concat(gt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=ft?ft: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:xn.open&&bn===dt?"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},ve?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[me&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Nt,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:kn,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:kn}))}))})),n.jsxs(i.Box,e.__assign({ref:un,onScroll:Qt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},ve?{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:cn,style:{width:"100%",height:"0px",flexShrink:0}}),Kn&&Hn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(ve){u=Gn.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=Gn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=Gn.findIndex(function(e,n){var t;return Ve.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Gt(d))}else u=[o+1],(c=Ve.has(o))&&(a=Gt(o));var v=Gt(ve&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:nt.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:Qn.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:rt("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Q?void 0:Q.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:ve?!!_t["right-".concat(o)]:!!_t[String(o)],treeData:Q,proposedSections:Gn,existingSections:Hn,deviationNumberRegistry:Wn,getBadgeRef:ut,getSectionCompareStyle:Gt,connectedSections:Ve,openMoreFunctionsPopup:Et,openSummaryPopup:oi,deviationNodeIdToView:null==ae?void 0:ae.id,deviationTargetParentId:di,onToggle:function(){li(),St(o,"right")},navigation:t.id?ai[t.id]:null,showOpenNodeRef:si,resolvedMarkdownStyles:on,maintainRelativeOrder:ve,showDeviationBadges:ge,renderSubSections:gi})})),ve&&v&&n.jsx(i.Box,e.__assign({ref:et.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:an,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./CognitiveCompareConstants.js"),n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},o=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return o(t)}))};var e=["#B91C1C","#A16207","#1D4ED8","#000000"],r=function(t){var n=e.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?e.length:n};exports.DEVIATION_BADGE_SEPARATOR="::",exports.areMarkdownPropsEqual=function(t,n){var o,e,r,i,u,a;if(t.content!==n.content)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;var l=t.highlights||[],
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./CognitiveCompareConstants.js"),n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},o=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return o(t)}))};var e=["#B91C1C","#A16207","#1D4ED8","#000000"],r=function(t){var n=e.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?e.length:n};exports.DEVIATION_BADGE_SEPARATOR="::",exports.areMarkdownPropsEqual=function(t,n){var o,e,r,i,u,a;if(t.content!==n.content)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;var l=t.highlights||[],v=n.highlights||[];if(l.length!==v.length)return!1;for(var s=0;s<l.length;s++)if(l[s]!==v[s])return!1;var d=t.deviationBadges||[],c=n.deviationBadges||[];if(d.length!==c.length)return!1;for(s=0;s<d.length;s++){if(d[s].id!==c[s].id)return!1;if(d[s].actionId!==c[s].actionId)return!1;if(d[s].label!==c[s].label)return!1;if(d[s].score!==c[s].score)return!1;if(d[s].isOrphan!==c[s].isOrphan)return!1;if(d[s].isConnected!==c[s].isConnected)return!1;if((null===(o=d[s].style)||void 0===o?void 0:o.badgeBg)!==(null===(e=c[s].style)||void 0===e?void 0:e.badgeBg))return!1;if((null===(r=d[s].style)||void 0===r?void 0:r.badgeBorder)!==(null===(i=c[s].style)||void 0===i?void 0:i.badgeBorder))return!1;if((null===(u=d[s].style)||void 0===u?void 0:u.badgeText)!==(null===(a=c[s].style)||void 0===a?void 0:a.badgeText))return!1}return!0},exports.debounce=function(t,n){var o;return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=this;clearTimeout(o),o=setTimeout(function(){return t.apply(i,e)},n)}},exports.extractDeviationScore=function(t,n){var o,e,r,i,u,a,l;if(!t)return n;var v=null!==(a=null!==(i=null!==(e=null===(o=t.evaluation_output)||void 0===o?void 0:o.output_score)&&void 0!==e?e:null===(r=t.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==i?i:null===(u=t.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==a?a:t.output_score;return null!==(l=null!=v?v:n)&&void 0!==l?l:""},exports.generateColorPalette=function(t){var n=function(t,n){var o=function(t){var n=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),o=parseInt(n,16);return{r:o>>16&255,g:o>>8&255,b:255&o}}(t),e=o.r,r=o.g,i=o.b;return function(t,n,o){return"#"+[t,n,o].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(e+(255-e)*n),Math.round(r+(255-r)*n),Math.round(i+(255-i)*n))};return{bg:n(t,.8),border:n(t,.5),badgeBg:n(t,.8),badgeBorder:n(t,.5),badgeText:t.toUpperCase(),highlightBg:n(t,.8)}},exports.getBentArrowPath=function(t,n,o,e,r){void 0===r&&(r=14);var i=t+.5*(o-t),u=e-n;if(Math.abs(u)<3)return"M ".concat(t," ").concat(n," H ").concat(o);var a=u>0?1:-1,l=Math.min(r,Math.abs(u)/2,Math.abs(i-t)/2,Math.abs(o-i)/2);return["M ".concat(t," ").concat(n),"H ".concat(i-l),"Q ".concat(i," ").concat(n," ").concat(i," ").concat(n+a*l),"V ".concat(e-a*l),"Q ".concat(i," ").concat(e," ").concat(i+l," ").concat(e),"H ".concat(o)].join(" ")},exports.getFirstDeviationColor=function(n){for(var o,e,i,u,a,l,v,s,d,c,f,g,p,h=[],b=0,_=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});b<_.length;b++){var m=_[b];(B=null===(u=null===(i=null===(e=null===(o=null==n?void 0:n.deviations)||void 0===o?void 0:o[m])||void 0===e?void 0:e.evaluation_outputs)||void 0===i?void 0:i.metadata)||void 0===u?void 0:u.label_color)&&h.push(B)}for(var y=0,x=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});y<x.length;y++){m=x[y];(B=null===(s=null===(v=null===(l=null===(a=null==n?void 0:n.deviation_entries)||void 0===a?void 0:a[m])||void 0===l?void 0:l.evaluation_outputs)||void 0===v?void 0:v.metadata)||void 0===s?void 0:s.label_color)&&h.push(B)}for(var O=0,A=Object.keys(n||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});O<A.length;O++){var B;m=A[O];(B=null===(f=null===(c=null===(d=null==n?void 0:n[m])||void 0===d?void 0:d.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===f?void 0:f.label_color)&&h.push(B)}return 0===h.length?(null===(p=null===(g=null==n?void 0:n.evaluation_outputs)||void 0===g?void 0:g.metadata)||void 0===p?void 0:p.label_color)?n.evaluation_outputs.metadata.label_color:t.DEFAULT_DEVIAION_COLOR:h.sort(function(t,n){return r(t)-r(n)})[0]},exports.getFirstDeviationOutputValue=function(t){for(var n,o,e,r,i,u,a,l,v,s=0,d=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});s<d.length;s++){var c=d[s];if(b=null===(e=null===(o=null===(n=null==t?void 0:t.deviations)||void 0===n?void 0:n[c])||void 0===o?void 0:o.evaluation_outputs)||void 0===e?void 0:e.output_value)return b}for(var f=0,g=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});f<g.length;f++){c=g[f];if(b=null===(u=null===(i=null===(r=null==t?void 0:t.deviation_entries)||void 0===r?void 0:r[c])||void 0===i?void 0:i.evaluation_outputs)||void 0===u?void 0:u.output_value)return b}for(var p=0,h=Object.keys(t||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});p<h.length;p++){var b;c=h[p];if(b=null===(l=null===(a=null==t?void 0:t[c])||void 0===a?void 0:a.evaluation_outputs)||void 0===l?void 0:l.output_value)return b}return(null===(v=null==t?void 0:t.evaluation_outputs)||void 0===v?void 0:v.output_value)?t.evaluation_outputs.output_value:null},exports.getRationale=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=t.mapping_rationale,o=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:o,citations:n.citations},score:0,relation:"N/A"}},exports.getSideData=function(t,o,e){var r,i=e[o],u=null===(r=null==t?void 0:t.comparison_inputs)||void 0===r?void 0:r[i];return{title:n((null==u?void 0:u.title)||""),content:n((null==u?void 0:u.content)||""),attributes:(null==u?void 0:u.additional_attributes)||null,subsections:(null==u?void 0:u.subsections)||[]}},exports.hasValue=o,exports.isMissingStr=function(t){if(!t)return!0;var n=t.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},exports.mixHexColors=function(t,n){var o=function(t){var n=t.replace("#","");return[parseInt(n.substring(0,2),16),parseInt(n.substring(2,4),16),parseInt(n.substring(4,6),16)]},e=function(t){var n=Math.round(t).toString(16);return 1===n.length?"0"+n:n};try{var r=o(t),i=o(n),u=(r[0]+i[0])/2*.95,a=(r[1]+i[1])/2*.95,l=(r[2]+i[2])/2*.95;return"#".concat(e(u)).concat(e(a)).concat(e(l))}catch(t){return"#FDE68A"}},exports.safeStringify=n,exports.smoothScrollTo=function(t,n,o,e,r){void 0===o&&(o=300);var i=t.style.scrollBehavior;t.style.scrollBehavior="auto";var u=t.scrollTop,a=n-u,l=null,v=function(s){null===l&&(l=s);var d,c=s-l;c<o?(t.scrollTop=(d=c,d/=o,a*(--d*d*d+1)+u),r&&r(),requestAnimationFrame(v)):(t.scrollTop=n,t.style.scrollBehavior=i,r&&r(),e&&e())};requestAnimationFrame(v)};
|
|
2
2
|
//# sourceMappingURL=CognitiveComparehelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("@mui/material"),r=require("react"),t=require("../CognitiveCompareConstants.js"),o=require("lucide-react"),l=require("react-markdown"),a=require("../CognitiveComparehelpers.js"),s=require("rehype-raw");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(r),u=c(l),g=c(s),h=d.default.memo(function(l){var s=l.content,c=l.sxStyles,h=l.deviationBadges,p=void 0===h?[]:h,f=l.highlights,v=void 0===f?[]:f,_=l.maintainRelativeOrder,x=void 0===_||_,m=l.highlightBg,b=r.useMemo(function(){return p.reduce(function(n,i){var r;return e.__assign(e.__assign({},n),((r={})[i.id]=i,r))},{})},[p]),y=function(n,i){return d.default.Children.map(n,function(n){var r;if(!d.default.isValidElement(n))return n;var t=(null===(r=n.props)||void 0===r?void 0:r.children)?y(n.props.children,i):n.props.children,o=d.default.cloneElement(n,e.__assign(e.__assign({},n.props),{children:t}));return i(o)})},C=r.useMemo(function(){return{mark:function(i){var r,t,o,l,a=i.children,s=e.__rest(i,["children"]),c=s["data-badge-id"],d=c?b[c]:null,u=s["data-highlight-color"],g=null!==(l=null!==(t=null!=u?u:null===(r=null==d?void 0:d.style)||void 0===r?void 0:r.highlightBg)&&void 0!==t?t:null===(o=null==d?void 0:d.style)||void 0===o?void 0:o.badgeBg)&&void 0!==l?l:m;return n.jsx("span",e.__assign({style:e.__assign(e.__assign({},s.isSuggestedDeviationFix?{}:{backgroundColor:g}),{borderRadius:"2px"})},{children:a}))},span:function(r){var l,a,s,c,d,u,g=r.children,h=e.__rest(r,["children"]),p=h["data-badge-id"];if(!p)return n.jsx("span",e.__assign({},h,{children:g}));var f=b[p];if(!f)return n.jsx("span",e.__assign({},h,{children:g}));var v="number"==typeof f.stackIndex?f.stackIndex:0,_="translateY(calc(-20% + ".concat(24*v,"px))");return n.jsxs(i.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[n.jsxs(i.Box,e.__assign({ref:f.badgeRef,sx:e.__assign(e.__assign({fontStyle:"normal",position:"absolute",zIndex:30+v,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(l=f.style)||void 0===l?void 0:l.badgeBg)||"#EEF2FF",color:(null===(a=f.style)||void 0===a?void 0:a.badgeText)||t.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(s=f.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden"},"left"===f.side?{right:"-16px",transform:"".concat(_," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(_," translateX(calc(-100% - 8px))")}),f.isConnected&&f.style&&{outline:"2px solid ".concat(f.style.badgeBorder),outlineOffset:"1px"})},{children:[n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),f.onSummaryClick&&f.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:f.label})),("left"===f.side||f.isOrphan)&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=f.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=f.score&&"N/A"!==f.score&&"NA"!==f.score&&0!==f.score?"".concat(f.score):"N/A"===f.score||"NA"===f.score?"N/A":"Same"}))]})),("left"===f.side||f.isOrphan)&&n.jsx(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),f.onClick&&f.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(d=f.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:n.jsx(o.EllipsisVertical,{size:12,color:(null===(u=f.style)||void 0===u?void 0:u.badgeText)||"#3730A3"})}))]})),g]}))},updated:function(i){var r=i.children;return e.__rest(i,["children"]),n.jsx(n.Fragment,{children:r})},deleted:function(i){var r=i.children;e.__rest(i,["children"]),console.log("nitish: ",r);var t=y(r,function(e){return d.default.cloneElement(e,{isSuggestedDeviationFix:!0})});return n.jsx("span",e.__assign({style:{borderTop:"1px solid #EF4444",borderBottom:"1px solid #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:t}))},changed:function(i){var r=i.children;e.__rest(i,["children"]);var t=y(r,function(e){return d.default.cloneElement(e,{isSuggestedDeviationFix:!0})});return n.jsx("span",e.__assign({style:{borderTop:"1px solid #2F59FF",borderBottom:"1px solid #2F59FF",backgroundColor:"#D5E8FF"}},{children:t}))}}},[b,x]),E=function(e){return e?e.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(e){return e.startsWith("\n")?e:e.replace(/\n/g," ")}).join(""):""},j=r.useMemo(function(){var e=E(a.safeStringify(s||"")),n=(p||[]).map(function(e){var n,i;return{id:null==e?void 0:e.id,highlight:E((null==e?void 0:e.highlight)||""),highlightColor:(null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.highlightBg)||(null===(i=null==e?void 0:e.style)||void 0===i?void 0:i.badgeBg)||m}}).filter(function(e){return e.id&&e.highlight}),i={};n.forEach(function(e){i[e.highlight]||(i[e.highlight]=[]),i[e.highlight].push(e)});var r=Object.keys(i).sort(function(e,n){return n.length-e.length}),t=new Set,o=function(e,n,i,r,t){void 0===n&&(n=""),void 0===i&&(i=""),void 0===r&&(r="");var o=e.startsWith("\n\n"),l=e.endsWith("\n\n"),a=t?' data-highlight-color="'.concat(t,'"'):"";return i+e.split(/(\n{2,})/).map(function(e,i,r){if(/^\n{2,}$/.test(e))return e;if(!e.trim())return e;var t=0===i||1===i&&/^\n{2,}$/.test(r[0]),s=i===r.length-1||i===r.length-2&&/^\n{2,}$/.test(r[r.length-1]);return o&&t||l&&s?e:'<mark data-badge-id="'.concat(n,'"').concat(a,">").concat(e,"</mark>")}).join("").replace(/^\n{2,}/,"").replace(/\n{2,}$/,"")+r},l={},c=0;r.forEach(function(n){for(var s=i[n],d=s[0],u=d.highlightColor,g=1;g<s.length;g++)u=a.mixHexColors(u,s[g].highlightColor);var h=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),p=r.filter(function(e){return n.length>e.length&&n.includes(e)}).sort(function(e,n){return n.length-e.length}),f=function(e){var r=n;return p.forEach(function(n){for(var l=i[n],s=l[0].highlightColor,c=1;c<l.length;c++)s=a.mixHexColors(s,l[c].highlightColor);var d=a.mixHexColors(u,s),g="",h="";e&&l.forEach(function(e){g+='<span data-badge-id="'.concat(e.id,'">'),h="</span>"+h,t.add(e.id)});var p=o(n,l[0].id,g,h,d);r=r.split(n).join(p)}),r},v=e.includes(n),_=f(v),x=f(!1),m=s.every(function(e){return t.has(e.id)});if(v&&!m){var b="__DEV_TOKEN_".concat(c++,"__"),y="",C="";s.forEach(function(e){y+='<span data-badge-id="'.concat(e.id,'">'),C="</span>"+C,t.add(e.id)}),l[b]=o(_,d.id,y,C,u),e=e.replace(n,b)}var E="__HIGHLIGHT_TOKEN_".concat(c++,"__");l[E]=o(x,d.id,"","",u),e=e.replace(new RegExp(h,"g"),E)});var d=new Set(r);return v.forEach(function(n){if(n){var i=E(n);if(i&&!d.has(i)){var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t="__PLAIN_TOKEN_".concat(c++,"__");l[t]=o(i),e=e.replace(new RegExp(r,"g"),t)}}}),Object.keys(l).forEach(function(n){e=e.split(n).join(l[n])}),e},[s,p,v]);return n.jsx(i.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},c),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}})},{children:n.jsx(u.default,e.__assign({components:C,rehypePlugins:[g.default]},{children:a.safeStringify(j).replace(/\\n/g,"\n")}))}))},a.areMarkdownPropsEqual);exports.MemoizedMarkdown=h;
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.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,getFirstDeviationOutputValue as R,getFirstDeviationColor as C,hasValue as w,getBentArrowPath as B,smoothScrollTo as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as T,DEFAULT_FIELD_CONFIG as _,DEFAULT_COMPARISON_CONFIG as E}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as F,DEFAULT_DEVIAION_COLOR as D,DEFAULT_COMPONENT_HEADER_TEXT as M}from"./CognitiveCompareConstants.js";import k from"./CognitivePopup.js";import A from"./MoreFunctionsPopup.js";import N from"./LoaderComponent.js";import H from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as j}from"./hooks/useCompareData.js";import{useComparePopups as L}from"./hooks/useComparePopups.js";import{useSectionRefs as O}from"./hooks/useSectionRefs.js";import{useAccordionState as P}from"./hooks/useAccordionState.js";import{useDeviationNavigation as z}from"./hooks/useDeviationNavigation.js";import W from"./components/CompareHeader.js";import Y from"./components/SectionAccordion.js";import K from"./components/SubSectionAccordion.js";import q from"./components/CognitiveSummaryPopup.js";var V=function(V){var X,J,U,$,G,Q,Z,nn,en,tn,on,rn,ln,un,cn,dn,an,sn,vn,fn,pn,gn,hn,xn,mn,yn,bn=V.componentHeaderText,Sn=void 0===bn?M:bn,Rn=V.treeData,Cn=V.comparisonConfig,wn=V.leftColumnTitleText,Bn=V.rightColumnTitleText,In=V.markdownStyles,Tn=V.resetTrigger,_n=V.displayConfig,En=void 0===_n?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!0}:_n,Fn=V.popupConfig,Dn=V.deviationData,Mn=void 0===Dn?{}:Dn,kn=V.deviationNodeIdToView,An=V.resetDeviationNodeId,Nn=o(En.maintainRelativeOrder),Hn=Nn[0],jn=Nn[1],Ln=!!Hn||!!(null==En?void 0:En.showDeviationBadges),On=o(!1),Pn=On[0],zn=On[1],Wn=o(!1),Yn=Wn[0],Kn=Wn[1],qn=o(null),Vn=qn[0],Xn=qn[1],Jn=o(!1),Un=Jn[0],$n=Jn[1],Gn=o(null===(J=null!==(X=null==Rn?void 0:Rn.newEvaluationResult)&&void 0!==X?X:null==En?void 0:En.enableDeviationSchemaBackwardCompatibility)||void 0===J||J)[0],Qn=o(!1),Zn=Qn[0],ne=Qn[1],ee=o(!1),te=ee[0],ie=ee[1],oe=o(null),re=oe[0],le=oe[1],ue=r(!1),ce=o(new Set),de=ce[0],ae=ce[1],se=o([]),ve=se[0],fe=se[1],pe=r(null),ge=r(!1),he=r(null),xe=r({}),me=r([]),ye=r(!1),be=r(!1),Se=r(null),Re=r(function(){}),Ce=l(function(){return(null==Rn?void 0:Rn.cognitive_decisioning)||{}},[Rn]),we=o({width:0,height:0}),Be=we[0],Ie=we[1],Te=l(function(){return n(n({},T),In)},[In]),_e=r(null),Ee=r(null),Fe=r(null),De=r(null),Me=r(null),ke=r(null),Ae=r(null),Ne=r(null),He=r(!1),je=r(null),Le=r(null),Oe=L(_e),Pe=Oe.cognitivePopup,ze=Oe.setCognitivePopup,We=Oe.moreFunctions,Ye=Oe.setMoreFunctions,Ke=Oe.position,qe=Oe.setPosition,Ve=Oe.activeBadgeId,Xe=Oe.summaryPopup,Je=Oe.setSummaryPopup,Ue=Oe.closeSummaryPopup,$e=Oe.setActiveBadgeId,Ge=Oe.popupRef,Qe=Oe.closeCognitivePopup,Ze=Oe.closeMoreFunctionsPopup,nt=l(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==Cn?void 0:Cn.fields)&&void 0!==n?n:_,thresholds:{high:null!==(t=null===(e=null==Cn?void 0:Cn.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:E.thresholds.high,medium:null!==(o=null===(i=null==Cn?void 0:Cn.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:E.thresholds.medium,exact:null!==(l=null===(r=null==Cn?void 0:Cn.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:E.thresholds.exact}}},[Cn]),et=o(null),tt=et[0];et[1];var it=null===(G=null===(U=null==Rn?void 0:Rn.documents)||void 0===U?void 0:U[null===($=null==Rn?void 0:Rn.input_index_map)||void 0===$?void 0:$[0]])||void 0===G?void 0:G.title,ot=null===(nn=null===(Q=null==Rn?void 0:Rn.documents)||void 0===Q?void 0:Q[null===(Z=null==Rn?void 0:Rn.input_index_map)||void 0===Z?void 0:Z[1]])||void 0===nn?void 0:nn.title,rt=m(wn||it||"Uploaded Contract"),lt=m(Bn||ot||"Reference Template"),ut=j(Rn,Hn,Mn,nt,Gn),ct=ut.activeProposed,dt=ut.existingRule,at=ut.proposedSections,st=ut.existingSections,vt=ut.visibleFields,ft=ut.parentDeviationRecord,pt=ut.deviationNumberRegistry,gt=ut.parseError;u(function(){gt&&Xn("Failed to load comparison: ".concat(gt))},[gt]);var ht=at.length>0||st.length>0,xt=O(vt.map(function(n){return n.key}),Math.max(at.length,st.length)),mt=xt.leftRefs,yt=xt.rightRefs,bt=xt.sectionLeftRefs,St=xt.sectionRightRefs,Rt=xt.lhsBadgeRefs,Ct=xt.rhsBadgeRefs,wt=xt.sectionRightRowRefs,Bt=xt.subSectionLeftRefs,It=xt.subSectionRightRefs,Tt=xt.sectionRowRefs,_t=xt.getSectionRowRef,Et=xt.getSubSectionRef,Ft=xt.getBadgeRef,Dt=dt.analysis,Mt=m(null===(tn=null===(en=null==Dt?void 0:Dt.rule_difference_comparison)||void 0===en?void 0:en.summary)||void 0===tn?void 0:tn.overall_summary),kt=!!Mt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),At=null!==(on=null==Rn?void 0:Rn.base_root_id)&&void 0!==on?on:"-1";null==Rn||Rn[At];var Nt=Gn?null!==(hn=null!==(fn=Mn&&(null===(vn=null==Mn?void 0:Mn[At])||void 0===vn?void 0:vn.evaluation_result))&&void 0!==fn?fn:null===(gn=null===(pn=null==Rn?void 0:Rn.nodes)||void 0===pn?void 0:pn[At])||void 0===gn?void 0:gn.evaluation_result)&&void 0!==hn?hn:null:null!==(sn=null!==(un=Mn&&(null===(ln=null===(rn=null==Mn?void 0:Mn[At])||void 0===rn?void 0:rn.evaluation_result)||void 0===ln?void 0:ln[0]))&&void 0!==un?un:null===(an=null===(dn=null===(cn=null==Rn?void 0:Rn.nodes)||void 0===cn?void 0:cn[At])||void 0===dn?void 0:dn.evaluation_result)||void 0===an?void 0:an[0])&&void 0!==sn?sn:null,Ht=y(Nt),jt=b(null!==(yn=null===(mn=null===(xn=null==Nt?void 0:Nt.evaluation_outputs)||void 0===xn?void 0:xn.metadata)||void 0===mn?void 0:mn.label_color)&&void 0!==yn?yn:""),Lt=c(function(){var n,e,t,i,o,r;$n(!1),be.current=!1;var l=Se.current,u=Zt.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var c=l.split(S);(d=(null===(n=Bt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=bt.current[Number(c[2])])||void 0===e?void 0:e.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=bt.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=It.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=St.current[Number(c[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=St.current[u])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}le(null),Se.current=null,Zt.current=null,ne(!1),Kn(!1),De.current&&(De.current.style.height="0px"),Me.current&&(Me.current.style.height="0px"),ke.current&&(ke.current.style.height="0px"),Ae.current&&(Ae.current.style.height="0px")},[]),Ot=c(function(){Lt(),ae(new Set),fe([]),me.current=[],Je(F)},[]);u(function(){Ot()},[Tn]);var Pt=P({maintainRelativeOrder:!!Hn,proposedSections:at,existingSections:st,activeSideBySideSection:re,connectedSections:de,resetSideBySide:Lt,setConnectedSections:ae,setConnectedLines:fe,cachedConnectedPositions:me,svgContainerRef:pe,isAnimatingRef:ge,animationTimerRef:he,calculateLinesRef:Re,sectionLeftRefs:bt,sectionRightRefs:St,subSectionLeftRefs:Bt,subSectionRightRefs:It}),zt=Pt.expandedSections,Wt=Pt.setExpandedSections,Yt=Pt.expandedSubSections,Kt=Pt.setExpandedSubSections,qt=Pt.toggleSection,Vt=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?Ce[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=Tt.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null;return{isLoading:null!==(a=null==En?void 0:En.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==Rn?void 0:Rn.documents,input_index_map:null==Rn?void 0:Rn.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}},[Ce,Rn]),Xt=c(function(n){Ze(),qe(null),ze(n)},[Ze]),Jt=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),We.open&&We.sectionIdx===o)Ze();else{var u=n.currentTarget,c="left";(null===(l=Fe.current)||void 0===l?void 0:l.contains(u))&&(c="right");be.current&&Lt(),ae(new Set),fe([]),me.current=[],Qe(),Xe.open?Ei():Ue(),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=Ct.current[l])||void 0===n?void 0:n.current:null===(e=Rt.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=Ct.current[o])||void 0===t?void 0:t.current:null===(i=Rt.current[o])||void 0===i?void 0:i.current}()||u;Ye(Vt(n,e,i,o,t,r))})}},Ut=c(function(){null!==We.sectionIdx&&We.anchorEl?Xt(n(n({},We),{open:!0})):Ze()},[We,Ze,Xt]),$t=c(function(){var n=We.sectionIdx,e=We.isOrphan;Ze(),Ue(),null!==n&&(e?Xn("No counterpart exists to connect to."):(be.current&&Lt(),fe([]),me.current=[],ae(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Re.current&&Re.current()},50)))},[We.sectionIdx,We.isOrphan,Ze,Ue,Lt]),Gt=r(null),Qt=r(null),Zt=r(null),ni=r(null),ei=r(null),ti=r(null),ii=o([]),oi=ii[0],ri=ii[1];r(null);var li=o(null),ui=li[0],ci=li[1];u(function(){if(tt){var n=nt.fields.find(function(n){return n.analysisKey===tt||n.key===tt});if(n){var e=mt.current[n.key]||yt.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[tt,nt.fields]);var di=c(function(n){var e,t,i,o,r,l,u,c,d,a=null===(e=null==Dt?void 0:Dt.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}},[Dt]),ai=c(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=at[e],Hn&&l){var c=st.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=st[e];else if(u=st[e],Hn&&u){var d=at.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=at[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(D)),{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=R(f),g=C(f);return n(n({},b(g)),null!=f?{label:null!==(r=p)&&void 0!==r?r:""}:{label:null})},[at,st,Ce,nt,Hn]),si=c(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=at[u[0]],d=st[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(D)),{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=Ce[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=R(g),x=C(g);return n(n({},b(x)),null!=g?{label:null!=h?h:""}:{label:null})},[at,st,Ce,nt]),vi=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==Mn?void 0:Mn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Rn?void 0:Rn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==Rn?void 0:Rn[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:D;return n(n({},b(C)),{label:null})},[Mn,Rn]),fi=c(function(){Wt({}),Kt({}),Lt(),ae(new Set),fe([]),me.current=[],Ue(),Qe(),Ze(),requestAnimationFrame(function(){Re.current&&Re.current()})},[Wt,Kt,Lt,Ue,Qe,Ze]),pi=l(function(){return Object.values(zt).some(Boolean)||Object.values(Yt).some(Boolean)},[zt,Yt]),gi=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(!He.current&&!ge.current){He.current=!0;try{if(!Gt.current)return;var I=function(n){var e=n.split("-"),t=e[0];if(!zt[t]&&!1===Hn)return!1;if(Hn&&!zt["left-".concat(t)]&&!zt["right-".concat(t)]&&!zt[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!Yt[i])return!1;return!0},T=Gt.current.getBoundingClientRect();Ie({width:T.width,height:T.height});var _=[];if(vt.forEach(function(n){var e,t,i=n.key,o=null===(e=mt.current[i])||void 0===e?void 0:e.current,r=null===(t=yt.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")}),!ge.current){for(var E=0;E<Math.max(at.length,st.length);E++){var F=null===(n=bt.current[E])||void 0===n?void 0:n.current,D=null===(e=St.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),D&&(D.style.height="auto",D.style.minHeight="0px")}Hn||Object.keys(Bt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Bt.current[n])||void 0===e?void 0:e.current,o=null===(t=It.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 M={};vt.forEach(function(n){var e,t,i=n.key,o=null===(e=mt.current[i])||void 0===e?void 0:e.current,r=null===(t=yt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();M[i]=Math.max(l.height,u.height)}});var k={left:{},right:{}},A={};if(!ge.current)if(Hn){if(Un&&null!==re)if("number"==typeof re){var N=re,H=at[N],j=null===(o=bt.current[N])||void 0===o?void 0:o.current;j&&H&&(H.refIndexes||[]).forEach(function(n){var e,t=st.findIndex(function(e){return e.selfIndex===n}),i=null===(e=St.current[t])||void 0===e?void 0:e.current;if(i&&(zt["left-".concat(N)]||zt["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);k.left[N]=Math.max(k.left[N]||0,o),k.right[t]=Math.max(k.right[t]||0,o)}})}else{var L=re.split(S)[2];if(L){F=null===(r=Bt.current[L])||void 0===r?void 0:r.current,D=null===(l=It.current[L])||void 0===l?void 0:l.current;if(F&&D){O=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);A[L]=Math.max(A[L]||0,O)}}}}else{Object.keys(Bt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Bt.current[n])||void 0===e?void 0:e.current,o=null===(t=It.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);A[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(at.length,st.length);E++){var F=null===(t=bt.current[E])||void 0===t?void 0:t.current,D=null===(i=St.current[E])||void 0===i?void 0:i.current;if(F&&D){var O=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);k.left[E]=O,k.right[E]=O}}}if(vt.forEach(function(n){var e,t,i=n.key,o=null===(e=mt.current[i])||void 0===e?void 0:e.current,r=null===(t=yt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=M[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),ge.current||(Object.entries(k.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=bt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(k.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=St.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Hn||Object.keys(A).forEach(function(n){var e,t,i=null===(e=Bt.current[n])||void 0===e?void 0:e.current,o=null===(t=It.current[n])||void 0===t?void 0:t.current;if(i&&o&&A[n]){var r=A[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),Hn)at.forEach(function(n,e){var t;(null===(t=bt.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=st.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var f=null===(t=Rt.current[e])||void 0===t?void 0:t.current,p=null===(i=Ct.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(Un&&re===e){var S=null!==(r=null===(o=Ne.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=Fe.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(d=null===(c=Ne.current)||void 0===c?void 0:c.clientHeight)&&void 0!==d?d:1/0),w=R+(null!==(s=null===(a=Fe.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),B=g.top+g.height/2,I=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(B,S,C)-T.top,b=E(I,R,w)-T.top}var F=ai(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(at.length,st.length);E++){var P=null===(u=bt.current[E])||void 0===u?void 0:u.current,z=null===(c=St.current[E])||void 0===c?void 0:c.current;if(P&&z){var W=P.getBoundingClientRect(),Y=z.getBoundingClientRect(),K=Math.max(W.top,Y.top)+18-T.top,q=(null===(d=st[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=ai(E))&&_.push({id:q,x1:W.right-T.left,y1:K,x2:Y.left-T.left,y2:K,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=at[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=st[E])||void 0===s?void 0:s.cognitiveData)||q&&Ce[q]),isSubSection:!1})}}Object.keys(Bt.current).forEach(function(n){var e,t,i,o,r,l;if(I(n)){var u=null===(e=Bt.current[n])||void 0===e?void 0:e.current,c=null===(t=It.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var d=n.split("-").map(Number),a=at[d[0]],s=st[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=si(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(Un&&"string"==typeof re&&re.includes(S)){var V=re.split(S),X=V[0],J=V[1],U=V[2],$=(V[3],"".concat(X).concat(S).concat(J)),G=null===(v=Rt.current[$])||void 0===v?void 0:v.current,Q=null===(f=Ct.current[$])||void 0===f?void 0:f.current;if(G&&Q){var Z,nn=G.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(Hn){var un=null!==(g=null===(p=Ne.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(x=null===(h=Fe.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,dn=un+(null!==(y=null===(m=Ne.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),an=cn+(null!==(R=null===(b=Fe.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=vi(X,J))&&void 0!==C?C:si(U))&&_.push({id:"line-subsec-".concat($),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(U.split("-")[0]),isSubSection:!0,subSectionKeyPath:re})}}if(ri(_),ei.current&&ti.current){var vn=ei.current.getBoundingClientRect(),fn=ti.current.getBoundingClientRect(),pn=(vn.top+vn.height/2-T.top+fn.top+fn.height/2-T.top)/2;ci({x1:vn.right-T.left,x2:fn.left-T.left,y:pn})}else ci(null);if(de.size>0){var gn=[],hn=Ne.current,xn=Fe.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,wn=xn.scrollTop,Bn=T.top,In=function(n,e,t){return Math.max(e,Math.min(t,n))};de.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=Rt.current[s])||void 0===e?void 0:e.current,f=null===(t=Ct.current[s])||void 0===t?void 0:t.current;if(!v||!f)return;var p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=null!==(i=vi(c,d))&&void 0!==i?i:si(a),x=(H=p.right-T.left)+.5*((j=g.left-T.left-0)-H),m=p.top+p.height/2,y=g.top+g.height/2,b=m-yn+Cn,R=y-bn+wn,C="conn-subsec-".concat(s);mn.push({lhsScrollY:b,rhsScrollY:R,x1:H,x2:j,containerTop:Bn,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var w=In(m,yn,Sn),I=In(y,bn,Rn),_=w-Bn,E=I-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(L=m>=yn-4&&m<=Sn+4)&&F?B(H,_,j,E):L&&!F?"M ".concat(H,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!L&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:n,rhsArrayIdx:n})}else if(Hn){var M=n,k=at[M];if(!(null===(l=null==k?void 0:k.refIndexes)||void 0===l?void 0:l.length))return;k.refIndexes.forEach(function(n){var e,t,i=st.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=Rt.current[M])||void 0===e?void 0:e.current,r=null===(t=Ct.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=ai(M),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+wn,h="conn-".concat(M,"-").concat(i);mn.push({lhsScrollY:p,rhsScrollY:g,x1:d,x2:a,containerTop:Bn,leftIdx:M,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var x=In(v,yn,Sn),m=In(f,bn,Rn),y=x-Bn,b=m-Bn,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:M,rhsArrayIdx:i})}}})}else{var A=n,N=A;v=null===(o=Rt.current[A])||void 0===o?void 0:o.current,f=null===(r=Ct.current[N])||void 0===r?void 0:r.current;if(!v||!f)return;var H,j;p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=ai(A),x=(H=p.right-T.left)+.5*((j=g.left-T.left-0)-H),m=p.top+p.height/2,y=g.top+g.height/2,b=m-yn+Cn,R=y-bn+wn,C="conn-".concat(A,"-").concat(N);mn.push({lhsScrollY:b,rhsScrollY:R,x1:H,x2:j,containerTop:Bn,leftIdx:A,rhsArrayIdx:N,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var L;w=In(m,yn,Sn),I=In(y,bn,Rn),_=w-Bn,E=I-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(L=m>=yn-4&&m<=Sn+4)&&F?B(H,_,j,E):L&&!F?"M ".concat(H,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!L&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:A,rhsArrayIdx:N})}}),me.current=mn}fe(gn)}else fe([]),me.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{He.current=!1}}},[vt,at,st,Ce,nt,di,ai,vi,Hn,Un,re,de,zt,Yt]),hi=c(function(){var n,e,t,i,o,r,l,u,c,d,a,s,v,f,p=me.current;if(p.length&&!ge.current){var g=null!==(e=null===(n=Ne.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=Fe.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=Ne.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(u=null===(l=Fe.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(d=null===(c=Ne.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=Fe.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=Gt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,w=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=xe.current[n.styleId+"-stroke"],o=xe.current[n.styleId+"-bg"];if(i||o){var r,l=w(e,y,S),u=w(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(){Re.current=gi},[gi]);var xi=r(null),mi=r(null),yi=c(function(){me.current.length>0&&!ge.current||(null!==xi.current&&clearTimeout(xi.current),xi.current=setTimeout(function(){Re.current(),xi.current=null},50))},[]),bi=c(function(){ie(!0),ne(!1),null!==mi.current&&clearTimeout(mi.current),null!==xi.current&&(clearTimeout(xi.current),xi.current=null),mi.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,d;if(me.current=[],be.current&&null!==Se.current&&null!==Zt.current){var a=Se.current,s=Zt.current,v=null,f=null,p=null,g=null;if("string"==typeof a&&a.includes(S)){var h=a.split(S),x="".concat(h[0]).concat(S).concat(h[1]);v=(null===(n=Rt.current[x])||void 0===n?void 0:n.current)||null,f=(null===(e=Ct.current[x])||void 0===e?void 0:e.current)||null,p=(null===(t=Bt.current[h[2]])||void 0===t?void 0:t.current)||(null===(i=bt.current[Number(h[2])])||void 0===i?void 0:i.current)||null,g=(null===(o=It.current[h[3]])||void 0===o?void 0:o.current)||(null===(r=St.current[Number(h[3])])||void 0===r?void 0:r.current)||null}else v=(null===(l=Tt.current[a])||void 0===l?void 0:l.current)||null,p=(null===(u=bt.current[a])||void 0===u?void 0:u.current)||null,f=(null===(c=wt.current[s])||void 0===c?void 0:c.current)||null,g=(null===(d=St.current[s])||void 0===d?void 0:d.current)||null;if(v&&f&&p&&g){if(p.style.paddingTop="0px",g.style.paddingTop="0px",!Hn){var m=v.getBoundingClientRect(),y=f.getBoundingClientRect(),b=m.top-y.top;b>0?g.style.paddingTop="".concat(b,"px"):b<0&&(p.style.paddingTop="".concat(Math.abs(b),"px"))}var R=Ne.current,C=Fe.current;if(R&&C){var w=v.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=f.getBoundingClientRect().top-C.getBoundingClientRect().top+C.scrollTop-(w-R.scrollTop);Math.abs(C.scrollTop-B)>1&&(C.scrollTop=B)}}}Re.current(),be.current&&ne(!0),ie(!1),mi.current=null},150)},[Hn,at,st]),Si=c(function(n){var e,t,i,o,r,l,u,c,d,a;if(null!==je.current&&Le.current&&Math.abs(n.currentTarget.scrollTop-je.current)<=2){var s=Le.current;je.current=null,Le.current=null,s()}if(!ue.current){if(Hn||yi(),be.current){var v=Se.current,f=Zt.current,p=Ne.current,g=Fe.current;if(null!==v&&null!==f&&p&&g){var h="string"==typeof v&&v.includes(S)?null===(e=Rt.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===e?void 0:e.current:null===(t=Tt.current[v])||void 0===t?void 0:t.current,x="string"==typeof f&&f.includes(S)?null===(i=Ct.current["".concat(f.split(S)[0]).concat(S).concat(f.split(S)[1])])||void 0===i?void 0:i.current:null===(o=wt.current[f])||void 0===o?void 0:o.current;if(h&&x&&ni.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=Rt.current[R])||void 0===r?void 0:r.current,y=null===(l=Ct.current[R])||void 0===l?void 0:l.current}else m=null===(u=Rt.current[v])||void 0===u?void 0:u.current,y=null===(c=Ct.current[f])||void 0===c?void 0:c.current;var C=null!==(a=null===(d=Gt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,w=p.getBoundingClientRect().top,B=w+p.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var I=m.getBoundingClientRect(),T=y.getBoundingClientRect(),_=I.top+I.height/2;T.top,T.height;var E=((D=_,M=w,k=B,Math.max(M,Math.min(k,D)))-C).toString();ni.current.setAttribute("y1",E),ni.current.setAttribute("y2",E);var F=_>=w-4&&_<=B+4;ni.current.setAttribute("visibility",F?"visible":"hidden")}}}}var D,M,k;me.current.length>0&&!ye.current&&(ye.current=!0,requestAnimationFrame(function(){hi(),ye.current=!1}))}},[hi,Hn,yi]),Ri=r(0),Ci=r(0),wi=r(0),Bi=r(function(){});r(null),u(function(){Bi.current=bi},[bi]),u(function(){var n=setTimeout(yi,250),e=function(){return Bi.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==xi.current&&clearTimeout(xi.current),null!==mi.current&&clearTimeout(mi.current),window.removeEventListener("resize",e)}},[ct,dt,Dt,vt,zt,Yt,at,st,nt,yi,Un,re,Zn,de]),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 Ee.current&&o.push(n(Ee.current,Ri,e,function(){return Bi.current()},function(){})),_e.current&&o.push(n(_e.current,Ci,t,function(){return Bi.current()},function(){return Re.current()})),Gt.current&&o.push(n(Gt.current,wi,i,function(){return Bi.current()},function(){return Re.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),u(function(){be.current=Un},[Un]),u(function(){Se.current=re},[re]);var Ii=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";Ze(),null!=n&&(e?Xn("No counterpart exists for this section."):Un&&re===n?r?Lt():null==l||l():(ae(new Set([n])),fe([]),me.current=[],Kn(!0),ue.current=!0,le(n),Se.current=n,$n(!0),be.current=!0,ne(!1),De.current&&(De.current.style.height="0px"),Me.current&&(Me.current.style.height="0px"),ke.current&&(ke.current.style.height="0px"),Ae.current&&(Ae.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=Rt.current[f])||void 0===e?void 0:e.current)||null,a=(null===(t=Ct.current[f])||void 0===t?void 0:t.current)||null,s=a?n:null}else if(d=(null===(i=Tt.current[n])||void 0===i?void 0:i.current)||null,Hn){var p=at[n],g=(null==p?void 0:p.refIndexes)||[];if(g.length>0){var h=g[0],x=st.findIndex(function(n){return n.selfIndex===h});-1!==x&&(a=(null===(r=wt.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else a=(null===(o=wt.current[n])||void 0===o?void 0:o.current)||null,s=a?n:null;Zt.current=s;var m=Ne.current,y=Fe.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=Bt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=bt.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=It.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=St.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=Rt.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=Ct.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(n),C=null!==s?Number(s):R;g=(null===(u=bt.current[R])||void 0===u?void 0:u.current)||null,h=(null===(d=St.current[C])||void 0===d?void 0:d.current)||null,x=(null===(a=Rt.current[R])||void 0===a?void 0:a.current)||(null===(v=Tt.current[R])||void 0===v?void 0:v.current)||g,m=(null===(f=Ct.current[C])||void 0===f?void 0:f.current)||(null===(p=wt.current[C])||void 0===p?void 0:p.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var w=x.getBoundingClientRect(),B=m.getBoundingClientRect(),I=w.top-B.top;I>0?h.style.paddingTop="".concat(I,"px"):I<0&&(g.style.paddingTop="".concat(Math.abs(I),"px"))}}(),ne(!0),Re.current&&Re.current(),ue.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Kn(!1),null==l||l()};if(!d||!m)return ue.current=!1,Kn(!1),void(null==l||l());if(a&&y){if(!Hn){var R=0;R="right"===u?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=_e.current,w=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+R-w-150:0;return C?void I(C,B,200,b):void b()}var T=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,_=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=_-(T-m.scrollTop);F<0&&De.current&&(De.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 Me.current&&(Me.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(y,F,E,b)})}n=F}I(y,n,E,b)})}else{var D=T-(_-y.scrollTop);D<0&&ke.current&&(ke.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var n,e=m.scrollHeight-m.clientHeight;if(D<0)n=0;else{if(D>e){var t=D-e;return Ae.current&&(Ae.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,D,E,b)})}n=D}I(m,n,E,b)})}}else b()})))},[re,Ze,st,Un,Hn,at,Lt]),Ti=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;Qe();var u="left";(null===(o=Fe.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=Ct.current[l])||void 0===n?void 0:n.current:null===(t=Rt.current[l])||void 0===t?void 0:t.current}return"right"===u?null===(i=Ct.current[e])||void 0===i?void 0:i.current:null===(o=Rt.current[e])||void 0===o?void 0:o.current};if(t)return Lt(),ae(new Set),fe([]),me.current=[],void(r&&requestAnimationFrame(function(){var n=c()||l;Je({open:!0,anchorEl:n,summary:i})}));Ii(e,t,r?{toggleIfSame:!1,sourceSide:u,onReady:function(){var n=c()||l;Je({open:!0,anchorEl:n,summary:i})}}:{toggleIfSame:!1,sourceSide:u})},[Ii,Qe,Je,Lt]),_i=c(function(){var n,e=We.sectionIdx,t=We.isOrphan;if(Ue(),null!=e){var i="left";We.anchorEl&&(null===(n=Fe.current)||void 0===n?void 0:n.contains(We.anchorEl))&&(i="right"),Ii(e,t,{sourceSide:i})}},[Ii,We.isOrphan,We.sectionIdx,We.anchorEl,Ue]),Ei=c(function(){Ue(),Lt(),ae(new Set),fe([]),me.current=[]},[Ue,Lt]),Fi=null!==We.sectionIdx&&de.has(We.sectionIdx),Di=z({proposedSections:at,existingSections:st,parentDeviationRecord:ft,expandedSections:zt,maintainRelativeOrder:!!Hn,scrollContainerRef:_e,leftContainerRef:Ne,lhsBadgeRefs:Rt,rhsBadgeRefs:Ct}),Mi=Di.showDeviationNavigation,ki=Di.showOpenNodeRef,Ai=l(function(){if(!kn)return null;var n=kn.id.split(":")[0];for(var e in ft){if((ft[e]||[]).some(function(e){return e.id===n}))return e}return null},[kn,ft]),Ni=r({id:null,triggerMs:null}),Hi=r(null);u(function(){if(null==kn?void 0:kn.id){var t=Number(kn.trigger),i=Ni.current;if(!(i.id===kn.id&&null!=i.triggerMs&&t-i.triggerMs<=1e3)){Ni.current={id:kn.id,triggerMs:t};var o=kn.id.split(":"),r=o[0],l=o[1],u=null!=l?l:"0";Hi.current!==kn.id&&(Ue(),Qe(),Lt(),ae(new Set),fe([]),me.current=[],Hi.current=kn.id);var c=!1,d=0,a=null,s=150,v=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},f=function(){var t,i,o,l;if(!c){var p=null,g=null;for(var h in ft){var x=ft[h].find(function(n){return n.id===r});if(x){p=h,g=x;break}}if(g&&p){var m=at.findIndex(function(n){return n.id===p}),y=st.findIndex(function(n){return n.id===p}),b=-1===m&&-1!==y,R=v(at,g.id),C=v(st,g.id);if(R&&!C&&!b){var w=R.split("-"),B=Number(w[0]);if(Hn){var I=null===(i=null===(t=at[B])||void 0===t?void 0:t.refIndexes)||void 0===i?void 0:i[0],T=st.findIndex(function(n){return n.selfIndex===I});-1!==T&&(B=T)}C=e([B],w.slice(1),!0).join("-")}if(R||C){var _=b||!R&&!!C,E=R?Number(R.split("-")[0]):m,F=C?Number(C.split("-")[0]):y;if(_){if(!(Hn?!!zt["right-".concat(F)]:!!zt[String(F)])&&F>=0)return qt(F,"right"),d+=1,void(a=setTimeout(f,450))}else if(!(Hn?!!zt["left-".concat(E)]:!!zt[String(E)])&&E>=0)return qt(E,"left"),d+=1,void(a=setTimeout(f,450));var D,M=R||"",k=C||"",A="".concat(g.id).concat(S).concat(u).concat(S).concat(M).concat(S).concat(k),N="".concat(g.id).concat(S).concat(u),H=null===(o=Rt.current[N])||void 0===o?void 0:o.current,j=null===(l=Ct.current[N])||void 0===l?void 0:l.current,L=_||!H&&!!j,O=L?j:H;if(D=Hn?L?Fe.current:Ne.current:_e.current,O&&D){var P=O.getBoundingClientRect();if(0===P.height)return void((d+=1)<20&&(a=setTimeout(f,s)));var z=D.getBoundingClientRect(),W=P.top-z.top+D.scrollTop-z.height/2+P.height/2,Y=function(){var e,t,i,o,r;if(!c){var l=window.getComputedStyle(O).color;H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),j&&(j.style.transition="box-shadow 300ms ease-in-out",j.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),j&&(j.style.boxShadow="")},2e3);var d=(null===(t=null===(e=g.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[u])||g,a=(null===(i=g.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||g.evaluation_outputs;if(!(!!H&&!!j)){var s=L?(null===(o=Ct.current[N])||void 0===o?void 0:o.current)||j:(null===(r=Rt.current[N])||void 0===r?void 0:r.current)||H;return Je({open:!0,anchorEl:s,summary:n(n({},d),{evaluation_outputs:a})}),void(null==An||An())}Ii(A,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t=(null===(e=Rt.current[N])||void 0===e?void 0:e.current)||H;Je({open:!0,anchorEl:t,summary:n(n({},d),{evaluation_outputs:a})})}})}};Math.abs(D.scrollTop-W)<=2?Y():(je.current=W,Le.current=Y,D.scrollTo({top:W,behavior:"smooth"}),a&&clearTimeout(a),a=setTimeout(function(){if(Le.current){je.current=null;var n=Le.current;Le.current=null,n()}},800))}else(d+=1)<20&&(a=setTimeout(f,s))}else(d+=1)<20&&(a=setTimeout(f,s))}else(d+=1)<20&&(a=setTimeout(f,s))}};return a=setTimeout(f,s),function(){c=!0,a&&clearTimeout(a)}}}},[kn,ft,at,st,Hn,zt,qt,Ii,Je]);var ji=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(K,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:void 0===c?"":c,expandedSubSections:Yt,setExpandedSubSections:Kt,maintainRelativeOrder:Hn||!1,proposedSections:at,existingSections:st,treeData:Rn,deviationNumberRegistry:pt,connectedSections:de,activeSideBySideSection:re,resolvedMarkdownStyles:Te,getSubSectionRef:Et,getSubSectionCompareStyle:si,getBadgeRef:Ft,openMoreFunctionsPopup:Jt,openSummaryPopup:Ti,showDeviationBadges:Ln,resetSideBySide:Lt,setConnectedSections:ae,setConnectedLines:fe,cachedConnectedPositions:me})};return t(d,n({ref:Ee,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Hn?{}:{overflow:"visible"}),{position:"relative"})},{children:[Pn&&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(N,{})})),Xe.open&&i(q,{open:Xe.open,anchorEl:Xe.anchorEl,containerEl:Qt.current,clipTopEl:ei.current,scrollContainerEl:_e.current,onClose:Ei,summary:Xe.summary}),i(A,{open:We.open,anchorEl:We.anchorEl,sectionTitle:We.sectionTitle,referenceSectionTitle:We.refSectionTitle,onClose:Ze,onOpenCognitiveCompare:Ut,onOpenSideBySide:_i,onConnect:$t,isConnected:Fi,isOrphan:We.isOrphan}),Pe.open&&i(k,{open:Pe.open,popupRef:Ge,position:Ke,popupConfig:Fn,onClose:function(){qe(null),ze(function(e){return n(n({},e),{open:!1})}),$e(null)},markdownStyles:In,sectionTitle:Pe.sectionTitle,referenceSectionTitle:Pe.refSectionTitle,cognitiveData:Pe.cognitiveData,anchorEl:Pe.anchorEl,sectionAnchorEl:Pe.sectionAnchorEl,scrollContainerEl:_e.current,badgeStyle:Pe.badgeStyle,docData:Pe.docData,deviationData:Pe.deviationData,isLoading:Pe.isLoading}),i(a,n({open:!!Vn,autoHideDuration:8e3,onClose:function(){return Xn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,n({onClose:function(){return Xn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Vn}))})),i(W,{componentHeaderText:Sn,displayConfig:En,maintainRelativeOrder:Hn,onCollapseAll:fi,showCollapseAll:pi,onToggleView:function(n){zn(!0),setTimeout(function(){jn(!n),Lt(),Ue(),ae(new Set),fe([]),me.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){zn(!1)},600)})})},50)}}),i(d,n({ref:_e,onScroll:Si,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Hn?"hidden":"auto",borderTop:Mt&&kt?"none":"1.5px solid #EEF0F4"}},{children:i(d,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Hn?{flex:1,minHeight:0}:{})},{children:t(d,n({ref:Gt,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Hn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:pe,style:{position:"absolute",top:0,left:0,width:Be.width||"100%",height:Be.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:te?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[ui&&i("g",{children:i("line",{x1:ui.x1,y1:ui.y,x2:ui.x2,y2:ui.y,stroke:jt.badgeBorder,strokeWidth:"1.5"})}),oi.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?Un&&re===e.subSectionKeyPath&&Zn:Un&&re===e.sectionIdx&&Zn)return null;if(!Hn){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=at[e.sectionIdx]||{title:"",content:""},x=st[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),w=null,I=null;R.length>0&&(w=at[R[0]]),C.length>0&&(I=st[C[0]]);var T=(null==w?void 0:w.title)||"",_=(null==I?void 0:I.title)||"";console.log("Root Parent Titles:",T,_);for(var E=1;E<R.length;E++)(null==w?void 0:w.subsections)&&(w=w.subsections[R[E]]);for(E=1;E<C.length;E++)(null==I?void 0:I.subsections)&&(I=I.subsections[C[E]]);w&&(g=n(n({},w),{title:T||w.title})),console.log("Base Section for Subsection Badge:",g),I&&(x=n(n({},I),{title:_||I.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),M=(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,k=F||M;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(),k&&(Pe.open&&Ve===e.id?Qe():($e(e.id),Xt(Vt(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:k?"pointer":"default"}},{children:[e.style.badgeText===D&&null==e.style.label?i(H,{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,{})})),k&&i(p,{size:11,style:{transform:Pe.open&&Ve===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),ve.map(function(e){var o,r=e.pathD,l=(null===(o=e.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",u="conn-marker-".concat(e.id),c="".concat(e.id,"-bg"),d="".concat(e.id,"-stroke");return t("g",{children:[i("defs",{children:i("clipPath",n({id:"connections-clip"},{children:i("marker",n({id:u,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:i("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),i("path",{ref:function(n){xe.current[c]=n},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(n){xe.current[d]=n},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(u,")")})]},e.id)})]})),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)"},Hn?{flex:1,overflow:"visible"}:{})},{children:[i(d,n({ref:ei,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:rt,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:rt}))}))})),t(d,n({ref:Ne,onScroll:Si,sx:n({p:"12px",display:"flex",flexDirection:"column"},Hn?{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:ke,style:{width:"100%",height:"0px",flexShrink:0}}),ht&&at.map(function(e,o){var r,l,u=!e.title&&!e.content;if(Hn&&u)return null;var c=e,a=ai(o,"left"),s=Hn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!st[o],v=Hn?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:o+1,f=de.has(o),p=y(c.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,n({ref:_t(o),sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:bt.current[o],sx:n({width:"100%",display:"flex"},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(Y,{section:e,idx:o,columnKey:"left",colRef:_t("left-accordion-".concat(o)),mb:0,treeData:Rn,proposedSections:at,existingSections:st,deviationNumberRegistry:pt,getSectionCompareStyle:ai,getBadgeRef:Ft,connectedSections:de,openMoreFunctionsPopup:Jt,openSummaryPopup:Ti,deviationNodeIdToView:null==kn?void 0:kn.id,deviationTargetParentId:Ai,parentNodeId:(null===(l=null==Rn?void 0:Rn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:Hn?!!zt["left-".concat(o)]:!!zt[String(o)],onToggle:function(){Ei(),qt(o,"left")},navigation:e.id?Mi[e.id]:null,showOpenNodeRef:ki,resolvedMarkdownStyles:Te,maintainRelativeOrder:Hn,showDeviationBadges:Ln,renderSubSections:ji})})),Hn&&a&&t(d,n({ref:Rt.current[o],onClick:function(n){var t=Hn?st.find(function(n){var e;return null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)})||{title:"",content:""}:st[o]||{title:"",content:""};Jt(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:[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:!En.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?s?"No Deviation Found":"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):i(H,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:Ae,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,n({ref:Qt,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(),Pe.open&&Ve===At?Qe():($e(At),Xt(Vt(e.currentTarget,{title:"",content:"",evaluationResult:Nt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,At,!0,n(n({},jt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:jt.badgeBg,color:jt.badgeText,border:"1px solid ".concat(jt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Ht?Ht:i(H,{}),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:Pe.open&&Ve===At?"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},Hn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Yn&&i(x,{sections:11}),i(d,n({ref:ti,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:lt,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:lt}))}))})),t(d,n({ref:Fe,onScroll:Si,sx:n({p:"12px",display:"flex",flexDirection:"column"},Hn?{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:De,style:{width:"100%",height:"0px",flexShrink:0}}),ht&&st.map(function(e,o){var r,l=e,u=[],c=!1,a=null,s=-1;if(Hn){u=at.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=at.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0});var v=at.findIndex(function(n,e){var t;return de.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==v)&&(a=ai(v))}else u=[o+1],(c=de.has(o))&&(a=ai(o));var f=ai(Hn&&-1!==s?s:o);return i(d,n({ref:wt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:St.current[o],sx:n({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(Y,{section:e,idx:o,columnKey:"right",colRef:_t("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Rn?void 0:Rn.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:Hn?!!zt["right-".concat(o)]:!!zt[String(o)],treeData:Rn,proposedSections:at,existingSections:st,deviationNumberRegistry:pt,getBadgeRef:Ft,getSectionCompareStyle:ai,connectedSections:de,openMoreFunctionsPopup:Jt,openSummaryPopup:Ti,deviationNodeIdToView:null==kn?void 0:kn.id,deviationTargetParentId:Ai,onToggle:function(){Ei(),qt(o,"right")},navigation:e.id?Mi[e.id]:null,showOpenNodeRef:ki,resolvedMarkdownStyles:Te,maintainRelativeOrder:Hn,showDeviationBadges:Ln,renderSubSections:ji})})),Hn&&f&&i(d,n({ref:Ct.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:Me,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{V 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,getFirstDeviationOutputValue as R,getFirstDeviationColor as C,hasValue as w,getBentArrowPath as B,smoothScrollTo as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as T,DEFAULT_FIELD_CONFIG as _,DEFAULT_COMPARISON_CONFIG as E}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as F,DEFAULT_DEVIAION_COLOR as D,DEFAULT_COMPONENT_HEADER_TEXT as M}from"./CognitiveCompareConstants.js";import k from"./CognitivePopup.js";import A from"./MoreFunctionsPopup.js";import N from"./LoaderComponent.js";import H from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as j}from"./hooks/useCompareData.js";import{useComparePopups as L}from"./hooks/useComparePopups.js";import{useSectionRefs as O}from"./hooks/useSectionRefs.js";import{useAccordionState as P}from"./hooks/useAccordionState.js";import{useDeviationNavigation as z}from"./hooks/useDeviationNavigation.js";import W from"./components/CompareHeader.js";import Y from"./components/SectionAccordion.js";import q from"./components/SubSectionAccordion.js";import K from"./components/CognitiveSummaryPopup.js";var V=function(V){var X,J,U,$,G,Q,Z,nn,en,tn,on,rn,ln,un,cn,dn,an,sn,vn,fn,pn,gn,hn,xn,mn,yn,bn=V.componentHeaderText,Sn=void 0===bn?M:bn,Rn=V.treeData,Cn=V.comparisonConfig,wn=V.leftColumnTitleText,Bn=V.rightColumnTitleText,In=V.markdownStyles,Tn=V.resetTrigger,_n=V.displayConfig,En=void 0===_n?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!0}:_n,Fn=V.popupConfig,Dn=V.deviationData,Mn=void 0===Dn?{}:Dn,kn=V.deviationNodeIdToView,An=V.resetDeviationNodeId,Nn=o(En.maintainRelativeOrder),Hn=Nn[0],jn=Nn[1],Ln=!!Hn||!!(null==En?void 0:En.showDeviationBadges),On=o(!1),Pn=On[0],zn=On[1],Wn=o(!1),Yn=Wn[0],qn=Wn[1],Kn=o(null),Vn=Kn[0],Xn=Kn[1],Jn=o(!1),Un=Jn[0],$n=Jn[1],Gn=o(null===(J=null!==(X=null==Rn?void 0:Rn.newEvaluationResult)&&void 0!==X?X:null==En?void 0:En.enableDeviationSchemaBackwardCompatibility)||void 0===J||J)[0],Qn=o(!1),Zn=Qn[0],ne=Qn[1],ee=o(!1),te=ee[0],ie=ee[1],oe=o(null),re=oe[0],le=oe[1],ue=r(!1),ce=o(new Set),de=ce[0],ae=ce[1],se=o([]),ve=se[0],fe=se[1],pe=r(null),ge=r(!1),he=r(null),xe=r({}),me=r([]),ye=r(!1),be=r(!1),Se=r(null),Re=r(function(){}),Ce=l(function(){return(null==Rn?void 0:Rn.cognitive_decisioning)||{}},[Rn]),we=o({width:0,height:0}),Be=we[0],Ie=we[1],Te=l(function(){return n(n({},T),In)},[In]),_e=r(null),Ee=r(null),Fe=r(null),De=r(null),Me=r(null),ke=r(null),Ae=r(null),Ne=r(null),He=r(!1),je=r(null),Le=r(null),Oe=L(_e),Pe=Oe.cognitivePopup,ze=Oe.setCognitivePopup,We=Oe.moreFunctions,Ye=Oe.setMoreFunctions,qe=Oe.position,Ke=Oe.setPosition,Ve=Oe.activeBadgeId,Xe=Oe.summaryPopup,Je=Oe.setSummaryPopup,Ue=Oe.closeSummaryPopup,$e=Oe.setActiveBadgeId,Ge=Oe.popupRef,Qe=Oe.closeCognitivePopup,Ze=Oe.closeMoreFunctionsPopup,nt=l(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==Cn?void 0:Cn.fields)&&void 0!==n?n:_,thresholds:{high:null!==(t=null===(e=null==Cn?void 0:Cn.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:E.thresholds.high,medium:null!==(o=null===(i=null==Cn?void 0:Cn.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:E.thresholds.medium,exact:null!==(l=null===(r=null==Cn?void 0:Cn.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:E.thresholds.exact}}},[Cn]),et=o(null),tt=et[0];et[1];var it=null===(G=null===(U=null==Rn?void 0:Rn.documents)||void 0===U?void 0:U[null===($=null==Rn?void 0:Rn.input_index_map)||void 0===$?void 0:$[0]])||void 0===G?void 0:G.title,ot=null===(nn=null===(Q=null==Rn?void 0:Rn.documents)||void 0===Q?void 0:Q[null===(Z=null==Rn?void 0:Rn.input_index_map)||void 0===Z?void 0:Z[1]])||void 0===nn?void 0:nn.title,rt=m(wn||it||"Uploaded Contract"),lt=m(Bn||ot||"Reference Template"),ut=j(Rn,Hn,Mn,nt,Gn),ct=ut.activeProposed,dt=ut.existingRule,at=ut.proposedSections,st=ut.existingSections,vt=ut.visibleFields,ft=ut.parentDeviationRecord,pt=ut.deviationNumberRegistry,gt=ut.parseError;u(function(){gt&&Xn("Failed to load comparison: ".concat(gt))},[gt]);var ht=at.length>0||st.length>0,xt=O(vt.map(function(n){return n.key}),Math.max(at.length,st.length)),mt=xt.leftRefs,yt=xt.rightRefs,bt=xt.sectionLeftRefs,St=xt.sectionRightRefs,Rt=xt.lhsBadgeRefs,Ct=xt.rhsBadgeRefs,wt=xt.sectionRightRowRefs,Bt=xt.subSectionLeftRefs,It=xt.subSectionRightRefs,Tt=xt.sectionRowRefs,_t=xt.getSectionRowRef,Et=xt.getSubSectionRef,Ft=xt.getBadgeRef,Dt=dt.analysis,Mt=m(null===(tn=null===(en=null==Dt?void 0:Dt.rule_difference_comparison)||void 0===en?void 0:en.summary)||void 0===tn?void 0:tn.overall_summary),kt=!!Mt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),At=null!==(on=null==Rn?void 0:Rn.base_root_id)&&void 0!==on?on:"-1";null==Rn||Rn[At];var Nt=Gn?null!==(hn=null!==(fn=Mn&&(null===(vn=null==Mn?void 0:Mn[At])||void 0===vn?void 0:vn.evaluation_result))&&void 0!==fn?fn:null===(gn=null===(pn=null==Rn?void 0:Rn.nodes)||void 0===pn?void 0:pn[At])||void 0===gn?void 0:gn.evaluation_result)&&void 0!==hn?hn:null:null!==(sn=null!==(un=Mn&&(null===(ln=null===(rn=null==Mn?void 0:Mn[At])||void 0===rn?void 0:rn.evaluation_result)||void 0===ln?void 0:ln[0]))&&void 0!==un?un:null===(an=null===(dn=null===(cn=null==Rn?void 0:Rn.nodes)||void 0===cn?void 0:cn[At])||void 0===dn?void 0:dn.evaluation_result)||void 0===an?void 0:an[0])&&void 0!==sn?sn:null,Ht=y(Nt),jt=b(null!==(yn=null===(mn=null===(xn=null==Nt?void 0:Nt.evaluation_outputs)||void 0===xn?void 0:xn.metadata)||void 0===mn?void 0:mn.label_color)&&void 0!==yn?yn:""),Lt=c(function(){var n,e,t,i,o,r;$n(!1),be.current=!1;var l=Se.current,u=Zt.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var c=l.split(S);(d=(null===(n=Bt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=bt.current[Number(c[2])])||void 0===e?void 0:e.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=bt.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=It.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=St.current[Number(c[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=St.current[u])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}le(null),Se.current=null,Zt.current=null,ne(!1),qn(!1),De.current&&(De.current.style.height="0px"),Me.current&&(Me.current.style.height="0px"),ke.current&&(ke.current.style.height="0px"),Ae.current&&(Ae.current.style.height="0px")},[]),Ot=c(function(){Lt(),ae(new Set),fe([]),me.current=[],ri([]),ci(null),Je(F),Qe(),requestAnimationFrame(function(){var n;null===(n=Re.current)||void 0===n||n.call(Re)})},[]);u(function(){Ot()},[Tn]);var Pt=P({maintainRelativeOrder:!!Hn,proposedSections:at,existingSections:st,activeSideBySideSection:re,connectedSections:de,resetSideBySide:Lt,setConnectedSections:ae,setConnectedLines:fe,cachedConnectedPositions:me,svgContainerRef:pe,isAnimatingRef:ge,animationTimerRef:he,calculateLinesRef:Re,sectionLeftRefs:bt,sectionRightRefs:St,subSectionLeftRefs:Bt,subSectionRightRefs:It}),zt=Pt.expandedSections,Wt=Pt.setExpandedSections,Yt=Pt.expandedSubSections,qt=Pt.setExpandedSubSections,Kt=Pt.toggleSection,Vt=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?Ce[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=Tt.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null;return{isLoading:null!==(a=null==En?void 0:En.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==Rn?void 0:Rn.documents,input_index_map:null==Rn?void 0:Rn.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}},[Ce,Rn]),Xt=c(function(n){Ze(),Ke(null),ze(n)},[Ze]),Jt=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),We.open&&We.sectionIdx===o)Ze();else{var u=n.currentTarget,c="left";(null===(l=Fe.current)||void 0===l?void 0:l.contains(u))&&(c="right");be.current&&Lt(),ae(new Set),fe([]),me.current=[],Qe(),Xe.open?Ei():Ue(),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=Ct.current[l])||void 0===n?void 0:n.current:null===(e=Rt.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=Ct.current[o])||void 0===t?void 0:t.current:null===(i=Rt.current[o])||void 0===i?void 0:i.current}()||u;Ye(Vt(n,e,i,o,t,r))})}},Ut=c(function(){null!==We.sectionIdx&&We.anchorEl?Xt(n(n({},We),{open:!0})):Ze()},[We,Ze,Xt]),$t=c(function(){var n=We.sectionIdx,e=We.isOrphan;Ze(),Ue(),null!==n&&(e?Xn("No counterpart exists to connect to."):(be.current&&Lt(),fe([]),me.current=[],ae(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Re.current&&Re.current()},50)))},[We.sectionIdx,We.isOrphan,Ze,Ue,Lt]),Gt=r(null),Qt=r(null),Zt=r(null),ni=r(null),ei=r(null),ti=r(null),ii=o([]),oi=ii[0],ri=ii[1];r(null);var li=o(null),ui=li[0],ci=li[1];u(function(){if(tt){var n=nt.fields.find(function(n){return n.analysisKey===tt||n.key===tt});if(n){var e=mt.current[n.key]||yt.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[tt,nt.fields]);var di=c(function(n){var e,t,i,o,r,l,u,c,d,a=null===(e=null==Dt?void 0:Dt.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}},[Dt]),ai=c(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=at[e],Hn&&l){var c=st.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=st[e];else if(u=st[e],Hn&&u){var d=at.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=at[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(D)),{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=R(f),g=C(f);return n(n({},b(g)),null!=f?{label:null!==(r=p)&&void 0!==r?r:""}:{label:null})},[at,st,Ce,nt,Hn]),si=c(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=at[u[0]],d=st[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(D)),{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=Ce[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=R(g),x=C(g);return n(n({},b(x)),null!=g?{label:null!=h?h:""}:{label:null})},[at,st,Ce,nt]),vi=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==Mn?void 0:Mn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Rn?void 0:Rn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==Rn?void 0:Rn[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:D;return n(n({},b(C)),{label:null})},[Mn,Rn]),fi=c(function(){Wt({}),qt({}),Lt(),ae(new Set),fe([]),me.current=[],Ue(),Qe(),Ze(),requestAnimationFrame(function(){Re.current&&Re.current()})},[Wt,qt,Lt,Ue,Qe,Ze]),pi=l(function(){return Object.values(zt).some(Boolean)||Object.values(Yt).some(Boolean)},[zt,Yt]),gi=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(!He.current&&!ge.current){He.current=!0;try{if(!Gt.current)return;var I=function(n){var e=n.split("-"),t=e[0];if(!zt[t]&&!1===Hn)return!1;if(Hn&&!zt["left-".concat(t)]&&!zt["right-".concat(t)]&&!zt[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!Yt[i])return!1;return!0},T=Gt.current.getBoundingClientRect();Ie({width:T.width,height:T.height});var _=[];if(vt.forEach(function(n){var e,t,i=n.key,o=null===(e=mt.current[i])||void 0===e?void 0:e.current,r=null===(t=yt.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")}),!ge.current){for(var E=0;E<Math.max(at.length,st.length);E++){var F=null===(n=bt.current[E])||void 0===n?void 0:n.current,D=null===(e=St.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),D&&(D.style.height="auto",D.style.minHeight="0px")}Hn||Object.keys(Bt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Bt.current[n])||void 0===e?void 0:e.current,o=null===(t=It.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 M={};vt.forEach(function(n){var e,t,i=n.key,o=null===(e=mt.current[i])||void 0===e?void 0:e.current,r=null===(t=yt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();M[i]=Math.max(l.height,u.height)}});var k={left:{},right:{}},A={};if(!ge.current)if(Hn){if(Un&&null!==re)if("number"==typeof re){var N=re,H=at[N],j=null===(o=bt.current[N])||void 0===o?void 0:o.current;j&&H&&(H.refIndexes||[]).forEach(function(n){var e,t=st.findIndex(function(e){return e.selfIndex===n}),i=null===(e=St.current[t])||void 0===e?void 0:e.current;if(i&&(zt["left-".concat(N)]||zt["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);k.left[N]=Math.max(k.left[N]||0,o),k.right[t]=Math.max(k.right[t]||0,o)}})}else{var L=re.split(S)[2];if(L){F=null===(r=Bt.current[L])||void 0===r?void 0:r.current,D=null===(l=It.current[L])||void 0===l?void 0:l.current;if(F&&D){O=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);A[L]=Math.max(A[L]||0,O)}}}}else{Object.keys(Bt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Bt.current[n])||void 0===e?void 0:e.current,o=null===(t=It.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);A[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(at.length,st.length);E++){var F=null===(t=bt.current[E])||void 0===t?void 0:t.current,D=null===(i=St.current[E])||void 0===i?void 0:i.current;if(F&&D){var O=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);k.left[E]=O,k.right[E]=O}}}if(vt.forEach(function(n){var e,t,i=n.key,o=null===(e=mt.current[i])||void 0===e?void 0:e.current,r=null===(t=yt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=M[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),ge.current||(Object.entries(k.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=bt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(k.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=St.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Hn||Object.keys(A).forEach(function(n){var e,t,i=null===(e=Bt.current[n])||void 0===e?void 0:e.current,o=null===(t=It.current[n])||void 0===t?void 0:t.current;if(i&&o&&A[n]){var r=A[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),Hn)at.forEach(function(n,e){var t;(null===(t=bt.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=st.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var f=null===(t=Rt.current[e])||void 0===t?void 0:t.current,p=null===(i=Ct.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(Un&&re===e){var S=null!==(r=null===(o=Ne.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=Fe.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(d=null===(c=Ne.current)||void 0===c?void 0:c.clientHeight)&&void 0!==d?d:1/0),w=R+(null!==(s=null===(a=Fe.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),B=g.top+g.height/2,I=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(B,S,C)-T.top,b=E(I,R,w)-T.top}var F=ai(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(at.length,st.length);E++){var P=null===(u=bt.current[E])||void 0===u?void 0:u.current,z=null===(c=St.current[E])||void 0===c?void 0:c.current;if(P&&z){var W=P.getBoundingClientRect(),Y=z.getBoundingClientRect(),q=Math.max(W.top,Y.top)+18-T.top,K=(null===(d=st[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=ai(E))&&_.push({id:K,x1:W.right-T.left,y1:q,x2:Y.left-T.left,y2:q,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=at[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=st[E])||void 0===s?void 0:s.cognitiveData)||K&&Ce[K]),isSubSection:!1})}}Object.keys(Bt.current).forEach(function(n){var e,t,i,o,r,l;if(I(n)){var u=null===(e=Bt.current[n])||void 0===e?void 0:e.current,c=null===(t=It.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var d=n.split("-").map(Number),a=at[d[0]],s=st[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=si(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(Un&&"string"==typeof re&&re.includes(S)){var V=re.split(S),X=V[0],J=V[1],U=V[2],$=(V[3],"".concat(X).concat(S).concat(J)),G=null===(v=Rt.current[$])||void 0===v?void 0:v.current,Q=null===(f=Ct.current[$])||void 0===f?void 0:f.current;if(G&&Q){var Z,nn=G.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(Hn){var un=null!==(g=null===(p=Ne.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(x=null===(h=Fe.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,dn=un+(null!==(y=null===(m=Ne.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),an=cn+(null!==(R=null===(b=Fe.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=vi(X,J))&&void 0!==C?C:si(U))&&_.push({id:"line-subsec-".concat($),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(U.split("-")[0]),isSubSection:!0,subSectionKeyPath:re})}}if(ri(_),ei.current&&ti.current){var vn=ei.current.getBoundingClientRect(),fn=ti.current.getBoundingClientRect(),pn=(vn.top+vn.height/2-T.top+fn.top+fn.height/2-T.top)/2;ci({x1:vn.right-T.left,x2:fn.left-T.left,y:pn})}else ci(null);if(de.size>0){var gn=[],hn=Ne.current,xn=Fe.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,wn=xn.scrollTop,Bn=T.top,In=function(n,e,t){return Math.max(e,Math.min(t,n))};de.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=Rt.current[s])||void 0===e?void 0:e.current,f=null===(t=Ct.current[s])||void 0===t?void 0:t.current;if(!v||!f)return;var p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=null!==(i=vi(c,d))&&void 0!==i?i:si(a),x=(H=p.right-T.left)+.5*((j=g.left-T.left-0)-H),m=p.top+p.height/2,y=g.top+g.height/2,b=m-yn+Cn,R=y-bn+wn,C="conn-subsec-".concat(s);mn.push({lhsScrollY:b,rhsScrollY:R,x1:H,x2:j,containerTop:Bn,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var w=In(m,yn,Sn),I=In(y,bn,Rn),_=w-Bn,E=I-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(L=m>=yn-4&&m<=Sn+4)&&F?B(H,_,j,E):L&&!F?"M ".concat(H,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!L&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:n,rhsArrayIdx:n})}else if(Hn){var M=n,k=at[M];if(!(null===(l=null==k?void 0:k.refIndexes)||void 0===l?void 0:l.length))return;k.refIndexes.forEach(function(n){var e,t,i=st.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=Rt.current[M])||void 0===e?void 0:e.current,r=null===(t=Ct.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=ai(M),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+wn,h="conn-".concat(M,"-").concat(i);mn.push({lhsScrollY:p,rhsScrollY:g,x1:d,x2:a,containerTop:Bn,leftIdx:M,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var x=In(v,yn,Sn),m=In(f,bn,Rn),y=x-Bn,b=m-Bn,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:M,rhsArrayIdx:i})}}})}else{var A=n,N=A;v=null===(o=Rt.current[A])||void 0===o?void 0:o.current,f=null===(r=Ct.current[N])||void 0===r?void 0:r.current;if(!v||!f)return;var H,j;p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=ai(A),x=(H=p.right-T.left)+.5*((j=g.left-T.left-0)-H),m=p.top+p.height/2,y=g.top+g.height/2,b=m-yn+Cn,R=y-bn+wn,C="conn-".concat(A,"-").concat(N);mn.push({lhsScrollY:b,rhsScrollY:R,x1:H,x2:j,containerTop:Bn,leftIdx:A,rhsArrayIdx:N,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var L;w=In(m,yn,Sn),I=In(y,bn,Rn),_=w-Bn,E=I-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(L=m>=yn-4&&m<=Sn+4)&&F?B(H,_,j,E):L&&!F?"M ".concat(H,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!L&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:A,rhsArrayIdx:N})}}),me.current=mn}fe(gn)}else fe([]),me.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{He.current=!1}}},[vt,at,st,Ce,nt,di,ai,vi,Hn,Un,re,de,zt,Yt]),hi=c(function(){var n,e,t,i,o,r,l,u,c,d,a,s,v,f,p=me.current;if(p.length&&!ge.current){var g=null!==(e=null===(n=Ne.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=Fe.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=Ne.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(u=null===(l=Fe.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(d=null===(c=Ne.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=Fe.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=Gt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,w=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=xe.current[n.styleId+"-stroke"],o=xe.current[n.styleId+"-bg"];if(i||o){var r,l=w(e,y,S),u=w(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(){Re.current=gi},[gi]);var xi=r(null),mi=r(null),yi=c(function(){me.current.length>0&&!ge.current||(null!==xi.current&&clearTimeout(xi.current),xi.current=setTimeout(function(){Re.current(),xi.current=null},50))},[]),bi=c(function(){ie(!0),ne(!1),null!==mi.current&&clearTimeout(mi.current),null!==xi.current&&(clearTimeout(xi.current),xi.current=null),mi.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,d,a;try{if(me.current=[],be.current&&null!==Se.current&&null!==Zt.current){var s=Se.current,v=Zt.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=Rt.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=Ct.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=Bt.current[m[2]])||void 0===t?void 0:t.current)||(null===(i=bt.current[Number(m[2])])||void 0===i?void 0:i.current)||null,x=(null===(o=It.current[m[3]])||void 0===o?void 0:o.current)||(null===(r=St.current[Number(m[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=Tt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=bt.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=wt.current[v])||void 0===c?void 0:c.current)||null,x=(null===(d=St.current[v])||void 0===d?void 0:d.current)||null;if(p&&g&&h&&x){if(h.style.paddingTop="0px",x.style.paddingTop="0px",!Hn){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 w=Ne.current,B=Fe.current;if(w&&B){var I=p.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop,T=g.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(I-w.scrollTop);Math.abs(B.scrollTop-T)>1&&(B.scrollTop=T)}}}null===(a=Re.current)||void 0===a||a.call(Re),be.current&&ne(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{ie(!1),mi.current=null}},150)},[Hn,at,st]),Si=c(function(n){var e,t,i,o,r,l,u,c,d,a;if(null!==je.current&&Le.current&&Math.abs(n.currentTarget.scrollTop-je.current)<=2){var s=Le.current;je.current=null,Le.current=null,s()}if(!ue.current){if(Hn||yi(),be.current){var v=Se.current,f=Zt.current,p=Ne.current,g=Fe.current;if(null!==v&&null!==f&&p&&g){var h="string"==typeof v&&v.includes(S)?null===(e=Rt.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===e?void 0:e.current:null===(t=Tt.current[v])||void 0===t?void 0:t.current,x="string"==typeof f&&f.includes(S)?null===(i=Ct.current["".concat(f.split(S)[0]).concat(S).concat(f.split(S)[1])])||void 0===i?void 0:i.current:null===(o=wt.current[f])||void 0===o?void 0:o.current;if(h&&x&&ni.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=Rt.current[R])||void 0===r?void 0:r.current,y=null===(l=Ct.current[R])||void 0===l?void 0:l.current}else m=null===(u=Rt.current[v])||void 0===u?void 0:u.current,y=null===(c=Ct.current[f])||void 0===c?void 0:c.current;var C=null!==(a=null===(d=Gt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,w=p.getBoundingClientRect().top,B=w+p.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var I=m.getBoundingClientRect(),T=y.getBoundingClientRect(),_=I.top+I.height/2;T.top,T.height;var E=((D=_,M=w,k=B,Math.max(M,Math.min(k,D)))-C).toString();ni.current.setAttribute("y1",E),ni.current.setAttribute("y2",E);var F=_>=w-4&&_<=B+4;ni.current.setAttribute("visibility",F?"visible":"hidden")}}}}var D,M,k;me.current.length>0&&!ye.current&&(ye.current=!0,requestAnimationFrame(function(){hi(),ye.current=!1}))}},[hi,Hn,yi]),Ri=r(0),Ci=r(0),wi=r(0),Bi=r(function(){});r(null),u(function(){Bi.current=bi},[bi]),u(function(){var n=setTimeout(yi,250),e=function(){return Bi.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==xi.current&&clearTimeout(xi.current),null!==mi.current&&clearTimeout(mi.current),window.removeEventListener("resize",e)}},[ct,dt,Dt,vt,zt,Yt,at,st,nt,yi,Un,re,Zn,de]),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 Ee.current&&o.push(n(Ee.current,Ri,e,function(){return Bi.current()},function(){})),_e.current&&o.push(n(_e.current,Ci,t,function(){return Bi.current()},function(){return Re.current()})),Gt.current&&o.push(n(Gt.current,wi,i,function(){return Bi.current()},function(){return Re.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),u(function(){be.current=Un},[Un]),u(function(){Se.current=re},[re]);var Ii=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";Ze(),null!=n&&(e?Xn("No counterpart exists for this section."):Un&&re===n?r?Lt():null==l||l():(ae(new Set([n])),fe([]),me.current=[],qn(!0),ue.current=!0,le(n),Se.current=n,$n(!0),be.current=!0,ne(!1),De.current&&(De.current.style.height="0px"),Me.current&&(Me.current.style.height="0px"),ke.current&&(ke.current.style.height="0px"),Ae.current&&(Ae.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=Rt.current[f])||void 0===e?void 0:e.current)||null,a=(null===(t=Ct.current[f])||void 0===t?void 0:t.current)||null,s=a?n:null}else if(d=(null===(i=Tt.current[n])||void 0===i?void 0:i.current)||null,Hn){var p=at[n],g=(null==p?void 0:p.refIndexes)||[];if(g.length>0){var h=g[0],x=st.findIndex(function(n){return n.selfIndex===h});-1!==x&&(a=(null===(r=wt.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else a=(null===(o=wt.current[n])||void 0===o?void 0:o.current)||null,s=a?n:null;Zt.current=s;var m=Ne.current,y=Fe.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=Bt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=bt.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=It.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=St.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=Rt.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=Ct.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(n),C=null!==s?Number(s):R;g=(null===(u=bt.current[R])||void 0===u?void 0:u.current)||null,h=(null===(d=St.current[C])||void 0===d?void 0:d.current)||null,x=(null===(a=Rt.current[R])||void 0===a?void 0:a.current)||(null===(v=Tt.current[R])||void 0===v?void 0:v.current)||g,m=(null===(f=Ct.current[C])||void 0===f?void 0:f.current)||(null===(p=wt.current[C])||void 0===p?void 0:p.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var w=x.getBoundingClientRect(),B=m.getBoundingClientRect(),I=w.top-B.top;I>0?h.style.paddingTop="".concat(I,"px"):I<0&&(g.style.paddingTop="".concat(Math.abs(I),"px"))}}(),ne(!0),Re.current&&Re.current(),ue.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),qn(!1),null==l||l()};if(!d||!m)return ue.current=!1,qn(!1),void(null==l||l());if(a&&y){if(!Hn){var R=0;R="right"===u?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=_e.current,w=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+R-w-150:0;return C?void I(C,B,200,b):void b()}var T=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,_=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=_-(T-m.scrollTop);F<0&&De.current&&(De.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 Me.current&&(Me.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(y,F,E,b)})}n=F}I(y,n,E,b)})}else{var D=T-(_-y.scrollTop);D<0&&ke.current&&(ke.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var n,e=m.scrollHeight-m.clientHeight;if(D<0)n=0;else{if(D>e){var t=D-e;return Ae.current&&(Ae.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,D,E,b)})}n=D}I(m,n,E,b)})}}else b()})))},[re,Ze,st,Un,Hn,at,Lt]),Ti=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;Qe();var u="left";(null===(o=Fe.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=Ct.current[l])||void 0===n?void 0:n.current:null===(t=Rt.current[l])||void 0===t?void 0:t.current}return"right"===u?null===(i=Ct.current[e])||void 0===i?void 0:i.current:null===(o=Rt.current[e])||void 0===o?void 0:o.current};if(t)return Lt(),ae(new Set),fe([]),me.current=[],void(r&&requestAnimationFrame(function(){var n=c()||l;Je({open:!0,anchorEl:n,summary:i})}));Ii(e,t,r?{toggleIfSame:!1,sourceSide:u,onReady:function(){var n=c()||l;Je({open:!0,anchorEl:n,summary:i})}}:{toggleIfSame:!1,sourceSide:u})},[Ii,Qe,Je,Lt]),_i=c(function(){var n,e=We.sectionIdx,t=We.isOrphan;if(Ue(),null!=e){var i="left";We.anchorEl&&(null===(n=Fe.current)||void 0===n?void 0:n.contains(We.anchorEl))&&(i="right"),Ii(e,t,{sourceSide:i})}},[Ii,We.isOrphan,We.sectionIdx,We.anchorEl,Ue]),Ei=c(function(){Ue(),Lt(),ae(new Set),fe([]),me.current=[]},[Ue,Lt]),Fi=null!==We.sectionIdx&&de.has(We.sectionIdx),Di=z({proposedSections:at,existingSections:st,parentDeviationRecord:ft,expandedSections:zt,maintainRelativeOrder:!!Hn,scrollContainerRef:_e,leftContainerRef:Ne,lhsBadgeRefs:Rt,rhsBadgeRefs:Ct}),Mi=Di.showDeviationNavigation,ki=Di.showOpenNodeRef,Ai=l(function(){var n;if(!kn)return null;var e=null===(n=null==kn?void 0:kn.id)||void 0===n?void 0:n.split(":")[0];for(var t in ft){if((ft[t]||[]).some(function(n){return n.id===e}))return t}return null},[kn,ft]),Ni=r({id:null,triggerMs:null}),Hi=r(null);u(function(){var t;if(null==kn?void 0:kn.id){var i=Number(kn.trigger),o=Ni.current;if((null==o?void 0:o.triggerMs)!==i){var r=null===(t=null==kn?void 0:kn.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";Hi.current!==kn.id&&(Ue(),Qe(),Lt(),ae(new Set),fe([]),me.current=[],Hi.current=kn.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(){Ni.current={id:kn.id,triggerMs:i}},h=null,x=null;for(var m in ft){var y=ft[m].find(function(n){return n.id===l});if(y){h=m,x=y;break}}if(x&&h){var b=at.findIndex(function(n){return n.id===h}),R=st.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==R,w=f(at,x.id),B=f(st,x.id);if(w&&!B&&!C){var I=w.split("-"),T=Number(I[0]);if(Hn){var _=null===(o=null===(t=at[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],E=st.findIndex(function(n){return n.selfIndex===_});-1!==E&&(T=E)}B=e([T],I.slice(1),!0).join("-")}if(w||B){var F=C||!w&&!!B,D=w?Number(w.split("-")[0]):b,M=B?Number(B.split("-")[0]):R;if(F){if(!(Hn?!!zt["right-".concat(M)]:!!zt[String(M)])&&M>=0)return Kt(M,"right"),a+=1,void(s=setTimeout(p,450))}else if(!(Hn?!!zt["left-".concat(D)]:!!zt[String(D)])&&D>=0)return Kt(D,"left"),a+=1,void(s=setTimeout(p,450));var k,A=w||"",N=B||"",H="".concat(x.id).concat(S).concat(c).concat(S).concat(A).concat(S).concat(N),j="".concat(x.id).concat(S).concat(c),L=null===(r=Rt.current[j])||void 0===r?void 0:r.current,O=null===(u=Ct.current[j])||void 0===u?void 0:u.current,P=F||!L&&!!O,z=P?O:L;if(k=Hn?P?Fe.current:Ne.current:_e.current,z&&k){var W=z.getBoundingClientRect();if(0===W.height)return void((a+=1)<2?s=setTimeout(p,v):g());var Y=k.getBoundingClientRect(),q=W.top-Y.top+k.scrollTop-Y.height/2+W.height/2,K=function(){var e,t,i,o,r;if(!d){g();var l=window.getComputedStyle(z).color;L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),O&&(O.style.transition="box-shadow 300ms ease-in-out",O.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){L&&(L.style.boxShadow=""),O&&(O.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(!(!!L&&!!O)){var s=P?(null===(o=Ct.current[j])||void 0===o?void 0:o.current)||O:(null===(r=Rt.current[j])||void 0===r?void 0:r.current)||L;return Je({open:!0,anchorEl:s,summary:n(n({},u),{evaluation_outputs:a})}),void(null==An||An())}Ii(H,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t=(null===(e=Rt.current[j])||void 0===e?void 0:e.current)||L;Je({open:!0,anchorEl:t,summary:n(n({},u),{evaluation_outputs:a})})}})}};Math.abs(k.scrollTop-q)<=2?K():(je.current=q,Le.current=K,k.scrollTo({top:q,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if(Le.current){je.current=null;var n=Le.current;Le.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)}}}},[kn,ft,at,st,Hn,zt,Kt,Ii,Je]);var ji=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(q,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:void 0===c?"":c,expandedSubSections:Yt,setExpandedSubSections:qt,maintainRelativeOrder:Hn||!1,proposedSections:at,existingSections:st,treeData:Rn,deviationNumberRegistry:pt,connectedSections:de,activeSideBySideSection:re,resolvedMarkdownStyles:Te,getSubSectionRef:Et,getSubSectionCompareStyle:si,getBadgeRef:Ft,openMoreFunctionsPopup:Jt,openSummaryPopup:Ti,showDeviationBadges:Ln,resetSideBySide:Lt,setConnectedSections:ae,setConnectedLines:fe,cachedConnectedPositions:me})};return t(d,n({ref:Ee,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Hn?{}:{overflow:"visible"}),{position:"relative"})},{children:[Pn&&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(N,{})})),Xe.open&&i(K,{open:Xe.open,anchorEl:Xe.anchorEl,containerEl:Qt.current,clipTopEl:ei.current,scrollContainerEl:_e.current,onClose:Ei,summary:Xe.summary}),i(A,{open:We.open,anchorEl:We.anchorEl,sectionTitle:We.sectionTitle,referenceSectionTitle:We.refSectionTitle,onClose:Ze,onOpenCognitiveCompare:Ut,onOpenSideBySide:_i,onConnect:$t,isConnected:Fi,isOrphan:We.isOrphan}),Pe.open&&i(k,{open:Pe.open,popupRef:Ge,position:qe,popupConfig:Fn,onClose:function(){Ke(null),ze(function(e){return n(n({},e),{open:!1})}),$e(null)},markdownStyles:In,sectionTitle:Pe.sectionTitle,referenceSectionTitle:Pe.refSectionTitle,cognitiveData:Pe.cognitiveData,anchorEl:Pe.anchorEl,sectionAnchorEl:Pe.sectionAnchorEl,scrollContainerEl:_e.current,badgeStyle:Pe.badgeStyle,docData:Pe.docData,deviationData:Pe.deviationData,isLoading:Pe.isLoading}),i(a,n({open:!!Vn,autoHideDuration:8e3,onClose:function(){return Xn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,n({onClose:function(){return Xn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Vn}))})),i(W,{componentHeaderText:Sn,displayConfig:En,maintainRelativeOrder:Hn,onCollapseAll:fi,showCollapseAll:pi,onToggleView:function(n){zn(!0),setTimeout(function(){jn(!n),Lt(),Ue(),ae(new Set),fe([]),me.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){zn(!1)},600)})})},50)}}),i(d,n({ref:_e,onScroll:Si,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Hn?"hidden":"auto",borderTop:Mt&&kt?"none":"1.5px solid #EEF0F4"}},{children:i(d,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Hn?{flex:1,minHeight:0}:{})},{children:t(d,n({ref:Gt,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Hn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:pe,style:{position:"absolute",top:0,left:0,width:Be.width||"100%",height:Be.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:te?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[ui&&i("g",{children:i("line",{x1:ui.x1,y1:ui.y,x2:ui.x2,y2:ui.y,stroke:jt.badgeBorder,strokeWidth:"1.5"})}),oi.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?Un&&re===e.subSectionKeyPath&&Zn:Un&&re===e.sectionIdx&&Zn)return null;if(!Hn){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=at[e.sectionIdx]||{title:"",content:""},x=st[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),w=null,I=null;R.length>0&&(w=at[R[0]]),C.length>0&&(I=st[C[0]]);var T=(null==w?void 0:w.title)||"",_=(null==I?void 0:I.title)||"";console.log("Root Parent Titles:",T,_);for(var E=1;E<R.length;E++)(null==w?void 0:w.subsections)&&(w=w.subsections[R[E]]);for(E=1;E<C.length;E++)(null==I?void 0:I.subsections)&&(I=I.subsections[C[E]]);w&&(g=n(n({},w),{title:T||w.title})),console.log("Base Section for Subsection Badge:",g),I&&(x=n(n({},I),{title:_||I.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),M=(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,k=F||M;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(),k&&(Pe.open&&Ve===e.id?Qe():($e(e.id),Xt(Vt(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:k?"pointer":"default"}},{children:[e.style.badgeText===D&&null==e.style.label?i(H,{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,{})})),k&&i(p,{size:11,style:{transform:Pe.open&&Ve===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),ve.map(function(e){var o,r=e.pathD,l=(null===(o=e.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",u="conn-marker-".concat(e.id),c="".concat(e.id,"-bg"),d="".concat(e.id,"-stroke");return t("g",{children:[i("defs",{children:i("clipPath",n({id:"connections-clip"},{children:i("marker",n({id:u,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:i("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),i("path",{ref:function(n){xe.current[c]=n},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(n){xe.current[d]=n},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(u,")")})]},e.id)})]})),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)"},Hn?{flex:1,overflow:"visible"}:{})},{children:[i(d,n({ref:ei,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:rt,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:rt}))}))})),t(d,n({ref:Ne,onScroll:Si,sx:n({p:"12px",display:"flex",flexDirection:"column"},Hn?{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:ke,style:{width:"100%",height:"0px",flexShrink:0}}),ht&&at.map(function(e,o){var r,l,u=!e.title&&!e.content;if(Hn&&u)return null;var c=e,a=ai(o,"left"),s=Hn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!st[o],v=Hn?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:o+1,f=de.has(o),p=y(c.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,n({ref:_t(o),sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:bt.current[o],sx:n({width:"100%",display:"flex"},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(Y,{section:e,idx:o,columnKey:"left",colRef:_t("left-accordion-".concat(o)),mb:0,treeData:Rn,proposedSections:at,existingSections:st,deviationNumberRegistry:pt,getSectionCompareStyle:ai,getBadgeRef:Ft,connectedSections:de,openMoreFunctionsPopup:Jt,openSummaryPopup:Ti,deviationNodeIdToView:null==kn?void 0:kn.id,deviationTargetParentId:Ai,parentNodeId:(null===(l=null==Rn?void 0:Rn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:Hn?!!zt["left-".concat(o)]:!!zt[String(o)],onToggle:function(){Ei(),Kt(o,"left")},navigation:e.id?Mi[e.id]:null,showOpenNodeRef:ki,resolvedMarkdownStyles:Te,maintainRelativeOrder:Hn,showDeviationBadges:Ln,renderSubSections:ji})})),Hn&&a&&t(d,n({ref:Rt.current[o],onClick:function(n){var t=Hn?st.find(function(n){var e;return null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)})||{title:"",content:""}:st[o]||{title:"",content:""};Jt(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:[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:!En.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?s?"No Deviation Found":"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):i(H,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:Ae,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,n({ref:Qt,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(),Pe.open&&Ve===At?Qe():($e(At),Xt(Vt(e.currentTarget,{title:"",content:"",evaluationResult:Nt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,At,!0,n(n({},jt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:jt.badgeBg,color:jt.badgeText,border:"1px solid ".concat(jt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Ht?Ht:i(H,{}),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:Pe.open&&Ve===At?"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},Hn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Yn&&i(x,{sections:11}),i(d,n({ref:ti,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:lt,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:lt}))}))})),t(d,n({ref:Fe,onScroll:Si,sx:n({p:"12px",display:"flex",flexDirection:"column"},Hn?{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:De,style:{width:"100%",height:"0px",flexShrink:0}}),ht&&st.map(function(e,o){var r,l=e,u=[],c=!1,a=null,s=-1;if(Hn){u=at.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=at.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0});var v=at.findIndex(function(n,e){var t;return de.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==v)&&(a=ai(v))}else u=[o+1],(c=de.has(o))&&(a=ai(o));var f=ai(Hn&&-1!==s?s:o);return i(d,n({ref:wt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:St.current[o],sx:n({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(Y,{section:e,idx:o,columnKey:"right",colRef:_t("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Rn?void 0:Rn.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:Hn?!!zt["right-".concat(o)]:!!zt[String(o)],treeData:Rn,proposedSections:at,existingSections:st,deviationNumberRegistry:pt,getBadgeRef:Ft,getSectionCompareStyle:ai,connectedSections:de,openMoreFunctionsPopup:Jt,openSummaryPopup:Ti,deviationNodeIdToView:null==kn?void 0:kn.id,deviationTargetParentId:Ai,onToggle:function(){Ei(),Kt(o,"right")},navigation:e.id?Mi[e.id]:null,showOpenNodeRef:ki,resolvedMarkdownStyles:Te,maintainRelativeOrder:Hn,showDeviationBadges:Ln,renderSubSections:ji})})),Hn&&f&&i(d,n({ref:Ct.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:Me,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{V as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DEFAULT_DEVIAION_COLOR as t}from"./CognitiveCompareConstants.js";var n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},o=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return o(t)}))},i=function(t,o,i){var r,e=i[o],u=null===(r=null==t?void 0:t.comparison_inputs)||void 0===r?void 0:r[e];return{title:n((null==u?void 0:u.title)||""),content:n((null==u?void 0:u.content)||""),attributes:(null==u?void 0:u.additional_attributes)||null,subsections:(null==u?void 0:u.subsections)||[]}},r=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=t.mapping_rationale,o=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:o,citations:n.citations},score:0,relation:"N/A"}};function e(t){var n=function(t,n){var o=function(t){var n=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),o=parseInt(n,16);return{r:o>>16&255,g:o>>8&255,b:255&o}}(t),i=o.r,r=o.g,e=o.b;return function(t,n,o){return"#"+[t,n,o].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(i+(255-i)*n),Math.round(r+(255-r)*n),Math.round(e+(255-e)*n))};return{bg:n(t,.8),border:n(t,.5),badgeBg:n(t,.8),badgeBorder:n(t,.5),badgeText:t.toUpperCase(),highlightBg:n(t,.8)}}function u(t,n){var o;return function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];var e=this;clearTimeout(o),o=setTimeout(function(){return t.apply(e,i)},n)}}var l=function(t,n){var o,i,r,e,u,l;if(t.content!==n.content)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;var a=t.highlights||[],v=n.highlights||[];if(a.length!==v.length)return!1;for(var d=0;d<a.length;d++)if(a[d]!==v[d])return!1;var s=t.deviationBadges||[],c=n.deviationBadges||[];if(s.length!==c.length)return!1;for(d=0;d<s.length;d++){if(s[d].id!==c[d].id)return!1;if(s[d].actionId!==c[d].actionId)return!1;if(s[d].label!==c[d].label)return!1;if(s[d].score!==c[d].score)return!1;if(s[d].isOrphan!==c[d].isOrphan)return!1;if(s[d].isConnected!==c[d].isConnected)return!1;if((null===(o=s[d].style)||void 0===o?void 0:o.badgeBg)!==(null===(i=c[d].style)||void 0===i?void 0:i.badgeBg))return!1;if((null===(r=s[d].style)||void 0===r?void 0:r.badgeBorder)!==(null===(e=c[d].style)||void 0===e?void 0:e.badgeBorder))return!1;if((null===(u=s[d].style)||void 0===u?void 0:u.badgeText)!==(null===(l=c[d].style)||void 0===l?void 0:l.badgeText))return!1}return!0},a="::",v=function(t){if(!t)return!0;var n=t.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},d=function(t,n){var o,i,r,e,u,l,a;if(!t)return n;var v=null!==(l=null!==(e=null!==(i=null===(o=t.evaluation_output)||void 0===o?void 0:o.output_score)&&void 0!==i?i:null===(r=t.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==e?e:null===(u=t.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==l?l:t.output_score;return null!==(a=null!=v?v:n)&&void 0!==a?a:""},s=function(t,n,o,i,r){void 0===r&&(r=14);var e=t+.5*(o-t),u=i-n;if(Math.abs(u)<3)return"M ".concat(t," ").concat(n," H ").concat(o);var l=u>0?1:-1,a=Math.min(r,Math.abs(u)/2,Math.abs(e-t)/2,Math.abs(o-e)/2);return["M ".concat(t," ").concat(n),"H ".concat(e-a),"Q ".concat(e," ").concat(n," ").concat(e," ").concat(n+l*a),"V ".concat(i-l*a),"Q ".concat(e," ").concat(i," ").concat(e+a," ").concat(i),"H ".concat(o)].join(" ")},c=function(t,n,o,i,r){void 0===o&&(o=300);var e=t.style.scrollBehavior;t.style.scrollBehavior="auto";var u=t.scrollTop,l=n-u,a=null,v=function(d){null===a&&(a=d);var s,c=d-a;c<o?(t.scrollTop=(s=c,s/=o,l*(--s*s*s+1)+u),r&&r(),requestAnimationFrame(v)):(t.scrollTop=n,t.style.scrollBehavior=e,r&&r(),i&&i())};requestAnimationFrame(v)},f=["#B91C1C","#A16207","#1D4ED8","#000000"],g=function(t){var n=f.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?f.length:n},p=function(n){for(var o,i,r,e,u,l,a,v,d,s,c,f,p,h=[],b=0,_=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});b<_.length;b++){var m=_[b];(
|
|
1
|
+
import{DEFAULT_DEVIAION_COLOR as t}from"./CognitiveCompareConstants.js";var n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},o=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return o(t)}))},i=function(t,o,i){var r,e=i[o],u=null===(r=null==t?void 0:t.comparison_inputs)||void 0===r?void 0:r[e];return{title:n((null==u?void 0:u.title)||""),content:n((null==u?void 0:u.content)||""),attributes:(null==u?void 0:u.additional_attributes)||null,subsections:(null==u?void 0:u.subsections)||[]}},r=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=t.mapping_rationale,o=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:o,citations:n.citations},score:0,relation:"N/A"}};function e(t){var n=function(t,n){var o=function(t){var n=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),o=parseInt(n,16);return{r:o>>16&255,g:o>>8&255,b:255&o}}(t),i=o.r,r=o.g,e=o.b;return function(t,n,o){return"#"+[t,n,o].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(i+(255-i)*n),Math.round(r+(255-r)*n),Math.round(e+(255-e)*n))};return{bg:n(t,.8),border:n(t,.5),badgeBg:n(t,.8),badgeBorder:n(t,.5),badgeText:t.toUpperCase(),highlightBg:n(t,.8)}}function u(t,n){var o;return function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];var e=this;clearTimeout(o),o=setTimeout(function(){return t.apply(e,i)},n)}}var l=function(t,n){var o,i,r,e,u,l;if(t.content!==n.content)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;var a=t.highlights||[],v=n.highlights||[];if(a.length!==v.length)return!1;for(var d=0;d<a.length;d++)if(a[d]!==v[d])return!1;var s=t.deviationBadges||[],c=n.deviationBadges||[];if(s.length!==c.length)return!1;for(d=0;d<s.length;d++){if(s[d].id!==c[d].id)return!1;if(s[d].actionId!==c[d].actionId)return!1;if(s[d].label!==c[d].label)return!1;if(s[d].score!==c[d].score)return!1;if(s[d].isOrphan!==c[d].isOrphan)return!1;if(s[d].isConnected!==c[d].isConnected)return!1;if((null===(o=s[d].style)||void 0===o?void 0:o.badgeBg)!==(null===(i=c[d].style)||void 0===i?void 0:i.badgeBg))return!1;if((null===(r=s[d].style)||void 0===r?void 0:r.badgeBorder)!==(null===(e=c[d].style)||void 0===e?void 0:e.badgeBorder))return!1;if((null===(u=s[d].style)||void 0===u?void 0:u.badgeText)!==(null===(l=c[d].style)||void 0===l?void 0:l.badgeText))return!1}return!0},a="::",v=function(t){if(!t)return!0;var n=t.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},d=function(t,n){var o,i,r,e,u,l,a;if(!t)return n;var v=null!==(l=null!==(e=null!==(i=null===(o=t.evaluation_output)||void 0===o?void 0:o.output_score)&&void 0!==i?i:null===(r=t.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==e?e:null===(u=t.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==l?l:t.output_score;return null!==(a=null!=v?v:n)&&void 0!==a?a:""},s=function(t,n,o,i,r){void 0===r&&(r=14);var e=t+.5*(o-t),u=i-n;if(Math.abs(u)<3)return"M ".concat(t," ").concat(n," H ").concat(o);var l=u>0?1:-1,a=Math.min(r,Math.abs(u)/2,Math.abs(e-t)/2,Math.abs(o-e)/2);return["M ".concat(t," ").concat(n),"H ".concat(e-a),"Q ".concat(e," ").concat(n," ").concat(e," ").concat(n+l*a),"V ".concat(i-l*a),"Q ".concat(e," ").concat(i," ").concat(e+a," ").concat(i),"H ".concat(o)].join(" ")},c=function(t,n,o,i,r){void 0===o&&(o=300);var e=t.style.scrollBehavior;t.style.scrollBehavior="auto";var u=t.scrollTop,l=n-u,a=null,v=function(d){null===a&&(a=d);var s,c=d-a;c<o?(t.scrollTop=(s=c,s/=o,l*(--s*s*s+1)+u),r&&r(),requestAnimationFrame(v)):(t.scrollTop=n,t.style.scrollBehavior=e,r&&r(),i&&i())};requestAnimationFrame(v)},f=["#B91C1C","#A16207","#1D4ED8","#000000"],g=function(t){var n=f.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?f.length:n},p=function(n){for(var o,i,r,e,u,l,a,v,d,s,c,f,p,h=[],b=0,_=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});b<_.length;b++){var m=_[b];(M=null===(e=null===(r=null===(i=null===(o=null==n?void 0:n.deviations)||void 0===o?void 0:o[m])||void 0===i?void 0:i.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===e?void 0:e.label_color)&&h.push(M)}for(var y=0,B=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});y<B.length;y++){m=B[y];(M=null===(v=null===(a=null===(l=null===(u=null==n?void 0:n.deviation_entries)||void 0===u?void 0:u[m])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===v?void 0:v.label_color)&&h.push(M)}for(var N=0,C=Object.keys(n||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});N<C.length;N++){var M;m=C[N];(M=null===(c=null===(s=null===(d=null==n?void 0:n[m])||void 0===d?void 0:d.evaluation_outputs)||void 0===s?void 0:s.metadata)||void 0===c?void 0:c.label_color)&&h.push(M)}return 0===h.length?(null===(p=null===(f=null==n?void 0:n.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===p?void 0:p.label_color)?n.evaluation_outputs.metadata.label_color:t:h.sort(function(t,n){return g(t)-g(n)})[0]},h=function(t){for(var n,o,i,r,e,u,l,a,v,d=0,s=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});d<s.length;d++){var c=s[d];if(b=null===(i=null===(o=null===(n=null==t?void 0:t.deviations)||void 0===n?void 0:n[c])||void 0===o?void 0:o.evaluation_outputs)||void 0===i?void 0:i.output_value)return b}for(var f=0,g=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});f<g.length;f++){c=g[f];if(b=null===(u=null===(e=null===(r=null==t?void 0:t.deviation_entries)||void 0===r?void 0:r[c])||void 0===e?void 0:e.evaluation_outputs)||void 0===u?void 0:u.output_value)return b}for(var p=0,h=Object.keys(t||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});p<h.length;p++){var b;c=h[p];if(b=null===(a=null===(l=null==t?void 0:t[c])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(v=null==t?void 0:t.evaluation_outputs)||void 0===v?void 0:v.output_value)?t.evaluation_outputs.output_value:null},b=function(t,n){var o=function(t){var n=t.replace("#","");return[parseInt(n.substring(0,2),16),parseInt(n.substring(2,4),16),parseInt(n.substring(4,6),16)]},i=function(t){var n=Math.round(t).toString(16);return 1===n.length?"0"+n:n};try{var r=o(t),e=o(n),u=(r[0]+e[0])/2*.95,l=(r[1]+e[1])/2*.95,a=(r[2]+e[2])/2*.95;return"#".concat(i(u)).concat(i(l)).concat(i(a))}catch(t){return"#FDE68A"}};export{a as DEVIATION_BADGE_SEPARATOR,l as areMarkdownPropsEqual,u as debounce,d as extractDeviationScore,e as generateColorPalette,s as getBentArrowPath,p as getFirstDeviationColor,h as getFirstDeviationOutputValue,r as getRationale,i as getSideData,o as hasValue,v as isMissingStr,b as mixHexColors,n as safeStringify,c as smoothScrollTo};
|
|
2
2
|
//# sourceMappingURL=CognitiveComparehelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as n,__rest as e}from"tslib";import{jsx as r,jsxs as i,Fragment as o}from"react/jsx-runtime";import{Box as t,Typography as l}from"@mui/material";import a,{useMemo as c}from"react";import{DEFAULT_DEVIAION_COLOR as d}from"../CognitiveCompareConstants.js";import{EllipsisVertical as s}from"lucide-react";import h from"react-markdown";import{safeStringify as p,mixHexColors as u,areMarkdownPropsEqual as g}from"../CognitiveComparehelpers.js";import f from"rehype-raw";var v=a.memo(function(g){var v=g.content,m=g.sxStyles,x=g.deviationBadges,b=void 0===x?[]:x,y=g.highlights,C=void 0===y?[]:y,E=g.maintainRelativeOrder,F=void 0===E||E,_=g.highlightBg,k=c(function(){return b.reduce(function(e,r){var i;return n(n({},e),((i={})[r.id]=r,i))},{})},[b]),S=function(e,r){return a.Children.map(e,function(e){var i;if(!a.isValidElement(e))return e;var o=(null===(i=e.props)||void 0===i?void 0:i.children)?S(e.props.children,r):e.props.children,t=a.cloneElement(e,n(n({},e.props),{children:o}));return r(t)})},w=c(function(){return{mark:function(i){var o,t,l,a,c=i.children,d=e(i,["children"]),s=d["data-badge-id"],h=s?k[s]:null,p=d["data-highlight-color"],u=null!==(a=null!==(t=null!=p?p:null===(o=null==h?void 0:h.style)||void 0===o?void 0:o.highlightBg)&&void 0!==t?t:null===(l=null==h?void 0:h.style)||void 0===l?void 0:l.badgeBg)&&void 0!==a?a:_;return r("span",n({style:n(n({},d.isSuggestedDeviationFix?{}:{backgroundColor:u}),{borderRadius:"2px"})},{children:c}))},span:function(o){var l,a,c,h,p,u,g=o.children,f=e(o,["children"]),v=f["data-badge-id"];if(!v)return r("span",n({},f,{children:g}));var m=k[v];if(!m)return r("span",n({},f,{children:g}));var x="number"==typeof m.stackIndex?m.stackIndex:0,b="translateY(calc(-20% + ".concat(24*x,"px))");return i(t,n({component:"span",sx:{position:"static",display:"inline"}},{children:[i(t,n({ref:m.badgeRef,sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(l=m.style)||void 0===l?void 0:l.badgeBg)||"#EEF2FF",color:(null===(a=m.style)||void 0===a?void 0:a.badgeText)||d,border:"1px solid ".concat((null===(c=m.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden"},"left"===m.side?{right:"-16px",transform:"".concat(b," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(b," translateX(calc(-100% - 8px))")}),m.isConnected&&m.style&&{outline:"2px solid ".concat(m.style.badgeBorder),outlineOffset:"1px"})},{children:[i(t,n({onClick:function(n){n.stopPropagation(),m.onSummaryClick&&m.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[r(t,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:m.label})),("left"===m.side||m.isOrphan)&&r(t,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(h=m.style)||void 0===h?void 0:h.badgeBorder)||"#C7D2FE")}},{children:null!=m.score&&"N/A"!==m.score&&"NA"!==m.score&&0!==m.score?"".concat(m.score):"N/A"===m.score||"NA"===m.score?"N/A":"Same"}))]})),("left"===m.side||m.isOrphan)&&r(t,n({onClick:function(n){n.stopPropagation(),m.onClick&&m.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(p=m.style)||void 0===p?void 0:p.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:r(s,{size:12,color:(null===(u=m.style)||void 0===u?void 0:u.badgeText)||"#3730A3"})}))]})),g]}))},updated:function(n){var i=n.children;return e(n,["children"]),r(o,{children:i})},deleted:function(i){var o=i.children;e(i,["children"]),console.log("nitish: ",o);var t=S(o,function(n){return a.cloneElement(n,{isSuggestedDeviationFix:!0})});return r("span",n({style:{borderTop:"1px solid #EF4444",borderBottom:"1px solid #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:t}))},changed:function(i){var o=i.children;e(i,["children"]);var t=S(o,function(n){return a.cloneElement(n,{isSuggestedDeviationFix:!0})});return r("span",n({style:{borderTop:"1px solid #2F59FF",borderBottom:"1px solid #2F59FF",backgroundColor:"#D5E8FF"}},{children:t}))}}},[k,F]),B=function(n){return n?n.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(n){return n.startsWith("\n")?n:n.replace(/\n/g," ")}).join(""):""},j=c(function(){var n=B(p(v||"")),e=(b||[]).map(function(n){var e,r;return{id:null==n?void 0:n.id,highlight:B((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.badgeBg)||_}}).filter(function(n){return n.id&&n.highlight}),r={};e.forEach(function(n){r[n.highlight]||(r[n.highlight]=[]),r[n.highlight].push(n)});var i=Object.keys(r).sort(function(n,e){return e.length-n.length}),o=new Set,t=function(n,e,r,i,o){void 0===e&&(e=""),void 0===r&&(r=""),void 0===i&&(i="");var t=n.startsWith("\n\n"),l=n.endsWith("\n\n"),a=o?' data-highlight-color="'.concat(o,'"'):"";return r+n.split(/(\n{2,})/).map(function(n,r,i){if(/^\n{2,}$/.test(n))return n;if(!n.trim())return n;var o=0===r||1===r&&/^\n{2,}$/.test(i[0]),c=r===i.length-1||r===i.length-2&&/^\n{2,}$/.test(i[i.length-1]);return t&&o||l&&c?n:'<mark data-badge-id="'.concat(e,'"').concat(a,">").concat(n,"</mark>")}).join("").replace(/^\n{2,}/,"").replace(/\n{2,}$/,"")+i},l={},a=0;i.forEach(function(e){for(var c=r[e],d=c[0],s=d.highlightColor,h=1;h<c.length;h++)s=u(s,c[h].highlightColor);var p=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=i.filter(function(n){return e.length>n.length&&e.includes(n)}).sort(function(n,e){return e.length-n.length}),f=function(n){var i=e;return g.forEach(function(e){for(var l=r[e],a=l[0].highlightColor,c=1;c<l.length;c++)a=u(a,l[c].highlightColor);var d=u(s,a),h="",p="";n&&l.forEach(function(n){h+='<span data-badge-id="'.concat(n.id,'">'),p="</span>"+p,o.add(n.id)});var g=t(e,l[0].id,h,p,d);i=i.split(e).join(g)}),i},v=n.includes(e),m=f(v),x=f(!1),b=c.every(function(n){return o.has(n.id)});if(v&&!b){var y="__DEV_TOKEN_".concat(a++,"__"),C="",E="";c.forEach(function(n){C+='<span data-badge-id="'.concat(n.id,'">'),E="</span>"+E,o.add(n.id)}),l[y]=t(m,d.id,C,E,s),n=n.replace(e,y)}var F="__HIGHLIGHT_TOKEN_".concat(a++,"__");l[F]=t(x,d.id,"","",s),n=n.replace(new RegExp(p,"g"),F)});var c=new Set(i);return C.forEach(function(e){if(e){var r=B(e);if(r&&!c.has(r)){var i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o="__PLAIN_TOKEN_".concat(a++,"__");l[o]=t(r),n=n.replace(new RegExp(i,"g"),o)}}}),Object.keys(l).forEach(function(e){n=n.split(e).join(l[e])}),n},[v,b,C]);return r(l,n({component:"div",sx:n(n({},m),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}})},{children:r(h,n({components:w,rehypePlugins:[f]},{children:p(j).replace(/\\n/g,"\n")}))}))},g);export{v as MemoizedMarkdown};
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,oBAAoB,+CA8KzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonConstants.d.ts","sourceRoot":"","sources":["../../../../src/CommonConstants/CommonConstants.tsx"],"names":[],"mappings":"AACA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,OAAO,CAAC;AAC5C,eAAO,MAAM,OAAO,EAAE,aAAqB,CAAC;AAC5C,eAAO,MAAM,SAAS,EAAE,aAAuB,CAAC;AAChD,eAAO,MAAM,6BAA6B,yCAAyC,CAAA;AAEnF,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"CommonConstants.d.ts","sourceRoot":"","sources":["../../../../src/CommonConstants/CommonConstants.tsx"],"names":[],"mappings":"AACA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,OAAO,CAAC;AAC5C,eAAO,MAAM,OAAO,EAAE,aAAqB,CAAC;AAC5C,eAAO,MAAM,SAAS,EAAE,aAAuB,CAAC;AAChD,eAAO,MAAM,6BAA6B,yCAAyC,CAAA;AAEnF,eAAO,MAAM,iBAAiB,EAAE,GAw9Y/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAkCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAiBlC,QAAA,MAAM,gBAAgB,0NAoBnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAkCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAiBlC,QAAA,MAAM,gBAAgB,0NAoBnB,qBAAqB,4CAs2GvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
|
|
@@ -48,6 +48,6 @@ export declare const smoothScrollTo: (element: HTMLElement, targetPosition: numb
|
|
|
48
48
|
export declare const escapeRegExp: (string: string) => string;
|
|
49
49
|
export declare const getFirstDeviationColor: (evaluationResult: any) => string;
|
|
50
50
|
export declare const getFirstDeviationOutputValue: (evaluationResult: any) => string | null;
|
|
51
|
-
export declare
|
|
51
|
+
export declare const mixHexColors: (hex1: string, hex2: string) => string;
|
|
52
52
|
export {};
|
|
53
53
|
//# sourceMappingURL=CognitiveComparehelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveComparehelpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveComparehelpers.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa,QAAS,OAAO,KAAG,MAM5C,CAAC;AAGF,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAKvC,CAAC;AAGF,eAAO,MAAM,WAAW,SAChB,GAAG,aACE,GAAG,GAAG,GAAG,YACV,OAAO,MAAM,EAAE,MAAM,CAAC;;;;;CAUjC,CAAC;AAGF,eAAO,MAAM,YAAY,SAAU,GAAG;;;;;;;;;;;;;;;;;;;;CA2BrC,CAAC;AAGF,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAOxD,CAAC;AAqDF,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAuD9D;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAQlC;AAED,eAAO,MAAM,mBAAmB,YAAa,MAAM,OAAO,MAAM,YAG/D,CAAA;AACD,eAAO,MAAM,qBAAqB,cAAe,GAAG,aAAa,GAAG,YAgCnE,CAAC;AAEF,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,eAAO,MAAM,YAAY,QAAS,MAAM,GAAG,SAAS,GAAG,IAAI,YAS1D,CAAC;AAEF,eAAO,MAAM,qBAAqB,qBAAsB,GAAG,kBAAkB,GAAG,QAO/E,CAAC;AAEF,eAAO,MAAM,gBAAgB,OACvB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,WACF,MAAM,KACb,MAyBF,CAAC;AAEF,eAAO,MAAM,cAAc,YAChB,WAAW,kBACJ,MAAM,aACZ,MAAM,eACH,MAAM,IAAI,eACV,MAAM,IAAI,SAgCxB,CAAC;AAEF,eAAO,MAAM,YAAY,WAAY,MAAM,WAQ1C,CAAC;AAWF,eAAO,MAAM,sBAAsB,qBAAsB,GAAG,KAAG,MAmC9D,CAAC;AAEF,eAAO,MAAM,4BAA4B,qBAAsB,GAAG,KAAG,MAAM,GAAG,IA4B7E,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"CognitiveComparehelpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveComparehelpers.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa,QAAS,OAAO,KAAG,MAM5C,CAAC;AAGF,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAKvC,CAAC;AAGF,eAAO,MAAM,WAAW,SAChB,GAAG,aACE,GAAG,GAAG,GAAG,YACV,OAAO,MAAM,EAAE,MAAM,CAAC;;;;;CAUjC,CAAC;AAGF,eAAO,MAAM,YAAY,SAAU,GAAG;;;;;;;;;;;;;;;;;;;;CA2BrC,CAAC;AAGF,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAOxD,CAAC;AAqDF,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAuD9D;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAQlC;AAED,eAAO,MAAM,mBAAmB,YAAa,MAAM,OAAO,MAAM,YAG/D,CAAA;AACD,eAAO,MAAM,qBAAqB,cAAe,GAAG,aAAa,GAAG,YAgCnE,CAAC;AAEF,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,eAAO,MAAM,YAAY,QAAS,MAAM,GAAG,SAAS,GAAG,IAAI,YAS1D,CAAC;AAEF,eAAO,MAAM,qBAAqB,qBAAsB,GAAG,kBAAkB,GAAG,QAO/E,CAAC;AAEF,eAAO,MAAM,gBAAgB,OACvB,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,WACF,MAAM,KACb,MAyBF,CAAC;AAEF,eAAO,MAAM,cAAc,YAChB,WAAW,kBACJ,MAAM,aACZ,MAAM,eACH,MAAM,IAAI,eACV,MAAM,IAAI,SAgCxB,CAAC;AAEF,eAAO,MAAM,YAAY,WAAY,MAAM,WAQ1C,CAAC;AAWF,eAAO,MAAM,sBAAsB,qBAAsB,GAAG,KAAG,MAmC9D,CAAC;AAEF,eAAO,MAAM,4BAA4B,qBAAsB,GAAG,KAAG,MAAM,GAAG,IA4B7E,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,QAAQ,MAAM,KAAG,MA8BzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memoizedMarkdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/memoizedMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAQhE,eAAO,MAAM,gBAAgB;aAQlB,MAAM;cACL,GAAG;;;;iBAIA,MAAM;
|
|
1
|
+
{"version":3,"file":"memoizedMarkdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/memoizedMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAQhE,eAAO,MAAM,gBAAgB;aAQlB,MAAM;cACL,GAAG;;;;iBAIA,MAAM;8CA4VI,CAAC"}
|