@viswa-test/test-citation 0.0.130 → 0.0.132

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.
Files changed (32) hide show
  1. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  3. package/dist/cjs/features/CognitiveCompare/components/CognitiveSummaryPopup.js +1 -1
  4. package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  5. package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  6. package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  7. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  8. package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  9. package/dist/features/CognitiveCompare/components/CognitiveSummaryPopup.js +1 -1
  10. package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  11. package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  12. package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  13. package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
  14. package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
  15. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
  16. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  17. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +2 -0
  18. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
  19. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +2 -0
  20. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
  21. package/dist/types/src/features/CognitiveCompare/components/CognitiveSummaryPopup.d.ts.map +1 -1
  22. package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts +2 -1
  23. package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
  24. package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts +1 -0
  25. package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
  26. package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +2 -1
  27. package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
  28. package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts +1 -0
  29. package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -0
  30. package/dist/types/src/features/CognitiveCompare/hooks/useStyles.d.ts +1 -0
  31. package/dist/types/src/features/CognitiveCompare/hooks/useStyles.d.ts.map +1 -0
  32. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("@mui/material"),t=require("react"),i=require("../CognitiveCompareConstants.js"),o=require("lucide-react"),a=require("react-markdown"),s=require("../CognitiveComparehelpers.js"),l=require("rehype-raw");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(t),u=c(a),g=c(l),h=d.default.memo(function(a){var l=a.content,c=a.overlayContent,h=a.sxStyles,f=a.deviationBadges,p=void 0===f?[]:f,v=a.highlights,x=void 0===v?[]:v,m=a.maintainRelativeOrder,_=void 0===m||m,b=a.highlightBg,y=a.collisionKey,E=t.useRef(null),C=!!c,j=t.useMemo(function(){return p.reduce(function(n,r){var t;return e.__assign(e.__assign({},n),((t={})[r.id]=r,t))},{})},[p]),S=function(n,r){return d.default.Children.map(n,function(n){var t;if(!d.default.isValidElement(n))return n;var i=(null===(t=n.props)||void 0===t?void 0:t.children)?S(n.props.children,r):n.props.children,o=d.default.cloneElement(n,e.__assign(e.__assign({},n.props),{children:i}));return r(o)})},F=t.useMemo(function(){return{mark:function(r){var t,i,o,a,s=r.children,l=e.__rest(r,["children"]),c=l["data-badge-id"],d=c?j[c]:null,u=l["data-highlight-color"],g=null!==(a=null!==(i=null!=u?u:null===(t=null==d?void 0:d.style)||void 0===t?void 0:t.highlightBg)&&void 0!==i?i:null===(o=null==d?void 0:d.style)||void 0===o?void 0:o.badgeBg)&&void 0!==a?a:b,h=C||l.isSuggestedDeviationFix;return n.jsx("span",e.__assign({style:e.__assign(e.__assign({},h?{}:{backgroundColor:g}),{borderRadius:"2px"})},{children:s}))},span:function(t){var a,s,l,c,d,u,g=t.children,h=e.__rest(t,["children"]),f=h["data-badge-id"];if(!f)return n.jsx("span",e.__assign({},h,{children:g}));var p=j[f];if(!p)return n.jsx("span",e.__assign({},h,{children:g}));var v="number"==typeof p.stackIndex?p.stackIndex:0,x="translateY(calc(-20% + ".concat(12*v,"px + var(--badge-nudge, 0px)))");return n.jsxs(r.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[n.jsxs(r.Box,e.__assign({ref:p.badgeRef,className:"deviation-badge","data-side":p.side||"right",sx:e.__assign(e.__assign({fontStyle:"normal",position:"absolute",zIndex:30+v,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=p.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(s=p.style)||void 0===s?void 0:s.badgeText)||i.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(l=p.style)||void 0===l?void 0:l.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"transform 0.2s ease-out"},"left"===p.side?{right:"-16px",transform:"".concat(x," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(x," translateX(calc(-100% - 8px))")}),p.isConnected&&p.style&&{outline:"2px solid ".concat(p.style.badgeBorder),outlineOffset:"1px"})},{children:[n.jsxs(r.Box,e.__assign({onClick:function(e){e.stopPropagation(),p.onSummaryClick&&p.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[n.jsx(r.Box,e.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:p.label})),("left"===p.side||p.isOrphan)&&n.jsx(r.Box,e.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=p.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=p.score&&"N/A"!==p.score&&"NA"!==p.score&&0!==p.score?"".concat(p.score):"N/A"===p.score||"NA"===p.score?"N/A":"Same"}))]})),("left"===p.side||p.isOrphan)&&n.jsx(r.Box,e.__assign({onClick:function(e){e.stopPropagation(),p.onClick&&p.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(d=p.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:n.jsx(o.EllipsisVertical,{size:12,color:(null===(u=p.style)||void 0===u?void 0:u.badgeText)||"#3730A3"})}))]})),g]}))},updated:function(r){var t=r.children;return e.__rest(r,["children"]),n.jsx(n.Fragment,{children:t})},deleted:function(r){var t=r.children;e.__rest(r,["children"]),console.log("nitish: ",t);var i=S(t,function(e){return d.default.cloneElement(e,{isSuggestedDeviationFix:!0})});return n.jsx("span",e.__assign({style:{borderTop:"1px solid #EF4444",borderBottom:"1px solid #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(r){var t=r.children;e.__rest(r,["children"]);var i=S(t,function(e){return d.default.cloneElement(e,{isSuggestedDeviationFix:!0})});return n.jsx("span",e.__assign({style:{borderTop:"1px solid #2F59FF",borderBottom:"1px solid #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))}}},[j,_,b,C]),w=function(e){return e?e.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(e){return e.startsWith("\n")?e:e.replace(/\n/g," ")}).join(""):""},B=t.useMemo(function(){var n=w(s.safeStringify(l||"")),r=(p||[]).map(function(e){var n,r;return{id:null==e?void 0:e.id,highlight:w((null==e?void 0:e.highlight)||""),highlightColor:(null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.highlightBg)||(null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.badgeBg)||b}}).filter(function(e){return e.id&&e.highlight}),t={};r.forEach(function(e){t[e.highlight]||(t[e.highlight]=[]),t[e.highlight].push(e)});var i=function(e,n){void 0===e&&(e="");var r=n?' data-highlight-color="'.concat(n,'"'):"";return'<mark data-badge-id="'.concat(e,'"').concat(r,">")},o=function(e){return'<span data-badge-id="'.concat(e,'">')},a=[];Object.entries(t).forEach(function(e){var r=e[0],t=e[1],i=n.indexOf(r);if(-1!==i){for(var o=t[0].highlightColor,l=1;l<t.length;l++)o=s.mixHexColors(o,t[l].highlightColor);a.push({highlight:r,start:i,end:i+r.length,badges:t,color:o})}}),a.sort(function(e,n){return e.start-n.start||n.end-e.end});var c=[],d={};a.forEach(function(e,n){for(var r=e.start,t=e.end,i=0,o=c;i<o.length;i++){var a=o[i],s=a.start,l=a.end,u=r<l&&t>l&&r>=s,g=r<s&&t>s&&t<=l;if(r>=s&&t<=l){e.orphaned=!0,d[n]=a.matchIdx;break}u&&(r=l),g&&(t=s)}e.trimmedStart=r,e.trimmedEnd=t,!e.orphaned&&r<t&&c.push({start:r,end:t,matchIdx:n})});var u={};Object.entries(d).forEach(function(e){var n=e[0],r=e[1],t=Number(n);u[r]||(u[r]=[]),u[r].push(t)});var g=function(e,n,r){void 0===n&&(n="");var t=e.startsWith("\n\n"),o=e.endsWith("\n\n"),a=e.split(/(\n{2,})/).map(function(e,a,s){if(/^\n{2,}$/.test(e))return e;if(!e.trim())return e;var l=0===a||1===a&&/^\n{2,}$/.test(s[0]),c=a===s.length-1||a===s.length-2&&/^\n{2,}$/.test(s[s.length-1]);return t&&l||o&&c?e:function(e,n,r){var t,o,a;void 0===n&&(n="");var s=e.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!s)return e;var l=null!==(t=s[1])&&void 0!==t?t:"",c=null!==(o=s[2])&&void 0!==o?o:"",d=null!==(a=s[3])&&void 0!==a?a:"";return c?l+i(n,r)+c+"</mark>"+d:e}(e,n,r)}).join("");return a.replace(/^\n{2,}/,"").replace(/\n{2,}$/,"")},h=a.map(function(n,r){return e.__assign(e.__assign({},n),{idx:r})}).filter(function(e){return!e.orphaned}).sort(function(e,n){var r,t;return(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)-(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)});h.forEach(function(e){var r,t,i=null!==(r=e.trimmedStart)&&void 0!==r?r:e.start,l=null!==(t=e.trimmedEnd)&&void 0!==t?t:e.end;if(!(i>=l)){var c=n.slice(i,l),d=function(e,n,r,t){if(!r.length)return e;var i=r.map(function(e){return a[e]}).sort(function(e,n){return e.start-n.start}),l="",c=0;return i.forEach(function(r){var i=r.start-n,a=r.end-n,d=s.mixHexColors(t,r.color);l+=e.slice(c,i);var u="",h="";r.badges.forEach(function(e){u+=o(e.id),h="</span>"+h}),l+=u+g(e.slice(i,a),r.badges[0].id,d)+h,c=a}),l+=e.slice(c)}(i!==e.start||l!==e.end?c:e.highlight,e.start,u[e.idx]||[],e.color),h=g(d,e.badges[0].id,e.color),f="",p="";e.badges.forEach(function(e){f+=o(e.id),p="</span>"+p});var v=f+h+p;n=n.slice(0,i)+v+n.slice(l)}});var f=new Set(Object.keys(t));return x.forEach(function(e){if(e){var r=w(e);if(r&&!f.has(r)){var t=n.indexOf(r);if(-1!==t){var o=n.slice(0,t);if((o.match(/</g)||[]).length===(o.match(/>/g)||[]).length){var a=i("","")+r+"</mark>";n=n.slice(0,t)+a+n.slice(t+r.length)}}}}}),n},[l,p,x,b]),k=t.useMemo(function(){return c?w(s.safeStringify(c||"")):""},[c]),T=!!c,O=e.__assign(e.__assign(e.__assign(e.__assign({},h),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:2}),T?{color:"transparent"}:{}),{"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}}),A=e.__assign(e.__assign({},h),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}});return t.useLayoutEffect(function(){if(E.current){var e=function(){var e=Array.from(E.current.querySelectorAll(".deviation-badge"));if(0!==e.length){e.forEach(function(e){e.style.setProperty("--badge-nudge","0px")});var n=e.filter(function(e){return"left"===e.dataset.side}),r=e.filter(function(e){return"left"!==e.dataset.side}),t=E.current.getBoundingClientRect(),i=t.bottom-4,o=t.top+4,a=function(e){if(0!==e.length){var n=e.map(function(e){var n=e.getBoundingClientRect();return{el:e,naturalTop:n.top,height:n.height,currentTop:n.top}});n.sort(function(e,n){return e.naturalTop-n.naturalTop});var r=[],t=[];n.forEach(function(e){if(0===t.length)t.push(e);else{var n=t[t.length-1],i=n.currentTop+n.height;e.naturalTop<i+8?(e.currentTop=i+8,t.push(e)):(r.push(t),t=[e])}}),t.length>0&&r.push(t),r.forEach(function(e){var n=e[e.length-1],r=n.currentTop+n.height;if(r>i){var t=r-i,a=e[0].currentTop-o,s=Math.max(0,Math.min(t,a));e.forEach(function(e){e.currentTop-=s})}}),r.flat().forEach(function(e){var n=e.currentTop-e.naturalTop;e.el.style.setProperty("--badge-nudge","".concat(n,"px"))})}};a(n),a(r)}};e();var n=new ResizeObserver(function(){return e()});return n.observe(E.current),function(){return n.disconnect()}}},[B,y]),n.jsxs(r.Box,e.__assign({ref:E,sx:{position:"relative",display:"grid"}},{children:[n.jsx(r.Typography,e.__assign({component:"div",sx:O},{children:n.jsx(u.default,e.__assign({components:F,rehypePlugins:[g.default]},{children:s.safeStringify(B).replace(/\\n/g,"\n")}))})),T&&n.jsx(r.Typography,e.__assign({component:"div",sx:A},{children:n.jsx(u.default,e.__assign({components:F,rehypePlugins:[g.default]},{children:s.safeStringify(k).replace(/\\n/g,"\n")}))}))]}))},s.areMarkdownPropsEqual);exports.MemoizedMarkdown=h;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("@mui/material"),t=require("react"),i=require("../CognitiveCompareConstants.js"),o=require("lucide-react"),a=require("react-markdown"),s=require("../CognitiveComparehelpers.js"),l=require("rehype-raw");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(t),u=c(a),g=c(l),h=d.default.memo(function(a){var l=a.content,c=a.overlayContent,h=a.sxStyles,p=a.deviationBadges,f=void 0===p?[]:p,v=a.highlights,x=void 0===v?[]:v,_=a.maintainRelativeOrder,m=void 0===_||_,b=a.highlightBg,y=a.suppressHighlightBg,C=void 0!==y&&y,E=a.collisionKey,S=t.useRef(null),j=!!c,k=t.useMemo(function(){return f.reduce(function(n,r){var t;return e.__assign(e.__assign({},n),((t={})[r.id]=r,t))},{})},[f]),w=function(n,r){return d.default.Children.map(n,function(n){var t;if(!d.default.isValidElement(n))return n;var i=(null===(t=n.props)||void 0===t?void 0:t.children)?w(n.props.children,r):n.props.children,o=d.default.cloneElement(n,e.__assign(e.__assign({},n.props),{children:i}));return r(o)})},B=t.useMemo(function(){return{mark:function(r){var t,i,o,a,s=r.children,l=e.__rest(r,["children"]),c=l["data-badge-id"],d=c?k[c]:null,u=l["data-highlight-color"],g=null!==(a=null!==(i=null!=u?u:null===(t=null==d?void 0:d.style)||void 0===t?void 0:t.highlightBg)&&void 0!==i?i:null===(o=null==d?void 0:d.style)||void 0===o?void 0:o.badgeBg)&&void 0!==a?a:b,h=l.isSuggestedDeviationFix||C;return n.jsx("span",e.__assign({style:e.__assign(e.__assign(e.__assign({},h?{}:{backgroundColor:g}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),j?{color:"transparent"}:{})},{children:s}))},span:function(t){var a,s,l,c,d,u,g=t.children,h=e.__rest(t,["children"]),p=h["data-badge-id"];if(!p)return n.jsx("span",e.__assign({},h,{children:g}));var f=k[p];if(!f)return n.jsx("span",e.__assign({},h,{children:g}));var v="number"==typeof f.stackIndex?f.stackIndex:0,x="translateY(calc(-20% + ".concat(12*v,"px + var(--badge-nudge, 0px)))");return n.jsxs(r.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[n.jsxs(r.Box,e.__assign({ref:f.badgeRef,className:"deviation-badge","data-side":f.side||"right",sx:e.__assign(e.__assign({fontStyle:"normal",position:"absolute",zIndex:30+v,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=f.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(s=f.style)||void 0===s?void 0:s.badgeText)||i.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(l=f.style)||void 0===l?void 0:l.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"transform 0.2s ease-out"},"left"===f.side?{right:"-16px",transform:"".concat(x," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(x," translateX(calc(-100% - 8px))")}),f.isConnected&&f.style&&{outline:"2px solid ".concat(f.style.badgeBorder),outlineOffset:"1px"})},{children:[n.jsxs(r.Box,e.__assign({onClick:function(e){e.stopPropagation(),f.onSummaryClick&&f.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[n.jsx(r.Box,e.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:f.label})),("left"===f.side||f.isOrphan)&&n.jsx(r.Box,e.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=f.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=f.score&&"N/A"!==f.score&&"NA"!==f.score&&0!==f.score?"".concat(f.score):"N/A"===f.score||"NA"===f.score?"N/A":"Same"}))]})),("left"===f.side||f.isOrphan)&&n.jsx(r.Box,e.__assign({onClick:function(e){e.stopPropagation(),f.onClick&&f.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(d=f.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:n.jsx(o.EllipsisVertical,{size:12,color:(null===(u=f.style)||void 0===u?void 0:u.badgeText)||"#3730A3"})}))]})),g]}))},updated:function(r){var t=r.children;return e.__rest(r,["children"]),n.jsx(n.Fragment,{children:t})},deleted:function(r){var t=r.children;e.__rest(r,["children"]),console.log("nitish: ",t);var i=w(t,function(e){return d.default.cloneElement(e,{isSuggestedDeviationFix:!0})});return n.jsx("span",e.__assign({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(r){var t=r.children;e.__rest(r,["children"]);var i=w(t,function(e){return d.default.cloneElement(e,{isSuggestedDeviationFix:!0})});return n.jsx("span",e.__assign({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))}}},[k,m,b,j,C]),F=function(e){return e?e.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(e){return e.startsWith("\n")?e:e.replace(/\n/g," ")}).join(""):""},T=function(e){return e.replace(/[\.,;:]/g," ")},O=t.useMemo(function(){var n=F(s.safeStringify(l||"")),r=C?T(n):n,t=(f||[]).map(function(e){var n,r;return{id:null==e?void 0:e.id,highlight:F((null==e?void 0:e.highlight)||""),highlightColor:(null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.highlightBg)||(null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.badgeBg)||b}}).filter(function(e){return e.id&&e.highlight}),i={};t.forEach(function(e){i[e.highlight]||(i[e.highlight]=[]),i[e.highlight].push(e)});var o=function(e,n){void 0===e&&(e="");var r=n?' data-highlight-color="'.concat(n,'"'):"";return'<mark data-badge-id="'.concat(e,'"').concat(r,">")},a=function(e){return'<span data-badge-id="'.concat(e,'">')},c=[];Object.entries(i).forEach(function(e){var t=e[0],i=e[1],o=n.indexOf(t),a=!1;if(-1===o&&C){var l=T(t);-1!==(o=r.indexOf(l))&&(a=!0)}if(-1!==o){for(var d=i[0].highlightColor,u=1;u<i.length;u++)d=s.mixHexColors(d,i[u].highlightColor);c.push({highlight:t,start:o,end:o+t.length,badges:i,color:d,usedLooseMatch:a})}}),c.sort(function(e,n){return e.start-n.start||n.end-e.end});var d=[],u={};c.forEach(function(e,n){for(var r=e.start,t=e.end,i=0,o=d;i<o.length;i++){var a=o[i],s=a.start,l=a.end,c=r<l&&t>l&&r>=s,g=r<s&&t>s&&t<=l;if(r>=s&&t<=l){e.orphaned=!0,u[n]=a.matchIdx;break}c&&(r=l),g&&(t=s)}e.trimmedStart=r,e.trimmedEnd=t,!e.orphaned&&r<t&&d.push({start:r,end:t,matchIdx:n})});var g={};Object.entries(u).forEach(function(e){var n=e[0],r=e[1],t=Number(n);g[r]||(g[r]=[]),g[r].push(t)});var h=function(e,n,r){void 0===n&&(n="");var t=e.startsWith("\n\n"),i=e.endsWith("\n\n"),a=e.split(/(\n{2,})/).map(function(e,a,s){if(/^\n{2,}$/.test(e))return e;if(!e.trim())return e;var l=0===a||1===a&&/^\n{2,}$/.test(s[0]),c=a===s.length-1||a===s.length-2&&/^\n{2,}$/.test(s[s.length-1]);return t&&l||i&&c?e:function(e,n,r){var t,i,a;void 0===n&&(n="");var s=e.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!s)return e;var l=null!==(t=s[1])&&void 0!==t?t:"",c=null!==(i=s[2])&&void 0!==i?i:"",d=null!==(a=s[3])&&void 0!==a?a:"";return c?l+o(n,r)+c+"</mark>"+d:e}(e,n,r)}).join("");return a.replace(/^\n{2,}/,"").replace(/\n{2,}$/,"")},p=c.map(function(n,r){return e.__assign(e.__assign({},n),{idx:r})}).filter(function(e){return!e.orphaned}).sort(function(e,n){var r,t;return(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)-(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)});p.forEach(function(e){var r,t,i=null!==(r=e.trimmedStart)&&void 0!==r?r:e.start,o=null!==(t=e.trimmedEnd)&&void 0!==t?t:e.end;if(!(i>=o)){var l=n.slice(i,o),d=function(e,n,r,t){if(!r.length)return e;var i=r.map(function(e){return c[e]}).sort(function(e,n){return e.start-n.start}),o="",l=0;return i.forEach(function(r){var i=r.start-n,c=r.end-n,d=s.mixHexColors(t,r.color);o+=e.slice(l,i);var u="",g="";r.badges.forEach(function(e){u+=a(e.id),g="</span>"+g}),o+=u+h(e.slice(i,c),r.badges[0].id,d)+g,l=c}),o+=e.slice(l)}(e.usedLooseMatch||i!==e.start||o!==e.end?l:e.highlight,e.start,g[e.idx]||[],e.color),u=h(d,e.badges[0].id,e.color),p="",f="";e.badges.forEach(function(e){p+=a(e.id),f="</span>"+f});var v=p+u+f;n=n.slice(0,i)+v+n.slice(o)}});var v=new Set(Object.keys(i));return x.forEach(function(e){if(e){var t=F(e);if(t&&!v.has(t)){var i=C?r.indexOf(T(t)):n.indexOf(t);if(-1!==i){var a=n.slice(0,i);if((a.match(/</g)||[]).length===(a.match(/>/g)||[]).length){var s=o("","")+t+"</mark>";n=n.slice(0,i)+s+n.slice(i+t.length)}}}}}),n},[l,f,x,b,C]),A=t.useMemo(function(){return c?F(s.safeStringify(c||"")):""},[c]),D=!!c,I=e.__assign(e.__assign(e.__assign(e.__assign({},h),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:2}),D?{color:"transparent"}:{}),{"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}}),M=e.__assign(e.__assign({},h),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}});return t.useLayoutEffect(function(){if(S.current){var e=function(){var e=Array.from(S.current.querySelectorAll(".deviation-badge"));if(0!==e.length){e.forEach(function(e){e.style.setProperty("--badge-nudge","0px")});var n=e.filter(function(e){return"left"===e.dataset.side}),r=e.filter(function(e){return"left"!==e.dataset.side}),t=S.current.getBoundingClientRect(),i=t.bottom-4,o=t.top+4,a=function(e){if(0!==e.length){var n=e.map(function(e){var n=e.getBoundingClientRect();return{el:e,naturalTop:n.top,height:n.height,currentTop:n.top}});n.sort(function(e,n){return e.naturalTop-n.naturalTop});var r=[],t=[];n.forEach(function(e){if(0===t.length)t.push(e);else{var n=t[t.length-1],i=n.currentTop+n.height;e.naturalTop<i+8?(e.currentTop=i+8,t.push(e)):(r.push(t),t=[e])}}),t.length>0&&r.push(t),r.forEach(function(e){var n=e[e.length-1],r=n.currentTop+n.height;if(r>i){var t=r-i,a=e[0].currentTop-o,s=Math.max(0,Math.min(t,a));e.forEach(function(e){e.currentTop-=s})}}),r.flat().forEach(function(e){var n=e.currentTop-e.naturalTop;e.el.style.setProperty("--badge-nudge","".concat(n,"px"))})}};a(n),a(r)}};e();var n=new ResizeObserver(function(){return e()});return n.observe(S.current),function(){return n.disconnect()}}},[O,E]),n.jsxs(r.Box,e.__assign({ref:S,sx:{position:"relative",display:"grid"}},{children:[n.jsx(r.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},I),{padding:"3px"})},{children:n.jsx(u.default,e.__assign({components:B,rehypePlugins:[g.default]},{children:s.safeStringify(O).replace(/\\n/g,"\n")}))})),D&&n.jsx(r.Typography,e.__assign({component:"div",sx:M},{children:n.jsx(u.default,e.__assign({components:B,rehypePlugins:[g.default]},{children:s.safeStringify(A).replace(/\\n/g,"\n")}))}))]}))},s.areMarkdownPropsEqual);exports.MemoizedMarkdown=h;
2
2
  //# sourceMappingURL=memoizedMarkdown.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{useState as r,useRef as l,useMemo as u,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as s,Alert as v,Tooltip as p,Typography as f}from"@mui/material";import{ChevronDown as g,EllipsisVertical as h}from"lucide-react";import{ButtonCognitiveIcon as x}from"../../assests/svg/ButtonCognitiveIcon.js";import m from"./OverlayComponent.js";import{safeStringify as y,extractDeviationScore as b,generateColorPalette as S,DEVIATION_BADGE_SEPARATOR as R,findKeyPathByNodeId as C,getFirstDeviationOutputValue as B,getFirstDeviationColor as I,hasValue as w,getBentArrowPath as T,smoothScrollTo as _,resetClauseHighlight as E,scrollAndHighlightClause as F}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as D,DEFAULT_FIELD_CONFIG as N,DEFAULT_COMPARISON_CONFIG as M}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as A,DEFAULT_DEVIAION_COLOR as k,DEFAULT_COMPONENT_HEADER_TEXT as P}from"./CognitiveCompareConstants.js";import j from"./CognitivePopup.js";import H from"./MoreFunctionsPopup.js";import L from"./LoaderComponent.js";import O from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as z}from"./hooks/useCompareData.js";import{useComparePopups as W}from"./hooks/useComparePopups.js";import{useSectionRefs as q}from"./hooks/useSectionRefs.js";import{useAccordionState as Y}from"./hooks/useAccordionState.js";import{useDeviationNavigation as K}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import X from"./components/SectionAccordion.js";import $ from"./components/SubSectionAccordion.js";import J from"./components/CognitiveSummaryPopup.js";import U from"./components/connectedLines.js";var G=function(G){var Q,Z,nn,en,tn,on,rn,ln,un,cn,an,dn,sn,vn,pn,fn,gn,hn,xn,mn,yn,bn,Sn,Rn,Cn,Bn,In=G.componentHeaderText,wn=void 0===In?P:In,Tn=G.treeData,_n=G.comparisonConfig,En=G.leftColumnTitleText,Fn=G.rightColumnTitleText,Dn=G.markdownStyles,Nn=G.resetTrigger,Mn=G.displayConfig,An=void 0===Mn?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:Mn,kn=G.popupConfig,Pn=G.deviationData,jn=void 0===Pn?{}:Pn,Hn=G.deviationNodeIdToView,Ln=G.resetDeviationNodeId,On=G.isProposingFix,zn=void 0!==On&&On,Wn=G.proposingFixNodeId,qn=r(An.maintainRelativeOrder),Yn=qn[0],Kn=qn[1],Vn=!!Yn||!!(null==An?void 0:An.showDeviationBadges),Xn=r(!1),$n=Xn[0],Jn=Xn[1],Un=r(!1),Gn=Un[0],Qn=Un[1],Zn=r(null),ne=Zn[0],ee=Zn[1],te=r(!1),ie=te[0],oe=te[1],re=r(null===(Z=null!==(Q=null==Tn?void 0:Tn.newEvaluationResult)&&void 0!==Q?Q:null==An?void 0:An.enableDeviationSchemaBackwardCompatibility)||void 0===Z||Z)[0],le=r(!1),ue=le[0],ce=le[1],ae=r(!1),de=ae[0],se=ae[1],ve=r(null),pe=ve[0],fe=ve[1],ge=l(!1),he=r(new Set),xe=he[0],me=he[1],ye=r([]),be=ye[0],Se=ye[1],Re=l(null),Ce=l(null),Be=l(null),Ie=l(new Set),we=l(!1),Te=l(null),_e=l({}),Ee=l([]),Fe=l(!1),De=l(!1),Ne=l(null),Me=l(function(){}),Ae=u(function(){return(null==Tn?void 0:Tn.cognitive_decisioning)||{}},[Tn]),ke=r({width:0,height:0}),Pe=ke[0],je=ke[1],He=u(function(){return n(n({},D),Dn)},[Dn]),Le=l(null),Oe=l(null),ze=l(null),We=l(null),qe=l(null),Ye=l(null),Ke=l(null),Ve=l(null),Xe=l(!1),$e=l(null),Je=l(null),Ue=W(Le),Ge=Ue.cognitivePopup,Qe=Ue.setCognitivePopup,Ze=Ue.moreFunctions,nt=Ue.setMoreFunctions,et=Ue.position,tt=Ue.setPosition,it=Ue.activeBadgeId,ot=Ue.summaryPopup,rt=Ue.setSummaryPopup,lt=Ue.closeSummaryPopup,ut=Ue.setActiveBadgeId,ct=Ue.popupRef,at=Ue.closeCognitivePopup,dt=Ue.closeMoreFunctionsPopup,st=u(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==_n?void 0:_n.fields)&&void 0!==n?n:N,thresholds:{high:null!==(t=null===(e=null==_n?void 0:_n.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:M.thresholds.high,medium:null!==(o=null===(i=null==_n?void 0:_n.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:M.thresholds.medium,exact:null!==(l=null===(r=null==_n?void 0:_n.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:M.thresholds.exact}}},[_n]),vt=r(null),pt=vt[0];vt[1];var ft=null===(tn=null===(nn=null==Tn?void 0:Tn.documents)||void 0===nn?void 0:nn[null===(en=null==Tn?void 0:Tn.input_index_map)||void 0===en?void 0:en[0]])||void 0===tn?void 0:tn.title,gt=null===(ln=null===(on=null==Tn?void 0:Tn.documents)||void 0===on?void 0:on[null===(rn=null==Tn?void 0:Tn.input_index_map)||void 0===rn?void 0:rn[1]])||void 0===ln?void 0:ln.title,ht=y(En||ft||"Uploaded Contract"),xt=y(Fn||gt||"Reference Template"),mt=z(Tn,Yn,jn,st,re),yt=mt.activeProposed,bt=mt.existingRule,St=mt.proposedSections,Rt=mt.existingSections,Ct=mt.visibleFields,Bt=mt.parentDeviationRecord,It=mt.deviationNumberRegistry,wt=mt.parseError;c(function(){wt&&ee("Failed to load comparison: ".concat(wt))},[wt]);var Tt=St.length>0||Rt.length>0,_t=u(function(){var n=new Map,e=new Map,t=1;if(Yn)St.forEach(function(e){!e.title&&!e.content||e.id&&n.set(e.id,t++)}),Rt.forEach(function(i){if(i.id){var o=St.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});if(o.length>0){var r=o.map(function(e){return n.get(e.id)}).filter(Boolean);e.set(i.id,r.join(", "))}else e.set(i.id,String(t++))}});else for(var i=Math.max(St.length,Rt.length),o=0;o<i;o++){var r=St[o],l=Rt[o];r?(n.set(r.id,t),l&&e.set(l.id,String(t)),t++):l&&e.set(l.id,String(t++))}return{leftNums:n,rightNums:e}},[St,Rt,Yn]),Et=q(Ct.map(function(n){return n.key}),Math.max(St.length,Rt.length)),Ft=Et.leftRefs,Dt=Et.rightRefs,Nt=Et.sectionLeftRefs,Mt=Et.sectionRightRefs,At=Et.lhsBadgeRefs,kt=Et.rhsBadgeRefs,Pt=Et.sectionRightRowRefs,jt=Et.subSectionLeftRefs,Ht=Et.subSectionRightRefs,Lt=Et.sectionRowRefs,Ot=Et.getSectionRowRef,zt=Et.getSubSectionRef,Wt=Et.getBadgeRef,qt=bt.analysis,Yt=y(null===(cn=null===(un=null==qt?void 0:qt.rule_difference_comparison)||void 0===un?void 0:un.summary)||void 0===cn?void 0:cn.overall_summary),Kt=!!Yt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Vt=null!==(an=null==Tn?void 0:Tn.base_root_id)&&void 0!==an?an:"-1";null==Tn||Tn[Vt];var Xt=re?null!==(Sn=null!==(mn=jn&&(null===(xn=null==jn?void 0:jn[Vt])||void 0===xn?void 0:xn.evaluation_result))&&void 0!==mn?mn:null===(bn=null===(yn=null==Tn?void 0:Tn.nodes)||void 0===yn?void 0:yn[Vt])||void 0===bn?void 0:bn.evaluation_result)&&void 0!==Sn?Sn:null:null!==(hn=null!==(vn=jn&&(null===(sn=null===(dn=null==jn?void 0:jn[Vt])||void 0===dn?void 0:dn.evaluation_result)||void 0===sn?void 0:sn[0]))&&void 0!==vn?vn:null===(gn=null===(fn=null===(pn=null==Tn?void 0:Tn.nodes)||void 0===pn?void 0:pn[Vt])||void 0===fn?void 0:fn.evaluation_result)||void 0===gn?void 0:gn[0])&&void 0!==hn?hn:null,$t=b(Xt),Jt=S(null!==(Bn=null===(Cn=null===(Rn=null==Xt?void 0:Xt.evaluation_outputs)||void 0===Rn?void 0:Rn.metadata)||void 0===Cn?void 0:Cn.label_color)&&void 0!==Bn?Bn:""),Ut=function(){Ie.current.forEach(function(n){E(n)}),Ie.current.clear()},Gt=a(function(){var n,e,t,i,o,r;Ut(),oe(!1),De.current=!1,Ce.current=null;var l=Ne.current,u=hi.current;if(null!==l)if("string"==typeof l&&l.includes(R)){var c=l.split(R);(a=(null===(n=jt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=Nt.current[Number(c[2])])||void 0===e?void 0:e.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(t=Nt.current[l])||void 0===t?void 0:t.current)&&(a.style.paddingTop="0px")}if(null!==u)if("string"==typeof u&&u.includes(R)){c=u.split(R);(d=(null===(i=Ht.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=Mt.current[Number(c[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Mt.current[u])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}fe(null),Ne.current=null,hi.current=null,ce(!1),Qn(!1),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px")},[]),Qt=a(function(){Ut(),Gt(),me(new Set),Se([]),Ee.current=[],Ri([]),Ii(null),rt(A),at(),requestAnimationFrame(function(){var n;null===(n=Me.current)||void 0===n||n.call(Me)})},[]),Zt=l(Qt);c(function(){Zt.current=Qt},[Qt]),c(function(){Nn&&Zt.current()},[Nn]);var ni=Y({maintainRelativeOrder:!!Yn,proposedSections:St,existingSections:Rt,activeSideBySideSection:pe,connectedSections:xe,resetSideBySide:Gt,setConnectedSections:me,setConnectedLines:Se,cachedConnectedPositions:Ee,svgContainerRef:Re,isAnimatingRef:we,animationTimerRef:Te,calculateLinesRef:Me,sectionLeftRefs:Nt,sectionRightRefs:Mt,subSectionLeftRefs:jt,subSectionRightRefs:Ht}),ei=ni.expandedSections,ti=ni.setExpandedSections,ii=ni.expandedSubSections,oi=ni.setExpandedSubSections,ri=ni.toggleSection,li=a(function(e,t,i,o,r,l,u){var c,a,d,s=y(null==t?void 0:t.id)||y(null==i?void 0:i.id)||"",v=(s?Ae[s]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:s,decisioning:[],gap:[],relevance_score:0},p=null!==(a=null===(c=Lt.current[o])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(d=null==An?void 0:An.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",refSectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",cognitiveData:v,anchorEl:e,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Tn?void 0:Tn.documents,input_index_map:null==Tn?void 0:Tn.input_index_map},deviationData:function(){var e,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,u=function(e){var t=function(n){if(!n||"object"!=typeof n)return null;var e=null==n?void 0:n.deviation_entries;if(e&&"object"==typeof e){var t=Object.keys(e).sort(function(n,e){return Number(n)-Number(e)})[0];if(t&&e[t])return e[t]}var i=Object.keys(n).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,e){return Number(n)-Number(e)});if(i.length&&n[i[0]])return n[i[0]];var o=null==n?void 0:n.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(n,e){return Number(n)-Number(e)})[0];if(r&&o[r])return o[r]}return null}(e);return t?n(n({},e),{deviation_summary:(null==e?void 0:e.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==e?void 0:e.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==e?void 0:e.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==e?void 0:e.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==e?void 0:e.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==e?void 0:e.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):e};if(!("string"==typeof o&&o.includes(R)))return u(l);var c=o.split(R)[1];if(!c)return l;var a=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(e=null==a?void 0:a.deviation_entries)||void 0===e?void 0:e[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return d?n(n(n({},a),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[Ae,Tn]),ui=a(function(n){dt(),tt(null),Qe(n)},[dt]),ci=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),Ze.open&&Ze.sectionIdx===o)dt();else{var u=n.currentTarget,c="left";(null===(l=ze.current)||void 0===l?void 0:l.contains(u))&&(c="right");Ut(),De.current&&Gt(),me(new Set),Se([]),Ee.current=[],at(),ot.open?Ki():lt(),requestAnimationFrame(function(){var n=function(){var n,e,t,i;if("string"==typeof o&&o.includes(R)){var r=o.split(R),l="".concat(r[0]).concat(R).concat(r[1]);return"right"===c?null===(n=kt.current[l])||void 0===n?void 0:n.current:null===(e=At.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=kt.current[o])||void 0===t?void 0:t.current:null===(i=At.current[o])||void 0===i?void 0:i.current}()||u;nt(li(n,e,i,o,t,r))})}},ai=a(function(){null!==Ze.sectionIdx&&Ze.anchorEl?ui(n(n({},Ze),{open:!0})):dt()},[Ze,dt,ui]),di=a(function(){var n=Ze.sectionIdx,e=Ze.isOrphan;dt(),lt(),null!==n&&(e?ee("No counterpart exists to connect to."):(Ut(),De.current&&Gt(),Se([]),Ee.current=[],me(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Me.current&&Me.current()},50)))},[Ze.sectionIdx,Ze.isOrphan,dt,lt,Gt]),si=a(function(){var n=Be.current;if(n){Be.current=null;var e=St.findIndex(function(e){return e.id===n}),t=Rt.findIndex(function(e){return e.id===n}),i=-1===e?C(St,n):null,o=-1===t?C(Rt,n):null,r=-1!==e?e:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=function(n,e,t,i){var o,r,l,u;return-1!==n?null!==(r=null===(o=t.current[n])||void 0===o?void 0:o.current)&&void 0!==r?r:null:e&&null!==(u=null===(l=i.current[e])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(n,e,t){void 0===t&&(t=30);var i=0,o=function(){var r=n();r&&0!==r.getBoundingClientRect().height?(Ie.current.add(r),F(r,e)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Yn)-1!==r&&Ve.current&&c(function(){return u(e,i,Nt,jt)},Ve.current),-1!==l&&ze.current&&c(function(){return u(t,o,Mt,Ht)},ze.current);else{var a=Le.current;if(!a)return;c(function(){return-1!==r?u(e,i,Nt,jt):u(t,o,Mt,Ht)},a)}}},[St,Rt,Yn,Nt,Mt,jt,Ht,Ve,ze,Le]),vi=a(function(e){if(e){Ut(),Gt(),me(new Set),Se([]),Ee.current=[],lt(),at();var t=St.findIndex(function(n){return n.id===e}),i=Rt.findIndex(function(n){return n.id===e}),o=-1===t?C(St,e):null,r=-1===i?C(Rt,e):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=-1!==i?i:r?Number(r.split("-")[0]):-1;Be.current=e,ti(function(e){var t,i=n({},e),o=!1;-1!==l&&(i[t=Yn?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==u&&(i[t=Yn?"right-".concat(u):String(u)]||(i[t]=!0,o=!0));return o?i:e}),oi(function(e){var t=n({},e),i=!1,l=function(n){for(var e=n.split("-"),o=e[0],r=1;r<e.length;r++)o+="-".concat(e[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:e}),setTimeout(function(){requestAnimationFrame(function(){Be.current===e&&pi.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(e,'" not found'))}},[St,Rt,Yn,ti,oi,Gt,lt,at]),pi=l(si);c(function(){pi.current=si},[si]);var fi=l(null),gi=l(null),hi=l(null),xi=l(null),mi=l(null),yi=l(null),bi=r([]),Si=bi[0],Ri=bi[1];l(null);var Ci=r(null),Bi=Ci[0],Ii=Ci[1];c(function(){if(pt){var n=st.fields.find(function(n){return n.analysisKey===pt||n.key===pt});if(n){var e=Ft.current[n.key]||Dt.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[pt,st.fields]);var wi=a(function(n){var e,t,i,o,r,l,u,c,a,d=null===(e=null==qt?void 0:qt.rule_difference_comparison)||void 0===e?void 0:e.fields;if(!d||!d[n])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[n],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var p=s.mappings[0]||{};return{score:s.score,relation:p.relation||"",highlightsA:(null===(l=p.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=p.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[qt]),Ti=a(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=St[e],Yn&&l){var c=Rt.filter(function(n){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});u=c.find(function(n){return n.evaluationResult})||c[0]}else u=Rt[e];else if(u=Rt[e],Yn&&u){var a=St.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(u.selfIndex)});l=a.find(function(n){return n.evaluationResult})||a[0]}else l=St[e];var d=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,s=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,v=!(!(null==l?void 0:l.cognitiveData)&&!(null==u?void 0:u.cognitiveData));if(!d&&!s&&!v)return n(n({},S(k)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==u?void 0:u.evaluationResult)&&void 0!==o?o:null,f=B(p),g=I(p);return n(n({},S(g)),null!=p?{label:null!==(r=f)&&void 0!==r?r:""}:{label:null})},[St,Rt,Ae,st,Yn]),_i=a(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=St[u[0]],a=Rt[u[0]],d=1;d<u.length;d++)(null==c?void 0:c.subsections)&&(c=c.subsections[u[d]]),(null==a?void 0:a.subsections)&&(a=a.subsections[u[d]]);if(!c&&!a)return null;var s=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,v=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,p=y(null==c?void 0:c.id)||y(null==a?void 0:a.id)||"",f=!(!(null==c?void 0:c.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!s&&!v&&!f)return n(n({},S(k)),{label:"Not Defined"});null!==(i=null!==(t=null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=Ae[p])||void 0===o||o.relevance_score);var g=null!==(l=null!==(r=null==c?void 0:c.evaluationResult)&&void 0!==r?r:null==a?void 0:a.evaluationResult)&&void 0!==l?l:null,h=B(g),x=I(g);return n(n({},S(x)),null!=g?{label:null!=h?h:""}:{label:null})},[St,Rt,Ae,st]),Ei=a(function(e,t){var i,o,r,l,u,c,a,d,s,v,p,f,g,h,x,m,y;if(!e||null==t)return null;var b=null!==(a=null!==(u=null!==(o=null===(i=null==jn?void 0:jn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Tn?void 0:Tn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==Tn?void 0:Tn[e])||void 0===c?void 0:c.evaluation_result)&&void 0!==a?a:null;if(!b||"object"!=typeof b)return null;var R=null!==(p=null!==(s=null===(d=null==b?void 0:b.deviations)||void 0===d?void 0:d[t])&&void 0!==s?s:null===(v=null==b?void 0:b.deviation_entries)||void 0===v?void 0:v[t])&&void 0!==p?p:null==b?void 0:b[t],C=null!==(y=null!==(h=null===(g=null===(f=null==R?void 0:R.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)&&void 0!==h?h:null===(m=null===(x=null==b?void 0:b.evaluation_outputs)||void 0===x?void 0:x.metadata)||void 0===m?void 0:m.label_color)&&void 0!==y?y:k;return n(n({},S(C)),{label:null})},[jn,Tn]),Fi=a(function(){Ut(),ti({}),oi({}),Gt(),me(new Set),Se([]),Ee.current=[],lt(),at(),dt(),requestAnimationFrame(function(){Me.current&&Me.current()})},[ti,oi,Gt,lt,at,dt]),Di=u(function(){return Object.values(ei).some(Boolean)||Object.values(ii).some(Boolean)},[ei,ii]),Ni=a(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f,g,h,x,m,y,b,S,C;if(!Xe.current&&!we.current){Xe.current=!0;try{if(!fi.current)return;var B=function(n){var e=n.split("-"),t=e[0];if(!ei[t]&&!1===Yn)return!1;if(Yn&&!ei["left-".concat(t)]&&!ei["right-".concat(t)]&&!ei[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!ii[i])return!1;return!0},I=fi.current.getBoundingClientRect();je({width:I.width,height:I.height});var _=[];if(Ct.forEach(function(n){var e,t,i=n.key,o=null===(e=Ft.current[i])||void 0===e?void 0:e.current,r=null===(t=Dt.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")}),!we.current){for(var E=0;E<Math.max(St.length,Rt.length);E++){var F=null===(n=Nt.current[E])||void 0===n?void 0:n.current,D=null===(e=Mt.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),D&&(D.style.height="auto",D.style.minHeight="0px")}Yn||Object.keys(jt.current).forEach(function(n){var e,t;if(B(n)){var i=null===(e=jt.current[n])||void 0===e?void 0:e.current,o=null===(t=Ht.current[n])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var N={};Ct.forEach(function(n){var e,t,i=n.key,o=null===(e=Ft.current[i])||void 0===e?void 0:e.current,r=null===(t=Dt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();N[i]=Math.max(l.height,u.height)}});var M={left:{},right:{}},A={};if(!we.current)if(Yn){if(ie&&null!==pe)if("number"==typeof pe){var k=pe,P=St[k],j=null===(o=Nt.current[k])||void 0===o?void 0:o.current;j&&P&&(P.refIndexes||[]).forEach(function(n){var e,t=Rt.findIndex(function(e){return e.selfIndex===n}),i=null===(e=Mt.current[t])||void 0===e?void 0:e.current;if(i&&(ei["left-".concat(k)]||ei["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);M.left[k]=Math.max(M.left[k]||0,o),M.right[t]=Math.max(M.right[t]||0,o)}})}else{var H=pe.split(R)[2];if(H){F=null===(r=jt.current[H])||void 0===r?void 0:r.current,D=null===(l=Ht.current[H])||void 0===l?void 0:l.current;if(F&&D){L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);A[H]=Math.max(A[H]||0,L)}}}}else{Object.keys(jt.current).forEach(function(n){var e,t;if(B(n)){var i=null===(e=jt.current[n])||void 0===e?void 0:e.current,o=null===(t=Ht.current[n])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);A[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(St.length,Rt.length);E++){var F=null===(t=Nt.current[E])||void 0===t?void 0:t.current,D=null===(i=Mt.current[E])||void 0===i?void 0:i.current;if(F&&D){var L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);M.left[E]=L,M.right[E]=L}}}if(Ct.forEach(function(n){var e,t,i=n.key,o=null===(e=Ft.current[i])||void 0===e?void 0:e.current,r=null===(t=Dt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=N[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),we.current||(Object.entries(M.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Nt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(M.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Mt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Yn||Object.keys(A).forEach(function(n){var e,t,i=null===(e=jt.current[n])||void 0===e?void 0:e.current,o=null===(t=Ht.current[n])||void 0===t?void 0:t.current;if(i&&o&&A[n]){var r=A[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),Yn)St.forEach(function(n,e){var t;(null===(t=Nt.current[e])||void 0===t?void 0:t.current)&&(n.refIndexes||[]).forEach(function(n){var t,i,o,r,l,u,c,a,d,s,v=Rt.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var p=null===(t=At.current[e])||void 0===t?void 0:t.current,f=null===(i=kt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),x=g.right-I.left,m=h.left-I.left,y=g.top+g.height/2-I.top,b=h.top+h.height/2-I.top;if(ie&&pe===e){var S=null!==(r=null===(o=Ve.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=ze.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(a=null===(c=Ve.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),B=R+(null!==(s=null===(d=ze.current)||void 0===d?void 0:d.clientHeight)&&void 0!==s?s:1/0),w=g.top+g.height/2,T=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(w,S,C)-I.top,b=E(T,R,B)-I.top}var F=Ti(e);F&&_.push({id:"line-".concat(e,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:F,sectionIdx:e,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(St.length,Rt.length);E++){var O=null===(u=Nt.current[E])||void 0===u?void 0:u.current,z=null===(c=Mt.current[E])||void 0===c?void 0:c.current;if(O&&z){var W=O.getBoundingClientRect(),q=z.getBoundingClientRect(),Y=Math.max(W.top,q.top)+18-I.top,K=(null===(a=Rt[E])||void 0===a?void 0:a.id)||"sec-".concat(E);(Z=Ti(E))&&_.push({id:K,x1:W.right-I.left,y1:Y,x2:q.left-I.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(d=St[E])||void 0===d?void 0:d.cognitiveData)||(null===(s=Rt[E])||void 0===s?void 0:s.cognitiveData)||K&&Ae[K]),isSubSection:!1})}}Object.keys(jt.current).forEach(function(n){var e,t,i,o,r,l;if(B(n)){var u=null===(e=jt.current[n])||void 0===e?void 0:e.current,c=null===(t=Ht.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var a=n.split("-").map(Number),d=St[a[0]],s=Rt[a[0]],v=1;v<a.length;v++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[a[v]]);var p=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&w(d.title)),f=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&w(d.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&w(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&w(s.content));if(p&&f||g&&h){var x=u.getBoundingClientRect(),m=c.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-I.top,b=_i(n);b&&"Not Defined"!==b.label&&_.push({id:"subsec-".concat(n),x1:x.right-I.left,y1:y,x2:m.left-I.left,y2:y,style:b,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:n,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(ie&&"string"==typeof pe&&pe.includes(R)){var V=pe.split(R),X=V[0],$=V[1],J=V[2],U=(V[3],"".concat(X).concat(R).concat($)),G=null===(v=At.current[U])||void 0===v?void 0:v.current,Q=null===(p=kt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,nn=G.getBoundingClientRect(),en=Q.getBoundingClientRect(),tn=nn.right-I.left,on=en.left-I.left,rn=nn.top+nn.height/2-I.top,ln=en.top+en.height/2-I.top;if(Yn){var un=null!==(g=null===(f=Ve.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(x=null===(h=ze.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,an=un+(null!==(y=null===(m=Ve.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),dn=cn+(null!==(S=null===(b=ze.current)||void 0===b?void 0:b.clientHeight)&&void 0!==S?S:1/0),sn=function(n,e,t){return Math.max(e,Math.min(t,n))};rn=sn(nn.top+nn.height/2,un,an)-I.top,ln=sn(en.top+en.height/2,cn,dn)-I.top}(Z=null!==(C=Ei(X,$))&&void 0!==C?C:_i(J))&&_.push({id:"line-subsec-".concat(U),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:pe})}}if(Ri(_),mi.current&&yi.current){var vn=mi.current.getBoundingClientRect(),pn=yi.current.getBoundingClientRect(),fn=(vn.top+vn.height/2-I.top+pn.top+pn.height/2-I.top)/2;Ii({x1:vn.right-I.left,x2:pn.left-I.left,y:fn})}else Ii(null);if(xe.size>0){var gn=[],hn=Ve.current,xn=ze.current;if(hn&&xn){var mn=[],yn=hn.getBoundingClientRect().top,bn=xn.getBoundingClientRect().top,Sn=yn+hn.clientHeight,Rn=bn+xn.clientHeight,Cn=hn.scrollTop,Bn=xn.scrollTop,In=I.top,wn=function(n,e,t){return Math.max(e,Math.min(t,n))};xe.forEach(function(n){var e,t,i,o,r,l;if("string"==typeof n&&n.includes(R)){var u=n.split(R),c=u[0],a=u[1],d=u[2],s=(u[3],"".concat(c).concat(R).concat(a)),v=null===(e=At.current[s])||void 0===e?void 0:e.current,p=null===(t=kt.current[s])||void 0===t?void 0:t.current;if(!v||!p)return;var f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=null!==(i=Ei(c,a))&&void 0!==i?i:_i(d),x=(P=f.right-I.left)+.5*((j=g.left-I.left-0)-P),m=f.top+f.height/2,y=g.top+g.height/2,b=m-yn+Cn,S=y-bn+Bn,C="conn-subsec-".concat(s);mn.push({lhsScrollY:b,rhsScrollY:S,x1:P,x2:j,containerTop:In,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var B=wn(m,yn,Sn),w=wn(y,bn,Rn),_=B-In,E=w-In,F=y>=bn-4&&y<=Rn+4,D="";D=(H=m>=yn-4&&m<=Sn+4)&&F?T(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!H&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:n,rhsArrayIdx:n})}else if(Yn){var N=n,M=St[N];if(!(null===(l=null==M?void 0:M.refIndexes)||void 0===l?void 0:l.length))return;M.refIndexes.forEach(function(n){var e,t,i=Rt.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=At.current[N])||void 0===e?void 0:e.current,r=null===(t=kt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=Ti(N),a=l.right-I.left,d=u.left-I.left-0,s=a+.5*(d-a),v=l.top+l.height/2,p=u.top+u.height/2,f=v-yn+Cn,g=p-bn+Bn,h="conn-".concat(N,"-").concat(i);mn.push({lhsScrollY:f,rhsScrollY:g,x1:a,x2:d,containerTop:In,leftIdx:N,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var x=wn(v,yn,Sn),m=wn(p,bn,Rn),y=x-In,b=m-In,S=v>=yn-4&&v<=Sn+4,R=p>=bn-4&&p<=Rn+4,C="";C=S&&R?T(a,y,d,b):S&&!R?"M ".concat(a,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(d,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),gn.push({id:h,pathD:C,style:c,leftIdx:N,rhsArrayIdx:i})}}})}else{var A=n,k=A;v=null===(o=At.current[A])||void 0===o?void 0:o.current,p=null===(r=kt.current[k])||void 0===r?void 0:r.current;if(!v||!p)return;var P,j;f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=Ti(A),x=(P=f.right-I.left)+.5*((j=g.left-I.left-0)-P),m=f.top+f.height/2,y=g.top+g.height/2,b=m-yn+Cn,S=y-bn+Bn,C="conn-".concat(A,"-").concat(k);mn.push({lhsScrollY:b,rhsScrollY:S,x1:P,x2:j,containerTop:In,leftIdx:A,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var H;B=wn(m,yn,Sn),w=wn(y,bn,Rn),_=B-In,E=w-In,F=y>=bn-4&&y<=Rn+4,D="";D=(H=m>=yn-4&&m<=Sn+4)&&F?T(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!H&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:A,rhsArrayIdx:k})}}),Ee.current=mn}Se(gn)}else Se([]),Ee.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{Xe.current=!1}}},[Ct,St,Rt,Ae,st,wi,Ti,Ei,Yn,ie,pe,xe,ei,ii]),Mi=a(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f=Ee.current;if(f.length&&!we.current){var g=null!==(e=null===(n=Ve.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=ze.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=Ve.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(u=null===(l=ze.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(a=null===(c=Ve.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(s=null===(d=ze.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,C=null!==(p=null===(v=fi.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,B=function(n,e,t){return Math.max(e,Math.min(t,n))};f.forEach(function(n){var e=n.lhsScrollY-g+y,t=n.rhsScrollY-h+b,i=_e.current[n.styleId+"-stroke"],o=_e.current[n.styleId+"-bg"];if(i||o){var r,l=B(e,y,S),u=B(t,b,R),c=l-C,a=u-C,d=e>=y-4&&e<=S+4,s=t>=b-4&&t<=R+4,v=n.x1+.5*(n.x2-n.x1);r=d&&s?T(n.x1,c,n.x2,a):d&&!s?"M ".concat(n.x1,",").concat(c," L ").concat(v,",").concat(c," L ").concat(v,",").concat(a):!d&&s?"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a," L ").concat(n.x2,",").concat(a):"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){Me.current=Ni},[Ni]);var Ai=l(null),ki=l(null),Pi=a(function(){Ee.current.length>0&&!we.current||(null!==Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(function(){Me.current(),Ai.current=null},50))},[]),ji=a(function(){se(!0),ce(!1),Ce.current=null,null!==ki.current&&clearTimeout(ki.current),null!==Ai.current&&(clearTimeout(Ai.current),Ai.current=null),ki.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,a,d;try{if(Ee.current=[],De.current&&null!==Ne.current&&null!==hi.current){var s=Ne.current,v=hi.current,p="string"==typeof s&&s.includes(R),f=null,g=null,h=null,x=null;if(p){var m=s.split(R),y="".concat(m[0]).concat(R).concat(m[1]);f=(null===(n=At.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=kt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=jt.current[m[2]])||void 0===t?void 0:t.current)||(null===(i=Nt.current[Number(m[2])])||void 0===i?void 0:i.current)||null,x=(null===(o=Ht.current[m[3]])||void 0===o?void 0:o.current)||(null===(r=Mt.current[Number(m[3])])||void 0===r?void 0:r.current)||null}else f=(null===(l=Lt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=Nt.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=Pt.current[v])||void 0===c?void 0:c.current)||null,x=(null===(a=Mt.current[v])||void 0===a?void 0:a.current)||null;if(f&&g&&h&&x){if(h.style.paddingTop="0px",x.style.paddingTop="0px",!Yn){var b=f.getBoundingClientRect(),S=g.getBoundingClientRect(),C=b.top-S.top;C>0?x.style.paddingTop="".concat(C,"px"):C<0&&(h.style.paddingTop="".concat(Math.abs(C),"px"))}var B=Ve.current,I=ze.current;if(B&&I){var w=f.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop,T=g.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop-(w-B.scrollTop);Math.abs(I.scrollTop-T)>1&&(I.scrollTop=T)}}}null===(d=Me.current)||void 0===d||d.call(Me),De.current&&ce(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{se(!1),ki.current=null}},150)},[Yn,St,Rt]),Hi=a(function(n){if(null!==$e.current&&Je.current&&Math.abs(n.currentTarget.scrollTop-$e.current)<=2){var e=Je.current;$e.current=null,Je.current=null,e()}ge.current||(Yn||Pi(),Fe.current||(Fe.current=!0,requestAnimationFrame(function(){var n,e,t,i,o,r,l;if(De.current){var u=Ve.current,c=ze.current;if(u&&c&&xi.current){if(!Ce.current){var a=Ne.current,d=void 0;if("string"==typeof a&&a.includes(R)){var s=a.split(R),v="".concat(s[0]).concat(R).concat(s[1]);d=null===(n=At.current[v])||void 0===n?void 0:n.current}else d=null===(e=At.current[a])||void 0===e?void 0:e.current;if(d){var p=d.getBoundingClientRect();Ce.current={badgeScreenY:p.top+p.height/2,initialScrollTop:u.scrollTop,leftTop:u.getBoundingClientRect().top,leftBottom:u.getBoundingClientRect().top+u.clientHeight,cTop:null!==(i=null===(t=fi.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Ce.current){var f=Ce.current,g=u.scrollTop-f.initialScrollTop,h=f.badgeScreenY-g,x=((o=h,r=f.leftTop,l=f.leftBottom,Math.max(r,Math.min(l,o)))-f.cTop).toString(),m=h>=f.leftTop-4&&h<=f.leftBottom+4;xi.current.setAttribute("y1",x),xi.current.setAttribute("y2",x),xi.current.setAttribute("visibility",m?"visible":"hidden")}}}Ee.current.length>0&&Mi(),Fe.current=!1})))},[Mi,Yn,Pi]),Li=l(0),Oi=l(0),zi=l(0),Wi=l(function(){});l(null),c(function(){Wi.current=ji},[ji]),c(function(){var n=setTimeout(Pi,250),e=function(){return Wi.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==Ai.current&&clearTimeout(Ai.current),null!==ki.current&&clearTimeout(ki.current),window.removeEventListener("resize",e)}},[yt,bt,qt,Ct,ei,ii,St,Rt,st,Pi,ie,pe,ue,xe]),c(function(){var n=function(n,e,t,i,o){e.current=n.getBoundingClientRect().width;var r=new ResizeObserver(function(n){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=n[n.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-e.current)<1?o():(e.current=a,i())}})});return r.observe(n),r},e={current:null},t={current:null},i={current:null},o=[],r=[e,t,i];return Oe.current&&o.push(n(Oe.current,Li,e,function(){return Wi.current()},function(){})),Le.current&&o.push(n(Le.current,Oi,t,function(){return Wi.current()},function(){return Me.current()})),fi.current&&o.push(n(fi.current,zi,i,function(){return Wi.current()},function(){return Me.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),c(function(){De.current=ie},[ie]),c(function(){Ne.current=pe},[pe]);var qi=a(function(n,e,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,u=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";dt(),null!=n&&(e?ee("No counterpart exists for this section."):(Ut(),ie&&pe===n?r?Gt():null==l||l():(me(new Set([n])),Se([]),Ee.current=[],Qn(!0),ge.current=!0,fe(n),Ne.current=n,oe(!0),De.current=!0,ce(!1),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),requestAnimationFrame(function(){var e,t,i,o,r,c="string"==typeof n&&n.includes(R),a=null,d=null,s=null;if(c){var v=n.split(R),p="".concat(v[0]).concat(R).concat(v[1]);a=(null===(e=At.current[p])||void 0===e?void 0:e.current)||null,d=(null===(t=kt.current[p])||void 0===t?void 0:t.current)||null,s=d?n:null}else if(a=(null===(i=Lt.current[n])||void 0===i?void 0:i.current)||null,Yn){var f=St[n],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],x=Rt.findIndex(function(n){return n.selfIndex===h});-1!==x&&(d=(null===(r=Pt.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else d=(null===(o=Pt.current[n])||void 0===o?void 0:o.current)||null,s=d?n:null;hi.current=s;var m=Ve.current,y=ze.current,b=function(){!function(){var e,t,i,o,r,l,u,a,d,v,p,f,g=null,h=null,x=null,m=null;if(c){var y=n.split(R),b="".concat(y[0]).concat(R).concat(y[1]);g=(null===(e=jt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=Nt.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=Ht.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=Mt.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=At.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=kt.current[b])||void 0===l?void 0:l.current)||h}else{var S=Number(n),C=null!==s?Number(s):S;g=(null===(u=Nt.current[S])||void 0===u?void 0:u.current)||null,h=(null===(a=Mt.current[C])||void 0===a?void 0:a.current)||null,x=(null===(d=At.current[S])||void 0===d?void 0:d.current)||(null===(v=Lt.current[S])||void 0===v?void 0:v.current)||g,m=(null===(p=kt.current[C])||void 0===p?void 0:p.current)||(null===(f=Pt.current[C])||void 0===f?void 0:f.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var B=x.getBoundingClientRect(),I=m.getBoundingClientRect(),w=B.top-I.top;w>0?h.style.paddingTop="".concat(w,"px"):w<0&&(g.style.paddingTop="".concat(Math.abs(w),"px"))}}(),ce(!0),Me.current&&Me.current(),ge.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Qn(!1),null==l||l()};if(!a||!m)return ge.current=!1,Qn(!1),void(null==l||l());if(d&&y){if(!Yn){var S=0;S="right"===u?d?d.getBoundingClientRect().top:0:a?a.getBoundingClientRect().top:0;var C=Le.current,B=(null==C?void 0:C.getBoundingClientRect().top)||0,I=C?C.scrollTop+S-B-150:0;return C?void _(C,I,200,b):void b()}var w=a.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,T=d.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=T-(w-m.scrollTop);F<0&&We.current&&(We.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var n,e=y.scrollHeight-y.clientHeight;if(F<0)n=0;else{if(F>e){var t=F-e;return qe.current&&(qe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){_(y,F,E,b)})}n=F}_(y,n,E,b)})}else{var D=w-(T-y.scrollTop);D<0&&Ye.current&&(Ye.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var n,e=m.scrollHeight-m.clientHeight;if(D<0)n=0;else{if(D>e){var t=D-e;return Ke.current&&(Ke.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){_(m,D,E,b)})}n=D}_(m,n,E,b)})}}else b()}))))},[pe,dt,Rt,ie,Yn,St,Gt]),Yi=a(function(){var n,e=Ze.sectionIdx,t=Ze.isOrphan;if(lt(),null!=e){var i="left";Ze.anchorEl&&(null===(n=ze.current)||void 0===n?void 0:n.contains(Ze.anchorEl))&&(i="right"),qi(e,t,{sourceSide:i})}},[qi,Ze.isOrphan,Ze.sectionIdx,Ze.anchorEl,lt]),Ki=a(function(){lt(),Gt(),me(new Set),Se([]),Ee.current=[]},[lt,Gt]),Vi=null!==Ze.sectionIdx&&xe.has(Ze.sectionIdx),Xi=K({proposedSections:St,existingSections:Rt,parentDeviationRecord:Bt,expandedSections:ei,maintainRelativeOrder:!!Yn,scrollContainerRef:Le,leftContainerRef:Ve,rightContainerRef:ze,lhsBadgeRefs:At,rhsBadgeRefs:kt}),$i=Xi.showDeviationNavigation,Ji=Xi.showOpenNodeRef,Ui=Xi.adjustScrollForPopup,Gi=a(function(n,e,t,i,o){var r,l="string"==typeof i?y(i).trim():y(null==i?void 0:i.deviation_summary).trim(),u=n.currentTarget;at();var c="left";(null===(r=ze.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var n,t,i,o;if("string"==typeof e&&e.includes(R)){var r=e.split(R),l="".concat(r[0]).concat(R).concat(r[1]);return"right"===c?null===(n=kt.current[l])||void 0===n?void 0:n.current:null===(t=At.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=kt.current[e])||void 0===i?void 0:i.current:null===(o=At.current[e])||void 0===o?void 0:o.current};if(t)return Gt(),me(new Set),Se([]),Ee.current=[],void(l&&requestAnimationFrame(function(){var n=a()||u;Ui(n,function(){rt({open:!0,anchorEl:n,summary:i,displayImpact:o})})}));qi(e,t,l?{toggleIfSame:!1,sourceSide:c,onReady:function(){var n=a()||u;Ui(n,function(){rt({open:!0,anchorEl:n,summary:i,displayImpact:o})})}}:{toggleIfSame:!1,sourceSide:c})},[qi,at,rt,Gt,Ui]),Qi=u(function(){var n;if(!Hn)return null;var e=null===(n=null==Hn?void 0:Hn.id)||void 0===n?void 0:n.split(":")[0];for(var t in Bt){if((Bt[t]||[]).some(function(n){return n.id===e}))return t}return null},[Hn,Bt]),Zi=l({id:null,triggerMs:null}),no=l(null);c(function(){var t;if(null==Hn?void 0:Hn.id){var i=Number(Hn.trigger),o=Zi.current;if((null==o?void 0:o.triggerMs)!==i){if(!(Hn.id.includes(":")&&/:\d+$/.test(Hn.id)))return Zi.current={id:Hn.id,triggerMs:i},void vi(Hn.id);var r=null===(t=null==Hn?void 0:Hn.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";no.current!==Hn.id&&(lt(),at(),Gt(),me(new Set),Se([]),Ee.current=[],no.current=Hn.id);var a=!1,d=0,s=null,v=150,p=function(n,e){for(var t=function(n,i){if(!n)return null;if(n.id===e)return i;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=t(n.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<n.length;i++){var o=t(n[i],String(i));if(o)return o}return null},f=function(){var t,o,r,u;if(!a){var g=function(){Zi.current={id:Hn.id,triggerMs:i}},h=null,x=null;for(var m in Bt){var y=Bt[m].find(function(n){return n.id===l});if(y){h=m,x=y;break}}if(x&&h){var b=St.findIndex(function(n){return n.id===h}),S=Rt.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==S,B=p(St,x.id),I=p(Rt,x.id);if(B&&!I&&!C){var w=B.split("-"),T=Number(w[0]);if(Yn){var _=null===(o=null===(t=St[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],E=Rt.findIndex(function(n){return n.selfIndex===_});-1!==E&&(T=E)}I=e([T],w.slice(1),!0).join("-")}if(B||I){var F=C||!B&&!!I,D=B?Number(B.split("-")[0]):b,N=I?Number(I.split("-")[0]):S;if(F){if(!(Yn?!!ei["right-".concat(N)]:!!ei[String(N)])&&N>=0)return ri(N,"right"),d+=1,void(s=setTimeout(f,450))}else if(!(Yn?!!ei["left-".concat(D)]:!!ei[String(D)])&&D>=0)return ri(D,"left"),d+=1,void(s=setTimeout(f,450));var M,A=B||"",k=I||"",P="".concat(x.id).concat(R).concat(c).concat(R).concat(A).concat(R).concat(k),j="".concat(x.id).concat(R).concat(c),H=null===(r=At.current[j])||void 0===r?void 0:r.current,L=null===(u=kt.current[j])||void 0===u?void 0:u.current,O=F||!H&&!!L,z=O?L:H;if(M=Yn?O?ze.current:Ve.current:Le.current,z&&M){var W=z.getBoundingClientRect();if(0===W.height)return void((d+=1)<2?s=setTimeout(f,v):g());var q=M.getBoundingClientRect(),Y=W.top-q.top+M.scrollTop-q.height/2+W.height/2+150,K=function(){var e,t,i,o,r;if(!a){g();var l=z instanceof Element?window.getComputedStyle(z).color:"";H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var u=(null===(t=null===(e=x.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[c])||x,d=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!H&&!!L)){var s=O?(null===(o=kt.current[j])||void 0===o?void 0:o.current)||L:(null===(r=At.current[j])||void 0===r?void 0:r.current)||H;return Ui(s,function(){rt({open:!0,anchorEl:s,displayImpact:Hn.displayImpact,summary:n(n({},u),{evaluation_outputs:d})})}),void(null==Ln||Ln())}qi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t,i=O?(null===(e=kt.current[j])||void 0===e?void 0:e.current)||L:(null===(t=At.current[j])||void 0===t?void 0:t.current)||H;Ui(i,function(){rt({open:!0,anchorEl:i,displayImpact:null==Hn?void 0:Hn.displayImpact,summary:n({},u)})})}})}};Math.abs(M.scrollTop-Y)<=2?K():($e.current=Y,Je.current=K,M.scrollTo({top:Y,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if(Je.current){$e.current=null;var n=Je.current;Je.current=null,n()}},800))}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}};return s=setTimeout(f,v),function(){a=!0,s&&clearTimeout(s)}}}},[Hn,Bt,St,Rt,Yn,ei,ri,qi,rt,vi]);var eo=function(n){var e=n.section,t=n.keyPath,o=n.depth,r=void 0===o?0:o,l=n.columnKey,u=void 0===l?"left":l,c=n.parentNodeId,a=void 0===c?"":c,d=n.sectionOffset;return i($,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:a,expandedSubSections:ii,setExpandedSubSections:oi,maintainRelativeOrder:Yn||!1,proposedSections:St,existingSections:Rt,treeData:Tn,deviationNumberRegistry:It,connectedSections:xe,activeSideBySideSection:pe,resolvedMarkdownStyles:He,getSubSectionRef:zt,getSubSectionCompareStyle:_i,getBadgeRef:Wt,openMoreFunctionsPopup:ci,openSummaryPopup:Gi,showDeviationBadges:Vn,resetSideBySide:Gt,setConnectedSections:me,setConnectedLines:Se,cachedConnectedPositions:Ee,isProposingFix:zn,proposingFixNodeId:Wn,sectionOffset:d})};return t(d,n({ref:Oe,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Yn?{}:{overflow:"visible"}),{position:"relative"})},{children:[$n&&i(d,n({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(L,{})})),ot.open&&i(J,{open:ot.open,anchorEl:ot.anchorEl,containerEl:gi.current,clipTopEl:mi.current,scrollContainerEl:Le.current,onClose:Ki,summary:ot.summary,displayImpact:ot.displayImpact}),i(H,{open:Ze.open,anchorEl:Ze.anchorEl,sectionTitle:Ze.sectionTitle,referenceSectionTitle:Ze.refSectionTitle,onClose:dt,onOpenCognitiveCompare:ai,onOpenSideBySide:Yi,onConnect:di,isConnected:Vi,isOrphan:Ze.isOrphan}),Ge.open&&i(j,{open:Ge.open,popupRef:ct,position:et,popupConfig:kn,onClose:function(){tt(null),Qe(function(e){return n(n({},e),{open:!1})}),ut(null)},markdownStyles:Dn,sectionTitle:Ge.sectionTitle,referenceSectionTitle:Ge.refSectionTitle,cognitiveData:Ge.cognitiveData,anchorEl:Ge.anchorEl,sectionAnchorEl:Ge.sectionAnchorEl,scrollContainerEl:Le.current,badgeStyle:Ge.badgeStyle,docData:Ge.docData,deviationData:Ge.deviationData,isLoading:Ge.isLoading}),i(s,n({open:!!ne,autoHideDuration:8e3,onClose:function(){return ee(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(v,n({onClose:function(){return ee(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ne}))})),i(V,{componentHeaderText:wn,displayConfig:An,maintainRelativeOrder:Yn,onCollapseAll:Fi,showCollapseAll:Di,onToggleView:function(n){Jn(!0),setTimeout(function(){Kn(!n),Gt(),lt(),me(new Set),Se([]),Ee.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Jn(!1)},600)})})},50)}}),i(d,n({ref:Le,onScroll:Hi,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Yn?"hidden":"auto",borderTop:Yt&&Kt?"none":"1.5px solid #EEF0F4"}},{children:i(d,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Yn?{flex:1,minHeight:0}:{})},{children:t(d,n({ref:fi,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Yn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:Re,style:{position:"absolute",top:0,left:0,width:Pe.width||"100%",height:Pe.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:de?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Bi&&i("g",{children:i("line",{x1:Bi.x1,y1:Bi.y,x2:Bi.x2,y2:Bi.y,stroke:Jt.badgeBorder,strokeWidth:"1.5"})}),Si.map(function(e){var o,r,l,u,c,a,s,v=e.x1+.5*(e.x2-e.x1),p=(e.y1+e.y2)/2;if("Not Defined"===e.style.label&&!e.hasCognitive)return null;if(e.isSubSection?ie&&pe===e.subSectionKeyPath&&ue:ie&&pe===e.sectionIdx&&ue)return null;if(!Yn){var f=e.isSubSection?T(e.x1,e.y1,e.x2,e.y2):"M ".concat(e.x1," ").concat(e.y1," L ").concat(e.x2," ").concat(e.y2),h=St[e.sectionIdx]||{title:"",content:""},m=Rt[null!==(o=e.targetRightIdx)&&void 0!==o?o:e.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",h,m),e.isSubSection&&e.subSectionKeyPath){var y=e.subSectionKeyPath.includes(R)?e.subSectionKeyPath.split(R):[],b=y[2]||e.subSectionKeyPath,S=y[3]||b,C=b.split("-").map(Number),B=S.split("-").map(Number),I=null,w=null;C.length>0&&(I=St[C[0]]),B.length>0&&(w=Rt[B[0]]);var _=(null==I?void 0:I.title)||"",E=(null==w?void 0:w.title)||"";console.log("Root Parent Titles:",_,E);for(var F=1;F<C.length;F++)(null==I?void 0:I.subsections)&&(I=I.subsections[C[F]]);for(F=1;F<B.length;F++)(null==w?void 0:w.subsections)&&(w=w.subsections[B[F]]);I&&(h=n(n({},I),{title:_||I.title})),console.log("Base Section for Subsection Badge:",h),w&&(m=n(n({},w),{title:E||w.title})),console.log("Ref Section for Subsection Badge:",m)}var D=!(null===(r=h.cognitiveData)||void 0===r?void 0:r.isMissingRationale)||Boolean(null===(u=null===(l=h.cognitiveData)||void 0===l?void 0:l.decisioning)||void 0===u?void 0:u.length),N=(null===(s=null===(a=null===(c=h.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===a?void 0:a.decisioning_factors)||void 0===s?void 0:s.length)||!1,M=D||N;return t("g",{children:[i("path",{d:f,fill:"none",stroke:e.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",n({x:v-100,y:p-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,n({onClick:function(n){n.stopPropagation(),M&&(Ge.open&&it===e.id?at():(ut(e.id),ui(li(n.currentTarget,h,m,e.sectionIdx,e.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:e.style.badgeBg,color:e.style.badgeText,border:"1px solid ".concat(e.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:M?"pointer":"default"}},{children:[e.style.badgeText===k&&null==e.style.label?i(O,{color:e.style.badgeText}):0===e.style.label?"Same":e.style.label,i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(x,{})})),M&&i(g,{size:11,style:{transform:Ge.open&&it===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),i(U,{connectedLines:be,pathRefs:_e})]})),t(d,n({sx:n({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},Yn?{flex:1,overflow:"visible"}:{})},{children:[i(d,n({ref:mi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(p,n({title:ht,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:ht}))}))})),t(d,n({ref:Ve,onScroll:Hi,sx:n({p:"12px",display:"flex",flexDirection:"column"},Yn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}}),Tt&&St.map(function(e,o){var r,l,u=!e.title&&!e.content;if(Yn&&u)return null;var c=e,a=Ti(o,"left"),s=Yn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!Rt[o],v=xe.has(o),p=b(c.evaluationResult,null==a?void 0:a.deviationLabel),f=_t.leftNums.get(c.id);return i(d,n({ref:Ot(o),sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Nt.current[o],sx:n({width:"100%",display:"flex",flexDirection:"column",minWidth:0},v&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(X,{section:e,idx:o,columnKey:"left",colRef:Ot("left-accordion-".concat(o)),mb:0,treeData:Tn,proposedSections:St,existingSections:Rt,deviationNumberRegistry:It,getSectionCompareStyle:Ti,getBadgeRef:Wt,connectedSections:xe,openMoreFunctionsPopup:ci,openSummaryPopup:Gi,deviationNodeIdToView:null==Hn?void 0:Hn.id,deviationTargetParentId:Qi,parentNodeId:(null===(l=null==Tn?void 0:Tn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:Yn?!!ei["left-".concat(o)]:!!ei[String(o)],onToggle:function(){Ki(),ri(o,"left")},navigation:e.id?$i[e.id]:null,showOpenNodeRef:Ji,resolvedMarkdownStyles:He,maintainRelativeOrder:Yn,showDeviationBadges:Vn,renderSubSections:eo,isProposingFix:zn,proposingFixNodeId:Wn,collisionKey:"".concat(ie?"1":"0","-").concat(String(null!=pe?pe:""))})})),Yn&&a&&t(d,n({ref:At.current[o],onClick:function(n){var e,t,i,r=An.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Gi(n,String(o),s,r)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var r=An.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Gi(n,String(o),s,r)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:s?"default":"pointer",borderRight:"1px solid ".concat(a.badgeBorder),"&:hover":s?{}:{bgColor:"".concat(a.badgeBorder,"22")}}},{children:[null!=f&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:f})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!An.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):i(O,{color:a.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var t=Yn?Rt.find(function(n){var e;return null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)})||{title:"",content:""}:Rt[o]||{title:"",content:""};ci(n,e,s,t,o,a)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(a.badgeBorder,"22")}}},{children:i(h,{size:11,color:a.badgeText})}))]}))]}))}),"left-row-".concat(o))}),i("div",{ref:Ke,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,n({ref:gi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,n({onClick:function(e){e.stopPropagation(),Ge.open&&it===Vt?at():(ut(Vt),ui(li(e.currentTarget,{title:"",content:"",evaluationResult:Xt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Vt,!0,n(n({},Jt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Jt.badgeBg,color:Jt.badgeText,border:"1px solid ".concat(Jt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=$t?$t:i(O,{}),i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(x,{})})),i(g,{size:11,style:{transform:Ge.open&&it===Vt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,n({sx:n({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},Yn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Gn&&i(m,{sections:11}),i(d,n({ref:yi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(p,n({title:xt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:xt}))}))})),t(d,n({ref:ze,onScroll:Hi,sx:n({p:"12px",display:"flex",flexDirection:"column"},Yn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),Tt&&Rt.map(function(e,r){var l,u,c=e,a=!1,s=null,v=-1;if(Yn){v=St.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(c.selfIndex))&&n.selfIndex>=0});var p=St.findIndex(function(n,e){var t;return xe.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(c.selfIndex))});(a=-1!==p)&&(s=Ti(p))}else(a=xe.has(r))&&(s=Ti(r));var f=Ti(Yn&&-1!==v?v:r),g=Yn?-1!==v||!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)&&St.some(function(n){return n.id&&n.id===c.id}):Boolean(St[r]),x=Yn?c.selfIndex<0||!g:!St[r],m=_t.rightNums.get(c.id);return i(d,n({ref:Pt.current[r],sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Mt.current[r],sx:n({width:"100%",display:"flex"},a&&s&&{borderRadius:"6px",outline:"2px solid ".concat(s.badgeBorder),outlineOffset:"1px"})},{children:i(X,{section:e,idx:r,columnKey:"right",colRef:Ot("right-accordion-".concat(r)),mb:0,parentNodeId:(null===(u=null==Tn?void 0:Tn.input_index_map)||void 0===u?void 0:u[1])||"",isExpanded:Yn?!!ei["right-".concat(r)]:!!ei[String(r)],treeData:Tn,proposedSections:St,existingSections:Rt,deviationNumberRegistry:It,getBadgeRef:Wt,getSectionCompareStyle:Ti,connectedSections:xe,openMoreFunctionsPopup:ci,openSummaryPopup:Gi,deviationNodeIdToView:null==Hn?void 0:Hn.id,deviationTargetParentId:Qi,onToggle:function(){Ki(),ri(r,"right")},navigation:e.id?$i[e.id]:null,showOpenNodeRef:Ji,resolvedMarkdownStyles:He,maintainRelativeOrder:Yn,showDeviationBadges:Vn,renderSubSections:eo,isProposingFix:zn,proposingFixNodeId:Wn,collisionKey:"".concat(ie?"1":"0","-").concat(String(null!=pe?pe:""))})})),Yn&&f&&i(d,n({ref:kt.current[r],"data-section-id":c.id,onClick:function(n){var e,t,i;if(x){var o=An.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Gi(n,String(r),x,o)}},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:x?"4px":"0px",fontSize:"11px",bgcolor:x?"#F1D2D2":f.badgeBg,color:x?"#B91C1C":f.badgeText,border:x?"1px solid #DC8E8E":"1px solid ".concat(f.badgeBorder),borderRadius:x?"12px":"10px",px:x?1.2:1,py:.3,fontWeight:x?600:700,cursor:x?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:x?"0 1px 3px rgba(0,0,0,0.07)":"none"}},{children:x?t(o,{children:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var o=An.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Gi(n,String(r),x,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:x?"1px solid #DC8E8E":"1px solid ".concat(f.badgeBorder),"&:hover":{bgcolor:x?"#F1D2D2":"".concat(f.badgeBorder,"22")}}},{children:[null!=m&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:x?"1px solid #DC8E8E":"1px solid ".concat(f.badgeBorder)}},{children:m})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!An.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"100% Deviation":i(O,{color:x?"#B91C1C":f.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var e=Yn?St.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(c.selfIndex)})||{title:"",content:""}:St[r]||{title:"",content:""};ci(n,e,x,c,r,f)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(f.badgeBorder,"22")}}},{children:i(h,{size:11,color:x?"#B91C1C":f.badgeText})}))]}):null!=m?m:""}))]}))}),"right-row-".concat(r))}),i("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{G as default};
1
+ import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{useState as r,useRef as l,useMemo as u,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as s,Alert as v,Tooltip as p,Typography as f}from"@mui/material";import{ChevronDown as g,EllipsisVertical as h}from"lucide-react";import{ButtonCognitiveIcon as m}from"../../assests/svg/ButtonCognitiveIcon.js";import x from"./OverlayComponent.js";import{safeStringify as y,extractDeviationScore as b,generateColorPalette as S,DEVIATION_BADGE_SEPARATOR as R,findKeyPathByNodeId as C,getFirstDeviationOutputValue as I,getFirstDeviationColor as B,hasValue as w,getBentArrowPath as T,smoothScrollTo as _,hasMeaningfulRedlineTags as F,resetClauseHighlight as E,scrollAndHighlightClause as M}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as D,DEFAULT_FIELD_CONFIG as N,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as k,DEFAULT_DEVIAION_COLOR as H,DEFAULT_COMPONENT_HEADER_TEXT as P}from"./CognitiveCompareConstants.js";import j from"./CognitivePopup.js";import L from"./MoreFunctionsPopup.js";import O from"./LoaderComponent.js";import z from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as W}from"./hooks/useCompareData.js";import{useComparePopups as q}from"./hooks/useComparePopups.js";import{useSectionRefs as Y}from"./hooks/useSectionRefs.js";import{useAccordionState as K}from"./hooks/useAccordionState.js";import{useDeviationNavigation as V}from"./hooks/useDeviationNavigation.js";import X from"./components/CompareHeader.js";import $ from"./components/SectionAccordion.js";import J from"./components/SubSectionAccordion.js";import U from"./components/CognitiveSummaryPopup.js";import G from"./components/connectedLines.js";var Q=function(Q){var Z,nn,en,tn,on,rn,ln,un,cn,an,dn,sn,vn,pn,fn,gn,hn,mn,xn,yn,bn,Sn,Rn,Cn,In,Bn,wn=Q.componentHeaderText,Tn=void 0===wn?P:wn,_n=Q.treeData,Fn=Q.comparisonConfig,En=Q.leftColumnTitleText,Mn=Q.rightColumnTitleText,Dn=Q.markdownStyles,Nn=Q.resetTrigger,An=Q.displayConfig,kn=void 0===An?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:An,Hn=Q.popupConfig,Pn=Q.deviationData,jn=void 0===Pn?{}:Pn,Ln=Q.deviationNodeIdToView,On=Q.resetDeviationNodeId,zn=Q.isProposingFix,Wn=void 0!==zn&&zn,qn=Q.proposingFixNodeId,Yn=Q.isRedlineFlow,Kn=r(kn.maintainRelativeOrder),Vn=Kn[0],Xn=Kn[1],$n=!!Vn||!!(null==kn?void 0:kn.showDeviationBadges),Jn=r(!1),Un=Jn[0],Gn=Jn[1],Qn=r(!1),Zn=Qn[0],ne=Qn[1],ee=r(null),te=ee[0],ie=ee[1],oe=r(!1),re=oe[0],le=oe[1],ue=r(null===(nn=null!==(Z=null==_n?void 0:_n.newEvaluationResult)&&void 0!==Z?Z:null==kn?void 0:kn.enableDeviationSchemaBackwardCompatibility)||void 0===nn||nn)[0],ce=r(!1),ae=ce[0],de=ce[1],se=r(!1),ve=se[0],pe=se[1],fe=r(null),ge=fe[0],he=fe[1],me=l(!1),xe=r(new Set),ye=xe[0],be=xe[1],Se=r([]),Re=Se[0],Ce=Se[1],Ie=l(null),Be=l(null),we=l(null),Te=l(new Set),_e=l(!1),Fe=l(null),Ee=l({}),Me=l([]),De=l(!1),Ne=l(!1),Ae=l(null),ke=l(function(){}),He=u(function(){return(null==_n?void 0:_n.cognitive_decisioning)||{}},[_n]),Pe=r({width:0,height:0}),je=Pe[0],Le=Pe[1],Oe=u(function(){return n(n({},D),Dn)},[Dn]),ze=l(null),We=l(null),qe=l(null),Ye=l(null),Ke=l(null),Ve=l(null),Xe=l(null),$e=l(null),Je=l(!1),Ue=l(null),Ge=l(null),Qe=q(ze),Ze=Qe.cognitivePopup,nt=Qe.setCognitivePopup,et=Qe.moreFunctions,tt=Qe.setMoreFunctions,it=Qe.position,ot=Qe.setPosition,rt=Qe.activeBadgeId,lt=Qe.summaryPopup,ut=Qe.setSummaryPopup,ct=Qe.closeSummaryPopup,at=Qe.setActiveBadgeId,dt=Qe.popupRef,st=Qe.closeCognitivePopup,vt=Qe.closeMoreFunctionsPopup,pt=u(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==Fn?void 0:Fn.fields)&&void 0!==n?n:N,thresholds:{high:null!==(t=null===(e=null==Fn?void 0:Fn.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:A.thresholds.high,medium:null!==(o=null===(i=null==Fn?void 0:Fn.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(l=null===(r=null==Fn?void 0:Fn.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:A.thresholds.exact}}},[Fn]),ft=r(null),gt=ft[0];ft[1];var ht=null===(on=null===(en=null==_n?void 0:_n.documents)||void 0===en?void 0:en[null===(tn=null==_n?void 0:_n.input_index_map)||void 0===tn?void 0:tn[0]])||void 0===on?void 0:on.title,mt=null===(un=null===(rn=null==_n?void 0:_n.documents)||void 0===rn?void 0:rn[null===(ln=null==_n?void 0:_n.input_index_map)||void 0===ln?void 0:ln[1]])||void 0===un?void 0:un.title,xt=y(En||ht||"Uploaded Contract"),yt=y(Mn||mt||"Reference Template"),bt=W(_n,Vn,jn,pt,ue),St=bt.activeProposed,Rt=bt.existingRule,Ct=bt.proposedSections,It=bt.existingSections,Bt=bt.visibleFields,wt=bt.parentDeviationRecord,Tt=bt.deviationNumberRegistry,_t=bt.parseError;c(function(){_t&&ie("Failed to load comparison: ".concat(_t))},[_t]);var Ft=Ct.length>0||It.length>0,Et=u(function(){if(!Yn)return"off";var n=0,e=0,t=function(i){Array.isArray(i)&&i.forEach(function(i){var o,r=(null==i?void 0:i.content)||"";F(r)&&(n+=1,e+=String(r).length),(null===(o=null==i?void 0:i.subsections)||void 0===o?void 0:o.length)&&t(i.subsections)})};return t(Ct),t(It),"".concat(n,":").concat(e)},[Yn,Ct,It]);c(function(){Yn&&"off"!==Et&&"0:0"!==Et&&(Be.current=null,Me.current=[],requestAnimationFrame(function(){var n;null===(n=ke.current)||void 0===n||n.call(ke)}))},[Yn,Et]);var Mt=u(function(){var n=new Map,e=new Map,t=1;if(Vn)Ct.forEach(function(e){!e.title&&!e.content||e.id&&n.set(e.id,t++)}),It.forEach(function(i){if(i.id){var o=Ct.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});if(o.length>0){var r=o.map(function(e){return n.get(e.id)}).filter(Boolean);e.set(i.id,r.join(", "))}else e.set(i.id,String(t++))}});else for(var i=Math.max(Ct.length,It.length),o=0;o<i;o++){var r=Ct[o],l=It[o];r?(n.set(r.id,t),l&&e.set(l.id,String(t)),t++):l&&e.set(l.id,String(t++))}return{leftNums:n,rightNums:e}},[Ct,It,Vn]),Dt=Y(Bt.map(function(n){return n.key}),Math.max(Ct.length,It.length)),Nt=Dt.leftRefs,At=Dt.rightRefs,kt=Dt.sectionLeftRefs,Ht=Dt.sectionRightRefs,Pt=Dt.lhsBadgeRefs,jt=Dt.rhsBadgeRefs,Lt=Dt.sectionRightRowRefs,Ot=Dt.subSectionLeftRefs,zt=Dt.subSectionRightRefs,Wt=Dt.sectionRowRefs,qt=Dt.getSectionRowRef,Yt=Dt.getSubSectionRef,Kt=Dt.getBadgeRef,Vt=Rt.analysis,Xt=y(null===(an=null===(cn=null==Vt?void 0:Vt.rule_difference_comparison)||void 0===cn?void 0:cn.summary)||void 0===an?void 0:an.overall_summary),$t=!!Xt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Jt=null!==(dn=null==_n?void 0:_n.base_root_id)&&void 0!==dn?dn:"-1";null==_n||_n[Jt];var Ut=ue?null!==(Rn=null!==(yn=jn&&(null===(xn=null==jn?void 0:jn[Jt])||void 0===xn?void 0:xn.evaluation_result))&&void 0!==yn?yn:null===(Sn=null===(bn=null==_n?void 0:_n.nodes)||void 0===bn?void 0:bn[Jt])||void 0===Sn?void 0:Sn.evaluation_result)&&void 0!==Rn?Rn:null:null!==(mn=null!==(pn=jn&&(null===(vn=null===(sn=null==jn?void 0:jn[Jt])||void 0===sn?void 0:sn.evaluation_result)||void 0===vn?void 0:vn[0]))&&void 0!==pn?pn:null===(hn=null===(gn=null===(fn=null==_n?void 0:_n.nodes)||void 0===fn?void 0:fn[Jt])||void 0===gn?void 0:gn.evaluation_result)||void 0===hn?void 0:hn[0])&&void 0!==mn?mn:null,Gt=b(Ut),Qt=S(null!==(Bn=null===(In=null===(Cn=null==Ut?void 0:Ut.evaluation_outputs)||void 0===Cn?void 0:Cn.metadata)||void 0===In?void 0:In.label_color)&&void 0!==Bn?Bn:""),Zt=function(){Te.current.forEach(function(n){E(n)}),Te.current.clear()},ni=a(function(){var n,e,t,i,o,r;Zt(),le(!1),Ne.current=!1,Be.current=null;var l=Ae.current,u=yi.current;if(null!==l)if("string"==typeof l&&l.includes(R)){var c=l.split(R);(a=(null===(n=Ot.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=kt.current[Number(c[2])])||void 0===e?void 0:e.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(t=kt.current[l])||void 0===t?void 0:t.current)&&(a.style.paddingTop="0px")}if(null!==u)if("string"==typeof u&&u.includes(R)){c=u.split(R);(d=(null===(i=zt.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=Ht.current[Number(c[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Ht.current[u])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}he(null),Ae.current=null,yi.current=null,de(!1),ne(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ve.current&&(Ve.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px")},[]),ei=a(function(){Zt(),ni(),be(new Set),Ce([]),Me.current=[],Bi([]),_i(null),ut(k),st(),requestAnimationFrame(function(){var n;null===(n=ke.current)||void 0===n||n.call(ke)})},[]),ti=l(ei);c(function(){ti.current=ei},[ei]),c(function(){Nn&&ti.current()},[Nn]);var ii=K({maintainRelativeOrder:!!Vn,proposedSections:Ct,existingSections:It,activeSideBySideSection:ge,connectedSections:ye,resetSideBySide:ni,setConnectedSections:be,setConnectedLines:Ce,cachedConnectedPositions:Me,svgContainerRef:Ie,isAnimatingRef:_e,animationTimerRef:Fe,calculateLinesRef:ke,sectionLeftRefs:kt,sectionRightRefs:Ht,subSectionLeftRefs:Ot,subSectionRightRefs:zt}),oi=ii.expandedSections,ri=ii.setExpandedSections,li=ii.expandedSubSections,ui=ii.setExpandedSubSections,ci=ii.toggleSection,ai=a(function(e,t,i,o,r,l,u){var c,a,d,s=y(null==t?void 0:t.id)||y(null==i?void 0:i.id)||"",v=(s?He[s]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:s,decisioning:[],gap:[],relevance_score:0},p=null!==(a=null===(c=Wt.current[o])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(d=null==kn?void 0:kn.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",refSectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",cognitiveData:v,anchorEl:e,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==_n?void 0:_n.documents,input_index_map:null==_n?void 0:_n.input_index_map},deviationData:function(){var e,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,u=function(e){var t=function(n){if(!n||"object"!=typeof n)return null;var e=null==n?void 0:n.deviation_entries;if(e&&"object"==typeof e){var t=Object.keys(e).sort(function(n,e){return Number(n)-Number(e)})[0];if(t&&e[t])return e[t]}var i=Object.keys(n).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,e){return Number(n)-Number(e)});if(i.length&&n[i[0]])return n[i[0]];var o=null==n?void 0:n.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(n,e){return Number(n)-Number(e)})[0];if(r&&o[r])return o[r]}return null}(e);return t?n(n({},e),{deviation_summary:(null==e?void 0:e.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==e?void 0:e.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==e?void 0:e.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==e?void 0:e.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==e?void 0:e.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==e?void 0:e.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):e};if(!("string"==typeof o&&o.includes(R)))return u(l);var c=o.split(R)[1];if(!c)return l;var a=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(e=null==a?void 0:a.deviation_entries)||void 0===e?void 0:e[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return d?n(n(n({},a),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[He,_n]),di=a(function(n){vt(),ot(null),nt(n)},[vt]),si=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),et.open&&et.sectionIdx===o)vt();else{var u=n.currentTarget,c="left";(null===(l=qe.current)||void 0===l?void 0:l.contains(u))&&(c="right");Zt(),Ne.current&&ni(),be(new Set),Ce([]),Me.current=[],st(),lt.open?$i():ct(),requestAnimationFrame(function(){var n=function(){var n,e,t,i;if("string"==typeof o&&o.includes(R)){var r=o.split(R),l="".concat(r[0]).concat(R).concat(r[1]);return"right"===c?null===(n=jt.current[l])||void 0===n?void 0:n.current:null===(e=Pt.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=jt.current[o])||void 0===t?void 0:t.current:null===(i=Pt.current[o])||void 0===i?void 0:i.current}()||u;tt(ai(n,e,i,o,t,r))})}},vi=a(function(){null!==et.sectionIdx&&et.anchorEl?di(n(n({},et),{open:!0})):vt()},[et,vt,di]),pi=a(function(){var n=et.sectionIdx,e=et.isOrphan;vt(),ct(),null!==n&&(e?ie("No counterpart exists to connect to."):(Zt(),Ne.current&&ni(),Ce([]),Me.current=[],be(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){ke.current&&ke.current()},50)))},[et.sectionIdx,et.isOrphan,vt,ct,ni]),fi=a(function(){var n=we.current;if(n){we.current=null;var e=Ct.findIndex(function(e){return e.id===n}),t=It.findIndex(function(e){return e.id===n}),i=-1===e?C(Ct,n):null,o=-1===t?C(It,n):null,r=-1!==e?e:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=function(n,e,t,i){var o,r,l,u;return-1!==n?null!==(r=null===(o=t.current[n])||void 0===o?void 0:o.current)&&void 0!==r?r:null:e&&null!==(u=null===(l=i.current[e])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(n,e,t){void 0===t&&(t=30);var i=0,o=function(){var r=n();r&&0!==r.getBoundingClientRect().height?(Te.current.add(r),M(r,e)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Vn)-1!==r&&$e.current&&c(function(){return u(e,i,kt,Ot)},$e.current),-1!==l&&qe.current&&c(function(){return u(t,o,Ht,zt)},qe.current);else{var a=ze.current;if(!a)return;c(function(){return-1!==r?u(e,i,kt,Ot):u(t,o,Ht,zt)},a)}}},[Ct,It,Vn,kt,Ht,Ot,zt,$e,qe,ze]),gi=a(function(e){if(e){Zt(),ni(),be(new Set),Ce([]),Me.current=[],ct(),st();var t=Ct.findIndex(function(n){return n.id===e}),i=It.findIndex(function(n){return n.id===e}),o=-1===t?C(Ct,e):null,r=-1===i?C(It,e):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=-1!==i?i:r?Number(r.split("-")[0]):-1;we.current=e,ri(function(e){var t,i=n({},e),o=!1;-1!==l&&(i[t=Vn?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==u&&(i[t=Vn?"right-".concat(u):String(u)]||(i[t]=!0,o=!0));return o?i:e}),ui(function(e){var t=n({},e),i=!1,l=function(n){for(var e=n.split("-"),o=e[0],r=1;r<e.length;r++)o+="-".concat(e[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:e}),setTimeout(function(){requestAnimationFrame(function(){we.current===e&&hi.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(e,'" not found'))}},[Ct,It,Vn,ri,ui,ni,ct,st]),hi=l(fi);c(function(){hi.current=fi},[fi]);var mi=l(null),xi=l(null),yi=l(null),bi=l(null),Si=l(null),Ri=l(null),Ci=r([]),Ii=Ci[0],Bi=Ci[1];l(null);var wi=r(null),Ti=wi[0],_i=wi[1];c(function(){if(gt){var n=pt.fields.find(function(n){return n.analysisKey===gt||n.key===gt});if(n){var e=Nt.current[n.key]||At.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[gt,pt.fields]);var Fi=a(function(n){var e,t,i,o,r,l,u,c,a,d=null===(e=null==Vt?void 0:Vt.rule_difference_comparison)||void 0===e?void 0:e.fields;if(!d||!d[n])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[n],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var p=s.mappings[0]||{};return{score:s.score,relation:p.relation||"",highlightsA:(null===(l=p.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=p.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Vt]),Ei=a(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=Ct[e],Vn&&l){var c=It.filter(function(n){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});u=c.find(function(n){return n.evaluationResult})||c[0]}else u=It[e];else if(u=It[e],Vn&&u){var a=Ct.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(u.selfIndex)});l=a.find(function(n){return n.evaluationResult})||a[0]}else l=Ct[e];var d=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,s=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,v=!(!(null==l?void 0:l.cognitiveData)&&!(null==u?void 0:u.cognitiveData));if(!d&&!s&&!v)return n(n({},S(H)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==u?void 0:u.evaluationResult)&&void 0!==o?o:null,f=I(p),g=B(p);return n(n({},S(g)),null!=p?{label:null!==(r=f)&&void 0!==r?r:""}:{label:null})},[Ct,It,He,pt,Vn]),Mi=a(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=Ct[u[0]],a=It[u[0]],d=1;d<u.length;d++)(null==c?void 0:c.subsections)&&(c=c.subsections[u[d]]),(null==a?void 0:a.subsections)&&(a=a.subsections[u[d]]);if(!c&&!a)return null;var s=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,v=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,p=y(null==c?void 0:c.id)||y(null==a?void 0:a.id)||"",f=!(!(null==c?void 0:c.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!s&&!v&&!f)return n(n({},S(H)),{label:"Not Defined"});null!==(i=null!==(t=null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=He[p])||void 0===o||o.relevance_score);var g=null!==(l=null!==(r=null==c?void 0:c.evaluationResult)&&void 0!==r?r:null==a?void 0:a.evaluationResult)&&void 0!==l?l:null,h=I(g),m=B(g);return n(n({},S(m)),null!=g?{label:null!=h?h:""}:{label:null})},[Ct,It,He,pt]),Di=a(function(e,t){var i,o,r,l,u,c,a,d,s,v,p,f,g,h,m,x,y;if(!e||null==t)return null;var b=null!==(a=null!==(u=null!==(o=null===(i=null==jn?void 0:jn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==_n?void 0:_n.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==_n?void 0:_n[e])||void 0===c?void 0:c.evaluation_result)&&void 0!==a?a:null;if(!b||"object"!=typeof b)return null;var R=null!==(p=null!==(s=null===(d=null==b?void 0:b.deviations)||void 0===d?void 0:d[t])&&void 0!==s?s:null===(v=null==b?void 0:b.deviation_entries)||void 0===v?void 0:v[t])&&void 0!==p?p:null==b?void 0:b[t],C=null!==(y=null!==(h=null===(g=null===(f=null==R?void 0:R.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)&&void 0!==h?h:null===(x=null===(m=null==b?void 0:b.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===x?void 0:x.label_color)&&void 0!==y?y:H;return n(n({},S(C)),{label:null})},[jn,_n]),Ni=a(function(){Zt(),ri({}),ui({}),ni(),be(new Set),Ce([]),Me.current=[],ct(),st(),vt(),requestAnimationFrame(function(){ke.current&&ke.current()})},[ri,ui,ni,ct,st,vt]),Ai=u(function(){return Object.values(oi).some(Boolean)||Object.values(li).some(Boolean)},[oi,li]),ki=a(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f,g,h,m,x,y,b,S,C;if(!Je.current&&!_e.current){Je.current=!0;try{if(!mi.current)return;var I=function(n){var e=n.split("-"),t=e[0];if(!oi[t]&&!1===Vn)return!1;if(Vn&&!oi["left-".concat(t)]&&!oi["right-".concat(t)]&&!oi[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!li[i])return!1;return!0},B=mi.current.getBoundingClientRect();Le({width:B.width,height:B.height});var _=[];if(Bt.forEach(function(n){var e,t,i=n.key,o=null===(e=Nt.current[i])||void 0===e?void 0:e.current,r=null===(t=At.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")}),!_e.current){for(var F=0;F<Math.max(Ct.length,It.length);F++){var E=null===(n=kt.current[F])||void 0===n?void 0:n.current,M=null===(e=Ht.current[F])||void 0===e?void 0:e.current;E&&(E.style.height="auto",E.style.minHeight="0px"),M&&(M.style.height="auto",M.style.minHeight="0px")}Vn||Object.keys(Ot.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Ot.current[n])||void 0===e?void 0:e.current,o=null===(t=zt.current[n])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var D={};Bt.forEach(function(n){var e,t,i=n.key,o=null===(e=Nt.current[i])||void 0===e?void 0:e.current,r=null===(t=At.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();D[i]=Math.max(l.height,u.height)}});var N={left:{},right:{}},A={};if(!_e.current)if(Vn){if(re&&null!==ge)if("number"==typeof ge){var k=ge,H=Ct[k],P=null===(o=kt.current[k])||void 0===o?void 0:o.current;P&&H&&(H.refIndexes||[]).forEach(function(n){var e,t=It.findIndex(function(e){return e.selfIndex===n}),i=null===(e=Ht.current[t])||void 0===e?void 0:e.current;if(i&&(oi["left-".concat(k)]||oi["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);N.left[k]=Math.max(N.left[k]||0,o),N.right[t]=Math.max(N.right[t]||0,o)}})}else{var j=ge.split(R)[2];if(j){E=null===(r=Ot.current[j])||void 0===r?void 0:r.current,M=null===(l=zt.current[j])||void 0===l?void 0:l.current;if(E&&M){L=Math.max(E.getBoundingClientRect().height,M.getBoundingClientRect().height);A[j]=Math.max(A[j]||0,L)}}}}else{Object.keys(Ot.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=Ot.current[n])||void 0===e?void 0:e.current,o=null===(t=zt.current[n])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);A[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(F=0;F<Math.min(Ct.length,It.length);F++){var E=null===(t=kt.current[F])||void 0===t?void 0:t.current,M=null===(i=Ht.current[F])||void 0===i?void 0:i.current;if(E&&M){var L=Math.max(E.getBoundingClientRect().height,M.getBoundingClientRect().height);N.left[F]=L,N.right[F]=L}}}if(Bt.forEach(function(n){var e,t,i=n.key,o=null===(e=Nt.current[i])||void 0===e?void 0:e.current,r=null===(t=At.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=D[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),_e.current||(Object.entries(N.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=kt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(N.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Ht.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Vn||Object.keys(A).forEach(function(n){var e,t,i=null===(e=Ot.current[n])||void 0===e?void 0:e.current,o=null===(t=zt.current[n])||void 0===t?void 0:t.current;if(i&&o&&A[n]){var r=A[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),Vn)Ct.forEach(function(n,e){var t;(null===(t=kt.current[e])||void 0===t?void 0:t.current)&&(n.refIndexes||[]).forEach(function(n){var t,i,o,r,l,u,c,a,d,s,v=It.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var p=null===(t=Pt.current[e])||void 0===t?void 0:t.current,f=null===(i=jt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),m=g.right-B.left,x=h.left-B.left,y=g.top+g.height/2-B.top,b=h.top+h.height/2-B.top;if(re&&ge===e){var S=null!==(r=null===(o=$e.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=qe.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(a=null===(c=$e.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=R+(null!==(s=null===(d=qe.current)||void 0===d?void 0:d.clientHeight)&&void 0!==s?s:1/0),w=g.top+g.height/2,T=h.top+h.height/2,F=function(n,e,t){return Math.max(e,Math.min(t,n))};y=F(w,S,C)-B.top,b=F(T,R,I)-B.top}var E=Ei(e);E&&_.push({id:"line-".concat(e,"-").concat(v),x1:m,y1:y,x2:x,y2:b,style:E,sectionIdx:e,targetRightIdx:v})}}})});else{for(F=0;F<Math.min(Ct.length,It.length);F++){var O=null===(u=kt.current[F])||void 0===u?void 0:u.current,z=null===(c=Ht.current[F])||void 0===c?void 0:c.current;if(O&&z){var W=O.getBoundingClientRect(),q=z.getBoundingClientRect(),Y=Math.max(W.top,q.top)+18-B.top,K=(null===(a=It[F])||void 0===a?void 0:a.id)||"sec-".concat(F);(Z=Ei(F))&&_.push({id:K,x1:W.right-B.left,y1:Y,x2:q.left-B.left,y2:Y,style:Z,sectionIdx:F,hasCognitive:!!((null===(d=Ct[F])||void 0===d?void 0:d.cognitiveData)||(null===(s=It[F])||void 0===s?void 0:s.cognitiveData)||K&&He[K]),isSubSection:!1})}}Object.keys(Ot.current).forEach(function(n){var e,t,i,o,r,l;if(I(n)){var u=null===(e=Ot.current[n])||void 0===e?void 0:e.current,c=null===(t=zt.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var a=n.split("-").map(Number),d=Ct[a[0]],s=It[a[0]],v=1;v<a.length;v++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[a[v]]);var p=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&w(d.title)),f=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&w(d.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&w(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&w(s.content));if(p&&f||g&&h){var m=u.getBoundingClientRect(),x=c.getBoundingClientRect(),y=Math.max(m.top,x.top)+16-B.top,b=Mi(n);b&&"Not Defined"!==b.label&&_.push({id:"subsec-".concat(n),x1:m.right-B.left,y1:y,x2:x.left-B.left,y2:y,style:b,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:n,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(re&&"string"==typeof ge&&ge.includes(R)){var V=ge.split(R),X=V[0],$=V[1],J=V[2],U=(V[3],"".concat(X).concat(R).concat($)),G=null===(v=Pt.current[U])||void 0===v?void 0:v.current,Q=null===(p=jt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,nn=G.getBoundingClientRect(),en=Q.getBoundingClientRect(),tn=nn.right-B.left,on=en.left-B.left,rn=nn.top+nn.height/2-B.top,ln=en.top+en.height/2-B.top;if(Vn){var un=null!==(g=null===(f=$e.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(m=null===(h=qe.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==m?m:0,an=un+(null!==(y=null===(x=$e.current)||void 0===x?void 0:x.clientHeight)&&void 0!==y?y:1/0),dn=cn+(null!==(S=null===(b=qe.current)||void 0===b?void 0:b.clientHeight)&&void 0!==S?S:1/0),sn=function(n,e,t){return Math.max(e,Math.min(t,n))};rn=sn(nn.top+nn.height/2,un,an)-B.top,ln=sn(en.top+en.height/2,cn,dn)-B.top}(Z=null!==(C=Di(X,$))&&void 0!==C?C:Mi(J))&&_.push({id:"line-subsec-".concat(U),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:ge})}}if(Bi(_),Si.current&&Ri.current){var vn=Si.current.getBoundingClientRect(),pn=Ri.current.getBoundingClientRect(),fn=(vn.top+vn.height/2-B.top+pn.top+pn.height/2-B.top)/2;_i({x1:vn.right-B.left,x2:pn.left-B.left,y:fn})}else _i(null);if(ye.size>0){var gn=[],hn=$e.current,mn=qe.current;if(hn&&mn){var xn=[],yn=hn.getBoundingClientRect().top,bn=mn.getBoundingClientRect().top,Sn=yn+hn.clientHeight,Rn=bn+mn.clientHeight,Cn=hn.scrollTop,In=mn.scrollTop,Bn=B.top,wn=function(n,e,t){return Math.max(e,Math.min(t,n))};ye.forEach(function(n){var e,t,i,o,r,l;if("string"==typeof n&&n.includes(R)){var u=n.split(R),c=u[0],a=u[1],d=u[2],s=(u[3],"".concat(c).concat(R).concat(a)),v=null===(e=Pt.current[s])||void 0===e?void 0:e.current,p=null===(t=jt.current[s])||void 0===t?void 0:t.current;if(!v||!p)return;var f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=null!==(i=Di(c,a))&&void 0!==i?i:Mi(d),m=(H=f.right-B.left)+.5*((P=g.left-B.left-0)-H),x=f.top+f.height/2,y=g.top+g.height/2,b=x-yn+Cn,S=y-bn+In,C="conn-subsec-".concat(s);xn.push({lhsScrollY:b,rhsScrollY:S,x1:H,x2:P,containerTop:Bn,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var I=wn(x,yn,Sn),w=wn(y,bn,Rn),_=I-Bn,F=w-Bn,E=y>=bn-4&&y<=Rn+4,M="";M=(j=x>=yn-4&&x<=Sn+4)&&E?T(H,_,P,F):j&&!E?"M ".concat(H,",").concat(_," L ").concat(m,",").concat(_," L ").concat(m,",").concat(F):!j&&E?"M ".concat(m,",").concat(_," L ").concat(m,",").concat(F," L ").concat(P,",").concat(F):"M ".concat(m,",").concat(_," L ").concat(m,",").concat(F),gn.push({id:C,pathD:M,style:h,leftIdx:n,rhsArrayIdx:n})}else if(Vn){var D=n,N=Ct[D];if(!(null===(l=null==N?void 0:N.refIndexes)||void 0===l?void 0:l.length))return;N.refIndexes.forEach(function(n){var e,t,i=It.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=Pt.current[D])||void 0===e?void 0:e.current,r=null===(t=jt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=Ei(D),a=l.right-B.left,d=u.left-B.left-0,s=a+.5*(d-a),v=l.top+l.height/2,p=u.top+u.height/2,f=v-yn+Cn,g=p-bn+In,h="conn-".concat(D,"-").concat(i);xn.push({lhsScrollY:f,rhsScrollY:g,x1:a,x2:d,containerTop:Bn,leftIdx:D,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var m=wn(v,yn,Sn),x=wn(p,bn,Rn),y=m-Bn,b=x-Bn,S=v>=yn-4&&v<=Sn+4,R=p>=bn-4&&p<=Rn+4,C="";C=S&&R?T(a,y,d,b):S&&!R?"M ".concat(a,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(d,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),gn.push({id:h,pathD:C,style:c,leftIdx:D,rhsArrayIdx:i})}}})}else{var A=n,k=A;v=null===(o=Pt.current[A])||void 0===o?void 0:o.current,p=null===(r=jt.current[k])||void 0===r?void 0:r.current;if(!v||!p)return;var H,P;f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=Ei(A),m=(H=f.right-B.left)+.5*((P=g.left-B.left-0)-H),x=f.top+f.height/2,y=g.top+g.height/2,b=x-yn+Cn,S=y-bn+In,C="conn-".concat(A,"-").concat(k);xn.push({lhsScrollY:b,rhsScrollY:S,x1:H,x2:P,containerTop:Bn,leftIdx:A,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var j;I=wn(x,yn,Sn),w=wn(y,bn,Rn),_=I-Bn,F=w-Bn,E=y>=bn-4&&y<=Rn+4,M="";M=(j=x>=yn-4&&x<=Sn+4)&&E?T(H,_,P,F):j&&!E?"M ".concat(H,",").concat(_," L ").concat(m,",").concat(_," L ").concat(m,",").concat(F):!j&&E?"M ".concat(m,",").concat(_," L ").concat(m,",").concat(F," L ").concat(P,",").concat(F):"M ".concat(m,",").concat(_," L ").concat(m,",").concat(F),gn.push({id:C,pathD:M,style:h,leftIdx:A,rhsArrayIdx:k})}}),Me.current=xn}Ce(gn)}else Ce([]),Me.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{Je.current=!1}}},[Bt,Ct,It,He,pt,Fi,Ei,Di,Vn,re,ge,ye,oi,li]),Hi=a(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f=Me.current;if(f.length&&!_e.current){var g=null!==(e=null===(n=$e.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=qe.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=$e.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,x=null!==(u=null===(l=qe.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(a=null===(c=$e.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(s=null===(d=qe.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+m,R=b+x,C=null!==(p=null===(v=mi.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,I=function(n,e,t){return Math.max(e,Math.min(t,n))};f.forEach(function(n){var e=n.lhsScrollY-g+y,t=n.rhsScrollY-h+b,i=Ee.current[n.styleId+"-stroke"],o=Ee.current[n.styleId+"-bg"];if(i||o){var r,l=I(e,y,S),u=I(t,b,R),c=l-C,a=u-C,d=e>=y-4&&e<=S+4,s=t>=b-4&&t<=R+4,v=n.x1+.5*(n.x2-n.x1);r=d&&s?T(n.x1,c,n.x2,a):d&&!s?"M ".concat(n.x1,",").concat(c," L ").concat(v,",").concat(c," L ").concat(v,",").concat(a):!d&&s?"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a," L ").concat(n.x2,",").concat(a):"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){ke.current=ki},[ki]);var Pi=l(null),ji=l(null),Li=a(function(){Me.current.length>0&&!_e.current||(null!==Pi.current&&clearTimeout(Pi.current),Pi.current=setTimeout(function(){ke.current(),Pi.current=null},50))},[]),Oi=a(function(){pe(!0),de(!1),Be.current=null,null!==ji.current&&clearTimeout(ji.current),null!==Pi.current&&(clearTimeout(Pi.current),Pi.current=null),ji.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,a,d;try{if(Me.current=[],Ne.current&&null!==Ae.current&&null!==yi.current){var s=Ae.current,v=yi.current,p="string"==typeof s&&s.includes(R),f=null,g=null,h=null,m=null;if(p){var x=s.split(R),y="".concat(x[0]).concat(R).concat(x[1]);f=(null===(n=Pt.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=jt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=Ot.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=kt.current[Number(x[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=zt.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=Ht.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else f=(null===(l=Wt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=kt.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=Lt.current[v])||void 0===c?void 0:c.current)||null,m=(null===(a=Ht.current[v])||void 0===a?void 0:a.current)||null;if(f&&g&&h&&m){if(h.style.paddingTop="0px",m.style.paddingTop="0px",!Vn){var b=f.getBoundingClientRect(),S=g.getBoundingClientRect(),C=b.top-S.top;C>0?m.style.paddingTop="".concat(C,"px"):C<0&&(h.style.paddingTop="".concat(Math.abs(C),"px"))}var I=$e.current,B=qe.current;if(I&&B){var w=f.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,T=g.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(w-I.scrollTop);Math.abs(B.scrollTop-T)>1&&(B.scrollTop=T)}}}null===(d=ke.current)||void 0===d||d.call(ke),Ne.current&&de(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{pe(!1),ji.current=null}},150)},[Vn,Ct,It]),zi=a(function(n){if(null!==Ue.current&&Ge.current&&Math.abs(n.currentTarget.scrollTop-Ue.current)<=2){var e=Ge.current;Ue.current=null,Ge.current=null,e()}me.current||(Vn||Li(),De.current||(De.current=!0,requestAnimationFrame(function(){var n,e,t,i,o,r,l;if(Ne.current){var u=$e.current,c=qe.current;if(u&&c&&bi.current){if(!Be.current){var a=Ae.current,d=void 0;if("string"==typeof a&&a.includes(R)){var s=a.split(R),v="".concat(s[0]).concat(R).concat(s[1]);d=null===(n=Pt.current[v])||void 0===n?void 0:n.current}else d=null===(e=Pt.current[a])||void 0===e?void 0:e.current;if(d){var p=d.getBoundingClientRect();Be.current={badgeScreenY:p.top+p.height/2,initialScrollTop:u.scrollTop,leftTop:u.getBoundingClientRect().top,leftBottom:u.getBoundingClientRect().top+u.clientHeight,cTop:null!==(i=null===(t=mi.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Be.current){var f=Be.current,g=u.scrollTop-f.initialScrollTop,h=f.badgeScreenY-g,m=((o=h,r=f.leftTop,l=f.leftBottom,Math.max(r,Math.min(l,o)))-f.cTop).toString(),x=h>=f.leftTop-4&&h<=f.leftBottom+4;bi.current.setAttribute("y1",m),bi.current.setAttribute("y2",m),bi.current.setAttribute("visibility",x?"visible":"hidden")}}}Me.current.length>0&&Hi(),De.current=!1})))},[Hi,Vn,Li]),Wi=l(0),qi=l(0),Yi=l(0),Ki=l(function(){});l(null),c(function(){Ki.current=Oi},[Oi]),c(function(){var n=setTimeout(Li,250),e=function(){return Ki.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==Pi.current&&clearTimeout(Pi.current),null!==ji.current&&clearTimeout(ji.current),window.removeEventListener("resize",e)}},[St,Rt,Vt,Bt,oi,li,Ct,It,pt,Li,re,ge,ae,ye]),c(function(){var n=function(n,e,t,i,o){e.current=n.getBoundingClientRect().width;var r=new ResizeObserver(function(n){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=n[n.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-e.current)<1?o():(e.current=a,i())}})});return r.observe(n),r},e={current:null},t={current:null},i={current:null},o=[],r=[e,t,i];return We.current&&o.push(n(We.current,Wi,e,function(){return Ki.current()},function(){})),ze.current&&o.push(n(ze.current,qi,t,function(){return Ki.current()},function(){return ke.current()})),mi.current&&o.push(n(mi.current,Yi,i,function(){return Ki.current()},function(){return ke.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),c(function(){Ne.current=re},[re]),c(function(){Ae.current=ge},[ge]);var Vi=a(function(n,e,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,u=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";vt(),null!=n&&(e?ie("No counterpart exists for this section."):(Zt(),re&&ge===n?r?ni():null==l||l():(be(new Set([n])),Ce([]),Me.current=[],ne(!0),me.current=!0,he(n),Ae.current=n,le(!0),Ne.current=!0,de(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ve.current&&(Ve.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px"),requestAnimationFrame(function(){var e,t,i,o,r,c="string"==typeof n&&n.includes(R),a=null,d=null,s=null;if(c){var v=n.split(R),p="".concat(v[0]).concat(R).concat(v[1]);a=(null===(e=Pt.current[p])||void 0===e?void 0:e.current)||null,d=(null===(t=jt.current[p])||void 0===t?void 0:t.current)||null,s=d?n:null}else if(a=(null===(i=Wt.current[n])||void 0===i?void 0:i.current)||null,Vn){var f=Ct[n],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],m=It.findIndex(function(n){return n.selfIndex===h});-1!==m&&(d=(null===(r=Lt.current[m])||void 0===r?void 0:r.current)||null,s=m)}}else d=(null===(o=Lt.current[n])||void 0===o?void 0:o.current)||null,s=d?n:null;yi.current=s;var x=$e.current,y=qe.current,b=function(){!function(){var e,t,i,o,r,l,u,a,d,v,p,f,g=null,h=null,m=null,x=null;if(c){var y=n.split(R),b="".concat(y[0]).concat(R).concat(y[1]);g=(null===(e=Ot.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=kt.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=zt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=Ht.current[Number(y[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=Pt.current[b])||void 0===r?void 0:r.current)||g,x=(null===(l=jt.current[b])||void 0===l?void 0:l.current)||h}else{var S=Number(n),C=null!==s?Number(s):S;g=(null===(u=kt.current[S])||void 0===u?void 0:u.current)||null,h=(null===(a=Ht.current[C])||void 0===a?void 0:a.current)||null,m=(null===(d=Pt.current[S])||void 0===d?void 0:d.current)||(null===(v=Wt.current[S])||void 0===v?void 0:v.current)||g,x=(null===(p=jt.current[C])||void 0===p?void 0:p.current)||(null===(f=Lt.current[C])||void 0===f?void 0:f.current)||h}if(m&&x&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=m.getBoundingClientRect(),B=x.getBoundingClientRect(),w=I.top-B.top;w>0?h.style.paddingTop="".concat(w,"px"):w<0&&(g.style.paddingTop="".concat(Math.abs(w),"px"))}}(),de(!0),ke.current&&ke.current(),me.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):x&&x.dispatchEvent(new Event("scroll")),ne(!1),null==l||l()};if(!a||!x)return me.current=!1,ne(!1),void(null==l||l());if(d&&y){if(!Vn){var S=0;S="right"===u?d?d.getBoundingClientRect().top:0:a?a.getBoundingClientRect().top:0;var C=ze.current,I=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+S-I-150:0;return C?void _(C,B,200,b):void b()}var w=a.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop,T=d.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,F=200;if("left"===u){var E=T-(w-x.scrollTop);E<0&&Ye.current&&(Ye.current.style.height="".concat(Math.abs(E),"px")),requestAnimationFrame(function(){var n,e=y.scrollHeight-y.clientHeight;if(E<0)n=0;else{if(E>e){var t=E-e;return Ke.current&&(Ke.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){_(y,E,F,b)})}n=E}_(y,n,F,b)})}else{var M=w-(T-y.scrollTop);M<0&&Ve.current&&(Ve.current.style.height="".concat(Math.abs(M),"px")),requestAnimationFrame(function(){var n,e=x.scrollHeight-x.clientHeight;if(M<0)n=0;else{if(M>e){var t=M-e;return Xe.current&&(Xe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){_(x,M,F,b)})}n=M}_(x,n,F,b)})}}else b()}))))},[ge,vt,It,re,Vn,Ct,ni]),Xi=a(function(){var n,e=et.sectionIdx,t=et.isOrphan;if(ct(),null!=e){var i="left";et.anchorEl&&(null===(n=qe.current)||void 0===n?void 0:n.contains(et.anchorEl))&&(i="right"),Vi(e,t,{sourceSide:i})}},[Vi,et.isOrphan,et.sectionIdx,et.anchorEl,ct]),$i=a(function(){ct(),ni(),be(new Set),Ce([]),Me.current=[]},[ct,ni]),Ji=null!==et.sectionIdx&&ye.has(et.sectionIdx),Ui=V({proposedSections:Ct,existingSections:It,parentDeviationRecord:wt,expandedSections:oi,maintainRelativeOrder:!!Vn,scrollContainerRef:ze,leftContainerRef:$e,rightContainerRef:qe,lhsBadgeRefs:Pt,rhsBadgeRefs:jt}),Gi=Ui.showDeviationNavigation,Qi=Ui.showOpenNodeRef,Zi=Ui.adjustScrollForPopup,no=a(function(n,e,t,i,o){var r,l="string"==typeof i?y(i).trim():y(null==i?void 0:i.deviation_summary).trim(),u=n.currentTarget;st();var c="left";(null===(r=qe.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var n,t,i,o;if("string"==typeof e&&e.includes(R)){var r=e.split(R),l="".concat(r[0]).concat(R).concat(r[1]);return"right"===c?null===(n=jt.current[l])||void 0===n?void 0:n.current:null===(t=Pt.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=jt.current[e])||void 0===i?void 0:i.current:null===(o=Pt.current[e])||void 0===o?void 0:o.current},d=function(n,e){var t=!!Vn,i=t?"right"===c?qe.current:$e.current:ze.current,o=t?"right"===c?$e.current:qe.current:null;if(i&&n){var r=n.getBoundingClientRect(),l=i.getBoundingClientRect(),u=l.bottom-.35*l.height,a=l.top+.35*l.height;if(r.top>u||r.top<a){var d=l.top+l.height/2,s=r.top+r.height/2-d;if(t&&o){var v=i.scrollHeight-i.clientHeight,p=o.scrollHeight-o.clientHeight;if(s>0){var f=v-i.scrollTop,g=p-o.scrollTop;s=Math.max(0,Math.min(s,f,g))}else s=Math.min(0,Math.max(s,-i.scrollTop,-o.scrollTop));_(o,o.scrollTop+s,250,function(){})}_(i,i.scrollTop+s,250,e)}else e()}else e()};if(t)return ni(),be(new Set),Ce([]),Me.current=[],void(l&&requestAnimationFrame(function(){var n=a()||u;d(n,function(){ut({open:!0,anchorEl:n,summary:i,displayImpact:o})})}));Vi(e,t,l?{toggleIfSame:!1,sourceSide:c,onReady:function(){var n=a()||u;d(n,function(){ut({open:!0,anchorEl:n,summary:i,displayImpact:o})})}}:{toggleIfSame:!1,sourceSide:c})},[Vi,st,ut,ni,Vn]),eo=u(function(){var n;if(!Ln)return null;var e=null===(n=null==Ln?void 0:Ln.id)||void 0===n?void 0:n.split(":")[0];for(var t in wt){if((wt[t]||[]).some(function(n){return n.id===e}))return t}return null},[Ln,wt]),to=l({id:null,triggerMs:null}),io=l(null);c(function(){var t;if(null==Ln?void 0:Ln.id){var i=Number(Ln.trigger),o=to.current;if((null==o?void 0:o.triggerMs)!==i){if(!(Ln.id.includes(":")&&/:\d+$/.test(Ln.id)))return to.current={id:Ln.id,triggerMs:i},void gi(Ln.id);var r=null===(t=null==Ln?void 0:Ln.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";io.current!==Ln.id&&(ct(),st(),ni(),be(new Set),Ce([]),Me.current=[],io.current=Ln.id);var a=!1,d=0,s=null,v=150,p=function(n,e){for(var t=function(n,i){if(!n)return null;if(n.id===e)return i;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=t(n.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<n.length;i++){var o=t(n[i],String(i));if(o)return o}return null},f=function(){var t,o,r,u;if(!a){var g=function(){to.current={id:Ln.id,triggerMs:i}},h=null,m=null;for(var x in wt){var y=wt[x].find(function(n){return n.id===l});if(y){h=x,m=y;break}}if(m&&h){var b=Ct.findIndex(function(n){return n.id===h}),S=It.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==S,I=p(Ct,m.id),B=p(It,m.id);if(I&&!B&&!C){var w=I.split("-"),T=Number(w[0]);if(Vn){var _=null===(o=null===(t=Ct[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],F=It.findIndex(function(n){return n.selfIndex===_});-1!==F&&(T=F)}B=e([T],w.slice(1),!0).join("-")}if(I||B){var E=C||!I&&!!B,M=I?Number(I.split("-")[0]):b,D=B?Number(B.split("-")[0]):S;if(E){if(!(Vn?!!oi["right-".concat(D)]:!!oi[String(D)])&&D>=0)return ci(D,"right"),d+=1,void(s=setTimeout(f,450))}else if(!(Vn?!!oi["left-".concat(M)]:!!oi[String(M)])&&M>=0)return ci(M,"left"),d+=1,void(s=setTimeout(f,450));var N,A=I||"",k=B||"",H="".concat(m.id).concat(R).concat(c).concat(R).concat(A).concat(R).concat(k),P="".concat(m.id).concat(R).concat(c),j=null===(r=Pt.current[P])||void 0===r?void 0:r.current,L=null===(u=jt.current[P])||void 0===u?void 0:u.current,O=E||!j&&!!L,z=O?L:j;if(N=Vn?O?qe.current:$e.current:ze.current,z&&N){var W=z.getBoundingClientRect();if(0===W.height)return void((d+=1)<2?s=setTimeout(f,v):g());var q=N.getBoundingClientRect(),Y=W.top-q.top+N.scrollTop-q.height/2+W.height/2+150,K=function(){var e,t,i,o,r;if(!a){g();var l=z instanceof Element?window.getComputedStyle(z).color:"";j&&(j.style.transition="box-shadow 300ms ease-in-out",j.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){j&&(j.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var u=(null===(t=null===(e=m.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[c])||m,d=(null===(i=m.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||m.evaluation_outputs;if(!(!!j&&!!L)){var s=O?(null===(o=jt.current[P])||void 0===o?void 0:o.current)||L:(null===(r=Pt.current[P])||void 0===r?void 0:r.current)||j;return Zi(s,function(){ut({open:!0,anchorEl:s,displayImpact:Ln.displayImpact,summary:n(n({},u),{evaluation_outputs:d})})}),void(null==On||On())}Vi(H,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t,i=O?(null===(e=jt.current[P])||void 0===e?void 0:e.current)||L:(null===(t=Pt.current[P])||void 0===t?void 0:t.current)||j;Zi(i,function(){ut({open:!0,anchorEl:i,displayImpact:null==Ln?void 0:Ln.displayImpact,summary:n({},u)})})}})}};Math.abs(N.scrollTop-Y)<=2?K():(Ue.current=Y,Ge.current=K,N.scrollTo({top:Y,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if(Ge.current){Ue.current=null;var n=Ge.current;Ge.current=null,n()}},800))}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}};return s=setTimeout(f,v),function(){a=!0,s&&clearTimeout(s)}}}},[Ln,wt,Ct,It,Vn,oi,ci,Vi,ut,gi]);var oo=function(n){var e=n.section,t=n.keyPath,o=n.depth,r=void 0===o?0:o,l=n.columnKey,u=void 0===l?"left":l,c=n.parentNodeId,a=void 0===c?"":c,d=n.sectionOffset;return i(J,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:a,expandedSubSections:li,setExpandedSubSections:ui,maintainRelativeOrder:Vn||!1,proposedSections:Ct,existingSections:It,treeData:_n,deviationNumberRegistry:Tt,connectedSections:ye,activeSideBySideSection:ge,resolvedMarkdownStyles:Oe,getSubSectionRef:Yt,getSubSectionCompareStyle:Mi,getBadgeRef:Kt,openMoreFunctionsPopup:si,openSummaryPopup:no,showDeviationBadges:$n,resetSideBySide:ni,setConnectedSections:be,setConnectedLines:Ce,cachedConnectedPositions:Me,isProposingFix:Wn,proposingFixNodeId:qn,isRedlineFlow:Yn,sectionOffset:d})};return t(d,n({ref:We,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Vn?{}:{overflow:"visible"}),{position:"relative"})},{children:[Un&&i(d,n({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(O,{})})),lt.open&&i(U,{open:lt.open,anchorEl:lt.anchorEl,containerEl:xi.current,clipTopEl:Si.current,scrollContainerEl:ze.current,onClose:$i,summary:lt.summary,displayImpact:lt.displayImpact}),i(L,{open:et.open,anchorEl:et.anchorEl,sectionTitle:et.sectionTitle,referenceSectionTitle:et.refSectionTitle,onClose:vt,onOpenCognitiveCompare:vi,onOpenSideBySide:Xi,onConnect:pi,isConnected:Ji,isOrphan:et.isOrphan}),Ze.open&&i(j,{open:Ze.open,popupRef:dt,position:it,popupConfig:Hn,onClose:function(){ot(null),nt(function(e){return n(n({},e),{open:!1})}),at(null)},markdownStyles:Dn,sectionTitle:Ze.sectionTitle,referenceSectionTitle:Ze.refSectionTitle,cognitiveData:Ze.cognitiveData,anchorEl:Ze.anchorEl,sectionAnchorEl:Ze.sectionAnchorEl,scrollContainerEl:ze.current,badgeStyle:Ze.badgeStyle,docData:Ze.docData,deviationData:Ze.deviationData,isLoading:Ze.isLoading}),i(s,n({open:!!te,autoHideDuration:8e3,onClose:function(){return ie(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(v,n({onClose:function(){return ie(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:te}))})),i(X,{componentHeaderText:Tn,displayConfig:kn,maintainRelativeOrder:Vn,onCollapseAll:Ni,showCollapseAll:Ai,onToggleView:function(n){Gn(!0),setTimeout(function(){Xn(!n),ni(),ct(),be(new Set),Ce([]),Me.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Gn(!1)},600)})})},50)}}),i(d,n({ref:ze,onScroll:zi,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Vn?"hidden":"auto",borderTop:Xt&&$t?"none":"1.5px solid #EEF0F4"}},{children:i(d,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Vn?{flex:1,minHeight:0}:{})},{children:t(d,n({ref:mi,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Vn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:Ie,style:{position:"absolute",top:0,left:0,width:je.width||"100%",height:je.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:ve?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Ti&&i("g",{children:i("line",{x1:Ti.x1,y1:Ti.y,x2:Ti.x2,y2:Ti.y,stroke:Qt.badgeBorder,strokeWidth:"1.5"})}),Ii.map(function(e){var o,r,l,u,c,a,s,v=e.x1+.5*(e.x2-e.x1),p=(e.y1+e.y2)/2;if("Not Defined"===e.style.label&&!e.hasCognitive)return null;if(e.isSubSection?re&&ge===e.subSectionKeyPath&&ae:re&&ge===e.sectionIdx&&ae)return null;if(!Vn){var f=e.isSubSection?T(e.x1,e.y1,e.x2,e.y2):"M ".concat(e.x1," ").concat(e.y1," L ").concat(e.x2," ").concat(e.y2),h=Ct[e.sectionIdx]||{title:"",content:""},x=It[null!==(o=e.targetRightIdx)&&void 0!==o?o:e.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",h,x),e.isSubSection&&e.subSectionKeyPath){var y=e.subSectionKeyPath.includes(R)?e.subSectionKeyPath.split(R):[],b=y[2]||e.subSectionKeyPath,S=y[3]||b,C=b.split("-").map(Number),I=S.split("-").map(Number),B=null,w=null;C.length>0&&(B=Ct[C[0]]),I.length>0&&(w=It[I[0]]);var _=(null==B?void 0:B.title)||"",F=(null==w?void 0:w.title)||"";console.log("Root Parent Titles:",_,F);for(var E=1;E<C.length;E++)(null==B?void 0:B.subsections)&&(B=B.subsections[C[E]]);for(E=1;E<I.length;E++)(null==w?void 0:w.subsections)&&(w=w.subsections[I[E]]);B&&(h=n(n({},B),{title:_||B.title})),console.log("Base Section for Subsection Badge:",h),w&&(x=n(n({},w),{title:F||w.title})),console.log("Ref Section for Subsection Badge:",x)}var M=!(null===(r=h.cognitiveData)||void 0===r?void 0:r.isMissingRationale)||Boolean(null===(u=null===(l=h.cognitiveData)||void 0===l?void 0:l.decisioning)||void 0===u?void 0:u.length),D=(null===(s=null===(a=null===(c=h.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===a?void 0:a.decisioning_factors)||void 0===s?void 0:s.length)||!1,N=M||D;return t("g",{children:[i("path",{d:f,fill:"none",stroke:e.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",n({x:v-100,y:p-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,n({onClick:function(n){n.stopPropagation(),N&&(Ze.open&&rt===e.id?st():(at(e.id),di(ai(n.currentTarget,h,x,e.sectionIdx,e.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:e.style.badgeBg,color:e.style.badgeText,border:"1px solid ".concat(e.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:N?"pointer":"default"}},{children:[e.style.badgeText===H&&null==e.style.label?i(z,{color:e.style.badgeText}):0===e.style.label?"Same":e.style.label,i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(m,{})})),N&&i(g,{size:11,style:{transform:Ze.open&&rt===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),i(G,{connectedLines:Re,pathRefs:Ee})]})),t(d,n({sx:n({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},Vn?{flex:1,overflow:"visible"}:{})},{children:[i(d,n({ref:Si,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(p,n({title:xt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:xt}))}))})),t(d,n({ref:$e,onScroll:zi,sx:n({p:"12px",display:"flex",flexDirection:"column"},Vn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Ve,style:{width:"100%",height:"0px",flexShrink:0}}),Ft&&Ct.map(function(e,o){var r,l,u=!e.title&&!e.content;if(Vn&&u)return null;var c=e,a=Ei(o,"left"),s=Vn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!It[o],v=ye.has(o),p=b(c.evaluationResult,null==a?void 0:a.deviationLabel),f=Mt.leftNums.get(c.id);return i(d,n({ref:qt(o),sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:kt.current[o],sx:n({width:"100%",display:"flex",flexDirection:"column",minWidth:0},v&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i($,{section:e,idx:o,columnKey:"left",colRef:qt("left-accordion-".concat(o)),mb:0,treeData:_n,proposedSections:Ct,existingSections:It,deviationNumberRegistry:Tt,getSectionCompareStyle:Ei,getBadgeRef:Kt,connectedSections:ye,openMoreFunctionsPopup:si,openSummaryPopup:no,deviationNodeIdToView:null==Ln?void 0:Ln.id,deviationTargetParentId:eo,parentNodeId:(null===(l=null==_n?void 0:_n.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:Vn?!!oi["left-".concat(o)]:!!oi[String(o)],onToggle:function(){$i(),ci(o,"left")},navigation:e.id?Gi[e.id]:null,showOpenNodeRef:Qi,resolvedMarkdownStyles:Oe,maintainRelativeOrder:Vn,showDeviationBadges:$n,renderSubSections:oo,isProposingFix:Wn,proposingFixNodeId:qn,isRedlineFlow:Yn,collisionKey:"".concat(re?"1":"0","-").concat(String(null!=ge?ge:""))})})),Vn&&a&&t(d,n({ref:Pt.current[o],onClick:function(n){var e,t,i,r=kn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;no(n,String(o),s,r)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var r=kn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;no(n,String(o),s,r)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:s?"default":"pointer",borderRight:"1px solid ".concat(a.badgeBorder),"&:hover":s?{}:{bgColor:"".concat(a.badgeBorder,"22")}}},{children:[null!=f&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:f})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!kn.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):i(z,{color:a.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var t=Vn?It.find(function(n){var e;return null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)})||{title:"",content:""}:It[o]||{title:"",content:""};si(n,e,s,t,o,a)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(a.badgeBorder,"22")}}},{children:i(h,{size:11,color:a.badgeText})}))]}))]}))}),"left-row-".concat(o))}),i("div",{ref:Xe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,n({ref:xi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,n({onClick:function(e){e.stopPropagation(),Ze.open&&rt===Jt?st():(at(Jt),di(ai(e.currentTarget,{title:"",content:"",evaluationResult:Ut,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Jt,!0,n(n({},Qt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Qt.badgeBg,color:Qt.badgeText,border:"1px solid ".concat(Qt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Gt?Gt:i(z,{}),i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(m,{})})),i(g,{size:11,style:{transform:Ze.open&&rt===Jt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,n({sx:n({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},Vn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Zn&&i(x,{sections:11}),i(d,n({ref:Ri,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(p,n({title:yt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:yt}))}))})),t(d,n({ref:qe,onScroll:zi,sx:n({p:"12px",display:"flex",flexDirection:"column"},Vn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}}),Ft&&It.map(function(e,r){var l,u,c=e,a=!1,s=null,v=-1;if(Vn){v=Ct.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(c.selfIndex))&&n.selfIndex>=0});var p=Ct.findIndex(function(n,e){var t;return ye.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(c.selfIndex))});(a=-1!==p)&&(s=Ei(p,"left"))}else(a=ye.has(r))&&(s=Ei(r,"right"));var f=Vn&&-1!==v?Ei(v,"left"):Ei(r,"right"),g=Vn?-1!==v||!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)&&Ct.some(function(n){return n.id&&n.id===c.id}):Boolean(Ct[r]),m=Vn?c.selfIndex<0||!g:!Ct[r],x=Mt.rightNums.get(c.id);return i(d,n({ref:Lt.current[r],sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Ht.current[r],sx:n({width:"100%",display:"flex"},a&&s&&{borderRadius:"6px",outline:"2px solid ".concat(s.badgeBorder),outlineOffset:"1px"})},{children:i($,{section:e,idx:r,columnKey:"right",colRef:qt("right-accordion-".concat(r)),mb:0,parentNodeId:(null===(u=null==_n?void 0:_n.input_index_map)||void 0===u?void 0:u[1])||"",isExpanded:Vn?!!oi["right-".concat(r)]:!!oi[String(r)],treeData:_n,proposedSections:Ct,existingSections:It,deviationNumberRegistry:Tt,getBadgeRef:Kt,getSectionCompareStyle:Ei,connectedSections:ye,openMoreFunctionsPopup:si,openSummaryPopup:no,deviationNodeIdToView:null==Ln?void 0:Ln.id,deviationTargetParentId:eo,onToggle:function(){$i(),ci(r,"right")},navigation:e.id?Gi[e.id]:null,showOpenNodeRef:Qi,resolvedMarkdownStyles:Oe,maintainRelativeOrder:Vn,showDeviationBadges:$n,renderSubSections:oo,isProposingFix:Wn,proposingFixNodeId:qn,isRedlineFlow:Yn,collisionKey:"".concat(re?"1":"0","-").concat(String(null!=ge?ge:""))})})),Vn&&f&&i(d,n({ref:jt.current[r],"data-section-id":c.id,onClick:function(n){var e,t,i;if(m){var o=kn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;no(n,String(r),m,o)}},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:m?"4px":"0px",fontSize:"11px",bgcolor:f.badgeBg,color:f.badgeText,border:"1px solid ".concat(f.badgeBorder),borderRadius:m?"12px":"10px",px:m?1.2:1,py:.3,fontWeight:m?600:700,cursor:m?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:m?"0 1px 3px rgba(0,0,0,0.07)":"none"}},{children:m?t(o,{children:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var o=kn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;no(n,String(r),m,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:"1px solid ".concat(f.badgeBorder),"&:hover":{bgcolor:"".concat(f.badgeBorder,"22")}}},{children:[null!=x&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(f.badgeBorder)}},{children:x})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!kn.isLoading||null!=c.evaluationResult&&void 0!==c.evaluationResult?f.label?"".concat(f.label):"100% Deviation":i(z,{color:f.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var e=Vn?Ct.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(c.selfIndex)})||{title:"",content:""}:Ct[r]||{title:"",content:""};si(n,e,m,c,r,f)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(f.badgeBorder,"22")}}},{children:i(h,{size:11,color:f.badgeText})}))]}):null!=x?x:""}))]}))}),"right-row-".concat(r))}),i("div",{ref:Ke,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{Q as default};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- import{DEFAULT_DEVIAION_COLOR as t}from"./CognitiveCompareConstants.js";var n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},o=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return o(t)}))},e=function(t,o,e){var i,r=e[o],u=null===(i=null==t?void 0:t.comparison_inputs)||void 0===i?void 0:i[r];return{title:n((null==u?void 0:u.title)||""),content:n((null==u?void 0:u.content)||""),change_history:n((null==u?void 0:u.change_history)||""),attributes:(null==u?void 0:u.additional_attributes)||null,subsections:(null==u?void 0:u.subsections)||[]}},i=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=t.mapping_rationale,o=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:o,citations:n.citations},score:0,relation:"N/A"}};function r(t){var n=function(t,n){var o=function(t){var n=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),o=parseInt(n,16);return{r:o>>16&255,g:o>>8&255,b:255&o}}(t),e=o.r,i=o.g,r=o.b;return function(t,n,o){return"#"+[t,n,o].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(e+(255-e)*n),Math.round(i+(255-i)*n),Math.round(r+(255-r)*n))};return{bg:n(t,.8),border:n(t,.5),badgeBg:n(t,.8),badgeBorder:n(t,.5),badgeText:t.toUpperCase(),highlightBg:n(t,.8)}}function u(t,n){var o;return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var r=this;clearTimeout(o),o=setTimeout(function(){return t.apply(r,e)},n)}}var l=function(t,n){var o,e,i,r,u,l;if(t.content!==n.content)return!1;if(t.overlayContent!==n.overlayContent)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;if(t.collisionKey!==n.collisionKey)return!1;var a=t.highlights||[],s=n.highlights||[];if(a.length!==s.length)return!1;for(var v=0;v<a.length;v++)if(a[v]!==s[v])return!1;var c=t.deviationBadges||[],d=n.deviationBadges||[];if(c.length!==d.length)return!1;for(v=0;v<c.length;v++){if(c[v].id!==d[v].id)return!1;if(c[v].actionId!==d[v].actionId)return!1;if(c[v].label!==d[v].label)return!1;if(c[v].score!==d[v].score)return!1;if(c[v].isOrphan!==d[v].isOrphan)return!1;if(c[v].isConnected!==d[v].isConnected)return!1;if((null===(o=c[v].style)||void 0===o?void 0:o.badgeBg)!==(null===(e=d[v].style)||void 0===e?void 0:e.badgeBg))return!1;if((null===(i=c[v].style)||void 0===i?void 0:i.badgeBorder)!==(null===(r=d[v].style)||void 0===r?void 0:r.badgeBorder))return!1;if((null===(u=c[v].style)||void 0===u?void 0:u.badgeText)!==(null===(l=d[v].style)||void 0===l?void 0:l.badgeText))return!1}return!0},a="::",s=function(t){if(!t)return!0;var n=t.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},v=function(t,n){var o,e,i,r,u,l,a;if(!t)return n;var s=null!==(l=null!==(r=null!==(e=null===(o=t.evaluation_output)||void 0===o?void 0:o.output_score)&&void 0!==e?e:null===(i=t.evaluation_outputs)||void 0===i?void 0:i.output_score)&&void 0!==r?r:null===(u=t.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==l?l:t.output_score;return null!==(a=null!=s?s:n)&&void 0!==a?a:""},c=function(t,n,o,e,i){void 0===i&&(i=14);var r=t+.5*(o-t),u=e-n;if(Math.abs(u)<3)return"M ".concat(t," ").concat(n," H ").concat(o);var l=u>0?1:-1,a=Math.min(i,Math.abs(u)/2,Math.abs(r-t)/2,Math.abs(o-r)/2);return["M ".concat(t," ").concat(n),"H ".concat(r-a),"Q ".concat(r," ").concat(n," ").concat(r," ").concat(n+l*a),"V ".concat(e-l*a),"Q ".concat(r," ").concat(e," ").concat(r+a," ").concat(e),"H ".concat(o)].join(" ")},d=function(t,n,o,e,i){void 0===o&&(o=300);var r=t.style.scrollBehavior;t.style.scrollBehavior="auto";var u=t.scrollTop,l=n-u,a=null,s=function(v){null===a&&(a=v);var c,d=v-a;d<o?(t.scrollTop=(c=d,c/=o,l*(--c*c*c+1)+u),i&&i(),requestAnimationFrame(s)):(t.scrollTop=n,t.style.scrollBehavior=r,i&&i(),e&&e())};requestAnimationFrame(s)},f=["#B91C1C","#A16207","#1D4ED8","#000000"],g=function(t){var n=f.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?f.length:n},p=function(n){for(var o,e,i,r,u,l,a,s,v,c,d,f,p,h=[],b=0,m=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});b<m.length;b++){var y=m[b];(x=null===(r=null===(i=null===(e=null===(o=null==n?void 0:n.deviations)||void 0===o?void 0:o[y])||void 0===e?void 0:e.evaluation_outputs)||void 0===i?void 0:i.metadata)||void 0===r?void 0:r.label_color)&&h.push(x)}for(var _=0,B=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});_<B.length;_++){y=B[_];(x=null===(s=null===(a=null===(l=null===(u=null==n?void 0:n.deviation_entries)||void 0===u?void 0:u[y])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===s?void 0:s.label_color)&&h.push(x)}for(var T=0,C=Object.keys(n||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});T<C.length;T++){var x;y=C[T];(x=null===(d=null===(c=null===(v=null==n?void 0:n[y])||void 0===v?void 0:v.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===d?void 0:d.label_color)&&h.push(x)}return 0===h.length?(null===(p=null===(f=null==n?void 0:n.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===p?void 0:p.label_color)?n.evaluation_outputs.metadata.label_color:t:h.sort(function(t,n){return g(t)-g(n)})[0]},h=function(t){for(var n,o,e,i,r,u,l,a,s,v=0,c=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});v<c.length;v++){var d=c[v];if(b=null===(e=null===(o=null===(n=null==t?void 0:t.deviations)||void 0===n?void 0:n[d])||void 0===o?void 0:o.evaluation_outputs)||void 0===e?void 0:e.output_value)return b}for(var f=0,g=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});f<g.length;f++){d=g[f];if(b=null===(u=null===(r=null===(i=null==t?void 0:t.deviation_entries)||void 0===i?void 0:i[d])||void 0===r?void 0:r.evaluation_outputs)||void 0===u?void 0:u.output_value)return b}for(var p=0,h=Object.keys(t||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});p<h.length;p++){var b;d=h[p];if(b=null===(a=null===(l=null==t?void 0:t[d])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(s=null==t?void 0:t.evaluation_outputs)||void 0===s?void 0:s.output_value)?t.evaluation_outputs.output_value:null},b=function(t,n){var o=function(t){var n=t.replace("#","");return[parseInt(n.substring(0,2),16),parseInt(n.substring(2,4),16),parseInt(n.substring(4,6),16)]},e=function(t){var n=Math.round(t).toString(16);return 1===n.length?"0"+n:n};try{var i=o(t),r=o(n),u=(i[0]+r[0])/2*.95,l=(i[1]+r[1])/2*.95,a=(i[2]+r[2])/2*.95;return"#".concat(e(u)).concat(e(l)).concat(e(a))}catch(t){return"#FDE68A"}},m=function(t,n,o){if(!t)return null;if(t.id===o)return n;if(!Array.isArray(t.subsections))return null;for(var e=0;e<t.subsections.length;e++){var i=m(t.subsections[e],"".concat(n,"-").concat(e),o);if(i)return i}return null},y=function(t,n){for(var o=0;o<t.length;o++){var e=m(t[o],String(o),n);if(e)return e}return null},_=new WeakMap,B=function(t){if(t){var n=_.get(t);null!=n&&(clearTimeout(n),_.delete(t)),t.style.transition="box-shadow 300ms ease-out, outline 300ms ease-out",requestAnimationFrame(function(){t.style.outline="",t.style.boxShadow=""}),window.setTimeout(function(){t.style.transition="",t.style.borderRadius=""},300)}},T=function(t){if(t){var n=_.get(t);null!=n&&clearTimeout(n),t.style.transition="box-shadow 300ms ease-in-out, outline 300ms ease-in-out",t.style.outline="2px solid #ff9494",t.style.borderRadius="6px",t.style.boxShadow="0 0 12px 2px rgba(244, 113, 113, 0.33)";var o=window.setTimeout(function(){B(t)},3e3);_.set(t,o)}},C=function(t,n){var o=n.getBoundingClientRect(),e=t.getBoundingClientRect(),i=n.scrollTop+e.top-o.top-o.height/2+e.height/2;n.scrollTo({top:i,behavior:"smooth"});var r=function(){return T(t)};if("onscrollend"in n)n.addEventListener("scrollend",r,{once:!0});else{var u=n.scrollTop,l=function(){n.scrollTop===u?r():(u=n.scrollTop,requestAnimationFrame(l))};requestAnimationFrame(l)}};export{a as DEVIATION_BADGE_SEPARATOR,l as areMarkdownPropsEqual,u as debounce,v as extractDeviationScore,y as findKeyPathByNodeId,r as generateColorPalette,c as getBentArrowPath,p as getFirstDeviationColor,h as getFirstDeviationOutputValue,i as getRationale,e as getSideData,o as hasValue,T as highlightClause,s as isMissingStr,b as mixHexColors,m as recursivelyFindSubSectionIdxById,B as resetClauseHighlight,n as safeStringify,C as scrollAndHighlightClause,d as smoothScrollTo};
1
+ import{DEFAULT_DEVIAION_COLOR as t}from"./CognitiveCompareConstants.js";var n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},e=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return e(t)}))},o=function(t,e,o){var i,r=o[e],u=null===(i=null==t?void 0:t.comparison_inputs)||void 0===i?void 0:i[r];return{title:n((null==u?void 0:u.title)||""),content:n((null==u?void 0:u.content)||""),change_history:n((null==u?void 0:u.change_history)||""),attributes:(null==u?void 0:u.additional_attributes)||null,subsections:(null==u?void 0:u.subsections)||[]}},i=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=t.mapping_rationale,e=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:e,citations:n.citations},score:0,relation:"N/A"}};function r(t){var n=function(t,n){var e=function(t){var n=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),e=parseInt(n,16);return{r:e>>16&255,g:e>>8&255,b:255&e}}(t),o=e.r,i=e.g,r=e.b;return function(t,n,e){return"#"+[t,n,e].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(o+(255-o)*n),Math.round(i+(255-i)*n),Math.round(r+(255-r)*n))};return{bg:n(t,.8),border:n(t,.5),badgeBg:n(t,.8),badgeBorder:n(t,.5),badgeText:t.toUpperCase(),highlightBg:n(t,.8)}}function u(t,n){var e;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var r=this;clearTimeout(e),e=setTimeout(function(){return t.apply(r,o)},n)}}var l=function(t,n){var e,o,i,r,u,l;if(t.content!==n.content)return!1;if(t.overlayContent!==n.overlayContent)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;if(t.suppressHighlightBg!==n.suppressHighlightBg)return!1;if(t.collisionKey!==n.collisionKey)return!1;var a=t.highlights||[],s=n.highlights||[];if(a.length!==s.length)return!1;for(var v=0;v<a.length;v++)if(a[v]!==s[v])return!1;var c=t.deviationBadges||[],d=n.deviationBadges||[];if(c.length!==d.length)return!1;for(v=0;v<c.length;v++){if(c[v].id!==d[v].id)return!1;if(c[v].actionId!==d[v].actionId)return!1;if(c[v].label!==d[v].label)return!1;if(c[v].score!==d[v].score)return!1;if(c[v].isOrphan!==d[v].isOrphan)return!1;if(c[v].isConnected!==d[v].isConnected)return!1;if((null===(e=c[v].style)||void 0===e?void 0:e.badgeBg)!==(null===(o=d[v].style)||void 0===o?void 0:o.badgeBg))return!1;if((null===(i=c[v].style)||void 0===i?void 0:i.badgeBorder)!==(null===(r=d[v].style)||void 0===r?void 0:r.badgeBorder))return!1;if((null===(u=c[v].style)||void 0===u?void 0:u.badgeText)!==(null===(l=d[v].style)||void 0===l?void 0:l.badgeText))return!1}return!0},a="::",s=function(t){if(!t)return!0;var n=t.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},v=function(t){var n;if("string"!=typeof t||!t)return!1;for(var e=/<(updated|deleted|changed|change)\b[^>]*>([\s\S]*?)<\/\1>/gi,o=null;null!==(o=e.exec(t));){if((null!==(n=o[2])&&void 0!==n?n:"").replace(/<[^>]*>/g,"").trim().length>0)return!0}return!1},c=function(t){return"string"==typeof t&&t?t.replace(/<\/?(updated|deleted|changed|change)\b[^>]*>/gi,""):""},d=function(t,n){var e,o,i,r,u,l,a;if(!t)return n;var s=null!==(l=null!==(r=null!==(o=null===(e=t.evaluation_output)||void 0===e?void 0:e.output_score)&&void 0!==o?o:null===(i=t.evaluation_outputs)||void 0===i?void 0:i.output_score)&&void 0!==r?r:null===(u=t.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==l?l:t.output_score;return null!==(a=null!=s?s:n)&&void 0!==a?a:""},f=function(t,n,e,o,i){void 0===i&&(i=14);var r=t+.5*(e-t),u=o-n;if(Math.abs(u)<3)return"M ".concat(t," ").concat(n," H ").concat(e);var l=u>0?1:-1,a=Math.min(i,Math.abs(u)/2,Math.abs(r-t)/2,Math.abs(e-r)/2);return["M ".concat(t," ").concat(n),"H ".concat(r-a),"Q ".concat(r," ").concat(n," ").concat(r," ").concat(n+l*a),"V ".concat(o-l*a),"Q ".concat(r," ").concat(o," ").concat(r+a," ").concat(o),"H ".concat(e)].join(" ")},g=function(t,n,e,o,i){void 0===e&&(e=300);var r=t.style.scrollBehavior;t.style.scrollBehavior="auto";var u=t.scrollTop,l=n-u,a=null,s=function(v){null===a&&(a=v);var c,d=v-a;d<e?(t.scrollTop=(c=d,c/=e,l*(--c*c*c+1)+u),i&&i(),requestAnimationFrame(s)):(t.scrollTop=n,t.style.scrollBehavior=r,i&&i(),o&&o())};requestAnimationFrame(s)},p=["#B91C1C","#A16207","#1D4ED8","#000000"],h=function(t){var n=p.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?p.length:n},b=function(n){for(var e,o,i,r,u,l,a,s,v,c,d,f,g,p=[],b=0,m=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});b<m.length;b++){var y=m[b];(C=null===(r=null===(i=null===(o=null===(e=null==n?void 0:n.deviations)||void 0===e?void 0:e[y])||void 0===o?void 0:o.evaluation_outputs)||void 0===i?void 0:i.metadata)||void 0===r?void 0:r.label_color)&&p.push(C)}for(var _=0,B=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});_<B.length;_++){y=B[_];(C=null===(s=null===(a=null===(l=null===(u=null==n?void 0:n.deviation_entries)||void 0===u?void 0:u[y])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===s?void 0:s.label_color)&&p.push(C)}for(var T=0,x=Object.keys(n||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});T<x.length;T++){var C;y=x[T];(C=null===(d=null===(c=null===(v=null==n?void 0:n[y])||void 0===v?void 0:v.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===d?void 0:d.label_color)&&p.push(C)}return 0===p.length?(null===(g=null===(f=null==n?void 0:n.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)?n.evaluation_outputs.metadata.label_color:t:p.sort(function(t,n){return h(t)-h(n)})[0]},m=function(t){for(var n,e,o,i,r,u,l,a,s,v=0,c=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});v<c.length;v++){var d=c[v];if(b=null===(o=null===(e=null===(n=null==t?void 0:t.deviations)||void 0===n?void 0:n[d])||void 0===e?void 0:e.evaluation_outputs)||void 0===o?void 0:o.output_value)return b}for(var f=0,g=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});f<g.length;f++){d=g[f];if(b=null===(u=null===(r=null===(i=null==t?void 0:t.deviation_entries)||void 0===i?void 0:i[d])||void 0===r?void 0:r.evaluation_outputs)||void 0===u?void 0:u.output_value)return b}for(var p=0,h=Object.keys(t||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});p<h.length;p++){var b;d=h[p];if(b=null===(a=null===(l=null==t?void 0:t[d])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(s=null==t?void 0:t.evaluation_outputs)||void 0===s?void 0:s.output_value)?t.evaluation_outputs.output_value:null},y=function(t,n){var e=function(t){var n=t.replace("#","");return[parseInt(n.substring(0,2),16),parseInt(n.substring(2,4),16),parseInt(n.substring(4,6),16)]},o=function(t){var n=Math.round(t).toString(16);return 1===n.length?"0"+n:n};try{var i=e(t),r=e(n),u=(i[0]+r[0])/2*.95,l=(i[1]+r[1])/2*.95,a=(i[2]+r[2])/2*.95;return"#".concat(o(u)).concat(o(l)).concat(o(a))}catch(t){return"#FDE68A"}},_=function(t,n,e){if(!t)return null;if(t.id===e)return n;if(!Array.isArray(t.subsections))return null;for(var o=0;o<t.subsections.length;o++){var i=_(t.subsections[o],"".concat(n,"-").concat(o),e);if(i)return i}return null},B=function(t,n){for(var e=0;e<t.length;e++){var o=_(t[e],String(e),n);if(o)return o}return null},T=new WeakMap,x=function(t){if(t){var n=T.get(t);null!=n&&(clearTimeout(n),T.delete(t)),t.style.transition="box-shadow 300ms ease-out, outline 300ms ease-out",requestAnimationFrame(function(){t.style.outline="",t.style.boxShadow=""}),window.setTimeout(function(){t.style.transition="",t.style.borderRadius=""},300)}},C=function(t){if(t){var n=T.get(t);null!=n&&clearTimeout(n),t.style.transition="box-shadow 300ms ease-in-out, outline 300ms ease-in-out",t.style.outline="2px solid #ff9494",t.style.borderRadius="6px",t.style.boxShadow="0 0 12px 2px rgba(244, 113, 113, 0.33)";var e=window.setTimeout(function(){x(t)},3e3);T.set(t,e)}},A=function(t,n){var e=n.getBoundingClientRect(),o=t.getBoundingClientRect(),i=n.scrollTop+o.top-e.top-e.height/2+o.height/2;n.scrollTo({top:i,behavior:"smooth"});var r=function(){return C(t)};if("onscrollend"in n)n.addEventListener("scrollend",r,{once:!0});else{var u=n.scrollTop,l=function(){n.scrollTop===u?r():(u=n.scrollTop,requestAnimationFrame(l))};requestAnimationFrame(l)}};export{a as DEVIATION_BADGE_SEPARATOR,l as areMarkdownPropsEqual,u as debounce,d as extractDeviationScore,B as findKeyPathByNodeId,r as generateColorPalette,f as getBentArrowPath,b as getFirstDeviationColor,m as getFirstDeviationOutputValue,i as getRationale,o as getSideData,v as hasMeaningfulRedlineTags,e as hasValue,C as highlightClause,s as isMissingStr,y as mixHexColors,_ as recursivelyFindSubSectionIdxById,x as resetClauseHighlight,n as safeStringify,A as scrollAndHighlightClause,g as smoothScrollTo,c as stripRedlineTags};
2
2
  //# sourceMappingURL=CognitiveComparehelpers.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{Popper as i,Paper as o,Box as r,Typography as l,IconButton as a,Accordion as d,AccordionSummary as c,AccordionDetails as s}from"@mui/material";import{Info as p,X as u,ChevronDown as f}from"lucide-react";import{useRef as m,useState as h,useMemo as x,useEffect as g}from"react";function v(v){var b,y,w,S=v.open,C=v.anchorEl,I=v.containerEl,z=v.clipTopEl,B=v.scrollContainerEl,R=v.onClose,F=v.summary;v.markdownStyles,v.isLoading;var W=v.displayImpact,E=m(null),H=m(null),k=h(null),A=k[0],_=k[1],L=h(null),M=L[0],P=L[1],O=h(null);O[0];var T=O[1],N=h(0),j=N[0],J=N[1],q="string"==typeof F?{deviation_summary:F}:null!=F?F:{},D=q.deviation_title,G=q.deviation_summary,V=q.deviation_impact,Y=q.evaluation_outputs,Z=!!String(V||"").trim(),K=(null===(b=null==Y?void 0:Y.metadata)||void 0===b?void 0:b.label_color)||"#6366F1",Q=null!==(y=null==I?void 0:I.getBoundingClientRect().width)&&void 0!==y?y:180,U=Math.max(148,Q+120),X=x(function(){if(!C||!I)return null;var e=C.getBoundingClientRect();if(0===e.width&&0===e.height)return null;var t=I.getBoundingClientRect();return{top:e.top,bottom:e.bottom,left:t.left+t.width/2}},[C,I]);g(function(){if(!S||!C||!I)return _(null),P(null),void T(null);var e=function(){null!==E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(function(){var e,t,n=C.getBoundingClientRect(),i=null==z?void 0:z.getBoundingClientRect(),o=null==B?void 0:B.getBoundingClientRect();if(0===n.width&&0===n.height)_(null);else{var r=I.getBoundingClientRect();_({top:n.top,bottom:n.bottom,left:r.left+r.width/2})}P(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null),T(null!==(t=null==o?void 0:o.bottom)&&void 0!==t?t:null),H.current&&J(H.current.offsetHeight)})};return e(),window.addEventListener("scroll",e,{passive:!0,capture:!0}),window.addEventListener("resize",e),function(){null!==E.current&&cancelAnimationFrame(E.current),window.removeEventListener("scroll",e,{capture:!0}),window.removeEventListener("resize",e)}},[S,C,I,z,B]);var $=null!==(w=null!=A?A:X)&&void 0!==w?w:"hidden",ee="hidden"===$?"hidden":$.bottom+20,te=null!=M&&"number"==typeof ee&&ee<M?Math.min(j,M-ee):0,ne=x(function(){return"hidden"===$?{getBoundingClientRect:function(){return{width:0,height:0,top:0,bottom:0,left:0,right:0,x:0,y:0,toJSON:function(){}}}}:{getBoundingClientRect:function(){return{width:0,height:$.bottom-$.top,top:$.top,bottom:$.bottom,left:$.left,right:$.left,x:$.left,y:$.top,toJSON:function(){}}}}},[$]);return F?t(i,e({open:S,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:ne,placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}},{name:"preventOverflow",enabled:!0,options:{boundary:B||"clippingParents",tether:!1}},{name:"flip",enabled:!0,options:{boundary:B||"clippingParents",fallbackPlacements:["top"]}}],sx:{zIndex:21,visibility:"hidden"===$?"hidden":"visible",opacity:"hidden"===$?0:1,transition:"opacity 0.15s ease-in-out"}},{children:n(o,e({ref:H,sx:e(e({p:1.5,borderRadius:"12px",width:U,maxWidth:U},te>0&&{clipPath:"inset(".concat(te,"px 0px 0px 0px round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(K,"26"),borderTop:"3px solid ".concat(K),overflow:"hidden",bgcolor:"#fff"})},{children:[n(r,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[n(r,e({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[t(p,{size:14,color:K}),t(l,e({sx:{fontSize:"11px",fontWeight:700,color:K,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),t(a,e({size:"small",onClick:R,sx:{p:.25,ml:.5,color:"#64748B"}},{children:t(u,{size:14})}))]})),n(r,e({sx:{display:"flex",flexDirection:"column",gap:1.5,maxHeight:"300px",overflowY:"auto",pr:.5}},{children:[n(r,{children:[D&&t(l,e({sx:{fontSize:"12px",color:"#334155",fontFamily:'"Inter", sans-serif',lineHeight:1.6,fontWeight:700,overflowWrap:"anywhere"}},{children:D})),t(l,e({sx:{fontSize:"11px",color:"#334155",lineHeight:1.6,fontFamily:'"Inter", sans-serif',fontWeight:400,overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:G||"No summary available."}))]}),Z&&n(d,e({expanded:W,disableGutters:!0,elevation:0,sx:{backgroundColor:"".concat(K,"0A"),border:"1px solid ".concat(K,"33"),borderRadius:"4px",fontFamily:'"Inter", sans-serif',overflow:"hidden",flexShrink:0,"&:before":{display:"none"},"&.Mui-expanded":{margin:0}}},{children:[t(c,e({expandIcon:t(f,{size:16,color:K}),sx:{minHeight:"10px",px:1.5,"& .MuiAccordionSummary-content":{py:"5px",my:0},"&.Mui-expanded":{minHeight:"10px",borderBottom:"1px solid ".concat(K,"1A")}}},{children:t(l,e({sx:{fontSize:"11px",fontWeight:700,color:K,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.5px"}},{children:"Impact"}))})),t(s,e({sx:{p:1.5,backgroundColor:"#fff"}},{children:t(l,e({sx:{fontSize:"11px",color:"#475569",lineHeight:1.6,fontWeight:400,fontFamily:'"Inter", sans-serif',overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:String(V).replace("Impact -","").trim()}))}))]}))]}))]}))})):null}export{v as default};
1
+ import{__assign as e}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import{Popper as i,Paper as o,Box as r,Typography as l,IconButton as a,Accordion as d,AccordionSummary as c,AccordionDetails as s}from"@mui/material";import{Info as p,X as u,ChevronDown as f}from"lucide-react";import{useRef as m,useState as h,useEffect as x,useMemo as g}from"react";function v(v){var b,y,w,S=v.open,C=v.anchorEl,I=v.containerEl,z=v.clipTopEl,B=v.scrollContainerEl,R=v.onClose,F=v.summary;v.markdownStyles,v.isLoading;var W=v.displayImpact,E=m(null),H=m(null),k=h(null),A=k[0],_=k[1],L=h(null),M=L[0],P=L[1],O=h(null);O[0];var T=O[1],N=h(0),j=N[0],J=N[1],q="string"==typeof F?{deviation_summary:F}:null!=F?F:{},D=q.deviation_title,G=q.deviation_summary,V=q.deviation_impact,Y=q.evaluation_outputs,Z=!!String(V||"").trim(),K=h(!!W),Q=K[0],U=K[1];x(function(){Z&&U(!!W)},[W,Z,F]);var X=(null===(b=null==Y?void 0:Y.metadata)||void 0===b?void 0:b.label_color)||"#6366F1",$=null!==(y=null==I?void 0:I.getBoundingClientRect().width)&&void 0!==y?y:180,ee=Math.max(148,$+120),ne=g(function(){if(!C||!I)return null;var e=C.getBoundingClientRect();if(0===e.width&&0===e.height)return null;var n=I.getBoundingClientRect();return{top:e.top,bottom:e.bottom,left:n.left+n.width/2}},[C,I]);x(function(){if(!S||!C||!I)return _(null),P(null),void T(null);var e=function(){null!==E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(function(){var e,n,t=C.getBoundingClientRect(),i=null==z?void 0:z.getBoundingClientRect(),o=null==B?void 0:B.getBoundingClientRect();if(0===t.width&&0===t.height)_(null);else{var r=I.getBoundingClientRect();_({top:t.top,bottom:t.bottom,left:r.left+r.width/2})}P(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null),T(null!==(n=null==o?void 0:o.bottom)&&void 0!==n?n:null),H.current&&J(H.current.offsetHeight)})};return e(),window.addEventListener("scroll",e,{passive:!0,capture:!0}),window.addEventListener("resize",e),function(){null!==E.current&&cancelAnimationFrame(E.current),window.removeEventListener("scroll",e,{capture:!0}),window.removeEventListener("resize",e)}},[S,C,I,z,B]);var te=null!==(w=null!=A?A:ne)&&void 0!==w?w:"hidden",ie="hidden"===te?"hidden":te.bottom+20,oe=null!=M&&"number"==typeof ie&&ie<M?Math.min(j,M-ie):0,re=g(function(){return"hidden"===te?{getBoundingClientRect:function(){return{width:0,height:0,top:0,bottom:0,left:0,right:0,x:0,y:0,toJSON:function(){}}}}:{getBoundingClientRect:function(){return{width:0,height:te.bottom-te.top,top:te.top,bottom:te.bottom,left:te.left,right:te.left,x:te.left,y:te.top,toJSON:function(){}}}}},[te]);return F?n(i,e({open:S,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:re,placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}},{name:"preventOverflow",enabled:!0,options:{boundary:B||"clippingParents",tether:!1}},{name:"flip",enabled:!0,options:{boundary:B||"clippingParents",fallbackPlacements:["top"]}}],sx:{zIndex:21,visibility:"hidden"===te?"hidden":"visible",opacity:"hidden"===te?0:1,transition:"opacity 0.15s ease-in-out"}},{children:t(o,e({ref:H,sx:e(e({p:1.5,borderRadius:"12px",width:ee,maxWidth:ee},oe>0&&{clipPath:"inset(".concat(oe,"px 0px 0px 0px round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(X,"26"),borderTop:"3px solid ".concat(X),overflow:"hidden",bgcolor:"#fff"})},{children:[t(r,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[t(r,e({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[n(p,{size:14,color:X}),n(l,e({sx:{fontSize:"11px",fontWeight:700,color:X,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),n(a,e({size:"small",onClick:R,sx:{p:.25,ml:.5,color:"#64748B"}},{children:n(u,{size:14})}))]})),t(r,e({sx:{display:"flex",flexDirection:"column",gap:1.5,maxHeight:"300px",overflowY:"auto",pr:.5}},{children:[t(r,{children:[D&&n(l,e({sx:{fontSize:"12px",color:"#334155",fontFamily:'"Inter", sans-serif',lineHeight:1.6,fontWeight:700,overflowWrap:"anywhere"}},{children:D})),n(l,e({sx:{fontSize:"11px",color:"#334155",lineHeight:1.6,fontFamily:'"Inter", sans-serif',fontWeight:400,overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:G||"No summary available."}))]}),Z&&t(d,e({expanded:Q,onChange:function(e,n){return U(n)},disableGutters:!0,elevation:0,sx:{backgroundColor:"".concat(X,"0A"),border:"1px solid ".concat(X,"33"),borderRadius:"4px",fontFamily:'"Inter", sans-serif',overflow:"hidden",flexShrink:0,"&:before":{display:"none"},"&.Mui-expanded":{margin:0}}},{children:[n(c,e({expandIcon:n(f,{size:16,color:X}),sx:{minHeight:"10px",px:1.5,"& .MuiAccordionSummary-content":{py:"5px",my:0},"&.Mui-expanded":{minHeight:"10px",borderBottom:"1px solid ".concat(X,"1A")}}},{children:n(l,e({sx:{fontSize:"11px",fontWeight:700,color:X,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.5px"}},{children:"Impact"}))})),n(s,e({sx:{p:1.5,backgroundColor:"#fff"}},{children:n(l,e({sx:{fontSize:"11px",color:"#475569",lineHeight:1.6,fontWeight:400,fontFamily:'"Inter", sans-serif',overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:String(V).replace("Impact -","").trim()}))}))]}))]}))]}))})):null}export{v as default};
2
2
  //# sourceMappingURL=CognitiveSummaryPopup.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as n}from"tslib";import{jsxs as i,jsx as e}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as v,ChevronDown as s}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{hasValue as p,generateColorPalette as h,isMissingStr as x,safeStringify as m,DEVIATION_BADGE_SEPARATOR as g}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as I}from"../CognitiveCompareConstants.js";var b=function(b){var y,w,_,F,R,S,k,C,B,M,A,O,W,N=b.section,T=b.idx,j=b.columnKey,E=b.colRef,K=b.mb,P=void 0===K?1:K,D=b.parentNodeId,z=void 0===D?"":D,V=b.isExpanded,G=b.onToggle,X=b.navigation,Y=b.showOpenNodeRef,H=b.resolvedMarkdownStyles,q=b.maintainRelativeOrder,J=b.showDeviationBadges,L=void 0!==J&&J,Q=b.renderSubSections,U=b.treeData,Z=b.proposedSections,$=void 0===Z?[]:Z,nn=b.existingSections,en=void 0===nn?[]:nn,on=b.deviationNumberRegistry,tn=void 0===on?{}:on,ln=b.getBadgeRef,dn=b.openSummaryPopup,rn=b.getSectionCompareStyle,an=b.connectedSections,un=b.openMoreFunctionsPopup;b.deviationNodeIdToView,b.deviationTargetParentId;var cn=b.isProposingFix,vn=b.proposingFixNodeId,sn=b.collisionKey,fn=(null===(y=N.displayTitle)||void 0===y||y)&&p(N.title),pn=N.change_history,hn=!!cn&&!!vn&&"left"===j&&N.id===vn&&p(pn),xn=hn?pn||"":N.content,mn=hn?N.content:void 0,gn=(null===(w=N.displayContent)||void 0===w||w)&&p(xn),In=!fn&&!gn,bn=N.title;fn||(bn=gn?"No Title Found":"No Matching Section Found");var yn=N.evaluationResult;if(!yn&&"right"===j)if(q){var wn=null===(_=N.refIndexes)||void 0===_?void 0:_[0],_n=$.find(function(n){return n.selfIndex===wn});yn=null==_n?void 0:_n.evaluationResult}else yn=null===(F=$[T])||void 0===F?void 0:F.evaluationResult;var Fn=null===(R=null==U?void 0:U.input_index_map)||void 0===R?void 0:R[0],Rn=null===(S=null==U?void 0:U.input_index_map)||void 0===S?void 0:S[1],Sn="left"===j?Rn:Fn,kn=function(n,i){return n.find(function(n){return(null==n?void 0:n.id)&&i&&n.id===i})},Cn="left"===j?N:$[T],Bn="right"===j?N:en[T],Mn=o.useMemo(function(){if(!q)return 0;var n=1/0,i=function(e,o,t,l){var d;if(e){var r=e.id;if(l&&"right"===j){var a=$.filter(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(e.selfIndex)});a.length>0&&(r=a[0].id)}var u=e.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),c=(null===(d=e.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(c).forEach(function(i){var e="".concat(r).concat(g).concat(i),o=null==tn?void 0:tn[e];null!=o&&o<n&&(n=o);var t="".concat(u).concat(g).concat(i),l=null==tn?void 0:tn[t];null!=l&&l<n&&(n=l)});for(var v=e.subsections||[],s=(null==o?void 0:o.subsections)||[],f=(null==t?void 0:t.subsections)||[],p=Math.max(v.length,s.length,f.length),h=0;h<p;h++)i(v[h],s[h],f[h],!1)}};return i(N,Cn,Bn,!0),n!==1/0?n-1:0},[N,Cn,Bn,j,tn,q,$]);if(q)if("left"===j){var An=null===(k=N.refIndexes)||void 0===k?void 0:k[0],On=en.findIndex(function(n){return n.selfIndex===An});Bn=-1!==On?en[On]:kn(en,N.id)}else{var Wn=null===(C=N.refIndexes)||void 0===C?void 0:C[0],Nn=$.findIndex(function(n){return n.selfIndex===Wn});Cn=-1!==Nn?$[Nn]:kn($,N.id)}var Tn="left"===j?!Bn:!Cn,jn=yn||(null==Cn?void 0:Cn.evaluationResult)||(null==Bn?void 0:Bn.evaluationResult),En=null!==(A=null===(M=null===(B=null==jn?void 0:jn.evaluation_outputs)||void 0===B?void 0:B.metadata)||void 0===M?void 0:M.label_color)&&void 0!==A?A:I,Kn=h(En).highlightBg,Pn=(null==jn?void 0:jn.deviations)||{},Dn=T+1,zn=N.id;if(q){var Vn=1,Gn=new Map;if($.forEach(function(n){!n.title&&!n.content||n.id&&Gn.set(n.id,Vn++)}),"left"===j)Dn=Gn.get(N.id)||T+1;else{var Xn=$.filter(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(N.selfIndex)});if(Xn.length>0)Dn=Gn.get(Xn[0].id)||T+1,zn=Xn[0].id;else for(var Yn=Vn,Hn=function(n){if(!n.title&&!n.content)return"continue";var i=$.some(function(i){var e;return null===(e=i.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});if(!i){if(n.id===N.id)return Dn=Yn,"break";Yn++}},qn=0,Jn=en;qn<Jn.length;qn++){if("break"===Hn(Jn[qn]))break}}}var Ln=[],Qn=Object.entries(Pn).map(function(n){var i=n[0],e=n[1],o="".concat(zn).concat(g).concat(i);return{deviationKey:i,deviationMap:e,refId:o,currentIndex:tn[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});Qn.sort(function(n,i){return n.currentIndex-i.currentIndex});var Un,Zn=Qn.map(function(i){var e,o,t,l,d,r,a=i.deviationKey,u=i.deviationMap,c=i.refId,v=i.currentIndex;q&&void 0!==Mn&&(v-=Mn);var s=u[z],f=x(s);if(f)s="";else if(!s)return null;Ln.push(s);var p=T,m=T;if(q)if("left"===j){var I=null===(e=N.refIndexes)||void 0===e?void 0:e[0],b=en.findIndex(function(n){return n.selfIndex===I});if(-1!==b)m=b;else{var y=en.findIndex(function(n){return n.id===N.id});m=-1!==y?y:T}}else{var w=null===(o=N.refIndexes)||void 0===o?void 0:o[0],_=$.findIndex(function(n){return n.selfIndex===w});if(-1!==_)p=_;else{var F=$.findIndex(function(n){return n.id===N.id});p=-1!==F?F:T}}var R="".concat(zn).concat(g).concat(a).concat(g).concat(p).concat(g).concat(m),S=u[Sn],k=Tn||x(S),C="".concat(Dn,".").concat(v),B=T;if("right"===j&&q){var M=null===(t=N.refIndexes)||void 0===t?void 0:t[0],A=$.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else{F=$.findIndex(function(n){return n.id===N.id});-1!==F&&(B=F)}}var O=rn?rn(B):null,W=(null==u?void 0:u.evaluation_outputs)||(null==jn?void 0:jn.evaluation_outputs),E=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,K=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:En,P=h(K),D=O?n(n({},O),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n({},P),V=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==jn?void 0:jn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==jn?void 0:jn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==jn?void 0:jn.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==jn?void 0:jn.cognitive_decisioning)}:null,G=0,X=xn||"";if(s&&X){var Y=X.split(/\n{2,}/),H=Y.findIndex(function(n){return n.includes(s)});if(-1!==H){var J=Object.entries(Pn).filter(function(n){n[0];var i=n[1][z];return i&&Y[H].includes(i)}).sort(function(n,i){return Y[H].indexOf(n[1][z])-Y[H].indexOf(i[1][z])});G=Math.max(0,J.findIndex(function(n){return n[0]===a}))}}return{id:c,actionId:R,label:C,highlight:s,side:j,style:D,stackIndex:G,score:E,isConnected:null==an?void 0:an.has(R),isOrphan:k,isMissingClause:f,badgeRef:ln(j,c),onClick:function(n){n.stopPropagation(),un&&un(n,Cn||{id:"orphan-left",title:"",content:""},k,Bn||{id:"orphan-right",title:"",content:""},R,D)},onSummaryClick:function(n){n.stopPropagation(),dn(n,R,k,V)}}}).filter(Boolean),$n=L?Zn:[],ni=N.id&&j===(null==X?void 0:X.columnKey)?X:null,ii=o.useRef(!1);return t(function(){V||(ii.current=!1)},[V]),i(l,n({ref:E,sx:{mb:P,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[V&&(null==ni?void 0:ni.showAbove)&&e("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,i;return null===(i=null===(n=null==ni?void 0:ni.showAboveRef)||void 0===n?void 0:n.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===j?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===j?{right:"0px"}:{left:"0px"})},{children:e(v,{color:(null===(O=null==ni?void 0:ni.showAboveRef)||void 0===O?void 0:O.current)?window.getComputedStyle(ni.showAboveRef.current).color:void 0})}))})),i(d,n({disableGutters:!0,expanded:!In&&V,onChange:function(){In||(G(),Y.current=N.id)},sx:{boxShadow:"none",border:In?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:In?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[e(r,n({expandIcon:In?null:e(s,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:In?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:fn&&e(a,n({title:bn,placement:"top"},{children:e(u,n({component:"div",sx:{fontSize:"12px",color:In?"#94A3B8":"#19213D",fontWeight:In?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Un=bn,Un?m(Un).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(n,i){return n.startsWith("**")&&n.endsWith("**")?e("strong",{children:n.slice(2,-2)},i):e(o.Fragment,{children:n},i)}):null)}))}))})),!In&&i(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[gn&&e(f,{content:xn,overlayContent:mn,sxStyles:H,highlights:Ln,maintainRelativeOrder:q,highlightBg:Kn,deviationBadges:$n,collisionKey:sn}),(N.subsections||[]).map(function(n,i){return Q({section:n,keyPath:"".concat(T,"-").concat(i),depth:0,columnKey:j,parentNodeId:z,sectionOffset:Mn})})]}))]})),V&&(null==ni?void 0:ni.showBelow)&&e("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,i;return null===(i=null===(n=null==ni?void 0:ni.showBelowRef)||void 0===n?void 0:n.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===j?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===j?{right:"0px"}:{left:"0px"})},{children:e(s,{color:(null===(W=null==ni?void 0:ni.showBelowRef)||void 0===W?void 0:W.current)?window.getComputedStyle(ni.showBelowRef.current).color:void 0})}))}))]}),"".concat(j,"-sec-").concat(T))};export{b as default};
1
+ import{__assign as n}from"tslib";import{jsxs as i,jsx as e}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{hasValue as p,hasMeaningfulRedlineTags as h,stripRedlineTags as x,generateColorPalette as m,isMissingStr as g,safeStringify as I,DEVIATION_BADGE_SEPARATOR as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as y}from"../CognitiveCompareConstants.js";var w=function(w){var _,F,R,S,k,B,C,M,A,O,W,N,T,j=w.section,E=w.idx,K=w.columnKey,P=w.colRef,D=w.mb,z=void 0===D?1:D,V=w.parentNodeId,G=void 0===V?"":V,H=w.isExpanded,X=w.onToggle,Y=w.navigation,q=w.showOpenNodeRef,J=w.resolvedMarkdownStyles,L=w.maintainRelativeOrder,Q=w.showDeviationBadges,U=void 0!==Q&&Q,Z=w.renderSubSections,$=w.treeData,nn=w.proposedSections,en=void 0===nn?[]:nn,on=w.existingSections,tn=void 0===on?[]:on,ln=w.deviationNumberRegistry,dn=void 0===ln?{}:ln,rn=w.getBadgeRef,an=w.openSummaryPopup,un=w.getSectionCompareStyle,cn=w.connectedSections,sn=w.openMoreFunctionsPopup;w.deviationNodeIdToView,w.deviationTargetParentId;var vn=w.isProposingFix,fn=w.proposingFixNodeId,pn=w.isRedlineFlow,hn=w.collisionKey,xn=(null===(_=j.displayTitle)||void 0===_||_)&&p(j.title),mn=!!vn&&!!fn&&"left"===K&&j.id===fn,gn=h(j.content),In="boolean"==typeof pn?pn:gn,bn=gn,yn=In&&gn,wn=yn?x(j.content):j.content,_n=yn?j.content:void 0,Fn=(null===(F=j.displayContent)||void 0===F||F)&&p(wn),Rn=!xn&&!Fn,Sn=j.title;xn||(Sn=Fn?"No Title Found":"No Matching Section Found");var kn=j.evaluationResult;if(!kn&&"right"===K)if(L){var Bn=null===(R=j.refIndexes)||void 0===R?void 0:R[0],Cn=en.find(function(n){return n.selfIndex===Bn});kn=null==Cn?void 0:Cn.evaluationResult}else kn=null===(S=en[E])||void 0===S?void 0:S.evaluationResult;var Mn=null===(k=null==$?void 0:$.input_index_map)||void 0===k?void 0:k[0],An=null===(B=null==$?void 0:$.input_index_map)||void 0===B?void 0:B[1],On="left"===K?An:Mn,Wn=function(n,i){return n.find(function(n){return(null==n?void 0:n.id)&&i&&n.id===i})},Nn="left"===K?j:en[E],Tn="right"===K?j:tn[E],jn=o.useMemo(function(){if(!L)return 0;var n=1/0,i=function(e,o,t,l){var d;if(e){var r=e.id;if(l&&"right"===K){var a=en.filter(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(e.selfIndex)});a.length>0&&(r=a[0].id)}var u=e.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),c=(null===(d=e.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(c).forEach(function(i){var e="".concat(r).concat(b).concat(i),o=null==dn?void 0:dn[e];null!=o&&o<n&&(n=o);var t="".concat(u).concat(b).concat(i),l=null==dn?void 0:dn[t];null!=l&&l<n&&(n=l)});for(var s=e.subsections||[],v=(null==o?void 0:o.subsections)||[],f=(null==t?void 0:t.subsections)||[],p=Math.max(s.length,v.length,f.length),h=0;h<p;h++)i(s[h],v[h],f[h],!1)}};return i(j,Nn,Tn,!0),n!==1/0?n-1:0},[j,Nn,Tn,K,dn,L,en]);if(L)if("left"===K){var En=null===(C=j.refIndexes)||void 0===C?void 0:C[0],Kn=tn.findIndex(function(n){return n.selfIndex===En});Tn=-1!==Kn?tn[Kn]:Wn(tn,j.id)}else{var Pn=null===(M=j.refIndexes)||void 0===M?void 0:M[0],Dn=en.findIndex(function(n){return n.selfIndex===Pn});Nn=-1!==Dn?en[Dn]:Wn(en,j.id)}var zn="left"===K?!Tn:!Nn,Vn=kn||(null==Nn?void 0:Nn.evaluationResult)||(null==Tn?void 0:Tn.evaluationResult),Gn=null!==(W=null===(O=null===(A=null==Vn?void 0:Vn.evaluation_outputs)||void 0===A?void 0:A.metadata)||void 0===O?void 0:O.label_color)&&void 0!==W?W:y,Hn=m(Gn).highlightBg,Xn=(null==Vn?void 0:Vn.deviations)||{},Yn=E+1,qn=j.id;if(L){var Jn=1,Ln=new Map;if(en.forEach(function(n){!n.title&&!n.content||n.id&&Ln.set(n.id,Jn++)}),"left"===K)Yn=Ln.get(j.id)||E+1;else{var Qn=en.filter(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(j.selfIndex)});if(Qn.length>0)Yn=Ln.get(Qn[0].id)||E+1,qn=Qn[0].id;else for(var Un=Jn,Zn=function(n){if(!n.title&&!n.content)return"continue";var i=en.some(function(i){var e;return null===(e=i.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});if(!i){if(n.id===j.id)return Yn=Un,"break";Un++}},$n=0,ni=tn;$n<ni.length;$n++){if("break"===Zn(ni[$n]))break}}}var ii=Object.entries(Xn).map(function(n){var i=n[0],e=n[1],o="".concat(qn).concat(b).concat(i);return{deviationKey:i,deviationMap:e,refId:o,currentIndex:dn[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});ii.sort(function(n,i){return n.currentIndex-i.currentIndex});var ei,oi=ii.map(function(i){var e,o,t,l,d,r,a=i.deviationKey,u=i.deviationMap,c=i.refId,s=i.currentIndex;L&&void 0!==jn&&(s-=jn);var v=u[G],f=g(v);if(f)v="";else if(!v)return null;var p=E,h=E;if(L)if("left"===K){var x=null===(e=j.refIndexes)||void 0===e?void 0:e[0],I=tn.findIndex(function(n){return n.selfIndex===x});if(-1!==I)h=I;else{var y=tn.findIndex(function(n){return n.id===j.id});h=-1!==y?y:E}}else{var w=null===(o=j.refIndexes)||void 0===o?void 0:o[0],_=en.findIndex(function(n){return n.selfIndex===w});if(-1!==_)p=_;else{var F=en.findIndex(function(n){return n.id===j.id});p=-1!==F?F:E}}var R="".concat(qn).concat(b).concat(a).concat(b).concat(p).concat(b).concat(h),S=u[On],k=zn||g(S),B="".concat(Yn,".").concat(s),C=E;if("right"===K&&L){var M=null===(t=j.refIndexes)||void 0===t?void 0:t[0],A=en.findIndex(function(n){return n.selfIndex===M});if(-1!==A)C=A;else{F=en.findIndex(function(n){return n.id===j.id});-1!==F&&(C=F)}}var O=un?un(C):null,W=(null==u?void 0:u.evaluation_outputs)||(null==Vn?void 0:Vn.evaluation_outputs),N=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,T=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:Gn,P=m(T),D=O?n(n({},O),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n({},P),z=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Vn?void 0:Vn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Vn?void 0:Vn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Vn?void 0:Vn.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Vn?void 0:Vn.cognitive_decisioning)}:null,V=0,H=wn||"";if(v&&H){var X=H.split(/\n{2,}/),Y=X.findIndex(function(n){return n.includes(v)});if(-1!==Y){var q=Object.entries(Xn).filter(function(n){n[0];var i=n[1][G];return i&&X[Y].includes(i)}).sort(function(n,i){return X[Y].indexOf(n[1][G])-X[Y].indexOf(i[1][G])}),J=q.filter(function(n){n[0];var i=n[1][G];return i&&(i.includes(v)||v.includes(i))});J.length>1&&(V=Math.max(0,J.findIndex(function(n){return n[0]===a})))}}return{id:c,actionId:R,label:B,highlight:v,side:K,style:D,stackIndex:V,score:N,isConnected:null==cn?void 0:cn.has(R),isOrphan:k,isMissingClause:f,badgeRef:rn(K,c),onClick:function(n){n.stopPropagation(),sn&&sn(n,Nn||{id:"orphan-left",title:"",content:""},k,Tn||{id:"orphan-right",title:"",content:""},R,D)},onSummaryClick:function(n){n.stopPropagation(),an(n,R,k,z)}}}).filter(Boolean),ti=U||!In&&mn,li=ti?oi:[],di=ti?li.map(function(n){return n.highlight}).filter(Boolean):[],ri=j.id&&K===(null==Y?void 0:Y.columnKey)?Y:null,ai=o.useRef(!1);return t(function(){H||(ai.current=!1)},[H]),i(l,n({ref:P,sx:{mb:z,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[H&&(null==ri?void 0:ri.showAbove)&&e("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,i;return null===(i=null===(n=null==ri?void 0:ri.showAboveRef)||void 0===n?void 0:n.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===K?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===K?{right:"0px"}:{left:"0px"})},{children:e(s,{color:(null===(N=null==ri?void 0:ri.showAboveRef)||void 0===N?void 0:N.current)?window.getComputedStyle(ri.showAboveRef.current).color:void 0})}))})),i(d,n({disableGutters:!0,expanded:!Rn&&H,onChange:function(){Rn||(X(),q.current=j.id)},sx:{boxShadow:"none",border:Rn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Rn?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[e(r,n({expandIcon:Rn?null:e(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Rn?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:xn&&e(a,n({title:Sn,placement:"top"},{children:e(u,n({component:"div",sx:{fontSize:"12px",color:Rn?"#94A3B8":"#19213D",fontWeight:Rn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ei=Sn,ei?I(ei).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(n,i){return n.startsWith("**")&&n.endsWith("**")?e("strong",{children:n.slice(2,-2)},i):e(o.Fragment,{children:n},i)}):null)}))}))})),!Rn&&i(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Fn&&e(f,{content:wn,overlayContent:_n,sxStyles:J,highlights:di,maintainRelativeOrder:L,highlightBg:Hn,suppressHighlightBg:bn,deviationBadges:li,collisionKey:hn}),(j.subsections||[]).map(function(n,i){return Z({section:n,keyPath:"".concat(E,"-").concat(i),depth:0,columnKey:K,parentNodeId:G,sectionOffset:jn})})]}))]})),H&&(null==ri?void 0:ri.showBelow)&&e("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,i;return null===(i=null===(n=null==ri?void 0:ri.showBelowRef)||void 0===n?void 0:n.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===K?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===K?{right:"0px"}:{left:"0px"})},{children:e(v,{color:(null===(T=null==ri?void 0:ri.showBelowRef)||void 0===T?void 0:T.current)?window.getComputedStyle(ri.showBelowRef.current).color:void 0})}))}))]}),"".concat(K,"-sec-").concat(E))};export{w as default};
2
2
  //# sourceMappingURL=SectionAccordion.js.map