@e-llm-studio/requirement-ai 0.0.247 → 0.0.249

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("react/jsx-runtime"),e=require("lucide-react"),n=require("react"),o=require("./ResizableSplitPane.js"),t=require("../icons/PdfViewerIcons.js"),l=require("@e-llm-studio/citation"),a=require("react-markdown"),r=require("rehype-raw"),d=require("@mui/material"),u=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function s(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var c=s(a),v=s(r);const p=i=>{if(i)try{const e=new URL(i).hostname.replace(/^www\./i,""),n=e.split(".")[0];return n?n.charAt(0).toUpperCase()+n.slice(1):e}catch(i){return}},x=(i,e)=>{const n=((i,e)=>(null==i?void 0:i.payloadCitationId)||(null==e?void 0:e.payloadCitationId)||(null==e?void 0:e.citation_uuid)||"")(i,e)||("function"==typeof(null===(o=globalThis.crypto)||void 0===o?void 0:o.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const e=Math.floor(16*Math.random());return("x"===i?e:e%4+8).toString(16)}));var o;return i&&"object"==typeof i&&(i.payloadCitationId=n),e&&"object"==typeof e&&(e.payloadCitationId=n,e.citation_uuid||(e.citation_uuid=n)),n},g=({href:t,metaData:a,citationTitle:r,isFullscreen:s,secondaryCitation:g})=>{var h,f,m,b,y,C,j,_,w,F,T,I,D,S,P,k,M,U,W,z,R;const A=n.useMemo(()=>{var i;return null===(i=(Array.isArray(null==a?void 0:a.citations)?a.citations:[]).find(i=>`pdf_citation$${i.id}`===t))||void 0===i?void 0:i.data},[t,null==a?void 0:a.citations]),q=null!==(y=null===(b=null===(m=null===(f=null===(h=null==a?void 0:a.guidelinesData)||void 0===h?void 0:h.artifactData)||void 0===f?void 0:f.userStorySnapshot)||void 0===m?void 0:m[0])||void 0===b?void 0:b.value)&&void 0!==y?y:"",E=n.useMemo(()=>{const i=null==g?void 0:g.phraseToHighlight;if(!i)return q;const e=q.toLowerCase().indexOf(i.toLowerCase());return-1===e?q:[q.slice(0,e),'<mark style="background-color: #FEF08A; padding: 0 2px;">',q.slice(e,e+i.length),"</mark>",q.slice(e+i.length)].join("")},[q,null==g?void 0:g.phraseToHighlight]),B=n.useMemo(()=>{var i;const e=Array.isArray(null==a?void 0:a.gptCitations)?a.gptCitations:[],n=((i="")=>{if(!i||"string"!=typeof i||!i.trim())return"";const e=i.match(/gpt_citation\$(\d+)/i);return e&&e.length>=2?e[1]:""})(null==g?void 0:g.href);if(!n)return null;const o=e.find(i=>String(null==i?void 0:i.id)===n),t=(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.extraMetaData)||{},l=(i=>Object.keys(i||{}).sort((i,e)=>Number(i)-Number(e)))(t),r=l[Number((null==g?void 0:g.occurrenceIndex)||0)]||l[0];return r?t[r]:null},[null==a?void 0:a.gptCitations,null==g?void 0:g.href,null==g?void 0:g.occurrenceIndex]),G=(null===(w=null===(_=null===(j=null===(C=null==B?void 0:B.aiReasoningCitation)||void 0===C?void 0:C.gpt_citation)||void 0===j?void 0:j[0])||void 0===_?void 0:_.customMetaData)||void 0===w?void 0:w.value)||{},N=(null===(I=null===(T=null===(F=null==B?void 0:B.aiReasoningCitation)||void 0===F?void 0:F.gpt_citation)||void 0===T?void 0:T[0])||void 0===I?void 0:I.customMetaData)||{},L=n.useMemo(()=>x(B,G),[G,B]),[O,H]=n.useState(),[V,$]=n.useState("pending"),[X,J]=n.useState(!0),{apiCachingConfig:K,citationConfig:Q}=u.useRequirementAI(),{getGptWebCitation:Y,gptWebCitationPartialPayload:Z}=K||{},ii=(null===(D=null==Q?void 0:Q.gptWeb)||void 0===D?void 0:D.displayMode)||l.CitationType.GPT_WEB,ei=null===(S=null==g?void 0:g.href)||void 0===S?void 0:S.includes("gpt_citation"),ni=n.useMemo(()=>({...Z,citationId:L,citationUrl:null==G?void 0:G.citationUrl,content:(null==B?void 0:B.Reasoning)||(null==G?void 0:G.text),citationType:null==G?void 0:G.citationType,citationNumber:Number((null==N?void 0:N.citation_number)||0)}),[Z,L,null==N?void 0:N.citation_number,null==G?void 0:G.citationType,null==G?void 0:G.citationUrl,null==G?void 0:G.text,null==B?void 0:B.Reasoning]),oi=n.useMemo(()=>({item:{confidence_score:Number((null==B?void 0:B.Confidence_score)||0),text:(null==G?void 0:G.paraphrase)||(null==g?void 0:g.title)||"Web citation reasoning",dataSource:(null==G?void 0:G.text)||(null==B?void 0:B.Reasoning)||"",paraphrase:(null==G?void 0:G.paraphrase)||""},headerTitle:(null==G?void 0:G.label)||"GPT Web Citation",index:Number((null==N?void 0:N.citation_number)||1)-1,iconsConfig:{ChevronDownIcon:e.ChevronDown,ChevronUpIcon:e.ChevronUp,MaximizeIcon:e.Maximize2,CloseIcon:e.X}}),[null==g?void 0:g.title,null==N?void 0:N.citation_number,null==G?void 0:G.label,null==G?void 0:G.paraphrase,null==G?void 0:G.text,null==B?void 0:B.Confidence_score,null==B?void 0:B.Reasoning]);if(n.useEffect(()=>{let i=!0;return(async()=>{var e,n;if(ei&&(null==G?void 0:G.citationUrl)&&ii!==l.CitationType.GPT&&(ii!==l.CitationType.GPT_WEB||X))if(Y){$("pending");try{const o=await Y(ni);if(!i)return;H(null!==(n=null!==(e=null==o?void 0:o.data)&&void 0!==e?e:null==o?void 0:o.responseData)&&void 0!==n?n:o),$("success")}catch(e){if(!i)return;$("error"),console.error("Failed to load GPT web citation",e)}}else $("error")})(),()=>{i=!1}},[Y,ni,ii,ei,null==G?void 0:G.citationUrl,X]),!A)return null;const ti=(null===(P=null==a?void 0:a.docData)||void 0===P?void 0:P.documents)||{},li=(null===(k=null==a?void 0:a.docData)||void 0===k?void 0:k.input_index_map)||{},ai=Object.values(li).find(i=>{const e=null==ti?void 0:ti[i];return(null==A?void 0:A[i])&&("application/pdf"===(null==e?void 0:e.mime_type)||"base"===(null==e?void 0:e.role))}),ri=Object.keys(A).find(i=>{const e=null==ti?void 0:ti[i];return"application/pdf"===(null==e?void 0:e.mime_type)||"base"===(null==e?void 0:e.role)})||Object.keys(A)[0],di=ai||ri||(null==li?void 0:li[0]),ui=Object.values(li).find(i=>i!==di),si=di?ti[di]:null,ci=ui?ti[ui]:null,vi=di?A[di]:null,pi=ui?A[ui]:null,xi="rulebook_citation"===((null===(M=null==g?void 0:g.type)||void 0===M?void 0:M.toLowerCase())||"")||Boolean(null==g?void 0:g.phraseToHighlight),gi=g?i.jsxs("div",{style:{height:"100%",overflow:"auto",padding:"16px",boxSizing:"border-box",backgroundColor:"#FFFFFF",color:"#101828",fontFamily:'"Inter", sans-serif',fontSize:"13px",lineHeight:1.6},children:[i.jsx("div",{style:{fontWeight:700,marginBottom:"8px"},children:xi?"Guideline Citation":"Web/GPT Citation"}),xi?i.jsx(i.Fragment,{children:i.jsx(d.Box,{sx:{padding:"0px 12px",backgroundColor:"#FFFFFF",overflow:"visible"},children:i.jsx(c.default,{rehypePlugins:[v.default],children:E})})}):ei?i.jsx(l.GptWebCitation,{gptCitation:oi,defaultCitationUrl:(null==G?void 0:G.citationUrl)||"",citationType:ii,webCitationData:O,sourceLabel:`Source: Web Citation > ${(null==G?void 0:G.paraphrase)||(null==G?void 0:G.label)||"Web Citation"}`,learnedFrom:p(null==G?void 0:G.citationUrl),showWebCitation:X,webCitationStatus:V,onGenerateWebCitation:()=>J(!0),onToggleCitationView:()=>J(i=>!i),showExpandImageButton:!0,showGptMaximizeButton:!0,iconsConfig:{MaximizeIcon:e.Maximize2,ExternalLinkIcon:e.ExternalLink},isFixedHeight:!1}):i.jsx("div",{children:"No secondary citation preview available."})]}):null;if(["Contract","clause"].includes(r)){const e=vi?i.jsx(l.PdfViewer,{pdfName:null==si?void 0:si.title,pdfUrl:null==si?void 0:si.signed_url,highlightText:[null!==(U=null==vi?void 0:vi.highlighted_text)&&void 0!==U?U:""],highlightPages:{1:null===(W=null==vi?void 0:vi.custom_metadata)||void 0===W?void 0:W.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,n=gi||(pi?i.jsx(l.PdfViewer,{pdfName:null==ci?void 0:ci.title,pdfUrl:null==ci?void 0:ci.signed_url,jumpToPageValue:1,highlightText:[null!==(z=null==pi?void 0:pi.highlighted_text)&&void 0!==z?z:""],highlightPages:{1:null===(R=null==pi?void 0:pi.custom_metadata)||void 0===R?void 0:R.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null);return vi||pi||gi?i.jsx("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:i.jsx(o.default,{leftComponent:e,rightComponent:n,isFullscreen:s})}):i.jsx("div",{children:"Missing PDF Citation. Please try again later"})}return i.jsx("div",{children:"No Citation Found. Please try again later"})};exports.default=({href:o,children:l,metaData:a,secondaryCitation:r,chevronUpComponent:d=null,chevronDownComponent:u=null,customStyle:s={},defaultState:c=!1})=>{var v,p,x;const[h,f]=n.useState(c),[m,b]=n.useState(!1),y="string"==typeof l&&(null===(v=null==l?void 0:l.split("\n"))||void 0===v?void 0:v.length)>1?l.split("\n").join(" "):l,C="string"==typeof l?l:l[0],j=null!=d?d:(n=>{var o,t;return i.jsx(e.ChevronUp,{size:null!==(o=null==n?void 0:n.fontSize)&&void 0!==o?o:16,color:null!==(t=null==n?void 0:n.color)&&void 0!==t?t:"rgb(214, 51, 132)"})})(null!==(p=null==s?void 0:s.arrow)&&void 0!==p?p:{}),_=null!=u?u:(n=>{var o,t;return i.jsx(e.ChevronDown,{size:null!==(o=null==n?void 0:n.fontSize)&&void 0!==o?o:16,color:null!==(t=null==n?void 0:n.color)&&void 0!==t?t:"rgb(214, 51, 132)"})})(null!==(x=null==s?void 0:s.arrow)&&void 0!==x?x:{}),w=n.useMemo(()=>(Array.isArray(null==a?void 0:a.citations)?a.citations:[]).some(i=>`pdf_citation$${i.id}`===o),[o,null==a?void 0:a.citations]);return["contract","clause"].includes(C.toLowerCase())&&w?i.jsxs("span",{style:{display:"inline",...s.relativeWrapper||{}},children:[i.jsx("div",{style:{display:"inline",marginTop:0,...s.citationButtonWrapper||{}},children:i.jsxs("button",{type:"button",onClick:()=>f(i=>!i),style:{display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal",...s.citationButton||{}},children:[i.jsx("span",{children:y}),i.jsx("span",{style:{display:"flex",alignItems:"center"},children:h?j:_})]})}),h&&i.jsxs("div",{style:m?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"},children:[i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0},children:i.jsx("button",{onClick:()=>{b(i=>!i)},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"},children:m?i.jsx(t.DefaultFullScreenCloseIcon,{}):i.jsx(t.DefaultFullScreenIcon,{})})}),i.jsx("div",{style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"},children:i.jsx(g,{href:o,children:l,metaData:a,citationTitle:C,isFullscreen:m,secondaryCitation:r})})]})]}):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("react/jsx-runtime"),n=require("lucide-react"),e=require("react"),o=require("./ResizableSplitPane.js"),l=require("../icons/PdfViewerIcons.js"),t=require("@e-llm-studio/citation"),a=require("react-markdown"),r=require("rehype-raw"),d=require("@mui/material"),u=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function s(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var c=s(a),v=s(r);const p=i=>{if(i)try{const n=new URL(i).hostname.replace(/^www\./i,""),e=n.split(".")[0];return e?e.charAt(0).toUpperCase()+e.slice(1):n}catch(i){return}},x=(i,n)=>{const e=((i,n)=>(null==i?void 0:i.payloadCitationId)||(null==n?void 0:n.payloadCitationId)||(null==n?void 0:n.citation_uuid)||"")(i,n)||("function"==typeof(null===(o=globalThis.crypto)||void 0===o?void 0:o.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const n=Math.floor(16*Math.random());return("x"===i?n:n%4+8).toString(16)}));var o;return i&&"object"==typeof i&&(i.payloadCitationId=e),n&&"object"==typeof n&&(n.payloadCitationId=e,n.citation_uuid||(n.citation_uuid=e)),e},g=({href:l,metaData:a,citationTitle:r,isFullscreen:s,secondaryCitation:g})=>{var h,f,m,b,y,C,j,_,w,F,T,I,D,S,P,U,k,M,W,R,z;const A=e.useMemo(()=>{var i;return null===(i=(Array.isArray(null==a?void 0:a.citations)?a.citations:[]).find(i=>`pdf_citation$${i.id}`===l))||void 0===i?void 0:i.data},[l,null==a?void 0:a.citations]),B=null!==(y=null===(b=null===(m=null===(f=null===(h=null==a?void 0:a.guidelinesData)||void 0===h?void 0:h.artifactData)||void 0===f?void 0:f.userStorySnapshot)||void 0===m?void 0:m[0])||void 0===b?void 0:b.value)&&void 0!==y?y:"",q=e.useMemo(()=>{const i=null==g?void 0:g.phraseToHighlight;if(!i)return B;const n=B.toLowerCase().indexOf(i.toLowerCase());return-1===n?B:[B.slice(0,n),'<mark style="background-color: #FEF08A; padding: 0 2px;">',B.slice(n,n+i.length),"</mark>",B.slice(n+i.length)].join("")},[B,null==g?void 0:g.phraseToHighlight]),E=e.useMemo(()=>{var i;const n=Array.isArray(null==a?void 0:a.gptCitations)?a.gptCitations:[],e=((i="")=>{if(!i||"string"!=typeof i||!i.trim())return"";const n=i.match(/gpt_citation\$(\d+)/i);return n&&n.length>=2?n[1]:""})(null==g?void 0:g.href);if(!e)return null;const o=n.find(i=>String(null==i?void 0:i.id)===e),l=(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.extraMetaData)||{},t=(i=>Object.keys(i||{}).sort((i,n)=>Number(i)-Number(n)))(l),r=t[Number((null==g?void 0:g.occurrenceIndex)||0)]||t[0];return r?l[r]:null},[null==a?void 0:a.gptCitations,null==g?void 0:g.href,null==g?void 0:g.occurrenceIndex]),G=(null===(w=null===(_=null===(j=null===(C=null==E?void 0:E.aiReasoningCitation)||void 0===C?void 0:C.gpt_citation)||void 0===j?void 0:j[0])||void 0===_?void 0:_.customMetaData)||void 0===w?void 0:w.value)||{},N=(null===(I=null===(T=null===(F=null==E?void 0:E.aiReasoningCitation)||void 0===F?void 0:F.gpt_citation)||void 0===T?void 0:T[0])||void 0===I?void 0:I.customMetaData)||{},L=e.useMemo(()=>x(E,G),[G,E]),[O,H]=e.useState(),[V,$]=e.useState("pending"),[X,J]=e.useState(!0),{apiCachingConfig:K,citationConfig:Q}=u.useRequirementAI(),{getGptWebCitation:Y,gptWebCitationPartialPayload:Z}=K||{},ii=(null===(D=null==Q?void 0:Q.gptWeb)||void 0===D?void 0:D.displayMode)||t.CitationType.GPT_WEB,ni=null===(S=null==g?void 0:g.href)||void 0===S?void 0:S.includes("gpt_citation"),ei=e.useMemo(()=>({...Z,citationId:L,citationUrl:null==G?void 0:G.citationUrl,content:(null==E?void 0:E.Reasoning)||(null==G?void 0:G.text),citationType:null==G?void 0:G.citationType,citationNumber:Number((null==N?void 0:N.citation_number)||0)}),[Z,L,null==N?void 0:N.citation_number,null==G?void 0:G.citationType,null==G?void 0:G.citationUrl,null==G?void 0:G.text,null==E?void 0:E.Reasoning]),oi=e.useMemo(()=>({item:{confidence_score:Number((null==E?void 0:E.Confidence_score)||0),text:(null==G?void 0:G.paraphrase)||(null==g?void 0:g.title)||"Web citation reasoning",dataSource:(null==G?void 0:G.text)||(null==E?void 0:E.Reasoning)||"",paraphrase:(null==G?void 0:G.paraphrase)||""},headerTitle:(null==G?void 0:G.label)||"GPT Web Citation",index:Number((null==N?void 0:N.citation_number)||1)-1,iconsConfig:{ChevronDownIcon:n.ChevronDown,ChevronUpIcon:n.ChevronUp,MaximizeIcon:n.Maximize2,CloseIcon:n.X}}),[null==g?void 0:g.title,null==N?void 0:N.citation_number,null==G?void 0:G.label,null==G?void 0:G.paraphrase,null==G?void 0:G.text,null==E?void 0:E.Confidence_score,null==E?void 0:E.Reasoning]);if(e.useEffect(()=>{let i=!0;return(async()=>{var n,e;if(ni&&(null==G?void 0:G.citationUrl)&&ii!==t.CitationType.GPT&&(ii!==t.CitationType.GPT_WEB||X))if(Y){$("pending");try{const o=await Y(ei);if(!i)return;H(null!==(e=null!==(n=null==o?void 0:o.data)&&void 0!==n?n:null==o?void 0:o.responseData)&&void 0!==e?e:o),$("success")}catch(n){if(!i)return;$("error"),console.error("Failed to load GPT web citation",n)}}else $("error")})(),()=>{i=!1}},[Y,ei,ii,ni,null==G?void 0:G.citationUrl,X]),!A)return null;const li=(null===(P=null==a?void 0:a.docData)||void 0===P?void 0:P.documents)||{},ti=(null===(U=null==a?void 0:a.docData)||void 0===U?void 0:U.input_index_map)||{},ai=Object.values(ti).find(i=>{const n=null==li?void 0:li[i];return(null==A?void 0:A[i])&&("application/pdf"===(null==n?void 0:n.mime_type)||"base"===(null==n?void 0:n.role))}),ri=Object.keys(A).find(i=>{const n=null==li?void 0:li[i];return"application/pdf"===(null==n?void 0:n.mime_type)||"base"===(null==n?void 0:n.role)})||Object.keys(A)[0],di=ai||ri||(null==ti?void 0:ti[0]),ui=Object.values(ti).find(i=>i!==di),si=di?li[di]:null,ci=ui?li[ui]:null,vi=di?A[di]:null,pi=ui?A[ui]:null,xi="rulebook_citation"===((null===(k=null==g?void 0:g.type)||void 0===k?void 0:k.toLowerCase())||"")||Boolean(null==g?void 0:g.phraseToHighlight),gi=Boolean(E&&((null==G?void 0:G.citationUrl)||(null==G?void 0:G.text)||(null==E?void 0:E.Reasoning))),hi=Boolean(ni&&gi&&(ii===t.CitationType.GPT||(null==G?void 0:G.citationUrl)&&Y)),fi=Boolean(xi&&B),mi=g&&(xi?fi:hi)?i.jsxs("div",{style:{height:"100%",overflow:"auto",padding:"16px",boxSizing:"border-box",backgroundColor:"#FFFFFF",color:"#101828",fontFamily:'"Inter", sans-serif',fontSize:"13px",lineHeight:1.6},children:[i.jsx("div",{style:{fontWeight:700,marginBottom:"8px"},children:xi?"Guideline Citation":"Web/GPT Citation"}),xi?i.jsx(i.Fragment,{children:i.jsx(d.Box,{sx:{padding:"0px 12px",backgroundColor:"#FFFFFF",overflow:"visible"},children:i.jsx(c.default,{rehypePlugins:[v.default],children:q})})}):ni?i.jsx(t.GptWebCitation,{gptCitation:oi,defaultCitationUrl:(null==G?void 0:G.citationUrl)||"",citationType:ii,webCitationData:O,sourceLabel:`Source: Web Citation > ${(null==G?void 0:G.paraphrase)||(null==G?void 0:G.label)||"Web Citation"}`,learnedFrom:p(null==G?void 0:G.citationUrl),showWebCitation:X,webCitationStatus:V,onGenerateWebCitation:()=>J(!0),onToggleCitationView:()=>J(i=>!i),showExpandImageButton:!0,showGptMaximizeButton:!0,iconsConfig:{MaximizeIcon:n.Maximize2,ExternalLinkIcon:n.ExternalLink},isFixedHeight:!1}):i.jsx("div",{children:"No secondary citation preview available."})]}):null;if(["Contract","clause"].includes(r)){const n=vi?i.jsx(t.PdfViewer,{pdfName:null==si?void 0:si.title,pdfUrl:null==si?void 0:si.signed_url,highlightText:[null!==(M=null==vi?void 0:vi.highlighted_text)&&void 0!==M?M:""],highlightPages:{1:null===(W=null==vi?void 0:vi.custom_metadata)||void 0===W?void 0:W.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,e=mi||(pi?i.jsx(t.PdfViewer,{pdfName:null==ci?void 0:ci.title,pdfUrl:null==ci?void 0:ci.signed_url,jumpToPageValue:1,highlightText:[null!==(R=null==pi?void 0:pi.highlighted_text)&&void 0!==R?R:""],highlightPages:{1:null===(z=null==pi?void 0:pi.custom_metadata)||void 0===z?void 0:z.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null);return vi||pi||mi?i.jsx("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:i.jsx(o.default,{leftComponent:n,rightComponent:e,isFullscreen:s})}):i.jsx("div",{children:"Missing PDF Citation. Please try again later"})}return i.jsx("div",{children:"No Citation Found. Please try again later"})};exports.default=({href:o,children:t,metaData:a,secondaryCitation:r,chevronUpComponent:d=null,chevronDownComponent:u=null,customStyle:s={},defaultState:c=!1})=>{var v,p,x;const[h,f]=e.useState(c),[m,b]=e.useState(!1),y="string"==typeof t&&(null===(v=null==t?void 0:t.split("\n"))||void 0===v?void 0:v.length)>1?t.split("\n").join(" "):t,C="string"==typeof t?t:t[0],j=null!=d?d:(e=>{var o,l;return i.jsx(n.ChevronUp,{size:null!==(o=null==e?void 0:e.fontSize)&&void 0!==o?o:16,color:null!==(l=null==e?void 0:e.color)&&void 0!==l?l:"rgb(214, 51, 132)"})})(null!==(p=null==s?void 0:s.arrow)&&void 0!==p?p:{}),_=null!=u?u:(e=>{var o,l;return i.jsx(n.ChevronDown,{size:null!==(o=null==e?void 0:e.fontSize)&&void 0!==o?o:16,color:null!==(l=null==e?void 0:e.color)&&void 0!==l?l:"rgb(214, 51, 132)"})})(null!==(x=null==s?void 0:s.arrow)&&void 0!==x?x:{}),w=e.useMemo(()=>(Array.isArray(null==a?void 0:a.citations)?a.citations:[]).some(i=>`pdf_citation$${i.id}`===o),[o,null==a?void 0:a.citations]);return["contract","clause"].includes(C.toLowerCase())&&w?i.jsxs("span",{style:{display:"inline",...s.relativeWrapper||{}},children:[i.jsx("div",{style:{display:"inline",marginTop:0,...s.citationButtonWrapper||{}},children:i.jsxs("button",{type:"button",onClick:()=>f(i=>!i),style:{display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal",...s.citationButton||{}},children:[i.jsx("span",{children:y}),i.jsx("span",{style:{display:"flex",alignItems:"center"},children:h?j:_})]})}),h&&i.jsxs("div",{style:m?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"},children:[i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0},children:i.jsx("button",{onClick:()=>{b(i=>!i)},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"},children:m?i.jsx(l.DefaultFullScreenCloseIcon,{}):i.jsx(l.DefaultFullScreenIcon,{})})}),i.jsx("div",{style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"},children:i.jsx(g,{href:o,children:t,metaData:a,citationTitle:C,isFullscreen:m,secondaryCitation:r})})]})]}):null};
2
2
  //# sourceMappingURL=CitationAnchor.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("../Popups/PopupDefaults.js"),i=require("react-markdown"),n=require("rehype-raw"),c=require("./CitationComponent.module.css.js"),l=require("lucide-react"),r=require("../icons/cognitiveBrain.svg.js"),s=require("../icons/aiMagic.svg.js"),d=require("./CitationAnchor.js"),o=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),u=require("../../../../../service/redlineService.js"),m=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),p=require("../cws/CwsEvent.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(t),f=h(i),v=h(n);const g=(e="")=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),_=(e,t)=>{try{const a=e.match(new RegExp(`${t}=(["'])(.*?)\\1`,"i"));return a&&a.length>=3&&a[2]||""}catch(e){return console.error("Regex matching failed in getAnchorAttribute",e),""}},j=(e,t)=>{let a=[];try{a=[...e.matchAll(/<a\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/a>/gi)].map(e=>{var t;return e&&e.length>=3?{fullMatch:e[0],attributes:e[1],label:e[2],index:null!==(t=e.index)&&void 0!==t?t:0}:null}).filter(e=>Boolean(e))}catch(t){return console.error("Failed to parse anchors in line",t),e}const i=a.find(e=>{return t=e.attributes,_(t,"href").startsWith("pdf_citation$");var t}),n=a.find(e=>{return t=e.attributes,_(t,"href").includes("gpt_citation")||t.includes("phrase_to_highlight=");var t});if(!i||!n)return e;const c=((e,t,a,i,n)=>{const c=_(a,"href"),l=_(a,"type")||(c.includes("gpt_citation")?"gpt_citation":""),r=_(a,"reason"),s=c.split("?")[1]||"",d=s&&new URLSearchParams(s).get("phrase_to_highlight")||"",o=c.includes("gpt_citation")&&void 0!==n?` data-secondary-occurrence-index="${n}"`:"";return`<a${e} data-dual-citation="true" data-secondary-href="${g(c)}" data-secondary-type="${g(l)}" data-secondary-title="${g(i)}" data-secondary-reason="${g(r)}" data-secondary-phrase-to-highlight="${g(d)}"${o}>${t}</a>`})(i.attributes,i.label,n.attributes,n.label,_(n.attributes,"href").includes("gpt_citation")?t():void 0),l=(n.index>i.index?e.slice(i.index+i.fullMatch.length,n.index):e.slice(n.index+n.fullMatch.length,i.index)).trim()?n.label:"";return e.replace(i.fullMatch,c).replace(n.fullMatch,l)},y=(e,t)=>{var a,i;let n=t;try{n=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}catch(e){console.error("String replacement failed in getDataAttribute",e)}return null!==(i=null!==(a=null==e?void 0:e[t])&&void 0!==a?a:null==e?void 0:e[n])&&void 0!==i?i:""},N=({text:a,item:i})=>{const n=t.useMemo(()=>(e=>{let t=0;const a=()=>t++;return e.split("\n").map(e=>j(e,a)).join("\n")})(a),[a]);return e.jsx(f.default,{rehypePlugins:[v.default],components:{ol:({children:t})=>e.jsx("ol",{className:c.default["md-ol"],children:t}),ul:({children:t})=>e.jsx("ul",{className:c.default["md-ul"],children:t}),li:({children:t})=>e.jsx("li",{className:c.default["md-li"],children:t}),a:({node:t,href:a,children:n})=>{const c=(null==t?void 0:t.properties)||{},l=y(c,"data-secondary-href");return e.jsx(d.default,{href:a,children:n,secondaryCitation:l?{href:l,title:y(c,"data-secondary-title"),type:y(c,"data-secondary-type"),reason:y(c,"data-secondary-reason"),phraseToHighlight:y(c,"data-secondary-phrase-to-highlight"),occurrenceIndex:Number(y(c,"data-secondary-occurrence-index")||0)}:void 0,metaData:{citations:i.citations,docData:i.docData,guidelinesData:i.guidelinesData,gptCitations:i.gptCitations}})}},children:n.replace(/<br\s*\/?>/gi,"\n")})},b=({text:t,markdownStyles:a,citationStyles:i,customIcons:n})=>e.jsx(o.AiReasonMarkdownWrapper,{message:t.replace(/<br\s*\/?>/gi,"\n"),customStyles:a,citationStyles:i,customIcons:n}),I=(e,t)=>e.disableAllActions===t.disableAllActions&&(e.redlineId===t.redlineId&&(e.aiReasonId===t.aiReasonId&&(e.relevanceScore===t.relevanceScore&&(e.reason===t.reason&&(e.impact===t.impact&&(e.explaination===t.explaination&&e.gap===t.gap)))))),C=t.memo(function({item:i,title:n="Cognitive Decisioning AI",relevanceScore:d=0,showRelevanceScore:o=!0,reason:u="No reasoning provided.",impact:m="No Impact provided.",explaination:p="No explaination provided.",gap:h="None",onClose:f=()=>{},showResolveBtns:v=!1,sections:g,leftIcon:_,scoreIcon:j,className:y,customStyles:I={},markdownStyles:C,citationStyles:R,customIcons:A,actions:k,disableAllActions:$=!1,actionBtnDisabledStyle:D={},onBackClick:S,isImpactNeeded:w=!0,cognitiveTitle:q="Cognitive Integrity",labels:M={},chatHistory:T,resolveRedlineAction:B}){const H=t.useMemo(()=>{const e=Number(d);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[d]),P=t.useMemo(()=>{const e=M&&M.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const t=e.trim().toLowerCase();return"none"===t||"no gap"===t||"no gaps"===t||"n/a"===t})(h)?e:h},[h]),L=M&&M.impact||"Impact",E=M&&M.explanation||"Explaination",U=M&&M.decisionFactors||"Decision Making Factors",F=M&&M.gaps||"Gaps in Decision",W=M&&M.accept||"Accept",G=M&&M.reject||"Reject",z=M&&M.backAriaLabel||"Go back",O=k||[{id:"reject",label:G,onClick:()=>B("reject"),className:c.default["btn-reject"]},{id:"accept",label:W,onClick:()=>B("accept"),className:c.default["btn-accept"]}],J=T&&T.length>0;return e.jsxs("div",{className:`${c.default["cite-acc"]} ${y||""}`,style:{...a.default.CitationAccordionDefaults.container,...null==I?void 0:I.container},children:[S&&e.jsxs("div",{className:c.default["cite-acc__backHeader"],children:[e.jsx("button",{type:"button",className:c.default["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),S&&S()},"aria-label":z,children:"‹"}),e.jsx("span",{className:c.default["cite-acc__backTitle"],children:q})]}),e.jsx("div",{className:c.default["cite-body"],children:g&&g.length>0?g.map(t=>!1===t.show?null:e.jsxs("div",{className:`${c.default["cite-acc__explain-body"]} ${t.bodyClassName||""}`,children:[e.jsxs("div",{className:c.default["cite-acc__innerHeader"],style:{...a.default.CitationAccordionDefaults.innerHeader,...null==I?void 0:I.innerHeader},children:[e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:t.title})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),f&&f()},children:e.jsx(l.ChevronUp,{})})]}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...a.default.CitationAccordionDefaults.innerBody,...null==I?void 0:I.innerBody},children:"string"==typeof t.content?e.jsx(N,{text:t.content,item:t.item||i||{}}):t.content})]},t.id||t.title)):e.jsxs(e.Fragment,{children:[w&&e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsxs("div",{className:c.default["cite-acc__innerHeader"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:L})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),f&&f()},children:e.jsx(l.ChevronUp,{})})]}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(N,{text:m||"",item:i||{}})})]}),p&&"No explaination provided."!==p&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:E})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(N,{text:p||"",item:{}})})]}),e.jsx("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),v&&e.jsx("div",{className:c.default["cite-acc__btn-container"],children:O.map(t=>{const a=$||t.disabled;return e.jsx("button",{className:t.className,onClick:a?void 0:t.onClick,disabled:a,style:{...t.style,...a?{opacity:.5,cursor:"not-allowed",...D,...t.disabledStyle}:{}},children:t.label},t.id)})})]}),e.jsxs("div",{className:c.default["cite-acc__header"],children:[e.jsxs("div",{className:c.default["cite-acc__headerLeft"],children:[e.jsx("span",{className:c.default["cite-acc__titleIcon"],children:_?"function"==typeof _?x.default.createElement(_):_:e.jsx(r.ReactComponent,{})}),e.jsx("div",{className:c.default["cite-acc__title"],children:n})]}),e.jsx("div",{className:c.default["cite-acc__headerRight"],children:o&&e.jsxs("span",{className:c.default["cite-acc__scoreBadge"],children:[j?"function"==typeof j?x.default.createElement(j):j:e.jsx(s.ReactComponent,{}),e.jsxs("span",{className:c.default["cite-acc__scoreText"],children:[H,"%"]})]})})]}),e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:U})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:J?e.jsx(b,{text:u||"",markdownStyles:C,citationStyles:R,customIcons:A}):e.jsx(N,{text:u||"",item:i||{}})})]}),e.jsxs("div",{className:`${c.default["cite-acc__explain-body"]} ${c.default["cite-acc__explain-body_border"]}`,children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:F})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:J?e.jsx(b,{text:P||"",markdownStyles:C,citationStyles:R,customIcons:A}):e.jsx(N,{text:P||"",item:i||{}})})]})]})})]})},I);var R=t.memo(function(a){const{redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c}=m.useRequirementAI(),l=t.useRef({redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c}),r=t.useRef({onActionTrigger:a.onActionTrigger,redlineId:a.redlineId,aiReasonId:a.aiReasonId});l.current={redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c},r.current={onActionTrigger:a.onActionTrigger,redlineId:a.redlineId,aiReasonId:a.aiReasonId};const s=t.useCallback(async e=>{var t,a,c,s,d;const{redlineDcoumentId:o,redlineConfig:m,updateRedlineDataParent:h}=l.current,{onActionTrigger:x,redlineId:f,aiReasonId:v}=r.current;try{await(null==x?void 0:x({status:"loading",action:e,metadata:{redlineId:f,aiReasonId:v}}))}catch(e){}if(null==n?void 0:n.callResolveRedline)try{const{updated_reqai:l}=await u.resolveRedline({documentId:o,userEmail:null==m?void 0:m.userEmail,userName:null==m?void 0:m.userName,redlineId:null!=f?f:"",action:e,baseApiUrl:null==m?void 0:m.baseApiUrl,redlineConfigId:null!==(t=null==m?void 0:m.redlineConfigId)&&void 0!==t?t:""},null!==(a=null==m?void 0:m.token)&&void 0!==a?a:"");await(null==h?void 0:h(l));const r=null===(d=null===(s=null===(c=null==l?void 0:l.artifactData)||void 0===c?void 0:c.userStorySnapshot)||void 0===s?void 0:s[0])||void 0===d?void 0:d.artifactId;"string"==typeof r&&r.trim()&&"string"==typeof i&&i.trim()&&"string"==typeof(null==n?void 0:n.userName)&&(null==n?void 0:n.userName.trim())?p.default.emit(`redline-edit:${i}:${r}`,{updatedBy:null==n?void 0:n.userName}):console.error("invalid cwsEvent name or payload"),null==x||x({status:"success",action:e,metadata:{redlineId:f,aiReasonId:v}})}catch(t){null==x||x({status:"failed",action:e,metadata:{redlineId:f,aiReasonId:v}})}},[]);return e.jsx(C,{...a,resolveRedlineAction:s})},I);exports.default=R;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("../Popups/PopupDefaults.js"),i=require("react-markdown"),n=require("rehype-raw"),c=require("./CitationComponent.module.css.js"),l=require("lucide-react"),r=require("../icons/cognitiveBrain.svg.js"),s=require("../icons/aiMagic.svg.js"),d=require("./CitationAnchor.js"),o=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),u=require("../../../../../service/redlineService.js"),m=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),p=require("../cws/CwsEvent.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(t),v=h(i),f=h(n);const g=(e="")=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),_=(e,t)=>{try{const a=e.match(new RegExp(`${t}=(["'])(.*?)\\1`,"i"));return a&&a.length>=3&&a[2]||""}catch(e){return console.error("Regex matching failed in getAnchorAttribute",e),""}},j=(e,t)=>{let a=[];try{a=[...e.matchAll(/<a\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/a>/gi)].map(e=>{var t;return e&&e.length>=3?{fullMatch:e[0],attributes:e[1],label:e[2],index:null!==(t=e.index)&&void 0!==t?t:0}:null}).filter(e=>Boolean(e))}catch(t){return console.error("Failed to parse anchors in line",t),e}const i=a.find(e=>{return t=e.attributes,_(t,"href").startsWith("pdf_citation$");var t}),n=a.find(e=>{return t=e.attributes,_(t,"href").includes("gpt_citation")||t.includes("phrase_to_highlight=");var t});if(!i||!n)return e;const c=((e,t,a,i,n)=>{const c=_(a,"href"),l=_(a,"type")||(c.includes("gpt_citation")?"gpt_citation":""),r=_(a,"reason"),s=c.split("?")[1]||"",d=s&&new URLSearchParams(s).get("phrase_to_highlight")||"",o=c.includes("gpt_citation")&&void 0!==n?` data-secondary-occurrence-index="${n}"`:"";return`<a${e} data-dual-citation="true" data-secondary-href="${g(c)}" data-secondary-type="${g(l)}" data-secondary-title="${g(i)}" data-secondary-reason="${g(r)}" data-secondary-phrase-to-highlight="${g(d)}"${o}>${t}</a>`})(i.attributes,i.label,n.attributes,n.label,_(n.attributes,"href").includes("gpt_citation")?t():void 0),l=(n.index>i.index?e.slice(i.index+i.fullMatch.length,n.index):e.slice(n.index+n.fullMatch.length,i.index)).trim()?n.label:"";return e.replace(i.fullMatch,c).replace(n.fullMatch,l)},y=(e,t)=>{var a,i;let n=t;try{n=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}catch(e){console.error("String replacement failed in getDataAttribute",e)}return null!==(i=null!==(a=null==e?void 0:e[t])&&void 0!==a?a:null==e?void 0:e[n])&&void 0!==i?i:""},N=({text:a,item:i})=>{const n=t.useMemo(()=>(e=>{let t=0;const a=()=>t++;return e.split("\n").map(e=>j(e,a)).join("\n")})(a),[a]);return e.jsx(v.default,{rehypePlugins:[f.default],components:{ol:({children:t})=>e.jsx("ol",{className:c.default["md-ol"],children:t}),ul:({children:t})=>e.jsx("ul",{className:c.default["md-ul"],children:t}),li:({children:t})=>e.jsx("li",{className:c.default["md-li"],children:t}),a:({node:t,href:a,children:n})=>{const c=(null==t?void 0:t.properties)||{},l=y(c,"data-secondary-href");return e.jsx(d.default,{href:a,children:n,secondaryCitation:l?{href:l,title:y(c,"data-secondary-title"),type:y(c,"data-secondary-type"),reason:y(c,"data-secondary-reason"),phraseToHighlight:y(c,"data-secondary-phrase-to-highlight"),occurrenceIndex:Number(y(c,"data-secondary-occurrence-index")||0)}:void 0,metaData:{citations:i.citations,docData:i.docData,guidelinesData:i.guidelinesData,gptCitations:i.gptCitations}})}},children:n.replace(/<br\s*\/?>/gi,"\n")})},b=({text:t,markdownStyles:a,citationStyles:i,customIcons:n})=>e.jsx(o.AiReasonMarkdownWrapper,{message:t.replace(/<br\s*\/?>/gi,"\n"),customStyles:a,citationStyles:i,customIcons:n}),I=(e,t)=>{return e.disableAllActions===t.disableAllActions&&(e.redlineId===t.redlineId&&(e.aiReasonId===t.aiReasonId&&(e.relevanceScore===t.relevanceScore&&(e.reason===t.reason&&(e.impact===t.impact&&(e.explaination===t.explaination&&(e.gap===t.gap&&(a=e.item,i=t.item,a===i||(a&&i?a.citations===i.citations&&a.guidelinesData===i.guidelinesData&&a.docData===i.docData&&(null===(n=a.docData)||void 0===n?void 0:n.input_index_map)===(null===(c=i.docData)||void 0===c?void 0:c.input_index_map)&&(null===(l=a.docData)||void 0===l?void 0:l.documents)===(null===(r=i.docData)||void 0===r?void 0:r.documents):a===i)))))))));var a,i,n,c,l,r},C=t.memo(function({item:i,title:n="Cognitive Decisioning AI",relevanceScore:d=0,showRelevanceScore:o=!0,reason:u="No reasoning provided.",impact:m="No Impact provided.",explaination:p="No explaination provided.",gap:h="None",onClose:v=()=>{},showResolveBtns:f=!1,sections:g,leftIcon:_,scoreIcon:j,className:y,customStyles:I={},markdownStyles:C,citationStyles:R,customIcons:A,actions:D,disableAllActions:k=!1,actionBtnDisabledStyle:$={},onBackClick:S,isImpactNeeded:w=!0,cognitiveTitle:q="Cognitive Integrity",labels:M={},chatHistory:T,resolveRedlineAction:B}){const H=t.useMemo(()=>{const e=Number(d);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[d]),P=t.useMemo(()=>{const e=M&&M.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const t=e.trim().toLowerCase();return"none"===t||"no gap"===t||"no gaps"===t||"n/a"===t})(h)?e:h},[h]),L=M&&M.impact||"Impact",E=M&&M.explanation||"Explaination",U=M&&M.decisionFactors||"Decision Making Factors",F=M&&M.gaps||"Gaps in Decision",W=M&&M.accept||"Accept",G=M&&M.reject||"Reject",z=M&&M.backAriaLabel||"Go back",O=D||[{id:"reject",label:G,onClick:()=>B("reject"),className:c.default["btn-reject"]},{id:"accept",label:W,onClick:()=>B("accept"),className:c.default["btn-accept"]}],J=T&&T.length>0;return e.jsxs("div",{className:`${c.default["cite-acc"]} ${y||""}`,style:{...a.default.CitationAccordionDefaults.container,...null==I?void 0:I.container},children:[S&&e.jsxs("div",{className:c.default["cite-acc__backHeader"],children:[e.jsx("button",{type:"button",className:c.default["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),S&&S()},"aria-label":z,children:"‹"}),e.jsx("span",{className:c.default["cite-acc__backTitle"],children:q})]}),e.jsx("div",{className:c.default["cite-body"],children:g&&g.length>0?g.map(t=>!1===t.show?null:e.jsxs("div",{className:`${c.default["cite-acc__explain-body"]} ${t.bodyClassName||""}`,children:[e.jsxs("div",{className:c.default["cite-acc__innerHeader"],style:{...a.default.CitationAccordionDefaults.innerHeader,...null==I?void 0:I.innerHeader},children:[e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:t.title})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),v&&v()},children:e.jsx(l.ChevronUp,{})})]}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...a.default.CitationAccordionDefaults.innerBody,...null==I?void 0:I.innerBody},children:"string"==typeof t.content?e.jsx(N,{text:t.content,item:t.item||i||{}}):t.content})]},t.id||t.title)):e.jsxs(e.Fragment,{children:[w&&e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsxs("div",{className:c.default["cite-acc__innerHeader"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:L})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),v&&v()},children:e.jsx(l.ChevronUp,{})})]}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(N,{text:m||"",item:i||{}})})]}),p&&"No explaination provided."!==p&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:E})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(N,{text:p||"",item:{}})})]}),e.jsx("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),f&&e.jsx("div",{className:c.default["cite-acc__btn-container"],children:O.map(t=>{const a=k||t.disabled;return e.jsx("button",{className:t.className,onClick:a?void 0:t.onClick,disabled:a,style:{...t.style,...a?{opacity:.5,cursor:"not-allowed",...$,...t.disabledStyle}:{}},children:t.label},t.id)})})]}),e.jsxs("div",{className:c.default["cite-acc__header"],children:[e.jsxs("div",{className:c.default["cite-acc__headerLeft"],children:[e.jsx("span",{className:c.default["cite-acc__titleIcon"],children:_?"function"==typeof _?x.default.createElement(_):_:e.jsx(r.ReactComponent,{})}),e.jsx("div",{className:c.default["cite-acc__title"],children:n})]}),e.jsx("div",{className:c.default["cite-acc__headerRight"],children:o&&e.jsxs("span",{className:c.default["cite-acc__scoreBadge"],children:[j?"function"==typeof j?x.default.createElement(j):j:e.jsx(s.ReactComponent,{}),e.jsxs("span",{className:c.default["cite-acc__scoreText"],children:[H,"%"]})]})})]}),e.jsxs("div",{className:c.default["cite-acc__explain-body"],children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:U})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:J?e.jsx(b,{text:u||"",markdownStyles:C,citationStyles:R,customIcons:A}):e.jsx(N,{text:u||"",item:i||{}})})]}),e.jsxs("div",{className:`${c.default["cite-acc__explain-body"]} ${c.default["cite-acc__explain-body_border"]}`,children:[e.jsx("div",{className:c.default["cite-acc__innerHeader"],children:e.jsx("div",{className:c.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:c.default["cite-acc__innerTitle"],children:F})})})}),e.jsx("div",{className:`${c.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:J?e.jsx(b,{text:P||"",markdownStyles:C,citationStyles:R,customIcons:A}):e.jsx(N,{text:P||"",item:i||{}})})]})]})})]})},I);var R=t.memo(function(a){const{redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c}=m.useRequirementAI(),l=t.useRef({redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c}),r=t.useRef({onActionTrigger:a.onActionTrigger,redlineId:a.redlineId,aiReasonId:a.aiReasonId});l.current={redlineDcoumentId:i,redlineConfig:n,updateRedlineDataParent:c},r.current={onActionTrigger:a.onActionTrigger,redlineId:a.redlineId,aiReasonId:a.aiReasonId};const s=t.useCallback(async e=>{var t,a,c,s,d;const{redlineDcoumentId:o,redlineConfig:m,updateRedlineDataParent:h}=l.current,{onActionTrigger:x,redlineId:v,aiReasonId:f}=r.current;try{await(null==x?void 0:x({status:"loading",action:e,metadata:{redlineId:v,aiReasonId:f}}))}catch(e){}if(null==n?void 0:n.callResolveRedline)try{const{updated_reqai:l}=await u.resolveRedline({documentId:o,userEmail:null==m?void 0:m.userEmail,userName:null==m?void 0:m.userName,redlineId:null!=v?v:"",action:e,baseApiUrl:null==m?void 0:m.baseApiUrl,redlineConfigId:null!==(t=null==m?void 0:m.redlineConfigId)&&void 0!==t?t:""},null!==(a=null==m?void 0:m.token)&&void 0!==a?a:"");await(null==h?void 0:h(l));const r=null===(d=null===(s=null===(c=null==l?void 0:l.artifactData)||void 0===c?void 0:c.userStorySnapshot)||void 0===s?void 0:s[0])||void 0===d?void 0:d.artifactId;"string"==typeof r&&r.trim()&&"string"==typeof i&&i.trim()&&"string"==typeof(null==n?void 0:n.userName)&&(null==n?void 0:n.userName.trim())?p.default.emit(`redline-edit:${i}:${r}`,{updatedBy:null==n?void 0:n.userName}):console.error("invalid cwsEvent name or payload"),null==x||x({status:"success",action:e,metadata:{redlineId:v,aiReasonId:f}})}catch(t){null==x||x({status:"failed",action:e,metadata:{redlineId:v,aiReasonId:f}})}},[]);return e.jsx(C,{...a,resolveRedlineAction:s})},I);exports.default=R;
2
2
  //# sourceMappingURL=CognitiveComponent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("react-dom"),n=require("@monaco-editor/react"),i=require("./ReadFileCitationContent.module.css.js"),a=require("./icons/ExternalLinkIcon.js"),r=require("lucide-react"),o=require("./CustomFileIcon.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(l),u=s(n);const c=e=>"number"==typeof e&&Number.isFinite(e),h=(e,t)=>c(e)&&c(t)?e<=0||t<e?null:{start:e,end:t,length:t-e+1}:null,m=(e,t,l,n)=>{let[i,a]=e;if(!Number.isFinite(i)||!Number.isFinite(a))return null;if(a<i&&([i,a]=[a,i]),c(l)&&c(n)){const e=Math.max(i,l),r=Math.min(a,n);if(e>r)return null;const o=e-l+1,s=r-l+1,d=Math.max(1,o),u=Math.min(t,s);return d>u?null:[d,u]}const r=Math.max(1,i),o=Math.min(t,a);return r>o?null:[r,o]},f=(e,t,l,n)=>{if(0===e.length)return!1;const i=h(l,n);if(!i)return!1;if(e.some(([e,l])=>e>t||l>t))return!0;if(i.start>t||i.end>t)return!0;if(Math.abs(i.length-t)<=1){return!e.every(([e,t])=>t<i.start||e>i.end)}return!1},g={border:"#3c3c3c",headerBg:"#252526",inactiveText:"#858585",background:"#1e1e1e",foreground:"#cccccc",highlightBg:"rgba(59, 130, 246, 0.15)",highlightGutter:"#3b82f6",hoverBg:"rgba(255, 255, 255, 0.1)"},p={theme:"vs-dark",fontSize:13,fontFamily:"Consolas, 'Courier New', monospace",maxHeight:300,minHeight:80},v={js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",py:"python",rb:"ruby",java:"java",cpp:"cpp",c:"c",go:"go",rust:"rust",json:"json",html:"html",css:"css",scss:"scss",md:"markdown",sql:"sql",sh:"shell",bash:"shell",yaml:"yaml",yml:"yaml"};exports.default=({citation:l,customStyles:n,customColors:s,customIcons:x,editorConfig:b,fileCallback:y})=>{const j=t.useMemo(()=>({...g,...s}),[s]),C=t.useMemo(()=>({...p,...b}),[b]),[N,M]=t.useState(!1),k=t.useRef(null),F=t.useRef(!1),w=l.customMetadata.content||"",S=l.customMetadata.highlighted_text,O=l.customMetadata.start_line,L=l.customMetadata.end_line,B=c(O)?O+1:O,P=t.useMemo(()=>{if(!S)return{};try{let e=S.trim();return e.startsWith("```")&&(e=e.replace(/^```\w*\n?/,""),e=e.replace(/\n?```\s*$/,"")),JSON.parse(e.trim())}catch(e){return console.error("Failed to parse highlight string:",e),{}}},[S]),T=t.useMemo(()=>{const e=[],t=/```(\w+)?\s*<file_path>([\s\S]*?)<\/file_path>\s*<code>([\s\S]*?)<\/code>\s*```/g;let l;for(;null!==(l=t.exec(w));){const t=l[1]||"javascript",n=l[2].trim(),i=l[3].trim();n&&i&&e.push({filePath:n,code:i,language:t})}return e},[w]),H=t.useCallback(e=>(P[e]||[]).map(e=>{const t=e.split("-").map(e=>Number(e.trim())),l=t[0],n=t.length>1?t[1]:l;return Number.isFinite(l)&&Number.isFinite(n)?[l,n]:null}).filter(e=>null!==e),[P]),q=t.useMemo(()=>{for(let e=0;e<T.length;e++){const t=T[e],l=t.code.split("\n").length,n=H(t.filePath),i=f(n,l,B,L);if(n.map(e=>m(e,l,i?B:void 0,i?L:void 0)).filter(e=>null!==e).length>0)return e}return-1},[T,H,B,L]),z=q>=0,R=t.useCallback((e,t)=>{const l=H(e),n=f(l,t,B,L);return l.map(e=>m(e,t,n?B:void 0,n?L:void 0)).filter(e=>null!==e)},[H,B,L]),E=t.useCallback((e,t)=>{const l=H(e);if(f(l,t,B,L)){const e=h(B,L);return e?l.map(([t,l])=>{const n=t<=l?[t,l]:[l,t],i=Math.max(n[0],e.start),a=Math.min(n[1],e.end);return i>a?null:[i,a]}).filter(e=>null!==e):[]}return R(e,t)},[H,R,B,L]);t.useEffect(()=>{if(z&&!F.current&&T.length>0&&(null==y?void 0:y.autoOpenFirstHighlighted)&&(null==y?void 0:y.onOpenFile)){const e=T[q],t=E(e.filePath,e.code.split("\n").length);F.current=!0;const l=setTimeout(()=>{y.onOpenFile({filePath:e.filePath,ranges:t.length>0?t:null})},300);return()=>clearTimeout(l)}},[z,q,T,R,y]),t.useEffect(()=>{F.current=!1},[w]),t.useEffect(()=>{if(q<0)return;const e=setTimeout(()=>{var e;null===(e=k.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},350);return()=>clearTimeout(e)},[q,S]);const W=t.useCallback((e,t)=>{if(null==y?void 0:y.onOpenFile){const l=E(e,t);y.onOpenFile({filePath:e,ranges:l.length>0?l:null})}},[E,y]),$=t.useCallback(()=>{(null==y?void 0:y.onExpandClick)?y.onExpandClick({blocks:T,highlightMap:P}):M(!0)},[y,T,P]),I=!!(null==y?void 0:y.onOpenFile),_=(null==x?void 0:x.readFileCitationIcon)||e.jsx(a.default,{style:{width:"14px",height:"14px"}}),D=t.useCallback((e,t,l,n)=>{const a=[];if(l.forEach(([e,l])=>{a.push({range:new t.Range(e,1,l,1),options:{isWholeLine:!0,className:i.default.yellowHighlightedLine,linesDecorationsClassName:i.default.yellowHighlightedLineDecoration}})}),a.length>0)try{e.createDecorationsCollection(a)}catch(e){console.warn("Failed to create decorations:",e)}const r=l[0];r&&requestAnimationFrame(()=>{e.revealLineInCenter(r[0])}),n>0&&e.updateOptions({lineNumbers:e=>String(e+n)})},[]),G=t=>T.map((l,a)=>{const o=l.code.split("\n").length,s=H(l.filePath),d=f(s,o,B,L),h=s.map(e=>m(e,o,d?B:void 0,d?L:void 0)).filter(e=>null!==e),g=d&&c(B)?h.map(([e,t])=>[e+B-1,t+B-1]):h,p=h.length>0,x=a===q,b=t?600:C.maxHeight,y=(()=>{const e=20*l.code.split("\n").length+16+4;return Math.min(Math.max(e,C.minHeight),b)})(),N=l.filePath.split("/").pop(),M=d&&c(B)?B-1:0,F=M+o,w=String(Math.max(1,F)).length;return e.jsxs("div",{ref:!t&&x?k:void 0,"data-highlighted":p?"true":void 0,"data-first-highlighted":x?"true":void 0,className:i.default.blockContainer,style:{border:`1px solid ${j.border}`,...null==n?void 0:n.blockContainer},children:[e.jsxs("div",{className:i.default.header,style:{backgroundColor:p?j.highlightBg:j.headerBg,borderBottom:`1px solid ${j.border}`,color:p?j.highlightGutter:j.foreground,...p?null==n?void 0:n.headerHighlighted:null==n?void 0:n.header},children:[e.jsxs("div",{className:i.default.headerLeft,children:[e.jsx("span",{className:i.default.fileName,title:l.filePath,style:null==n?void 0:n.fileName,onClick:()=>W(l.filePath,o),children:N}),I&&e.jsx("button",{className:i.default.openFileButton,onClick:()=>W(l.filePath,o),title:"Open in editor","aria-label":`Open ${N} in editor`,style:null==n?void 0:n.openFileButton,children:_})]}),e.jsxs("div",{className:i.default.headerRight,children:[p&&e.jsx("span",{className:i.default.lineRanges,style:null==n?void 0:n.lineRanges,children:(O=g,O.map(([e,t])=>e===t?`L${e}`:`L${e}-${t}`).join(", "))}),!t&&0===a&&e.jsx("button",{className:i.default.expandButton,style:null==n?void 0:n.expandButton,onClick:$,title:"Expand","aria-label":"Expand code view",children:e.jsx(r.Maximize2,{size:13})})]})]}),e.jsx("div",{className:i.default.editorWrapper,style:{height:`${y}px`,backgroundColor:j.background,...null==n?void 0:n.editorWrapper},children:e.jsx(u.default,{height:"100%",language:(S=l.language,v[S.toLowerCase()]||S),value:l.code,theme:C.theme,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:C.fontSize,lineHeight:20,fontFamily:C.fontFamily,lineNumbers:M>0?e=>String(e+M):"on",folding:!1,lineDecorationsWidth:10,lineNumbersMinChars:Math.max(4,w),renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!1,alwaysConsumeMouseWheel:!1},automaticLayout:!0,wordWrap:"off",contextmenu:!1,selectOnLineNumbers:!0,glyphMargin:!1,padding:{top:8,bottom:8},overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,overviewRulerLanes:0,renderWhitespace:"none",guides:{indentation:!1},cursorStyle:"line",cursorBlinking:"solid",fixedOverflowWidgets:!0},onMount:(e,t)=>D(e,t,h,M),loading:e.jsx("div",{className:i.default.editorLoading,style:{color:j.inactiveText},children:"Loading editor..."})})})]},a);var S,O});if(0===T.length)return e.jsx("div",{className:i.default.emptyState,style:{color:j.inactiveText,...null==n?void 0:n.emptyState},children:"No code content available"});const A=N?d.default.createPortal(e.jsx("div",{className:i.default.modalOverlay,style:null==n?void 0:n.modalOverlay,onClick:e=>{e.target===e.currentTarget&&M(!1)},children:e.jsxs("div",{className:i.default.modalContent,style:null==n?void 0:n.modalContent,children:[e.jsxs("div",{className:i.default.modalHeader,style:null==n?void 0:n.modalHeader,children:[e.jsx("span",{className:i.default.modalTitle,style:null==n?void 0:n.modalTitle,children:1===T.length?e.jsxs("span",{className:i.default.modalTitleContent,children:[e.jsx(o.default,{name:T[0].filePath,size:"15px"}),e.jsx("span",{className:i.default.modalTitleText,children:T[0].filePath})]}):`${T.length} files`}),e.jsx("button",{className:i.default.modalCloseButton,style:null==n?void 0:n.modalCloseButton,onClick:()=>M(!1),"aria-label":"Close expanded view",children:e.jsx(r.X,{size:16})})]}),e.jsx("div",{className:i.default.modalBody,children:e.jsx("div",{className:i.default.container,style:null==n?void 0:n.container,children:G(!0)})})]})}),document.body):null;return e.jsxs(e.Fragment,{children:[A,e.jsx("div",{className:i.default.container,style:null==n?void 0:n.container,children:G(!1)})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("react-dom"),n=require("@monaco-editor/react"),i=require("./ReadFileCitationContent.module.css.js"),a=require("./icons/ExternalLinkIcon.js"),o=require("lucide-react"),r=require("./CustomFileIcon.js"),s=require("@mui/material");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(l),u=d(n);const h=e=>"number"==typeof e&&Number.isFinite(e),m=(e,t)=>h(e)&&h(t)?e<=0||t<e?null:{start:e,end:t,length:t-e+1}:null,p=(e,t,l,n)=>{let[i,a]=e;if(!Number.isFinite(i)||!Number.isFinite(a))return null;if(a<i&&([i,a]=[a,i]),h(l)&&h(n)){const e=Math.max(i,l),o=Math.min(a,n);if(e>o)return null;const r=e-l+1,s=o-l+1,d=Math.max(1,r),c=Math.min(t,s);return d>c?null:[d,c]}const o=Math.max(1,i),r=Math.min(t,a);return o>r?null:[o,r]},f=(e,t,l,n)=>{if(0===e.length)return!1;const i=m(l,n);if(!i)return!1;if(e.some(([e,l])=>e>t||l>t))return!0;if(i.start>t||i.end>t)return!0;if(Math.abs(i.length-t)<=1){return!e.every(([e,t])=>t<i.start||e>i.end)}return!1},g={border:"#3c3c3c",headerBg:"#252526",inactiveText:"#858585",background:"#1e1e1e",foreground:"#cccccc",highlightBg:"rgba(59, 130, 246, 0.15)",highlightGutter:"#3b82f6",hoverBg:"rgba(255, 255, 255, 0.1)"},v={theme:"vs-dark",fontSize:13,fontFamily:"Consolas, 'Courier New', monospace",maxHeight:300,minHeight:80},x={js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",py:"python",rb:"ruby",java:"java",cpp:"cpp",c:"c",go:"go",rust:"rust",json:"json",html:"html",css:"css",scss:"scss",md:"markdown",sql:"sql",sh:"shell",bash:"shell",yaml:"yaml",yml:"yaml"},b=e=>e.map(([e,t])=>e===t?`L${e}`:`L${e}-${t}`).join(", ");exports.default=({citation:l,customStyles:n,customColors:d,customIcons:y,editorConfig:j,fileCallback:C})=>{const N=t.useMemo(()=>({...g,...d}),[d]),M=t.useMemo(()=>({...v,...j}),[j]),[k,w]=t.useState(!1),F=t.useRef(null),P=t.useRef(!1),S=t.useRef(null);t.useEffect(()=>{const e=()=>{const e=document.querySelectorAll("dialog[open]");S.current=e.length>0?e[e.length-1]:document.body};e();const t=new MutationObserver(e);return t.observe(document.body,{subtree:!0,attributes:!0,attributeFilter:["open"]}),()=>t.disconnect()},[]);const O=t.useMemo(()=>({popper:{container:()=>{var e;return null!==(e=S.current)&&void 0!==e?e:document.body},sx:{zIndex:15e5}}}),[]),T=l.customMetadata.content||"",L=l.customMetadata.highlighted_text,B=l.customMetadata.start_line,q=l.customMetadata.end_line,E=h(B)?B+1:B,H=t.useMemo(()=>{if(!L)return{};try{let e=L.trim();return e.startsWith("```")&&(e=e.replace(/^```\w*\n?/,""),e=e.replace(/\n?```\s*$/,"")),JSON.parse(e.trim())}catch(e){return console.error("Failed to parse highlight string:",e),{}}},[L]),z=t.useMemo(()=>{const e=[],t=/```(\w+)?\s*<file_path>([\s\S]*?)<\/file_path>\s*<code>([\s\S]*?)<\/code>\s*```/g;let l;for(;null!==(l=t.exec(T));){const t=l[1]||"javascript",n=l[2].trim(),i=l[3].trim();n&&i&&e.push({filePath:n,code:i,language:t})}return e},[T]),R=t.useCallback(e=>(H[e]||[]).map(e=>{const t=e.split("-").map(e=>Number(e.trim())),l=t[0],n=t.length>1?t[1]:l;return Number.isFinite(l)&&Number.isFinite(n)?[l,n]:null}).filter(e=>null!==e),[H]),$=t.useMemo(()=>{for(let e=0;e<z.length;e++){const t=z[e],l=t.code.split("\n").length,n=R(t.filePath),i=f(n,l,E,q);if(n.map(e=>p(e,l,i?E:void 0,i?q:void 0)).filter(e=>null!==e).length>0)return e}return-1},[z,R,E,q]),W=$>=0,I=t.useCallback((e,t)=>{const l=R(e),n=f(l,t,E,q);return l.map(e=>p(e,t,n?E:void 0,n?q:void 0)).filter(e=>null!==e)},[R,E,q]),_=t.useCallback((e,t)=>{const l=R(e);if(f(l,t,E,q)){const e=m(E,q);return e?l.map(([t,l])=>{const n=t<=l?[t,l]:[l,t],i=Math.max(n[0],e.start),a=Math.min(n[1],e.end);return i>a?null:[i,a]}).filter(e=>null!==e):[]}return I(e,t)},[R,I,E,q]);t.useEffect(()=>{if(W&&!P.current&&z.length>0&&(null==C?void 0:C.autoOpenFirstHighlighted)&&(null==C?void 0:C.onOpenFile)){const e=z[$],t=_(e.filePath,e.code.split("\n").length);P.current=!0;const l=setTimeout(()=>{C.onOpenFile({filePath:e.filePath,ranges:t.length>0?t:null})},300);return()=>clearTimeout(l)}},[W,$,z,I,C]),t.useEffect(()=>{P.current=!1},[T]),t.useEffect(()=>{if($<0)return;const e=setTimeout(()=>{var e;null===(e=F.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},350);return()=>clearTimeout(e)},[$,L]);const D=t.useCallback((e,t)=>{if(null==C?void 0:C.onOpenFile){const l=_(e,t);C.onOpenFile({filePath:e,ranges:l.length>0?l:null})}},[_,C]),A=t.useMemo(()=>!C||(!!C.onExpandClick||!("onExpandClick"in C&&!C.onExpandClick)),[C]),G=t.useCallback(()=>{(null==C?void 0:C.onExpandClick)?C.onExpandClick({blocks:z,highlightMap:H}):w(!0)},[C,z,H]),J=!!(null==C?void 0:C.onOpenFile),V=(null==y?void 0:y.readFileCitationIcon)||e.jsx(a.default,{style:{width:"14px",height:"14px"}}),X=t.useCallback((e,t,l,n)=>{const a=[];if(l.forEach(([e,l])=>{a.push({range:new t.Range(e,1,l,1),options:{isWholeLine:!0,className:i.default.yellowHighlightedLine,linesDecorationsClassName:i.default.yellowHighlightedLineDecoration}})}),a.length>0)try{e.createDecorationsCollection(a)}catch(e){console.warn("Failed to create decorations:",e)}const o=l[0];o&&requestAnimationFrame(()=>{e.revealLineInCenter(o[0])}),n>0&&e.updateOptions({lineNumbers:e=>String(e+n)})},[]),K=t=>z.map((l,a)=>{const r=l.code.split("\n").length,d=R(l.filePath),c=f(d,r,E,q),m=d.map(e=>p(e,r,c?E:void 0,c?q:void 0)).filter(e=>null!==e),g=c&&h(E)?m.map(([e,t])=>[e+E-1,t+E-1]):m,v=m.length>0,y=a===$,j=t?600:M.maxHeight,C=(()=>{const e=20*l.code.split("\n").length+16+4;return Math.min(Math.max(e,M.minHeight),j)})(),k=l.filePath.split("/").pop()||l.filePath,w=c&&h(E)?E-1:0,P=w+r,S=String(Math.max(1,P)).length;return e.jsxs("div",{ref:!t&&y?F:void 0,"data-highlighted":v?"true":void 0,"data-first-highlighted":y?"true":void 0,className:i.default.blockContainer,style:{border:`1px solid ${N.border}`,...null==n?void 0:n.blockContainer},children:[e.jsxs("div",{className:i.default.header,style:{backgroundColor:v?N.highlightBg:N.headerBg,borderBottom:`1px solid ${N.border}`,color:v?N.highlightGutter:N.foreground,...v?null==n?void 0:n.headerHighlighted:null==n?void 0:n.header},children:[e.jsxs("div",{className:i.default.headerLeft,children:[e.jsx(s.Tooltip,{title:l.filePath,arrow:!0,placement:"top",slotProps:O,children:e.jsx("span",{className:i.default.fileName,style:null==n?void 0:n.fileName,onClick:()=>D(l.filePath,r),children:k})}),J&&e.jsx(s.Tooltip,{title:`Open ${k} in editor`,arrow:!0,placement:"top",slotProps:O,children:e.jsx("button",{className:i.default.openFileButton,onClick:()=>D(l.filePath,r),"aria-label":`Open ${k} in editor`,style:null==n?void 0:n.openFileButton,children:V})})]}),e.jsxs("div",{className:i.default.headerRight,children:[v&&e.jsx(s.Tooltip,{title:`Highlighted lines: ${b(g)}`,arrow:!0,placement:"top",slotProps:O,children:e.jsx("span",{className:i.default.lineRanges,style:null==n?void 0:n.lineRanges,children:b(g)})}),!t&&A&&0===a&&e.jsx(s.Tooltip,{title:"Expand code view",arrow:!0,placement:"top",slotProps:O,children:e.jsx("button",{className:i.default.expandButton,style:null==n?void 0:n.expandButton,onClick:G,"aria-label":`Expand ${k} code view`,children:e.jsx(o.Maximize2,{size:13})})})]})]}),e.jsx("div",{className:i.default.editorWrapper,style:{height:`${C}px`,backgroundColor:N.background,...null==n?void 0:n.editorWrapper},children:e.jsx(u.default,{height:"100%",language:(T=l.language,x[T.toLowerCase()]||T),value:l.code,theme:M.theme,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:M.fontSize,lineHeight:20,fontFamily:M.fontFamily,lineNumbers:w>0?e=>String(e+w):"on",folding:!1,lineDecorationsWidth:10,lineNumbersMinChars:Math.max(4,S),renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!1,alwaysConsumeMouseWheel:!1},automaticLayout:!0,wordWrap:"off",contextmenu:!1,selectOnLineNumbers:!0,glyphMargin:!1,padding:{top:8,bottom:8},overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,overviewRulerLanes:0,renderWhitespace:"none",guides:{indentation:!1},cursorStyle:"line",cursorBlinking:"solid",fixedOverflowWidgets:!0},onMount:(e,t)=>X(e,t,m,w),loading:e.jsx("div",{className:i.default.editorLoading,style:{color:N.inactiveText},children:"Loading editor..."})})})]},a);var T});if(0===z.length)return e.jsx("div",{className:i.default.emptyState,style:{color:N.inactiveText,...null==n?void 0:n.emptyState},children:"No code content available"});const Q=k?c.default.createPortal(e.jsx("div",{className:i.default.modalOverlay,style:null==n?void 0:n.modalOverlay,onClick:e=>{e.target===e.currentTarget&&w(!1)},children:e.jsxs("div",{className:i.default.modalContent,style:null==n?void 0:n.modalContent,children:[e.jsxs("div",{className:i.default.modalHeader,style:null==n?void 0:n.modalHeader,children:[e.jsx("span",{className:i.default.modalTitle,style:null==n?void 0:n.modalTitle,children:1===z.length?e.jsx(s.Tooltip,{title:z[0].filePath,arrow:!0,placement:"top",slotProps:O,children:e.jsxs("span",{className:i.default.modalTitleContent,children:[e.jsx(r.default,{name:z[0].filePath,size:"15px"}),e.jsx("span",{className:i.default.modalTitleText,children:z[0].filePath})]})}):`${z.length} files`}),e.jsx(s.Tooltip,{title:"Close expanded view",arrow:!0,placement:"bottom",slotProps:O,children:e.jsx("button",{className:i.default.modalCloseButton,style:null==n?void 0:n.modalCloseButton,onClick:()=>w(!1),"aria-label":"Close expanded view",children:e.jsx(o.X,{size:16})})})]}),e.jsx("div",{className:i.default.modalBody,children:e.jsx("div",{className:i.default.container,style:null==n?void 0:n.container,children:K(!0)})})]})}),document.body):null;return e.jsxs(e.Fragment,{children:[Q,e.jsx("div",{className:i.default.container,style:null==n?void 0:n.container,children:K(!1)})]})};
2
2
  //# sourceMappingURL=ReadFileCitationContent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),i=require("../utils/proccess-stream.utils.js");exports.useStreamContentHandler=function({setUserStory:t,setAiReasoning:o,setUserStoryCitations:n,onStreamingCompleted:r,isGraphQLCallInProgress:s,knowledgeBase:a,projectAnalyserSummary:u,dataSourceFiles:l,aiReasoning:c,setRedisValue:d,fetchCitationByBlock:_}){const p=e.useRef(new Set),m=e.useRef(new Set),g=e.useRef(null),b=e.useRef(null),v=e.useRef({gap_items_prompt:"",risk_items_prompt:""}),f=e.useRef(new Set);async function h(e,i,t){var a,u;let l="",c="";try{const r=await _(e,t,i);o(e=>{var i;const t=[...e];return null===(i=r.response.ai_reasonings)||void 0===i||i.forEach(e=>{const i=t.findIndex(i=>i.id===e.id);-1!==i&&e.gap.length>0&&e.reason.length>0&&(t[i]={...e})}),t}),l=(null===(a=r.response)||void 0===a?void 0:a.gap_items_prompt)||"",c=(null===(u=r.response)||void 0===u?void 0:u.risk_items_prompt)||"",(l||c)&&(v.current={gap_items_prompt:l,risk_items_prompt:c}),n(e=>{var i,t,o,n,s,a,u,l,c,d,_,p,m,g;return{...e,appmod_citations:[...null!==(i=e.appmod_citations)&&void 0!==i?i:[],...null!==(t=r.response.appmod_citations)&&void 0!==t?t:[]],audio_citations:[...null!==(o=e.audio_citations)&&void 0!==o?o:[],...null!==(n=r.response.audio_citations)&&void 0!==n?n:[]],file_citations:[...null!==(s=e.file_citations)&&void 0!==s?s:[],...null!==(a=r.response.file_citations)&&void 0!==a?a:[]],image_citations:[...null!==(u=e.image_citations)&&void 0!==u?u:[],...null!==(l=r.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=r.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(_=e.web_citations)&&void 0!==_?_:[],...null!==(p=r.response.web_citations)&&void 0!==p?p:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=r.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(i){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,i)}finally{let i=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(m.current.add(i),m.current.size===p.current.size&&!s.current){const e=l||v.current.gap_items_prompt,i=c||v.current.risk_items_prompt;await r(e,i),p.current.clear(),m.current.clear(),g.current=null,b.current=null,v.current={gap_items_prompt:"",risk_items_prompt:""},f.current.clear()}}}return{processStreamContent:function(e,r,s){try{const _=JSON.stringify(e);if(b.current===_)return;b.current=_;let m=[],v=[];e=e.map(e=>{var t;const o=`${(e={...e,subBlockNumber:null!==(t=e.subBlockNumber)&&void 0!==t?t:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(f.current.has(o))return null;f.current.add(o);let{outputText:s,reasonings:a,gpt_citation:u,processedDescription:l}=i.processAIReasoningFromBlocks(e.value,e.blockNumber,e.storyNumber,e.description);n(e=>{var i;return u.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(i=e.gpt_citations)||void 0===i||i.push(...u)),{...e}}),m.push(...a),v.push([...a]);let c=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return p.current.has(c)||(h({...e,value:s,description:l},a,r),p.current.add(c)),{...e,value:s,description:l}}).filter(Boolean),m.forEach(e=>{o(i=>(i.find(i=>i.id===e.id)||i.push(e),[...i]))}),e.length>0&&e.map(({title:e,section:i,value:o,storyNumber:n,description:r,blockNumber:_,big_enough:p,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h},N)=>{t(t=>{var y,k,R,S,B,$,C,w;const O=t.findIndex(e=>e.storyNumber===n);if("intro"===i)-1===O?t.push({artifactId:`STORY-${n}-${_}`,title:e,value:o,description:r,storyNumber:n,sub_features:[],section:i,blockNumber:_,aiReasoning:v[N],big_enough:p,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h}):(t[O].value+=o,t[O].aiReasoning=t[O].aiReasoning||[],null===(k=null===(y=t[O])||void 0===y?void 0:y.aiReasoning)||void 0===k||k.push(...v[N]),t[O].big_enough=p,t[O].big_enough_decision_factors=m,t[O].gapValue=b,t[O].confidenceScore=f,t[O].metadata=h);else{t[O].sub_features||(t[O].sub_features=[]);const r=(null===(S=null===(R=t[O])||void 0===R?void 0:R.sub_features)||void 0===S?void 0:S.findIndex(e=>e.blockNumber===_))||-1;if(-1===r)null===($=null===(B=t[O])||void 0===B?void 0:B.sub_features)||void 0===$||$.push({artifactId:`STORY-${n}-${_}`,title:e,value:o,storyNumber:n,blockNumber:_,section:i,aiReasoning:v[N],big_enough:p,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h});else{let e=null===(w=null===(C=null==t?void 0:t[O])||void 0===C?void 0:C.sub_features)||void 0===w?void 0:w[r];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...v[N]),e.big_enough=p,e.big_enough_decision_factors=m,e.gapValue=b,e.confidenceScore=f,e.metadata=h}}const E=JSON.stringify(t);return g.current!==E&&(d({key:`streaming-redis-key-${s}`,value:{mmvf_list:t,knowledgeBase:a,projectAnalyserSummary:u,dataSources_files:l,ai_reasonings:c}}),g.current=E),[...t]})})}catch(e){console.error("Error in processing Stream Content",e)}}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),i=require("../utils/proccess-stream.utils.js");exports.useStreamContentHandler=function({setUserStory:t,setAiReasoning:n,setUserStoryCitations:o,onStreamingCompleted:s,isGraphQLCallInProgress:r,knowledgeBase:a,projectAnalyserSummary:u,dataSourceFiles:l,aiReasoning:c,setRedisValue:d,fetchCitationByBlock:p}){const[_,m]=e.useState({finalGap:"",finalRisk:"",status:"in-progress"}),g=e.useRef(new Set),f=e.useRef(new Set),b=e.useRef(null),v=e.useRef(null),h=e.useRef({gap_items_prompt:"",risk_items_prompt:""}),k=e.useRef(new Set);return e.useEffect(()=>{"complete"!==_.status||r||(s(_.finalGap,_.finalRisk),g.current.clear(),f.current.clear(),b.current=null,v.current=null,h.current={gap_items_prompt:"",risk_items_prompt:""},k.current.clear(),m({finalGap:"",finalRisk:"",status:"in-progress"}))},[_,r]),{processStreamContent:function(e,s,r){try{const _=JSON.stringify(e);if(v.current===_)return;v.current=_;let R=[],N=[];e=e.map(e=>{var t;const r=`${(e={...e,subBlockNumber:null!==(t=e.subBlockNumber)&&void 0!==t?t:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(k.current.has(r))return null;k.current.add(r);let{outputText:a,reasonings:u,gpt_citation:l,processedDescription:c}=i.processAIReasoningFromBlocks(e.value,e.blockNumber,e.storyNumber,e.description);o(e=>{var i;return l.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(i=e.gpt_citations)||void 0===i||i.push(...l)),{...e}}),R.push(...u),N.push([...u]);let d=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return g.current.has(d)||(!async function(e,i,t){var s,r;let a="",u="";try{const l=await p(e,t,i);n(e=>{var i;const t=[...e];return null===(i=l.response.ai_reasonings)||void 0===i||i.forEach(e=>{const i=t.findIndex(i=>i.id===e.id);-1!==i&&e.gap.length>0&&e.reason.length>0&&(t[i]={...e})}),t}),a=(null===(s=l.response)||void 0===s?void 0:s.gap_items_prompt)||"",u=(null===(r=l.response)||void 0===r?void 0:r.risk_items_prompt)||"",(a||u)&&(h.current={gap_items_prompt:a,risk_items_prompt:u}),o(e=>{var i,t,n,o,s,r,a,u,c,d,p,_,m,g;return{...e,appmod_citations:[...null!==(i=e.appmod_citations)&&void 0!==i?i:[],...null!==(t=l.response.appmod_citations)&&void 0!==t?t:[]],audio_citations:[...null!==(n=e.audio_citations)&&void 0!==n?n:[],...null!==(o=l.response.audio_citations)&&void 0!==o?o:[]],file_citations:[...null!==(s=e.file_citations)&&void 0!==s?s:[],...null!==(r=l.response.file_citations)&&void 0!==r?r:[]],image_citations:[...null!==(a=e.image_citations)&&void 0!==a?a:[],...null!==(u=l.response.image_citations)&&void 0!==u?u:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=l.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=l.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=l.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(i){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,i)}finally{let i=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(f.current.add(i),f.current.size===g.current.size){const e=a||h.current.gap_items_prompt,i=u||h.current.risk_items_prompt;m({finalGap:e,finalRisk:i,status:"complete"})}}}({...e,value:a,description:c},u,s),g.current.add(d)),{...e,value:a,description:c}}).filter(Boolean),R.forEach(e=>{n(i=>(i.find(i=>i.id===e.id)||i.push(e),[...i]))}),e.length>0&&e.map(({title:e,section:i,value:n,storyNumber:o,description:s,blockNumber:p,big_enough:_,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:v},h)=>{t(t=>{var k,R,y,S,B,$,C,O;const w=t.findIndex(e=>e.storyNumber===o);if("intro"===i)-1===w?t.push({artifactId:`STORY-${o}-${p}`,title:e,value:n,description:s,storyNumber:o,sub_features:[],section:i,blockNumber:p,aiReasoning:N[h],big_enough:_,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:v}):(t[w].value+=n,t[w].aiReasoning=t[w].aiReasoning||[],null===(R=null===(k=t[w])||void 0===k?void 0:k.aiReasoning)||void 0===R||R.push(...N[h]),t[w].big_enough=_,t[w].big_enough_decision_factors=m,t[w].gapValue=g,t[w].confidenceScore=f,t[w].metadata=v);else{t[w].sub_features||(t[w].sub_features=[]);const s=(null===(S=null===(y=t[w])||void 0===y?void 0:y.sub_features)||void 0===S?void 0:S.findIndex(e=>e.blockNumber===p))||-1;if(-1===s)null===($=null===(B=t[w])||void 0===B?void 0:B.sub_features)||void 0===$||$.push({artifactId:`STORY-${o}-${p}`,title:e,value:n,storyNumber:o,blockNumber:p,section:i,aiReasoning:N[h],big_enough:_,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:v});else{let e=null===(O=null===(C=null==t?void 0:t[w])||void 0===C?void 0:C.sub_features)||void 0===O?void 0:O[s];e.value=(e.value||"")+n,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...N[h]),e.big_enough=_,e.big_enough_decision_factors=m,e.gapValue=g,e.confidenceScore=f,e.metadata=v}}const E=JSON.stringify(t);return b.current!==E&&(d({key:`streaming-redis-key-${r}`,value:{mmvf_list:t,knowledgeBase:a,projectAnalyserSummary:u,dataSources_files:l,ai_reasonings:c}}),b.current=E),[...t]})})}catch(e){console.error("Error in processing Stream Content",e)}}}};
2
2
  //# sourceMappingURL=useStreamContentHandler.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as i,jsx as o,Fragment as n}from"react/jsx-runtime";import{ChevronDown as l,ChevronUp as t,Maximize2 as e,X as r,ExternalLink as a}from"lucide-react";import{useState as d,useMemo as u,useEffect as c}from"react";import s from"./ResizableSplitPane.js";import{DefaultFullScreenCloseIcon as v,DefaultFullScreenIcon as p}from"../icons/PdfViewerIcons.js";import{CitationType as g,GptWebCitation as h,PdfViewer as m}from"@e-llm-studio/citation";import x from"react-markdown";import f from"rehype-raw";import{Box as b}from"@mui/material";import{useRequirementAI as y}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const C=i=>{if(i)try{const o=new URL(i).hostname.replace(/^www\./i,""),n=o.split(".")[0];return n?n.charAt(0).toUpperCase()+n.slice(1):o}catch(i){return}},_=(i,o)=>{const n=((i,o)=>(null==i?void 0:i.payloadCitationId)||(null==o?void 0:o.payloadCitationId)||(null==o?void 0:o.citation_uuid)||"")(i,o)||("function"==typeof(null===(l=globalThis.crypto)||void 0===l?void 0:l.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const o=Math.floor(16*Math.random());return("x"===i?o:o%4+8).toString(16)}));var l;return i&&"object"==typeof i&&(i.payloadCitationId=n),o&&"object"==typeof o&&(o.payloadCitationId=n,o.citation_uuid||(o.citation_uuid=n)),n},F=({href:v,metaData:p,citationTitle:F,isFullscreen:w,secondaryCitation:T})=>{var I,D,k,P,S,U,W,j,R,z,A,E,N,B,G,M,L,H,O,$,V;const q=u(()=>{var i;return null===(i=(Array.isArray(null==p?void 0:p.citations)?p.citations:[]).find(i=>`pdf_citation$${i.id}`===v))||void 0===i?void 0:i.data},[v,null==p?void 0:p.citations]),J=null!==(S=null===(P=null===(k=null===(D=null===(I=null==p?void 0:p.guidelinesData)||void 0===I?void 0:I.artifactData)||void 0===D?void 0:D.userStorySnapshot)||void 0===k?void 0:k[0])||void 0===P?void 0:P.value)&&void 0!==S?S:"",K=u(()=>{const i=null==T?void 0:T.phraseToHighlight;if(!i)return J;const o=J.toLowerCase().indexOf(i.toLowerCase());return-1===o?J:[J.slice(0,o),'<mark style="background-color: #FEF08A; padding: 0 2px;">',J.slice(o,o+i.length),"</mark>",J.slice(o+i.length)].join("")},[J,null==T?void 0:T.phraseToHighlight]),Q=u(()=>{var i;const o=Array.isArray(null==p?void 0:p.gptCitations)?p.gptCitations:[],n=((i="")=>{if(!i||"string"!=typeof i||!i.trim())return"";const o=i.match(/gpt_citation\$(\d+)/i);return o&&o.length>=2?o[1]:""})(null==T?void 0:T.href);if(!n)return null;const l=o.find(i=>String(null==i?void 0:i.id)===n),t=(null===(i=null==l?void 0:l.data)||void 0===i?void 0:i.extraMetaData)||{},e=(i=>Object.keys(i||{}).sort((i,o)=>Number(i)-Number(o)))(t),r=e[Number((null==T?void 0:T.occurrenceIndex)||0)]||e[0];return r?t[r]:null},[null==p?void 0:p.gptCitations,null==T?void 0:T.href,null==T?void 0:T.occurrenceIndex]),X=(null===(R=null===(j=null===(W=null===(U=null==Q?void 0:Q.aiReasoningCitation)||void 0===U?void 0:U.gpt_citation)||void 0===W?void 0:W[0])||void 0===j?void 0:j.customMetaData)||void 0===R?void 0:R.value)||{},Y=(null===(E=null===(A=null===(z=null==Q?void 0:Q.aiReasoningCitation)||void 0===z?void 0:z.gpt_citation)||void 0===A?void 0:A[0])||void 0===E?void 0:E.customMetaData)||{},Z=u(()=>_(Q,X),[X,Q]),[ii,oi]=d(),[ni,li]=d("pending"),[ti,ei]=d(!0),{apiCachingConfig:ri,citationConfig:ai}=y(),{getGptWebCitation:di,gptWebCitationPartialPayload:ui}=ri||{},ci=(null===(N=null==ai?void 0:ai.gptWeb)||void 0===N?void 0:N.displayMode)||g.GPT_WEB,si=null===(B=null==T?void 0:T.href)||void 0===B?void 0:B.includes("gpt_citation"),vi=u(()=>({...ui,citationId:Z,citationUrl:null==X?void 0:X.citationUrl,content:(null==Q?void 0:Q.Reasoning)||(null==X?void 0:X.text),citationType:null==X?void 0:X.citationType,citationNumber:Number((null==Y?void 0:Y.citation_number)||0)}),[ui,Z,null==Y?void 0:Y.citation_number,null==X?void 0:X.citationType,null==X?void 0:X.citationUrl,null==X?void 0:X.text,null==Q?void 0:Q.Reasoning]),pi=u(()=>({item:{confidence_score:Number((null==Q?void 0:Q.Confidence_score)||0),text:(null==X?void 0:X.paraphrase)||(null==T?void 0:T.title)||"Web citation reasoning",dataSource:(null==X?void 0:X.text)||(null==Q?void 0:Q.Reasoning)||"",paraphrase:(null==X?void 0:X.paraphrase)||""},headerTitle:(null==X?void 0:X.label)||"GPT Web Citation",index:Number((null==Y?void 0:Y.citation_number)||1)-1,iconsConfig:{ChevronDownIcon:l,ChevronUpIcon:t,MaximizeIcon:e,CloseIcon:r}}),[null==T?void 0:T.title,null==Y?void 0:Y.citation_number,null==X?void 0:X.label,null==X?void 0:X.paraphrase,null==X?void 0:X.text,null==Q?void 0:Q.Confidence_score,null==Q?void 0:Q.Reasoning]);if(c(()=>{let i=!0;return(async()=>{var o,n;if(si&&(null==X?void 0:X.citationUrl)&&ci!==g.GPT&&(ci!==g.GPT_WEB||ti))if(di){li("pending");try{const l=await di(vi);if(!i)return;oi(null!==(n=null!==(o=null==l?void 0:l.data)&&void 0!==o?o:null==l?void 0:l.responseData)&&void 0!==n?n:l),li("success")}catch(o){if(!i)return;li("error"),console.error("Failed to load GPT web citation",o)}}else li("error")})(),()=>{i=!1}},[di,vi,ci,si,null==X?void 0:X.citationUrl,ti]),!q)return null;const gi=(null===(G=null==p?void 0:p.docData)||void 0===G?void 0:G.documents)||{},hi=(null===(M=null==p?void 0:p.docData)||void 0===M?void 0:M.input_index_map)||{},mi=Object.values(hi).find(i=>{const o=null==gi?void 0:gi[i];return(null==q?void 0:q[i])&&("application/pdf"===(null==o?void 0:o.mime_type)||"base"===(null==o?void 0:o.role))}),xi=Object.keys(q).find(i=>{const o=null==gi?void 0:gi[i];return"application/pdf"===(null==o?void 0:o.mime_type)||"base"===(null==o?void 0:o.role)})||Object.keys(q)[0],fi=mi||xi||(null==hi?void 0:hi[0]),bi=Object.values(hi).find(i=>i!==fi),yi=fi?gi[fi]:null,Ci=bi?gi[bi]:null,_i=fi?q[fi]:null,Fi=bi?q[bi]:null,wi="rulebook_citation"===((null===(L=null==T?void 0:T.type)||void 0===L?void 0:L.toLowerCase())||"")||Boolean(null==T?void 0:T.phraseToHighlight),Ti=T?i("div",{style:{height:"100%",overflow:"auto",padding:"16px",boxSizing:"border-box",backgroundColor:"#FFFFFF",color:"#101828",fontFamily:'"Inter", sans-serif',fontSize:"13px",lineHeight:1.6},children:[o("div",{style:{fontWeight:700,marginBottom:"8px"},children:wi?"Guideline Citation":"Web/GPT Citation"}),wi?o(n,{children:o(b,{sx:{padding:"0px 12px",backgroundColor:"#FFFFFF",overflow:"visible"},children:o(x,{rehypePlugins:[f],children:K})})}):si?o(h,{gptCitation:pi,defaultCitationUrl:(null==X?void 0:X.citationUrl)||"",citationType:ci,webCitationData:ii,sourceLabel:`Source: Web Citation > ${(null==X?void 0:X.paraphrase)||(null==X?void 0:X.label)||"Web Citation"}`,learnedFrom:C(null==X?void 0:X.citationUrl),showWebCitation:ti,webCitationStatus:ni,onGenerateWebCitation:()=>ei(!0),onToggleCitationView:()=>ei(i=>!i),showExpandImageButton:!0,showGptMaximizeButton:!0,iconsConfig:{MaximizeIcon:e,ExternalLinkIcon:a},isFixedHeight:!1}):o("div",{children:"No secondary citation preview available."})]}):null;if(["Contract","clause"].includes(F)){const i=_i?o(m,{pdfName:null==yi?void 0:yi.title,pdfUrl:null==yi?void 0:yi.signed_url,highlightText:[null!==(H=null==_i?void 0:_i.highlighted_text)&&void 0!==H?H:""],highlightPages:{1:null===(O=null==_i?void 0:_i.custom_metadata)||void 0===O?void 0:O.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,n=Ti||(Fi?o(m,{pdfName:null==Ci?void 0:Ci.title,pdfUrl:null==Ci?void 0:Ci.signed_url,jumpToPageValue:1,highlightText:[null!==($=null==Fi?void 0:Fi.highlighted_text)&&void 0!==$?$:""],highlightPages:{1:null===(V=null==Fi?void 0:Fi.custom_metadata)||void 0===V?void 0:V.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null);return o("div",_i||Fi||Ti?{style:{height:"100%",display:"flex",flexDirection:"column"},children:o(s,{leftComponent:i,rightComponent:n,isFullscreen:w})}:{children:"Missing PDF Citation. Please try again later"})}return o("div",{children:"No Citation Found. Please try again later"})},w=({href:n,children:e,metaData:r,secondaryCitation:a,chevronUpComponent:c=null,chevronDownComponent:s=null,customStyle:g={},defaultState:h=!1})=>{var m,x,f;const[b,y]=d(h),[C,_]=d(!1),w="string"==typeof e&&(null===(m=null==e?void 0:e.split("\n"))||void 0===m?void 0:m.length)>1?e.split("\n").join(" "):e,T="string"==typeof e?e:e[0],I=null!=c?c:(i=>{var n,l;return o(t,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(l=null==i?void 0:i.color)&&void 0!==l?l:"rgb(214, 51, 132)"})})(null!==(x=null==g?void 0:g.arrow)&&void 0!==x?x:{}),D=null!=s?s:(i=>{var n,t;return o(l,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(t=null==i?void 0:i.color)&&void 0!==t?t:"rgb(214, 51, 132)"})})(null!==(f=null==g?void 0:g.arrow)&&void 0!==f?f:{}),k=u(()=>(Array.isArray(null==r?void 0:r.citations)?r.citations:[]).some(i=>`pdf_citation$${i.id}`===n),[n,null==r?void 0:r.citations]);return["contract","clause"].includes(T.toLowerCase())&&k?i("span",{style:{display:"inline",...g.relativeWrapper||{}},children:[o("div",{style:{display:"inline",marginTop:0,...g.citationButtonWrapper||{}},children:i("button",{type:"button",onClick:()=>y(i=>!i),style:{display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal",...g.citationButton||{}},children:[o("span",{children:w}),o("span",{style:{display:"flex",alignItems:"center"},children:b?I:D})]})}),b&&i("div",{style:C?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"},children:[o("div",{style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0},children:o("button",{onClick:()=>{_(i=>!i)},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"},children:o(C?v:p,{})})}),o("div",{style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"},children:o(F,{href:n,children:e,metaData:r,citationTitle:T,isFullscreen:C,secondaryCitation:a})})]})]}):null};export{w as default};
1
+ import{jsxs as i,jsx as o,Fragment as n}from"react/jsx-runtime";import{ChevronDown as l,ChevronUp as t,Maximize2 as e,X as a,ExternalLink as r}from"lucide-react";import{useState as d,useMemo as u,useEffect as c}from"react";import s from"./ResizableSplitPane.js";import{DefaultFullScreenCloseIcon as v,DefaultFullScreenIcon as p}from"../icons/PdfViewerIcons.js";import{CitationType as g,GptWebCitation as h,PdfViewer as m}from"@e-llm-studio/citation";import x from"react-markdown";import f from"rehype-raw";import{Box as b}from"@mui/material";import{useRequirementAI as y}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const C=i=>{if(i)try{const o=new URL(i).hostname.replace(/^www\./i,""),n=o.split(".")[0];return n?n.charAt(0).toUpperCase()+n.slice(1):o}catch(i){return}},_=(i,o)=>{const n=((i,o)=>(null==i?void 0:i.payloadCitationId)||(null==o?void 0:o.payloadCitationId)||(null==o?void 0:o.citation_uuid)||"")(i,o)||("function"==typeof(null===(l=globalThis.crypto)||void 0===l?void 0:l.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const o=Math.floor(16*Math.random());return("x"===i?o:o%4+8).toString(16)}));var l;return i&&"object"==typeof i&&(i.payloadCitationId=n),o&&"object"==typeof o&&(o.payloadCitationId=n,o.citation_uuid||(o.citation_uuid=n)),n},F=({href:v,metaData:p,citationTitle:F,isFullscreen:w,secondaryCitation:T})=>{var I,D,P,k,U,S,W,j,R,z,A,B,E,G,N,M,L,H,O,$,V;const q=u(()=>{var i;return null===(i=(Array.isArray(null==p?void 0:p.citations)?p.citations:[]).find(i=>`pdf_citation$${i.id}`===v))||void 0===i?void 0:i.data},[v,null==p?void 0:p.citations]),J=null!==(U=null===(k=null===(P=null===(D=null===(I=null==p?void 0:p.guidelinesData)||void 0===I?void 0:I.artifactData)||void 0===D?void 0:D.userStorySnapshot)||void 0===P?void 0:P[0])||void 0===k?void 0:k.value)&&void 0!==U?U:"",K=u(()=>{const i=null==T?void 0:T.phraseToHighlight;if(!i)return J;const o=J.toLowerCase().indexOf(i.toLowerCase());return-1===o?J:[J.slice(0,o),'<mark style="background-color: #FEF08A; padding: 0 2px;">',J.slice(o,o+i.length),"</mark>",J.slice(o+i.length)].join("")},[J,null==T?void 0:T.phraseToHighlight]),Q=u(()=>{var i;const o=Array.isArray(null==p?void 0:p.gptCitations)?p.gptCitations:[],n=((i="")=>{if(!i||"string"!=typeof i||!i.trim())return"";const o=i.match(/gpt_citation\$(\d+)/i);return o&&o.length>=2?o[1]:""})(null==T?void 0:T.href);if(!n)return null;const l=o.find(i=>String(null==i?void 0:i.id)===n),t=(null===(i=null==l?void 0:l.data)||void 0===i?void 0:i.extraMetaData)||{},e=(i=>Object.keys(i||{}).sort((i,o)=>Number(i)-Number(o)))(t),a=e[Number((null==T?void 0:T.occurrenceIndex)||0)]||e[0];return a?t[a]:null},[null==p?void 0:p.gptCitations,null==T?void 0:T.href,null==T?void 0:T.occurrenceIndex]),X=(null===(R=null===(j=null===(W=null===(S=null==Q?void 0:Q.aiReasoningCitation)||void 0===S?void 0:S.gpt_citation)||void 0===W?void 0:W[0])||void 0===j?void 0:j.customMetaData)||void 0===R?void 0:R.value)||{},Y=(null===(B=null===(A=null===(z=null==Q?void 0:Q.aiReasoningCitation)||void 0===z?void 0:z.gpt_citation)||void 0===A?void 0:A[0])||void 0===B?void 0:B.customMetaData)||{},Z=u(()=>_(Q,X),[X,Q]),[ii,oi]=d(),[ni,li]=d("pending"),[ti,ei]=d(!0),{apiCachingConfig:ai,citationConfig:ri}=y(),{getGptWebCitation:di,gptWebCitationPartialPayload:ui}=ai||{},ci=(null===(E=null==ri?void 0:ri.gptWeb)||void 0===E?void 0:E.displayMode)||g.GPT_WEB,si=null===(G=null==T?void 0:T.href)||void 0===G?void 0:G.includes("gpt_citation"),vi=u(()=>({...ui,citationId:Z,citationUrl:null==X?void 0:X.citationUrl,content:(null==Q?void 0:Q.Reasoning)||(null==X?void 0:X.text),citationType:null==X?void 0:X.citationType,citationNumber:Number((null==Y?void 0:Y.citation_number)||0)}),[ui,Z,null==Y?void 0:Y.citation_number,null==X?void 0:X.citationType,null==X?void 0:X.citationUrl,null==X?void 0:X.text,null==Q?void 0:Q.Reasoning]),pi=u(()=>({item:{confidence_score:Number((null==Q?void 0:Q.Confidence_score)||0),text:(null==X?void 0:X.paraphrase)||(null==T?void 0:T.title)||"Web citation reasoning",dataSource:(null==X?void 0:X.text)||(null==Q?void 0:Q.Reasoning)||"",paraphrase:(null==X?void 0:X.paraphrase)||""},headerTitle:(null==X?void 0:X.label)||"GPT Web Citation",index:Number((null==Y?void 0:Y.citation_number)||1)-1,iconsConfig:{ChevronDownIcon:l,ChevronUpIcon:t,MaximizeIcon:e,CloseIcon:a}}),[null==T?void 0:T.title,null==Y?void 0:Y.citation_number,null==X?void 0:X.label,null==X?void 0:X.paraphrase,null==X?void 0:X.text,null==Q?void 0:Q.Confidence_score,null==Q?void 0:Q.Reasoning]);if(c(()=>{let i=!0;return(async()=>{var o,n;if(si&&(null==X?void 0:X.citationUrl)&&ci!==g.GPT&&(ci!==g.GPT_WEB||ti))if(di){li("pending");try{const l=await di(vi);if(!i)return;oi(null!==(n=null!==(o=null==l?void 0:l.data)&&void 0!==o?o:null==l?void 0:l.responseData)&&void 0!==n?n:l),li("success")}catch(o){if(!i)return;li("error"),console.error("Failed to load GPT web citation",o)}}else li("error")})(),()=>{i=!1}},[di,vi,ci,si,null==X?void 0:X.citationUrl,ti]),!q)return null;const gi=(null===(N=null==p?void 0:p.docData)||void 0===N?void 0:N.documents)||{},hi=(null===(M=null==p?void 0:p.docData)||void 0===M?void 0:M.input_index_map)||{},mi=Object.values(hi).find(i=>{const o=null==gi?void 0:gi[i];return(null==q?void 0:q[i])&&("application/pdf"===(null==o?void 0:o.mime_type)||"base"===(null==o?void 0:o.role))}),xi=Object.keys(q).find(i=>{const o=null==gi?void 0:gi[i];return"application/pdf"===(null==o?void 0:o.mime_type)||"base"===(null==o?void 0:o.role)})||Object.keys(q)[0],fi=mi||xi||(null==hi?void 0:hi[0]),bi=Object.values(hi).find(i=>i!==fi),yi=fi?gi[fi]:null,Ci=bi?gi[bi]:null,_i=fi?q[fi]:null,Fi=bi?q[bi]:null,wi="rulebook_citation"===((null===(L=null==T?void 0:T.type)||void 0===L?void 0:L.toLowerCase())||"")||Boolean(null==T?void 0:T.phraseToHighlight),Ti=Boolean(Q&&((null==X?void 0:X.citationUrl)||(null==X?void 0:X.text)||(null==Q?void 0:Q.Reasoning))),Ii=Boolean(si&&Ti&&(ci===g.GPT||(null==X?void 0:X.citationUrl)&&di)),Di=Boolean(wi&&J),Pi=T&&(wi?Di:Ii)?i("div",{style:{height:"100%",overflow:"auto",padding:"16px",boxSizing:"border-box",backgroundColor:"#FFFFFF",color:"#101828",fontFamily:'"Inter", sans-serif',fontSize:"13px",lineHeight:1.6},children:[o("div",{style:{fontWeight:700,marginBottom:"8px"},children:wi?"Guideline Citation":"Web/GPT Citation"}),wi?o(n,{children:o(b,{sx:{padding:"0px 12px",backgroundColor:"#FFFFFF",overflow:"visible"},children:o(x,{rehypePlugins:[f],children:K})})}):si?o(h,{gptCitation:pi,defaultCitationUrl:(null==X?void 0:X.citationUrl)||"",citationType:ci,webCitationData:ii,sourceLabel:`Source: Web Citation > ${(null==X?void 0:X.paraphrase)||(null==X?void 0:X.label)||"Web Citation"}`,learnedFrom:C(null==X?void 0:X.citationUrl),showWebCitation:ti,webCitationStatus:ni,onGenerateWebCitation:()=>ei(!0),onToggleCitationView:()=>ei(i=>!i),showExpandImageButton:!0,showGptMaximizeButton:!0,iconsConfig:{MaximizeIcon:e,ExternalLinkIcon:r},isFixedHeight:!1}):o("div",{children:"No secondary citation preview available."})]}):null;if(["Contract","clause"].includes(F)){const i=_i?o(m,{pdfName:null==yi?void 0:yi.title,pdfUrl:null==yi?void 0:yi.signed_url,highlightText:[null!==(H=null==_i?void 0:_i.highlighted_text)&&void 0!==H?H:""],highlightPages:{1:null===(O=null==_i?void 0:_i.custom_metadata)||void 0===O?void 0:O.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,n=Pi||(Fi?o(m,{pdfName:null==Ci?void 0:Ci.title,pdfUrl:null==Ci?void 0:Ci.signed_url,jumpToPageValue:1,highlightText:[null!==($=null==Fi?void 0:Fi.highlighted_text)&&void 0!==$?$:""],highlightPages:{1:null===(V=null==Fi?void 0:Fi.custom_metadata)||void 0===V?void 0:V.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null);return o("div",_i||Fi||Pi?{style:{height:"100%",display:"flex",flexDirection:"column"},children:o(s,{leftComponent:i,rightComponent:n,isFullscreen:w})}:{children:"Missing PDF Citation. Please try again later"})}return o("div",{children:"No Citation Found. Please try again later"})},w=({href:n,children:e,metaData:a,secondaryCitation:r,chevronUpComponent:c=null,chevronDownComponent:s=null,customStyle:g={},defaultState:h=!1})=>{var m,x,f;const[b,y]=d(h),[C,_]=d(!1),w="string"==typeof e&&(null===(m=null==e?void 0:e.split("\n"))||void 0===m?void 0:m.length)>1?e.split("\n").join(" "):e,T="string"==typeof e?e:e[0],I=null!=c?c:(i=>{var n,l;return o(t,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(l=null==i?void 0:i.color)&&void 0!==l?l:"rgb(214, 51, 132)"})})(null!==(x=null==g?void 0:g.arrow)&&void 0!==x?x:{}),D=null!=s?s:(i=>{var n,t;return o(l,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(t=null==i?void 0:i.color)&&void 0!==t?t:"rgb(214, 51, 132)"})})(null!==(f=null==g?void 0:g.arrow)&&void 0!==f?f:{}),P=u(()=>(Array.isArray(null==a?void 0:a.citations)?a.citations:[]).some(i=>`pdf_citation$${i.id}`===n),[n,null==a?void 0:a.citations]);return["contract","clause"].includes(T.toLowerCase())&&P?i("span",{style:{display:"inline",...g.relativeWrapper||{}},children:[o("div",{style:{display:"inline",marginTop:0,...g.citationButtonWrapper||{}},children:i("button",{type:"button",onClick:()=>y(i=>!i),style:{display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal",...g.citationButton||{}},children:[o("span",{children:w}),o("span",{style:{display:"flex",alignItems:"center"},children:b?I:D})]})}),b&&i("div",{style:C?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"},children:[o("div",{style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0},children:o("button",{onClick:()=>{_(i=>!i)},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"},children:o(C?v:p,{})})}),o("div",{style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"},children:o(F,{href:n,children:e,metaData:a,citationTitle:T,isFullscreen:C,secondaryCitation:r})})]})]}):null};export{w as default};
2
2
  //# sourceMappingURL=CitationAnchor.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import a,{memo as n,useMemo as c,useRef as r,useCallback as l}from"react";import o from"../Popups/PopupDefaults.js";import d from"react-markdown";import s from"rehype-raw";import m from"./CitationComponent.module.css.js";import{ChevronUp as u}from"lucide-react";import{ReactComponent as p}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as h}from"../icons/aiMagic.svg.js";import v from"./CitationAnchor.js";import{AiReasonMarkdownWrapper as g}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{resolveRedline as _}from"../../../../../service/redlineService.js";import{useRequirementAI as y}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import f from"../cws/CwsEvent.js";const N=(e="")=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),b=(e,i)=>{try{const t=e.match(new RegExp(`${i}=(["'])(.*?)\\1`,"i"));return t&&t.length>=3&&t[2]||""}catch(e){return console.error("Regex matching failed in getAnchorAttribute",e),""}},x=(e,i)=>{let t=[];try{t=[...e.matchAll(/<a\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/a>/gi)].map(e=>{var i;return e&&e.length>=3?{fullMatch:e[0],attributes:e[1],label:e[2],index:null!==(i=e.index)&&void 0!==i?i:0}:null}).filter(e=>Boolean(e))}catch(i){return console.error("Failed to parse anchors in line",i),e}const a=t.find(e=>{return i=e.attributes,b(i,"href").startsWith("pdf_citation$");var i}),n=t.find(e=>{return i=e.attributes,b(i,"href").includes("gpt_citation")||i.includes("phrase_to_highlight=");var i});if(!a||!n)return e;const c=((e,i,t,a,n)=>{const c=b(t,"href"),r=b(t,"type")||(c.includes("gpt_citation")?"gpt_citation":""),l=b(t,"reason"),o=c.split("?")[1]||"",d=o&&new URLSearchParams(o).get("phrase_to_highlight")||"",s=c.includes("gpt_citation")&&void 0!==n?` data-secondary-occurrence-index="${n}"`:"";return`<a${e} data-dual-citation="true" data-secondary-href="${N(c)}" data-secondary-type="${N(r)}" data-secondary-title="${N(a)}" data-secondary-reason="${N(l)}" data-secondary-phrase-to-highlight="${N(d)}"${s}>${i}</a>`})(a.attributes,a.label,n.attributes,n.label,b(n.attributes,"href").includes("gpt_citation")?i():void 0),r=(n.index>a.index?e.slice(a.index+a.fullMatch.length,n.index):e.slice(n.index+n.fullMatch.length,a.index)).trim()?n.label:"";return e.replace(a.fullMatch,c).replace(n.fullMatch,r)},I=(e,i)=>{var t,a;let n=i;try{n=i.replace(/-([a-z])/g,(e,i)=>i.toUpperCase())}catch(e){console.error("String replacement failed in getDataAttribute",e)}return null!==(a=null!==(t=null==e?void 0:e[i])&&void 0!==t?t:null==e?void 0:e[n])&&void 0!==a?a:""},C=({text:e,item:t})=>{const a=c(()=>(e=>{let i=0;const t=()=>i++;return e.split("\n").map(e=>x(e,t)).join("\n")})(e),[e]);return i(d,{rehypePlugins:[s],components:{ol:({children:e})=>i("ol",{className:m["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:m["md-ul"],children:e}),li:({children:e})=>i("li",{className:m["md-li"],children:e}),a:({node:e,href:a,children:n})=>{const c=(null==e?void 0:e.properties)||{},r=I(c,"data-secondary-href");return i(v,{href:a,children:n,secondaryCitation:r?{href:r,title:I(c,"data-secondary-title"),type:I(c,"data-secondary-type"),reason:I(c,"data-secondary-reason"),phraseToHighlight:I(c,"data-secondary-phrase-to-highlight"),occurrenceIndex:Number(I(c,"data-secondary-occurrence-index")||0)}:void 0,metaData:{citations:t.citations,docData:t.docData,guidelinesData:t.guidelinesData,gptCitations:t.gptCitations}})}},children:a.replace(/<br\s*\/?>/gi,"\n")})},R=({text:e,markdownStyles:t,citationStyles:a,customIcons:n})=>i(g,{message:e.replace(/<br\s*\/?>/gi,"\n"),customStyles:t,citationStyles:a,customIcons:n}),A=(e,i)=>e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&(e.relevanceScore===i.relevanceScore&&(e.reason===i.reason&&(e.impact===i.impact&&(e.explaination===i.explaination&&e.gap===i.gap)))))),$=n(function({item:n,title:r="Cognitive Decisioning AI",relevanceScore:l=0,showRelevanceScore:d=!0,reason:s="No reasoning provided.",impact:v="No Impact provided.",explaination:g="No explaination provided.",gap:_="None",onClose:y=()=>{},showResolveBtns:f=!1,sections:N,leftIcon:b,scoreIcon:x,className:I,customStyles:A={},markdownStyles:$,citationStyles:D,customIcons:S,actions:k,disableAllActions:w=!1,actionBtnDisabledStyle:j={},onBackClick:T,isImpactNeeded:B=!0,cognitiveTitle:H="Cognitive Integrity",labels:M={},chatHistory:P,resolveRedlineAction:L}){const E=c(()=>{const e=Number(l);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[l]),q=c(()=>{const e=M&&M.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(_)?e:_},[_]),U=M&&M.impact||"Impact",W=M&&M.explanation||"Explaination",F=M&&M.decisionFactors||"Decision Making Factors",G=M&&M.gaps||"Gaps in Decision",z=M&&M.accept||"Accept",J=M&&M.reject||"Reject",K=M&&M.backAriaLabel||"Go back",O=k||[{id:"reject",label:J,onClick:()=>L("reject"),className:m["btn-reject"]},{id:"accept",label:z,onClick:()=>L("accept"),className:m["btn-accept"]}],Q=P&&P.length>0;return e("div",{className:`${m["cite-acc"]} ${I||""}`,style:{...o.CitationAccordionDefaults.container,...null==A?void 0:A.container},children:[T&&e("div",{className:m["cite-acc__backHeader"],children:[i("button",{type:"button",className:m["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),T&&T()},"aria-label":K,children:"‹"}),i("span",{className:m["cite-acc__backTitle"],children:H})]}),i("div",{className:m["cite-body"],children:N&&N.length>0?N.map(t=>!1===t.show?null:e("div",{className:`${m["cite-acc__explain-body"]} ${t.bodyClassName||""}`,children:[e("div",{className:m["cite-acc__innerHeader"],style:{...o.CitationAccordionDefaults.innerHeader,...null==A?void 0:A.innerHeader},children:[i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:t.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),y&&y()},children:i(u,{})})]}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...o.CitationAccordionDefaults.innerBody,...null==A?void 0:A.innerBody},children:"string"==typeof t.content?i(C,{text:t.content,item:t.item||n||{}}):t.content})]},t.id||t.title)):e(t,{children:[B&&e("div",{className:m["cite-acc__explain-body"],children:[e("div",{className:m["cite-acc__innerHeader"],children:[i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:U})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),y&&y()},children:i(u,{})})]}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(C,{text:v||"",item:n||{}})})]}),g&&"No explaination provided."!==g&&e(t,{children:[e("div",{className:m["cite-acc__explain-body"],children:[i("div",{className:m["cite-acc__innerHeader"],children:i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:W})})})}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(C,{text:g||"",item:{}})})]}),i("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),f&&i("div",{className:m["cite-acc__btn-container"],children:O.map(e=>{const t=w||e.disabled;return i("button",{className:e.className,onClick:t?void 0:e.onClick,disabled:t,style:{...e.style,...t?{opacity:.5,cursor:"not-allowed",...j,...e.disabledStyle}:{}},children:e.label},e.id)})})]}),e("div",{className:m["cite-acc__header"],children:[e("div",{className:m["cite-acc__headerLeft"],children:[i("span",{className:m["cite-acc__titleIcon"],children:b?"function"==typeof b?a.createElement(b):b:i(p,{})}),i("div",{className:m["cite-acc__title"],children:r})]}),i("div",{className:m["cite-acc__headerRight"],children:d&&e("span",{className:m["cite-acc__scoreBadge"],children:[x?"function"==typeof x?a.createElement(x):x:i(h,{}),e("span",{className:m["cite-acc__scoreText"],children:[E,"%"]})]})})]}),e("div",{className:m["cite-acc__explain-body"],children:[i("div",{className:m["cite-acc__innerHeader"],children:i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:F})})})}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,children:Q?i(R,{text:s||"",markdownStyles:$,citationStyles:D,customIcons:S}):i(C,{text:s||"",item:n||{}})})]}),e("div",{className:`${m["cite-acc__explain-body"]} ${m["cite-acc__explain-body_border"]}`,children:[i("div",{className:m["cite-acc__innerHeader"],children:i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:G})})})}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,children:Q?i(R,{text:q||"",markdownStyles:$,citationStyles:D,customIcons:S}):i(C,{text:q||"",item:n||{}})})]})]})})]})},A);var D=n(function(e){const{redlineDcoumentId:t,redlineConfig:a,updateRedlineDataParent:n}=y(),c=r({redlineDcoumentId:t,redlineConfig:a,updateRedlineDataParent:n}),o=r({onActionTrigger:e.onActionTrigger,redlineId:e.redlineId,aiReasonId:e.aiReasonId});c.current={redlineDcoumentId:t,redlineConfig:a,updateRedlineDataParent:n},o.current={onActionTrigger:e.onActionTrigger,redlineId:e.redlineId,aiReasonId:e.aiReasonId};const d=l(async e=>{var i,n,r,l,d;const{redlineDcoumentId:s,redlineConfig:m,updateRedlineDataParent:u}=c.current,{onActionTrigger:p,redlineId:h,aiReasonId:v}=o.current;try{await(null==p?void 0:p({status:"loading",action:e,metadata:{redlineId:h,aiReasonId:v}}))}catch(e){}if(null==a?void 0:a.callResolveRedline)try{const{updated_reqai:c}=await _({documentId:s,userEmail:null==m?void 0:m.userEmail,userName:null==m?void 0:m.userName,redlineId:null!=h?h:"",action:e,baseApiUrl:null==m?void 0:m.baseApiUrl,redlineConfigId:null!==(i=null==m?void 0:m.redlineConfigId)&&void 0!==i?i:""},null!==(n=null==m?void 0:m.token)&&void 0!==n?n:"");await(null==u?void 0:u(c));const o=null===(d=null===(l=null===(r=null==c?void 0:c.artifactData)||void 0===r?void 0:r.userStorySnapshot)||void 0===l?void 0:l[0])||void 0===d?void 0:d.artifactId;"string"==typeof o&&o.trim()&&"string"==typeof t&&t.trim()&&"string"==typeof(null==a?void 0:a.userName)&&(null==a?void 0:a.userName.trim())?f.emit(`redline-edit:${t}:${o}`,{updatedBy:null==a?void 0:a.userName}):console.error("invalid cwsEvent name or payload"),null==p||p({status:"success",action:e,metadata:{redlineId:h,aiReasonId:v}})}catch(i){null==p||p({status:"failed",action:e,metadata:{redlineId:h,aiReasonId:v}})}},[]);return i($,{...e,resolveRedlineAction:d})},A);export{D as default};
1
+ import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import a,{memo as n,useMemo as c,useRef as r,useCallback as l}from"react";import o from"../Popups/PopupDefaults.js";import d from"react-markdown";import s from"rehype-raw";import m from"./CitationComponent.module.css.js";import{ChevronUp as u}from"lucide-react";import{ReactComponent as p}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as h}from"../icons/aiMagic.svg.js";import v from"./CitationAnchor.js";import{AiReasonMarkdownWrapper as g}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{resolveRedline as _}from"../../../../../service/redlineService.js";import{useRequirementAI as y}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import f from"../cws/CwsEvent.js";const N=(e="")=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),b=(e,i)=>{try{const t=e.match(new RegExp(`${i}=(["'])(.*?)\\1`,"i"));return t&&t.length>=3&&t[2]||""}catch(e){return console.error("Regex matching failed in getAnchorAttribute",e),""}},x=(e,i)=>{let t=[];try{t=[...e.matchAll(/<a\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/a>/gi)].map(e=>{var i;return e&&e.length>=3?{fullMatch:e[0],attributes:e[1],label:e[2],index:null!==(i=e.index)&&void 0!==i?i:0}:null}).filter(e=>Boolean(e))}catch(i){return console.error("Failed to parse anchors in line",i),e}const a=t.find(e=>{return i=e.attributes,b(i,"href").startsWith("pdf_citation$");var i}),n=t.find(e=>{return i=e.attributes,b(i,"href").includes("gpt_citation")||i.includes("phrase_to_highlight=");var i});if(!a||!n)return e;const c=((e,i,t,a,n)=>{const c=b(t,"href"),r=b(t,"type")||(c.includes("gpt_citation")?"gpt_citation":""),l=b(t,"reason"),o=c.split("?")[1]||"",d=o&&new URLSearchParams(o).get("phrase_to_highlight")||"",s=c.includes("gpt_citation")&&void 0!==n?` data-secondary-occurrence-index="${n}"`:"";return`<a${e} data-dual-citation="true" data-secondary-href="${N(c)}" data-secondary-type="${N(r)}" data-secondary-title="${N(a)}" data-secondary-reason="${N(l)}" data-secondary-phrase-to-highlight="${N(d)}"${s}>${i}</a>`})(a.attributes,a.label,n.attributes,n.label,b(n.attributes,"href").includes("gpt_citation")?i():void 0),r=(n.index>a.index?e.slice(a.index+a.fullMatch.length,n.index):e.slice(n.index+n.fullMatch.length,a.index)).trim()?n.label:"";return e.replace(a.fullMatch,c).replace(n.fullMatch,r)},I=(e,i)=>{var t,a;let n=i;try{n=i.replace(/-([a-z])/g,(e,i)=>i.toUpperCase())}catch(e){console.error("String replacement failed in getDataAttribute",e)}return null!==(a=null!==(t=null==e?void 0:e[i])&&void 0!==t?t:null==e?void 0:e[n])&&void 0!==a?a:""},C=({text:e,item:t})=>{const a=c(()=>(e=>{let i=0;const t=()=>i++;return e.split("\n").map(e=>x(e,t)).join("\n")})(e),[e]);return i(d,{rehypePlugins:[s],components:{ol:({children:e})=>i("ol",{className:m["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:m["md-ul"],children:e}),li:({children:e})=>i("li",{className:m["md-li"],children:e}),a:({node:e,href:a,children:n})=>{const c=(null==e?void 0:e.properties)||{},r=I(c,"data-secondary-href");return i(v,{href:a,children:n,secondaryCitation:r?{href:r,title:I(c,"data-secondary-title"),type:I(c,"data-secondary-type"),reason:I(c,"data-secondary-reason"),phraseToHighlight:I(c,"data-secondary-phrase-to-highlight"),occurrenceIndex:Number(I(c,"data-secondary-occurrence-index")||0)}:void 0,metaData:{citations:t.citations,docData:t.docData,guidelinesData:t.guidelinesData,gptCitations:t.gptCitations}})}},children:a.replace(/<br\s*\/?>/gi,"\n")})},D=({text:e,markdownStyles:t,citationStyles:a,customIcons:n})=>i(g,{message:e.replace(/<br\s*\/?>/gi,"\n"),customStyles:t,citationStyles:a,customIcons:n}),R=(e,i)=>{return e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&(e.relevanceScore===i.relevanceScore&&(e.reason===i.reason&&(e.impact===i.impact&&(e.explaination===i.explaination&&(e.gap===i.gap&&(t=e.item,a=i.item,t===a||(t&&a?t.citations===a.citations&&t.guidelinesData===a.guidelinesData&&t.docData===a.docData&&(null===(n=t.docData)||void 0===n?void 0:n.input_index_map)===(null===(c=a.docData)||void 0===c?void 0:c.input_index_map)&&(null===(r=t.docData)||void 0===r?void 0:r.documents)===(null===(l=a.docData)||void 0===l?void 0:l.documents):t===a)))))))));var t,a,n,c,r,l},A=n(function({item:n,title:r="Cognitive Decisioning AI",relevanceScore:l=0,showRelevanceScore:d=!0,reason:s="No reasoning provided.",impact:v="No Impact provided.",explaination:g="No explaination provided.",gap:_="None",onClose:y=()=>{},showResolveBtns:f=!1,sections:N,leftIcon:b,scoreIcon:x,className:I,customStyles:R={},markdownStyles:A,citationStyles:$,customIcons:S,actions:k,disableAllActions:w=!1,actionBtnDisabledStyle:j={},onBackClick:T,isImpactNeeded:B=!0,cognitiveTitle:H="Cognitive Integrity",labels:M={},chatHistory:P,resolveRedlineAction:L}){const E=c(()=>{const e=Number(l);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[l]),q=c(()=>{const e=M&&M.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(_)?e:_},[_]),U=M&&M.impact||"Impact",W=M&&M.explanation||"Explaination",F=M&&M.decisionFactors||"Decision Making Factors",G=M&&M.gaps||"Gaps in Decision",z=M&&M.accept||"Accept",J=M&&M.reject||"Reject",K=M&&M.backAriaLabel||"Go back",O=k||[{id:"reject",label:J,onClick:()=>L("reject"),className:m["btn-reject"]},{id:"accept",label:z,onClick:()=>L("accept"),className:m["btn-accept"]}],Q=P&&P.length>0;return e("div",{className:`${m["cite-acc"]} ${I||""}`,style:{...o.CitationAccordionDefaults.container,...null==R?void 0:R.container},children:[T&&e("div",{className:m["cite-acc__backHeader"],children:[i("button",{type:"button",className:m["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),T&&T()},"aria-label":K,children:"‹"}),i("span",{className:m["cite-acc__backTitle"],children:H})]}),i("div",{className:m["cite-body"],children:N&&N.length>0?N.map(t=>!1===t.show?null:e("div",{className:`${m["cite-acc__explain-body"]} ${t.bodyClassName||""}`,children:[e("div",{className:m["cite-acc__innerHeader"],style:{...o.CitationAccordionDefaults.innerHeader,...null==R?void 0:R.innerHeader},children:[i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:t.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),y&&y()},children:i(u,{})})]}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...o.CitationAccordionDefaults.innerBody,...null==R?void 0:R.innerBody},children:"string"==typeof t.content?i(C,{text:t.content,item:t.item||n||{}}):t.content})]},t.id||t.title)):e(t,{children:[B&&e("div",{className:m["cite-acc__explain-body"],children:[e("div",{className:m["cite-acc__innerHeader"],children:[i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:U})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),y&&y()},children:i(u,{})})]}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(C,{text:v||"",item:n||{}})})]}),g&&"No explaination provided."!==g&&e(t,{children:[e("div",{className:m["cite-acc__explain-body"],children:[i("div",{className:m["cite-acc__innerHeader"],children:i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:W})})})}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(C,{text:g||"",item:{}})})]}),i("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),f&&i("div",{className:m["cite-acc__btn-container"],children:O.map(e=>{const t=w||e.disabled;return i("button",{className:e.className,onClick:t?void 0:e.onClick,disabled:t,style:{...e.style,...t?{opacity:.5,cursor:"not-allowed",...j,...e.disabledStyle}:{}},children:e.label},e.id)})})]}),e("div",{className:m["cite-acc__header"],children:[e("div",{className:m["cite-acc__headerLeft"],children:[i("span",{className:m["cite-acc__titleIcon"],children:b?"function"==typeof b?a.createElement(b):b:i(p,{})}),i("div",{className:m["cite-acc__title"],children:r})]}),i("div",{className:m["cite-acc__headerRight"],children:d&&e("span",{className:m["cite-acc__scoreBadge"],children:[x?"function"==typeof x?a.createElement(x):x:i(h,{}),e("span",{className:m["cite-acc__scoreText"],children:[E,"%"]})]})})]}),e("div",{className:m["cite-acc__explain-body"],children:[i("div",{className:m["cite-acc__innerHeader"],children:i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:F})})})}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,children:Q?i(D,{text:s||"",markdownStyles:A,citationStyles:$,customIcons:S}):i(C,{text:s||"",item:n||{}})})]}),e("div",{className:`${m["cite-acc__explain-body"]} ${m["cite-acc__explain-body_border"]}`,children:[i("div",{className:m["cite-acc__innerHeader"],children:i("div",{className:m["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:m["cite-acc__innerTitle"],children:G})})})}),i("div",{className:`${m["cite-acc__innerBody"]} text-sm text-gray-600`,children:Q?i(D,{text:q||"",markdownStyles:A,citationStyles:$,customIcons:S}):i(C,{text:q||"",item:n||{}})})]})]})})]})},R);var $=n(function(e){const{redlineDcoumentId:t,redlineConfig:a,updateRedlineDataParent:n}=y(),c=r({redlineDcoumentId:t,redlineConfig:a,updateRedlineDataParent:n}),o=r({onActionTrigger:e.onActionTrigger,redlineId:e.redlineId,aiReasonId:e.aiReasonId});c.current={redlineDcoumentId:t,redlineConfig:a,updateRedlineDataParent:n},o.current={onActionTrigger:e.onActionTrigger,redlineId:e.redlineId,aiReasonId:e.aiReasonId};const d=l(async e=>{var i,n,r,l,d;const{redlineDcoumentId:s,redlineConfig:m,updateRedlineDataParent:u}=c.current,{onActionTrigger:p,redlineId:h,aiReasonId:v}=o.current;try{await(null==p?void 0:p({status:"loading",action:e,metadata:{redlineId:h,aiReasonId:v}}))}catch(e){}if(null==a?void 0:a.callResolveRedline)try{const{updated_reqai:c}=await _({documentId:s,userEmail:null==m?void 0:m.userEmail,userName:null==m?void 0:m.userName,redlineId:null!=h?h:"",action:e,baseApiUrl:null==m?void 0:m.baseApiUrl,redlineConfigId:null!==(i=null==m?void 0:m.redlineConfigId)&&void 0!==i?i:""},null!==(n=null==m?void 0:m.token)&&void 0!==n?n:"");await(null==u?void 0:u(c));const o=null===(d=null===(l=null===(r=null==c?void 0:c.artifactData)||void 0===r?void 0:r.userStorySnapshot)||void 0===l?void 0:l[0])||void 0===d?void 0:d.artifactId;"string"==typeof o&&o.trim()&&"string"==typeof t&&t.trim()&&"string"==typeof(null==a?void 0:a.userName)&&(null==a?void 0:a.userName.trim())?f.emit(`redline-edit:${t}:${o}`,{updatedBy:null==a?void 0:a.userName}):console.error("invalid cwsEvent name or payload"),null==p||p({status:"success",action:e,metadata:{redlineId:h,aiReasonId:v}})}catch(i){null==p||p({status:"failed",action:e,metadata:{redlineId:h,aiReasonId:v}})}},[]);return i(A,{...e,resolveRedlineAction:d})},R);export{$ as default};
2
2
  //# sourceMappingURL=CognitiveComponent.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useMemo as n,useState as i,useRef as o,useCallback as a,useEffect as r}from"react";import s from"react-dom";import c from"@monaco-editor/react";import d from"./ReadFileCitationContent.module.css.js";import h from"./icons/ExternalLinkIcon.js";import{X as u,Maximize2 as m}from"lucide-react";import g from"./CustomFileIcon.js";const p=e=>"number"==typeof e&&Number.isFinite(e),v=(e,t)=>p(e)&&p(t)?e<=0||t<e?null:{start:e,end:t,length:t-e+1}:null,f=(e,t,l,n)=>{let[i,o]=e;if(!Number.isFinite(i)||!Number.isFinite(o))return null;if(o<i&&([i,o]=[o,i]),p(l)&&p(n)){const e=Math.max(i,l),a=Math.min(o,n);if(e>a)return null;const r=e-l+1,s=a-l+1,c=Math.max(1,r),d=Math.min(t,s);return c>d?null:[c,d]}const a=Math.max(1,i),r=Math.min(t,o);return a>r?null:[a,r]},y=(e,t,l,n)=>{if(0===e.length)return!1;const i=v(l,n);if(!i)return!1;if(e.some(([e,l])=>e>t||l>t))return!0;if(i.start>t||i.end>t)return!0;if(Math.abs(i.length-t)<=1){return!e.every(([e,t])=>t<i.start||e>i.end)}return!1},b={border:"#3c3c3c",headerBg:"#252526",inactiveText:"#858585",background:"#1e1e1e",foreground:"#cccccc",highlightBg:"rgba(59, 130, 246, 0.15)",highlightGutter:"#3b82f6",hoverBg:"rgba(255, 255, 255, 0.1)"},N={theme:"vs-dark",fontSize:13,fontFamily:"Consolas, 'Courier New', monospace",maxHeight:300,minHeight:80},x={js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",py:"python",rb:"ruby",java:"java",cpp:"cpp",c:"c",go:"go",rust:"rust",json:"json",html:"html",css:"css",scss:"scss",md:"markdown",sql:"sql",sh:"shell",bash:"shell",yaml:"yaml",yml:"yaml"},C=({citation:C,customStyles:F,customColors:M,customIcons:k,editorConfig:w,fileCallback:S})=>{const L=n(()=>({...b,...M}),[M]),O=n(()=>({...N,...w}),[w]),[B,j]=i(!1),P=o(null),T=o(!1),H=C.customMetadata.content||"",z=C.customMetadata.highlighted_text,R=C.customMetadata.start_line,W=C.customMetadata.end_line,$=p(R)?R+1:R,I=n(()=>{if(!z)return{};try{let e=z.trim();return e.startsWith("```")&&(e=e.replace(/^```\w*\n?/,""),e=e.replace(/\n?```\s*$/,"")),JSON.parse(e.trim())}catch(e){return console.error("Failed to parse highlight string:",e),{}}},[z]),E=n(()=>{const e=[],t=/```(\w+)?\s*<file_path>([\s\S]*?)<\/file_path>\s*<code>([\s\S]*?)<\/code>\s*```/g;let l;for(;null!==(l=t.exec(H));){const t=l[1]||"javascript",n=l[2].trim(),i=l[3].trim();n&&i&&e.push({filePath:n,code:i,language:t})}return e},[H]),_=a(e=>(I[e]||[]).map(e=>{const t=e.split("-").map(e=>Number(e.trim())),l=t[0],n=t.length>1?t[1]:l;return Number.isFinite(l)&&Number.isFinite(n)?[l,n]:null}).filter(e=>null!==e),[I]),D=n(()=>{for(let e=0;e<E.length;e++){const t=E[e],l=t.code.split("\n").length,n=_(t.filePath),i=y(n,l,$,W);if(n.map(e=>f(e,l,i?$:void 0,i?W:void 0)).filter(e=>null!==e).length>0)return e}return-1},[E,_,$,W]),q=D>=0,G=a((e,t)=>{const l=_(e),n=y(l,t,$,W);return l.map(e=>f(e,t,n?$:void 0,n?W:void 0)).filter(e=>null!==e)},[_,$,W]),A=a((e,t)=>{const l=_(e);if(y(l,t,$,W)){const e=v($,W);return e?l.map(([t,l])=>{const n=t<=l?[t,l]:[l,t],i=Math.max(n[0],e.start),o=Math.min(n[1],e.end);return i>o?null:[i,o]}).filter(e=>null!==e):[]}return G(e,t)},[_,G,$,W]);r(()=>{if(q&&!T.current&&E.length>0&&(null==S?void 0:S.autoOpenFirstHighlighted)&&(null==S?void 0:S.onOpenFile)){const e=E[D],t=A(e.filePath,e.code.split("\n").length);T.current=!0;const l=setTimeout(()=>{S.onOpenFile({filePath:e.filePath,ranges:t.length>0?t:null})},300);return()=>clearTimeout(l)}},[q,D,E,G,S]),r(()=>{T.current=!1},[H]),r(()=>{if(D<0)return;const e=setTimeout(()=>{var e;null===(e=P.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},350);return()=>clearTimeout(e)},[D,z]);const J=a((e,t)=>{if(null==S?void 0:S.onOpenFile){const l=A(e,t);S.onOpenFile({filePath:e,ranges:l.length>0?l:null})}},[A,S]),V=a(()=>{(null==S?void 0:S.onExpandClick)?S.onExpandClick({blocks:E,highlightMap:I}):j(!0)},[S,E,I]),K=!!(null==S?void 0:S.onOpenFile),Q=(null==k?void 0:k.readFileCitationIcon)||e(h,{style:{width:"14px",height:"14px"}}),U=a((e,t,l,n)=>{const i=[];if(l.forEach(([e,l])=>{i.push({range:new t.Range(e,1,l,1),options:{isWholeLine:!0,className:d.yellowHighlightedLine,linesDecorationsClassName:d.yellowHighlightedLineDecoration}})}),i.length>0)try{e.createDecorationsCollection(i)}catch(e){console.warn("Failed to create decorations:",e)}const o=l[0];o&&requestAnimationFrame(()=>{e.revealLineInCenter(o[0])}),n>0&&e.updateOptions({lineNumbers:e=>String(e+n)})},[]),X=l=>E.map((n,i)=>{const o=n.code.split("\n").length,a=_(n.filePath),r=y(a,o,$,W),s=a.map(e=>f(e,o,r?$:void 0,r?W:void 0)).filter(e=>null!==e),h=r&&p($)?s.map(([e,t])=>[e+$-1,t+$-1]):s,u=s.length>0,g=i===D,v=l?600:O.maxHeight,b=(()=>{const e=20*n.code.split("\n").length+16+4;return Math.min(Math.max(e,O.minHeight),v)})(),N=n.filePath.split("/").pop(),C=r&&p($)?$-1:0,M=C+o,k=String(Math.max(1,M)).length;return t("div",{ref:!l&&g?P:void 0,"data-highlighted":u?"true":void 0,"data-first-highlighted":g?"true":void 0,className:d.blockContainer,style:{border:`1px solid ${L.border}`,...null==F?void 0:F.blockContainer},children:[t("div",{className:d.header,style:{backgroundColor:u?L.highlightBg:L.headerBg,borderBottom:`1px solid ${L.border}`,color:u?L.highlightGutter:L.foreground,...u?null==F?void 0:F.headerHighlighted:null==F?void 0:F.header},children:[t("div",{className:d.headerLeft,children:[e("span",{className:d.fileName,title:n.filePath,style:null==F?void 0:F.fileName,onClick:()=>J(n.filePath,o),children:N}),K&&e("button",{className:d.openFileButton,onClick:()=>J(n.filePath,o),title:"Open in editor","aria-label":`Open ${N} in editor`,style:null==F?void 0:F.openFileButton,children:Q})]}),t("div",{className:d.headerRight,children:[u&&e("span",{className:d.lineRanges,style:null==F?void 0:F.lineRanges,children:(S=h,S.map(([e,t])=>e===t?`L${e}`:`L${e}-${t}`).join(", "))}),!l&&0===i&&e("button",{className:d.expandButton,style:null==F?void 0:F.expandButton,onClick:V,title:"Expand","aria-label":"Expand code view",children:e(m,{size:13})})]})]}),e("div",{className:d.editorWrapper,style:{height:`${b}px`,backgroundColor:L.background,...null==F?void 0:F.editorWrapper},children:e(c,{height:"100%",language:(w=n.language,x[w.toLowerCase()]||w),value:n.code,theme:O.theme,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:O.fontSize,lineHeight:20,fontFamily:O.fontFamily,lineNumbers:C>0?e=>String(e+C):"on",folding:!1,lineDecorationsWidth:10,lineNumbersMinChars:Math.max(4,k),renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!1,alwaysConsumeMouseWheel:!1},automaticLayout:!0,wordWrap:"off",contextmenu:!1,selectOnLineNumbers:!0,glyphMargin:!1,padding:{top:8,bottom:8},overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,overviewRulerLanes:0,renderWhitespace:"none",guides:{indentation:!1},cursorStyle:"line",cursorBlinking:"solid",fixedOverflowWidgets:!0},onMount:(e,t)=>U(e,t,s,C),loading:e("div",{className:d.editorLoading,style:{color:L.inactiveText},children:"Loading editor..."})})})]},i);var w,S});if(0===E.length)return e("div",{className:d.emptyState,style:{color:L.inactiveText,...null==F?void 0:F.emptyState},children:"No code content available"});const Y=B?s.createPortal(e("div",{className:d.modalOverlay,style:null==F?void 0:F.modalOverlay,onClick:e=>{e.target===e.currentTarget&&j(!1)},children:t("div",{className:d.modalContent,style:null==F?void 0:F.modalContent,children:[t("div",{className:d.modalHeader,style:null==F?void 0:F.modalHeader,children:[e("span",{className:d.modalTitle,style:null==F?void 0:F.modalTitle,children:1===E.length?t("span",{className:d.modalTitleContent,children:[e(g,{name:E[0].filePath,size:"15px"}),e("span",{className:d.modalTitleText,children:E[0].filePath})]}):`${E.length} files`}),e("button",{className:d.modalCloseButton,style:null==F?void 0:F.modalCloseButton,onClick:()=>j(!1),"aria-label":"Close expanded view",children:e(u,{size:16})})]}),e("div",{className:d.modalBody,children:e("div",{className:d.container,style:null==F?void 0:F.container,children:X(!0)})})]})}),document.body):null;return t(l,{children:[Y,e("div",{className:d.container,style:null==F?void 0:F.container,children:X(!1)})]})};export{C as default};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useMemo as l,useState as i,useRef as o,useEffect as r,useCallback as a}from"react";import s from"react-dom";import c from"@monaco-editor/react";import d from"./ReadFileCitationContent.module.css.js";import h from"./icons/ExternalLinkIcon.js";import{X as u,Maximize2 as m}from"lucide-react";import p from"./CustomFileIcon.js";import{Tooltip as g}from"@mui/material";const v=e=>"number"==typeof e&&Number.isFinite(e),f=(e,t)=>v(e)&&v(t)?e<=0||t<e?null:{start:e,end:t,length:t-e+1}:null,b=(e,t,n,l)=>{let[i,o]=e;if(!Number.isFinite(i)||!Number.isFinite(o))return null;if(o<i&&([i,o]=[o,i]),v(n)&&v(l)){const e=Math.max(i,n),r=Math.min(o,l);if(e>r)return null;const a=e-n+1,s=r-n+1,c=Math.max(1,a),d=Math.min(t,s);return c>d?null:[c,d]}const r=Math.max(1,i),a=Math.min(t,o);return r>a?null:[r,a]},y=(e,t,n,l)=>{if(0===e.length)return!1;const i=f(n,l);if(!i)return!1;if(e.some(([e,n])=>e>t||n>t))return!0;if(i.start>t||i.end>t)return!0;if(Math.abs(i.length-t)<=1){return!e.every(([e,t])=>t<i.start||e>i.end)}return!1},x={border:"#3c3c3c",headerBg:"#252526",inactiveText:"#858585",background:"#1e1e1e",foreground:"#cccccc",highlightBg:"rgba(59, 130, 246, 0.15)",highlightGutter:"#3b82f6",hoverBg:"rgba(255, 255, 255, 0.1)"},N={theme:"vs-dark",fontSize:13,fontFamily:"Consolas, 'Courier New', monospace",maxHeight:300,minHeight:80},C={js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",py:"python",rb:"ruby",java:"java",cpp:"cpp",c:"c",go:"go",rust:"rust",json:"json",html:"html",css:"css",scss:"scss",md:"markdown",sql:"sql",sh:"shell",bash:"shell",yaml:"yaml",yml:"yaml"},w=e=>e.map(([e,t])=>e===t?`L${e}`:`L${e}-${t}`).join(", "),k=({citation:k,customStyles:F,customColors:M,customIcons:P,editorConfig:S,fileCallback:O})=>{const L=l(()=>({...x,...M}),[M]),B=l(()=>({...N,...S}),[S]),[j,H]=i(!1),T=o(null),$=o(!1),z=o(null);r(()=>{const e=()=>{const e=document.querySelectorAll("dialog[open]");z.current=e.length>0?e[e.length-1]:document.body};e();const t=new MutationObserver(e);return t.observe(document.body,{subtree:!0,attributes:!0,attributeFilter:["open"]}),()=>t.disconnect()},[]);const E=l(()=>({popper:{container:()=>{var e;return null!==(e=z.current)&&void 0!==e?e:document.body},sx:{zIndex:15e5}}}),[]),R=k.customMetadata.content||"",W=k.customMetadata.highlighted_text,I=k.customMetadata.start_line,_=k.customMetadata.end_line,q=v(I)?I+1:I,D=l(()=>{if(!W)return{};try{let e=W.trim();return e.startsWith("```")&&(e=e.replace(/^```\w*\n?/,""),e=e.replace(/\n?```\s*$/,"")),JSON.parse(e.trim())}catch(e){return console.error("Failed to parse highlight string:",e),{}}},[W]),A=l(()=>{const e=[],t=/```(\w+)?\s*<file_path>([\s\S]*?)<\/file_path>\s*<code>([\s\S]*?)<\/code>\s*```/g;let n;for(;null!==(n=t.exec(R));){const t=n[1]||"javascript",l=n[2].trim(),i=n[3].trim();l&&i&&e.push({filePath:l,code:i,language:t})}return e},[R]),G=a(e=>(D[e]||[]).map(e=>{const t=e.split("-").map(e=>Number(e.trim())),n=t[0],l=t.length>1?t[1]:n;return Number.isFinite(n)&&Number.isFinite(l)?[n,l]:null}).filter(e=>null!==e),[D]),J=l(()=>{for(let e=0;e<A.length;e++){const t=A[e],n=t.code.split("\n").length,l=G(t.filePath),i=y(l,n,q,_);if(l.map(e=>b(e,n,i?q:void 0,i?_:void 0)).filter(e=>null!==e).length>0)return e}return-1},[A,G,q,_]),V=J>=0,K=a((e,t)=>{const n=G(e),l=y(n,t,q,_);return n.map(e=>b(e,t,l?q:void 0,l?_:void 0)).filter(e=>null!==e)},[G,q,_]),Q=a((e,t)=>{const n=G(e);if(y(n,t,q,_)){const e=f(q,_);return e?n.map(([t,n])=>{const l=t<=n?[t,n]:[n,t],i=Math.max(l[0],e.start),o=Math.min(l[1],e.end);return i>o?null:[i,o]}).filter(e=>null!==e):[]}return K(e,t)},[G,K,q,_]);r(()=>{if(V&&!$.current&&A.length>0&&(null==O?void 0:O.autoOpenFirstHighlighted)&&(null==O?void 0:O.onOpenFile)){const e=A[J],t=Q(e.filePath,e.code.split("\n").length);$.current=!0;const n=setTimeout(()=>{O.onOpenFile({filePath:e.filePath,ranges:t.length>0?t:null})},300);return()=>clearTimeout(n)}},[V,J,A,K,O]),r(()=>{$.current=!1},[R]),r(()=>{if(J<0)return;const e=setTimeout(()=>{var e;null===(e=T.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},350);return()=>clearTimeout(e)},[J,W]);const U=a((e,t)=>{if(null==O?void 0:O.onOpenFile){const n=Q(e,t);O.onOpenFile({filePath:e,ranges:n.length>0?n:null})}},[Q,O]),X=l(()=>!O||(!!O.onExpandClick||!("onExpandClick"in O&&!O.onExpandClick)),[O]),Y=a(()=>{(null==O?void 0:O.onExpandClick)?O.onExpandClick({blocks:A,highlightMap:D}):H(!0)},[O,A,D]),Z=!!(null==O?void 0:O.onOpenFile),ee=(null==P?void 0:P.readFileCitationIcon)||e(h,{style:{width:"14px",height:"14px"}}),te=a((e,t,n,l)=>{const i=[];if(n.forEach(([e,n])=>{i.push({range:new t.Range(e,1,n,1),options:{isWholeLine:!0,className:d.yellowHighlightedLine,linesDecorationsClassName:d.yellowHighlightedLineDecoration}})}),i.length>0)try{e.createDecorationsCollection(i)}catch(e){console.warn("Failed to create decorations:",e)}const o=n[0];o&&requestAnimationFrame(()=>{e.revealLineInCenter(o[0])}),l>0&&e.updateOptions({lineNumbers:e=>String(e+l)})},[]),ne=n=>A.map((l,i)=>{const o=l.code.split("\n").length,r=G(l.filePath),a=y(r,o,q,_),s=r.map(e=>b(e,o,a?q:void 0,a?_:void 0)).filter(e=>null!==e),h=a&&v(q)?s.map(([e,t])=>[e+q-1,t+q-1]):s,u=s.length>0,p=i===J,f=n?600:B.maxHeight,x=(()=>{const e=20*l.code.split("\n").length+16+4;return Math.min(Math.max(e,B.minHeight),f)})(),N=l.filePath.split("/").pop()||l.filePath,k=a&&v(q)?q-1:0,M=k+o,P=String(Math.max(1,M)).length;return t("div",{ref:!n&&p?T:void 0,"data-highlighted":u?"true":void 0,"data-first-highlighted":p?"true":void 0,className:d.blockContainer,style:{border:`1px solid ${L.border}`,...null==F?void 0:F.blockContainer},children:[t("div",{className:d.header,style:{backgroundColor:u?L.highlightBg:L.headerBg,borderBottom:`1px solid ${L.border}`,color:u?L.highlightGutter:L.foreground,...u?null==F?void 0:F.headerHighlighted:null==F?void 0:F.header},children:[t("div",{className:d.headerLeft,children:[e(g,{title:l.filePath,arrow:!0,placement:"top",slotProps:E,children:e("span",{className:d.fileName,style:null==F?void 0:F.fileName,onClick:()=>U(l.filePath,o),children:N})}),Z&&e(g,{title:`Open ${N} in editor`,arrow:!0,placement:"top",slotProps:E,children:e("button",{className:d.openFileButton,onClick:()=>U(l.filePath,o),"aria-label":`Open ${N} in editor`,style:null==F?void 0:F.openFileButton,children:ee})})]}),t("div",{className:d.headerRight,children:[u&&e(g,{title:`Highlighted lines: ${w(h)}`,arrow:!0,placement:"top",slotProps:E,children:e("span",{className:d.lineRanges,style:null==F?void 0:F.lineRanges,children:w(h)})}),!n&&X&&0===i&&e(g,{title:"Expand code view",arrow:!0,placement:"top",slotProps:E,children:e("button",{className:d.expandButton,style:null==F?void 0:F.expandButton,onClick:Y,"aria-label":`Expand ${N} code view`,children:e(m,{size:13})})})]})]}),e("div",{className:d.editorWrapper,style:{height:`${x}px`,backgroundColor:L.background,...null==F?void 0:F.editorWrapper},children:e(c,{height:"100%",language:(S=l.language,C[S.toLowerCase()]||S),value:l.code,theme:B.theme,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:B.fontSize,lineHeight:20,fontFamily:B.fontFamily,lineNumbers:k>0?e=>String(e+k):"on",folding:!1,lineDecorationsWidth:10,lineNumbersMinChars:Math.max(4,P),renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!1,alwaysConsumeMouseWheel:!1},automaticLayout:!0,wordWrap:"off",contextmenu:!1,selectOnLineNumbers:!0,glyphMargin:!1,padding:{top:8,bottom:8},overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,overviewRulerLanes:0,renderWhitespace:"none",guides:{indentation:!1},cursorStyle:"line",cursorBlinking:"solid",fixedOverflowWidgets:!0},onMount:(e,t)=>te(e,t,s,k),loading:e("div",{className:d.editorLoading,style:{color:L.inactiveText},children:"Loading editor..."})})})]},i);var S});if(0===A.length)return e("div",{className:d.emptyState,style:{color:L.inactiveText,...null==F?void 0:F.emptyState},children:"No code content available"});const le=j?s.createPortal(e("div",{className:d.modalOverlay,style:null==F?void 0:F.modalOverlay,onClick:e=>{e.target===e.currentTarget&&H(!1)},children:t("div",{className:d.modalContent,style:null==F?void 0:F.modalContent,children:[t("div",{className:d.modalHeader,style:null==F?void 0:F.modalHeader,children:[e("span",{className:d.modalTitle,style:null==F?void 0:F.modalTitle,children:1===A.length?e(g,{title:A[0].filePath,arrow:!0,placement:"top",slotProps:E,children:t("span",{className:d.modalTitleContent,children:[e(p,{name:A[0].filePath,size:"15px"}),e("span",{className:d.modalTitleText,children:A[0].filePath})]})}):`${A.length} files`}),e(g,{title:"Close expanded view",arrow:!0,placement:"bottom",slotProps:E,children:e("button",{className:d.modalCloseButton,style:null==F?void 0:F.modalCloseButton,onClick:()=>H(!1),"aria-label":"Close expanded view",children:e(u,{size:16})})})]}),e("div",{className:d.modalBody,children:e("div",{className:d.container,style:null==F?void 0:F.container,children:ne(!0)})})]})}),document.body):null;return t(n,{children:[le,e("div",{className:d.container,style:null==F?void 0:F.container,children:ne(!1)})]})};export{k as default};
2
2
  //# sourceMappingURL=ReadFileCitationContent.js.map
@@ -1,2 +1,2 @@
1
- import{useRef as e}from"react";import{processAIReasoningFromBlocks as i}from"../utils/proccess-stream.utils.js";function t({setUserStory:t,setAiReasoning:o,setUserStoryCitations:n,onStreamingCompleted:r,isGraphQLCallInProgress:s,knowledgeBase:a,projectAnalyserSummary:u,dataSourceFiles:l,aiReasoning:c,setRedisValue:d,fetchCitationByBlock:p}){const _=e(new Set),m=e(new Set),g=e(null),b=e(null),v=e({gap_items_prompt:"",risk_items_prompt:""}),f=e(new Set);async function h(e,i,t){var a,u;let l="",c="";try{const r=await p(e,t,i);o(e=>{var i;const t=[...e];return null===(i=r.response.ai_reasonings)||void 0===i||i.forEach(e=>{const i=t.findIndex(i=>i.id===e.id);-1!==i&&e.gap.length>0&&e.reason.length>0&&(t[i]={...e})}),t}),l=(null===(a=r.response)||void 0===a?void 0:a.gap_items_prompt)||"",c=(null===(u=r.response)||void 0===u?void 0:u.risk_items_prompt)||"",(l||c)&&(v.current={gap_items_prompt:l,risk_items_prompt:c}),n(e=>{var i,t,o,n,s,a,u,l,c,d,p,_,m,g;return{...e,appmod_citations:[...null!==(i=e.appmod_citations)&&void 0!==i?i:[],...null!==(t=r.response.appmod_citations)&&void 0!==t?t:[]],audio_citations:[...null!==(o=e.audio_citations)&&void 0!==o?o:[],...null!==(n=r.response.audio_citations)&&void 0!==n?n:[]],file_citations:[...null!==(s=e.file_citations)&&void 0!==s?s:[],...null!==(a=r.response.file_citations)&&void 0!==a?a:[]],image_citations:[...null!==(u=e.image_citations)&&void 0!==u?u:[],...null!==(l=r.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=r.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=r.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=r.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(i){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,i)}finally{let i=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(m.current.add(i),m.current.size===_.current.size&&!s.current){const e=l||v.current.gap_items_prompt,i=c||v.current.risk_items_prompt;await r(e,i),_.current.clear(),m.current.clear(),g.current=null,b.current=null,v.current={gap_items_prompt:"",risk_items_prompt:""},f.current.clear()}}}return{processStreamContent:function(e,r,s){try{const p=JSON.stringify(e);if(b.current===p)return;b.current=p;let m=[],v=[];e=e.map(e=>{var t;const o=`${(e={...e,subBlockNumber:null!==(t=e.subBlockNumber)&&void 0!==t?t:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(f.current.has(o))return null;f.current.add(o);let{outputText:s,reasonings:a,gpt_citation:u,processedDescription:l}=i(e.value,e.blockNumber,e.storyNumber,e.description);n(e=>{var i;return u.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(i=e.gpt_citations)||void 0===i||i.push(...u)),{...e}}),m.push(...a),v.push([...a]);let c=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return _.current.has(c)||(h({...e,value:s,description:l},a,r),_.current.add(c)),{...e,value:s,description:l}}).filter(Boolean),m.forEach(e=>{o(i=>(i.find(i=>i.id===e.id)||i.push(e),[...i]))}),e.length>0&&e.map(({title:e,section:i,value:o,storyNumber:n,description:r,blockNumber:p,big_enough:_,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h},N)=>{t(t=>{var y,k,S,B,R,$,w,C;const O=t.findIndex(e=>e.storyNumber===n);if("intro"===i)-1===O?t.push({artifactId:`STORY-${n}-${p}`,title:e,value:o,description:r,storyNumber:n,sub_features:[],section:i,blockNumber:p,aiReasoning:v[N],big_enough:_,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h}):(t[O].value+=o,t[O].aiReasoning=t[O].aiReasoning||[],null===(k=null===(y=t[O])||void 0===y?void 0:y.aiReasoning)||void 0===k||k.push(...v[N]),t[O].big_enough=_,t[O].big_enough_decision_factors=m,t[O].gapValue=b,t[O].confidenceScore=f,t[O].metadata=h);else{t[O].sub_features||(t[O].sub_features=[]);const r=(null===(B=null===(S=t[O])||void 0===S?void 0:S.sub_features)||void 0===B?void 0:B.findIndex(e=>e.blockNumber===p))||-1;if(-1===r)null===($=null===(R=t[O])||void 0===R?void 0:R.sub_features)||void 0===$||$.push({artifactId:`STORY-${n}-${p}`,title:e,value:o,storyNumber:n,blockNumber:p,section:i,aiReasoning:v[N],big_enough:_,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:h});else{let e=null===(C=null===(w=null==t?void 0:t[O])||void 0===w?void 0:w.sub_features)||void 0===C?void 0:C[r];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...v[N]),e.big_enough=_,e.big_enough_decision_factors=m,e.gapValue=b,e.confidenceScore=f,e.metadata=h}}const E=JSON.stringify(t);return g.current!==E&&(d({key:`streaming-redis-key-${s}`,value:{mmvf_list:t,knowledgeBase:a,projectAnalyserSummary:u,dataSources_files:l,ai_reasonings:c}}),g.current=E),[...t]})})}catch(e){console.error("Error in processing Stream Content",e)}}}}export{t as useStreamContentHandler};
1
+ import{useState as e,useRef as i,useEffect as t}from"react";import{processAIReasoningFromBlocks as o}from"../utils/proccess-stream.utils.js";function n({setUserStory:n,setAiReasoning:r,setUserStoryCitations:s,onStreamingCompleted:a,isGraphQLCallInProgress:l,knowledgeBase:u,projectAnalyserSummary:c,dataSourceFiles:d,aiReasoning:p,setRedisValue:_,fetchCitationByBlock:m}){const[g,b]=e({finalGap:"",finalRisk:"",status:"in-progress"}),f=i(new Set),v=i(new Set),h=i(null),k=i(null),N=i({gap_items_prompt:"",risk_items_prompt:""}),y=i(new Set);return t(()=>{"complete"!==g.status||l||(a(g.finalGap,g.finalRisk),f.current.clear(),v.current.clear(),h.current=null,k.current=null,N.current={gap_items_prompt:"",risk_items_prompt:""},y.current.clear(),b({finalGap:"",finalRisk:"",status:"in-progress"}))},[g,l]),{processStreamContent:function(e,i,t){try{const a=JSON.stringify(e);if(k.current===a)return;k.current=a;let l=[],g=[];e=e.map(e=>{var t;const n=`${(e={...e,subBlockNumber:null!==(t=e.subBlockNumber)&&void 0!==t?t:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(y.current.has(n))return null;y.current.add(n);let{outputText:a,reasonings:u,gpt_citation:c,processedDescription:d}=o(e.value,e.blockNumber,e.storyNumber,e.description);s(e=>{var i;return c.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(i=e.gpt_citations)||void 0===i||i.push(...c)),{...e}}),l.push(...u),g.push([...u]);let p=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return f.current.has(p)||(!async function(e,i,t){var o,n;let a="",l="";try{const u=await m(e,t,i);r(e=>{var i;const t=[...e];return null===(i=u.response.ai_reasonings)||void 0===i||i.forEach(e=>{const i=t.findIndex(i=>i.id===e.id);-1!==i&&e.gap.length>0&&e.reason.length>0&&(t[i]={...e})}),t}),a=(null===(o=u.response)||void 0===o?void 0:o.gap_items_prompt)||"",l=(null===(n=u.response)||void 0===n?void 0:n.risk_items_prompt)||"",(a||l)&&(N.current={gap_items_prompt:a,risk_items_prompt:l}),s(e=>{var i,t,o,n,r,s,a,l,c,d,p,_,m,g;return{...e,appmod_citations:[...null!==(i=e.appmod_citations)&&void 0!==i?i:[],...null!==(t=u.response.appmod_citations)&&void 0!==t?t:[]],audio_citations:[...null!==(o=e.audio_citations)&&void 0!==o?o:[],...null!==(n=u.response.audio_citations)&&void 0!==n?n:[]],file_citations:[...null!==(r=e.file_citations)&&void 0!==r?r:[],...null!==(s=u.response.file_citations)&&void 0!==s?s:[]],image_citations:[...null!==(a=e.image_citations)&&void 0!==a?a:[],...null!==(l=u.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=u.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=u.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=u.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(i){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,i)}finally{let i=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(v.current.add(i),v.current.size===f.current.size){const e=a||N.current.gap_items_prompt,i=l||N.current.risk_items_prompt;b({finalGap:e,finalRisk:i,status:"complete"})}}}({...e,value:a,description:d},u,i),f.current.add(p)),{...e,value:a,description:d}}).filter(Boolean),l.forEach(e=>{r(i=>(i.find(i=>i.id===e.id)||i.push(e),[...i]))}),e.length>0&&e.map(({title:e,section:i,value:o,storyNumber:r,description:s,blockNumber:a,big_enough:l,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:v},k)=>{n(n=>{var N,y,S,R,B,$,C,w;const O=n.findIndex(e=>e.storyNumber===r);if("intro"===i)-1===O?n.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,description:s,storyNumber:r,sub_features:[],section:i,blockNumber:a,aiReasoning:g[k],big_enough:l,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:v}):(n[O].value+=o,n[O].aiReasoning=n[O].aiReasoning||[],null===(y=null===(N=n[O])||void 0===N?void 0:N.aiReasoning)||void 0===y||y.push(...g[k]),n[O].big_enough=l,n[O].big_enough_decision_factors=m,n[O].gapValue=b,n[O].confidenceScore=f,n[O].metadata=v);else{n[O].sub_features||(n[O].sub_features=[]);const t=(null===(R=null===(S=n[O])||void 0===S?void 0:S.sub_features)||void 0===R?void 0:R.findIndex(e=>e.blockNumber===a))||-1;if(-1===t)null===($=null===(B=n[O])||void 0===B?void 0:B.sub_features)||void 0===$||$.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,storyNumber:r,blockNumber:a,section:i,aiReasoning:g[k],big_enough:l,big_enough_decision_factors:m,gapValue:b,confidenceScore:f,metadata:v});else{let e=null===(w=null===(C=null==n?void 0:n[O])||void 0===C?void 0:C.sub_features)||void 0===w?void 0:w[t];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...g[k]),e.big_enough=l,e.big_enough_decision_factors=m,e.gapValue=b,e.confidenceScore=f,e.metadata=v}}const E=JSON.stringify(n);return h.current!==E&&(_({key:`streaming-redis-key-${t}`,value:{mmvf_list:n,knowledgeBase:u,projectAnalyserSummary:c,dataSources_files:d,ai_reasonings:p}}),h.current=E),[...n]})})}catch(e){console.error("Error in processing Stream Content",e)}}}}export{n as useStreamContentHandler};
2
2
  //# sourceMappingURL=useStreamContentHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CitationAnchor.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EACV,aAAa,EAIhB,MAAM,OAAO,CAAC;AAef,UAAU,mBAAmB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,iBAAiB,CAAC,EAAE;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE;QACV,qBAAqB,CAAC,EAAE,aAAa,CAAC;QACtC,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,cAAc,CAAC,EAAE,aAAa,CAAC;QAC/B,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAClC,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,SAAS,CAAC,EAAE,aAAa,CAAC;QAC1B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,mBAAmB,CAAC,EAAE,aAAa,CAAC;QACpC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,oBAAoB,CAAC,EAAE,aAAa,CAAC;QACrC,eAAe,CAAC,EAAE,aAAa,CAAC;KACnC,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB;AAqWD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAiKjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CitationAnchor.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EACV,aAAa,EAIhB,MAAM,OAAO,CAAC;AAef,UAAU,mBAAmB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,iBAAiB,CAAC,EAAE;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE;QACV,qBAAqB,CAAC,EAAE,aAAa,CAAC;QACtC,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,cAAc,CAAC,EAAE,aAAa,CAAC;QAC/B,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAClC,UAAU,CAAC,EAAE,aAAa,CAAC;QAC3B,QAAQ,CAAC,EAAE,aAAa,CAAC;QACzB,SAAS,CAAC,EAAE,aAAa,CAAC;QAC1B,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,mBAAmB,CAAC,EAAE,aAAa,CAAC;QACpC,eAAe,CAAC,EAAE,aAAa,CAAC;QAChC,oBAAoB,CAAC,EAAE,aAAa,CAAC;QACrC,eAAe,CAAC,EAAE,aAAa,CAAC;KACnC,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB;AAyXD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAiKjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveComponent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAUlE,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAKlH,KAAK,OAAO,GAAG;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAClC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAGF,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACvC;AAED,KAAK,KAAK,GAAG;IAET,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,CAAC,aAAa,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5G,eAAe,CAAC,EAAE,OAAO,CAAC;IAG1B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC;IAC/C,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACnD,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAG7C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,WAAW,CAAC,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;;AA2fF,wBAAsD"}
1
+ {"version":3,"file":"CognitiveComponent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAUlE,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAKlH,KAAK,OAAO,GAAG;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAClC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAGF,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACvC;AAED,KAAK,KAAK,GAAG;IAET,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,CAAC,aAAa,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5G,eAAe,CAAC,EAAE,OAAO,CAAC;IAG1B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC;IAC/C,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACnD,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAG7C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,WAAW,CAAC,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;;AAygBF,wBAAsD"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReadFileCitationContent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACf,MAAM,iCAAiC,CAAC;AAIzC,UAAU,4BAA4B;IACpC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,YAAY,CAAC,EAAE,0BAA0B,CAAC;IAC1C,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,YAAY,CAAC,EAAE,4BAA4B,CAAC;CAC7C;AAwID,QAAA,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CA0jBnE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"ReadFileCitationContent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACf,MAAM,iCAAiC,CAAC;AAKzC,UAAU,4BAA4B;IACpC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,YAAY,CAAC,EAAE,0BAA0B,CAAC;IAC1C,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,YAAY,CAAC,EAAE,4BAA4B,CAAC;CAC7C;AAwID,QAAA,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAwpBnE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -23,7 +23,7 @@ interface IProps {
23
23
  setAiReasoning: React.Dispatch<React.SetStateAction<TAIReasoning[]>>;
24
24
  setUserStoryCitations: React.Dispatch<React.SetStateAction<UserStoryCitations>>;
25
25
  onStreamingCompleted: (gap_items_prompt?: string, risk_items_prompt?: string) => Promise<void>;
26
- isGraphQLCallInProgress: React.MutableRefObject<boolean>;
26
+ isGraphQLCallInProgress: boolean;
27
27
  knowledgeBase: any;
28
28
  projectAnalyserSummary: any;
29
29
  dataSourceFiles: {
@@ -1 +1 @@
1
- {"version":3,"file":"useStreamContentHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/features/RequirementAI/hooks/useStreamContentHandler.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAErF,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,YAAY,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B,CAAC,EAAE,wBAAwB,CAAC;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF,UAAU,MAAM;IACZ,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACrE,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACjE,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrE,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAChF,oBAAoB,EAAE,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,uBAAuB,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzD,aAAa,EAAE,GAAG,CAAC;IACnB,sBAAsB,EAAE,GAAG,CAAC;IAC5B,eAAe,EAAE;QACb,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,oBAAoB,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACjI;AAED,wBAAgB,uBAAuB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,EAAE,MAAM;sCAuE7O,eAAe,EAAE,kBACZ,GAAG,mBACF,MAAM;EAkL9B"}
1
+ {"version":3,"file":"useStreamContentHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/features/RequirementAI/hooks/useStreamContentHandler.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAErF,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,YAAY,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B,CAAC,EAAE,wBAAwB,CAAC;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF,UAAU,MAAM;IACZ,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACrE,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACjE,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrE,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAChF,oBAAoB,EAAE,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,uBAAuB,EAAE,OAAO,CAAC;IACjC,aAAa,EAAE,GAAG,CAAC;IACnB,sBAAsB,EAAE,GAAG,CAAC;IAC5B,eAAe,EAAE;QACb,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,oBAAoB,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACjI;AAED,wBAAgB,uBAAuB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,EAAE,MAAM;sCAgF7O,eAAe,EAAE,kBACZ,GAAG,mBACF,MAAM;EAkL9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/requirement-ai",
3
- "version": "0.0.247",
3
+ "version": "0.0.249",
4
4
  "author": "Saptyadeep Bhattacharjee",
5
5
  "description": "",
6
6
  "license": "MIT",