@e-llm-studio/requirement-ai 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
- package/dist/cjs/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
- package/dist/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/types/src/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),n=require("react"),t=require("../../store/ref.context.js"),i=n.createContext(null);exports.default=function(s){var u=s.children,o=s.userStory,a=s.setUserStory,c=s.aiReasoning,l=s.setAiReasoning,f=s.citations,d=s.setCitations,g=s.apiCachingConfig,h=s.customStyles,v=s.customIcons,m=s.searchQueryList,y=s.searchQueryReasoningIdList,x=s.citationConfig,C=n.useMemo(function(){if(0===o.length||0===c.length)return Array(o.length).fill(0);var e=Array.from({length:o.length},function(){return[]});return c.forEach(function(r){var n=Number(r.relevance_score);if(!(isNaN(n)||n<=0)){var t="ai_reasoning$".concat(r.id),i=o.findIndex(function(e){var r;return e.value.includes(t)||(null===(r=e.sub_features)||void 0===r?void 0:r.some(function(e){return e.value.includes(t)}))});-1!==i&&e[i].push(n)}}),e.map(function(e){return 0===e.length?0:Math.round(e.reduce(function(e,r){return e+r},0)/e.length)})},[o,c]),p=n.useCallback(function(e){var r,n=o.findIndex(function(r){return r.artifactId===e});return-1===n?0:null!==(r=C[n])&&void 0!==r?r:0},[o,C]);return r.jsx(i.Provider,e.__assign({value:{userStory:o,setUserStory:a,aiReasoning:c,setAiReasoning:l,citations:f,setCitations:d,apiCachingConfig:g,customStyles:h,customIcons:v,searchQueryList:m,searchQueryReasoningIdList:y,citationConfig:x,getAvgScoreForStory:p}},{children:r.jsx(t.RefProvider,{children:u})}))},exports.useRequirementAI=function(){var e=n.useContext(i);if(!e)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return e};
|
|
2
2
|
//# sourceMappingURL=RequirementAIWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),i=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),i=require("monaco-editor"),r=require("./ReadFileCitationContent.module.css.js"),a=require("./icons/ExternalLinkIcon.js");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var l=o(i);"undefined"!=typeof self&&(self.MonacoEnvironment=e.__assign(e.__assign({},self.MonacoEnvironment),{getWorker:function(){return{postMessage:function(){},terminate:function(){},addEventListener:function(){},removeEventListener:function(){},dispatchEvent:function(){return!0},onmessage:null,onerror:null,onmessageerror:null}}}));var s=!1,u=function(){if(!s&&"undefined"!=typeof document)try{var e=document.createElement("div");e.style.cssText="position:absolute;top:-9999px;left:-9999px;width:1px;height:1px;overflow:hidden;visibility:hidden;pointer-events:none;",document.body.appendChild(e),l.editor.create(e,{value:"",language:"plaintext",automaticLayout:!1,minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"hidden"},overviewRulerLanes:0,lineNumbers:"off",glyphMargin:!1,folding:!1,lineDecorationsWidth:0,lineNumbersMinChars:0}).dispose(),document.body.removeChild(e),s=!0}catch(e){s=!0}};u(),"undefined"!=typeof window&&(window.addEventListener("error",function(e){var t=e.message||"";if(t.includes("Worker")||t.includes("Monaco"))return e.preventDefault(),e.stopImmediatePropagation(),!1},!0),window.addEventListener("unhandledrejection",function(e){var t,n=(null===(t=e.reason)||void 0===t?void 0:t.message)||String(e.reason||"");(n.includes("Worker")||n.includes("Monaco"))&&(e.preventDefault(),e.stopImmediatePropagation())},!0));var c={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)"},d={theme:"vs-dark",fontSize:13,fontFamily:"Consolas, 'Courier New', monospace",maxHeight:300,minHeight:80},h={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"},f=function(e){return h[e.toLowerCase()]||e},g=function(i){var a=i.code,o=i.language,s=i.theme,c=i.fontSize,d=i.fontFamily,h=i.height,g=i.highlightRanges,m=i.backgroundColor,v=i.editorWrapperStyle,p=n.useRef(null),b=n.useRef(null),y=n.useRef(!1);return n.useEffect(function(){y.current=!1,u();var e=setTimeout(function(){var e=p.current;if(e&&!y.current&&!b.current)try{l.editor.setTheme(s);var t=l.editor.create(e,{value:a,language:f(o),readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:c,lineHeight:20,fontFamily:d,lineNumbers:"on",folding:!1,lineDecorationsWidth:10,lineNumbersMinChars:4,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});if(b.current=t,g.length>0){var n=g.map(function(e){var t=e[0],n=e[1];return{range:new l.Range(t,1,n,1),options:{isWholeLine:!0,className:r.default.highlightedLine,linesDecorationsClassName:r.default.highlightedLineDecoration}}});t.createDecorationsCollection(n);var i=g[0];i&&requestAnimationFrame(function(){!y.current&&b.current&&t.revealLineInCenter(i[0])})}}catch(e){}},50);return function(){if(y.current=!0,clearTimeout(e),b.current){try{b.current.dispose()}catch(e){}b.current=null}}},[]),n.useEffect(function(){try{l.editor.setTheme(s)}catch(e){}},[s]),t.jsx("div",e.__assign({className:r.default.editorWrapper,style:e.__assign({height:"".concat(h,"px"),backgroundColor:m},v)},{children:t.jsx("div",{ref:p,style:{width:"100%",height:"100%"}})}))};exports.default=function(i){var o=i.citation,l=i.customStyles,s=i.customColors,u=i.customIcons,h=i.editorConfig,f=i.fileCallback,m=n.useMemo(function(){return e.__assign(e.__assign({},c),s)},[s]),v=n.useMemo(function(){return e.__assign(e.__assign({},d),h)},[h]),p=n.useRef(null),b=n.useRef(!1),y=o.customMetadata.content||"",_=o.customMetadata.highlighted_text,x=n.useMemo(function(){if(!_)return{};try{var e=_.trim();return e.startsWith("```")&&(e=(e=e.replace(/^```\w*\n?/,"")).replace(/\n?```\s*$/,"")),JSON.parse(e.trim())}catch(e){return console.error("Failed to parse highlight string:",e),{}}},[_]),j=n.useMemo(function(){for(var e=[],t=y.split("```"),n=1;n<t.length;n+=2){var i=t[n];if(null==i?void 0:i.trim()){var r=i.match(/<file_path>\s*([\s\S]*?)\s*<\/file_path>/),a=r?r[1].trim():"",o=i.match(/<code>\s*([\s\S]*?)\s*<\/code>/),l=o?o[1].trim():"",s=i.match(/^(\w+)\s/),u=s?s[1]:"javascript";a&&l&&e.push({filePath:a,code:l,language:u})}}return e},[y]),C=n.useCallback(function(e){return(x[e]||[]).map(function(e){var t=e.split("-").map(Number),n=t[0];return[n+1,(t.length>1?t[1]:n)+1]})},[x]),w=n.useMemo(function(){for(var e=0;e<j.length;e++){if(C(j[e].filePath).length>0)return e}return-1},[j,C]),k=w>=0,M=n.useCallback(function(e,t){return C(e).map(function(e){var n=e[0],i=e[1];return n>t?[0,0]:[n,Math.min(i,t)]}).filter(function(e){var t=e[0],n=e[1];return t>0&&n>=t})},[C]),N=n.useCallback(function(e){var t=20*e.split("\n").length+16+4;return Math.min(Math.max(t,v.minHeight),v.maxHeight)},[v.minHeight,v.maxHeight]);n.useEffect(function(){if(k&&!b.current&&j.length>0&&(null==f?void 0:f.autoOpenFirstHighlighted)&&(null==f?void 0:f.onOpenFile)){var e=j[w],t=M(e.filePath,e.code.split("\n").length);b.current=!0;var n=setTimeout(function(){f.onOpenFile({filePath:e.filePath,ranges:t.length>0?t:null})},300);return function(){return clearTimeout(n)}}},[k,w,j,M,f]),n.useEffect(function(){b.current=!1},[y]),n.useEffect(function(){if(!(w<0)){var e=setTimeout(function(){var e;null===(e=p.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},350);return function(){return clearTimeout(e)}}},[w,_]);var L=n.useCallback(function(e,t){if(null==f?void 0:f.onOpenFile){var n=M(e,t);f.onOpenFile({filePath:e,ranges:n.length>0?n:null})}},[M,f]),O=!!(null==f?void 0:f.onOpenFile),S=(null==u?void 0:u.readFileCitationIcon)||t.jsx(a.default,{style:{width:"14px",height:"14px"}});return 0===j.length?t.jsx("div",e.__assign({className:r.default.emptyState,style:e.__assign({color:m.inactiveText},null==l?void 0:l.emptyState)},{children:"No code content available"})):t.jsx("div",e.__assign({className:r.default.container,style:null==l?void 0:l.container},{children:j.map(function(n,i){var a,o=C(n.filePath),s=o.length>0,u=i===w,c=N(n.code),d=n.filePath.split("/").pop(),h=n.code.split("\n").length,f=M(n.filePath,h);return t.jsxs("div",e.__assign({ref:u?p:void 0,"data-highlighted":s?"true":void 0,"data-first-highlighted":u?"true":void 0,className:r.default.blockContainer,style:e.__assign({border:"1px solid ".concat(m.border)},null==l?void 0:l.blockContainer)},{children:[t.jsxs("div",e.__assign({className:r.default.header,style:e.__assign({backgroundColor:s?m.highlightBg:m.headerBg,borderBottom:"1px solid ".concat(m.border),color:s?m.highlightGutter:m.foreground},s?null==l?void 0:l.headerHighlighted:null==l?void 0:l.header)},{children:[t.jsxs("div",e.__assign({className:r.default.headerLeft},{children:[t.jsx("span",e.__assign({className:r.default.fileName,title:n.filePath,style:null==l?void 0:l.fileName},{children:d})),O&&t.jsx("button",e.__assign({className:r.default.openFileButton,onClick:function(){return L(n.filePath,h)},title:"Open in editor","aria-label":"Open ".concat(d," in editor"),style:null==l?void 0:l.openFileButton},{children:S}))]})),s&&t.jsx("span",e.__assign({className:r.default.lineRanges,style:null==l?void 0:l.lineRanges},{children:(a=o,a.map(function(e){var t=e[0],n=e[1];return t===n?"L".concat(t):"L".concat(t,"-").concat(n)}).join(", "))}))]})),t.jsx(g,{code:n.code,language:n.language,theme:v.theme,fontSize:v.fontSize,fontFamily:v.fontFamily,height:c,highlightRanges:f,backgroundColor:m.background,editorWrapperStyle:null==l?void 0:l.editorWrapper})]}),i)})}))};
|
|
2
2
|
//# sourceMappingURL=ReadFileCitationContent.js.map
|
package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("react-markdown"),r=require("rehype-raw"),o=require("./UserStoryWithCitation.module.css.js"),a=require("../../shared/useMarkdownSearch.js"),l=require("lucide-react"),d=require("@mui/material"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),v=require("../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("../ai-reasoning/AiReasoningCitation.js"),g=require("../../icons/RelevanceScoreIcon.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=h(t),p=h(r),m=i.createContext(!1),x=i.createContext({expandedInfo:null,setExpanded:function(){},reasonToRow:{current:new Map}}),C=i.createContext({rowId:""}),y=function(t){var r,a,l=t.children,d=t.node,s=i.useRef(Math.random().toString(36).slice(2)).current,c=i.useContext(x).expandedInfo,u=(null==c?void 0:c.rowId)===s,v=Array.isArray(null==d?void 0:d.children)?d.children.filter(function(e){return"element"===e.type}).length:1,f=null!==(a=null===(r=null==d?void 0:d.properties)||void 0===r?void 0:r.style)&&void 0!==a?a:void 0;return n.jsxs(C.Provider,e.__assign({value:{rowId:s}},{children:[n.jsx("tr",e.__assign({style:f?{cssText:f}:void 0},{children:l})),u&&(null==c?void 0:c.aiReason)&&n.jsx("tr",e.__assign({style:{width:"100%"}},{children:n.jsx("td",e.__assign({colSpan:v||1,className:o.default.tableExpandedCell},{children:n.jsx("div",e.__assign({className:o.default.tableExpandedCellInner},{children:n.jsx("div",{className:o.default.tableExpandedCellContent})}))}))}))]}))};exports.default=function(t){var r=t.message,h=t.scenario,C=t.showUserStoryDiff,j=void 0!==C&&C,S=t.aiReasoningsForBlock,R=t.isCitationLoadingDisplay,w=void 0!==R&&R,I=t.className;t.highConfidenceIcon,t.lowConfidenceIcon;var b=t.customStyles,N=t.customIcons,q=t.aiReasoningDiffView,A=t.userStoryCitations,M=t.artifactId,T=i.useRef(null),L=v.useRequirementAI(),U=L.userStory,E=L.getAvgScoreForStory,P=L.setUserStory,k=L.aiReasoning,F=L.setAiReasoning,$=L.customIcons,D=L.searchQueryList,W=L.searchQueryReasoningIdList,H=null!=N?N:null==$?void 0:$.userStoryIcons,z=null==b?void 0:b.searchHighlight,G=a.useMarkdownSearch(T,z),O=G.search,Q=G.clear,B=i.useState("1"),V=B[0],J=B[1],K=i.useState(null),X=K[0],Y=K[1],Z=i.useRef(new Map),ee=i.useCallback(function(e,n){Y(e&&n?{rowId:e,aiReason:n}:null)},[]),ne=M?E(M):0,ie=i.useState([]),te=ie[0],re=ie[1],oe=function(e){var n=new RegExp("<(/?(".concat(["updated","deleted","changed"].join("|"),"))>"),"g"),i=e.replace(n,"\n\n<$1>\n\n");return i=(i=i.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,function(e,n){var i=n.replace(/ai_reasoning\$(\d+)/g,function(e,n){return"ai_reasoning$".concat(n,"-legacy")});return"<deleted>".concat(i,"</deleted>")})).replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,function(e,n,i){var t=btoa(encodeURIComponent(i.trim()));return"\n\n<generatedCode".concat(n,' data-raw="').concat(t,'"></generatedCode>\n\n')})};i.useMemo(function(){return r?oe(r):r},[r]),i.useEffect(function(){re(S||k)},[S,k]);var ae=i.useMemo(function(){return{h1:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("h1",e.__assign({className:o.default.heading1,style:null==b?void 0:b.heading1},{children:t.children}))},h2:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("h2",e.__assign({className:o.default.heading2,style:null==b?void 0:b.heading2},{children:t.children}))},h3:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("h3",e.__assign({className:o.default.heading3,style:null==b?void 0:b.heading3},{children:t.children}))},b:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("b",e.__assign({className:o.default.bold,style:null==b?void 0:b.bold},{children:null==t?void 0:t.children}))},p:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("p",e.__assign({},t,{className:o.default.paragraph,style:null==b?void 0:b.paragraph},{children:t.children}))},updated:function(i){var t=i.node,r=e.__rest(i,["node"]);return n.jsx(s.default,e.__assign({showUserStoryDiff:j,currentUpdatedTagId:V,setCurrentUpdatedTagId:J,userStory:U,setUserStory:P,setAiReasoning:F,node:t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("react-markdown"),r=require("rehype-raw"),o=require("./UserStoryWithCitation.module.css.js"),a=require("../../shared/useMarkdownSearch.js"),l=require("lucide-react"),d=require("@mui/material"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),v=require("../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("../ai-reasoning/AiReasoningCitation.js"),g=require("../../icons/RelevanceScoreIcon.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=h(t),p=h(r),m=i.createContext(!1),x=i.createContext({expandedInfo:null,setExpanded:function(){},reasonToRow:{current:new Map}}),C=i.createContext({rowId:""}),y=function(t){var r,a,l=t.children,d=t.node,s=i.useRef(Math.random().toString(36).slice(2)).current,c=i.useContext(x).expandedInfo,u=(null==c?void 0:c.rowId)===s,v=Array.isArray(null==d?void 0:d.children)?d.children.filter(function(e){return"element"===e.type}).length:1,f=null!==(a=null===(r=null==d?void 0:d.properties)||void 0===r?void 0:r.style)&&void 0!==a?a:void 0;return n.jsxs(C.Provider,e.__assign({value:{rowId:s}},{children:[n.jsx("tr",e.__assign({style:f?{cssText:f}:void 0},{children:l})),u&&(null==c?void 0:c.aiReason)&&n.jsx("tr",e.__assign({style:{width:"100%"}},{children:n.jsx("td",e.__assign({colSpan:v||1,className:o.default.tableExpandedCell},{children:n.jsx("div",e.__assign({className:o.default.tableExpandedCellInner},{children:n.jsx("div",{className:o.default.tableExpandedCellContent})}))}))}))]}))};exports.default=function(t){var r=t.message,h=t.scenario,C=t.showUserStoryDiff,j=void 0!==C&&C,S=t.aiReasoningsForBlock,R=t.isCitationLoadingDisplay,w=void 0!==R&&R,I=t.className;t.highConfidenceIcon,t.lowConfidenceIcon;var b=t.customStyles,N=t.customIcons,q=t.aiReasoningDiffView,A=t.userStoryCitations,M=t.artifactId,T=i.useRef(null),L=v.useRequirementAI(),U=L.userStory,E=L.getAvgScoreForStory,P=L.setUserStory,k=L.aiReasoning,F=L.setAiReasoning,$=L.customIcons,D=L.searchQueryList,W=L.searchQueryReasoningIdList,H=null!=N?N:null==$?void 0:$.userStoryIcons,z=null==b?void 0:b.searchHighlight,G=a.useMarkdownSearch(T,z),O=G.search,Q=G.clear,B=i.useState("1"),V=B[0],J=B[1],K=i.useState(null),X=K[0],Y=K[1],Z=i.useRef(new Map),ee=i.useCallback(function(e,n){Y(e&&n?{rowId:e,aiReason:n}:null)},[]),ne=M?E(M):0,ie=i.useState([]),te=ie[0],re=ie[1],oe=function(e){var n=new RegExp("<(/?(".concat(["updated","deleted","changed"].join("|"),"))>"),"g"),i=e.replace(n,"\n\n<$1>\n\n");return i=(i=i.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,function(e,n){var i=n.replace(/ai_reasoning\$(\d+)/g,function(e,n){return"ai_reasoning$".concat(n,"-legacy")});return"<deleted>".concat(i,"</deleted>")})).replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,function(e,n,i){var t=btoa(encodeURIComponent(i.trim()));return"\n\n<generatedCode".concat(n,' data-raw="').concat(t,'"></generatedCode>\n\n')})};i.useMemo(function(){return r?oe(r):r},[r]),i.useEffect(function(){re(S||k)},[S,k]);var ae=i.useMemo(function(){return{h1:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("h1",e.__assign({className:o.default.heading1,style:null==b?void 0:b.heading1},{children:t.children}))},h2:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("h2",e.__assign({className:o.default.heading2,style:null==b?void 0:b.heading2},{children:t.children}))},h3:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("h3",e.__assign({className:o.default.heading3,style:null==b?void 0:b.heading3},{children:t.children}))},b:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("b",e.__assign({className:o.default.bold,style:null==b?void 0:b.bold},{children:null==t?void 0:t.children}))},p:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("p",e.__assign({},t,{className:o.default.paragraph,style:null==b?void 0:b.paragraph},{children:t.children}))},updated:function(i){var t=i.node,r=e.__rest(i,["node"]);return n.jsx(s.default,e.__assign({},r,{showUserStoryDiff:j,currentUpdatedTagId:V,setCurrentUpdatedTagId:J,userStory:U,setUserStory:P,setAiReasoning:F,node:t,customStyles:null==b?void 0:b.updatedContent}))},ol:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("ol",e.__assign({className:o.default.orderedList,style:null==b?void 0:b.olist},{children:null==t?void 0:t.children}))},ul:function(i){i.node;var t=e.__rest(i,["node"]);return n.jsx("ul",e.__assign({className:o.default.unorderedList,style:null==b?void 0:b.ulist},{children:null==t?void 0:t.children}))},table:function(i){var t=i.children;return n.jsx("div",e.__assign({className:o.default.tableWrapper},{children:n.jsx("table",e.__assign({className:o.default.table,style:null==b?void 0:b.table},{children:t}))}))},tr:y,td:function(i){var t,r=i.node,o=i.children,a=null!==(t=null==r?void 0:r.properties)&&void 0!==t?t:{},l=a.style,d=e.__rest(a,["style"]);return n.jsx(m.Provider,e.__assign({value:!0},{children:n.jsx("td",e.__assign({},d,{style:l?{cssText:l}:void 0},{children:o}))}))},th:function(i){var t,r=i.node,o=i.children,a=null!==(t=null==r?void 0:r.properties)&&void 0!==t?t:{},l=a.style,d=e.__rest(a,["style"]);return n.jsx(m.Provider,e.__assign({value:!0},{children:n.jsx("th",e.__assign({},d,{style:l?{cssText:l}:void 0},{children:o}))}))},a:function(t){var r,o,a;t.inline,t.children,t.node;var l=e.__rest(t,["inline","children","node"]),d=i.useContext(m)||"true"==(null==l?void 0:l.table),s="".concat(null==l?void 0:l.href),c=null===(r=s.split("$"))||void 0===r?void 0:r[0],u=null===(o=s.split("$"))||void 0===o?void 0:o[1];if("ai_reasoning"===c){var v=(null!==(a=j?q:k)&&void 0!==a?a:[]).find(function(e){return e.id.toString()===decodeURIComponent(u)});if(v&&v.reason.length>0&&v.gap.length>0)return n.jsx(f.default,{title:"Source",aiReason:v,isSourceHasHighlight:!1,isTable:d,customIcons:H,customStyles:{aiReasoningContent:null==b?void 0:b.aiReasoningContent,aiReasoningAccordion:null==b?void 0:b.aiReasoningAccordion,aiReasoningMarkdown:null==b?void 0:b.aiReasoningMarkdown,aiReasoningPill:null==b?void 0:b.aiReasoningPill,webCitation:null==b?void 0:b.webCitation,stormeeCitation:null==b?void 0:b.stormeeCitation,waveformCitation:null==b?void 0:b.waveformCitation,imageCitation:null==b?void 0:b.imageCitation,fileCitation:null==b?void 0:b.fileCitation,appModCitation:null==b?void 0:b.appModCitation,rcaCitation:null==b?void 0:b.rcaCitation,readFileCitation:null==b?void 0:b.readFileCitation}})}return null},code:function(i){i.inline;var t=i.children,r=i.className;return i.node,e.__rest(i,["inline","children","className","node"]),/language-(\w+)/.exec(r||"")||(null==r?void 0:r.includes("language-"))?n.jsx("div",{children:n.jsx("code",e.__assign({className:o.default.blockCode,style:null==b?void 0:b.code},{children:t}))}):n.jsx("code",e.__assign({className:o.default.inlineCode,style:null==b?void 0:b.code},{children:t}))},learned:function(i){var t=i.children;return n.jsx(d.Tooltip,e.__assign({title:t,placement:"top"},{children:n.jsx(l.Info,{size:16,className:o.default.learned})}))},generatedcode:function(i){i.node;var t=e.__rest(i,["node"]),r=(null==t?void 0:t.language)||"python",o=function(e){var n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{var i=function(e){var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n}(t);return n.jsx(c.default,{title:"Generated Code",code:o,language:r,customStyles:{pill:null==b?void 0:b.generatedCodePill,content:null==b?void 0:b.generatedCodeContent}})}}},[te,k,A,V,j,r,N]);return i.useEffect(function(){if(T.current){if(null==D?void 0:D.length){var e;if(0===(null==W?void 0:W.length))requestAnimationFrame(function(){O(D.map(function(e){return e.replace(/\*/g,"")}))});else{var n=T.current,i=new MutationObserver(function(){clearTimeout(e),e=setTimeout(function(){i.disconnect(),requestAnimationFrame(function(){O(D.map(function(e){return e.replace(/\*/g,"")}))})},50)});i.observe(n,{childList:!0,subtree:!0})}return function(){clearTimeout(e)}}Q()}},[D,W]),n.jsx(x.Provider,e.__assign({value:{expandedInfo:X,setExpanded:ee,reasonToRow:Z}},{children:n.jsxs("div",e.__assign({ref:T,className:"".concat(o.default.container," ").concat("approving"!==h?o.default.wrapper:""," ").concat(I||""),style:null==b?void 0:b.container},{children:[n.jsx(_.default,e.__assign({components:ae,rehypePlugins:[p.default]},{children:oe(r)})),ne>0&&n.jsx("div",e.__assign({className:o.default.confidenceScoreContainer,style:null==b?void 0:b.confidenceScoreContainer},{children:n.jsxs("span",e.__assign({className:o.default.confidenceScore,style:null==b?void 0:b.confidenceScore},{children:[n.jsx(g.default,{size:14,color:(null==b?void 0:b.confidenceScoreIconColor)||"#166534"}),ne,"%"]}))})),w&&n.jsx("div",e.__assign({className:o.default.citationLoader,style:null==b?void 0:b.citationLoaderContainer},{children:n.jsx(u.default,{customStyles:{container:null==b?void 0:b.citationLoadingContainer,icon:null==b?void 0:b.citationLoadingIcon,text:null==b?void 0:b.citationLoadingText}})}))]}))}))};
|
|
2
2
|
//# sourceMappingURL=UserStoryWithCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as r}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as r}from"tslib";import{jsx as n}from"react/jsx-runtime";import{createContext as e,useMemo as t,useCallback as i,useContext as o}from"react";import{RefProvider as s}from"../../store/ref.context.js";var u=e(null),a=function(e){var o=e.children,a=e.userStory,c=e.setUserStory,f=e.aiReasoning,l=e.setAiReasoning,g=e.citations,d=e.setCitations,h=e.apiCachingConfig,m=e.customStyles,v=e.customIcons,y=e.searchQueryList,p=e.searchQueryReasoningIdList,I=e.citationConfig,C=t(function(){if(0===a.length||0===f.length)return Array(a.length).fill(0);var r=Array.from({length:a.length},function(){return[]});return f.forEach(function(n){var e=Number(n.relevance_score);if(!(isNaN(e)||e<=0)){var t="ai_reasoning$".concat(n.id),i=a.findIndex(function(r){var n;return r.value.includes(t)||(null===(n=r.sub_features)||void 0===n?void 0:n.some(function(r){return r.value.includes(t)}))});-1!==i&&r[i].push(e)}}),r.map(function(r){return 0===r.length?0:Math.round(r.reduce(function(r,n){return r+n},0)/r.length)})},[a,f]),R=i(function(r){var n,e=a.findIndex(function(n){return n.artifactId===r});return-1===e?0:null!==(n=C[e])&&void 0!==n?n:0},[a,C]);return n(u.Provider,r({value:{userStory:a,setUserStory:c,aiReasoning:f,setAiReasoning:l,citations:g,setCitations:d,apiCachingConfig:h,customStyles:m,customIcons:v,searchQueryList:y,searchQueryReasoningIdList:p,citationConfig:I,getAvgScoreForStory:R}},{children:n(s,{children:o})}))},c=function(){var r=o(u);if(!r)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return r};export{a as default,c as useRequirementAI};
|
|
2
2
|
//# sourceMappingURL=RequirementAIWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import{useMemo as i,useRef as r,useCallback as o,useEffect as a}from"react";import*as l from"monaco-editor";import c from"./ReadFileCitationContent.module.css.js";import s from"./icons/ExternalLinkIcon.js";"undefined"!=typeof self&&(self.MonacoEnvironment=e(e({},self.MonacoEnvironment),{getWorker:function(){return{postMessage:function(){},terminate:function(){},addEventListener:function(){},removeEventListener:function(){},dispatchEvent:function(){return!0},onmessage:null,onerror:null,onmessageerror:null}}}));var u=!1,d=function(){if(!u&&"undefined"!=typeof document)try{var e=document.createElement("div");e.style.cssText="position:absolute;top:-9999px;left:-9999px;width:1px;height:1px;overflow:hidden;visibility:hidden;pointer-events:none;",document.body.appendChild(e),l.editor.create(e,{value:"",language:"plaintext",automaticLayout:!1,minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"hidden"},overviewRulerLanes:0,lineNumbers:"off",glyphMargin:!1,folding:!1,lineDecorationsWidth:0,lineNumbersMinChars:0}).dispose(),document.body.removeChild(e),u=!0}catch(e){u=!0}};d(),"undefined"!=typeof window&&(window.addEventListener("error",function(e){var n=e.message||"";if(n.includes("Worker")||n.includes("Monaco"))return e.preventDefault(),e.stopImmediatePropagation(),!1},!0),window.addEventListener("unhandledrejection",function(e){var n,t=(null===(n=e.reason)||void 0===n?void 0:n.message)||String(e.reason||"");(t.includes("Worker")||t.includes("Monaco"))&&(e.preventDefault(),e.stopImmediatePropagation())},!0));var h={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)"},m={theme:"vs-dark",fontSize:13,fontFamily:"Consolas, 'Courier New', monospace",maxHeight:300,minHeight:80},f={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"},g=function(e){return f[e.toLowerCase()]||e},p=function(t){var i=t.code,o=t.language,s=t.theme,u=t.fontSize,h=t.fontFamily,m=t.height,f=t.highlightRanges,p=t.backgroundColor,v=t.editorWrapperStyle,y=r(null),b=r(null),w=r(!1);return a(function(){w.current=!1,d();var e=setTimeout(function(){var e=y.current;if(e&&!w.current&&!b.current)try{l.editor.setTheme(s);var n=l.editor.create(e,{value:i,language:g(o),readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:u,lineHeight:20,fontFamily:h,lineNumbers:"on",folding:!1,lineDecorationsWidth:10,lineNumbersMinChars:4,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});if(b.current=n,f.length>0){var t=f.map(function(e){var n=e[0],t=e[1];return{range:new l.Range(n,1,t,1),options:{isWholeLine:!0,className:c.highlightedLine,linesDecorationsClassName:c.highlightedLineDecoration}}});n.createDecorationsCollection(t);var r=f[0];r&&requestAnimationFrame(function(){!w.current&&b.current&&n.revealLineInCenter(r[0])})}}catch(e){}},50);return function(){if(w.current=!0,clearTimeout(e),b.current){try{b.current.dispose()}catch(e){}b.current=null}}},[]),a(function(){try{l.editor.setTheme(s)}catch(e){}},[s]),n("div",e({className:c.editorWrapper,style:e({height:"".concat(m,"px"),backgroundColor:p},v)},{children:n("div",{ref:y,style:{width:"100%",height:"100%"}})}))},v=function(l){var u=l.citation,d=l.customStyles,f=l.customColors,g=l.customIcons,v=l.editorConfig,y=l.fileCallback,b=i(function(){return e(e({},h),f)},[f]),w=i(function(){return e(e({},m),v)},[v]),x=r(null),C=r(!1),N=u.customMetadata.content||"",L=u.customMetadata.highlighted_text,S=i(function(){if(!L)return{};try{var e=L.trim();return e.startsWith("```")&&(e=(e=e.replace(/^```\w*\n?/,"")).replace(/\n?```\s*$/,"")),JSON.parse(e.trim())}catch(e){return console.error("Failed to parse highlight string:",e),{}}},[L]),k=i(function(){for(var e=[],n=N.split("```"),t=1;t<n.length;t+=2){var i=n[t];if(null==i?void 0:i.trim()){var r=i.match(/<file_path>\s*([\s\S]*?)\s*<\/file_path>/),o=r?r[1].trim():"",a=i.match(/<code>\s*([\s\S]*?)\s*<\/code>/),l=a?a[1].trim():"",c=i.match(/^(\w+)\s/),s=c?c[1]:"javascript";o&&l&&e.push({filePath:o,code:l,language:s})}}return e},[N]),F=o(function(e){return(S[e]||[]).map(function(e){var n=e.split("-").map(Number),t=n[0];return[t+1,(n.length>1?n[1]:t)+1]})},[S]),M=i(function(){for(var e=0;e<k.length;e++){if(F(k[e].filePath).length>0)return e}return-1},[k,F]),W=M>=0,j=o(function(e,n){return F(e).map(function(e){var t=e[0],i=e[1];return t>n?[0,0]:[t,Math.min(i,n)]}).filter(function(e){var n=e[0],t=e[1];return n>0&&t>=n})},[F]),O=o(function(e){var n=20*e.split("\n").length+16+4;return Math.min(Math.max(n,w.minHeight),w.maxHeight)},[w.minHeight,w.maxHeight]);a(function(){if(W&&!C.current&&k.length>0&&(null==y?void 0:y.autoOpenFirstHighlighted)&&(null==y?void 0:y.onOpenFile)){var e=k[M],n=j(e.filePath,e.code.split("\n").length);C.current=!0;var t=setTimeout(function(){y.onOpenFile({filePath:e.filePath,ranges:n.length>0?n:null})},300);return function(){return clearTimeout(t)}}},[W,M,k,j,y]),a(function(){C.current=!1},[N]),a(function(){if(!(M<0)){var e=setTimeout(function(){var e;null===(e=x.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},350);return function(){return clearTimeout(e)}}},[M,L]);var P=o(function(e,n){if(null==y?void 0:y.onOpenFile){var t=j(e,n);y.onOpenFile({filePath:e,ranges:t.length>0?t:null})}},[j,y]),B=!!(null==y?void 0:y.onOpenFile),R=(null==g?void 0:g.readFileCitationIcon)||n(s,{style:{width:"14px",height:"14px"}});return 0===k.length?n("div",e({className:c.emptyState,style:e({color:b.inactiveText},null==d?void 0:d.emptyState)},{children:"No code content available"})):n("div",e({className:c.container,style:null==d?void 0:d.container},{children:k.map(function(i,r){var o,a=F(i.filePath),l=a.length>0,s=r===M,u=O(i.code),h=i.filePath.split("/").pop(),m=i.code.split("\n").length,f=j(i.filePath,m);return t("div",e({ref:s?x:void 0,"data-highlighted":l?"true":void 0,"data-first-highlighted":s?"true":void 0,className:c.blockContainer,style:e({border:"1px solid ".concat(b.border)},null==d?void 0:d.blockContainer)},{children:[t("div",e({className:c.header,style:e({backgroundColor:l?b.highlightBg:b.headerBg,borderBottom:"1px solid ".concat(b.border),color:l?b.highlightGutter:b.foreground},l?null==d?void 0:d.headerHighlighted:null==d?void 0:d.header)},{children:[t("div",e({className:c.headerLeft},{children:[n("span",e({className:c.fileName,title:i.filePath,style:null==d?void 0:d.fileName},{children:h})),B&&n("button",e({className:c.openFileButton,onClick:function(){return P(i.filePath,m)},title:"Open in editor","aria-label":"Open ".concat(h," in editor"),style:null==d?void 0:d.openFileButton},{children:R}))]})),l&&n("span",e({className:c.lineRanges,style:null==d?void 0:d.lineRanges},{children:(o=a,o.map(function(e){var n=e[0],t=e[1];return n===t?"L".concat(n):"L".concat(n,"-").concat(t)}).join(", "))}))]})),n(p,{code:i.code,language:i.language,theme:w.theme,fontSize:w.fontSize,fontFamily:w.fontFamily,height:u,highlightRanges:f,backgroundColor:b.background,editorWrapperStyle:null==d?void 0:d.editorWrapper})]}),r)})}))};export{v as default};
|
|
2
2
|
//# sourceMappingURL=ReadFileCitationContent.js.map
|
package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as n}from"tslib";import{jsx as i,jsxs as o}from"react/jsx-runtime";import{createContext as r,useRef as t,useState as l,useCallback as a,useMemo as d,useEffect as c,useContext as s}from"react";import u from"react-markdown";import v from"rehype-raw";import h from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as m}from"../../shared/useMarkdownSearch.js";import{Info as p}from"lucide-react";import{Tooltip as f}from"@mui/material";import g from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import C from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as S}from"../RequirementAIWrapper/RequirementAIWrapper.js";import w from"../ai-reasoning/AiReasoningCitation.js";import I from"../../icons/RelevanceScoreIcon.js";var R=r(!1),b=r({expandedInfo:null,setExpanded:function(){},reasonToRow:{current:new Map}}),N=r({rowId:""}),x=function(e){var r,l,a=e.children,d=e.node,c=t(Math.random().toString(36).slice(2)).current,u=s(b).expandedInfo,v=(null==u?void 0:u.rowId)===c,m=Array.isArray(null==d?void 0:d.children)?d.children.filter(function(e){return"element"===e.type}).length:1,p=null!==(l=null===(r=null==d?void 0:d.properties)||void 0===r?void 0:r.style)&&void 0!==l?l:void 0;return o(N.Provider,n({value:{rowId:c}},{children:[i("tr",n({style:p?{cssText:p}:void 0},{children:a})),v&&(null==u?void 0:u.aiReason)&&i("tr",n({style:{width:"100%"}},{children:i("td",n({colSpan:m||1,className:h.tableExpandedCell},{children:i("div",n({className:h.tableExpandedCellInner},{children:i("div",{className:h.tableExpandedCellContent})}))}))}))]}))},A=function(r){var N=r.message,A=r.scenario,L=r.showUserStoryDiff,T=void 0!==L&&L,j=r.aiReasoningsForBlock,U=r.isCitationLoadingDisplay,M=void 0!==U&&U,P=r.className;r.highConfidenceIcon,r.lowConfidenceIcon;var E=r.customStyles,k=r.customIcons,F=r.aiReasoningDiffView,$=r.userStoryCitations,q=r.artifactId,D=t(null),W=S(),H=W.userStory,_=W.getAvgScoreForStory,z=W.setUserStory,G=W.aiReasoning,Q=W.setAiReasoning,B=W.customIcons,O=W.searchQueryList,V=W.searchQueryReasoningIdList,J=null!=k?k:null==B?void 0:B.userStoryIcons,K=null==E?void 0:E.searchHighlight,X=m(D,K),Y=X.search,Z=X.clear,ee=l("1"),ne=ee[0],ie=ee[1],oe=l(null),re=oe[0],te=oe[1],le=t(new Map),ae=a(function(e,n){te(e&&n?{rowId:e,aiReason:n}:null)},[]),de=q?_(q):0,ce=l([]),se=ce[0],ue=ce[1],ve=function(e){var n=new RegExp("<(/?(".concat(["updated","deleted","changed"].join("|"),"))>"),"g"),i=e.replace(n,"\n\n<$1>\n\n");return i=(i=i.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,function(e,n){var i=n.replace(/ai_reasoning\$(\d+)/g,function(e,n){return"ai_reasoning$".concat(n,"-legacy")});return"<deleted>".concat(i,"</deleted>")})).replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,function(e,n,i){var o=btoa(encodeURIComponent(i.trim()));return"\n\n<generatedCode".concat(n,' data-raw="').concat(o,'"></generatedCode>\n\n')})};d(function(){return N?ve(N):N},[N]),c(function(){ue(j||G)},[j,G]);var he=d(function(){return{h1:function(o){o.node;var r=e(o,["node"]);return i("h1",n({className:h.heading1,style:null==E?void 0:E.heading1},{children:r.children}))},h2:function(o){o.node;var r=e(o,["node"]);return i("h2",n({className:h.heading2,style:null==E?void 0:E.heading2},{children:r.children}))},h3:function(o){o.node;var r=e(o,["node"]);return i("h3",n({className:h.heading3,style:null==E?void 0:E.heading3},{children:r.children}))},b:function(o){o.node;var r=e(o,["node"]);return i("b",n({className:h.bold,style:null==E?void 0:E.bold},{children:null==r?void 0:r.children}))},p:function(o){o.node;var r=e(o,["node"]);return i("p",n({},r,{className:h.paragraph,style:null==E?void 0:E.paragraph},{children:r.children}))},updated:function(o){var r=o.node,t=e(o,["node"]);return i(g,n({showUserStoryDiff:T,currentUpdatedTagId:ne,setCurrentUpdatedTagId:ie,userStory:H,setUserStory:z,setAiReasoning:Q,node:r,
|
|
1
|
+
import{__rest as e,__assign as n}from"tslib";import{jsx as i,jsxs as o}from"react/jsx-runtime";import{createContext as r,useRef as t,useState as l,useCallback as a,useMemo as d,useEffect as c,useContext as s}from"react";import u from"react-markdown";import v from"rehype-raw";import h from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as m}from"../../shared/useMarkdownSearch.js";import{Info as p}from"lucide-react";import{Tooltip as f}from"@mui/material";import g from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import C from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as S}from"../RequirementAIWrapper/RequirementAIWrapper.js";import w from"../ai-reasoning/AiReasoningCitation.js";import I from"../../icons/RelevanceScoreIcon.js";var R=r(!1),b=r({expandedInfo:null,setExpanded:function(){},reasonToRow:{current:new Map}}),N=r({rowId:""}),x=function(e){var r,l,a=e.children,d=e.node,c=t(Math.random().toString(36).slice(2)).current,u=s(b).expandedInfo,v=(null==u?void 0:u.rowId)===c,m=Array.isArray(null==d?void 0:d.children)?d.children.filter(function(e){return"element"===e.type}).length:1,p=null!==(l=null===(r=null==d?void 0:d.properties)||void 0===r?void 0:r.style)&&void 0!==l?l:void 0;return o(N.Provider,n({value:{rowId:c}},{children:[i("tr",n({style:p?{cssText:p}:void 0},{children:a})),v&&(null==u?void 0:u.aiReason)&&i("tr",n({style:{width:"100%"}},{children:i("td",n({colSpan:m||1,className:h.tableExpandedCell},{children:i("div",n({className:h.tableExpandedCellInner},{children:i("div",{className:h.tableExpandedCellContent})}))}))}))]}))},A=function(r){var N=r.message,A=r.scenario,L=r.showUserStoryDiff,T=void 0!==L&&L,j=r.aiReasoningsForBlock,U=r.isCitationLoadingDisplay,M=void 0!==U&&U,P=r.className;r.highConfidenceIcon,r.lowConfidenceIcon;var E=r.customStyles,k=r.customIcons,F=r.aiReasoningDiffView,$=r.userStoryCitations,q=r.artifactId,D=t(null),W=S(),H=W.userStory,_=W.getAvgScoreForStory,z=W.setUserStory,G=W.aiReasoning,Q=W.setAiReasoning,B=W.customIcons,O=W.searchQueryList,V=W.searchQueryReasoningIdList,J=null!=k?k:null==B?void 0:B.userStoryIcons,K=null==E?void 0:E.searchHighlight,X=m(D,K),Y=X.search,Z=X.clear,ee=l("1"),ne=ee[0],ie=ee[1],oe=l(null),re=oe[0],te=oe[1],le=t(new Map),ae=a(function(e,n){te(e&&n?{rowId:e,aiReason:n}:null)},[]),de=q?_(q):0,ce=l([]),se=ce[0],ue=ce[1],ve=function(e){var n=new RegExp("<(/?(".concat(["updated","deleted","changed"].join("|"),"))>"),"g"),i=e.replace(n,"\n\n<$1>\n\n");return i=(i=i.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,function(e,n){var i=n.replace(/ai_reasoning\$(\d+)/g,function(e,n){return"ai_reasoning$".concat(n,"-legacy")});return"<deleted>".concat(i,"</deleted>")})).replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,function(e,n,i){var o=btoa(encodeURIComponent(i.trim()));return"\n\n<generatedCode".concat(n,' data-raw="').concat(o,'"></generatedCode>\n\n')})};d(function(){return N?ve(N):N},[N]),c(function(){ue(j||G)},[j,G]);var he=d(function(){return{h1:function(o){o.node;var r=e(o,["node"]);return i("h1",n({className:h.heading1,style:null==E?void 0:E.heading1},{children:r.children}))},h2:function(o){o.node;var r=e(o,["node"]);return i("h2",n({className:h.heading2,style:null==E?void 0:E.heading2},{children:r.children}))},h3:function(o){o.node;var r=e(o,["node"]);return i("h3",n({className:h.heading3,style:null==E?void 0:E.heading3},{children:r.children}))},b:function(o){o.node;var r=e(o,["node"]);return i("b",n({className:h.bold,style:null==E?void 0:E.bold},{children:null==r?void 0:r.children}))},p:function(o){o.node;var r=e(o,["node"]);return i("p",n({},r,{className:h.paragraph,style:null==E?void 0:E.paragraph},{children:r.children}))},updated:function(o){var r=o.node,t=e(o,["node"]);return i(g,n({},t,{showUserStoryDiff:T,currentUpdatedTagId:ne,setCurrentUpdatedTagId:ie,userStory:H,setUserStory:z,setAiReasoning:Q,node:r,customStyles:null==E?void 0:E.updatedContent}))},ol:function(o){o.node;var r=e(o,["node"]);return i("ol",n({className:h.orderedList,style:null==E?void 0:E.olist},{children:null==r?void 0:r.children}))},ul:function(o){o.node;var r=e(o,["node"]);return i("ul",n({className:h.unorderedList,style:null==E?void 0:E.ulist},{children:null==r?void 0:r.children}))},table:function(e){var o=e.children;return i("div",n({className:h.tableWrapper},{children:i("table",n({className:h.table,style:null==E?void 0:E.table},{children:o}))}))},tr:x,td:function(o){var r,t=o.node,l=o.children,a=null!==(r=null==t?void 0:t.properties)&&void 0!==r?r:{},d=a.style,c=e(a,["style"]);return i(R.Provider,n({value:!0},{children:i("td",n({},c,{style:d?{cssText:d}:void 0},{children:l}))}))},th:function(o){var r,t=o.node,l=o.children,a=null!==(r=null==t?void 0:t.properties)&&void 0!==r?r:{},d=a.style,c=e(a,["style"]);return i(R.Provider,n({value:!0},{children:i("th",n({},c,{style:d?{cssText:d}:void 0},{children:l}))}))},a:function(n){var o,r,t;n.inline,n.children,n.node;var l=e(n,["inline","children","node"]),a=s(R)||"true"==(null==l?void 0:l.table),d="".concat(null==l?void 0:l.href),c=null===(o=d.split("$"))||void 0===o?void 0:o[0],u=null===(r=d.split("$"))||void 0===r?void 0:r[1];if("ai_reasoning"===c){var v=(null!==(t=T?F:G)&&void 0!==t?t:[]).find(function(e){return e.id.toString()===decodeURIComponent(u)});if(v&&v.reason.length>0&&v.gap.length>0)return i(w,{title:"Source",aiReason:v,isSourceHasHighlight:!1,isTable:a,customIcons:J,customStyles:{aiReasoningContent:null==E?void 0:E.aiReasoningContent,aiReasoningAccordion:null==E?void 0:E.aiReasoningAccordion,aiReasoningMarkdown:null==E?void 0:E.aiReasoningMarkdown,aiReasoningPill:null==E?void 0:E.aiReasoningPill,webCitation:null==E?void 0:E.webCitation,stormeeCitation:null==E?void 0:E.stormeeCitation,waveformCitation:null==E?void 0:E.waveformCitation,imageCitation:null==E?void 0:E.imageCitation,fileCitation:null==E?void 0:E.fileCitation,appModCitation:null==E?void 0:E.appModCitation,rcaCitation:null==E?void 0:E.rcaCitation,readFileCitation:null==E?void 0:E.readFileCitation}})}return null},code:function(o){o.inline;var r=o.children,t=o.className;return o.node,e(o,["inline","children","className","node"]),/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?i("div",{children:i("code",n({className:h.blockCode,style:null==E?void 0:E.code},{children:r}))}):i("code",n({className:h.inlineCode,style:null==E?void 0:E.code},{children:r}))},learned:function(e){var o=e.children;return i(f,n({title:o,placement:"top"},{children:i(p,{size:16,className:h.learned})}))},generatedcode:function(n){n.node;var o=e(n,["node"]),r=(null==o?void 0:o.language)||"python",t=function(e){var n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{var i=function(e){var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n}(o);return i(y,{title:"Generated Code",code:t,language:r,customStyles:{pill:null==E?void 0:E.generatedCodePill,content:null==E?void 0:E.generatedCodeContent}})}}},[se,G,$,ne,T,N,k]);return c(function(){if(D.current){if(null==O?void 0:O.length){var e;if(0===(null==V?void 0:V.length))requestAnimationFrame(function(){Y(O.map(function(e){return e.replace(/\*/g,"")}))});else{var n=D.current,i=new MutationObserver(function(){clearTimeout(e),e=setTimeout(function(){i.disconnect(),requestAnimationFrame(function(){Y(O.map(function(e){return e.replace(/\*/g,"")}))})},50)});i.observe(n,{childList:!0,subtree:!0})}return function(){clearTimeout(e)}}Z()}},[O,V]),i(b.Provider,n({value:{expandedInfo:re,setExpanded:ae,reasonToRow:le}},{children:o("div",n({ref:D,className:"".concat(h.container," ").concat("approving"!==A?h.wrapper:""," ").concat(P||""),style:null==E?void 0:E.container},{children:[i(u,n({components:he,rehypePlugins:[v]},{children:ve(N)})),de>0&&i("div",n({className:h.confidenceScoreContainer,style:null==E?void 0:E.confidenceScoreContainer},{children:o("span",n({className:h.confidenceScore,style:null==E?void 0:E.confidenceScore},{children:[i(I,{size:14,color:(null==E?void 0:E.confidenceScoreIconColor)||"#166534"}),de,"%"]}))})),M&&i("div",n({className:h.citationLoader,style:null==E?void 0:E.citationLoaderContainer},{children:i(C,{customStyles:{container:null==E?void 0:E.citationLoadingContainer,icon:null==E?void 0:E.citationLoadingIcon,text:null==E?void 0:E.citationLoadingText}})}))]}))}))};export{A as default};
|
|
2
2
|
//# sourceMappingURL=UserStoryWithCitation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadFileCitationContent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ReadFileCitationContent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA8F7F,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;AAoND,QAAA,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAwRnE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|