@viswa-test/test-citation 0.0.184 → 0.0.186

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),e=require("react/jsx-runtime"),n=require("react"),i=require("./CitationRenderer.module.css.js");exports.default=function(o){var a=o.inLineCitation,s=o.citationTitle,r=o.citationIcon,l=o.chevronUpComponent,c=o.chevronDownComponent,u=o.additionalCallbackForPillButton,d=o.citationComponent,p=o.styles,v=void 0===p?{}:p,f=o.isOpen,_=o.onToggle,m=n.useState(!1),C=m[0],g=m[1],j=void 0!==f?f:C;return e.jsxs(e.Fragment,{children:[e.jsxs("span",t.__assign({onClick:function(t){return function(t){t.preventDefault(),t.stopPropagation(),u&&u(),_?_():void 0===f&&g(function(t){return!t})}(t)},className:i.default.pillButton,style:v.pillButton},{children:[r||(s?e.jsx("span",t.__assign({style:v.citationTitle},{children:s})):null),a&&(j?l:c)]})),a&&j&&e.jsx("div",t.__assign({className:i.default.citationWrapper,style:v.citationWrapper},{children:e.jsx("div",t.__assign({className:i.default.citationContent,style:v.citationContent},{children:d}))}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),e=require("./CitationRenderer.module.css.js"),o=n.memo(function(o){var s=o.inLineCitation,a=o.citationTitle,r=o.citationIcon,l=o.chevronUpComponent,c=o.chevronDownComponent,u=o.additionalCallbackForPillButton,p=o.citationComponent,d=o.styles,f=void 0===d?{}:d,m=o.isOpen,v=o.onToggle,C=n.useState(!1),g=C[0],y=C[1],_=void 0!==m?m:g;return i.jsxs(i.Fragment,{children:[i.jsxs("span",t.__assign({onClick:function(t){return function(t){t.preventDefault(),t.stopPropagation(),u&&u(),v?v():void 0===m&&y(function(t){return!t})}(t)},className:e.default.pillButton,style:f.pillButton},{children:[r||(a?i.jsx("span",t.__assign({style:f.citationTitle},{children:a})):null),s&&(_?l:c)]})),s&&_&&i.jsx("div",t.__assign({className:e.default.citationWrapper,style:f.citationWrapper},{children:i.jsx("div",t.__assign({className:e.default.citationContent,style:f.citationContent},{children:p}))}))]})},function(t,i){return t.inLineCitation===i.inLineCitation&&t.citationTitle===i.citationTitle&&t.isOpen===i.isOpen&&JSON.stringify(t.styles)===JSON.stringify(i.styles)});exports.default=o;
2
2
  //# sourceMappingURL=CitationRenderer.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("lucide-react"),l=require("react"),t=require("./ResizableSplitPane.js"),o=require("../PdfViewer/PdfViewer.js"),r=require("../../assests/svg/PdfViewerIcons.js"),a=function(n){var l,r,a,d,s,u,c,g,v,p,h,f=n.href,x=n.metaData,_=n.citationTitle,m=n.isFullscreen,b=function(e){try{return new URL(e,window.location.origin).searchParams.get("citationNumber")}catch(e){return null}}(f);if(!b)return null;var j=(null===(l=null==x?void 0:x.citations)||void 0===l?void 0:l[b])||{},y=(null===(r=null==x?void 0:x.docData)||void 0===r?void 0:r.documents)||{},C=(null===(a=null==x?void 0:x.docData)||void 0===a?void 0:a.input_index_map)||{},w=null==C?void 0:C[0],F=null==C?void 0:C[1],P=w?y[w]:null,S=F?y[F]:null,D=w?j[w]:null,k=F?j[F]:null;if(["contract","clause"].includes(_)){var z=D?i.jsx(o.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:P.title,pdfUrl:P.signed_url,highlightText:[null!==(d=null==D?void 0:D.highlighted_text)&&void 0!==d?d:""],highlightPages:{1:null===(s=null==D?void 0:D.custom_metadata)||void 0===s?void 0:s.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(u=null==D?void 0:D.custom_metadata)||void 0===u?void 0:u.pdf_start_page_number,null===(c=null==D?void 0:D.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]}):null,R=k?i.jsx(o.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:S.title,pdfUrl:S.signed_url,jumpToPageValue:1,highlightText:[null!==(g=null==k?void 0:k.highlighted_text)&&void 0!==g?g:""],highlightPages:{1:null===(v=null==k?void 0:k.custom_metadata)||void 0===v?void 0:v.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(p=null==k?void 0:k.custom_metadata)||void 0===p?void 0:p.pdf_start_page_number,null===(h=null==k?void 0:k.custom_metadata)||void 0===h?void 0:h.pdf_end_page_number]}):null;return D||k?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:i.jsx(t.default,{leftComponent:z,rightComponent:R,isFullscreen:m})})):i.jsx("div",{children:"Missing PDF Citation. Please try again later"})}return i.jsx("div",{children:"No Citation Found. Please try again later"})};exports.default=function(t){var o,d,s,u=t.href,c=t.children,g=t.metaData,v=t.chevronUpComponent,p=void 0===v?null:v,h=t.chevronDownComponent,f=void 0===h?null:h,x=t.customStyle,_=void 0===x?{}:x,m=t.defaultState,b=void 0!==m&&m,j=l.useState(b),y=j[0],C=j[1],w=l.useState(!1),F=w[0],P=w[1],S="string"==typeof c&&(null===(o=null==c?void 0:c.split("\n"))||void 0===o?void 0:o.length)>1?c.split("\n").join(" "):c,D="string"==typeof c?c:c[0],k=null!=p?p:function(e){var l,t;return i.jsx(n.ChevronUp,{size:null!==(l=null==e?void 0:e.fontSize)&&void 0!==l?l:16,color:null!==(t=null==e?void 0:e.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(d=null==_?void 0:_.arrow)&&void 0!==d?d:{}),z=null!=f?f:function(e){var l,t;return i.jsx(n.ChevronDown,{size:null!==(l=null==e?void 0:e.fontSize)&&void 0!==l?l:16,color:null!==(t=null==e?void 0:e.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(s=null==_?void 0:_.arrow)&&void 0!==s?s:{});return i.jsxs("span",e.__assign({style:e.__assign({display:"inline"},_.relativeWrapper||{})},{children:[i.jsx("div",e.__assign({style:e.__assign({display:"inline",marginTop:0},_.citationButtonWrapper||{})},{children:i.jsxs("button",e.__assign({type:"button",onClick:function(){return C(function(e){return!e})},style:e.__assign({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},_.citationButton||{})},{children:[i.jsx("span",{children:S}),i.jsx("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:y?k:z}))]}))})),y&&i.jsxs("div",e.__assign({style:F?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"}},{children:[i.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:i.jsx("button",e.__assign({onClick:function(){P(function(e){return!e})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:F?i.jsx(r.DefaultFullScreenCloseIcon,{}):i.jsx(r.DefaultFullScreenIcon,{})}))})),i.jsx("div",e.__assign({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:i.jsx(a,{href:u,children:c,metaData:g,citationTitle:D,isFullscreen:F})}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("lucide-react"),l=require("react"),t=require("./ResizableSplitPane.js"),o=require("../PdfViewer/PdfViewer.js"),d=require("../../assests/svg/PdfViewerIcons.js"),r=function(i){var d,r,a,u,s,c,v,g=i.href,p=i.metaData,h=i.citationTitle,_=i.isFullscreen,f=function(e){try{return new URL(e,window.location.origin).searchParams.get("citationNumber")}catch(e){return null}}(g);if(!f)return null;var m=(null===(d=null==p?void 0:p.citations)||void 0===d?void 0:d[f])||{},x=(null===(r=null==p?void 0:p.docData)||void 0===r?void 0:r.documents)||{},b=(null===(a=null==p?void 0:p.docData)||void 0===a?void 0:a.input_index_map)||{},j=null==b?void 0:b[0],y=null==b?void 0:b[1],C=j?x[j]:null,w=y?x[y]:null,F=j?m[j]:null,P=y?m[y]:null,S=l.useMemo(function(){var e,i,l,t;return F?n.jsx(o.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==C?void 0:C.title,pdfUrl:null==C?void 0:C.signed_url,highlightText:[null!==(e=null==F?void 0:F.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(i=null==F?void 0:F.custom_metadata)||void 0===i?void 0:i.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(l=null==F?void 0:F.custom_metadata)||void 0===l?void 0:l.pdf_start_page_number,null===(t=null==F?void 0:F.custom_metadata)||void 0===t?void 0:t.pdf_end_page_number]}):null},[null==C?void 0:C.title,null==C?void 0:C.signed_url,null==F?void 0:F.highlighted_text,null===(u=null==F?void 0:F.custom_metadata)||void 0===u?void 0:u.pdf_start_page_number,null===(s=null==F?void 0:F.custom_metadata)||void 0===s?void 0:s.pdf_end_page_number]),D=l.useMemo(function(){var e,i,l,t;return P?n.jsx(o.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==w?void 0:w.title,pdfUrl:null==w?void 0:w.signed_url,jumpToPageValue:1,highlightText:[null!==(e=null==P?void 0:P.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(i=null==P?void 0:P.custom_metadata)||void 0===i?void 0:i.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(l=null==P?void 0:P.custom_metadata)||void 0===l?void 0:l.pdf_start_page_number,null===(t=null==P?void 0:P.custom_metadata)||void 0===t?void 0:t.pdf_end_page_number]}):null},[null==w?void 0:w.title,null==w?void 0:w.signed_url,null==P?void 0:P.highlighted_text,null===(c=null==P?void 0:P.custom_metadata)||void 0===c?void 0:c.pdf_start_page_number,null===(v=null==P?void 0:P.custom_metadata)||void 0===v?void 0:v.pdf_end_page_number]);return["contract","clause"].includes(h)?F||P?n.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:l.useMemo(function(){return n.jsx(t.default,{leftComponent:S,rightComponent:D,isFullscreen:_})},[S,D,_])})):n.jsx("div",{children:"Missing PDF Citation. Please try again later"}):n.jsx("div",{children:"No Citation Found. Please try again later"})};exports.default=function(t){var o,a,u,s=t.href,c=t.children,v=t.metaData,g=t.chevronUpComponent,p=void 0===g?null:g,h=t.chevronDownComponent,_=void 0===h?null:h,f=t.customStyle,m=void 0===f?{}:f,x=t.defaultState,b=void 0!==x&&x,j=l.useState(b),y=j[0],C=j[1],w=l.useState(!1),F=w[0],P=w[1],S="string"==typeof c&&(null===(o=null==c?void 0:c.split("\n"))||void 0===o?void 0:o.length)>1?c.split("\n").join(" "):c,D="string"==typeof c?c:c[0],k=null!=p?p:function(e){var l,t;return n.jsx(i.ChevronUp,{size:null!==(l=null==e?void 0:e.fontSize)&&void 0!==l?l:16,color:null!==(t=null==e?void 0:e.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(a=null==m?void 0:m.arrow)&&void 0!==a?a:{}),z=null!=_?_:function(e){var l,t;return n.jsx(i.ChevronDown,{size:null!==(l=null==e?void 0:e.fontSize)&&void 0!==l?l:16,color:null!==(t=null==e?void 0:e.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(u=null==m?void 0:m.arrow)&&void 0!==u?u:{});return n.jsxs("span",e.__assign({style:e.__assign({display:"inline"},m.relativeWrapper||{})},{children:[n.jsx("div",e.__assign({style:e.__assign({display:"inline",marginTop:0},m.citationButtonWrapper||{})},{children:n.jsxs("button",e.__assign({type:"button",onClick:function(){return C(function(e){return!e})},style:e.__assign({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},m.citationButton||{})},{children:[n.jsx("span",{children:S}),n.jsx("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:y?k:z}))]}))})),y&&n.jsxs("div",e.__assign({style:F?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:n.jsx("button",e.__assign({onClick:function(){P(function(e){return!e})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:F?n.jsx(d.DefaultFullScreenCloseIcon,{}):n.jsx(d.DefaultFullScreenIcon,{})}))})),n.jsx("div",e.__assign({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:n.jsx(r,{href:s,children:c,metaData:v,citationTitle:D,isFullscreen:F})}))]}))]}))};
2
2
  //# sourceMappingURL=CitationAnchor.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("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"),w=require("./hooks/useSideBySide.js"),T=require("./components/SvgConnectors.js");exports.SHARED_MARKDOWN_STYLES=u.SHARED_MARKDOWN_STYLES,exports.default=function(I){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=I.componentHeaderText,ve=void 0===fe?a.DEFAULT_COMPONENT_HEADER_TEXT:fe,pe=I.treeData,ge=I.comparisonConfig,he=I.leftColumnTitleText,me=I.rightColumnTitleText,Se=I.markdownStyles,Re=I.resetTrigger,xe=I.displayConfig,_e=void 0===xe?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:xe,ye=I.popupConfig,be=I.deviationData,Ce=void 0===be?{}:be,Ee=I.deviationNodeIdToView,Ae=I.resetDeviationNodeId,Be=I.isProposingFix,we=void 0!==Be&&Be,Te=I.proposingFixNodeId,Ie=I.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,wn=An.setCognitivePopup,Tn=An.moreFunctions,In=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(!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(ti),i(oi),"".concat(e,":").concat(n)},[Ie,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=w.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:Tn,closeSummaryPopup:Nn}),Ai=Ei.isSideBySide,Bi=Ei.isArrowVisible,wi=Ei.setIsArrowVisible,Ti=Ei.isResizing,Ii=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(){Ie&&"off"!==ci&&"0:0"!==ci&&(ji.current=null,un.current=[],requestAnimationFrame(function(){var e;null===(e=an.current)||void 0===e||e.call(an)}))},[Ie,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(),Tn.open&&Tn.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;In(St(e,n,t,o,i,r))})}},[Tn.open,Tn.sectionIdx,Vn,Nn,St]),xt=i.useCallback(function(){var e=Tn.sectionIdx;Tn.isOrphan,Vn(),Nn(),null!==e&&(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))},[Tn.sectionIdx,Tn.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,wt=At.getSubSectionCompareStyle,Tt=At.getDeviationStyleByKey,It=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:wt,getDeviationStyleByKey:Tt,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=It.lines,Ot=It.setLines,Ft=It.overallConnector,jt=It.setOverallConnector,Pt=It.svgDimensions,Nt=It.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:Ii,setIsArrowVisible:wi,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=Tn.sectionIdx,i=Tn.isOrphan;if(Nn(),null!=n){var t="left";Tn.anchorEl&&(null===(e=Sn.current)||void 0===e?void 0:e.contains(Tn.anchorEl))&&(t="right"),Ji(n),Vi(n,i,{sourceSide:t})}},[Vi,Tn.isOrphan,Tn.sectionIdx,Tn.anchorEl,Nn]),Wt=i.useCallback(function(){Nn(),Hi(),Ke(new Set),Xe([]),un.current=[]},[Nn,Hi]),Kt=null!==Tn.sectionIdx&&We.has(Tn.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;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));Pn({open:!0,anchorEl:e,summary:t,displayImpact:o})})));Ji(n),l?setTimeout(function(){Vi(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var s=l.top-window.innerHeight/2;Oe?(null===(e=bn.current)||void 0===e||e.scrollBy({top:s,behavior:"smooth"}),null===(n=Sn.current)||void 0===n||n.scrollBy({top:s,behavior:"smooth"})):null===(i=hn.current)||void 0===i||i.scrollBy({top:s,behavior:"smooth"})}}Pn({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){Vi(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[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],w=oi.findIndex(function(e){return e.selfIndex===B});-1!==w&&(A=w)}C=e.__spreadArray([A],E.slice(1),!0).join("-")}if(b||C){var T=b?Number(b.split("-")[0]):x,I=C?Number(C.split("-")[0]):_,D=ti[T],O=oi[I],F=D&&!D.title&&!D.content,j=O&&!O.title&&!O.content,P=y||(!b&&!!C||F&&!j),N=!1;if(T>=0&&!y)(Oe?!!Gi["left-".concat(T)]:!!Gi[String(T)])||(Xi(T,"left"),N=!0);if(I>=0)(Oe?!!Gi["right-".concat(I)]:!!Gi[String(I)])||(Xi(I,"right"),N=!0);if(N)return c+=1,void(d=setTimeout(p,450));var k,L=b||"",q=C||"",M="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u).concat(s.DEVIATION_BADGE_SEPARATOR).concat(L).concat(s.DEVIATION_BADGE_SEPARATOR).concat(q),H="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u),V=null===(o=hi.current[H])||void 0===o?void 0:o.current,z=null===(l=mi.current[H])||void 0===l?void 0:l.current,G=P||!V&&!!z,W=G?z:V;if(k=Oe?G?Sn.current:bn.current:hn.current,W&&k){var K=W.getBoundingClientRect();if(0===K.height)return void((c+=1)<2?d=setTimeout(p,f):g());var U=k.getBoundingClientRect(),Y=K.top-U.top+k.scrollTop-U.height/2+K.height/2,X=b&&b.includes("-")||C&&C.includes("-"),J=function(){var n,i,t,o,r;if(!a){g();var l=W instanceof Element?window.getComputedStyle(W).color:"";V&&(V.style.transition="box-shadow 300ms ease-in-out",V.style.boxShadow="0 0 10px ".concat(l)),z&&(z.style.transition="box-shadow 300ms ease-in-out",z.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){V&&(V.style.boxShadow=""),z&&(z.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(!(!!V&&!!z)){var d=G?(null===(o=mi.current[X?H:I])||void 0===o?void 0:o.current)||z:(null===(r=hi.current[X?H:T])||void 0===r?void 0:r.current)||V;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(M,!1,{toggleIfSame:!1,sourceSide:y?"right":"left",onReady:function(){var n,i;g();var t=G?(null===(n=mi.current[H])||void 0===n?void 0:n.current)||z:(null===(i=hi.current[H])||void 0===i?void 0:i.current)||V;Pn({open:!0,anchorEl:t,displayImpact:Ee.displayImpact,summary:e.__assign({},s)}),null==Ae||Ae()}})}};Math.abs(k.scrollTop-Y)<=2?J():(Cn.current=Y,En.current=J,k.scrollTo({top:Y,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=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(hi.current)||r(mi.current);if(l){var s=(null===(i=mi.current[l])||void 0===i?void 0:i.current)||(null===(t=hi.current[l])||void 0===t?void 0:t.current);s&&s.isConnected&&Pn(function(n){return e.__assign(e.__assign({},n),{anchorEl:s})})}}}},[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);wn(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:we,proposingFixNodeId:Te,isRedlineFlow:Ie,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:wt,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,we,Te,Ie,Ai,Oi,$e,Qi,jn.anchorEl,We,ti,oi,si,pe,_e,gn,Zi,Gi,Ki,Ui,Bt,wt,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:Tn.open,anchorEl:Tn.anchorEl,maintainRelativeOrder:!!Oe,sectionTitle:Tn.sectionTitle,referenceSectionTitle:Tn.refSectionTitle,onClose:Vn,onOpenCognitiveCompare:qn,onOpenSideBySide:Gt,onConnect:xt,isConnected:Kt,isOrphan:Tn.isOrphan}),Bn.open&&n.jsx(c.default,{open:Bn.open,popupRef:Ln,position:Dn,popupConfig:ye,onClose:function(){On(null),wn(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(T.default,{svgContainerRef:Ze,svgDimensions:Pt,isResizing:Ti,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}})]}))]}))]}))}))}))]}))}))};
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"),w=require("./hooks/useSideBySide.js"),I=require("./components/SvgConnectors.js");exports.SHARED_MARKDOWN_STYLES=u.SHARED_MARKDOWN_STYLES,exports.default=function(T){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=T.componentHeaderText,ve=void 0===fe?a.DEFAULT_COMPONENT_HEADER_TEXT:fe,pe=T.treeData,ge=T.comparisonConfig,he=T.leftColumnTitleText,me=T.rightColumnTitleText,Se=T.markdownStyles,Re=T.resetTrigger,xe=T.displayConfig,_e=void 0===xe?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:xe,ye=T.popupConfig,be=T.deviationData,Ce=void 0===be?{}:be,Ee=T.deviationNodeIdToView,Ae=T.resetDeviationNodeId,Be=T.isProposingFix,we=void 0!==Be&&Be,Ie=T.proposingFixNodeId,Te=T.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,wn=An.setCognitivePopup,In=An.moreFunctions,Tn=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(!Te)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)},[Te,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=w.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,wi=Ei.setIsArrowVisible,Ii=Ei.isResizing,Ti=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(){Te&&"off"!==ci&&"0:0"!==ci&&(ji.current=null,un.current=[],requestAnimationFrame(function(){var e;null===(e=an.current)||void 0===e||e.call(an)}))},[Te,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&&!(!t.title&&!t.content)){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 fo.current(e,n,i,t,o,r)},[]),ct=i.useCallback(function(e,n,i,t,o){return vo.current(e,n,i,t,o)},[]),dt=i.useCallback(function(){return po.current()},[]),ft=i.useCallback(function(e,n){return go.current(e,n)},[]),vt=i.useCallback(function(e){return ho.current(e)},[]),pt=i.useCallback(function(e){return mo.current(e)},[]),gt=i.useCallback(function(){return So.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=[],Ft([]),Pt(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.useMemo(function(){return{documents:null==pe?void 0:pe.documents,input_index_map:null==pe?void 0:pe.input_index_map}},[null==pe?void 0:pe.documents,null==pe?void 0:pe.input_index_map]),Rt=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:St,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,St]),xt=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?Kt():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;Tn(Rt(e,n,t,o,i,r))})}},[In.open,In.sectionIdx,Vn,Nn,Rt]),_t=i.useCallback(function(){var e=In.sectionIdx;In.isOrphan,Vn(),Nn(),null!==e&&(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]),yt=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]),bt=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&&Ct.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[ti,oi,Oe,Wi,Ui,Hi,Nn,Hn]),Ct=i.useRef(yt);i.useEffect(function(){Ct.current=yt},[yt]);var Et=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 At=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]),Bt=E.useStyleHelpers({proposedSections:ti,existingSections:oi,maintainRelativeOrder:Oe,cognitiveMap:pn,deviationData:Ce,treeData:pe,resolvedComparisonConfig:zn}),wt=Bt.getSectionCompareStyle,It=Bt.getSubSectionCompareStyle,Tt=Bt.getDeviationStyleByKey,Dt=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:wt,getSubSectionCompareStyle:It,getDeviationStyleByKey:Tt,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:At}),Ot=Dt.lines,Ft=Dt.setLines,jt=Dt.overallConnector,Pt=Dt.setOverallConnector,Nt=Dt.svgDimensions,kt=Dt.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 Lt=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 qt=i.useMemo(function(){return Object.values(Gi).some(Boolean)||Object.values(Ki).some(Boolean)},[Gi,Ki]),Mt=i.useRef(null),Ht=i.useRef(0),Vt=i.useRef(0),zt=i.useRef(0),Gt=A.useResizeHandler({timerRef:Mt,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:Ti,setIsArrowVisible:wi,sideBySideCacheRef:ji,cachedConnectedPositions:un}).handleResize;i.useEffect(function(){dn.current=Gt},[Gt,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,Ht,n,function(){return dn.current()},function(){})),hn.current&&o.push(e(hn.current,Vt,i,function(){return dn.current()},function(){return an.current()})),en.current&&o.push(e(en.current,zt,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 Wt=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]),Kt=i.useCallback(function(){Nn(),Hi(),Ke(new Set),Xe([]),un.current=[]},[Nn,Hi]),Ut=null!==In.sectionIdx&&We.has(In.sectionIdx),Yt=S.useDeviationNavigation({proposedSections:ti,existingSections:oi,parentDeviationRecord:li,expandedSections:Gi,maintainRelativeOrder:!!Oe,scrollContainerRef:hn,leftContainerRef:bn,rightContainerRef:Sn,lhsBadgeRefs:hi,rhsBadgeRefs:mi}),Xt=Yt.showDeviationNavigation,Jt=Yt.showOpenNodeRef,$t=Yt.adjustScrollForPopup,Qt=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;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));Pn({open:!0,anchorEl:e,summary:t,displayImpact:o})})));Ji(n),l?setTimeout(function(){Vi(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var s=l.top-window.innerHeight/2;Oe?(null===(e=bn.current)||void 0===e||e.scrollBy({top:s,behavior:"smooth"}),null===(n=Sn.current)||void 0===n||n.scrollBy({top:s,behavior:"smooth"})):null===(i=hn.current)||void 0===i||i.scrollBy({top:s,behavior:"smooth"})}}Pn({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){Vi(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[Vi,Hn,Pn,Hi,Ji]),Zt=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]),eo=i.useRef({id:null,triggerMs:null}),no=i.useRef(null);i.useEffect(function(){var n;if(null==Ee?void 0:Ee.id){var i=Number(Ee.trigger),t=eo.current;if((null==t?void 0:t.triggerMs)!==i){if(!(Ee.id.includes(":")&&/:\d+$/.test(Ee.id)))return eo.current={id:Ee.id,triggerMs:i},void bt(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";no.current!==Ee.id&&(Nn(),Hn(),Hi(),Ke(new Set),Xe([]),un.current=[],no.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(){eo.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],w=oi.findIndex(function(e){return e.selfIndex===B});-1!==w&&(A=w)}C=e.__spreadArray([A],E.slice(1),!0).join("-")}if(b||C){var I=b?Number(b.split("-")[0]):x,T=C?Number(C.split("-")[0]):_,D=ti[I],O=oi[T],F=D&&!D.title&&!D.content,j=O&&!O.title&&!O.content,P=y||(!b&&!!C||F&&!j),N=!1;if(I>=0&&!y)(Oe?!!Gi["left-".concat(I)]:!!Gi[String(I)])||(Xi(I,"left"),N=!0);if(T>=0)(Oe?!!Gi["right-".concat(T)]:!!Gi[String(T)])||(Xi(T,"right"),N=!0);if(N)return c+=1,void(d=setTimeout(p,450));var k,L=b||"",q=C||"",M="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u).concat(s.DEVIATION_BADGE_SEPARATOR).concat(L).concat(s.DEVIATION_BADGE_SEPARATOR).concat(q),H="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u),V=null===(o=hi.current[H])||void 0===o?void 0:o.current,z=null===(l=mi.current[H])||void 0===l?void 0:l.current,G=P||!V&&!!z,W=G?z:V;if(k=Oe?G?Sn.current:bn.current:hn.current,W&&k){var K=W.getBoundingClientRect();if(0===K.height)return void((c+=1)<2?d=setTimeout(p,f):g());var U=k.getBoundingClientRect(),Y=K.top-U.top+k.scrollTop-U.height/2+K.height/2,X=b&&b.includes("-")||C&&C.includes("-"),J=function(){var n,i,t,o,r;if(!a){g();var l=W instanceof Element?window.getComputedStyle(W).color:"";V&&(V.style.transition="box-shadow 300ms ease-in-out",V.style.boxShadow="0 0 10px ".concat(l)),z&&(z.style.transition="box-shadow 300ms ease-in-out",z.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){V&&(V.style.boxShadow=""),z&&(z.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(!(!!V&&!!z)){var d=G?(null===(o=mi.current[X?H:T])||void 0===o?void 0:o.current)||z:(null===(r=hi.current[X?H:I])||void 0===r?void 0:r.current)||V;return $t(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(M,!1,{toggleIfSame:!1,sourceSide:y?"right":"left",onReady:function(){var n,i;g();var t=G?(null===(n=mi.current[H])||void 0===n?void 0:n.current)||z:(null===(i=hi.current[H])||void 0===i?void 0:i.current)||V;Pn({open:!0,anchorEl:t,displayImpact:Ee.displayImpact,summary:e.__assign({},s)}),null==Ae||Ae()}})}};Math.abs(k.scrollTop-Y)<=2?J():(Cn.current=Y,En.current=J,k.scrollTo({top:Y,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,bt]),i.useEffect(function(){var n,i,t;if(jn.open){var o=jn.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(hi.current)||r(mi.current);if(l){var s=(null===(i=mi.current[l])||void 0===i?void 0:i.current)||(null===(t=hi.current[l])||void 0===t?void 0:t.current);s&&s.isConnected&&Pn(function(n){return e.__assign(e.__assign({},n),{anchorEl:s})})}}}},[jn.open,jn.anchorEl,$e,We,Gi]);var io=Bn.open,to=Bn.sectionIdx,oo=Bn.isOrphan,ro=Bn.badgeStyle,lo=Bn.anchorEl,so=Bn.sectionAnchorEl;i.useEffect(function(){var n;if(io&&null!=to&&to!==tt){var i="string"==typeof to?to.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 to?ti[to]||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 to?oi[to]||null:r,a=Rt(lo,l,u,to,oo,ro);wn(function(n){return n.open?s.safeStringify(n.cognitiveData)===s.safeStringify(a.cognitiveData)&&s.safeStringify(n.deviationData)===s.safeStringify(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})}},[io,to,oo,ro,lo,so,ti,oi,pe,Ce,Rt]);var uo=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})},[]),ao=i.useMemo(function(){return ti.map(function(e,i){var t,o=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return o&&r?null:n.jsx(_.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(i))})},[ti]),co=i.useMemo(function(){return oi.map(function(e,i){var t,o=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return o&&r?null: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]),fo=i.useRef(xt);i.useEffect(function(){fo.current=xt},[xt]);var vo=i.useRef(Qt);i.useEffect(function(){vo.current=Qt},[Qt]);var po=i.useRef(Kt);i.useEffect(function(){po.current=Kt},[Kt]);var go=i.useRef(Xi);i.useEffect(function(){go.current=Xi},[Xi]);var ho=i.useRef(Yi);i.useEffect(function(){ho.current=Yi},[Yi]);var mo=i.useRef(uo);i.useEffect(function(){mo.current=uo},[uo]);var So=i.useRef(Hi);i.useEffect(function(){So.current=Hi},[Hi]);var Ro=i.useMemo(function(){return{maintainRelativeOrder:!!Oe,showDeviationBadges:Ne,isProposingFix:we,proposingFixNodeId:Ie,isRedlineFlow:Te,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:wt,getSubSectionCompareStyle:It,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:Xt,showOpenNodeRef:Jt,deviationNodeIdToView:null==Ee?void 0:Ee.id,deviationTargetParentId:Zt}},[Oe,Ne,we,Ie,Te,Ai,Oi,$e,Qi,jn.anchorEl,We,ti,oi,si,pe,_e,gn,Zi,Gi,Ki,Ui,wt,It,Ci,yi,bi,Xt,Jt,Ee,Zt]);return n.jsx(C.CompareContextProvider,e.__assign({value:Ro},{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:Et.current,clipTopEl:nn.current,scrollContainerEl:hn.current,onClose:Kt,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:Wt,onConnect:_t,isConnected:Ut,isOrphan:In.isOrphan}),Bn.open&&n.jsx(c.default,{open:Bn.open,popupRef:Ln,position:Dn,popupConfig:ye,onClose:function(){On(null),wn(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:Lt,showCollapseAll:qt,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:kt,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:Nt,isResizing:Ii,overallConnector:jt,rootDeviationStyle:lt,lines:Ot,isSideBySide:Ai,activeSideBySideSection:Oi,isArrowVisible:Bi,maintainRelativeOrder:Oe,proposedSections:ti,existingSections:oi,cognitivePopup:Bn,activeBadgeId:Fn,closeCognitivePopup:Hn,setActiveBadgeId:kn,openCognitivePopupFromState:Mn,buildSectionPopupState:Rt,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:kt,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&&ao,n.jsx("div",{ref:yn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:Et,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(Rt(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:kt,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&&co,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 l=require("tslib"),e=require("react"),i=require("../CognitiveComparehelpers.js"),n=require("../CognitiveCompareConstants.js");exports.useStyleHelpers=function(o){var t=o.proposedSections,u=o.existingSections,a=o.maintainRelativeOrder,v=o.cognitiveMap,r=o.deviationData,d=o.treeData,s=o.resolvedComparisonConfig,_=e.useCallback(function(e,o){var v,r,d;void 0===o&&(o="left");var s=null,_=null;if("left"===o)if(s=t[e],a&&s){var g=u.filter(function(l){var e;return null===(e=s.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex)});_=g.find(function(l){return l.evaluationResult})||g[0]}else _=u[e];else if(_=u[e],a&&_){var f=t.filter(function(l){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(_.selfIndex)});s=f.find(function(l){return l.evaluationResult})||f[0]}else s=t[e];var c=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,C=(null==_?void 0:_.relation)&&"not_defined"!==_.relation,b=!(!(null==s?void 0:s.cognitiveData)&&!(null==_?void 0:_.cognitiveData));if(!c&&!C&&!b)return l.__assign(l.__assign({},i.generateColorPalette(n.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var p=null!==(r=null!==(v=null==s?void 0:s.evaluationResult)&&void 0!==v?v:null==_?void 0:_.evaluationResult)&&void 0!==r?r:null,D=i.getFirstDeviationOutputValue(p),O=i.getFirstDeviationColor(p);return null!=p?l.__assign(l.__assign({},i.generateColorPalette(O)),{label:null!==(d=D)&&void 0!==d?d:""}):l.__assign(l.__assign({},i.generateColorPalette(O)),{label:null})},[t,u,v,s,a]),g=e.useCallback(function(e){for(var o,a,v=e.split("-").map(Number),r=t[v[0]],d=u[v[0]],s=1;s<v.length;s++)(null==r?void 0:r.subsections)&&(r=r.subsections[v[s]]),(null==d?void 0:d.subsections)&&(d=d.subsections[v[s]]);if(!r&&!d)return null;var _=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation;i.safeStringify(null==r?void 0:r.id)||i.safeStringify(null==d?void 0:d.id);var f=!(!(null==r?void 0:r.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!_&&!g&&!f)return l.__assign(l.__assign({},i.generateColorPalette(n.DEFAULT_DEVIAION_COLOR)),{label:null});var c=null!==(a=null!==(o=null==r?void 0:r.evaluationResult)&&void 0!==o?o:null==d?void 0:d.evaluationResult)&&void 0!==a?a:null,C=i.getFirstDeviationOutputValue(c),b=i.getFirstDeviationColor(c);return null!=c?l.__assign(l.__assign({},i.generateColorPalette(b)),{label:null!=C?C:""}):l.__assign(l.__assign({},i.generateColorPalette(b)),{label:null})},[t,u,v,s]),f=e.useCallback(function(e,o){var t,u,a,v,s,_,g,f,c,C,b,p,D,O,m,S,y,I,R,F,P;if(!e||null==o)return null;var x=null!==(s=null!==(u=null===(t=null==r?void 0:r[e])||void 0===t?void 0:t.evaluation_result)&&void 0!==u?u:null===(v=null===(a=null==d?void 0:d.nodes)||void 0===a?void 0:a[e])||void 0===v?void 0:v.evaluation_result)&&void 0!==s?s:null;if(!x||"object"!=typeof x)return null;var V=null!==(C=null!==(c=null!==(g=null===(_=null==x?void 0:x.deviations)||void 0===_?void 0:_[o])&&void 0!==g?g:null===(f=null==x?void 0:x.deviation_entries)||void 0===f?void 0:f[o])&&void 0!==c?c:null==x?void 0:x[o])&&void 0!==C?C:null,A=null!==(F=null!==(y=null!==(m=null!==(D=null===(p=null===(b=null==V?void 0:V.evaluation_outputs)||void 0===b?void 0:b.metadata)||void 0===p?void 0:p.label_color)&&void 0!==D?D:null===(O=null==V?void 0:V.evaluation_outputs)||void 0===O?void 0:O.label_color)&&void 0!==m?m:null===(S=null==V?void 0:V.metadata)||void 0===S?void 0:S.label_color)&&void 0!==y?y:null===(R=null===(I=null==x?void 0:x.evaluation_outputs)||void 0===I?void 0:I.metadata)||void 0===R?void 0:R.label_color)&&void 0!==F?F:n.DEFAULT_DEVIAION_COLOR,E=null!==(P=i.getFirstDeviationOutputValue(V))&&void 0!==P?P:i.getFirstDeviationOutputValue(x);return l.__assign(l.__assign({},i.generateColorPalette(A)),{label:E})},[r,d]);return{getSectionCompareStyle:_,getSubSectionCompareStyle:g,getDeviationStyleByKey:f}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var l=require("tslib"),e=require("react"),i=require("../CognitiveComparehelpers.js"),n=require("../CognitiveCompareConstants.js");exports.useStyleHelpers=function(o){var t=o.proposedSections,u=o.existingSections,a=o.maintainRelativeOrder,v=o.cognitiveMap,r=o.deviationData,d=o.treeData,s=o.resolvedComparisonConfig,_=e.useCallback(function(e,o){var v,r,d;void 0===o&&(o="left");var s=null,_=null;if("left"===o)if(s=t[e],a&&s){var g=u.filter(function(l){var e;return null===(e=s.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex)});_=g.find(function(l){return l.evaluationResult})||g[0]}else _=u[e];else if(_=u[e],a&&_){var f=t.filter(function(l){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(_.selfIndex)});s=f.find(function(l){return l.evaluationResult})||f[0]}else s=t[e];var c=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,C=(null==_?void 0:_.relation)&&"not_defined"!==_.relation,b=!(!(null==s?void 0:s.cognitiveData)&&!(null==_?void 0:_.cognitiveData)),p="left"===o?!(null==s?void 0:s.title)&&!(null==s?void 0:s.content):!(null==_?void 0:_.title)&&!(null==_?void 0:_.content);if(!c&&!C&&!b)return l.__assign(l.__assign({},i.generateColorPalette(n.DEFAULT_DEVIAION_COLOR)),{label:p?null:"Not Defined"});var D=null!==(r=null!==(v=null==s?void 0:s.evaluationResult)&&void 0!==v?v:null==_?void 0:_.evaluationResult)&&void 0!==r?r:null,O=i.getFirstDeviationOutputValue(D),m=i.getFirstDeviationColor(D);return null!=D?l.__assign(l.__assign({},i.generateColorPalette(m)),{label:null!==(d=O)&&void 0!==d?d:""}):l.__assign(l.__assign({},i.generateColorPalette(m)),{label:null})},[t,u,v,s,a]),g=e.useCallback(function(e){for(var o,a,v=e.split("-").map(Number),r=t[v[0]],d=u[v[0]],s=1;s<v.length;s++)(null==r?void 0:r.subsections)&&(r=r.subsections[v[s]]),(null==d?void 0:d.subsections)&&(d=d.subsections[v[s]]);if(!r&&!d)return null;var _=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation;i.safeStringify(null==r?void 0:r.id)||i.safeStringify(null==d?void 0:d.id);var f=!(!(null==r?void 0:r.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!_&&!g&&!f)return l.__assign(l.__assign({},i.generateColorPalette(n.DEFAULT_DEVIAION_COLOR)),{label:null});var c=null!==(a=null!==(o=null==r?void 0:r.evaluationResult)&&void 0!==o?o:null==d?void 0:d.evaluationResult)&&void 0!==a?a:null,C=i.getFirstDeviationOutputValue(c),b=i.getFirstDeviationColor(c);return null!=c?l.__assign(l.__assign({},i.generateColorPalette(b)),{label:null!=C?C:""}):l.__assign(l.__assign({},i.generateColorPalette(b)),{label:null})},[t,u,v,s]),f=e.useCallback(function(e,o){var t,u,a,v,s,_,g,f,c,C,b,p,D,O,m,S,y,I,R,F,P;if(!e||null==o)return null;var x=null!==(s=null!==(u=null===(t=null==r?void 0:r[e])||void 0===t?void 0:t.evaluation_result)&&void 0!==u?u:null===(v=null===(a=null==d?void 0:d.nodes)||void 0===a?void 0:a[e])||void 0===v?void 0:v.evaluation_result)&&void 0!==s?s:null;if(!x||"object"!=typeof x)return null;var V=null!==(C=null!==(c=null!==(g=null===(_=null==x?void 0:x.deviations)||void 0===_?void 0:_[o])&&void 0!==g?g:null===(f=null==x?void 0:x.deviation_entries)||void 0===f?void 0:f[o])&&void 0!==c?c:null==x?void 0:x[o])&&void 0!==C?C:null,A=null!==(F=null!==(y=null!==(m=null!==(D=null===(p=null===(b=null==V?void 0:V.evaluation_outputs)||void 0===b?void 0:b.metadata)||void 0===p?void 0:p.label_color)&&void 0!==D?D:null===(O=null==V?void 0:V.evaluation_outputs)||void 0===O?void 0:O.label_color)&&void 0!==m?m:null===(S=null==V?void 0:V.metadata)||void 0===S?void 0:S.label_color)&&void 0!==y?y:null===(R=null===(I=null==x?void 0:x.evaluation_outputs)||void 0===I?void 0:I.metadata)||void 0===R?void 0:R.label_color)&&void 0!==F?F:n.DEFAULT_DEVIAION_COLOR,E=null!==(P=i.getFirstDeviationOutputValue(V))&&void 0!==P?P:i.getFirstDeviationOutputValue(x);return l.__assign(l.__assign({},i.generateColorPalette(A)),{label:E})},[r,d]);return{getSectionCompareStyle:_,getSubSectionCompareStyle:g,getDeviationStyleByKey:f}};
2
2
  //# sourceMappingURL=useStyles.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as t}from"tslib";import{jsxs as n,Fragment as i,jsx as o}from"react/jsx-runtime";import{useState as e}from"react";import r from"./CitationRenderer.module.css.js";var a=function(a){var l=a.inLineCitation,c=a.citationTitle,s=a.citationIcon,p=a.chevronUpComponent,m=a.chevronDownComponent,d=a.additionalCallbackForPillButton,u=a.citationComponent,f=a.styles,v=void 0===f?{}:f,C=a.isOpen,h=a.onToggle,y=e(!1),g=y[0],B=y[1],N=void 0!==C?C:g;return n(i,{children:[n("span",t({onClick:function(t){return function(t){t.preventDefault(),t.stopPropagation(),d&&d(),h?h():void 0===C&&B(function(t){return!t})}(t)},className:r.pillButton,style:v.pillButton},{children:[s||(c?o("span",t({style:v.citationTitle},{children:c})):null),l&&(N?p:m)]})),l&&N&&o("div",t({className:r.citationWrapper,style:v.citationWrapper},{children:o("div",t({className:r.citationContent,style:v.citationContent},{children:u}))}))]})};export{a as default};
1
+ import{__assign as t}from"tslib";import{jsxs as i,Fragment as n,jsx as o}from"react/jsx-runtime";import{memo as e,useState as r}from"react";import a from"./CitationRenderer.module.css.js";var l=e(function(e){var l=e.inLineCitation,c=e.citationTitle,s=e.citationIcon,p=e.chevronUpComponent,u=e.chevronDownComponent,m=e.additionalCallbackForPillButton,d=e.citationComponent,f=e.styles,C=void 0===f?{}:f,v=e.isOpen,y=e.onToggle,h=r(!1),g=h[0],N=h[1],O=void 0!==v?v:g;return i(n,{children:[i("span",t({onClick:function(t){return function(t){t.preventDefault(),t.stopPropagation(),m&&m(),y?y():void 0===v&&N(function(t){return!t})}(t)},className:a.pillButton,style:C.pillButton},{children:[s||(c?o("span",t({style:C.citationTitle},{children:c})):null),l&&(O?p:u)]})),l&&O&&o("div",t({className:a.citationWrapper,style:C.citationWrapper},{children:o("div",t({className:a.citationContent,style:C.citationContent},{children:d}))}))]})},function(t,i){return t.inLineCitation===i.inLineCitation&&t.citationTitle===i.citationTitle&&t.isOpen===i.isOpen&&JSON.stringify(t.styles)===JSON.stringify(i.styles)});export{l as default};
2
2
  //# sourceMappingURL=CitationRenderer.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i}from"tslib";import{jsxs as n,jsx as e}from"react/jsx-runtime";import{ChevronUp as l,ChevronDown as o}from"lucide-react";import{useState as t}from"react";import r from"./ResizableSplitPane.js";import d from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as a,DefaultFullScreenIcon as u}from"../../assests/svg/PdfViewerIcons.js";var s=function(n){var l,o,t,a,u,s,c,p,g,v,h,f=n.href,m=n.metaData,x=n.citationTitle,b=n.isFullscreen,_=function(i){try{return new URL(i,window.location.origin).searchParams.get("citationNumber")}catch(i){return null}}(f);if(!_)return null;var y=(null===(l=null==m?void 0:m.citations)||void 0===l?void 0:l[_])||{},w=(null===(o=null==m?void 0:m.docData)||void 0===o?void 0:o.documents)||{},C=(null===(t=null==m?void 0:m.docData)||void 0===t?void 0:t.input_index_map)||{},P=null==C?void 0:C[0],F=null==C?void 0:C[1],S=P?w[P]:null,D=F?w[F]:null,k=P?y[P]:null,j=F?y[F]:null;if(["contract","clause"].includes(x)){var z=k?e(d,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:S.title,pdfUrl:S.signed_url,highlightText:[null!==(a=null==k?void 0:k.highlighted_text)&&void 0!==a?a:""],highlightPages:{1:null===(u=null==k?void 0:k.custom_metadata)||void 0===u?void 0:u.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(s=null==k?void 0:k.custom_metadata)||void 0===s?void 0:s.pdf_start_page_number,null===(c=null==k?void 0:k.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]}):null,R=j?e(d,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:D.title,pdfUrl:D.signed_url,jumpToPageValue:1,highlightText:[null!==(p=null==j?void 0:j.highlighted_text)&&void 0!==p?p:""],highlightPages:{1:null===(g=null==j?void 0:j.custom_metadata)||void 0===g?void 0:g.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(v=null==j?void 0:j.custom_metadata)||void 0===v?void 0:v.pdf_start_page_number,null===(h=null==j?void 0:j.custom_metadata)||void 0===h?void 0:h.pdf_end_page_number]}):null;return e("div",k||j?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:e(r,{leftComponent:z,rightComponent:R,isFullscreen:b})}):{children:"Missing PDF Citation. Please try again later"})}return e("div",{children:"No Citation Found. Please try again later"})},c=function(r){var d,c,p,g=r.href,v=r.children,h=r.metaData,f=r.chevronUpComponent,m=void 0===f?null:f,x=r.chevronDownComponent,b=void 0===x?null:x,_=r.customStyle,y=void 0===_?{}:_,w=r.defaultState,C=t(void 0!==w&&w),P=C[0],F=C[1],S=t(!1),D=S[0],k=S[1],j="string"==typeof v&&(null===(d=null==v?void 0:v.split("\n"))||void 0===d?void 0:d.length)>1?v.split("\n").join(" "):v,z="string"==typeof v?v:v[0],R=null!=m?m:function(i){var n,o;return e(l,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(o=null==i?void 0:i.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(c=null==y?void 0:y.arrow)&&void 0!==c?c:{}),T=null!=b?b:function(i){var n,l;return e(o,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(l=null==i?void 0:i.color)&&void 0!==l?l:"rgb(214, 51, 132)"})}(null!==(p=null==y?void 0:y.arrow)&&void 0!==p?p:{});return n("span",i({style:i({display:"inline"},y.relativeWrapper||{})},{children:[e("div",i({style:i({display:"inline",marginTop:0},y.citationButtonWrapper||{})},{children:n("button",i({type:"button",onClick:function(){return F(function(i){return!i})},style:i({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},y.citationButton||{})},{children:[e("span",{children:j}),e("span",i({style:{display:"flex",alignItems:"center"}},{children:P?R:T}))]}))})),P&&n("div",i({style:D?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:e("button",i({onClick:function(){k(function(i){return!i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:e(D?a:u,{})}))})),e("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:e(s,{href:g,children:v,metaData:h,citationTitle:z,isFullscreen:D})}))]}))]}))};export{c as default};
1
+ import{__assign as i}from"tslib";import{jsxs as n,jsx as l}from"react/jsx-runtime";import{ChevronUp as e,ChevronDown as o}from"lucide-react";import{useState as t,useMemo as d}from"react";import r from"./ResizableSplitPane.js";import a from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as u,DefaultFullScreenIcon as s}from"../../assests/svg/PdfViewerIcons.js";var c=function(n){var e,o,t,u,s,c,v,g=n.href,p=n.metaData,h=n.citationTitle,m=n.isFullscreen,f=function(i){try{return new URL(i,window.location.origin).searchParams.get("citationNumber")}catch(i){return null}}(g);if(!f)return null;var _=(null===(e=null==p?void 0:p.citations)||void 0===e?void 0:e[f])||{},x=(null===(o=null==p?void 0:p.docData)||void 0===o?void 0:o.documents)||{},b=(null===(t=null==p?void 0:p.docData)||void 0===t?void 0:t.input_index_map)||{},y=null==b?void 0:b[0],w=null==b?void 0:b[1],C=y?x[y]:null,P=w?x[w]:null,F=y?_[y]:null,S=w?_[w]:null,D=d(function(){var i,n,e,o;return F?l(a,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==C?void 0:C.title,pdfUrl:null==C?void 0:C.signed_url,highlightText:[null!==(i=null==F?void 0:F.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==F?void 0:F.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(e=null==F?void 0:F.custom_metadata)||void 0===e?void 0:e.pdf_start_page_number,null===(o=null==F?void 0:F.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==C?void 0:C.title,null==C?void 0:C.signed_url,null==F?void 0:F.highlighted_text,null===(u=null==F?void 0:F.custom_metadata)||void 0===u?void 0:u.pdf_start_page_number,null===(s=null==F?void 0:F.custom_metadata)||void 0===s?void 0:s.pdf_end_page_number]),k=d(function(){var i,n,e,o;return S?l(a,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==P?void 0:P.title,pdfUrl:null==P?void 0:P.signed_url,jumpToPageValue:1,highlightText:[null!==(i=null==S?void 0:S.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==S?void 0:S.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(e=null==S?void 0:S.custom_metadata)||void 0===e?void 0:e.pdf_start_page_number,null===(o=null==S?void 0:S.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==P?void 0:P.title,null==P?void 0:P.signed_url,null==S?void 0:S.highlighted_text,null===(c=null==S?void 0:S.custom_metadata)||void 0===c?void 0:c.pdf_start_page_number,null===(v=null==S?void 0:S.custom_metadata)||void 0===v?void 0:v.pdf_end_page_number]);return["contract","clause"].includes(h)?l("div",F||S?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:d(function(){return l(r,{leftComponent:D,rightComponent:k,isFullscreen:m})},[D,k,m])}):{children:"Missing PDF Citation. Please try again later"}):l("div",{children:"No Citation Found. Please try again later"})},v=function(d){var r,a,v,g=d.href,p=d.children,h=d.metaData,m=d.chevronUpComponent,f=void 0===m?null:m,_=d.chevronDownComponent,x=void 0===_?null:_,b=d.customStyle,y=void 0===b?{}:b,w=d.defaultState,C=t(void 0!==w&&w),P=C[0],F=C[1],S=t(!1),D=S[0],k=S[1],j="string"==typeof p&&(null===(r=null==p?void 0:p.split("\n"))||void 0===r?void 0:r.length)>1?p.split("\n").join(" "):p,z="string"==typeof p?p:p[0],R=null!=f?f:function(i){var n,o;return l(e,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(o=null==i?void 0:i.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(a=null==y?void 0:y.arrow)&&void 0!==a?a:{}),T=null!=x?x:function(i){var n,e;return l(o,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(e=null==i?void 0:i.color)&&void 0!==e?e:"rgb(214, 51, 132)"})}(null!==(v=null==y?void 0:y.arrow)&&void 0!==v?v:{});return n("span",i({style:i({display:"inline"},y.relativeWrapper||{})},{children:[l("div",i({style:i({display:"inline",marginTop:0},y.citationButtonWrapper||{})},{children:n("button",i({type:"button",onClick:function(){return F(function(i){return!i})},style:i({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},y.citationButton||{})},{children:[l("span",{children:j}),l("span",i({style:{display:"flex",alignItems:"center"}},{children:P?R:T}))]}))})),P&&n("div",i({style:D?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"}},{children:[l("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:l("button",i({onClick:function(){k(function(i){return!i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:l(D?u:s,{})}))})),l("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:l(c,{href:g,children:p,metaData:h,citationTitle:z,isFullscreen:D})}))]}))]}))};export{v as default};
2
2
  //# sourceMappingURL=CitationAnchor.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 g}from"../../assests/svg/ButtonCognitiveIcon.js";import h from"./OverlayComponent.js";import{safeStringify as m,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 B,DEFAULT_COMPARISON_CONFIG as _}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as E,EMPTY_SUMMARY_POPUP_STATE as F,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 L}from"./hooks/useCompareData.js";import{useComparePopups as O}from"./hooks/useComparePopups.js";import{useSectionRefs as j}from"./hooks/useSectionRefs.js";import{useAccordionState as P}from"./hooks/useAccordionState.js";import{useDeviationNavigation as N}from"./hooks/useDeviationNavigation.js";import H from"./components/CompareHeader.js";import z 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,he,me,Se,xe,Re,ye,be,Ce,we,Be,_e,Ee,Fe,Ie,Te,Ae,De=U.componentHeaderText,ke=void 0===De?I:De,Le=U.treeData,Oe=U.comparisonConfig,je=U.leftColumnTitleText,Pe=U.rightColumnTitleText,Ne=U.markdownStyles,He=U.resetTrigger,ze=U.displayConfig,Me=void 0===ze?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:ze,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==Le?void 0:Le.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],hn=pn[1],mn=o(!1),Sn=mn[0],xn=mn[1],Rn=r(null),yn=r(null),bn=r(null),Cn=r(null),wn=r(null),Bn=r(!1),_n=r(null),En=r({}),Fn=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]),Ln=l(function(){return(null==Le?void 0:Le.cognitive_decisioning)||{}},[Le]),On=l(function(){return e(e({},w),Ne)},[Ne]),jn=r(null),Pn=r(null),Nn=r(null),Hn=r(null),zn=r(null),Mn=r(null),qn=r(null),Wn=r(null),Vn=r(null),Kn=r(null),Yn=O(jn),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==Oe?void 0:Oe.fields)&&void 0!==e?e:B,thresholds:{high:null!==(i=null===(n=null==Oe?void 0:Oe.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:_.thresholds.high,medium:null!==(o=null===(t=null==Oe?void 0:Oe.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:_.thresholds.medium,exact:null!==(l=null===(r=null==Oe?void 0:Oe.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:_.thresholds.exact}}},[Oe]),si=o(null),di=si[0];si[1];var vi=null===(ie=null===(ee=null==Le?void 0:Le.documents)||void 0===ee?void 0:ee[null===(ne=null==Le?void 0:Le.input_index_map)||void 0===ne?void 0:ne[0]])||void 0===ie?void 0:ie.title,fi=null===(re=null===(te=null==Le?void 0:Le.documents)||void 0===te?void 0:te[null===(oe=null==Le?void 0:Le.input_index_map)||void 0===oe?void 0:oe[1]])||void 0===re?void 0:re.title,pi=m(je||vi||"Uploaded Contract"),gi=null===(ae=null===(ce=null===(le=null==Le?void 0:Le.documents)||void 0===le?void 0:le[null===(ue=null==Le?void 0:Le.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,hi=m(gi),mi=null===(fe=null===(ve=null===(se=null==Le?void 0:Le.documents)||void 0===se?void 0:se[null===(de=null==Le?void 0:Le.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=m(mi),xi=m(Pe||fi||"Reference Template"),Ri=L(Le,Qe,kn,ai,sn),yi=Ri.activeProposed,bi=Ri.existingRule,Ci=Ri.proposedSections,wi=Ri.existingSections,Bi=Ri.visibleFields,_i=Ri.parentDeviationRecord,Ei=Ri.deviationNumberRegistry,Fi=Ri.parseError;u(function(){Fi&&an("Failed to load comparison: ".concat(Fi))},[Fi]);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=j(Bi.map(function(e){return e.key}),Math.max(Ci.length,wi.length)),Di=Ai.leftRefs,ki=Ai.rightRefs,Li=Ai.sectionLeftRefs,Oi=Ai.sectionRightRefs,ji=Ai.lhsBadgeRefs,Pi=Ai.rhsBadgeRefs,Ni=Ai.sectionRightRowRefs,Hi=Ai.subSectionLeftRefs,zi=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:jn,sectionLeftRefs:Li,sectionRightRefs:Oi,subSectionLeftRefs:Hi,subSectionRightRefs:zi,lhsBadgeRefs:ji,rhsBadgeRefs:Pi,sectionRowRefs:Mi,sectionRightRowRefs:Ni,rhsTopSpacerRef:Hn,rhsBottomSpacerRef:zn,lhsTopSpacerRef:Mn,lhsBottomSpacerRef:qn,calculateLinesRef:In,setConnectedSections:fn,setConnectedLines:hn,cachedConnectedPositions:Fn,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:hn,cachedConnectedPositions:Fn,svgContainerRef:Rn,isAnimatingRef:Bn,animationTimerRef:_n,calculateLinesRef:In,sectionLeftRefs:Li,sectionRightRefs:Oi,subSectionLeftRefs:Hi,subSectionRightRefs:zi}),st=at.expandedSections,dt=at.setExpandedSections,vt=at.expandedSubSections,ft=at.setExpandedSubSections,pt=at.handleSubSectionToggle,gt=at.toggleSection,ht=at.forceExpandCrossWiredSections,mt=function(){var e,n;if(null!=Qi){var i=null===(e=Li.current[Qi])||void 0===e?void 0:e.current,t=null===(n=Oi.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(){mt()}),n})},[mt]);u(function(){Ue&&"off"!==Ti&&"0:0"!==Ti&&(et.current=null,Fn.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=m(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!==(he=null==Le?void 0:Le.base_root_id)&&void 0!==he?he:"-1";null==Le||Le[Ct];var wt=sn?null!==(Fe=null!==(Be=Ve&&(null===(we=null==Ve?void 0:Ve[Ct])||void 0===we?void 0:we.evaluation_result))&&void 0!==Be?Be:null===(Ee=null===(_e=null==Le?void 0:Le.nodes)||void 0===_e?void 0:_e[Ct])||void 0===Ee?void 0:Ee.evaluation_result)&&void 0!==Fe?Fe:null:null!==(Ce=null!==(xe=Ve&&(null===(Se=null===(me=null==Ve?void 0:Ve[Ct])||void 0===me?void 0:me.evaluation_result)||void 0===Se?void 0:Se[0]))&&void 0!==xe?xe:null===(be=null===(ye=null===(Re=null==Le?void 0:Le.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,Bt=S(wt),_t=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:E),Et=r(ut);u(function(){Et.current=ut},[ut]);var Ft=r(ui);u(function(){Ft.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 Lo.current(e,n)},[]),kt=c(function(e){return Oo.current(e)},[]),Lt=c(function(e){return jo.current(e)},[]),Ot=c(function(){return Po.current()},[]),jt=c(function(){var e,n;lt(),null===(e=Et.current)||void 0===e||e.call(Et),xn(!1),fn(new Set),hn([]),Fn.current=[],Qt([]),eo(null),ni(F),null===(n=Ft.current)||void 0===n||n.call(Ft),requestAnimationFrame(function(){var e;null===(e=In.current)||void 0===e||e.call(In)})},[]),Pt=r(jt);u(function(){Pt.current=jt},[jt]),u(function(){He&&Pt.current()},[He]);var Nt=c(function(n,i,t,o,r,l,u){var c,a,s,d=m(null==i?void 0:i.id)||m(null==t?void 0:t.id)||"",v=(d?Ln[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==Le?void 0:Le.documents,input_index_map:null==Le?void 0:Le.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}},[Ln,Le]),Ht=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),hn([]),Fn.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=ji.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=ji.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]),zt=c(function(){var e=$n.sectionIdx;$n.isOrphan,ci(),ii(),null!==e&&(ht(e),lt(),nt.current&&ut(),hn([]),Fn.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,Li,Hi)},Wn.current),-1!==l&&Nn.current&&c(function(){return u(i,o,Oi,zi)},Nn.current);else{var a=jn.current;if(!a)return;c(function(){return-1!==r?u(n,t,Li,Hi):u(i,o,Oi,zi)},a)}}},[Ci,wi,Qe,Li,Oi,Hi,zi,Wn,Nn,jn]),qt=c(function(n){if(n){lt(),ut(),fn(new Set),hn([]),Fn.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:Ln,deviationData:Ve,treeData:Le,resolvedComparisonConfig:ai}),Jt=Yt.getSectionCompareStyle,Xt=Yt.getSubSectionCompareStyle,$t=Yt.getDeviationStyleByKey,Ut=J({containerRef:yn,leftContainerRef:Wn,rightContainerRef:Nn,svgContainerRef:Rn,pathRefs:En,leftHeaderRef:bn,rightHeaderRef:Cn,proposedSections:Ci,existingSections:wi,visibleFields:Bi,leftRefs:Di,rightRefs:ki,sectionLeftRefs:Li,sectionRightRefs:Oi,subSectionLeftRefs:Hi,subSectionRightRefs:zi,lhsBadgeRefs:ji,rhsBadgeRefs:Pi,sectionRowRefs:Mi,expandedSections:st,expandedSubSections:vt,connectedSections:vn,isSideBySide:Yi,activeSideBySideSection:Qi,maintainRelativeOrder:Qe,cognitiveMap:Ln,getSectionCompareStyle:Jt,getSubSectionCompareStyle:Xt,getDeviationStyleByKey:$t,isArrowVisible:Ji,isAnimatingRef:Bn,isSideBySideRef:nt,sideBySideCacheRef:et,sideBySideLineRef:ot,activeSideBySideSectionRef:tt,activeSideBySideRightSectionRef:it,connectedLines:gn,setConnectedLines:hn,cachedConnectedPositions:Fn,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),hn([]),Fn.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:jn,containerRef:yn,maintainRelativeOrder:Qe,proposedSections:Ci,existingSections:wi,isSideBySideRef:nt,activeSideBySideSectionRef:tt,activeSideBySideRightSectionRef:it,sectionRowRefs:Mi,sectionRightRowRefs:Ni,sectionLeftRefs:Li,sectionRightRefs:Oi,subSectionLeftRefs:Hi,subSectionRightRefs:zi,lhsBadgeRefs:ji,rhsBadgeRefs:Pi,leftContainerRef:Wn,rightContainerRef:Nn,calculateLinesRef:In,handleResizeRef:An,setIsResizing:Ui,setIsArrowVisible:Xi,sideBySideCacheRef:et,cachedConnectedPositions:Fn}).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(){})),jn.current&&o.push(e(jn.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"),ht(n),ct(n,i,{sourceSide:t})}},[ct,$n.isOrphan,$n.sectionIdx,$n.anchorEl,ii]),vo=c(function(){ii(),ut(),fn(new Set),hn([]),Fn.current=[]},[ii,ut]),fo=null!==$n.sectionIdx&&vn.has($n.sectionIdx),po=N({proposedSections:Ci,existingSections:wi,parentDeviationRecord:_i,expandedSections:st,maintainRelativeOrder:!!Qe,scrollContainerRef:jn,leftContainerRef:Wn,rightContainerRef:Nn,lhsBadgeRefs:ji,rhsBadgeRefs:Pi}),go=po.showDeviationNavigation,ho=po.showOpenNodeRef,mo=po.adjustScrollForPopup,So=c(function(e,n,i,t,o){var r,l="string"==typeof t?m(t).trim():m(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=ji.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=ji.current[n])||void 0===o?void 0:o.current};if(i)return ut(),fn(new Set),hn([]),Fn.current=[],void(l&&(ht(n),requestAnimationFrame(function(){var e=a()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ni({open:!0,anchorEl:e,summary:t,displayImpact:o})})));ht(n),l?setTimeout(function(){ct(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e,n,i,r=a()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var c=l.top-window.innerHeight/2;Qe?(null===(e=Wn.current)||void 0===e||e.scrollBy({top:c,behavior:"smooth"}),null===(n=Nn.current)||void 0===n||n.scrollBy({top:c,behavior:"smooth"})):null===(i=jn.current)||void 0===i||i.scrollBy({top:c,behavior:"smooth"})}}ni({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){ct(n,i,{toggleIfSame:!1,sourceSide:c})},350)},[ct,ui,ni,ut,ht]),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 _i){if((_i[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ke,_i]),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),hn([]),Fn.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}},h=null,m=null;for(var S in _i){var x=_i[S].find(function(e){return e.id===l});if(x){h=S,m=x;break}}if(m&&h){var R=Ci.findIndex(function(e){return e.id===h}),b=wi.findIndex(function(e){return e.id===h}),C=-1===R&&-1!==b,w=f(Ci,m.id),B=f(wi,m.id);if(w&&!B&&!C){var _=w.split("-"),E=Number(_[0]);if(Qe){var F=null===(o=null===(i=Ci[E])||void 0===i?void 0:i.refIndexes)||void 0===o?void 0:o[0],I=wi.findIndex(function(e){return e.selfIndex===F});-1!==I&&(E=I)}B=n([E],_.slice(1),!0).join("-")}if(w||B){var T=w?Number(w.split("-")[0]):R,A=B?Number(B.split("-")[0]):b,D=Ci[T],k=wi[A],L=D&&!D.title&&!D.content,O=k&&!k.title&&!k.content,j=C||(!w&&!!B||L&&!O),P=!1;if(T>=0&&!C)(Qe?!!st["left-".concat(T)]:!!st[String(T)])||(gt(T,"left"),P=!0);if(A>=0)(Qe?!!st["right-".concat(A)]:!!st[String(A)])||(gt(A,"right"),P=!0);if(P)return s+=1,void(d=setTimeout(p,450));var N,H=w||"",z=B||"",M="".concat(m.id).concat(y).concat(c).concat(y).concat(H).concat(y).concat(z),q="".concat(m.id).concat(y).concat(c),W=null===(r=ji.current[q])||void 0===r?void 0:r.current,V=null===(u=Pi.current[q])||void 0===u?void 0:u.current,K=j||!W&&!!V,Y=K?V:W;if(N=Qe?K?Nn.current:Wn.current:jn.current,Y&&N){var J=Y.getBoundingClientRect();if(0===J.height)return void((s+=1)<2?d=setTimeout(p,v):g());var X=N.getBoundingClientRect(),$=J.top-X.top+N.scrollTop-X.height/2+J.height/2,U=w&&w.includes("-")||B&&B.includes("-"),G=function(){var n,i,t,o,r;if(!a){g();var l=Y instanceof Element?window.getComputedStyle(Y).color:"";W&&(W.style.transition="box-shadow 300ms ease-in-out",W.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(){W&&(W.style.boxShadow=""),V&&(V.style.boxShadow="")},2e3);var u=(null===(i=null===(n=m.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===i?void 0:i[c])||m,s=(null===(t=m.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||m.evaluation_outputs;if(!(!!W&&!!V)){var d=K?(null===(o=Pi.current[U?q:A])||void 0===o?void 0:o.current)||V:(null===(r=ji.current[U?q:T])||void 0===r?void 0:r.current)||W;return mo(d,function(){ni({open:!0,anchorEl:d,displayImpact:Ke.displayImpact,summary:e(e({},u),{evaluation_outputs:s})})},{skipScroll:!0}),void(null==Ye||Ye())}ct(M,!1,{toggleIfSame:!1,sourceSide:C?"right":"left",onReady:function(){var n,i;g();var t=K?(null===(n=Pi.current[q])||void 0===n?void 0:n.current)||V:(null===(i=ji.current[q])||void 0===i?void 0:i.current)||W;ni({open:!0,anchorEl:t,displayImpact:Ke.displayImpact,summary:e({},u)}),null==Ye||Ye()}})}};Math.abs(N.scrollTop-$)<=2?G():(Vn.current=$,Kn.current=G,N.scrollTo({top:$,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,_i,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=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(ji.current)||r(Pi.current);if(l){var u=(null===(i=Pi.current[l])||void 0===i?void 0:i.current)||(null===(t=ji.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ni(function(n){return e(e({},n),{anchorEl:u})})}}}},[ei.open,ei.anchorEl,Sn,vn,st]);var bo=Jn.open,Co=Jn.sectionIdx,wo=Jn.isOrphan,Bo=Jn.badgeStyle,_o=Jn.anchorEl,Eo=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==Le?void 0:Le.nodes)||void 0===n?void 0:n[i])||(null==Le?void 0:Le[i]))||null,u="number"==typeof Co?wi[Co]||null:r,c=Nt(_o,l,u,Co,wo,Bo);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,Bo,_o,Eo,Ci,wi,Le,Ve,Nt]);var Fo=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(z,{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(Ht);u(function(){Ao.current=Ht},[Ht]);var Do=r(So);u(function(){Do.current=So},[So]);var ko=r(vo);u(function(){ko.current=vo},[vo]);var Lo=r(gt);u(function(){Lo.current=gt},[gt]);var Oo=r(pt);u(function(){Oo.current=pt},[pt]);var jo=r(Fo);u(function(){jo.current=Fo},[Fo]);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:Ei,treeData:Le,displayConfig:Me,resolvedMarkdownStyles:On,unifiedNumbering:xt,expandedSections:st,expandedSubSections:vt,setExpandedSubSections:ft,getSectionCompareStyle:Jt,getSubSectionCompareStyle:Xt,getBadgeRef:Vi,getSectionRowRef:qi,getSubSectionRef:Wi,sectionLeftRefs:Li,sectionRightRefs:Oi,sectionRowRefs:Mi,sectionRightRowRefs:Ni,subSectionLeftRefs:Hi,subSectionRightRefs:zi,lhsBadgeRefs:ji,rhsBadgeRefs:Pi,openMoreFunctionsPopup:It,handleOpenSummaryPopup:Tt,openSummaryPopup:Tt,handleCloseSummaryPopup:At,toggleSection:Dt,handleSubSectionToggle:kt,renderSubSectionAccordion:Lt,resetSideBySide:Ot,setConnectedSections:fn,setConnectedLines:hn,cachedConnectedPositions:Fn,showDeviationNavigation:go,showOpenNodeRef:ho,deviationNodeIdToView:null==Ke?void 0:Ke.id,deviationTargetParentId:xo}},[Qe,tn,Xe,$e,Ue,Yi,Qi,Sn,St,ei.anchorEl,vn,Ci,wi,Ei,Le,Me,On,xt,st,vt,ft,Jt,Xt,Vi,qi,Wi,go,ho,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:jn.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:zt,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:hi,referenceSectionTitle:Si,cognitiveData:Jn.cognitiveData,anchorEl:Jn.anchorEl,sectionAnchorEl:Jn.sectionAnchorEl,scrollContainerEl:jn.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(H,{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),hn([]),Fn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ln(!1)},600)})})},50)}}),i(a,e({ref:jn,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:_t,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:En}),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({},_t),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:_t.badgeBg,color:_t.badgeText,border:"1px solid ".concat(_t.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(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(h,{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:Hn,style:{width:"100%",height:"0px",flexShrink:0}}),Ii&&To,i("div",{ref:zn,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 h from"./OverlayComponent.js";import{safeStringify as m,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 B,DEFAULT_COMPARISON_CONFIG as _}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as E,EMPTY_SUMMARY_POPUP_STATE as F,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 L}from"./hooks/useCompareData.js";import{useComparePopups as O}from"./hooks/useComparePopups.js";import{useSectionRefs as j}from"./hooks/useSectionRefs.js";import{useAccordionState as P}from"./hooks/useAccordionState.js";import{useDeviationNavigation as N}from"./hooks/useDeviationNavigation.js";import H from"./components/CompareHeader.js";import z 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,he,me,Se,xe,Re,ye,be,Ce,we,Be,_e,Ee,Fe,Ie,Te,Ae,De=U.componentHeaderText,ke=void 0===De?I:De,Le=U.treeData,Oe=U.comparisonConfig,je=U.leftColumnTitleText,Pe=U.rightColumnTitleText,Ne=U.markdownStyles,He=U.resetTrigger,ze=U.displayConfig,Me=void 0===ze?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:ze,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==Le?void 0:Le.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],hn=pn[1],mn=o(!1),Sn=mn[0],xn=mn[1],Rn=r(null),yn=r(null),bn=r(null),Cn=r(null),wn=r(null),Bn=r(!1),_n=r(null),En=r({}),Fn=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]),Ln=l(function(){return(null==Le?void 0:Le.cognitive_decisioning)||{}},[Le]),On=l(function(){return e(e({},w),Ne)},[Ne]),jn=r(null),Pn=r(null),Nn=r(null),Hn=r(null),zn=r(null),Mn=r(null),qn=r(null),Wn=r(null),Vn=r(null),Kn=r(null),Yn=O(jn),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==Oe?void 0:Oe.fields)&&void 0!==e?e:B,thresholds:{high:null!==(i=null===(n=null==Oe?void 0:Oe.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:_.thresholds.high,medium:null!==(o=null===(t=null==Oe?void 0:Oe.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:_.thresholds.medium,exact:null!==(l=null===(r=null==Oe?void 0:Oe.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:_.thresholds.exact}}},[Oe]),si=o(null),di=si[0];si[1];var vi=null===(ie=null===(ee=null==Le?void 0:Le.documents)||void 0===ee?void 0:ee[null===(ne=null==Le?void 0:Le.input_index_map)||void 0===ne?void 0:ne[0]])||void 0===ie?void 0:ie.title,fi=null===(re=null===(te=null==Le?void 0:Le.documents)||void 0===te?void 0:te[null===(oe=null==Le?void 0:Le.input_index_map)||void 0===oe?void 0:oe[1]])||void 0===re?void 0:re.title,pi=m(je||vi||"Uploaded Contract"),gi=null===(ae=null===(ce=null===(le=null==Le?void 0:Le.documents)||void 0===le?void 0:le[null===(ue=null==Le?void 0:Le.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,hi=m(gi),mi=null===(fe=null===(ve=null===(se=null==Le?void 0:Le.documents)||void 0===se?void 0:se[null===(de=null==Le?void 0:Le.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=m(mi),xi=m(Pe||fi||"Reference Template"),Ri=L(Le,Qe,kn,ai,sn),yi=Ri.activeProposed,bi=Ri.existingRule,Ci=Ri.proposedSections,wi=Ri.existingSections,Bi=Ri.visibleFields,_i=Ri.parentDeviationRecord,Ei=Ri.deviationNumberRegistry,Fi=Ri.parseError;u(function(){Fi&&an("Failed to load comparison: ".concat(Fi))},[Fi]);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=j(Bi.map(function(e){return e.key}),Math.max(Ci.length,wi.length)),Di=Ai.leftRefs,ki=Ai.rightRefs,Li=Ai.sectionLeftRefs,Oi=Ai.sectionRightRefs,ji=Ai.lhsBadgeRefs,Pi=Ai.rhsBadgeRefs,Ni=Ai.sectionRightRowRefs,Hi=Ai.subSectionLeftRefs,zi=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:jn,sectionLeftRefs:Li,sectionRightRefs:Oi,subSectionLeftRefs:Hi,subSectionRightRefs:zi,lhsBadgeRefs:ji,rhsBadgeRefs:Pi,sectionRowRefs:Mi,sectionRightRowRefs:Ni,rhsTopSpacerRef:Hn,rhsBottomSpacerRef:zn,lhsTopSpacerRef:Mn,lhsBottomSpacerRef:qn,calculateLinesRef:In,setConnectedSections:fn,setConnectedLines:hn,cachedConnectedPositions:Fn,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:hn,cachedConnectedPositions:Fn,svgContainerRef:Rn,isAnimatingRef:Bn,animationTimerRef:_n,calculateLinesRef:In,sectionLeftRefs:Li,sectionRightRefs:Oi,subSectionLeftRefs:Hi,subSectionRightRefs:zi}),st=at.expandedSections,dt=at.setExpandedSections,vt=at.expandedSubSections,ft=at.setExpandedSubSections,pt=at.handleSubSectionToggle,gt=at.toggleSection,ht=at.forceExpandCrossWiredSections,mt=function(){var e,n;if(null!=Qi){var i=null===(e=Li.current[Qi])||void 0===e?void 0:e.current,t=null===(n=Oi.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(){mt()}),n})},[mt]);u(function(){Ue&&"off"!==Ti&&"0:0"!==Ti&&(et.current=null,Fn.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&&!(!t.title&&!t.content)){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=m(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!==(he=null==Le?void 0:Le.base_root_id)&&void 0!==he?he:"-1";null==Le||Le[Ct];var wt=sn?null!==(Fe=null!==(Be=Ve&&(null===(we=null==Ve?void 0:Ve[Ct])||void 0===we?void 0:we.evaluation_result))&&void 0!==Be?Be:null===(Ee=null===(_e=null==Le?void 0:Le.nodes)||void 0===_e?void 0:_e[Ct])||void 0===Ee?void 0:Ee.evaluation_result)&&void 0!==Fe?Fe:null:null!==(Ce=null!==(xe=Ve&&(null===(Se=null===(me=null==Ve?void 0:Ve[Ct])||void 0===me?void 0:me.evaluation_result)||void 0===Se?void 0:Se[0]))&&void 0!==xe?xe:null===(be=null===(ye=null===(Re=null==Le?void 0:Le.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,Bt=S(wt),_t=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:E),Et=r(ut);u(function(){Et.current=ut},[ut]);var Ft=r(ui);u(function(){Ft.current=ui},[ui]);var It=c(function(e,n,i,t,o,r){return Do.current(e,n,i,t,o,r)},[]),Tt=c(function(e,n,i,t,o){return ko.current(e,n,i,t,o)},[]),At=c(function(){return Lo.current()},[]),Dt=c(function(e,n){return Oo.current(e,n)},[]),kt=c(function(e){return jo.current(e)},[]),Lt=c(function(e){return Po.current(e)},[]),Ot=c(function(){return No.current()},[]),jt=c(function(){var e,n;lt(),null===(e=Et.current)||void 0===e||e.call(Et),xn(!1),fn(new Set),hn([]),Fn.current=[],Zt([]),no(null),ni(F),null===(n=Ft.current)||void 0===n||n.call(Ft),requestAnimationFrame(function(){var e;null===(e=In.current)||void 0===e||e.call(In)})},[]),Pt=r(jt);u(function(){Pt.current=jt},[jt]),u(function(){He&&Pt.current()},[He]);var Nt=l(function(){return{documents:null==Le?void 0:Le.documents,input_index_map:null==Le?void 0:Le.input_index_map}},[null==Le?void 0:Le.documents,null==Le?void 0:Le.input_index_map]),Ht=c(function(n,i,t,o,r,l,u){var c,a,s,d=m(null==i?void 0:i.id)||m(null==t?void 0:t.id)||"",v=(d?Ln[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:Nt,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}},[Ln,Le,Nt]),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),hn([]),Fn.current=[],ui(),ei.open?fo():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=ji.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=ji.current[o])||void 0===t?void 0:t.current}()||u;Un(Ht(e,n,t,o,i,r))})}},[$n.open,$n.sectionIdx,ci,ii,Ht]),Mt=c(function(){var e=$n.sectionIdx;$n.isOrphan,ci(),ii(),null!==e&&(ht(e),lt(),nt.current&&ut(),hn([]),Fn.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]),qt=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,Li,Hi)},Wn.current),-1!==l&&Nn.current&&c(function(){return u(i,o,Oi,zi)},Nn.current);else{var a=jn.current;if(!a)return;c(function(){return-1!==r?u(n,t,Li,Hi):u(i,o,Oi,zi)},a)}}},[Ci,wi,Qe,Li,Oi,Hi,zi,Wn,Nn,jn]),Wt=c(function(n){if(n){lt(),ut(),fn(new Set),hn([]),Fn.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&&Vt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Ci,wi,Qe,dt,ft,ut,ii,ui]),Vt=r(qt);u(function(){Vt.current=qt},[qt]);var Kt=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 Yt=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]),Jt=K({proposedSections:Ci,existingSections:wi,maintainRelativeOrder:Qe,cognitiveMap:Ln,deviationData:Ve,treeData:Le,resolvedComparisonConfig:ai}),Xt=Jt.getSectionCompareStyle,$t=Jt.getSubSectionCompareStyle,Ut=Jt.getDeviationStyleByKey,Gt=J({containerRef:yn,leftContainerRef:Wn,rightContainerRef:Nn,svgContainerRef:Rn,pathRefs:En,leftHeaderRef:bn,rightHeaderRef:Cn,proposedSections:Ci,existingSections:wi,visibleFields:Bi,leftRefs:Di,rightRefs:ki,sectionLeftRefs:Li,sectionRightRefs:Oi,subSectionLeftRefs:Hi,subSectionRightRefs:zi,lhsBadgeRefs:ji,rhsBadgeRefs:Pi,sectionRowRefs:Mi,expandedSections:st,expandedSubSections:vt,connectedSections:vn,isSideBySide:Yi,activeSideBySideSection:Qi,maintainRelativeOrder:Qe,cognitiveMap:Ln,getSectionCompareStyle:Xt,getSubSectionCompareStyle:$t,getDeviationStyleByKey:Ut,isArrowVisible:Ji,isAnimatingRef:Bn,isSideBySideRef:nt,sideBySideCacheRef:et,sideBySideLineRef:ot,activeSideBySideSectionRef:tt,activeSideBySideRightSectionRef:it,connectedLines:gn,setConnectedLines:hn,cachedConnectedPositions:Fn,calculateLinesRef:In,resizeTimerRef:Tn,scrollLock:Zi,scrollSyncLocked:Sn,handleResizeRef:An,activeProposed:yi,existingRule:bi,analysisData:Rt,pendingScrollTargetRef:Vn,pendingScrollCallbackRef:Kn,resolvedComparisonConfig:ai,getFieldData:Yt}),Qt=Gt.lines,Zt=Gt.setLines,eo=Gt.overallConnector,no=Gt.setOverallConnector,io=Gt.svgDimensions,to=Gt.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 oo=c(function(){lt(),xn(!1),dt({}),ft({}),ut(),fn(new Set),hn([]),Fn.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 ro=l(function(){return Object.values(st).some(Boolean)||Object.values(vt).some(Boolean)},[st,vt]),lo=r(null),uo=r(0),co=r(0),ao=r(0),so=Y({timerRef:lo,ruleComponentRef:Pn,scrollContainerRef:jn,containerRef:yn,maintainRelativeOrder:Qe,proposedSections:Ci,existingSections:wi,isSideBySideRef:nt,activeSideBySideSectionRef:tt,activeSideBySideRightSectionRef:it,sectionRowRefs:Mi,sectionRightRowRefs:Ni,sectionLeftRefs:Li,sectionRightRefs:Oi,subSectionLeftRefs:Hi,subSectionRightRefs:zi,lhsBadgeRefs:ji,rhsBadgeRefs:Pi,leftContainerRef:Wn,rightContainerRef:Nn,calculateLinesRef:In,handleResizeRef:An,setIsResizing:Ui,setIsArrowVisible:Xi,sideBySideCacheRef:et,cachedConnectedPositions:Fn}).handleResize;u(function(){An.current=so},[so,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,uo,n,function(){return An.current()},function(){})),jn.current&&o.push(e(jn.current,co,i,function(){return An.current()},function(){return In.current()})),yn.current&&o.push(e(yn.current,ao,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 vo=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"),ht(n),ct(n,i,{sourceSide:t})}},[ct,$n.isOrphan,$n.sectionIdx,$n.anchorEl,ii]),fo=c(function(){ii(),ut(),fn(new Set),hn([]),Fn.current=[]},[ii,ut]),po=null!==$n.sectionIdx&&vn.has($n.sectionIdx),go=N({proposedSections:Ci,existingSections:wi,parentDeviationRecord:_i,expandedSections:st,maintainRelativeOrder:!!Qe,scrollContainerRef:jn,leftContainerRef:Wn,rightContainerRef:Nn,lhsBadgeRefs:ji,rhsBadgeRefs:Pi}),ho=go.showDeviationNavigation,mo=go.showOpenNodeRef,So=go.adjustScrollForPopup,xo=c(function(e,n,i,t,o){var r,l="string"==typeof t?m(t).trim():m(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=ji.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=ji.current[n])||void 0===o?void 0:o.current};if(i)return ut(),fn(new Set),hn([]),Fn.current=[],void(l&&(ht(n),requestAnimationFrame(function(){var e=a()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ni({open:!0,anchorEl:e,summary:t,displayImpact:o})})));ht(n),l?setTimeout(function(){ct(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e,n,i,r=a()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var c=l.top-window.innerHeight/2;Qe?(null===(e=Wn.current)||void 0===e||e.scrollBy({top:c,behavior:"smooth"}),null===(n=Nn.current)||void 0===n||n.scrollBy({top:c,behavior:"smooth"})):null===(i=jn.current)||void 0===i||i.scrollBy({top:c,behavior:"smooth"})}}ni({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){ct(n,i,{toggleIfSame:!1,sourceSide:c})},350)},[ct,ui,ni,ut,ht]),Ro=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 _i){if((_i[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ke,_i]),yo=r({id:null,triggerMs:null}),bo=r(null);u(function(){var i;if(null==Ke?void 0:Ke.id){var t=Number(Ke.trigger),o=yo.current;if((null==o?void 0:o.triggerMs)!==t){if(!(Ke.id.includes(":")&&/:\d+$/.test(Ke.id)))return yo.current={id:Ke.id,triggerMs:t},void Wt(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";bo.current!==Ke.id&&(ii(),ui(),ut(),fn(new Set),hn([]),Fn.current=[],bo.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(){yo.current={id:Ke.id,triggerMs:t}},h=null,m=null;for(var S in _i){var x=_i[S].find(function(e){return e.id===l});if(x){h=S,m=x;break}}if(m&&h){var R=Ci.findIndex(function(e){return e.id===h}),b=wi.findIndex(function(e){return e.id===h}),C=-1===R&&-1!==b,w=f(Ci,m.id),B=f(wi,m.id);if(w&&!B&&!C){var _=w.split("-"),E=Number(_[0]);if(Qe){var F=null===(o=null===(i=Ci[E])||void 0===i?void 0:i.refIndexes)||void 0===o?void 0:o[0],I=wi.findIndex(function(e){return e.selfIndex===F});-1!==I&&(E=I)}B=n([E],_.slice(1),!0).join("-")}if(w||B){var T=w?Number(w.split("-")[0]):R,A=B?Number(B.split("-")[0]):b,D=Ci[T],k=wi[A],L=D&&!D.title&&!D.content,O=k&&!k.title&&!k.content,j=C||(!w&&!!B||L&&!O),P=!1;if(T>=0&&!C)(Qe?!!st["left-".concat(T)]:!!st[String(T)])||(gt(T,"left"),P=!0);if(A>=0)(Qe?!!st["right-".concat(A)]:!!st[String(A)])||(gt(A,"right"),P=!0);if(P)return s+=1,void(d=setTimeout(p,450));var N,H=w||"",z=B||"",M="".concat(m.id).concat(y).concat(c).concat(y).concat(H).concat(y).concat(z),q="".concat(m.id).concat(y).concat(c),W=null===(r=ji.current[q])||void 0===r?void 0:r.current,V=null===(u=Pi.current[q])||void 0===u?void 0:u.current,K=j||!W&&!!V,Y=K?V:W;if(N=Qe?K?Nn.current:Wn.current:jn.current,Y&&N){var J=Y.getBoundingClientRect();if(0===J.height)return void((s+=1)<2?d=setTimeout(p,v):g());var X=N.getBoundingClientRect(),$=J.top-X.top+N.scrollTop-X.height/2+J.height/2,U=w&&w.includes("-")||B&&B.includes("-"),G=function(){var n,i,t,o,r;if(!a){g();var l=Y instanceof Element?window.getComputedStyle(Y).color:"";W&&(W.style.transition="box-shadow 300ms ease-in-out",W.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(){W&&(W.style.boxShadow=""),V&&(V.style.boxShadow="")},2e3);var u=(null===(i=null===(n=m.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===i?void 0:i[c])||m,s=(null===(t=m.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||m.evaluation_outputs;if(!(!!W&&!!V)){var d=K?(null===(o=Pi.current[U?q:A])||void 0===o?void 0:o.current)||V:(null===(r=ji.current[U?q:T])||void 0===r?void 0:r.current)||W;return So(d,function(){ni({open:!0,anchorEl:d,displayImpact:Ke.displayImpact,summary:e(e({},u),{evaluation_outputs:s})})},{skipScroll:!0}),void(null==Ye||Ye())}ct(M,!1,{toggleIfSame:!1,sourceSide:C?"right":"left",onReady:function(){var n,i;g();var t=K?(null===(n=Pi.current[q])||void 0===n?void 0:n.current)||V:(null===(i=ji.current[q])||void 0===i?void 0:i.current)||W;ni({open:!0,anchorEl:t,displayImpact:Ke.displayImpact,summary:e({},u)}),null==Ye||Ye()}})}};Math.abs(N.scrollTop-$)<=2?G():(Vn.current=$,Kn.current=G,N.scrollTo({top:$,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,_i,Ci,wi,Qe,st,gt,ct,ni,Wt]),u(function(){var n,i,t;if(ei.open){var o=ei.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(ji.current)||r(Pi.current);if(l){var u=(null===(i=Pi.current[l])||void 0===i?void 0:i.current)||(null===(t=ji.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ni(function(n){return e(e({},n),{anchorEl:u})})}}}},[ei.open,ei.anchorEl,Sn,vn,st]);var Co=Jn.open,wo=Jn.sectionIdx,Bo=Jn.isOrphan,_o=Jn.badgeStyle,Eo=Jn.anchorEl,Fo=Jn.sectionAnchorEl;u(function(){var n;if(Co&&null!=wo&&wo!==Ct){var i="string"==typeof wo?wo.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 wo?Ci[wo]||null:o||i&&((null===(n=null==Le?void 0:Le.nodes)||void 0===n?void 0:n[i])||(null==Le?void 0:Le[i]))||null,u="number"==typeof wo?wi[wo]||null:r,c=Ht(Eo,l,u,wo,Bo,_o);Xn(function(n){return n.open?m(n.cognitiveData)===m(c.cognitiveData)&&m(n.deviationData)===m(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})}},[Co,wo,Bo,_o,Eo,Fo,Ci,wi,Le,Ve,Ht]);var Io=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(z,{section:n,keyPath:t,depth:r,columnKey:u,parentNodeId:a,sectionOffset:s})},[]),To=l(function(){return Ci.map(function(e,n){var t,o=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return o&&r?null:i(M,{section:e,idx:n},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(n))})},[Ci]),Ao=l(function(){return wi.map(function(e,n){var t,o=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return o&&r?null:i(q,{section:e,idx:n},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(n))})},[wi]),Do=r(zt);u(function(){Do.current=zt},[zt]);var ko=r(xo);u(function(){ko.current=xo},[xo]);var Lo=r(fo);u(function(){Lo.current=fo},[fo]);var Oo=r(gt);u(function(){Oo.current=gt},[gt]);var jo=r(pt);u(function(){jo.current=pt},[pt]);var Po=r(Io);u(function(){Po.current=Io},[Io]);var No=r(ut);u(function(){No.current=ut},[ut]);var Ho=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:Ei,treeData:Le,displayConfig:Me,resolvedMarkdownStyles:On,unifiedNumbering:xt,expandedSections:st,expandedSubSections:vt,setExpandedSubSections:ft,getSectionCompareStyle:Xt,getSubSectionCompareStyle:$t,getBadgeRef:Vi,getSectionRowRef:qi,getSubSectionRef:Wi,sectionLeftRefs:Li,sectionRightRefs:Oi,sectionRowRefs:Mi,sectionRightRowRefs:Ni,subSectionLeftRefs:Hi,subSectionRightRefs:zi,lhsBadgeRefs:ji,rhsBadgeRefs:Pi,openMoreFunctionsPopup:It,handleOpenSummaryPopup:Tt,openSummaryPopup:Tt,handleCloseSummaryPopup:At,toggleSection:Dt,handleSubSectionToggle:kt,renderSubSectionAccordion:Lt,resetSideBySide:Ot,setConnectedSections:fn,setConnectedLines:hn,cachedConnectedPositions:Fn,showDeviationNavigation:ho,showOpenNodeRef:mo,deviationNodeIdToView:null==Ke?void 0:Ke.id,deviationTargetParentId:Ro}},[Qe,tn,Xe,$e,Ue,Yi,Qi,Sn,St,ei.anchorEl,vn,Ci,wi,Ei,Le,Me,On,xt,st,vt,ft,Xt,$t,Vi,qi,Wi,ho,mo,Ke,Ro]);return i(V,e({value:Ho},{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:Kt.current,clipTopEl:bn.current,scrollContainerEl:jn.current,onClose:fo,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:vo,onConnect:Mt,isConnected:po,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:hi,referenceSectionTitle:Si,cognitiveData:Jn.cognitiveData,anchorEl:Jn.anchorEl,sectionAnchorEl:Jn.sectionAnchorEl,scrollContainerEl:jn.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(H,{componentHeaderText:ke,displayConfig:Me,maintainRelativeOrder:Qe,onCollapseAll:oo,showCollapseAll:ro,onToggleView:function(e){ln(!0),setTimeout(function(){Ze(!e),xn(!1),ut(),ii(),fn(new Set),hn([]),Fn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ln(!1)},600)})})},50)}}),i(a,e({ref:jn,onScroll:to,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:io,isResizing:$i,overallConnector:eo,rootDeviationStyle:_t,lines:Qt,isSideBySide:Yi,activeSideBySideSection:Qi,isArrowVisible:Ji,maintainRelativeOrder:Qe,proposedSections:Ci,existingSections:wi,cognitivePopup:Jn,activeBadgeId:Zn,closeCognitivePopup:ui,setActiveBadgeId:ti,openCognitivePopupFromState:li,buildSectionPopupState:Ht,connectedLines:gn,pathRefs:En}),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:to,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&&To,i("div",{ref:qn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(a,e({ref:Kt,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(Ht(n.currentTarget,{title:"",content:"",evaluationResult:wt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Ct,!0,e(e({},_t),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:_t.badgeBg,color:_t.badgeText,border:"1px solid ".concat(_t.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(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(h,{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:to,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:Hn,style:{width:"100%",height:"0px",flexShrink:0}}),Ii&&Ao,i("div",{ref:zn,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 l}from"tslib";import{useCallback as n}from"react";import{generateColorPalette as i,getFirstDeviationOutputValue as o,getFirstDeviationColor as e,safeStringify as u}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as t}from"../CognitiveCompareConstants.js";var v=function(v){var d=v.proposedSections,a=v.existingSections,r=v.maintainRelativeOrder,s=v.cognitiveMap,f=v.deviationData,c=v.treeData,p=v.resolvedComparisonConfig,b=n(function(n,u){var v,s,f;void 0===u&&(u="left");var c=null,p=null;if("left"===u)if(c=d[n],r&&c){var b=a.filter(function(l){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex)});p=b.find(function(l){return l.evaluationResult})||b[0]}else p=a[n];else if(p=a[n],r&&p){var m=d.filter(function(l){var n;return null===(n=l.refIndexes)||void 0===n?void 0:n.includes(p.selfIndex)});c=m.find(function(l){return l.evaluationResult})||m[0]}else c=d[n];var _=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,C=!(!(null==c?void 0:c.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!_&&!g&&!C)return l(l({},i(t)),{label:"Not Defined"});var D=null!==(s=null!==(v=null==c?void 0:c.evaluationResult)&&void 0!==v?v:null==p?void 0:p.evaluationResult)&&void 0!==s?s:null,S=o(D),R=e(D);return l(l({},i(R)),null!=D?{label:null!==(f=S)&&void 0!==f?f:""}:{label:null})},[d,a,s,p,r]),m=n(function(n){for(var v,r,s=n.split("-").map(Number),f=d[s[0]],c=a[s[0]],p=1;p<s.length;p++)(null==f?void 0:f.subsections)&&(f=f.subsections[s[p]]),(null==c?void 0:c.subsections)&&(c=c.subsections[s[p]]);if(!f&&!c)return null;var b=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,m=(null==c?void 0:c.relation)&&"not_defined"!==c.relation;u(null==f?void 0:f.id)||u(null==c?void 0:c.id);var _=!(!(null==f?void 0:f.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!b&&!m&&!_)return l(l({},i(t)),{label:null});var g=null!==(r=null!==(v=null==f?void 0:f.evaluationResult)&&void 0!==v?v:null==c?void 0:c.evaluationResult)&&void 0!==r?r:null,C=o(g),D=e(g);return l(l({},i(D)),null!=g?{label:null!=C?C:""}:{label:null})},[d,a,s,p]),_=n(function(n,e){var u,v,d,a,r,s,p,b,m,_,g,C,D,S,R,x,y,I,j,h,N;if(!n||null==e)return null;var B=null!==(r=null!==(v=null===(u=null==f?void 0:f[n])||void 0===u?void 0:u.evaluation_result)&&void 0!==v?v:null===(a=null===(d=null==c?void 0:c.nodes)||void 0===d?void 0:d[n])||void 0===a?void 0:a.evaluation_result)&&void 0!==r?r:null;if(!B||"object"!=typeof B)return null;var K=null!==(_=null!==(m=null!==(p=null===(s=null==B?void 0:B.deviations)||void 0===s?void 0:s[e])&&void 0!==p?p:null===(b=null==B?void 0:B.deviation_entries)||void 0===b?void 0:b[e])&&void 0!==m?m:null==B?void 0:B[e])&&void 0!==_?_:null,M=null!==(h=null!==(y=null!==(R=null!==(D=null===(C=null===(g=null==K?void 0:K.evaluation_outputs)||void 0===g?void 0:g.metadata)||void 0===C?void 0:C.label_color)&&void 0!==D?D:null===(S=null==K?void 0:K.evaluation_outputs)||void 0===S?void 0:S.label_color)&&void 0!==R?R:null===(x=null==K?void 0:K.metadata)||void 0===x?void 0:x.label_color)&&void 0!==y?y:null===(j=null===(I=null==B?void 0:B.evaluation_outputs)||void 0===I?void 0:I.metadata)||void 0===j?void 0:j.label_color)&&void 0!==h?h:t,O=null!==(N=o(K))&&void 0!==N?N:o(B);return l(l({},i(M)),{label:O})},[f,c]);return{getSectionCompareStyle:b,getSubSectionCompareStyle:m,getDeviationStyleByKey:_}};export{v as useStyleHelpers};
1
+ import{__assign as l}from"tslib";import{useCallback as n}from"react";import{generateColorPalette as i,getFirstDeviationOutputValue as o,getFirstDeviationColor as e,safeStringify as u}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as t}from"../CognitiveCompareConstants.js";var v=function(v){var d=v.proposedSections,a=v.existingSections,r=v.maintainRelativeOrder,s=v.cognitiveMap,f=v.deviationData,c=v.treeData,p=v.resolvedComparisonConfig,b=n(function(n,u){var v,s,f;void 0===u&&(u="left");var c=null,p=null;if("left"===u)if(c=d[n],r&&c){var b=a.filter(function(l){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex)});p=b.find(function(l){return l.evaluationResult})||b[0]}else p=a[n];else if(p=a[n],r&&p){var m=d.filter(function(l){var n;return null===(n=l.refIndexes)||void 0===n?void 0:n.includes(p.selfIndex)});c=m.find(function(l){return l.evaluationResult})||m[0]}else c=d[n];var _=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,C=!(!(null==c?void 0:c.cognitiveData)&&!(null==p?void 0:p.cognitiveData)),D="left"===u?!(null==c?void 0:c.title)&&!(null==c?void 0:c.content):!(null==p?void 0:p.title)&&!(null==p?void 0:p.content);if(!_&&!g&&!C)return l(l({},i(t)),{label:D?null:"Not Defined"});var S=null!==(s=null!==(v=null==c?void 0:c.evaluationResult)&&void 0!==v?v:null==p?void 0:p.evaluationResult)&&void 0!==s?s:null,R=o(S),x=e(S);return l(l({},i(x)),null!=S?{label:null!==(f=R)&&void 0!==f?f:""}:{label:null})},[d,a,s,p,r]),m=n(function(n){for(var v,r,s=n.split("-").map(Number),f=d[s[0]],c=a[s[0]],p=1;p<s.length;p++)(null==f?void 0:f.subsections)&&(f=f.subsections[s[p]]),(null==c?void 0:c.subsections)&&(c=c.subsections[s[p]]);if(!f&&!c)return null;var b=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,m=(null==c?void 0:c.relation)&&"not_defined"!==c.relation;u(null==f?void 0:f.id)||u(null==c?void 0:c.id);var _=!(!(null==f?void 0:f.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!b&&!m&&!_)return l(l({},i(t)),{label:null});var g=null!==(r=null!==(v=null==f?void 0:f.evaluationResult)&&void 0!==v?v:null==c?void 0:c.evaluationResult)&&void 0!==r?r:null,C=o(g),D=e(g);return l(l({},i(D)),null!=g?{label:null!=C?C:""}:{label:null})},[d,a,s,p]),_=n(function(n,e){var u,v,d,a,r,s,p,b,m,_,g,C,D,S,R,x,y,I,j,h,N;if(!n||null==e)return null;var B=null!==(r=null!==(v=null===(u=null==f?void 0:f[n])||void 0===u?void 0:u.evaluation_result)&&void 0!==v?v:null===(a=null===(d=null==c?void 0:c.nodes)||void 0===d?void 0:d[n])||void 0===a?void 0:a.evaluation_result)&&void 0!==r?r:null;if(!B||"object"!=typeof B)return null;var K=null!==(_=null!==(m=null!==(p=null===(s=null==B?void 0:B.deviations)||void 0===s?void 0:s[e])&&void 0!==p?p:null===(b=null==B?void 0:B.deviation_entries)||void 0===b?void 0:b[e])&&void 0!==m?m:null==B?void 0:B[e])&&void 0!==_?_:null,M=null!==(h=null!==(y=null!==(R=null!==(D=null===(C=null===(g=null==K?void 0:K.evaluation_outputs)||void 0===g?void 0:g.metadata)||void 0===C?void 0:C.label_color)&&void 0!==D?D:null===(S=null==K?void 0:K.evaluation_outputs)||void 0===S?void 0:S.label_color)&&void 0!==R?R:null===(x=null==K?void 0:K.metadata)||void 0===x?void 0:x.label_color)&&void 0!==y?y:null===(j=null===(I=null==B?void 0:B.evaluation_outputs)||void 0===I?void 0:I.metadata)||void 0===j?void 0:j.label_color)&&void 0!==h?h:t,O=null!==(N=o(K))&&void 0!==N?N:o(B);return l(l({},i(M)),{label:O})},[f,c]);return{getSectionCompareStyle:b,getSubSectionCompareStyle:m,getDeviationStyleByKey:_}};export{v as useStyleHelpers};
2
2
  //# sourceMappingURL=useStyles.js.map
@@ -16,6 +16,6 @@ interface CitationRendererProps {
16
16
  isOpen?: boolean;
17
17
  onToggle?: () => void;
18
18
  }
19
- declare const CitationRenderer: React.FC<CitationRendererProps>;
20
- export default CitationRenderer;
19
+ declare const _default: React.NamedExoticComponent<CitationRendererProps>;
20
+ export default _default;
21
21
  //# sourceMappingURL=CitationRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CitationRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/features/CitationRenderer/CitationRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAY,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlE,UAAU,qBAAqB;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,+BAA+B,CAAC,EAAE,GAAG,CAAC;IACtC,iBAAiB,CAAC,EAAE,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE;QACL,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;KACnC,CAAC;IACF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA6DrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"CitationRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/features/CitationRenderer/CitationRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAY,aAAa,EAAE,SAAS,EAAQ,MAAM,OAAO,CAAC;AAGxE,UAAU,qBAAqB;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,+BAA+B,CAAC,EAAE,GAAG,CAAC;IACtC,iBAAiB,CAAC,EAAE,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE;QACL,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;KACnC,CAAC;IACF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;;AAiED,wBASG"}
@@ -1 +1 @@
1
- {"version":3,"file":"CitationAnchor.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CitationAnchor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EACV,aAAa,EAKhB,MAAM,OAAO,CAAC;AAKf,UAAU,mBAAmB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE;QACV,qBAAqB,CAAC,EAAE,aAAa,CAAC;QACtC,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,cAAc,CAAC,EAAE,aAAa,CAAC;QAC/B,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAClC,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,SAAS,CAAC,EAAE,aAAa,CAAC;QAC1B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,mBAAmB,CAAC,EAAE,aAAa,CAAC;QACpC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,oBAAoB,CAAC,EAAE,aAAa,CAAC;QACrC,eAAe,CAAC,EAAE,aAAa,CAAC;KACnC,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB;AA6FD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAiKjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CitationAnchor.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CitationAnchor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EACV,aAAa,EAKhB,MAAM,OAAO,CAAC;AAKf,UAAU,mBAAmB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE;QACV,qBAAqB,CAAC,EAAE,aAAa,CAAC;QACtC,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,cAAc,CAAC,EAAE,aAAa,CAAC;QAC/B,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAClC,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,SAAS,CAAC,EAAE,aAAa,CAAC;QAC1B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,mBAAmB,CAAC,EAAE,aAAa,CAAC;QACpC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,oBAAoB,CAAC,EAAE,aAAa,CAAC;QACrC,eAAe,CAAC,EAAE,aAAa,CAAC;KACnC,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB;AAoHD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAiKjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAwCA,OAAO,EAEL,qBAAqB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA0BlC,QAAA,MAAM,gBAAgB,6QAwBnB,qBAAqB,4CA06EvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAwCA,OAAO,EAEL,qBAAqB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA0BlC,QAAA,MAAM,gBAAgB,6QAwBnB,qBAAqB,4CA47EvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useStyles.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtE,eAAO,MAAM,eAAe;sBAAuJ,YAAY,EAAE;sBAAoB,YAAY,EAAE;2BAAyB,OAAO;kBAAgB,GAAG;mBAAiB,GAAG;cAAY,GAAG;8BAA4B,GAAG;;kCAE9U,MAAM,SAAQ,MAAM,GAAG,OAAO,KAAY,YAAY,GAAG,IAAI;yCA0DrD,MAAM,KAAG,YAAY,GAAG,IAAI;qCA0D7B,MAAM,gBAAgB,MAAM,KAAG,YAAY,GAAG,IAAI;CA0ClE,CAAA"}
1
+ {"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useStyles.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtE,eAAO,MAAM,eAAe;sBAAuJ,YAAY,EAAE;sBAAoB,YAAY,EAAE;2BAAyB,OAAO;kBAAgB,GAAG;mBAAiB,GAAG;cAAY,GAAG;8BAA4B,GAAG;;kCAE9U,MAAM,SAAQ,MAAM,GAAG,OAAO,KAAY,YAAY,GAAG,IAAI;yCA8DrD,MAAM,KAAG,YAAY,GAAG,IAAI;qCA0D7B,MAAM,gBAAgB,MAAM,KAAG,YAAY,GAAG,IAAI;CA0ClE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viswa-test/test-citation",
3
- "version": "0.0.184",
3
+ "version": "0.0.186",
4
4
  "author": "Viswa Koduru",
5
5
  "description": "",
6
6
  "license": "MIT",