@viswa-test/test-citation 0.0.175 → 0.0.177
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/MoreFunctionsPopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/MoreFunctionsPopup.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +2 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/MoreFunctionsPopup.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/MoreFunctionsPopup.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),s=require("./CognitiveComparehelpers.js"),u=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("./components/ThreeDotsLoader.js"),p=require("./hooks/useCompareData.js"),g=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),m=require("./hooks/useAccordionState.js"),S=require("./hooks/useDeviationNavigation.js"),R=require("./components/CompareHeader.js"),x=require("./components/SubSectionAccordion.js"),_=require("./components/LHSSectionRow.js"),y=require("./components/RHSSectionRow.js"),C=require("./components/CognitiveSummaryPopup.js"),b=require("./CompareContext.js"),E=require("./hooks/useStyles.js"),A=require("./hooks/useResizeHandler.js"),B=require("./hooks/useLinesCalculator.js"),T=require("./hooks/useSideBySide.js"),I=require("./components/SvgConnectors.js");exports.SHARED_MARKDOWN_STYLES=u.SHARED_MARKDOWN_STYLES,exports.default=function(w){var D,O,F,j,P,N,k,L,q,M,H,V,z,G,W,K,U,Y,X,J,$,Q,Z,ee,ne,ie,te,oe,re,le,se,ue,ae,ce,de=w.componentHeaderText,fe=void 0===de?a.DEFAULT_COMPONENT_HEADER_TEXT:de,ve=w.treeData,pe=w.comparisonConfig,ge=w.leftColumnTitleText,he=w.rightColumnTitleText,me=w.markdownStyles,Se=w.resetTrigger,Re=w.displayConfig,xe=void 0===Re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:Re,_e=w.popupConfig,ye=w.deviationData,Ce=void 0===ye?{}:ye,be=w.deviationNodeIdToView,Ee=w.resetDeviationNodeId,Ae=w.isProposingFix,Be=void 0!==Ae&&Ae,Te=w.proposingFixNodeId,Ie=w.isRedlineFlow,we=i.useState(xe.maintainRelativeOrder),De=we[0],Oe=we[1],Fe=!!De||!!(null==xe?void 0:xe.showDeviationBadges),je=i.useState(!1),Pe=je[0],Ne=je[1],ke=i.useState(null),Le=ke[0],qe=ke[1],Me=i.useState(null===(O=null!==(D=null==ve?void 0:ve.newEvaluationResult)&&void 0!==D?D:null==xe?void 0:xe.enableDeviationSchemaBackwardCompatibility)||void 0===O||O)[0],He=i.useState(new Set),Ve=He[0],ze=He[1],Ge=i.useState([]),We=Ge[0],Ke=Ge[1],Ue=i.useState(!1),Ye=Ue[0],Xe=Ue[1],Je=i.useRef(null),$e=i.useRef(null),Qe=i.useRef(null),Ze=i.useRef(null),en=i.useRef(null),nn=i.useRef(!1),tn=i.useRef(null),on=i.useRef({}),rn=i.useRef([]),ln=i.useRef(function(){}),sn=i.useRef(null),un=i.useRef(function(){}),an=i.useMemo(function(){return JSON.stringify(Ce||{})},[JSON.stringify(Ce)]),cn=i.useMemo(function(){return Ce||{}},[an]),dn=i.useMemo(function(){return(null==ve?void 0:ve.cognitive_decisioning)||{}},[ve]),fn=i.useMemo(function(){return e.__assign(e.__assign({},u.SHARED_MARKDOWN_STYLES),me)},[me]),vn=i.useRef(null),pn=i.useRef(null),gn=i.useRef(null),hn=i.useRef(null),mn=i.useRef(null),Sn=i.useRef(null),Rn=i.useRef(null),xn=i.useRef(null),_n=i.useRef(null),yn=i.useRef(null),Cn=g.useComparePopups(vn),bn=Cn.cognitivePopup,En=Cn.setCognitivePopup,An=Cn.moreFunctions,Bn=Cn.setMoreFunctions,Tn=Cn.position,In=Cn.setPosition,wn=Cn.activeBadgeId,Dn=Cn.summaryPopup,On=Cn.setSummaryPopup,Fn=Cn.closeSummaryPopup,jn=Cn.setActiveBadgeId,Pn=Cn.popupRef,Nn=Cn.handleOpenCognitiveCompare,kn=Cn.openCognitivePopupFromState,Ln=Cn.closeCognitivePopup,qn=Cn.closeMoreFunctionsPopup,Mn=i.useMemo(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==pe?void 0:pe.fields)&&void 0!==e?e:u.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(n=null==pe?void 0:pe.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:u.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==pe?void 0:pe.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:u.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==pe?void 0:pe.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:u.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[pe]),Hn=i.useState(null),Vn=Hn[0];Hn[1];var zn=null===(P=null===(F=null==ve?void 0:ve.documents)||void 0===F?void 0:F[null===(j=null==ve?void 0:ve.input_index_map)||void 0===j?void 0:j[0]])||void 0===P?void 0:P.title,Gn=null===(L=null===(N=null==ve?void 0:ve.documents)||void 0===N?void 0:N[null===(k=null==ve?void 0:ve.input_index_map)||void 0===k?void 0:k[1]])||void 0===L?void 0:L.title,Wn=s.safeStringify(ge||zn||"Uploaded Contract"),Kn=null===(V=null===(H=null===(q=null==ve?void 0:ve.documents)||void 0===q?void 0:q[null===(M=null==ve?void 0:ve.input_index_map)||void 0===M?void 0:M[0]])||void 0===H?void 0:H.metadata)||void 0===V?void 0:V.file_name,Un=s.safeStringify(Kn),Yn=null===(K=null===(W=null===(z=null==ve?void 0:ve.documents)||void 0===z?void 0:z[null===(G=null==ve?void 0:ve.input_index_map)||void 0===G?void 0:G[1]])||void 0===W?void 0:W.metadata)||void 0===K?void 0:K.file_name,Xn=s.safeStringify(Yn),Jn=s.safeStringify(he||Gn||"Reference Template"),$n=p.useCognitiveTreeData(ve,De,cn,Mn,Me),Qn=$n.activeProposed,Zn=$n.existingRule,ei=$n.proposedSections,ni=$n.existingSections,ii=$n.visibleFields,ti=$n.parentDeviationRecord,oi=$n.deviationNumberRegistry,ri=$n.parseError;i.useEffect(function(){ri&&qe("Failed to load comparison: ".concat(ri))},[ri]);var li=ei.length>0||ni.length>0,si=i.useMemo(function(){if(!Ie)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";s.hasMeaningfulRedlineTags(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(ei),i(ni),"".concat(e,":").concat(n)},[Ie,ei,ni]),ui=h.useSectionRefs(ii.map(function(e){return e.key}),Math.max(ei.length,ni.length)),ai=ui.leftRefs,ci=ui.rightRefs,di=ui.sectionLeftRefs,fi=ui.sectionRightRefs,vi=ui.lhsBadgeRefs,pi=ui.rhsBadgeRefs,gi=ui.sectionRightRowRefs,hi=ui.subSectionLeftRefs,mi=ui.subSectionRightRefs,Si=ui.sectionRowRefs,Ri=ui.getSectionRowRef,xi=ui.getSubSectionRef,_i=ui.getBadgeRef,yi=T.useSideBySide({maintainRelativeOrder:De,proposedSections:ei,existingSections:ni,leftContainerRef:xn,rightContainerRef:gn,scrollContainerRef:vn,sectionLeftRefs:di,sectionRightRefs:fi,subSectionLeftRefs:hi,subSectionRightRefs:mi,lhsBadgeRefs:vi,rhsBadgeRefs:pi,sectionRowRefs:Si,sectionRightRowRefs:gi,rhsTopSpacerRef:hn,rhsBottomSpacerRef:mn,lhsTopSpacerRef:Sn,lhsBottomSpacerRef:Rn,calculateLinesRef:ln,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:rn,closeMoreFunctionsPopup:qn,setErrorToast:qe,moreFunctions:An,closeSummaryPopup:Fn}),Ci=yi.isSideBySide,bi=yi.isArrowVisible,Ei=yi.setIsArrowVisible,Ai=yi.isResizing,Bi=yi.setIsResizing,Ti=yi.isSideBySideLoading,Ii=yi.activeSideBySideSection,wi=yi.scrollLock,Di=yi.sideBySideCacheRef,Oi=yi.isSideBySideRef,Fi=yi.activeSideBySideRightSectionRef,ji=yi.activeSideBySideSectionRef,Pi=yi.sideBySideLineRef,Ni=yi.highlightedClauseRefs,ki=yi.clearClauseHighlight,Li=yi.resetSideBySide,qi=yi.activateSideBySide,Mi=m.useAccordionState({maintainRelativeOrder:!!De,proposedSections:ei,existingSections:ni,activeSideBySideSection:Ii,connectedSections:Ve,resetSideBySide:Li,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:rn,svgContainerRef:Je,isAnimatingRef:nn,animationTimerRef:tn,calculateLinesRef:ln,sectionLeftRefs:di,sectionRightRefs:fi,subSectionLeftRefs:hi,subSectionRightRefs:mi}),Hi=Mi.expandedSections,Vi=Mi.setExpandedSections,zi=Mi.expandedSubSections,Gi=Mi.setExpandedSubSections,Wi=Mi.handleSubSectionToggle,Ki=Mi.toggleSection,Ui=Mi.forceExpandCrossWiredSections,Yi=function(){var e,n;if(null!=Ii){var i=null===(e=di.current[Ii])||void 0===e?void 0:e.current,t=null===(n=fi.current[Ii])||void 0===n?void 0:n.current,o=gn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),s=o.getBoundingClientRect(),u=r.top-s.top,a=l.top-s.top-u;o.scrollBy({top:a,behavior:"smooth"})}}},Xi=i.useCallback(function(e){null==e||e.stopPropagation(),Xe(function(e){var n=!e;return n&&requestAnimationFrame(function(){Yi()}),n})},[Yi]);i.useEffect(function(){Ie&&"off"!==si&&"0:0"!==si&&(Di.current=null,rn.current=[],requestAnimationFrame(function(){var e;null===(e=ln.current)||void 0===e||e.call(ln)}))},[Ie,si]);var Ji=i.useMemo(function(){var e=new Map,n=new Map,i=1;if(De)ei.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),ni.forEach(function(t){if(t.id){var o=ei.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(ei.length,ni.length),o=0;o<t;o++){var r=ei[o],l=ni[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[ei,ni,De]),$i=Zn.analysis,Qi=s.safeStringify(null===(Y=null===(U=null==$i?void 0:$i.rule_difference_comparison)||void 0===U?void 0:U.summary)||void 0===Y?void 0:Y.overall_summary),Zi=!!Qi.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),et=null!==(X=null==ve?void 0:ve.base_root_id)&&void 0!==X?X:"-1";null==ve||ve[et];var nt=Me?null!==(se=null!==(oe=Ce&&(null===(te=null==Ce?void 0:Ce[et])||void 0===te?void 0:te.evaluation_result))&&void 0!==oe?oe:null===(le=null===(re=null==ve?void 0:ve.nodes)||void 0===re?void 0:re[et])||void 0===le?void 0:le.evaluation_result)&&void 0!==se?se:null:null!==(ie=null!==(Q=Ce&&(null===($=null===(J=null==Ce?void 0:Ce[et])||void 0===J?void 0:J.evaluation_result)||void 0===$?void 0:$[0]))&&void 0!==Q?Q:null===(ne=null===(ee=null===(Z=null==ve?void 0:ve.nodes)||void 0===Z?void 0:Z[et])||void 0===ee?void 0:ee.evaluation_result)||void 0===ne?void 0:ne[0])&&void 0!==ie?ie:null,it=s.extractDeviationScore(nt),tt=s.generateColorPalette(null!==(ce=null===(ae=null===(ue=null==nt?void 0:nt.evaluation_outputs)||void 0===ue?void 0:ue.metadata)||void 0===ae?void 0:ae.label_color)&&void 0!==ce?ce:a.DEFAULT_DEVIAION_COLOR),ot=i.useRef(Li);i.useEffect(function(){ot.current=Li},[Li]);var rt=i.useRef(Ln);i.useEffect(function(){rt.current=Ln},[Ln]);var lt=i.useCallback(function(e,n,i,t,o,r){return so.current(e,n,i,t,o,r)},[]),st=i.useCallback(function(e,n,i,t,o){return uo.current(e,n,i,t,o)},[]),ut=i.useCallback(function(){return ao.current()},[]),at=i.useCallback(function(e,n){return co.current(e,n)},[]),ct=i.useCallback(function(e){return fo.current(e)},[]),dt=i.useCallback(function(e){return vo.current(e)},[]),ft=i.useCallback(function(){return po.current()},[]),vt=i.useCallback(function(){var e,n;ki(),null===(e=ot.current)||void 0===e||e.call(ot),Xe(!1),ze(new Set),Ke([]),rn.current=[],It([]),Dt(null),On(a.EMPTY_SUMMARY_POPUP_STATE),null===(n=rt.current)||void 0===n||n.call(rt),requestAnimationFrame(function(){var e;null===(e=ln.current)||void 0===e||e.call(ln)})},[]),pt=i.useRef(vt);i.useEffect(function(){pt.current=vt},[vt]),i.useEffect(function(){Se&&pt.current()},[Se]);var gt=i.useCallback(function(n,i,t,o,r,l,u){var a,c,d,f=s.safeStringify(null==i?void 0:i.id)||s.safeStringify(null==t?void 0:t.id)||"",v=(f?dn[f]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:f,decisioning:[],gap:[],relevance_score:0},p=null!==(c=null===(a=Si.current[o])||void 0===a?void 0:a.current)&&void 0!==c?c:null;return{isLoading:null!==(d=null==xe?void 0:xe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:v,anchorEl:n,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==ve?void 0:ve.documents,input_index_map:null==ve?void 0:ve.input_index_map},deviationData:function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[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 i?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)))return u(l);var a=o.split(s.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},d=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},c),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[dn,ve]),ht=i.useCallback(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),An.open&&An.sectionIdx===o)qn();else{var u=e.currentTarget,a="left";(null===(l=gn.current)||void 0===l?void 0:l.contains(u))&&(a="right");ki(),Oi.current&&Li(),ze(new Set),Ke([]),rn.current=[],Ln(),Dn.open?Vt():Fn(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=o.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=pi.current[l])||void 0===e?void 0:e.current:null===(n=vi.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=pi.current[o])||void 0===i?void 0:i.current:null===(t=vi.current[o])||void 0===t?void 0:t.current}()||u;Bn(gt(e,n,t,o,i,r))})}},[An.open,An.sectionIdx,qn,Fn,gt]),mt=i.useCallback(function(){var e=An.sectionIdx,n=An.isOrphan;qn(),Fn(),null!==e&&(n?qe("No counterpart exists to connect to."):(Ui(e),ki(),Oi.current&&Li(),Ke([]),rn.current=[],ze(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){ln.current&&ln.current()},50)))},[An.sectionIdx,An.isOrphan,qn,Fn,Li]),St=i.useCallback(function(){var e=en.current;if(e){en.current=null;var n=ei.findIndex(function(n){return n.id===e}),i=ni.findIndex(function(n){return n.id===e}),t=-1===n?s.findKeyPathByNodeId(ei,e):null,o=-1===i?s.findKeyPathByNodeId(ni,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,s;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(s=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==s?s:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Ni.current.add(r),s.scrollAndHighlightClause(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(De)-1!==r&&xn.current&&a(function(){return u(n,t,di,hi)},xn.current),-1!==l&&gn.current&&a(function(){return u(i,o,fi,mi)},gn.current);else{var c=vn.current;if(!c)return;a(function(){return-1!==r?u(n,t,di,hi):u(i,o,fi,mi)},c)}}},[ei,ni,De,di,fi,hi,mi,xn,gn,vn]),Rt=i.useCallback(function(n){if(n){ki(),Li(),ze(new Set),Ke([]),rn.current=[],Fn(),Ln();var i=ei.findIndex(function(e){return e.id===n}),t=ni.findIndex(function(e){return e.id===n}),o=-1===i?s.findKeyPathByNodeId(ei,n):null,r=-1===t?s.findKeyPathByNodeId(ni,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;en.current=n,Vi(function(n){var i,t=e.__assign({},n),o=!1;-1!==l&&(t[i=De?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=De?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Gi(function(n){var i=e.__assign({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){en.current===n&&xt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[ei,ni,De,Vi,Gi,Li,Fn,Ln]),xt=i.useRef(St);i.useEffect(function(){xt.current=St},[St]);var _t=i.useRef(null);i.useEffect(function(){if(Vn){var e=Mn.fields.find(function(e){return e.analysisKey===Vn||e.key===Vn});if(e){var n=ai.current[e.key]||ci.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Vn,Mn.fields]);var yt=i.useCallback(function(e){var n,i,t,o,r,l,s,u,a,c=null===(n=null==$i?void 0:$i.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!c||!c[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=c[e],f=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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 v=d.mappings[0]||{};return{score:d.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=v.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(u=d.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[$i]),Ct=E.useStyleHelpers({proposedSections:ei,existingSections:ni,maintainRelativeOrder:De,cognitiveMap:dn,deviationData:Ce,treeData:ve,resolvedComparisonConfig:Mn}),bt=Ct.getSectionCompareStyle,Et=Ct.getSubSectionCompareStyle,At=Ct.getDeviationStyleByKey,Bt=B.useLinesCalculator({containerRef:$e,leftContainerRef:xn,rightContainerRef:gn,svgContainerRef:Je,pathRefs:on,leftHeaderRef:Qe,rightHeaderRef:Ze,proposedSections:ei,existingSections:ni,visibleFields:ii,leftRefs:ai,rightRefs:ci,sectionLeftRefs:di,sectionRightRefs:fi,subSectionLeftRefs:hi,subSectionRightRefs:mi,lhsBadgeRefs:vi,rhsBadgeRefs:pi,sectionRowRefs:Si,expandedSections:Hi,expandedSubSections:zi,connectedSections:Ve,isSideBySide:Ci,activeSideBySideSection:Ii,maintainRelativeOrder:De,cognitiveMap:dn,getSectionCompareStyle:bt,getSubSectionCompareStyle:Et,getDeviationStyleByKey:At,isArrowVisible:bi,isAnimatingRef:nn,isSideBySideRef:Oi,sideBySideCacheRef:Di,sideBySideLineRef:Pi,activeSideBySideSectionRef:ji,activeSideBySideRightSectionRef:Fi,connectedLines:We,setConnectedLines:Ke,cachedConnectedPositions:rn,calculateLinesRef:ln,resizeTimerRef:sn,scrollLock:wi,scrollSyncLocked:Ye,handleResizeRef:un,activeProposed:Qn,existingRule:Zn,analysisData:$i,pendingScrollTargetRef:_n,pendingScrollCallbackRef:yn,resolvedComparisonConfig:Mn,getFieldData:yt}),Tt=Bt.lines,It=Bt.setLines,wt=Bt.overallConnector,Dt=Bt.setOverallConnector,Ot=Bt.svgDimensions,Ft=Bt.handleColumnScroll;i.useEffect(function(){Dn.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=ln.current)||void 0===e||e.call(ln)})})},[Dn.anchorEl,Ye]);var jt=i.useCallback(function(){ki(),Xe(!1),Vi({}),Gi({}),Li(),ze(new Set),Ke([]),rn.current=[],Fn(),Ln(),qn(),requestAnimationFrame(function(){ln.current&&ln.current()})},[Vi,Gi,Li,Fn,Ln,qn]);i.useEffect(function(){Ci||0!==Ve.size||Xe(!1)},[Ci,Ve]);var Pt=i.useMemo(function(){return Object.values(Hi).some(Boolean)||Object.values(zi).some(Boolean)},[Hi,zi]),Nt=i.useRef(null),kt=i.useRef(0),Lt=i.useRef(0),qt=i.useRef(0),Mt=A.useResizeHandler({timerRef:Nt,ruleComponentRef:pn,scrollContainerRef:vn,containerRef:$e,maintainRelativeOrder:De,proposedSections:ei,existingSections:ni,isSideBySideRef:Oi,activeSideBySideSectionRef:ji,activeSideBySideRightSectionRef:Fi,sectionRowRefs:Si,sectionRightRowRefs:gi,sectionLeftRefs:di,sectionRightRefs:fi,subSectionLeftRefs:hi,subSectionRightRefs:mi,lhsBadgeRefs:vi,rhsBadgeRefs:pi,leftContainerRef:xn,rightContainerRef:gn,calculateLinesRef:ln,handleResizeRef:un,setIsResizing:Bi,setIsArrowVisible:Ei,sideBySideCacheRef:Di,cachedConnectedPositions:rn}).handleResize;i.useEffect(function(){un.current=Mt},[Mt,un]),i.useEffect(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,s;i.current=null;var u=e[e.length-1];if(u){var a=null!==(s=null===(l=null===(r=u.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==s?s:u.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return pn.current&&o.push(e(pn.current,kt,n,function(){return un.current()},function(){})),vn.current&&o.push(e(vn.current,Lt,i,function(){return un.current()},function(){return ln.current()})),$e.current&&o.push(e($e.current,qt,t,function(){return un.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)})}},[]),i.useEffect(function(){Oi.current=Ci},[Ci]),i.useEffect(function(){ji.current=Ii},[Ii]);var Ht=i.useCallback(function(){var e,n=An.sectionIdx,i=An.isOrphan;if(Fn(),null!=n){var t="left";An.anchorEl&&(null===(e=gn.current)||void 0===e?void 0:e.contains(An.anchorEl))&&(t="right"),Ui(n),qi(n,i,{sourceSide:t})}},[qi,An.isOrphan,An.sectionIdx,An.anchorEl,Fn]),Vt=i.useCallback(function(){Fn(),Li(),ze(new Set),Ke([]),rn.current=[]},[Fn,Li]),zt=null!==An.sectionIdx&&Ve.has(An.sectionIdx),Gt=S.useDeviationNavigation({proposedSections:ei,existingSections:ni,parentDeviationRecord:ti,expandedSections:Hi,maintainRelativeOrder:!!De,scrollContainerRef:vn,leftContainerRef:xn,rightContainerRef:gn,lhsBadgeRefs:vi,rhsBadgeRefs:pi}),Wt=Gt.showDeviationNavigation,Kt=Gt.showOpenNodeRef,Ut=Gt.adjustScrollForPopup,Yt=i.useCallback(function(e,n,i,t,o){var r,l="string"==typeof t?s.safeStringify(t).trim():s.safeStringify(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;Ln();var a="left";(null===(r=gn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=n.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=pi.current[l])||void 0===e?void 0:e.current:null===(i=vi.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=pi.current[n])||void 0===t?void 0:t.current:null===(o=vi.current[n])||void 0===o?void 0:o.current};if(i)return Li(),ze(new Set),Ke([]),rn.current=[],void(l&&(Ui(n),requestAnimationFrame(function(){var e=c()||u;On({open:!0,anchorEl:e,summary:t,displayImpact:o})})));Ui(n),l?requestAnimationFrame(function(){qi(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=c()||u;On({open:!0,anchorEl:e,summary:t,displayImpact:o})}})}):requestAnimationFrame(function(){qi(n,i,{toggleIfSame:!1,sourceSide:a})})},[qi,Ln,On,Li,Ui]),Xt=i.useMemo(function(){var e;if(!be)return null;var n=null===(e=null==be?void 0:be.id)||void 0===e?void 0:e.split(":")[0];for(var i in ti){if((ti[i]||[]).some(function(e){return e.id===n}))return i}return null},[be,ti]),Jt=i.useRef({id:null,triggerMs:null}),$t=i.useRef(null);i.useEffect(function(){var n;if(null==be?void 0:be.id){var i=Number(be.trigger),t=Jt.current;if((null==t?void 0:t.triggerMs)!==i){if(!(be.id.includes(":")&&/:\d+$/.test(be.id)))return Jt.current={id:be.id,triggerMs:i},void Rt(be.id);var o=null===(n=null==be?void 0:be.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],u=null!=l?l:"0";$t.current!==be.id&&(Fn(),Ln(),Li(),ze(new Set),Ke([]),rn.current=[],$t.current=be.id);var a=!1,c=0,d=null,f=150,v=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},p=function(){var n,t,o,l;if(!a){var g=function(){Jt.current={id:be.id,triggerMs:i}},h=null,m=null;for(var S in ti){var R=ti[S].find(function(e){return e.id===r});if(R){h=S,m=R;break}}if(m&&h){var x=ei.findIndex(function(e){return e.id===h}),_=ni.findIndex(function(e){return e.id===h}),y=-1===x&&-1!==_,C=v(ei,m.id),b=v(ni,m.id);if(C&&!b&&!y){var E=C.split("-"),A=Number(E[0]);if(De){var B=null===(t=null===(n=ei[A])||void 0===n?void 0:n.refIndexes)||void 0===t?void 0:t[0],T=ni.findIndex(function(e){return e.selfIndex===B});-1!==T&&(A=T)}b=e.__spreadArray([A],E.slice(1),!0).join("-")}if(C||b){var I=C?Number(C.split("-")[0]):x,w=b?Number(b.split("-")[0]):_,D=ei[I],O=ni[w],F=D&&!D.title&&!D.content,j=O&&!O.title&&!O.content,P=y||(!C&&!!b||F&&!j);if(P){if(!(De?!!Hi["right-".concat(w)]:!!Hi[String(w)])&&w>=0)return Ki(w,"right"),c+=1,void(d=setTimeout(p,450))}else if(!(De?!!Hi["left-".concat(I)]:!!Hi[String(I)])&&I>=0)return Ki(I,"left"),c+=1,void(d=setTimeout(p,450));var N,k=C||"",L=b||"",q="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u).concat(s.DEVIATION_BADGE_SEPARATOR).concat(k).concat(s.DEVIATION_BADGE_SEPARATOR).concat(L),M="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u),H=null===(o=vi.current[M])||void 0===o?void 0:o.current,V=null===(l=pi.current[M])||void 0===l?void 0:l.current,z=P||!H&&!!V,G=z?V:H;if(N=De?z?gn.current:xn.current:vn.current,G&&N){var W=G.getBoundingClientRect();if(0===W.height)return void((c+=1)<2?d=setTimeout(p,f):g());var K=N.getBoundingClientRect(),U=W.top-K.top+N.scrollTop-K.height/2+W.height/2,Y=C&&C.includes("-")||b&&b.includes("-"),X=function(){var n,i,t,o,r;if(!a){g();var l=G instanceof Element?window.getComputedStyle(G).color:"";H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),V&&(V.style.transition="box-shadow 300ms ease-in-out",V.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),V&&(V.style.boxShadow="")},2e3);var s=(null===(i=null===(n=m.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===i?void 0:i[u])||m,c=(null===(t=m.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||m.evaluation_outputs;if(!(!!H&&!!V)){var d=z?(null===(o=pi.current[Y?M:w])||void 0===o?void 0:o.current)||V:(null===(r=vi.current[Y?M:I])||void 0===r?void 0:r.current)||H;return Ut(d,function(){On({open:!0,anchorEl:d,displayImpact:be.displayImpact,summary:e.__assign(e.__assign({},s),{evaluation_outputs:c})})},{skipScroll:!0}),void(null==Ee||Ee())}qi(q,!1,{toggleIfSame:!1,sourceSide:y?"right":"left",onReady:function(){var n,i;g();var t=z?(null===(n=pi.current[M])||void 0===n?void 0:n.current)||V:(null===(i=vi.current[M])||void 0===i?void 0:i.current)||H;On({open:!0,anchorEl:t,displayImpact:be.displayImpact,summary:e.__assign({},s)}),null==Ee||Ee()}})}};Math.abs(N.scrollTop-U)<=2?X():(_n.current=U,yn.current=X,N.scrollTo({top:U,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(yn.current){_n.current=null;var e=yn.current;yn.current=null,e()}},800))}else(c+=1)<2?d=setTimeout(p,f):g()}else(c+=1)<2?d=setTimeout(p,f):g()}else(c+=1)<2?d=setTimeout(p,f):g()}};return d=setTimeout(p,f),function(){a=!0,d&&clearTimeout(d)}}}},[be,ti,ei,ni,De,Hi,Ki,qi,On,Rt]),i.useEffect(function(){var n,i,t;if(Dn.open){var o=Dn.anchorEl;if(o&&!o.isConnected){var r=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||Object.keys(vi.current).find(function(e){var n,i;return(null===(i=null===(n=vi.current[e])||void 0===n?void 0:n.current)||void 0===i?void 0:i.textContent)===o.textContent})||Object.keys(pi.current).find(function(e){var n,i;return(null===(i=null===(n=pi.current[e])||void 0===n?void 0:n.current)||void 0===i?void 0:i.textContent)===o.textContent});if(r){var l=(null===(i=pi.current[r])||void 0===i?void 0:i.current)||(null===(t=vi.current[r])||void 0===t?void 0:t.current);l&&l.isConnected&&On(function(n){return e.__assign(e.__assign({},n),{anchorEl:l})})}}}},[Dn.open,Dn.anchorEl,Ye,Ve,Hi]);var Qt=bn.open,Zt=bn.sectionIdx,eo=bn.isOrphan,no=bn.badgeStyle,io=bn.anchorEl,to=bn.sectionAnchorEl;i.useEffect(function(){var n;if(Qt&&null!=Zt&&Zt!==et){var i="string"==typeof Zt?Zt.split(s.DEVIATION_BADGE_SEPARATOR)[0]:null,t=i&&"string"==typeof i&&ei.find(function(e){return e.id===i})||null,o=i&&"string"==typeof i&&ni.find(function(e){return e.id===i})||null,r="number"==typeof Zt?ei[Zt]||null:t||i&&((null===(n=null==ve?void 0:ve.nodes)||void 0===n?void 0:n[i])||(null==ve?void 0:ve[i]))||null,l="number"==typeof Zt?ni[Zt]||null:o,u=gt(io,r,l,Zt,eo,no);En(function(n){return n.open?n.cognitiveData===u.cognitiveData&&n.deviationData===u.deviationData&&n.sectionTitle===u.sectionTitle&&n.refSectionTitle===u.refSectionTitle?n:e.__assign(e.__assign(e.__assign({},n),u),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Qt,Zt,eo,no,io,to,ei,ni,ve,Ce,gt]);var oo=i.useCallback(function(e){var i=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,s=void 0===l?"left":l,u=e.parentNodeId,a=void 0===u?"":u,c=e.sectionOffset;return n.jsx(x.default,{section:i,keyPath:t,depth:r,columnKey:s,parentNodeId:a,sectionOffset:c})},[]),ro=i.useMemo(function(){return ei.map(function(e,i){var t;return n.jsx(_.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(i))})},[ei]),lo=i.useMemo(function(){return ni.map(function(e,i){var t;return n.jsx(y.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(i))})},[ni]),so=i.useRef(ht);i.useEffect(function(){so.current=ht},[ht]);var uo=i.useRef(Yt);i.useEffect(function(){uo.current=Yt},[Yt]);var ao=i.useRef(Vt);i.useEffect(function(){ao.current=Vt},[Vt]);var co=i.useRef(Ki);i.useEffect(function(){co.current=Ki},[Ki]);var fo=i.useRef(Wi);i.useEffect(function(){fo.current=Wi},[Wi]);var vo=i.useRef(oo);i.useEffect(function(){vo.current=oo},[oo]);var po=i.useRef(Li);i.useEffect(function(){po.current=Li},[Li]);var go=i.useMemo(function(){return{maintainRelativeOrder:!!De,showDeviationBadges:Fe,isProposingFix:Be,proposingFixNodeId:Te,isRedlineFlow:Ie,isSideBySide:Ci,activeSideBySideSection:Ii,scrollSyncLocked:Ye,toggleScrollSyncLocked:Xi,summaryPopupAnchorEl:Dn.anchorEl,connectedSections:Ve,proposedSections:ei,existingSections:ni,deviationNumberRegistry:oi,treeData:ve,displayConfig:xe,resolvedMarkdownStyles:fn,unifiedNumbering:Ji,expandedSections:Hi,expandedSubSections:zi,setExpandedSubSections:Gi,getSectionCompareStyle:bt,getSubSectionCompareStyle:Et,getBadgeRef:_i,getSectionRowRef:Ri,getSubSectionRef:xi,sectionLeftRefs:di,sectionRightRefs:fi,sectionRowRefs:Si,sectionRightRowRefs:gi,subSectionLeftRefs:hi,subSectionRightRefs:mi,lhsBadgeRefs:vi,rhsBadgeRefs:pi,openMoreFunctionsPopup:lt,handleOpenSummaryPopup:st,openSummaryPopup:st,handleCloseSummaryPopup:ut,toggleSection:at,handleSubSectionToggle:ct,renderSubSectionAccordion:dt,resetSideBySide:ft,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:rn,showDeviationNavigation:Wt,showOpenNodeRef:Kt,deviationNodeIdToView:null==be?void 0:be.id,deviationTargetParentId:Xt}},[De,Fe,Be,Te,Ie,Ci,Ii,Ye,Xi,Dn.anchorEl,Ve,ei,ni,oi,ve,xe,fn,Ji,Hi,zi,Gi,bt,Et,_i,Ri,xi,Wt,Kt,be,Xt]);return n.jsx(b.CompareContextProvider,e.__assign({value:go},{children:n.jsxs(t.Box,e.__assign({ref:pn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},De?{}:{overflow:"visible"}),{position:"relative"})},{children:[Pe&&n.jsx(t.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(f.default,{})})),Dn.open&&n.jsx(C.default,{open:Dn.open,anchorEl:Dn.anchorEl,containerEl:_t.current,clipTopEl:Qe.current,scrollContainerEl:vn.current,onClose:Vt,summary:Dn.summary,displayImpact:Dn.displayImpact,isScrollLocked:Ye}),n.jsx(d.default,{open:An.open,anchorEl:An.anchorEl,sectionTitle:An.sectionTitle,referenceSectionTitle:An.refSectionTitle,onClose:qn,onOpenCognitiveCompare:Nn,onOpenSideBySide:Ht,onConnect:mt,isConnected:zt,isOrphan:An.isOrphan}),bn.open&&n.jsx(c.default,{open:bn.open,popupRef:Pn,position:Tn,popupConfig:_e,onClose:function(){In(null),En(function(n){return e.__assign(e.__assign({},n),{open:!1})}),jn(null)},markdownStyles:me,sectionTitle:Un,referenceSectionTitle:Xn,cognitiveData:bn.cognitiveData,anchorEl:bn.anchorEl,sectionAnchorEl:bn.sectionAnchorEl,scrollContainerEl:vn.current,badgeStyle:bn.badgeStyle,docData:bn.docData,deviationData:bn.deviationData,isLoading:bn.isLoading}),n.jsx(t.Snackbar,e.__assign({open:!!Le,autoHideDuration:8e3,onClose:function(){return qe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return qe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Le}))})),n.jsx(R.default,{componentHeaderText:fe,displayConfig:xe,maintainRelativeOrder:De,onCollapseAll:jt,showCollapseAll:Pt,onToggleView:function(e){Ne(!0),setTimeout(function(){Oe(!e),Xe(!1),Li(),Fn(),ze(new Set),Ke([]),rn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Ne(!1)},600)})})},50)}}),n.jsx(t.Box,e.__assign({ref:vn,onScroll:Ft,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:De?"hidden":"auto",borderTop:Qi&&Zi?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},De?{flex:1,minHeight:0}:{})},{children:n.jsxs(t.Box,e.__assign({ref:$e,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},De?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(I.default,{svgContainerRef:Je,svgDimensions:Ot,isResizing:Ai,overallConnector:wt,rootDeviationStyle:tt,lines:Tt,isSideBySide:Ci,activeSideBySideSection:Ii,isArrowVisible:bi,maintainRelativeOrder:De,proposedSections:ei,existingSections:ni,cognitivePopup:bn,activeBadgeId:wn,closeCognitivePopup:Ln,setActiveBadgeId:jn,openCognitivePopupFromState:kn,buildSectionPopupState:gt,connectedLines:We,pathRefs:on}),n.jsxs(t.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)"},De?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(t.Box,e.__assign({ref:Qe,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(t.Tooltip,e.__assign({title:Wn,placement:"top"},{children:n.jsx(t.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:Wn}))}))})),n.jsxs(t.Box,e.__assign({ref:xn,onScroll:Ft,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},De?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Sn,style:{width:"100%",height:"0px",flexShrink:0}}),li&&ro,n.jsx("div",{ref:Rn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:_t,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({onClick:function(n){n.stopPropagation(),bn.open&&wn===et?Ln():(jn(et),kn(gt(n.currentTarget,{title:"",content:"",evaluationResult:nt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,et,!0,e.__assign(e.__assign({},tt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:tt.badgeBg,color:tt.badgeText,border:"1px solid ".concat(tt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=it?it:n.jsx(v.default,{}),n.jsx(t.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:bn.open&&wn===et?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(t.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},De?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Ti&&n.jsx(l.default,{sections:11}),n.jsx(t.Box,e.__assign({ref:Ze,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(t.Tooltip,e.__assign({title:Jn,placement:"top"},{children:n.jsx(t.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:Jn}))}))})),n.jsxs(t.Box,e.__assign({ref:gn,onScroll:Ft,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},De?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}}),li&&lo,n.jsx("div",{ref:mn,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"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),s=require("./CognitiveComparehelpers.js"),u=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("./components/ThreeDotsLoader.js"),p=require("./hooks/useCompareData.js"),g=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),m=require("./hooks/useAccordionState.js"),S=require("./hooks/useDeviationNavigation.js"),R=require("./components/CompareHeader.js"),x=require("./components/SubSectionAccordion.js"),_=require("./components/LHSSectionRow.js"),y=require("./components/RHSSectionRow.js"),b=require("./components/CognitiveSummaryPopup.js"),C=require("./CompareContext.js"),E=require("./hooks/useStyles.js"),A=require("./hooks/useResizeHandler.js"),B=require("./hooks/useLinesCalculator.js"),T=require("./hooks/useSideBySide.js"),I=require("./components/SvgConnectors.js");exports.SHARED_MARKDOWN_STYLES=u.SHARED_MARKDOWN_STYLES,exports.default=function(w){var D,O,F,j,P,N,k,L,q,M,H,V,z,G,W,K,U,Y,X,J,$,Q,Z,ee,ne,ie,te,oe,re,le,se,ue,ae,ce,de,fe=w.componentHeaderText,ve=void 0===fe?a.DEFAULT_COMPONENT_HEADER_TEXT:fe,pe=w.treeData,ge=w.comparisonConfig,he=w.leftColumnTitleText,me=w.rightColumnTitleText,Se=w.markdownStyles,Re=w.resetTrigger,xe=w.displayConfig,_e=void 0===xe?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:xe,ye=w.popupConfig,be=w.deviationData,Ce=void 0===be?{}:be,Ee=w.deviationNodeIdToView,Ae=w.resetDeviationNodeId,Be=w.isProposingFix,Te=void 0!==Be&&Be,Ie=w.proposingFixNodeId,we=w.isRedlineFlow,De=i.useState(_e.maintainRelativeOrder),Oe=De[0],Fe=De[1],je=null!==(D=null==_e?void 0:_e.expandLevels)&&void 0!==D?D:0,Pe=!!(null==_e?void 0:_e.expandAllSections),Ne=!!Oe||!!(null==_e?void 0:_e.showDeviationBadges),ke=i.useState(!1),Le=ke[0],qe=ke[1],Me=i.useState(null),He=Me[0],Ve=Me[1],ze=i.useState(null===(F=null!==(O=null==pe?void 0:pe.newEvaluationResult)&&void 0!==O?O:null==_e?void 0:_e.enableDeviationSchemaBackwardCompatibility)||void 0===F||F)[0],Ge=i.useState(new Set),We=Ge[0],Ke=Ge[1],Ue=i.useState([]),Ye=Ue[0],Xe=Ue[1],Je=i.useState(!1),$e=Je[0],Qe=Je[1],Ze=i.useRef(null),en=i.useRef(null),nn=i.useRef(null),tn=i.useRef(null),on=i.useRef(null),rn=i.useRef(!1),ln=i.useRef(null),sn=i.useRef({}),un=i.useRef([]),an=i.useRef(function(){}),cn=i.useRef(null),dn=i.useRef(function(){}),fn=i.useMemo(function(){return JSON.stringify(Ce||{})},[JSON.stringify(Ce)]),vn=i.useMemo(function(){return Ce||{}},[fn]),pn=i.useMemo(function(){return(null==pe?void 0:pe.cognitive_decisioning)||{}},[pe]),gn=i.useMemo(function(){return e.__assign(e.__assign({},u.SHARED_MARKDOWN_STYLES),Se)},[Se]),hn=i.useRef(null),mn=i.useRef(null),Sn=i.useRef(null),Rn=i.useRef(null),xn=i.useRef(null),_n=i.useRef(null),yn=i.useRef(null),bn=i.useRef(null),Cn=i.useRef(null),En=i.useRef(null),An=g.useComparePopups(hn),Bn=An.cognitivePopup,Tn=An.setCognitivePopup,In=An.moreFunctions,wn=An.setMoreFunctions,Dn=An.position,On=An.setPosition,Fn=An.activeBadgeId,jn=An.summaryPopup,Pn=An.setSummaryPopup,Nn=An.closeSummaryPopup,kn=An.setActiveBadgeId,Ln=An.popupRef,qn=An.handleOpenCognitiveCompare,Mn=An.openCognitivePopupFromState,Hn=An.closeCognitivePopup,Vn=An.closeMoreFunctionsPopup,zn=i.useMemo(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==ge?void 0:ge.fields)&&void 0!==e?e:u.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(n=null==ge?void 0:ge.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:u.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==ge?void 0:ge.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:u.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==ge?void 0:ge.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:u.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[ge]),Gn=i.useState(null),Wn=Gn[0];Gn[1];var Kn=null===(N=null===(j=null==pe?void 0:pe.documents)||void 0===j?void 0:j[null===(P=null==pe?void 0:pe.input_index_map)||void 0===P?void 0:P[0]])||void 0===N?void 0:N.title,Un=null===(q=null===(k=null==pe?void 0:pe.documents)||void 0===k?void 0:k[null===(L=null==pe?void 0:pe.input_index_map)||void 0===L?void 0:L[1]])||void 0===q?void 0:q.title,Yn=s.safeStringify(he||Kn||"Uploaded Contract"),Xn=null===(z=null===(V=null===(M=null==pe?void 0:pe.documents)||void 0===M?void 0:M[null===(H=null==pe?void 0:pe.input_index_map)||void 0===H?void 0:H[0]])||void 0===V?void 0:V.metadata)||void 0===z?void 0:z.file_name,Jn=s.safeStringify(Xn),$n=null===(U=null===(K=null===(G=null==pe?void 0:pe.documents)||void 0===G?void 0:G[null===(W=null==pe?void 0:pe.input_index_map)||void 0===W?void 0:W[1]])||void 0===K?void 0:K.metadata)||void 0===U?void 0:U.file_name,Qn=s.safeStringify($n),Zn=s.safeStringify(me||Un||"Reference Template"),ei=p.useCognitiveTreeData(pe,Oe,vn,zn,ze),ni=ei.activeProposed,ii=ei.existingRule,ti=ei.proposedSections,oi=ei.existingSections,ri=ei.visibleFields,li=ei.parentDeviationRecord,si=ei.deviationNumberRegistry,ui=ei.parseError;i.useEffect(function(){ui&&Ve("Failed to load comparison: ".concat(ui))},[ui]);var ai=ti.length>0||oi.length>0,ci=i.useMemo(function(){if(!we)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";s.hasMeaningfulRedlineTags(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(ti),i(oi),"".concat(e,":").concat(n)},[we,ti,oi]);i.useEffect(function(){if(ti.length||oi.length)if(Pe){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=Oe?"".concat(t,"-").concat(o):String(o);e[l]=!0;var s=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&s(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&s(i.subsections,String(o))})};i(ti,"left"),i(oi,"right"),Wi(e),Ui(n)}else if(je>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var s=Oe?"".concat(n,"-").concat(r):String(r);t[s]=!0}var u=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&u(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&u(e.subsections,String(r),2)})};r(ti,"left",je),r(oi,"right",je),Wi(t),Ui(o)}},[Pe,je,ti,oi,Oe]);var di=h.useSectionRefs(ri.map(function(e){return e.key}),Math.max(ti.length,oi.length)),fi=di.leftRefs,vi=di.rightRefs,pi=di.sectionLeftRefs,gi=di.sectionRightRefs,hi=di.lhsBadgeRefs,mi=di.rhsBadgeRefs,Si=di.sectionRightRowRefs,Ri=di.subSectionLeftRefs,xi=di.subSectionRightRefs,_i=di.sectionRowRefs,yi=di.getSectionRowRef,bi=di.getSubSectionRef,Ci=di.getBadgeRef,Ei=T.useSideBySide({maintainRelativeOrder:Oe,proposedSections:ti,existingSections:oi,leftContainerRef:bn,rightContainerRef:Sn,scrollContainerRef:hn,sectionLeftRefs:pi,sectionRightRefs:gi,subSectionLeftRefs:Ri,subSectionRightRefs:xi,lhsBadgeRefs:hi,rhsBadgeRefs:mi,sectionRowRefs:_i,sectionRightRowRefs:Si,rhsTopSpacerRef:Rn,rhsBottomSpacerRef:xn,lhsTopSpacerRef:_n,lhsBottomSpacerRef:yn,calculateLinesRef:an,setConnectedSections:Ke,setConnectedLines:Xe,cachedConnectedPositions:un,closeMoreFunctionsPopup:Vn,setErrorToast:Ve,moreFunctions:In,closeSummaryPopup:Nn}),Ai=Ei.isSideBySide,Bi=Ei.isArrowVisible,Ti=Ei.setIsArrowVisible,Ii=Ei.isResizing,wi=Ei.setIsResizing,Di=Ei.isSideBySideLoading,Oi=Ei.activeSideBySideSection,Fi=Ei.scrollLock,ji=Ei.sideBySideCacheRef,Pi=Ei.isSideBySideRef,Ni=Ei.activeSideBySideRightSectionRef,ki=Ei.activeSideBySideSectionRef,Li=Ei.sideBySideLineRef,qi=Ei.highlightedClauseRefs,Mi=Ei.clearClauseHighlight,Hi=Ei.resetSideBySide,Vi=Ei.activateSideBySide,zi=m.useAccordionState({maintainRelativeOrder:!!Oe,proposedSections:ti,existingSections:oi,activeSideBySideSection:Oi,connectedSections:We,resetSideBySide:Hi,setConnectedSections:Ke,setConnectedLines:Xe,cachedConnectedPositions:un,svgContainerRef:Ze,isAnimatingRef:rn,animationTimerRef:ln,calculateLinesRef:an,sectionLeftRefs:pi,sectionRightRefs:gi,subSectionLeftRefs:Ri,subSectionRightRefs:xi}),Gi=zi.expandedSections,Wi=zi.setExpandedSections,Ki=zi.expandedSubSections,Ui=zi.setExpandedSubSections,Yi=zi.handleSubSectionToggle,Xi=zi.toggleSection,Ji=zi.forceExpandCrossWiredSections,$i=function(){var e,n;if(null!=Oi){var i=null===(e=pi.current[Oi])||void 0===e?void 0:e.current,t=null===(n=gi.current[Oi])||void 0===n?void 0:n.current,o=Sn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),s=o.getBoundingClientRect(),u=r.top-s.top,a=l.top-s.top-u;o.scrollBy({top:a,behavior:"smooth"})}}},Qi=i.useCallback(function(e){null==e||e.stopPropagation(),Qe(function(e){var n=!e;return n&&requestAnimationFrame(function(){$i()}),n})},[$i]);i.useEffect(function(){we&&"off"!==ci&&"0:0"!==ci&&(ji.current=null,un.current=[],requestAnimationFrame(function(){var e;null===(e=an.current)||void 0===e||e.call(an)}))},[we,ci]);var Zi=i.useMemo(function(){var e=new Map,n=new Map,i=1;if(Oe)ti.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),oi.forEach(function(t){if(t.id){var o=ti.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(ti.length,oi.length),o=0;o<t;o++){var r=ti[o],l=oi[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[ti,oi,Oe]),et=ii.analysis,nt=s.safeStringify(null===(X=null===(Y=null==et?void 0:et.rule_difference_comparison)||void 0===Y?void 0:Y.summary)||void 0===X?void 0:X.overall_summary),it=!!nt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),tt=null!==(J=null==pe?void 0:pe.base_root_id)&&void 0!==J?J:"-1";null==pe||pe[tt];var ot=ze?null!==(ue=null!==(re=Ce&&(null===(oe=null==Ce?void 0:Ce[tt])||void 0===oe?void 0:oe.evaluation_result))&&void 0!==re?re:null===(se=null===(le=null==pe?void 0:pe.nodes)||void 0===le?void 0:le[tt])||void 0===se?void 0:se.evaluation_result)&&void 0!==ue?ue:null:null!==(te=null!==(Z=Ce&&(null===(Q=null===($=null==Ce?void 0:Ce[tt])||void 0===$?void 0:$.evaluation_result)||void 0===Q?void 0:Q[0]))&&void 0!==Z?Z:null===(ie=null===(ne=null===(ee=null==pe?void 0:pe.nodes)||void 0===ee?void 0:ee[tt])||void 0===ne?void 0:ne.evaluation_result)||void 0===ie?void 0:ie[0])&&void 0!==te?te:null,rt=s.extractDeviationScore(ot),lt=s.generateColorPalette(null!==(de=null===(ce=null===(ae=null==ot?void 0:ot.evaluation_outputs)||void 0===ae?void 0:ae.metadata)||void 0===ce?void 0:ce.label_color)&&void 0!==de?de:a.DEFAULT_DEVIAION_COLOR),st=i.useRef(Hi);i.useEffect(function(){st.current=Hi},[Hi]);var ut=i.useRef(Hn);i.useEffect(function(){ut.current=Hn},[Hn]);var at=i.useCallback(function(e,n,i,t,o,r){return co.current(e,n,i,t,o,r)},[]),ct=i.useCallback(function(e,n,i,t,o){return fo.current(e,n,i,t,o)},[]),dt=i.useCallback(function(){return vo.current()},[]),ft=i.useCallback(function(e,n){return po.current(e,n)},[]),vt=i.useCallback(function(e){return go.current(e)},[]),pt=i.useCallback(function(e){return ho.current(e)},[]),gt=i.useCallback(function(){return mo.current()},[]),ht=i.useCallback(function(){var e,n;Mi(),null===(e=st.current)||void 0===e||e.call(st),Qe(!1),Ke(new Set),Xe([]),un.current=[],Ot([]),jt(null),Pn(a.EMPTY_SUMMARY_POPUP_STATE),null===(n=ut.current)||void 0===n||n.call(ut),requestAnimationFrame(function(){var e;null===(e=an.current)||void 0===e||e.call(an)})},[]),mt=i.useRef(ht);i.useEffect(function(){mt.current=ht},[ht]),i.useEffect(function(){Re&&mt.current()},[Re]);var St=i.useCallback(function(n,i,t,o,r,l,u){var a,c,d,f=s.safeStringify(null==i?void 0:i.id)||s.safeStringify(null==t?void 0:t.id)||"",v=(f?pn[f]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:f,decisioning:[],gap:[],relevance_score:0},p=null!==(c=null===(a=_i.current[o])||void 0===a?void 0:a.current)&&void 0!==c?c:null;return{isLoading:null!==(d=null==_e?void 0:_e.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:v,anchorEl:n,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==pe?void 0:pe.documents,input_index_map:null==pe?void 0:pe.input_index_map},deviationData:function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[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 i?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)))return u(l);var a=o.split(s.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},d=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},c),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[pn,pe]),Rt=i.useCallback(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),In.open&&In.sectionIdx===o)Vn();else{var u=e.currentTarget,a="left";(null===(l=Sn.current)||void 0===l?void 0:l.contains(u))&&(a="right");Mi(),Pi.current&&Hi(),Ke(new Set),Xe([]),un.current=[],Hn(),jn.open?Wt():Nn(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=o.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=mi.current[l])||void 0===e?void 0:e.current:null===(n=hi.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=mi.current[o])||void 0===i?void 0:i.current:null===(t=hi.current[o])||void 0===t?void 0:t.current}()||u;wn(St(e,n,t,o,i,r))})}},[In.open,In.sectionIdx,Vn,Nn,St]),xt=i.useCallback(function(){var e=In.sectionIdx,n=In.isOrphan;Vn(),Nn(),null!==e&&(n?Ve("No counterpart exists to connect to."):(Ji(e),Mi(),Pi.current&&Hi(),Xe([]),un.current=[],Ke(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){an.current&&an.current()},50)))},[In.sectionIdx,In.isOrphan,Vn,Nn,Hi]),_t=i.useCallback(function(){var e=on.current;if(e){on.current=null;var n=ti.findIndex(function(n){return n.id===e}),i=oi.findIndex(function(n){return n.id===e}),t=-1===n?s.findKeyPathByNodeId(ti,e):null,o=-1===i?s.findKeyPathByNodeId(oi,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,s;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(s=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==s?s:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(qi.current.add(r),s.scrollAndHighlightClause(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Oe)-1!==r&&bn.current&&a(function(){return u(n,t,pi,Ri)},bn.current),-1!==l&&Sn.current&&a(function(){return u(i,o,gi,xi)},Sn.current);else{var c=hn.current;if(!c)return;a(function(){return-1!==r?u(n,t,pi,Ri):u(i,o,gi,xi)},c)}}},[ti,oi,Oe,pi,gi,Ri,xi,bn,Sn,hn]),yt=i.useCallback(function(n){if(n){Mi(),Hi(),Ke(new Set),Xe([]),un.current=[],Nn(),Hn();var i=ti.findIndex(function(e){return e.id===n}),t=oi.findIndex(function(e){return e.id===n}),o=-1===i?s.findKeyPathByNodeId(ti,n):null,r=-1===t?s.findKeyPathByNodeId(oi,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;on.current=n,Wi(function(n){var i,t=e.__assign({},n),o=!1;-1!==l&&(t[i=Oe?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=Oe?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Ui(function(n){var i=e.__assign({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){on.current===n&&bt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[ti,oi,Oe,Wi,Ui,Hi,Nn,Hn]),bt=i.useRef(_t);i.useEffect(function(){bt.current=_t},[_t]);var Ct=i.useRef(null);i.useEffect(function(){if(Wn){var e=zn.fields.find(function(e){return e.analysisKey===Wn||e.key===Wn});if(e){var n=fi.current[e.key]||vi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Wn,zn.fields]);var Et=i.useCallback(function(e){var n,i,t,o,r,l,s,u,a,c=null===(n=null==et?void 0:et.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!c||!c[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=c[e],f=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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 v=d.mappings[0]||{};return{score:d.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=v.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(u=d.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[et]),At=E.useStyleHelpers({proposedSections:ti,existingSections:oi,maintainRelativeOrder:Oe,cognitiveMap:pn,deviationData:Ce,treeData:pe,resolvedComparisonConfig:zn}),Bt=At.getSectionCompareStyle,Tt=At.getSubSectionCompareStyle,It=At.getDeviationStyleByKey,wt=B.useLinesCalculator({containerRef:en,leftContainerRef:bn,rightContainerRef:Sn,svgContainerRef:Ze,pathRefs:sn,leftHeaderRef:nn,rightHeaderRef:tn,proposedSections:ti,existingSections:oi,visibleFields:ri,leftRefs:fi,rightRefs:vi,sectionLeftRefs:pi,sectionRightRefs:gi,subSectionLeftRefs:Ri,subSectionRightRefs:xi,lhsBadgeRefs:hi,rhsBadgeRefs:mi,sectionRowRefs:_i,expandedSections:Gi,expandedSubSections:Ki,connectedSections:We,isSideBySide:Ai,activeSideBySideSection:Oi,maintainRelativeOrder:Oe,cognitiveMap:pn,getSectionCompareStyle:Bt,getSubSectionCompareStyle:Tt,getDeviationStyleByKey:It,isArrowVisible:Bi,isAnimatingRef:rn,isSideBySideRef:Pi,sideBySideCacheRef:ji,sideBySideLineRef:Li,activeSideBySideSectionRef:ki,activeSideBySideRightSectionRef:Ni,connectedLines:Ye,setConnectedLines:Xe,cachedConnectedPositions:un,calculateLinesRef:an,resizeTimerRef:cn,scrollLock:Fi,scrollSyncLocked:$e,handleResizeRef:dn,activeProposed:ni,existingRule:ii,analysisData:et,pendingScrollTargetRef:Cn,pendingScrollCallbackRef:En,resolvedComparisonConfig:zn,getFieldData:Et}),Dt=wt.lines,Ot=wt.setLines,Ft=wt.overallConnector,jt=wt.setOverallConnector,Pt=wt.svgDimensions,Nt=wt.handleColumnScroll;i.useEffect(function(){jn.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=an.current)||void 0===e||e.call(an)})})},[jn.anchorEl,$e]);var kt=i.useCallback(function(){Mi(),Qe(!1),Wi({}),Ui({}),Hi(),Ke(new Set),Xe([]),un.current=[],Nn(),Hn(),Vn(),requestAnimationFrame(function(){an.current&&an.current()})},[Wi,Ui,Hi,Nn,Hn,Vn]);i.useEffect(function(){Ai||0!==We.size||Qe(!1)},[Ai,We]);var Lt=i.useMemo(function(){return Object.values(Gi).some(Boolean)||Object.values(Ki).some(Boolean)},[Gi,Ki]),qt=i.useRef(null),Mt=i.useRef(0),Ht=i.useRef(0),Vt=i.useRef(0),zt=A.useResizeHandler({timerRef:qt,ruleComponentRef:mn,scrollContainerRef:hn,containerRef:en,maintainRelativeOrder:Oe,proposedSections:ti,existingSections:oi,isSideBySideRef:Pi,activeSideBySideSectionRef:ki,activeSideBySideRightSectionRef:Ni,sectionRowRefs:_i,sectionRightRowRefs:Si,sectionLeftRefs:pi,sectionRightRefs:gi,subSectionLeftRefs:Ri,subSectionRightRefs:xi,lhsBadgeRefs:hi,rhsBadgeRefs:mi,leftContainerRef:bn,rightContainerRef:Sn,calculateLinesRef:an,handleResizeRef:dn,setIsResizing:wi,setIsArrowVisible:Ti,sideBySideCacheRef:ji,cachedConnectedPositions:un}).handleResize;i.useEffect(function(){dn.current=zt},[zt,dn]),i.useEffect(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,s;i.current=null;var u=e[e.length-1];if(u){var a=null!==(s=null===(l=null===(r=u.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==s?s:u.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return mn.current&&o.push(e(mn.current,Mt,n,function(){return dn.current()},function(){})),hn.current&&o.push(e(hn.current,Ht,i,function(){return dn.current()},function(){return an.current()})),en.current&&o.push(e(en.current,Vt,t,function(){return dn.current()},function(){return an.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),i.useEffect(function(){Pi.current=Ai},[Ai]),i.useEffect(function(){ki.current=Oi},[Oi]);var Gt=i.useCallback(function(){var e,n=In.sectionIdx,i=In.isOrphan;if(Nn(),null!=n){var t="left";In.anchorEl&&(null===(e=Sn.current)||void 0===e?void 0:e.contains(In.anchorEl))&&(t="right"),Ji(n),Vi(n,i,{sourceSide:t})}},[Vi,In.isOrphan,In.sectionIdx,In.anchorEl,Nn]),Wt=i.useCallback(function(){Nn(),Hi(),Ke(new Set),Xe([]),un.current=[]},[Nn,Hi]),Kt=null!==In.sectionIdx&&We.has(In.sectionIdx),Ut=S.useDeviationNavigation({proposedSections:ti,existingSections:oi,parentDeviationRecord:li,expandedSections:Gi,maintainRelativeOrder:!!Oe,scrollContainerRef:hn,leftContainerRef:bn,rightContainerRef:Sn,lhsBadgeRefs:hi,rhsBadgeRefs:mi}),Yt=Ut.showDeviationNavigation,Xt=Ut.showOpenNodeRef,Jt=Ut.adjustScrollForPopup,$t=i.useCallback(function(e,n,i,t,o){var r,l="string"==typeof t?s.safeStringify(t).trim():s.safeStringify(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;Hn();var a="left";(null===(r=Sn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=n.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=mi.current[l])||void 0===e?void 0:e.current:null===(i=hi.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=mi.current[n])||void 0===t?void 0:t.current:null===(o=hi.current[n])||void 0===o?void 0:o.current};if(i)return Hi(),Ke(new Set),Xe([]),un.current=[],void(l&&(Ji(n),requestAnimationFrame(function(){var e=c()||u;Pn({open:!0,anchorEl:e,summary:t,displayImpact:o})})));Ji(n),l?requestAnimationFrame(function(){Vi(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=c()||u;Pn({open:!0,anchorEl:e,summary:t,displayImpact:o})}})}):requestAnimationFrame(function(){Vi(n,i,{toggleIfSame:!1,sourceSide:a})})},[Vi,Hn,Pn,Hi,Ji]),Qt=i.useMemo(function(){var e;if(!Ee)return null;var n=null===(e=null==Ee?void 0:Ee.id)||void 0===e?void 0:e.split(":")[0];for(var i in li){if((li[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ee,li]),Zt=i.useRef({id:null,triggerMs:null}),eo=i.useRef(null);i.useEffect(function(){var n;if(null==Ee?void 0:Ee.id){var i=Number(Ee.trigger),t=Zt.current;if((null==t?void 0:t.triggerMs)!==i){if(!(Ee.id.includes(":")&&/:\d+$/.test(Ee.id)))return Zt.current={id:Ee.id,triggerMs:i},void yt(Ee.id);var o=null===(n=null==Ee?void 0:Ee.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],u=null!=l?l:"0";eo.current!==Ee.id&&(Nn(),Hn(),Hi(),Ke(new Set),Xe([]),un.current=[],eo.current=Ee.id);var a=!1,c=0,d=null,f=150,v=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},p=function(){var n,t,o,l;if(!a){var g=function(){Zt.current={id:Ee.id,triggerMs:i}},h=null,m=null;for(var S in li){var R=li[S].find(function(e){return e.id===r});if(R){h=S,m=R;break}}if(m&&h){var x=ti.findIndex(function(e){return e.id===h}),_=oi.findIndex(function(e){return e.id===h}),y=-1===x&&-1!==_,b=v(ti,m.id),C=v(oi,m.id);if(b&&!C&&!y){var E=b.split("-"),A=Number(E[0]);if(Oe){var B=null===(t=null===(n=ti[A])||void 0===n?void 0:n.refIndexes)||void 0===t?void 0:t[0],T=oi.findIndex(function(e){return e.selfIndex===B});-1!==T&&(A=T)}C=e.__spreadArray([A],E.slice(1),!0).join("-")}if(b||C){var I=b?Number(b.split("-")[0]):x,w=C?Number(C.split("-")[0]):_,D=ti[I],O=oi[w],F=D&&!D.title&&!D.content,j=O&&!O.title&&!O.content,P=y||(!b&&!!C||F&&!j);if(P){if(!(Oe?!!Gi["right-".concat(w)]:!!Gi[String(w)])&&w>=0)return Xi(w,"right"),c+=1,void(d=setTimeout(p,450))}else if(!(Oe?!!Gi["left-".concat(I)]:!!Gi[String(I)])&&I>=0)return Xi(I,"left"),c+=1,void(d=setTimeout(p,450));var N,k=b||"",L=C||"",q="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u).concat(s.DEVIATION_BADGE_SEPARATOR).concat(k).concat(s.DEVIATION_BADGE_SEPARATOR).concat(L),M="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u),H=null===(o=hi.current[M])||void 0===o?void 0:o.current,V=null===(l=mi.current[M])||void 0===l?void 0:l.current,z=P||!H&&!!V,G=z?V:H;if(N=Oe?z?Sn.current:bn.current:hn.current,G&&N){var W=G.getBoundingClientRect();if(0===W.height)return void((c+=1)<2?d=setTimeout(p,f):g());var K=N.getBoundingClientRect(),U=W.top-K.top+N.scrollTop-K.height/2+W.height/2,Y=b&&b.includes("-")||C&&C.includes("-"),X=function(){var n,i,t,o,r;if(!a){g();var l=G instanceof Element?window.getComputedStyle(G).color:"";H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),V&&(V.style.transition="box-shadow 300ms ease-in-out",V.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),V&&(V.style.boxShadow="")},2e3);var s=(null===(i=null===(n=m.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===i?void 0:i[u])||m,c=(null===(t=m.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||m.evaluation_outputs;if(!(!!H&&!!V)){var d=z?(null===(o=mi.current[Y?M:w])||void 0===o?void 0:o.current)||V:(null===(r=hi.current[Y?M:I])||void 0===r?void 0:r.current)||H;return Jt(d,function(){Pn({open:!0,anchorEl:d,displayImpact:Ee.displayImpact,summary:e.__assign(e.__assign({},s),{evaluation_outputs:c})})},{skipScroll:!0}),void(null==Ae||Ae())}Vi(q,!1,{toggleIfSame:!1,sourceSide:y?"right":"left",onReady:function(){var n,i;g();var t=z?(null===(n=mi.current[M])||void 0===n?void 0:n.current)||V:(null===(i=hi.current[M])||void 0===i?void 0:i.current)||H;Pn({open:!0,anchorEl:t,displayImpact:Ee.displayImpact,summary:e.__assign({},s)}),null==Ae||Ae()}})}};Math.abs(N.scrollTop-U)<=2?X():(Cn.current=U,En.current=X,N.scrollTo({top:U,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(En.current){Cn.current=null;var e=En.current;En.current=null,e()}},800))}else(c+=1)<2?d=setTimeout(p,f):g()}else(c+=1)<2?d=setTimeout(p,f):g()}else(c+=1)<2?d=setTimeout(p,f):g()}};return d=setTimeout(p,f),function(){a=!0,d&&clearTimeout(d)}}}},[Ee,li,ti,oi,Oe,Gi,Xi,Vi,Pn,yt]),i.useEffect(function(){var n,i,t;if(jn.open){var o=jn.anchorEl;if(o&&!o.isConnected){var r=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||Object.keys(hi.current).find(function(e){var n,i;return(null===(i=null===(n=hi.current[e])||void 0===n?void 0:n.current)||void 0===i?void 0:i.textContent)===o.textContent})||Object.keys(mi.current).find(function(e){var n,i;return(null===(i=null===(n=mi.current[e])||void 0===n?void 0:n.current)||void 0===i?void 0:i.textContent)===o.textContent});if(r){var l=(null===(i=mi.current[r])||void 0===i?void 0:i.current)||(null===(t=hi.current[r])||void 0===t?void 0:t.current);l&&l.isConnected&&Pn(function(n){return e.__assign(e.__assign({},n),{anchorEl:l})})}}}},[jn.open,jn.anchorEl,$e,We,Gi]);var no=Bn.open,io=Bn.sectionIdx,to=Bn.isOrphan,oo=Bn.badgeStyle,ro=Bn.anchorEl,lo=Bn.sectionAnchorEl;i.useEffect(function(){var n;if(no&&null!=io&&io!==tt){var i="string"==typeof io?io.split(s.DEVIATION_BADGE_SEPARATOR)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var s=t(l.subsections,n);if(s)return s}}return null},o=i&&"string"==typeof i?t(ti,i):null,r=i&&"string"==typeof i?t(oi,i):null,l="number"==typeof io?ti[io]||null:o||i&&((null===(n=null==pe?void 0:pe.nodes)||void 0===n?void 0:n[i])||(null==pe?void 0:pe[i]))||null,u="number"==typeof io?oi[io]||null:r,a=St(ro,l,u,io,to,oo);Tn(function(n){return n.open?n.cognitiveData===a.cognitiveData&&n.deviationData===a.deviationData&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e.__assign(e.__assign(e.__assign({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[no,io,to,oo,ro,lo,ti,oi,pe,Ce,St]);var so=i.useCallback(function(e){var i=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,s=void 0===l?"left":l,u=e.parentNodeId,a=void 0===u?"":u,c=e.sectionOffset;return n.jsx(x.default,{section:i,keyPath:t,depth:r,columnKey:s,parentNodeId:a,sectionOffset:c})},[]),uo=i.useMemo(function(){return ti.map(function(e,i){var t;return n.jsx(_.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(i))})},[ti]),ao=i.useMemo(function(){return oi.map(function(e,i){var t;return n.jsx(y.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(i))})},[oi]),co=i.useRef(Rt);i.useEffect(function(){co.current=Rt},[Rt]);var fo=i.useRef($t);i.useEffect(function(){fo.current=$t},[$t]);var vo=i.useRef(Wt);i.useEffect(function(){vo.current=Wt},[Wt]);var po=i.useRef(Xi);i.useEffect(function(){po.current=Xi},[Xi]);var go=i.useRef(Yi);i.useEffect(function(){go.current=Yi},[Yi]);var ho=i.useRef(so);i.useEffect(function(){ho.current=so},[so]);var mo=i.useRef(Hi);i.useEffect(function(){mo.current=Hi},[Hi]);var So=i.useMemo(function(){return{maintainRelativeOrder:!!Oe,showDeviationBadges:Ne,isProposingFix:Te,proposingFixNodeId:Ie,isRedlineFlow:we,isSideBySide:Ai,activeSideBySideSection:Oi,scrollSyncLocked:$e,toggleScrollSyncLocked:Qi,summaryPopupAnchorEl:jn.anchorEl,connectedSections:We,proposedSections:ti,existingSections:oi,deviationNumberRegistry:si,treeData:pe,displayConfig:_e,resolvedMarkdownStyles:gn,unifiedNumbering:Zi,expandedSections:Gi,expandedSubSections:Ki,setExpandedSubSections:Ui,getSectionCompareStyle:Bt,getSubSectionCompareStyle:Tt,getBadgeRef:Ci,getSectionRowRef:yi,getSubSectionRef:bi,sectionLeftRefs:pi,sectionRightRefs:gi,sectionRowRefs:_i,sectionRightRowRefs:Si,subSectionLeftRefs:Ri,subSectionRightRefs:xi,lhsBadgeRefs:hi,rhsBadgeRefs:mi,openMoreFunctionsPopup:at,handleOpenSummaryPopup:ct,openSummaryPopup:ct,handleCloseSummaryPopup:dt,toggleSection:ft,handleSubSectionToggle:vt,renderSubSectionAccordion:pt,resetSideBySide:gt,setConnectedSections:Ke,setConnectedLines:Xe,cachedConnectedPositions:un,showDeviationNavigation:Yt,showOpenNodeRef:Xt,deviationNodeIdToView:null==Ee?void 0:Ee.id,deviationTargetParentId:Qt}},[Oe,Ne,Te,Ie,we,Ai,Oi,$e,Qi,jn.anchorEl,We,ti,oi,si,pe,_e,gn,Zi,Gi,Ki,Ui,Bt,Tt,Ci,yi,bi,Yt,Xt,Ee,Qt]);return n.jsx(C.CompareContextProvider,e.__assign({value:So},{children:n.jsxs(t.Box,e.__assign({ref:mn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Oe?{}:{overflow:"visible"}),{position:"relative"})},{children:[Le&&n.jsx(t.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(f.default,{})})),jn.open&&n.jsx(b.default,{open:jn.open,anchorEl:jn.anchorEl,containerEl:Ct.current,clipTopEl:nn.current,scrollContainerEl:hn.current,onClose:Wt,summary:jn.summary,displayImpact:jn.displayImpact,isScrollLocked:$e}),n.jsx(d.default,{open:In.open,anchorEl:In.anchorEl,maintainRelativeOrder:!!Oe,sectionTitle:In.sectionTitle,referenceSectionTitle:In.refSectionTitle,onClose:Vn,onOpenCognitiveCompare:qn,onOpenSideBySide:Gt,onConnect:xt,isConnected:Kt,isOrphan:In.isOrphan}),Bn.open&&n.jsx(c.default,{open:Bn.open,popupRef:Ln,position:Dn,popupConfig:ye,onClose:function(){On(null),Tn(function(n){return e.__assign(e.__assign({},n),{open:!1})}),kn(null)},markdownStyles:Se,sectionTitle:Jn,referenceSectionTitle:Qn,cognitiveData:Bn.cognitiveData,anchorEl:Bn.anchorEl,sectionAnchorEl:Bn.sectionAnchorEl,scrollContainerEl:hn.current,badgeStyle:Bn.badgeStyle,docData:Bn.docData,deviationData:Bn.deviationData,isLoading:Bn.isLoading}),n.jsx(t.Snackbar,e.__assign({open:!!He,autoHideDuration:8e3,onClose:function(){return Ve(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return Ve(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:He}))})),n.jsx(R.default,{componentHeaderText:ve,displayConfig:_e,maintainRelativeOrder:Oe,onCollapseAll:kt,showCollapseAll:Lt,onToggleView:function(e){qe(!0),setTimeout(function(){Fe(!e),Qe(!1),Hi(),Nn(),Ke(new Set),Xe([]),un.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){qe(!1)},600)})})},50)}}),n.jsx(t.Box,e.__assign({ref:hn,onScroll:Nt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Oe?"hidden":"auto",borderTop:nt&&it?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Oe?{flex:1,minHeight:0}:{})},{children:n.jsxs(t.Box,e.__assign({ref:en,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Oe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(I.default,{svgContainerRef:Ze,svgDimensions:Pt,isResizing:Ii,overallConnector:Ft,rootDeviationStyle:lt,lines:Dt,isSideBySide:Ai,activeSideBySideSection:Oi,isArrowVisible:Bi,maintainRelativeOrder:Oe,proposedSections:ti,existingSections:oi,cognitivePopup:Bn,activeBadgeId:Fn,closeCognitivePopup:Hn,setActiveBadgeId:kn,openCognitivePopupFromState:Mn,buildSectionPopupState:St,connectedLines:Ye,pathRefs:sn}),n.jsxs(t.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)"},Oe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(t.Box,e.__assign({ref:nn,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(t.Tooltip,e.__assign({title:Yn,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Yn}))}))})),n.jsxs(t.Box,e.__assign({ref:bn,onScroll:Nt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},Oe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:_n,style:{width:"100%",height:"0px",flexShrink:0}}),ai&&uo,n.jsx("div",{ref:yn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:Ct,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({onClick:function(n){n.stopPropagation(),Bn.open&&Fn===tt?Hn():(kn(tt),Mn(St(n.currentTarget,{title:"",content:"",evaluationResult:ot,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,tt,!0,e.__assign(e.__assign({},lt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:lt.badgeBg,color:lt.badgeText,border:"1px solid ".concat(lt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=rt?rt:n.jsx(v.default,{}),n.jsx(t.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:Bn.open&&Fn===tt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(t.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},Oe?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Di&&n.jsx(l.default,{sections:11}),n.jsx(t.Box,e.__assign({ref:tn,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(t.Tooltip,e.__assign({title:Zn,placement:"top"},{children:n.jsx(t.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(t.Box,e.__assign({ref:Sn,onScroll:Nt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},Oe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Rn,style:{width:"100%",height:"0px",flexShrink:0}}),ai&&ao,n.jsx("div",{ref:xn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("@mui/material"),t=require("../../assests/svg/ButtonCognitiveIcon.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("@mui/material"),t=require("../../assests/svg/ButtonCognitiveIcon.js"),s=function(){return i.jsx("svg",e.__assign({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M2 6.5L5 9.5L11 3.5",stroke:"#15803D",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))},o=[{key:"connect",title:"Connect",icon:i.jsx("svg",e.__assign({width:"15",height:"18",viewBox:"0 0 15 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M14.8237 3.89331C14.547 5.57188 13.0559 6.77501 11.3572 6.69242C9.65857 6.60983 8.2925 5.26384 8.18312 3.56742C4.75678 3.67456 3.54027 4.4759 3.73893 6.10536C3.81259 6.71474 4.18089 7.04063 4.85723 7.19911C5.26794 7.2951 5.7233 7.30849 6.13625 7.27054C6.17419 7.26608 6.21437 7.26385 6.25232 7.25938C6.50455 7.19911 6.76125 7.14777 7.01794 7.1076C7.77911 6.9826 8.55366 6.9201 9.29027 6.96027C11.3617 7.07188 12.7724 7.98483 12.8438 9.92233C12.913 11.7996 11.6229 13.1299 9.5425 14.0205C8.87509 14.3063 8.1675 14.5272 7.45991 14.6946C7.14071 14.7705 6.87286 14.8219 6.67419 14.8554C6.49786 16.5496 5.07821 17.842 3.37509 17.8554C1.67196 17.8688 0.229997 16.6031 0.0246403 14.9112C-0.180717 13.2192 0.917498 11.6455 2.57375 11.2527C4.23 10.8598 5.91973 11.7728 6.49562 13.3755C6.70544 13.3375 6.91303 13.2951 7.12062 13.246C7.75009 13.0987 8.37955 12.9022 8.95991 12.6522C10.538 11.9781 11.3996 11.0875 11.3595 9.9759C11.3237 8.98036 10.6095 8.52054 9.21214 8.44465C8.5983 8.41117 7.92643 8.46474 7.26348 8.57411C7.07821 8.60536 6.90857 8.63661 6.75902 8.6701C6.67196 8.68795 6.61169 8.70358 6.58491 8.71027L6.51571 8.72367C6.4666 8.73036 6.38402 8.74152 6.27687 8.75268C5.71884 8.80402 5.11393 8.78617 4.52464 8.65001C3.2925 8.36206 2.42866 7.59643 2.26794 6.2884C1.9175 3.47143 4.02241 2.16563 8.42866 2.07188C9.07821 0.500452 10.8037 -0.336602 12.4376 0.129916C14.0737 0.596434 15.1005 2.21474 14.8237 3.89331V3.89331ZM3.34161 12.6478C3.09741 12.6478 2.85562 12.6959 2.63002 12.7894C2.40442 12.8828 2.19944 13.0198 2.02678 13.1925C1.85412 13.3652 1.71717 13.5702 1.62373 13.7958C1.5303 14.0214 1.48222 14.2632 1.48223 14.5074C1.48224 14.7516 1.53036 14.9934 1.62382 15.219C1.71728 15.4446 1.85426 15.6495 2.02694 15.8222C2.19962 15.9949 2.40462 16.1318 2.63022 16.2252C2.85583 16.3187 3.09764 16.3668 3.34183 16.3667C3.83499 16.3667 4.30795 16.1708 4.65665 15.822C5.00535 15.4733 5.20123 15.0003 5.2012 14.5071C5.20117 14.014 5.00524 13.541 4.65649 13.1923C4.30775 12.8436 3.83477 12.6477 3.34161 12.6478ZM11.5224 1.49152C11.2782 1.49154 11.0364 1.53965 10.8108 1.63311C10.5852 1.72657 10.3802 1.86355 10.2076 2.03623C10.0349 2.20891 9.89797 2.41391 9.80454 2.63952C9.7111 2.86513 9.66302 3.10693 9.66303 3.35112C9.66305 3.59531 9.71116 3.83711 9.80462 4.06271C9.89808 4.28831 10.0351 4.49329 10.2077 4.66594C10.3804 4.8386 10.5854 4.97556 10.811 5.06899C11.0366 5.16243 11.2784 5.21051 11.5226 5.2105C12.0158 5.21047 12.4888 5.01453 12.8375 4.66579C13.1862 4.31704 13.382 3.84406 13.382 3.3509C13.382 2.85773 13.186 2.38478 12.8373 2.03608C12.4886 1.68738 12.0156 1.49149 11.5224 1.49152V1.49152Z",fill:"#1D2939",fillOpacity:"0.85"})}))},{key:"side-by-side",title:"Side by Side",icon:i.jsx("svg",e.__assign({width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M3.19922 8.19922H13.1992M3.19922 8.19922L4.86589 10.6992M3.19922 8.19922L4.86589 5.69922M13.1992 8.19922L11.5326 10.6992M13.1992 8.19922L11.5326 5.69922M15.6992 0.699219V15.6992M0.699219 0.699219V15.6992",stroke:"#3F4957",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}))},{key:"cognitive-decisioning",title:"Cognitive Decisioning",icon:i.jsx(t.ButtonCognitiveIcon,{})}];exports.default=function(t){var r=t.open,l=t.anchorEl;t.sectionTitle,t.referenceSectionTitle;var a=t.onClose,c=t.onOpenCognitiveCompare,d=t.onOpenSideBySide,C=t.onConnect,x=t.isConnected,g=void 0!==x&&x,h=t.isOrphan,p=t.maintainRelativeOrder;return i.jsx(n.Menu,e.__assign({open:r,anchorEl:l,onClose:a,disableScrollLock:!0,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},PaperProps:{sx:{ml:.75,minWidth:190,maxWidth:220,borderRadius:"12px",border:"1px solid #E4E7EC",boxShadow:"0px 12px 28px rgba(16, 24, 40, 0.12)",overflow:"hidden"}},MenuListProps:{sx:{p:.5,bgcolor:"#FFFFFF"}}},{children:o.filter(function(e){return p||"side-by-side"!==e.key}).map(function(t){var o="connect"===t.key,r=o&&g,l=h&&("connect"===t.key||"side-by-side"===t.key),a=i.jsxs(i.Fragment,{children:[i.jsx(n.Box,e.__assign({sx:e.__assign(e.__assign({width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{display:"block"}},l&&{opacity:.15}),r&&{"& svg path":{fill:"#15803D",fillOpacity:1}})},{children:t.icon})),i.jsxs(n.Box,e.__assign({sx:{minWidth:0,display:"flex",flexDirection:"column",flex:1}},{children:[i.jsx(n.Typography,e.__assign({sx:{fontSize:"12px",fontWeight:500,color:l?"#98A2B3":r?"#15803D":"#101828",lineHeight:1.2,whiteSpace:"nowrap"}},{children:o?g?"Disconnect":"Connect":t.title})),l&&i.jsx(n.Typography,e.__assign({sx:{mt:.35,fontSize:"10px",lineHeight:1.3,color:"#98A2B3",whiteSpace:"normal"}},{children:"No counterpart exists to connect to."}))]})),r&&!l&&i.jsx(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",ml:"auto"}},{children:i.jsx(s,{})}))]});return l?i.jsx(n.Box,e.__assign({"aria-disabled":"true",sx:{px:1.25,py:1,minHeight:22,borderRadius:"10px",display:"flex",alignItems:"flex-start",gap:1,cursor:"not-allowed",userSelect:"none"}},{children:a}),t.key):i.jsx(n.MenuItem,e.__assign({onClick:function(){return e=t.key,void(h&&("connect"===e||"side-by-side"===e)||("connect"!==e?"side-by-side"!==e?c():d():C()));var e},sx:{px:1.25,py:1,minHeight:40,borderRadius:"10px",display:"flex",alignItems:"center",gap:1,bgcolor:r?"#F0FDF4":"transparent","&:hover":{bgcolor:r?"#DCFCE7":"#F9FAFB"}}},{children:a}),t.key)})}))};
|
|
2
2
|
//# sourceMappingURL=MoreFunctionsPopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("@mui/material"),r=require("react"),t=require("../CognitiveCompareConstants.js"),o=require("lucide-react"),a=require("react-markdown"),s=require("../CognitiveComparehelpers.js"),l=require("rehype-raw"),c=require("remark-gfm");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(r),g=d(a),h=d(l),p=d(c),f=u.default.memo(function(a){var l=a.content,c=a.overlayContent,d=a.sxStyles,f=a.deviationBadges,v=void 0===f?[]:f,x=a.highlights,m=void 0===x?[]:x;a.maintainRelativeOrder;var _=a.highlightBg,b=a.suppressHighlightBg,y=void 0!==b&&b,B=a.collisionKey,E=r.useRef(null),C=!!c,j=r.useMemo(function(){return v.reduce(function(n,i){var r;return e.__assign(e.__assign({},n),((r={})[i.id]=i,r))},{})},[v]),F=r.useRef({badgeMap:j,highlightBg:_,hideHighlightBg:C,suppressHighlightBg:y});F.current={badgeMap:j,highlightBg:_,hideHighlightBg:C,suppressHighlightBg:y};var S=function(n,i){return u.default.Children.map(n,function(n){var r;if(!u.default.isValidElement(n))return n;var t=(null===(r=n.props)||void 0===r?void 0:r.children)?S(n.props.children,i):n.props.children,o=u.default.cloneElement(n,e.__assign(e.__assign({},n.props),{children:t}));return i(o)})},k=r.useMemo(function(){return{mark:function(i){var r,t,o,a,s=i.children,l=e.__rest(i,["children"]),c=F.current,d=c.badgeMap,u=c.highlightBg,g=c.hideHighlightBg,h=c.suppressHighlightBg,p=l["data-badge-id"],f=p?d[p]:null,v=l["data-highlight-color"],x=null!==(a=null!==(t=null!=v?v:null===(r=null==f?void 0:f.style)||void 0===r?void 0:r.highlightBg)&&void 0!==t?t:null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.badgeBg)&&void 0!==a?a:u,m=l.isSuggestedDeviationFix||h;return n.jsx("span",e.__assign({style:e.__assign(e.__assign(e.__assign({},m?{}:{backgroundColor:x}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),g?{color:"transparent"}:{})},{children:s}))},span:function(r){var a,s,l,c,d,u,g=r.children,h=e.__rest(r,["children"]),p=F.current.badgeMap,f=h["data-badge-id"];if(!f)return n.jsx("span",e.__assign({},h,{children:g}));var v=p[f];if(!v)return n.jsx("span",e.__assign({},h,{children:g}));var x="number"==typeof v.stackIndex?v.stackIndex:0,m="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return n.jsxs(i.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[n.jsxs(i.Box,e.__assign({ref:v.badgeRef,className:"deviation-badge","data-side":v.side||"right",sx:e.__assign(e.__assign({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=v.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(s=v.style)||void 0===s?void 0:s.badgeText)||t.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(l=v.style)||void 0===l?void 0:l.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===v.side?{right:"-16px",transform:"".concat(m," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(m," translateX(calc(-100% - 8px))")}),v.isConnected&&v.style&&{outline:"2px solid ".concat(v.style.badgeBorder),outlineOffset:"1px"})},{children:[n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),v.onSummaryClick&&v.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:v.label})),("left"===v.side||v.isOrphan)&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=v.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=v.score&&"N/A"!==v.score&&"NA"!==v.score&&0!==v.score?"".concat(v.score):"N/A"===v.score||"NA"===v.score?"N/A":"Same"}))]})),("left"===v.side||v.isOrphan)&&n.jsx(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),v.onClick&&v.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(d=v.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:n.jsx(o.EllipsisVertical,{size:12,color:(null===(u=v.style)||void 0===u?void 0:u.badgeText)||"#3730A3"})}))]})),g]}))},table:function(r){var t=r.children;return n.jsx(i.Box,e.__assign({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:t}))},thead:function(r){var t=r.children;return n.jsx(i.Box,e.__assign({component:"thead"},{children:t}))},tbody:function(r){var t=r.children;return n.jsx(i.Box,e.__assign({component:"tbody"},{children:t}))},tr:function(r){var t=r.children;return n.jsx(i.Box,e.__assign({component:"tr",sx:{borderBotttom:"1px solid #E5E7EB"}},{children:t}))},th:function(r){var t=r.children;return n.jsx(i.Box,e.__assign({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:t}))},td:function(r){var t=r.children;return n.jsx(i.Box,e.__assign({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:t}))},updated:function(i){var r=i.children;return e.__rest(i,["children"]),n.jsx(n.Fragment,{children:r})},deleted:function(i){var r=i.children;e.__rest(i,["children"]),console.log("nitish: ",r);var t=S(r,function(e){return u.default.cloneElement(e,{isSuggestedDeviationFix:!0})});return n.jsx("span",e.__assign({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:t}))},changed:function(i){var r=i.children;e.__rest(i,["children"]);var t=S(r,function(e){return u.default.cloneElement(e,{isSuggestedDeviationFix:!0})});return n.jsx("span",e.__assign({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:t}))}}},[]),w=function(e){return e?e.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(e){return e.startsWith("\n")||/\|.*\|/.test(e)&&/\|[-:\s]+\|/.test(e)?e:e.replace(/\n/g," ")}).join(""):""},A=r.useMemo(function(){return v.map(function(e){return{id:e.id,connected:e.isConnected,stackIndex:e.stackIndex,size:e.size}})},[v]),M=function(e){return e.replace(/[\.,;:]/g," ")},T=r.useMemo(function(){var n=w(s.safeStringify(l||"")),i=y?M(n):n,r=(v||[]).map(function(e){var n,i;return{id:null==e?void 0:e.id,highlight:w((null==e?void 0:e.highlight)||""),highlightColor:(null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.highlightBg)||(null===(i=null==e?void 0:e.style)||void 0===i?void 0:i.badgeBg)||_}}).filter(function(e){return e.id&&e.highlight}),t={};r.forEach(function(e){t[e.highlight]||(t[e.highlight]=[]),t[e.highlight].push(e)});var o=function(e,n){void 0===e&&(e="");var i=n?' data-highlight-color="'.concat(n,'"'):"";return'<mark data-badge-id="'.concat(e,'"').concat(i,">")},a=function(e){return'<span data-badge-id="'.concat(e,'">')},c=function(e,n,i){var r,t,a;void 0===n&&(n="");var s=e.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!s)return e;var l=null!==(r=s[1])&&void 0!==r?r:"",c=null!==(t=s[2])&&void 0!==t?t:"",d=null!==(a=s[3])&&void 0!==a?a:"";return c?l+o(n,i)+c+"</mark>"+d:e},d=[];Object.entries(t).forEach(function(e){var r=e[0],t=e[1],o=n.indexOf(r),a=!1;if(-1===o&&y){var l=M(r);-1!==(o=i.indexOf(l))&&(a=!0)}if(-1!==o){for(var c=t[0].highlightColor,u=1;u<t.length;u++)c=s.mixHexColors(c,t[u].highlightColor);d.push({highlight:r,start:o,end:o+r.length,badges:t,color:c,usedLooseMatch:a})}}),d.sort(function(e,n){return e.start-n.start||n.end-e.end});var u=[],g={};d.forEach(function(e,n){for(var i=e.start,r=e.end,t=0,o=u;t<o.length;t++){var a=o[t],s=a.start,l=a.end,c=i<l&&r>l&&i>=s,d=i<s&&r>s&&r<=l;if(i>=s&&r<=l){e.orphaned=!0,g[n]=a.matchIdx;break}c&&(i=l),d&&(r=s)}e.trimmedStart=i,e.trimmedEnd=r,!e.orphaned&&i<r&&u.push({start:i,end:r,matchIdx:n})});var h={};Object.entries(g).forEach(function(e){var n=e[0],i=e[1],r=Number(n);h[i]||(h[i]=[]),h[i].push(r)});var p=function(e,n,i){return void 0===n&&(n=""),e.split(/(\n+)/).map(function(e){return/^\n+$/.test(e)?e:e.trim()?""===e.replace(/[|:\-\s]/g,"")&&e.includes("-")?e:e.includes("|")?e.split(/(\|)/).map(function(e){return"|"!==e&&e.trim()?c(e,n,i):e}).join(""):c(e,n,i):e}).join("")},f=d.map(function(n,i){return e.__assign(e.__assign({},n),{idx:i})}).filter(function(e){return!e.orphaned}).sort(function(e,n){var i,r;return(null!==(i=n.trimmedStart)&&void 0!==i?i:n.start)-(null!==(r=e.trimmedStart)&&void 0!==r?r:e.start)});f.forEach(function(e){var i,r,t=null!==(i=e.trimmedStart)&&void 0!==i?i:e.start,o=null!==(r=e.trimmedEnd)&&void 0!==r?r:e.end;if(!(t>=o)){var l=n.slice(t,o),c=function(e,n,i,r){if(!i.length)return e;var t=i.map(function(e){return d[e]}).sort(function(e,n){return e.start-n.start}),o="",l=0;return t.forEach(function(i){var t=i.start-n,c=i.end-n,d=s.mixHexColors(r,i.color);o+=e.slice(l,t);var u="",g="";i.badges.forEach(function(e){u+=a(e.id),g="</span>"+g}),o+=u+p(e.slice(t,c),i.badges[0].id,d)+g,l=c}),o+=e.slice(l)}(e.usedLooseMatch||t!==e.start||o!==e.end?l:e.highlight,e.start,h[e.idx]||[],e.color),u=p(c,e.badges[0].id,e.color),g="",f="";e.badges.forEach(function(e){g+=a(e.id),f="</span>"+f});var v=g+u+f;n=n.slice(0,t)+v+n.slice(o)}});var x=new Set(Object.keys(t));return m.forEach(function(e){if(e){var r=w(e);if(r&&!x.has(r)){var t=y?i.indexOf(M(r)):n.indexOf(r);if(-1!==t){var a=n.slice(0,t);if((a.match(/</g)||[]).length===(a.match(/>/g)||[]).length){var s=o("","")+r+"</mark>";n=n.slice(0,t)+s+n.slice(t+r.length)}}}}}),n},[l,v,m,_,y]),O=r.useMemo(function(){return c?w(s.safeStringify(c||"")):""},[c]),q=!!c,I=e.__assign(e.__assign(e.__assign(e.__assign({},d),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),q?{color:"transparent"}:{}),{"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}}),z=e.__assign(e.__assign({},d),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}});return r.useLayoutEffect(function(){if(E.current){var e=function(){var e=Array.from(E.current.querySelectorAll(".deviation-badge"));if(0!==e.length){e.forEach(function(e){e.style.setProperty("--badge-nudge","0px")});var n=e.filter(function(e){return"left"===e.dataset.side}),i=e.filter(function(e){return"left"!==e.dataset.side}),r=E.current.getBoundingClientRect(),t=r.bottom-4,o=r.top+4,a=function(e){if(0!==e.length){var n=e.map(function(e){var n=e.getBoundingClientRect();return{el:e,naturalTop:n.top,height:n.height,currentTop:n.top}});n.sort(function(e,n){return e.naturalTop-n.naturalTop});var i=[],r=[];n.forEach(function(e){if(0===r.length)r.push(e);else{var n=r[r.length-1],t=n.currentTop+n.height;e.naturalTop<t+8?(e.currentTop=t+8,r.push(e)):(i.push(r),r=[e])}}),r.length>0&&i.push(r),i.forEach(function(e){var n=e[e.length-1],i=n.currentTop+n.height;if(i>t){var r=i-t,a=e[0].currentTop-o,s=Math.max(0,Math.min(r,a));e.forEach(function(e){e.currentTop-=s})}}),i.flat().forEach(function(e){var n=e.currentTop-e.naturalTop;e.el.style.setProperty("--badge-nudge","".concat(n,"px"))})}};a(n),a(i)}},n=requestAnimationFrame(function(){requestAnimationFrame(function(){e()})}),i=new ResizeObserver(function(){requestAnimationFrame(e)});return i.observe(E.current),function(){i.disconnect(),cancelAnimationFrame(n)}}},[T,B,A]),n.jsxs(i.Box,e.__assign({ref:E,sx:{position:"relative",display:"grid"}},{children:[n.jsx(i.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},I),{padding:"3px"})},{children:n.jsx(g.default,e.__assign({components:k,remarkPlugins:[p.default],rehypePlugins:[h.default]},{children:s.safeStringify(T).replace(/\\n/g,"\n")}))})),q&&n.jsx(i.Typography,e.__assign({component:"div",sx:z},{children:n.jsx(g.default,e.__assign({components:k,remarkPlugins:[p.default],rehypePlugins:[h.default]},{children:s.safeStringify(O).replace(/\\n/g,"\n")}))}))]}))},s.areMarkdownPropsEqual);exports.MemoizedMarkdown=f;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),t=require("@mui/material"),r=require("react"),i=require("../CognitiveCompareConstants.js"),o=require("lucide-react"),a=require("react-markdown"),s=require("../CognitiveComparehelpers.js"),l=require("rehype-raw"),c=require("remark-gfm");function d(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=d(r),g=d(a),h=d(l),p=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},f=[p(d(c).default)],v=[p(h.default)],x=u.default.memo(function(a){var l=a.content,c=a.overlayContent,d=a.sxStyles,h=a.deviationBadges,p=void 0===h?[]:h,x=a.highlights,m=void 0===x?[]:x;a.maintainRelativeOrder;var _=a.highlightBg,b=a.suppressHighlightBg,y=void 0!==b&&b,B=a.collisionKey,E=r.useRef(null),j=!!c,C=r.useMemo(function(){return p.reduce(function(e,t){var r;return n.__assign(n.__assign({},e),((r={})[t.id]=t,r))},{})},[p]),k=r.useRef({badgeMap:C,highlightBg:_,hideHighlightBg:j,suppressHighlightBg:y});k.current={badgeMap:C,highlightBg:_,hideHighlightBg:j,suppressHighlightBg:y};var F=function(e,t){return u.default.Children.map(e,function(e){var r;if(!u.default.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?F(e.props.children,t):e.props.children,o=u.default.cloneElement(e,n.__assign(n.__assign({},e.props),{children:i}));return t(o)})},S=r.useMemo(function(){return{mark:function(t){var r,i,o,a,s=t.children,l=n.__rest(t,["children"]),c=k.current,d=c.badgeMap,u=c.highlightBg,g=c.hideHighlightBg,h=c.suppressHighlightBg,p=l["data-badge-id"],f=p?d[p]:null,v=l["data-highlight-color"],x=null!==(a=null!==(i=null!=v?v:null===(r=null==f?void 0:f.style)||void 0===r?void 0:r.highlightBg)&&void 0!==i?i:null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.badgeBg)&&void 0!==a?a:u,m="true"===l["data-is-suggested-deviation-fix"]||h;return e.jsx("span",n.__assign({style:n.__assign(n.__assign(n.__assign({},m?{}:{backgroundColor:x}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),g?{color:"transparent"}:{})},{children:s}))},span:function(r){var a,s,l,c,d,u,g=r.children,h=n.__rest(r,["children"]),p=k.current.badgeMap,f=h["data-badge-id"];if(!f)return e.jsx("span",n.__assign({},h,{children:g}));var v=p[f];if(!v)return e.jsx("span",n.__assign({},h,{children:g}));var x="number"==typeof v.stackIndex?v.stackIndex:0,m="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return e.jsxs(t.Box,n.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[e.jsxs(t.Box,n.__assign({ref:v.badgeRef,className:"deviation-badge","data-side":v.side||"right",sx:n.__assign(n.__assign({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=v.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(s=v.style)||void 0===s?void 0:s.badgeText)||i.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(l=v.style)||void 0===l?void 0:l.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===v.side?{right:"-16px",transform:"".concat(m," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(m," translateX(calc(-100% - 8px))")}),v.isConnected&&v.style&&{outline:"2px solid ".concat(v.style.badgeBorder),outlineOffset:"1px"})},{children:[e.jsxs(t.Box,n.__assign({onClick:function(n){n.stopPropagation(),v.onSummaryClick&&v.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[e.jsx(t.Box,n.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:v.label})),("left"===v.side||v.isOrphan)&&e.jsx(t.Box,n.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=v.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=v.score&&"N/A"!==v.score&&"NA"!==v.score&&0!==v.score?"".concat(v.score):"N/A"===v.score||"NA"===v.score?"N/A":"Same"}))]})),("left"===v.side||v.isOrphan)&&e.jsx(t.Box,n.__assign({onClick:function(n){n.stopPropagation(),v.onClick&&v.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(d=v.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:e.jsx(o.EllipsisVertical,{size:12,color:(null===(u=v.style)||void 0===u?void 0:u.badgeText)||"#3730A3"})}))]})),g]}))},table:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:i}))},thead:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"thead"},{children:i}))},tbody:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"tbody"},{children:i}))},tr:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:i}))},th:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:i}))},td:function(r){var i=r.children;return e.jsx(t.Box,n.__assign({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:i}))},code:function(t){var r=t.children;return e.jsx("span",n.__assign({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(t){var r=t.children;return e.jsx("span",n.__assign({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var t=n.children;return e.jsx(e.Fragment,{children:t})},deleted:function(t){var r=t.children,i=F(r,function(n){return u.default.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return e.jsx("span",n.__assign({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(t){var r=t.children,i=F(r,function(n){return u.default.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return e.jsx("span",n.__assign({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))}}},[]),w=function(n){if(!n||"string"!=typeof n)return"";var e=n.replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n"),t=(e=(e=(e=e.replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).split(/(\n{2,})/);return e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r,i=null!==(r=n[t+1])&&void 0!==r?r:"";return/^[#>|\-*+]/.test(i)||/^\d+\./.test(n.slice(t+1))?"\n":" "})}).join(""),e},M=function(n){return n.replace(/[\.,;:]/g," ")},A=r.useMemo(function(){return p.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[p]),T=function(n){return'<span data-badge-id="'.concat(n,'">')},O=r.useMemo(function(){var e=w(l||""),t=y?M(e):e,r=(p||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:w((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||_}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var s=null!==(r=a[1])&&void 0!==r?r:"",l=null!==(i=a[2])&&void 0!==i?i:"",c=null!==(o=a[3])&&void 0!==o?o:"";return l?s+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+l+"</mark>"+c:n}(n,e,t),a=o;return!i&&r.length>0&&(i=!0,a=T(r[0].id)+o+"</span>"),""+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&y){var c=M(r);-1!==(o=t.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,u=1;u<i.length;u++)d=s.mixHexColors(d,i[u].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:d,usedLooseMatch:l})}});var c=new Set(Object.keys(i));(m||[]).forEach(function(n){if(n){var r=w(n);if(r&&!c.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&y){var s=M(r);-1!==(i=t.indexOf(s))&&(o=!0)}if(-1!==i){var l=e.slice(0,i);(l.match(/</g)||[]).length===(l.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:_||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var d=[],u={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=d;i<o.length;i++){var a=o[i],s=a.start,l=a.end,c=t<l&&r>l&&t>=s,g=t<s&&r>s&&r<=l;if(t>=s&&r<=l){n.orphaned=!0,u[e]=a.matchIdx;break}c&&(t=l),g&&(r=s)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&d.push({start:t,end:r,matchIdx:e})});var g={};Object.entries(u).forEach(function(n){var e=n[0],t=n[1],r=Number(e);g[t]||(g[t]=[]),g[t].push(r)});var h=a.map(function(e,t){return n.__assign(n.__assign({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return h.forEach(function(n){var t,r,i,l,c=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,d=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(c>=d)){var u=e.slice(c,d),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",c=0;return i.forEach(function(t){var i,a,d=Math.max(c,t.start-e),u=Math.max(d,t.end-e);if(!(d>=u)){var g=s.mixHexColors(r,t.color||"");l+=n.slice(c,d);var h="",p="";(t.badges||[]).forEach(function(n){h+=T(n.id),p="</span>"+p}),l+=h+o(n.slice(d,u),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",g,t.badges||[])+p,c=u}}),l+=n.slice(c)}(n.usedLooseMatch||c!==n.start||d!==n.end?u:n.highlight,n.start,g[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,c)+p+e.slice(d)}}),e},[l,p,m,_,y]),q=r.useMemo(function(){return c?w(c||""):""},[c]),z=!!c,I={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},P=n.__assign(n.__assign(n.__assign(n.__assign({},d),I),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),z?{color:"transparent"}:{}),R=n.__assign(n.__assign(n.__assign({},d),I),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none"});return r.useLayoutEffect(function(){if(E.current){var n=function(){var n=Array.from(E.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=E.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,s=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=s})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(E.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[O,B,A]),e.jsxs(t.Box,n.__assign({ref:E,sx:{position:"relative",display:"grid"}},{children:[e.jsx(t.Typography,n.__assign({component:"div",sx:n.__assign(n.__assign({},P),{padding:"3px"})},{children:e.jsx(g.default,n.__assign({components:S,remarkPlugins:f,rehypePlugins:v},{children:O.replace(/#{3}/g,"")}))})),z&&e.jsx(t.Typography,n.__assign({component:"div",sx:R},{children:e.jsx(g.default,n.__assign({components:S,remarkPlugins:f,rehypePlugins:v},{children:q}))}))]}))},s.areMarkdownPropsEqual);exports.MemoizedMarkdown=x;
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n}from"tslib";import{jsx as i,jsxs as t}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 s,Alert as d,Tooltip as v,Typography as f}from"@mui/material";import{ChevronDown as p}from"lucide-react";import{ButtonCognitiveIcon as m}from"../../assests/svg/ButtonCognitiveIcon.js";import g from"./OverlayComponent.js";import{safeStringify as h,extractDeviationScore as S,generateColorPalette as x,findKeyPathByNodeId as R,DEVIATION_BADGE_SEPARATOR as y,hasMeaningfulRedlineTags as b,scrollAndHighlightClause as C}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as w,DEFAULT_FIELD_CONFIG as _,DEFAULT_COMPARISON_CONFIG as B}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as F,EMPTY_SUMMARY_POPUP_STATE as E,DEFAULT_COMPONENT_HEADER_TEXT as I}from"./CognitiveCompareConstants.js";import T from"./CognitivePopup.js";import A from"./MoreFunctionsPopup.js";import D from"./LoaderComponent.js";import k from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as j}from"./hooks/useCompareData.js";import{useComparePopups as O}from"./hooks/useComparePopups.js";import{useSectionRefs as L}from"./hooks/useSectionRefs.js";import{useAccordionState as P}from"./hooks/useAccordionState.js";import{useDeviationNavigation as N}from"./hooks/useDeviationNavigation.js";import z from"./components/CompareHeader.js";import H from"./components/SubSectionAccordion.js";import M from"./components/LHSSectionRow.js";import q from"./components/RHSSectionRow.js";import W from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as V}from"./CompareContext.js";import{useStyleHelpers as K}from"./hooks/useStyles.js";import{useResizeHandler as Y}from"./hooks/useResizeHandler.js";import{useLinesCalculator as J}from"./hooks/useLinesCalculator.js";import{useSideBySide as X}from"./hooks/useSideBySide.js";import $ from"./components/SvgConnectors.js";var U=function(U){var G,Q,Z,ee,ne,ie,te,oe,re,le,ue,ce,ae,se,de,ve,fe,pe,me,ge,he,Se,xe,Re,ye,be,Ce,we,_e,Be,Fe,Ee,Ie,Te,Ae=U.componentHeaderText,De=void 0===Ae?I:Ae,ke=U.treeData,je=U.comparisonConfig,Oe=U.leftColumnTitleText,Le=U.rightColumnTitleText,Pe=U.markdownStyles,Ne=U.resetTrigger,ze=U.displayConfig,He=void 0===ze?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:ze,Me=U.popupConfig,qe=U.deviationData,We=void 0===qe?{}:qe,Ve=U.deviationNodeIdToView,Ke=U.resetDeviationNodeId,Ye=U.isProposingFix,Je=void 0!==Ye&&Ye,Xe=U.proposingFixNodeId,$e=U.isRedlineFlow,Ue=o(He.maintainRelativeOrder),Ge=Ue[0],Qe=Ue[1],Ze=!!Ge||!!(null==He?void 0:He.showDeviationBadges),en=o(!1),nn=en[0],tn=en[1],on=o(null),rn=on[0],ln=on[1],un=o(null===(Q=null!==(G=null==ke?void 0:ke.newEvaluationResult)&&void 0!==G?G:null==He?void 0:He.enableDeviationSchemaBackwardCompatibility)||void 0===Q||Q)[0],cn=o(new Set),an=cn[0],sn=cn[1],dn=o([]),vn=dn[0],fn=dn[1],pn=o(!1),mn=pn[0],gn=pn[1],hn=r(null),Sn=r(null),xn=r(null),Rn=r(null),yn=r(null),bn=r(!1),Cn=r(null),wn=r({}),_n=r([]),Bn=r(function(){}),Fn=r(null),En=r(function(){}),In=l(function(){return JSON.stringify(We||{})},[JSON.stringify(We)]),Tn=l(function(){return We||{}},[In]),An=l(function(){return(null==ke?void 0:ke.cognitive_decisioning)||{}},[ke]),Dn=l(function(){return e(e({},w),Pe)},[Pe]),kn=r(null),jn=r(null),On=r(null),Ln=r(null),Pn=r(null),Nn=r(null),zn=r(null),Hn=r(null),Mn=r(null),qn=r(null),Wn=O(kn),Vn=Wn.cognitivePopup,Kn=Wn.setCognitivePopup,Yn=Wn.moreFunctions,Jn=Wn.setMoreFunctions,Xn=Wn.position,$n=Wn.setPosition,Un=Wn.activeBadgeId,Gn=Wn.summaryPopup,Qn=Wn.setSummaryPopup,Zn=Wn.closeSummaryPopup,ei=Wn.setActiveBadgeId,ni=Wn.popupRef,ii=Wn.handleOpenCognitiveCompare,ti=Wn.openCognitivePopupFromState,oi=Wn.closeCognitivePopup,ri=Wn.closeMoreFunctionsPopup,li=l(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==je?void 0:je.fields)&&void 0!==e?e:_,thresholds:{high:null!==(i=null===(n=null==je?void 0:je.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:B.thresholds.high,medium:null!==(o=null===(t=null==je?void 0:je.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:B.thresholds.medium,exact:null!==(l=null===(r=null==je?void 0:je.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:B.thresholds.exact}}},[je]),ui=o(null),ci=ui[0];ui[1];var ai=null===(ne=null===(Z=null==ke?void 0:ke.documents)||void 0===Z?void 0:Z[null===(ee=null==ke?void 0:ke.input_index_map)||void 0===ee?void 0:ee[0]])||void 0===ne?void 0:ne.title,si=null===(oe=null===(ie=null==ke?void 0:ke.documents)||void 0===ie?void 0:ie[null===(te=null==ke?void 0:ke.input_index_map)||void 0===te?void 0:te[1]])||void 0===oe?void 0:oe.title,di=h(Oe||ai||"Uploaded Contract"),vi=null===(ce=null===(ue=null===(re=null==ke?void 0:ke.documents)||void 0===re?void 0:re[null===(le=null==ke?void 0:ke.input_index_map)||void 0===le?void 0:le[0]])||void 0===ue?void 0:ue.metadata)||void 0===ce?void 0:ce.file_name,fi=h(vi),pi=null===(ve=null===(de=null===(ae=null==ke?void 0:ke.documents)||void 0===ae?void 0:ae[null===(se=null==ke?void 0:ke.input_index_map)||void 0===se?void 0:se[1]])||void 0===de?void 0:de.metadata)||void 0===ve?void 0:ve.file_name,mi=h(pi),gi=h(Le||si||"Reference Template"),hi=j(ke,Ge,Tn,li,un),Si=hi.activeProposed,xi=hi.existingRule,Ri=hi.proposedSections,yi=hi.existingSections,bi=hi.visibleFields,Ci=hi.parentDeviationRecord,wi=hi.deviationNumberRegistry,_i=hi.parseError;u(function(){_i&&ln("Failed to load comparison: ".concat(_i))},[_i]);var Bi=Ri.length>0||yi.length>0,Fi=l(function(){if(!$e)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";b(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Ri),i(yi),"".concat(e,":").concat(n)},[$e,Ri,yi]),Ei=L(bi.map(function(e){return e.key}),Math.max(Ri.length,yi.length)),Ii=Ei.leftRefs,Ti=Ei.rightRefs,Ai=Ei.sectionLeftRefs,Di=Ei.sectionRightRefs,ki=Ei.lhsBadgeRefs,ji=Ei.rhsBadgeRefs,Oi=Ei.sectionRightRowRefs,Li=Ei.subSectionLeftRefs,Pi=Ei.subSectionRightRefs,Ni=Ei.sectionRowRefs,zi=Ei.getSectionRowRef,Hi=Ei.getSubSectionRef,Mi=Ei.getBadgeRef,qi=X({maintainRelativeOrder:Ge,proposedSections:Ri,existingSections:yi,leftContainerRef:Hn,rightContainerRef:On,scrollContainerRef:kn,sectionLeftRefs:Ai,sectionRightRefs:Di,subSectionLeftRefs:Li,subSectionRightRefs:Pi,lhsBadgeRefs:ki,rhsBadgeRefs:ji,sectionRowRefs:Ni,sectionRightRowRefs:Oi,rhsTopSpacerRef:Ln,rhsBottomSpacerRef:Pn,lhsTopSpacerRef:Nn,lhsBottomSpacerRef:zn,calculateLinesRef:Bn,setConnectedSections:sn,setConnectedLines:fn,cachedConnectedPositions:_n,closeMoreFunctionsPopup:ri,setErrorToast:ln,moreFunctions:Yn,closeSummaryPopup:Zn}),Wi=qi.isSideBySide,Vi=qi.isArrowVisible,Ki=qi.setIsArrowVisible,Yi=qi.isResizing,Ji=qi.setIsResizing,Xi=qi.isSideBySideLoading,$i=qi.activeSideBySideSection,Ui=qi.scrollLock,Gi=qi.sideBySideCacheRef,Qi=qi.isSideBySideRef,Zi=qi.activeSideBySideRightSectionRef,et=qi.activeSideBySideSectionRef,nt=qi.sideBySideLineRef,it=qi.highlightedClauseRefs,tt=qi.clearClauseHighlight,ot=qi.resetSideBySide,rt=qi.activateSideBySide,lt=P({maintainRelativeOrder:!!Ge,proposedSections:Ri,existingSections:yi,activeSideBySideSection:$i,connectedSections:an,resetSideBySide:ot,setConnectedSections:sn,setConnectedLines:fn,cachedConnectedPositions:_n,svgContainerRef:hn,isAnimatingRef:bn,animationTimerRef:Cn,calculateLinesRef:Bn,sectionLeftRefs:Ai,sectionRightRefs:Di,subSectionLeftRefs:Li,subSectionRightRefs:Pi}),ut=lt.expandedSections,ct=lt.setExpandedSections,at=lt.expandedSubSections,st=lt.setExpandedSubSections,dt=lt.handleSubSectionToggle,vt=lt.toggleSection,ft=lt.forceExpandCrossWiredSections,pt=function(){var e,n;if(null!=$i){var i=null===(e=Ai.current[$i])||void 0===e?void 0:e.current,t=null===(n=Di.current[$i])||void 0===n?void 0:n.current,o=On.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),c=r.top-u.top,a=l.top-u.top-c;o.scrollBy({top:a,behavior:"smooth"})}}},mt=c(function(e){null==e||e.stopPropagation(),gn(function(e){var n=!e;return n&&requestAnimationFrame(function(){pt()}),n})},[pt]);u(function(){$e&&"off"!==Fi&&"0:0"!==Fi&&(Gi.current=null,_n.current=[],requestAnimationFrame(function(){var e;null===(e=Bn.current)||void 0===e||e.call(Bn)}))},[$e,Fi]);var gt=l(function(){var e=new Map,n=new Map,i=1;if(Ge)Ri.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),yi.forEach(function(t){if(t.id){var o=Ri.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Ri.length,yi.length),o=0;o<t;o++){var r=Ri[o],l=yi[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Ri,yi,Ge]),ht=xi.analysis,St=h(null===(pe=null===(fe=null==ht?void 0:ht.rule_difference_comparison)||void 0===fe?void 0:fe.summary)||void 0===pe?void 0:pe.overall_summary),xt=!!St.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Rt=null!==(me=null==ke?void 0:ke.base_root_id)&&void 0!==me?me:"-1";null==ke||ke[Rt];var yt=un?null!==(Fe=null!==(we=We&&(null===(Ce=null==We?void 0:We[Rt])||void 0===Ce?void 0:Ce.evaluation_result))&&void 0!==we?we:null===(Be=null===(_e=null==ke?void 0:ke.nodes)||void 0===_e?void 0:_e[Rt])||void 0===Be?void 0:Be.evaluation_result)&&void 0!==Fe?Fe:null:null!==(be=null!==(Se=We&&(null===(he=null===(ge=null==We?void 0:We[Rt])||void 0===ge?void 0:ge.evaluation_result)||void 0===he?void 0:he[0]))&&void 0!==Se?Se:null===(ye=null===(Re=null===(xe=null==ke?void 0:ke.nodes)||void 0===xe?void 0:xe[Rt])||void 0===Re?void 0:Re.evaluation_result)||void 0===ye?void 0:ye[0])&&void 0!==be?be:null,bt=S(yt),Ct=x(null!==(Te=null===(Ie=null===(Ee=null==yt?void 0:yt.evaluation_outputs)||void 0===Ee?void 0:Ee.metadata)||void 0===Ie?void 0:Ie.label_color)&&void 0!==Te?Te:F),wt=r(ot);u(function(){wt.current=ot},[ot]);var _t=r(oi);u(function(){_t.current=oi},[oi]);var Bt=c(function(e,n,i,t,o,r){return Eo.current(e,n,i,t,o,r)},[]),Ft=c(function(e,n,i,t,o){return Io.current(e,n,i,t,o)},[]),Et=c(function(){return To.current()},[]),It=c(function(e,n){return Ao.current(e,n)},[]),Tt=c(function(e){return Do.current(e)},[]),At=c(function(e){return ko.current(e)},[]),Dt=c(function(){return jo.current()},[]),kt=c(function(){var e,n;tt(),null===(e=wt.current)||void 0===e||e.call(wt),gn(!1),sn(new Set),fn([]),_n.current=[],$t([]),Gt(null),Qn(E),null===(n=_t.current)||void 0===n||n.call(_t),requestAnimationFrame(function(){var e;null===(e=Bn.current)||void 0===e||e.call(Bn)})},[]),jt=r(kt);u(function(){jt.current=kt},[kt]),u(function(){Ne&&jt.current()},[Ne]);var Ot=c(function(n,i,t,o,r,l,u){var c,a,s,d=h(null==i?void 0:i.id)||h(null==t?void 0:t.id)||"",v=(d?An[d]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},f=null!==(a=null===(c=Ni.current[o])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(s=null==He?void 0:He.isLoading)&&void 0!==s&&s,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:v,anchorEl:n,sectionAnchorEl:f,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==ke?void 0:ke.documents,input_index_map:null==ke?void 0:ke.input_index_map},deviationData:function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[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 i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(y)))return u(l);var c=o.split(y)[1];if(!c)return l;var a=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==a?void 0:a.deviation_entries)||void 0===n?void 0:n[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return s?e(e(e({},a),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[An,ke]),Lt=c(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),Yn.open&&Yn.sectionIdx===o)ri();else{var u=e.currentTarget,c="left";(null===(l=On.current)||void 0===l?void 0:l.contains(u))&&(c="right");tt(),Qi.current&&ot(),sn(new Set),fn([]),_n.current=[],oi(),Gn.open?co():Zn(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(y)){var r=o.split(y),l="".concat(r[0]).concat(y).concat(r[1]);return"right"===c?null===(e=ji.current[l])||void 0===e?void 0:e.current:null===(n=ki.current[l])||void 0===n?void 0:n.current}return"right"===c?null===(i=ji.current[o])||void 0===i?void 0:i.current:null===(t=ki.current[o])||void 0===t?void 0:t.current}()||u;Jn(Ot(e,n,t,o,i,r))})}},[Yn.open,Yn.sectionIdx,ri,Zn,Ot]),Pt=c(function(){var e=Yn.sectionIdx,n=Yn.isOrphan;ri(),Zn(),null!==e&&(n?ln("No counterpart exists to connect to."):(ft(e),tt(),Qi.current&&ot(),fn([]),_n.current=[],sn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Bn.current&&Bn.current()},50)))},[Yn.sectionIdx,Yn.isOrphan,ri,Zn,ot]),Nt=c(function(){var e=yn.current;if(e){yn.current=null;var n=Ri.findIndex(function(n){return n.id===e}),i=yi.findIndex(function(n){return n.id===e}),t=-1===n?R(Ri,e):null,o=-1===i?R(yi,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(it.current.add(r),C(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Ge)-1!==r&&Hn.current&&c(function(){return u(n,t,Ai,Li)},Hn.current),-1!==l&&On.current&&c(function(){return u(i,o,Di,Pi)},On.current);else{var a=kn.current;if(!a)return;c(function(){return-1!==r?u(n,t,Ai,Li):u(i,o,Di,Pi)},a)}}},[Ri,yi,Ge,Ai,Di,Li,Pi,Hn,On,kn]),zt=c(function(n){if(n){tt(),ot(),sn(new Set),fn([]),_n.current=[],Zn(),oi();var i=Ri.findIndex(function(e){return e.id===n}),t=yi.findIndex(function(e){return e.id===n}),o=-1===i?R(Ri,n):null,r=-1===t?R(yi,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;yn.current=n,ct(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=Ge?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=Ge?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),st(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){yn.current===n&&Ht.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Ri,yi,Ge,ct,st,ot,Zn,oi]),Ht=r(Nt);u(function(){Ht.current=Nt},[Nt]);var Mt=r(null);u(function(){if(ci){var e=li.fields.find(function(e){return e.analysisKey===ci||e.key===ci});if(e){var n=Ii.current[e.key]||Ti.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[ci,li.fields]);var qt=c(function(e){var n,i,t,o,r,l,u,c,a,s=null===(n=null==ht?void 0:ht.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===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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}},[ht]),Wt=K({proposedSections:Ri,existingSections:yi,maintainRelativeOrder:Ge,cognitiveMap:An,deviationData:We,treeData:ke,resolvedComparisonConfig:li}),Vt=Wt.getSectionCompareStyle,Kt=Wt.getSubSectionCompareStyle,Yt=Wt.getDeviationStyleByKey,Jt=J({containerRef:Sn,leftContainerRef:Hn,rightContainerRef:On,svgContainerRef:hn,pathRefs:wn,leftHeaderRef:xn,rightHeaderRef:Rn,proposedSections:Ri,existingSections:yi,visibleFields:bi,leftRefs:Ii,rightRefs:Ti,sectionLeftRefs:Ai,sectionRightRefs:Di,subSectionLeftRefs:Li,subSectionRightRefs:Pi,lhsBadgeRefs:ki,rhsBadgeRefs:ji,sectionRowRefs:Ni,expandedSections:ut,expandedSubSections:at,connectedSections:an,isSideBySide:Wi,activeSideBySideSection:$i,maintainRelativeOrder:Ge,cognitiveMap:An,getSectionCompareStyle:Vt,getSubSectionCompareStyle:Kt,getDeviationStyleByKey:Yt,isArrowVisible:Vi,isAnimatingRef:bn,isSideBySideRef:Qi,sideBySideCacheRef:Gi,sideBySideLineRef:nt,activeSideBySideSectionRef:et,activeSideBySideRightSectionRef:Zi,connectedLines:vn,setConnectedLines:fn,cachedConnectedPositions:_n,calculateLinesRef:Bn,resizeTimerRef:Fn,scrollLock:Ui,scrollSyncLocked:mn,handleResizeRef:En,activeProposed:Si,existingRule:xi,analysisData:ht,pendingScrollTargetRef:Mn,pendingScrollCallbackRef:qn,resolvedComparisonConfig:li,getFieldData:qt}),Xt=Jt.lines,$t=Jt.setLines,Ut=Jt.overallConnector,Gt=Jt.setOverallConnector,Qt=Jt.svgDimensions,Zt=Jt.handleColumnScroll;u(function(){Gn.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Bn.current)||void 0===e||e.call(Bn)})})},[Gn.anchorEl,mn]);var eo=c(function(){tt(),gn(!1),ct({}),st({}),ot(),sn(new Set),fn([]),_n.current=[],Zn(),oi(),ri(),requestAnimationFrame(function(){Bn.current&&Bn.current()})},[ct,st,ot,Zn,oi,ri]);u(function(){Wi||0!==an.size||gn(!1)},[Wi,an]);var no=l(function(){return Object.values(ut).some(Boolean)||Object.values(at).some(Boolean)},[ut,at]),io=r(null),to=r(0),oo=r(0),ro=r(0),lo=Y({timerRef:io,ruleComponentRef:jn,scrollContainerRef:kn,containerRef:Sn,maintainRelativeOrder:Ge,proposedSections:Ri,existingSections:yi,isSideBySideRef:Qi,activeSideBySideSectionRef:et,activeSideBySideRightSectionRef:Zi,sectionRowRefs:Ni,sectionRightRowRefs:Oi,sectionLeftRefs:Ai,sectionRightRefs:Di,subSectionLeftRefs:Li,subSectionRightRefs:Pi,lhsBadgeRefs:ki,rhsBadgeRefs:ji,leftContainerRef:Hn,rightContainerRef:On,calculateLinesRef:Bn,handleResizeRef:En,setIsResizing:Ji,setIsArrowVisible:Ki,sideBySideCacheRef:Gi,cachedConnectedPositions:_n}).handleResize;u(function(){En.current=lo},[lo,En]),u(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.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,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return jn.current&&o.push(e(jn.current,to,n,function(){return En.current()},function(){})),kn.current&&o.push(e(kn.current,oo,i,function(){return En.current()},function(){return Bn.current()})),Sn.current&&o.push(e(Sn.current,ro,t,function(){return En.current()},function(){return Bn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),u(function(){Qi.current=Wi},[Wi]),u(function(){et.current=$i},[$i]);var uo=c(function(){var e,n=Yn.sectionIdx,i=Yn.isOrphan;if(Zn(),null!=n){var t="left";Yn.anchorEl&&(null===(e=On.current)||void 0===e?void 0:e.contains(Yn.anchorEl))&&(t="right"),ft(n),rt(n,i,{sourceSide:t})}},[rt,Yn.isOrphan,Yn.sectionIdx,Yn.anchorEl,Zn]),co=c(function(){Zn(),ot(),sn(new Set),fn([]),_n.current=[]},[Zn,ot]),ao=null!==Yn.sectionIdx&&an.has(Yn.sectionIdx),so=N({proposedSections:Ri,existingSections:yi,parentDeviationRecord:Ci,expandedSections:ut,maintainRelativeOrder:!!Ge,scrollContainerRef:kn,leftContainerRef:Hn,rightContainerRef:On,lhsBadgeRefs:ki,rhsBadgeRefs:ji}),vo=so.showDeviationNavigation,fo=so.showOpenNodeRef,po=so.adjustScrollForPopup,mo=c(function(e,n,i,t,o){var r,l="string"==typeof t?h(t).trim():h(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;oi();var c="left";(null===(r=On.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var e,i,t,o;if("string"==typeof n&&n.includes(y)){var r=n.split(y),l="".concat(r[0]).concat(y).concat(r[1]);return"right"===c?null===(e=ji.current[l])||void 0===e?void 0:e.current:null===(i=ki.current[l])||void 0===i?void 0:i.current}return"right"===c?null===(t=ji.current[n])||void 0===t?void 0:t.current:null===(o=ki.current[n])||void 0===o?void 0:o.current};if(i)return ot(),sn(new Set),fn([]),_n.current=[],void(l&&(ft(n),requestAnimationFrame(function(){var e=a()||u;Qn({open:!0,anchorEl:e,summary:t,displayImpact:o})})));ft(n),l?requestAnimationFrame(function(){rt(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||u;Qn({open:!0,anchorEl:e,summary:t,displayImpact:o})}})}):requestAnimationFrame(function(){rt(n,i,{toggleIfSame:!1,sourceSide:c})})},[rt,oi,Qn,ot,ft]),go=l(function(){var e;if(!Ve)return null;var n=null===(e=null==Ve?void 0:Ve.id)||void 0===e?void 0:e.split(":")[0];for(var i in Ci){if((Ci[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ve,Ci]),ho=r({id:null,triggerMs:null}),So=r(null);u(function(){var i;if(null==Ve?void 0:Ve.id){var t=Number(Ve.trigger),o=ho.current;if((null==o?void 0:o.triggerMs)!==t){if(!(Ve.id.includes(":")&&/:\d+$/.test(Ve.id)))return ho.current={id:Ve.id,triggerMs:t},void zt(Ve.id);var r=null===(i=null==Ve?void 0:Ve.id)||void 0===i?void 0:i.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";So.current!==Ve.id&&(Zn(),oi(),ot(),sn(new Set),fn([]),_n.current=[],So.current=Ve.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},p=function(){var i,o,r,u;if(!a){var m=function(){ho.current={id:Ve.id,triggerMs:t}},g=null,h=null;for(var S in Ci){var x=Ci[S].find(function(e){return e.id===l});if(x){g=S,h=x;break}}if(h&&g){var R=Ri.findIndex(function(e){return e.id===g}),b=yi.findIndex(function(e){return e.id===g}),C=-1===R&&-1!==b,w=f(Ri,h.id),_=f(yi,h.id);if(w&&!_&&!C){var B=w.split("-"),F=Number(B[0]);if(Ge){var E=null===(o=null===(i=Ri[F])||void 0===i?void 0:i.refIndexes)||void 0===o?void 0:o[0],I=yi.findIndex(function(e){return e.selfIndex===E});-1!==I&&(F=I)}_=n([F],B.slice(1),!0).join("-")}if(w||_){var T=w?Number(w.split("-")[0]):R,A=_?Number(_.split("-")[0]):b,D=Ri[T],k=yi[A],j=D&&!D.title&&!D.content,O=k&&!k.title&&!k.content,L=C||(!w&&!!_||j&&!O);if(L){if(!(Ge?!!ut["right-".concat(A)]:!!ut[String(A)])&&A>=0)return vt(A,"right"),s+=1,void(d=setTimeout(p,450))}else if(!(Ge?!!ut["left-".concat(T)]:!!ut[String(T)])&&T>=0)return vt(T,"left"),s+=1,void(d=setTimeout(p,450));var P,N=w||"",z=_||"",H="".concat(h.id).concat(y).concat(c).concat(y).concat(N).concat(y).concat(z),M="".concat(h.id).concat(y).concat(c),q=null===(r=ki.current[M])||void 0===r?void 0:r.current,W=null===(u=ji.current[M])||void 0===u?void 0:u.current,V=L||!q&&!!W,K=V?W:q;if(P=Ge?V?On.current:Hn.current:kn.current,K&&P){var Y=K.getBoundingClientRect();if(0===Y.height)return void((s+=1)<2?d=setTimeout(p,v):m());var J=P.getBoundingClientRect(),X=Y.top-J.top+P.scrollTop-J.height/2+Y.height/2,$=w&&w.includes("-")||_&&_.includes("-"),U=function(){var n,i,t,o,r;if(!a){m();var l=K instanceof Element?window.getComputedStyle(K).color:"";q&&(q.style.transition="box-shadow 300ms ease-in-out",q.style.boxShadow="0 0 10px ".concat(l)),W&&(W.style.transition="box-shadow 300ms ease-in-out",W.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){q&&(q.style.boxShadow=""),W&&(W.style.boxShadow="")},2e3);var u=(null===(i=null===(n=h.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===i?void 0:i[c])||h,s=(null===(t=h.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||h.evaluation_outputs;if(!(!!q&&!!W)){var d=V?(null===(o=ji.current[$?M:A])||void 0===o?void 0:o.current)||W:(null===(r=ki.current[$?M:T])||void 0===r?void 0:r.current)||q;return po(d,function(){Qn({open:!0,anchorEl:d,displayImpact:Ve.displayImpact,summary:e(e({},u),{evaluation_outputs:s})})},{skipScroll:!0}),void(null==Ke||Ke())}rt(H,!1,{toggleIfSame:!1,sourceSide:C?"right":"left",onReady:function(){var n,i;m();var t=V?(null===(n=ji.current[M])||void 0===n?void 0:n.current)||W:(null===(i=ki.current[M])||void 0===i?void 0:i.current)||q;Qn({open:!0,anchorEl:t,displayImpact:Ve.displayImpact,summary:e({},u)}),null==Ke||Ke()}})}};Math.abs(P.scrollTop-X)<=2?U():(Mn.current=X,qn.current=U,P.scrollTo({top:X,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(qn.current){Mn.current=null;var e=qn.current;qn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(p,v):m()}else(s+=1)<2?d=setTimeout(p,v):m()}else(s+=1)<2?d=setTimeout(p,v):m()}};return d=setTimeout(p,v),function(){a=!0,d&&clearTimeout(d)}}}},[Ve,Ci,Ri,yi,Ge,ut,vt,rt,Qn,zt]),u(function(){var n,i,t;if(Gn.open){var o=Gn.anchorEl;if(o&&!o.isConnected){var r=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||Object.keys(ki.current).find(function(e){var n,i;return(null===(i=null===(n=ki.current[e])||void 0===n?void 0:n.current)||void 0===i?void 0:i.textContent)===o.textContent})||Object.keys(ji.current).find(function(e){var n,i;return(null===(i=null===(n=ji.current[e])||void 0===n?void 0:n.current)||void 0===i?void 0:i.textContent)===o.textContent});if(r){var l=(null===(i=ji.current[r])||void 0===i?void 0:i.current)||(null===(t=ki.current[r])||void 0===t?void 0:t.current);l&&l.isConnected&&Qn(function(n){return e(e({},n),{anchorEl:l})})}}}},[Gn.open,Gn.anchorEl,mn,an,ut]);var xo=Vn.open,Ro=Vn.sectionIdx,yo=Vn.isOrphan,bo=Vn.badgeStyle,Co=Vn.anchorEl,wo=Vn.sectionAnchorEl;u(function(){var n;if(xo&&null!=Ro&&Ro!==Rt){var i="string"==typeof Ro?Ro.split(y)[0]:null,t=i&&"string"==typeof i&&Ri.find(function(e){return e.id===i})||null,o=i&&"string"==typeof i&&yi.find(function(e){return e.id===i})||null,r="number"==typeof Ro?Ri[Ro]||null:t||i&&((null===(n=null==ke?void 0:ke.nodes)||void 0===n?void 0:n[i])||(null==ke?void 0:ke[i]))||null,l="number"==typeof Ro?yi[Ro]||null:o,u=Ot(Co,r,l,Ro,yo,bo);Kn(function(n){return n.open?n.cognitiveData===u.cognitiveData&&n.deviationData===u.deviationData&&n.sectionTitle===u.sectionTitle&&n.refSectionTitle===u.refSectionTitle?n:e(e(e({},n),u),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[xo,Ro,yo,bo,Co,wo,Ri,yi,ke,We,Ot]);var _o=c(function(e){var n=e.section,t=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,s=e.sectionOffset;return i(H,{section:n,keyPath:t,depth:r,columnKey:u,parentNodeId:a,sectionOffset:s})},[]),Bo=l(function(){return Ri.map(function(e,n){var t;return i(M,{section:e,idx:n},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(n))})},[Ri]),Fo=l(function(){return yi.map(function(e,n){var t;return i(q,{section:e,idx:n},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(n))})},[yi]),Eo=r(Lt);u(function(){Eo.current=Lt},[Lt]);var Io=r(mo);u(function(){Io.current=mo},[mo]);var To=r(co);u(function(){To.current=co},[co]);var Ao=r(vt);u(function(){Ao.current=vt},[vt]);var Do=r(dt);u(function(){Do.current=dt},[dt]);var ko=r(_o);u(function(){ko.current=_o},[_o]);var jo=r(ot);u(function(){jo.current=ot},[ot]);var Oo=l(function(){return{maintainRelativeOrder:!!Ge,showDeviationBadges:Ze,isProposingFix:Je,proposingFixNodeId:Xe,isRedlineFlow:$e,isSideBySide:Wi,activeSideBySideSection:$i,scrollSyncLocked:mn,toggleScrollSyncLocked:mt,summaryPopupAnchorEl:Gn.anchorEl,connectedSections:an,proposedSections:Ri,existingSections:yi,deviationNumberRegistry:wi,treeData:ke,displayConfig:He,resolvedMarkdownStyles:Dn,unifiedNumbering:gt,expandedSections:ut,expandedSubSections:at,setExpandedSubSections:st,getSectionCompareStyle:Vt,getSubSectionCompareStyle:Kt,getBadgeRef:Mi,getSectionRowRef:zi,getSubSectionRef:Hi,sectionLeftRefs:Ai,sectionRightRefs:Di,sectionRowRefs:Ni,sectionRightRowRefs:Oi,subSectionLeftRefs:Li,subSectionRightRefs:Pi,lhsBadgeRefs:ki,rhsBadgeRefs:ji,openMoreFunctionsPopup:Bt,handleOpenSummaryPopup:Ft,openSummaryPopup:Ft,handleCloseSummaryPopup:Et,toggleSection:It,handleSubSectionToggle:Tt,renderSubSectionAccordion:At,resetSideBySide:Dt,setConnectedSections:sn,setConnectedLines:fn,cachedConnectedPositions:_n,showDeviationNavigation:vo,showOpenNodeRef:fo,deviationNodeIdToView:null==Ve?void 0:Ve.id,deviationTargetParentId:go}},[Ge,Ze,Je,Xe,$e,Wi,$i,mn,mt,Gn.anchorEl,an,Ri,yi,wi,ke,He,Dn,gt,ut,at,st,Vt,Kt,Mi,zi,Hi,vo,fo,Ve,go]);return i(V,e({value:Oo},{children:t(a,e({ref:jn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Ge?{}:{overflow:"visible"}),{position:"relative"})},{children:[nn&&i(a,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(D,{})})),Gn.open&&i(W,{open:Gn.open,anchorEl:Gn.anchorEl,containerEl:Mt.current,clipTopEl:xn.current,scrollContainerEl:kn.current,onClose:co,summary:Gn.summary,displayImpact:Gn.displayImpact,isScrollLocked:mn}),i(A,{open:Yn.open,anchorEl:Yn.anchorEl,sectionTitle:Yn.sectionTitle,referenceSectionTitle:Yn.refSectionTitle,onClose:ri,onOpenCognitiveCompare:ii,onOpenSideBySide:uo,onConnect:Pt,isConnected:ao,isOrphan:Yn.isOrphan}),Vn.open&&i(T,{open:Vn.open,popupRef:ni,position:Xn,popupConfig:Me,onClose:function(){$n(null),Kn(function(n){return e(e({},n),{open:!1})}),ei(null)},markdownStyles:Pe,sectionTitle:fi,referenceSectionTitle:mi,cognitiveData:Vn.cognitiveData,anchorEl:Vn.anchorEl,sectionAnchorEl:Vn.sectionAnchorEl,scrollContainerEl:kn.current,badgeStyle:Vn.badgeStyle,docData:Vn.docData,deviationData:Vn.deviationData,isLoading:Vn.isLoading}),i(s,e({open:!!rn,autoHideDuration:8e3,onClose:function(){return ln(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(d,e({onClose:function(){return ln(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:rn}))})),i(z,{componentHeaderText:De,displayConfig:He,maintainRelativeOrder:Ge,onCollapseAll:eo,showCollapseAll:no,onToggleView:function(e){tn(!0),setTimeout(function(){Qe(!e),gn(!1),ot(),Zn(),sn(new Set),fn([]),_n.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){tn(!1)},600)})})},50)}}),i(a,e({ref:kn,onScroll:Zt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Ge?"hidden":"auto",borderTop:St&&xt?"none":"1.5px solid #EEF0F4"}},{children:i(a,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Ge?{flex:1,minHeight:0}:{})},{children:t(a,e({ref:Sn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Ge?{flex:1,overflow:"visible"}:{})},{children:[i($,{svgContainerRef:hn,svgDimensions:Qt,isResizing:Yi,overallConnector:Ut,rootDeviationStyle:Ct,lines:Xt,isSideBySide:Wi,activeSideBySideSection:$i,isArrowVisible:Vi,maintainRelativeOrder:Ge,proposedSections:Ri,existingSections:yi,cognitivePopup:Vn,activeBadgeId:Un,closeCognitivePopup:oi,setActiveBadgeId:ei,openCognitivePopupFromState:ti,buildSectionPopupState:Ot,connectedLines:vn,pathRefs:wn}),t(a,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},Ge?{flex:1,overflow:"visible"}:{})},{children:[i(a,e({ref:xn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,e({title:di,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:di}))}))})),t(a,e({ref:Hn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},Ge?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Nn,style:{width:"100%",height:"0px",flexShrink:0}}),Bi&&Bo,i("div",{ref:zn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(a,e({ref:Mt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(a,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(a,e({onClick:function(n){n.stopPropagation(),Vn.open&&Un===Rt?oi():(ei(Rt),ti(Ot(n.currentTarget,{title:"",content:"",evaluationResult:yt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Rt,!0,e(e({},Ct),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Ct.badgeBg,color:Ct.badgeText,border:"1px solid ".concat(Ct.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=bt?bt:i(k,{}),i(a,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(m,{})})),i(p,{size:11,style:{transform:Vn.open&&Un===Rt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(a,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},Ge?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Xi&&i(g,{sections:11}),i(a,e({ref:Rn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,e({title:gi,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:gi}))}))})),t(a,e({ref:On,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},Ge?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Ln,style:{width:"100%",height:"0px",flexShrink:0}}),Bi&&Fo,i("div",{ref:Pn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{U as default};
|
|
1
|
+
import{__assign as e,__spreadArray as n}from"tslib";import{jsx as i,jsxs as t}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 s,Alert as d,Tooltip as v,Typography as f}from"@mui/material";import{ChevronDown as p}from"lucide-react";import{ButtonCognitiveIcon as g}from"../../assests/svg/ButtonCognitiveIcon.js";import m from"./OverlayComponent.js";import{safeStringify as h,extractDeviationScore as S,generateColorPalette as x,findKeyPathByNodeId as R,DEVIATION_BADGE_SEPARATOR as y,hasMeaningfulRedlineTags as b,scrollAndHighlightClause as C}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as w,DEFAULT_FIELD_CONFIG as _,DEFAULT_COMPARISON_CONFIG as B}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as F,EMPTY_SUMMARY_POPUP_STATE as E,DEFAULT_COMPONENT_HEADER_TEXT as I}from"./CognitiveCompareConstants.js";import T from"./CognitivePopup.js";import A from"./MoreFunctionsPopup.js";import D from"./LoaderComponent.js";import k from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as O}from"./hooks/useCompareData.js";import{useComparePopups as j}from"./hooks/useComparePopups.js";import{useSectionRefs as L}from"./hooks/useSectionRefs.js";import{useAccordionState as P}from"./hooks/useAccordionState.js";import{useDeviationNavigation as N}from"./hooks/useDeviationNavigation.js";import z from"./components/CompareHeader.js";import H from"./components/SubSectionAccordion.js";import M from"./components/LHSSectionRow.js";import q from"./components/RHSSectionRow.js";import W from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as V}from"./CompareContext.js";import{useStyleHelpers as K}from"./hooks/useStyles.js";import{useResizeHandler as Y}from"./hooks/useResizeHandler.js";import{useLinesCalculator as J}from"./hooks/useLinesCalculator.js";import{useSideBySide as X}from"./hooks/useSideBySide.js";import $ from"./components/SvgConnectors.js";var U=function(U){var G,Q,Z,ee,ne,ie,te,oe,re,le,ue,ce,ae,se,de,ve,fe,pe,ge,me,he,Se,xe,Re,ye,be,Ce,we,_e,Be,Fe,Ee,Ie,Te,Ae,De=U.componentHeaderText,ke=void 0===De?I:De,Oe=U.treeData,je=U.comparisonConfig,Le=U.leftColumnTitleText,Pe=U.rightColumnTitleText,Ne=U.markdownStyles,ze=U.resetTrigger,He=U.displayConfig,Me=void 0===He?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:He,qe=U.popupConfig,We=U.deviationData,Ve=void 0===We?{}:We,Ke=U.deviationNodeIdToView,Ye=U.resetDeviationNodeId,Je=U.isProposingFix,Xe=void 0!==Je&&Je,$e=U.proposingFixNodeId,Ue=U.isRedlineFlow,Ge=o(Me.maintainRelativeOrder),Qe=Ge[0],Ze=Ge[1],en=null!==(G=null==Me?void 0:Me.expandLevels)&&void 0!==G?G:0,nn=!!(null==Me?void 0:Me.expandAllSections),tn=!!Qe||!!(null==Me?void 0:Me.showDeviationBadges),on=o(!1),rn=on[0],ln=on[1],un=o(null),cn=un[0],an=un[1],sn=o(null===(Z=null!==(Q=null==Oe?void 0:Oe.newEvaluationResult)&&void 0!==Q?Q:null==Me?void 0:Me.enableDeviationSchemaBackwardCompatibility)||void 0===Z||Z)[0],dn=o(new Set),vn=dn[0],fn=dn[1],pn=o([]),gn=pn[0],mn=pn[1],hn=o(!1),Sn=hn[0],xn=hn[1],Rn=r(null),yn=r(null),bn=r(null),Cn=r(null),wn=r(null),_n=r(!1),Bn=r(null),Fn=r({}),En=r([]),In=r(function(){}),Tn=r(null),An=r(function(){}),Dn=l(function(){return JSON.stringify(Ve||{})},[JSON.stringify(Ve)]),kn=l(function(){return Ve||{}},[Dn]),On=l(function(){return(null==Oe?void 0:Oe.cognitive_decisioning)||{}},[Oe]),jn=l(function(){return e(e({},w),Ne)},[Ne]),Ln=r(null),Pn=r(null),Nn=r(null),zn=r(null),Hn=r(null),Mn=r(null),qn=r(null),Wn=r(null),Vn=r(null),Kn=r(null),Yn=j(Ln),Jn=Yn.cognitivePopup,Xn=Yn.setCognitivePopup,$n=Yn.moreFunctions,Un=Yn.setMoreFunctions,Gn=Yn.position,Qn=Yn.setPosition,Zn=Yn.activeBadgeId,ei=Yn.summaryPopup,ni=Yn.setSummaryPopup,ii=Yn.closeSummaryPopup,ti=Yn.setActiveBadgeId,oi=Yn.popupRef,ri=Yn.handleOpenCognitiveCompare,li=Yn.openCognitivePopupFromState,ui=Yn.closeCognitivePopup,ci=Yn.closeMoreFunctionsPopup,ai=l(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==je?void 0:je.fields)&&void 0!==e?e:_,thresholds:{high:null!==(i=null===(n=null==je?void 0:je.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:B.thresholds.high,medium:null!==(o=null===(t=null==je?void 0:je.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:B.thresholds.medium,exact:null!==(l=null===(r=null==je?void 0:je.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:B.thresholds.exact}}},[je]),si=o(null),di=si[0];si[1];var vi=null===(ie=null===(ee=null==Oe?void 0:Oe.documents)||void 0===ee?void 0:ee[null===(ne=null==Oe?void 0:Oe.input_index_map)||void 0===ne?void 0:ne[0]])||void 0===ie?void 0:ie.title,fi=null===(re=null===(te=null==Oe?void 0:Oe.documents)||void 0===te?void 0:te[null===(oe=null==Oe?void 0:Oe.input_index_map)||void 0===oe?void 0:oe[1]])||void 0===re?void 0:re.title,pi=h(Le||vi||"Uploaded Contract"),gi=null===(ae=null===(ce=null===(le=null==Oe?void 0:Oe.documents)||void 0===le?void 0:le[null===(ue=null==Oe?void 0:Oe.input_index_map)||void 0===ue?void 0:ue[0]])||void 0===ce?void 0:ce.metadata)||void 0===ae?void 0:ae.file_name,mi=h(gi),hi=null===(fe=null===(ve=null===(se=null==Oe?void 0:Oe.documents)||void 0===se?void 0:se[null===(de=null==Oe?void 0:Oe.input_index_map)||void 0===de?void 0:de[1]])||void 0===ve?void 0:ve.metadata)||void 0===fe?void 0:fe.file_name,Si=h(hi),xi=h(Pe||fi||"Reference Template"),Ri=O(Oe,Qe,kn,ai,sn),yi=Ri.activeProposed,bi=Ri.existingRule,Ci=Ri.proposedSections,wi=Ri.existingSections,_i=Ri.visibleFields,Bi=Ri.parentDeviationRecord,Fi=Ri.deviationNumberRegistry,Ei=Ri.parseError;u(function(){Ei&&an("Failed to load comparison: ".concat(Ei))},[Ei]);var Ii=Ci.length>0||wi.length>0,Ti=l(function(){if(!Ue)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";b(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Ci),i(wi),"".concat(e,":").concat(n)},[Ue,Ci,wi]);u(function(){if(Ci.length||wi.length)if(nn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=Qe?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(Ci,"left"),i(wi,"right"),dt(e),ft(n)}else if(en>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=Qe?"".concat(n,"-").concat(r):String(r);t[u]=!0}var c=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&c(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&c(e.subsections,String(r),2)})};r(Ci,"left",en),r(wi,"right",en),dt(t),ft(o)}},[nn,en,Ci,wi,Qe]);var Ai=L(_i.map(function(e){return e.key}),Math.max(Ci.length,wi.length)),Di=Ai.leftRefs,ki=Ai.rightRefs,Oi=Ai.sectionLeftRefs,ji=Ai.sectionRightRefs,Li=Ai.lhsBadgeRefs,Pi=Ai.rhsBadgeRefs,Ni=Ai.sectionRightRowRefs,zi=Ai.subSectionLeftRefs,Hi=Ai.subSectionRightRefs,Mi=Ai.sectionRowRefs,qi=Ai.getSectionRowRef,Wi=Ai.getSubSectionRef,Vi=Ai.getBadgeRef,Ki=X({maintainRelativeOrder:Qe,proposedSections:Ci,existingSections:wi,leftContainerRef:Wn,rightContainerRef:Nn,scrollContainerRef:Ln,sectionLeftRefs:Oi,sectionRightRefs:ji,subSectionLeftRefs:zi,subSectionRightRefs:Hi,lhsBadgeRefs:Li,rhsBadgeRefs:Pi,sectionRowRefs:Mi,sectionRightRowRefs:Ni,rhsTopSpacerRef:zn,rhsBottomSpacerRef:Hn,lhsTopSpacerRef:Mn,lhsBottomSpacerRef:qn,calculateLinesRef:In,setConnectedSections:fn,setConnectedLines:mn,cachedConnectedPositions:En,closeMoreFunctionsPopup:ci,setErrorToast:an,moreFunctions:$n,closeSummaryPopup:ii}),Yi=Ki.isSideBySide,Ji=Ki.isArrowVisible,Xi=Ki.setIsArrowVisible,$i=Ki.isResizing,Ui=Ki.setIsResizing,Gi=Ki.isSideBySideLoading,Qi=Ki.activeSideBySideSection,Zi=Ki.scrollLock,et=Ki.sideBySideCacheRef,nt=Ki.isSideBySideRef,it=Ki.activeSideBySideRightSectionRef,tt=Ki.activeSideBySideSectionRef,ot=Ki.sideBySideLineRef,rt=Ki.highlightedClauseRefs,lt=Ki.clearClauseHighlight,ut=Ki.resetSideBySide,ct=Ki.activateSideBySide,at=P({maintainRelativeOrder:!!Qe,proposedSections:Ci,existingSections:wi,activeSideBySideSection:Qi,connectedSections:vn,resetSideBySide:ut,setConnectedSections:fn,setConnectedLines:mn,cachedConnectedPositions:En,svgContainerRef:Rn,isAnimatingRef:_n,animationTimerRef:Bn,calculateLinesRef:In,sectionLeftRefs:Oi,sectionRightRefs:ji,subSectionLeftRefs:zi,subSectionRightRefs:Hi}),st=at.expandedSections,dt=at.setExpandedSections,vt=at.expandedSubSections,ft=at.setExpandedSubSections,pt=at.handleSubSectionToggle,gt=at.toggleSection,mt=at.forceExpandCrossWiredSections,ht=function(){var e,n;if(null!=Qi){var i=null===(e=Oi.current[Qi])||void 0===e?void 0:e.current,t=null===(n=ji.current[Qi])||void 0===n?void 0:n.current,o=Nn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),c=r.top-u.top,a=l.top-u.top-c;o.scrollBy({top:a,behavior:"smooth"})}}},St=c(function(e){null==e||e.stopPropagation(),xn(function(e){var n=!e;return n&&requestAnimationFrame(function(){ht()}),n})},[ht]);u(function(){Ue&&"off"!==Ti&&"0:0"!==Ti&&(et.current=null,En.current=[],requestAnimationFrame(function(){var e;null===(e=In.current)||void 0===e||e.call(In)}))},[Ue,Ti]);var xt=l(function(){var e=new Map,n=new Map,i=1;if(Qe)Ci.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),wi.forEach(function(t){if(t.id){var o=Ci.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Ci.length,wi.length),o=0;o<t;o++){var r=Ci[o],l=wi[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Ci,wi,Qe]),Rt=bi.analysis,yt=h(null===(ge=null===(pe=null==Rt?void 0:Rt.rule_difference_comparison)||void 0===pe?void 0:pe.summary)||void 0===ge?void 0:ge.overall_summary),bt=!!yt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Ct=null!==(me=null==Oe?void 0:Oe.base_root_id)&&void 0!==me?me:"-1";null==Oe||Oe[Ct];var wt=sn?null!==(Ee=null!==(_e=Ve&&(null===(we=null==Ve?void 0:Ve[Ct])||void 0===we?void 0:we.evaluation_result))&&void 0!==_e?_e:null===(Fe=null===(Be=null==Oe?void 0:Oe.nodes)||void 0===Be?void 0:Be[Ct])||void 0===Fe?void 0:Fe.evaluation_result)&&void 0!==Ee?Ee:null:null!==(Ce=null!==(xe=Ve&&(null===(Se=null===(he=null==Ve?void 0:Ve[Ct])||void 0===he?void 0:he.evaluation_result)||void 0===Se?void 0:Se[0]))&&void 0!==xe?xe:null===(be=null===(ye=null===(Re=null==Oe?void 0:Oe.nodes)||void 0===Re?void 0:Re[Ct])||void 0===ye?void 0:ye.evaluation_result)||void 0===be?void 0:be[0])&&void 0!==Ce?Ce:null,_t=S(wt),Bt=x(null!==(Ae=null===(Te=null===(Ie=null==wt?void 0:wt.evaluation_outputs)||void 0===Ie?void 0:Ie.metadata)||void 0===Te?void 0:Te.label_color)&&void 0!==Ae?Ae:F),Ft=r(ut);u(function(){Ft.current=ut},[ut]);var Et=r(ui);u(function(){Et.current=ui},[ui]);var It=c(function(e,n,i,t,o,r){return Ao.current(e,n,i,t,o,r)},[]),Tt=c(function(e,n,i,t,o){return Do.current(e,n,i,t,o)},[]),At=c(function(){return ko.current()},[]),Dt=c(function(e,n){return Oo.current(e,n)},[]),kt=c(function(e){return jo.current(e)},[]),Ot=c(function(e){return Lo.current(e)},[]),jt=c(function(){return Po.current()},[]),Lt=c(function(){var e,n;lt(),null===(e=Ft.current)||void 0===e||e.call(Ft),xn(!1),fn(new Set),mn([]),En.current=[],Qt([]),eo(null),ni(E),null===(n=Et.current)||void 0===n||n.call(Et),requestAnimationFrame(function(){var e;null===(e=In.current)||void 0===e||e.call(In)})},[]),Pt=r(Lt);u(function(){Pt.current=Lt},[Lt]),u(function(){ze&&Pt.current()},[ze]);var Nt=c(function(n,i,t,o,r,l,u){var c,a,s,d=h(null==i?void 0:i.id)||h(null==t?void 0:t.id)||"",v=(d?On[d]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},f=null!==(a=null===(c=Mi.current[o])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(s=null==Me?void 0:Me.isLoading)&&void 0!==s&&s,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:v,anchorEl:n,sectionAnchorEl:f,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Oe?void 0:Oe.documents,input_index_map:null==Oe?void 0:Oe.input_index_map},deviationData:function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[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 i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(y)))return u(l);var c=o.split(y)[1];if(!c)return l;var a=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==a?void 0:a.deviation_entries)||void 0===n?void 0:n[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return s?e(e(e({},a),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[On,Oe]),zt=c(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),$n.open&&$n.sectionIdx===o)ci();else{var u=e.currentTarget,c="left";(null===(l=Nn.current)||void 0===l?void 0:l.contains(u))&&(c="right");lt(),nt.current&&ut(),fn(new Set),mn([]),En.current=[],ui(),ei.open?vo():ii(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(y)){var r=o.split(y),l="".concat(r[0]).concat(y).concat(r[1]);return"right"===c?null===(e=Pi.current[l])||void 0===e?void 0:e.current:null===(n=Li.current[l])||void 0===n?void 0:n.current}return"right"===c?null===(i=Pi.current[o])||void 0===i?void 0:i.current:null===(t=Li.current[o])||void 0===t?void 0:t.current}()||u;Un(Nt(e,n,t,o,i,r))})}},[$n.open,$n.sectionIdx,ci,ii,Nt]),Ht=c(function(){var e=$n.sectionIdx,n=$n.isOrphan;ci(),ii(),null!==e&&(n?an("No counterpart exists to connect to."):(mt(e),lt(),nt.current&&ut(),mn([]),En.current=[],fn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){In.current&&In.current()},50)))},[$n.sectionIdx,$n.isOrphan,ci,ii,ut]),Mt=c(function(){var e=wn.current;if(e){wn.current=null;var n=Ci.findIndex(function(n){return n.id===e}),i=wi.findIndex(function(n){return n.id===e}),t=-1===n?R(Ci,e):null,o=-1===i?R(wi,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(rt.current.add(r),C(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Qe)-1!==r&&Wn.current&&c(function(){return u(n,t,Oi,zi)},Wn.current),-1!==l&&Nn.current&&c(function(){return u(i,o,ji,Hi)},Nn.current);else{var a=Ln.current;if(!a)return;c(function(){return-1!==r?u(n,t,Oi,zi):u(i,o,ji,Hi)},a)}}},[Ci,wi,Qe,Oi,ji,zi,Hi,Wn,Nn,Ln]),qt=c(function(n){if(n){lt(),ut(),fn(new Set),mn([]),En.current=[],ii(),ui();var i=Ci.findIndex(function(e){return e.id===n}),t=wi.findIndex(function(e){return e.id===n}),o=-1===i?R(Ci,n):null,r=-1===t?R(wi,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;wn.current=n,dt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=Qe?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=Qe?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),ft(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){wn.current===n&&Wt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Ci,wi,Qe,dt,ft,ut,ii,ui]),Wt=r(Mt);u(function(){Wt.current=Mt},[Mt]);var Vt=r(null);u(function(){if(di){var e=ai.fields.find(function(e){return e.analysisKey===di||e.key===di});if(e){var n=Di.current[e.key]||ki.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[di,ai.fields]);var Kt=c(function(e){var n,i,t,o,r,l,u,c,a,s=null===(n=null==Rt?void 0:Rt.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===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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}},[Rt]),Yt=K({proposedSections:Ci,existingSections:wi,maintainRelativeOrder:Qe,cognitiveMap:On,deviationData:Ve,treeData:Oe,resolvedComparisonConfig:ai}),Jt=Yt.getSectionCompareStyle,Xt=Yt.getSubSectionCompareStyle,$t=Yt.getDeviationStyleByKey,Ut=J({containerRef:yn,leftContainerRef:Wn,rightContainerRef:Nn,svgContainerRef:Rn,pathRefs:Fn,leftHeaderRef:bn,rightHeaderRef:Cn,proposedSections:Ci,existingSections:wi,visibleFields:_i,leftRefs:Di,rightRefs:ki,sectionLeftRefs:Oi,sectionRightRefs:ji,subSectionLeftRefs:zi,subSectionRightRefs:Hi,lhsBadgeRefs:Li,rhsBadgeRefs:Pi,sectionRowRefs:Mi,expandedSections:st,expandedSubSections:vt,connectedSections:vn,isSideBySide:Yi,activeSideBySideSection:Qi,maintainRelativeOrder:Qe,cognitiveMap:On,getSectionCompareStyle:Jt,getSubSectionCompareStyle:Xt,getDeviationStyleByKey:$t,isArrowVisible:Ji,isAnimatingRef:_n,isSideBySideRef:nt,sideBySideCacheRef:et,sideBySideLineRef:ot,activeSideBySideSectionRef:tt,activeSideBySideRightSectionRef:it,connectedLines:gn,setConnectedLines:mn,cachedConnectedPositions:En,calculateLinesRef:In,resizeTimerRef:Tn,scrollLock:Zi,scrollSyncLocked:Sn,handleResizeRef:An,activeProposed:yi,existingRule:bi,analysisData:Rt,pendingScrollTargetRef:Vn,pendingScrollCallbackRef:Kn,resolvedComparisonConfig:ai,getFieldData:Kt}),Gt=Ut.lines,Qt=Ut.setLines,Zt=Ut.overallConnector,eo=Ut.setOverallConnector,no=Ut.svgDimensions,io=Ut.handleColumnScroll;u(function(){ei.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=In.current)||void 0===e||e.call(In)})})},[ei.anchorEl,Sn]);var to=c(function(){lt(),xn(!1),dt({}),ft({}),ut(),fn(new Set),mn([]),En.current=[],ii(),ui(),ci(),requestAnimationFrame(function(){In.current&&In.current()})},[dt,ft,ut,ii,ui,ci]);u(function(){Yi||0!==vn.size||xn(!1)},[Yi,vn]);var oo=l(function(){return Object.values(st).some(Boolean)||Object.values(vt).some(Boolean)},[st,vt]),ro=r(null),lo=r(0),uo=r(0),co=r(0),ao=Y({timerRef:ro,ruleComponentRef:Pn,scrollContainerRef:Ln,containerRef:yn,maintainRelativeOrder:Qe,proposedSections:Ci,existingSections:wi,isSideBySideRef:nt,activeSideBySideSectionRef:tt,activeSideBySideRightSectionRef:it,sectionRowRefs:Mi,sectionRightRowRefs:Ni,sectionLeftRefs:Oi,sectionRightRefs:ji,subSectionLeftRefs:zi,subSectionRightRefs:Hi,lhsBadgeRefs:Li,rhsBadgeRefs:Pi,leftContainerRef:Wn,rightContainerRef:Nn,calculateLinesRef:In,handleResizeRef:An,setIsResizing:Ui,setIsArrowVisible:Xi,sideBySideCacheRef:et,cachedConnectedPositions:En}).handleResize;u(function(){An.current=ao},[ao,An]),u(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.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,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Pn.current&&o.push(e(Pn.current,lo,n,function(){return An.current()},function(){})),Ln.current&&o.push(e(Ln.current,uo,i,function(){return An.current()},function(){return In.current()})),yn.current&&o.push(e(yn.current,co,t,function(){return An.current()},function(){return In.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),u(function(){nt.current=Yi},[Yi]),u(function(){tt.current=Qi},[Qi]);var so=c(function(){var e,n=$n.sectionIdx,i=$n.isOrphan;if(ii(),null!=n){var t="left";$n.anchorEl&&(null===(e=Nn.current)||void 0===e?void 0:e.contains($n.anchorEl))&&(t="right"),mt(n),ct(n,i,{sourceSide:t})}},[ct,$n.isOrphan,$n.sectionIdx,$n.anchorEl,ii]),vo=c(function(){ii(),ut(),fn(new Set),mn([]),En.current=[]},[ii,ut]),fo=null!==$n.sectionIdx&&vn.has($n.sectionIdx),po=N({proposedSections:Ci,existingSections:wi,parentDeviationRecord:Bi,expandedSections:st,maintainRelativeOrder:!!Qe,scrollContainerRef:Ln,leftContainerRef:Wn,rightContainerRef:Nn,lhsBadgeRefs:Li,rhsBadgeRefs:Pi}),go=po.showDeviationNavigation,mo=po.showOpenNodeRef,ho=po.adjustScrollForPopup,So=c(function(e,n,i,t,o){var r,l="string"==typeof t?h(t).trim():h(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;ui();var c="left";(null===(r=Nn.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var e,i,t,o;if("string"==typeof n&&n.includes(y)){var r=n.split(y),l="".concat(r[0]).concat(y).concat(r[1]);return"right"===c?null===(e=Pi.current[l])||void 0===e?void 0:e.current:null===(i=Li.current[l])||void 0===i?void 0:i.current}return"right"===c?null===(t=Pi.current[n])||void 0===t?void 0:t.current:null===(o=Li.current[n])||void 0===o?void 0:o.current};if(i)return ut(),fn(new Set),mn([]),En.current=[],void(l&&(mt(n),requestAnimationFrame(function(){var e=a()||u;ni({open:!0,anchorEl:e,summary:t,displayImpact:o})})));mt(n),l?requestAnimationFrame(function(){ct(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||u;ni({open:!0,anchorEl:e,summary:t,displayImpact:o})}})}):requestAnimationFrame(function(){ct(n,i,{toggleIfSame:!1,sourceSide:c})})},[ct,ui,ni,ut,mt]),xo=l(function(){var e;if(!Ke)return null;var n=null===(e=null==Ke?void 0:Ke.id)||void 0===e?void 0:e.split(":")[0];for(var i in Bi){if((Bi[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ke,Bi]),Ro=r({id:null,triggerMs:null}),yo=r(null);u(function(){var i;if(null==Ke?void 0:Ke.id){var t=Number(Ke.trigger),o=Ro.current;if((null==o?void 0:o.triggerMs)!==t){if(!(Ke.id.includes(":")&&/:\d+$/.test(Ke.id)))return Ro.current={id:Ke.id,triggerMs:t},void qt(Ke.id);var r=null===(i=null==Ke?void 0:Ke.id)||void 0===i?void 0:i.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";yo.current!==Ke.id&&(ii(),ui(),ut(),fn(new Set),mn([]),En.current=[],yo.current=Ke.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},p=function(){var i,o,r,u;if(!a){var g=function(){Ro.current={id:Ke.id,triggerMs:t}},m=null,h=null;for(var S in Bi){var x=Bi[S].find(function(e){return e.id===l});if(x){m=S,h=x;break}}if(h&&m){var R=Ci.findIndex(function(e){return e.id===m}),b=wi.findIndex(function(e){return e.id===m}),C=-1===R&&-1!==b,w=f(Ci,h.id),_=f(wi,h.id);if(w&&!_&&!C){var B=w.split("-"),F=Number(B[0]);if(Qe){var E=null===(o=null===(i=Ci[F])||void 0===i?void 0:i.refIndexes)||void 0===o?void 0:o[0],I=wi.findIndex(function(e){return e.selfIndex===E});-1!==I&&(F=I)}_=n([F],B.slice(1),!0).join("-")}if(w||_){var T=w?Number(w.split("-")[0]):R,A=_?Number(_.split("-")[0]):b,D=Ci[T],k=wi[A],O=D&&!D.title&&!D.content,j=k&&!k.title&&!k.content,L=C||(!w&&!!_||O&&!j);if(L){if(!(Qe?!!st["right-".concat(A)]:!!st[String(A)])&&A>=0)return gt(A,"right"),s+=1,void(d=setTimeout(p,450))}else if(!(Qe?!!st["left-".concat(T)]:!!st[String(T)])&&T>=0)return gt(T,"left"),s+=1,void(d=setTimeout(p,450));var P,N=w||"",z=_||"",H="".concat(h.id).concat(y).concat(c).concat(y).concat(N).concat(y).concat(z),M="".concat(h.id).concat(y).concat(c),q=null===(r=Li.current[M])||void 0===r?void 0:r.current,W=null===(u=Pi.current[M])||void 0===u?void 0:u.current,V=L||!q&&!!W,K=V?W:q;if(P=Qe?V?Nn.current:Wn.current:Ln.current,K&&P){var Y=K.getBoundingClientRect();if(0===Y.height)return void((s+=1)<2?d=setTimeout(p,v):g());var J=P.getBoundingClientRect(),X=Y.top-J.top+P.scrollTop-J.height/2+Y.height/2,$=w&&w.includes("-")||_&&_.includes("-"),U=function(){var n,i,t,o,r;if(!a){g();var l=K instanceof Element?window.getComputedStyle(K).color:"";q&&(q.style.transition="box-shadow 300ms ease-in-out",q.style.boxShadow="0 0 10px ".concat(l)),W&&(W.style.transition="box-shadow 300ms ease-in-out",W.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){q&&(q.style.boxShadow=""),W&&(W.style.boxShadow="")},2e3);var u=(null===(i=null===(n=h.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===i?void 0:i[c])||h,s=(null===(t=h.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||h.evaluation_outputs;if(!(!!q&&!!W)){var d=V?(null===(o=Pi.current[$?M:A])||void 0===o?void 0:o.current)||W:(null===(r=Li.current[$?M:T])||void 0===r?void 0:r.current)||q;return ho(d,function(){ni({open:!0,anchorEl:d,displayImpact:Ke.displayImpact,summary:e(e({},u),{evaluation_outputs:s})})},{skipScroll:!0}),void(null==Ye||Ye())}ct(H,!1,{toggleIfSame:!1,sourceSide:C?"right":"left",onReady:function(){var n,i;g();var t=V?(null===(n=Pi.current[M])||void 0===n?void 0:n.current)||W:(null===(i=Li.current[M])||void 0===i?void 0:i.current)||q;ni({open:!0,anchorEl:t,displayImpact:Ke.displayImpact,summary:e({},u)}),null==Ye||Ye()}})}};Math.abs(P.scrollTop-X)<=2?U():(Vn.current=X,Kn.current=U,P.scrollTo({top:X,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(Kn.current){Vn.current=null;var e=Kn.current;Kn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(p,v):g()}else(s+=1)<2?d=setTimeout(p,v):g()}else(s+=1)<2?d=setTimeout(p,v):g()}};return d=setTimeout(p,v),function(){a=!0,d&&clearTimeout(d)}}}},[Ke,Bi,Ci,wi,Qe,st,gt,ct,ni,qt]),u(function(){var n,i,t;if(ei.open){var o=ei.anchorEl;if(o&&!o.isConnected){var r=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||Object.keys(Li.current).find(function(e){var n,i;return(null===(i=null===(n=Li.current[e])||void 0===n?void 0:n.current)||void 0===i?void 0:i.textContent)===o.textContent})||Object.keys(Pi.current).find(function(e){var n,i;return(null===(i=null===(n=Pi.current[e])||void 0===n?void 0:n.current)||void 0===i?void 0:i.textContent)===o.textContent});if(r){var l=(null===(i=Pi.current[r])||void 0===i?void 0:i.current)||(null===(t=Li.current[r])||void 0===t?void 0:t.current);l&&l.isConnected&&ni(function(n){return e(e({},n),{anchorEl:l})})}}}},[ei.open,ei.anchorEl,Sn,vn,st]);var bo=Jn.open,Co=Jn.sectionIdx,wo=Jn.isOrphan,_o=Jn.badgeStyle,Bo=Jn.anchorEl,Fo=Jn.sectionAnchorEl;u(function(){var n;if(bo&&null!=Co&&Co!==Ct){var i="string"==typeof Co?Co.split(y)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(Ci,i):null,r=i&&"string"==typeof i?t(wi,i):null,l="number"==typeof Co?Ci[Co]||null:o||i&&((null===(n=null==Oe?void 0:Oe.nodes)||void 0===n?void 0:n[i])||(null==Oe?void 0:Oe[i]))||null,u="number"==typeof Co?wi[Co]||null:r,c=Nt(Bo,l,u,Co,wo,_o);Xn(function(n){return n.open?n.cognitiveData===c.cognitiveData&&n.deviationData===c.deviationData&&n.sectionTitle===c.sectionTitle&&n.refSectionTitle===c.refSectionTitle?n:e(e(e({},n),c),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[bo,Co,wo,_o,Bo,Fo,Ci,wi,Oe,Ve,Nt]);var Eo=c(function(e){var n=e.section,t=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,s=e.sectionOffset;return i(H,{section:n,keyPath:t,depth:r,columnKey:u,parentNodeId:a,sectionOffset:s})},[]),Io=l(function(){return Ci.map(function(e,n){var t;return i(M,{section:e,idx:n},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(n))})},[Ci]),To=l(function(){return wi.map(function(e,n){var t;return i(q,{section:e,idx:n},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(n))})},[wi]),Ao=r(zt);u(function(){Ao.current=zt},[zt]);var Do=r(So);u(function(){Do.current=So},[So]);var ko=r(vo);u(function(){ko.current=vo},[vo]);var Oo=r(gt);u(function(){Oo.current=gt},[gt]);var jo=r(pt);u(function(){jo.current=pt},[pt]);var Lo=r(Eo);u(function(){Lo.current=Eo},[Eo]);var Po=r(ut);u(function(){Po.current=ut},[ut]);var No=l(function(){return{maintainRelativeOrder:!!Qe,showDeviationBadges:tn,isProposingFix:Xe,proposingFixNodeId:$e,isRedlineFlow:Ue,isSideBySide:Yi,activeSideBySideSection:Qi,scrollSyncLocked:Sn,toggleScrollSyncLocked:St,summaryPopupAnchorEl:ei.anchorEl,connectedSections:vn,proposedSections:Ci,existingSections:wi,deviationNumberRegistry:Fi,treeData:Oe,displayConfig:Me,resolvedMarkdownStyles:jn,unifiedNumbering:xt,expandedSections:st,expandedSubSections:vt,setExpandedSubSections:ft,getSectionCompareStyle:Jt,getSubSectionCompareStyle:Xt,getBadgeRef:Vi,getSectionRowRef:qi,getSubSectionRef:Wi,sectionLeftRefs:Oi,sectionRightRefs:ji,sectionRowRefs:Mi,sectionRightRowRefs:Ni,subSectionLeftRefs:zi,subSectionRightRefs:Hi,lhsBadgeRefs:Li,rhsBadgeRefs:Pi,openMoreFunctionsPopup:It,handleOpenSummaryPopup:Tt,openSummaryPopup:Tt,handleCloseSummaryPopup:At,toggleSection:Dt,handleSubSectionToggle:kt,renderSubSectionAccordion:Ot,resetSideBySide:jt,setConnectedSections:fn,setConnectedLines:mn,cachedConnectedPositions:En,showDeviationNavigation:go,showOpenNodeRef:mo,deviationNodeIdToView:null==Ke?void 0:Ke.id,deviationTargetParentId:xo}},[Qe,tn,Xe,$e,Ue,Yi,Qi,Sn,St,ei.anchorEl,vn,Ci,wi,Fi,Oe,Me,jn,xt,st,vt,ft,Jt,Xt,Vi,qi,Wi,go,mo,Ke,xo]);return i(V,e({value:No},{children:t(a,e({ref:Pn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Qe?{}:{overflow:"visible"}),{position:"relative"})},{children:[rn&&i(a,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(D,{})})),ei.open&&i(W,{open:ei.open,anchorEl:ei.anchorEl,containerEl:Vt.current,clipTopEl:bn.current,scrollContainerEl:Ln.current,onClose:vo,summary:ei.summary,displayImpact:ei.displayImpact,isScrollLocked:Sn}),i(A,{open:$n.open,anchorEl:$n.anchorEl,maintainRelativeOrder:!!Qe,sectionTitle:$n.sectionTitle,referenceSectionTitle:$n.refSectionTitle,onClose:ci,onOpenCognitiveCompare:ri,onOpenSideBySide:so,onConnect:Ht,isConnected:fo,isOrphan:$n.isOrphan}),Jn.open&&i(T,{open:Jn.open,popupRef:oi,position:Gn,popupConfig:qe,onClose:function(){Qn(null),Xn(function(n){return e(e({},n),{open:!1})}),ti(null)},markdownStyles:Ne,sectionTitle:mi,referenceSectionTitle:Si,cognitiveData:Jn.cognitiveData,anchorEl:Jn.anchorEl,sectionAnchorEl:Jn.sectionAnchorEl,scrollContainerEl:Ln.current,badgeStyle:Jn.badgeStyle,docData:Jn.docData,deviationData:Jn.deviationData,isLoading:Jn.isLoading}),i(s,e({open:!!cn,autoHideDuration:8e3,onClose:function(){return an(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(d,e({onClose:function(){return an(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:cn}))})),i(z,{componentHeaderText:ke,displayConfig:Me,maintainRelativeOrder:Qe,onCollapseAll:to,showCollapseAll:oo,onToggleView:function(e){ln(!0),setTimeout(function(){Ze(!e),xn(!1),ut(),ii(),fn(new Set),mn([]),En.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ln(!1)},600)})})},50)}}),i(a,e({ref:Ln,onScroll:io,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Qe?"hidden":"auto",borderTop:yt&&bt?"none":"1.5px solid #EEF0F4"}},{children:i(a,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Qe?{flex:1,minHeight:0}:{})},{children:t(a,e({ref:yn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Qe?{flex:1,overflow:"visible"}:{})},{children:[i($,{svgContainerRef:Rn,svgDimensions:no,isResizing:$i,overallConnector:Zt,rootDeviationStyle:Bt,lines:Gt,isSideBySide:Yi,activeSideBySideSection:Qi,isArrowVisible:Ji,maintainRelativeOrder:Qe,proposedSections:Ci,existingSections:wi,cognitivePopup:Jn,activeBadgeId:Zn,closeCognitivePopup:ui,setActiveBadgeId:ti,openCognitivePopupFromState:li,buildSectionPopupState:Nt,connectedLines:gn,pathRefs:Fn}),t(a,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},Qe?{flex:1,overflow:"visible"}:{})},{children:[i(a,e({ref:bn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,e({title:pi,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:pi}))}))})),t(a,e({ref:Wn,onScroll:io,sx:e({p:"12px",display:"flex",flexDirection:"column"},Qe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Mn,style:{width:"100%",height:"0px",flexShrink:0}}),Ii&&Io,i("div",{ref:qn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(a,e({ref:Vt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(a,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(a,e({onClick:function(n){n.stopPropagation(),Jn.open&&Zn===Ct?ui():(ti(Ct),li(Nt(n.currentTarget,{title:"",content:"",evaluationResult:wt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Ct,!0,e(e({},Bt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Bt.badgeBg,color:Bt.badgeText,border:"1px solid ".concat(Bt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=_t?_t:i(k,{}),i(a,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(g,{})})),i(p,{size:11,style:{transform:Jn.open&&Zn===Ct?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(a,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},Qe?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Gi&&i(m,{sections:11}),i(a,e({ref:Cn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,e({title:xi,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:xi}))}))})),t(a,e({ref:Nn,onScroll:io,sx:e({p:"12px",display:"flex",flexDirection:"column"},Qe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:zn,style:{width:"100%",height:"0px",flexShrink:0}}),Ii&&To,i("div",{ref:Hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{U as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as i,jsxs as n,Fragment as t}from"react/jsx-runtime";import{Menu as o,Box as r,Typography as l,MenuItem as s}from"@mui/material";import{ButtonCognitiveIcon as c}from"../../assests/svg/ButtonCognitiveIcon.js";var
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as i,jsxs as n,Fragment as t}from"react/jsx-runtime";import{Menu as o,Box as r,Typography as l,MenuItem as s}from"@mui/material";import{ButtonCognitiveIcon as c}from"../../assests/svg/ButtonCognitiveIcon.js";var d=function(){return i("svg",e({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M2 6.5L5 9.5L11 3.5",stroke:"#15803D",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))},C=[{key:"connect",title:"Connect",icon:i("svg",e({width:"15",height:"18",viewBox:"0 0 15 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M14.8237 3.89331C14.547 5.57188 13.0559 6.77501 11.3572 6.69242C9.65857 6.60983 8.2925 5.26384 8.18312 3.56742C4.75678 3.67456 3.54027 4.4759 3.73893 6.10536C3.81259 6.71474 4.18089 7.04063 4.85723 7.19911C5.26794 7.2951 5.7233 7.30849 6.13625 7.27054C6.17419 7.26608 6.21437 7.26385 6.25232 7.25938C6.50455 7.19911 6.76125 7.14777 7.01794 7.1076C7.77911 6.9826 8.55366 6.9201 9.29027 6.96027C11.3617 7.07188 12.7724 7.98483 12.8438 9.92233C12.913 11.7996 11.6229 13.1299 9.5425 14.0205C8.87509 14.3063 8.1675 14.5272 7.45991 14.6946C7.14071 14.7705 6.87286 14.8219 6.67419 14.8554C6.49786 16.5496 5.07821 17.842 3.37509 17.8554C1.67196 17.8688 0.229997 16.6031 0.0246403 14.9112C-0.180717 13.2192 0.917498 11.6455 2.57375 11.2527C4.23 10.8598 5.91973 11.7728 6.49562 13.3755C6.70544 13.3375 6.91303 13.2951 7.12062 13.246C7.75009 13.0987 8.37955 12.9022 8.95991 12.6522C10.538 11.9781 11.3996 11.0875 11.3595 9.9759C11.3237 8.98036 10.6095 8.52054 9.21214 8.44465C8.5983 8.41117 7.92643 8.46474 7.26348 8.57411C7.07821 8.60536 6.90857 8.63661 6.75902 8.6701C6.67196 8.68795 6.61169 8.70358 6.58491 8.71027L6.51571 8.72367C6.4666 8.73036 6.38402 8.74152 6.27687 8.75268C5.71884 8.80402 5.11393 8.78617 4.52464 8.65001C3.2925 8.36206 2.42866 7.59643 2.26794 6.2884C1.9175 3.47143 4.02241 2.16563 8.42866 2.07188C9.07821 0.500452 10.8037 -0.336602 12.4376 0.129916C14.0737 0.596434 15.1005 2.21474 14.8237 3.89331V3.89331ZM3.34161 12.6478C3.09741 12.6478 2.85562 12.6959 2.63002 12.7894C2.40442 12.8828 2.19944 13.0198 2.02678 13.1925C1.85412 13.3652 1.71717 13.5702 1.62373 13.7958C1.5303 14.0214 1.48222 14.2632 1.48223 14.5074C1.48224 14.7516 1.53036 14.9934 1.62382 15.219C1.71728 15.4446 1.85426 15.6495 2.02694 15.8222C2.19962 15.9949 2.40462 16.1318 2.63022 16.2252C2.85583 16.3187 3.09764 16.3668 3.34183 16.3667C3.83499 16.3667 4.30795 16.1708 4.65665 15.822C5.00535 15.4733 5.20123 15.0003 5.2012 14.5071C5.20117 14.014 5.00524 13.541 4.65649 13.1923C4.30775 12.8436 3.83477 12.6477 3.34161 12.6478ZM11.5224 1.49152C11.2782 1.49154 11.0364 1.53965 10.8108 1.63311C10.5852 1.72657 10.3802 1.86355 10.2076 2.03623C10.0349 2.20891 9.89797 2.41391 9.80454 2.63952C9.7111 2.86513 9.66302 3.10693 9.66303 3.35112C9.66305 3.59531 9.71116 3.83711 9.80462 4.06271C9.89808 4.28831 10.0351 4.49329 10.2077 4.66594C10.3804 4.8386 10.5854 4.97556 10.811 5.06899C11.0366 5.16243 11.2784 5.21051 11.5226 5.2105C12.0158 5.21047 12.4888 5.01453 12.8375 4.66579C13.1862 4.31704 13.382 3.84406 13.382 3.3509C13.382 2.85773 13.186 2.38478 12.8373 2.03608C12.4886 1.68738 12.0156 1.49149 11.5224 1.49152V1.49152Z",fill:"#1D2939",fillOpacity:"0.85"})}))},{key:"side-by-side",title:"Side by Side",icon:i("svg",e({width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M3.19922 8.19922H13.1992M3.19922 8.19922L4.86589 10.6992M3.19922 8.19922L4.86589 5.69922M13.1992 8.19922L11.5326 10.6992M13.1992 8.19922L11.5326 5.69922M15.6992 0.699219V15.6992M0.699219 0.699219V15.6992",stroke:"#3F4957",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}))},{key:"cognitive-decisioning",title:"Cognitive Decisioning",icon:i(c,{})}],a=function(c){var a=c.open,h=c.anchorEl;c.sectionTitle,c.referenceSectionTitle;var p=c.onClose,g=c.onOpenCognitiveCompare,x=c.onOpenSideBySide,f=c.onConnect,m=c.isConnected,u=void 0!==m&&m,y=c.isOrphan,v=c.maintainRelativeOrder;return i(o,e({open:a,anchorEl:h,onClose:p,disableScrollLock:!0,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},PaperProps:{sx:{ml:.75,minWidth:190,maxWidth:220,borderRadius:"12px",border:"1px solid #E4E7EC",boxShadow:"0px 12px 28px rgba(16, 24, 40, 0.12)",overflow:"hidden"}},MenuListProps:{sx:{p:.5,bgcolor:"#FFFFFF"}}},{children:C.filter(function(e){return v||"side-by-side"!==e.key}).map(function(o){var c="connect"===o.key,C=c&&u,a=y&&("connect"===o.key||"side-by-side"===o.key),h=n(t,{children:[i(r,e({sx:e(e({width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{display:"block"}},a&&{opacity:.15}),C&&{"& svg path":{fill:"#15803D",fillOpacity:1}})},{children:o.icon})),n(r,e({sx:{minWidth:0,display:"flex",flexDirection:"column",flex:1}},{children:[i(l,e({sx:{fontSize:"12px",fontWeight:500,color:a?"#98A2B3":C?"#15803D":"#101828",lineHeight:1.2,whiteSpace:"nowrap"}},{children:c?u?"Disconnect":"Connect":o.title})),a&&i(l,e({sx:{mt:.35,fontSize:"10px",lineHeight:1.3,color:"#98A2B3",whiteSpace:"normal"}},{children:"No counterpart exists to connect to."}))]})),C&&!a&&i(r,e({sx:{display:"flex",alignItems:"center",justifyContent:"center",ml:"auto"}},{children:i(d,{})}))]});return a?i(r,e({"aria-disabled":"true",sx:{px:1.25,py:1,minHeight:22,borderRadius:"10px",display:"flex",alignItems:"flex-start",gap:1,cursor:"not-allowed",userSelect:"none"}},{children:h}),o.key):i(s,e({onClick:function(){return e=o.key,void(y&&("connect"===e||"side-by-side"===e)||("connect"!==e?"side-by-side"!==e?g():x():f()));var e},sx:{px:1.25,py:1,minHeight:40,borderRadius:"10px",display:"flex",alignItems:"center",gap:1,bgcolor:C?"#F0FDF4":"transparent","&:hover":{bgcolor:C?"#DCFCE7":"#F9FAFB"}}},{children:h}),o.key)})}))};export{a as default};
|
|
2
2
|
//# sourceMappingURL=MoreFunctionsPopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__rest as e}from"tslib";import{jsx as r,jsxs as t,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{safeStringify as g,mixHexColors as f,areMarkdownPropsEqual as v}from"../CognitiveComparehelpers.js";import m from"rehype-raw";import x from"remark-gfm";var b=l.memo(function(v){var b=v.content,y=v.overlayContent,E=v.sxStyles,C=v.deviationBadges,B=void 0===C?[]:C,F=v.highlights,k=void 0===F?[]:F;v.maintainRelativeOrder;var S=v.highlightBg,w=v.suppressHighlightBg,A=void 0!==w&&w,T=v.collisionKey,I=c(null),O=!!y,z=d(function(){return B.reduce(function(e,r){var t;return n(n({},e),((t={})[r.id]=r,t))},{})},[B]),D=c({badgeMap:z,highlightBg:S,hideHighlightBg:O,suppressHighlightBg:A});D.current={badgeMap:z,highlightBg:S,hideHighlightBg:O,suppressHighlightBg:A};var j=function(e,r){return l.Children.map(e,function(e){var t;if(!l.isValidElement(e))return e;var i=(null===(t=e.props)||void 0===t?void 0:t.children)?j(e.props.children,r):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return r(o)})},M=d(function(){return{mark:function(t){var i,o,a,l,c=t.children,d=e(t,["children"]),s=D.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=d["data-badge-id"],v=f?u[f]:null,m=d["data-highlight-color"],x=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,b=d.isSuggestedDeviationFix||g;return r("span",n({style:n(n(n({},b?{}:{backgroundColor:x}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,g=i.children,f=e(i,["children"]),v=D.current.badgeMap,m=f["data-badge-id"];if(!m)return r("span",n({},f,{children:g}));var x=v[m];if(!x)return r("span",n({},f,{children:g}));var b="number"==typeof x.stackIndex?x.stackIndex:0,y="translateY(calc(-20% + ".concat(12*b,"px + var(--badge-nudge, 0px)))");return t(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[t(o,n({ref:x.badgeRef,className:"deviation-badge","data-side":x.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+b,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=x.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=x.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=x.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===x.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),x.isConnected&&x.style&&{outline:"2px solid ".concat(x.style.badgeBorder),outlineOffset:"1px"})},{children:[t(o,n({onClick:function(n){n.stopPropagation(),x.onSummaryClick&&x.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[r(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:x.label})),("left"===x.side||x.isOrphan)&&r(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=x.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=x.score&&"N/A"!==x.score&&"NA"!==x.score&&0!==x.score?"".concat(x.score):"N/A"===x.score||"NA"===x.score?"N/A":"Same"}))]})),("left"===x.side||x.isOrphan)&&r(o,n({onClick:function(n){n.stopPropagation(),x.onClick&&x.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=x.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:r(h,{size:12,color:(null===(p=x.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var t=e.children;return r(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:t}))},thead:function(e){var t=e.children;return r(o,n({component:"thead"},{children:t}))},tbody:function(e){var t=e.children;return r(o,n({component:"tbody"},{children:t}))},tr:function(e){var t=e.children;return r(o,n({component:"tr",sx:{borderBotttom:"1px solid #E5E7EB"}},{children:t}))},th:function(e){var t=e.children;return r(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:t}))},td:function(e){var t=e.children;return r(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:t}))},updated:function(n){var t=n.children;return e(n,["children"]),r(i,{children:t})},deleted:function(t){var i=t.children;e(t,["children"]),console.log("nitish: ",i);var o=j(i,function(n){return l.cloneElement(n,{isSuggestedDeviationFix:!0})});return r("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:o}))},changed:function(t){var i=t.children;e(t,["children"]);var o=j(i,function(n){return l.cloneElement(n,{isSuggestedDeviationFix:!0})});return r("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:o}))}}},[]),P=function(n){return n?n.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(n){return n.startsWith("\n")||/\|.*\|/.test(n)&&/\|[-:\s]+\|/.test(n)?n:n.replace(/\n/g," ")}).join(""):""},H=d(function(){return B.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[B]),N=function(n){return n.replace(/[\.,;:]/g," ")},R=d(function(){var e=P(g(b||"")),r=A?N(e):e,t=(B||[]).map(function(n){var e,r;return{id:null==n?void 0:n.id,highlight:P((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.badgeBg)||S}}).filter(function(n){return n.id&&n.highlight}),i={};t.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e){void 0===n&&(n="");var r=e?' data-highlight-color="'.concat(e,'"'):"";return'<mark data-badge-id="'.concat(n,'"').concat(r,">")},a=function(n){return'<span data-badge-id="'.concat(n,'">')},l=function(n,e,r){var t,i,a;void 0===e&&(e="");var l=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!l)return n;var c=null!==(t=l[1])&&void 0!==t?t:"",d=null!==(i=l[2])&&void 0!==i?i:"",s=null!==(a=l[3])&&void 0!==a?a:"";return d?c+o(e,r)+d+"</mark>"+s:n},c=[];Object.entries(i).forEach(function(n){var t=n[0],i=n[1],o=e.indexOf(t),a=!1;if(-1===o&&A){var l=N(t);-1!==(o=r.indexOf(l))&&(a=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=f(d,i[s].highlightColor);c.push({highlight:t,start:o,end:o+t.length,badges:i,color:d,usedLooseMatch:a})}}),c.sort(function(n,e){return n.start-e.start||e.end-n.end});var d=[],s={};c.forEach(function(n,e){for(var r=n.start,t=n.end,i=0,o=d;i<o.length;i++){var a=o[i],l=a.start,c=a.end,u=r<c&&t>c&&r>=l,h=r<l&&t>l&&t<=c;if(r>=l&&t<=c){n.orphaned=!0,s[e]=a.matchIdx;break}u&&(r=c),h&&(t=l)}n.trimmedStart=r,n.trimmedEnd=t,!n.orphaned&&r<t&&d.push({start:r,end:t,matchIdx:e})});var u={};Object.entries(s).forEach(function(n){var e=n[0],r=n[1],t=Number(e);u[r]||(u[r]=[]),u[r].push(t)});var h=function(n,e,r){return void 0===e&&(e=""),n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?l(n,e,r):n}).join(""):l(n,e,r):n}).join("")},p=c.map(function(e,r){return n(n({},e),{idx:r})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var r,t;return(null!==(r=e.trimmedStart)&&void 0!==r?r:e.start)-(null!==(t=n.trimmedStart)&&void 0!==t?t:n.start)});p.forEach(function(n){var r,t,i=null!==(r=n.trimmedStart)&&void 0!==r?r:n.start,o=null!==(t=n.trimmedEnd)&&void 0!==t?t:n.end;if(!(i>=o)){var l=e.slice(i,o),d=function(n,e,r,t){if(!r.length)return n;var i=r.map(function(n){return c[n]}).sort(function(n,e){return n.start-e.start}),o="",l=0;return i.forEach(function(r){var i=r.start-e,c=r.end-e,d=f(t,r.color);o+=n.slice(l,i);var s="",u="";r.badges.forEach(function(n){s+=a(n.id),u="</span>"+u}),o+=s+h(n.slice(i,c),r.badges[0].id,d)+u,l=c}),o+=n.slice(l)}(n.usedLooseMatch||i!==n.start||o!==n.end?l:n.highlight,n.start,u[n.idx]||[],n.color),s=h(d,n.badges[0].id,n.color),p="",g="";n.badges.forEach(function(n){p+=a(n.id),g="</span>"+g});var v=p+s+g;e=e.slice(0,i)+v+e.slice(o)}});var v=new Set(Object.keys(i));return k.forEach(function(n){if(n){var t=P(n);if(t&&!v.has(t)){var i=A?r.indexOf(N(t)):e.indexOf(t);if(-1!==i){var a=e.slice(0,i);if((a.match(/</g)||[]).length===(a.match(/>/g)||[]).length){var l=o("","")+t+"</mark>";e=e.slice(0,i)+l+e.slice(i+t.length)}}}}}),e},[b,B,k,S,A]),W=d(function(){return y?P(g(y||"")):""},[y]),q=!!y,L=n(n(n(n({},E),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),q?{color:"transparent"}:{}),{"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}}),$=n(n({},E),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}});return s(function(){if(I.current){var n=function(){var n=Array.from(I.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),r=n.filter(function(n){return"left"!==n.dataset.side}),t=I.current.getBoundingClientRect(),i=t.bottom-4,o=t.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var r=[],t=[];e.forEach(function(n){if(0===t.length)t.push(n);else{var e=t[t.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,t.push(n)):(r.push(t),t=[n])}}),t.length>0&&r.push(t),r.forEach(function(n){var e=n[n.length-1],r=e.currentTop+e.height;if(r>i){var t=r-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(t,a));n.forEach(function(n){n.currentTop-=l})}}),r.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(r)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),r=new ResizeObserver(function(){requestAnimationFrame(n)});return r.observe(I.current),function(){r.disconnect(),cancelAnimationFrame(e)}}},[R,T,H]),t(o,n({ref:I,sx:{position:"relative",display:"grid"}},{children:[r(a,n({component:"div",sx:n(n({},L),{padding:"3px"})},{children:r(p,n({components:M,remarkPlugins:[x],rehypePlugins:[m]},{children:g(R).replace(/\\n/g,"\n")}))})),q&&r(a,n({component:"div",sx:$},{children:r(p,n({components:M,remarkPlugins:[x],rehypePlugins:[m]},{children:g(W).replace(/\\n/g,"\n")}))}))]}))},v);export{b as MemoizedMarkdown};
|
|
1
|
+
import{__assign as n,__rest as e}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{mixHexColors as g,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import v from"rehype-raw";import m from"remark-gfm";var x=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},b=[x(m)],y=[x(v)],E=l.memo(function(f){var v=f.content,m=f.overlayContent,x=f.sxStyles,E=f.deviationBadges,C=void 0===E?[]:E,B=f.highlights,k=void 0===B?[]:B;f.maintainRelativeOrder;var S=f.highlightBg,F=f.suppressHighlightBg,w=void 0!==F&&F,A=f.collisionKey,z=c(null),T=!!m,I=d(function(){return C.reduce(function(e,t){var r;return n(n({},e),((r={})[t.id]=t,r))},{})},[C]),O=c({badgeMap:I,highlightBg:S,hideHighlightBg:T,suppressHighlightBg:w});O.current={badgeMap:I,highlightBg:S,hideHighlightBg:T,suppressHighlightBg:w};var M=function(e,t){return l.Children.map(e,function(e){var r;if(!l.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?M(e.props.children,t):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return t(o)})},j=d(function(){return{mark:function(r){var i,o,a,l,c=r.children,d=e(r,["children"]),s=O.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=d["data-badge-id"],v=f?u[f]:null,m=d["data-highlight-color"],x=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,b="true"===d["data-is-suggested-deviation-fix"]||g;return t("span",n({style:n(n(n({},b?{}:{backgroundColor:x}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,g=i.children,f=e(i,["children"]),v=O.current.badgeMap,m=f["data-badge-id"];if(!m)return t("span",n({},f,{children:g}));var x=v[m];if(!x)return t("span",n({},f,{children:g}));var b="number"==typeof x.stackIndex?x.stackIndex:0,y="translateY(calc(-20% + ".concat(12*b,"px + var(--badge-nudge, 0px)))");return r(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,n({ref:x.badgeRef,className:"deviation-badge","data-side":x.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+b,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=x.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=x.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=x.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===x.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),x.isConnected&&x.style&&{outline:"2px solid ".concat(x.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,n({onClick:function(n){n.stopPropagation(),x.onSummaryClick&&x.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:x.label})),("left"===x.side||x.isOrphan)&&t(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=x.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=x.score&&"N/A"!==x.score&&"NA"!==x.score&&0!==x.score?"".concat(x.score):"N/A"===x.score||"NA"===x.score?"N/A":"Same"}))]})),("left"===x.side||x.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),x.onClick&&x.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=x.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=x.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var r=e.children;return t(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:r}))},thead:function(e){var r=e.children;return t(o,n({component:"thead"},{children:r}))},tbody:function(e){var r=e.children;return t(o,n({component:"tbody"},{children:r}))},tr:function(e){var r=e.children;return t(o,n({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(e){var r=e.children;return t(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:r}))},td:function(e){var r=e.children;return t(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:r}))},code:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var e=n.children;return t(i,{children:e})},deleted:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))}}},[]),P=function(n){if(!n||"string"!=typeof n)return"";var e=n.replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n"),t=(e=(e=(e=e.replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).split(/(\n{2,})/);return e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r,i=null!==(r=n[t+1])&&void 0!==r?r:"";return/^[#>|\-*+]/.test(i)||/^\d+\./.test(n.slice(t+1))?"\n":" "})}).join(""),e},D=function(n){return n.replace(/[\.,;:]/g," ")},H=d(function(){return C.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[C]),N=function(n){return'<span data-badge-id="'.concat(n,'">')},R=d(function(){var e=P(v||""),t=w?D(e):e,r=(C||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:P((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||S}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var l=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(i=a[2])&&void 0!==i?i:"",d=null!==(o=a[3])&&void 0!==o?o:"";return c?l+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+c+"</mark>"+d:n}(n,e,t),a=o;return!i&&r.length>0&&(i=!0,a=N(r[0].id)+o+"</span>"),""+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&w){var c=D(r);-1!==(o=t.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=g(d,i[s].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:d,usedLooseMatch:l})}});var l=new Set(Object.keys(i));(k||[]).forEach(function(n){if(n){var r=P(n);if(r&&!l.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&w){var c=D(r);-1!==(i=t.indexOf(c))&&(o=!0)}if(-1!==i){var d=e.slice(0,i);(d.match(/</g)||[]).length===(d.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:S||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],d={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=c;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=t<s&&r>s&&t>=l,h=t<l&&r>l&&r<=s;if(t>=l&&r<=s){n.orphaned=!0,d[e]=a.matchIdx;break}u&&(t=s),h&&(r=l)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&c.push({start:t,end:r,matchIdx:e})});var s={};Object.entries(d).forEach(function(n){var e=n[0],t=n[1],r=Number(e);s[t]||(s[t]=[]),s[t].push(r)});var u=a.map(function(e,t){return n(n({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return u.forEach(function(n){var t,r,i,l,c=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,d=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(c>=d)){var u=e.slice(c,d),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",c=0;return i.forEach(function(t){var i,a,d=Math.max(c,t.start-e),s=Math.max(d,t.end-e);if(!(d>=s)){var u=g(r,t.color||"");l+=n.slice(c,d);var h="",p="";(t.badges||[]).forEach(function(n){h+=N(n.id),p="</span>"+p}),l+=h+o(n.slice(d,s),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",u,t.badges||[])+p,c=s}}),l+=n.slice(c)}(n.usedLooseMatch||c!==n.start||d!==n.end?u:n.highlight,n.start,s[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,c)+p+e.slice(d)}}),e},[v,C,k,S,w]),$=d(function(){return m?P(m||""):""},[m]),L=!!m,q={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},W=n(n(n(n({},x),q),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),L?{color:"transparent"}:{}),X=n(n(n({},x),q),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none"});return s(function(){if(z.current){var n=function(){var n=Array.from(z.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=z.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=l})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(z.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[R,A,H]),r(o,n({ref:z,sx:{position:"relative",display:"grid"}},{children:[t(a,n({component:"div",sx:n(n({},W),{padding:"3px"})},{children:t(p,n({components:j,remarkPlugins:b,rehypePlugins:y},{children:R.replace(/#{3}/g,"")}))})),L&&t(a,n({component:"div",sx:X},{children:t(p,n({components:j,remarkPlugins:b,rehypePlugins:y},{children:$}))}))]}))},f);export{E as MemoizedMarkdown};
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,oBAAoB,+CA8MzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAwCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA0BlC,QAAA,MAAM,gBAAgB,6QAwBnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAwCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA0BlC,QAAA,MAAM,gBAAgB,6QAwBnB,qBAAqB,4CA83EvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
|
|
@@ -85,6 +85,8 @@ export type IDisplayConfig = {
|
|
|
85
85
|
showDeviationBadges?: boolean;
|
|
86
86
|
enableDeviationSchemaBackwardCompatibility?: boolean;
|
|
87
87
|
displayEmailNotifier?: boolean;
|
|
88
|
+
expandAllSections?: boolean;
|
|
89
|
+
expandLevels?: number;
|
|
88
90
|
};
|
|
89
91
|
export interface CognitiveCompareProps {
|
|
90
92
|
componentHeaderText?: string;
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoreFunctionsPopup.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/MoreFunctionsPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,uBAAuB,GAAG;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB,EAAE,MAAM,IAAI,CAAC;IACnC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MoreFunctionsPopup.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/MoreFunctionsPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,uBAAuB,GAAG;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB,EAAE,MAAM,IAAI,CAAC;IACnC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAoCF,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA8LzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memoizedMarkdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/memoizedMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"memoizedMarkdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/memoizedMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoE,MAAM,OAAO,CAAC;AAezF,eAAO,MAAM,gBAAgB;aAWlB,MAAM;;cAEL,GAAG;;;;iBAIA,MAAM;;;8CA4kBpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viswa-test/test-citation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.177",
|
|
4
4
|
"author": "Viswa Koduru",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -255,21 +255,21 @@
|
|
|
255
255
|
"@react-pdf-viewer/page-navigation": "^3.12.0",
|
|
256
256
|
"@react-pdf-viewer/search": "^3.12.0",
|
|
257
257
|
"@react-pdf-viewer/zoom": "^3.12.0",
|
|
258
|
-
"dompurify": ">=3.0.0",
|
|
259
258
|
"highlight.js": "^11.11.1",
|
|
260
|
-
"lucide-react": "^0.474.0",
|
|
261
259
|
"pdfjs-dist": "^3.11.174",
|
|
262
260
|
"react": ">=16.8.0 <19.0.0",
|
|
263
261
|
"react-dom": ">=16.8.0 <19.0.0",
|
|
264
|
-
"react-markdown": ">=8.0.0",
|
|
265
262
|
"react-player": "^3.4.0",
|
|
266
263
|
"react-reader": "^2.0.13",
|
|
264
|
+
"wavesurfer.js": "^7.12.1",
|
|
265
|
+
"lucide-react": "^0.474.0",
|
|
266
|
+
"react-markdown": ">=8.0.0",
|
|
267
267
|
"react-resizable-panels": ">=2.0.0",
|
|
268
268
|
"react-syntax-highlighter": ">=15.0.0",
|
|
269
|
-
"
|
|
270
|
-
"remark-breaks": "
|
|
271
|
-
"
|
|
272
|
-
"
|
|
269
|
+
"remark-gfm": ">=4.0.0",
|
|
270
|
+
"remark-breaks": ">=4.0.0",
|
|
271
|
+
"rehype-raw": ">=7.0.0",
|
|
272
|
+
"dompurify": ">=3.0.0"
|
|
273
273
|
},
|
|
274
274
|
"peerDependenciesMeta": {
|
|
275
275
|
"@mui/icons-material": {
|