@viswa-test/test-citation 0.0.85 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),m=require("./hooks/useDeviationNavigation.js"),_=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,I,T,B,C,D,O,w,j,P,N,F,k,M,L=b.componentHeaderText,V=void 0===L?a.DEFAULT_COMPONENT_HEADER_TEXT:L,H=b.treeData,G=b.comparisonConfig,q=b.leftColumnTitleText,z=b.rightColumnTitleText,W=b.markdownStyles,Y=b.displayConfig,K=void 0===Y?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:Y,U=b.popupConfig,X=b.deviationData,J=void 0===X?{}:X,Q=b.deviationNodeIdToView,Z=t.useState(K.maintainRelativeOrder),$=Z[0],ee=Z[1],ne=t.useState(!1),te=ne[0],ie=ne[1],oe=t.useState(!1),re=oe[0],le=oe[1],ue=t.useState(null),ce=ue[0],ae=ue[1],se=t.useState(!1),de=se[0],ve=se[1],fe=t.useState(!1),ge=fe[0],pe=fe[1],he=t.useState(!1),xe=he[0],me=he[1],_e=t.useState(null),Re=_e[0],ye=_e[1],Se=t.useRef(!1),be=t.useState(new Set),Ae=be[0],Ee=be[1],Ie=t.useState([]),Te=Ie[0],Be=Ie[1],Ce=t.useRef(null),De=t.useRef(!1),Oe=t.useRef(null),we=t.useRef({}),je=t.useRef([]),Pe=t.useRef(!1),Ne=t.useRef(!1),Fe=t.useRef(null),ke=t.useRef(function(){}),Me=t.useMemo(function(){return(null==H?void 0:H.cognitive_decisioning)||{}},[H]),Le=t.useState({width:0,height:0}),Ve=Le[0],He=Le[1],Ge=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),W)},[W]),qe=t.useRef(null),ze=t.useRef(null),We=t.useRef(null),Ye=t.useRef(null),Ke=t.useRef(null),Ue=t.useRef(null),Xe=t.useRef(null),Je=t.useRef(null),Qe=t.useRef(!1),Ze=t.useRef(null),$e=t.useRef(null),en=p.useComparePopups(qe),nn=en.cognitivePopup,tn=en.setCognitivePopup,on=en.moreFunctions,rn=en.setMoreFunctions,ln=en.position,un=en.setPosition,cn=en.activeBadgeId,an=en.summaryPopup,sn=en.setSummaryPopup,dn=en.closeSummaryPopup,vn=en.setActiveBadgeId,fn=en.popupRef,gn=en.closeCognitivePopup,pn=en.closeMoreFunctionsPopup,hn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==G?void 0:G.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==G?void 0:G.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==G?void 0:G.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==G?void 0:G.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[G]),xn=t.useState(null),mn=xn[0];xn[1];var _n=null===(I=null===(A=null==H?void 0:H.documents)||void 0===A?void 0:A[null===(E=null==H?void 0:H.input_index_map)||void 0===E?void 0:E[0]])||void 0===I?void 0:I.title,Rn=null===(C=null===(T=null==H?void 0:H.documents)||void 0===T?void 0:T[null===(B=null==H?void 0:H.input_index_map)||void 0===B?void 0:B[1]])||void 0===C?void 0:C.title,yn=u.safeStringify(q||_n||"Uploaded Contract"),Sn=u.safeStringify(z||Rn||"Reference Template"),bn=g.useCognitiveTreeData(H,$,J,hn),An=bn.activeProposed,En=bn.existingRule,In=bn.proposedSections,Tn=bn.existingSections,Bn=bn.visibleFields,Cn=bn.parentDeviationRecord,Dn=bn.deviationNumberRegistry,On=bn.parseError;t.useEffect(function(){On&&ae("Failed to load comparison: ".concat(On))},[On]);var wn=In.length>0||Tn.length>0,jn=h.useSectionRefs(Bn.map(function(e){return e.key}),Math.max(In.length,Tn.length)),Pn=jn.leftRefs,Nn=jn.rightRefs,Fn=jn.sectionLeftRefs,kn=jn.sectionRightRefs,Mn=jn.lhsBadgeRefs,Ln=jn.rhsBadgeRefs,Vn=jn.sectionRightRowRefs,Hn=jn.subSectionLeftRefs,Gn=jn.subSectionRightRefs,qn=jn.sectionRowRefs,zn=jn.getSectionRowRef,Wn=jn.getSubSectionRef,Yn=jn.getBadgeRef,Kn=En.analysis,Un=u.safeStringify(null===(O=null===(D=null==Kn?void 0:Kn.rule_difference_comparison)||void 0===D?void 0:D.summary)||void 0===O?void 0:O.overall_summary),Xn=!!Un.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Jn=null!==(w=null==H?void 0:H.base_root_id)&&void 0!==w?w:"-1";null==H||H[Jn];var Qn=(null===(j=null==J?void 0:J[Jn])||void 0===j?void 0:j.evaluation_result)||(null===(N=null===(P=null==H?void 0:H.nodes)||void 0===P?void 0:P[Jn])||void 0===N?void 0:N.evaluation_result)||null,Zn=u.extractDeviationScore(Qn),$n=u.generateColorPalette(null!==(M=null===(k=null===(F=null==Qn?void 0:Qn.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===k?void 0:k.label_color)&&void 0!==M?M:""),et=t.useCallback(function(){var e,n,t,i,o,r;ve(!1),Ne.current=!1;var l=Fe.current,c=ft.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=Hn.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=Fn.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=Fn.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=Gn.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=kn.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=kn.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}ye(null),Fe.current=null,ft.current=null,pe(!1),le(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px")},[]),nt=x.useAccordionState({maintainRelativeOrder:!!$,proposedSections:In,existingSections:Tn,activeSideBySideSection:Re,connectedSections:Ae,resetSideBySide:et,setConnectedSections:Ee,setConnectedLines:Be,cachedConnectedPositions:je,svgContainerRef:Ce,isAnimatingRef:De,animationTimerRef:Oe,calculateLinesRef:ke,sectionLeftRefs:Fn,sectionRightRefs:kn,subSectionLeftRefs:Hn,subSectionRightRefs:Gn}),tt=nt.expandedSections,it=nt.expandedSubSections,ot=nt.setExpandedSubSections,rt=nt.toggleSection,lt=t.useCallback(function(e,n,t,i,o,r,l){var c,a,s,d=u.safeStringify(null==n?void 0:n.id)||u.safeStringify(null==t?void 0:t.id)||"",v=(d?Me[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},f=null!==(a=null===(c=qn.current[i])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(s=null==K?void 0:K.isLoading)&&void 0!==s&&s,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:f,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==H?void 0:H.documents,input_index_map:null==H?void 0:H.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[Me,H]),ut=t.useCallback(function(e){pn(),un(null),tn(e)},[pn]),ct=function(e,n,t,i,o,r){e.stopPropagation(),on.open&&on.sectionIdx===o?pn():(Ne.current&&et(),Ee(new Set),Be([]),je.current=[],gn(),an.open?Ft():dn(),rn(lt(e.currentTarget,n,i,o,t,r)))},at=t.useCallback(function(){null!==on.sectionIdx&&on.anchorEl?ut(e.__assign(e.__assign({},on),{open:!0})):pn()},[on,pn,ut]),st=t.useCallback(function(){var e=on.sectionIdx,n=on.isOrphan;pn(),dn(),null!==e&&(n?ae("No counterpart exists to connect to."):(Ne.current&&et(),Be([]),je.current=[],Ee(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){ke.current&&ke.current()},50)))},[on.sectionIdx,on.isOrphan,pn,dn,et]),dt=t.useRef(null),vt=t.useRef(null),ft=t.useRef(null),gt=t.useRef(null),pt=t.useRef(null),ht=t.useRef(null),xt=t.useState([]),mt=xt[0],_t=xt[1];t.useRef(null);var Rt=t.useState(null),yt=Rt[0],St=Rt[1];t.useEffect(function(){if(mn){var e=hn.fields.find(function(e){return e.analysisKey===mn||e.key===mn});if(e){var n=Pn.current[e.key]||Nn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[mn,hn.fields]);var bt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==Kn?void 0:Kn.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}},[Kn]),At=t.useCallback(function(n,t){var i,o,r,l,c,s,d;void 0===t&&(t="left");var v=null,f=null;if("left"===t)if(v=In[n],$&&v){var g=Tn.filter(function(e){var n;return null===(n=v.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});f=g.find(function(e){return e.evaluationResult})||g[0]}else f=Tn[n];else if(f=Tn[n],$&&f){var p=In.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(f.selfIndex)});v=p.find(function(e){return e.evaluationResult})||p[0]}else v=In[n];var h=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,x=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,m=!(!(null==v?void 0:v.cognitiveData)&&!(null==f?void 0:f.cognitiveData));if(!h&&!x&&!m)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var _=null!==(o=null!==(i=null==v?void 0:v.evaluationResult)&&void 0!==i?i:null==f?void 0:f.evaluationResult)&&void 0!==o?o:null,R=null===(r=null==_?void 0:_.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(s=null===(c=null===(l=null==_?void 0:_.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==s?s:a.DEFAULT_DEVIAION_COLOR;return null!=_?e.__assign(e.__assign({},u.generateColorPalette(y)),{label:null!==(d=R)&&void 0!==d?d:""}):e.__assign(e.__assign({},u.generateColorPalette(y)),{label:null})},[In,Tn,Me,hn,$]),Et=t.useCallback(function(n){for(var t,i,o,r,l,c,s,d,v,f=n.split("-").map(Number),g=In[f[0]],p=Tn[f[0]],h=1;h<f.length;h++)(null==g?void 0:g.subsections)&&(g=g.subsections[f[h]]),(null==p?void 0:p.subsections)&&(p=p.subsections[f[h]]);if(!g&&!p)return null;var x=(null==g?void 0:g.relation)&&"not_defined"!==g.relation,m=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,_=u.safeStringify(null==g?void 0:g.id)||u.safeStringify(null==p?void 0:p.id)||"",R=!(!(null==g?void 0:g.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!x&&!m&&!R)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==g?void 0:g.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||_&&(null===(o=Me[_])||void 0===o||o.relevance_score);var y=null!==(l=null!==(r=null==g?void 0:g.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,S=null===(c=null==y?void 0:y.evaluation_outputs)||void 0===c?void 0:c.output_value,b=null!==(v=null===(d=null===(s=null==y?void 0:y.evaluation_outputs)||void 0===s?void 0:s.metadata)||void 0===d?void 0:d.label_color)&&void 0!==v?v:a.DEFAULT_DEVIAION_COLOR;return null!=y?e.__assign(e.__assign({},u.generateColorPalette(b)),{label:null!=S?S:""}):e.__assign(e.__assign({},u.generateColorPalette(b)),{label:null})},[In,Tn,Me,hn]),It=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;if(!Qe.current&&!De.current){Qe.current=!0;try{if(!dt.current)return;var b=function(e){var n=e.split("-"),t=n[0];if(!tt[t]&&!1===$)return!1;if($&&!tt["left-".concat(t)]&&!tt["right-".concat(t)]&&!tt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!it[i])return!1;return!0},A=dt.current.getBoundingClientRect();He({width:A.width,height:A.height});var E=[];if(Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.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")}),!De.current){for(var I=0;I<Math.max(In.length,Tn.length);I++){var T=null===(e=Fn.current[I])||void 0===e?void 0:e.current,B=null===(n=kn.current[I])||void 0===n?void 0:n.current;T&&(T.style.height="auto",T.style.minHeight="0px"),B&&(B.style.height="auto",B.style.minHeight="0px")}$||Object.keys(Hn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.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 C={};Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();C[i]=Math.max(l.height,u.height)}});var D={left:{},right:{}},O={};if(!De.current)if($){if(de&&null!==Re)if("number"==typeof Re){var w=Re,j=In[w],P=null===(o=Fn.current[w])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Tn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=kn.current[t])||void 0===n?void 0:n.current;if(i&&(tt["left-".concat(w)]||tt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[w]=Math.max(D.left[w]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var N=Re.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(N){T=null===(r=Hn.current[N])||void 0===r?void 0:r.current,B=null===(l=Gn.current[N])||void 0===l?void 0:l.current;if(T&&B){F=Math.max(T.getBoundingClientRect().height,B.getBoundingClientRect().height);O[N]=Math.max(O[N]||0,F)}}}}else{Object.keys(Hn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.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);O[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(I=0;I<Math.min(In.length,Tn.length);I++){var T=null===(t=Fn.current[I])||void 0===t?void 0:t.current,B=null===(i=kn.current[I])||void 0===i?void 0:i.current;if(T&&B){var F=Math.max(T.getBoundingClientRect().height,B.getBoundingClientRect().height);D.left[I]=F,D.right[I]=F}}}if(Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=C[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),De.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Fn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=kn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),$||Object.keys(O).forEach(function(e){var n,t,i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(i&&o&&O[e]){var r=O[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),$)In.forEach(function(e,n){var t;(null===(t=Fn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,u,c,a,s,d,v=Tn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=Mn.current[n])||void 0===t?void 0:t.current,g=null===(i=Ln.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-A.left,m=h.left-A.left,_=p.top+p.height/2-A.top,R=h.top+h.height/2-A.top;if(de&&Re===n){var y=null!==(r=null===(o=Je.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=We.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,b=y+(null!==(a=null===(c=Je.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=S+(null!==(d=null===(s=We.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),T=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};_=C(T,y,b)-A.top,R=C(B,S,I)-A.top}var D=At(n);D&&E.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:_,x2:m,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(I=0;I<Math.min(In.length,Tn.length);I++){var k=null===(c=Fn.current[I])||void 0===c?void 0:c.current,M=null===(a=kn.current[I])||void 0===a?void 0:a.current;if(k&&M){var L=k.getBoundingClientRect(),V=M.getBoundingClientRect(),H=Math.max(L.top,V.top)+18-A.top,G=(null===(s=Tn[I])||void 0===s?void 0:s.id)||"sec-".concat(I);(J=At(I))&&E.push({id:G,x1:L.right-A.left,y1:H,x2:V.left-A.left,y2:H,style:J,sectionIdx:I,hasCognitive:!!((null===(d=In[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Tn[I])||void 0===v?void 0:v.cognitiveData)||G&&Me[G]),isSubSection:!1})}}Object.keys(Hn.current).forEach(function(e){var n,t,i,o,r,l;if(b(e)){var c=null===(n=Hn.current[e])||void 0===n?void 0:n.current,a=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=In[s[0]],v=Tn[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 m=c.getBoundingClientRect(),_=a.getBoundingClientRect(),R=Math.max(m.top,_.top)+16-A.top,y=Et(e);y&&"Not Defined"!==y.label&&E.push({id:"subsec-".concat(e),x1:m.right-A.left,y1:R,x2:_.left-A.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(de&&"string"==typeof Re&&Re.includes(u.DEVIATION_BADGE_SEPARATOR)){var q=Re.split(u.DEVIATION_BADGE_SEPARATOR),z=q[0],W=q[1],Y=q[2],K=(q[3],"".concat(z).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),U=null===(f=Mn.current[K])||void 0===f?void 0:f.current,X=null===(g=Ln.current[K])||void 0===g?void 0:g.current;if(U&&X){var J,Q=U.getBoundingClientRect(),Z=X.getBoundingClientRect(),ee=Q.right-A.left,ne=Z.left-A.left,te=Q.top+Q.height/2-A.top,ie=Z.top+Z.height/2-A.top;if($){var oe=null!==(h=null===(p=Je.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(m=null===(x=We.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,le=oe+(null!==(R=null===(_=Je.current)||void 0===_?void 0:_.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=We.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)-A.top,ie=ce(Z.top+Z.height/2,re,ue)-A.top}(J=Et(Y))&&E.push({id:"line-subsec-".concat(K),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Re})}}if(_t(E),pt.current&&ht.current){var ae=pt.current.getBoundingClientRect(),se=ht.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-A.top+se.top+se.height/2-A.top)/2;St({x1:ae.right-A.left,x2:se.left-A.left,y:ve})}else St(null);if(Ae.size>0){var fe=[],ge=Je.current,pe=We.current;if(ge&&pe){var he=[],xe=ge.getBoundingClientRect().top,me=pe.getBoundingClientRect().top,_e=xe+ge.clientHeight,ye=me+pe.clientHeight,Se=ge.scrollTop,be=pe.scrollTop,Ee=A.top,Ie=function(e,n,t){return Math.max(n,Math.min(t,e))};Ae.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var l=e.split(u.DEVIATION_BADGE_SEPARATOR),c=l[0],a=l[1],s=l[2],d=(l[3],"".concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(a)),v=null===(n=Mn.current[d])||void 0===n?void 0:n.current,f=null===(t=Ln.current[d])||void 0===t?void 0:t.current;if(!v||!f)return;var g=v.getBoundingClientRect(),p=f.getBoundingClientRect(),h=Et(s),x=(P=g.right-A.left)+.5*((N=p.left-A.left-0)-P),m=g.top+g.height/2,_=p.top+p.height/2,R=m-xe+Se,y=_-me+be,S="conn-subsec-".concat(d);he.push({lhsScrollY:R,rhsScrollY:y,x1:P,x2:N,containerTop:Ee,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var b=Ie(m,xe,_e),E=Ie(_,me,ye),I=b-Ee,T=E-Ee,B=_>=me-4&&_<=ye+4,C="";C=(F=m>=xe-4&&m<=_e+4)&&B?u.getBentArrowPath(P,I,N,T):F&&!B?"M ".concat(P,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&B?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(N,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),fe.push({id:S,pathD:C,style:h,leftIdx:e,rhsArrayIdx:e})}else if($){var D=e,O=In[D];if(!(null===(r=null==O?void 0:O.refIndexes)||void 0===r?void 0:r.length))return;O.refIndexes.forEach(function(e){var n,t,i=Tn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Mn.current[D])||void 0===n?void 0:n.current,r=null===(t=Ln.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=At(D),s=l.right-A.left,d=c.left-A.left-0,v=s+.5*(d-s),f=l.top+l.height/2,g=c.top+c.height/2,p=f-xe+Se,h=g-me+be,x="conn-".concat(D,"-").concat(i);he.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:Ee,leftIdx:D,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var m=Ie(f,xe,_e),_=Ie(g,me,ye),R=m-Ee,y=_-Ee,S=f>=xe-4&&f<=_e+4,b=g>=me-4&&g<=ye+4,E="";E=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:E,style:a,leftIdx:D,rhsArrayIdx:i})}}})}else{var w=e,j=w;v=null===(i=Mn.current[w])||void 0===i?void 0:i.current,f=null===(o=Ln.current[j])||void 0===o?void 0:o.current;if(!v||!f)return;var P,N;g=v.getBoundingClientRect(),p=f.getBoundingClientRect(),h=At(w),x=(P=g.right-A.left)+.5*((N=p.left-A.left-0)-P),m=g.top+g.height/2,_=p.top+p.height/2,R=m-xe+Se,y=_-me+be,S="conn-".concat(w,"-").concat(j);he.push({lhsScrollY:R,rhsScrollY:y,x1:P,x2:N,containerTop:Ee,leftIdx:w,rhsArrayIdx:j,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var F;b=Ie(m,xe,_e),E=Ie(_,me,ye),I=b-Ee,T=E-Ee,B=_>=me-4&&_<=ye+4,C="";C=(F=m>=xe-4&&m<=_e+4)&&B?u.getBentArrowPath(P,I,N,T):F&&!B?"M ".concat(P,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&B?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(N,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),fe.push({id:S,pathD:C,style:h,leftIdx:w,rhsArrayIdx:j})}}),je.current=he}Be(fe)}else Be([]),je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Qe.current=!1}}},[Bn,In,Tn,Me,hn,bt,At,$,de,Re,Ae,tt,it]),Tt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=je.current;if(p.length&&!De.current){var h=null!==(n=null===(e=Je.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=We.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=Je.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,_=null!==(c=null===(l=We.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=Je.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=We.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+m,b=y+_,A=null!==(g=null===(f=dt.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=we.current[e.styleId+"-stroke"],o=we.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(){ke.current=It},[It]);var Bt=t.useRef(null),Ct=t.useRef(null),Dt=t.useCallback(function(){je.current.length>0&&!De.current||(null!==Bt.current&&clearTimeout(Bt.current),Bt.current=setTimeout(function(){ke.current(),Bt.current=null},50))},[]),Ot=t.useCallback(function(){me(!0),pe(!1),null!==Ct.current&&clearTimeout(Ct.current),null!==Bt.current&&(clearTimeout(Bt.current),Bt.current=null),Ct.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s;if(je.current=[],Ne.current&&null!==Fe.current&&null!==ft.current){var d=Fe.current,v=ft.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),m="".concat(x[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(x[1]);f=(null===(e=Mn.current[m])||void 0===e?void 0:e.current)||null,g=(null===(n=Ln.current[m])||void 0===n?void 0:n.current)||null,p=(null===(t=Hn.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=Fn.current[Number(x[2])])||void 0===i?void 0:i.current)||null,h=(null===(o=Gn.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=kn.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else f=(null===(l=qn.current[d])||void 0===l?void 0:l.current)||null,p=(null===(c=Fn.current[d])||void 0===c?void 0:c.current)||null,g=(null===(a=Vn.current[v])||void 0===a?void 0:a.current)||null,h=(null===(s=kn.current[v])||void 0===s?void 0:s.current)||null;if(f&&g&&p&&h){if(p.style.paddingTop="0px",h.style.paddingTop="0px",!$){var _=f.getBoundingClientRect(),R=g.getBoundingClientRect(),y=_.top-R.top;y>0?h.style.paddingTop="".concat(y,"px"):y<0&&(p.style.paddingTop="".concat(Math.abs(y),"px"))}var S=Je.current,b=We.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)}}}ke.current(),Ne.current&&pe(!0),me(!1),Ct.current=null},150)},[$,In,Tn]),wt=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==Ze.current&&$e.current&&Math.abs(e.currentTarget.scrollTop-Ze.current)<=2){var v=$e.current;Ze.current=null,$e.current=null,v()}if(!Se.current){if($||Dt(),Ne.current){var f=Fe.current,g=ft.current,p=Je.current,h=We.current;if(null!==f&&null!==g&&p&&h){var x="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=Mn.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=qn.current[f])||void 0===t?void 0:t.current,m="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=Ln.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=Vn.current[g])||void 0===o?void 0:o.current;if(x&&m&>.current){var _=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]);_=null===(r=Mn.current[S])||void 0===r?void 0:r.current,R=null===(l=Ln.current[S])||void 0===l?void 0:l.current}else _=null===(c=Mn.current[f])||void 0===c?void 0:c.current,R=null===(a=Ln.current[g])||void 0===a?void 0:a.current;var b=null!==(d=null===(s=dt.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(_&&R){var I=_.getBoundingClientRect(),T=R.getBoundingClientRect(),B=I.top+I.height/2;T.top,T.height;var C=((O=B,w=A,j=E,Math.max(w,Math.min(j,O)))-b).toString();gt.current.setAttribute("y1",C),gt.current.setAttribute("y2",C);var D=B>=A-4&&B<=E+4;gt.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,j;je.current.length>0&&!Pe.current&&(Pe.current=!0,requestAnimationFrame(function(){Tt(),Pe.current=!1}))}},[Tt,$,Dt]);t.useEffect(function(){var e=setTimeout(Dt,250);window.addEventListener("resize",Ot);var n=null,t=null;return qe.current&&(n=new ResizeObserver(Dt)).observe(qe.current),dt.current&&(t=new ResizeObserver(Dt)).observe(dt.current),function(){clearTimeout(e),null!==Bt.current&&clearTimeout(Bt.current),null!==Ct.current&&clearTimeout(Ct.current),window.removeEventListener("resize",Ot),null==n||n.disconnect(),null==t||t.disconnect()}},[An,En,Kn,Bn,tt,it,In,Tn,hn,Dt,Ot,de,Re,ge,Ae]),t.useEffect(function(){Ne.current=de},[de]),t.useEffect(function(){Fe.current=Re},[Re]);var jt=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";pn(),null!=e&&(n?ae("No counterpart exists for this section."):de&&Re===e?r?et():null==l||l():(Ee(new Set([e])),Be([]),je.current=[],le(!0),Se.current=!0,ye(e),Fe.current=e,ve(!0),Ne.current=!0,pe(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a=null,s=null,d=null;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var v=e.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(v[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(v[1]);a=(null===(n=Mn.current[f])||void 0===n?void 0:n.current)||null,d=(s=(null===(t=Ln.current[f])||void 0===t?void 0:t.current)||null)?e:null}else if(a=(null===(i=qn.current[e])||void 0===i?void 0:i.current)||null,$){var g=In[e],p=(null==g?void 0:g.refIndexes)||[];if(p.length>0){var h=p[0],x=Tn.findIndex(function(e){return e.selfIndex===h});-1!==x&&(s=(null===(r=Vn.current[x])||void 0===r?void 0:r.current)||null,d=x)}}else d=(s=(null===(o=Vn.current[e])||void 0===o?void 0:o.current)||null)?e:null;ft.current=d;var m=Je.current,_=We.current,R=function(){"right"===c&&_?_.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll"))};if(!a||!m)return Se.current=!1,le(!1),void(null==l||l());if(!s||!_)return pe(!0),ke.current(),Se.current=!1,le(!1),void(null==l||l());if(!$){var y=0;y="right"===c?s?s.getBoundingClientRect().top:0:a?a.getBoundingClientRect().top:0;var S=qe.current,b=(null==S?void 0:S.getBoundingClientRect().top)||0,A=S?S.scrollTop+y-b-150:0;return S?void u.smoothScrollTo(S,A,200,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()}):(pe(!0),ke.current(),Se.current=!1,le(!1),void(null==l||l()))}var E=a.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,I=s.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,T=200;if("left"===c){var B=I-(E-m.scrollTop);B<0&&Ye.current&&(Ye.current.style.height="".concat(Math.abs(B),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(B<0)e=0;else{if(B>n){var t=B-n;return Ke.current&&(Ke.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,B,T,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}e=B}u.smoothScrollTo(_,e,T,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}else{var C=E-(I-_.scrollTop);C<0&&Ue.current&&(Ue.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return Xe.current&&(Xe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(m,C,T,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}e=C}u.smoothScrollTo(m,e,T,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}})))},[Re,pn,Tn,de,$,In,et]),Pt=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;gn();var c="left";(null===(o=We.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=Ln.current[l])||void 0===e?void 0:e.current:null===(t=Mn.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=Ln.current[n])||void 0===i?void 0:i.current:null===(o=Mn.current[n])||void 0===o?void 0:o.current};if(t)return et(),Ee(new Set),Be([]),je.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;sn({open:!0,anchorEl:e,summary:i})}));jt(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;sn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[jt,gn,sn,et]),Nt=t.useCallback(function(){var e,n=on.sectionIdx,t=on.isOrphan;if(dn(),null!=n){var i="left";on.anchorEl&&(null===(e=We.current)||void 0===e?void 0:e.contains(on.anchorEl))&&(i="right"),jt(n,t,{sourceSide:i})}},[jt,on.isOrphan,on.sectionIdx,on.anchorEl,dn]),Ft=t.useCallback(function(){dn(),et(),Ee(new Set),Be([]),je.current=[]},[dn,et]),kt=null!==on.sectionIdx&&Ae.has(on.sectionIdx),Mt=m.useDeviationNavigation({proposedSections:In,existingSections:Tn,parentDeviationRecord:Cn,expandedSections:tt,maintainRelativeOrder:!!$,scrollContainerRef:qe,leftContainerRef:Je,lhsBadgeRefs:Mn,rhsBadgeRefs:Ln}),Lt=Mt.showDeviationNavigation,Vt=Mt.showOpenNodeRef,Ht=t.useMemo(function(){if(!Q)return null;for(var e in Cn){if((Cn[e]||[]).some(function(e){return e.id===Q}))return e}return null},[Q,Cn]),Gt=t.useRef(null),qt=t.useRef(null);t.useEffect(function(){if(Q&&Gt.current!==Q){qt.current!==Q&&(dn(),gn(),et(),Ee(new Set),Be([]),je.current=[],qt.current=Q);var n=!1,t=0,i=null,o=150,r=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},l=function(){var c,a,s,d;if(!n){var v=null,f=null;for(var g in Cn){var p=Cn[g].find(function(e){return e.id===Q});if(p){v=g,f=p;break}}if(f&&v){var h=In.findIndex(function(e){return e.id===v}),x=Tn.findIndex(function(e){return e.id===v}),m=-1===h&&-1!==x;if(m){if(!($?!!tt["right-".concat(x)]:!!tt[String(x)]))return rt(x,"right"),t+=1,void(i=setTimeout(l,450))}else if(!($?!!tt["left-".concat(h)]:!!tt[String(h)])&&h>=0)return rt(h,"left"),t+=1,void(i=setTimeout(l,450));var _=r(In,f.id),R=r(Tn,f.id);if(_&&!R&&!m){var y=_.split("-"),S=Number(y[0]);if($){var b=null===(a=null===(c=In[S])||void 0===c?void 0:c.refIndexes)||void 0===a?void 0:a[0],A=Tn.findIndex(function(e){return e.selfIndex===b});-1!==A&&(S=A)}R=e.__spreadArray([S],y.slice(1),!0).join("-")}if(_||R){var E,I=_||"",T=R||"",B="".concat(f.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0").concat(u.DEVIATION_BADGE_SEPARATOR).concat(I).concat(u.DEVIATION_BADGE_SEPARATOR).concat(T),C="".concat(f.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0"),D=null===(s=Mn.current[C])||void 0===s?void 0:s.current,O=null===(d=Ln.current[C])||void 0===d?void 0:d.current,w=m?O:D;if(E=$?m?We.current:Je.current:qe.current,w&&E){var j=w.getBoundingClientRect();if(0===j.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var P=E.getBoundingClientRect(),N=j.top-P.top+E.scrollTop-P.height/2+j.height/2,F=function(){var e,t,i,o,r;if(!n){Gt.current=Q;var l=window.getComputedStyle(w).color;D&&(D.style.transition="box-shadow 300ms ease-in-out",D.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(){D&&(D.style.boxShadow=""),O&&(O.style.boxShadow="")},2e3);var u=(null===(t=null===(e=f.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[0])||f,c=(null===(i=f.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||f.evaluation_outputs;if(D&&O&&!m)jt(B,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=Mn.current[C])||void 0===e?void 0:e.current)||D;sn({open:!0,anchorEl:n,summary:{deviation_summary:u.deviation_summary||u,evaluation_outputs:c}})}});else{var a=m?(null===(o=Ln.current[C])||void 0===o?void 0:o.current)||O:(null===(r=Mn.current[C])||void 0===r?void 0:r.current)||D;sn({open:!0,anchorEl:a,summary:{deviation_summary:u.deviation_summary||u,evaluation_outputs:c}})}}};Math.abs(E.scrollTop-N)<=2?F():(Ze.current=N,$e.current=F,E.scrollTo({top:N,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if($e.current){Ze.current=null;var e=$e.current;$e.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){n=!0,i&&clearTimeout(i)}}},[Q,Cn,In,Tn,$,tt,rt,jt,sn]);var zt=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:it,setExpandedSubSections:ot,maintainRelativeOrder:$||!1,proposedSections:In,existingSections:Tn,treeData:H,deviationNumberRegistry:Dn,connectedSections:Ae,activeSideBySideSection:Re,resolvedMarkdownStyles:Ge,getSubSectionRef:Wn,getSubSectionCompareStyle:Et,getBadgeRef:Yn,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,resetSideBySide:et,setConnectedSections:Ee,setConnectedLines:Be,cachedConnectedPositions:je})};return n.jsxs(i.Box,e.__assign({ref:ze,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},$?{}:{overflow:"visible"}),{position:"relative"})},{children:[te&&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:vt.current,clipTopEl:pt.current,scrollContainerEl:qe.current,onClose:Ft,summary:an.summary}),n.jsx(d.default,{open:on.open,anchorEl:on.anchorEl,sectionTitle:on.sectionTitle,referenceSectionTitle:on.refSectionTitle,onClose:pn,onOpenCognitiveCompare:at,onOpenSideBySide:Nt,onConnect:st,isConnected:kt,isOrphan:on.isOrphan}),nn.open&&n.jsx(s.default,{open:nn.open,popupRef:fn,position:ln,popupConfig:U,onClose:function(){un(null),tn(function(n){return e.__assign(e.__assign({},n),{open:!1})}),vn(null)},markdownStyles:W,sectionTitle:nn.sectionTitle,referenceSectionTitle:nn.refSectionTitle,cognitiveData:nn.cognitiveData,anchorEl:nn.anchorEl,sectionAnchorEl:nn.sectionAnchorEl,scrollContainerEl:qe.current,badgeStyle:nn.badgeStyle,docData:nn.docData,deviationData:nn.deviationData,isLoading:nn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!ce,autoHideDuration:8e3,onClose:function(){return ae(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return ae(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ce}))})),n.jsx(_.default,{componentHeaderText:V,displayConfig:K,maintainRelativeOrder:$,onToggleView:function(e){ie(!0),setTimeout(function(){ee(!e),et(),dn(),Ee(new Set),Be([]),je.current=[],setTimeout(function(){ie(!1)},400)},50)}}),n.jsx(i.Box,e.__assign({ref:qe,onScroll:wt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:$?"hidden":"auto",borderTop:Un&&Xn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},$?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:dt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ce,style:{position:"absolute",top:0,left:0,width:Ve.width||"100%",height:Ve.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:xe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[yt&&n.jsx("g",{children:n.jsx("line",{x1:yt.x1,y1:yt.y,x2:yt.x2,y2:yt.y,stroke:$n.badgeBorder,strokeWidth:"1.5"})}),mt.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?de&&Re===t.subSectionKeyPath&&ge:de&&Re===t.sectionIdx&&ge)return null;if(!$){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),m=In[t.sectionIdx]||{title:"",content:""},_=Tn[t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",m,_),t.isSubSection&&t.subSectionKeyPath){var R=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],y=R[2]||t.subSectionKeyPath,S=R[3]||y,b=y.split("-").map(Number),A=S.split("-").map(Number),E=null,I=null;b.length>0&&(E=In[b[0]]),A.length>0&&(I=Tn[A[0]]);var T=(null==E?void 0:E.title)||"",B=(null==I?void 0:I.title)||"";console.log("Root Parent Titles:",T,B);for(var C=1;C<b.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[b[C]]);for(C=1;C<A.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[A[C]]);E&&(m=e.__assign(e.__assign({},E),{title:T||E.title})),console.log("Base Section for Subsection Badge:",m),I&&(_=e.__assign(e.__assign({},I),{title:B||I.title})),console.log("Ref Section for Subsection Badge:",_)}var D=!(null===(l=m.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(s=null===(c=m.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===s?void 0:s.length),O=(null===(g=null===(v=null===(d=m.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&&(nn.open&&cn===t.id?gn():(vn(t.id),ut(lt(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:nn.open&&cn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Te.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){we.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){we.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)"},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:pt,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:yn,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:yn}))}))})),n.jsxs(i.Box,e.__assign({ref:Je,onScroll:wt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{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:Ue,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&In.map(function(t,r){var l,c,a=!t.title&&!t.content;if($&&a)return null;var s=t,d=At(r,"left"),v=$?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Tn[r],g=$?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ae.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:zn(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:Fn.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:zn("left-accordion-".concat(r)),mb:0,treeData:H,proposedSections:In,existingSections:Tn,deviationNumberRegistry:Dn,getSectionCompareStyle:At,getBadgeRef:Yn,connectedSections:Ae,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Ht,parentNodeId:(null===(c=null==H?void 0:H.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:$?!!tt["left-".concat(r)]:!!tt[String(r)],onToggle:function(){Ft(),rt(r,"left")},navigation:t.id?Lt[t.id]:null,showOpenNodeRef:Vt,resolvedMarkdownStyles:Ge,maintainRelativeOrder:$,renderSubSections:zt})})),$&&d&&n.jsxs(i.Box,e.__assign({ref:Mn.current[r],onClick:function(e){var n=$?Tn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Tn[r]||{title:"",content:""};ct(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:!K.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:Xe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:vt,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(),nn.open&&cn===Jn?gn():(vn(Jn),ut(lt(n.currentTarget,{title:"",content:"",evaluationResult:Qn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Jn,!0,e.__assign(e.__assign({},$n),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:$n.badgeBg,color:$n.badgeText,border:"1px solid ".concat($n.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Zn?Zn: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:nn.open&&cn===Jn?"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},$?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[re&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:ht,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:Sn,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:Sn}))}))})),n.jsxs(i.Box,e.__assign({ref:We,onScroll:wt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{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:Ye,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&Tn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if($){u=In.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=In.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=In.findIndex(function(e,n){var t;return Ae.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=At(d))}else u=[o+1],(c=Ae.has(o))&&(a=At(o));var v=At($&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:Vn.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:kn.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:zn("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==H?void 0:H.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:$?!!tt["right-".concat(o)]:!!tt[String(o)],treeData:H,proposedSections:In,existingSections:Tn,deviationNumberRegistry:Dn,getBadgeRef:Yn,getSectionCompareStyle:At,connectedSections:Ae,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Ht,onToggle:function(){Ft(),rt(o,"right")},navigation:t.id?Lt[t.id]:null,showOpenNodeRef:Vt,resolvedMarkdownStyles:Ge,maintainRelativeOrder:$,renderSubSections:zt})})),$&&v&&n.jsx(i.Box,e.__assign({ref:Ln.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:Ke,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"),g=require("./components/ThreeDotsLoader.js"),f=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(A){var b,E,I,T,B,C,D,O,w,j,N,P,F,k,M,L=A.componentHeaderText,V=void 0===L?a.DEFAULT_COMPONENT_HEADER_TEXT:L,H=A.treeData,G=A.comparisonConfig,q=A.leftColumnTitleText,z=A.rightColumnTitleText,W=A.markdownStyles,Y=A.displayConfig,K=void 0===Y?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:Y,U=A.popupConfig,X=A.deviationData,J=void 0===X?{}:X,Q=A.deviationNodeIdToView,Z=t.useState(K.maintainRelativeOrder),$=Z[0],ee=Z[1],ne=t.useState(!1),te=ne[0],ie=ne[1],oe=t.useState(!1),re=oe[0],le=oe[1],ue=t.useState(null),ce=ue[0],ae=ue[1],se=t.useState(!1),de=se[0],ve=se[1],ge=t.useState(!1),fe=ge[0],pe=ge[1],he=t.useState(!1),xe=he[0],_e=he[1],me=t.useState(null),Re=me[0],ye=me[1],Se=t.useRef(!1),Ae=t.useState(new Set),be=Ae[0],Ee=Ae[1],Ie=t.useState([]),Te=Ie[0],Be=Ie[1],Ce=t.useRef(null),De=t.useRef(!1),Oe=t.useRef(null),we=t.useRef({}),je=t.useRef([]),Ne=t.useRef(!1),Pe=t.useRef(!1),Fe=t.useRef(null),ke=t.useRef(function(){}),Me=t.useMemo(function(){return(null==H?void 0:H.cognitive_decisioning)||{}},[H]),Le=t.useState({width:0,height:0}),Ve=Le[0],He=Le[1],Ge=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),W)},[W]),qe=t.useRef(null),ze=t.useRef(null),We=t.useRef(null),Ye=t.useRef(null),Ke=t.useRef(null),Ue=t.useRef(null),Xe=t.useRef(null),Je=t.useRef(null),Qe=t.useRef(!1),Ze=t.useRef(null),$e=t.useRef(null),en=p.useComparePopups(qe),nn=en.cognitivePopup,tn=en.setCognitivePopup,on=en.moreFunctions,rn=en.setMoreFunctions,ln=en.position,un=en.setPosition,cn=en.activeBadgeId,an=en.summaryPopup,sn=en.setSummaryPopup,dn=en.closeSummaryPopup,vn=en.setActiveBadgeId,gn=en.popupRef,fn=en.closeCognitivePopup,pn=en.closeMoreFunctionsPopup,hn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==G?void 0:G.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==G?void 0:G.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==G?void 0:G.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==G?void 0:G.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[G]),xn=t.useState(null),_n=xn[0];xn[1];var mn=null===(I=null===(b=null==H?void 0:H.documents)||void 0===b?void 0:b[null===(E=null==H?void 0:H.input_index_map)||void 0===E?void 0:E[0]])||void 0===I?void 0:I.title,Rn=null===(C=null===(T=null==H?void 0:H.documents)||void 0===T?void 0:T[null===(B=null==H?void 0:H.input_index_map)||void 0===B?void 0:B[1]])||void 0===C?void 0:C.title,yn=u.safeStringify(q||mn||"Uploaded Contract"),Sn=u.safeStringify(z||Rn||"Reference Template"),An=f.useCognitiveTreeData(H,$,J,hn),bn=An.activeProposed,En=An.existingRule,In=An.proposedSections,Tn=An.existingSections,Bn=An.visibleFields,Cn=An.parentDeviationRecord,Dn=An.deviationNumberRegistry,On=An.parseError;t.useEffect(function(){On&&ae("Failed to load comparison: ".concat(On))},[On]);var wn=In.length>0||Tn.length>0,jn=h.useSectionRefs(Bn.map(function(e){return e.key}),Math.max(In.length,Tn.length)),Nn=jn.leftRefs,Pn=jn.rightRefs,Fn=jn.sectionLeftRefs,kn=jn.sectionRightRefs,Mn=jn.lhsBadgeRefs,Ln=jn.rhsBadgeRefs,Vn=jn.sectionRightRowRefs,Hn=jn.subSectionLeftRefs,Gn=jn.subSectionRightRefs,qn=jn.sectionRowRefs,zn=jn.getSectionRowRef,Wn=jn.getSubSectionRef,Yn=jn.getBadgeRef,Kn=En.analysis,Un=u.safeStringify(null===(O=null===(D=null==Kn?void 0:Kn.rule_difference_comparison)||void 0===D?void 0:D.summary)||void 0===O?void 0:O.overall_summary),Xn=!!Un.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Jn=null!==(w=null==H?void 0:H.base_root_id)&&void 0!==w?w:"-1";null==H||H[Jn];var Qn=(null===(j=null==J?void 0:J[Jn])||void 0===j?void 0:j.evaluation_result)||(null===(P=null===(N=null==H?void 0:H.nodes)||void 0===N?void 0:N[Jn])||void 0===P?void 0:P.evaluation_result)||null,Zn=u.extractDeviationScore(Qn),$n=u.generateColorPalette(null!==(M=null===(k=null===(F=null==Qn?void 0:Qn.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===k?void 0:k.label_color)&&void 0!==M?M:""),et=t.useCallback(function(){var e,n,t,i,o,r;ve(!1),Pe.current=!1;var l=Fe.current,c=gt.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=Hn.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=Fn.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=Fn.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=Gn.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=kn.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=kn.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}ye(null),Fe.current=null,gt.current=null,pe(!1),le(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px")},[]),nt=x.useAccordionState({maintainRelativeOrder:!!$,proposedSections:In,existingSections:Tn,activeSideBySideSection:Re,connectedSections:be,resetSideBySide:et,setConnectedSections:Ee,setConnectedLines:Be,cachedConnectedPositions:je,svgContainerRef:Ce,isAnimatingRef:De,animationTimerRef:Oe,calculateLinesRef:ke,sectionLeftRefs:Fn,sectionRightRefs:kn,subSectionLeftRefs:Hn,subSectionRightRefs:Gn}),tt=nt.expandedSections,it=nt.expandedSubSections,ot=nt.setExpandedSubSections,rt=nt.toggleSection,lt=t.useCallback(function(e,n,t,i,o,r,l){var c,a,s,d=u.safeStringify(null==n?void 0:n.id)||u.safeStringify(null==t?void 0:t.id)||"",v=(d?Me[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},g=null!==(a=null===(c=qn.current[i])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(s=null==K?void 0:K.isLoading)&&void 0!==s&&s,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:g,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==H?void 0:H.documents,input_index_map:null==H?void 0:H.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[Me,H]),ut=t.useCallback(function(e){pn(),un(null),tn(e)},[pn]),ct=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),on.open&&on.sectionIdx===o)pn();else{var c=e.currentTarget,a="left";(null===(l=We.current)||void 0===l?void 0:l.contains(c))&&(a="right");Pe.current&&et(),Ee(new Set),Be([]),je.current=[],fn(),an.open?Ft():dn(),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=Ln.current[l])||void 0===e?void 0:e.current:null===(n=Mn.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=Ln.current[o])||void 0===t?void 0:t.current:null===(i=Mn.current[o])||void 0===i?void 0:i.current}()||c;rn(lt(e,n,i,o,t,r))})}},at=t.useCallback(function(){null!==on.sectionIdx&&on.anchorEl?ut(e.__assign(e.__assign({},on),{open:!0})):pn()},[on,pn,ut]),st=t.useCallback(function(){var e=on.sectionIdx,n=on.isOrphan;pn(),dn(),null!==e&&(n?ae("No counterpart exists to connect to."):(Pe.current&&et(),Be([]),je.current=[],Ee(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){ke.current&&ke.current()},50)))},[on.sectionIdx,on.isOrphan,pn,dn,et]),dt=t.useRef(null),vt=t.useRef(null),gt=t.useRef(null),ft=t.useRef(null),pt=t.useRef(null),ht=t.useRef(null),xt=t.useState([]),_t=xt[0],mt=xt[1];t.useRef(null);var Rt=t.useState(null),yt=Rt[0],St=Rt[1];t.useEffect(function(){if(_n){var e=hn.fields.find(function(e){return e.analysisKey===_n||e.key===_n});if(e){var n=Nn.current[e.key]||Pn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[_n,hn.fields]);var At=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==Kn?void 0:Kn.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 g=d.mappings[0]||{};return{score:d.score,relation:g.relation||"",highlightsA:(null===(l=g.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=g.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}},[Kn]),bt=t.useCallback(function(n,t){var i,o,r,l,c,s,d;void 0===t&&(t="left");var v=null,g=null;if("left"===t)if(v=In[n],$&&v){var f=Tn.filter(function(e){var n;return null===(n=v.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});g=f.find(function(e){return e.evaluationResult})||f[0]}else g=Tn[n];else if(g=Tn[n],$&&g){var p=In.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(g.selfIndex)});v=p.find(function(e){return e.evaluationResult})||p[0]}else v=In[n];var h=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,x=(null==g?void 0:g.relation)&&"not_defined"!==g.relation,_=!(!(null==v?void 0:v.cognitiveData)&&!(null==g?void 0:g.cognitiveData));if(!h&&!x&&!_)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var m=null!==(o=null!==(i=null==v?void 0:v.evaluationResult)&&void 0!==i?i:null==g?void 0:g.evaluationResult)&&void 0!==o?o:null,R=null===(r=null==m?void 0:m.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(s=null===(c=null===(l=null==m?void 0:m.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==s?s:a.DEFAULT_DEVIAION_COLOR;return null!=m?e.__assign(e.__assign({},u.generateColorPalette(y)),{label:null!==(d=R)&&void 0!==d?d:""}):e.__assign(e.__assign({},u.generateColorPalette(y)),{label:null})},[In,Tn,Me,hn,$]),Et=t.useCallback(function(n){for(var t,i,o,r,l,c,s,d,v,g=n.split("-").map(Number),f=In[g[0]],p=Tn[g[0]],h=1;h<g.length;h++)(null==f?void 0:f.subsections)&&(f=f.subsections[g[h]]),(null==p?void 0:p.subsections)&&(p=p.subsections[g[h]]);if(!f&&!p)return null;var x=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,_=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,m=u.safeStringify(null==f?void 0:f.id)||u.safeStringify(null==p?void 0:p.id)||"",R=!(!(null==f?void 0:f.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!x&&!_&&!R)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||m&&(null===(o=Me[m])||void 0===o||o.relevance_score);var y=null!==(l=null!==(r=null==f?void 0:f.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,S=null===(c=null==y?void 0:y.evaluation_outputs)||void 0===c?void 0:c.output_value,A=null!==(v=null===(d=null===(s=null==y?void 0:y.evaluation_outputs)||void 0===s?void 0:s.metadata)||void 0===d?void 0:d.label_color)&&void 0!==v?v:a.DEFAULT_DEVIAION_COLOR;return null!=y?e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null!=S?S:""}):e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[In,Tn,Me,hn]),It=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,g,f,p,h,x,_,m,R,y,S;if(!Qe.current&&!De.current){Qe.current=!0;try{if(!dt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!tt[t]&&!1===$)return!1;if($&&!tt["left-".concat(t)]&&!tt["right-".concat(t)]&&!tt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!it[i])return!1;return!0},b=dt.current.getBoundingClientRect();He({width:b.width,height:b.height});var E=[];if(Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Nn.current[i])||void 0===n?void 0:n.current,r=null===(t=Pn.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")}),!De.current){for(var I=0;I<Math.max(In.length,Tn.length);I++){var T=null===(e=Fn.current[I])||void 0===e?void 0:e.current,B=null===(n=kn.current[I])||void 0===n?void 0:n.current;T&&(T.style.height="auto",T.style.minHeight="0px"),B&&(B.style.height="auto",B.style.minHeight="0px")}$||Object.keys(Hn.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.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 C={};Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Nn.current[i])||void 0===n?void 0:n.current,r=null===(t=Pn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();C[i]=Math.max(l.height,u.height)}});var D={left:{},right:{}},O={};if(!De.current)if($){if(de&&null!==Re)if("number"==typeof Re){var w=Re,j=In[w],N=null===(o=Fn.current[w])||void 0===o?void 0:o.current;N&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Tn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=kn.current[t])||void 0===n?void 0:n.current;if(i&&(tt["left-".concat(w)]||tt["right-".concat(t)])){var o=Math.max(N.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[w]=Math.max(D.left[w]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var P=Re.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(P){T=null===(r=Hn.current[P])||void 0===r?void 0:r.current,B=null===(l=Gn.current[P])||void 0===l?void 0:l.current;if(T&&B){F=Math.max(T.getBoundingClientRect().height,B.getBoundingClientRect().height);O[P]=Math.max(O[P]||0,F)}}}}else{Object.keys(Hn.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.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);O[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(I=0;I<Math.min(In.length,Tn.length);I++){var T=null===(t=Fn.current[I])||void 0===t?void 0:t.current,B=null===(i=kn.current[I])||void 0===i?void 0:i.current;if(T&&B){var F=Math.max(T.getBoundingClientRect().height,B.getBoundingClientRect().height);D.left[I]=F,D.right[I]=F}}}if(Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Nn.current[i])||void 0===n?void 0:n.current,r=null===(t=Pn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=C[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),De.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Fn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=kn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),$||Object.keys(O).forEach(function(e){var n,t,i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(i&&o&&O[e]){var r=O[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),$)In.forEach(function(e,n){var t;(null===(t=Fn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,u,c,a,s,d,v=Tn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var g=null===(t=Mn.current[n])||void 0===t?void 0:t.current,f=null===(i=Ln.current[v])||void 0===i?void 0:i.current;if(g&&f){var p=g.getBoundingClientRect(),h=f.getBoundingClientRect(),x=p.right-b.left,_=h.left-b.left,m=p.top+p.height/2-b.top,R=h.top+h.height/2-b.top;if(de&&Re===n){var y=null!==(r=null===(o=Je.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=We.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,A=y+(null!==(a=null===(c=Je.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=S+(null!==(d=null===(s=We.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),T=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};m=C(T,y,A)-b.top,R=C(B,S,I)-b.top}var D=bt(n);D&&E.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(In.length,Tn.length);I++){var k=null===(c=Fn.current[I])||void 0===c?void 0:c.current,M=null===(a=kn.current[I])||void 0===a?void 0:a.current;if(k&&M){var L=k.getBoundingClientRect(),V=M.getBoundingClientRect(),H=Math.max(L.top,V.top)+18-b.top,G=(null===(s=Tn[I])||void 0===s?void 0:s.id)||"sec-".concat(I);(J=bt(I))&&E.push({id:G,x1:L.right-b.left,y1:H,x2:V.left-b.left,y2:H,style:J,sectionIdx:I,hasCognitive:!!((null===(d=In[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Tn[I])||void 0===v?void 0:v.cognitiveData)||G&&Me[G]),isSubSection:!1})}}Object.keys(Hn.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=Hn.current[e])||void 0===n?void 0:n.current,a=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=In[s[0]],v=Tn[s[0]],g=1;g<s.length;g++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[g]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[g]]);var f=!!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(f&&p||h&&x){var _=c.getBoundingClientRect(),m=a.getBoundingClientRect(),R=Math.max(_.top,m.top)+16-b.top,y=Et(e);y&&"Not Defined"!==y.label&&E.push({id:"subsec-".concat(e),x1:_.right-b.left,y1:R,x2:m.left-b.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(de&&"string"==typeof Re&&Re.includes(u.DEVIATION_BADGE_SEPARATOR)){var q=Re.split(u.DEVIATION_BADGE_SEPARATOR),z=q[0],W=q[1],Y=q[2],K=(q[3],"".concat(z).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),U=null===(g=Mn.current[K])||void 0===g?void 0:g.current,X=null===(f=Ln.current[K])||void 0===f?void 0:f.current;if(U&&X){var J,Q=U.getBoundingClientRect(),Z=X.getBoundingClientRect(),ee=Q.right-b.left,ne=Z.left-b.left,te=Q.top+Q.height/2-b.top,ie=Z.top+Z.height/2-b.top;if($){var oe=null!==(h=null===(p=Je.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(_=null===(x=We.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==_?_:0,le=oe+(null!==(R=null===(m=Je.current)||void 0===m?void 0:m.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=We.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)-b.top,ie=ce(Z.top+Z.height/2,re,ue)-b.top}(J=Et(Y))&&E.push({id:"line-subsec-".concat(K),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Re})}}if(mt(E),pt.current&&ht.current){var ae=pt.current.getBoundingClientRect(),se=ht.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-b.top+se.top+se.height/2-b.top)/2;St({x1:ae.right-b.left,x2:se.left-b.left,y:ve})}else St(null);if(be.size>0){var ge=[],fe=Je.current,pe=We.current;if(fe&&pe){var he=[],xe=fe.getBoundingClientRect().top,_e=pe.getBoundingClientRect().top,me=xe+fe.clientHeight,ye=_e+pe.clientHeight,Se=fe.scrollTop,Ae=pe.scrollTop,Ee=b.top,Ie=function(e,n,t){return Math.max(n,Math.min(t,e))};be.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var l=e.split(u.DEVIATION_BADGE_SEPARATOR),c=l[0],a=l[1],s=l[2],d=(l[3],"".concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(a)),v=null===(n=Mn.current[d])||void 0===n?void 0:n.current,g=null===(t=Ln.current[d])||void 0===t?void 0:t.current;if(!v||!g)return;var f=v.getBoundingClientRect(),p=g.getBoundingClientRect(),h=Et(s),x=(N=f.right-b.left)+.5*((P=p.left-b.left-0)-N),_=f.top+f.height/2,m=p.top+p.height/2,R=_-xe+Se,y=m-_e+Ae,S="conn-subsec-".concat(d);he.push({lhsScrollY:R,rhsScrollY:y,x1:N,x2:P,containerTop:Ee,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var A=Ie(_,xe,me),E=Ie(m,_e,ye),I=A-Ee,T=E-Ee,B=m>=_e-4&&m<=ye+4,C="";C=(F=_>=xe-4&&_<=me+4)&&B?u.getBentArrowPath(N,I,P,T):F&&!B?"M ".concat(N,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&B?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(P,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:C,style:h,leftIdx:e,rhsArrayIdx:e})}else if($){var D=e,O=In[D];if(!(null===(r=null==O?void 0:O.refIndexes)||void 0===r?void 0:r.length))return;O.refIndexes.forEach(function(e){var n,t,i=Tn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Mn.current[D])||void 0===n?void 0:n.current,r=null===(t=Ln.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=bt(D),s=l.right-b.left,d=c.left-b.left-0,v=s+.5*(d-s),g=l.top+l.height/2,f=c.top+c.height/2,p=g-xe+Se,h=f-_e+Ae,x="conn-".concat(D,"-").concat(i);he.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:Ee,leftIdx:D,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var _=Ie(g,xe,me),m=Ie(f,_e,ye),R=_-Ee,y=m-Ee,S=g>=xe-4&&g<=me+4,A=f>=_e-4&&f<=ye+4,E="";E=S&&A?u.getBentArrowPath(s,R,d,y):S&&!A?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!S&&A?"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),ge.push({id:x,pathD:E,style:a,leftIdx:D,rhsArrayIdx:i})}}})}else{var w=e,j=w;v=null===(i=Mn.current[w])||void 0===i?void 0:i.current,g=null===(o=Ln.current[j])||void 0===o?void 0:o.current;if(!v||!g)return;var N,P;f=v.getBoundingClientRect(),p=g.getBoundingClientRect(),h=bt(w),x=(N=f.right-b.left)+.5*((P=p.left-b.left-0)-N),_=f.top+f.height/2,m=p.top+p.height/2,R=_-xe+Se,y=m-_e+Ae,S="conn-".concat(w,"-").concat(j);he.push({lhsScrollY:R,rhsScrollY:y,x1:N,x2:P,containerTop:Ee,leftIdx:w,rhsArrayIdx:j,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var F;A=Ie(_,xe,me),E=Ie(m,_e,ye),I=A-Ee,T=E-Ee,B=m>=_e-4&&m<=ye+4,C="";C=(F=_>=xe-4&&_<=me+4)&&B?u.getBentArrowPath(N,I,P,T):F&&!B?"M ".concat(N,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&B?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(P,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:C,style:h,leftIdx:w,rhsArrayIdx:j})}}),je.current=he}Be(ge)}else Be([]),je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Qe.current=!1}}},[Bn,In,Tn,Me,hn,At,bt,$,de,Re,be,tt,it]),Tt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,g,f,p=je.current;if(p.length&&!De.current){var h=null!==(n=null===(e=Je.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=We.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,_=null!==(r=null===(o=Je.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=We.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=Je.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=We.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+_,A=y+m,b=null!==(f=null===(g=dt.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==f?f: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=we.current[e.styleId+"-stroke"],o=we.current[e.styleId+"-bg"];if(i||o){var r,l=E(n,R,S),c=E(t,y,A),a=l-b,s=c-b,d=n>=R-4&&n<=S+4,v=t>=y-4&&t<=A+4,g=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(g,",").concat(a," L ").concat(g,",").concat(s):!d&&v?"M ".concat(g,",").concat(a," L ").concat(g,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(g,",").concat(a," L ").concat(g,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);t.useEffect(function(){ke.current=It},[It]);var Bt=t.useRef(null),Ct=t.useRef(null),Dt=t.useCallback(function(){je.current.length>0&&!De.current||(null!==Bt.current&&clearTimeout(Bt.current),Bt.current=setTimeout(function(){ke.current(),Bt.current=null},50))},[]),Ot=t.useCallback(function(){_e(!0),pe(!1),null!==Ct.current&&clearTimeout(Ct.current),null!==Bt.current&&(clearTimeout(Bt.current),Bt.current=null),Ct.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s;if(je.current=[],Pe.current&&null!==Fe.current&&null!==gt.current){var d=Fe.current,v=gt.current,g=null,f=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]);g=(null===(e=Mn.current[_])||void 0===e?void 0:e.current)||null,f=(null===(n=Ln.current[_])||void 0===n?void 0:n.current)||null,p=(null===(t=Hn.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=Fn.current[Number(x[2])])||void 0===i?void 0:i.current)||null,h=(null===(o=Gn.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=kn.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else g=(null===(l=qn.current[d])||void 0===l?void 0:l.current)||null,p=(null===(c=Fn.current[d])||void 0===c?void 0:c.current)||null,f=(null===(a=Vn.current[v])||void 0===a?void 0:a.current)||null,h=(null===(s=kn.current[v])||void 0===s?void 0:s.current)||null;if(g&&f&&p&&h){if(p.style.paddingTop="0px",h.style.paddingTop="0px",!$){var m=g.getBoundingClientRect(),R=f.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=Je.current,A=We.current;if(S&&A){var b=g.getBoundingClientRect().top-S.getBoundingClientRect().top+S.scrollTop,E=f.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop-(b-S.scrollTop);Math.abs(A.scrollTop-E)>1&&(A.scrollTop=E)}}}ke.current(),Pe.current&&pe(!0),_e(!1),Ct.current=null},150)},[$,In,Tn]),wt=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==Ze.current&&$e.current&&Math.abs(e.currentTarget.scrollTop-Ze.current)<=2){var v=$e.current;Ze.current=null,$e.current=null,v()}if(!Se.current){if($||Dt(),Pe.current){var g=Fe.current,f=gt.current,p=Je.current,h=We.current;if(null!==g&&null!==f&&p&&h){var x="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=Mn.current["".concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===n?void 0:n.current:null===(t=qn.current[g])||void 0===t?void 0:t.current,_="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=Ln.current["".concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===i?void 0:i.current:null===(o=Vn.current[f])||void 0===o?void 0:o.current;if(x&&_&&ft.current){var m=void 0,R=void 0;if("string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)){var y=g.split(u.DEVIATION_BADGE_SEPARATOR),S="".concat(y[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(y[1]);m=null===(r=Mn.current[S])||void 0===r?void 0:r.current,R=null===(l=Ln.current[S])||void 0===l?void 0:l.current}else m=null===(c=Mn.current[g])||void 0===c?void 0:c.current,R=null===(a=Ln.current[f])||void 0===a?void 0:a.current;var A=null!==(d=null===(s=dt.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==d?d:0,b=p.getBoundingClientRect().top,E=b+p.clientHeight;h.getBoundingClientRect().top;h.clientHeight;if(m&&R){var I=m.getBoundingClientRect(),T=R.getBoundingClientRect(),B=I.top+I.height/2;T.top,T.height;var C=((O=B,w=b,j=E,Math.max(w,Math.min(j,O)))-A).toString();ft.current.setAttribute("y1",C),ft.current.setAttribute("y2",C);var D=B>=b-4&&B<=E+4;ft.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,j;je.current.length>0&&!Ne.current&&(Ne.current=!0,requestAnimationFrame(function(){Tt(),Ne.current=!1}))}},[Tt,$,Dt]);t.useEffect(function(){var e=setTimeout(Dt,250);window.addEventListener("resize",Ot);var n=null,t=null;return qe.current&&(n=new ResizeObserver(Dt)).observe(qe.current),dt.current&&(t=new ResizeObserver(Dt)).observe(dt.current),function(){clearTimeout(e),null!==Bt.current&&clearTimeout(Bt.current),null!==Ct.current&&clearTimeout(Ct.current),window.removeEventListener("resize",Ot),null==n||n.disconnect(),null==t||t.disconnect()}},[bn,En,Kn,Bn,tt,it,In,Tn,hn,Dt,Ot,de,Re,fe,be]),t.useEffect(function(){Pe.current=de},[de]),t.useEffect(function(){Fe.current=Re},[Re]);var jt=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";pn(),null!=e&&(n?ae("No counterpart exists for this section."):de&&Re===e?r?et():null==l||l():(Ee(new Set([e])),Be([]),je.current=[],le(!0),Se.current=!0,ye(e),Fe.current=e,ve(!0),Pe.current=!0,pe(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.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 g=e.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(g[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(g[1]);s=(null===(n=Mn.current[f])||void 0===n?void 0:n.current)||null,d=(null===(t=Ln.current[f])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=qn.current[e])||void 0===i?void 0:i.current)||null,$){var p=In[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],_=Tn.findIndex(function(e){return e.selfIndex===x});-1!==_&&(d=(null===(r=Vn.current[_])||void 0===r?void 0:r.current)||null,v=_)}}else d=(null===(o=Vn.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;gt.current=v;var m=Je.current,R=We.current,y=function(){!function(){var n,t,i,o,r,l,c,s,d,g,f,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=Hn.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=Fn.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=Gn.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=kn.current[Number(R[3])])||void 0===o?void 0:o.current)||null,_=(null===(r=Mn.current[y])||void 0===r?void 0:r.current)||h,m=(null===(l=Ln.current[y])||void 0===l?void 0:l.current)||x}else{var S=Number(e),A=null!==v?Number(v):S;h=(null===(c=Fn.current[S])||void 0===c?void 0:c.current)||null,x=(null===(s=kn.current[A])||void 0===s?void 0:s.current)||null,_=(null===(d=Mn.current[S])||void 0===d?void 0:d.current)||(null===(g=qn.current[S])||void 0===g?void 0:g.current)||h,m=(null===(f=Ln.current[A])||void 0===f?void 0:f.current)||(null===(p=Vn.current[A])||void 0===p?void 0:p.current)||x}if(_&&m&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var b=_.getBoundingClientRect(),E=m.getBoundingClientRect(),I=b.top-E.top;I>0?x.style.paddingTop="".concat(I,"px"):I<0&&(h.style.paddingTop="".concat(Math.abs(I),"px"))}}(),pe(!0),ke.current&&ke.current(),Se.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),le(!1),null==l||l()};if(!s||!m)return Se.current=!1,le(!1),void(null==l||l());if(d&&R){if(!$){var S=0;S="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var A=qe.current,b=(null==A?void 0:A.getBoundingClientRect().top)||0,E=A?A.scrollTop+S-b-150:0;return A?void u.smoothScrollTo(A,E,200,y):void y()}var I=s.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,T=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=T-(I-m.scrollTop);C<0&&Ye.current&&(Ye.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 Ke.current&&(Ke.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(R,C,B,y)})}e=C}u.smoothScrollTo(R,e,B,y)})}else{var D=I-(T-R.scrollTop);D<0&&Ue.current&&(Ue.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 Xe.current&&(Xe.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()})))},[Re,pn,Tn,de,$,In,et]),Nt=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;fn();var c="left";(null===(o=We.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=Ln.current[l])||void 0===e?void 0:e.current:null===(t=Mn.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=Ln.current[n])||void 0===i?void 0:i.current:null===(o=Mn.current[n])||void 0===o?void 0:o.current};if(t)return et(),Ee(new Set),Be([]),je.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;sn({open:!0,anchorEl:e,summary:i})}));jt(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;sn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[jt,fn,sn,et]),Pt=t.useCallback(function(){var e,n=on.sectionIdx,t=on.isOrphan;if(dn(),null!=n){var i="left";on.anchorEl&&(null===(e=We.current)||void 0===e?void 0:e.contains(on.anchorEl))&&(i="right"),jt(n,t,{sourceSide:i})}},[jt,on.isOrphan,on.sectionIdx,on.anchorEl,dn]),Ft=t.useCallback(function(){dn(),et(),Ee(new Set),Be([]),je.current=[]},[dn,et]),kt=null!==on.sectionIdx&&be.has(on.sectionIdx),Mt=_.useDeviationNavigation({proposedSections:In,existingSections:Tn,parentDeviationRecord:Cn,expandedSections:tt,maintainRelativeOrder:!!$,scrollContainerRef:qe,leftContainerRef:Je,lhsBadgeRefs:Mn,rhsBadgeRefs:Ln}),Lt=Mt.showDeviationNavigation,Vt=Mt.showOpenNodeRef,Ht=t.useMemo(function(){if(!Q)return null;for(var e in Cn){if((Cn[e]||[]).some(function(e){return e.id===Q}))return e}return null},[Q,Cn]),Gt=t.useRef(null),qt=t.useRef(null);t.useEffect(function(){if(Q&&Gt.current!==Q){qt.current!==Q&&(dn(),fn(),et(),Ee(new Set),Be([]),je.current=[],qt.current=Q);var n=!1,t=0,i=null,o=150,r=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},l=function(){var c,a,s,d;if(!n){var v=null,g=null;for(var f in Cn){var p=Cn[f].find(function(e){return e.id===Q});if(p){v=f,g=p;break}}if(g&&v){var h=In.findIndex(function(e){return e.id===v}),x=Tn.findIndex(function(e){return e.id===v}),_=-1===h&&-1!==x;if(_){if(!($?!!tt["right-".concat(x)]:!!tt[String(x)]))return rt(x,"right"),t+=1,void(i=setTimeout(l,450))}else if(!($?!!tt["left-".concat(h)]:!!tt[String(h)])&&h>=0)return rt(h,"left"),t+=1,void(i=setTimeout(l,450));var m=r(In,g.id),R=r(Tn,g.id);if(m&&!R&&!_){var y=m.split("-"),S=Number(y[0]);if($){var A=null===(a=null===(c=In[S])||void 0===c?void 0:c.refIndexes)||void 0===a?void 0:a[0],b=Tn.findIndex(function(e){return e.selfIndex===A});-1!==b&&(S=b)}R=e.__spreadArray([S],y.slice(1),!0).join("-")}if(m||R){var E,I=m||"",T=R||"",B="".concat(g.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0").concat(u.DEVIATION_BADGE_SEPARATOR).concat(I).concat(u.DEVIATION_BADGE_SEPARATOR).concat(T),C="".concat(g.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0"),D=null===(s=Mn.current[C])||void 0===s?void 0:s.current,O=null===(d=Ln.current[C])||void 0===d?void 0:d.current,w=_?O:D;if(E=$?_?We.current:Je.current:qe.current,w&&E){var j=w.getBoundingClientRect();if(0===j.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var N=E.getBoundingClientRect(),P=j.top-N.top+E.scrollTop-N.height/2+j.height/2,F=function(){var e,t,i,o,r;if(!n){Gt.current=Q;var l=window.getComputedStyle(w).color;D&&(D.style.transition="box-shadow 300ms ease-in-out",D.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(){D&&(D.style.boxShadow=""),O&&(O.style.boxShadow="")},2e3);var u=(null===(t=null===(e=g.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[0])||g,c=(null===(i=g.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||g.evaluation_outputs;if(D&&O&&!_)jt(B,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=Mn.current[C])||void 0===e?void 0:e.current)||D;sn({open:!0,anchorEl:n,summary:{deviation_summary:u.deviation_summary||u,evaluation_outputs:c}})}});else{var a=_?(null===(o=Ln.current[C])||void 0===o?void 0:o.current)||O:(null===(r=Mn.current[C])||void 0===r?void 0:r.current)||D;sn({open:!0,anchorEl:a,summary:{deviation_summary:u.deviation_summary||u,evaluation_outputs:c}})}}};Math.abs(E.scrollTop-P)<=2?F():(Ze.current=P,$e.current=F,E.scrollTo({top:P,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if($e.current){Ze.current=null;var e=$e.current;$e.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){n=!0,i&&clearTimeout(i)}}},[Q,Cn,In,Tn,$,tt,rt,jt,sn]);var zt=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:it,setExpandedSubSections:ot,maintainRelativeOrder:$||!1,proposedSections:In,existingSections:Tn,treeData:H,deviationNumberRegistry:Dn,connectedSections:be,activeSideBySideSection:Re,resolvedMarkdownStyles:Ge,getSubSectionRef:Wn,getSubSectionCompareStyle:Et,getBadgeRef:Yn,openMoreFunctionsPopup:ct,openSummaryPopup:Nt,resetSideBySide:et,setConnectedSections:Ee,setConnectedLines:Be,cachedConnectedPositions:je})};return n.jsxs(i.Box,e.__assign({ref:ze,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},$?{}:{overflow:"visible"}),{position:"relative"})},{children:[te&&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:vt.current,clipTopEl:pt.current,scrollContainerEl:qe.current,onClose:Ft,summary:an.summary}),n.jsx(d.default,{open:on.open,anchorEl:on.anchorEl,sectionTitle:on.sectionTitle,referenceSectionTitle:on.refSectionTitle,onClose:pn,onOpenCognitiveCompare:at,onOpenSideBySide:Pt,onConnect:st,isConnected:kt,isOrphan:on.isOrphan}),nn.open&&n.jsx(s.default,{open:nn.open,popupRef:gn,position:ln,popupConfig:U,onClose:function(){un(null),tn(function(n){return e.__assign(e.__assign({},n),{open:!1})}),vn(null)},markdownStyles:W,sectionTitle:nn.sectionTitle,referenceSectionTitle:nn.refSectionTitle,cognitiveData:nn.cognitiveData,anchorEl:nn.anchorEl,sectionAnchorEl:nn.sectionAnchorEl,scrollContainerEl:qe.current,badgeStyle:nn.badgeStyle,docData:nn.docData,deviationData:nn.deviationData,isLoading:nn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!ce,autoHideDuration:8e3,onClose:function(){return ae(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return ae(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ce}))})),n.jsx(m.default,{componentHeaderText:V,displayConfig:K,maintainRelativeOrder:$,onToggleView:function(e){ie(!0),setTimeout(function(){ee(!e),et(),dn(),Ee(new Set),Be([]),je.current=[],setTimeout(function(){ie(!1)},400)},50)}}),n.jsx(i.Box,e.__assign({ref:qe,onScroll:wt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:$?"hidden":"auto",borderTop:Un&&Xn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},$?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:dt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ce,style:{position:"absolute",top:0,left:0,width:Ve.width||"100%",height:Ve.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:xe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[yt&&n.jsx("g",{children:n.jsx("line",{x1:yt.x1,y1:yt.y,x2:yt.x2,y2:yt.y,stroke:$n.badgeBorder,strokeWidth:"1.5"})}),_t.map(function(t){var l,c,s,d,v,f,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?de&&Re===t.subSectionKeyPath&&fe:de&&Re===t.sectionIdx&&fe)return null;if(!$){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),_=In[t.sectionIdx]||{title:"",content:""},m=Tn[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,A=y.split("-").map(Number),b=S.split("-").map(Number),E=null,I=null;A.length>0&&(E=In[A[0]]),b.length>0&&(I=Tn[b[0]]);var T=(null==E?void 0:E.title)||"",B=(null==I?void 0:I.title)||"";console.log("Root Parent Titles:",T,B);for(var C=1;C<A.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[A[C]]);for(C=1;C<b.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[b[C]]);E&&(_=e.__assign(e.__assign({},E),{title:T||E.title})),console.log("Base Section for Subsection Badge:",_),I&&(m=e.__assign(e.__assign({},I),{title:B||I.title})),console.log("Ref Section for Subsection Badge:",m)}var D=!(null===(l=_.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(s=null===(c=_.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===s?void 0:s.length),O=(null===(f=null===(v=null===(d=_.evaluationResult)||void 0===d?void 0:d.cognitive_decisioning)||void 0===v?void 0:v.decisioning_factors)||void 0===f?void 0:f.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&&(nn.open&&cn===t.id?fn():(vn(t.id),ut(lt(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(g.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:nn.open&&cn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Te.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){we.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){we.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)"},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:pt,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:yn,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:yn}))}))})),n.jsxs(i.Box,e.__assign({ref:Je,onScroll:wt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{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:Ue,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&In.map(function(t,r){var l,c,a=!t.title&&!t.content;if($&&a)return null;var s=t,d=bt(r,"left"),v=$?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Tn[r],f=$?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=be.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:zn(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:Fn.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:zn("left-accordion-".concat(r)),mb:0,treeData:H,proposedSections:In,existingSections:Tn,deviationNumberRegistry:Dn,getSectionCompareStyle:bt,getBadgeRef:Yn,connectedSections:be,openMoreFunctionsPopup:ct,openSummaryPopup:Nt,deviationNodeIdToView:Q,deviationTargetParentId:Ht,parentNodeId:(null===(c=null==H?void 0:H.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:$?!!tt["left-".concat(r)]:!!tt[String(r)],onToggle:function(){Ft(),rt(r,"left")},navigation:t.id?Lt[t.id]:null,showOpenNodeRef:Vt,resolvedMarkdownStyles:Ge,maintainRelativeOrder:$,renderSubSections:zt})})),$&&d&&n.jsxs(i.Box,e.__assign({ref:Mn.current[r],onClick:function(e){var n=$?Tn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Tn[r]||{title:"",content:""};ct(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!==f&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:f})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!K.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(g.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:Xe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:vt,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(),nn.open&&cn===Jn?fn():(vn(Jn),ut(lt(n.currentTarget,{title:"",content:"",evaluationResult:Qn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Jn,!0,e.__assign(e.__assign({},$n),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:$n.badgeBg,color:$n.badgeText,border:"1px solid ".concat($n.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Zn?Zn:n.jsx(g.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:nn.open&&cn===Jn?"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},$?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[re&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:ht,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:Sn,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:Sn}))}))})),n.jsxs(i.Box,e.__assign({ref:We,onScroll:wt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{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:Ye,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&Tn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if($){u=In.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=In.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=In.findIndex(function(e,n){var t;return be.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=bt(d))}else u=[o+1],(c=be.has(o))&&(a=bt(o));var v=bt($&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:Vn.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:kn.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:zn("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==H?void 0:H.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:$?!!tt["right-".concat(o)]:!!tt[String(o)],treeData:H,proposedSections:In,existingSections:Tn,deviationNumberRegistry:Dn,getBadgeRef:Yn,getSectionCompareStyle:bt,connectedSections:be,openMoreFunctionsPopup:ct,openSummaryPopup:Nt,deviationNodeIdToView:Q,deviationTargetParentId:Ht,onToggle:function(){Ft(),rt(o,"right")},navigation:t.id?Lt[t.id]:null,showOpenNodeRef:Vt,resolvedMarkdownStyles:Ge,maintainRelativeOrder:$,renderSubSections:zt})})),$&&v&&n.jsx(i.Box,e.__assign({ref:Ln.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:Ke,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n}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 c,useCallback as u}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as p}from"@mui/material";import{ChevronDown as f,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,hasValue as R,getBentArrowPath as C,smoothScrollTo as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as w,DEFAULT_FIELD_CONFIG as B,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as E,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import _ from"./CognitivePopup.js";import M from"./MoreFunctionsPopup.js";import k from"./LoaderComponent.js";import D from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as A}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as L}from"./hooks/useSectionRefs.js";import{useAccordionState as P}from"./hooks/useAccordionState.js";import{useDeviationNavigation as N}from"./hooks/useDeviationNavigation.js";import O from"./components/CompareHeader.js";import j from"./components/SectionAccordion.js";import z from"./components/SubSectionAccordion.js";import W from"./components/CognitiveSummaryPopup.js";var Y=function(Y){var K,q,V,X,J,U,G,Q,Z,$,ee,ne,te,ie,oe,re=Y.componentHeaderText,le=void 0===re?F:re,ce=Y.treeData,ue=Y.comparisonConfig,de=Y.leftColumnTitleText,ae=Y.rightColumnTitleText,se=Y.markdownStyles,ve=Y.displayConfig,pe=void 0===ve?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:ve,fe=Y.popupConfig,ge=Y.deviationData,he=void 0===ge?{}:ge,xe=Y.deviationNodeIdToView,me=o(pe.maintainRelativeOrder),ye=me[0],be=me[1],Se=o(!1),Re=Se[0],Ce=Se[1],Ie=o(!1),we=Ie[0],Be=Ie[1],Te=o(null),Ee=Te[0],Fe=Te[1],_e=o(!1),Me=_e[0],ke=_e[1],De=o(!1),Ae=De[0],He=De[1],Le=o(!1),Pe=Le[0],Ne=Le[1],Oe=o(null),je=Oe[0],ze=Oe[1],We=r(!1),Ye=o(new Set),Ke=Ye[0],qe=Ye[1],Ve=o([]),Xe=Ve[0],Je=Ve[1],Ue=r(null),Ge=r(!1),Qe=r(null),Ze=r({}),$e=r([]),en=r(!1),nn=r(!1),tn=r(null),on=r(function(){}),rn=l(function(){return(null==ce?void 0:ce.cognitive_decisioning)||{}},[ce]),ln=o({width:0,height:0}),cn=ln[0],un=ln[1],dn=l(function(){return e(e({},w),se)},[se]),an=r(null),sn=r(null),vn=r(null),pn=r(null),fn=r(null),gn=r(null),hn=r(null),xn=r(null),mn=r(!1),yn=r(null),bn=r(null),Sn=H(an),Rn=Sn.cognitivePopup,Cn=Sn.setCognitivePopup,In=Sn.moreFunctions,wn=Sn.setMoreFunctions,Bn=Sn.position,Tn=Sn.setPosition,En=Sn.activeBadgeId,Fn=Sn.summaryPopup,_n=Sn.setSummaryPopup,Mn=Sn.closeSummaryPopup,kn=Sn.setActiveBadgeId,Dn=Sn.popupRef,An=Sn.closeCognitivePopup,Hn=Sn.closeMoreFunctionsPopup,Ln=l(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ue?void 0:ue.fields)&&void 0!==e?e:B,thresholds:{high:null!==(t=null===(n=null==ue?void 0:ue.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:T.thresholds.high,medium:null!==(o=null===(i=null==ue?void 0:ue.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:T.thresholds.medium,exact:null!==(l=null===(r=null==ue?void 0:ue.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:T.thresholds.exact}}},[ue]),Pn=o(null),Nn=Pn[0];Pn[1];var On=null===(V=null===(K=null==ce?void 0:ce.documents)||void 0===K?void 0:K[null===(q=null==ce?void 0:ce.input_index_map)||void 0===q?void 0:q[0]])||void 0===V?void 0:V.title,jn=null===(U=null===(X=null==ce?void 0:ce.documents)||void 0===X?void 0:X[null===(J=null==ce?void 0:ce.input_index_map)||void 0===J?void 0:J[1]])||void 0===U?void 0:U.title,zn=m(de||On||"Uploaded Contract"),Wn=m(ae||jn||"Reference Template"),Yn=A(ce,ye,he,Ln),Kn=Yn.activeProposed,qn=Yn.existingRule,Vn=Yn.proposedSections,Xn=Yn.existingSections,Jn=Yn.visibleFields,Un=Yn.parentDeviationRecord,Gn=Yn.deviationNumberRegistry,Qn=Yn.parseError;c(function(){Qn&&Fe("Failed to load comparison: ".concat(Qn))},[Qn]);var Zn=Vn.length>0||Xn.length>0,$n=L(Jn.map(function(e){return e.key}),Math.max(Vn.length,Xn.length)),et=$n.leftRefs,nt=$n.rightRefs,tt=$n.sectionLeftRefs,it=$n.sectionRightRefs,ot=$n.lhsBadgeRefs,rt=$n.rhsBadgeRefs,lt=$n.sectionRightRowRefs,ct=$n.subSectionLeftRefs,ut=$n.subSectionRightRefs,dt=$n.sectionRowRefs,at=$n.getSectionRowRef,st=$n.getSubSectionRef,vt=$n.getBadgeRef,pt=qn.analysis,ft=m(null===(Q=null===(G=null==pt?void 0:pt.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===Q?void 0:Q.overall_summary),gt=!!ft.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ht=null!==(Z=null==ce?void 0:ce.base_root_id)&&void 0!==Z?Z:"-1";null==ce||ce[ht];var xt=(null===($=null==he?void 0:he[ht])||void 0===$?void 0:$.evaluation_result)||(null===(ne=null===(ee=null==ce?void 0:ce.nodes)||void 0===ee?void 0:ee[ht])||void 0===ne?void 0:ne.evaluation_result)||null,mt=y(xt),yt=b(null!==(oe=null===(ie=null===(te=null==xt?void 0:xt.evaluation_outputs)||void 0===te?void 0:te.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==oe?oe:""),bt=u(function(){var e,n,t,i,o,r;ke(!1),nn.current=!1;var l=tn.current,c=Dt.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var u=l.split(S);(d=(null===(e=ct.current[u[2]])||void 0===e?void 0:e.current)||(null===(n=tt.current[Number(u[2])])||void 0===n?void 0:n.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=tt.current[l])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(S)){u=c.split(S);(a=(null===(i=ut.current[u[3]])||void 0===i?void 0:i.current)||(null===(o=it.current[Number(u[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=it.current[c])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}ze(null),tn.current=null,Dt.current=null,He(!1),Be(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px")},[]),St=P({maintainRelativeOrder:!!ye,proposedSections:Vn,existingSections:Xn,activeSideBySideSection:je,connectedSections:Ke,resetSideBySide:bt,setConnectedSections:qe,setConnectedLines:Je,cachedConnectedPositions:$e,svgContainerRef:Ue,isAnimatingRef:Ge,animationTimerRef:Qe,calculateLinesRef:on,sectionLeftRefs:tt,sectionRightRefs:it,subSectionLeftRefs:ct,subSectionRightRefs:ut}),Rt=St.expandedSections,Ct=St.expandedSubSections,It=St.setExpandedSubSections,wt=St.toggleSection,Bt=u(function(e,n,t,i,o,r,l){var c,u,d,a=m(null==n?void 0:n.id)||m(null==t?void 0:t.id)||"",s=(a?rn[a]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:a,decisioning:[],gap:[],relevance_score:0},v=null!==(u=null===(c=dt.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==pe?void 0:pe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:s,anchorEl:e,sectionAnchorEl:v,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==ce?void 0:ce.documents,input_index_map:null==ce?void 0:ce.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[rn,ce]),Tt=u(function(e){Hn(),Tn(null),Cn(e)},[Hn]),Et=function(e,n,t,i,o,r){e.stopPropagation(),In.open&&In.sectionIdx===o?Hn():(nn.current&&bt(),qe(new Set),Je([]),$e.current=[],An(),Fn.open?ti():Mn(),wn(Bt(e.currentTarget,n,i,o,t,r)))},Ft=u(function(){null!==In.sectionIdx&&In.anchorEl?Tt(e(e({},In),{open:!0})):Hn()},[In,Hn,Tt]),_t=u(function(){var e=In.sectionIdx,n=In.isOrphan;Hn(),Mn(),null!==e&&(n?Fe("No counterpart exists to connect to."):(nn.current&&bt(),Je([]),$e.current=[],qe(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){on.current&&on.current()},50)))},[In.sectionIdx,In.isOrphan,Hn,Mn,bt]),Mt=r(null),kt=r(null),Dt=r(null),At=r(null),Ht=r(null),Lt=r(null),Pt=o([]),Nt=Pt[0],Ot=Pt[1];r(null);var jt=o(null),zt=jt[0],Wt=jt[1];c(function(){if(Nn){var e=Ln.fields.find(function(e){return e.analysisKey===Nn||e.key===Nn});if(e){var n=et.current[e.key]||nt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Nn,Ln.fields]);var Yt=u(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==pt?void 0:pt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[e],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 p=s.mappings[0]||{};return{score:s.score,relation:p.relation||"",highlightsA:(null===(l=p.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=p.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(u=s.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[pt]),Kt=u(function(n,t){var i,o,r,l,c,u,d;void 0===t&&(t="left");var a=null,s=null;if("left"===t)if(a=Vn[n],ye&&a){var v=Xn.filter(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});s=v.find(function(e){return e.evaluationResult})||v[0]}else s=Xn[n];else if(s=Xn[n],ye&&s){var p=Vn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(s.selfIndex)});a=p.find(function(e){return e.evaluationResult})||p[0]}else a=Vn[n];var f=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,g=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,h=!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData));if(!f&&!g&&!h)return e(e({},b(E)),{label:"Not Defined"});var x=null!==(o=null!==(i=null==a?void 0:a.evaluationResult)&&void 0!==i?i:null==s?void 0:s.evaluationResult)&&void 0!==o?o:null,m=null===(r=null==x?void 0:x.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(u=null===(c=null===(l=null==x?void 0:x.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==u?u:E;return e(e({},b(y)),null!=x?{label:null!==(d=m)&&void 0!==d?d:""}:{label:null})},[Vn,Xn,rn,Ln,ye]),qt=u(function(n){for(var t,i,o,r,l,c,u,d,a,s=n.split("-").map(Number),v=Vn[s[0]],p=Xn[s[0]],f=1;f<s.length;f++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[f]]);if(!v&&!p)return null;var g=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,h=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,x=m(null==v?void 0:v.id)||m(null==p?void 0:p.id)||"",y=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!g&&!h&&!y)return e(e({},b(E)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=rn[x])||void 0===o||o.relevance_score);var S=null!==(l=null!==(r=null==v?void 0:v.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,R=null===(c=null==S?void 0:S.evaluation_outputs)||void 0===c?void 0:c.output_value,C=null!==(a=null===(d=null===(u=null==S?void 0:S.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:E;return e(e({},b(C)),null!=S?{label:null!=R?R:""}:{label:null})},[Vn,Xn,rn,Ln]),Vt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f,g,h,x,m,y,b,I;if(!mn.current&&!Ge.current){mn.current=!0;try{if(!Mt.current)return;var w=function(e){var n=e.split("-"),t=n[0];if(!Rt[t]&&!1===ye)return!1;if(ye&&!Rt["left-".concat(t)]&&!Rt["right-".concat(t)]&&!Rt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Ct[i])return!1;return!0},B=Mt.current.getBoundingClientRect();un({width:B.width,height:B.height});var T=[];if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.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(Vn.length,Xn.length);E++){var F=null===(e=tt.current[E])||void 0===e?void 0:e.current,_=null===(n=it.current[E])||void 0===n?void 0:n.current;F&&(F.style.height="auto",F.style.minHeight="0px"),_&&(_.style.height="auto",_.style.minHeight="0px")}ye||Object.keys(ct.current).forEach(function(e){var n,t;if(w(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.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 M={};Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();M[i]=Math.max(l.height,c.height)}});var k={left:{},right:{}},D={};if(!Ge.current)if(ye){if(Me&&null!==je)if("number"==typeof je){var A=je,H=Vn[A],L=null===(o=tt.current[A])||void 0===o?void 0:o.current;L&&H&&(H.refIndexes||[]).forEach(function(e){var n,t=Xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=it.current[t])||void 0===n?void 0:n.current;if(i&&(Rt["left-".concat(A)]||Rt["right-".concat(t)])){var o=Math.max(L.getBoundingClientRect().height,i.getBoundingClientRect().height);k.left[A]=Math.max(k.left[A]||0,o),k.right[t]=Math.max(k.right[t]||0,o)}})}else{var P=je.split(S)[2];if(P){F=null===(r=ct.current[P])||void 0===r?void 0:r.current,_=null===(l=ut.current[P])||void 0===l?void 0:l.current;if(F&&_){N=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);D[P]=Math.max(D[P]||0,N)}}}}else{Object.keys(ct.current).forEach(function(e){var n,t;if(w(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.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(),c=Math.max(r.height,l.height);D[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(E=0;E<Math.min(Vn.length,Xn.length);E++){var F=null===(t=tt.current[E])||void 0===t?void 0:t.current,_=null===(i=it.current[E])||void 0===i?void 0:i.current;if(F&&_){var N=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);k.left[E]=N,k.right[E]=N}}}if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.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(e){var n,t=e[0],i=e[1],o=null===(n=tt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(k.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=it.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ye||Object.keys(D).forEach(function(e){var n,t,i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(i&&o&&D[e]){var r=D[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),ye)Vn.forEach(function(e,n){var t;(null===(t=tt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,c,u,d,a,s,v=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=ot.current[n])||void 0===t?void 0:t.current,f=null===(i=rt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),x=g.right-B.left,m=h.left-B.left,y=g.top+g.height/2-B.top,b=h.top+h.height/2-B.top;if(Me&&je===n){var S=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=xn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=vn.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),w=g.top+g.height/2,E=h.top+h.height/2,F=function(e,n,t){return Math.max(n,Math.min(t,e))};y=F(w,S,C)-B.top,b=F(E,R,I)-B.top}var _=Kt(n);_&&T.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:_,sectionIdx:n,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(Vn.length,Xn.length);E++){var O=null===(c=tt.current[E])||void 0===c?void 0:c.current,j=null===(u=it.current[E])||void 0===u?void 0:u.current;if(O&&j){var z=O.getBoundingClientRect(),W=j.getBoundingClientRect(),Y=Math.max(z.top,W.top)+18-B.top,K=(null===(d=Xn[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=Kt(E))&&T.push({id:K,x1:z.right-B.left,y1:Y,x2:W.left-B.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=Vn[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=Xn[E])||void 0===s?void 0:s.cognitiveData)||K&&rn[K]),isSubSection:!1})}}Object.keys(ct.current).forEach(function(e){var n,t,i,o,r,l;if(w(e)){var c=null===(n=ct.current[e])||void 0===n?void 0:n.current,u=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Vn[d[0]],s=Xn[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 p=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&R(a.title)),f=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&R(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&R(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&R(s.content));if(p&&f||g&&h){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-B.top,b=qt(e);b&&"Not Defined"!==b.label&&T.push({id:"subsec-".concat(e),x1:x.right-B.left,y1:y,x2:m.left-B.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(Me&&"string"==typeof je&&je.includes(S)){var q=je.split(S),V=q[0],X=q[1],J=q[2],U=(q[3],"".concat(V).concat(S).concat(X)),G=null===(v=ot.current[U])||void 0===v?void 0:v.current,Q=null===(p=rt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,$=G.getBoundingClientRect(),ee=Q.getBoundingClientRect(),ne=$.right-B.left,te=ee.left-B.left,ie=$.top+$.height/2-B.top,oe=ee.top+ee.height/2-B.top;if(ye){var re=null!==(g=null===(f=xn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,le=null!==(x=null===(h=vn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=xn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(I=null===(b=vn.current)||void 0===b?void 0:b.clientHeight)&&void 0!==I?I:1/0),de=function(e,n,t){return Math.max(n,Math.min(t,e))};ie=de($.top+$.height/2,re,ce)-B.top,oe=de(ee.top+ee.height/2,le,ue)-B.top}(Z=qt(J))&&T.push({id:"line-subsec-".concat(U),x1:ne,y1:ie,x2:te,y2:oe,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:je})}}if(Ot(T),Ht.current&&Lt.current){var ae=Ht.current.getBoundingClientRect(),se=Lt.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Wt({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Wt(null);if(Ke.size>0){var pe=[],fe=xn.current,ge=vn.current;if(fe&&ge){var he=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,be=xe+fe.clientHeight,Se=me+ge.clientHeight,Re=fe.scrollTop,Ce=ge.scrollTop,Ie=B.top,we=function(e,n,t){return Math.max(n,Math.min(t,e))};Ke.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(S)){var l=e.split(S),c=l[0],u=l[1],d=l[2],a=(l[3],"".concat(c).concat(S).concat(u)),s=null===(n=ot.current[a])||void 0===n?void 0:n.current,v=null===(t=rt.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=qt(d),h=(H=p.right-B.left)+.5*((L=f.left-B.left-0)-H),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-subsec-".concat(a);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:L,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var I=we(x,xe,be),w=we(m,me,Se),T=I-Ie,E=w-Ie,F=m>=me-4&&m<=Se+4,_="";_=(P=x>=xe-4&&x<=be+4)&&F?C(H,T,L,E):P&&!F?"M ".concat(H,",").concat(T," L ").concat(h,",").concat(T," L ").concat(h,",").concat(E):!P&&F?"M ".concat(h,",").concat(T," L ").concat(h,",").concat(E," L ").concat(L,",").concat(E):"M ".concat(h,",").concat(T," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:e,rhsArrayIdx:e})}else if(ye){var M=e,k=Vn[M];if(!(null===(r=null==k?void 0:k.refIndexes)||void 0===r?void 0:r.length))return;k.refIndexes.forEach(function(e){var n,t,i=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=ot.current[M])||void 0===n?void 0:n.current,r=null===(t=rt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=Kt(M),d=l.right-B.left,a=c.left-B.left-0,s=d+.5*(a-d),v=l.top+l.height/2,p=c.top+c.height/2,f=v-xe+Re,g=p-me+Ce,h="conn-".concat(M,"-").concat(i);he.push({lhsScrollY:f,rhsScrollY:g,x1:d,x2:a,containerTop:Ie,leftIdx:M,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:h});var x=we(v,xe,be),m=we(p,me,Se),y=x-Ie,b=m-Ie,S=v>=xe-4&&v<=be+4,R=p>=me-4&&p<=Se+4,I="";I=S&&R?C(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),pe.push({id:h,pathD:I,style:u,leftIdx:M,rhsArrayIdx:i})}}})}else{var D=e,A=D;s=null===(i=ot.current[D])||void 0===i?void 0:i.current,v=null===(o=rt.current[A])||void 0===o?void 0:o.current;if(!s||!v)return;var H,L;p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Kt(D),h=(H=p.right-B.left)+.5*((L=f.left-B.left-0)-H),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-".concat(D,"-").concat(A);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:L,containerTop:Ie,leftIdx:D,rhsArrayIdx:A,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var P;I=we(x,xe,be),w=we(m,me,Se),T=I-Ie,E=w-Ie,F=m>=me-4&&m<=Se+4,_="";_=(P=x>=xe-4&&x<=be+4)&&F?C(H,T,L,E):P&&!F?"M ".concat(H,",").concat(T," L ").concat(h,",").concat(T," L ").concat(h,",").concat(E):!P&&F?"M ".concat(h,",").concat(T," L ").concat(h,",").concat(E," L ").concat(L,",").concat(E):"M ".concat(h,",").concat(T," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:D,rhsArrayIdx:A})}}),$e.current=he}Je(pe)}else Je([]),$e.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{mn.current=!1}}},[Jn,Vn,Xn,rn,Ln,Yt,Kt,ye,Me,je,Ke,Rt,Ct]),Xt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f=$e.current;if(f.length&&!Ge.current){var g=null!==(n=null===(e=xn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=vn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=xn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=vn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,I=null!==(p=null===(v=Mt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,w=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-g+y,t=e.rhsScrollY-h+b,i=Ze.current[e.styleId+"-stroke"],o=Ze.current[e.styleId+"-bg"];if(i||o){var r,l=w(n,y,S),c=w(t,b,R),u=l-I,d=c-I,a=n>=y-4&&n<=S+4,s=t>=b-4&&t<=R+4,v=e.x1+.5*(e.x2-e.x1);r=a&&s?C(e.x1,u,e.x2,d):a&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d," L ").concat(e.x2,",").concat(d):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){on.current=Vt},[Vt]);var Jt=r(null),Ut=r(null),Gt=u(function(){$e.current.length>0&&!Ge.current||(null!==Jt.current&&clearTimeout(Jt.current),Jt.current=setTimeout(function(){on.current(),Jt.current=null},50))},[]),Qt=u(function(){Ne(!0),He(!1),null!==Ut.current&&clearTimeout(Ut.current),null!==Jt.current&&(clearTimeout(Jt.current),Jt.current=null),Ut.current=setTimeout(function(){var e,n,t,i,o,r,l,c,u,d;if($e.current=[],nn.current&&null!==tn.current&&null!==Dt.current){var a=tn.current,s=Dt.current,v=null,p=null,f=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===(e=ot.current[x])||void 0===e?void 0:e.current)||null,p=(null===(n=rt.current[x])||void 0===n?void 0:n.current)||null,f=(null===(t=ct.current[h[2]])||void 0===t?void 0:t.current)||(null===(i=tt.current[Number(h[2])])||void 0===i?void 0:i.current)||null,g=(null===(o=ut.current[h[3]])||void 0===o?void 0:o.current)||(null===(r=it.current[Number(h[3])])||void 0===r?void 0:r.current)||null}else v=(null===(l=dt.current[a])||void 0===l?void 0:l.current)||null,f=(null===(c=tt.current[a])||void 0===c?void 0:c.current)||null,p=(null===(u=lt.current[s])||void 0===u?void 0:u.current)||null,g=(null===(d=it.current[s])||void 0===d?void 0:d.current)||null;if(v&&p&&f&&g){if(f.style.paddingTop="0px",g.style.paddingTop="0px",!ye){var m=v.getBoundingClientRect(),y=p.getBoundingClientRect(),b=m.top-y.top;b>0?g.style.paddingTop="".concat(b,"px"):b<0&&(f.style.paddingTop="".concat(Math.abs(b),"px"))}var R=xn.current,C=vn.current;if(R&&C){var I=v.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,w=p.getBoundingClientRect().top-C.getBoundingClientRect().top+C.scrollTop-(I-R.scrollTop);Math.abs(C.scrollTop-w)>1&&(C.scrollTop=w)}}}on.current(),nn.current&&He(!0),Ne(!1),Ut.current=null},150)},[ye,Vn,Xn]),Zt=u(function(e){var n,t,i,o,r,l,c,u,d,a;if(null!==yn.current&&bn.current&&Math.abs(e.currentTarget.scrollTop-yn.current)<=2){var s=bn.current;yn.current=null,bn.current=null,s()}if(!We.current){if(ye||Gt(),nn.current){var v=tn.current,p=Dt.current,f=xn.current,g=vn.current;if(null!==v&&null!==p&&f&&g){var h="string"==typeof v&&v.includes(S)?null===(n=ot.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===n?void 0:n.current:null===(t=dt.current[v])||void 0===t?void 0:t.current,x="string"==typeof p&&p.includes(S)?null===(i=rt.current["".concat(p.split(S)[0]).concat(S).concat(p.split(S)[1])])||void 0===i?void 0:i.current:null===(o=lt.current[p])||void 0===o?void 0:o.current;if(h&&x&&At.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=ot.current[R])||void 0===r?void 0:r.current,y=null===(l=rt.current[R])||void 0===l?void 0:l.current}else m=null===(c=ot.current[v])||void 0===c?void 0:c.current,y=null===(u=rt.current[p])||void 0===u?void 0:u.current;var C=null!==(a=null===(d=Mt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,I=f.getBoundingClientRect().top,w=I+f.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var B=m.getBoundingClientRect(),T=y.getBoundingClientRect(),E=B.top+B.height/2;T.top,T.height;var F=((M=E,k=I,D=w,Math.max(k,Math.min(D,M)))-C).toString();At.current.setAttribute("y1",F),At.current.setAttribute("y2",F);var _=E>=I-4&&E<=w+4;At.current.setAttribute("visibility",_?"visible":"hidden")}}}}var M,k,D;$e.current.length>0&&!en.current&&(en.current=!0,requestAnimationFrame(function(){Xt(),en.current=!1}))}},[Xt,ye,Gt]);c(function(){var e=setTimeout(Gt,250);window.addEventListener("resize",Qt);var n=null,t=null;return an.current&&(n=new ResizeObserver(Gt)).observe(an.current),Mt.current&&(t=new ResizeObserver(Gt)).observe(Mt.current),function(){clearTimeout(e),null!==Jt.current&&clearTimeout(Jt.current),null!==Ut.current&&clearTimeout(Ut.current),window.removeEventListener("resize",Qt),null==n||n.disconnect(),null==t||t.disconnect()}},[Kn,qn,pt,Jn,Rt,Ct,Vn,Xn,Ln,Gt,Qt,Me,je,Ae,Ke]),c(function(){nn.current=Me},[Me]),c(function(){tn.current=je},[je]);var $t=u(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";Hn(),null!=e&&(n?Fe("No counterpart exists for this section."):Me&&je===e?r?bt():null==l||l():(qe(new Set([e])),Je([]),$e.current=[],Be(!0),We.current=!0,ze(e),tn.current=e,ke(!0),nn.current=!0,He(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,u=null,d=null,a=null;if("string"==typeof e&&e.includes(S)){var s=e.split(S),v="".concat(s[0]).concat(S).concat(s[1]);u=(null===(n=ot.current[v])||void 0===n?void 0:n.current)||null,a=(d=(null===(t=rt.current[v])||void 0===t?void 0:t.current)||null)?e:null}else if(u=(null===(i=dt.current[e])||void 0===i?void 0:i.current)||null,ye){var p=Vn[e],f=(null==p?void 0:p.refIndexes)||[];if(f.length>0){var g=f[0],h=Xn.findIndex(function(e){return e.selfIndex===g});-1!==h&&(d=(null===(r=lt.current[h])||void 0===r?void 0:r.current)||null,a=h)}}else a=(d=(null===(o=lt.current[e])||void 0===o?void 0:o.current)||null)?e:null;Dt.current=a;var x=xn.current,m=vn.current,y=function(){"right"===c&&m?m.dispatchEvent(new Event("scroll")):x&&x.dispatchEvent(new Event("scroll"))};if(!u||!x)return We.current=!1,Be(!1),void(null==l||l());if(!d||!m)return He(!0),on.current(),We.current=!1,Be(!1),void(null==l||l());if(!ye){var b=0;b="right"===c?d?d.getBoundingClientRect().top:0:u?u.getBoundingClientRect().top:0;var R=an.current,C=(null==R?void 0:R.getBoundingClientRect().top)||0,w=R?R.scrollTop+b-C-150:0;return R?void I(R,w,200,function(){He(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()}):(He(!0),on.current(),We.current=!1,Be(!1),void(null==l||l()))}var B=u.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop,T=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,E=200;if("left"===c){var F=T-(B-x.scrollTop);F<0&&pn.current&&(pn.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(F<0)e=0;else{if(F>n){var t=F-n;return fn.current&&(fn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,F,E,function(){He(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()})})}e=F}I(m,e,E,function(){He(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()})})}else{var _=B-(T-m.scrollTop);_<0&&gn.current&&(gn.current.style.height="".concat(Math.abs(_),"px")),requestAnimationFrame(function(){var e,n=x.scrollHeight-x.clientHeight;if(_<0)e=0;else{if(_>n){var t=_-n;return hn.current&&(hn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(x,_,E,function(){He(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()})})}e=_}I(x,e,E,function(){He(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()})})}})))},[je,Hn,Xn,Me,ye,Vn,bt]),ei=u(function(e,n,t,i){var o,r="string"==typeof i?m(i).trim():m(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;An();var c="left";(null===(o=vn.current)||void 0===o?void 0:o.contains(l))&&(c="right");var u=function(){var e,t,i,o;if("string"==typeof n&&n.includes(S)){var r=n.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(e=rt.current[l])||void 0===e?void 0:e.current:null===(t=ot.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=rt.current[n])||void 0===i?void 0:i.current:null===(o=ot.current[n])||void 0===o?void 0:o.current};if(t)return bt(),qe(new Set),Je([]),$e.current=[],void(r&&requestAnimationFrame(function(){var e=u()||l;_n({open:!0,anchorEl:e,summary:i})}));$t(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=u()||l;_n({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[$t,An,_n,bt]),ni=u(function(){var e,n=In.sectionIdx,t=In.isOrphan;if(Mn(),null!=n){var i="left";In.anchorEl&&(null===(e=vn.current)||void 0===e?void 0:e.contains(In.anchorEl))&&(i="right"),$t(n,t,{sourceSide:i})}},[$t,In.isOrphan,In.sectionIdx,In.anchorEl,Mn]),ti=u(function(){Mn(),bt(),qe(new Set),Je([]),$e.current=[]},[Mn,bt]),ii=null!==In.sectionIdx&&Ke.has(In.sectionIdx),oi=N({proposedSections:Vn,existingSections:Xn,parentDeviationRecord:Un,expandedSections:Rt,maintainRelativeOrder:!!ye,scrollContainerRef:an,leftContainerRef:xn,lhsBadgeRefs:ot,rhsBadgeRefs:rt}),ri=oi.showDeviationNavigation,li=oi.showOpenNodeRef,ci=l(function(){if(!xe)return null;for(var e in Un){if((Un[e]||[]).some(function(e){return e.id===xe}))return e}return null},[xe,Un]),ui=r(null),di=r(null);c(function(){if(xe&&ui.current!==xe){di.current!==xe&&(Mn(),An(),bt(),qe(new Set),Je([]),$e.current=[],di.current=xe);var e=!1,t=0,i=null,o=150,r=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},l=function(){var c,u,d,a;if(!e){var s=null,v=null;for(var p in Un){var f=Un[p].find(function(e){return e.id===xe});if(f){s=p,v=f;break}}if(v&&s){var g=Vn.findIndex(function(e){return e.id===s}),h=Xn.findIndex(function(e){return e.id===s}),x=-1===g&&-1!==h;if(x){if(!(ye?!!Rt["right-".concat(h)]:!!Rt[String(h)]))return wt(h,"right"),t+=1,void(i=setTimeout(l,450))}else if(!(ye?!!Rt["left-".concat(g)]:!!Rt[String(g)])&&g>=0)return wt(g,"left"),t+=1,void(i=setTimeout(l,450));var m=r(Vn,v.id),y=r(Xn,v.id);if(m&&!y&&!x){var b=m.split("-"),R=Number(b[0]);if(ye){var C=null===(u=null===(c=Vn[R])||void 0===c?void 0:c.refIndexes)||void 0===u?void 0:u[0],I=Xn.findIndex(function(e){return e.selfIndex===C});-1!==I&&(R=I)}y=n([R],b.slice(1),!0).join("-")}if(m||y){var w,B=m||"",T=y||"",E="".concat(v.id).concat(S,"0").concat(S).concat(B).concat(S).concat(T),F="".concat(v.id).concat(S,"0"),_=null===(d=ot.current[F])||void 0===d?void 0:d.current,M=null===(a=rt.current[F])||void 0===a?void 0:a.current,k=x?M:_;if(w=ye?x?vn.current:xn.current:an.current,k&&w){var D=k.getBoundingClientRect();if(0===D.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var A=w.getBoundingClientRect(),H=D.top-A.top+w.scrollTop-A.height/2+D.height/2,L=function(){var n,t,i,o,r;if(!e){ui.current=xe;var l=window.getComputedStyle(k).color;_&&(_.style.transition="box-shadow 300ms ease-in-out",_.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(){_&&(_.style.boxShadow=""),M&&(M.style.boxShadow="")},2e3);var c=(null===(t=null===(n=v.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[0])||v,u=(null===(i=v.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||v.evaluation_outputs;if(_&&M&&!x)$t(E,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=ot.current[F])||void 0===e?void 0:e.current)||_;_n({open:!0,anchorEl:n,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}})}});else{var d=x?(null===(o=rt.current[F])||void 0===o?void 0:o.current)||M:(null===(r=ot.current[F])||void 0===r?void 0:r.current)||_;_n({open:!0,anchorEl:d,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}})}}};Math.abs(w.scrollTop-H)<=2?L():(yn.current=H,bn.current=L,w.scrollTo({top:H,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(bn.current){yn.current=null;var e=bn.current;bn.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){e=!0,i&&clearTimeout(i)}}},[xe,Un,Vn,Xn,ye,Rt,wt,$t,_n]);var ai=function(e){var n=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,c=void 0===l?"left":l,u=e.parentNodeId;return i(z,{section:n,keyPath:t,depth:r,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:Ct,setExpandedSubSections:It,maintainRelativeOrder:ye||!1,proposedSections:Vn,existingSections:Xn,treeData:ce,deviationNumberRegistry:Gn,connectedSections:Ke,activeSideBySideSection:je,resolvedMarkdownStyles:dn,getSubSectionRef:st,getSubSectionCompareStyle:qt,getBadgeRef:vt,openMoreFunctionsPopup:Et,openSummaryPopup:ei,resetSideBySide:bt,setConnectedSections:qe,setConnectedLines:Je,cachedConnectedPositions:$e})};return t(d,e({ref:sn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ye?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&i(d,e({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(k,{})})),Fn.open&&i(W,{open:Fn.open,anchorEl:Fn.anchorEl,containerEl:kt.current,clipTopEl:Ht.current,scrollContainerEl:an.current,onClose:ti,summary:Fn.summary}),i(M,{open:In.open,anchorEl:In.anchorEl,sectionTitle:In.sectionTitle,referenceSectionTitle:In.refSectionTitle,onClose:Hn,onOpenCognitiveCompare:Ft,onOpenSideBySide:ni,onConnect:_t,isConnected:ii,isOrphan:In.isOrphan}),Rn.open&&i(_,{open:Rn.open,popupRef:Dn,position:Bn,popupConfig:fe,onClose:function(){Tn(null),Cn(function(n){return e(e({},n),{open:!1})}),kn(null)},markdownStyles:se,sectionTitle:Rn.sectionTitle,referenceSectionTitle:Rn.refSectionTitle,cognitiveData:Rn.cognitiveData,anchorEl:Rn.anchorEl,sectionAnchorEl:Rn.sectionAnchorEl,scrollContainerEl:an.current,badgeStyle:Rn.badgeStyle,docData:Rn.docData,deviationData:Rn.deviationData,isLoading:Rn.isLoading}),i(a,e({open:!!Ee,autoHideDuration:8e3,onClose:function(){return Fe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,e({onClose:function(){return Fe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ee}))})),i(O,{componentHeaderText:le,displayConfig:pe,maintainRelativeOrder:ye,onToggleView:function(e){Ce(!0),setTimeout(function(){be(!e),bt(),Mn(),qe(new Set),Je([]),$e.current=[],setTimeout(function(){Ce(!1)},400)},50)}}),i(d,e({ref:an,onScroll:Zt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ye?"hidden":"auto",borderTop:ft&>?"none":"1.5px solid #EEF0F4"}},{children:i(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ye?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Mt,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ye?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ue,style:{position:"absolute",top:0,left:0,width:cn.width||"100%",height:cn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Pe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[zt&&i("g",{children:i("line",{x1:zt.x1,y1:zt.y,x2:zt.x2,y2:zt.y,stroke:yt.badgeBorder,strokeWidth:"1.5"})}),Nt.map(function(n){var o,r,l,c,u,a,s=n.x1+.5*(n.x2-n.x1),v=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;if(n.isSubSection?Me&&je===n.subSectionKeyPath&&Ae:Me&&je===n.sectionIdx&&Ae)return null;if(!ye){var p=n.isSubSection?C(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2),g=Vn[n.sectionIdx]||{title:"",content:""},x=Xn[n.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,x),n.isSubSection&&n.subSectionKeyPath){var m=n.subSectionKeyPath.includes(S)?n.subSectionKeyPath.split(S):[],y=m[2]||n.subSectionKeyPath,b=m[3]||y,R=y.split("-").map(Number),I=b.split("-").map(Number),w=null,B=null;R.length>0&&(w=Vn[R[0]]),I.length>0&&(B=Xn[I[0]]);var T=(null==w?void 0:w.title)||"",F=(null==B?void 0:B.title)||"";console.log("Root Parent Titles:",T,F);for(var _=1;_<R.length;_++)(null==w?void 0:w.subsections)&&(w=w.subsections[R[_]]);for(_=1;_<I.length;_++)(null==B?void 0:B.subsections)&&(B=B.subsections[I[_]]);w&&(g=e(e({},w),{title:T||w.title})),console.log("Base Section for Subsection Badge:",g),B&&(x=e(e({},B),{title:F||B.title})),console.log("Ref Section for Subsection Badge:",x)}var M=!(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),k=(null===(a=null===(u=null===(c=g.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===u?void 0:u.decisioning_factors)||void 0===a?void 0:a.length)||!1,A=M||k;return t("g",{children:[i("path",{d:p,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,e({onClick:function(e){e.stopPropagation(),A&&(Rn.open&&En===n.id?An():(kn(n.id),Tt(Bt(e.currentTarget,g,x,n.sectionIdx,n.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:A?"pointer":"default"}},{children:[n.style.badgeText===E&&null==n.style.label?i(D,{color:n.style.badgeText}):0===n.style.label?"Same":n.style.label,i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),A&&i(f,{size:11,style:{transform:Rn.open&&En===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),Xe.map(function(n){var o,r=n.pathD,l=(null===(o=n.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),d="".concat(n.id,"-stroke");return t("g",{children:[i("defs",{children:i("clipPath",e({id:"connections-clip"},{children:i("marker",e({id:c,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(e){Ze.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){Ze.current[d]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),t(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},ye?{flex:1,overflow:"visible"}:{})},{children:[i(d,e({ref:Ht,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,e({title:zn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:zn}))}))})),t(d,e({ref:xn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{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:gn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Vn.map(function(n,o){var r,l,c=!n.title&&!n.content;if(ye&&c)return null;var u=n,a=Kt(o,"left"),s=ye?!(null===(r=u.refIndexes)||void 0===r?void 0:r.length)||u.selfIndex<0:!Xn[o],v=ye?"number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null:o+1,p=Ke.has(o),f=y(u.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,e({ref:at(o),sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:tt.current[o],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"left",colRef:at("left-accordion-".concat(o)),mb:0,treeData:ce,proposedSections:Vn,existingSections:Xn,deviationNumberRegistry:Gn,getSectionCompareStyle:Kt,getBadgeRef:vt,connectedSections:Ke,openMoreFunctionsPopup:Et,openSummaryPopup:ei,deviationNodeIdToView:xe,deviationTargetParentId:ci,parentNodeId:(null===(l=null==ce?void 0:ce.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:ye?!!Rt["left-".concat(o)]:!!Rt[String(o)],onToggle:function(){ti(),wt(o,"left")},navigation:n.id?ri[n.id]:null,showOpenNodeRef:li,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:ai})})),ye&&a&&t(d,e({ref:ot.current[o],onClick:function(e){var t=ye?Xn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Xn[o]||{title:"",content:""};Et(e,n,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,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!pe.isLoading||null!=u.evaluationResult&&null!=u.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):i(D,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,e({ref:kt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,e({onClick:function(n){n.stopPropagation(),Rn.open&&En===ht?An():(kn(ht),Tt(Bt(n.currentTarget,{title:"",content:"",evaluationResult:xt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,ht,!0,e(e({},yt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:yt.badgeBg,color:yt.badgeText,border:"1px solid ".concat(yt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=mt?mt:i(D,{}),i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(f,{size:11,style:{transform:Rn.open&&En===ht?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},ye?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[we&&i(x,{sections:11}),i(d,e({ref:Lt,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,e({title:Wn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Wn}))}))})),t(d,e({ref:vn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{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:pn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Xn.map(function(n,o){var r,l=n,c=[],u=!1,a=null,s=-1;if(ye){c=Vn.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=Vn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var v=Vn.findIndex(function(e,n){var t;return Ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(u=-1!==v)&&(a=Kt(v))}else c=[o+1],(u=Ke.has(o))&&(a=Kt(o));var p=Kt(ye&&-1!==s?s:o);return i(d,e({ref:lt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:it.current[o],sx:e({width:"100%",display:"flex"},u&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"right",colRef:at("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==ce?void 0:ce.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:ye?!!Rt["right-".concat(o)]:!!Rt[String(o)],treeData:ce,proposedSections:Vn,existingSections:Xn,deviationNumberRegistry:Gn,getBadgeRef:vt,getSectionCompareStyle:Kt,connectedSections:Ke,openMoreFunctionsPopup:Et,openSummaryPopup:ei,deviationNodeIdToView:xe,deviationTargetParentId:ci,onToggle:function(){ti(),wt(o,"right")},navigation:n.id?ri[n.id]:null,showOpenNodeRef:li,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:ai})})),ye&&p&&i(d,e({ref:rt.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:p.badgeBg,color:p.badgeText,border:"1px solid ".concat(p.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{Y as default};
|
|
1
|
+
import{__assign as e,__spreadArray as n}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 c,useCallback as u}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as p}from"@mui/material";import{ChevronDown as f,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,hasValue as R,getBentArrowPath as C,smoothScrollTo as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as T,DEFAULT_FIELD_CONFIG as B,DEFAULT_COMPARISON_CONFIG as w}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as E,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import _ from"./CognitivePopup.js";import M from"./MoreFunctionsPopup.js";import k from"./LoaderComponent.js";import D from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as A}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as N}from"./hooks/useSectionRefs.js";import{useAccordionState as L}from"./hooks/useAccordionState.js";import{useDeviationNavigation as P}from"./hooks/useDeviationNavigation.js";import O from"./components/CompareHeader.js";import j from"./components/SectionAccordion.js";import z from"./components/SubSectionAccordion.js";import W from"./components/CognitiveSummaryPopup.js";var Y=function(Y){var K,q,V,X,J,U,G,Q,Z,$,ee,ne,te,ie,oe,re=Y.componentHeaderText,le=void 0===re?F:re,ce=Y.treeData,ue=Y.comparisonConfig,de=Y.leftColumnTitleText,ae=Y.rightColumnTitleText,se=Y.markdownStyles,ve=Y.displayConfig,pe=void 0===ve?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:ve,fe=Y.popupConfig,ge=Y.deviationData,he=void 0===ge?{}:ge,xe=Y.deviationNodeIdToView,me=o(pe.maintainRelativeOrder),ye=me[0],be=me[1],Se=o(!1),Re=Se[0],Ce=Se[1],Ie=o(!1),Te=Ie[0],Be=Ie[1],we=o(null),Ee=we[0],Fe=we[1],_e=o(!1),Me=_e[0],ke=_e[1],De=o(!1),Ae=De[0],He=De[1],Ne=o(!1),Le=Ne[0],Pe=Ne[1],Oe=o(null),je=Oe[0],ze=Oe[1],We=r(!1),Ye=o(new Set),Ke=Ye[0],qe=Ye[1],Ve=o([]),Xe=Ve[0],Je=Ve[1],Ue=r(null),Ge=r(!1),Qe=r(null),Ze=r({}),$e=r([]),en=r(!1),nn=r(!1),tn=r(null),on=r(function(){}),rn=l(function(){return(null==ce?void 0:ce.cognitive_decisioning)||{}},[ce]),ln=o({width:0,height:0}),cn=ln[0],un=ln[1],dn=l(function(){return e(e({},T),se)},[se]),an=r(null),sn=r(null),vn=r(null),pn=r(null),fn=r(null),gn=r(null),hn=r(null),xn=r(null),mn=r(!1),yn=r(null),bn=r(null),Sn=H(an),Rn=Sn.cognitivePopup,Cn=Sn.setCognitivePopup,In=Sn.moreFunctions,Tn=Sn.setMoreFunctions,Bn=Sn.position,wn=Sn.setPosition,En=Sn.activeBadgeId,Fn=Sn.summaryPopup,_n=Sn.setSummaryPopup,Mn=Sn.closeSummaryPopup,kn=Sn.setActiveBadgeId,Dn=Sn.popupRef,An=Sn.closeCognitivePopup,Hn=Sn.closeMoreFunctionsPopup,Nn=l(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ue?void 0:ue.fields)&&void 0!==e?e:B,thresholds:{high:null!==(t=null===(n=null==ue?void 0:ue.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:w.thresholds.high,medium:null!==(o=null===(i=null==ue?void 0:ue.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:w.thresholds.medium,exact:null!==(l=null===(r=null==ue?void 0:ue.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:w.thresholds.exact}}},[ue]),Ln=o(null),Pn=Ln[0];Ln[1];var On=null===(V=null===(K=null==ce?void 0:ce.documents)||void 0===K?void 0:K[null===(q=null==ce?void 0:ce.input_index_map)||void 0===q?void 0:q[0]])||void 0===V?void 0:V.title,jn=null===(U=null===(X=null==ce?void 0:ce.documents)||void 0===X?void 0:X[null===(J=null==ce?void 0:ce.input_index_map)||void 0===J?void 0:J[1]])||void 0===U?void 0:U.title,zn=m(de||On||"Uploaded Contract"),Wn=m(ae||jn||"Reference Template"),Yn=A(ce,ye,he,Nn),Kn=Yn.activeProposed,qn=Yn.existingRule,Vn=Yn.proposedSections,Xn=Yn.existingSections,Jn=Yn.visibleFields,Un=Yn.parentDeviationRecord,Gn=Yn.deviationNumberRegistry,Qn=Yn.parseError;c(function(){Qn&&Fe("Failed to load comparison: ".concat(Qn))},[Qn]);var Zn=Vn.length>0||Xn.length>0,$n=N(Jn.map(function(e){return e.key}),Math.max(Vn.length,Xn.length)),et=$n.leftRefs,nt=$n.rightRefs,tt=$n.sectionLeftRefs,it=$n.sectionRightRefs,ot=$n.lhsBadgeRefs,rt=$n.rhsBadgeRefs,lt=$n.sectionRightRowRefs,ct=$n.subSectionLeftRefs,ut=$n.subSectionRightRefs,dt=$n.sectionRowRefs,at=$n.getSectionRowRef,st=$n.getSubSectionRef,vt=$n.getBadgeRef,pt=qn.analysis,ft=m(null===(Q=null===(G=null==pt?void 0:pt.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===Q?void 0:Q.overall_summary),gt=!!ft.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ht=null!==(Z=null==ce?void 0:ce.base_root_id)&&void 0!==Z?Z:"-1";null==ce||ce[ht];var xt=(null===($=null==he?void 0:he[ht])||void 0===$?void 0:$.evaluation_result)||(null===(ne=null===(ee=null==ce?void 0:ce.nodes)||void 0===ee?void 0:ee[ht])||void 0===ne?void 0:ne.evaluation_result)||null,mt=y(xt),yt=b(null!==(oe=null===(ie=null===(te=null==xt?void 0:xt.evaluation_outputs)||void 0===te?void 0:te.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==oe?oe:""),bt=u(function(){var e,n,t,i,o,r;ke(!1),nn.current=!1;var l=tn.current,c=Dt.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var u=l.split(S);(d=(null===(e=ct.current[u[2]])||void 0===e?void 0:e.current)||(null===(n=tt.current[Number(u[2])])||void 0===n?void 0:n.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=tt.current[l])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(S)){u=c.split(S);(a=(null===(i=ut.current[u[3]])||void 0===i?void 0:i.current)||(null===(o=it.current[Number(u[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=it.current[c])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}ze(null),tn.current=null,Dt.current=null,He(!1),Be(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px")},[]),St=L({maintainRelativeOrder:!!ye,proposedSections:Vn,existingSections:Xn,activeSideBySideSection:je,connectedSections:Ke,resetSideBySide:bt,setConnectedSections:qe,setConnectedLines:Je,cachedConnectedPositions:$e,svgContainerRef:Ue,isAnimatingRef:Ge,animationTimerRef:Qe,calculateLinesRef:on,sectionLeftRefs:tt,sectionRightRefs:it,subSectionLeftRefs:ct,subSectionRightRefs:ut}),Rt=St.expandedSections,Ct=St.expandedSubSections,It=St.setExpandedSubSections,Tt=St.toggleSection,Bt=u(function(e,n,t,i,o,r,l){var c,u,d,a=m(null==n?void 0:n.id)||m(null==t?void 0:t.id)||"",s=(a?rn[a]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:a,decisioning:[],gap:[],relevance_score:0},v=null!==(u=null===(c=dt.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==pe?void 0:pe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:s,anchorEl:e,sectionAnchorEl:v,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==ce?void 0:ce.documents,input_index_map:null==ce?void 0:ce.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[rn,ce]),wt=u(function(e){Hn(),wn(null),Cn(e)},[Hn]),Et=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),In.open&&In.sectionIdx===o)Hn();else{var c=e.currentTarget,u="left";(null===(l=vn.current)||void 0===l?void 0:l.contains(c))&&(u="right");nn.current&&bt(),qe(new Set),Je([]),$e.current=[],An(),Fn.open?ti():Mn(),requestAnimationFrame(function(){var e=function(){var e,n,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"===u?null===(e=rt.current[l])||void 0===e?void 0:e.current:null===(n=ot.current[l])||void 0===n?void 0:n.current}return"right"===u?null===(t=rt.current[o])||void 0===t?void 0:t.current:null===(i=ot.current[o])||void 0===i?void 0:i.current}()||c;Tn(Bt(e,n,i,o,t,r))})}},Ft=u(function(){null!==In.sectionIdx&&In.anchorEl?wt(e(e({},In),{open:!0})):Hn()},[In,Hn,wt]),_t=u(function(){var e=In.sectionIdx,n=In.isOrphan;Hn(),Mn(),null!==e&&(n?Fe("No counterpart exists to connect to."):(nn.current&&bt(),Je([]),$e.current=[],qe(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){on.current&&on.current()},50)))},[In.sectionIdx,In.isOrphan,Hn,Mn,bt]),Mt=r(null),kt=r(null),Dt=r(null),At=r(null),Ht=r(null),Nt=r(null),Lt=o([]),Pt=Lt[0],Ot=Lt[1];r(null);var jt=o(null),zt=jt[0],Wt=jt[1];c(function(){if(Pn){var e=Nn.fields.find(function(e){return e.analysisKey===Pn||e.key===Pn});if(e){var n=et.current[e.key]||nt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Pn,Nn.fields]);var Yt=u(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==pt?void 0:pt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[e],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 p=s.mappings[0]||{};return{score:s.score,relation:p.relation||"",highlightsA:(null===(l=p.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=p.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(u=s.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[pt]),Kt=u(function(n,t){var i,o,r,l,c,u,d;void 0===t&&(t="left");var a=null,s=null;if("left"===t)if(a=Vn[n],ye&&a){var v=Xn.filter(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});s=v.find(function(e){return e.evaluationResult})||v[0]}else s=Xn[n];else if(s=Xn[n],ye&&s){var p=Vn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(s.selfIndex)});a=p.find(function(e){return e.evaluationResult})||p[0]}else a=Vn[n];var f=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,g=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,h=!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData));if(!f&&!g&&!h)return e(e({},b(E)),{label:"Not Defined"});var x=null!==(o=null!==(i=null==a?void 0:a.evaluationResult)&&void 0!==i?i:null==s?void 0:s.evaluationResult)&&void 0!==o?o:null,m=null===(r=null==x?void 0:x.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(u=null===(c=null===(l=null==x?void 0:x.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==u?u:E;return e(e({},b(y)),null!=x?{label:null!==(d=m)&&void 0!==d?d:""}:{label:null})},[Vn,Xn,rn,Nn,ye]),qt=u(function(n){for(var t,i,o,r,l,c,u,d,a,s=n.split("-").map(Number),v=Vn[s[0]],p=Xn[s[0]],f=1;f<s.length;f++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[f]]);if(!v&&!p)return null;var g=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,h=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,x=m(null==v?void 0:v.id)||m(null==p?void 0:p.id)||"",y=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!g&&!h&&!y)return e(e({},b(E)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=rn[x])||void 0===o||o.relevance_score);var S=null!==(l=null!==(r=null==v?void 0:v.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,R=null===(c=null==S?void 0:S.evaluation_outputs)||void 0===c?void 0:c.output_value,C=null!==(a=null===(d=null===(u=null==S?void 0:S.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:E;return e(e({},b(C)),null!=S?{label:null!=R?R:""}:{label:null})},[Vn,Xn,rn,Nn]),Vt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f,g,h,x,m,y,b,I;if(!mn.current&&!Ge.current){mn.current=!0;try{if(!Mt.current)return;var T=function(e){var n=e.split("-"),t=n[0];if(!Rt[t]&&!1===ye)return!1;if(ye&&!Rt["left-".concat(t)]&&!Rt["right-".concat(t)]&&!Rt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Ct[i])return!1;return!0},B=Mt.current.getBoundingClientRect();un({width:B.width,height:B.height});var w=[];if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.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(Vn.length,Xn.length);E++){var F=null===(e=tt.current[E])||void 0===e?void 0:e.current,_=null===(n=it.current[E])||void 0===n?void 0:n.current;F&&(F.style.height="auto",F.style.minHeight="0px"),_&&(_.style.height="auto",_.style.minHeight="0px")}ye||Object.keys(ct.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.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 M={};Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();M[i]=Math.max(l.height,c.height)}});var k={left:{},right:{}},D={};if(!Ge.current)if(ye){if(Me&&null!==je)if("number"==typeof je){var A=je,H=Vn[A],N=null===(o=tt.current[A])||void 0===o?void 0:o.current;N&&H&&(H.refIndexes||[]).forEach(function(e){var n,t=Xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=it.current[t])||void 0===n?void 0:n.current;if(i&&(Rt["left-".concat(A)]||Rt["right-".concat(t)])){var o=Math.max(N.getBoundingClientRect().height,i.getBoundingClientRect().height);k.left[A]=Math.max(k.left[A]||0,o),k.right[t]=Math.max(k.right[t]||0,o)}})}else{var L=je.split(S)[2];if(L){F=null===(r=ct.current[L])||void 0===r?void 0:r.current,_=null===(l=ut.current[L])||void 0===l?void 0:l.current;if(F&&_){P=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);D[L]=Math.max(D[L]||0,P)}}}}else{Object.keys(ct.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.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(),c=Math.max(r.height,l.height);D[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(E=0;E<Math.min(Vn.length,Xn.length);E++){var F=null===(t=tt.current[E])||void 0===t?void 0:t.current,_=null===(i=it.current[E])||void 0===i?void 0:i.current;if(F&&_){var P=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);k.left[E]=P,k.right[E]=P}}}if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.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(e){var n,t=e[0],i=e[1],o=null===(n=tt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(k.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=it.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ye||Object.keys(D).forEach(function(e){var n,t,i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(i&&o&&D[e]){var r=D[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),ye)Vn.forEach(function(e,n){var t;(null===(t=tt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,c,u,d,a,s,v=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=ot.current[n])||void 0===t?void 0:t.current,f=null===(i=rt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),x=g.right-B.left,m=h.left-B.left,y=g.top+g.height/2-B.top,b=h.top+h.height/2-B.top;if(Me&&je===n){var S=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=xn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=vn.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),T=g.top+g.height/2,E=h.top+h.height/2,F=function(e,n,t){return Math.max(n,Math.min(t,e))};y=F(T,S,C)-B.top,b=F(E,R,I)-B.top}var _=Kt(n);_&&w.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:_,sectionIdx:n,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(Vn.length,Xn.length);E++){var O=null===(c=tt.current[E])||void 0===c?void 0:c.current,j=null===(u=it.current[E])||void 0===u?void 0:u.current;if(O&&j){var z=O.getBoundingClientRect(),W=j.getBoundingClientRect(),Y=Math.max(z.top,W.top)+18-B.top,K=(null===(d=Xn[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=Kt(E))&&w.push({id:K,x1:z.right-B.left,y1:Y,x2:W.left-B.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=Vn[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=Xn[E])||void 0===s?void 0:s.cognitiveData)||K&&rn[K]),isSubSection:!1})}}Object.keys(ct.current).forEach(function(e){var n,t,i,o,r,l;if(T(e)){var c=null===(n=ct.current[e])||void 0===n?void 0:n.current,u=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Vn[d[0]],s=Xn[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 p=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&R(a.title)),f=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&R(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&R(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&R(s.content));if(p&&f||g&&h){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-B.top,b=qt(e);b&&"Not Defined"!==b.label&&w.push({id:"subsec-".concat(e),x1:x.right-B.left,y1:y,x2:m.left-B.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(Me&&"string"==typeof je&&je.includes(S)){var q=je.split(S),V=q[0],X=q[1],J=q[2],U=(q[3],"".concat(V).concat(S).concat(X)),G=null===(v=ot.current[U])||void 0===v?void 0:v.current,Q=null===(p=rt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,$=G.getBoundingClientRect(),ee=Q.getBoundingClientRect(),ne=$.right-B.left,te=ee.left-B.left,ie=$.top+$.height/2-B.top,oe=ee.top+ee.height/2-B.top;if(ye){var re=null!==(g=null===(f=xn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,le=null!==(x=null===(h=vn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=xn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(I=null===(b=vn.current)||void 0===b?void 0:b.clientHeight)&&void 0!==I?I:1/0),de=function(e,n,t){return Math.max(n,Math.min(t,e))};ie=de($.top+$.height/2,re,ce)-B.top,oe=de(ee.top+ee.height/2,le,ue)-B.top}(Z=qt(J))&&w.push({id:"line-subsec-".concat(U),x1:ne,y1:ie,x2:te,y2:oe,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:je})}}if(Ot(w),Ht.current&&Nt.current){var ae=Ht.current.getBoundingClientRect(),se=Nt.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Wt({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Wt(null);if(Ke.size>0){var pe=[],fe=xn.current,ge=vn.current;if(fe&&ge){var he=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,be=xe+fe.clientHeight,Se=me+ge.clientHeight,Re=fe.scrollTop,Ce=ge.scrollTop,Ie=B.top,Te=function(e,n,t){return Math.max(n,Math.min(t,e))};Ke.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(S)){var l=e.split(S),c=l[0],u=l[1],d=l[2],a=(l[3],"".concat(c).concat(S).concat(u)),s=null===(n=ot.current[a])||void 0===n?void 0:n.current,v=null===(t=rt.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=qt(d),h=(H=p.right-B.left)+.5*((N=f.left-B.left-0)-H),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-subsec-".concat(a);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:N,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var I=Te(x,xe,be),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,_="";_=(L=x>=xe-4&&x<=be+4)&&F?C(H,w,N,E):L&&!F?"M ".concat(H,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!L&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(N,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:e,rhsArrayIdx:e})}else if(ye){var M=e,k=Vn[M];if(!(null===(r=null==k?void 0:k.refIndexes)||void 0===r?void 0:r.length))return;k.refIndexes.forEach(function(e){var n,t,i=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=ot.current[M])||void 0===n?void 0:n.current,r=null===(t=rt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=Kt(M),d=l.right-B.left,a=c.left-B.left-0,s=d+.5*(a-d),v=l.top+l.height/2,p=c.top+c.height/2,f=v-xe+Re,g=p-me+Ce,h="conn-".concat(M,"-").concat(i);he.push({lhsScrollY:f,rhsScrollY:g,x1:d,x2:a,containerTop:Ie,leftIdx:M,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:h});var x=Te(v,xe,be),m=Te(p,me,Se),y=x-Ie,b=m-Ie,S=v>=xe-4&&v<=be+4,R=p>=me-4&&p<=Se+4,I="";I=S&&R?C(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),pe.push({id:h,pathD:I,style:u,leftIdx:M,rhsArrayIdx:i})}}})}else{var D=e,A=D;s=null===(i=ot.current[D])||void 0===i?void 0:i.current,v=null===(o=rt.current[A])||void 0===o?void 0:o.current;if(!s||!v)return;var H,N;p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Kt(D),h=(H=p.right-B.left)+.5*((N=f.left-B.left-0)-H),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-".concat(D,"-").concat(A);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:N,containerTop:Ie,leftIdx:D,rhsArrayIdx:A,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var L;I=Te(x,xe,be),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,_="";_=(L=x>=xe-4&&x<=be+4)&&F?C(H,w,N,E):L&&!F?"M ".concat(H,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!L&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(N,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:D,rhsArrayIdx:A})}}),$e.current=he}Je(pe)}else Je([]),$e.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{mn.current=!1}}},[Jn,Vn,Xn,rn,Nn,Yt,Kt,ye,Me,je,Ke,Rt,Ct]),Xt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f=$e.current;if(f.length&&!Ge.current){var g=null!==(n=null===(e=xn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=vn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=xn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=vn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,I=null!==(p=null===(v=Mt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,T=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-g+y,t=e.rhsScrollY-h+b,i=Ze.current[e.styleId+"-stroke"],o=Ze.current[e.styleId+"-bg"];if(i||o){var r,l=T(n,y,S),c=T(t,b,R),u=l-I,d=c-I,a=n>=y-4&&n<=S+4,s=t>=b-4&&t<=R+4,v=e.x1+.5*(e.x2-e.x1);r=a&&s?C(e.x1,u,e.x2,d):a&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d," L ").concat(e.x2,",").concat(d):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){on.current=Vt},[Vt]);var Jt=r(null),Ut=r(null),Gt=u(function(){$e.current.length>0&&!Ge.current||(null!==Jt.current&&clearTimeout(Jt.current),Jt.current=setTimeout(function(){on.current(),Jt.current=null},50))},[]),Qt=u(function(){Pe(!0),He(!1),null!==Ut.current&&clearTimeout(Ut.current),null!==Jt.current&&(clearTimeout(Jt.current),Jt.current=null),Ut.current=setTimeout(function(){var e,n,t,i,o,r,l,c,u,d;if($e.current=[],nn.current&&null!==tn.current&&null!==Dt.current){var a=tn.current,s=Dt.current,v=null,p=null,f=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===(e=ot.current[x])||void 0===e?void 0:e.current)||null,p=(null===(n=rt.current[x])||void 0===n?void 0:n.current)||null,f=(null===(t=ct.current[h[2]])||void 0===t?void 0:t.current)||(null===(i=tt.current[Number(h[2])])||void 0===i?void 0:i.current)||null,g=(null===(o=ut.current[h[3]])||void 0===o?void 0:o.current)||(null===(r=it.current[Number(h[3])])||void 0===r?void 0:r.current)||null}else v=(null===(l=dt.current[a])||void 0===l?void 0:l.current)||null,f=(null===(c=tt.current[a])||void 0===c?void 0:c.current)||null,p=(null===(u=lt.current[s])||void 0===u?void 0:u.current)||null,g=(null===(d=it.current[s])||void 0===d?void 0:d.current)||null;if(v&&p&&f&&g){if(f.style.paddingTop="0px",g.style.paddingTop="0px",!ye){var m=v.getBoundingClientRect(),y=p.getBoundingClientRect(),b=m.top-y.top;b>0?g.style.paddingTop="".concat(b,"px"):b<0&&(f.style.paddingTop="".concat(Math.abs(b),"px"))}var R=xn.current,C=vn.current;if(R&&C){var I=v.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,T=p.getBoundingClientRect().top-C.getBoundingClientRect().top+C.scrollTop-(I-R.scrollTop);Math.abs(C.scrollTop-T)>1&&(C.scrollTop=T)}}}on.current(),nn.current&&He(!0),Pe(!1),Ut.current=null},150)},[ye,Vn,Xn]),Zt=u(function(e){var n,t,i,o,r,l,c,u,d,a;if(null!==yn.current&&bn.current&&Math.abs(e.currentTarget.scrollTop-yn.current)<=2){var s=bn.current;yn.current=null,bn.current=null,s()}if(!We.current){if(ye||Gt(),nn.current){var v=tn.current,p=Dt.current,f=xn.current,g=vn.current;if(null!==v&&null!==p&&f&&g){var h="string"==typeof v&&v.includes(S)?null===(n=ot.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===n?void 0:n.current:null===(t=dt.current[v])||void 0===t?void 0:t.current,x="string"==typeof p&&p.includes(S)?null===(i=rt.current["".concat(p.split(S)[0]).concat(S).concat(p.split(S)[1])])||void 0===i?void 0:i.current:null===(o=lt.current[p])||void 0===o?void 0:o.current;if(h&&x&&At.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=ot.current[R])||void 0===r?void 0:r.current,y=null===(l=rt.current[R])||void 0===l?void 0:l.current}else m=null===(c=ot.current[v])||void 0===c?void 0:c.current,y=null===(u=rt.current[p])||void 0===u?void 0:u.current;var C=null!==(a=null===(d=Mt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,I=f.getBoundingClientRect().top,T=I+f.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var B=m.getBoundingClientRect(),w=y.getBoundingClientRect(),E=B.top+B.height/2;w.top,w.height;var F=((M=E,k=I,D=T,Math.max(k,Math.min(D,M)))-C).toString();At.current.setAttribute("y1",F),At.current.setAttribute("y2",F);var _=E>=I-4&&E<=T+4;At.current.setAttribute("visibility",_?"visible":"hidden")}}}}var M,k,D;$e.current.length>0&&!en.current&&(en.current=!0,requestAnimationFrame(function(){Xt(),en.current=!1}))}},[Xt,ye,Gt]);c(function(){var e=setTimeout(Gt,250);window.addEventListener("resize",Qt);var n=null,t=null;return an.current&&(n=new ResizeObserver(Gt)).observe(an.current),Mt.current&&(t=new ResizeObserver(Gt)).observe(Mt.current),function(){clearTimeout(e),null!==Jt.current&&clearTimeout(Jt.current),null!==Ut.current&&clearTimeout(Ut.current),window.removeEventListener("resize",Qt),null==n||n.disconnect(),null==t||t.disconnect()}},[Kn,qn,pt,Jn,Rt,Ct,Vn,Xn,Nn,Gt,Qt,Me,je,Ae,Ke]),c(function(){nn.current=Me},[Me]),c(function(){tn.current=je},[je]);var $t=u(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";Hn(),null!=e&&(n?Fe("No counterpart exists for this section."):Me&&je===e?r?bt():null==l||l():(qe(new Set([e])),Je([]),$e.current=[],Be(!0),We.current=!0,ze(e),tn.current=e,ke(!0),nn.current=!0,He(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,u="string"==typeof e&&e.includes(S),d=null,a=null,s=null;if(u){var v=e.split(S),p="".concat(v[0]).concat(S).concat(v[1]);d=(null===(n=ot.current[p])||void 0===n?void 0:n.current)||null,a=(null===(t=rt.current[p])||void 0===t?void 0:t.current)||null,s=a?e:null}else if(d=(null===(i=dt.current[e])||void 0===i?void 0:i.current)||null,ye){var f=Vn[e],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],x=Xn.findIndex(function(e){return e.selfIndex===h});-1!==x&&(a=(null===(r=lt.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else a=(null===(o=lt.current[e])||void 0===o?void 0:o.current)||null,s=a?e:null;Dt.current=s;var m=xn.current,y=vn.current,b=function(){!function(){var n,t,i,o,r,l,c,d,a,v,p,f,g=null,h=null,x=null,m=null;if(u){var y=e.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(n=ct.current[y[2]])||void 0===n?void 0:n.current)||(null===(t=tt.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=ut.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=it.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=ot.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=rt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(e),C=null!==s?Number(s):R;g=(null===(c=tt.current[R])||void 0===c?void 0:c.current)||null,h=(null===(d=it.current[C])||void 0===d?void 0:d.current)||null,x=(null===(a=ot.current[R])||void 0===a?void 0:a.current)||(null===(v=dt.current[R])||void 0===v?void 0:v.current)||g,m=(null===(p=rt.current[C])||void 0===p?void 0:p.current)||(null===(f=lt.current[C])||void 0===f?void 0:f.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=x.getBoundingClientRect(),T=m.getBoundingClientRect(),B=I.top-T.top;B>0?h.style.paddingTop="".concat(B,"px"):B<0&&(g.style.paddingTop="".concat(Math.abs(B),"px"))}}(),He(!0),on.current&&on.current(),We.current=!1,"right"===c&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Be(!1),null==l||l()};if(!d||!m)return We.current=!1,Be(!1),void(null==l||l());if(a&&y){if(!ye){var R=0;R="right"===c?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=an.current,T=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+R-T-150:0;return C?void I(C,B,200,b):void b()}var w=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,E=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,F=200;if("left"===c){var _=E-(w-m.scrollTop);_<0&&pn.current&&(pn.current.style.height="".concat(Math.abs(_),"px")),requestAnimationFrame(function(){var e,n=y.scrollHeight-y.clientHeight;if(_<0)e=0;else{if(_>n){var t=_-n;return fn.current&&(fn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(y,_,F,b)})}e=_}I(y,e,F,b)})}else{var M=w-(E-y.scrollTop);M<0&&gn.current&&(gn.current.style.height="".concat(Math.abs(M),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(M<0)e=0;else{if(M>n){var t=M-n;return hn.current&&(hn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,M,F,b)})}e=M}I(m,e,F,b)})}}else b()})))},[je,Hn,Xn,Me,ye,Vn,bt]),ei=u(function(e,n,t,i){var o,r="string"==typeof i?m(i).trim():m(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;An();var c="left";(null===(o=vn.current)||void 0===o?void 0:o.contains(l))&&(c="right");var u=function(){var e,t,i,o;if("string"==typeof n&&n.includes(S)){var r=n.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(e=rt.current[l])||void 0===e?void 0:e.current:null===(t=ot.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=rt.current[n])||void 0===i?void 0:i.current:null===(o=ot.current[n])||void 0===o?void 0:o.current};if(t)return bt(),qe(new Set),Je([]),$e.current=[],void(r&&requestAnimationFrame(function(){var e=u()||l;_n({open:!0,anchorEl:e,summary:i})}));$t(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=u()||l;_n({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[$t,An,_n,bt]),ni=u(function(){var e,n=In.sectionIdx,t=In.isOrphan;if(Mn(),null!=n){var i="left";In.anchorEl&&(null===(e=vn.current)||void 0===e?void 0:e.contains(In.anchorEl))&&(i="right"),$t(n,t,{sourceSide:i})}},[$t,In.isOrphan,In.sectionIdx,In.anchorEl,Mn]),ti=u(function(){Mn(),bt(),qe(new Set),Je([]),$e.current=[]},[Mn,bt]),ii=null!==In.sectionIdx&&Ke.has(In.sectionIdx),oi=P({proposedSections:Vn,existingSections:Xn,parentDeviationRecord:Un,expandedSections:Rt,maintainRelativeOrder:!!ye,scrollContainerRef:an,leftContainerRef:xn,lhsBadgeRefs:ot,rhsBadgeRefs:rt}),ri=oi.showDeviationNavigation,li=oi.showOpenNodeRef,ci=l(function(){if(!xe)return null;for(var e in Un){if((Un[e]||[]).some(function(e){return e.id===xe}))return e}return null},[xe,Un]),ui=r(null),di=r(null);c(function(){if(xe&&ui.current!==xe){di.current!==xe&&(Mn(),An(),bt(),qe(new Set),Je([]),$e.current=[],di.current=xe);var e=!1,t=0,i=null,o=150,r=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},l=function(){var c,u,d,a;if(!e){var s=null,v=null;for(var p in Un){var f=Un[p].find(function(e){return e.id===xe});if(f){s=p,v=f;break}}if(v&&s){var g=Vn.findIndex(function(e){return e.id===s}),h=Xn.findIndex(function(e){return e.id===s}),x=-1===g&&-1!==h;if(x){if(!(ye?!!Rt["right-".concat(h)]:!!Rt[String(h)]))return Tt(h,"right"),t+=1,void(i=setTimeout(l,450))}else if(!(ye?!!Rt["left-".concat(g)]:!!Rt[String(g)])&&g>=0)return Tt(g,"left"),t+=1,void(i=setTimeout(l,450));var m=r(Vn,v.id),y=r(Xn,v.id);if(m&&!y&&!x){var b=m.split("-"),R=Number(b[0]);if(ye){var C=null===(u=null===(c=Vn[R])||void 0===c?void 0:c.refIndexes)||void 0===u?void 0:u[0],I=Xn.findIndex(function(e){return e.selfIndex===C});-1!==I&&(R=I)}y=n([R],b.slice(1),!0).join("-")}if(m||y){var T,B=m||"",w=y||"",E="".concat(v.id).concat(S,"0").concat(S).concat(B).concat(S).concat(w),F="".concat(v.id).concat(S,"0"),_=null===(d=ot.current[F])||void 0===d?void 0:d.current,M=null===(a=rt.current[F])||void 0===a?void 0:a.current,k=x?M:_;if(T=ye?x?vn.current:xn.current:an.current,k&&T){var D=k.getBoundingClientRect();if(0===D.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var A=T.getBoundingClientRect(),H=D.top-A.top+T.scrollTop-A.height/2+D.height/2,N=function(){var n,t,i,o,r;if(!e){ui.current=xe;var l=window.getComputedStyle(k).color;_&&(_.style.transition="box-shadow 300ms ease-in-out",_.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(){_&&(_.style.boxShadow=""),M&&(M.style.boxShadow="")},2e3);var c=(null===(t=null===(n=v.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[0])||v,u=(null===(i=v.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||v.evaluation_outputs;if(_&&M&&!x)$t(E,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=ot.current[F])||void 0===e?void 0:e.current)||_;_n({open:!0,anchorEl:n,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}})}});else{var d=x?(null===(o=rt.current[F])||void 0===o?void 0:o.current)||M:(null===(r=ot.current[F])||void 0===r?void 0:r.current)||_;_n({open:!0,anchorEl:d,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}})}}};Math.abs(T.scrollTop-H)<=2?N():(yn.current=H,bn.current=N,T.scrollTo({top:H,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(bn.current){yn.current=null;var e=bn.current;bn.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){e=!0,i&&clearTimeout(i)}}},[xe,Un,Vn,Xn,ye,Rt,Tt,$t,_n]);var ai=function(e){var n=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,c=void 0===l?"left":l,u=e.parentNodeId;return i(z,{section:n,keyPath:t,depth:r,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:Ct,setExpandedSubSections:It,maintainRelativeOrder:ye||!1,proposedSections:Vn,existingSections:Xn,treeData:ce,deviationNumberRegistry:Gn,connectedSections:Ke,activeSideBySideSection:je,resolvedMarkdownStyles:dn,getSubSectionRef:st,getSubSectionCompareStyle:qt,getBadgeRef:vt,openMoreFunctionsPopup:Et,openSummaryPopup:ei,resetSideBySide:bt,setConnectedSections:qe,setConnectedLines:Je,cachedConnectedPositions:$e})};return t(d,e({ref:sn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ye?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&i(d,e({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(k,{})})),Fn.open&&i(W,{open:Fn.open,anchorEl:Fn.anchorEl,containerEl:kt.current,clipTopEl:Ht.current,scrollContainerEl:an.current,onClose:ti,summary:Fn.summary}),i(M,{open:In.open,anchorEl:In.anchorEl,sectionTitle:In.sectionTitle,referenceSectionTitle:In.refSectionTitle,onClose:Hn,onOpenCognitiveCompare:Ft,onOpenSideBySide:ni,onConnect:_t,isConnected:ii,isOrphan:In.isOrphan}),Rn.open&&i(_,{open:Rn.open,popupRef:Dn,position:Bn,popupConfig:fe,onClose:function(){wn(null),Cn(function(n){return e(e({},n),{open:!1})}),kn(null)},markdownStyles:se,sectionTitle:Rn.sectionTitle,referenceSectionTitle:Rn.refSectionTitle,cognitiveData:Rn.cognitiveData,anchorEl:Rn.anchorEl,sectionAnchorEl:Rn.sectionAnchorEl,scrollContainerEl:an.current,badgeStyle:Rn.badgeStyle,docData:Rn.docData,deviationData:Rn.deviationData,isLoading:Rn.isLoading}),i(a,e({open:!!Ee,autoHideDuration:8e3,onClose:function(){return Fe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,e({onClose:function(){return Fe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ee}))})),i(O,{componentHeaderText:le,displayConfig:pe,maintainRelativeOrder:ye,onToggleView:function(e){Ce(!0),setTimeout(function(){be(!e),bt(),Mn(),qe(new Set),Je([]),$e.current=[],setTimeout(function(){Ce(!1)},400)},50)}}),i(d,e({ref:an,onScroll:Zt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ye?"hidden":"auto",borderTop:ft&>?"none":"1.5px solid #EEF0F4"}},{children:i(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ye?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Mt,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ye?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ue,style:{position:"absolute",top:0,left:0,width:cn.width||"100%",height:cn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Le?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[zt&&i("g",{children:i("line",{x1:zt.x1,y1:zt.y,x2:zt.x2,y2:zt.y,stroke:yt.badgeBorder,strokeWidth:"1.5"})}),Pt.map(function(n){var o,r,l,c,u,a,s=n.x1+.5*(n.x2-n.x1),v=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;if(n.isSubSection?Me&&je===n.subSectionKeyPath&&Ae:Me&&je===n.sectionIdx&&Ae)return null;if(!ye){var p=n.isSubSection?C(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2),g=Vn[n.sectionIdx]||{title:"",content:""},x=Xn[n.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,x),n.isSubSection&&n.subSectionKeyPath){var m=n.subSectionKeyPath.includes(S)?n.subSectionKeyPath.split(S):[],y=m[2]||n.subSectionKeyPath,b=m[3]||y,R=y.split("-").map(Number),I=b.split("-").map(Number),T=null,B=null;R.length>0&&(T=Vn[R[0]]),I.length>0&&(B=Xn[I[0]]);var w=(null==T?void 0:T.title)||"",F=(null==B?void 0:B.title)||"";console.log("Root Parent Titles:",w,F);for(var _=1;_<R.length;_++)(null==T?void 0:T.subsections)&&(T=T.subsections[R[_]]);for(_=1;_<I.length;_++)(null==B?void 0:B.subsections)&&(B=B.subsections[I[_]]);T&&(g=e(e({},T),{title:w||T.title})),console.log("Base Section for Subsection Badge:",g),B&&(x=e(e({},B),{title:F||B.title})),console.log("Ref Section for Subsection Badge:",x)}var M=!(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),k=(null===(a=null===(u=null===(c=g.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===u?void 0:u.decisioning_factors)||void 0===a?void 0:a.length)||!1,A=M||k;return t("g",{children:[i("path",{d:p,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,e({onClick:function(e){e.stopPropagation(),A&&(Rn.open&&En===n.id?An():(kn(n.id),wt(Bt(e.currentTarget,g,x,n.sectionIdx,n.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:A?"pointer":"default"}},{children:[n.style.badgeText===E&&null==n.style.label?i(D,{color:n.style.badgeText}):0===n.style.label?"Same":n.style.label,i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),A&&i(f,{size:11,style:{transform:Rn.open&&En===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),Xe.map(function(n){var o,r=n.pathD,l=(null===(o=n.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),d="".concat(n.id,"-stroke");return t("g",{children:[i("defs",{children:i("clipPath",e({id:"connections-clip"},{children:i("marker",e({id:c,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(e){Ze.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){Ze.current[d]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),t(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},ye?{flex:1,overflow:"visible"}:{})},{children:[i(d,e({ref:Ht,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,e({title:zn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:zn}))}))})),t(d,e({ref:xn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{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:gn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Vn.map(function(n,o){var r,l,c=!n.title&&!n.content;if(ye&&c)return null;var u=n,a=Kt(o,"left"),s=ye?!(null===(r=u.refIndexes)||void 0===r?void 0:r.length)||u.selfIndex<0:!Xn[o],v=ye?"number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null:o+1,p=Ke.has(o),f=y(u.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,e({ref:at(o),sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:tt.current[o],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"left",colRef:at("left-accordion-".concat(o)),mb:0,treeData:ce,proposedSections:Vn,existingSections:Xn,deviationNumberRegistry:Gn,getSectionCompareStyle:Kt,getBadgeRef:vt,connectedSections:Ke,openMoreFunctionsPopup:Et,openSummaryPopup:ei,deviationNodeIdToView:xe,deviationTargetParentId:ci,parentNodeId:(null===(l=null==ce?void 0:ce.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:ye?!!Rt["left-".concat(o)]:!!Rt[String(o)],onToggle:function(){ti(),Tt(o,"left")},navigation:n.id?ri[n.id]:null,showOpenNodeRef:li,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:ai})})),ye&&a&&t(d,e({ref:ot.current[o],onClick:function(e){var t=ye?Xn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Xn[o]||{title:"",content:""};Et(e,n,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,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!pe.isLoading||null!=u.evaluationResult&&null!=u.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):i(D,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,e({ref:kt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,e({onClick:function(n){n.stopPropagation(),Rn.open&&En===ht?An():(kn(ht),wt(Bt(n.currentTarget,{title:"",content:"",evaluationResult:xt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,ht,!0,e(e({},yt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:yt.badgeBg,color:yt.badgeText,border:"1px solid ".concat(yt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=mt?mt:i(D,{}),i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(f,{size:11,style:{transform:Rn.open&&En===ht?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},ye?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Te&&i(x,{sections:11}),i(d,e({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:i(v,e({title:Wn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Wn}))}))})),t(d,e({ref:vn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{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:pn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Xn.map(function(n,o){var r,l=n,c=[],u=!1,a=null,s=-1;if(ye){c=Vn.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=Vn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var v=Vn.findIndex(function(e,n){var t;return Ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(u=-1!==v)&&(a=Kt(v))}else c=[o+1],(u=Ke.has(o))&&(a=Kt(o));var p=Kt(ye&&-1!==s?s:o);return i(d,e({ref:lt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:it.current[o],sx:e({width:"100%",display:"flex"},u&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"right",colRef:at("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==ce?void 0:ce.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:ye?!!Rt["right-".concat(o)]:!!Rt[String(o)],treeData:ce,proposedSections:Vn,existingSections:Xn,deviationNumberRegistry:Gn,getBadgeRef:vt,getSectionCompareStyle:Kt,connectedSections:Ke,openMoreFunctionsPopup:Et,openSummaryPopup:ei,deviationNodeIdToView:xe,deviationTargetParentId:ci,onToggle:function(){ti(),Tt(o,"right")},navigation:n.id?ri[n.id]:null,showOpenNodeRef:li,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:ai})})),ye&&p&&i(d,e({ref:rt.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:p.badgeBg,color:p.badgeText,border:"1px solid ".concat(p.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{Y as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAiBlC,QAAA,MAAM,gBAAgB,sLAWnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAiBlC,QAAA,MAAM,gBAAgB,sLAWnB,qBAAqB,4CAugGvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viswa-test/test-citation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.87",
|
|
4
4
|
"author": "Viswa Koduru",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"dist"
|
|
145
145
|
],
|
|
146
146
|
"scripts": {
|
|
147
|
-
"start": "craco start",
|
|
147
|
+
"start": "PORT=3005 craco start",
|
|
148
148
|
"build": "rollup -c",
|
|
149
149
|
"tsupBuild": "tsup src/index.ts",
|
|
150
150
|
"test": "craco test",
|