@viswa-test/test-citation 0.0.117 → 0.0.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/CognitiveSummaryPopup.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/cjs/features/PdfViewer/usePdfHighlight.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
- package/dist/features/CognitiveCompare/components/CognitiveSummaryPopup.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/PdfViewer/usePdfHighlight.js +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +3 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/CognitiveSummaryPopup.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/components/CognitiveSummaryPopup.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/usePdfHighlight.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),m=require("./hooks/useDeviationNavigation.js"),_=require("./components/CompareHeader.js"),R=require("./components/SectionAccordion.js"),y=require("./components/SubSectionAccordion.js"),b=require("./components/CognitiveSummaryPopup.js"),S=require("./components/connectedLines.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(A){var E,I,T,B,C,D,O,w,N,j,P,F,M,k,L,V,H,q,G,z,K,W,Y,U,X,$,J=A.componentHeaderText,Q=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Z=A.treeData,ee=A.comparisonConfig,ne=A.leftColumnTitleText,te=A.rightColumnTitleText,ie=A.markdownStyles,oe=A.resetTrigger,re=A.displayConfig,le=void 0===re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:re,ue=A.popupConfig,ce=A.deviationData,ae=void 0===ce?{}:ce,se=A.deviationNodeIdToView,de=A.resetDeviationNodeId,ve=A.isProposingFix,fe=void 0!==ve&&ve,ge=A.proposingFixNodeId,pe=t.useState(le.maintainRelativeOrder),he=pe[0],xe=pe[1],me=!!he||!!(null==le?void 0:le.showDeviationBadges),_e=t.useState(!1),Re=_e[0],ye=_e[1],be=t.useState(!1),Se=be[0],Ae=be[1],Ee=t.useState(null),Ie=Ee[0],Te=Ee[1],Be=t.useState(!1),Ce=Be[0],De=Be[1],Oe=t.useState(null===(I=null!==(E=null==Z?void 0:Z.newEvaluationResult)&&void 0!==E?E:null==le?void 0:le.enableDeviationSchemaBackwardCompatibility)||void 0===I||I)[0],we=t.useState(!1),Ne=we[0],je=we[1],Pe=t.useState(!1),Fe=Pe[0],Me=Pe[1],ke=t.useState(null),Le=ke[0],Ve=ke[1],He=t.useRef(!1),qe=t.useState(new Set),Ge=qe[0],ze=qe[1],Ke=t.useState([]),We=Ke[0],Ye=Ke[1],Ue=t.useRef(null),Xe=t.useRef(null),$e=t.useRef(null),Je=t.useRef(new Set),Qe=t.useRef(!1),Ze=t.useRef(null),en=t.useRef({}),nn=t.useRef([]),tn=t.useRef(!1),on=t.useRef(!1),rn=t.useRef(null),ln=t.useRef(function(){}),un=t.useMemo(function(){return(null==Z?void 0:Z.cognitive_decisioning)||{}},[Z]),cn=t.useState({width:0,height:0}),an=cn[0],sn=cn[1],dn=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),ie)},[ie]),vn=t.useRef(null),fn=t.useRef(null),gn=t.useRef(null),pn=t.useRef(null),hn=t.useRef(null),xn=t.useRef(null),mn=t.useRef(null),_n=t.useRef(null),Rn=t.useRef(!1),yn=t.useRef(null),bn=t.useRef(null),Sn=p.useComparePopups(vn),An=Sn.cognitivePopup,En=Sn.setCognitivePopup,In=Sn.moreFunctions,Tn=Sn.setMoreFunctions,Bn=Sn.position,Cn=Sn.setPosition,Dn=Sn.activeBadgeId,On=Sn.summaryPopup,wn=Sn.setSummaryPopup,Nn=Sn.closeSummaryPopup,jn=Sn.setActiveBadgeId,Pn=Sn.popupRef,Fn=Sn.closeCognitivePopup,Mn=Sn.closeMoreFunctionsPopup,kn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ee?void 0:ee.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==ee?void 0:ee.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==ee?void 0:ee.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==ee?void 0:ee.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[ee]),Ln=t.useState(null),Vn=Ln[0];Ln[1];var Hn=null===(C=null===(T=null==Z?void 0:Z.documents)||void 0===T?void 0:T[null===(B=null==Z?void 0:Z.input_index_map)||void 0===B?void 0:B[0]])||void 0===C?void 0:C.title,qn=null===(w=null===(D=null==Z?void 0:Z.documents)||void 0===D?void 0:D[null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[1]])||void 0===w?void 0:w.title,Gn=u.safeStringify(ne||Hn||"Uploaded Contract"),zn=u.safeStringify(te||qn||"Reference Template"),Kn=g.useCognitiveTreeData(Z,he,ae,kn,Oe),Wn=Kn.activeProposed,Yn=Kn.existingRule,Un=Kn.proposedSections,Xn=Kn.existingSections,$n=Kn.visibleFields,Jn=Kn.parentDeviationRecord,Qn=Kn.deviationNumberRegistry,Zn=Kn.parseError;t.useEffect(function(){Zn&&Te("Failed to load comparison: ".concat(Zn))},[Zn]);var et=Un.length>0||Xn.length>0,nt=h.useSectionRefs($n.map(function(e){return e.key}),Math.max(Un.length,Xn.length)),tt=nt.leftRefs,it=nt.rightRefs,ot=nt.sectionLeftRefs,rt=nt.sectionRightRefs,lt=nt.lhsBadgeRefs,ut=nt.rhsBadgeRefs,ct=nt.sectionRightRowRefs,at=nt.subSectionLeftRefs,st=nt.subSectionRightRefs,dt=nt.sectionRowRefs,vt=nt.getSectionRowRef,ft=nt.getSubSectionRef,gt=nt.getBadgeRef,pt=Yn.analysis,ht=u.safeStringify(null===(j=null===(N=null==pt?void 0:pt.rule_difference_comparison)||void 0===N?void 0:N.summary)||void 0===j?void 0:j.overall_summary),xt=!!ht.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),mt=null!==(P=null==Z?void 0:Z.base_root_id)&&void 0!==P?P:"-1";null==Z||Z[mt];var _t=Oe?null!==(Y=null!==(z=ae&&(null===(G=null==ae?void 0:ae[mt])||void 0===G?void 0:G.evaluation_result))&&void 0!==z?z:null===(W=null===(K=null==Z?void 0:Z.nodes)||void 0===K?void 0:K[mt])||void 0===W?void 0:W.evaluation_result)&&void 0!==Y?Y:null:null!==(q=null!==(k=ae&&(null===(M=null===(F=null==ae?void 0:ae[mt])||void 0===F?void 0:F.evaluation_result)||void 0===M?void 0:M[0]))&&void 0!==k?k:null===(H=null===(V=null===(L=null==Z?void 0:Z.nodes)||void 0===L?void 0:L[mt])||void 0===V?void 0:V.evaluation_result)||void 0===H?void 0:H[0])&&void 0!==q?q:null,Rt=u.extractDeviationScore(_t),yt=u.generateColorPalette(null!==($=null===(X=null===(U=null==_t?void 0:_t.evaluation_outputs)||void 0===U?void 0:U.metadata)||void 0===X?void 0:X.label_color)&&void 0!==$?$:""),bt=function(){Je.current.forEach(function(e){u.resetClauseHighlight(e)}),Je.current.clear()},St=t.useCallback(function(){var e,n,t,i,o,r;bt(),De(!1),on.current=!1,Xe.current=null;var l=rn.current,c=qt.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=at.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=ot.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=ot.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=st.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=rt.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=rt.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Ve(null),rn.current=null,qt.current=null,je(!1),Ae(!1),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px")},[]),At=t.useCallback(function(){bt(),St(),ze(new Set),Ye([]),nn.current=[],Ut([]),Jt(null),wn(a.EMPTY_SUMMARY_POPUP_STATE),Fn(),requestAnimationFrame(function(){var e;null===(e=ln.current)||void 0===e||e.call(ln)})},[]),Et=t.useRef(At);t.useEffect(function(){Et.current=At},[At]),t.useEffect(function(){oe&&Et.current()},[oe]);var It=x.useAccordionState({maintainRelativeOrder:!!he,proposedSections:Un,existingSections:Xn,activeSideBySideSection:Le,connectedSections:Ge,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:nn,svgContainerRef:Ue,isAnimatingRef:Qe,animationTimerRef:Ze,calculateLinesRef:ln,sectionLeftRefs:ot,sectionRightRefs:rt,subSectionLeftRefs:at,subSectionRightRefs:st}),Tt=It.expandedSections,Bt=It.setExpandedSections,Ct=It.expandedSubSections,Dt=It.setExpandedSubSections,Ot=It.toggleSection,wt=t.useCallback(function(n,t,i,o,r,l,c){var a,s,d,v=u.safeStringify(null==t?void 0:t.id)||u.safeStringify(null==i?void 0:i.id)||"",f=(v?un[v]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},g=null!==(s=null===(a=dt.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==le?void 0:le.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:f,anchorEl:n,sectionAnchorEl:g,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Z?void 0:Z.documents,input_index_map:null==Z?void 0:Z.input_index_map},deviationData:function(){var n,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,c=function(n){var t=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var t=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(t&&n[t])return n[t]}var i=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(i.length&&e[i[0]])return e[i[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return t?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return c(l);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var s=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(n=null==s?void 0:s.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==s?void 0:s.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},s),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==s?void 0:s.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==s?void 0:s.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==s?void 0:s.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==s?void 0:s.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==s?void 0:s.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==s?void 0:s.cognitive_decisioning)}):c(l)}(),isOrphan:!!r}},[un,Z]),Nt=t.useCallback(function(e){Mn(),Cn(null),En(e)},[Mn]),jt=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),In.open&&In.sectionIdx===o)Mn();else{var c=e.currentTarget,a="left";(null===(l=gn.current)||void 0===l?void 0:l.contains(c))&&(a="right");bt(),on.current&&St(),ze(new Set),Ye([]),nn.current=[],Fn(),On.open?mi():Nn(),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=ut.current[l])||void 0===e?void 0:e.current:null===(n=lt.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=ut.current[o])||void 0===t?void 0:t.current:null===(i=lt.current[o])||void 0===i?void 0:i.current}()||c;Tn(wt(e,n,i,o,t,r))})}},Pt=t.useCallback(function(){null!==In.sectionIdx&&In.anchorEl?Nt(e.__assign(e.__assign({},In),{open:!0})):Mn()},[In,Mn,Nt]),Ft=t.useCallback(function(){var e=In.sectionIdx,n=In.isOrphan;Mn(),Nn(),null!==e&&(n?Te("No counterpart exists to connect to."):(bt(),on.current&&St(),Ye([]),nn.current=[],ze(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){ln.current&&ln.current()},50)))},[In.sectionIdx,In.isOrphan,Mn,Nn,St]),Mt=t.useCallback(function(){var e=$e.current;if(e){$e.current=null;var n=Un.findIndex(function(n){return n.id===e}),t=Xn.findIndex(function(n){return n.id===e}),i=-1===n?u.findKeyPathByNodeId(Un,e):null,o=-1===t?u.findKeyPathByNodeId(Xn,e):null,r=-1!==n?n:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=function(e,n,t,i){var o,r,l,u;return-1!==e?null!==(r=null===(o=t.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=i.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,t){void 0===t&&(t=30);var i=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Je.current.add(r),u.scrollAndHighlightClause(r,n)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(he)-1!==r&&_n.current&&a(function(){return c(n,i,ot,at)},_n.current),-1!==l&&gn.current&&a(function(){return c(t,o,rt,st)},gn.current);else{var s=vn.current;if(!s)return;a(function(){return-1!==r?c(n,i,ot,at):c(t,o,rt,st)},s)}}},[Un,Xn,he,ot,rt,at,st,_n,gn,vn]),kt=t.useCallback(function(n){if(n){bt(),St(),ze(new Set),Ye([]),nn.current=[],Nn(),Fn();var t=Un.findIndex(function(e){return e.id===n}),i=Xn.findIndex(function(e){return e.id===n}),o=-1===t?u.findKeyPathByNodeId(Un,n):null,r=-1===i?u.findKeyPathByNodeId(Xn,n):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=-1!==i?i:r?Number(r.split("-")[0]):-1;$e.current=n,Bt(function(n){var t,i=e.__assign({},n),o=!1;-1!==l&&(i[t=he?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==c&&(i[t=he?"right-".concat(c):String(c)]||(i[t]=!0,o=!0));return o?i:n}),Dt(function(n){var t=e.__assign({},n),i=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:n}),setTimeout(function(){requestAnimationFrame(function(){$e.current===n&&Lt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Un,Xn,he,Bt,Dt,St,Nn,Fn]),Lt=t.useRef(Mt);t.useEffect(function(){Lt.current=Mt},[Mt]);var Vt=t.useRef(null),Ht=t.useRef(null),qt=t.useRef(null),Gt=t.useRef(null),zt=t.useRef(null),Kt=t.useRef(null),Wt=t.useState([]),Yt=Wt[0],Ut=Wt[1];t.useRef(null);var Xt=t.useState(null),$t=Xt[0],Jt=Xt[1];t.useEffect(function(){if(Vn){var e=kn.fields.find(function(e){return e.analysisKey===Vn||e.key===Vn});if(e){var n=tt.current[e.key]||it.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Vn,kn.fields]);var Qt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==pt?void 0:pt.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}},[pt]),Zt=t.useCallback(function(n,t){var i,o,r;void 0===t&&(t="left");var l=null,c=null;if("left"===t)if(l=Un[n],he&&l){var s=Xn.filter(function(e){var n;return null===(n=l.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});c=s.find(function(e){return e.evaluationResult})||s[0]}else c=Xn[n];else if(c=Xn[n],he&&c){var d=Un.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)});l=d.find(function(e){return e.evaluationResult})||d[0]}else l=Un[n];var v=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,f=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!v&&!f&&!g)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==c?void 0:c.evaluationResult)&&void 0!==o?o:null,h=u.getFirstDeviationOutputValue(p),x=u.getFirstDeviationColor(p);return null!=p?e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null!==(r=h)&&void 0!==r?r:""}):e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null})},[Un,Xn,un,kn,he]),ei=t.useCallback(function(n){for(var t,i,o,r,l,c=n.split("-").map(Number),s=Un[c[0]],d=Xn[c[0]],v=1;v<c.length;v++)(null==s?void 0:s.subsections)&&(s=s.subsections[c[v]]),(null==d?void 0:d.subsections)&&(d=d.subsections[c[v]]);if(!s&&!d)return null;var f=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=u.safeStringify(null==s?void 0:s.id)||u.safeStringify(null==d?void 0:d.id)||"",h=!(!(null==s?void 0:s.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!f&&!g&&!h)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=un[p])||void 0===o||o.relevance_score);var x=null!==(l=null!==(r=null==s?void 0:s.evaluationResult)&&void 0!==r?r:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,m=u.getFirstDeviationOutputValue(x),_=u.getFirstDeviationColor(x);return null!=x?e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null!=m?m:""}):e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null})},[Un,Xn,un,kn]),ni=t.useCallback(function(n,t){var i,o,r,l,c,s,d,v,f,g,p,h,x,m,_,R,y;if(!n||null==t)return null;var b=null!==(d=null!==(c=null!==(o=null===(i=null==ae?void 0:ae[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Z?void 0:Z.nodes)||void 0===r?void 0:r[n])||void 0===l?void 0:l.evaluation_result)&&void 0!==c?c:null===(s=null==Z?void 0:Z[n])||void 0===s?void 0:s.evaluation_result)&&void 0!==d?d:null;if(!b||"object"!=typeof b)return null;var S=null!==(p=null!==(f=null===(v=null==b?void 0:b.deviations)||void 0===v?void 0:v[t])&&void 0!==f?f:null===(g=null==b?void 0:b.deviation_entries)||void 0===g?void 0:g[t])&&void 0!==p?p:null==b?void 0:b[t],A=null!==(y=null!==(m=null===(x=null===(h=null==S?void 0:S.evaluation_outputs)||void 0===h?void 0:h.metadata)||void 0===x?void 0:x.label_color)&&void 0!==m?m:null===(R=null===(_=null==b?void 0:b.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===R?void 0:R.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR;return e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[ae,Z]),ti=t.useCallback(function(){bt(),Bt({}),Dt({}),St(),ze(new Set),Ye([]),nn.current=[],Nn(),Fn(),Mn(),requestAnimationFrame(function(){ln.current&&ln.current()})},[Bt,Dt,St,Nn,Fn,Mn]),ii=t.useMemo(function(){return Object.values(Tt).some(Boolean)||Object.values(Ct).some(Boolean)},[Tt,Ct]),oi=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p,h,x,m,_,R,y,b,S;if(!Rn.current&&!Qe.current){Rn.current=!0;try{if(!Vt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!Tt[t]&&!1===he)return!1;if(he&&!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]),!Ct[i])return!1;return!0},E=Vt.current.getBoundingClientRect();sn({width:E.width,height:E.height});var I=[];if($n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.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")}),!Qe.current){for(var T=0;T<Math.max(Un.length,Xn.length);T++){var B=null===(e=ot.current[T])||void 0===e?void 0:e.current,C=null===(n=rt.current[T])||void 0===n?void 0:n.current;B&&(B.style.height="auto",B.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}he||Object.keys(at.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var D={};$n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();D[i]=Math.max(l.height,u.height)}});var O={left:{},right:{}},w={};if(!Qe.current)if(he){if(Ce&&null!==Le)if("number"==typeof Le){var N=Le,j=Un[N],P=null===(o=ot.current[N])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=rt.current[t])||void 0===n?void 0:n.current;if(i&&(Tt["left-".concat(N)]||Tt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);O.left[N]=Math.max(O.left[N]||0,o),O.right[t]=Math.max(O.right[t]||0,o)}})}else{var F=Le.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(r=at.current[F])||void 0===r?void 0:r.current,C=null===(l=st.current[F])||void 0===l?void 0:l.current;if(B&&C){M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,M)}}}}else{Object.keys(at.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);w[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(T=0;T<Math.min(Un.length,Xn.length);T++){var B=null===(t=ot.current[T])||void 0===t?void 0:t.current,C=null===(i=rt.current[T])||void 0===i?void 0:i.current;if(B&&C){var M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[T]=M,O.right[T]=M}}}if($n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=D[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Qe.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ot.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=rt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),he||Object.keys(w).forEach(function(e){var n,t,i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.current[e])||void 0===t?void 0:t.current;if(i&&o&&w[e]){var r=w[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),he)Un.forEach(function(e,n){var t;(null===(t=ot.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=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=lt.current[n])||void 0===t?void 0:t.current,g=null===(i=ut.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-E.left,m=h.left-E.left,_=p.top+p.height/2-E.top,R=h.top+h.height/2-E.top;if(Ce&&Le===n){var y=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,b=null!==(u=null===(l=gn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,S=y+(null!==(a=null===(c=_n.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=b+(null!==(d=null===(s=gn.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,S)-E.top,R=C(B,b,A)-E.top}var D=Zt(n);D&&I.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:_,x2:m,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(T=0;T<Math.min(Un.length,Xn.length);T++){var k=null===(c=ot.current[T])||void 0===c?void 0:c.current,L=null===(a=rt.current[T])||void 0===a?void 0:a.current;if(k&&L){var V=k.getBoundingClientRect(),H=L.getBoundingClientRect(),q=Math.max(V.top,H.top)+18-E.top,G=(null===(s=Xn[T])||void 0===s?void 0:s.id)||"sec-".concat(T);(J=Zt(T))&&I.push({id:G,x1:V.right-E.left,y1:q,x2:H.left-E.left,y2:q,style:J,sectionIdx:T,hasCognitive:!!((null===(d=Un[T])||void 0===d?void 0:d.cognitiveData)||(null===(v=Xn[T])||void 0===v?void 0:v.cognitiveData)||G&&un[G]),isSubSection:!1})}}Object.keys(at.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=at.current[e])||void 0===n?void 0:n.current,a=null===(t=st.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Un[s[0]],v=Xn[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-E.top,y=ei(e);y&&"Not Defined"!==y.label&&I.push({id:"subsec-".concat(e),x1:m.right-E.left,y1:R,x2:_.left-E.left,y2:R,style:y,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(Ce&&"string"==typeof Le&&Le.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Le.split(u.DEVIATION_BADGE_SEPARATOR),K=z[0],W=z[1],Y=z[2],U=(z[3],"".concat(K).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),X=null===(f=lt.current[U])||void 0===f?void 0:f.current,$=null===(g=ut.current[U])||void 0===g?void 0:g.current;if(X&&$){var J,Q=X.getBoundingClientRect(),Z=$.getBoundingClientRect(),ee=Q.right-E.left,ne=Z.left-E.left,te=Q.top+Q.height/2-E.top,ie=Z.top+Z.height/2-E.top;if(he){var oe=null!==(h=null===(p=_n.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(m=null===(x=gn.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,le=oe+(null!==(R=null===(_=_n.current)||void 0===_?void 0:_.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(b=null===(y=gn.current)||void 0===y?void 0:y.clientHeight)&&void 0!==b?b:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,le)-E.top,ie=ce(Z.top+Z.height/2,re,ue)-E.top}(J=null!==(S=ni(K,W))&&void 0!==S?S:ei(Y))&&I.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Le})}}if(Ut(I),zt.current&&Kt.current){var ae=zt.current.getBoundingClientRect(),se=Kt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-E.top+se.top+se.height/2-E.top)/2;Jt({x1:ae.right-E.left,x2:se.left-E.left,y:de})}else Jt(null);if(Ge.size>0){var ve=[],fe=_n.current,ge=gn.current;if(fe&&ge){var pe=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,_e=xe+fe.clientHeight,Re=me+ge.clientHeight,ye=fe.scrollTop,be=ge.scrollTop,Se=E.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};Ge.forEach(function(e){var n,t,i,o,r,l;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var c=e.split(u.DEVIATION_BADGE_SEPARATOR),a=c[0],s=c[1],d=c[2],v=(c[3],"".concat(a).concat(u.DEVIATION_BADGE_SEPARATOR).concat(s)),f=null===(n=lt.current[v])||void 0===n?void 0:n.current,g=null===(t=ut.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=ni(a,s))&&void 0!==i?i:ei(d),m=(P=p.right-E.left)+.5*((F=h.left-E.left-0)-P),_=p.top+p.height/2,R=h.top+h.height/2,y=_-xe+ye,b=R-me+be,S="conn-subsec-".concat(v);pe.push({lhsScrollY:y,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var A=Ae(_,xe,_e),I=Ae(R,me,Re),T=A-Se,B=I-Se,C=R>=me-4&&R<=Re+4,D="";D=(M=_>=xe-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):M&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!M&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(he){var O=e,w=Un[O];if(!(null===(l=null==w?void 0:w.refIndexes)||void 0===l?void 0:l.length))return;w.refIndexes.forEach(function(e){var n,t,i=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=lt.current[O])||void 0===n?void 0:n.current,r=null===(t=ut.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Zt(O),s=l.right-E.left,d=c.left-E.left-0,v=s+.5*(d-s),f=l.top+l.height/2,g=c.top+c.height/2,p=f-xe+ye,h=g-me+be,x="conn-".concat(O,"-").concat(i);pe.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:Se,leftIdx:O,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var m=Ae(f,xe,_e),_=Ae(g,me,Re),R=m-Se,y=_-Se,b=f>=xe-4&&f<=_e+4,S=g>=me-4&&g<=Re+4,A="";A=b&&S?u.getBentArrowPath(s,R,d,y):b&&!S?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!b&&S?"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y),ve.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,j=N;f=null===(o=lt.current[N])||void 0===o?void 0:o.current,g=null===(r=ut.current[j])||void 0===r?void 0:r.current;if(!f||!g)return;var P,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=Zt(N),m=(P=p.right-E.left)+.5*((F=h.left-E.left-0)-P),_=p.top+p.height/2,R=h.top+h.height/2,y=_-xe+ye,b=R-me+be,S="conn-".concat(N,"-").concat(j);pe.push({lhsScrollY:y,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:N,rhsArrayIdx:j,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var M;A=Ae(_,xe,_e),I=Ae(R,me,Re),T=A-Se,B=I-Se,C=R>=me-4&&R<=Re+4,D="";D=(M=_>=xe-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):M&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!M&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:N,rhsArrayIdx:j})}}),nn.current=pe}Ye(ve)}else Ye([]),nn.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Rn.current=!1}}},[$n,Un,Xn,un,kn,Qt,Zt,ni,he,Ce,Le,Ge,Tt,Ct]),ri=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=nn.current;if(p.length&&!Qe.current){var h=null!==(n=null===(e=_n.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=gn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,_=null!==(c=null===(l=gn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=_n.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=gn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,b=R+m,S=y+_,A=null!==(g=null===(f=Vt.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,E=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+R,t=e.rhsScrollY-x+y,i=en.current[e.styleId+"-stroke"],o=en.current[e.styleId+"-bg"];if(i||o){var r,l=E(n,R,b),c=E(t,y,S),a=l-A,s=c-A,d=n>=R-4&&n<=b+4,v=t>=y-4&&t<=S+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(){ln.current=oi},[oi]);var li=t.useRef(null),ui=t.useRef(null),ci=t.useCallback(function(){nn.current.length>0&&!Qe.current||(null!==li.current&&clearTimeout(li.current),li.current=setTimeout(function(){ln.current(),li.current=null},50))},[]),ai=t.useCallback(function(){Me(!0),je(!1),Xe.current=null,null!==ui.current&&clearTimeout(ui.current),null!==li.current&&(clearTimeout(li.current),li.current=null),ui.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s,d;try{if(nn.current=[],on.current&&null!==rn.current&&null!==qt.current){var v=rn.current,f=qt.current,g="string"==typeof v&&v.includes(u.DEVIATION_BADGE_SEPARATOR),p=null,h=null,x=null,m=null;if(g){var _=v.split(u.DEVIATION_BADGE_SEPARATOR),R="".concat(_[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(_[1]);p=(null===(e=lt.current[R])||void 0===e?void 0:e.current)||null,h=(null===(n=ut.current[R])||void 0===n?void 0:n.current)||null,x=(null===(t=at.current[_[2]])||void 0===t?void 0:t.current)||(null===(i=ot.current[Number(_[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=st.current[_[3]])||void 0===o?void 0:o.current)||(null===(r=rt.current[Number(_[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=dt.current[v])||void 0===l?void 0:l.current)||null,x=(null===(c=ot.current[v])||void 0===c?void 0:c.current)||null,h=(null===(a=ct.current[f])||void 0===a?void 0:a.current)||null,m=(null===(s=rt.current[f])||void 0===s?void 0:s.current)||null;if(p&&h&&x&&m){if(x.style.paddingTop="0px",m.style.paddingTop="0px",!he){var y=p.getBoundingClientRect(),b=h.getBoundingClientRect(),S=y.top-b.top;S>0?m.style.paddingTop="".concat(S,"px"):S<0&&(x.style.paddingTop="".concat(Math.abs(S),"px"))}var A=_n.current,E=gn.current;if(A&&E){var I=p.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,T=h.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-(I-A.scrollTop);Math.abs(E.scrollTop-T)>1&&(E.scrollTop=T)}}}null===(d=ln.current)||void 0===d||d.call(ln),on.current&&je(!0)}catch(e){console.error("Safely caught error during resize calculation:",e)}finally{Me(!1),ui.current=null}},150)},[he,Un,Xn]),si=t.useCallback(function(e){if(null!==yn.current&&bn.current&&Math.abs(e.currentTarget.scrollTop-yn.current)<=2){var n=bn.current;yn.current=null,bn.current=null,n()}He.current||(he||ci(),tn.current||(tn.current=!0,requestAnimationFrame(function(){var e,n,t,i,o,r,l;if(on.current){var c=_n.current,a=gn.current;if(c&&a&&Gt.current){if(!Xe.current){var s=rn.current,d=void 0;if("string"==typeof s&&s.includes(u.DEVIATION_BADGE_SEPARATOR)){var v=s.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(v[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(v[1]);d=null===(e=lt.current[f])||void 0===e?void 0:e.current}else d=null===(n=lt.current[s])||void 0===n?void 0:n.current;if(d){var g=d.getBoundingClientRect();Xe.current={badgeScreenY:g.top+g.height/2,initialScrollTop:c.scrollTop,leftTop:c.getBoundingClientRect().top,leftBottom:c.getBoundingClientRect().top+c.clientHeight,cTop:null!==(i=null===(t=Vt.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Xe.current){var p=Xe.current,h=c.scrollTop-p.initialScrollTop,x=p.badgeScreenY-h,m=((o=x,r=p.leftTop,l=p.leftBottom,Math.max(r,Math.min(l,o)))-p.cTop).toString(),_=x>=p.leftTop-4&&x<=p.leftBottom+4;Gt.current.setAttribute("y1",m),Gt.current.setAttribute("y2",m),Gt.current.setAttribute("visibility",_?"visible":"hidden")}}}nn.current.length>0&&ri(),tn.current=!1})))},[ri,he,ci]),di=t.useRef(0),vi=t.useRef(0),fi=t.useRef(0),gi=t.useRef(function(){});t.useRef(null),t.useEffect(function(){gi.current=ai},[ai]),t.useEffect(function(){var e=setTimeout(ci,250),n=function(){return gi.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==li.current&&clearTimeout(li.current),null!==ui.current&&clearTimeout(ui.current),window.removeEventListener("resize",n)}},[Wn,Yn,pt,$n,Tt,Ct,Un,Xn,kn,ci,Ce,Le,Ne,Ge]),t.useEffect(function(){var e=function(e,n,t,i,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,i())}})});return r.observe(e),r},n={current:null},t={current:null},i={current:null},o=[],r=[n,t,i];return fn.current&&o.push(e(fn.current,di,n,function(){return gi.current()},function(){})),vn.current&&o.push(e(vn.current,vi,t,function(){return gi.current()},function(){return ln.current()})),Vt.current&&o.push(e(Vt.current,fi,i,function(){return gi.current()},function(){return ln.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),t.useEffect(function(){on.current=Ce},[Ce]),t.useEffect(function(){rn.current=Le},[Le]);var pi=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";Mn(),null!=e&&(n?Te("No counterpart exists for this section."):(bt(),Ce&&Le===e?r?St():null==l||l():(ze(new Set([e])),Ye([]),nn.current=[],Ae(!0),He.current=!0,Ve(e),rn.current=e,De(!0),on.current=!0,je(!1),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var f=e.split(u.DEVIATION_BADGE_SEPARATOR),g="".concat(f[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f[1]);s=(null===(n=lt.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=ut.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=dt.current[e])||void 0===i?void 0:i.current)||null,he){var p=Un[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],m=Xn.findIndex(function(e){return e.selfIndex===x});-1!==m&&(d=(null===(r=ct.current[m])||void 0===r?void 0:r.current)||null,v=m)}}else d=(null===(o=ct.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;qt.current=v;var _=_n.current,R=gn.current,y=function(){!function(){var n,t,i,o,r,l,c,s,d,f,g,p,h=null,x=null,m=null,_=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=at.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=ot.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=st.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=rt.current[Number(R[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=lt.current[y])||void 0===r?void 0:r.current)||h,_=(null===(l=ut.current[y])||void 0===l?void 0:l.current)||x}else{var b=Number(e),S=null!==v?Number(v):b;h=(null===(c=ot.current[b])||void 0===c?void 0:c.current)||null,x=(null===(s=rt.current[S])||void 0===s?void 0:s.current)||null,m=(null===(d=lt.current[b])||void 0===d?void 0:d.current)||(null===(f=dt.current[b])||void 0===f?void 0:f.current)||h,_=(null===(g=ut.current[S])||void 0===g?void 0:g.current)||(null===(p=ct.current[S])||void 0===p?void 0:p.current)||x}if(m&&_&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var A=m.getBoundingClientRect(),E=_.getBoundingClientRect(),I=A.top-E.top;I>0?x.style.paddingTop="".concat(I,"px"):I<0&&(h.style.paddingTop="".concat(Math.abs(I),"px"))}}(),je(!0),ln.current&&ln.current(),He.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):_&&_.dispatchEvent(new Event("scroll")),Ae(!1),null==l||l()};if(!s||!_)return He.current=!1,Ae(!1),void(null==l||l());if(d&&R){if(!he){var b=0;b="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var S=vn.current,A=(null==S?void 0:S.getBoundingClientRect().top)||0,E=S?S.scrollTop+b-A-150:0;return S?void u.smoothScrollTo(S,E,200,y):void y()}var I=s.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,T=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=T-(I-_.scrollTop);C<0&&pn.current&&(pn.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 hn.current&&(hn.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&&xn.current&&(xn.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return mn.current&&(mn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,D,B,y)})}e=D}u.smoothScrollTo(_,e,B,y)})}}else y()}))))},[Le,Mn,Xn,Ce,he,Un,St]),hi=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=gn.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=ut.current[l])||void 0===e?void 0:e.current:null===(t=lt.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=ut.current[n])||void 0===i?void 0:i.current:null===(o=lt.current[n])||void 0===o?void 0:o.current};if(t)return St(),ze(new Set),Ye([]),nn.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;wn({open:!0,anchorEl:e,summary:i})}));pi(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;wn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[pi,Fn,wn,St]),xi=t.useCallback(function(){var e,n=In.sectionIdx,t=In.isOrphan;if(Nn(),null!=n){var i="left";In.anchorEl&&(null===(e=gn.current)||void 0===e?void 0:e.contains(In.anchorEl))&&(i="right"),pi(n,t,{sourceSide:i})}},[pi,In.isOrphan,In.sectionIdx,In.anchorEl,Nn]),mi=t.useCallback(function(){Nn(),St(),ze(new Set),Ye([]),nn.current=[]},[Nn,St]),_i=null!==In.sectionIdx&&Ge.has(In.sectionIdx),Ri=m.useDeviationNavigation({proposedSections:Un,existingSections:Xn,parentDeviationRecord:Jn,expandedSections:Tt,maintainRelativeOrder:!!he,scrollContainerRef:vn,leftContainerRef:_n,lhsBadgeRefs:lt,rhsBadgeRefs:ut}),yi=Ri.showDeviationNavigation,bi=Ri.showOpenNodeRef,Si=t.useMemo(function(){var e;if(!se)return null;var n=null===(e=null==se?void 0:se.id)||void 0===e?void 0:e.split(":")[0];for(var t in Jn){if((Jn[t]||[]).some(function(e){return e.id===n}))return t}return null},[se,Jn]),Ai=t.useRef({id:null,triggerMs:null}),Ei=t.useRef(null);t.useEffect(function(){var n;if(null==se?void 0:se.id){var t=Number(se.trigger),i=Ai.current;if((null==i?void 0:i.triggerMs)!==t){if(!(se.id.includes(":")&&/:\d+$/.test(se.id)))return Ai.current={id:se.id,triggerMs:t},void kt(se.id);var o=null===(n=null==se?void 0:se.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],c=null!=l?l:"0";Ei.current!==se.id&&(Nn(),Fn(),St(),ze(new Set),Ye([]),nn.current=[],Ei.current=se.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},g=function(){var n,i,o,l;if(!a){var p=function(){Ai.current={id:se.id,triggerMs:t}},h=null,x=null;for(var m in Jn){var _=Jn[m].find(function(e){return e.id===r});if(_){h=m,x=_;break}}if(x&&h){var R=Un.findIndex(function(e){return e.id===h}),y=Xn.findIndex(function(e){return e.id===h}),b=-1===R&&-1!==y,S=f(Un,x.id),A=f(Xn,x.id);if(S&&!A&&!b){var E=S.split("-"),I=Number(E[0]);if(he){var T=null===(i=null===(n=Un[I])||void 0===n?void 0:n.refIndexes)||void 0===i?void 0:i[0],B=Xn.findIndex(function(e){return e.selfIndex===T});-1!==B&&(I=B)}A=e.__spreadArray([I],E.slice(1),!0).join("-")}if(S||A){var C=b||!S&&!!A,D=S?Number(S.split("-")[0]):R,O=A?Number(A.split("-")[0]):y;if(C){if(!(he?!!Tt["right-".concat(O)]:!!Tt[String(O)])&&O>=0)return Ot(O,"right"),s+=1,void(d=setTimeout(g,450))}else if(!(he?!!Tt["left-".concat(D)]:!!Tt[String(D)])&&D>=0)return Ot(D,"left"),s+=1,void(d=setTimeout(g,450));var w,N=S||"",j=A||"",P="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(N).concat(u.DEVIATION_BADGE_SEPARATOR).concat(j),F="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c),M=null===(o=lt.current[F])||void 0===o?void 0:o.current,k=null===(l=ut.current[F])||void 0===l?void 0:l.current,L=C||!M&&!!k,V=L?k:M;if(w=he?L?gn.current:_n.current:vn.current,V&&w){var H=V.getBoundingClientRect();if(0===H.height)return void((s+=1)<2?d=setTimeout(g,v):p());var q=w.getBoundingClientRect(),G=H.top-q.top+w.scrollTop-q.height/2+H.height/2+150,z=function(){var n,t,i,o,r;if(!a){p();var l=V instanceof Element?window.getComputedStyle(V).color:"";M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(l)),k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){M&&(M.style.boxShadow=""),k&&(k.style.boxShadow="")},2e3);var u=(null===(t=null===(n=x.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[c])||x,s=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!M&&!!k)){var d=L?(null===(o=ut.current[F])||void 0===o?void 0:o.current)||k:(null===(r=lt.current[F])||void 0===r?void 0:r.current)||M;return wn({open:!0,anchorEl:d,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})}),void(null==de||de())}pi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t=(null===(n=lt.current[F])||void 0===n?void 0:n.current)||M;console.log("Summary data",s,u),wn({open:!0,anchorEl:t,summary:e.__assign({},u)})}})}};Math.abs(w.scrollTop-G)<=2?z():(yn.current=G,bn.current=z,w.scrollTo({top:G,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(bn.current){yn.current=null;var e=bn.current;bn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}};return d=setTimeout(g,v),function(){a=!0,d&&clearTimeout(d)}}}},[se,Jn,Un,Xn,he,Tt,Ot,pi,wn,kt]);var Ii=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:Ct,setExpandedSubSections:Dt,maintainRelativeOrder:he||!1,proposedSections:Un,existingSections:Xn,treeData:Z,deviationNumberRegistry:Qn,connectedSections:Ge,activeSideBySideSection:Le,resolvedMarkdownStyles:dn,getSubSectionRef:ft,getSubSectionCompareStyle:ei,getBadgeRef:gt,openMoreFunctionsPopup:jt,openSummaryPopup:hi,showDeviationBadges:me,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:nn,isProposingFix:fe,proposingFixNodeId:ge})};return n.jsxs(i.Box,e.__assign({ref:fn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},he?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),On.open&&n.jsx(b.default,{open:On.open,anchorEl:On.anchorEl,containerEl:Ht.current,clipTopEl:zt.current,scrollContainerEl:vn.current,onClose:mi,summary:On.summary}),n.jsx(d.default,{open:In.open,anchorEl:In.anchorEl,sectionTitle:In.sectionTitle,referenceSectionTitle:In.refSectionTitle,onClose:Mn,onOpenCognitiveCompare:Pt,onOpenSideBySide:xi,onConnect:Ft,isConnected:_i,isOrphan:In.isOrphan}),An.open&&n.jsx(s.default,{open:An.open,popupRef:Pn,position:Bn,popupConfig:ue,onClose:function(){Cn(null),En(function(n){return e.__assign(e.__assign({},n),{open:!1})}),jn(null)},markdownStyles:ie,sectionTitle:An.sectionTitle,referenceSectionTitle:An.refSectionTitle,cognitiveData:An.cognitiveData,anchorEl:An.anchorEl,sectionAnchorEl:An.sectionAnchorEl,scrollContainerEl:vn.current,badgeStyle:An.badgeStyle,docData:An.docData,deviationData:An.deviationData,isLoading:An.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Ie,autoHideDuration:8e3,onClose:function(){return Te(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Te(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ie}))})),n.jsx(_.default,{componentHeaderText:Q,displayConfig:le,maintainRelativeOrder:he,onCollapseAll:ti,showCollapseAll:ii,onToggleView:function(e){ye(!0),setTimeout(function(){xe(!e),St(),Nn(),ze(new Set),Ye([]),nn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ye(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:vn,onScroll:si,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:he?"hidden":"auto",borderTop:ht&&xt?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},he?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Vt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ue,style:{position:"absolute",top:0,left:0,width:an.width||"100%",height:an.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Fe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[$t&&n.jsx("g",{children:n.jsx("line",{x1:$t.x1,y1:$t.y,x2:$t.x2,y2:$t.y,stroke:yt.badgeBorder,strokeWidth:"1.5"})}),Yt.map(function(t){var l,c,s,d,v,g,p=t.x1+.5*(t.x2-t.x1),h=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?Ce&&Le===t.subSectionKeyPath&&Ne:Ce&&Le===t.sectionIdx&&Ne)return null;if(!he){var x=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),m=Un[t.sectionIdx]||{title:"",content:""},_=Xn[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,b=R[3]||y,S=y.split("-").map(Number),A=b.split("-").map(Number),E=null,I=null;S.length>0&&(E=Un[S[0]]),A.length>0&&(I=Xn[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<S.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[S[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&&(An.open&&Dn===t.id?Fn():(jn(t.id),Nt(wt(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:An.open&&Dn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),n.jsx(S.default,{connectedLines:We,pathRefs:en})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:zt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(i.Tooltip,e.__assign({title:Gn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Gn}))}))})),n.jsxs(i.Box,e.__assign({ref:_n,onScroll:si,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:xn,style:{width:"100%",height:"0px",flexShrink:0}}),et&&Un.map(function(t,r){var l,c,a=!t.title&&!t.content;if(he&&a)return null;var s=t,d=Zt(r,"left"),v=he?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Xn[r],g=he?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ge.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:vt(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:ot.current[r],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:r,columnKey:"left",colRef:vt("left-accordion-".concat(r)),mb:0,treeData:Z,proposedSections:Un,existingSections:Xn,deviationNumberRegistry:Qn,getSectionCompareStyle:Zt,getBadgeRef:gt,connectedSections:Ge,openMoreFunctionsPopup:jt,openSummaryPopup:hi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,parentNodeId:(null===(c=null==Z?void 0:Z.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:he?!!Tt["left-".concat(r)]:!!Tt[String(r)],onToggle:function(){mi(),Ot(r,"left")},navigation:t.id?yi[t.id]:null,showOpenNodeRef:bi,resolvedMarkdownStyles:dn,maintainRelativeOrder:he,showDeviationBadges:me,renderSubSections:Ii,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Le?Le:""))})})),he&&d&&n.jsxs(i.Box,e.__assign({ref:lt.current[r],onClick:function(e){var n,t,i,o=le.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;hi(e,String(r),v,o)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=le.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;hi(e,String(r),v,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:v?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":v?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=g&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:g})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!le.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(f.default,{color:d.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=he?Xn.find(function(e){var n;return(null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e))||{title:"",content:""}}):Xn[r]||{title:"",content:""};jt(e,t,v,n,r,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:mn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:Ht,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(),An.open&&Dn===mt?Fn():(jn(mt),Nt(wt(n.currentTarget,{title:"",content:"",evaluationResult:_t,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,mt,!0,e.__assign(e.__assign({},yt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",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!=Rt?Rt: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:An.open&&Dn===mt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},he?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Se&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Kt,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:zn,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:zn}))}))})),n.jsxs(i.Box,e.__assign({ref:gn,onScroll:si,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}}),et&&Xn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(he){u=Un.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=Un.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=Un.findIndex(function(e,n){var t;return Ge.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Zt(d))}else u=[o+1],(c=Ge.has(o))&&(a=Zt(o));var v=Zt(he&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:ct.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:rt.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:vt("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Z?void 0:Z.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:he?!!Tt["right-".concat(o)]:!!Tt[String(o)],treeData:Z,proposedSections:Un,existingSections:Xn,deviationNumberRegistry:Qn,getBadgeRef:gt,getSectionCompareStyle:Zt,connectedSections:Ge,openMoreFunctionsPopup:jt,openSummaryPopup:hi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,onToggle:function(){mi(),Ot(o,"right")},navigation:t.id?yi[t.id]:null,showOpenNodeRef:bi,resolvedMarkdownStyles:dn,maintainRelativeOrder:he,showDeviationBadges:me,renderSubSections:Ii,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Le?Le:""))})})),he&&v&&n.jsx(i.Box,e.__assign({ref:ut.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:hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),m=require("./hooks/useDeviationNavigation.js"),_=require("./components/CompareHeader.js"),y=require("./components/SectionAccordion.js"),R=require("./components/SubSectionAccordion.js"),b=require("./components/CognitiveSummaryPopup.js"),S=require("./components/connectedLines.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(A){var I,E,T,B,C,D,O,w,N,j,P,F,M,k,L,V,H,q,G,z,K,W,Y,U,X,$,J=A.componentHeaderText,Q=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Z=A.treeData,ee=A.comparisonConfig,ne=A.leftColumnTitleText,te=A.rightColumnTitleText,ie=A.markdownStyles,oe=A.resetTrigger,re=A.displayConfig,le=void 0===re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:re,ue=A.popupConfig,ce=A.deviationData,ae=void 0===ce?{}:ce,se=A.deviationNodeIdToView,de=A.resetDeviationNodeId,ve=A.isProposingFix,fe=void 0!==ve&&ve,ge=A.proposingFixNodeId,pe=t.useState(le.maintainRelativeOrder),he=pe[0],xe=pe[1],me=!!he||!!(null==le?void 0:le.showDeviationBadges),_e=t.useState(!1),ye=_e[0],Re=_e[1],be=t.useState(!1),Se=be[0],Ae=be[1],Ie=t.useState(null),Ee=Ie[0],Te=Ie[1],Be=t.useState(!1),Ce=Be[0],De=Be[1],Oe=t.useState(null===(E=null!==(I=null==Z?void 0:Z.newEvaluationResult)&&void 0!==I?I:null==le?void 0:le.enableDeviationSchemaBackwardCompatibility)||void 0===E||E)[0],we=t.useState(!1),Ne=we[0],je=we[1],Pe=t.useState(!1),Fe=Pe[0],Me=Pe[1],ke=t.useState(null),Le=ke[0],Ve=ke[1],He=t.useRef(!1),qe=t.useState(new Set),Ge=qe[0],ze=qe[1],Ke=t.useState([]),We=Ke[0],Ye=Ke[1],Ue=t.useRef(null),Xe=t.useRef(null),$e=t.useRef(null),Je=t.useRef(new Set),Qe=t.useRef(!1),Ze=t.useRef(null),en=t.useRef({}),nn=t.useRef([]),tn=t.useRef(!1),on=t.useRef(!1),rn=t.useRef(null),ln=t.useRef(function(){}),un=t.useMemo(function(){return(null==Z?void 0:Z.cognitive_decisioning)||{}},[Z]),cn=t.useState({width:0,height:0}),an=cn[0],sn=cn[1],dn=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),ie)},[ie]),vn=t.useRef(null),fn=t.useRef(null),gn=t.useRef(null),pn=t.useRef(null),hn=t.useRef(null),xn=t.useRef(null),mn=t.useRef(null),_n=t.useRef(null),yn=t.useRef(!1),Rn=t.useRef(null),bn=t.useRef(null),Sn=p.useComparePopups(vn),An=Sn.cognitivePopup,In=Sn.setCognitivePopup,En=Sn.moreFunctions,Tn=Sn.setMoreFunctions,Bn=Sn.position,Cn=Sn.setPosition,Dn=Sn.activeBadgeId,On=Sn.summaryPopup,wn=Sn.setSummaryPopup,Nn=Sn.closeSummaryPopup,jn=Sn.setActiveBadgeId,Pn=Sn.popupRef,Fn=Sn.closeCognitivePopup,Mn=Sn.closeMoreFunctionsPopup,kn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ee?void 0:ee.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==ee?void 0:ee.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==ee?void 0:ee.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==ee?void 0:ee.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[ee]),Ln=t.useState(null),Vn=Ln[0];Ln[1];var Hn=null===(C=null===(T=null==Z?void 0:Z.documents)||void 0===T?void 0:T[null===(B=null==Z?void 0:Z.input_index_map)||void 0===B?void 0:B[0]])||void 0===C?void 0:C.title,qn=null===(w=null===(D=null==Z?void 0:Z.documents)||void 0===D?void 0:D[null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[1]])||void 0===w?void 0:w.title,Gn=u.safeStringify(ne||Hn||"Uploaded Contract"),zn=u.safeStringify(te||qn||"Reference Template"),Kn=g.useCognitiveTreeData(Z,he,ae,kn,Oe),Wn=Kn.activeProposed,Yn=Kn.existingRule,Un=Kn.proposedSections,Xn=Kn.existingSections,$n=Kn.visibleFields,Jn=Kn.parentDeviationRecord,Qn=Kn.deviationNumberRegistry,Zn=Kn.parseError;t.useEffect(function(){Zn&&Te("Failed to load comparison: ".concat(Zn))},[Zn]);var et=Un.length>0||Xn.length>0,nt=h.useSectionRefs($n.map(function(e){return e.key}),Math.max(Un.length,Xn.length)),tt=nt.leftRefs,it=nt.rightRefs,ot=nt.sectionLeftRefs,rt=nt.sectionRightRefs,lt=nt.lhsBadgeRefs,ut=nt.rhsBadgeRefs,ct=nt.sectionRightRowRefs,at=nt.subSectionLeftRefs,st=nt.subSectionRightRefs,dt=nt.sectionRowRefs,vt=nt.getSectionRowRef,ft=nt.getSubSectionRef,gt=nt.getBadgeRef,pt=Yn.analysis,ht=u.safeStringify(null===(j=null===(N=null==pt?void 0:pt.rule_difference_comparison)||void 0===N?void 0:N.summary)||void 0===j?void 0:j.overall_summary),xt=!!ht.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),mt=null!==(P=null==Z?void 0:Z.base_root_id)&&void 0!==P?P:"-1";null==Z||Z[mt];var _t=Oe?null!==(Y=null!==(z=ae&&(null===(G=null==ae?void 0:ae[mt])||void 0===G?void 0:G.evaluation_result))&&void 0!==z?z:null===(W=null===(K=null==Z?void 0:Z.nodes)||void 0===K?void 0:K[mt])||void 0===W?void 0:W.evaluation_result)&&void 0!==Y?Y:null:null!==(q=null!==(k=ae&&(null===(M=null===(F=null==ae?void 0:ae[mt])||void 0===F?void 0:F.evaluation_result)||void 0===M?void 0:M[0]))&&void 0!==k?k:null===(H=null===(V=null===(L=null==Z?void 0:Z.nodes)||void 0===L?void 0:L[mt])||void 0===V?void 0:V.evaluation_result)||void 0===H?void 0:H[0])&&void 0!==q?q:null,yt=u.extractDeviationScore(_t),Rt=u.generateColorPalette(null!==($=null===(X=null===(U=null==_t?void 0:_t.evaluation_outputs)||void 0===U?void 0:U.metadata)||void 0===X?void 0:X.label_color)&&void 0!==$?$:""),bt=function(){Je.current.forEach(function(e){u.resetClauseHighlight(e)}),Je.current.clear()},St=t.useCallback(function(){var e,n,t,i,o,r;bt(),De(!1),on.current=!1,Xe.current=null;var l=rn.current,c=qt.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=at.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=ot.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=ot.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=st.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=rt.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=rt.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Ve(null),rn.current=null,qt.current=null,je(!1),Ae(!1),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px")},[]),At=t.useCallback(function(){bt(),St(),ze(new Set),Ye([]),nn.current=[],Ut([]),Jt(null),wn(a.EMPTY_SUMMARY_POPUP_STATE),Fn(),requestAnimationFrame(function(){var e;null===(e=ln.current)||void 0===e||e.call(ln)})},[]),It=t.useRef(At);t.useEffect(function(){It.current=At},[At]),t.useEffect(function(){oe&&It.current()},[oe]);var Et=x.useAccordionState({maintainRelativeOrder:!!he,proposedSections:Un,existingSections:Xn,activeSideBySideSection:Le,connectedSections:Ge,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:nn,svgContainerRef:Ue,isAnimatingRef:Qe,animationTimerRef:Ze,calculateLinesRef:ln,sectionLeftRefs:ot,sectionRightRefs:rt,subSectionLeftRefs:at,subSectionRightRefs:st}),Tt=Et.expandedSections,Bt=Et.setExpandedSections,Ct=Et.expandedSubSections,Dt=Et.setExpandedSubSections,Ot=Et.toggleSection,wt=t.useCallback(function(n,t,i,o,r,l,c){var a,s,d,v=u.safeStringify(null==t?void 0:t.id)||u.safeStringify(null==i?void 0:i.id)||"",f=(v?un[v]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},g=null!==(s=null===(a=dt.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==le?void 0:le.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:f,anchorEl:n,sectionAnchorEl:g,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Z?void 0:Z.documents,input_index_map:null==Z?void 0:Z.input_index_map},deviationData:function(){var n,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,c=function(n){var t=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var t=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(t&&n[t])return n[t]}var i=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(i.length&&e[i[0]])return e[i[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return t?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return c(l);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var s=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(n=null==s?void 0:s.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==s?void 0:s.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},s),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==s?void 0:s.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==s?void 0:s.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==s?void 0:s.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==s?void 0:s.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==s?void 0:s.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==s?void 0:s.cognitive_decisioning)}):c(l)}(),isOrphan:!!r}},[un,Z]),Nt=t.useCallback(function(e){Mn(),Cn(null),In(e)},[Mn]),jt=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),En.open&&En.sectionIdx===o)Mn();else{var c=e.currentTarget,a="left";(null===(l=gn.current)||void 0===l?void 0:l.contains(c))&&(a="right");bt(),on.current&&St(),ze(new Set),Ye([]),nn.current=[],Fn(),On.open?mi():Nn(),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=ut.current[l])||void 0===e?void 0:e.current:null===(n=lt.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=ut.current[o])||void 0===t?void 0:t.current:null===(i=lt.current[o])||void 0===i?void 0:i.current}()||c;Tn(wt(e,n,i,o,t,r))})}},Pt=t.useCallback(function(){null!==En.sectionIdx&&En.anchorEl?Nt(e.__assign(e.__assign({},En),{open:!0})):Mn()},[En,Mn,Nt]),Ft=t.useCallback(function(){var e=En.sectionIdx,n=En.isOrphan;Mn(),Nn(),null!==e&&(n?Te("No counterpart exists to connect to."):(bt(),on.current&&St(),Ye([]),nn.current=[],ze(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){ln.current&&ln.current()},50)))},[En.sectionIdx,En.isOrphan,Mn,Nn,St]),Mt=t.useCallback(function(){var e=$e.current;if(e){$e.current=null;var n=Un.findIndex(function(n){return n.id===e}),t=Xn.findIndex(function(n){return n.id===e}),i=-1===n?u.findKeyPathByNodeId(Un,e):null,o=-1===t?u.findKeyPathByNodeId(Xn,e):null,r=-1!==n?n:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=function(e,n,t,i){var o,r,l,u;return-1!==e?null!==(r=null===(o=t.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=i.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,t){void 0===t&&(t=30);var i=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Je.current.add(r),u.scrollAndHighlightClause(r,n)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(he)-1!==r&&_n.current&&a(function(){return c(n,i,ot,at)},_n.current),-1!==l&&gn.current&&a(function(){return c(t,o,rt,st)},gn.current);else{var s=vn.current;if(!s)return;a(function(){return-1!==r?c(n,i,ot,at):c(t,o,rt,st)},s)}}},[Un,Xn,he,ot,rt,at,st,_n,gn,vn]),kt=t.useCallback(function(n){if(n){bt(),St(),ze(new Set),Ye([]),nn.current=[],Nn(),Fn();var t=Un.findIndex(function(e){return e.id===n}),i=Xn.findIndex(function(e){return e.id===n}),o=-1===t?u.findKeyPathByNodeId(Un,n):null,r=-1===i?u.findKeyPathByNodeId(Xn,n):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=-1!==i?i:r?Number(r.split("-")[0]):-1;$e.current=n,Bt(function(n){var t,i=e.__assign({},n),o=!1;-1!==l&&(i[t=he?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==c&&(i[t=he?"right-".concat(c):String(c)]||(i[t]=!0,o=!0));return o?i:n}),Dt(function(n){var t=e.__assign({},n),i=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:n}),setTimeout(function(){requestAnimationFrame(function(){$e.current===n&&Lt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Un,Xn,he,Bt,Dt,St,Nn,Fn]),Lt=t.useRef(Mt);t.useEffect(function(){Lt.current=Mt},[Mt]);var Vt=t.useRef(null),Ht=t.useRef(null),qt=t.useRef(null),Gt=t.useRef(null),zt=t.useRef(null),Kt=t.useRef(null),Wt=t.useState([]),Yt=Wt[0],Ut=Wt[1];t.useRef(null);var Xt=t.useState(null),$t=Xt[0],Jt=Xt[1];t.useEffect(function(){if(Vn){var e=kn.fields.find(function(e){return e.analysisKey===Vn||e.key===Vn});if(e){var n=tt.current[e.key]||it.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Vn,kn.fields]);var Qt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==pt?void 0:pt.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}},[pt]),Zt=t.useCallback(function(n,t){var i,o,r;void 0===t&&(t="left");var l=null,c=null;if("left"===t)if(l=Un[n],he&&l){var s=Xn.filter(function(e){var n;return null===(n=l.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});c=s.find(function(e){return e.evaluationResult})||s[0]}else c=Xn[n];else if(c=Xn[n],he&&c){var d=Un.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)});l=d.find(function(e){return e.evaluationResult})||d[0]}else l=Un[n];var v=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,f=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!v&&!f&&!g)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==c?void 0:c.evaluationResult)&&void 0!==o?o:null,h=u.getFirstDeviationOutputValue(p),x=u.getFirstDeviationColor(p);return null!=p?e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null!==(r=h)&&void 0!==r?r:""}):e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null})},[Un,Xn,un,kn,he]),ei=t.useCallback(function(n){for(var t,i,o,r,l,c=n.split("-").map(Number),s=Un[c[0]],d=Xn[c[0]],v=1;v<c.length;v++)(null==s?void 0:s.subsections)&&(s=s.subsections[c[v]]),(null==d?void 0:d.subsections)&&(d=d.subsections[c[v]]);if(!s&&!d)return null;var f=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=u.safeStringify(null==s?void 0:s.id)||u.safeStringify(null==d?void 0:d.id)||"",h=!(!(null==s?void 0:s.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!f&&!g&&!h)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=un[p])||void 0===o||o.relevance_score);var x=null!==(l=null!==(r=null==s?void 0:s.evaluationResult)&&void 0!==r?r:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,m=u.getFirstDeviationOutputValue(x),_=u.getFirstDeviationColor(x);return null!=x?e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null!=m?m:""}):e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null})},[Un,Xn,un,kn]),ni=t.useCallback(function(n,t){var i,o,r,l,c,s,d,v,f,g,p,h,x,m,_,y,R;if(!n||null==t)return null;var b=null!==(d=null!==(c=null!==(o=null===(i=null==ae?void 0:ae[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Z?void 0:Z.nodes)||void 0===r?void 0:r[n])||void 0===l?void 0:l.evaluation_result)&&void 0!==c?c:null===(s=null==Z?void 0:Z[n])||void 0===s?void 0:s.evaluation_result)&&void 0!==d?d:null;if(!b||"object"!=typeof b)return null;var S=null!==(p=null!==(f=null===(v=null==b?void 0:b.deviations)||void 0===v?void 0:v[t])&&void 0!==f?f:null===(g=null==b?void 0:b.deviation_entries)||void 0===g?void 0:g[t])&&void 0!==p?p:null==b?void 0:b[t],A=null!==(R=null!==(m=null===(x=null===(h=null==S?void 0:S.evaluation_outputs)||void 0===h?void 0:h.metadata)||void 0===x?void 0:x.label_color)&&void 0!==m?m:null===(y=null===(_=null==b?void 0:b.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===y?void 0:y.label_color)&&void 0!==R?R:a.DEFAULT_DEVIAION_COLOR;return e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[ae,Z]),ti=t.useCallback(function(){bt(),Bt({}),Dt({}),St(),ze(new Set),Ye([]),nn.current=[],Nn(),Fn(),Mn(),requestAnimationFrame(function(){ln.current&&ln.current()})},[Bt,Dt,St,Nn,Fn,Mn]),ii=t.useMemo(function(){return Object.values(Tt).some(Boolean)||Object.values(Ct).some(Boolean)},[Tt,Ct]),oi=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p,h,x,m,_,y,R,b,S;if(!yn.current&&!Qe.current){yn.current=!0;try{if(!Vt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!Tt[t]&&!1===he)return!1;if(he&&!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]),!Ct[i])return!1;return!0},I=Vt.current.getBoundingClientRect();sn({width:I.width,height:I.height});var E=[];if($n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.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")}),!Qe.current){for(var T=0;T<Math.max(Un.length,Xn.length);T++){var B=null===(e=ot.current[T])||void 0===e?void 0:e.current,C=null===(n=rt.current[T])||void 0===n?void 0:n.current;B&&(B.style.height="auto",B.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}he||Object.keys(at.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var D={};$n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();D[i]=Math.max(l.height,u.height)}});var O={left:{},right:{}},w={};if(!Qe.current)if(he){if(Ce&&null!==Le)if("number"==typeof Le){var N=Le,j=Un[N],P=null===(o=ot.current[N])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=rt.current[t])||void 0===n?void 0:n.current;if(i&&(Tt["left-".concat(N)]||Tt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);O.left[N]=Math.max(O.left[N]||0,o),O.right[t]=Math.max(O.right[t]||0,o)}})}else{var F=Le.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(r=at.current[F])||void 0===r?void 0:r.current,C=null===(l=st.current[F])||void 0===l?void 0:l.current;if(B&&C){M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,M)}}}}else{Object.keys(at.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);w[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(T=0;T<Math.min(Un.length,Xn.length);T++){var B=null===(t=ot.current[T])||void 0===t?void 0:t.current,C=null===(i=rt.current[T])||void 0===i?void 0:i.current;if(B&&C){var M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[T]=M,O.right[T]=M}}}if($n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=D[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Qe.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ot.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=rt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),he||Object.keys(w).forEach(function(e){var n,t,i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.current[e])||void 0===t?void 0:t.current;if(i&&o&&w[e]){var r=w[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),he)Un.forEach(function(e,n){var t;(null===(t=ot.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=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=lt.current[n])||void 0===t?void 0:t.current,g=null===(i=ut.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-I.left,m=h.left-I.left,_=p.top+p.height/2-I.top,y=h.top+h.height/2-I.top;if(Ce&&Le===n){var R=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,b=null!==(u=null===(l=gn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,S=R+(null!==(a=null===(c=_n.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=b+(null!==(d=null===(s=gn.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,R,S)-I.top,y=C(B,b,A)-I.top}var D=Zt(n);D&&E.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:_,x2:m,y2:y,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(T=0;T<Math.min(Un.length,Xn.length);T++){var k=null===(c=ot.current[T])||void 0===c?void 0:c.current,L=null===(a=rt.current[T])||void 0===a?void 0:a.current;if(k&&L){var V=k.getBoundingClientRect(),H=L.getBoundingClientRect(),q=Math.max(V.top,H.top)+18-I.top,G=(null===(s=Xn[T])||void 0===s?void 0:s.id)||"sec-".concat(T);(J=Zt(T))&&E.push({id:G,x1:V.right-I.left,y1:q,x2:H.left-I.left,y2:q,style:J,sectionIdx:T,hasCognitive:!!((null===(d=Un[T])||void 0===d?void 0:d.cognitiveData)||(null===(v=Xn[T])||void 0===v?void 0:v.cognitiveData)||G&&un[G]),isSubSection:!1})}}Object.keys(at.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=at.current[e])||void 0===n?void 0:n.current,a=null===(t=st.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Un[s[0]],v=Xn[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(),y=Math.max(m.top,_.top)+16-I.top,R=ei(e);R&&"Not Defined"!==R.label&&E.push({id:"subsec-".concat(e),x1:m.right-I.left,y1:y,x2:_.left-I.left,y2:y,style:R,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(Ce&&"string"==typeof Le&&Le.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Le.split(u.DEVIATION_BADGE_SEPARATOR),K=z[0],W=z[1],Y=z[2],U=(z[3],"".concat(K).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),X=null===(f=lt.current[U])||void 0===f?void 0:f.current,$=null===(g=ut.current[U])||void 0===g?void 0:g.current;if(X&&$){var J,Q=X.getBoundingClientRect(),Z=$.getBoundingClientRect(),ee=Q.right-I.left,ne=Z.left-I.left,te=Q.top+Q.height/2-I.top,ie=Z.top+Z.height/2-I.top;if(he){var oe=null!==(h=null===(p=_n.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(m=null===(x=gn.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,le=oe+(null!==(y=null===(_=_n.current)||void 0===_?void 0:_.clientHeight)&&void 0!==y?y:1/0),ue=re+(null!==(b=null===(R=gn.current)||void 0===R?void 0:R.clientHeight)&&void 0!==b?b:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,le)-I.top,ie=ce(Z.top+Z.height/2,re,ue)-I.top}(J=null!==(S=ni(K,W))&&void 0!==S?S:ei(Y))&&E.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Le})}}if(Ut(E),zt.current&&Kt.current){var ae=zt.current.getBoundingClientRect(),se=Kt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-I.top+se.top+se.height/2-I.top)/2;Jt({x1:ae.right-I.left,x2:se.left-I.left,y:de})}else Jt(null);if(Ge.size>0){var ve=[],fe=_n.current,ge=gn.current;if(fe&&ge){var pe=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,_e=xe+fe.clientHeight,ye=me+ge.clientHeight,Re=fe.scrollTop,be=ge.scrollTop,Se=I.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};Ge.forEach(function(e){var n,t,i,o,r,l;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var c=e.split(u.DEVIATION_BADGE_SEPARATOR),a=c[0],s=c[1],d=c[2],v=(c[3],"".concat(a).concat(u.DEVIATION_BADGE_SEPARATOR).concat(s)),f=null===(n=lt.current[v])||void 0===n?void 0:n.current,g=null===(t=ut.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=ni(a,s))&&void 0!==i?i:ei(d),m=(P=p.right-I.left)+.5*((F=h.left-I.left-0)-P),_=p.top+p.height/2,y=h.top+h.height/2,R=_-xe+Re,b=y-me+be,S="conn-subsec-".concat(v);pe.push({lhsScrollY:R,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var A=Ae(_,xe,_e),E=Ae(y,me,ye),T=A-Se,B=E-Se,C=y>=me-4&&y<=ye+4,D="";D=(M=_>=xe-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):M&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!M&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(he){var O=e,w=Un[O];if(!(null===(l=null==w?void 0:w.refIndexes)||void 0===l?void 0:l.length))return;w.refIndexes.forEach(function(e){var n,t,i=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=lt.current[O])||void 0===n?void 0:n.current,r=null===(t=ut.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Zt(O),s=l.right-I.left,d=c.left-I.left-0,v=s+.5*(d-s),f=l.top+l.height/2,g=c.top+c.height/2,p=f-xe+Re,h=g-me+be,x="conn-".concat(O,"-").concat(i);pe.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:Se,leftIdx:O,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var m=Ae(f,xe,_e),_=Ae(g,me,ye),y=m-Se,R=_-Se,b=f>=xe-4&&f<=_e+4,S=g>=me-4&&g<=ye+4,A="";A=b&&S?u.getBentArrowPath(s,y,d,R):b&&!S?"M ".concat(s,",").concat(y," L ").concat(v,",").concat(y," L ").concat(v,",").concat(R):!b&&S?"M ".concat(v,",").concat(y," L ").concat(v,",").concat(R," L ").concat(d,",").concat(R):"M ".concat(v,",").concat(y," L ").concat(v,",").concat(R),ve.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,j=N;f=null===(o=lt.current[N])||void 0===o?void 0:o.current,g=null===(r=ut.current[j])||void 0===r?void 0:r.current;if(!f||!g)return;var P,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=Zt(N),m=(P=p.right-I.left)+.5*((F=h.left-I.left-0)-P),_=p.top+p.height/2,y=h.top+h.height/2,R=_-xe+Re,b=y-me+be,S="conn-".concat(N,"-").concat(j);pe.push({lhsScrollY:R,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:N,rhsArrayIdx:j,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var M;A=Ae(_,xe,_e),E=Ae(y,me,ye),T=A-Se,B=E-Se,C=y>=me-4&&y<=ye+4,D="";D=(M=_>=xe-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):M&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!M&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:N,rhsArrayIdx:j})}}),nn.current=pe}Ye(ve)}else Ye([]),nn.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{yn.current=!1}}},[$n,Un,Xn,un,kn,Qt,Zt,ni,he,Ce,Le,Ge,Tt,Ct]),ri=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=nn.current;if(p.length&&!Qe.current){var h=null!==(n=null===(e=_n.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=gn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,_=null!==(c=null===(l=gn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(s=null===(a=_n.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,R=null!==(v=null===(d=gn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,b=y+m,S=R+_,A=null!==(g=null===(f=Vt.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,I=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+y,t=e.rhsScrollY-x+R,i=en.current[e.styleId+"-stroke"],o=en.current[e.styleId+"-bg"];if(i||o){var r,l=I(n,y,b),c=I(t,R,S),a=l-A,s=c-A,d=n>=y-4&&n<=b+4,v=t>=R-4&&t<=S+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(){ln.current=oi},[oi]);var li=t.useRef(null),ui=t.useRef(null),ci=t.useCallback(function(){nn.current.length>0&&!Qe.current||(null!==li.current&&clearTimeout(li.current),li.current=setTimeout(function(){ln.current(),li.current=null},50))},[]),ai=t.useCallback(function(){Me(!0),je(!1),Xe.current=null,null!==ui.current&&clearTimeout(ui.current),null!==li.current&&(clearTimeout(li.current),li.current=null),ui.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s,d;try{if(nn.current=[],on.current&&null!==rn.current&&null!==qt.current){var v=rn.current,f=qt.current,g="string"==typeof v&&v.includes(u.DEVIATION_BADGE_SEPARATOR),p=null,h=null,x=null,m=null;if(g){var _=v.split(u.DEVIATION_BADGE_SEPARATOR),y="".concat(_[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(_[1]);p=(null===(e=lt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(n=ut.current[y])||void 0===n?void 0:n.current)||null,x=(null===(t=at.current[_[2]])||void 0===t?void 0:t.current)||(null===(i=ot.current[Number(_[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=st.current[_[3]])||void 0===o?void 0:o.current)||(null===(r=rt.current[Number(_[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=dt.current[v])||void 0===l?void 0:l.current)||null,x=(null===(c=ot.current[v])||void 0===c?void 0:c.current)||null,h=(null===(a=ct.current[f])||void 0===a?void 0:a.current)||null,m=(null===(s=rt.current[f])||void 0===s?void 0:s.current)||null;if(p&&h&&x&&m){if(x.style.paddingTop="0px",m.style.paddingTop="0px",!he){var R=p.getBoundingClientRect(),b=h.getBoundingClientRect(),S=R.top-b.top;S>0?m.style.paddingTop="".concat(S,"px"):S<0&&(x.style.paddingTop="".concat(Math.abs(S),"px"))}var A=_n.current,I=gn.current;if(A&&I){var E=p.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,T=h.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop-(E-A.scrollTop);Math.abs(I.scrollTop-T)>1&&(I.scrollTop=T)}}}null===(d=ln.current)||void 0===d||d.call(ln),on.current&&je(!0)}catch(e){console.error("Safely caught error during resize calculation:",e)}finally{Me(!1),ui.current=null}},150)},[he,Un,Xn]),si=t.useCallback(function(e){if(null!==Rn.current&&bn.current&&Math.abs(e.currentTarget.scrollTop-Rn.current)<=2){var n=bn.current;Rn.current=null,bn.current=null,n()}He.current||(he||ci(),tn.current||(tn.current=!0,requestAnimationFrame(function(){var e,n,t,i,o,r,l;if(on.current){var c=_n.current,a=gn.current;if(c&&a&&Gt.current){if(!Xe.current){var s=rn.current,d=void 0;if("string"==typeof s&&s.includes(u.DEVIATION_BADGE_SEPARATOR)){var v=s.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(v[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(v[1]);d=null===(e=lt.current[f])||void 0===e?void 0:e.current}else d=null===(n=lt.current[s])||void 0===n?void 0:n.current;if(d){var g=d.getBoundingClientRect();Xe.current={badgeScreenY:g.top+g.height/2,initialScrollTop:c.scrollTop,leftTop:c.getBoundingClientRect().top,leftBottom:c.getBoundingClientRect().top+c.clientHeight,cTop:null!==(i=null===(t=Vt.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Xe.current){var p=Xe.current,h=c.scrollTop-p.initialScrollTop,x=p.badgeScreenY-h,m=((o=x,r=p.leftTop,l=p.leftBottom,Math.max(r,Math.min(l,o)))-p.cTop).toString(),_=x>=p.leftTop-4&&x<=p.leftBottom+4;Gt.current.setAttribute("y1",m),Gt.current.setAttribute("y2",m),Gt.current.setAttribute("visibility",_?"visible":"hidden")}}}nn.current.length>0&&ri(),tn.current=!1})))},[ri,he,ci]),di=t.useRef(0),vi=t.useRef(0),fi=t.useRef(0),gi=t.useRef(function(){});t.useRef(null),t.useEffect(function(){gi.current=ai},[ai]),t.useEffect(function(){var e=setTimeout(ci,250),n=function(){return gi.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==li.current&&clearTimeout(li.current),null!==ui.current&&clearTimeout(ui.current),window.removeEventListener("resize",n)}},[Wn,Yn,pt,$n,Tt,Ct,Un,Xn,kn,ci,Ce,Le,Ne,Ge]),t.useEffect(function(){var e=function(e,n,t,i,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,i())}})});return r.observe(e),r},n={current:null},t={current:null},i={current:null},o=[],r=[n,t,i];return fn.current&&o.push(e(fn.current,di,n,function(){return gi.current()},function(){})),vn.current&&o.push(e(vn.current,vi,t,function(){return gi.current()},function(){return ln.current()})),Vt.current&&o.push(e(Vt.current,fi,i,function(){return gi.current()},function(){return ln.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),t.useEffect(function(){on.current=Ce},[Ce]),t.useEffect(function(){rn.current=Le},[Le]);var pi=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";Mn(),null!=e&&(n?Te("No counterpart exists for this section."):(bt(),Ce&&Le===e?r?St():null==l||l():(ze(new Set([e])),Ye([]),nn.current=[],Ae(!0),He.current=!0,Ve(e),rn.current=e,De(!0),on.current=!0,je(!1),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var f=e.split(u.DEVIATION_BADGE_SEPARATOR),g="".concat(f[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f[1]);s=(null===(n=lt.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=ut.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=dt.current[e])||void 0===i?void 0:i.current)||null,he){var p=Un[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],m=Xn.findIndex(function(e){return e.selfIndex===x});-1!==m&&(d=(null===(r=ct.current[m])||void 0===r?void 0:r.current)||null,v=m)}}else d=(null===(o=ct.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;qt.current=v;var _=_n.current,y=gn.current,R=function(){!function(){var n,t,i,o,r,l,c,s,d,f,g,p,h=null,x=null,m=null,_=null;if(a){var y=e.split(u.DEVIATION_BADGE_SEPARATOR),R="".concat(y[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(y[1]);h=(null===(n=at.current[y[2]])||void 0===n?void 0:n.current)||(null===(t=ot.current[Number(y[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=st.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=rt.current[Number(y[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=lt.current[R])||void 0===r?void 0:r.current)||h,_=(null===(l=ut.current[R])||void 0===l?void 0:l.current)||x}else{var b=Number(e),S=null!==v?Number(v):b;h=(null===(c=ot.current[b])||void 0===c?void 0:c.current)||null,x=(null===(s=rt.current[S])||void 0===s?void 0:s.current)||null,m=(null===(d=lt.current[b])||void 0===d?void 0:d.current)||(null===(f=dt.current[b])||void 0===f?void 0:f.current)||h,_=(null===(g=ut.current[S])||void 0===g?void 0:g.current)||(null===(p=ct.current[S])||void 0===p?void 0:p.current)||x}if(m&&_&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var A=m.getBoundingClientRect(),I=_.getBoundingClientRect(),E=A.top-I.top;E>0?x.style.paddingTop="".concat(E,"px"):E<0&&(h.style.paddingTop="".concat(Math.abs(E),"px"))}}(),je(!0),ln.current&&ln.current(),He.current=!1,"right"===c&&y?y.dispatchEvent(new Event("scroll")):_&&_.dispatchEvent(new Event("scroll")),Ae(!1),null==l||l()};if(!s||!_)return He.current=!1,Ae(!1),void(null==l||l());if(d&&y){if(!he){var b=0;b="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var S=vn.current,A=(null==S?void 0:S.getBoundingClientRect().top)||0,I=S?S.scrollTop+b-A-150:0;return S?void u.smoothScrollTo(S,I,200,R):void R()}var E=s.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,T=d.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,B=200;if("left"===c){var C=T-(E-_.scrollTop);C<0&&pn.current&&(pn.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=y.scrollHeight-y.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return hn.current&&(hn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(y,C,B,R)})}e=C}u.smoothScrollTo(y,e,B,R)})}else{var D=E-(T-y.scrollTop);D<0&&xn.current&&(xn.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return mn.current&&(mn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,D,B,R)})}e=D}u.smoothScrollTo(_,e,B,R)})}}else R()}))))},[Le,Mn,Xn,Ce,he,Un,St]),hi=t.useCallback(function(e,n,t,i,o){var r,l="string"==typeof i?u.safeStringify(i).trim():u.safeStringify(null==i?void 0:i.deviation_summary).trim(),c=e.currentTarget;Fn();var a="left";(null===(r=gn.current)||void 0===r?void 0:r.contains(c))&&(a="right");var s=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"===a?null===(e=ut.current[l])||void 0===e?void 0:e.current:null===(t=lt.current[l])||void 0===t?void 0:t.current}return"right"===a?null===(i=ut.current[n])||void 0===i?void 0:i.current:null===(o=lt.current[n])||void 0===o?void 0:o.current};if(t)return St(),ze(new Set),Ye([]),nn.current=[],void(l&&requestAnimationFrame(function(){var e=s()||c;wn({open:!0,anchorEl:e,summary:i,displayImpact:o})}));pi(n,t,l?{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=s()||c;wn({open:!0,anchorEl:e,summary:i,displayImpact:o})}}:{toggleIfSame:!1,sourceSide:a})},[pi,Fn,wn,St]),xi=t.useCallback(function(){var e,n=En.sectionIdx,t=En.isOrphan;if(Nn(),null!=n){var i="left";En.anchorEl&&(null===(e=gn.current)||void 0===e?void 0:e.contains(En.anchorEl))&&(i="right"),pi(n,t,{sourceSide:i})}},[pi,En.isOrphan,En.sectionIdx,En.anchorEl,Nn]),mi=t.useCallback(function(){Nn(),St(),ze(new Set),Ye([]),nn.current=[]},[Nn,St]),_i=null!==En.sectionIdx&&Ge.has(En.sectionIdx),yi=m.useDeviationNavigation({proposedSections:Un,existingSections:Xn,parentDeviationRecord:Jn,expandedSections:Tt,maintainRelativeOrder:!!he,scrollContainerRef:vn,leftContainerRef:_n,lhsBadgeRefs:lt,rhsBadgeRefs:ut}),Ri=yi.showDeviationNavigation,bi=yi.showOpenNodeRef,Si=t.useMemo(function(){var e;if(!se)return null;var n=null===(e=null==se?void 0:se.id)||void 0===e?void 0:e.split(":")[0];for(var t in Jn){if((Jn[t]||[]).some(function(e){return e.id===n}))return t}return null},[se,Jn]),Ai=t.useRef({id:null,triggerMs:null}),Ii=t.useRef(null);t.useEffect(function(){var n;if(null==se?void 0:se.id){var t=Number(se.trigger),i=Ai.current;if((null==i?void 0:i.triggerMs)!==t){if(!(se.id.includes(":")&&/:\d+$/.test(se.id)))return Ai.current={id:se.id,triggerMs:t},void kt(se.id);var o=null===(n=null==se?void 0:se.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],c=null!=l?l:"0";Ii.current!==se.id&&(Nn(),Fn(),St(),ze(new Set),Ye([]),nn.current=[],Ii.current=se.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},g=function(){var n,i,o,l;if(!a){var p=function(){Ai.current={id:se.id,triggerMs:t}},h=null,x=null;for(var m in Jn){var _=Jn[m].find(function(e){return e.id===r});if(_){h=m,x=_;break}}if(x&&h){var y=Un.findIndex(function(e){return e.id===h}),R=Xn.findIndex(function(e){return e.id===h}),b=-1===y&&-1!==R,S=f(Un,x.id),A=f(Xn,x.id);if(S&&!A&&!b){var I=S.split("-"),E=Number(I[0]);if(he){var T=null===(i=null===(n=Un[E])||void 0===n?void 0:n.refIndexes)||void 0===i?void 0:i[0],B=Xn.findIndex(function(e){return e.selfIndex===T});-1!==B&&(E=B)}A=e.__spreadArray([E],I.slice(1),!0).join("-")}if(S||A){var C=b||!S&&!!A,D=S?Number(S.split("-")[0]):y,O=A?Number(A.split("-")[0]):R;if(C){if(!(he?!!Tt["right-".concat(O)]:!!Tt[String(O)])&&O>=0)return Ot(O,"right"),s+=1,void(d=setTimeout(g,450))}else if(!(he?!!Tt["left-".concat(D)]:!!Tt[String(D)])&&D>=0)return Ot(D,"left"),s+=1,void(d=setTimeout(g,450));var w,N=S||"",j=A||"",P="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(N).concat(u.DEVIATION_BADGE_SEPARATOR).concat(j),F="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c),M=null===(o=lt.current[F])||void 0===o?void 0:o.current,k=null===(l=ut.current[F])||void 0===l?void 0:l.current,L=C||!M&&!!k,V=L?k:M;if(w=he?L?gn.current:_n.current:vn.current,V&&w){var H=V.getBoundingClientRect();if(0===H.height)return void((s+=1)<2?d=setTimeout(g,v):p());var q=w.getBoundingClientRect(),G=H.top-q.top+w.scrollTop-q.height/2+H.height/2+150,z=function(){var n,t,i,o,r;if(!a){p();var l=V instanceof Element?window.getComputedStyle(V).color:"";M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(l)),k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){M&&(M.style.boxShadow=""),k&&(k.style.boxShadow="")},2e3);var u=(null===(t=null===(n=x.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[c])||x,s=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!M&&!!k)){var d=L?(null===(o=ut.current[F])||void 0===o?void 0:o.current)||k:(null===(r=lt.current[F])||void 0===r?void 0:r.current)||M;return wn({open:!0,anchorEl:d,displayImpact:se.displayImpact,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})}),void(null==de||de())}pi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t=(null===(n=lt.current[F])||void 0===n?void 0:n.current)||M;console.log("Summary data",s,u),wn({open:!0,anchorEl:t,displayImpact:null==se?void 0:se.displayImpact,summary:e.__assign({},u)})}})}};Math.abs(w.scrollTop-G)<=2?z():(Rn.current=G,bn.current=z,w.scrollTo({top:G,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(bn.current){Rn.current=null;var e=bn.current;bn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}};return d=setTimeout(g,v),function(){a=!0,d&&clearTimeout(d)}}}},[se,Jn,Un,Xn,he,Tt,Ot,pi,wn,kt]);var Ei=function(e){var t=e.section,i=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c;return n.jsx(R.default,{section:t,keyPath:i,depth:r,columnKey:u,parentNodeId:a,expandedSubSections:Ct,setExpandedSubSections:Dt,maintainRelativeOrder:he||!1,proposedSections:Un,existingSections:Xn,treeData:Z,deviationNumberRegistry:Qn,connectedSections:Ge,activeSideBySideSection:Le,resolvedMarkdownStyles:dn,getSubSectionRef:ft,getSubSectionCompareStyle:ei,getBadgeRef:gt,openMoreFunctionsPopup:jt,openSummaryPopup:hi,showDeviationBadges:me,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:nn,isProposingFix:fe,proposingFixNodeId:ge})};return n.jsxs(i.Box,e.__assign({ref:fn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},he?{}:{overflow:"visible"}),{position:"relative"})},{children:[ye&&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,{})})),On.open&&n.jsx(b.default,{open:On.open,anchorEl:On.anchorEl,containerEl:Ht.current,clipTopEl:zt.current,scrollContainerEl:vn.current,onClose:mi,summary:On.summary,displayImpact:On.displayImpact}),n.jsx(d.default,{open:En.open,anchorEl:En.anchorEl,sectionTitle:En.sectionTitle,referenceSectionTitle:En.refSectionTitle,onClose:Mn,onOpenCognitiveCompare:Pt,onOpenSideBySide:xi,onConnect:Ft,isConnected:_i,isOrphan:En.isOrphan}),An.open&&n.jsx(s.default,{open:An.open,popupRef:Pn,position:Bn,popupConfig:ue,onClose:function(){Cn(null),In(function(n){return e.__assign(e.__assign({},n),{open:!1})}),jn(null)},markdownStyles:ie,sectionTitle:An.sectionTitle,referenceSectionTitle:An.refSectionTitle,cognitiveData:An.cognitiveData,anchorEl:An.anchorEl,sectionAnchorEl:An.sectionAnchorEl,scrollContainerEl:vn.current,badgeStyle:An.badgeStyle,docData:An.docData,deviationData:An.deviationData,isLoading:An.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Ee,autoHideDuration:8e3,onClose:function(){return Te(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Te(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ee}))})),n.jsx(_.default,{componentHeaderText:Q,displayConfig:le,maintainRelativeOrder:he,onCollapseAll:ti,showCollapseAll:ii,onToggleView:function(e){Re(!0),setTimeout(function(){xe(!e),St(),Nn(),ze(new Set),Ye([]),nn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Re(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:vn,onScroll:si,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:he?"hidden":"auto",borderTop:ht&&xt?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},he?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Vt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ue,style:{position:"absolute",top:0,left:0,width:an.width||"100%",height:an.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Fe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[$t&&n.jsx("g",{children:n.jsx("line",{x1:$t.x1,y1:$t.y,x2:$t.x2,y2:$t.y,stroke:Rt.badgeBorder,strokeWidth:"1.5"})}),Yt.map(function(t){var l,c,s,d,v,g,p=t.x1+.5*(t.x2-t.x1),h=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?Ce&&Le===t.subSectionKeyPath&&Ne:Ce&&Le===t.sectionIdx&&Ne)return null;if(!he){var x=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),m=Un[t.sectionIdx]||{title:"",content:""},_=Xn[t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",m,_),t.isSubSection&&t.subSectionKeyPath){var y=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],R=y[2]||t.subSectionKeyPath,b=y[3]||R,S=R.split("-").map(Number),A=b.split("-").map(Number),I=null,E=null;S.length>0&&(I=Un[S[0]]),A.length>0&&(E=Xn[A[0]]);var T=(null==I?void 0:I.title)||"",B=(null==E?void 0:E.title)||"";console.log("Root Parent Titles:",T,B);for(var C=1;C<S.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[S[C]]);for(C=1;C<A.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[A[C]]);I&&(m=e.__assign(e.__assign({},I),{title:T||I.title})),console.log("Base Section for Subsection Badge:",m),E&&(_=e.__assign(e.__assign({},E),{title:B||E.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&&(An.open&&Dn===t.id?Fn():(jn(t.id),Nt(wt(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:An.open&&Dn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),n.jsx(S.default,{connectedLines:We,pathRefs:en})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:zt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(i.Tooltip,e.__assign({title:Gn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Gn}))}))})),n.jsxs(i.Box,e.__assign({ref:_n,onScroll:si,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:xn,style:{width:"100%",height:"0px",flexShrink:0}}),et&&Un.map(function(t,r){var l,c,a=!t.title&&!t.content;if(he&&a)return null;var s=t,d=Zt(r,"left"),v=he?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Xn[r],g=he?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ge.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:vt(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:ot.current[r],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(y.default,{section:t,idx:r,columnKey:"left",colRef:vt("left-accordion-".concat(r)),mb:0,treeData:Z,proposedSections:Un,existingSections:Xn,deviationNumberRegistry:Qn,getSectionCompareStyle:Zt,getBadgeRef:gt,connectedSections:Ge,openMoreFunctionsPopup:jt,openSummaryPopup:hi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,parentNodeId:(null===(c=null==Z?void 0:Z.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:he?!!Tt["left-".concat(r)]:!!Tt[String(r)],onToggle:function(){mi(),Ot(r,"left")},navigation:t.id?Ri[t.id]:null,showOpenNodeRef:bi,resolvedMarkdownStyles:dn,maintainRelativeOrder:he,showDeviationBadges:me,renderSubSections:Ei,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Le?Le:""))})})),he&&d&&n.jsxs(i.Box,e.__assign({ref:lt.current[r],onClick:function(e){var n,t,i,o=le.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;hi(e,String(r),v,o)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=le.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;hi(e,String(r),v,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:v?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":v?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=g&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:g})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!le.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(f.default,{color:d.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=he?Xn.find(function(e){var n;return(null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e))||{title:"",content:""}}):Xn[r]||{title:"",content:""};jt(e,t,v,n,r,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:mn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:Ht,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(),An.open&&Dn===mt?Fn():(jn(mt),Nt(wt(n.currentTarget,{title:"",content:"",evaluationResult:_t,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,mt,!0,e.__assign(e.__assign({},Rt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Rt.badgeBg,color:Rt.badgeText,border:"1px solid ".concat(Rt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=yt?yt: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:An.open&&Dn===mt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},he?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Se&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Kt,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:zn,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:zn}))}))})),n.jsxs(i.Box,e.__assign({ref:gn,onScroll:si,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}}),et&&Xn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(he){u=Un.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=Un.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=Un.findIndex(function(e,n){var t;return Ge.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Zt(d))}else u=[o+1],(c=Ge.has(o))&&(a=Zt(o));var v=Zt(he&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:ct.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:rt.current[o],sx:e.__assign({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(y.default,{section:t,idx:o,columnKey:"right",colRef:vt("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Z?void 0:Z.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:he?!!Tt["right-".concat(o)]:!!Tt[String(o)],treeData:Z,proposedSections:Un,existingSections:Xn,deviationNumberRegistry:Qn,getBadgeRef:gt,getSectionCompareStyle:Zt,connectedSections:Ge,openMoreFunctionsPopup:jt,openSummaryPopup:hi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,onToggle:function(){mi(),Ot(o,"right")},navigation:t.id?Ri[t.id]:null,showOpenNodeRef:bi,resolvedMarkdownStyles:dn,maintainRelativeOrder:he,showDeviationBadges:me,renderSubSections:Ei,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Le?Le:""))})})),he&&v&&n.jsx(i.Box,e.__assign({ref:ut.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:hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.ARROW_SIZE=10,exports.DEFAULT_COMPONENT_HEADER_TEXT="Contract Comparison",exports.DEFAULT_DEVIAION_COLOR="#3730A3",exports.EMPTY_SECTION_POPUP_STATE={isLoading:!1,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},exports.EMPTY_SUMMARY_POPUP_STATE={open:!1,anchorEl:null,summary:"",markdownStyles:{}},exports.POPUP_GAP=12,exports.POPUP_WIDTH=680,exports.VIEWPORT_MARGIN=12;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.ARROW_SIZE=10,exports.DEFAULT_COMPONENT_HEADER_TEXT="Contract Comparison",exports.DEFAULT_DEVIAION_COLOR="#3730A3",exports.EMPTY_SECTION_POPUP_STATE={isLoading:!1,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},exports.EMPTY_SUMMARY_POPUP_STATE={open:!1,anchorEl:null,summary:"",markdownStyles:{},displayImpact:!1},exports.POPUP_GAP=12,exports.POPUP_WIDTH=680,exports.VIEWPORT_MARGIN=12;
|
|
2
2
|
//# sourceMappingURL=CognitiveCompareConstants.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("@mui/material"),i=require("lucide-react"),o=require("react");exports.default=function(r){var l,a,s,d=r.open,c=r.anchorEl,u=r.containerEl,p=r.clipTopEl,f=r.scrollContainerEl,x=r.onClose,m=r.summary;r.markdownStyles,r.isLoading;var h=o.useRef(null),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("@mui/material"),i=require("lucide-react"),o=require("react");exports.default=function(r){var l,a,s,d=r.open,c=r.anchorEl,u=r.containerEl,p=r.clipTopEl,f=r.scrollContainerEl,x=r.onClose,m=r.summary;r.markdownStyles,r.isLoading;var h=r.displayImpact,g=o.useRef(null),v=o.useRef(null),y=o.useState(null),b=y[0],_=y[1],w=o.useState(null),S=w[0],j=w[1],C=o.useState(null);C[0];var B=C[1],I=o.useState(0),R=I[0],z=I[1],E="string"==typeof m?{deviation_summary:m}:null!=m?m:{},F=E.deviation_title,W=E.deviation_summary,A=E.deviation_impact,T=E.evaluation_outputs,H=!!String(A||"").trim(),M=(null===(l=null==T?void 0:T.metadata)||void 0===l?void 0:l.label_color)||"#6366F1",P=null!==(a=null==u?void 0:u.getBoundingClientRect().width)&&void 0!==a?a:180,k=Math.max(148,P+120),q=o.useMemo(function(){if(!c||!u)return null;var e=c.getBoundingClientRect();if(0===e.width&&0===e.height)return null;var n=u.getBoundingClientRect();return{top:e.top,bottom:e.bottom,left:n.left+n.width/2}},[c,u]);o.useEffect(function(){if(!d||!c||!u)return _(null),j(null),void B(null);var e=function(){null!==g.current&&cancelAnimationFrame(g.current),g.current=requestAnimationFrame(function(){var e,n,t=c.getBoundingClientRect(),i=null==p?void 0:p.getBoundingClientRect(),o=null==f?void 0:f.getBoundingClientRect();if(0===t.width&&0===t.height)_(null);else{var r=u.getBoundingClientRect();_({top:t.top,bottom:t.bottom,left:r.left+r.width/2})}j(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null),B(null!==(n=null==o?void 0:o.bottom)&&void 0!==n?n:null),v.current&&z(v.current.offsetHeight)})};return e(),window.addEventListener("scroll",e,{passive:!0,capture:!0}),window.addEventListener("resize",e),function(){null!==g.current&&cancelAnimationFrame(g.current),window.removeEventListener("scroll",e,{capture:!0}),window.removeEventListener("resize",e)}},[d,c,u,p,f]);var L=null!==(s=null!=b?b:q)&&void 0!==s?s:"hidden",O="hidden"===L?"hidden":L.bottom+20,D=null!=S&&"number"==typeof O&&O<S?Math.min(R,S-O):0,N=o.useMemo(function(){return"hidden"===L?{getBoundingClientRect:function(){return{width:0,height:0,top:0,bottom:0,left:0,right:0,x:0,y:0,toJSON:function(){}}}}:{getBoundingClientRect:function(){return{width:0,height:L.bottom-L.top,top:L.top,bottom:L.bottom,left:L.left,right:L.left,x:L.left,y:L.top,toJSON:function(){}}}}},[L]);return m?n.jsx(t.Popper,e.__assign({open:d,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:N,placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}},{name:"preventOverflow",enabled:!0,options:{boundary:f||"clippingParents",tether:!1}},{name:"flip",enabled:!0,options:{boundary:f||"clippingParents",fallbackPlacements:["top"]}}],sx:{zIndex:21,visibility:"hidden"===L?"hidden":"visible",opacity:"hidden"===L?0:1,transition:"opacity 0.15s ease-in-out"}},{children:n.jsxs(t.Paper,e.__assign({ref:v,sx:e.__assign(e.__assign({p:1.5,borderRadius:"12px",width:k,maxWidth:k},D>0&&{clipPath:"inset(".concat(D,"px 0px 0px 0px round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(M,"26"),borderTop:"3px solid ".concat(M),overflow:"hidden",bgcolor:"#fff"})},{children:[n.jsxs(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[n.jsxs(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[n.jsx(i.Info,{size:14,color:M}),n.jsx(t.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:700,color:M,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),n.jsx(t.IconButton,e.__assign({size:"small",onClick:x,sx:{p:.25,ml:.5,color:"#64748B"}},{children:n.jsx(i.X,{size:14})}))]})),n.jsxs(t.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:1.5,maxHeight:"300px",overflowY:"auto",pr:.5}},{children:[n.jsxs(t.Box,{children:[F&&n.jsx(t.Typography,e.__assign({sx:{fontSize:"12px",color:"#334155",fontFamily:'"Inter", sans-serif',lineHeight:1.6,fontWeight:700,overflowWrap:"anywhere"}},{children:F})),n.jsx(t.Typography,e.__assign({sx:{fontSize:"11px",color:"#334155",lineHeight:1.6,fontFamily:'"Inter", sans-serif',fontWeight:400,overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:W||"No summary available."}))]}),H&&n.jsxs(t.Accordion,e.__assign({expanded:h,disableGutters:!0,elevation:0,sx:{backgroundColor:"".concat(M,"0A"),border:"1px solid ".concat(M,"33"),borderRadius:"4px",fontFamily:'"Inter", sans-serif',overflow:"hidden",flexShrink:0,"&:before":{display:"none"},"&.Mui-expanded":{margin:0}}},{children:[n.jsx(t.AccordionSummary,e.__assign({expandIcon:n.jsx(i.ChevronDown,{size:16,color:M}),sx:{minHeight:"10px",px:1.5,"& .MuiAccordionSummary-content":{py:"5px",my:0},"&.Mui-expanded":{minHeight:"10px",borderBottom:"1px solid ".concat(M,"1A")}}},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:700,color:M,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.5px"}},{children:"Impact"}))})),n.jsx(t.AccordionDetails,e.__assign({sx:{p:1.5,backgroundColor:"#fff"}},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"11px",color:"#475569",lineHeight:1.6,fontWeight:400,fontFamily:'"Inter", sans-serif',overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:String(A).replace("Impact -","").trim()}))}))]}))]}))]}))})):null};
|
|
2
2
|
//# sourceMappingURL=CognitiveSummaryPopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@react-pdf-viewer/core"),o=require("./PdfContainer.js"),r=require("./PdfToolbar.js"),n=require("./PdfStyle.js"),a=require("./usePdfHighlight.js");require("@react-pdf-viewer/zoom/lib/styles/index.css"),require("@react-pdf-viewer/page-navigation/lib/styles/index.css"),require("@react-pdf-viewer/core/lib/styles/index.css"),require("@react-pdf-viewer/search/lib/styles/index.css");var s=require("react"),l=require("../ScannedDocCitation/ScannedDocCitation.js"),u=function(e){switch(e){case"ActualSize":return t.SpecialZoomLevel.ActualSize;case"PageFit":return t.SpecialZoomLevel.PageFit;case"PageWidth":return t.SpecialZoomLevel.PageWidth;default:return null!=e?e:t.SpecialZoomLevel.PageWidth}};exports.default=function(c){var d,g=c.pdfUrl,f=c.highlightText,h=c.highlightPages,v=c.highlightCordinatePages,p=c.highlightColor,m=void 0===p?"yellow":p,x=c.activeHighlightColor,S=void 0===x?"#f7dc51":x,C=c.jumpToPageValue,P=void 0===C?0:C,_=c.pdfName,w=c.onClose,T=c.customStyles,y=c.customClasses,b=c.customIcons,A=c.useCoordinates,q=c.fallbackPages,j=c.activeCitationIndex,H=c.onActiveCitationChange,I=c.headerAction,F=c.isZoomEnabled,Z=void 0===F||F,L=c.showHighlightsAction,z=void 0===L||L,N=c.defaultScale,R=void 0===N?t.SpecialZoomLevel.ActualSize:N,E=c.useRange,V=void 0!==E&&E,W=c.rangeOfPages,D=void 0===W?null:W,O=c.showFullScreenAction,B=void 0===O||O,U=s.useRef(null),k=s.useMemo(function(){if(A)return new Set(v.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(h).forEach(function(i){i>0&&e.add(i-1)}),e},[h]),M=(d=f)&&0!==d.length?d.filter(function(e){return!d.some(function(i){return i!==e&&i.includes(e)})}):d,J=a.PdfHighlightControls(M,A?{}:h,U,k,A,A?v:[],m,S),K=J.highlightIndex,G=J.cursorIndex,Q=J.setCursorIndex,X=J.orderedKeys,Y=J.totalHighlights,$=J.getValidPosition,ee=J.tryJump,ie=J.jumpToPage,te=J.zoomTo,oe=J.plugins,re=J.controls,ne=J.hideNonTargetHighlights,ae=J.deduplicateHighlights,se=$(G);s.useEffect(function(){void 0!==j&&j!==G&&Q(j)},[j]);var le=e.__assign(e.__assign({},re),{goToNext:function(){re.goToNext(),H&&H(G+1)},goToPrevious:function(){re.goToPrevious(),H&&H(G-1)}});if(!g)return i.jsx(l.default,{pages:q,activeCitationIndex:j,onActiveCitationChange:H,headerAction:I});return i.jsxs("div",e.__assign({ref:U,className:(null==y?void 0:y.pdfViewerWrapper)||"",style:e.__assign(e.__assign(e.__assign({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},n.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==T?void 0:T.pdfViewer)},{children:[i.jsx(r.default,{highlightIndex:K,totalHighlights:Y,controls:le,currentPosition:se,pdfName:_,onClose:w,pdfUrl:g,viewerRef:U,customStyles:T,customClasses:y,customIcons:b,headerAction:I,isZoomEnabled:Z,showHighlightsAction:z,showFullScreenAction:B}),i.jsx(o.default,{defaultScale:u(R),pdfUrl:g,plugins:oe,customStyles:T,onLoad:function(){if(te(t.SpecialZoomLevel.ActualSize),P>0&&!V){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@react-pdf-viewer/core"),o=require("./PdfContainer.js"),r=require("./PdfToolbar.js"),n=require("./PdfStyle.js"),a=require("./usePdfHighlight.js");require("@react-pdf-viewer/zoom/lib/styles/index.css"),require("@react-pdf-viewer/page-navigation/lib/styles/index.css"),require("@react-pdf-viewer/core/lib/styles/index.css"),require("@react-pdf-viewer/search/lib/styles/index.css");var s=require("react"),l=require("../ScannedDocCitation/ScannedDocCitation.js"),u=function(e){switch(e){case"ActualSize":return t.SpecialZoomLevel.ActualSize;case"PageFit":return t.SpecialZoomLevel.PageFit;case"PageWidth":return t.SpecialZoomLevel.PageWidth;default:return null!=e?e:t.SpecialZoomLevel.PageWidth}};exports.default=function(c){var d,g=c.pdfUrl,f=c.highlightText,h=c.highlightPages,v=c.highlightCordinatePages,p=c.highlightColor,m=void 0===p?"yellow":p,x=c.activeHighlightColor,S=void 0===x?"#f7dc51":x,C=c.jumpToPageValue,P=void 0===C?0:C,_=c.pdfName,w=c.onClose,T=c.customStyles,y=c.customClasses,b=c.customIcons,A=c.useCoordinates,q=c.fallbackPages,j=c.activeCitationIndex,H=c.onActiveCitationChange,I=c.headerAction,F=c.isZoomEnabled,Z=void 0===F||F,L=c.showHighlightsAction,z=void 0===L||L,N=c.defaultScale,R=void 0===N?t.SpecialZoomLevel.ActualSize:N,E=c.useRange,V=void 0!==E&&E,W=c.rangeOfPages,D=void 0===W?null:W,O=c.showFullScreenAction,B=void 0===O||O,U=s.useRef(null),k=s.useMemo(function(){if(A)return new Set(v.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(h).forEach(function(i){i>0&&e.add(i-1)}),e},[h]),M=(d=f)&&0!==d.length?d.filter(function(e){return!d.some(function(i){return i!==e&&i.includes(e)})}):d,J=a.PdfHighlightControls(M,A?{}:h,U,k,A,A?v:[],m,S),K=J.highlightIndex,G=J.cursorIndex,Q=J.setCursorIndex,X=J.orderedKeys,Y=J.totalHighlights,$=J.getValidPosition,ee=J.tryJump,ie=J.jumpToPage,te=J.zoomTo,oe=J.plugins,re=J.controls,ne=J.hideNonTargetHighlights,ae=J.deduplicateHighlights,se=$(G);s.useEffect(function(){void 0!==j&&j!==G&&Q(j)},[j]);var le=e.__assign(e.__assign({},re),{goToNext:function(){re.goToNext(),H&&H(G+1)},goToPrevious:function(){re.goToPrevious(),H&&H(G-1)}});if(!g)return i.jsx(l.default,{pages:q,activeCitationIndex:j,onActiveCitationChange:H,headerAction:I});return i.jsxs("div",e.__assign({ref:U,className:(null==y?void 0:y.pdfViewerWrapper)||"",style:e.__assign(e.__assign(e.__assign({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},n.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==T?void 0:T.pdfViewer)},{children:[i.jsx(r.default,{highlightIndex:K,totalHighlights:Y,controls:le,currentPosition:se,pdfName:_,onClose:w,pdfUrl:g,viewerRef:U,customStyles:T,customClasses:y,customIcons:b,headerAction:I,isZoomEnabled:Z,showHighlightsAction:z,showFullScreenAction:B}),i.jsx(o.default,{defaultScale:u(R),pdfUrl:g,plugins:oe,customStyles:T,onLoad:function(){var i=!A&&!V&&P<=0;if(te(t.SpecialZoomLevel.ActualSize),P>0&&!V){var o=P-1,r=X[o],n=h[r],a=v[o];Q(o),console.log(a,"cordinateTargetHighlight"),A&&a.pageIndex>0&&ie(a.pageIndex),n>0&&(setTimeout(function(){ne(k),ae(n-1)},1e3),A||ie(n-1))}else if(V&&D&&2===D.length){e.__awaiter(void 0,void 0,void 0,function(){var i,t,o,r,n;return e.__generator(this,function(e){switch(e.label){case 0:i=D[0],t=D[1],o=i,e.label=1;case 1:return o<=t?(ie(r=o-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(e.sent(),ne(k),(n=ae(r))&&n>0)return[3,4];e.label=3;case 3:return o++,[3,1];case 4:return[2]}})})}else if(!A&&h){var s=X.find(function(e){return h[e]>0});if(void 0!==s){var l=h[s]-1;ie(l),setTimeout(function(){ne(k),ae(l)},1e3)}}requestAnimationFrame(function(){i&&ee(),!A&&P>0&&!V&&function(){if(U.current){var e=P-1,i=X[e],t=h[i],o=t>0?t-1:0,r={};X.forEach(function(e,i){var t=h[e];t>0&&(r[t]||(r[t]=[]),r[t].push(i))});var n=(r[t]||[]).indexOf(e),a=0,s=function(){var e,i;if(!(++a>40)){var t=null===(e=U.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(t){var r=null===(i=U.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(o,'"]'));if(r){var l=t.getBoundingClientRect(),u=r.getBoundingClientRect();if(u.top<l.bottom&&u.bottom>l.top){var c=r.querySelectorAll(".rpv-search__highlight")[n];if(c){var d=c.getBoundingClientRect(),g=t.scrollTop+(d.top-l.top)-t.clientHeight/2+d.height/2;t.scrollTo({top:g,behavior:"smooth"})}else setTimeout(s,100)}else setTimeout(s,100)}else setTimeout(s,100)}else setTimeout(s,100)}};setTimeout(s,500)}}()})},onPageChange:function(e){var i=e.currentPage;k.has(i)?(ae(i),ne(k)):ne(k)}})]}))};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),n=require("@react-pdf-viewer/search"),o=require("@react-pdf-viewer/page-navigation"),i=require("@react-pdf-viewer/zoom"),a=require("@react-pdf-viewer/highlight");exports.PdfHighlightControls=function(l,u,c,s,p,g,f,h){void 0===f&&(f="yellow"),void 0===h&&(h="#F6D739");var v=r.useState(0),d=v[0],m=v[1],T=r.useRef(!1),y=r.useState(0),x=y[0],_=y[1];r.useRef([]);var b=function(e){if(!e)return[];return e.replace(/\\(['’])/g,"$1").replace(/\]\s*\n\s*\(/g,"](").split(/\n+/).map(function(e){var t=e.trim(),r=(t=(t=t.replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\u00A0\u2009\u202F]/g," ")).replace(/^[-•]\s+/,"")).match(/^((\d+(?:\.\d+)*[.)]?)|[A-Za-z][.)]|\([A-Za-z0-9]+\)|(?:i|ii|iii|iv|v|vi|vii|viii|ix|x)[.)])\s*/i);return r?t.slice(r[0].length).trim():t}).flatMap(function(e){var t=e.match(/^\s*\|(.+)\|\s*$/);return t?t[1].split("|").map(function(e){return e.trim()}).filter(Boolean):[e]}).map(function(e){return e.replace(/&[#\w]+;/g,function(e){return t=e,(r=document.createElement("textarea")).innerHTML=t,r.value;var t,r}).replace(/<br\s*\/?>/gi,"\n").replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/[^\S\n]+/g," ").trim()}).flatMap(function(e){return e.split(/\n+/)}).flatMap(function(e){for(var t,r=[],n=/([*_]{1,3})([^*_]+)\1|([*_]{1,3})/g,o=0;null!==(t=n.exec(e));){var i=e.slice(o,t.index).trim();i&&r.push(i),t[2]&&r.push(t[2].trim()),o=t.index+t[0].length}var a=e.slice(o).trim();return a&&r.push(a),r.flatMap(function(e){return e.split(/[\u2013\u2014-]/g)}).flatMap(function(e){return e.split(/\n+/)}).map(function(e){return e.replace(/[*_]+/g,"").replace(/`([^`]+)`/g,"$1").replace(/[^\S\n]+/g," ").trim()})})},I=Object.keys(u).map(Number).sort(function(e,t){return e-t}),q=r.useMemo(function(){return p?g.length:p?0:Object.values(u).filter(function(e){return e>0}).length},[g,u]),S=function(e){if(c.current){var t=c.current.querySelector('[data-testid="search__highlights-'.concat(e,'"]'));if(t){var r=Array.from(t.querySelectorAll(".rpv-search__highlight")),n=function(e){return(e||"").toLowerCase().replace(/[^\w\s]/g,"").replace(/\s+/g," ").trim()},o=M.map(n).filter(Boolean);if(0!==o.length){var i=[],a=null;r.forEach(function(e){var t=n(e.getAttribute("title")||e.textContent||""),r=parseFloat(e.style.top||"0");a?a.title===t&&Math.abs(a.lastTop-r)<=3?(a.elements.push(e),a.lastTop=r):(i.push(a),a={title:t,elements:[e],lastTop:r}):a={title:t,elements:[e],lastTop:r}}),a&&i.push(a);for(var u=0,s=new Set,p=0;p<i.length;p++)for(var g=i[p].title,f=0;f<o.length;f++)if(o[f]===g){for(var h=0,v=new Set,d=f,m=p-1,T=p;T<i.length&&d<o.length;T++){if(i[T].title===o[d]){if(m>=0){var y=i[m].lastTop,x=parseFloat(i[T].elements[0].style.top||"0");if(Math.abs(x-y)>15)break}h++,v.add(T),m=T,d++}else if(d>0&&i[T].title===o[d-1]){y=i[m].lastTop,x=parseFloat(i[T].elements[0].style.top||"0");Math.abs(x-y)<=3&&(v.add(T),m=T)}if(T-m>4)break}h>u&&(u=h,s=v)}return i.forEach(function(e,t){var r=s.has(t);e.elements.forEach(function(e){r?(e.classList.add("verified-match"),e.style.display=""):(e.style.display="none",e.classList.remove("verified-match"))})}),console.groupCollapsed("[debug: PDF ordered matching - Page ".concat(e,"]")),console.log("input->",l),console.log("processed text->",M),console.log("Expected sequence length:",o.length),console.log("Matched ordered sequence length:",u),console.log("blocksToKeep",s,"size",s.size),console.groupEnd(),s.size}}}},w=function(e){c.current&&c.current.querySelectorAll(".rpv-search__highlights").forEach(function(t){var r=t.getAttribute("data-testid"),n=parseInt((null==r?void 0:r.replace(/search__highlights-/g,""))||"-1"),o=t.querySelectorAll(".rpv-search__highlight");e.has(n)||o.forEach(function(e){e.style.display="none"})})},M=l.map(function(e){return b(e)}).flat(),P=n.searchPlugin({keyword:M}),j=o.pageNavigationPlugin(),B=i.zoomPlugin(),C=P.jumpToMatch,A=j.jumpToPage,F=B.zoomTo,E=B.ZoomInButton,k=B.ZoomOutButton,z=B.ZoomPopover,H=a.highlightPlugin({renderHighlights:function(r){return t.jsx(t.Fragment,{children:g.map(function(t,r){return e.__assign(e.__assign({},t),{originalIndex:r})}).filter(function(e){return e.pageNumber?e.pageNumber-1===r.pageIndex:e.pageIndex===r.pageIndex}).map(function(e){var r=e.originalIndex,n=r===x;return t.jsx("div",{style:{position:"absolute",left:"".concat(e.left,"%"),top:"".concat(e.top,"%"),width:"".concat(e.width,"%"),height:"".concat(e.height,"%"),background:n?h:f,opacity:n?.7:.4,transition:"background 0.2s, opacity 0.2s"}},r)})})}}),O=function(){if(!T.current)try{C(0),T.current=!0;var e=g[0];e&&p&&Z(e.pageIndex,e.top)}catch(e){requestAnimationFrame(O)}},R=function(e,t){if(c.current&&c.current.querySelector(".rpv-core__viewer")){var r=-1,n=function(){var o,i,a=null===(o=c.current)||void 0===o?void 0:o.querySelector(".rpv-core__inner-pages");if(a){if(a.scrollTop!==r)return r=a.scrollTop,void setTimeout(n,100);var l=null===(i=c.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(l){var u=l.querySelectorAll(".rpv-search__highlight")[t];if(u){var s=a.getBoundingClientRect(),p=u.getBoundingClientRect(),g=a.scrollTop+(p.top-s.top)-a.clientHeight/2+p.height/2;a.scrollTo({top:g,behavior:"smooth"})}}}};setTimeout(n,300)}},Z=function(e,t){if(c.current){var r=0,n=function(){var o,i;if(!(++r>60)){var a=null===(o=c.current)||void 0===o?void 0:o.querySelector(".rpv-core__inner-pages");if(a){var l=null===(i=c.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(l){var u=l.getBoundingClientRect();if(0!==u.height){var s=a.getBoundingClientRect(),p=t/100*u.height,g=u.top-s.top+p;a.scrollTo({top:a.scrollTop+g-40,behavior:"smooth"})}else setTimeout(n,100)}else setTimeout(n,100)}else setTimeout(n,100)}};setTimeout(n,100)}},N=r.useMemo(function(){var e={};return I.forEach(function(t,r){var n=u[t];n>0&&(e[n]||(e[n]=[]),e[n].push(r))}),e},[I,u]),L=function(e){var t=u[I[e]];return(N[t]||[]).indexOf(e)},$=function(e,t){if(c.current){var r=-1,n=0,o=function(){var i,a;if(!(++n>60)){var l=null===(i=c.current)||void 0===i?void 0:i.querySelector(".rpv-core__inner-pages");if(l){if(l.scrollTop!==r)return r=l.scrollTop,void setTimeout(o,100);var u=null===(a=c.current)||void 0===a?void 0:a.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(u){var s=u.getBoundingClientRect();if(0!==s.height){var p=l.getBoundingClientRect(),g=t/100*s.height,f=s.top-p.top+g;l.scrollTo({top:l.scrollTop+f-40,behavior:"instant"})}else setTimeout(o,100)}else setTimeout(o,100)}else setTimeout(o,100)}};setTimeout(o,100)}};return{setHighlightIndex:m,highlightIndex:d,cursorIndex:x,setCursorIndex:_,orderedKeys:I,totalHighlights:q,getValidPosition:function(e){if(p)return e+1;if(!u)return 0;for(var t=0,r=0;r<=e;r++)u[I[r]]>0&&t++;return t},tryJump:O,jumpToPage:A,zoomTo:F,hideNonTargetHighlights:w,deduplicateHighlights:S,scrollToCoord:Z,plugins:[p?H:P,j,B],controls:{ZoomInButton:E,ZoomOutButton:k,ZoomPopover:z,goToNext:function(){if(p&&g)for(var e=x+1;e<g.length;e++){var t=g[e],r=g[x];return _(e),A(t.pageIndex),void(t.pageIndex!==r.pageIndex?(A(t.pageIndex),$(t.pageIndex,t.top)):Z(t.pageIndex,t.top))}else{var n=function(e){var t=I[e];if(u[t]>0){var r=u[t]-1,n=L(e);return _(e),A(u[t]-1),R(r,n),setTimeout(function(){S(r)},500),1===Object.keys(u).length&&w(s),{value:void 0}}};for(e=x+1;e<I.length;e++){var o=n(e);if("object"==typeof o)return o.value}}},goToPrevious:function(){if(p&&g)for(var e=x-1;e>=0;e--){var t=g[e],r=g[x];return _(e),A(t.pageIndex),void(t.pageIndex!==r.pageIndex?(A(t.pageIndex),$(t.pageIndex,t.top)):Z(t.pageIndex,t.top))}else{var n=function(e){var t=I[e];if(u[t]>0){var r=u[t]-1,n=L(e);return _(e),A(u[t]-1),R(r,n),setTimeout(function(){S(r)},500),1===Object.keys(u).length&&w(s),{value:void 0}}};for(e=x-1;e>=0;e--){var o=n(e);if("object"==typeof o)return o.value}}}}}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),n=require("@react-pdf-viewer/search"),i=require("@react-pdf-viewer/page-navigation"),o=require("@react-pdf-viewer/zoom"),a=require("@react-pdf-viewer/highlight");exports.PdfHighlightControls=function(l,u,c,f,g,s,h,p){void 0===h&&(h="yellow"),void 0===p&&(p="#F6D739");var d=r.useState(0),v=d[0],m=d[1],x=r.useRef(!1),_=r.useState(0),y=_[0],T=_[1];r.useRef([]);var b=function(e){return e.replace(/[^\S\n]+/g," ").trim()},w=function(e){return(e||"").toLowerCase().replace(/\u00ad/g,"").replace(/[""]/g,'"').replace(/['']/g,"'").replace(/[\u2013\u2014]/g,"-").replace(/-/g," ").replace(/[^\w\s]/g,"").replace(/\s+/g," ").trim()},M=function(e){var t=e.trim(),r=(t=(t=t.replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\u00A0\u2009\u202F]/g," ")).replace(/^[-•]\s+/,"")).match(/^((\d+(?:\.\d+)*[.)]?)|[A-Za-z][.)]|\([A-Za-z0-9]+\)|(?:i|ii|iii|iv|v|vi|vii|viii|ix|x)[.)])\s*/i);return r?t.slice(r[0].length).trim():t},I=function(e){var t=w(e),r=t.replace(/\s+/g,""),n=new Set;return t&&n.add(t),r&&n.add(r),n},S=function(e){return e.replace(/\\([''])/g,"$1").replace(/\]\s*\n\s*\(/g,"](").replace(/&[#\w]+;/g,function(e){return t=e,(r=document.createElement("textarea")).innerHTML=t,r.value;var t,r}).replace(/<br\s*\/?>/gi,"\n").replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1")},A=function(e){return e?S(e).split(/\n+/).map(M).flatMap(function(e){var t=e.match(/^\s*\|(.+)\|\s*$/);return t?t[1].split("|").map(function(e){return e.trim()}).filter(Boolean):[e]}).map(function(e){return b(function(e){return e.replace(/(^|\W)[*_]{1,3}([^*_]+)[*_]{1,3}(?=\W|$)/g,"$1$2")}(e))}).filter(Boolean):[]},q=Object.keys(u).map(Number).sort(function(e,t){return e-t}),E=r.useMemo(function(){return g?s.length:g?0:Object.values(u).filter(function(e){return e>0}).length},[s,u]),B=function(t){if(c.current){var r=c.current.querySelector('[data-testid="search__highlights-'.concat(t,'"]'));if(r){var n=Array.from(r.querySelectorAll(".rpv-search__highlight"));if(0!==n.length){var i=C.map(I),o=P.map(I);if(0!==i.length||0!==o.length){var a=n.map(function(t){var r=function(e){var t=e.getBoundingClientRect();if(t.height>0||t.width>0)return{top:t.top,left:t.left,right:t.right};var r=e.offsetTop,n=e.offsetLeft;return{top:r,left:n,right:n+e.offsetWidth}}(t),n=(t.textContent||"").trim(),i=(t.getAttribute("title")||"").trim(),o=n||i;return e.__assign({el:t,text:o},r)}).filter(function(e){return e.text.length>0}).sort(function(e,t){return e.top-t.top||e.left-t.left});if(0!==a.length){var u=[],f=null,g=[],s=function(){if(f){var e=g.join(" ");f.title=w(e),f.title&&u.push(f),f=null,g=[]}};if(a.forEach(function(e){if(!f)return f={title:"",elements:[e.el],lastTop:e.top,lastRight:e.right},void(g=[e.text]);var t=Math.abs(e.top-f.lastTop)<=5,r=e.left<=f.lastRight+28;t&&r?(f.elements.push(e.el),f.lastTop=e.top,f.lastRight=Math.max(f.lastRight,e.right),g.push(e.text)):(s(),f={title:"",elements:[e.el],lastTop:e.top,lastRight:e.right},g=[e.text])}),s(),0!==u.length){for(var h=function(e,t){if(!e)return!1;if(t.has(e))return!0;for(var r=e.replace(/\s+/g,""),n=0,i=Array.from(t);n<i.length;n++){var o=i[n];if(o){var a=o.replace(/\s+/g,"");if(a===r)return!0;if(o.length>=8&&e.length>=5&&o.includes(e))return!0;if(a.length>=8&&r.length>=5&&a.includes(r))return!0;if(e.length>=10&&o.length>=8&&e.includes(o))return!0;if(r.length>=10&&a.length>=8&&r.includes(a))return!0}}return!1},p=0,d=new Set,v=function(e){if(!e||e.length<8)return null;for(var t=e.replace(/\s+/g,""),r=0;r<u.length;r++)for(var n="",i="",o=new Set,a=r;a<u.length&&a<r+20;a++){var l=u[a].title;if(n=n?"".concat(n," ").concat(l):l,i=i?"".concat(i).concat(l.replace(/\s+/g,"")):l.replace(/\s+/g,""),o.add(a),n.includes(e)||i.includes(t))return o;if(n.length>=15&&(e.includes(n)||t.includes(i)))return o;if(n.length>e.length+150)break}return null},m=0,x=Array.from(new Set(e.__spreadArray(e.__spreadArray([],C,!0),P,!0).map(w).filter(function(e){return e.length>=8}))).sort(function(e,t){return t.length-e.length});m<x.length;m++){var _=v(x[m]);_&&_.size>0&&(_.forEach(function(e){return d.add(e)}),p=d.size)}if(0===p){var y=function(e){if(0===e.length)return null;for(var t=null,r=0,n=e;r<n.length;r++)for(var i=n[r],o=0,a=Array.from(i);o<a.length;o++){var l=a[o];if(l&&!(l.length<5))for(var c=l.replace(/\s+/g,""),f=0;f<u.length;f++)for(var g="",s="",h=new Set,p=f;p<u.length&&p<f+15;p++){var d=u[p].title;if(g=g?"".concat(g," ").concat(d):d,s=s?"".concat(s).concat(d.replace(/\s+/g,"")):d.replace(/\s+/g,""),h.add(p),g.includes(l)||s.includes(c)){var v=Math.max(0,g.length-l.length);(!t||v<t.extra)&&(t={blocks:new Set(h),extra:v});break}if(g.length>l.length+120)break}}return t?t.blocks:null}(i);y&&y.size>0&&(y.forEach(function(e){return d.add(e)}),p=d.size)}var T=function(e){if(e.length<2)return 40;for(var t=[],r=1;r<e.length;r++){var n=Math.abs(e[r].lastTop-e[r-1].lastTop);n>0&&t.push(n)}if(0===t.length)return 40;t.sort(function(e,t){return e-t});var i=t[Math.floor(t.length/2)],o=Math.round(2.25*i);return Math.min(60,Math.max(24,o))}(u),b=P.map(w).filter(function(e){return e.length>=8}),M=b.map(function(e){return e.split(/\s+/).filter(function(e){return e.length>=2})});if(0===p)for(var S=o,A=0;A<u.length;A++)for(var q=u[A].title,E=0;E<S.length;E++)if(h(q,S[E])){for(var B=0,j=new Set,k=E,z=A-1,R=A;R<u.length&&k<S.length;R++){if(h(u[R].title,S[k])){if(z>=0){var N=u[z].lastTop,$=u[R].lastTop;if(Math.abs($-N)>T)break}B++,j.add(R),z=R,k++}else if(k>0&&h(u[R].title,S[k-1])){N=u[z].lastTop,$=u[R].lastTop;Math.abs($-N)<=3&&(j.add(R),z=R)}if(R-z>6)break}B>p&&(p=B,d=j)}if(p<Math.min(3,b.length)&&b.length>0){var H=new Set;u.forEach(function(e,t){var r=e.title.split(/\s+/).filter(function(e){return e.length>=2});if(!(r.length<2))for(var n=new Set(r),i=0,o=M;i<o.length;i++){var a=o[i];if(!(a.length<2)){for(var l=0,u=0,c=a;u<c.length;u++){var f=c[u];n.has(f)&&l++}var g=l/a.length;if(l>=3||g>=.5){H.add(t);break}}}}),H.size>0&&(d=H,p=Math.max(p,H.size))}var O=new Set;if(F.forEach(function(e){var t=w(e);t&&(O.add(t),O.add(t.replace(/\s+/g,"")))}),0===p){var Z=new Set;if(u.forEach(function(e,t){var r=e.title.replace(/\s+/g,"");if(O.has(e.title)||O.has(r))Z.add(t);else for(var n=Array.from(O),i=0;i<n.length;i++){var o=n[i];if(o.length>=10&&o.includes(e.title)&&e.title.length>=5){Z.add(t);break}}}),0===Z.size)return 0;d=Z}u.forEach(function(e,t){var r=d.has(t);e.elements.forEach(function(e){r?(e.classList.add("verified-match"),e.style.display=""):(e.style.display="none",e.classList.remove("verified-match"))})});var L=[];return u.forEach(function(e,t){d.has(t)&&e.elements.forEach(function(e){return L.push(e)})}),requestAnimationFrame(function(){var e=L.map(function(e){return{el:e,rect:e.getBoundingClientRect()}}).filter(function(e){return e.rect.width>0&&e.rect.height>0}).sort(function(e,t){return t.rect.width*t.rect.height-e.rect.width*e.rect.height}),t=[];e.forEach(function(e){var r=e.el,n=e.rect;t.some(function(e){return t=e.rect,r=n,i=Math.max(0,Math.min(t.right,r.right)-Math.max(t.left,r.left))*Math.max(0,Math.min(t.bottom,r.bottom)-Math.max(t.top,r.top)),((o=Math.min(t.width*t.height,r.width*r.height))>0?i/o:0)>.5;var t,r,i,o})?(r.style.display="none",r.classList.remove("verified-match")):t.push({el:r,rect:n})})}),console.groupCollapsed("[debug: PDF ordered matching - Page ".concat(t,"]")),console.log("input->",l),console.log("processed sentences->",C),console.log("processed lines->",P),console.log("Expected sentence count:",i.length),console.log("Expected line count:",o.length),console.log("Matched sequence length:",p),console.log("blocksToKeep",d,"size",d.size),console.groupEnd(),d.size}}}}}}},j=function(e){c.current&&c.current.querySelectorAll(".rpv-search__highlights").forEach(function(t){var r=t.getAttribute("data-testid"),n=parseInt((null==r?void 0:r.replace(/search__highlights-/g,""))||"-1"),i=t.querySelectorAll(".rpv-search__highlight");e.has(n)||i.forEach(function(e){e.style.display="none"})})},k=l.map(function(e){return function(e){return e?S(e).split(/\n{2,}/).map(function(e){return A(e).join(" ")}).map(function(e){return b(e)}).filter(Boolean):[]}(e)}).flat(),z=l.map(function(e){return A(e)}).flat(),R=k.some(function(e){return e.length>=3})?3:1,C=k.filter(function(e){return e.length>=R}),P=z.filter(function(e){return e.length>=R}),N=P.flatMap(function(e){return function(e,t,r){void 0===t&&(t=6),void 0===r&&(r=4);var n=e.split(/\s+/).filter(Boolean);if(n.length<=t)return[];for(var i=[],o=0;o+t<=n.length;o+=r)i.push(n.slice(o,o+t).join(" "));return n.length>t&&(n.length-t)%r!==0&&i.push(n.slice(n.length-t).join(" ")),i}(e)}),F=Array.from(new Set(e.__spreadArray(e.__spreadArray(e.__spreadArray([],C,!0),P,!0),N,!0).flatMap(function(e){var t=b(e.replace(/[\u00A0\u2009\u202F]/g," ").replace(/\u00ad/g,"").replace(/[""]/g,'"').replace(/['']/g,"'"));if(!t)return[];var r=t.replace(/[\u2013\u2014]/g,"-"),n=b(r.replace(/(\w)-\s+(\w)/g,"$1$2")),i=b(r.replace(/-/g," ")),o=b(r.replace(/-/g,"")),a=b(t.replace(/[^\w\s]/g,"")),l=new Set([t,r,n,i,o,a]);return Array.from(l).filter(Boolean)}))).filter(function(e){var t=e.split(/\s+/).filter(Boolean);return!(e.length<R)&&(t.length>=3||e.length>=12)}),$=n.searchPlugin({keyword:F}),H=i.pageNavigationPlugin(),O=o.zoomPlugin(),Z=$.jumpToMatch,L=H.jumpToPage,D=O.zoomTo,W=O.ZoomInButton,K=O.ZoomOutButton,J=O.ZoomPopover,V=r.useMemo(function(){return function(t){if(0===t.length)return[];var r=new Map;t.forEach(function(t,n){var i=null!=t.pageNumber?t.pageNumber-1:t.pageIndex;r.has(i)||r.set(i,[]),r.get(i).push(e.__assign(e.__assign({},t),{originalIndex:n}))});var n=[];return r.forEach(function(t){for(var r=e.__spreadArray([],t,!0).sort(function(e,t){return e.top!==t.top?e.top-t.top:e.left-t.left}),i=new Array(r.length).fill(!1),o=0;o<r.length;o++)if(!i[o]){var a=r[o],l=a.left,u=a.top,c=a.width,f=a.height,g=a.pageIndex,s=a.pageNumber,h=l+c,p=u+f;i[o]=!0;for(var d=!0;d;){d=!1;for(var v=o+1;v<r.length;v++)if(!i[v]){var m=r[v],x=m.left+m.width,_=m.top+m.height;l<=x+1&&h>=m.left-1&&u<=_+1&&p>=m.top-1&&(l=Math.min(l,m.left),u=Math.min(u,m.top),c=(h=Math.max(h,x))-l,f=(p=Math.max(p,_))-u,i[v]=!0,d=!0)}}n.push({pageIndex:g,pageNumber:s,left:l,top:u,width:c,height:f})}}),n}(s)},[s]),G=a.highlightPlugin({renderHighlights:function(r){return t.jsx(t.Fragment,{children:V.map(function(t,r){return e.__assign(e.__assign({},t),{mergedIndex:r})}).filter(function(e){return null!=e.pageNumber?e.pageNumber-1===r.pageIndex:e.pageIndex===r.pageIndex}).map(function(e){var n=s[y],i=null!=n&&(null!=n.pageNumber?n.pageNumber-1===r.pageIndex:n.pageIndex===r.pageIndex)&&n.left>=e.left-1&&n.left<=e.left+e.width+1&&n.top>=e.top-1&&n.top<=e.top+e.height+1;return t.jsx("div",{style:{position:"absolute",left:"".concat(e.left,"%"),top:"".concat(e.top,"%"),width:"".concat(e.width,"%"),height:"".concat(e.height,"%"),background:i?p:h,opacity:i?.7:.4,transition:"background 0.2s, opacity 0.2s"}},e.mergedIndex)})})}}),Q=function(){if(!x.current)try{Z(0),x.current=!0;var e=s[0];e&&g&&X(e.pageIndex,e.top)}catch(e){requestAnimationFrame(Q)}},U=function(e,t){if(c.current&&c.current.querySelector(".rpv-core__viewer")){var r=-1,n=function(){var i,o,a=null===(i=c.current)||void 0===i?void 0:i.querySelector(".rpv-core__inner-pages");if(a){if(a.scrollTop!==r)return r=a.scrollTop,void setTimeout(n,100);var l=null===(o=c.current)||void 0===o?void 0:o.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(l){var u=l.querySelectorAll(".rpv-search__highlight")[t];if(u){var f=a.getBoundingClientRect(),g=u.getBoundingClientRect(),s=a.scrollTop+(g.top-f.top)-a.clientHeight/2+g.height/2;a.scrollTo({top:s,behavior:"smooth"})}}}};setTimeout(n,300)}},X=function(e,t){if(c.current){var r=0,n=function(){var i,o;if(!(++r>60)){var a=null===(i=c.current)||void 0===i?void 0:i.querySelector(".rpv-core__inner-pages");if(a){var l=null===(o=c.current)||void 0===o?void 0:o.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(l){var u=l.getBoundingClientRect();if(0!==u.height){var f=a.getBoundingClientRect(),g=t/100*u.height,s=u.top-f.top+g;a.scrollTo({top:a.scrollTop+s-40,behavior:"smooth"})}else setTimeout(n,100)}else setTimeout(n,100)}else setTimeout(n,100)}};setTimeout(n,100)}},Y=r.useMemo(function(){var e={};return q.forEach(function(t,r){var n=u[t];n>0&&(e[n]||(e[n]=[]),e[n].push(r))}),e},[q,u]),ee=function(e){var t=u[q[e]];return(Y[t]||[]).indexOf(e)},te=function(e,t){if(c.current){var r=-1,n=0,i=function(){var o,a;if(!(++n>60)){var l=null===(o=c.current)||void 0===o?void 0:o.querySelector(".rpv-core__inner-pages");if(l){if(l.scrollTop!==r)return r=l.scrollTop,void setTimeout(i,100);var u=null===(a=c.current)||void 0===a?void 0:a.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(u){var f=u.getBoundingClientRect();if(0!==f.height){var g=l.getBoundingClientRect(),s=t/100*f.height,h=f.top-g.top+s;l.scrollTo({top:l.scrollTop+h-40,behavior:"instant"})}else setTimeout(i,100)}else setTimeout(i,100)}else setTimeout(i,100)}};setTimeout(i,100)}};return{setHighlightIndex:m,highlightIndex:v,cursorIndex:y,setCursorIndex:T,orderedKeys:q,totalHighlights:E,getValidPosition:function(e){if(g)return e+1;if(!u)return 0;for(var t=0,r=0;r<=e;r++)u[q[r]]>0&&t++;return t},tryJump:Q,jumpToPage:L,zoomTo:D,hideNonTargetHighlights:j,deduplicateHighlights:B,scrollToCoord:X,plugins:[g?G:$,H,O],controls:{ZoomInButton:W,ZoomOutButton:K,ZoomPopover:J,goToNext:function(){if(g&&s)for(var e=y+1;e<s.length;e++){var t=s[e],r=s[y];return T(e),L(t.pageIndex),void(t.pageIndex!==r.pageIndex?(L(t.pageIndex),te(t.pageIndex,t.top)):X(t.pageIndex,t.top))}else{var n=function(e){var t=q[e];if(u[t]>0){var r=u[t]-1,n=ee(e);return T(e),L(u[t]-1),U(r,n),setTimeout(function(){B(r)},500),1===Object.keys(u).length&&j(f),{value:void 0}}};for(e=y+1;e<q.length;e++){var i=n(e);if("object"==typeof i)return i.value}}},goToPrevious:function(){if(g&&s)for(var e=y-1;e>=0;e--){var t=s[e],r=s[y];return T(e),L(t.pageIndex),void(t.pageIndex!==r.pageIndex?(L(t.pageIndex),te(t.pageIndex,t.top)):X(t.pageIndex,t.top))}else{var n=function(e){var t=q[e];if(u[t]>0){var r=u[t]-1,n=ee(e);return T(e),L(u[t]-1),U(r,n),setTimeout(function(){B(r)},500),1===Object.keys(u).length&&j(f),{value:void 0}}};for(e=y-1;e>=0;e--){var i=n(e);if("object"==typeof i)return i.value}}}}}};
|
|
2
2
|
//# sourceMappingURL=usePdfHighlight.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as u,useCallback as c}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as f}from"@mui/material";import{ChevronDown as p,EllipsisVertical as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import m from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,findKeyPathByNodeId as R,getFirstDeviationOutputValue as C,getFirstDeviationColor as B,hasValue as I,getBentArrowPath as w,smoothScrollTo as T,resetClauseHighlight as _,scrollAndHighlightClause as E}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as F,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as M,DEFAULT_DEVIAION_COLOR as N,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import P from"./CognitivePopup.js";import j from"./MoreFunctionsPopup.js";import H from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as O}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as W}from"./hooks/useSectionRefs.js";import{useAccordionState as q}from"./hooks/useAccordionState.js";import{useDeviationNavigation as Y}from"./hooks/useDeviationNavigation.js";import K from"./components/CompareHeader.js";import V from"./components/SectionAccordion.js";import X from"./components/SubSectionAccordion.js";import $ from"./components/CognitiveSummaryPopup.js";import J from"./components/connectedLines.js";var U=function(U){var G,Q,Z,nn,en,tn,on,rn,ln,un,cn,dn,an,sn,vn,fn,pn,gn,hn,mn,xn,yn,bn,Sn,Rn,Cn,Bn=U.componentHeaderText,In=void 0===Bn?k:Bn,wn=U.treeData,Tn=U.comparisonConfig,_n=U.leftColumnTitleText,En=U.rightColumnTitleText,Fn=U.markdownStyles,Dn=U.resetTrigger,An=U.displayConfig,Mn=void 0===An?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:An,Nn=U.popupConfig,kn=U.deviationData,Pn=void 0===kn?{}:kn,jn=U.deviationNodeIdToView,Hn=U.resetDeviationNodeId,Ln=U.isProposingFix,On=void 0!==Ln&&Ln,zn=U.proposingFixNodeId,Wn=o(Mn.maintainRelativeOrder),qn=Wn[0],Yn=Wn[1],Kn=!!qn||!!(null==Mn?void 0:Mn.showDeviationBadges),Vn=o(!1),Xn=Vn[0],$n=Vn[1],Jn=o(!1),Un=Jn[0],Gn=Jn[1],Qn=o(null),Zn=Qn[0],ne=Qn[1],ee=o(!1),te=ee[0],ie=ee[1],oe=o(null===(Q=null!==(G=null==wn?void 0:wn.newEvaluationResult)&&void 0!==G?G:null==Mn?void 0:Mn.enableDeviationSchemaBackwardCompatibility)||void 0===Q||Q)[0],re=o(!1),le=re[0],ue=re[1],ce=o(!1),de=ce[0],ae=ce[1],se=o(null),ve=se[0],fe=se[1],pe=r(!1),ge=o(new Set),he=ge[0],me=ge[1],xe=o([]),ye=xe[0],be=xe[1],Se=r(null),Re=r(null),Ce=r(null),Be=r(new Set),Ie=r(!1),we=r(null),Te=r({}),_e=r([]),Ee=r(!1),Fe=r(!1),De=r(null),Ae=r(function(){}),Me=l(function(){return(null==wn?void 0:wn.cognitive_decisioning)||{}},[wn]),Ne=o({width:0,height:0}),ke=Ne[0],Pe=Ne[1],je=l(function(){return n(n({},F),Fn)},[Fn]),He=r(null),Le=r(null),Oe=r(null),ze=r(null),We=r(null),qe=r(null),Ye=r(null),Ke=r(null),Ve=r(!1),Xe=r(null),$e=r(null),Je=z(He),Ue=Je.cognitivePopup,Ge=Je.setCognitivePopup,Qe=Je.moreFunctions,Ze=Je.setMoreFunctions,nt=Je.position,et=Je.setPosition,tt=Je.activeBadgeId,it=Je.summaryPopup,ot=Je.setSummaryPopup,rt=Je.closeSummaryPopup,lt=Je.setActiveBadgeId,ut=Je.popupRef,ct=Je.closeCognitivePopup,dt=Je.closeMoreFunctionsPopup,at=l(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==Tn?void 0:Tn.fields)&&void 0!==n?n:D,thresholds:{high:null!==(t=null===(e=null==Tn?void 0:Tn.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:A.thresholds.high,medium:null!==(o=null===(i=null==Tn?void 0:Tn.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(l=null===(r=null==Tn?void 0:Tn.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:A.thresholds.exact}}},[Tn]),st=o(null),vt=st[0];st[1];var ft=null===(en=null===(Z=null==wn?void 0:wn.documents)||void 0===Z?void 0:Z[null===(nn=null==wn?void 0:wn.input_index_map)||void 0===nn?void 0:nn[0]])||void 0===en?void 0:en.title,pt=null===(rn=null===(tn=null==wn?void 0:wn.documents)||void 0===tn?void 0:tn[null===(on=null==wn?void 0:wn.input_index_map)||void 0===on?void 0:on[1]])||void 0===rn?void 0:rn.title,gt=x(_n||ft||"Uploaded Contract"),ht=x(En||pt||"Reference Template"),mt=O(wn,qn,Pn,at,oe),xt=mt.activeProposed,yt=mt.existingRule,bt=mt.proposedSections,St=mt.existingSections,Rt=mt.visibleFields,Ct=mt.parentDeviationRecord,Bt=mt.deviationNumberRegistry,It=mt.parseError;u(function(){It&&ne("Failed to load comparison: ".concat(It))},[It]);var wt=bt.length>0||St.length>0,Tt=W(Rt.map(function(n){return n.key}),Math.max(bt.length,St.length)),_t=Tt.leftRefs,Et=Tt.rightRefs,Ft=Tt.sectionLeftRefs,Dt=Tt.sectionRightRefs,At=Tt.lhsBadgeRefs,Mt=Tt.rhsBadgeRefs,Nt=Tt.sectionRightRowRefs,kt=Tt.subSectionLeftRefs,Pt=Tt.subSectionRightRefs,jt=Tt.sectionRowRefs,Ht=Tt.getSectionRowRef,Lt=Tt.getSubSectionRef,Ot=Tt.getBadgeRef,zt=yt.analysis,Wt=x(null===(un=null===(ln=null==zt?void 0:zt.rule_difference_comparison)||void 0===ln?void 0:ln.summary)||void 0===un?void 0:un.overall_summary),qt=!!Wt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Yt=null!==(cn=null==wn?void 0:wn.base_root_id)&&void 0!==cn?cn:"-1";null==wn||wn[Yt];var Kt=oe?null!==(bn=null!==(mn=Pn&&(null===(hn=null==Pn?void 0:Pn[Yt])||void 0===hn?void 0:hn.evaluation_result))&&void 0!==mn?mn:null===(yn=null===(xn=null==wn?void 0:wn.nodes)||void 0===xn?void 0:xn[Yt])||void 0===yn?void 0:yn.evaluation_result)&&void 0!==bn?bn:null:null!==(gn=null!==(sn=Pn&&(null===(an=null===(dn=null==Pn?void 0:Pn[Yt])||void 0===dn?void 0:dn.evaluation_result)||void 0===an?void 0:an[0]))&&void 0!==sn?sn:null===(pn=null===(fn=null===(vn=null==wn?void 0:wn.nodes)||void 0===vn?void 0:vn[Yt])||void 0===fn?void 0:fn.evaluation_result)||void 0===pn?void 0:pn[0])&&void 0!==gn?gn:null,Vt=y(Kt),Xt=b(null!==(Cn=null===(Rn=null===(Sn=null==Kt?void 0:Kt.evaluation_outputs)||void 0===Sn?void 0:Sn.metadata)||void 0===Rn?void 0:Rn.label_color)&&void 0!==Cn?Cn:""),$t=function(){Be.current.forEach(function(n){_(n)}),Be.current.clear()},Jt=c(function(){var n,e,t,i,o,r;$t(),ie(!1),Fe.current=!1,Re.current=null;var l=De.current,u=pi.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var c=l.split(S);(d=(null===(n=kt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=Ft.current[Number(c[2])])||void 0===e?void 0:e.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=Ft.current[l])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==u)if("string"==typeof u&&u.includes(S)){c=u.split(S);(a=(null===(i=Pt.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=Dt.current[Number(c[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=Dt.current[u])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}fe(null),De.current=null,pi.current=null,ue(!1),Gn(!1),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px")},[]),Ut=c(function(){$t(),Jt(),me(new Set),be([]),_e.current=[],bi([]),Ci(null),ot(M),ct(),requestAnimationFrame(function(){var n;null===(n=Ae.current)||void 0===n||n.call(Ae)})},[]),Gt=r(Ut);u(function(){Gt.current=Ut},[Ut]),u(function(){Dn&&Gt.current()},[Dn]);var Qt=q({maintainRelativeOrder:!!qn,proposedSections:bt,existingSections:St,activeSideBySideSection:ve,connectedSections:he,resetSideBySide:Jt,setConnectedSections:me,setConnectedLines:be,cachedConnectedPositions:_e,svgContainerRef:Se,isAnimatingRef:Ie,animationTimerRef:we,calculateLinesRef:Ae,sectionLeftRefs:Ft,sectionRightRefs:Dt,subSectionLeftRefs:kt,subSectionRightRefs:Pt}),Zt=Qt.expandedSections,ni=Qt.setExpandedSections,ei=Qt.expandedSubSections,ti=Qt.setExpandedSubSections,ii=Qt.toggleSection,oi=c(function(e,t,i,o,r,l,u){var c,d,a,s=x(null==t?void 0:t.id)||x(null==i?void 0:i.id)||"",v=(s?Me[s]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:s,decisioning:[],gap:[],relevance_score:0},f=null!==(d=null===(c=jt.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null;return{isLoading:null!==(a=null==Mn?void 0:Mn.isLoading)&&void 0!==a&&a,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:f,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==wn?void 0:wn.documents,input_index_map:null==wn?void 0:wn.input_index_map},deviationData:function(){var e,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,u=function(e){var t=function(n){if(!n||"object"!=typeof n)return null;var e=null==n?void 0:n.deviation_entries;if(e&&"object"==typeof e){var t=Object.keys(e).sort(function(n,e){return Number(n)-Number(e)})[0];if(t&&e[t])return e[t]}var i=Object.keys(n).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,e){return Number(n)-Number(e)});if(i.length&&n[i[0]])return n[i[0]];var o=null==n?void 0:n.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(n,e){return Number(n)-Number(e)})[0];if(r&&o[r])return o[r]}return null}(e);return t?n(n({},e),{deviation_summary:(null==e?void 0:e.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==e?void 0:e.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==e?void 0:e.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==e?void 0:e.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==e?void 0:e.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==e?void 0:e.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):e};if(!("string"==typeof o&&o.includes(S)))return u(l);var c=o.split(S)[1];if(!c)return l;var d=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},a=(null===(e=null==d?void 0:d.deviation_entries)||void 0===e?void 0:e[c])||(null===(r=null==d?void 0:d.deviations)||void 0===r?void 0:r[c])||null;return a?n(n(n({},d),a),{deviation_summary:(null==a?void 0:a.deviation_summary)||(null==d?void 0:d.deviation_summary),deviation_title:(null==a?void 0:a.deviation_title)||(null==d?void 0:d.deviation_title),deviation_impact:(null==a?void 0:a.deviation_impact)||(null==d?void 0:d.deviation_impact),deviation_explanation:(null==a?void 0:a.deviation_explanation)||(null==d?void 0:d.deviation_explanation),evaluation_outputs:(null==a?void 0:a.evaluation_outputs)||(null==d?void 0:d.evaluation_outputs),cognitive_decisioning:(null==a?void 0:a.cognitive_decisioning)||(null==d?void 0:d.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[Me,wn]),ri=c(function(n){dt(),et(null),Ge(n)},[dt]),li=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),Qe.open&&Qe.sectionIdx===o)dt();else{var u=n.currentTarget,c="left";(null===(l=Oe.current)||void 0===l?void 0:l.contains(u))&&(c="right");$t(),Fe.current&&Jt(),me(new Set),be([]),_e.current=[],ct(),it.open?Yi():rt(),requestAnimationFrame(function(){var n=function(){var n,e,t,i;if("string"==typeof o&&o.includes(S)){var r=o.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(n=Mt.current[l])||void 0===n?void 0:n.current:null===(e=At.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=Mt.current[o])||void 0===t?void 0:t.current:null===(i=At.current[o])||void 0===i?void 0:i.current}()||u;Ze(oi(n,e,i,o,t,r))})}},ui=c(function(){null!==Qe.sectionIdx&&Qe.anchorEl?ri(n(n({},Qe),{open:!0})):dt()},[Qe,dt,ri]),ci=c(function(){var n=Qe.sectionIdx,e=Qe.isOrphan;dt(),rt(),null!==n&&(e?ne("No counterpart exists to connect to."):($t(),Fe.current&&Jt(),be([]),_e.current=[],me(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Ae.current&&Ae.current()},50)))},[Qe.sectionIdx,Qe.isOrphan,dt,rt,Jt]),di=c(function(){var n=Ce.current;if(n){Ce.current=null;var e=bt.findIndex(function(e){return e.id===n}),t=St.findIndex(function(e){return e.id===n}),i=-1===e?R(bt,n):null,o=-1===t?R(St,n):null,r=-1!==e?e:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=function(n,e,t,i){var o,r,l,u;return-1!==n?null!==(r=null===(o=t.current[n])||void 0===o?void 0:o.current)&&void 0!==r?r:null:e&&null!==(u=null===(l=i.current[e])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(n,e,t){void 0===t&&(t=30);var i=0,o=function(){var r=n();r&&0!==r.getBoundingClientRect().height?(Be.current.add(r),E(r,e)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(qn)-1!==r&&Ke.current&&c(function(){return u(e,i,Ft,kt)},Ke.current),-1!==l&&Oe.current&&c(function(){return u(t,o,Dt,Pt)},Oe.current);else{var d=He.current;if(!d)return;c(function(){return-1!==r?u(e,i,Ft,kt):u(t,o,Dt,Pt)},d)}}},[bt,St,qn,Ft,Dt,kt,Pt,Ke,Oe,He]),ai=c(function(e){if(e){$t(),Jt(),me(new Set),be([]),_e.current=[],rt(),ct();var t=bt.findIndex(function(n){return n.id===e}),i=St.findIndex(function(n){return n.id===e}),o=-1===t?R(bt,e):null,r=-1===i?R(St,e):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=-1!==i?i:r?Number(r.split("-")[0]):-1;Ce.current=e,ni(function(e){var t,i=n({},e),o=!1;-1!==l&&(i[t=qn?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==u&&(i[t=qn?"right-".concat(u):String(u)]||(i[t]=!0,o=!0));return o?i:e}),ti(function(e){var t=n({},e),i=!1,l=function(n){for(var e=n.split("-"),o=e[0],r=1;r<e.length;r++)o+="-".concat(e[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:e}),setTimeout(function(){requestAnimationFrame(function(){Ce.current===e&&si.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(e,'" not found'))}},[bt,St,qn,ni,ti,Jt,rt,ct]),si=r(di);u(function(){si.current=di},[di]);var vi=r(null),fi=r(null),pi=r(null),gi=r(null),hi=r(null),mi=r(null),xi=o([]),yi=xi[0],bi=xi[1];r(null);var Si=o(null),Ri=Si[0],Ci=Si[1];u(function(){if(vt){var n=at.fields.find(function(n){return n.analysisKey===vt||n.key===vt});if(n){var e=_t.current[n.key]||Et.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[vt,at.fields]);var Bi=c(function(n){var e,t,i,o,r,l,u,c,d,a=null===(e=null==zt?void 0:zt.rule_difference_comparison)||void 0===e?void 0:e.fields;if(!a||!a[n])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[n],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var f=s.mappings[0]||{};return{score:s.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[zt]),Ii=c(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=bt[e],qn&&l){var c=St.filter(function(n){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});u=c.find(function(n){return n.evaluationResult})||c[0]}else u=St[e];else if(u=St[e],qn&&u){var d=bt.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(u.selfIndex)});l=d.find(function(n){return n.evaluationResult})||d[0]}else l=bt[e];var a=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,s=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,v=!(!(null==l?void 0:l.cognitiveData)&&!(null==u?void 0:u.cognitiveData));if(!a&&!s&&!v)return n(n({},b(N)),{label:"Not Defined"});var f=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==u?void 0:u.evaluationResult)&&void 0!==o?o:null,p=C(f),g=B(f);return n(n({},b(g)),null!=f?{label:null!==(r=p)&&void 0!==r?r:""}:{label:null})},[bt,St,Me,at,qn]),wi=c(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=bt[u[0]],d=St[u[0]],a=1;a<u.length;a++)(null==c?void 0:c.subsections)&&(c=c.subsections[u[a]]),(null==d?void 0:d.subsections)&&(d=d.subsections[u[a]]);if(!c&&!d)return null;var s=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,v=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,f=x(null==c?void 0:c.id)||x(null==d?void 0:d.id)||"",p=!(!(null==c?void 0:c.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!s&&!v&&!p)return n(n({},b(N)),{label:"Not Defined"});null!==(i=null!==(t=null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||f&&(null===(o=Me[f])||void 0===o||o.relevance_score);var g=null!==(l=null!==(r=null==c?void 0:c.evaluationResult)&&void 0!==r?r:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,h=C(g),m=B(g);return n(n({},b(m)),null!=g?{label:null!=h?h:""}:{label:null})},[bt,St,Me,at]),Ti=c(function(e,t){var i,o,r,l,u,c,d,a,s,v,f,p,g,h,m,x,y;if(!e||null==t)return null;var S=null!==(d=null!==(u=null!==(o=null===(i=null==Pn?void 0:Pn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==wn?void 0:wn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==wn?void 0:wn[e])||void 0===c?void 0:c.evaluation_result)&&void 0!==d?d:null;if(!S||"object"!=typeof S)return null;var R=null!==(f=null!==(s=null===(a=null==S?void 0:S.deviations)||void 0===a?void 0:a[t])&&void 0!==s?s:null===(v=null==S?void 0:S.deviation_entries)||void 0===v?void 0:v[t])&&void 0!==f?f:null==S?void 0:S[t],C=null!==(y=null!==(h=null===(g=null===(p=null==R?void 0:R.evaluation_outputs)||void 0===p?void 0:p.metadata)||void 0===g?void 0:g.label_color)&&void 0!==h?h:null===(x=null===(m=null==S?void 0:S.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===x?void 0:x.label_color)&&void 0!==y?y:N;return n(n({},b(C)),{label:null})},[Pn,wn]),_i=c(function(){$t(),ni({}),ti({}),Jt(),me(new Set),be([]),_e.current=[],rt(),ct(),dt(),requestAnimationFrame(function(){Ae.current&&Ae.current()})},[ni,ti,Jt,rt,ct,dt]),Ei=l(function(){return Object.values(Zt).some(Boolean)||Object.values(ei).some(Boolean)},[Zt,ei]),Fi=c(function(){var n,e,t,i,o,r,l,u,c,d,a,s,v,f,p,g,h,m,x,y,b,R,C;if(!Ve.current&&!Ie.current){Ve.current=!0;try{if(!vi.current)return;var B=function(n){var e=n.split("-"),t=e[0];if(!Zt[t]&&!1===qn)return!1;if(qn&&!Zt["left-".concat(t)]&&!Zt["right-".concat(t)]&&!Zt[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!ei[i])return!1;return!0},T=vi.current.getBoundingClientRect();Pe({width:T.width,height:T.height});var _=[];if(Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Ie.current){for(var E=0;E<Math.max(bt.length,St.length);E++){var F=null===(n=Ft.current[E])||void 0===n?void 0:n.current,D=null===(e=Dt.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),D&&(D.style.height="auto",D.style.minHeight="0px")}qn||Object.keys(kt.current).forEach(function(n){var e,t;if(B(n)){var i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var A={};Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();A[i]=Math.max(l.height,u.height)}});var M={left:{},right:{}},N={};if(!Ie.current)if(qn){if(te&&null!==ve)if("number"==typeof ve){var k=ve,P=bt[k],j=null===(o=Ft.current[k])||void 0===o?void 0:o.current;j&&P&&(P.refIndexes||[]).forEach(function(n){var e,t=St.findIndex(function(e){return e.selfIndex===n}),i=null===(e=Dt.current[t])||void 0===e?void 0:e.current;if(i&&(Zt["left-".concat(k)]||Zt["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);M.left[k]=Math.max(M.left[k]||0,o),M.right[t]=Math.max(M.right[t]||0,o)}})}else{var H=ve.split(S)[2];if(H){F=null===(r=kt.current[H])||void 0===r?void 0:r.current,D=null===(l=Pt.current[H])||void 0===l?void 0:l.current;if(F&&D){L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);N[H]=Math.max(N[H]||0,L)}}}}else{Object.keys(kt.current).forEach(function(n){var e,t;if(B(n)){var i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);N[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(bt.length,St.length);E++){var F=null===(t=Ft.current[E])||void 0===t?void 0:t.current,D=null===(i=Dt.current[E])||void 0===i?void 0:i.current;if(F&&D){var L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);M.left[E]=L,M.right[E]=L}}}if(Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=A[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Ie.current||(Object.entries(M.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Ft.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(M.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Dt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),qn||Object.keys(N).forEach(function(n){var e,t,i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(i&&o&&N[n]){var r=N[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),qn)bt.forEach(function(n,e){var t;(null===(t=Ft.current[e])||void 0===t?void 0:t.current)&&(n.refIndexes||[]).forEach(function(n){var t,i,o,r,l,u,c,d,a,s,v=St.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var f=null===(t=At.current[e])||void 0===t?void 0:t.current,p=null===(i=Mt.current[v])||void 0===i?void 0:i.current;if(f&&p){var g=f.getBoundingClientRect(),h=p.getBoundingClientRect(),m=g.right-T.left,x=h.left-T.left,y=g.top+g.height/2-T.top,b=h.top+h.height/2-T.top;if(te&&ve===e){var S=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=Oe.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(d=null===(c=Ke.current)||void 0===c?void 0:c.clientHeight)&&void 0!==d?d:1/0),B=R+(null!==(s=null===(a=Oe.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),I=g.top+g.height/2,w=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(I,S,C)-T.top,b=E(w,R,B)-T.top}var F=Ii(e);F&&_.push({id:"line-".concat(e,"-").concat(v),x1:m,y1:y,x2:x,y2:b,style:F,sectionIdx:e,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(bt.length,St.length);E++){var O=null===(u=Ft.current[E])||void 0===u?void 0:u.current,z=null===(c=Dt.current[E])||void 0===c?void 0:c.current;if(O&&z){var W=O.getBoundingClientRect(),q=z.getBoundingClientRect(),Y=Math.max(W.top,q.top)+18-T.top,K=(null===(d=St[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=Ii(E))&&_.push({id:K,x1:W.right-T.left,y1:Y,x2:q.left-T.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=bt[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=St[E])||void 0===s?void 0:s.cognitiveData)||K&&Me[K]),isSubSection:!1})}}Object.keys(kt.current).forEach(function(n){var e,t,i,o,r,l;if(B(n)){var u=null===(e=kt.current[n])||void 0===e?void 0:e.current,c=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var d=n.split("-").map(Number),a=bt[d[0]],s=St[d[0]],v=1;v<d.length;v++)(null==a?void 0:a.subsections)&&(a=a.subsections[d[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[d[v]]);var f=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&I(a.title)),p=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&I(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&I(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&I(s.content));if(f&&p||g&&h){var m=u.getBoundingClientRect(),x=c.getBoundingClientRect(),y=Math.max(m.top,x.top)+16-T.top,b=wi(n);b&&"Not Defined"!==b.label&&_.push({id:"subsec-".concat(n),x1:m.right-T.left,y1:y,x2:x.left-T.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:n,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(te&&"string"==typeof ve&&ve.includes(S)){var V=ve.split(S),X=V[0],$=V[1],J=V[2],U=(V[3],"".concat(X).concat(S).concat($)),G=null===(v=At.current[U])||void 0===v?void 0:v.current,Q=null===(f=Mt.current[U])||void 0===f?void 0:f.current;if(G&&Q){var Z,nn=G.getBoundingClientRect(),en=Q.getBoundingClientRect(),tn=nn.right-T.left,on=en.left-T.left,rn=nn.top+nn.height/2-T.top,ln=en.top+en.height/2-T.top;if(qn){var un=null!==(g=null===(p=Ke.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(m=null===(h=Oe.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==m?m:0,dn=un+(null!==(y=null===(x=Ke.current)||void 0===x?void 0:x.clientHeight)&&void 0!==y?y:1/0),an=cn+(null!==(R=null===(b=Oe.current)||void 0===b?void 0:b.clientHeight)&&void 0!==R?R:1/0),sn=function(n,e,t){return Math.max(e,Math.min(t,n))};rn=sn(nn.top+nn.height/2,un,dn)-T.top,ln=sn(en.top+en.height/2,cn,an)-T.top}(Z=null!==(C=Ti(X,$))&&void 0!==C?C:wi(J))&&_.push({id:"line-subsec-".concat(U),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:ve})}}if(bi(_),hi.current&&mi.current){var vn=hi.current.getBoundingClientRect(),fn=mi.current.getBoundingClientRect(),pn=(vn.top+vn.height/2-T.top+fn.top+fn.height/2-T.top)/2;Ci({x1:vn.right-T.left,x2:fn.left-T.left,y:pn})}else Ci(null);if(he.size>0){var gn=[],hn=Ke.current,mn=Oe.current;if(hn&&mn){var xn=[],yn=hn.getBoundingClientRect().top,bn=mn.getBoundingClientRect().top,Sn=yn+hn.clientHeight,Rn=bn+mn.clientHeight,Cn=hn.scrollTop,Bn=mn.scrollTop,In=T.top,wn=function(n,e,t){return Math.max(e,Math.min(t,n))};he.forEach(function(n){var e,t,i,o,r,l;if("string"==typeof n&&n.includes(S)){var u=n.split(S),c=u[0],d=u[1],a=u[2],s=(u[3],"".concat(c).concat(S).concat(d)),v=null===(e=At.current[s])||void 0===e?void 0:e.current,f=null===(t=Mt.current[s])||void 0===t?void 0:t.current;if(!v||!f)return;var p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=null!==(i=Ti(c,d))&&void 0!==i?i:wi(a),m=(P=p.right-T.left)+.5*((j=g.left-T.left-0)-P),x=p.top+p.height/2,y=g.top+g.height/2,b=x-yn+Cn,R=y-bn+Bn,C="conn-subsec-".concat(s);xn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:j,containerTop:In,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var B=wn(x,yn,Sn),I=wn(y,bn,Rn),_=B-In,E=I-In,F=y>=bn-4&&y<=Rn+4,D="";D=(H=x>=yn-4&&x<=Sn+4)&&F?w(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(m,",").concat(_," L ").concat(m,",").concat(E):!H&&F?"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:n,rhsArrayIdx:n})}else if(qn){var A=n,M=bt[A];if(!(null===(l=null==M?void 0:M.refIndexes)||void 0===l?void 0:l.length))return;M.refIndexes.forEach(function(n){var e,t,i=St.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=At.current[A])||void 0===e?void 0:e.current,r=null===(t=Mt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=Ii(A),d=l.right-T.left,a=u.left-T.left-0,s=d+.5*(a-d),v=l.top+l.height/2,f=u.top+u.height/2,p=v-yn+Cn,g=f-bn+Bn,h="conn-".concat(A,"-").concat(i);xn.push({lhsScrollY:p,rhsScrollY:g,x1:d,x2:a,containerTop:In,leftIdx:A,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var m=wn(v,yn,Sn),x=wn(f,bn,Rn),y=m-In,b=x-In,S=v>=yn-4&&v<=Sn+4,R=f>=bn-4&&f<=Rn+4,C="";C=S&&R?w(d,y,a,b):S&&!R?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(a,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),gn.push({id:h,pathD:C,style:c,leftIdx:A,rhsArrayIdx:i})}}})}else{var N=n,k=N;v=null===(o=At.current[N])||void 0===o?void 0:o.current,f=null===(r=Mt.current[k])||void 0===r?void 0:r.current;if(!v||!f)return;var P,j;p=v.getBoundingClientRect(),g=f.getBoundingClientRect(),h=Ii(N),m=(P=p.right-T.left)+.5*((j=g.left-T.left-0)-P),x=p.top+p.height/2,y=g.top+g.height/2,b=x-yn+Cn,R=y-bn+Bn,C="conn-".concat(N,"-").concat(k);xn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:j,containerTop:In,leftIdx:N,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var H;B=wn(x,yn,Sn),I=wn(y,bn,Rn),_=B-In,E=I-In,F=y>=bn-4&&y<=Rn+4,D="";D=(H=x>=yn-4&&x<=Sn+4)&&F?w(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(m,",").concat(_," L ").concat(m,",").concat(E):!H&&F?"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:N,rhsArrayIdx:k})}}),_e.current=xn}be(gn)}else be([]),_e.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{Ve.current=!1}}},[Rt,bt,St,Me,at,Bi,Ii,Ti,qn,te,ve,he,Zt,ei]),Di=c(function(){var n,e,t,i,o,r,l,u,c,d,a,s,v,f,p=_e.current;if(p.length&&!Ie.current){var g=null!==(e=null===(n=Ke.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=Oe.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,x=null!==(u=null===(l=Oe.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(d=null===(c=Ke.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=Oe.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+m,R=b+x,C=null!==(f=null===(v=vi.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,B=function(n,e,t){return Math.max(e,Math.min(t,n))};p.forEach(function(n){var e=n.lhsScrollY-g+y,t=n.rhsScrollY-h+b,i=Te.current[n.styleId+"-stroke"],o=Te.current[n.styleId+"-bg"];if(i||o){var r,l=B(e,y,S),u=B(t,b,R),c=l-C,d=u-C,a=e>=y-4&&e<=S+4,s=t>=b-4&&t<=R+4,v=n.x1+.5*(n.x2-n.x1);r=a&&s?w(n.x1,c,n.x2,d):a&&!s?"M ".concat(n.x1,",").concat(c," L ").concat(v,",").concat(c," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(c," L ").concat(v,",").concat(d," L ").concat(n.x2,",").concat(d):"M ".concat(v,",").concat(c," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);u(function(){Ae.current=Fi},[Fi]);var Ai=r(null),Mi=r(null),Ni=c(function(){_e.current.length>0&&!Ie.current||(null!==Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(function(){Ae.current(),Ai.current=null},50))},[]),ki=c(function(){ae(!0),ue(!1),Re.current=null,null!==Mi.current&&clearTimeout(Mi.current),null!==Ai.current&&(clearTimeout(Ai.current),Ai.current=null),Mi.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,d,a;try{if(_e.current=[],Fe.current&&null!==De.current&&null!==pi.current){var s=De.current,v=pi.current,f="string"==typeof s&&s.includes(S),p=null,g=null,h=null,m=null;if(f){var x=s.split(S),y="".concat(x[0]).concat(S).concat(x[1]);p=(null===(n=At.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=Mt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=kt.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=Ft.current[Number(x[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=Pt.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=Dt.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=jt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=Ft.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=Nt.current[v])||void 0===c?void 0:c.current)||null,m=(null===(d=Dt.current[v])||void 0===d?void 0:d.current)||null;if(p&&g&&h&&m){if(h.style.paddingTop="0px",m.style.paddingTop="0px",!qn){var b=p.getBoundingClientRect(),R=g.getBoundingClientRect(),C=b.top-R.top;C>0?m.style.paddingTop="".concat(C,"px"):C<0&&(h.style.paddingTop="".concat(Math.abs(C),"px"))}var B=Ke.current,I=Oe.current;if(B&&I){var w=p.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop,T=g.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop-(w-B.scrollTop);Math.abs(I.scrollTop-T)>1&&(I.scrollTop=T)}}}null===(a=Ae.current)||void 0===a||a.call(Ae),Fe.current&&ue(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{ae(!1),Mi.current=null}},150)},[qn,bt,St]),Pi=c(function(n){if(null!==Xe.current&&$e.current&&Math.abs(n.currentTarget.scrollTop-Xe.current)<=2){var e=$e.current;Xe.current=null,$e.current=null,e()}pe.current||(qn||Ni(),Ee.current||(Ee.current=!0,requestAnimationFrame(function(){var n,e,t,i,o,r,l;if(Fe.current){var u=Ke.current,c=Oe.current;if(u&&c&&gi.current){if(!Re.current){var d=De.current,a=void 0;if("string"==typeof d&&d.includes(S)){var s=d.split(S),v="".concat(s[0]).concat(S).concat(s[1]);a=null===(n=At.current[v])||void 0===n?void 0:n.current}else a=null===(e=At.current[d])||void 0===e?void 0:e.current;if(a){var f=a.getBoundingClientRect();Re.current={badgeScreenY:f.top+f.height/2,initialScrollTop:u.scrollTop,leftTop:u.getBoundingClientRect().top,leftBottom:u.getBoundingClientRect().top+u.clientHeight,cTop:null!==(i=null===(t=vi.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Re.current){var p=Re.current,g=u.scrollTop-p.initialScrollTop,h=p.badgeScreenY-g,m=((o=h,r=p.leftTop,l=p.leftBottom,Math.max(r,Math.min(l,o)))-p.cTop).toString(),x=h>=p.leftTop-4&&h<=p.leftBottom+4;gi.current.setAttribute("y1",m),gi.current.setAttribute("y2",m),gi.current.setAttribute("visibility",x?"visible":"hidden")}}}_e.current.length>0&&Di(),Ee.current=!1})))},[Di,qn,Ni]),ji=r(0),Hi=r(0),Li=r(0),Oi=r(function(){});r(null),u(function(){Oi.current=ki},[ki]),u(function(){var n=setTimeout(Ni,250),e=function(){return Oi.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==Ai.current&&clearTimeout(Ai.current),null!==Mi.current&&clearTimeout(Mi.current),window.removeEventListener("resize",e)}},[xt,yt,zt,Rt,Zt,ei,bt,St,at,Ni,te,ve,le,he]),u(function(){var n=function(n,e,t,i,o){e.current=n.getBoundingClientRect().width;var r=new ResizeObserver(function(n){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=n[n.length-1];if(c){var d=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(d-e.current)<1?o():(e.current=d,i())}})});return r.observe(n),r},e={current:null},t={current:null},i={current:null},o=[],r=[e,t,i];return Le.current&&o.push(n(Le.current,ji,e,function(){return Oi.current()},function(){})),He.current&&o.push(n(He.current,Hi,t,function(){return Oi.current()},function(){return Ae.current()})),vi.current&&o.push(n(vi.current,Li,i,function(){return Oi.current()},function(){return Ae.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),u(function(){Fe.current=te},[te]),u(function(){De.current=ve},[ve]);var zi=c(function(n,e,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,u=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";dt(),null!=n&&(e?ne("No counterpart exists for this section."):($t(),te&&ve===n?r?Jt():null==l||l():(me(new Set([n])),be([]),_e.current=[],Gn(!0),pe.current=!0,fe(n),De.current=n,ie(!0),Fe.current=!0,ue(!1),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),requestAnimationFrame(function(){var e,t,i,o,r,c="string"==typeof n&&n.includes(S),d=null,a=null,s=null;if(c){var v=n.split(S),f="".concat(v[0]).concat(S).concat(v[1]);d=(null===(e=At.current[f])||void 0===e?void 0:e.current)||null,a=(null===(t=Mt.current[f])||void 0===t?void 0:t.current)||null,s=a?n:null}else if(d=(null===(i=jt.current[n])||void 0===i?void 0:i.current)||null,qn){var p=bt[n],g=(null==p?void 0:p.refIndexes)||[];if(g.length>0){var h=g[0],m=St.findIndex(function(n){return n.selfIndex===h});-1!==m&&(a=(null===(r=Nt.current[m])||void 0===r?void 0:r.current)||null,s=m)}}else a=(null===(o=Nt.current[n])||void 0===o?void 0:o.current)||null,s=a?n:null;pi.current=s;var x=Ke.current,y=Oe.current,b=function(){!function(){var e,t,i,o,r,l,u,d,a,v,f,p,g=null,h=null,m=null,x=null;if(c){var y=n.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(e=kt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=Ft.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=Pt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=Dt.current[Number(y[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=At.current[b])||void 0===r?void 0:r.current)||g,x=(null===(l=Mt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(n),C=null!==s?Number(s):R;g=(null===(u=Ft.current[R])||void 0===u?void 0:u.current)||null,h=(null===(d=Dt.current[C])||void 0===d?void 0:d.current)||null,m=(null===(a=At.current[R])||void 0===a?void 0:a.current)||(null===(v=jt.current[R])||void 0===v?void 0:v.current)||g,x=(null===(f=Mt.current[C])||void 0===f?void 0:f.current)||(null===(p=Nt.current[C])||void 0===p?void 0:p.current)||h}if(m&&x&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var B=m.getBoundingClientRect(),I=x.getBoundingClientRect(),w=B.top-I.top;w>0?h.style.paddingTop="".concat(w,"px"):w<0&&(g.style.paddingTop="".concat(Math.abs(w),"px"))}}(),ue(!0),Ae.current&&Ae.current(),pe.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):x&&x.dispatchEvent(new Event("scroll")),Gn(!1),null==l||l()};if(!d||!x)return pe.current=!1,Gn(!1),void(null==l||l());if(a&&y){if(!qn){var R=0;R="right"===u?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=He.current,B=(null==C?void 0:C.getBoundingClientRect().top)||0,I=C?C.scrollTop+R-B-150:0;return C?void T(C,I,200,b):void b()}var w=d.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop,_=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=_-(w-x.scrollTop);F<0&&ze.current&&(ze.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var n,e=y.scrollHeight-y.clientHeight;if(F<0)n=0;else{if(F>e){var t=F-e;return We.current&&(We.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(y,F,E,b)})}n=F}T(y,n,E,b)})}else{var D=w-(_-y.scrollTop);D<0&&qe.current&&(qe.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var n,e=x.scrollHeight-x.clientHeight;if(D<0)n=0;else{if(D>e){var t=D-e;return Ye.current&&(Ye.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(x,D,E,b)})}n=D}T(x,n,E,b)})}}else b()}))))},[ve,dt,St,te,qn,bt,Jt]),Wi=c(function(n,e,t,i){var o,r="string"==typeof i?x(i).trim():x(null==i?void 0:i.deviation_summary).trim(),l=n.currentTarget;ct();var u="left";(null===(o=Oe.current)||void 0===o?void 0:o.contains(l))&&(u="right");var c=function(){var n,t,i,o;if("string"==typeof e&&e.includes(S)){var r=e.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===u?null===(n=Mt.current[l])||void 0===n?void 0:n.current:null===(t=At.current[l])||void 0===t?void 0:t.current}return"right"===u?null===(i=Mt.current[e])||void 0===i?void 0:i.current:null===(o=At.current[e])||void 0===o?void 0:o.current};if(t)return Jt(),me(new Set),be([]),_e.current=[],void(r&&requestAnimationFrame(function(){var n=c()||l;ot({open:!0,anchorEl:n,summary:i})}));zi(e,t,r?{toggleIfSame:!1,sourceSide:u,onReady:function(){var n=c()||l;ot({open:!0,anchorEl:n,summary:i})}}:{toggleIfSame:!1,sourceSide:u})},[zi,ct,ot,Jt]),qi=c(function(){var n,e=Qe.sectionIdx,t=Qe.isOrphan;if(rt(),null!=e){var i="left";Qe.anchorEl&&(null===(n=Oe.current)||void 0===n?void 0:n.contains(Qe.anchorEl))&&(i="right"),zi(e,t,{sourceSide:i})}},[zi,Qe.isOrphan,Qe.sectionIdx,Qe.anchorEl,rt]),Yi=c(function(){rt(),Jt(),me(new Set),be([]),_e.current=[]},[rt,Jt]),Ki=null!==Qe.sectionIdx&&he.has(Qe.sectionIdx),Vi=Y({proposedSections:bt,existingSections:St,parentDeviationRecord:Ct,expandedSections:Zt,maintainRelativeOrder:!!qn,scrollContainerRef:He,leftContainerRef:Ke,lhsBadgeRefs:At,rhsBadgeRefs:Mt}),Xi=Vi.showDeviationNavigation,$i=Vi.showOpenNodeRef,Ji=l(function(){var n;if(!jn)return null;var e=null===(n=null==jn?void 0:jn.id)||void 0===n?void 0:n.split(":")[0];for(var t in Ct){if((Ct[t]||[]).some(function(n){return n.id===e}))return t}return null},[jn,Ct]),Ui=r({id:null,triggerMs:null}),Gi=r(null);u(function(){var t;if(null==jn?void 0:jn.id){var i=Number(jn.trigger),o=Ui.current;if((null==o?void 0:o.triggerMs)!==i){if(!(jn.id.includes(":")&&/:\d+$/.test(jn.id)))return Ui.current={id:jn.id,triggerMs:i},void ai(jn.id);var r=null===(t=null==jn?void 0:jn.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";Gi.current!==jn.id&&(rt(),ct(),Jt(),me(new Set),be([]),_e.current=[],Gi.current=jn.id);var d=!1,a=0,s=null,v=150,f=function(n,e){for(var t=function(n,i){if(!n)return null;if(n.id===e)return i;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=t(n.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<n.length;i++){var o=t(n[i],String(i));if(o)return o}return null},p=function(){var t,o,r,u;if(!d){var g=function(){Ui.current={id:jn.id,triggerMs:i}},h=null,m=null;for(var x in Ct){var y=Ct[x].find(function(n){return n.id===l});if(y){h=x,m=y;break}}if(m&&h){var b=bt.findIndex(function(n){return n.id===h}),R=St.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==R,B=f(bt,m.id),I=f(St,m.id);if(B&&!I&&!C){var w=B.split("-"),T=Number(w[0]);if(qn){var _=null===(o=null===(t=bt[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],E=St.findIndex(function(n){return n.selfIndex===_});-1!==E&&(T=E)}I=e([T],w.slice(1),!0).join("-")}if(B||I){var F=C||!B&&!!I,D=B?Number(B.split("-")[0]):b,A=I?Number(I.split("-")[0]):R;if(F){if(!(qn?!!Zt["right-".concat(A)]:!!Zt[String(A)])&&A>=0)return ii(A,"right"),a+=1,void(s=setTimeout(p,450))}else if(!(qn?!!Zt["left-".concat(D)]:!!Zt[String(D)])&&D>=0)return ii(D,"left"),a+=1,void(s=setTimeout(p,450));var M,N=B||"",k=I||"",P="".concat(m.id).concat(S).concat(c).concat(S).concat(N).concat(S).concat(k),j="".concat(m.id).concat(S).concat(c),H=null===(r=At.current[j])||void 0===r?void 0:r.current,L=null===(u=Mt.current[j])||void 0===u?void 0:u.current,O=F||!H&&!!L,z=O?L:H;if(M=qn?O?Oe.current:Ke.current:He.current,z&&M){var W=z.getBoundingClientRect();if(0===W.height)return void((a+=1)<2?s=setTimeout(p,v):g());var q=M.getBoundingClientRect(),Y=W.top-q.top+M.scrollTop-q.height/2+W.height/2+150,K=function(){var e,t,i,o,r;if(!d){g();var l=z instanceof Element?window.getComputedStyle(z).color:"";H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var u=(null===(t=null===(e=m.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[c])||m,a=(null===(i=m.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||m.evaluation_outputs;if(!(!!H&&!!L)){var s=O?(null===(o=Mt.current[j])||void 0===o?void 0:o.current)||L:(null===(r=At.current[j])||void 0===r?void 0:r.current)||H;return ot({open:!0,anchorEl:s,summary:n(n({},u),{evaluation_outputs:a})}),void(null==Hn||Hn())}zi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t=(null===(e=At.current[j])||void 0===e?void 0:e.current)||H;console.log("Summary data",a,u),ot({open:!0,anchorEl:t,summary:n({},u)})}})}};Math.abs(M.scrollTop-Y)<=2?K():(Xe.current=Y,$e.current=K,M.scrollTo({top:Y,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if($e.current){Xe.current=null;var n=$e.current;$e.current=null,n()}},800))}else(a+=1)<2?s=setTimeout(p,v):g()}else(a+=1)<2?s=setTimeout(p,v):g()}else(a+=1)<2?s=setTimeout(p,v):g()}};return s=setTimeout(p,v),function(){d=!0,s&&clearTimeout(s)}}}},[jn,Ct,bt,St,qn,Zt,ii,zi,ot,ai]);var Qi=function(n){var e=n.section,t=n.keyPath,o=n.depth,r=void 0===o?0:o,l=n.columnKey,u=void 0===l?"left":l,c=n.parentNodeId;return i(X,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:void 0===c?"":c,expandedSubSections:ei,setExpandedSubSections:ti,maintainRelativeOrder:qn||!1,proposedSections:bt,existingSections:St,treeData:wn,deviationNumberRegistry:Bt,connectedSections:he,activeSideBySideSection:ve,resolvedMarkdownStyles:je,getSubSectionRef:Lt,getSubSectionCompareStyle:wi,getBadgeRef:Ot,openMoreFunctionsPopup:li,openSummaryPopup:Wi,showDeviationBadges:Kn,resetSideBySide:Jt,setConnectedSections:me,setConnectedLines:be,cachedConnectedPositions:_e,isProposingFix:On,proposingFixNodeId:zn})};return t(d,n({ref:Le,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},qn?{}:{overflow:"visible"}),{position:"relative"})},{children:[Xn&&i(d,n({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(H,{})})),it.open&&i($,{open:it.open,anchorEl:it.anchorEl,containerEl:fi.current,clipTopEl:hi.current,scrollContainerEl:He.current,onClose:Yi,summary:it.summary}),i(j,{open:Qe.open,anchorEl:Qe.anchorEl,sectionTitle:Qe.sectionTitle,referenceSectionTitle:Qe.refSectionTitle,onClose:dt,onOpenCognitiveCompare:ui,onOpenSideBySide:qi,onConnect:ci,isConnected:Ki,isOrphan:Qe.isOrphan}),Ue.open&&i(P,{open:Ue.open,popupRef:ut,position:nt,popupConfig:Nn,onClose:function(){et(null),Ge(function(e){return n(n({},e),{open:!1})}),lt(null)},markdownStyles:Fn,sectionTitle:Ue.sectionTitle,referenceSectionTitle:Ue.refSectionTitle,cognitiveData:Ue.cognitiveData,anchorEl:Ue.anchorEl,sectionAnchorEl:Ue.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Ue.badgeStyle,docData:Ue.docData,deviationData:Ue.deviationData,isLoading:Ue.isLoading}),i(a,n({open:!!Zn,autoHideDuration:8e3,onClose:function(){return ne(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,n({onClose:function(){return ne(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Zn}))})),i(K,{componentHeaderText:In,displayConfig:Mn,maintainRelativeOrder:qn,onCollapseAll:_i,showCollapseAll:Ei,onToggleView:function(n){$n(!0),setTimeout(function(){Yn(!n),Jt(),rt(),me(new Set),be([]),_e.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){$n(!1)},600)})})},50)}}),i(d,n({ref:He,onScroll:Pi,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:qn?"hidden":"auto",borderTop:Wt&&qt?"none":"1.5px solid #EEF0F4"}},{children:i(d,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},qn?{flex:1,minHeight:0}:{})},{children:t(d,n({ref:vi,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},qn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:Se,style:{position:"absolute",top:0,left:0,width:ke.width||"100%",height:ke.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:de?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Ri&&i("g",{children:i("line",{x1:Ri.x1,y1:Ri.y,x2:Ri.x2,y2:Ri.y,stroke:Xt.badgeBorder,strokeWidth:"1.5"})}),yi.map(function(e){var o,r,l,u,c,a,s=e.x1+.5*(e.x2-e.x1),v=(e.y1+e.y2)/2;if("Not Defined"===e.style.label&&!e.hasCognitive)return null;if(e.isSubSection?te&&ve===e.subSectionKeyPath&&le:te&&ve===e.sectionIdx&&le)return null;if(!qn){var f=e.isSubSection?w(e.x1,e.y1,e.x2,e.y2):"M ".concat(e.x1," ").concat(e.y1," L ").concat(e.x2," ").concat(e.y2),g=bt[e.sectionIdx]||{title:"",content:""},m=St[e.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,m),e.isSubSection&&e.subSectionKeyPath){var x=e.subSectionKeyPath.includes(S)?e.subSectionKeyPath.split(S):[],y=x[2]||e.subSectionKeyPath,b=x[3]||y,R=y.split("-").map(Number),C=b.split("-").map(Number),B=null,I=null;R.length>0&&(B=bt[R[0]]),C.length>0&&(I=St[C[0]]);var T=(null==B?void 0:B.title)||"",_=(null==I?void 0:I.title)||"";console.log("Root Parent Titles:",T,_);for(var E=1;E<R.length;E++)(null==B?void 0:B.subsections)&&(B=B.subsections[R[E]]);for(E=1;E<C.length;E++)(null==I?void 0:I.subsections)&&(I=I.subsections[C[E]]);B&&(g=n(n({},B),{title:T||B.title})),console.log("Base Section for Subsection Badge:",g),I&&(m=n(n({},I),{title:_||I.title})),console.log("Ref Section for Subsection Badge:",m)}var F=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),D=(null===(a=null===(c=null===(u=g.evaluationResult)||void 0===u?void 0:u.cognitive_decisioning)||void 0===c?void 0:c.decisioning_factors)||void 0===a?void 0:a.length)||!1,A=F||D;return t("g",{children:[i("path",{d:f,fill:"none",stroke:e.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",n({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,n({onClick:function(n){n.stopPropagation(),A&&(Ue.open&&tt===e.id?ct():(lt(e.id),ri(oi(n.currentTarget,g,m,e.sectionIdx,e.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:e.style.badgeBg,color:e.style.badgeText,border:"1px solid ".concat(e.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:A?"pointer":"default"}},{children:[e.style.badgeText===N&&null==e.style.label?i(L,{color:e.style.badgeText}):0===e.style.label?"Same":e.style.label,i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),A&&i(p,{size:11,style:{transform:Ue.open&&tt===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),i(J,{connectedLines:ye,pathRefs:Te})]})),t(d,n({sx:n({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},qn?{flex:1,overflow:"visible"}:{})},{children:[i(d,n({ref:hi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,n({title:gt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:gt}))}))})),t(d,n({ref:Ke,onScroll:Pi,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&bt.map(function(e,o){var r,l,u=!e.title&&!e.content;if(qn&&u)return null;var c=e,a=Ii(o,"left"),s=qn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!St[o],v=qn?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:o+1,f=he.has(o),p=y(c.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,n({ref:Ht(o),sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Ft.current[o],sx:n({width:"100%",display:"flex",flexDirection:"column",minWidth:0},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"left",colRef:Ht("left-accordion-".concat(o)),mb:0,treeData:wn,proposedSections:bt,existingSections:St,deviationNumberRegistry:Bt,getSectionCompareStyle:Ii,getBadgeRef:Ot,connectedSections:he,openMoreFunctionsPopup:li,openSummaryPopup:Wi,deviationNodeIdToView:null==jn?void 0:jn.id,deviationTargetParentId:Ji,parentNodeId:(null===(l=null==wn?void 0:wn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:qn?!!Zt["left-".concat(o)]:!!Zt[String(o)],onToggle:function(){Yi(),ii(o,"left")},navigation:e.id?Xi[e.id]:null,showOpenNodeRef:$i,resolvedMarkdownStyles:je,maintainRelativeOrder:qn,showDeviationBadges:Kn,renderSubSections:Qi,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&a&&t(d,n({ref:At.current[o],onClick:function(n){var e,t,i,r=Mn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Wi(n,String(o),s,r)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var r=Mn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Wi(n,String(o),s,r)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:s?"default":"pointer",borderRight:"1px solid ".concat(a.badgeBorder),"&:hover":s?{}:{bgColor:"".concat(a.badgeBorder,"22")}}},{children:[null!=v&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!Mn.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):i(L,{color:a.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var t=qn?St.find(function(n){var e;return(null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n))||{title:"",content:""}}):St[o]||{title:"",content:""};li(n,e,s,t,o,a)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(a.badgeBorder,"22")}}},{children:i(g,{size:11,color:a.badgeText})}))]}))]}))}),"left-row-".concat(o))}),i("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,n({ref:fi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,n({onClick:function(e){e.stopPropagation(),Ue.open&&tt===Yt?ct():(lt(Yt),ri(oi(e.currentTarget,{title:"",content:"",evaluationResult:Kt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Yt,!0,n(n({},Xt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Xt.badgeBg,color:Xt.badgeText,border:"1px solid ".concat(Xt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Vt?Vt:i(L,{}),i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(p,{size:11,style:{transform:Ue.open&&tt===Yt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,n({sx:n({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},qn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Un&&i(m,{sections:11}),i(d,n({ref:mi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,n({title:ht,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:ht}))}))})),t(d,n({ref:Oe,onScroll:Pi,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:ze,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&St.map(function(e,o){var r,l=e,u=[],c=!1,a=null,s=-1;if(qn){u=bt.filter(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0}).map(function(n){return n.selfIndex+1}),s=bt.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0});var v=bt.findIndex(function(n,e){var t;return he.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==v)&&(a=Ii(v))}else u=[o+1],(c=he.has(o))&&(a=Ii(o));var f=Ii(qn&&-1!==s?s:o);return i(d,n({ref:Nt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Dt.current[o],sx:n({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"right",colRef:Ht("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==wn?void 0:wn.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:qn?!!Zt["right-".concat(o)]:!!Zt[String(o)],treeData:wn,proposedSections:bt,existingSections:St,deviationNumberRegistry:Bt,getBadgeRef:Ot,getSectionCompareStyle:Ii,connectedSections:he,openMoreFunctionsPopup:li,openSummaryPopup:Wi,deviationNodeIdToView:null==jn?void 0:jn.id,deviationTargetParentId:Ji,onToggle:function(){Yi(),ii(o,"right")},navigation:e.id?Xi[e.id]:null,showOpenNodeRef:$i,resolvedMarkdownStyles:je,maintainRelativeOrder:qn,showDeviationBadges:Kn,renderSubSections:Qi,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&f&&i(d,n({ref:Mt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:f.badgeBg,color:f.badgeText,border:"1px solid ".concat(f.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{U as default};
|
|
1
|
+
import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as u,useCallback as c}from"react";import{Box as a,Snackbar as d,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 m from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,findKeyPathByNodeId as R,getFirstDeviationOutputValue as C,getFirstDeviationColor as I,hasValue as B,getBentArrowPath as w,smoothScrollTo as T,resetClauseHighlight as _,scrollAndHighlightClause as E}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as F,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as M,DEFAULT_DEVIAION_COLOR as N,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import P from"./CognitivePopup.js";import j from"./MoreFunctionsPopup.js";import H from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as O}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as W}from"./hooks/useSectionRefs.js";import{useAccordionState as q}from"./hooks/useAccordionState.js";import{useDeviationNavigation as Y}from"./hooks/useDeviationNavigation.js";import K from"./components/CompareHeader.js";import V from"./components/SectionAccordion.js";import X from"./components/SubSectionAccordion.js";import $ from"./components/CognitiveSummaryPopup.js";import J from"./components/connectedLines.js";var U=function(U){var G,Q,Z,nn,en,tn,on,rn,ln,un,cn,an,dn,sn,vn,pn,fn,gn,hn,mn,xn,yn,bn,Sn,Rn,Cn,In=U.componentHeaderText,Bn=void 0===In?k:In,wn=U.treeData,Tn=U.comparisonConfig,_n=U.leftColumnTitleText,En=U.rightColumnTitleText,Fn=U.markdownStyles,Dn=U.resetTrigger,An=U.displayConfig,Mn=void 0===An?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:An,Nn=U.popupConfig,kn=U.deviationData,Pn=void 0===kn?{}:kn,jn=U.deviationNodeIdToView,Hn=U.resetDeviationNodeId,Ln=U.isProposingFix,On=void 0!==Ln&&Ln,zn=U.proposingFixNodeId,Wn=o(Mn.maintainRelativeOrder),qn=Wn[0],Yn=Wn[1],Kn=!!qn||!!(null==Mn?void 0:Mn.showDeviationBadges),Vn=o(!1),Xn=Vn[0],$n=Vn[1],Jn=o(!1),Un=Jn[0],Gn=Jn[1],Qn=o(null),Zn=Qn[0],ne=Qn[1],ee=o(!1),te=ee[0],ie=ee[1],oe=o(null===(Q=null!==(G=null==wn?void 0:wn.newEvaluationResult)&&void 0!==G?G:null==Mn?void 0:Mn.enableDeviationSchemaBackwardCompatibility)||void 0===Q||Q)[0],re=o(!1),le=re[0],ue=re[1],ce=o(!1),ae=ce[0],de=ce[1],se=o(null),ve=se[0],pe=se[1],fe=r(!1),ge=o(new Set),he=ge[0],me=ge[1],xe=o([]),ye=xe[0],be=xe[1],Se=r(null),Re=r(null),Ce=r(null),Ie=r(new Set),Be=r(!1),we=r(null),Te=r({}),_e=r([]),Ee=r(!1),Fe=r(!1),De=r(null),Ae=r(function(){}),Me=l(function(){return(null==wn?void 0:wn.cognitive_decisioning)||{}},[wn]),Ne=o({width:0,height:0}),ke=Ne[0],Pe=Ne[1],je=l(function(){return n(n({},F),Fn)},[Fn]),He=r(null),Le=r(null),Oe=r(null),ze=r(null),We=r(null),qe=r(null),Ye=r(null),Ke=r(null),Ve=r(!1),Xe=r(null),$e=r(null),Je=z(He),Ue=Je.cognitivePopup,Ge=Je.setCognitivePopup,Qe=Je.moreFunctions,Ze=Je.setMoreFunctions,nt=Je.position,et=Je.setPosition,tt=Je.activeBadgeId,it=Je.summaryPopup,ot=Je.setSummaryPopup,rt=Je.closeSummaryPopup,lt=Je.setActiveBadgeId,ut=Je.popupRef,ct=Je.closeCognitivePopup,at=Je.closeMoreFunctionsPopup,dt=l(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==Tn?void 0:Tn.fields)&&void 0!==n?n:D,thresholds:{high:null!==(t=null===(e=null==Tn?void 0:Tn.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:A.thresholds.high,medium:null!==(o=null===(i=null==Tn?void 0:Tn.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(l=null===(r=null==Tn?void 0:Tn.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:A.thresholds.exact}}},[Tn]),st=o(null),vt=st[0];st[1];var pt=null===(en=null===(Z=null==wn?void 0:wn.documents)||void 0===Z?void 0:Z[null===(nn=null==wn?void 0:wn.input_index_map)||void 0===nn?void 0:nn[0]])||void 0===en?void 0:en.title,ft=null===(rn=null===(tn=null==wn?void 0:wn.documents)||void 0===tn?void 0:tn[null===(on=null==wn?void 0:wn.input_index_map)||void 0===on?void 0:on[1]])||void 0===rn?void 0:rn.title,gt=x(_n||pt||"Uploaded Contract"),ht=x(En||ft||"Reference Template"),mt=O(wn,qn,Pn,dt,oe),xt=mt.activeProposed,yt=mt.existingRule,bt=mt.proposedSections,St=mt.existingSections,Rt=mt.visibleFields,Ct=mt.parentDeviationRecord,It=mt.deviationNumberRegistry,Bt=mt.parseError;u(function(){Bt&&ne("Failed to load comparison: ".concat(Bt))},[Bt]);var wt=bt.length>0||St.length>0,Tt=W(Rt.map(function(n){return n.key}),Math.max(bt.length,St.length)),_t=Tt.leftRefs,Et=Tt.rightRefs,Ft=Tt.sectionLeftRefs,Dt=Tt.sectionRightRefs,At=Tt.lhsBadgeRefs,Mt=Tt.rhsBadgeRefs,Nt=Tt.sectionRightRowRefs,kt=Tt.subSectionLeftRefs,Pt=Tt.subSectionRightRefs,jt=Tt.sectionRowRefs,Ht=Tt.getSectionRowRef,Lt=Tt.getSubSectionRef,Ot=Tt.getBadgeRef,zt=yt.analysis,Wt=x(null===(un=null===(ln=null==zt?void 0:zt.rule_difference_comparison)||void 0===ln?void 0:ln.summary)||void 0===un?void 0:un.overall_summary),qt=!!Wt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Yt=null!==(cn=null==wn?void 0:wn.base_root_id)&&void 0!==cn?cn:"-1";null==wn||wn[Yt];var Kt=oe?null!==(bn=null!==(mn=Pn&&(null===(hn=null==Pn?void 0:Pn[Yt])||void 0===hn?void 0:hn.evaluation_result))&&void 0!==mn?mn:null===(yn=null===(xn=null==wn?void 0:wn.nodes)||void 0===xn?void 0:xn[Yt])||void 0===yn?void 0:yn.evaluation_result)&&void 0!==bn?bn:null:null!==(gn=null!==(sn=Pn&&(null===(dn=null===(an=null==Pn?void 0:Pn[Yt])||void 0===an?void 0:an.evaluation_result)||void 0===dn?void 0:dn[0]))&&void 0!==sn?sn:null===(fn=null===(pn=null===(vn=null==wn?void 0:wn.nodes)||void 0===vn?void 0:vn[Yt])||void 0===pn?void 0:pn.evaluation_result)||void 0===fn?void 0:fn[0])&&void 0!==gn?gn:null,Vt=y(Kt),Xt=b(null!==(Cn=null===(Rn=null===(Sn=null==Kt?void 0:Kt.evaluation_outputs)||void 0===Sn?void 0:Sn.metadata)||void 0===Rn?void 0:Rn.label_color)&&void 0!==Cn?Cn:""),$t=function(){Ie.current.forEach(function(n){_(n)}),Ie.current.clear()},Jt=c(function(){var n,e,t,i,o,r;$t(),ie(!1),Fe.current=!1,Re.current=null;var l=De.current,u=fi.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var c=l.split(S);(a=(null===(n=kt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=Ft.current[Number(c[2])])||void 0===e?void 0:e.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(t=Ft.current[l])||void 0===t?void 0:t.current)&&(a.style.paddingTop="0px")}if(null!==u)if("string"==typeof u&&u.includes(S)){c=u.split(S);(d=(null===(i=Pt.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=Dt.current[Number(c[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Dt.current[u])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}pe(null),De.current=null,fi.current=null,ue(!1),Gn(!1),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px")},[]),Ut=c(function(){$t(),Jt(),me(new Set),be([]),_e.current=[],bi([]),Ci(null),ot(M),ct(),requestAnimationFrame(function(){var n;null===(n=Ae.current)||void 0===n||n.call(Ae)})},[]),Gt=r(Ut);u(function(){Gt.current=Ut},[Ut]),u(function(){Dn&&Gt.current()},[Dn]);var Qt=q({maintainRelativeOrder:!!qn,proposedSections:bt,existingSections:St,activeSideBySideSection:ve,connectedSections:he,resetSideBySide:Jt,setConnectedSections:me,setConnectedLines:be,cachedConnectedPositions:_e,svgContainerRef:Se,isAnimatingRef:Be,animationTimerRef:we,calculateLinesRef:Ae,sectionLeftRefs:Ft,sectionRightRefs:Dt,subSectionLeftRefs:kt,subSectionRightRefs:Pt}),Zt=Qt.expandedSections,ni=Qt.setExpandedSections,ei=Qt.expandedSubSections,ti=Qt.setExpandedSubSections,ii=Qt.toggleSection,oi=c(function(e,t,i,o,r,l,u){var c,a,d,s=x(null==t?void 0:t.id)||x(null==i?void 0:i.id)||"",v=(s?Me[s]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:s,decisioning:[],gap:[],relevance_score:0},p=null!==(a=null===(c=jt.current[o])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(d=null==Mn?void 0:Mn.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==wn?void 0:wn.documents,input_index_map:null==wn?void 0:wn.input_index_map},deviationData:function(){var e,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,u=function(e){var t=function(n){if(!n||"object"!=typeof n)return null;var e=null==n?void 0:n.deviation_entries;if(e&&"object"==typeof e){var t=Object.keys(e).sort(function(n,e){return Number(n)-Number(e)})[0];if(t&&e[t])return e[t]}var i=Object.keys(n).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,e){return Number(n)-Number(e)});if(i.length&&n[i[0]])return n[i[0]];var o=null==n?void 0:n.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(n,e){return Number(n)-Number(e)})[0];if(r&&o[r])return o[r]}return null}(e);return t?n(n({},e),{deviation_summary:(null==e?void 0:e.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==e?void 0:e.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==e?void 0:e.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==e?void 0:e.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==e?void 0:e.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==e?void 0:e.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):e};if(!("string"==typeof o&&o.includes(S)))return u(l);var c=o.split(S)[1];if(!c)return l;var a=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(e=null==a?void 0:a.deviation_entries)||void 0===e?void 0:e[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return d?n(n(n({},a),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[Me,wn]),ri=c(function(n){at(),et(null),Ge(n)},[at]),li=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),Qe.open&&Qe.sectionIdx===o)at();else{var u=n.currentTarget,c="left";(null===(l=Oe.current)||void 0===l?void 0:l.contains(u))&&(c="right");$t(),Fe.current&&Jt(),me(new Set),be([]),_e.current=[],ct(),it.open?Yi():rt(),requestAnimationFrame(function(){var n=function(){var n,e,t,i;if("string"==typeof o&&o.includes(S)){var r=o.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(n=Mt.current[l])||void 0===n?void 0:n.current:null===(e=At.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=Mt.current[o])||void 0===t?void 0:t.current:null===(i=At.current[o])||void 0===i?void 0:i.current}()||u;Ze(oi(n,e,i,o,t,r))})}},ui=c(function(){null!==Qe.sectionIdx&&Qe.anchorEl?ri(n(n({},Qe),{open:!0})):at()},[Qe,at,ri]),ci=c(function(){var n=Qe.sectionIdx,e=Qe.isOrphan;at(),rt(),null!==n&&(e?ne("No counterpart exists to connect to."):($t(),Fe.current&&Jt(),be([]),_e.current=[],me(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Ae.current&&Ae.current()},50)))},[Qe.sectionIdx,Qe.isOrphan,at,rt,Jt]),ai=c(function(){var n=Ce.current;if(n){Ce.current=null;var e=bt.findIndex(function(e){return e.id===n}),t=St.findIndex(function(e){return e.id===n}),i=-1===e?R(bt,n):null,o=-1===t?R(St,n):null,r=-1!==e?e:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=function(n,e,t,i){var o,r,l,u;return-1!==n?null!==(r=null===(o=t.current[n])||void 0===o?void 0:o.current)&&void 0!==r?r:null:e&&null!==(u=null===(l=i.current[e])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(n,e,t){void 0===t&&(t=30);var i=0,o=function(){var r=n();r&&0!==r.getBoundingClientRect().height?(Ie.current.add(r),E(r,e)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(qn)-1!==r&&Ke.current&&c(function(){return u(e,i,Ft,kt)},Ke.current),-1!==l&&Oe.current&&c(function(){return u(t,o,Dt,Pt)},Oe.current);else{var a=He.current;if(!a)return;c(function(){return-1!==r?u(e,i,Ft,kt):u(t,o,Dt,Pt)},a)}}},[bt,St,qn,Ft,Dt,kt,Pt,Ke,Oe,He]),di=c(function(e){if(e){$t(),Jt(),me(new Set),be([]),_e.current=[],rt(),ct();var t=bt.findIndex(function(n){return n.id===e}),i=St.findIndex(function(n){return n.id===e}),o=-1===t?R(bt,e):null,r=-1===i?R(St,e):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=-1!==i?i:r?Number(r.split("-")[0]):-1;Ce.current=e,ni(function(e){var t,i=n({},e),o=!1;-1!==l&&(i[t=qn?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==u&&(i[t=qn?"right-".concat(u):String(u)]||(i[t]=!0,o=!0));return o?i:e}),ti(function(e){var t=n({},e),i=!1,l=function(n){for(var e=n.split("-"),o=e[0],r=1;r<e.length;r++)o+="-".concat(e[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:e}),setTimeout(function(){requestAnimationFrame(function(){Ce.current===e&&si.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(e,'" not found'))}},[bt,St,qn,ni,ti,Jt,rt,ct]),si=r(ai);u(function(){si.current=ai},[ai]);var vi=r(null),pi=r(null),fi=r(null),gi=r(null),hi=r(null),mi=r(null),xi=o([]),yi=xi[0],bi=xi[1];r(null);var Si=o(null),Ri=Si[0],Ci=Si[1];u(function(){if(vt){var n=dt.fields.find(function(n){return n.analysisKey===vt||n.key===vt});if(n){var e=_t.current[n.key]||Et.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[vt,dt.fields]);var Ii=c(function(n){var e,t,i,o,r,l,u,c,a,d=null===(e=null==zt?void 0:zt.rule_difference_comparison)||void 0===e?void 0:e.fields;if(!d||!d[n])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[n],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var 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===(u=p.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[zt]),Bi=c(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=bt[e],qn&&l){var c=St.filter(function(n){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});u=c.find(function(n){return n.evaluationResult})||c[0]}else u=St[e];else if(u=St[e],qn&&u){var a=bt.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(u.selfIndex)});l=a.find(function(n){return n.evaluationResult})||a[0]}else l=bt[e];var d=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,s=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,v=!(!(null==l?void 0:l.cognitiveData)&&!(null==u?void 0:u.cognitiveData));if(!d&&!s&&!v)return n(n({},b(N)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==u?void 0:u.evaluationResult)&&void 0!==o?o:null,f=C(p),g=I(p);return n(n({},b(g)),null!=p?{label:null!==(r=f)&&void 0!==r?r:""}:{label:null})},[bt,St,Me,dt,qn]),wi=c(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=bt[u[0]],a=St[u[0]],d=1;d<u.length;d++)(null==c?void 0:c.subsections)&&(c=c.subsections[u[d]]),(null==a?void 0:a.subsections)&&(a=a.subsections[u[d]]);if(!c&&!a)return null;var s=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,v=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,p=x(null==c?void 0:c.id)||x(null==a?void 0:a.id)||"",f=!(!(null==c?void 0:c.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!s&&!v&&!f)return n(n({},b(N)),{label:"Not Defined"});null!==(i=null!==(t=null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=Me[p])||void 0===o||o.relevance_score);var g=null!==(l=null!==(r=null==c?void 0:c.evaluationResult)&&void 0!==r?r:null==a?void 0:a.evaluationResult)&&void 0!==l?l:null,h=C(g),m=I(g);return n(n({},b(m)),null!=g?{label:null!=h?h:""}:{label:null})},[bt,St,Me,dt]),Ti=c(function(e,t){var i,o,r,l,u,c,a,d,s,v,p,f,g,h,m,x,y;if(!e||null==t)return null;var S=null!==(a=null!==(u=null!==(o=null===(i=null==Pn?void 0:Pn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==wn?void 0:wn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==wn?void 0:wn[e])||void 0===c?void 0:c.evaluation_result)&&void 0!==a?a:null;if(!S||"object"!=typeof S)return null;var R=null!==(p=null!==(s=null===(d=null==S?void 0:S.deviations)||void 0===d?void 0:d[t])&&void 0!==s?s:null===(v=null==S?void 0:S.deviation_entries)||void 0===v?void 0:v[t])&&void 0!==p?p:null==S?void 0:S[t],C=null!==(y=null!==(h=null===(g=null===(f=null==R?void 0:R.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)&&void 0!==h?h:null===(x=null===(m=null==S?void 0:S.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===x?void 0:x.label_color)&&void 0!==y?y:N;return n(n({},b(C)),{label:null})},[Pn,wn]),_i=c(function(){$t(),ni({}),ti({}),Jt(),me(new Set),be([]),_e.current=[],rt(),ct(),at(),requestAnimationFrame(function(){Ae.current&&Ae.current()})},[ni,ti,Jt,rt,ct,at]),Ei=l(function(){return Object.values(Zt).some(Boolean)||Object.values(ei).some(Boolean)},[Zt,ei]),Fi=c(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f,g,h,m,x,y,b,R,C;if(!Ve.current&&!Be.current){Ve.current=!0;try{if(!vi.current)return;var I=function(n){var e=n.split("-"),t=e[0];if(!Zt[t]&&!1===qn)return!1;if(qn&&!Zt["left-".concat(t)]&&!Zt["right-".concat(t)]&&!Zt[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!ei[i])return!1;return!0},T=vi.current.getBoundingClientRect();Pe({width:T.width,height:T.height});var _=[];if(Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.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")}),!Be.current){for(var E=0;E<Math.max(bt.length,St.length);E++){var F=null===(n=Ft.current[E])||void 0===n?void 0:n.current,D=null===(e=Dt.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),D&&(D.style.height="auto",D.style.minHeight="0px")}qn||Object.keys(kt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var A={};Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();A[i]=Math.max(l.height,u.height)}});var M={left:{},right:{}},N={};if(!Be.current)if(qn){if(te&&null!==ve)if("number"==typeof ve){var k=ve,P=bt[k],j=null===(o=Ft.current[k])||void 0===o?void 0:o.current;j&&P&&(P.refIndexes||[]).forEach(function(n){var e,t=St.findIndex(function(e){return e.selfIndex===n}),i=null===(e=Dt.current[t])||void 0===e?void 0:e.current;if(i&&(Zt["left-".concat(k)]||Zt["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);M.left[k]=Math.max(M.left[k]||0,o),M.right[t]=Math.max(M.right[t]||0,o)}})}else{var H=ve.split(S)[2];if(H){F=null===(r=kt.current[H])||void 0===r?void 0:r.current,D=null===(l=Pt.current[H])||void 0===l?void 0:l.current;if(F&&D){L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);N[H]=Math.max(N[H]||0,L)}}}}else{Object.keys(kt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);N[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(bt.length,St.length);E++){var F=null===(t=Ft.current[E])||void 0===t?void 0:t.current,D=null===(i=Dt.current[E])||void 0===i?void 0:i.current;if(F&&D){var L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);M.left[E]=L,M.right[E]=L}}}if(Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=A[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Be.current||(Object.entries(M.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Ft.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(M.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Dt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),qn||Object.keys(N).forEach(function(n){var e,t,i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(i&&o&&N[n]){var r=N[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),qn)bt.forEach(function(n,e){var t;(null===(t=Ft.current[e])||void 0===t?void 0:t.current)&&(n.refIndexes||[]).forEach(function(n){var t,i,o,r,l,u,c,a,d,s,v=St.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var p=null===(t=At.current[e])||void 0===t?void 0:t.current,f=null===(i=Mt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),m=g.right-T.left,x=h.left-T.left,y=g.top+g.height/2-T.top,b=h.top+h.height/2-T.top;if(te&&ve===e){var S=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=Oe.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(a=null===(c=Ke.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=R+(null!==(s=null===(d=Oe.current)||void 0===d?void 0:d.clientHeight)&&void 0!==s?s:1/0),B=g.top+g.height/2,w=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(B,S,C)-T.top,b=E(w,R,I)-T.top}var F=Bi(e);F&&_.push({id:"line-".concat(e,"-").concat(v),x1:m,y1:y,x2:x,y2:b,style:F,sectionIdx:e,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(bt.length,St.length);E++){var O=null===(u=Ft.current[E])||void 0===u?void 0:u.current,z=null===(c=Dt.current[E])||void 0===c?void 0:c.current;if(O&&z){var W=O.getBoundingClientRect(),q=z.getBoundingClientRect(),Y=Math.max(W.top,q.top)+18-T.top,K=(null===(a=St[E])||void 0===a?void 0:a.id)||"sec-".concat(E);(Z=Bi(E))&&_.push({id:K,x1:W.right-T.left,y1:Y,x2:q.left-T.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(d=bt[E])||void 0===d?void 0:d.cognitiveData)||(null===(s=St[E])||void 0===s?void 0:s.cognitiveData)||K&&Me[K]),isSubSection:!1})}}Object.keys(kt.current).forEach(function(n){var e,t,i,o,r,l;if(I(n)){var u=null===(e=kt.current[n])||void 0===e?void 0:e.current,c=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var a=n.split("-").map(Number),d=bt[a[0]],s=St[a[0]],v=1;v<a.length;v++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[a[v]]);var p=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&B(d.title)),f=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&B(d.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&B(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&B(s.content));if(p&&f||g&&h){var m=u.getBoundingClientRect(),x=c.getBoundingClientRect(),y=Math.max(m.top,x.top)+16-T.top,b=wi(n);b&&"Not Defined"!==b.label&&_.push({id:"subsec-".concat(n),x1:m.right-T.left,y1:y,x2:x.left-T.left,y2:y,style:b,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:n,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(te&&"string"==typeof ve&&ve.includes(S)){var V=ve.split(S),X=V[0],$=V[1],J=V[2],U=(V[3],"".concat(X).concat(S).concat($)),G=null===(v=At.current[U])||void 0===v?void 0:v.current,Q=null===(p=Mt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,nn=G.getBoundingClientRect(),en=Q.getBoundingClientRect(),tn=nn.right-T.left,on=en.left-T.left,rn=nn.top+nn.height/2-T.top,ln=en.top+en.height/2-T.top;if(qn){var un=null!==(g=null===(f=Ke.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(m=null===(h=Oe.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==m?m:0,an=un+(null!==(y=null===(x=Ke.current)||void 0===x?void 0:x.clientHeight)&&void 0!==y?y:1/0),dn=cn+(null!==(R=null===(b=Oe.current)||void 0===b?void 0:b.clientHeight)&&void 0!==R?R:1/0),sn=function(n,e,t){return Math.max(e,Math.min(t,n))};rn=sn(nn.top+nn.height/2,un,an)-T.top,ln=sn(en.top+en.height/2,cn,dn)-T.top}(Z=null!==(C=Ti(X,$))&&void 0!==C?C:wi(J))&&_.push({id:"line-subsec-".concat(U),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:ve})}}if(bi(_),hi.current&&mi.current){var vn=hi.current.getBoundingClientRect(),pn=mi.current.getBoundingClientRect(),fn=(vn.top+vn.height/2-T.top+pn.top+pn.height/2-T.top)/2;Ci({x1:vn.right-T.left,x2:pn.left-T.left,y:fn})}else Ci(null);if(he.size>0){var gn=[],hn=Ke.current,mn=Oe.current;if(hn&&mn){var xn=[],yn=hn.getBoundingClientRect().top,bn=mn.getBoundingClientRect().top,Sn=yn+hn.clientHeight,Rn=bn+mn.clientHeight,Cn=hn.scrollTop,In=mn.scrollTop,Bn=T.top,wn=function(n,e,t){return Math.max(e,Math.min(t,n))};he.forEach(function(n){var e,t,i,o,r,l;if("string"==typeof n&&n.includes(S)){var u=n.split(S),c=u[0],a=u[1],d=u[2],s=(u[3],"".concat(c).concat(S).concat(a)),v=null===(e=At.current[s])||void 0===e?void 0:e.current,p=null===(t=Mt.current[s])||void 0===t?void 0:t.current;if(!v||!p)return;var f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=null!==(i=Ti(c,a))&&void 0!==i?i:wi(d),m=(P=f.right-T.left)+.5*((j=g.left-T.left-0)-P),x=f.top+f.height/2,y=g.top+g.height/2,b=x-yn+Cn,R=y-bn+In,C="conn-subsec-".concat(s);xn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:j,containerTop:Bn,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var I=wn(x,yn,Sn),B=wn(y,bn,Rn),_=I-Bn,E=B-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(H=x>=yn-4&&x<=Sn+4)&&F?w(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(m,",").concat(_," L ").concat(m,",").concat(E):!H&&F?"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:n,rhsArrayIdx:n})}else if(qn){var A=n,M=bt[A];if(!(null===(l=null==M?void 0:M.refIndexes)||void 0===l?void 0:l.length))return;M.refIndexes.forEach(function(n){var e,t,i=St.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=At.current[A])||void 0===e?void 0:e.current,r=null===(t=Mt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=Bi(A),a=l.right-T.left,d=u.left-T.left-0,s=a+.5*(d-a),v=l.top+l.height/2,p=u.top+u.height/2,f=v-yn+Cn,g=p-bn+In,h="conn-".concat(A,"-").concat(i);xn.push({lhsScrollY:f,rhsScrollY:g,x1:a,x2:d,containerTop:Bn,leftIdx:A,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var m=wn(v,yn,Sn),x=wn(p,bn,Rn),y=m-Bn,b=x-Bn,S=v>=yn-4&&v<=Sn+4,R=p>=bn-4&&p<=Rn+4,C="";C=S&&R?w(a,y,d,b):S&&!R?"M ".concat(a,",").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(d,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),gn.push({id:h,pathD:C,style:c,leftIdx:A,rhsArrayIdx:i})}}})}else{var N=n,k=N;v=null===(o=At.current[N])||void 0===o?void 0:o.current,p=null===(r=Mt.current[k])||void 0===r?void 0:r.current;if(!v||!p)return;var P,j;f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=Bi(N),m=(P=f.right-T.left)+.5*((j=g.left-T.left-0)-P),x=f.top+f.height/2,y=g.top+g.height/2,b=x-yn+Cn,R=y-bn+In,C="conn-".concat(N,"-").concat(k);xn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:j,containerTop:Bn,leftIdx:N,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var H;I=wn(x,yn,Sn),B=wn(y,bn,Rn),_=I-Bn,E=B-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(H=x>=yn-4&&x<=Sn+4)&&F?w(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(m,",").concat(_," L ").concat(m,",").concat(E):!H&&F?"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:N,rhsArrayIdx:k})}}),_e.current=xn}be(gn)}else be([]),_e.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{Ve.current=!1}}},[Rt,bt,St,Me,dt,Ii,Bi,Ti,qn,te,ve,he,Zt,ei]),Di=c(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f=_e.current;if(f.length&&!Be.current){var g=null!==(e=null===(n=Ke.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=Oe.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,x=null!==(u=null===(l=Oe.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(a=null===(c=Ke.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(s=null===(d=Oe.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+m,R=b+x,C=null!==(p=null===(v=vi.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,I=function(n,e,t){return Math.max(e,Math.min(t,n))};f.forEach(function(n){var e=n.lhsScrollY-g+y,t=n.rhsScrollY-h+b,i=Te.current[n.styleId+"-stroke"],o=Te.current[n.styleId+"-bg"];if(i||o){var r,l=I(e,y,S),u=I(t,b,R),c=l-C,a=u-C,d=e>=y-4&&e<=S+4,s=t>=b-4&&t<=R+4,v=n.x1+.5*(n.x2-n.x1);r=d&&s?w(n.x1,c,n.x2,a):d&&!s?"M ".concat(n.x1,",").concat(c," L ").concat(v,",").concat(c," L ").concat(v,",").concat(a):!d&&s?"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a," L ").concat(n.x2,",").concat(a):"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);u(function(){Ae.current=Fi},[Fi]);var Ai=r(null),Mi=r(null),Ni=c(function(){_e.current.length>0&&!Be.current||(null!==Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(function(){Ae.current(),Ai.current=null},50))},[]),ki=c(function(){de(!0),ue(!1),Re.current=null,null!==Mi.current&&clearTimeout(Mi.current),null!==Ai.current&&(clearTimeout(Ai.current),Ai.current=null),Mi.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,a,d;try{if(_e.current=[],Fe.current&&null!==De.current&&null!==fi.current){var s=De.current,v=fi.current,p="string"==typeof s&&s.includes(S),f=null,g=null,h=null,m=null;if(p){var x=s.split(S),y="".concat(x[0]).concat(S).concat(x[1]);f=(null===(n=At.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=Mt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=kt.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=Ft.current[Number(x[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=Pt.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=Dt.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else f=(null===(l=jt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=Ft.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=Nt.current[v])||void 0===c?void 0:c.current)||null,m=(null===(a=Dt.current[v])||void 0===a?void 0:a.current)||null;if(f&&g&&h&&m){if(h.style.paddingTop="0px",m.style.paddingTop="0px",!qn){var b=f.getBoundingClientRect(),R=g.getBoundingClientRect(),C=b.top-R.top;C>0?m.style.paddingTop="".concat(C,"px"):C<0&&(h.style.paddingTop="".concat(Math.abs(C),"px"))}var I=Ke.current,B=Oe.current;if(I&&B){var w=f.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,T=g.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(w-I.scrollTop);Math.abs(B.scrollTop-T)>1&&(B.scrollTop=T)}}}null===(d=Ae.current)||void 0===d||d.call(Ae),Fe.current&&ue(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{de(!1),Mi.current=null}},150)},[qn,bt,St]),Pi=c(function(n){if(null!==Xe.current&&$e.current&&Math.abs(n.currentTarget.scrollTop-Xe.current)<=2){var e=$e.current;Xe.current=null,$e.current=null,e()}fe.current||(qn||Ni(),Ee.current||(Ee.current=!0,requestAnimationFrame(function(){var n,e,t,i,o,r,l;if(Fe.current){var u=Ke.current,c=Oe.current;if(u&&c&&gi.current){if(!Re.current){var a=De.current,d=void 0;if("string"==typeof a&&a.includes(S)){var s=a.split(S),v="".concat(s[0]).concat(S).concat(s[1]);d=null===(n=At.current[v])||void 0===n?void 0:n.current}else d=null===(e=At.current[a])||void 0===e?void 0:e.current;if(d){var p=d.getBoundingClientRect();Re.current={badgeScreenY:p.top+p.height/2,initialScrollTop:u.scrollTop,leftTop:u.getBoundingClientRect().top,leftBottom:u.getBoundingClientRect().top+u.clientHeight,cTop:null!==(i=null===(t=vi.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Re.current){var f=Re.current,g=u.scrollTop-f.initialScrollTop,h=f.badgeScreenY-g,m=((o=h,r=f.leftTop,l=f.leftBottom,Math.max(r,Math.min(l,o)))-f.cTop).toString(),x=h>=f.leftTop-4&&h<=f.leftBottom+4;gi.current.setAttribute("y1",m),gi.current.setAttribute("y2",m),gi.current.setAttribute("visibility",x?"visible":"hidden")}}}_e.current.length>0&&Di(),Ee.current=!1})))},[Di,qn,Ni]),ji=r(0),Hi=r(0),Li=r(0),Oi=r(function(){});r(null),u(function(){Oi.current=ki},[ki]),u(function(){var n=setTimeout(Ni,250),e=function(){return Oi.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==Ai.current&&clearTimeout(Ai.current),null!==Mi.current&&clearTimeout(Mi.current),window.removeEventListener("resize",e)}},[xt,yt,zt,Rt,Zt,ei,bt,St,dt,Ni,te,ve,le,he]),u(function(){var n=function(n,e,t,i,o){e.current=n.getBoundingClientRect().width;var r=new ResizeObserver(function(n){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=n[n.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-e.current)<1?o():(e.current=a,i())}})});return r.observe(n),r},e={current:null},t={current:null},i={current:null},o=[],r=[e,t,i];return Le.current&&o.push(n(Le.current,ji,e,function(){return Oi.current()},function(){})),He.current&&o.push(n(He.current,Hi,t,function(){return Oi.current()},function(){return Ae.current()})),vi.current&&o.push(n(vi.current,Li,i,function(){return Oi.current()},function(){return Ae.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),u(function(){Fe.current=te},[te]),u(function(){De.current=ve},[ve]);var zi=c(function(n,e,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,u=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";at(),null!=n&&(e?ne("No counterpart exists for this section."):($t(),te&&ve===n?r?Jt():null==l||l():(me(new Set([n])),be([]),_e.current=[],Gn(!0),fe.current=!0,pe(n),De.current=n,ie(!0),Fe.current=!0,ue(!1),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),requestAnimationFrame(function(){var e,t,i,o,r,c="string"==typeof n&&n.includes(S),a=null,d=null,s=null;if(c){var v=n.split(S),p="".concat(v[0]).concat(S).concat(v[1]);a=(null===(e=At.current[p])||void 0===e?void 0:e.current)||null,d=(null===(t=Mt.current[p])||void 0===t?void 0:t.current)||null,s=d?n:null}else if(a=(null===(i=jt.current[n])||void 0===i?void 0:i.current)||null,qn){var f=bt[n],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],m=St.findIndex(function(n){return n.selfIndex===h});-1!==m&&(d=(null===(r=Nt.current[m])||void 0===r?void 0:r.current)||null,s=m)}}else d=(null===(o=Nt.current[n])||void 0===o?void 0:o.current)||null,s=d?n:null;fi.current=s;var x=Ke.current,y=Oe.current,b=function(){!function(){var e,t,i,o,r,l,u,a,d,v,p,f,g=null,h=null,m=null,x=null;if(c){var y=n.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(e=kt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=Ft.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=Pt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=Dt.current[Number(y[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=At.current[b])||void 0===r?void 0:r.current)||g,x=(null===(l=Mt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(n),C=null!==s?Number(s):R;g=(null===(u=Ft.current[R])||void 0===u?void 0:u.current)||null,h=(null===(a=Dt.current[C])||void 0===a?void 0:a.current)||null,m=(null===(d=At.current[R])||void 0===d?void 0:d.current)||(null===(v=jt.current[R])||void 0===v?void 0:v.current)||g,x=(null===(p=Mt.current[C])||void 0===p?void 0:p.current)||(null===(f=Nt.current[C])||void 0===f?void 0:f.current)||h}if(m&&x&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=m.getBoundingClientRect(),B=x.getBoundingClientRect(),w=I.top-B.top;w>0?h.style.paddingTop="".concat(w,"px"):w<0&&(g.style.paddingTop="".concat(Math.abs(w),"px"))}}(),ue(!0),Ae.current&&Ae.current(),fe.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):x&&x.dispatchEvent(new Event("scroll")),Gn(!1),null==l||l()};if(!a||!x)return fe.current=!1,Gn(!1),void(null==l||l());if(d&&y){if(!qn){var R=0;R="right"===u?d?d.getBoundingClientRect().top:0:a?a.getBoundingClientRect().top:0;var C=He.current,I=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+R-I-150:0;return C?void T(C,B,200,b):void b()}var w=a.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop,_=d.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=_-(w-x.scrollTop);F<0&&ze.current&&(ze.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var n,e=y.scrollHeight-y.clientHeight;if(F<0)n=0;else{if(F>e){var t=F-e;return We.current&&(We.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(y,F,E,b)})}n=F}T(y,n,E,b)})}else{var D=w-(_-y.scrollTop);D<0&&qe.current&&(qe.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var n,e=x.scrollHeight-x.clientHeight;if(D<0)n=0;else{if(D>e){var t=D-e;return Ye.current&&(Ye.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(x,D,E,b)})}n=D}T(x,n,E,b)})}}else b()}))))},[ve,at,St,te,qn,bt,Jt]),Wi=c(function(n,e,t,i,o){var r,l="string"==typeof i?x(i).trim():x(null==i?void 0:i.deviation_summary).trim(),u=n.currentTarget;ct();var c="left";(null===(r=Oe.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var n,t,i,o;if("string"==typeof e&&e.includes(S)){var r=e.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(n=Mt.current[l])||void 0===n?void 0:n.current:null===(t=At.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=Mt.current[e])||void 0===i?void 0:i.current:null===(o=At.current[e])||void 0===o?void 0:o.current};if(t)return Jt(),me(new Set),be([]),_e.current=[],void(l&&requestAnimationFrame(function(){var n=a()||u;ot({open:!0,anchorEl:n,summary:i,displayImpact:o})}));zi(e,t,l?{toggleIfSame:!1,sourceSide:c,onReady:function(){var n=a()||u;ot({open:!0,anchorEl:n,summary:i,displayImpact:o})}}:{toggleIfSame:!1,sourceSide:c})},[zi,ct,ot,Jt]),qi=c(function(){var n,e=Qe.sectionIdx,t=Qe.isOrphan;if(rt(),null!=e){var i="left";Qe.anchorEl&&(null===(n=Oe.current)||void 0===n?void 0:n.contains(Qe.anchorEl))&&(i="right"),zi(e,t,{sourceSide:i})}},[zi,Qe.isOrphan,Qe.sectionIdx,Qe.anchorEl,rt]),Yi=c(function(){rt(),Jt(),me(new Set),be([]),_e.current=[]},[rt,Jt]),Ki=null!==Qe.sectionIdx&&he.has(Qe.sectionIdx),Vi=Y({proposedSections:bt,existingSections:St,parentDeviationRecord:Ct,expandedSections:Zt,maintainRelativeOrder:!!qn,scrollContainerRef:He,leftContainerRef:Ke,lhsBadgeRefs:At,rhsBadgeRefs:Mt}),Xi=Vi.showDeviationNavigation,$i=Vi.showOpenNodeRef,Ji=l(function(){var n;if(!jn)return null;var e=null===(n=null==jn?void 0:jn.id)||void 0===n?void 0:n.split(":")[0];for(var t in Ct){if((Ct[t]||[]).some(function(n){return n.id===e}))return t}return null},[jn,Ct]),Ui=r({id:null,triggerMs:null}),Gi=r(null);u(function(){var t;if(null==jn?void 0:jn.id){var i=Number(jn.trigger),o=Ui.current;if((null==o?void 0:o.triggerMs)!==i){if(!(jn.id.includes(":")&&/:\d+$/.test(jn.id)))return Ui.current={id:jn.id,triggerMs:i},void di(jn.id);var r=null===(t=null==jn?void 0:jn.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";Gi.current!==jn.id&&(rt(),ct(),Jt(),me(new Set),be([]),_e.current=[],Gi.current=jn.id);var a=!1,d=0,s=null,v=150,p=function(n,e){for(var t=function(n,i){if(!n)return null;if(n.id===e)return i;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=t(n.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<n.length;i++){var o=t(n[i],String(i));if(o)return o}return null},f=function(){var t,o,r,u;if(!a){var g=function(){Ui.current={id:jn.id,triggerMs:i}},h=null,m=null;for(var x in Ct){var y=Ct[x].find(function(n){return n.id===l});if(y){h=x,m=y;break}}if(m&&h){var b=bt.findIndex(function(n){return n.id===h}),R=St.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==R,I=p(bt,m.id),B=p(St,m.id);if(I&&!B&&!C){var w=I.split("-"),T=Number(w[0]);if(qn){var _=null===(o=null===(t=bt[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],E=St.findIndex(function(n){return n.selfIndex===_});-1!==E&&(T=E)}B=e([T],w.slice(1),!0).join("-")}if(I||B){var F=C||!I&&!!B,D=I?Number(I.split("-")[0]):b,A=B?Number(B.split("-")[0]):R;if(F){if(!(qn?!!Zt["right-".concat(A)]:!!Zt[String(A)])&&A>=0)return ii(A,"right"),d+=1,void(s=setTimeout(f,450))}else if(!(qn?!!Zt["left-".concat(D)]:!!Zt[String(D)])&&D>=0)return ii(D,"left"),d+=1,void(s=setTimeout(f,450));var M,N=I||"",k=B||"",P="".concat(m.id).concat(S).concat(c).concat(S).concat(N).concat(S).concat(k),j="".concat(m.id).concat(S).concat(c),H=null===(r=At.current[j])||void 0===r?void 0:r.current,L=null===(u=Mt.current[j])||void 0===u?void 0:u.current,O=F||!H&&!!L,z=O?L:H;if(M=qn?O?Oe.current:Ke.current:He.current,z&&M){var W=z.getBoundingClientRect();if(0===W.height)return void((d+=1)<2?s=setTimeout(f,v):g());var q=M.getBoundingClientRect(),Y=W.top-q.top+M.scrollTop-q.height/2+W.height/2+150,K=function(){var e,t,i,o,r;if(!a){g();var l=z instanceof Element?window.getComputedStyle(z).color:"";H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var u=(null===(t=null===(e=m.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[c])||m,d=(null===(i=m.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||m.evaluation_outputs;if(!(!!H&&!!L)){var s=O?(null===(o=Mt.current[j])||void 0===o?void 0:o.current)||L:(null===(r=At.current[j])||void 0===r?void 0:r.current)||H;return ot({open:!0,anchorEl:s,displayImpact:jn.displayImpact,summary:n(n({},u),{evaluation_outputs:d})}),void(null==Hn||Hn())}zi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t=(null===(e=At.current[j])||void 0===e?void 0:e.current)||H;console.log("Summary data",d,u),ot({open:!0,anchorEl:t,displayImpact:null==jn?void 0:jn.displayImpact,summary:n({},u)})}})}};Math.abs(M.scrollTop-Y)<=2?K():(Xe.current=Y,$e.current=K,M.scrollTo({top:Y,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if($e.current){Xe.current=null;var n=$e.current;$e.current=null,n()}},800))}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}};return s=setTimeout(f,v),function(){a=!0,s&&clearTimeout(s)}}}},[jn,Ct,bt,St,qn,Zt,ii,zi,ot,di]);var Qi=function(n){var e=n.section,t=n.keyPath,o=n.depth,r=void 0===o?0:o,l=n.columnKey,u=void 0===l?"left":l,c=n.parentNodeId;return i(X,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:void 0===c?"":c,expandedSubSections:ei,setExpandedSubSections:ti,maintainRelativeOrder:qn||!1,proposedSections:bt,existingSections:St,treeData:wn,deviationNumberRegistry:It,connectedSections:he,activeSideBySideSection:ve,resolvedMarkdownStyles:je,getSubSectionRef:Lt,getSubSectionCompareStyle:wi,getBadgeRef:Ot,openMoreFunctionsPopup:li,openSummaryPopup:Wi,showDeviationBadges:Kn,resetSideBySide:Jt,setConnectedSections:me,setConnectedLines:be,cachedConnectedPositions:_e,isProposingFix:On,proposingFixNodeId:zn})};return t(a,n({ref:Le,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},qn?{}:{overflow:"visible"}),{position:"relative"})},{children:[Xn&&i(a,n({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(H,{})})),it.open&&i($,{open:it.open,anchorEl:it.anchorEl,containerEl:pi.current,clipTopEl:hi.current,scrollContainerEl:He.current,onClose:Yi,summary:it.summary,displayImpact:it.displayImpact}),i(j,{open:Qe.open,anchorEl:Qe.anchorEl,sectionTitle:Qe.sectionTitle,referenceSectionTitle:Qe.refSectionTitle,onClose:at,onOpenCognitiveCompare:ui,onOpenSideBySide:qi,onConnect:ci,isConnected:Ki,isOrphan:Qe.isOrphan}),Ue.open&&i(P,{open:Ue.open,popupRef:ut,position:nt,popupConfig:Nn,onClose:function(){et(null),Ge(function(e){return n(n({},e),{open:!1})}),lt(null)},markdownStyles:Fn,sectionTitle:Ue.sectionTitle,referenceSectionTitle:Ue.refSectionTitle,cognitiveData:Ue.cognitiveData,anchorEl:Ue.anchorEl,sectionAnchorEl:Ue.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Ue.badgeStyle,docData:Ue.docData,deviationData:Ue.deviationData,isLoading:Ue.isLoading}),i(d,n({open:!!Zn,autoHideDuration:8e3,onClose:function(){return ne(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,n({onClose:function(){return ne(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Zn}))})),i(K,{componentHeaderText:Bn,displayConfig:Mn,maintainRelativeOrder:qn,onCollapseAll:_i,showCollapseAll:Ei,onToggleView:function(n){$n(!0),setTimeout(function(){Yn(!n),Jt(),rt(),me(new Set),be([]),_e.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){$n(!1)},600)})})},50)}}),i(a,n({ref:He,onScroll:Pi,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:qn?"hidden":"auto",borderTop:Wt&&qt?"none":"1.5px solid #EEF0F4"}},{children:i(a,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},qn?{flex:1,minHeight:0}:{})},{children:t(a,n({ref:vi,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},qn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:Se,style:{position:"absolute",top:0,left:0,width:ke.width||"100%",height:ke.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:ae?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Ri&&i("g",{children:i("line",{x1:Ri.x1,y1:Ri.y,x2:Ri.x2,y2:Ri.y,stroke:Xt.badgeBorder,strokeWidth:"1.5"})}),yi.map(function(e){var o,r,l,u,c,d,s=e.x1+.5*(e.x2-e.x1),v=(e.y1+e.y2)/2;if("Not Defined"===e.style.label&&!e.hasCognitive)return null;if(e.isSubSection?te&&ve===e.subSectionKeyPath&&le:te&&ve===e.sectionIdx&&le)return null;if(!qn){var p=e.isSubSection?w(e.x1,e.y1,e.x2,e.y2):"M ".concat(e.x1," ").concat(e.y1," L ").concat(e.x2," ").concat(e.y2),g=bt[e.sectionIdx]||{title:"",content:""},m=St[e.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,m),e.isSubSection&&e.subSectionKeyPath){var x=e.subSectionKeyPath.includes(S)?e.subSectionKeyPath.split(S):[],y=x[2]||e.subSectionKeyPath,b=x[3]||y,R=y.split("-").map(Number),C=b.split("-").map(Number),I=null,B=null;R.length>0&&(I=bt[R[0]]),C.length>0&&(B=St[C[0]]);var T=(null==I?void 0:I.title)||"",_=(null==B?void 0:B.title)||"";console.log("Root Parent Titles:",T,_);for(var E=1;E<R.length;E++)(null==I?void 0:I.subsections)&&(I=I.subsections[R[E]]);for(E=1;E<C.length;E++)(null==B?void 0:B.subsections)&&(B=B.subsections[C[E]]);I&&(g=n(n({},I),{title:T||I.title})),console.log("Base Section for Subsection Badge:",g),B&&(m=n(n({},B),{title:_||B.title})),console.log("Ref Section for Subsection Badge:",m)}var F=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),D=(null===(d=null===(c=null===(u=g.evaluationResult)||void 0===u?void 0:u.cognitive_decisioning)||void 0===c?void 0:c.decisioning_factors)||void 0===d?void 0:d.length)||!1,A=F||D;return t("g",{children:[i("path",{d:p,fill:"none",stroke:e.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",n({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(a,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(a,n({onClick:function(n){n.stopPropagation(),A&&(Ue.open&&tt===e.id?ct():(lt(e.id),ri(oi(n.currentTarget,g,m,e.sectionIdx,e.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:e.style.badgeBg,color:e.style.badgeText,border:"1px solid ".concat(e.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:A?"pointer":"default"}},{children:[e.style.badgeText===N&&null==e.style.label?i(L,{color:e.style.badgeText}):0===e.style.label?"Same":e.style.label,i(a,n({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:Ue.open&&tt===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),i(J,{connectedLines:ye,pathRefs:Te})]})),t(a,n({sx:n({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},qn?{flex:1,overflow:"visible"}:{})},{children:[i(a,n({ref:hi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,n({title:gt,placement:"top"},{children:i(p,n({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:gt}))}))})),t(a,n({ref:Ke,onScroll:Pi,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&bt.map(function(e,o){var r,l,u=!e.title&&!e.content;if(qn&&u)return null;var c=e,d=Bi(o,"left"),s=qn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!St[o],v=qn?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:o+1,p=he.has(o),f=y(c.evaluationResult,null==d?void 0:d.deviationLabel);return i(a,n({ref:Ht(o),sx:{mb:1,width:"100%"}},{children:t(a,n({sx:{position:"relative",width:"100%"}},{children:[i(a,n({ref:Ft.current[o],sx:n({width:"100%",display:"flex",flexDirection:"column",minWidth:0},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"left",colRef:Ht("left-accordion-".concat(o)),mb:0,treeData:wn,proposedSections:bt,existingSections:St,deviationNumberRegistry:It,getSectionCompareStyle:Bi,getBadgeRef:Ot,connectedSections:he,openMoreFunctionsPopup:li,openSummaryPopup:Wi,deviationNodeIdToView:null==jn?void 0:jn.id,deviationTargetParentId:Ji,parentNodeId:(null===(l=null==wn?void 0:wn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:qn?!!Zt["left-".concat(o)]:!!Zt[String(o)],onToggle:function(){Yi(),ii(o,"left")},navigation:e.id?Xi[e.id]:null,showOpenNodeRef:$i,resolvedMarkdownStyles:je,maintainRelativeOrder:qn,showDeviationBadges:Kn,renderSubSections:Qi,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&d&&t(a,n({ref:At.current[o],onClick:function(n){var e,t,i,r=Mn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Wi(n,String(o),s,r)},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:[t(a,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var r=Mn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Wi(n,String(o),s,r)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:s?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":s?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=v&&i(a,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:v})),i(a,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!Mn.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):i(L,{color:d.badgeText})}))]})),i(a,n({component:"span",onClick:function(n){n.stopPropagation();var t=qn?St.find(function(n){var e;return(null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n))||{title:"",content:""}}):St[o]||{title:"",content:""};li(n,e,s,t,o,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:i(g,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(o))}),i("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(a,n({ref:pi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(a,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(a,n({onClick:function(e){e.stopPropagation(),Ue.open&&tt===Yt?ct():(lt(Yt),ri(oi(e.currentTarget,{title:"",content:"",evaluationResult:Kt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Yt,!0,n(n({},Xt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Xt.badgeBg,color:Xt.badgeText,border:"1px solid ".concat(Xt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Vt?Vt:i(L,{}),i(a,n({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:Ue.open&&tt===Yt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(a,n({sx:n({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},qn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Un&&i(m,{sections:11}),i(a,n({ref:mi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,n({title:ht,placement:"top"},{children:i(p,n({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:ht}))}))})),t(a,n({ref:Oe,onScroll:Pi,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:ze,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&St.map(function(e,o){var r,l=e,u=[],c=!1,d=null,s=-1;if(qn){u=bt.filter(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0}).map(function(n){return n.selfIndex+1}),s=bt.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0});var v=bt.findIndex(function(n,e){var t;return he.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==v)&&(d=Bi(v))}else u=[o+1],(c=he.has(o))&&(d=Bi(o));var p=Bi(qn&&-1!==s?s:o);return i(a,n({ref:Nt.current[o],sx:{mb:1,width:"100%"}},{children:t(a,n({sx:{position:"relative",width:"100%"}},{children:[i(a,n({ref:Dt.current[o],sx:n({width:"100%",display:"flex"},c&&d&&{borderRadius:"6px",outline:"2px solid ".concat(d.badgeBorder),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"right",colRef:Ht("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==wn?void 0:wn.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:qn?!!Zt["right-".concat(o)]:!!Zt[String(o)],treeData:wn,proposedSections:bt,existingSections:St,deviationNumberRegistry:It,getBadgeRef:Ot,getSectionCompareStyle:Bi,connectedSections:he,openMoreFunctionsPopup:li,openSummaryPopup:Wi,deviationNodeIdToView:null==jn?void 0:jn.id,deviationTargetParentId:Ji,onToggle:function(){Yi(),ii(o,"right")},navigation:e.id?Xi[e.id]:null,showOpenNodeRef:$i,resolvedMarkdownStyles:je,maintainRelativeOrder:qn,showDeviationBadges:Kn,renderSubSections:Qi,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&p&&i(a,n({ref:Mt.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:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{U as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var l="#3730A3",n=12,a=680,o=12,t=10,e="Contract Comparison",i={isLoading:!1,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},c={open:!1,anchorEl:null,summary:"",markdownStyles:{},displayImpact:!1};export{t as ARROW_SIZE,e as DEFAULT_COMPONENT_HEADER_TEXT,l as DEFAULT_DEVIAION_COLOR,i as EMPTY_SECTION_POPUP_STATE,c as EMPTY_SUMMARY_POPUP_STATE,n as POPUP_GAP,a as POPUP_WIDTH,o as VIEWPORT_MARGIN};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompareConstants.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{Popper as i,Paper as o,Box as r,Typography as l,IconButton as a,Accordion as d,AccordionSummary as c,AccordionDetails as s}from"@mui/material";import{Info as p,X as u,ChevronDown as f}from"lucide-react";import{useRef as m,useState as h,useMemo as x,useEffect as g}from"react";function v(v){var b,w,
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{Popper as i,Paper as o,Box as r,Typography as l,IconButton as a,Accordion as d,AccordionSummary as c,AccordionDetails as s}from"@mui/material";import{Info as p,X as u,ChevronDown as f}from"lucide-react";import{useRef as m,useState as h,useMemo as x,useEffect as g}from"react";function v(v){var b,y,w,S=v.open,C=v.anchorEl,I=v.containerEl,z=v.clipTopEl,B=v.scrollContainerEl,R=v.onClose,F=v.summary;v.markdownStyles,v.isLoading;var W=v.displayImpact,E=m(null),H=m(null),k=h(null),A=k[0],_=k[1],L=h(null),M=L[0],P=L[1],O=h(null);O[0];var T=O[1],N=h(0),j=N[0],J=N[1],q="string"==typeof F?{deviation_summary:F}:null!=F?F:{},D=q.deviation_title,G=q.deviation_summary,V=q.deviation_impact,Y=q.evaluation_outputs,Z=!!String(V||"").trim(),K=(null===(b=null==Y?void 0:Y.metadata)||void 0===b?void 0:b.label_color)||"#6366F1",Q=null!==(y=null==I?void 0:I.getBoundingClientRect().width)&&void 0!==y?y:180,U=Math.max(148,Q+120),X=x(function(){if(!C||!I)return null;var e=C.getBoundingClientRect();if(0===e.width&&0===e.height)return null;var t=I.getBoundingClientRect();return{top:e.top,bottom:e.bottom,left:t.left+t.width/2}},[C,I]);g(function(){if(!S||!C||!I)return _(null),P(null),void T(null);var e=function(){null!==E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(function(){var e,t,n=C.getBoundingClientRect(),i=null==z?void 0:z.getBoundingClientRect(),o=null==B?void 0:B.getBoundingClientRect();if(0===n.width&&0===n.height)_(null);else{var r=I.getBoundingClientRect();_({top:n.top,bottom:n.bottom,left:r.left+r.width/2})}P(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null),T(null!==(t=null==o?void 0:o.bottom)&&void 0!==t?t:null),H.current&&J(H.current.offsetHeight)})};return e(),window.addEventListener("scroll",e,{passive:!0,capture:!0}),window.addEventListener("resize",e),function(){null!==E.current&&cancelAnimationFrame(E.current),window.removeEventListener("scroll",e,{capture:!0}),window.removeEventListener("resize",e)}},[S,C,I,z,B]);var $=null!==(w=null!=A?A:X)&&void 0!==w?w:"hidden",ee="hidden"===$?"hidden":$.bottom+20,te=null!=M&&"number"==typeof ee&&ee<M?Math.min(j,M-ee):0,ne=x(function(){return"hidden"===$?{getBoundingClientRect:function(){return{width:0,height:0,top:0,bottom:0,left:0,right:0,x:0,y:0,toJSON:function(){}}}}:{getBoundingClientRect:function(){return{width:0,height:$.bottom-$.top,top:$.top,bottom:$.bottom,left:$.left,right:$.left,x:$.left,y:$.top,toJSON:function(){}}}}},[$]);return F?t(i,e({open:S,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:ne,placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}},{name:"preventOverflow",enabled:!0,options:{boundary:B||"clippingParents",tether:!1}},{name:"flip",enabled:!0,options:{boundary:B||"clippingParents",fallbackPlacements:["top"]}}],sx:{zIndex:21,visibility:"hidden"===$?"hidden":"visible",opacity:"hidden"===$?0:1,transition:"opacity 0.15s ease-in-out"}},{children:n(o,e({ref:H,sx:e(e({p:1.5,borderRadius:"12px",width:U,maxWidth:U},te>0&&{clipPath:"inset(".concat(te,"px 0px 0px 0px round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(K,"26"),borderTop:"3px solid ".concat(K),overflow:"hidden",bgcolor:"#fff"})},{children:[n(r,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[n(r,e({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[t(p,{size:14,color:K}),t(l,e({sx:{fontSize:"11px",fontWeight:700,color:K,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),t(a,e({size:"small",onClick:R,sx:{p:.25,ml:.5,color:"#64748B"}},{children:t(u,{size:14})}))]})),n(r,e({sx:{display:"flex",flexDirection:"column",gap:1.5,maxHeight:"300px",overflowY:"auto",pr:.5}},{children:[n(r,{children:[D&&t(l,e({sx:{fontSize:"12px",color:"#334155",fontFamily:'"Inter", sans-serif',lineHeight:1.6,fontWeight:700,overflowWrap:"anywhere"}},{children:D})),t(l,e({sx:{fontSize:"11px",color:"#334155",lineHeight:1.6,fontFamily:'"Inter", sans-serif',fontWeight:400,overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:G||"No summary available."}))]}),Z&&n(d,e({expanded:W,disableGutters:!0,elevation:0,sx:{backgroundColor:"".concat(K,"0A"),border:"1px solid ".concat(K,"33"),borderRadius:"4px",fontFamily:'"Inter", sans-serif',overflow:"hidden",flexShrink:0,"&:before":{display:"none"},"&.Mui-expanded":{margin:0}}},{children:[t(c,e({expandIcon:t(f,{size:16,color:K}),sx:{minHeight:"10px",px:1.5,"& .MuiAccordionSummary-content":{py:"5px",my:0},"&.Mui-expanded":{minHeight:"10px",borderBottom:"1px solid ".concat(K,"1A")}}},{children:t(l,e({sx:{fontSize:"11px",fontWeight:700,color:K,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.5px"}},{children:"Impact"}))})),t(s,e({sx:{p:1.5,backgroundColor:"#fff"}},{children:t(l,e({sx:{fontSize:"11px",color:"#475569",lineHeight:1.6,fontWeight:400,fontFamily:'"Inter", sans-serif',overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:String(V).replace("Impact -","").trim()}))}))]}))]}))]}))})):null}export{v as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveSummaryPopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as t,__generator as i}from"tslib";import{jsx as o,jsxs as n}from"react/jsx-runtime";import{SpecialZoomLevel as r}from"@react-pdf-viewer/core";import a from"./PdfContainer.js";import l from"./PdfToolbar.js";import{pdfStyles as s}from"./PdfStyle.js";import{PdfHighlightControls as c}from"./usePdfHighlight.js";import"@react-pdf-viewer/zoom/lib/styles/index.css";import"@react-pdf-viewer/page-navigation/lib/styles/index.css";import"@react-pdf-viewer/core/lib/styles/index.css";import"@react-pdf-viewer/search/lib/styles/index.css";import{useRef as u,useMemo as d,useEffect as g}from"react";import f from"../ScannedDocCitation/ScannedDocCitation.js";var h=function(e){switch(e){case"ActualSize":return r.ActualSize;case"PageFit":return r.PageFit;case"PageWidth":return r.PageWidth;default:return null!=e?e:r.PageWidth}},m=function(m){var v,p=m.pdfUrl,x=m.highlightText,C=m.highlightPages,P=m.highlightCordinatePages,w=m.highlightColor,T=void 0===w?"yellow":w,S=m.activeHighlightColor,y=void 0===S?"#f7dc51":S,A=m.jumpToPageValue,b=void 0===A?0:A,H=m.pdfName,I=m.onClose,j=m.customStyles,F=m.customClasses,z=m.customIcons,N=m.useCoordinates,_=m.fallbackPages,R=m.activeCitationIndex,V=m.onActiveCitationChange,W=m.headerAction,q=m.isZoomEnabled,D=void 0===q||q,E=m.showHighlightsAction,B=void 0===E||E,O=m.defaultScale,U=void 0===O?r.ActualSize:O,k=m.useRange,Z=void 0!==k&&k,J=m.rangeOfPages,K=void 0===J?null:J,L=m.showFullScreenAction,G=void 0===L||L,M=u(null),Q=d(function(){if(N)return new Set(P.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(C).forEach(function(t){t>0&&e.add(t-1)}),e},[C]),X=(v=x)&&0!==v.length?v.filter(function(e){return!v.some(function(t){return t!==e&&t.includes(e)})}):v,Y=c(X,N?{}:C,M,Q,N,N?P:[],T,y),$=Y.highlightIndex,ee=Y.cursorIndex,te=Y.setCursorIndex,ie=Y.orderedKeys,oe=Y.totalHighlights,ne=Y.getValidPosition,re=Y.tryJump,ae=Y.jumpToPage,le=Y.zoomTo,se=Y.plugins,ce=Y.controls,ue=Y.hideNonTargetHighlights,de=Y.deduplicateHighlights,ge=ne(ee);g(function(){void 0!==R&&R!==ee&&te(R)},[R]);var fe=e(e({},ce),{goToNext:function(){ce.goToNext(),V&&V(ee+1)},goToPrevious:function(){ce.goToPrevious(),V&&V(ee-1)}});if(!p)return o(f,{pages:_,activeCitationIndex:R,onActiveCitationChange:V,headerAction:W});return n("div",e({ref:M,className:(null==F?void 0:F.pdfViewerWrapper)||"",style:e(e(e({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},s.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==j?void 0:j.pdfViewer)},{children:[o(l,{highlightIndex:$,totalHighlights:oe,controls:fe,currentPosition:ge,pdfName:H,onClose:I,pdfUrl:p,viewerRef:M,customStyles:j,customClasses:F,customIcons:z,headerAction:W,isZoomEnabled:D,showHighlightsAction:B,showFullScreenAction:G}),o(a,{defaultScale:h(U),pdfUrl:p,plugins:se,customStyles:j,onLoad:function(){if(le(r.ActualSize),b>0&&!Z){var
|
|
1
|
+
import{__assign as e,__awaiter as t,__generator as i}from"tslib";import{jsx as o,jsxs as n}from"react/jsx-runtime";import{SpecialZoomLevel as r}from"@react-pdf-viewer/core";import a from"./PdfContainer.js";import l from"./PdfToolbar.js";import{pdfStyles as s}from"./PdfStyle.js";import{PdfHighlightControls as c}from"./usePdfHighlight.js";import"@react-pdf-viewer/zoom/lib/styles/index.css";import"@react-pdf-viewer/page-navigation/lib/styles/index.css";import"@react-pdf-viewer/core/lib/styles/index.css";import"@react-pdf-viewer/search/lib/styles/index.css";import{useRef as u,useMemo as d,useEffect as g}from"react";import f from"../ScannedDocCitation/ScannedDocCitation.js";var h=function(e){switch(e){case"ActualSize":return r.ActualSize;case"PageFit":return r.PageFit;case"PageWidth":return r.PageWidth;default:return null!=e?e:r.PageWidth}},m=function(m){var v,p=m.pdfUrl,x=m.highlightText,C=m.highlightPages,P=m.highlightCordinatePages,w=m.highlightColor,T=void 0===w?"yellow":w,S=m.activeHighlightColor,y=void 0===S?"#f7dc51":S,A=m.jumpToPageValue,b=void 0===A?0:A,H=m.pdfName,I=m.onClose,j=m.customStyles,F=m.customClasses,z=m.customIcons,N=m.useCoordinates,_=m.fallbackPages,R=m.activeCitationIndex,V=m.onActiveCitationChange,W=m.headerAction,q=m.isZoomEnabled,D=void 0===q||q,E=m.showHighlightsAction,B=void 0===E||E,O=m.defaultScale,U=void 0===O?r.ActualSize:O,k=m.useRange,Z=void 0!==k&&k,J=m.rangeOfPages,K=void 0===J?null:J,L=m.showFullScreenAction,G=void 0===L||L,M=u(null),Q=d(function(){if(N)return new Set(P.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(C).forEach(function(t){t>0&&e.add(t-1)}),e},[C]),X=(v=x)&&0!==v.length?v.filter(function(e){return!v.some(function(t){return t!==e&&t.includes(e)})}):v,Y=c(X,N?{}:C,M,Q,N,N?P:[],T,y),$=Y.highlightIndex,ee=Y.cursorIndex,te=Y.setCursorIndex,ie=Y.orderedKeys,oe=Y.totalHighlights,ne=Y.getValidPosition,re=Y.tryJump,ae=Y.jumpToPage,le=Y.zoomTo,se=Y.plugins,ce=Y.controls,ue=Y.hideNonTargetHighlights,de=Y.deduplicateHighlights,ge=ne(ee);g(function(){void 0!==R&&R!==ee&&te(R)},[R]);var fe=e(e({},ce),{goToNext:function(){ce.goToNext(),V&&V(ee+1)},goToPrevious:function(){ce.goToPrevious(),V&&V(ee-1)}});if(!p)return o(f,{pages:_,activeCitationIndex:R,onActiveCitationChange:V,headerAction:W});return n("div",e({ref:M,className:(null==F?void 0:F.pdfViewerWrapper)||"",style:e(e(e({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},s.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==j?void 0:j.pdfViewer)},{children:[o(l,{highlightIndex:$,totalHighlights:oe,controls:fe,currentPosition:ge,pdfName:H,onClose:I,pdfUrl:p,viewerRef:M,customStyles:j,customClasses:F,customIcons:z,headerAction:W,isZoomEnabled:D,showHighlightsAction:B,showFullScreenAction:G}),o(a,{defaultScale:h(U),pdfUrl:p,plugins:se,customStyles:j,onLoad:function(){var e=!N&&!Z&&b<=0;if(le(r.ActualSize),b>0&&!Z){var o=b-1,n=ie[o],a=C[n],l=P[o];te(o),console.log(l,"cordinateTargetHighlight"),N&&l.pageIndex>0&&ae(l.pageIndex),a>0&&(setTimeout(function(){ue(Q),de(a-1)},1e3),N||ae(a-1))}else if(Z&&K&&2===K.length){t(void 0,void 0,void 0,function(){var e,t,o,n,r;return i(this,function(i){switch(i.label){case 0:e=K[0],t=K[1],o=e,i.label=1;case 1:return o<=t?(ae(n=o-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(i.sent(),ue(Q),(r=de(n))&&r>0)return[3,4];i.label=3;case 3:return o++,[3,1];case 4:return[2]}})})}else if(!N&&C){var s=ie.find(function(e){return C[e]>0});if(void 0!==s){var c=C[s]-1;ae(c),setTimeout(function(){ue(Q),de(c)},1e3)}}requestAnimationFrame(function(){e&&re(),!N&&b>0&&!Z&&function(){if(M.current){var e=b-1,t=ie[e],i=C[t],o=i>0?i-1:0,n={};ie.forEach(function(e,t){var i=C[e];i>0&&(n[i]||(n[i]=[]),n[i].push(t))});var r=(n[i]||[]).indexOf(e),a=0,l=function(){var e,t;if(!(++a>40)){var i=null===(e=M.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(i){var n=null===(t=M.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(o,'"]'));if(n){var s=i.getBoundingClientRect(),c=n.getBoundingClientRect();if(c.top<s.bottom&&c.bottom>s.top){var u=n.querySelectorAll(".rpv-search__highlight")[r];if(u){var d=u.getBoundingClientRect(),g=i.scrollTop+(d.top-s.top)-i.clientHeight/2+d.height/2;i.scrollTo({top:g,behavior:"smooth"})}else setTimeout(l,100)}else setTimeout(l,100)}else setTimeout(l,100)}else setTimeout(l,100)}};setTimeout(l,500)}}()})},onPageChange:function(e){var t=e.currentPage;Q.has(t)?(de(t),ue(Q)):ue(Q)}})]}))};export{m as default};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as t,Fragment as r}from"react/jsx-runtime";import{useState as o,useRef as n,useMemo as i}from"react";import{searchPlugin as a}from"@react-pdf-viewer/search";import{pageNavigationPlugin as l}from"@react-pdf-viewer/page-navigation";import{zoomPlugin as c}from"@react-pdf-viewer/zoom";import{highlightPlugin as u}from"@react-pdf-viewer/highlight";var s=function(s,p,g,f,v,h,d,m){void 0===d&&(d="yellow"),void 0===m&&(m="#F6D739");var T=o(0),y=T[0],x=T[1],_=n(!1),b=o(0),I=b[0],S=b[1];n([]);var q=function(e){if(!e)return[];return e.replace(/\\(['’])/g,"$1").replace(/\]\s*\n\s*\(/g,"](").split(/\n+/).map(function(e){var t=e.trim(),r=(t=(t=t.replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\u00A0\u2009\u202F]/g," ")).replace(/^[-•]\s+/,"")).match(/^((\d+(?:\.\d+)*[.)]?)|[A-Za-z][.)]|\([A-Za-z0-9]+\)|(?:i|ii|iii|iv|v|vi|vii|viii|ix|x)[.)])\s*/i);return r?t.slice(r[0].length).trim():t}).flatMap(function(e){var t=e.match(/^\s*\|(.+)\|\s*$/);return t?t[1].split("|").map(function(e){return e.trim()}).filter(Boolean):[e]}).map(function(e){return e.replace(/&[#\w]+;/g,function(e){return t=e,(r=document.createElement("textarea")).innerHTML=t,r.value;var t,r}).replace(/<br\s*\/?>/gi,"\n").replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/[^\S\n]+/g," ").trim()}).flatMap(function(e){return e.split(/\n+/)}).flatMap(function(e){for(var t,r=[],o=/([*_]{1,3})([^*_]+)\1|([*_]{1,3})/g,n=0;null!==(t=o.exec(e));){var i=e.slice(n,t.index).trim();i&&r.push(i),t[2]&&r.push(t[2].trim()),n=t.index+t[0].length}var a=e.slice(n).trim();return a&&r.push(a),r.flatMap(function(e){return e.split(/[\u2013\u2014-]/g)}).flatMap(function(e){return e.split(/\n+/)}).map(function(e){return e.replace(/[*_]+/g,"").replace(/`([^`]+)`/g,"$1").replace(/[^\S\n]+/g," ").trim()})})},w=Object.keys(p).map(Number).sort(function(e,t){return e-t}),B=i(function(){return v?h.length:v?0:Object.values(p).filter(function(e){return e>0}).length},[h,p]),A=function(e){if(g.current){var t=g.current.querySelector('[data-testid="search__highlights-'.concat(e,'"]'));if(t){var r=Array.from(t.querySelectorAll(".rpv-search__highlight")),o=function(e){return(e||"").toLowerCase().replace(/[^\w\s]/g,"").replace(/\s+/g," ").trim()},n=M.map(o).filter(Boolean);if(0!==n.length){var i=[],a=null;r.forEach(function(e){var t=o(e.getAttribute("title")||e.textContent||""),r=parseFloat(e.style.top||"0");a?a.title===t&&Math.abs(a.lastTop-r)<=3?(a.elements.push(e),a.lastTop=r):(i.push(a),a={title:t,elements:[e],lastTop:r}):a={title:t,elements:[e],lastTop:r}}),a&&i.push(a);for(var l=0,c=new Set,u=0;u<i.length;u++)for(var p=i[u].title,f=0;f<n.length;f++)if(n[f]===p){for(var v=0,h=new Set,d=f,m=u-1,T=u;T<i.length&&d<n.length;T++){if(i[T].title===n[d]){if(m>=0){var y=i[m].lastTop,x=parseFloat(i[T].elements[0].style.top||"0");if(Math.abs(x-y)>15)break}v++,h.add(T),m=T,d++}else if(d>0&&i[T].title===n[d-1]){y=i[m].lastTop,x=parseFloat(i[T].elements[0].style.top||"0");Math.abs(x-y)<=3&&(h.add(T),m=T)}if(T-m>4)break}v>l&&(l=v,c=h)}return i.forEach(function(e,t){var r=c.has(t);e.elements.forEach(function(e){r?(e.classList.add("verified-match"),e.style.display=""):(e.style.display="none",e.classList.remove("verified-match"))})}),console.groupCollapsed("[debug: PDF ordered matching - Page ".concat(e,"]")),console.log("input->",s),console.log("processed text->",M),console.log("Expected sequence length:",n.length),console.log("Matched ordered sequence length:",l),console.log("blocksToKeep",c,"size",c.size),console.groupEnd(),c.size}}}},C=function(e){g.current&&g.current.querySelectorAll(".rpv-search__highlights").forEach(function(t){var r=t.getAttribute("data-testid"),o=parseInt((null==r?void 0:r.replace(/search__highlights-/g,""))||"-1"),n=t.querySelectorAll(".rpv-search__highlight");e.has(o)||n.forEach(function(e){e.style.display="none"})})},M=s.map(function(e){return q(e)}).flat(),j=a({keyword:M}),E=l(),F=c(),k=j.jumpToMatch,z=E.jumpToPage,P=F.zoomTo,Z=F.ZoomInButton,H=F.ZoomOutButton,O=F.ZoomPopover,R=u({renderHighlights:function(o){return t(r,{children:h.map(function(t,r){return e(e({},t),{originalIndex:r})}).filter(function(e){return e.pageNumber?e.pageNumber-1===o.pageIndex:e.pageIndex===o.pageIndex}).map(function(e){var r=e.originalIndex,o=r===I;return t("div",{style:{position:"absolute",left:"".concat(e.left,"%"),top:"".concat(e.top,"%"),width:"".concat(e.width,"%"),height:"".concat(e.height,"%"),background:o?m:d,opacity:o?.7:.4,transition:"background 0.2s, opacity 0.2s"}},r)})})}}),N=function(){if(!_.current)try{k(0),_.current=!0;var e=h[0];e&&v&&$(e.pageIndex,e.top)}catch(e){requestAnimationFrame(N)}},L=function(e,t){if(g.current&&g.current.querySelector(".rpv-core__viewer")){var r=-1,o=function(){var n,i,a=null===(n=g.current)||void 0===n?void 0:n.querySelector(".rpv-core__inner-pages");if(a){if(a.scrollTop!==r)return r=a.scrollTop,void setTimeout(o,100);var l=null===(i=g.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(l){var c=l.querySelectorAll(".rpv-search__highlight")[t];if(c){var u=a.getBoundingClientRect(),s=c.getBoundingClientRect(),p=a.scrollTop+(s.top-u.top)-a.clientHeight/2+s.height/2;a.scrollTo({top:p,behavior:"smooth"})}}}};setTimeout(o,300)}},$=function(e,t){if(g.current){var r=0,o=function(){var n,i;if(!(++r>60)){var a=null===(n=g.current)||void 0===n?void 0:n.querySelector(".rpv-core__inner-pages");if(a){var l=null===(i=g.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(l){var c=l.getBoundingClientRect();if(0!==c.height){var u=a.getBoundingClientRect(),s=t/100*c.height,p=c.top-u.top+s;a.scrollTo({top:a.scrollTop+p-40,behavior:"smooth"})}else setTimeout(o,100)}else setTimeout(o,100)}else setTimeout(o,100)}};setTimeout(o,100)}},D=i(function(){var e={};return w.forEach(function(t,r){var o=p[t];o>0&&(e[o]||(e[o]=[]),e[o].push(r))}),e},[w,p]),K=function(e){var t=p[w[e]];return(D[t]||[]).indexOf(e)},J=function(e,t){if(g.current){var r=-1,o=0,n=function(){var i,a;if(!(++o>60)){var l=null===(i=g.current)||void 0===i?void 0:i.querySelector(".rpv-core__inner-pages");if(l){if(l.scrollTop!==r)return r=l.scrollTop,void setTimeout(n,100);var c=null===(a=g.current)||void 0===a?void 0:a.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(c){var u=c.getBoundingClientRect();if(0!==u.height){var s=l.getBoundingClientRect(),p=t/100*u.height,f=u.top-s.top+p;l.scrollTo({top:l.scrollTop+f-40,behavior:"instant"})}else setTimeout(n,100)}else setTimeout(n,100)}else setTimeout(n,100)}};setTimeout(n,100)}};return{setHighlightIndex:x,highlightIndex:y,cursorIndex:I,setCursorIndex:S,orderedKeys:w,totalHighlights:B,getValidPosition:function(e){if(v)return e+1;if(!p)return 0;for(var t=0,r=0;r<=e;r++)p[w[r]]>0&&t++;return t},tryJump:N,jumpToPage:z,zoomTo:P,hideNonTargetHighlights:C,deduplicateHighlights:A,scrollToCoord:$,plugins:[v?R:j,E,F],controls:{ZoomInButton:Z,ZoomOutButton:H,ZoomPopover:O,goToNext:function(){if(v&&h)for(var e=I+1;e<h.length;e++){var t=h[e],r=h[I];return S(e),z(t.pageIndex),void(t.pageIndex!==r.pageIndex?(z(t.pageIndex),J(t.pageIndex,t.top)):$(t.pageIndex,t.top))}else{var o=function(e){var t=w[e];if(p[t]>0){var r=p[t]-1,o=K(e);return S(e),z(p[t]-1),L(r,o),setTimeout(function(){A(r)},500),1===Object.keys(p).length&&C(f),{value:void 0}}};for(e=I+1;e<w.length;e++){var n=o(e);if("object"==typeof n)return n.value}}},goToPrevious:function(){if(v&&h)for(var e=I-1;e>=0;e--){var t=h[e],r=h[I];return S(e),z(t.pageIndex),void(t.pageIndex!==r.pageIndex?(z(t.pageIndex),J(t.pageIndex,t.top)):$(t.pageIndex,t.top))}else{var o=function(e){var t=w[e];if(p[t]>0){var r=p[t]-1,o=K(e);return S(e),z(p[t]-1),L(r,o),setTimeout(function(){A(r)},500),1===Object.keys(p).length&&C(f),{value:void 0}}};for(e=I-1;e>=0;e--){var n=o(e);if("object"==typeof n)return n.value}}}}}};export{s as PdfHighlightControls};
|
|
1
|
+
import{__spreadArray as e,__assign as t}from"tslib";import{jsx as r,Fragment as n}from"react/jsx-runtime";import{useState as o,useRef as i,useMemo as a}from"react";import{searchPlugin as l}from"@react-pdf-viewer/search";import{pageNavigationPlugin as u}from"@react-pdf-viewer/page-navigation";import{zoomPlugin as c}from"@react-pdf-viewer/zoom";import{highlightPlugin as f}from"@react-pdf-viewer/highlight";var g=function(g,h,s,p,v,d,m,x){void 0===m&&(m="yellow"),void 0===x&&(x="#F6D739");var T=o(0),y=T[0],b=T[1],w=i(!1),I=o(0),M=I[0],_=I[1];i([]);var S=function(e){return e.replace(/[^\S\n]+/g," ").trim()},E=function(e){return(e||"").toLowerCase().replace(/\u00ad/g,"").replace(/[""]/g,'"').replace(/['']/g,"'").replace(/[\u2013\u2014]/g,"-").replace(/-/g," ").replace(/[^\w\s]/g,"").replace(/\s+/g," ").trim()},A=function(e){var t=e.trim(),r=(t=(t=t.replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\u00A0\u2009\u202F]/g," ")).replace(/^[-•]\s+/,"")).match(/^((\d+(?:\.\d+)*[.)]?)|[A-Za-z][.)]|\([A-Za-z0-9]+\)|(?:i|ii|iii|iv|v|vi|vii|viii|ix|x)[.)])\s*/i);return r?t.slice(r[0].length).trim():t},B=function(e){var t=E(e),r=t.replace(/\s+/g,""),n=new Set;return t&&n.add(t),r&&n.add(r),n},k=function(e){return e.replace(/\\([''])/g,"$1").replace(/\]\s*\n\s*\(/g,"](").replace(/&[#\w]+;/g,function(e){return t=e,(r=document.createElement("textarea")).innerHTML=t,r.value;var t,r}).replace(/<br\s*\/?>/gi,"\n").replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1")},q=function(e){return e?k(e).split(/\n+/).map(A).flatMap(function(e){var t=e.match(/^\s*\|(.+)\|\s*$/);return t?t[1].split("|").map(function(e){return e.trim()}).filter(Boolean):[e]}).map(function(e){return S(function(e){return e.replace(/(^|\W)[*_]{1,3}([^*_]+)[*_]{1,3}(?=\W|$)/g,"$1$2")}(e))}).filter(Boolean):[]},z=Object.keys(h).map(Number).sort(function(e,t){return e-t}),j=a(function(){return v?d.length:v?0:Object.values(h).filter(function(e){return e>0}).length},[d,h]),C=function(r){if(s.current){var n=s.current.querySelector('[data-testid="search__highlights-'.concat(r,'"]'));if(n){var o=Array.from(n.querySelectorAll(".rpv-search__highlight"));if(0!==o.length){var i=P.map(B),a=Z.map(B);if(0!==i.length||0!==a.length){var l=o.map(function(e){var r=function(e){var t=e.getBoundingClientRect();if(t.height>0||t.width>0)return{top:t.top,left:t.left,right:t.right};var r=e.offsetTop,n=e.offsetLeft;return{top:r,left:n,right:n+e.offsetWidth}}(e),n=(e.textContent||"").trim(),o=(e.getAttribute("title")||"").trim();return t({el:e,text:n||o},r)}).filter(function(e){return e.text.length>0}).sort(function(e,t){return e.top-t.top||e.left-t.left});if(0!==l.length){var u=[],c=null,f=[],h=function(){if(c){var e=f.join(" ");c.title=E(e),c.title&&u.push(c),c=null,f=[]}};if(l.forEach(function(e){if(!c)return c={title:"",elements:[e.el],lastTop:e.top,lastRight:e.right},void(f=[e.text]);var t=Math.abs(e.top-c.lastTop)<=5,r=e.left<=c.lastRight+28;t&&r?(c.elements.push(e.el),c.lastTop=e.top,c.lastRight=Math.max(c.lastRight,e.right),f.push(e.text)):(h(),c={title:"",elements:[e.el],lastTop:e.top,lastRight:e.right},f=[e.text])}),h(),0!==u.length){for(var p=function(e,t){if(!e)return!1;if(t.has(e))return!0;for(var r=e.replace(/\s+/g,""),n=0,o=Array.from(t);n<o.length;n++){var i=o[n];if(i){var a=i.replace(/\s+/g,"");if(a===r)return!0;if(i.length>=8&&e.length>=5&&i.includes(e))return!0;if(a.length>=8&&r.length>=5&&a.includes(r))return!0;if(e.length>=10&&i.length>=8&&e.includes(i))return!0;if(r.length>=10&&a.length>=8&&r.includes(a))return!0}}return!1},v=0,d=new Set,m=function(e){if(!e||e.length<8)return null;for(var t=e.replace(/\s+/g,""),r=0;r<u.length;r++)for(var n="",o="",i=new Set,a=r;a<u.length&&a<r+20;a++){var l=u[a].title;if(n=n?"".concat(n," ").concat(l):l,o=o?"".concat(o).concat(l.replace(/\s+/g,"")):l.replace(/\s+/g,""),i.add(a),n.includes(e)||o.includes(t))return i;if(n.length>=15&&(e.includes(n)||t.includes(o)))return i;if(n.length>e.length+150)break}return null},x=0,T=Array.from(new Set(e(e([],P,!0),Z,!0).map(E).filter(function(e){return e.length>=8}))).sort(function(e,t){return t.length-e.length});x<T.length;x++){var y=m(T[x]);y&&y.size>0&&(y.forEach(function(e){return d.add(e)}),v=d.size)}if(0===v){var b=function(e){if(0===e.length)return null;for(var t=null,r=0,n=e;r<n.length;r++)for(var o=n[r],i=0,a=Array.from(o);i<a.length;i++){var l=a[i];if(l&&!(l.length<5))for(var c=l.replace(/\s+/g,""),f=0;f<u.length;f++)for(var g="",h="",s=new Set,p=f;p<u.length&&p<f+15;p++){var v=u[p].title;if(g=g?"".concat(g," ").concat(v):v,h=h?"".concat(h).concat(v.replace(/\s+/g,"")):v.replace(/\s+/g,""),s.add(p),g.includes(l)||h.includes(c)){var d=Math.max(0,g.length-l.length);(!t||d<t.extra)&&(t={blocks:new Set(s),extra:d});break}if(g.length>l.length+120)break}}return t?t.blocks:null}(i);b&&b.size>0&&(b.forEach(function(e){return d.add(e)}),v=d.size)}var w=function(e){if(e.length<2)return 40;for(var t=[],r=1;r<e.length;r++){var n=Math.abs(e[r].lastTop-e[r-1].lastTop);n>0&&t.push(n)}if(0===t.length)return 40;t.sort(function(e,t){return e-t});var o=t[Math.floor(t.length/2)],i=Math.round(2.25*o);return Math.min(60,Math.max(24,i))}(u),I=Z.map(E).filter(function(e){return e.length>=8}),M=I.map(function(e){return e.split(/\s+/).filter(function(e){return e.length>=2})});if(0===v)for(var _=a,S=0;S<u.length;S++)for(var A=u[S].title,k=0;k<_.length;k++)if(p(A,_[k])){for(var q=0,z=new Set,j=k,C=S-1,R=S;R<u.length&&j<_.length;R++){if(p(u[R].title,_[j])){if(C>=0){var N=u[C].lastTop,F=u[R].lastTop;if(Math.abs(F-N)>w)break}q++,z.add(R),C=R,j++}else if(j>0&&p(u[R].title,_[j-1])){N=u[C].lastTop,F=u[R].lastTop;Math.abs(F-N)<=3&&(z.add(R),C=R)}if(R-C>6)break}q>v&&(v=q,d=z)}if(v<Math.min(3,I.length)&&I.length>0){var $=new Set;u.forEach(function(e,t){var r=e.title.split(/\s+/).filter(function(e){return e.length>=2});if(!(r.length<2))for(var n=new Set(r),o=0,i=M;o<i.length;o++){var a=i[o];if(!(a.length<2)){for(var l=0,u=0,c=a;u<c.length;u++){var f=c[u];n.has(f)&&l++}var g=l/a.length;if(l>=3||g>=.5){$.add(t);break}}}}),$.size>0&&(d=$,v=Math.max(v,$.size))}var H=new Set;if(O.forEach(function(e){var t=E(e);t&&(H.add(t),H.add(t.replace(/\s+/g,"")))}),0===v){var L=new Set;if(u.forEach(function(e,t){var r=e.title.replace(/\s+/g,"");if(H.has(e.title)||H.has(r))L.add(t);else for(var n=Array.from(H),o=0;o<n.length;o++){var i=n[o];if(i.length>=10&&i.includes(e.title)&&e.title.length>=5){L.add(t);break}}}),0===L.size)return 0;d=L}u.forEach(function(e,t){var r=d.has(t);e.elements.forEach(function(e){r?(e.classList.add("verified-match"),e.style.display=""):(e.style.display="none",e.classList.remove("verified-match"))})});var D=[];return u.forEach(function(e,t){d.has(t)&&e.elements.forEach(function(e){return D.push(e)})}),requestAnimationFrame(function(){var e=D.map(function(e){return{el:e,rect:e.getBoundingClientRect()}}).filter(function(e){return e.rect.width>0&&e.rect.height>0}).sort(function(e,t){return t.rect.width*t.rect.height-e.rect.width*e.rect.height}),t=[];e.forEach(function(e){var r=e.el,n=e.rect;t.some(function(e){return t=e.rect,r=n,o=Math.max(0,Math.min(t.right,r.right)-Math.max(t.left,r.left))*Math.max(0,Math.min(t.bottom,r.bottom)-Math.max(t.top,r.top)),((i=Math.min(t.width*t.height,r.width*r.height))>0?o/i:0)>.5;var t,r,o,i})?(r.style.display="none",r.classList.remove("verified-match")):t.push({el:r,rect:n})})}),console.groupCollapsed("[debug: PDF ordered matching - Page ".concat(r,"]")),console.log("input->",g),console.log("processed sentences->",P),console.log("processed lines->",Z),console.log("Expected sentence count:",i.length),console.log("Expected line count:",a.length),console.log("Matched sequence length:",v),console.log("blocksToKeep",d,"size",d.size),console.groupEnd(),d.size}}}}}}},R=function(e){s.current&&s.current.querySelectorAll(".rpv-search__highlights").forEach(function(t){var r=t.getAttribute("data-testid"),n=parseInt((null==r?void 0:r.replace(/search__highlights-/g,""))||"-1"),o=t.querySelectorAll(".rpv-search__highlight");e.has(n)||o.forEach(function(e){e.style.display="none"})})},N=g.map(function(e){return function(e){return e?k(e).split(/\n{2,}/).map(function(e){return q(e).join(" ")}).map(function(e){return S(e)}).filter(Boolean):[]}(e)}).flat(),F=g.map(function(e){return q(e)}).flat(),$=N.some(function(e){return e.length>=3})?3:1,P=N.filter(function(e){return e.length>=$}),Z=F.filter(function(e){return e.length>=$}),H=Z.flatMap(function(e){return function(e,t,r){void 0===t&&(t=6),void 0===r&&(r=4);var n=e.split(/\s+/).filter(Boolean);if(n.length<=t)return[];for(var o=[],i=0;i+t<=n.length;i+=r)o.push(n.slice(i,i+t).join(" "));return n.length>t&&(n.length-t)%r!==0&&o.push(n.slice(n.length-t).join(" ")),o}(e)}),O=Array.from(new Set(e(e(e([],P,!0),Z,!0),H,!0).flatMap(function(e){var t=S(e.replace(/[\u00A0\u2009\u202F]/g," ").replace(/\u00ad/g,"").replace(/[""]/g,'"').replace(/['']/g,"'"));if(!t)return[];var r=t.replace(/[\u2013\u2014]/g,"-"),n=S(r.replace(/(\w)-\s+(\w)/g,"$1$2")),o=S(r.replace(/-/g," ")),i=S(r.replace(/-/g,"")),a=S(t.replace(/[^\w\s]/g,"")),l=new Set([t,r,n,o,i,a]);return Array.from(l).filter(Boolean)}))).filter(function(e){var t=e.split(/\s+/).filter(Boolean);return!(e.length<$)&&(t.length>=3||e.length>=12)}),L=l({keyword:O}),D=u(),W=c(),K=L.jumpToMatch,J=D.jumpToPage,V=W.zoomTo,G=W.ZoomInButton,Q=W.ZoomOutButton,U=W.ZoomPopover,X=a(function(){return function(r){if(0===r.length)return[];var n=new Map;r.forEach(function(e,r){var o=null!=e.pageNumber?e.pageNumber-1:e.pageIndex;n.has(o)||n.set(o,[]),n.get(o).push(t(t({},e),{originalIndex:r}))});var o=[];return n.forEach(function(t){for(var r=e([],t,!0).sort(function(e,t){return e.top!==t.top?e.top-t.top:e.left-t.left}),n=new Array(r.length).fill(!1),i=0;i<r.length;i++)if(!n[i]){var a=r[i],l=a.left,u=a.top,c=a.width,f=a.height,g=a.pageIndex,h=a.pageNumber,s=l+c,p=u+f;n[i]=!0;for(var v=!0;v;){v=!1;for(var d=i+1;d<r.length;d++)if(!n[d]){var m=r[d],x=m.left+m.width,T=m.top+m.height;l<=x+1&&s>=m.left-1&&u<=T+1&&p>=m.top-1&&(l=Math.min(l,m.left),u=Math.min(u,m.top),c=(s=Math.max(s,x))-l,f=(p=Math.max(p,T))-u,n[d]=!0,v=!0)}}o.push({pageIndex:g,pageNumber:h,left:l,top:u,width:c,height:f})}}),o}(d)},[d]),Y=f({renderHighlights:function(e){return r(n,{children:X.map(function(e,r){return t(t({},e),{mergedIndex:r})}).filter(function(t){return null!=t.pageNumber?t.pageNumber-1===e.pageIndex:t.pageIndex===e.pageIndex}).map(function(t){var n=d[M],o=null!=n&&(null!=n.pageNumber?n.pageNumber-1===e.pageIndex:n.pageIndex===e.pageIndex)&&n.left>=t.left-1&&n.left<=t.left+t.width+1&&n.top>=t.top-1&&n.top<=t.top+t.height+1;return r("div",{style:{position:"absolute",left:"".concat(t.left,"%"),top:"".concat(t.top,"%"),width:"".concat(t.width,"%"),height:"".concat(t.height,"%"),background:o?x:m,opacity:o?.7:.4,transition:"background 0.2s, opacity 0.2s"}},t.mergedIndex)})})}}),ee=function(){if(!w.current)try{K(0),w.current=!0;var e=d[0];e&&v&&re(e.pageIndex,e.top)}catch(e){requestAnimationFrame(ee)}},te=function(e,t){if(s.current&&s.current.querySelector(".rpv-core__viewer")){var r=-1,n=function(){var o,i,a=null===(o=s.current)||void 0===o?void 0:o.querySelector(".rpv-core__inner-pages");if(a){if(a.scrollTop!==r)return r=a.scrollTop,void setTimeout(n,100);var l=null===(i=s.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(l){var u=l.querySelectorAll(".rpv-search__highlight")[t];if(u){var c=a.getBoundingClientRect(),f=u.getBoundingClientRect(),g=a.scrollTop+(f.top-c.top)-a.clientHeight/2+f.height/2;a.scrollTo({top:g,behavior:"smooth"})}}}};setTimeout(n,300)}},re=function(e,t){if(s.current){var r=0,n=function(){var o,i;if(!(++r>60)){var a=null===(o=s.current)||void 0===o?void 0:o.querySelector(".rpv-core__inner-pages");if(a){var l=null===(i=s.current)||void 0===i?void 0:i.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(l){var u=l.getBoundingClientRect();if(0!==u.height){var c=a.getBoundingClientRect(),f=t/100*u.height,g=u.top-c.top+f;a.scrollTo({top:a.scrollTop+g-40,behavior:"smooth"})}else setTimeout(n,100)}else setTimeout(n,100)}else setTimeout(n,100)}};setTimeout(n,100)}},ne=a(function(){var e={};return z.forEach(function(t,r){var n=h[t];n>0&&(e[n]||(e[n]=[]),e[n].push(r))}),e},[z,h]),oe=function(e){var t=h[z[e]];return(ne[t]||[]).indexOf(e)},ie=function(e,t){if(s.current){var r=-1,n=0,o=function(){var i,a;if(!(++n>60)){var l=null===(i=s.current)||void 0===i?void 0:i.querySelector(".rpv-core__inner-pages");if(l){if(l.scrollTop!==r)return r=l.scrollTop,void setTimeout(o,100);var u=null===(a=s.current)||void 0===a?void 0:a.querySelector('[data-testid="core__page-layer-'.concat(e,'"]'));if(u){var c=u.getBoundingClientRect();if(0!==c.height){var f=l.getBoundingClientRect(),g=t/100*c.height,h=c.top-f.top+g;l.scrollTo({top:l.scrollTop+h-40,behavior:"instant"})}else setTimeout(o,100)}else setTimeout(o,100)}else setTimeout(o,100)}};setTimeout(o,100)}};return{setHighlightIndex:b,highlightIndex:y,cursorIndex:M,setCursorIndex:_,orderedKeys:z,totalHighlights:j,getValidPosition:function(e){if(v)return e+1;if(!h)return 0;for(var t=0,r=0;r<=e;r++)h[z[r]]>0&&t++;return t},tryJump:ee,jumpToPage:J,zoomTo:V,hideNonTargetHighlights:R,deduplicateHighlights:C,scrollToCoord:re,plugins:[v?Y:L,D,W],controls:{ZoomInButton:G,ZoomOutButton:Q,ZoomPopover:U,goToNext:function(){if(v&&d)for(var e=M+1;e<d.length;e++){var t=d[e],r=d[M];return _(e),J(t.pageIndex),void(t.pageIndex!==r.pageIndex?(J(t.pageIndex),ie(t.pageIndex,t.top)):re(t.pageIndex,t.top))}else{var n=function(e){var t=z[e];if(h[t]>0){var r=h[t]-1,n=oe(e);return _(e),J(h[t]-1),te(r,n),setTimeout(function(){C(r)},500),1===Object.keys(h).length&&R(p),{value:void 0}}};for(e=M+1;e<z.length;e++){var o=n(e);if("object"==typeof o)return o.value}}},goToPrevious:function(){if(v&&d)for(var e=M-1;e>=0;e--){var t=d[e],r=d[M];return _(e),J(t.pageIndex),void(t.pageIndex!==r.pageIndex?(J(t.pageIndex),ie(t.pageIndex,t.top)):re(t.pageIndex,t.top))}else{var n=function(e){var t=z[e];if(h[t]>0){var r=h[t]-1,n=oe(e);return _(e),J(h[t]-1),te(r,n),setTimeout(function(){C(r)},500),1===Object.keys(h).length&&R(p),{value:void 0}}};for(e=M-1;e>=0;e--){var o=n(e);if("object"==typeof o)return o.value}}}}}};export{g as PdfHighlightControls};
|
|
2
2
|
//# sourceMappingURL=usePdfHighlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,oBAAoB,+CAqNzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAkBlC,QAAA,MAAM,gBAAgB,8PAsBnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAkBlC,QAAA,MAAM,gBAAgB,8PAsBnB,qBAAqB,4CAglHvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompareConstants.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEzF,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,UAAU,KAAK,CAAC;AAG7B,eAAO,MAAM,qBAAqB,EAAE,QAAgC,CAAC;AACrE,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AACnE,eAAO,MAAM,yBAAyB,EAAE,iBAavC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAC,
|
|
1
|
+
{"version":3,"file":"CognitiveCompareConstants.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEzF,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,UAAU,KAAK,CAAC;AAG7B,eAAO,MAAM,qBAAqB,EAAE,QAAgC,CAAC;AACrE,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AACnE,eAAO,MAAM,yBAAyB,EAAE,iBAavC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAC,iBAMtC,CAAA"}
|
|
@@ -106,6 +106,7 @@ export interface CognitiveCompareProps {
|
|
|
106
106
|
deviationNodeIdToView?: {
|
|
107
107
|
id: string;
|
|
108
108
|
trigger: number;
|
|
109
|
+
displayImpact?: boolean;
|
|
109
110
|
};
|
|
110
111
|
resetDeviationNodeId?: () => void;
|
|
111
112
|
resetTrigger?: number;
|
|
@@ -250,6 +251,7 @@ export type CognitiveSummaryPopupProps = {
|
|
|
250
251
|
scrollContainerEl?: HTMLElement | null;
|
|
251
252
|
markdownStyles?: React.CSSProperties & Record<string, any>;
|
|
252
253
|
isLoading?: boolean;
|
|
254
|
+
displayImpact?: boolean;
|
|
253
255
|
};
|
|
254
256
|
export type SummaryPopupState = {
|
|
255
257
|
open: boolean;
|
|
@@ -257,6 +259,7 @@ export type SummaryPopupState = {
|
|
|
257
259
|
summary: string | Record<string, any> | null;
|
|
258
260
|
markdownStyles?: React.CSSProperties & Record<string, any>;
|
|
259
261
|
isLoading?: boolean;
|
|
262
|
+
displayImpact?: boolean;
|
|
260
263
|
};
|
|
261
264
|
export type HighlightMatch = {
|
|
262
265
|
idx?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompareTypes.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareTypes.ts"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"CognitiveCompareTypes.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareTypes.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CognitiveSummaryPopupProps } from "../CognitiveCompareTypes";
|
|
2
|
-
export default function CognitiveSummaryPopup({ open, anchorEl, containerEl, clipTopEl, scrollContainerEl, onClose, summary, markdownStyles, isLoading, }: CognitiveSummaryPopupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
export default function CognitiveSummaryPopup({ open, anchorEl, containerEl, clipTopEl, scrollContainerEl, onClose, summary, markdownStyles, isLoading, displayImpact, }: CognitiveSummaryPopupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
//# sourceMappingURL=CognitiveSummaryPopup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveSummaryPopup.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/CognitiveSummaryPopup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAGtE,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,cAAc,EACd,SAAS,
|
|
1
|
+
{"version":3,"file":"CognitiveSummaryPopup.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/CognitiveSummaryPopup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAGtE,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,cAAc,EACd,SAAS,EACT,aAAa,GACd,EAAE,0BAA0B,kDA2X5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfViewer.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfViewer.tsx"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"PdfViewer.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfViewer.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePdfHighlight.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/usePdfHighlight.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM5C,eAAO,MAAM,oBAAoB,kBAChB,MAAM,EAAE,kBACP,OAAO,MAAM,EAAE,MAAM,CAAC,aAC3B,MAAM,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,oBAC9B,IAAI,MAAM,CAAC,kBACb,OAAO,2BACE,aAAa,EAAE;;;;;;;+
|
|
1
|
+
{"version":3,"file":"usePdfHighlight.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/usePdfHighlight.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM5C,eAAO,MAAM,oBAAoB,kBAChB,MAAM,EAAE,kBACP,OAAO,MAAM,EAAE,MAAM,CAAC,aAC3B,MAAM,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,oBAC9B,IAAI,MAAM,CAAC,kBACb,OAAO,2BACE,aAAa,EAAE;;;;;;;+BAgOP,MAAM,KAAG,MAAM;;;;2CAwmBH,IAAI,MAAM,CAAC;wCAxiBd,MAAM;+BAqvBf,MAAM,OAAO,MAAM;;;;;;;;;CA4MtD,CAAC"}
|