@viswa-test/test-citation 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("react-markdown"),s=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),c=require("./CognitivePopup.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(i),g=u(l),h={id:"",title:""};exports.default=function(l){var u,v,x,f,p,_,m,y,F=l.componentHeaderText,S=void 0===F?"Learning Comparison":F,b=l.treeData,E=l.comparisonConfig,w=l.leftColumnTitleText,C=l.rightColumnTitleText,j=i.useState(null),R=j[0],A=j[1],I=i.useMemo(function(){return(null==b?void 0:b.cognitive_decisioning)||{}},[b]);i.useRef(null);var B=i.useState(null),D=B[0],T=B[1],M=i.useRef(null),O=i.useState({width:0,height:0}),k=O[0],N=O[1];console.log("[cognitive compare] rendering");var L=i.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null}),z=L[0],H=L[1],W=i.useRef(null),P=i.useRef(null),q=i.useRef(!1),U=i.useRef(null);i.useEffect(function(){U.current=null},[z.sectionIdx,z.open]);var G=i.useCallback(function(){var e;if(z.anchorEl&&z.refSectionTitle){var n=z.anchorEl.getBoundingClientRect(),i=(null===(e=null==M?void 0:M.current)||void 0===e?void 0:e.offsetHeight)||0,t=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<i&&r>o;null!==U.current?!0===U.current&&(l=r>=i||r>=o):l=!(o>=i||o>=r),U.current=l;var s=l?r:o,a=Math.min(i||9999,s),c=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,d=u-t/2,g=Math.max(12,Math.min(d,window.innerWidth-t-12)),h=Math.max(14,Math.min(u-g,t-10-4));T({top:c,left:g,arrowLeft:h,openAbove:l,maxHeight:s})}},[z.anchorEl,z.refSectionTitle]);i.useEffect(function(){if(z.open){window.addEventListener("resize",G);var e=requestAnimationFrame(G),n=null;return M.current&&(n=new ResizeObserver(function(){e=requestAnimationFrame(G)})).observe(M.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",G),n&&n.disconnect()}}},[z.open,G]),i.useEffect(function(){var n=W.current;if(n&&z.open){var i=function(n){M.current&&M.current.contains(n.target)||(console.log("Scroll event detected on:",n.target,"- closing CognitivePopup"),T(null),H(function(n){return e.__assign(e.__assign({},n),{open:!1,anchorEl:null,sectionAnchorEl:null})}))};return n.addEventListener("scroll",i,{capture:!0}),window.addEventListener("scroll",i,{capture:!0}),function(){n.removeEventListener("scroll",i,{capture:!0}),window.removeEventListener("scroll",i,{capture:!0})}}},[z.open]);var V=i.useMemo(function(){var n,i,t,o,r,l,s,c,u,d,g,h;return{fields:null!==(n=null==E?void 0:E.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(i=null==E?void 0:E.thresholds)||void 0===i?void 0:i.high)&&void 0!==t?t:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(r=null===(o=null==E?void 0:E.thresholds)||void 0===o?void 0:o.medium)&&void 0!==r?r:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==E?void 0:E.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:a.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(c=null==E?void 0:E.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==E?void 0:E.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==E?void 0:E.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(g=null==E?void 0:E.relationStyles)||void 0===g?void 0:g.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(h=null==E?void 0:E.relationStyles)||void 0===h?void 0:h.low)||{})}}},[E]),K=i.useMemo(function(){if(b&&Object.keys(b).length>0)try{var n=function(n){var i,t,o,r,l=[],a=[],c=n.base_root_id,u=n.input_index_map||{0:"left",1:"right"},d=n[c];if(!d||!1===d.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var g=function(i){var t=n[i];if(t&&!1!==t.display_node){var o=s.getRationale(t),r=s.getSideData(t,"0",u),c=s.getSideData(t,"1",u),d=r.title.trim()||r.content.trim(),h=c.title.trim()||c.content.trim();l.push(e.__assign({id:i,title:d?r.title:"",content:d?r.content:"",subsections:[]},d?o:{score:void 0,relation:"not_defined"})),a.push(e.__assign({id:i,title:h?c.title:"",content:h?c.content:"",subsections:[]},h?o:{score:void 0,relation:"not_defined"})),t.next&&Object.values(t.next).forEach(g)}};return d.next&&Object.values(d.next).forEach(g),{activeProposed:{title:(null===(t=null===(i=d.comparison_inputs)||void 0===i?void 0:i[u[0]])||void 0===t?void 0:t.title)||"Uploaded Contract",description:d.decision_scope_description||"",sections:l},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(o=d.comparison_inputs)||void 0===o?void 0:o[u[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:a,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:d.decision_scope_description||""},fields:{}}}}]}}(b);return e.__assign(e.__assign({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[b]),Y=K.activeProposed,J=K.activeVariants,Q=K.parseError;i.useEffect(function(){Q&&A("Failed to load comparison: ".concat(Q))},[Q]);var X=i.useState(null),Z=X[0];X[1];var $=i.useState({}),ee=$[0],ne=$[1],ie=J[0]||h,te=null===(x=null===(u=null==b?void 0:b.documents)||void 0===u?void 0:u[null===(v=null==b?void 0:b.input_index_map)||void 0===v?void 0:v[0]])||void 0===x?void 0:x.title,oe=null===(_=null===(f=null==b?void 0:b.documents)||void 0===f?void 0:f[null===(p=null==b?void 0:b.input_index_map)||void 0===p?void 0:p[1]])||void 0===_?void 0:_.title,re=s.safeStringify(w||te||"Uploaded Contract"),le=s.safeStringify(C||oe||"Reference Template"),se=i.useMemo(function(){return Y.sections||[]},[Y.sections]),ae=i.useMemo(function(){return ie.sections||[]},[ie.sections]),ce=se.length>0||ae.length>0,ue=ie.analysis,de=s.safeStringify(null===(y=null===(m=null==ue?void 0:ue.rule_difference_comparison)||void 0===m?void 0:m.summary)||void 0===y?void 0:y.overall_summary),ge=!!de.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),he=i.useRef({}),ve=function(e){return he.current[e]||(he.current[e]=d.default.createRef()),he.current[e]},xe=i.useRef(null),fe=i.useRef(null),pe=i.useRef(null),_e=i.useState([]),me=_e[0],ye=_e[1],Fe=i.useState(null),Se=Fe[0],be=Fe[1],Ee=i.useMemo(function(){return V.fields.filter(function(e){var n=e.key;return(!ce||"description"!==n)&&(s.hasValue(Y[n])||s.hasValue(ie[n]))})},[Y,ie,ce,V.fields]),we=i.useRef({}),Ce=i.useRef({}),je=i.useRef({}),Re=i.useRef({});Ee.forEach(function(e){var n=e.key;we.current[n]||(we.current[n]=d.default.createRef()),Ce.current[n]||(Ce.current[n]=d.default.createRef())});for(var Ae=0;Ae<Math.max(se.length,ae.length);Ae+=1)je.current[Ae]||(je.current[Ae]=d.default.createRef()),Re.current[Ae]||(Re.current[Ae]=d.default.createRef());i.useEffect(function(){if(Z){var e=V.fields.find(function(e){return e.analysisKey===Z||e.key===Z});if(e){var n=we.current[e.key]||Ce.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Z,V.fields]);var Ie=i.useCallback(function(e){var n,i,t,o,r,l,s,a,c,u=null===(n=null==ue?void 0:ue.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],g=(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 h=d.mappings[0]||{};return{score:d.score,relation:h.relation||"",highlightsA:(null===(l=h.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=h.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!g}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!g}},[ue]),Be=i.useCallback(function(n){var i,t,o=se[n],r=ae[n],l=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,a=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,c=!(!(null==o?void 0:o.cognitiveData)&&!(null==r?void 0:r.cognitiveData));if(!l&&!a&&!c)return e.__assign(e.__assign({},V.relationStyles.noContent),{label:"Not Defined"});var u=Ie("description");if(null!=(null!==(i=null==o?void 0:o.cognitiveRelevanceScore)&&void 0!==i?i:null==r?void 0:r.cognitiveRelevanceScore)){var d=s.cognitiveScoreToRelation(),g=d.score,h=d.relation;return s.getStyleForRelation(g,h,!0,V)}var v=l?o.relation:a?r.relation:u.relation,x=null!==(t=null==o?void 0:o.score)&&void 0!==t?t:null==r?void 0:r.score,f="number"==typeof x?x:u.score;return s.getStyleForRelation(f,v,!0,V)},[se,ae,V,Ie]),De=i.useCallback(function(){var e,n,i,t,o,r,l,a,c,u,d;if(!q.current){q.current=!0;try{if(!xe.current)return;var g=xe.current.getBoundingClientRect();N({width:g.width,height:g.height});var h=[];Ee.forEach(function(e){var n,i,t=e.key,o=null===(n=we.current[t])||void 0===n?void 0:n.current,r=null===(i=Ce.current[t])||void 0===i?void 0:i.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")});for(var v=0;v<Math.min(se.length,ae.length);v++){var x=null===(e=je.current[v])||void 0===e?void 0:e.current,f=null===(n=Re.current[v])||void 0===n?void 0:n.current;x&&f&&(x.style.height="auto",f.style.height="auto",x.style.minHeight="0px",f.style.minHeight="0px")}var p={};Ee.forEach(function(e){var n,i,t=e.key,o=null===(n=we.current[t])||void 0===n?void 0:n.current,r=null===(i=Ce.current[t])||void 0===i?void 0:i.current;if(o&&r){var l=o.getBoundingClientRect(),s=r.getBoundingClientRect();p[t]=Math.max(l.height,s.height)}});var _=[];for(v=0;v<Math.min(se.length,ae.length);v++){x=null===(i=je.current[v])||void 0===i?void 0:i.current,f=null===(t=Re.current[v])||void 0===t?void 0:t.current;if(x&&f){var m=x.getBoundingClientRect(),y=f.getBoundingClientRect();_[v]=Math.max(m.height,y.height)}}Ee.forEach(function(e){var n,i,t=e.key,o=null===(n=we.current[t])||void 0===n?void 0:n.current,r=null===(i=Ce.current[t])||void 0===i?void 0:i.current;if(o&&r){var l=p[t];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}});for(v=0;v<_.length;v++){x=null===(o=je.current[v])||void 0===o?void 0:o.current,f=null===(r=Re.current[v])||void 0===r?void 0:r.current;if(x&&f){var F=_[v];x.style.minHeight="".concat(F,"px"),f.style.minHeight="".concat(F,"px")}}Ee.forEach(function(e){var n,i,t=e.key,o=e.analysisKey,r=null===(n=we.current[t])||void 0===n?void 0:n.current,l=null===(i=Ce.current[t])||void 0===i?void 0:i.current;if(r&&l){var a=r.getBoundingClientRect(),c=l.getBoundingClientRect(),u=Ie(o),d=s.getStyleForRelation(u.score,u.relation,u.hasContent,V);if(!d)return;var v=a.top+a.height/2-g.top;h.push({id:"field-".concat(t),x1:a.right-g.left,y1:v,x2:c.left-g.left,y2:v,style:d})}});for(v=0;v<Math.min(se.length,ae.length);v++){var S=null===(l=je.current[v])||void 0===l?void 0:l.current,b=null===(a=Re.current[v])||void 0===a?void 0:a.current;if(S&&b){var E=S.querySelector(".MuiAccordionSummary-root"),w=b.querySelector(".MuiAccordionSummary-root");if(E&&w){var C=E.getBoundingClientRect(),j=w.getBoundingClientRect(),R=(C.top+C.height/2-g.top+j.top+j.height/2-g.top)/2,A=(null===(c=ae[v])||void 0===c?void 0:c.id)||"sec-".concat(v),I=Be(v);I&&h.push({id:A,x1:C.right-g.left,y1:R,x2:j.left-g.left,y2:R,style:I,sectionIdx:v,hasCognitive:!(!(null===(u=se[v])||void 0===u?void 0:u.cognitiveData)&&!(null===(d=ae[v])||void 0===d?void 0:d.cognitiveData))})}}}if(ye(h),fe.current&&pe.current){var B=fe.current.getBoundingClientRect(),D=pe.current.getBoundingClientRect(),T=(B.top+B.height/2-g.top+D.top+D.height/2-g.top)/2;be({x1:B.right-g.left,x2:D.left-g.left,y:T})}else be(null)}catch(e){console.error("Line render safe fail: ",e)}finally{q.current=!1}}},[Ee,se,ae,V,Ie,Be]),Te=i.useCallback(function(){window.requestAnimationFrame(De)},[De]);i.useEffect(function(){var e=setTimeout(Te,250);window.addEventListener("resize",Te);var n=null,i=null;return W.current&&(n=new ResizeObserver(Te)).observe(W.current),xe.current&&(i=new ResizeObserver(Te)).observe(xe.current),function(){clearTimeout(e),window.removeEventListener("resize",Te),null==n||n.disconnect(),null==i||i.disconnect()}},[Y,ie,ue,Ee,ee,se,ae,V,Te]);var Me=function(i,r,l,c){var u,h=!s.hasValue(i.title)&&!s.hasValue(i.content);return n.jsx(t.Box,e.__assign({ref:c,sx:{mb:1,minHeight:0,display:"flex",flexDirection:"column"}},{children:n.jsxs(t.Accordion,e.__assign({disableGutters:!0,expanded:!h&&!!ee[r],onChange:function(){return!h&&(n=r,void ne(function(i){var t;return e.__assign(e.__assign({},i),((t={})[n]=!i[n],t))}));var n},sx:{boxShadow:"none",border:h?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:h?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[n.jsx(t.AccordionSummary,e.__assign({expandIcon:h?null:n.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:h?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:n.jsx(t.Tooltip,e.__assign({title:i.title||"No Matching Section Found",placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"12px",color:h?"#94A3B8":"#19213D",fontWeight:h?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=i.title||"No Matching Section Found",u?s.safeStringify(u).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(d.default.Fragment,{children:e},i)}):null)}))}))})),!h&&n.jsxs(t.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[n.jsx(t.Typography,e.__assign({component:"div",sx:a.SHARED_MARKDOWN_STYLES},{children:n.jsx(g.default,{children:s.safeStringify(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(i,o){return n.jsx(t.Box,e.__assign({sx:{mt:1,pt:1,borderTop:"1px solid #EEF2F7"}},{children:n.jsx(t.Typography,e.__assign({component:"div",sx:a.SHARED_MARKDOWN_STYLES},{children:n.jsx(g.default,{children:s.safeStringify(i).replace(/\\n/g,"\n")})}))}),"".concat(l,"-sub-").concat(r,"-").concat(o))})]}))]}))}),"".concat(l,"-sec-").concat(r))};return n.jsxs(t.Box,e.__assign({ref:P,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[z.open&&n.jsx(c.default,{open:z.open,popupRef:M,position:D,onClose:function(){T(null),H(function(n){return e.__assign(e.__assign({},n),{open:!1})})},sectionTitle:z.sectionTitle,referenceSectionTitle:z.refSectionTitle,cognitiveData:z.cognitiveData,anchorEl:z.anchorEl,sectionAnchorEl:z.sectionAnchorEl,scrollContainerEl:W.current,badgeStyle:z.badgeStyle}),n.jsx(t.Snackbar,e.__assign({open:!!R,autoHideDuration:8e3,onClose:function(){return A(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return A(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:R}))})),n.jsx(t.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:S}))}))})),n.jsx(t.Box,e.__assign({ref:W,sx:{flex:1,overflowY:"auto",minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:de&&ge?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:n.jsxs(t.Box,e.__assign({ref:xe,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0}},{children:[n.jsxs("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:k.width||"100%",height:k.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Se&&n.jsxs("g",{children:[n.jsx("line",{x1:Se.x1,y1:Se.y,x2:Math.max(Se.x1,(Se.x1+Se.x2)/2-70),y2:Se.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(Se.x2,(Se.x1+Se.x2)/2+70),y1:Se.y,x2:Se.x2,y2:Se.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),me.map(function(i,l){var a=(i.x1+i.x2)/2;return"Not Defined"!==i.style.label||i.hasCognitive?n.jsxs("g",{children:[n.jsx("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder,strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:a-75,y:i.y1-14,width:"150",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(t.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n.jsxs(t.Box,e.__assign({onClick:function(n){if(n.stopPropagation(),z.open&&z.sectionIdx===i.sectionIdx)return T(null),void H(function(n){return e.__assign(e.__assign({},n),{open:!1})});!function(e,n,i,t,o){var r,l;e.stopPropagation(),T(null);var a=s.safeStringify(n.id)||s.safeStringify(i.id)||"",c=(a?I[a]:null)||n.cognitiveData||i.cognitiveData||null,u=null!==(l=null===(r=he.current[t])||void 0===r?void 0:r.current)&&void 0!==l?l:null;H({open:!0,sectionTitle:n.title||"N/A",refSectionTitle:i.title||"NA",cognitiveData:c,anchorEl:e.currentTarget,sectionAnchorEl:u,badgeStyle:o||null,sectionIdx:t})}(n,se[i.sectionIdx]||{title:"",content:""},ae[i.sectionIdx]||{title:"",content:""},i.sectionIdx,i.style)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",cursor:"pointer",verticalAlign:"middle"}},{children:[i.hasCognitive&&void 0!==i.sectionIdx&&n.jsx(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",color:i.style.badgeText}},{children:n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(r.ButtonCognitiveIcon,{})}))})),z.open&&z.sectionIdx===i.sectionIdx?n.jsx(o.ChevronUp,{size:12,color:i.style.badgeText}):n.jsx(o.ChevronDown,{size:12,color:i.style.badgeText})]}))]}))}))}))]},l):null})]})),n.jsxs(t.Box,e.__assign({sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(t.Box,e.__assign({ref:fe,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center",overflow:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:re,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:re}))}))})),n.jsx(t.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:ce&&se.map(function(e,n){return{section:e,idx:n}}).map(function(i){var o=i.section,r=i.idx;return n.jsx(t.Box,e.__assign({ref:ve(r)},{children:Me(o,r,"left",je.current[r]||d.default.createRef())}),"left-row-".concat(r))})}))]})),n.jsx(t.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[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,{})})),0,"% Similarity",n.jsx(o.ChevronDown,{size:11})]}))}))})),n.jsxs(t.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(t.Box,e.__assign({ref:pe,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center",overflow:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:le,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:le}))}))})),n.jsx(t.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:ce&&ae.map(function(e,n){return{section:e,idx:n}}).map(function(e){var n=e.section,i=e.idx;return Me(n,i,"right",Re.current[i]||d.default.createRef())})}))]}))]}))}))}))]}))};
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("react-markdown"),s=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),c=require("./CognitivePopup.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(i),g=u(l),h={id:"",title:""};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(l){var u,v,x,f,p,_,m,y,F=l.componentHeaderText,S=void 0===F?"Learning Comparison":F,E=l.treeData,b=l.comparisonConfig,w=l.leftColumnTitleText,C=l.rightColumnTitleText,j=l.markdownStyles,R=i.useState(null),A=R[0],D=R[1],I=i.useMemo(function(){return(null==E?void 0:E.cognitive_decisioning)||{}},[E]);i.useRef(null);var B=i.useState(null),T=B[0],M=B[1],O=i.useRef(null),k=i.useState({width:0,height:0}),N=k[0],L=k[1],z=i.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),j)},[j]),H=i.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null}),W=H[0],P=H[1],q=i.useRef(null),U=i.useRef(null),G=i.useRef(!1),V=i.useRef(null);i.useEffect(function(){V.current=null},[W.sectionIdx,W.open]);var K=i.useCallback(function(){var e;if(W.anchorEl&&W.refSectionTitle){var n=W.anchorEl.getBoundingClientRect(),i=(null===(e=null==O?void 0:O.current)||void 0===e?void 0:e.offsetHeight)||0,t=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<i&&r>o;null!==V.current?!0===V.current&&(l=r>=i||r>=o):l=!(o>=i||o>=r),V.current=l;var s=l?r:o,a=Math.min(i||9999,s),c=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,d=u-t/2,g=Math.max(12,Math.min(d,window.innerWidth-t-12)),h=Math.max(14,Math.min(u-g,t-10-4));M({top:c,left:g,arrowLeft:h,openAbove:l,maxHeight:s})}},[W.anchorEl,W.refSectionTitle]);i.useEffect(function(){if(W.open){window.addEventListener("resize",K);var e=requestAnimationFrame(K),n=null;return O.current&&(n=new ResizeObserver(function(){e=requestAnimationFrame(K)})).observe(O.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",K),n&&n.disconnect()}}},[W.open,K]),i.useEffect(function(){var n=q.current;if(n&&W.open){var i=function(n){O.current&&O.current.contains(n.target)||(console.log("Scroll event detected on:",n.target,"- closing CognitivePopup"),M(null),P(function(n){return e.__assign(e.__assign({},n),{open:!1,anchorEl:null,sectionAnchorEl:null})}))};return n.addEventListener("scroll",i,{capture:!0}),window.addEventListener("scroll",i,{capture:!0}),function(){n.removeEventListener("scroll",i,{capture:!0}),window.removeEventListener("scroll",i,{capture:!0})}}},[W.open]);var Y=i.useMemo(function(){var n,i,t,o,r,l,s,c,u,d,g,h;return{fields:null!==(n=null==b?void 0:b.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(i=null==b?void 0:b.thresholds)||void 0===i?void 0:i.high)&&void 0!==t?t:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(r=null===(o=null==b?void 0:b.thresholds)||void 0===o?void 0:o.medium)&&void 0!==r?r:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==b?void 0:b.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:a.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(c=null==b?void 0:b.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==b?void 0:b.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==b?void 0:b.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(g=null==b?void 0:b.relationStyles)||void 0===g?void 0:g.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(h=null==b?void 0:b.relationStyles)||void 0===h?void 0:h.low)||{})}}},[b]),J=i.useMemo(function(){if(E&&Object.keys(E).length>0)try{var n=function(n){var i,t,o,r,l=[],a=[],c=n.base_root_id,u=n.input_index_map||{0:"left",1:"right"},d=n[c];if(!d||!1===d.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var g=function(i){var t=n[i];if(t&&!1!==t.display_node){var o=s.getRationale(t),r=s.getSideData(t,"0",u),c=s.getSideData(t,"1",u),d=r.title.trim()||r.content.trim(),h=c.title.trim()||c.content.trim();l.push(e.__assign({id:i,title:d?r.title:"",content:d?r.content:"",subsections:[]},d?o:{score:void 0,relation:"not_defined"})),a.push(e.__assign({id:i,title:h?c.title:"",content:h?c.content:"",subsections:[]},h?o:{score:void 0,relation:"not_defined"})),t.next&&Object.values(t.next).forEach(g)}};return d.next&&Object.values(d.next).forEach(g),{activeProposed:{title:(null===(t=null===(i=d.comparison_inputs)||void 0===i?void 0:i[u[0]])||void 0===t?void 0:t.title)||"Uploaded Contract",description:d.decision_scope_description||"",sections:l},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(o=d.comparison_inputs)||void 0===o?void 0:o[u[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:a,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:d.decision_scope_description||""},fields:{}}}}]}}(E);return e.__assign(e.__assign({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[E]),Q=J.activeProposed,X=J.activeVariants,Z=J.parseError;i.useEffect(function(){Z&&D("Failed to load comparison: ".concat(Z))},[Z]);var $=i.useState(null),ee=$[0];$[1];var ne=i.useState({}),ie=ne[0],te=ne[1],oe=X[0]||h,re=null===(x=null===(u=null==E?void 0:E.documents)||void 0===u?void 0:u[null===(v=null==E?void 0:E.input_index_map)||void 0===v?void 0:v[0]])||void 0===x?void 0:x.title,le=null===(_=null===(f=null==E?void 0:E.documents)||void 0===f?void 0:f[null===(p=null==E?void 0:E.input_index_map)||void 0===p?void 0:p[1]])||void 0===_?void 0:_.title,se=s.safeStringify(w||re||"Uploaded Contract"),ae=s.safeStringify(C||le||"Reference Template"),ce=i.useMemo(function(){return Q.sections||[]},[Q.sections]),ue=i.useMemo(function(){return oe.sections||[]},[oe.sections]),de=ce.length>0||ue.length>0,ge=oe.analysis,he=s.safeStringify(null===(y=null===(m=null==ge?void 0:ge.rule_difference_comparison)||void 0===m?void 0:m.summary)||void 0===y?void 0:y.overall_summary),ve=!!he.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),xe=i.useRef({}),fe=function(e){return xe.current[e]||(xe.current[e]=d.default.createRef()),xe.current[e]},pe=i.useRef(null),_e=i.useRef(null),me=i.useRef(null),ye=i.useState([]),Fe=ye[0],Se=ye[1],Ee=i.useState(null),be=Ee[0],we=Ee[1],Ce=i.useMemo(function(){return Y.fields.filter(function(e){var n=e.key;return(!de||"description"!==n)&&(s.hasValue(Q[n])||s.hasValue(oe[n]))})},[Q,oe,de,Y.fields]),je=i.useRef({}),Re=i.useRef({}),Ae=i.useRef({}),De=i.useRef({});Ce.forEach(function(e){var n=e.key;je.current[n]||(je.current[n]=d.default.createRef()),Re.current[n]||(Re.current[n]=d.default.createRef())});for(var Ie=0;Ie<Math.max(ce.length,ue.length);Ie+=1)Ae.current[Ie]||(Ae.current[Ie]=d.default.createRef()),De.current[Ie]||(De.current[Ie]=d.default.createRef());i.useEffect(function(){if(ee){var e=Y.fields.find(function(e){return e.analysisKey===ee||e.key===ee});if(e){var n=je.current[e.key]||Re.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[ee,Y.fields]);var Be=i.useCallback(function(e){var n,i,t,o,r,l,s,a,c,u=null===(n=null==ge?void 0:ge.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],g=(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 h=d.mappings[0]||{};return{score:d.score,relation:h.relation||"",highlightsA:(null===(l=h.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=h.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!g}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!g}},[ge]),Te=i.useCallback(function(n){var i,t,o=ce[n],r=ue[n],l=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,a=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,c=!(!(null==o?void 0:o.cognitiveData)&&!(null==r?void 0:r.cognitiveData));if(!l&&!a&&!c)return e.__assign(e.__assign({},Y.relationStyles.noContent),{label:"Not Defined"});var u=Be("description");if(null!=(null!==(i=null==o?void 0:o.cognitiveRelevanceScore)&&void 0!==i?i:null==r?void 0:r.cognitiveRelevanceScore)){var d=s.cognitiveScoreToRelation(),g=d.score,h=d.relation;return s.getStyleForRelation(g,h,!0,Y)}var v=l?o.relation:a?r.relation:u.relation,x=null!==(t=null==o?void 0:o.score)&&void 0!==t?t:null==r?void 0:r.score,f="number"==typeof x?x:u.score;return s.getStyleForRelation(f,v,!0,Y)},[ce,ue,Y,Be]),Me=i.useCallback(function(){var e,n,i,t,o,r,l,a,c,u,d;if(!G.current){G.current=!0;try{if(!pe.current)return;var g=pe.current.getBoundingClientRect();L({width:g.width,height:g.height});var h=[];Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")});for(var v=0;v<Math.min(ce.length,ue.length);v++){var x=null===(e=Ae.current[v])||void 0===e?void 0:e.current,f=null===(n=De.current[v])||void 0===n?void 0:n.current;x&&f&&(x.style.height="auto",f.style.height="auto",x.style.minHeight="0px",f.style.minHeight="0px")}var p={};Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(o&&r){var l=o.getBoundingClientRect(),s=r.getBoundingClientRect();p[t]=Math.max(l.height,s.height)}});var _=[];for(v=0;v<Math.min(ce.length,ue.length);v++){x=null===(i=Ae.current[v])||void 0===i?void 0:i.current,f=null===(t=De.current[v])||void 0===t?void 0:t.current;if(x&&f){var m=x.getBoundingClientRect(),y=f.getBoundingClientRect();_[v]=Math.max(m.height,y.height)}}Ce.forEach(function(e){var n,i,t=e.key,o=null===(n=je.current[t])||void 0===n?void 0:n.current,r=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(o&&r){var l=p[t];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}});for(v=0;v<_.length;v++){x=null===(o=Ae.current[v])||void 0===o?void 0:o.current,f=null===(r=De.current[v])||void 0===r?void 0:r.current;if(x&&f){var F=_[v];x.style.minHeight="".concat(F,"px"),f.style.minHeight="".concat(F,"px")}}Ce.forEach(function(e){var n,i,t=e.key,o=e.analysisKey,r=null===(n=je.current[t])||void 0===n?void 0:n.current,l=null===(i=Re.current[t])||void 0===i?void 0:i.current;if(r&&l){var a=r.getBoundingClientRect(),c=l.getBoundingClientRect(),u=Be(o),d=s.getStyleForRelation(u.score,u.relation,u.hasContent,Y);if(!d)return;var v=a.top+a.height/2-g.top;h.push({id:"field-".concat(t),x1:a.right-g.left,y1:v,x2:c.left-g.left,y2:v,style:d})}});for(v=0;v<Math.min(ce.length,ue.length);v++){var S=null===(l=Ae.current[v])||void 0===l?void 0:l.current,E=null===(a=De.current[v])||void 0===a?void 0:a.current;if(S&&E){var b=S.querySelector(".MuiAccordionSummary-root"),w=E.querySelector(".MuiAccordionSummary-root");if(b&&w){var C=b.getBoundingClientRect(),j=w.getBoundingClientRect(),R=(C.top+C.height/2-g.top+j.top+j.height/2-g.top)/2,A=(null===(c=ue[v])||void 0===c?void 0:c.id)||"sec-".concat(v),D=Te(v);D&&h.push({id:A,x1:C.right-g.left,y1:R,x2:j.left-g.left,y2:R,style:D,sectionIdx:v,hasCognitive:!(!(null===(u=ce[v])||void 0===u?void 0:u.cognitiveData)&&!(null===(d=ue[v])||void 0===d?void 0:d.cognitiveData))})}}}if(Se(h),_e.current&&me.current){var I=_e.current.getBoundingClientRect(),B=me.current.getBoundingClientRect(),T=(I.top+I.height/2-g.top+B.top+B.height/2-g.top)/2;we({x1:I.right-g.left,x2:B.left-g.left,y:T})}else we(null)}catch(e){console.error("Line render safe fail: ",e)}finally{G.current=!1}}},[Ce,ce,ue,Y,Be,Te]),Oe=i.useCallback(function(){window.requestAnimationFrame(Me)},[Me]);i.useEffect(function(){var e=setTimeout(Oe,250);window.addEventListener("resize",Oe);var n=null,i=null;return q.current&&(n=new ResizeObserver(Oe)).observe(q.current),pe.current&&(i=new ResizeObserver(Oe)).observe(pe.current),function(){clearTimeout(e),window.removeEventListener("resize",Oe),null==n||n.disconnect(),null==i||i.disconnect()}},[Q,oe,ge,Ce,ie,ce,ue,Y,Oe]);var ke=function(i,r,l,a){var c,u=!s.hasValue(i.title)&&!s.hasValue(i.content);return n.jsx(t.Box,e.__assign({ref:a,sx:{mb:1,minHeight:0,display:"flex",flexDirection:"column"}},{children:n.jsxs(t.Accordion,e.__assign({disableGutters:!0,expanded:!u&&!!ie[r],onChange:function(){return!u&&(n=r,void te(function(i){var t;return e.__assign(e.__assign({},i),((t={})[n]=!i[n],t))}));var n},sx:{boxShadow:"none",border:u?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:u?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[n.jsx(t.AccordionSummary,e.__assign({expandIcon:u?null:n.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:u?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:n.jsx(t.Tooltip,e.__assign({title:i.title||"No Matching Section Found",placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"12px",color:u?"#94A3B8":"#19213D",fontWeight:u?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(c=i.title||"No Matching Section Found",c?s.safeStringify(c).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(d.default.Fragment,{children:e},i)}):null)}))}))})),!u&&n.jsxs(t.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[n.jsx(t.Typography,e.__assign({component:"div",sx:z},{children:n.jsx(g.default,{children:s.safeStringify(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(i,o){return n.jsx(t.Box,e.__assign({sx:{mt:1,pt:1,borderTop:"1px solid #EEF2F7"}},{children:n.jsx(t.Typography,e.__assign({component:"div",sx:z},{children:n.jsx(g.default,{children:s.safeStringify(i).replace(/\\n/g,"\n")})}))}),"".concat(l,"-sub-").concat(r,"-").concat(o))})]}))]}))}),"".concat(l,"-sec-").concat(r))};return n.jsxs(t.Box,e.__assign({ref:U,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[W.open&&n.jsx(c.default,{open:W.open,popupRef:O,position:T,onClose:function(){M(null),P(function(n){return e.__assign(e.__assign({},n),{open:!1})})},markdownStyles:j,sectionTitle:W.sectionTitle,referenceSectionTitle:W.refSectionTitle,cognitiveData:W.cognitiveData,anchorEl:W.anchorEl,sectionAnchorEl:W.sectionAnchorEl,scrollContainerEl:q.current,badgeStyle:W.badgeStyle}),n.jsx(t.Snackbar,e.__assign({open:!!A,autoHideDuration:8e3,onClose:function(){return D(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return D(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:A}))})),n.jsx(t.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:S}))}))})),n.jsx(t.Box,e.__assign({ref:q,sx:{flex:1,overflowY:"auto",minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:he&&ve?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:n.jsxs(t.Box,e.__assign({ref:pe,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0}},{children:[n.jsxs("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:N.width||"100%",height:N.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[be&&n.jsxs("g",{children:[n.jsx("line",{x1:be.x1,y1:be.y,x2:Math.max(be.x1,(be.x1+be.x2)/2-70),y2:be.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(be.x2,(be.x1+be.x2)/2+70),y1:be.y,x2:be.x2,y2:be.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Fe.map(function(i,l){var a=(i.x1+i.x2)/2;return"Not Defined"!==i.style.label||i.hasCognitive?n.jsxs("g",{children:[n.jsx("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder,strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:a-75,y:i.y1-14,width:"150",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(t.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n.jsxs(t.Box,e.__assign({onClick:function(n){if(n.stopPropagation(),W.open&&W.sectionIdx===i.sectionIdx)return M(null),void P(function(n){return e.__assign(e.__assign({},n),{open:!1})});!function(e,n,i,t,o){var r,l;e.stopPropagation(),M(null);var a=s.safeStringify(n.id)||s.safeStringify(i.id)||"",c=(a?I[a]:null)||n.cognitiveData||i.cognitiveData||null,u=null!==(l=null===(r=xe.current[t])||void 0===r?void 0:r.current)&&void 0!==l?l:null;P({open:!0,sectionTitle:n.title||"N/A",refSectionTitle:i.title||"NA",cognitiveData:c,anchorEl:e.currentTarget,sectionAnchorEl:u,badgeStyle:o||null,sectionIdx:t})}(n,ce[i.sectionIdx]||{title:"",content:""},ue[i.sectionIdx]||{title:"",content:""},i.sectionIdx,i.style)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",cursor:"pointer",verticalAlign:"middle"}},{children:[i.hasCognitive&&void 0!==i.sectionIdx&&n.jsx(t.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",color:i.style.badgeText}},{children:n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(r.ButtonCognitiveIcon,{})}))})),W.open&&W.sectionIdx===i.sectionIdx?n.jsx(o.ChevronUp,{size:12,color:i.style.badgeText}):n.jsx(o.ChevronDown,{size:12,color:i.style.badgeText})]}))]}))}))}))]},l):null})]})),n.jsxs(t.Box,e.__assign({sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(t.Box,e.__assign({ref:_e,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center",overflow:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:se,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:se}))}))})),n.jsx(t.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:de&&ce.map(function(e,n){return{section:e,idx:n}}).map(function(i){var o=i.section,r=i.idx;return n.jsx(t.Box,e.__assign({ref:fe(r)},{children:ke(o,r,"left",Ae.current[r]||d.default.createRef())}),"left-row-".concat(r))})}))]})),n.jsx(t.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[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,{})})),0,"% Similarity",n.jsx(o.ChevronDown,{size:11})]}))}))})),n.jsxs(t.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(t.Box,e.__assign({ref:me,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center",overflow:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:ae,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:ae}))}))})),n.jsx(t.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:de&&ue.map(function(e,n){return{section:e,idx:n}}).map(function(e){var n=e.section,i=e.idx;return ke(n,i,"right",De.current[i]||d.default.createRef())})}))]}))]}))}))}))]}))};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],F={fields:e,thresholds:{exact:90,high:70,medium:40},relationStyles:{noContent:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F8FAFC",badgeBorder:"#F1F5F9",badgeText:"#64748B",highlightBg:"transparent"},exact:{bg:"#FFF1F2",border:"#FECDD3",badgeBg:"#FFE4E6",badgeBorder:"#FEE2E2",badgeText:"#9F1239",highlightBg:"#FECDD3"},high:{bg:"#FFF5F5",border:"#FECACA",badgeBg:"#FEECEC",badgeBorder:"#F8C2C2",badgeText:"#B42318",highlightBg:"#FDD5D5"},medium:{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3"},low:{bg:"#F5F9FF",border:"#CFE0FF",badgeBg:"#EEF4FF",badgeBorder:"#BFD3FF",badgeText:"#1D4ED8",highlightBg:"#DCEAFF"}}};exports.DEFAULT_COMPARISON_CONFIG=F,exports.DEFAULT_FIELD_CONFIG=e,exports.SHARED_MARKDOWN_STYLES={fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden","& p":{mt:0,mb:1.5},"& p:last-child":{mb:0},"& ul, & ol":{mt:0,mb:1.5,pl:2.5},"& li":{mb:.5},"& strong":{fontWeight:600},"& code":{whiteSpace:"pre-wrap",wordBreak:"break-word"}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],F={fields:e,thresholds:{exact:90,high:70,medium:40},relationStyles:{noContent:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F8FAFC",badgeBorder:"#F1F5F9",badgeText:"#64748B",highlightBg:"transparent"},exact:{bg:"#FFF1F2",border:"#FECDD3",badgeBg:"#FFE4E6",badgeBorder:"#FEE2E2",badgeText:"#9F1239",highlightBg:"#FECDD3"},high:{bg:"#FFF5F5",border:"#FECACA",badgeBg:"#FEECEC",badgeBorder:"#F8C2C2",badgeText:"#B42318",highlightBg:"#FDD5D5"},medium:{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3"},low:{bg:"#F5F9FF",border:"#CFE0FF",badgeBg:"#EEF4FF",badgeBorder:"#BFD3FF",badgeText:"#1D4ED8",highlightBg:"#DCEAFF"}}};exports.DEFAULT_COMPARISON_CONFIG=F,exports.DEFAULT_FIELD_CONFIG=e,exports.SHARED_MARKDOWN_STYLES={fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden","& p":{mt:0,mb:1.5},"& p:last-child":{mb:0},"& ul":{mt:0,mb:1.5,pl:2.5,listStyleType:"disc"},"& ol":{mt:0,mb:1.5,pl:2.5,listStyleType:"decimal"},"& li":{mb:.5},"& strong":{fontWeight:600},"& code":{whiteSpace:"pre-wrap",wordBreak:"break-word"}};
2
2
  //# sourceMappingURL=CognitiveCompareConfig.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),r=require("lucide-react"),s=require("react-dom"),t=require("../../assests/svg/SparkleIcon.js"),a=require("react-markdown"),l=require("./CognitiveCompareConfig.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=x(s),c=x(a),p=10;exports.default=function(s){var a,x,h,g,f,u=s.open,b=s.onClose,_=s.sectionTitle,v=s.referenceSectionTitle,m=s.cognitiveData,y=s.relevanceScore,j=s.anchorEl,F=s.badgeStyle,w=s.popupRef,B=s.position,E=null==m?void 0:m.isMissingRationale,D=i.useState(E?"deviation":"association"),S=D[0],C=D[1];i.useEffect(function(){u&&C(E?"deviation":"association")},[u,E]);var R=i.useMemo(function(){if(!F)return{border:"#5928ED",shadow:"rgba(89,40,237,0.18)"};var e=F.badgeText;return"#9F1239"===e||"#B42318"===e?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===e?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===e?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:"#5928ED",shadow:"rgba(89,40,237,0.18)"}},[F]);if(i.useEffect(function(){if(u){var e=function(e){var o;(null===(o=w.current)||void 0===o?void 0:o.contains(e.target))||(null==j?void 0:j.contains(e.target))||b()};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[u,b,j,w]),!u||!m)return null;var k=null!==(x=null!==(a=m.relevance_score)&&void 0!==a?a:y)&&void 0!==x?x:0,W=m.decisioning,T=Array.isArray(W)?W:"string"==typeof W&&W.trim()?[W]:[],z=m.gap,A=Array.isArray(z)?z:"string"==typeof z&&z.trim()?[z]:[],I=null!==(h=null==B?void 0:B.arrowLeft)&&void 0!==h?h:60,H=o.jsxs(n.Box,e.__assign({ref:w,sx:{position:"fixed",top:null!==(g=null==B?void 0:B.top)&&void 0!==g?g:-9999,left:null!==(f=null==B?void 0:B.left)&&void 0!==f?f:-9999,zIndex:9999,width:"min(".concat(680,"px, calc(100vw - ").concat(24,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(R.border),boxShadow:"0px 8px 32px ".concat(R.shadow,", 0px 0px 0px 3px ").concat(R.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==B?void 0:B.maxHeight)?"min(60vh, ".concat(B.maxHeight,"px)"):"60vh",visibility:B?"visible":"hidden"}},{children:[B&&(B.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:I-p,width:0,height:0,borderLeft:"".concat(p,"px solid transparent"),borderRight:"".concat(p,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(R.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:I-p+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(p,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:I-p,width:0,height:0,borderLeft:"".concat(p,"px solid transparent"),borderRight:"".concat(p,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(R.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:I-p+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(p,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,e.__assign({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o.jsxs(n.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[o.jsxs(n.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[o.jsx(n.Box,e.__assign({component:"span",title:_,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:_})),o.jsx(n.Box,e.__assign({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),o.jsx(n.Box,e.__assign({component:"span",title:v||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:v||"Reference Section"}))]})),o.jsx(n.Box,e.__assign({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"13px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:"deviation"===S?"Why this is a deviation?":"Why these sections are paired?"}))}))]})),o.jsxs(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o.jsxs(n.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[o.jsx(t.default,{}),"Decision Strength ",k,"%"]})),o.jsx(n.IconButton,e.__assign({onClick:b,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:o.jsx(r.X,{size:22})}))]}))]})),o.jsx(n.Box,e.__assign({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:(E?["deviation"]:["deviation","association"]).map(function(i){var r=S===i,s="deviation"===i?"Deviation Analysis":"Association Logic";return o.jsx(n.Box,e.__assign({onClick:function(){return C(i)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:"pointer",fontSize:"14px",fontWeight:r?600:400,color:r?"#5928ED":"#667085",backgroundColor:r?"rgba(89,40,237,0.08)":"transparent",borderBottom:r?"2px solid #5928ED":"2px solid transparent",transition:"all 0.15s",userSelect:"none",overflowY:"auto"}},{children:s}),i)})})),o.jsx(n.Box,e.__assign({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(R.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:R.border},scrollbarWidth:"thin",scrollbarColor:"".concat(R.border,"55 transparent")}},{children:"deviation"===S?o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD",p:2,display:"flex",flexDirection:"column",gap:1}},{children:[o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054"}},{children:"Deviation Analysis"})),o.jsx(n.Typography,e.__assign({sx:{fontSize:"14px",color:"#667085",lineHeight:1.6}},{children:"Deviation analysis content will appear here. This tab shows structural and semantic deviations identified between the two sections being compared."}))]})):o.jsxs(o.Fragment,{children:[T.length>0&&o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[o.jsx(n.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:"Decision Making Factors"}))})),o.jsx(n.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:o.jsx(n.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:o.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign({},l.SHARED_MARKDOWN_STYLES)},{children:o.jsx(c.default,{children:T.join("\n\n")})}))}))}))]})),A.length>0&&o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[o.jsx(n.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:"Gaps in Decision"}))})),o.jsx(n.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:o.jsx(n.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:o.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign({},l.SHARED_MARKDOWN_STYLES)},{children:o.jsx(c.default,{children:A.join("\n\n")})}))}))}))]})),0===T.length&&0===A.length&&o.jsx(n.Box,e.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]})}))]}));return d.default.createPortal(H,document.body)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),r=require("lucide-react"),s=require("react-dom"),t=require("../../assests/svg/SparkleIcon.js"),a=require("react-markdown"),l=require("./CognitiveCompareConfig.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=x(s),c=x(a),p=10;exports.default=function(s){var a,x,h,g,f,u=s.open,b=s.onClose,_=s.sectionTitle,v=s.referenceSectionTitle,m=s.cognitiveData,y=s.relevanceScore,j=s.anchorEl,F=s.badgeStyle,w=s.popupRef,B=s.position,E=s.markdownStyles,D=e.__assign(e.__assign({},l.SHARED_MARKDOWN_STYLES),E),S=null==m?void 0:m.isMissingRationale,C=i.useState(S?"deviation":"association"),k=C[0],R=C[1];i.useEffect(function(){u&&R(S?"deviation":"association")},[u,S]);var W=i.useMemo(function(){if(!F)return{border:"#5928ED",shadow:"rgba(89,40,237,0.18)"};var e=F.badgeText;return"#9F1239"===e||"#B42318"===e?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===e?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===e?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:"#5928ED",shadow:"rgba(89,40,237,0.18)"}},[F]);if(i.useEffect(function(){if(u){var e=function(e){var o;(null===(o=w.current)||void 0===o?void 0:o.contains(e.target))||(null==j?void 0:j.contains(e.target))||b()};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[u,b,j,w]),!u||!m)return null;var z=null!==(x=null!==(a=m.relevance_score)&&void 0!==a?a:y)&&void 0!==x?x:0,T=m.decisioning,A=Array.isArray(T)?T:"string"==typeof T&&T.trim()?[T]:[],I=m.gap,H=Array.isArray(I)?I:"string"==typeof I&&I.trim()?[I]:[],q=null!==(h=null==B?void 0:B.arrowLeft)&&void 0!==h?h:60,L=o.jsxs(n.Box,e.__assign({ref:w,sx:{position:"fixed",top:null!==(g=null==B?void 0:B.top)&&void 0!==g?g:-9999,left:null!==(f=null==B?void 0:B.left)&&void 0!==f?f:-9999,zIndex:9999,width:"min(".concat(680,"px, calc(100vw - ").concat(24,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(W.border),boxShadow:"0px 8px 32px ".concat(W.shadow,", 0px 0px 0px 3px ").concat(W.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==B?void 0:B.maxHeight)?"min(60vh, ".concat(B.maxHeight,"px)"):"60vh",visibility:B?"visible":"hidden"}},{children:[B&&(B.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:q-p,width:0,height:0,borderLeft:"".concat(p,"px solid transparent"),borderRight:"".concat(p,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(W.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:q-p+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(p,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:q-p,width:0,height:0,borderLeft:"".concat(p,"px solid transparent"),borderRight:"".concat(p,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(W.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:q-p+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(p,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,e.__assign({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o.jsxs(n.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[o.jsxs(n.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[o.jsx(n.Box,e.__assign({component:"span",title:_,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:_})),o.jsx(n.Box,e.__assign({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),o.jsx(n.Box,e.__assign({component:"span",title:v||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:v||"Reference Section"}))]})),o.jsx(n.Box,e.__assign({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"13px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:"deviation"===k?"Why this is a deviation?":"Why these sections are paired?"}))}))]})),o.jsxs(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o.jsxs(n.Box,e.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[o.jsx(t.default,{}),"Decision Strength ",z,"%"]})),o.jsx(n.IconButton,e.__assign({onClick:b,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:o.jsx(r.X,{size:22})}))]}))]})),o.jsx(n.Box,e.__assign({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:(S?["deviation"]:["deviation","association"]).map(function(i){var r=k===i,s="deviation"===i?"Deviation Analysis":"Association Logic";return o.jsx(n.Box,e.__assign({onClick:function(){return R(i)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:"pointer",fontSize:"14px",fontWeight:r?600:400,color:r?"#5928ED":"#667085",backgroundColor:r?"rgba(89,40,237,0.08)":"transparent",borderBottom:r?"2px solid #5928ED":"2px solid transparent",transition:"all 0.15s",userSelect:"none",overflowY:"auto"}},{children:s}),i)})})),o.jsx(n.Box,e.__assign({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(W.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:W.border},scrollbarWidth:"thin",scrollbarColor:"".concat(W.border,"55 transparent")}},{children:"deviation"===k?o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD",p:2,display:"flex",flexDirection:"column",gap:1}},{children:[o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054"}},{children:"Deviation Analysis"})),o.jsx(n.Typography,e.__assign({sx:{fontSize:"14px",color:"#667085",lineHeight:1.6}},{children:"Deviation analysis content will appear here. This tab shows structural and semantic deviations identified between the two sections being compared."}))]})):o.jsxs(o.Fragment,{children:[A.length>0&&o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[o.jsx(n.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:"Decision Making Factors"}))})),o.jsx(n.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:o.jsx(n.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:o.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign({},D)},{children:o.jsx(c.default,{children:A.join("\n\n")})}))}))}))]})),H.length>0&&o.jsxs(n.Box,e.__assign({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[o.jsx(n.Box,e.__assign({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:"Gaps in Decision"}))})),o.jsx(n.Box,e.__assign({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:o.jsx(n.Box,e.__assign({sx:{display:"flex",flexDirection:"column"}},{children:o.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign({},D)},{children:o.jsx(c.default,{children:H.join("\n\n")})}))}))}))]})),0===A.length&&0===H.length&&o.jsx(n.Box,e.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,e.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]})}))]}));return d.default.createPortal(L,document.body)};
2
2
  //# sourceMappingURL=CognitivePopup.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import i,{useState as o,useMemo as r,useRef as l,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as s,Alert as u,Typography as v,Tooltip as h,Accordion as p,AccordionSummary as f,AccordionDetails as g}from"@mui/material";import{ChevronUp as x,ChevronDown as m}from"lucide-react";import{ButtonCognitiveIcon as y}from"../../assests/svg/ButtonCognitiveIcon.js";import F from"react-markdown";import{safeStringify as b,hasValue as w,getStyleForRelation as E,cognitiveScoreToRelation as S,getRationale as C,getSideData as _}from"./CognitiveComparehelpers.js";import{DEFAULT_FIELD_CONFIG as I,DEFAULT_COMPARISON_CONFIG as A,SHARED_MARKDOWN_STYLES as D}from"./CognitiveCompareConfig.js";import R from"./CognitivePopup.js";var B={id:"",title:""},T=function(T){var k,z,M,H,W,j,L,O,P=T.componentHeaderText,N=void 0===P?"Learning Comparison":P,q=T.treeData,V=T.comparisonConfig,U=T.leftColumnTitleText,K=T.rightColumnTitleText,G=o(null),J=G[0],Y=G[1],Q=r(function(){return(null==q?void 0:q.cognitive_decisioning)||{}},[q]);l(null);var X=o(null),Z=X[0],$=X[1],ee=l(null),ne=o({width:0,height:0}),te=ne[0],ie=ne[1];console.log("[cognitive compare] rendering");var oe=o({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null}),re=oe[0],le=oe[1],ce=l(null),ae=l(null),de=l(!1),se=l(null);c(function(){se.current=null},[re.sectionIdx,re.open]);var ue=a(function(){var e;if(re.anchorEl&&re.refSectionTitle){var n=re.anchorEl.getBoundingClientRect(),t=(null===(e=null==ee?void 0:ee.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<t&&r>o;null!==se.current?!0===se.current&&(l=r>=t||r>=o):l=!(o>=t||o>=r),se.current=l;var c=l?r:o,a=Math.min(t||9999,c),d=l?n.top-12-a:n.bottom+12,s=n.left+n.width/2,u=s-i/2,v=Math.max(12,Math.min(u,window.innerWidth-i-12)),h=Math.max(14,Math.min(s-v,i-10-4));$({top:d,left:v,arrowLeft:h,openAbove:l,maxHeight:c})}},[re.anchorEl,re.refSectionTitle]);c(function(){if(re.open){window.addEventListener("resize",ue);var e=requestAnimationFrame(ue),n=null;return ee.current&&(n=new ResizeObserver(function(){e=requestAnimationFrame(ue)})).observe(ee.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",ue),n&&n.disconnect()}}},[re.open,ue]),c(function(){var n=ce.current;if(n&&re.open){var t=function(n){ee.current&&ee.current.contains(n.target)||(console.log("Scroll event detected on:",n.target,"- closing CognitivePopup"),$(null),le(function(n){return e(e({},n),{open:!1,anchorEl:null,sectionAnchorEl:null})}))};return n.addEventListener("scroll",t,{capture:!0}),window.addEventListener("scroll",t,{capture:!0}),function(){n.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("scroll",t,{capture:!0})}}},[re.open]);var ve=r(function(){var n,t,i,o,r,l,c,a,d,s,u,v;return{fields:null!==(n=null==V?void 0:V.fields)&&void 0!==n?n:I,thresholds:{high:null!==(i=null===(t=null==V?void 0:V.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:A.thresholds.high,medium:null!==(r=null===(o=null==V?void 0:V.thresholds)||void 0===o?void 0:o.medium)&&void 0!==r?r:A.thresholds.medium,exact:null!==(c=null===(l=null==V?void 0:V.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:A.thresholds.exact},relationStyles:{noContent:e(e({},A.relationStyles.noContent),(null===(a=null==V?void 0:V.relationStyles)||void 0===a?void 0:a.noContent)||{}),high:e(e({},A.relationStyles.high),(null===(d=null==V?void 0:V.relationStyles)||void 0===d?void 0:d.high)||{}),exact:e(e({},A.relationStyles.exact),(null===(s=null==V?void 0:V.relationStyles)||void 0===s?void 0:s.exact)||{}),medium:e(e({},A.relationStyles.medium),(null===(u=null==V?void 0:V.relationStyles)||void 0===u?void 0:u.medium)||{}),low:e(e({},A.relationStyles.low),(null===(v=null==V?void 0:V.relationStyles)||void 0===v?void 0:v.low)||{})}}},[V]),he=r(function(){if(q&&Object.keys(q).length>0)try{var n=function(n){var t,i,o,r,l=[],c=[],a=n.base_root_id,d=n.input_index_map||{0:"left",1:"right"},s=n[a];if(!s||!1===s.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var u=function(t){var i=n[t];if(i&&!1!==i.display_node){var o=C(i),r=_(i,"0",d),a=_(i,"1",d),s=r.title.trim()||r.content.trim(),v=a.title.trim()||a.content.trim();l.push(e({id:t,title:s?r.title:"",content:s?r.content:"",subsections:[]},s?o:{score:void 0,relation:"not_defined"})),c.push(e({id:t,title:v?a.title:"",content:v?a.content:"",subsections:[]},v?o:{score:void 0,relation:"not_defined"})),i.next&&Object.values(i.next).forEach(u)}};return s.next&&Object.values(s.next).forEach(u),{activeProposed:{title:(null===(i=null===(t=s.comparison_inputs)||void 0===t?void 0:t[d[0]])||void 0===i?void 0:i.title)||"Uploaded Contract",description:s.decision_scope_description||"",sections:l},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(o=s.comparison_inputs)||void 0===o?void 0:o[d[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:c,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:s.decision_scope_description||""},fields:{}}}}]}}(q);return e(e({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[q]),pe=he.activeProposed,fe=he.activeVariants,ge=he.parseError;c(function(){ge&&Y("Failed to load comparison: ".concat(ge))},[ge]);var xe=o(null),me=xe[0];xe[1];var ye=o({}),Fe=ye[0],be=ye[1],we=fe[0]||B,Ee=null===(M=null===(k=null==q?void 0:q.documents)||void 0===k?void 0:k[null===(z=null==q?void 0:q.input_index_map)||void 0===z?void 0:z[0]])||void 0===M?void 0:M.title,Se=null===(j=null===(H=null==q?void 0:q.documents)||void 0===H?void 0:H[null===(W=null==q?void 0:q.input_index_map)||void 0===W?void 0:W[1]])||void 0===j?void 0:j.title,Ce=b(U||Ee||"Uploaded Contract"),_e=b(K||Se||"Reference Template"),Ie=r(function(){return pe.sections||[]},[pe.sections]),Ae=r(function(){return we.sections||[]},[we.sections]),De=Ie.length>0||Ae.length>0,Re=we.analysis,Be=b(null===(O=null===(L=null==Re?void 0:Re.rule_difference_comparison)||void 0===L?void 0:L.summary)||void 0===O?void 0:O.overall_summary),Te=!!Be.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ke=l({}),ze=function(e){return ke.current[e]||(ke.current[e]=i.createRef()),ke.current[e]},Me=l(null),He=l(null),We=l(null),je=o([]),Le=je[0],Oe=je[1],Pe=o(null),Ne=Pe[0],qe=Pe[1],Ve=r(function(){return ve.fields.filter(function(e){var n=e.key;return(!De||"description"!==n)&&(w(pe[n])||w(we[n]))})},[pe,we,De,ve.fields]),Ue=l({}),Ke=l({}),Ge=l({}),Je=l({});Ve.forEach(function(e){var n=e.key;Ue.current[n]||(Ue.current[n]=i.createRef()),Ke.current[n]||(Ke.current[n]=i.createRef())});for(var Ye=0;Ye<Math.max(Ie.length,Ae.length);Ye+=1)Ge.current[Ye]||(Ge.current[Ye]=i.createRef()),Je.current[Ye]||(Je.current[Ye]=i.createRef());c(function(){if(me){var e=ve.fields.find(function(e){return e.analysisKey===me||e.key===me});if(e){var n=Ue.current[e.key]||Ke.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[me,ve.fields]);var Qe=a(function(e){var n,t,i,o,r,l,c,a,d,s=null===(n=null==Re?void 0:Re.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var u=s[e],v=(null==u?void 0:u.relation)||(null===(i=null===(t=null==u?void 0:u.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==u?void 0:u.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==u?void 0:u.mappings)&&u.mappings.length>0;if(u.mappings){var h=u.mappings[0]||{};return{score:u.score,relation:h.relation||"",highlightsA:(null===(l=h.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=h.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:u.score,relation:u.relation||"",highlightsA:(null===(a=u.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(d=u.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[Re]),Xe=a(function(n){var t,i,o=Ie[n],r=Ae[n],l=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,c=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,a=!(!(null==o?void 0:o.cognitiveData)&&!(null==r?void 0:r.cognitiveData));if(!l&&!c&&!a)return e(e({},ve.relationStyles.noContent),{label:"Not Defined"});var d=Qe("description");if(null!=(null!==(t=null==o?void 0:o.cognitiveRelevanceScore)&&void 0!==t?t:null==r?void 0:r.cognitiveRelevanceScore)){var s=S(),u=s.score,v=s.relation;return E(u,v,!0,ve)}var h=l?o.relation:c?r.relation:d.relation,p=null!==(i=null==o?void 0:o.score)&&void 0!==i?i:null==r?void 0:r.score,f="number"==typeof p?p:d.score;return E(f,h,!0,ve)},[Ie,Ae,ve,Qe]),Ze=a(function(){var e,n,t,i,o,r,l,c,a,d,s;if(!de.current){de.current=!0;try{if(!Me.current)return;var u=Me.current.getBoundingClientRect();ie({width:u.width,height:u.height});var v=[];Ve.forEach(function(e){var n,t,i=e.key,o=null===(n=Ue.current[i])||void 0===n?void 0:n.current,r=null===(t=Ke.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")});for(var h=0;h<Math.min(Ie.length,Ae.length);h++){var p=null===(e=Ge.current[h])||void 0===e?void 0:e.current,f=null===(n=Je.current[h])||void 0===n?void 0:n.current;p&&f&&(p.style.height="auto",f.style.height="auto",p.style.minHeight="0px",f.style.minHeight="0px")}var g={};Ve.forEach(function(e){var n,t,i=e.key,o=null===(n=Ue.current[i])||void 0===n?void 0:n.current,r=null===(t=Ke.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();g[i]=Math.max(l.height,c.height)}});var x=[];for(h=0;h<Math.min(Ie.length,Ae.length);h++){p=null===(t=Ge.current[h])||void 0===t?void 0:t.current,f=null===(i=Je.current[h])||void 0===i?void 0:i.current;if(p&&f){var m=p.getBoundingClientRect(),y=f.getBoundingClientRect();x[h]=Math.max(m.height,y.height)}}Ve.forEach(function(e){var n,t,i=e.key,o=null===(n=Ue.current[i])||void 0===n?void 0:n.current,r=null===(t=Ke.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=g[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}});for(h=0;h<x.length;h++){p=null===(o=Ge.current[h])||void 0===o?void 0:o.current,f=null===(r=Je.current[h])||void 0===r?void 0:r.current;if(p&&f){var F=x[h];p.style.minHeight="".concat(F,"px"),f.style.minHeight="".concat(F,"px")}}Ve.forEach(function(e){var n,t,i=e.key,o=e.analysisKey,r=null===(n=Ue.current[i])||void 0===n?void 0:n.current,l=null===(t=Ke.current[i])||void 0===t?void 0:t.current;if(r&&l){var c=r.getBoundingClientRect(),a=l.getBoundingClientRect(),d=Qe(o),s=E(d.score,d.relation,d.hasContent,ve);if(!s)return;var h=c.top+c.height/2-u.top;v.push({id:"field-".concat(i),x1:c.right-u.left,y1:h,x2:a.left-u.left,y2:h,style:s})}});for(h=0;h<Math.min(Ie.length,Ae.length);h++){var b=null===(l=Ge.current[h])||void 0===l?void 0:l.current,w=null===(c=Je.current[h])||void 0===c?void 0:c.current;if(b&&w){var S=b.querySelector(".MuiAccordionSummary-root"),C=w.querySelector(".MuiAccordionSummary-root");if(S&&C){var _=S.getBoundingClientRect(),I=C.getBoundingClientRect(),A=(_.top+_.height/2-u.top+I.top+I.height/2-u.top)/2,D=(null===(a=Ae[h])||void 0===a?void 0:a.id)||"sec-".concat(h),R=Xe(h);R&&v.push({id:D,x1:_.right-u.left,y1:A,x2:I.left-u.left,y2:A,style:R,sectionIdx:h,hasCognitive:!(!(null===(d=Ie[h])||void 0===d?void 0:d.cognitiveData)&&!(null===(s=Ae[h])||void 0===s?void 0:s.cognitiveData))})}}}if(Oe(v),He.current&&We.current){var B=He.current.getBoundingClientRect(),T=We.current.getBoundingClientRect(),k=(B.top+B.height/2-u.top+T.top+T.height/2-u.top)/2;qe({x1:B.right-u.left,x2:T.left-u.left,y:k})}else qe(null)}catch(e){console.error("Line render safe fail: ",e)}finally{de.current=!1}}},[Ve,Ie,Ae,ve,Qe,Xe]),$e=a(function(){window.requestAnimationFrame(Ze)},[Ze]);c(function(){var e=setTimeout($e,250);window.addEventListener("resize",$e);var n=null,t=null;return ce.current&&(n=new ResizeObserver($e)).observe(ce.current),Me.current&&(t=new ResizeObserver($e)).observe(Me.current),function(){clearTimeout(e),window.removeEventListener("resize",$e),null==n||n.disconnect(),null==t||t.disconnect()}},[pe,we,Re,Ve,Fe,Ie,Ae,ve,$e]);var en=function(o,r,l,c){var a,s=!w(o.title)&&!w(o.content);return t(d,e({ref:c,sx:{mb:1,minHeight:0,display:"flex",flexDirection:"column"}},{children:n(p,e({disableGutters:!0,expanded:!s&&!!Fe[r],onChange:function(){return!s&&(n=r,void be(function(t){var i;return e(e({},t),((i={})[n]=!t[n],i))}));var n},sx:{boxShadow:"none",border:s?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:s?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[t(f,e({expandIcon:s?null:t(m,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:s?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:t(h,e({title:o.title||"No Matching Section Found",placement:"top"},{children:t(v,e({sx:{fontSize:"12px",color:s?"#94A3B8":"#19213D",fontWeight:s?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(a=o.title||"No Matching Section Found",a?b(a).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(i.Fragment,{children:e},n)}):null)}))}))})),!s&&n(g,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[t(v,e({component:"div",sx:D},{children:t(F,{children:b(o.content).replace(/\\n/g,"\n")})})),(o.subsections||[]).map(function(n,i){return t(d,e({sx:{mt:1,pt:1,borderTop:"1px solid #EEF2F7"}},{children:t(v,e({component:"div",sx:D},{children:t(F,{children:b(n).replace(/\\n/g,"\n")})}))}),"".concat(l,"-sub-").concat(r,"-").concat(i))})]}))]}))}),"".concat(l,"-sec-").concat(r))};return n(d,e({ref:ae,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[re.open&&t(R,{open:re.open,popupRef:ee,position:Z,onClose:function(){$(null),le(function(n){return e(e({},n),{open:!1})})},sectionTitle:re.sectionTitle,referenceSectionTitle:re.refSectionTitle,cognitiveData:re.cognitiveData,anchorEl:re.anchorEl,sectionAnchorEl:re.sectionAnchorEl,scrollContainerEl:ce.current,badgeStyle:re.badgeStyle}),t(s,e({open:!!J,autoHideDuration:8e3,onClose:function(){return Y(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(u,e({onClose:function(){return Y(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:J}))})),t(d,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:t(d,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:t(v,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:N}))}))})),t(d,e({ref:ce,sx:{flex:1,overflowY:"auto",minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:Be&&Te?"none":"1.5px solid #EEF0F4"}},{children:t(d,e({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:n(d,e({ref:Me,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0}},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:te.width||"100%",height:te.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Ne&&n("g",{children:[t("line",{x1:Ne.x1,y1:Ne.y,x2:Math.max(Ne.x1,(Ne.x1+Ne.x2)/2-70),y2:Ne.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),t("line",{x1:Math.min(Ne.x2,(Ne.x1+Ne.x2)/2+70),y1:Ne.y,x2:Ne.x2,y2:Ne.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Le.map(function(i,o){var r=(i.x1+i.x2)/2;return"Not Defined"!==i.style.label||i.hasCognitive?n("g",{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder,strokeWidth:"1.5"}),t("foreignObject",e({x:r-75,y:i.y1-14,width:"150",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(d,e({sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n(d,e({onClick:function(n){if(n.stopPropagation(),re.open&&re.sectionIdx===i.sectionIdx)return $(null),void le(function(n){return e(e({},n),{open:!1})});!function(e,n,t,i,o){var r,l;e.stopPropagation(),$(null);var c=b(n.id)||b(t.id)||"",a=(c?Q[c]:null)||n.cognitiveData||t.cognitiveData||null,d=null!==(l=null===(r=ke.current[i])||void 0===r?void 0:r.current)&&void 0!==l?l:null;le({open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:a,anchorEl:e.currentTarget,sectionAnchorEl:d,badgeStyle:o||null,sectionIdx:i})}(n,Ie[i.sectionIdx]||{title:"",content:""},Ae[i.sectionIdx]||{title:"",content:""},i.sectionIdx,i.style)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",cursor:"pointer",verticalAlign:"middle"}},{children:[i.hasCognitive&&void 0!==i.sectionIdx&&t(d,e({sx:{display:"flex",alignItems:"center",justifyContent:"center",color:i.style.badgeText}},{children:t("div",e({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:t(y,{})}))})),re.open&&re.sectionIdx===i.sectionIdx?t(x,{size:12,color:i.style.badgeText}):t(m,{size:12,color:i.style.badgeText})]}))]}))}))}))]},o):null})]})),n(d,e({sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[t(d,e({ref:He,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center",overflow:"hidden"}},{children:t(h,e({title:Ce,placement:"top"},{children:t(v,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:Ce}))}))})),t(d,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:De&&Ie.map(function(e,n){return{section:e,idx:n}}).map(function(n){var o=n.section,r=n.idx;return t(d,e({ref:ze(r)},{children:en(o,r,"left",Ge.current[r]||i.createRef())}),"left-row-".concat(r))})}))]})),t(d,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(d,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[t(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(y,{})})),0,"% Similarity",t(m,{size:11})]}))}))})),n(d,e({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[t(d,e({ref:We,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center",overflow:"hidden"}},{children:t(h,e({title:_e,placement:"top"},{children:t(v,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:_e}))}))})),t(d,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:De&&Ae.map(function(e,n){return{section:e,idx:n}}).map(function(e){var n=e.section,t=e.idx;return en(n,t,"right",Je.current[t]||i.createRef())})}))]}))]}))}))}))]}))};export{T as default};
1
+ import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import i,{useState as o,useMemo as r,useRef as l,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as s,Alert as u,Typography as h,Tooltip as v,Accordion as p,AccordionSummary as f,AccordionDetails as g}from"@mui/material";import{ChevronUp as x,ChevronDown as m}from"lucide-react";import{ButtonCognitiveIcon as y}from"../../assests/svg/ButtonCognitiveIcon.js";import w from"react-markdown";import{safeStringify as F,hasValue as b,getStyleForRelation as E,cognitiveScoreToRelation as S,getRationale as C,getSideData as _}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as A,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as I}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import R from"./CognitivePopup.js";var T={id:"",title:""},B=function(B){var k,M,z,H,W,j,L,O,P=B.componentHeaderText,N=void 0===P?"Learning Comparison":P,q=B.treeData,V=B.comparisonConfig,K=B.leftColumnTitleText,U=B.rightColumnTitleText,Y=B.markdownStyles,G=o(null),J=G[0],Q=G[1],X=r(function(){return(null==q?void 0:q.cognitive_decisioning)||{}},[q]);l(null);var Z=o(null),$=Z[0],ee=Z[1],ne=l(null),te=o({width:0,height:0}),ie=te[0],oe=te[1],re=r(function(){return e(e({},A),Y)},[Y]),le=o({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null}),ce=le[0],ae=le[1],de=l(null),se=l(null),ue=l(!1),he=l(null);c(function(){he.current=null},[ce.sectionIdx,ce.open]);var ve=a(function(){var e;if(ce.anchorEl&&ce.refSectionTitle){var n=ce.anchorEl.getBoundingClientRect(),t=(null===(e=null==ne?void 0:ne.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<t&&r>o;null!==he.current?!0===he.current&&(l=r>=t||r>=o):l=!(o>=t||o>=r),he.current=l;var c=l?r:o,a=Math.min(t||9999,c),d=l?n.top-12-a:n.bottom+12,s=n.left+n.width/2,u=s-i/2,h=Math.max(12,Math.min(u,window.innerWidth-i-12)),v=Math.max(14,Math.min(s-h,i-10-4));ee({top:d,left:h,arrowLeft:v,openAbove:l,maxHeight:c})}},[ce.anchorEl,ce.refSectionTitle]);c(function(){if(ce.open){window.addEventListener("resize",ve);var e=requestAnimationFrame(ve),n=null;return ne.current&&(n=new ResizeObserver(function(){e=requestAnimationFrame(ve)})).observe(ne.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",ve),n&&n.disconnect()}}},[ce.open,ve]),c(function(){var n=de.current;if(n&&ce.open){var t=function(n){ne.current&&ne.current.contains(n.target)||(console.log("Scroll event detected on:",n.target,"- closing CognitivePopup"),ee(null),ae(function(n){return e(e({},n),{open:!1,anchorEl:null,sectionAnchorEl:null})}))};return n.addEventListener("scroll",t,{capture:!0}),window.addEventListener("scroll",t,{capture:!0}),function(){n.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("scroll",t,{capture:!0})}}},[ce.open]);var pe=r(function(){var n,t,i,o,r,l,c,a,d,s,u,h;return{fields:null!==(n=null==V?void 0:V.fields)&&void 0!==n?n:D,thresholds:{high:null!==(i=null===(t=null==V?void 0:V.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:I.thresholds.high,medium:null!==(r=null===(o=null==V?void 0:V.thresholds)||void 0===o?void 0:o.medium)&&void 0!==r?r:I.thresholds.medium,exact:null!==(c=null===(l=null==V?void 0:V.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:I.thresholds.exact},relationStyles:{noContent:e(e({},I.relationStyles.noContent),(null===(a=null==V?void 0:V.relationStyles)||void 0===a?void 0:a.noContent)||{}),high:e(e({},I.relationStyles.high),(null===(d=null==V?void 0:V.relationStyles)||void 0===d?void 0:d.high)||{}),exact:e(e({},I.relationStyles.exact),(null===(s=null==V?void 0:V.relationStyles)||void 0===s?void 0:s.exact)||{}),medium:e(e({},I.relationStyles.medium),(null===(u=null==V?void 0:V.relationStyles)||void 0===u?void 0:u.medium)||{}),low:e(e({},I.relationStyles.low),(null===(h=null==V?void 0:V.relationStyles)||void 0===h?void 0:h.low)||{})}}},[V]),fe=r(function(){if(q&&Object.keys(q).length>0)try{var n=function(n){var t,i,o,r,l=[],c=[],a=n.base_root_id,d=n.input_index_map||{0:"left",1:"right"},s=n[a];if(!s||!1===s.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var u=function(t){var i=n[t];if(i&&!1!==i.display_node){var o=C(i),r=_(i,"0",d),a=_(i,"1",d),s=r.title.trim()||r.content.trim(),h=a.title.trim()||a.content.trim();l.push(e({id:t,title:s?r.title:"",content:s?r.content:"",subsections:[]},s?o:{score:void 0,relation:"not_defined"})),c.push(e({id:t,title:h?a.title:"",content:h?a.content:"",subsections:[]},h?o:{score:void 0,relation:"not_defined"})),i.next&&Object.values(i.next).forEach(u)}};return s.next&&Object.values(s.next).forEach(u),{activeProposed:{title:(null===(i=null===(t=s.comparison_inputs)||void 0===t?void 0:t[d[0]])||void 0===i?void 0:i.title)||"Uploaded Contract",description:s.decision_scope_description||"",sections:l},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(o=s.comparison_inputs)||void 0===o?void 0:o[d[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:c,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:s.decision_scope_description||""},fields:{}}}}]}}(q);return e(e({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[q]),ge=fe.activeProposed,xe=fe.activeVariants,me=fe.parseError;c(function(){me&&Q("Failed to load comparison: ".concat(me))},[me]);var ye=o(null),we=ye[0];ye[1];var Fe=o({}),be=Fe[0],Ee=Fe[1],Se=xe[0]||T,Ce=null===(z=null===(k=null==q?void 0:q.documents)||void 0===k?void 0:k[null===(M=null==q?void 0:q.input_index_map)||void 0===M?void 0:M[0]])||void 0===z?void 0:z.title,_e=null===(j=null===(H=null==q?void 0:q.documents)||void 0===H?void 0:H[null===(W=null==q?void 0:q.input_index_map)||void 0===W?void 0:W[1]])||void 0===j?void 0:j.title,Ae=F(K||Ce||"Uploaded Contract"),De=F(U||_e||"Reference Template"),Ie=r(function(){return ge.sections||[]},[ge.sections]),Re=r(function(){return Se.sections||[]},[Se.sections]),Te=Ie.length>0||Re.length>0,Be=Se.analysis,ke=F(null===(O=null===(L=null==Be?void 0:Be.rule_difference_comparison)||void 0===L?void 0:L.summary)||void 0===O?void 0:O.overall_summary),Me=!!ke.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ze=l({}),He=function(e){return ze.current[e]||(ze.current[e]=i.createRef()),ze.current[e]},We=l(null),je=l(null),Le=l(null),Oe=o([]),Pe=Oe[0],Ne=Oe[1],qe=o(null),Ve=qe[0],Ke=qe[1],Ue=r(function(){return pe.fields.filter(function(e){var n=e.key;return(!Te||"description"!==n)&&(b(ge[n])||b(Se[n]))})},[ge,Se,Te,pe.fields]),Ye=l({}),Ge=l({}),Je=l({}),Qe=l({});Ue.forEach(function(e){var n=e.key;Ye.current[n]||(Ye.current[n]=i.createRef()),Ge.current[n]||(Ge.current[n]=i.createRef())});for(var Xe=0;Xe<Math.max(Ie.length,Re.length);Xe+=1)Je.current[Xe]||(Je.current[Xe]=i.createRef()),Qe.current[Xe]||(Qe.current[Xe]=i.createRef());c(function(){if(we){var e=pe.fields.find(function(e){return e.analysisKey===we||e.key===we});if(e){var n=Ye.current[e.key]||Ge.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[we,pe.fields]);var Ze=a(function(e){var n,t,i,o,r,l,c,a,d,s=null===(n=null==Be?void 0:Be.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var u=s[e],h=(null==u?void 0:u.relation)||(null===(i=null===(t=null==u?void 0:u.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==u?void 0:u.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==u?void 0:u.mappings)&&u.mappings.length>0;if(u.mappings){var v=u.mappings[0]||{};return{score:u.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=v.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!h}}return{score:u.score,relation:u.relation||"",highlightsA:(null===(a=u.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(d=u.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!h}},[Be]),$e=a(function(n){var t,i,o=Ie[n],r=Re[n],l=(null==o?void 0:o.relation)&&"not_defined"!==o.relation,c=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,a=!(!(null==o?void 0:o.cognitiveData)&&!(null==r?void 0:r.cognitiveData));if(!l&&!c&&!a)return e(e({},pe.relationStyles.noContent),{label:"Not Defined"});var d=Ze("description");if(null!=(null!==(t=null==o?void 0:o.cognitiveRelevanceScore)&&void 0!==t?t:null==r?void 0:r.cognitiveRelevanceScore)){var s=S(),u=s.score,h=s.relation;return E(u,h,!0,pe)}var v=l?o.relation:c?r.relation:d.relation,p=null!==(i=null==o?void 0:o.score)&&void 0!==i?i:null==r?void 0:r.score,f="number"==typeof p?p:d.score;return E(f,v,!0,pe)},[Ie,Re,pe,Ze]),en=a(function(){var e,n,t,i,o,r,l,c,a,d,s;if(!ue.current){ue.current=!0;try{if(!We.current)return;var u=We.current.getBoundingClientRect();oe({width:u.width,height:u.height});var h=[];Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")});for(var v=0;v<Math.min(Ie.length,Re.length);v++){var p=null===(e=Je.current[v])||void 0===e?void 0:e.current,f=null===(n=Qe.current[v])||void 0===n?void 0:n.current;p&&f&&(p.style.height="auto",f.style.height="auto",p.style.minHeight="0px",f.style.minHeight="0px")}var g={};Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();g[i]=Math.max(l.height,c.height)}});var x=[];for(v=0;v<Math.min(Ie.length,Re.length);v++){p=null===(t=Je.current[v])||void 0===t?void 0:t.current,f=null===(i=Qe.current[v])||void 0===i?void 0:i.current;if(p&&f){var m=p.getBoundingClientRect(),y=f.getBoundingClientRect();x[v]=Math.max(m.height,y.height)}}Ue.forEach(function(e){var n,t,i=e.key,o=null===(n=Ye.current[i])||void 0===n?void 0:n.current,r=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=g[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}});for(v=0;v<x.length;v++){p=null===(o=Je.current[v])||void 0===o?void 0:o.current,f=null===(r=Qe.current[v])||void 0===r?void 0:r.current;if(p&&f){var w=x[v];p.style.minHeight="".concat(w,"px"),f.style.minHeight="".concat(w,"px")}}Ue.forEach(function(e){var n,t,i=e.key,o=e.analysisKey,r=null===(n=Ye.current[i])||void 0===n?void 0:n.current,l=null===(t=Ge.current[i])||void 0===t?void 0:t.current;if(r&&l){var c=r.getBoundingClientRect(),a=l.getBoundingClientRect(),d=Ze(o),s=E(d.score,d.relation,d.hasContent,pe);if(!s)return;var v=c.top+c.height/2-u.top;h.push({id:"field-".concat(i),x1:c.right-u.left,y1:v,x2:a.left-u.left,y2:v,style:s})}});for(v=0;v<Math.min(Ie.length,Re.length);v++){var F=null===(l=Je.current[v])||void 0===l?void 0:l.current,b=null===(c=Qe.current[v])||void 0===c?void 0:c.current;if(F&&b){var S=F.querySelector(".MuiAccordionSummary-root"),C=b.querySelector(".MuiAccordionSummary-root");if(S&&C){var _=S.getBoundingClientRect(),A=C.getBoundingClientRect(),D=(_.top+_.height/2-u.top+A.top+A.height/2-u.top)/2,I=(null===(a=Re[v])||void 0===a?void 0:a.id)||"sec-".concat(v),R=$e(v);R&&h.push({id:I,x1:_.right-u.left,y1:D,x2:A.left-u.left,y2:D,style:R,sectionIdx:v,hasCognitive:!(!(null===(d=Ie[v])||void 0===d?void 0:d.cognitiveData)&&!(null===(s=Re[v])||void 0===s?void 0:s.cognitiveData))})}}}if(Ne(h),je.current&&Le.current){var T=je.current.getBoundingClientRect(),B=Le.current.getBoundingClientRect(),k=(T.top+T.height/2-u.top+B.top+B.height/2-u.top)/2;Ke({x1:T.right-u.left,x2:B.left-u.left,y:k})}else Ke(null)}catch(e){console.error("Line render safe fail: ",e)}finally{ue.current=!1}}},[Ue,Ie,Re,pe,Ze,$e]),nn=a(function(){window.requestAnimationFrame(en)},[en]);c(function(){var e=setTimeout(nn,250);window.addEventListener("resize",nn);var n=null,t=null;return de.current&&(n=new ResizeObserver(nn)).observe(de.current),We.current&&(t=new ResizeObserver(nn)).observe(We.current),function(){clearTimeout(e),window.removeEventListener("resize",nn),null==n||n.disconnect(),null==t||t.disconnect()}},[ge,Se,Be,Ue,be,Ie,Re,pe,nn]);var tn=function(o,r,l,c){var a,s=!b(o.title)&&!b(o.content);return t(d,e({ref:c,sx:{mb:1,minHeight:0,display:"flex",flexDirection:"column"}},{children:n(p,e({disableGutters:!0,expanded:!s&&!!be[r],onChange:function(){return!s&&(n=r,void Ee(function(t){var i;return e(e({},t),((i={})[n]=!t[n],i))}));var n},sx:{boxShadow:"none",border:s?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:s?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[t(f,e({expandIcon:s?null:t(m,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:s?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:t(v,e({title:o.title||"No Matching Section Found",placement:"top"},{children:t(h,e({sx:{fontSize:"12px",color:s?"#94A3B8":"#19213D",fontWeight:s?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(a=o.title||"No Matching Section Found",a?F(a).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(i.Fragment,{children:e},n)}):null)}))}))})),!s&&n(g,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[t(h,e({component:"div",sx:re},{children:t(w,{children:F(o.content).replace(/\\n/g,"\n")})})),(o.subsections||[]).map(function(n,i){return t(d,e({sx:{mt:1,pt:1,borderTop:"1px solid #EEF2F7"}},{children:t(h,e({component:"div",sx:re},{children:t(w,{children:F(n).replace(/\\n/g,"\n")})}))}),"".concat(l,"-sub-").concat(r,"-").concat(i))})]}))]}))}),"".concat(l,"-sec-").concat(r))};return n(d,e({ref:se,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[ce.open&&t(R,{open:ce.open,popupRef:ne,position:$,onClose:function(){ee(null),ae(function(n){return e(e({},n),{open:!1})})},markdownStyles:Y,sectionTitle:ce.sectionTitle,referenceSectionTitle:ce.refSectionTitle,cognitiveData:ce.cognitiveData,anchorEl:ce.anchorEl,sectionAnchorEl:ce.sectionAnchorEl,scrollContainerEl:de.current,badgeStyle:ce.badgeStyle}),t(s,e({open:!!J,autoHideDuration:8e3,onClose:function(){return Q(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(u,e({onClose:function(){return Q(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:J}))})),t(d,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:t(d,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:t(h,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:N}))}))})),t(d,e({ref:de,sx:{flex:1,overflowY:"auto",minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:ke&&Me?"none":"1.5px solid #EEF0F4"}},{children:t(d,e({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:n(d,e({ref:We,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0}},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:ie.width||"100%",height:ie.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Ve&&n("g",{children:[t("line",{x1:Ve.x1,y1:Ve.y,x2:Math.max(Ve.x1,(Ve.x1+Ve.x2)/2-70),y2:Ve.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),t("line",{x1:Math.min(Ve.x2,(Ve.x1+Ve.x2)/2+70),y1:Ve.y,x2:Ve.x2,y2:Ve.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Pe.map(function(i,o){var r=(i.x1+i.x2)/2;return"Not Defined"!==i.style.label||i.hasCognitive?n("g",{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder,strokeWidth:"1.5"}),t("foreignObject",e({x:r-75,y:i.y1-14,width:"150",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(d,e({sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n(d,e({onClick:function(n){if(n.stopPropagation(),ce.open&&ce.sectionIdx===i.sectionIdx)return ee(null),void ae(function(n){return e(e({},n),{open:!1})});!function(e,n,t,i,o){var r,l;e.stopPropagation(),ee(null);var c=F(n.id)||F(t.id)||"",a=(c?X[c]:null)||n.cognitiveData||t.cognitiveData||null,d=null!==(l=null===(r=ze.current[i])||void 0===r?void 0:r.current)&&void 0!==l?l:null;ae({open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:a,anchorEl:e.currentTarget,sectionAnchorEl:d,badgeStyle:o||null,sectionIdx:i})}(n,Ie[i.sectionIdx]||{title:"",content:""},Re[i.sectionIdx]||{title:"",content:""},i.sectionIdx,i.style)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",cursor:"pointer",verticalAlign:"middle"}},{children:[i.hasCognitive&&void 0!==i.sectionIdx&&t(d,e({sx:{display:"flex",alignItems:"center",justifyContent:"center",color:i.style.badgeText}},{children:t("div",e({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:t(y,{})}))})),ce.open&&ce.sectionIdx===i.sectionIdx?t(x,{size:12,color:i.style.badgeText}):t(m,{size:12,color:i.style.badgeText})]}))]}))}))}))]},o):null})]})),n(d,e({sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[t(d,e({ref:je,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center",overflow:"hidden"}},{children:t(v,e({title:Ae,placement:"top"},{children:t(h,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:Ae}))}))})),t(d,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:Te&&Ie.map(function(e,n){return{section:e,idx:n}}).map(function(n){var o=n.section,r=n.idx;return t(d,e({ref:He(r)},{children:tn(o,r,"left",Je.current[r]||i.createRef())}),"left-row-".concat(r))})}))]})),t(d,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(d,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[t(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(y,{})})),0,"% Similarity",t(m,{size:11})]}))}))})),n(d,e({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[t(d,e({ref:Le,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center",overflow:"hidden"}},{children:t(v,e({title:De,placement:"top"},{children:t(h,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%"}},{children:De}))}))})),t(d,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:Te&&Re.map(function(e,n){return{section:e,idx:n}}).map(function(e){var n=e.section,t=e.idx;return tn(n,t,"right",Qe.current[t]||i.createRef())})}))]}))]}))}))}))]}))};export{B as default};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],F={fields:e,thresholds:{exact:90,high:70,medium:40},relationStyles:{noContent:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F8FAFC",badgeBorder:"#F1F5F9",badgeText:"#64748B",highlightBg:"transparent"},exact:{bg:"#FFF1F2",border:"#FECDD3",badgeBg:"#FFE4E6",badgeBorder:"#FEE2E2",badgeText:"#9F1239",highlightBg:"#FECDD3"},high:{bg:"#FFF5F5",border:"#FECACA",badgeBg:"#FEECEC",badgeBorder:"#F8C2C2",badgeText:"#B42318",highlightBg:"#FDD5D5"},medium:{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3"},low:{bg:"#F5F9FF",border:"#CFE0FF",badgeBg:"#EEF4FF",badgeBorder:"#BFD3FF",badgeText:"#1D4ED8",highlightBg:"#DCEAFF"}}},r={fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden","& p":{mt:0,mb:1.5},"& p:last-child":{mb:0},"& ul, & ol":{mt:0,mb:1.5,pl:2.5},"& li":{mb:.5},"& strong":{fontWeight:600},"& code":{whiteSpace:"pre-wrap",wordBreak:"break-word"}};export{F as DEFAULT_COMPARISON_CONFIG,e as DEFAULT_FIELD_CONFIG,r as SHARED_MARKDOWN_STYLES};
1
+ var e=[{key:"title",label:"Title",analysisKey:"title"},{key:"description",label:"Description",analysisKey:"description"}],F={fields:e,thresholds:{exact:90,high:70,medium:40},relationStyles:{noContent:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F8FAFC",badgeBorder:"#F1F5F9",badgeText:"#64748B",highlightBg:"transparent"},exact:{bg:"#FFF1F2",border:"#FECDD3",badgeBg:"#FFE4E6",badgeBorder:"#FEE2E2",badgeText:"#9F1239",highlightBg:"#FECDD3"},high:{bg:"#FFF5F5",border:"#FECACA",badgeBg:"#FEECEC",badgeBorder:"#F8C2C2",badgeText:"#B42318",highlightBg:"#FDD5D5"},medium:{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3"},low:{bg:"#F5F9FF",border:"#CFE0FF",badgeBg:"#EEF4FF",badgeBorder:"#BFD3FF",badgeText:"#1D4ED8",highlightBg:"#DCEAFF"}}},r={fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden","& p":{mt:0,mb:1.5},"& p:last-child":{mb:0},"& ul":{mt:0,mb:1.5,pl:2.5,listStyleType:"disc"},"& ol":{mt:0,mb:1.5,pl:2.5,listStyleType:"decimal"},"& li":{mb:.5},"& strong":{fontWeight:600},"& code":{whiteSpace:"pre-wrap",wordBreak:"break-word"}};export{F as DEFAULT_COMPARISON_CONFIG,e as DEFAULT_FIELD_CONFIG,r as SHARED_MARKDOWN_STYLES};
2
2
  //# sourceMappingURL=CognitiveCompareConfig.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as o,Fragment as i,jsx as r}from"react/jsx-runtime";import{useState as n,useEffect as t,useMemo as l}from"react";import{Box as a,Typography as d,IconButton as s}from"@mui/material";import{X as c}from"lucide-react";import p from"react-dom";import x from"../../assests/svg/SparkleIcon.js";import h from"react-markdown";import{SHARED_MARKDOWN_STYLES as f}from"./CognitiveCompareConfig.js";var b=10,g=function(g){var m,u,v,w,F,y=g.open,E=g.onClose,D=g.sectionTitle,S=g.referenceSectionTitle,C=g.cognitiveData,k=g.relevanceScore,z=g.anchorEl,W=g.badgeStyle,R=g.popupRef,A=g.position,I=null==C?void 0:C.isMissingRationale,B=n(I?"deviation":"association"),H=B[0],L=B[1];t(function(){y&&L(I?"deviation":"association")},[y,I]);var j=l(function(){if(!W)return{border:"#5928ED",shadow:"rgba(89,40,237,0.18)"};var e=W.badgeText;return"#9F1239"===e||"#B42318"===e?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===e?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===e?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:"#5928ED",shadow:"rgba(89,40,237,0.18)"}},[W]);if(t(function(){if(y){var e=function(e){var o;(null===(o=R.current)||void 0===o?void 0:o.contains(e.target))||(null==z?void 0:z.contains(e.target))||E()};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[y,E,z,R]),!y||!C)return null;var T=null!==(u=null!==(m=C.relevance_score)&&void 0!==m?m:k)&&void 0!==u?u:0,M=C.decisioning,O=Array.isArray(M)?M:"string"==typeof M&&M.trim()?[M]:[],Y=C.gap,G=Array.isArray(Y)?Y:"string"==typeof Y&&Y.trim()?[Y]:[],N=null!==(v=null==A?void 0:A.arrowLeft)&&void 0!==v?v:60,P=o(a,e({ref:R,sx:{position:"fixed",top:null!==(w=null==A?void 0:A.top)&&void 0!==w?w:-9999,left:null!==(F=null==A?void 0:A.left)&&void 0!==F?F:-9999,zIndex:9999,width:"min(".concat(680,"px, calc(100vw - ").concat(24,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(j.border),boxShadow:"0px 8px 32px ".concat(j.shadow,", 0px 0px 0px 3px ").concat(j.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==A?void 0:A.maxHeight)?"min(60vh, ".concat(A.maxHeight,"px)"):"60vh",visibility:A?"visible":"hidden"}},{children:[A&&(A.openAbove?o(i,{children:[r(a,{sx:{position:"absolute",bottom:-11,left:N-b,width:0,height:0,borderLeft:"".concat(b,"px solid transparent"),borderRight:"".concat(b,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(j.border),zIndex:1}}),r(a,{sx:{position:"absolute",bottom:-9,left:N-b+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(b,"px solid #FFFFFF"),zIndex:2}})]}):o(i,{children:[r(a,{sx:{position:"absolute",top:-11,left:N-b,width:0,height:0,borderLeft:"".concat(b,"px solid transparent"),borderRight:"".concat(b,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(j.border),zIndex:1}}),r(a,{sx:{position:"absolute",top:-9,left:N-b+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(b,"px solid #FFFFFF"),zIndex:2}})]})),o(a,e({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o(a,e({sx:{flex:1,minWidth:0}},{children:[o(d,e({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[r(a,e({component:"span",title:D,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:D})),r(a,e({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),r(a,e({component:"span",title:S||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:S||"Reference Section"}))]})),r(a,e({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:r(d,e({sx:{fontSize:"13px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:"deviation"===H?"Why this is a deviation?":"Why these sections are paired?"}))}))]})),o(a,e({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o(a,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[r(x,{}),"Decision Strength ",T,"%"]})),r(s,e({onClick:E,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:r(c,{size:22})}))]}))]})),r(a,e({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:(I?["deviation"]:["deviation","association"]).map(function(o){var i=H===o;return r(a,e({onClick:function(){return L(o)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:"pointer",fontSize:"14px",fontWeight:i?600:400,color:i?"#5928ED":"#667085",backgroundColor:i?"rgba(89,40,237,0.08)":"transparent",borderBottom:i?"2px solid #5928ED":"2px solid transparent",transition:"all 0.15s",userSelect:"none",overflowY:"auto"}},{children:"deviation"===o?"Deviation Analysis":"Association Logic"}),o)})})),r(a,e({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(j.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:j.border},scrollbarWidth:"thin",scrollbarColor:"".concat(j.border,"55 transparent")}},{children:"deviation"===H?o(a,e({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD",p:2,display:"flex",flexDirection:"column",gap:1}},{children:[r(d,e({sx:{fontSize:"15px",fontWeight:600,color:"#344054"}},{children:"Deviation Analysis"})),r(d,e({sx:{fontSize:"14px",color:"#667085",lineHeight:1.6}},{children:"Deviation analysis content will appear here. This tab shows structural and semantic deviations identified between the two sections being compared."}))]})):o(i,{children:[O.length>0&&o(a,e({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[r(a,e({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:r(d,e({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:"Decision Making Factors"}))})),r(a,e({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:r(a,e({sx:{display:"flex",flexDirection:"column"}},{children:r(d,e({component:"div",sx:e({},f)},{children:r(h,{children:O.join("\n\n")})}))}))}))]})),G.length>0&&o(a,e({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[r(a,e({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:r(d,e({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:"Gaps in Decision"}))})),r(a,e({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:r(a,e({sx:{display:"flex",flexDirection:"column"}},{children:r(d,e({component:"div",sx:e({},f)},{children:r(h,{children:G.join("\n\n")})}))}))}))]})),0===O.length&&0===G.length&&r(a,e({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:r(d,e({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]})}))]}));return p.createPortal(P,document.body)};export{g as default};
1
+ import{__assign as e}from"tslib";import{jsxs as o,Fragment as i,jsx as r}from"react/jsx-runtime";import{useState as n,useEffect as t,useMemo as l}from"react";import{Box as a,Typography as d,IconButton as s}from"@mui/material";import{X as c}from"lucide-react";import p from"react-dom";import x from"../../assests/svg/SparkleIcon.js";import h from"react-markdown";import{SHARED_MARKDOWN_STYLES as f}from"./CognitiveCompareConfig.js";var b=10,g=function(g){var m,u,v,w,F,y=g.open,E=g.onClose,D=g.sectionTitle,S=g.referenceSectionTitle,C=g.cognitiveData,k=g.relevanceScore,z=g.anchorEl,W=g.badgeStyle,R=g.popupRef,A=g.position,I=g.markdownStyles,B=e(e({},f),I),H=null==C?void 0:C.isMissingRationale,L=n(H?"deviation":"association"),j=L[0],T=L[1];t(function(){y&&T(H?"deviation":"association")},[y,H]);var M=l(function(){if(!W)return{border:"#5928ED",shadow:"rgba(89,40,237,0.18)"};var e=W.badgeText;return"#9F1239"===e||"#B42318"===e?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===e?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===e?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:"#5928ED",shadow:"rgba(89,40,237,0.18)"}},[W]);if(t(function(){if(y){var e=function(e){var o;(null===(o=R.current)||void 0===o?void 0:o.contains(e.target))||(null==z?void 0:z.contains(e.target))||E()};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[y,E,z,R]),!y||!C)return null;var O=null!==(u=null!==(m=C.relevance_score)&&void 0!==m?m:k)&&void 0!==u?u:0,Y=C.decisioning,G=Array.isArray(Y)?Y:"string"==typeof Y&&Y.trim()?[Y]:[],N=C.gap,P=Array.isArray(N)?N:"string"==typeof N&&N.trim()?[N]:[],_=null!==(v=null==A?void 0:A.arrowLeft)&&void 0!==v?v:60,q=o(a,e({ref:R,sx:{position:"fixed",top:null!==(w=null==A?void 0:A.top)&&void 0!==w?w:-9999,left:null!==(F=null==A?void 0:A.left)&&void 0!==F?F:-9999,zIndex:9999,width:"min(".concat(680,"px, calc(100vw - ").concat(24,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(M.border),boxShadow:"0px 8px 32px ".concat(M.shadow,", 0px 0px 0px 3px ").concat(M.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==A?void 0:A.maxHeight)?"min(60vh, ".concat(A.maxHeight,"px)"):"60vh",visibility:A?"visible":"hidden"}},{children:[A&&(A.openAbove?o(i,{children:[r(a,{sx:{position:"absolute",bottom:-11,left:_-b,width:0,height:0,borderLeft:"".concat(b,"px solid transparent"),borderRight:"".concat(b,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(M.border),zIndex:1}}),r(a,{sx:{position:"absolute",bottom:-9,left:_-b+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(b,"px solid #FFFFFF"),zIndex:2}})]}):o(i,{children:[r(a,{sx:{position:"absolute",top:-11,left:_-b,width:0,height:0,borderLeft:"".concat(b,"px solid transparent"),borderRight:"".concat(b,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(M.border),zIndex:1}}),r(a,{sx:{position:"absolute",top:-9,left:_-b+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(b,"px solid #FFFFFF"),zIndex:2}})]})),o(a,e({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o(a,e({sx:{flex:1,minWidth:0}},{children:[o(d,e({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[r(a,e({component:"span",title:D,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:D})),r(a,e({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),r(a,e({component:"span",title:S||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:S||"Reference Section"}))]})),r(a,e({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:r(d,e({sx:{fontSize:"13px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:"deviation"===j?"Why this is a deviation?":"Why these sections are paired?"}))}))]})),o(a,e({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o(a,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[r(x,{}),"Decision Strength ",O,"%"]})),r(s,e({onClick:E,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:r(c,{size:22})}))]}))]})),r(a,e({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:(H?["deviation"]:["deviation","association"]).map(function(o){var i=j===o;return r(a,e({onClick:function(){return T(o)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:"pointer",fontSize:"14px",fontWeight:i?600:400,color:i?"#5928ED":"#667085",backgroundColor:i?"rgba(89,40,237,0.08)":"transparent",borderBottom:i?"2px solid #5928ED":"2px solid transparent",transition:"all 0.15s",userSelect:"none",overflowY:"auto"}},{children:"deviation"===o?"Deviation Analysis":"Association Logic"}),o)})})),r(a,e({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(M.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:M.border},scrollbarWidth:"thin",scrollbarColor:"".concat(M.border,"55 transparent")}},{children:"deviation"===j?o(a,e({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD",p:2,display:"flex",flexDirection:"column",gap:1}},{children:[r(d,e({sx:{fontSize:"15px",fontWeight:600,color:"#344054"}},{children:"Deviation Analysis"})),r(d,e({sx:{fontSize:"14px",color:"#667085",lineHeight:1.6}},{children:"Deviation analysis content will appear here. This tab shows structural and semantic deviations identified between the two sections being compared."}))]})):o(i,{children:[G.length>0&&o(a,e({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[r(a,e({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:r(d,e({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:"Decision Making Factors"}))})),r(a,e({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:r(a,e({sx:{display:"flex",flexDirection:"column"}},{children:r(d,e({component:"div",sx:e({},B)},{children:r(h,{children:G.join("\n\n")})}))}))}))]})),P.length>0&&o(a,e({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[r(a,e({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:r(d,e({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:"Gaps in Decision"}))})),r(a,e({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:r(a,e({sx:{display:"flex",flexDirection:"column"}},{children:r(d,e({component:"div",sx:e({},B)},{children:r(h,{children:P.join("\n\n")})}))}))}))]})),0===G.length&&0===P.length&&r(a,e({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:r(d,e({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]})}))]}));return p.createPortal(q,document.body)};export{g as default};
2
2
  //# sourceMappingURL=CognitivePopup.js.map
@@ -1,4 +1,6 @@
1
1
  import { CognitiveCompareProps } from "./CognitiveCompareTypes";
2
- declare const CognitiveCompare: ({ componentHeaderText, treeData, comparisonConfig, leftColumnTitleText, rightColumnTitleText, }: CognitiveCompareProps) => import("react/jsx-runtime").JSX.Element;
2
+ import { SHARED_MARKDOWN_STYLES } from "./CognitiveCompareConfig";
3
+ declare const CognitiveCompare: ({ componentHeaderText, treeData, comparisonConfig, leftColumnTitleText, rightColumnTitleText, markdownStyles, }: CognitiveCompareProps) => import("react/jsx-runtime").JSX.Element;
4
+ export { SHARED_MARKDOWN_STYLES };
3
5
  export default CognitiveCompare;
4
6
  //# sourceMappingURL=CognitiveCompare.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AA6BA,OAAO,EAIL,qBAAqB,EAKtB,MAAM,yBAAyB,CAAC;AA+MjC,QAAA,MAAM,gBAAgB,oGAMnB,qBAAqB,4CAgxCvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AA6BA,OAAO,EAIL,qBAAqB,EAKtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA0MlC,QAAA,MAAM,gBAAgB,oHAOnB,qBAAqB,4CAsxCvB,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
@@ -15,10 +15,17 @@ export declare const SHARED_MARKDOWN_STYLES: {
15
15
  "& p:last-child": {
16
16
  mb: number;
17
17
  };
18
- "& ul, & ol": {
18
+ "& ul": {
19
19
  mt: number;
20
20
  mb: number;
21
21
  pl: number;
22
+ listStyleType: string;
23
+ };
24
+ "& ol": {
25
+ mt: number;
26
+ mb: number;
27
+ pl: number;
28
+ listStyleType: string;
22
29
  };
23
30
  "& li": {
24
31
  mb: number;
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompareConfig.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE5E,eAAO,MAAM,oBAAoB,EAAE,eAAe,EAGjD,CAAC;AACF,eAAO,MAAM,yBAAyB,EAAE,gBA6CvC,CAAC;AAIF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAalC,CAAC"}
1
+ {"version":3,"file":"CognitiveCompareConfig.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE5E,eAAO,MAAM,oBAAoB,EAAE,eAAe,EAGjD,CAAC;AACF,eAAO,MAAM,yBAAyB,EAAE,gBA6CvC,CAAC;AAmBF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAclC,CAAC"}
@@ -74,6 +74,7 @@ export interface CognitiveCompareProps {
74
74
  activeBadgeId?: string | null;
75
75
  leftColumnTitleText?: string;
76
76
  rightColumnTitleText?: string;
77
+ markdownStyles?: React.CSSProperties & Record<string, any>;
77
78
  }
78
79
  export type StyleVariant = {
79
80
  bg: string;
@@ -127,6 +128,7 @@ export interface CognitivePopupProps {
127
128
  baseLayoutRef?: any;
128
129
  popupRef: React.RefObject<HTMLDivElement>;
129
130
  position: PopupPosition | null;
131
+ markdownStyles?: React.CSSProperties & Record<string, any>;
130
132
  }
131
133
  export type SectionBlock = {
132
134
  id?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompareTypes.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareTypes.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"CognitiveCompareTypes.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareTypes.ts"],"names":[],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"CognitivePopup.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitivePopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAS9D,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAkejD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CognitivePopup.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitivePopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAS9D,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAsejD,CAAC;AAEF,eAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viswa-test/test-citation",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "author": "Viswa Koduru",
5
5
  "description": "",
6
6
  "license": "MIT",