@viswa-test/test-citation 0.0.165 → 0.0.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/dist/cjs/features/ChatDrawer/ChatDrawer.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/CognitiveSummaryPopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/ChatDrawer/ChatDrawer.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/components/CognitiveSummaryPopup.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/types/src/AutopilotStyle.d.ts +2 -0
- package/dist/types/src/AutopilotStyle.d.ts.map +1 -0
- package/dist/types/src/ChatDrawerTest.d.ts +15 -0
- package/dist/types/src/ChatDrawerTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +2483 -19079
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/ChatDrawer/ChatDrawer.d.ts.map +1 -1
- package/dist/types/src/features/ChatDrawer/types/ChatDrawer.types.d.ts +3 -0
- package/dist/types/src/features/ChatDrawer/types/ChatDrawer.types.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +0 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
- package/package.json +7 -4
|
@@ -1,2 +1,2 @@
|
|
|
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
|
|
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 c,AccordionSummary as d,AccordionDetails as s}from"@mui/material";import{Info as u,X as p,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,w,y,S=v.open,C=v.anchorEl,E=v.containerEl,I=v.clipTopEl,z=v.scrollContainerEl,B=v.onClose,R=v.summary;v.markdownStyles,v.isLoading;var F=v.displayImpact,H=v.isScrollLocked,W=m(null),k=m(null),L=h(null),A=L[0],_=L[1],M=h(null),P=M[0],O=M[1],T=h(null);T[0];var N=T[1],Y=h(0),j=Y[0],J=Y[1],q="string"==typeof R?{deviation_summary:R}:null!=R?R:{},D=h(!1),G=D[0],V=D[1];x(function(){S&&V(!1)},[S]);var Z=q.deviation_title,K=q.deviation_summary,Q=q.deviation_impact,U=q.evaluation_outputs,X=!!String(Q||"").trim(),$=h(!!F),ee=$[0],ne=$[1];x(function(){X&&ne(!!F)},[F,X,R]);var te=(null===(b=null==U?void 0:U.metadata)||void 0===b?void 0:b.label_color)||"#6366F1",ie=null!==(w=null==E?void 0:E.getBoundingClientRect().width)&&void 0!==w?w:180,oe=Math.max(148,ie+120),re=g(function(){if(!C||!E)return null;var e=C.getBoundingClientRect();if(0===e.width&&0===e.height)return null;var n=E.getBoundingClientRect();return{top:e.top,bottom:e.bottom,left:n.left+n.width/2}},[C,E]);x(function(){if(!S||!C||!E)return _(null),O(null),void N(null);var e=function(){null!==W.current&&cancelAnimationFrame(W.current),W.current=requestAnimationFrame(function(){var e,n,t=null==C?void 0:C.getBoundingClientRect(),i=null==I?void 0:I.getBoundingClientRect(),o=null==z?void 0:z.getBoundingClientRect();if(0!==t.width||0!==t.height){var r=E.getBoundingClientRect();_({top:t.top,bottom:t.bottom,left:r.left+r.width/2}),O(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null),N(null!==(n=null==o?void 0:o.bottom)&&void 0!==n?n:null),k.current&&J(k.current.offsetHeight)}})};e();var n=function(e){for(var n=[],t=(null==e?void 0:e.parentElement)||null;t;){var i=window.getComputedStyle(t);("auto"===i.overflowY||"scroll"===i.overflowY)&&t.scrollHeight>t.clientHeight&&n.push(t),t=t.parentElement}return n}(C);return window.addEventListener("scroll",e,{passive:!0,capture:!0}),window.addEventListener("resize",e),n.forEach(function(n){n.addEventListener("scroll",e,{passive:!0})}),function(){null!==W.current&&cancelAnimationFrame(W.current),window.removeEventListener("scroll",e,{capture:!0}),window.removeEventListener("resize",e),n.forEach(function(n){n.removeEventListener("scroll",e)})}},[S,C,E,I,z,H]);var le=null!==(y=null!=A?A:re)&&void 0!==y?y:"hidden",ae="hidden"===le?"hidden":le.bottom+20,ce=null!=P&&"number"==typeof ae&&ae<P?Math.min(j,P-ae):0,de=g(function(){return"hidden"===le?{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:le.bottom-le.top,top:le.top,bottom:le.bottom,left:le.left,right:le.left,x:le.left,y:le.top,toJSON:function(){}}}}},[le]);return R?n(i,e({open:S&&!G,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:de,placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}},{name:"preventOverflow",enabled:!0,options:{boundary:z||"clippingParents",tether:!1}},{name:"flip",enabled:!0,options:{boundary:z||"clippingParents",fallbackPlacements:["top"]}}],sx:{zIndex:21,visibility:"hidden"===le?"hidden":"visible",opacity:"hidden"===le?0:1,transition:"opacity 0.15s ease-in-out"}},{children:t(o,e({ref:k,sx:e(e({p:1.5,borderRadius:"12px",width:oe,maxWidth:oe},ce>0&&{clipPath:"inset(".concat(ce,"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(te,"26"),borderTop:"3px solid ".concat(te),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(u,{size:14,color:te}),n(l,e({sx:{fontSize:"11px",fontWeight:700,color:te,fontFamily:'"Inter", sans-serif',textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),n(a,e({size:"small",onClick:B,sx:{p:.25,ml:.5,color:"#64748B"}},{children:n(p,{size:14})}))]})),t(r,e({sx:{display:"flex",flexDirection:"column",gap:1.5,maxHeight:"300px",overflowY:"auto",pr:.5}},{children:[t(r,{children:[Z&&n(l,e({sx:{fontSize:"12px",color:"#334155",fontFamily:'"Inter", sans-serif',lineHeight:1.6,fontWeight:700,overflowWrap:"anywhere"}},{children:Z})),n(l,e({sx:{fontSize:"11px",color:"#334155",lineHeight:1.6,fontFamily:'"Inter", sans-serif',fontWeight:400,overflowWrap:"anywhere",whiteSpace:"pre-wrap"}},{children:K||"No summary available."}))]}),X&&t(c,e({expanded:ee,onChange:function(e,n){return ne(n)},disableGutters:!0,elevation:0,sx:{backgroundColor:"".concat(te,"0A"),border:"1px solid ".concat(te,"33"),borderRadius:"4px",fontFamily:'"Inter", sans-serif',overflow:"hidden",flexShrink:0,"&:before":{display:"none"},"&.Mui-expanded":{margin:0}}},{children:[n(d,e({expandIcon:n(f,{size:16,color:te}),sx:{minHeight:"10px",px:1.5,"& .MuiAccordionSummary-content":{py:"5px",my:0},"&.Mui-expanded":{minHeight:"10px",borderBottom:"1px solid ".concat(te,"1A")}}},{children:n(l,e({sx:{fontSize:"11px",fontWeight:700,color:te,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(Q).replace("Impact -","").trim()}))}))]}))]}))]}))})):null}export{v as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveSummaryPopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__rest as e}from"tslib";import{jsx as r,jsxs as t,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as l}from"@mui/material";import a,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{safeStringify as g,mixHexColors as f,areMarkdownPropsEqual as v}from"../CognitiveComparehelpers.js";import m from"rehype-raw";import x from"remark-gfm";import b from"../components/ScrollLockToggle.js";var y=a.memo(function(v){var y=v.content,E=v.overlayContent,C=v.sxStyles,k=v.deviationBadges,S=void 0===k?[]:k,F=v.highlights,w=void 0===F?[]:F,B=v.maintainRelativeOrder,A=void 0===B||B,T=v.highlightBg,z=v.suppressHighlightBg,I=void 0!==z&&z,O=v.collisionKey,D=c(null),j=!!E,L=d(function(){return S.reduce(function(e,r){var t;return n(n({},e),((t={})[r.id]=r,t))},{})},[S]),P=function(e,r){return a.Children.map(e,function(e){var t;if(!a.isValidElement(e))return e;var i=(null===(t=e.props)||void 0===t?void 0:t.children)?P(e.props.children,r):e.props.children,o=a.cloneElement(e,n(n({},e.props),{children:i}));return r(o)})},N=d(function(){return{mark:function(t){var i,o,l,a,c=t.children,d=e(t,["children"]),s=d["data-badge-id"],u=s?L[s]:null,h=d["data-highlight-color"],p=null!==(a=null!==(o=null!=h?h:null===(i=null==u?void 0:u.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(l=null==u?void 0:u.style)||void 0===l?void 0:l.badgeBg)&&void 0!==a?a:T,g=d.isSuggestedDeviationFix||I;return r("span",n({style:n(n(n({},g?{}:{backgroundColor:p}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),j?{color:"transparent"}:{})},{children:c}))},span:function(i){var l,a,c,d,s,p,g,f,v=i.children,m=e(i,["children"]),x=m["data-badge-id"];if(!x)return r("span",n({},m,{children:v}));var y=L[x];if(!y)return r("span",n({},m,{children:v}));var E="number"==typeof y.stackIndex?y.stackIndex:0,C="translateY(calc(-20% + ".concat(12*E,"px + var(--badge-nudge, 0px)))");return t(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[t(o,n({ref:y.badgeRef,className:"deviation-badge","data-side":y.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+E,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(l=y.style)||void 0===l?void 0:l.badgeBg)||"#EEF2FF",color:(null===(a=y.style)||void 0===a?void 0:a.badgeText)||u,border:"1px solid ".concat((null===(c=y.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===y.side?{right:"-16px",transform:"".concat(C," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(C," translateX(calc(-100% - 8px))")}),y.isConnected&&y.style&&{outline:"2px solid ".concat(y.style.badgeBorder),outlineOffset:"1px"})},{children:[t(o,n({onClick:function(n){n.stopPropagation(),y.onSummaryClick&&y.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[r(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:y.label})),("left"===y.side||y.isOrphan)&&r(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=y.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=y.score&&"N/A"!==y.score&&"NA"!==y.score&&0!==y.score?"".concat(y.score):"N/A"===y.score||"NA"===y.score?"N/A":"Same"}))]})),("left"===y.side||y.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),y.onClick&&y.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=y.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:[r(h,{size:12,color:(null===(p=y.style)||void 0===p?void 0:p.badgeText)||"#3730A3"}),y.showScrollLockToggle&&r(b,{locked:!!y.scrollSyncLocked,onToggle:y.toggleScrollSyncLocked,color:(null===(g=y.style)||void 0===g?void 0:g.badgeText)||"#3730A3",borderColor:(null===(f=y.style)||void 0===f?void 0:f.badgeBorder)||"#C7D2FE",size:12})]}))]})),v]}))},table:function(e){var t=e.children;return r(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:t}))},thead:function(e){var t=e.children;return r(o,n({component:"thead"},{children:t}))},tbody:function(e){var t=e.children;return r(o,n({component:"tbody"},{children:t}))},tr:function(e){var t=e.children;return r(o,n({component:"tr",sx:{borderBotttom:"1px solid #E5E7EB"}},{children:t}))},th:function(e){var t=e.children;return r(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:t}))},td:function(e){var t=e.children;return r(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:t}))},updated:function(n){var t=n.children;return e(n,["children"]),r(i,{children:t})},deleted:function(t){var i=t.children;e(t,["children"]),console.log("nitish: ",i);var o=P(i,function(n){return a.cloneElement(n,{isSuggestedDeviationFix:!0})});return r("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:o}))},changed:function(t){var i=t.children;e(t,["children"]);var o=P(i,function(n){return a.cloneElement(n,{isSuggestedDeviationFix:!0})});return r("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:o}))}}},[L,A,T,j,I]),R=function(n){if(!n)return"";var e=n.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n");return/\|.*\|/.test(e)&&/\|[-:\s]+\|/.test(e)?e.replace(/(\|.*\|)\n\s*\n(?=\|)/g,"$1\n"):e.split(/(\n{2,})/).map(function(n){return n.startsWith("\n")?n:n.replace(/\n/g," ")}).join("")},W=d(function(){return S.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[S]),$=function(n){return n.replace(/[\.,;:]/g," ")},q=d(function(){var e=R(g(y||"")),r=I?$(e):e,t=(S||[]).map(function(n){var e,r;return{id:null==n?void 0:n.id,highlight:R((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.badgeBg)||T}}).filter(function(n){return n.id&&n.highlight}),i={};t.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e){void 0===n&&(n="");var r=e?' data-highlight-color="'.concat(e,'"'):"";return'<mark data-badge-id="'.concat(n,'"').concat(r,">")},l=function(n){return'<span data-badge-id="'.concat(n,'">')},a=[];Object.entries(i).forEach(function(n){var t=n[0],i=n[1],o=e.indexOf(t),l=!1;if(-1===o&&I){var c=$(t);-1!==(o=r.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=f(d,i[s].highlightColor);a.push({highlight:t,start:o,end:o+t.length,badges:i,color:d,usedLooseMatch:l})}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],d={};a.forEach(function(n,e){for(var r=n.start,t=n.end,i=0,o=c;i<o.length;i++){var l=o[i],a=l.start,s=l.end,u=r<s&&t>s&&r>=a,h=r<a&&t>a&&t<=s;if(r>=a&&t<=s){n.orphaned=!0,d[e]=l.matchIdx;break}u&&(r=s),h&&(t=a)}n.trimmedStart=r,n.trimmedEnd=t,!n.orphaned&&r<t&&c.push({start:r,end:t,matchIdx:e})});var s={};Object.entries(d).forEach(function(n){var e=n[0],r=n[1],t=Number(e);s[r]||(s[r]=[]),s[r].push(t)});var u=function(n,e,r){void 0===e&&(e="");var t=n.startsWith("\n\n"),i=n.endsWith("\n\n"),l=n.split(/(\n{2,})/).map(function(n,l,a){if(/^\n{2,}$/.test(n))return n;if(!n.trim())return n;var c=0===l||1===l&&/^\n{2,}$/.test(a[0]),d=l===a.length-1||l===a.length-2&&/^\n{2,}$/.test(a[a.length-1]);return t&&c||i&&d?n:function(n,e,r){var t,i,l;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var c=null!==(t=a[1])&&void 0!==t?t:"",d=null!==(i=a[2])&&void 0!==i?i:"",s=null!==(l=a[3])&&void 0!==l?l:"";return d?c+o(e,r)+d+"</mark>"+s:n}(n,e,r)}).join("");return l.replace(/^\n{2,}/,"").replace(/\n{2,}$/,"")},h=a.map(function(e,r){return n(n({},e),{idx:r})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var r,t;return(null!==(r=e.trimmedStart)&&void 0!==r?r:e.start)-(null!==(t=n.trimmedStart)&&void 0!==t?t:n.start)});h.forEach(function(n){var r,t,i=null!==(r=n.trimmedStart)&&void 0!==r?r:n.start,o=null!==(t=n.trimmedEnd)&&void 0!==t?t:n.end;if(!(i>=o)){var c=e.slice(i,o),d=function(n,e,r,t){if(!r.length)return n;var i=r.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),o="",c=0;return i.forEach(function(r){var i=r.start-e,a=r.end-e,d=f(t,r.color);o+=n.slice(c,i);var s="",h="";r.badges.forEach(function(n){s+=l(n.id),h="</span>"+h}),o+=s+u(n.slice(i,a),r.badges[0].id,d)+h,c=a}),o+=n.slice(c)}(n.usedLooseMatch||i!==n.start||o!==n.end?c:n.highlight,n.start,s[n.idx]||[],n.color),h=u(d,n.badges[0].id,n.color),p="",g="";n.badges.forEach(function(n){p+=l(n.id),g="</span>"+g});var v=p+h+g;e=e.slice(0,i)+v+e.slice(o)}});var p=new Set(Object.keys(i));return w.forEach(function(n){if(n){var t=R(n);if(t&&!p.has(t)){var i=I?r.indexOf($(t)):e.indexOf(t);if(-1!==i){var l=e.slice(0,i);if((l.match(/</g)||[]).length===(l.match(/>/g)||[]).length){var a=o("","")+t+"</mark>";e=e.slice(0,i)+a+e.slice(i+t.length)}}}}}),e},[y,S,w,T,I]),M=d(function(){return E?R(g(E||"")):""},[E]),X=!!E,H=n(n(n(n({},C),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),X?{color:"transparent"}:{}),{"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}}),K=n(n({},C),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}});return s(function(){if(D.current){var n=function(){var n=Array.from(D.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),r=n.filter(function(n){return"left"!==n.dataset.side}),t=D.current.getBoundingClientRect(),i=t.bottom-4,o=t.top+4,l=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var r=[],t=[];e.forEach(function(n){if(0===t.length)t.push(n);else{var e=t[t.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,t.push(n)):(r.push(t),t=[n])}}),t.length>0&&r.push(t),r.forEach(function(n){var e=n[n.length-1],r=e.currentTop+e.height;if(r>i){var t=r-i,l=n[0].currentTop-o,a=Math.max(0,Math.min(t,l));n.forEach(function(n){n.currentTop-=a})}}),r.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};l(e),l(r)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),r=new ResizeObserver(function(){requestAnimationFrame(n)});return r.observe(D.current),function(){r.disconnect(),cancelAnimationFrame(e)}}},[q,O,W]),t(o,n({ref:D,sx:{position:"relative",display:"grid"}},{children:[r(l,n({component:"div",sx:n(n({},H),{padding:"3px"})},{children:r(p,n({components:N,remarkPlugins:[x],rehypePlugins:[m]},{children:g(q).replace(/\\n/g,"\n")}))})),X&&r(l,n({component:"div",sx:K},{children:r(p,n({components:N,remarkPlugins:[x],rehypePlugins:[m]},{children:g(M).replace(/\\n/g,"\n")}))}))]}))},v);export{y as MemoizedMarkdown};
|
|
1
|
+
import{__assign as n,__rest as e}from"tslib";import{jsx as r,jsxs as t,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{safeStringify as g,mixHexColors as f,areMarkdownPropsEqual as v}from"../CognitiveComparehelpers.js";import m from"rehype-raw";import x from"remark-gfm";import b from"../components/ScrollLockToggle.js";var y=l.memo(function(v){var y=v.content,E=v.overlayContent,C=v.sxStyles,k=v.deviationBadges,B=void 0===k?[]:k,S=v.highlights,F=void 0===S?[]:S;v.maintainRelativeOrder;var w=v.highlightBg,A=v.suppressHighlightBg,T=void 0!==A&&A,z=v.collisionKey,I=c(null),O=!!E,D=d(function(){return B.reduce(function(e,r){var t;return n(n({},e),((t={})[r.id]=r,t))},{})},[B]),j=c({badgeMap:D,highlightBg:w,hideHighlightBg:O,suppressHighlightBg:T});j.current={badgeMap:D,highlightBg:w,hideHighlightBg:O,suppressHighlightBg:T};var L=function(e,r){return l.Children.map(e,function(e){var t;if(!l.isValidElement(e))return e;var i=(null===(t=e.props)||void 0===t?void 0:t.children)?L(e.props.children,r):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return r(o)})},M=d(function(){return{mark:function(t){var i,o,a,l,c=t.children,d=e(t,["children"]),s=j.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=d["data-badge-id"],v=f?u[f]:null,m=d["data-highlight-color"],x=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,b=d.isSuggestedDeviationFix||g;return r("span",n({style:n(n(n({},b?{}:{backgroundColor:x}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,g,f,v=i.children,m=e(i,["children"]),x=j.current.badgeMap,y=m["data-badge-id"];if(!y)return r("span",n({},m,{children:v}));var E=x[y];if(!E)return r("span",n({},m,{children:v}));var C="number"==typeof E.stackIndex?E.stackIndex:0,k="translateY(calc(-20% + ".concat(12*C,"px + var(--badge-nudge, 0px)))");return t(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[t(o,n({ref:E.badgeRef,className:"deviation-badge","data-side":E.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+C,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=E.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=E.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=E.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===E.side?{right:"-16px",transform:"".concat(k," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(k," translateX(calc(-100% - 8px))")}),E.isConnected&&E.style&&{outline:"2px solid ".concat(E.style.badgeBorder),outlineOffset:"1px"})},{children:[t(o,n({onClick:function(n){n.stopPropagation(),E.onSummaryClick&&E.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[r(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:E.label})),("left"===E.side||E.isOrphan)&&r(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=E.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=E.score&&"N/A"!==E.score&&"NA"!==E.score&&0!==E.score?"".concat(E.score):"N/A"===E.score||"NA"===E.score?"N/A":"Same"}))]})),("left"===E.side||E.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),E.onClick&&E.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=E.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:[r(h,{size:12,color:(null===(p=E.style)||void 0===p?void 0:p.badgeText)||"#3730A3"}),E.showScrollLockToggle&&r(b,{locked:!!E.scrollSyncLocked,onToggle:E.toggleScrollSyncLocked,color:(null===(g=E.style)||void 0===g?void 0:g.badgeText)||"#3730A3",borderColor:(null===(f=E.style)||void 0===f?void 0:f.badgeBorder)||"#C7D2FE",size:12})]}))]})),v]}))},table:function(e){var t=e.children;return r(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:t}))},thead:function(e){var t=e.children;return r(o,n({component:"thead"},{children:t}))},tbody:function(e){var t=e.children;return r(o,n({component:"tbody"},{children:t}))},tr:function(e){var t=e.children;return r(o,n({component:"tr",sx:{borderBotttom:"1px solid #E5E7EB"}},{children:t}))},th:function(e){var t=e.children;return r(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:t}))},td:function(e){var t=e.children;return r(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:t}))},updated:function(n){var t=n.children;return e(n,["children"]),r(i,{children:t})},deleted:function(t){var i=t.children;e(t,["children"]),console.log("nitish: ",i);var o=L(i,function(n){return l.cloneElement(n,{isSuggestedDeviationFix:!0})});return r("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:o}))},changed:function(t){var i=t.children;e(t,["children"]);var o=L(i,function(n){return l.cloneElement(n,{isSuggestedDeviationFix:!0})});return r("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:o}))}}},[]),P=function(n){if(!n)return"";var e=n.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n");return/\|.*\|/.test(e)&&/\|[-:\s]+\|/.test(e)?e.replace(/(\|.*\|)\n\s*\n(?=\|)/g,"$1\n"):e.split(/(\n{2,})/).map(function(n){return n.startsWith("\n")?n:n.replace(/\n/g," ")}).join("")},H=d(function(){return B.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[B]),N=function(n){return n.replace(/[\.,;:]/g," ")},R=d(function(){var e=P(g(y||"")),r=T?N(e):e,t=(B||[]).map(function(n){var e,r;return{id:null==n?void 0:n.id,highlight:P((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.badgeBg)||w}}).filter(function(n){return n.id&&n.highlight}),i={};t.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e){void 0===n&&(n="");var r=e?' data-highlight-color="'.concat(e,'"'):"";return'<mark data-badge-id="'.concat(n,'"').concat(r,">")},a=function(n){return'<span data-badge-id="'.concat(n,'">')},l=[];Object.entries(i).forEach(function(n){var t=n[0],i=n[1],o=e.indexOf(t),a=!1;if(-1===o&&T){var c=N(t);-1!==(o=r.indexOf(c))&&(a=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=f(d,i[s].highlightColor);l.push({highlight:t,start:o,end:o+t.length,badges:i,color:d,usedLooseMatch:a})}}),l.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],d={};l.forEach(function(n,e){for(var r=n.start,t=n.end,i=0,o=c;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=r<s&&t>s&&r>=l,h=r<l&&t>l&&t<=s;if(r>=l&&t<=s){n.orphaned=!0,d[e]=a.matchIdx;break}u&&(r=s),h&&(t=l)}n.trimmedStart=r,n.trimmedEnd=t,!n.orphaned&&r<t&&c.push({start:r,end:t,matchIdx:e})});var s={};Object.entries(d).forEach(function(n){var e=n[0],r=n[1],t=Number(e);s[r]||(s[r]=[]),s[r].push(t)});var u=function(n,e,r){void 0===e&&(e="");var t=n.startsWith("\n\n"),i=n.endsWith("\n\n"),a=n.split(/(\n{2,})/).map(function(n,a,l){if(/^\n{2,}$/.test(n))return n;if(!n.trim())return n;var c=0===a||1===a&&/^\n{2,}$/.test(l[0]),d=a===l.length-1||a===l.length-2&&/^\n{2,}$/.test(l[l.length-1]);return t&&c||i&&d?n:function(n,e,r){var t,i,a;void 0===e&&(e="");var l=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!l)return n;var c=null!==(t=l[1])&&void 0!==t?t:"",d=null!==(i=l[2])&&void 0!==i?i:"",s=null!==(a=l[3])&&void 0!==a?a:"";return d?c+o(e,r)+d+"</mark>"+s:n}(n,e,r)}).join("");return a.replace(/^\n{2,}/,"").replace(/\n{2,}$/,"")},h=l.map(function(e,r){return n(n({},e),{idx:r})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var r,t;return(null!==(r=e.trimmedStart)&&void 0!==r?r:e.start)-(null!==(t=n.trimmedStart)&&void 0!==t?t:n.start)});h.forEach(function(n){var r,t,i=null!==(r=n.trimmedStart)&&void 0!==r?r:n.start,o=null!==(t=n.trimmedEnd)&&void 0!==t?t:n.end;if(!(i>=o)){var c=e.slice(i,o),d=function(n,e,r,t){if(!r.length)return n;var i=r.map(function(n){return l[n]}).sort(function(n,e){return n.start-e.start}),o="",c=0;return i.forEach(function(r){var i=r.start-e,l=r.end-e,d=f(t,r.color);o+=n.slice(c,i);var s="",h="";r.badges.forEach(function(n){s+=a(n.id),h="</span>"+h}),o+=s+u(n.slice(i,l),r.badges[0].id,d)+h,c=l}),o+=n.slice(c)}(n.usedLooseMatch||i!==n.start||o!==n.end?c:n.highlight,n.start,s[n.idx]||[],n.color),h=u(d,n.badges[0].id,n.color),p="",g="";n.badges.forEach(function(n){p+=a(n.id),g="</span>"+g});var v=p+h+g;e=e.slice(0,i)+v+e.slice(o)}});var p=new Set(Object.keys(i));return F.forEach(function(n){if(n){var t=P(n);if(t&&!p.has(t)){var i=T?r.indexOf(N(t)):e.indexOf(t);if(-1!==i){var a=e.slice(0,i);if((a.match(/</g)||[]).length===(a.match(/>/g)||[]).length){var l=o("","")+t+"</mark>";e=e.slice(0,i)+l+e.slice(i+t.length)}}}}}),e},[y,B,F,w,T]),W=d(function(){return E?P(g(E||"")):""},[E]),$=!!E,q=n(n(n(n({},C),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),$?{color:"transparent"}:{}),{"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}}),X=n(n({},C),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"},"& *":{fontFamily:"inherit"}});return s(function(){if(I.current){var n=function(){var n=Array.from(I.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),r=n.filter(function(n){return"left"!==n.dataset.side}),t=I.current.getBoundingClientRect(),i=t.bottom-4,o=t.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var r=[],t=[];e.forEach(function(n){if(0===t.length)t.push(n);else{var e=t[t.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,t.push(n)):(r.push(t),t=[n])}}),t.length>0&&r.push(t),r.forEach(function(n){var e=n[n.length-1],r=e.currentTop+e.height;if(r>i){var t=r-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(t,a));n.forEach(function(n){n.currentTop-=l})}}),r.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(r)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),r=new ResizeObserver(function(){requestAnimationFrame(n)});return r.observe(I.current),function(){r.disconnect(),cancelAnimationFrame(e)}}},[R,z,H]),t(o,n({ref:I,sx:{position:"relative",display:"grid"}},{children:[r(a,n({component:"div",sx:n(n({},q),{padding:"3px"})},{children:r(p,n({components:M,remarkPlugins:[x],rehypePlugins:[m]},{children:g(R).replace(/\\n/g,"\n")}))})),$&&r(a,n({component:"div",sx:X},{children:r(p,n({components:M,remarkPlugins:[x],rehypePlugins:[m]},{children:g(W).replace(/\\n/g,"\n")}))}))]}))},v);export{y as MemoizedMarkdown};
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const autopilotStyles = "\n @keyframes shimmerSweep {\n 0% { background-position: -200% center; }\n 100% { background-position: 200% center; }\n }\n\n @keyframes dotGrow {\n 0%, 100% { transform: scale(0.3); opacity: 0.2; }\n 50% { transform: scale(1); opacity: 1; }\n }\n\n .autopilot-glow-text {\n background: linear-gradient(90deg, #6d28d9 0%, #a78bfa 30%, #c4b5fd 50%, #a78bfa 70%, #6d28d9 100%);\n background-size: 200% auto;\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n background-clip: text;\n animation: shimmerSweep 2s linear infinite;\n }\n\n .autopilot-dot {\n display: inline-block;\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background-color: #7c3aed;\n transform: scale(0.3);\n opacity: 0.2;\n }\n\n .autopilot-dot:nth-child(1) { animation: dotGrow 1.2s ease-in-out infinite; animation-delay: 0s; }\n .autopilot-dot:nth-child(2) { animation: dotGrow 1.2s ease-in-out infinite; animation-delay: 0.4s; }\n .autopilot-dot:nth-child(3) { animation: dotGrow 1.2s ease-in-out infinite; animation-delay: 0.8s; }\n";
|
|
2
|
+
//# sourceMappingURL=AutopilotStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutopilotStyle.d.ts","sourceRoot":"","sources":["../../../src/AutopilotStyle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,ylCAiC3B,CAAC"}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AutopilotIndicatorProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
AIlabel?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
export declare const AutopilotIndicator: React.FC<AutopilotIndicatorProps>;
|
|
8
|
+
interface RedliningSummaryProps {
|
|
9
|
+
approved: number;
|
|
10
|
+
rejected: number;
|
|
11
|
+
pending: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const RedliningFixesSummaryUI: ({ approved, rejected, pending }: RedliningSummaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const TotalCountsBadge: React.FC<any>;
|
|
1
15
|
export default function ChatDrawerTest(): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
2
17
|
//# sourceMappingURL=ChatDrawerTest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatDrawerTest.d.ts","sourceRoot":"","sources":["../../../src/ChatDrawerTest.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatDrawerTest.d.ts","sourceRoot":"","sources":["../../../src/ChatDrawerTest.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA2BhE,CAAC;AAGF,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,uBAAuB,oCAAqC,qBAAqB,4CAiE7F,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAsB1C,CAAC;AA8CF,MAAM,CAAC,OAAO,UAAU,cAAc,4CAsCrC"}
|