@e-llm-studio/requirement-ai 0.0.227 → 0.0.228

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),l=require("lucide-react"),s=require("showdown"),i=require("@mui/material"),o=require("../../icons/Illustration.svg.js"),a=require("uuid"),r=require("./UserStoryCard.module.css.js"),d=require("../../utils/helpers.js"),u=require("../../utils/user-story.utils.js"),c=require("../../shared/AtomicButton.js"),v=require("../RichTextEditor/RichTextEditor.js"),g=require("../userstory-with-citation/UserStoryWithCitation.js"),j=require("../RequirementAIWrapper/RequirementAIWrapper.js"),p=require("../story-screen/BigEnoughPanel.js"),f=require("./TitleEditor/TitleEditor.js"),y=require("./ClinicalTrialSection.js"),h=require("../story-screen/CompletionPanel.js"),m=require("../../icons/CDIcon.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=b(s);const x={[j.SectionStatus.WAITING]:"WAITING TO GENERATE",[j.SectionStatus.IN_PROGRESS]:"IN PROGRESS",[j.SectionStatus.GENERATED]:"GENERATED",[j.SectionStatus.FAILED]:"FAILED",[j.SectionStatus.GENERATE]:"GENERATE",[j.SectionStatus.APPROVED]:"APPROVED"};function C(e){const n=[],s=/<learned>(.*?)<\/learned>/g;let o,r=0,d=0;for(;null!==(o=s.exec(e));){const[,u]=o,c=o.index;c>r&&n.push(t.jsx("span",{children:e.slice(r,c)},"text-pre-"+d++)),n.push(t.jsx(i.Tooltip,Object.assign({title:u,placement:"top"},{children:t.jsx(l.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),`tooltip-${a.v4()}`)),r=s.lastIndex}return r<(null==e?void 0:e.length)&&n.push(t.jsx("span",{children:e.slice(r)},"text-post-"+d++)),n}function O(e,t,n){var l;if(!e)return{};if(t)return Object.assign({},e.parentConfig);const s=Object.assign({},e.childConfig);return n&&(null===(l=e.subFeatureOverrides)||void 0===l?void 0:l[n])?Object.assign(Object.assign({},s),e.subFeatureOverrides[n]):s}const I=({displayName:e})=>{var n;const{customStyles:s}=j.useRequirementAI(),i=null===(n=null==s?void 0:s.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return t.jsxs("div",Object.assign({className:r.default.displayName,style:null==i?void 0:i.wrapper},{children:[t.jsx(l.Bookmark,{className:r.default.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),t.jsxs("span",Object.assign({style:null==i?void 0:i.label},{children:[e,":"]}))]}))},w=({isUserStoryCurrentlyUpdated:s,artifactId:b,artifactTitleId:N,parentUserStory:E,currentUserStory:D,onUserStoryChange:B,parentIndex:T,currentIndex:P,enableDownload:k,isDiffEditReviewMode:A,showUserStoryDiff:U,handleDownloadUserStory:_,handleOpenSendDialog:M,updateUserStoryArtifact:R,selectedArtifactId:q,isDisplayHighlightControl:L,elementDisplayConfig:F,_resolvedConfig:z,showWrapper:V=!1,defaultExpanded:W,actionItemsConfig:G,onDelete:H,contextVariant:$,expandedSubFeatures:Q,showDisplayName:X=!0,allowTitleEdit:Z=!0,showConfidenceScore:J=!0,showBorderTop:K=!0,sectionStatusConfig:Y,showCompletionPanel:ee=!1,completionPanelConfig:te,showAddSectionButton:ne=!1,disableEditPlan:le=!1,useMuiTooltip:se=!1,approveButtonConfig:ie,editButtonConfig:oe,CDNeededInChip:ae})=>{var re,de,ue,ce,ve,ge,je,pe,fe,ye,he,me,be,Se,xe,Ce,Oe,Ie,we,Ne,Ee,De,Be,Te;const{isLoadingSectionData:Pe=!1,onLoadSectionData:ke,status:Ae,onStatusClick:Ue,completedCount:_e,totalCount:Me,isNoDataAvailable:Re=!1}=null!=Y?Y:{},{searchQueryList:qe,citations:Le,customStyles:Fe,customSectionConfig:ze}=j.useRequirementAI(),Ve=null==Fe?void 0:Fe.userStoryCardStyles,We=null==Ve?void 0:Ve.customSectionEditButton,Ge=null==Ve?void 0:Ve.statusStyles,He=null===(re=null==Fe?void 0:Fe.userStoryCardStyles)||void 0===re?void 0:re.userStoryEditStyles,$e=null===(de=null==Fe?void 0:Fe.userStoryScreenStyles)||void 0===de?void 0:de.userStoryContentStyles,Qe=null==Ve?void 0:Ve.progressHeaderStyles,Xe=null==Ve?void 0:Ve.clinicalTrialSectionStyles,Ze=null==Ve?void 0:Ve.CompletionStyles,Je=null==Ve?void 0:Ve.noDataStyles,Ke=null==Ve?void 0:Ve.approveButtonStyles,Ye=null!==(ce=null===(ue=null==ze?void 0:ze.shouldRender)||void 0===ue?void 0:ue.call(ze,D))&&void 0!==ce&&ce,et=null===(ve=null==ze?void 0:ze.getValue)||void 0===ve?void 0:ve.call(ze,D),tt=null!==(je=null===(ge=null==ze?void 0:ze.getFields)||void 0===ge?void 0:ge.call(ze,D))&&void 0!==je?je:[],nt=null!==(pe=null==ze?void 0:ze.isEditDisabled)&&void 0!==pe&&pe,lt=null!==(ye=null===(fe=null==ze?void 0:ze.isSaving)||void 0===fe?void 0:fe.call(ze,D))&&void 0!==ye&&ye,st=(it=null!==(he=D.completion_percentage)&&void 0!==he?he:0,ot=Ze,it>=80?null==ot?void 0:ot.highCompletion:it>=50?null==ot?void 0:ot.mediumCompletion:null==ot?void 0:ot.lowCompletion);var it,ot;const at={[j.SectionStatus.WAITING]:null==Ge?void 0:Ge.waiting,[j.SectionStatus.IN_PROGRESS]:null==Ge?void 0:Ge.inProgress,[j.SectionStatus.GENERATED]:null==Ge?void 0:Ge.generated,[j.SectionStatus.FAILED]:null==Ge?void 0:Ge.failed,[j.SectionStatus.GENERATE]:null==Ge?void 0:Ge.generate,[j.SectionStatus.APPROVED]:null==Ge?void 0:Ge.approved},[rt,dt]=n.useState(Object.assign(Object.assign({},structuredClone(D)),{value:d.formatMarkdown(D.value)||""})),[ut,ct]=n.useState({userStory:!!D.isDefaultEdit}),[vt,gt]=n.useState(!1),[jt,pt]=n.useState(!1),[ft,yt]=n.useState(null),[ht,mt]=n.useState(null),{userStory:bt,customIcons:St}=j.useRequirementAI(),[xt,Ct]=n.useState(null!=W?W:""===T||q===D.artifactId||!!D.isDefaultOpen),[Ot,It]=n.useState(!1),[wt,Nt]=n.useState(null),[Et,Dt]=n.useState(null),[Bt,Tt]=n.useState(!1),Pt=n.useRef(null),kt=n.useRef(null),[At,Ut]=n.useState(!1),[_t,Mt]=n.useState(!1),Rt=n.useRef(null),[qt,Lt]=n.useState(!1);n.useEffect(()=>{s&&Ct(s)},[s]),n.useEffect(()=>{dt(Object.assign(Object.assign({},structuredClone(D)),{value:d.formatMarkdown(D.value)||""}))},[D]),n.useEffect(()=>{qe.length>0?Ct(!0):void 0===W&&q&&Ct(q===D.artifactId)},[qe,q,D.artifactId]),n.useEffect(()=>{Q&&Q.length>0&&Ct(Q.includes(D.artifactId)||""===T||q===D.artifactId||!!D.isDefaultOpen)},[Q]);const Ft=()=>{Nt(null)},zt=()=>{Dt(null)},Vt=()=>{xt&&ut.userStory&&kt.current&&!kt.current.requestClose()||Ct(e=>!e)},Wt=()=>e.__awaiter(void 0,void 0,void 0,function*(){var e,t;Tt(!0);try{"userStory"==="userStory"&&(B(rt),console.log("I am changing RTE editor values",rt)),yield null===(e=null==oe?void 0:oe.onSaveEditedSection)||void 0===e?void 0:e.call(oe,rt),yield R(Le,bt,b,null===(t=Rt.current)||void 0===t?void 0:t.signal),B(Object.assign(Object.assign({},rt),{isDefaultEdit:!1})),ct(e=>Object.assign(Object.assign({},e),{userStory:!1}))}finally{Tt(!1)}});const Gt=null!=(null==D?void 0:D.big_enough)&&!Number.isNaN(D.big_enough)&&!!(null==D?void 0:D.big_enough_decision_factors),Ht=null!==(me=null==D?void 0:D.completion_percentage)&&void 0!==me?me:0,$t=!!(null==D?void 0:D.completion_decision_factors),Qt=""===T,Xt=null!=z?z:O(F,Qt),Zt=!A&&!U;return n.useEffect(()=>{if(!ht)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${ht}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[ht]),n.useEffect(()=>{D.isDefaultEdit&&ct(e=>Object.assign(Object.assign({},e),{userStory:!0}))},[D.isDefaultEdit]),t.jsxs("div",Object.assign({className:r.default.card,style:null==Ve?void 0:Ve.cardStyle,id:`story-card-${D.title}`,"data-expanded":xt},{children:[t.jsxs("div",Object.assign({className:r.default.titleSection,style:null==Ve?void 0:Ve.titleSection},{children:[t.jsxs("div",Object.assign({className:r.default.titleRow,style:null==Ve?void 0:Ve.titleRow,onClick:Vt},{children:[t.jsxs("div",Object.assign({className:r.default.titleLeft,style:null==Ve?void 0:Ve.titleLeft,onMouseEnter:()=>Ut(!0),onMouseLeave:()=>Ut(!1)},{children:[X&&t.jsx(I,{displayName:N}),vt&&Zt?t.jsx(f.InlineTitleEditor,{title:D.title,onSave:t=>((t,n)=>e.__awaiter(void 0,void 0,void 0,function*(){var e;try{let l=Object.assign({},D);D.artifactId===n?l.title=t:l.sub_features=(null===(e=D.sub_features)||void 0===e?void 0:e.map(e=>e.artifactId===n?Object.assign(Object.assign({},e),{title:t}):e))||[],dt(l),B(l),gt(!1)}catch(e){console.error("Failed to save title",e)}}))(t,D.artifactId),onCancel:()=>{gt(!1)},inputStyle:null==He?void 0:He.inlineTitleInput,confirmButtonStyle:null==He?void 0:He.inlineTitleConfirm,cancelButtonStyle:null==He?void 0:He.inlineTitleCancel},"inline-title-editor"):t.jsxs("div",Object.assign({className:r.default.storyTitleWrapper},{children:[t.jsx(i.Tooltip,Object.assign({title:C(D.title),arrow:!0},{children:t.jsx("h2",Object.assign({title:se?void 0:D.title,className:r.default.storyTitle,style:null==Ve?void 0:Ve.storyTitle},{children:C(D.title)}),D.artifactId)})),ee&&!Ye&&($t?t.jsx(h.CompletionPanel,Object.assign({customIcons:null==St?void 0:St.userStoryIcons,customStyles:null==Ve?void 0:Ve.aiReasoningCitaionStyles,currentUserStory:D,panelStyles:null==Ve?void 0:Ve.CompletionStyles,onToggleStateChange:Mt,completionPanelConfig:te},{children:t.jsxs("div",Object.assign({style:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",gap:"4px"},null==Ze?void 0:Ze.badge),st)},{children:[t.jsxs("span",{children:[Ht,"% Completed"]}),t.jsx("span",Object.assign({style:{display:"flex",alignItems:"center"}},{children:t.jsx(m.default,{color:"currentColor"})})),_t?t.jsx(l.ChevronUp,{size:14,style:null==Ze?void 0:Ze.chevronStyle}):t.jsx(l.ChevronDown,{size:14,style:null==Ze?void 0:Ze.chevronStyle})]}))})):t.jsx("div",Object.assign({style:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",gap:"4px"},null==Ze?void 0:Ze.badge),st)},{children:t.jsxs("span",{children:[Ht,"% Completed"]})}))),Z&&t.jsx("button",Object.assign({type:"button",className:r.default.titleEditButton,style:null==He?void 0:He.titleEditButton,onClick:e=>{e.stopPropagation(),gt(!0),xt||Ct(!0)},"aria-label":"Edit title",title:"Edit title"},{children:t.jsx("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:t.jsx("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})}))}))]}))]})),(Ae||void 0!==_e&&void 0!==Me)&&t.jsxs("div",Object.assign({className:r.default.statusContainer},{children:[void 0!==_e&&void 0!==Me&&t.jsxs("div",Object.assign({className:r.default.completedBadge},{children:["Completed: ",_e,"/",Me]})),Ae&&t.jsx("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),null==Ue||Ue()},onMouseEnter:()=>Lt(!0),onMouseLeave:()=>Lt(!1),className:r.default.statusButton,style:Object.assign(Object.assign({},null===(be=at[Ae])||void 0===be?void 0:be.default),qt&&(null===(Se=at[Ae])||void 0===Se?void 0:Se.hover))},{children:x[Ae]}))]})),t.jsxs("div",Object.assign({className:r.default.titleActions,style:null==Ve?void 0:Ve.titleActions,onClick:e=>e.stopPropagation()},{children:[(Xt.showProgressPercentage||Xt.showGapBox)&&V&&t.jsxs("div",Object.assign({className:r.default.progressHeader,style:null==Qe?void 0:Qe.wrapper},{children:[Xt.showProgressPercentage&&t.jsxs("div",Object.assign({className:r.default.progressPercentage,style:null==Qe?void 0:Qe.percentage},{children:[null!==(Ce=null!==(xe=null==D?void 0:D.confidenceScore)&&void 0!==xe?xe:null==Xt?void 0:Xt.confidenceValue)&&void 0!==Ce?Ce:"0","%"]})),Xt.showGapBox&&t.jsxs("div",Object.assign({className:r.default.gapBox,style:null==Qe?void 0:Qe.gapBox},{children:[null!==(Ie=null!==(Oe=null==D?void 0:D.gapValue)&&void 0!==Oe?Oe:null==Xt?void 0:Xt.gapBoxValue)&&void 0!==Ie?Ie:"2"," ","Gaps"]}))]})),Gt&&t.jsx(p.BigEnoughPanel,{customIcons:null==St?void 0:St.userStoryIcons,customStyles:null==Ve?void 0:Ve.aiReasoningCitaionStyles,currentUserStory:D,panelStyles:null==Ve?void 0:Ve.BigEnoughStyles}),!ut.userStory&&t.jsxs(t.Fragment,{children:[!1!==(null==Xt?void 0:Xt.showShareButton)&&t.jsx("button",Object.assign({className:r.default.iconButton,style:null==Ve?void 0:Ve.iconButton,onClick:e=>{Nt(e.currentTarget)}},{children:t.jsx(l.ExternalLink,{size:16})})),t.jsxs(i.Menu,Object.assign({id:"user-story-share-menu",anchorEl:wt,open:!!wt,onClose:()=>Nt(null),style:null==Ve?void 0:Ve.userStoryShareMenu},{children:[k&&t.jsx(i.MenuItem,Object.assign({style:null==Ve?void 0:Ve.userStoryMenuItem,onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){It(!0),_&&(yield Promise.all([_("pdf"),_("doc")]),It(!1))})},{children:t.jsxs("div",Object.assign({ref:Pt,className:r.default.menuItemContent,style:null==Ve?void 0:Ve.menuItemContent},{children:[t.jsx(l.Download,{size:16,color:null==Ve?void 0:Ve.menuIconColor}),t.jsx("p",Object.assign({style:null==Ve?void 0:Ve.menuLabel},{children:"Download"}))]}))})),t.jsx(i.MenuItem,Object.assign({style:null==Ve?void 0:Ve.userStoryMenuItem,onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){let e=D;E&&(e=Object.assign(Object.assign({},D),{value:`${u.replaceTitleSection(null==E?void 0:E.value,D.title)} \n${D.value}`})),null==M||M(!0,[e],D.artifactId),Ft()})},{children:t.jsxs("div",Object.assign({style:null==Ve?void 0:Ve.menuItemContent,className:r.default.menuItemContentPadded},{children:[t.jsx(l.Share2,{size:16,color:null==Ve?void 0:Ve.menuIconColor}),t.jsx("p",Object.assign({style:null==Ve?void 0:Ve.menuLabel},{children:"Send"}))]}))})),t.jsx(i.MenuItem,Object.assign({style:null==Ve?void 0:Ve.userStoryMenuItem,onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){const e=(new S.default.Converter).makeHtml(d.formatMarkdown(D.value)||D.value),t=function(e){const t=(new S.default.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(d.formatMarkdown(D.value)||D.value),n=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{yield navigator.clipboard.write([n]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{Ft()}})},{children:t.jsxs("div",Object.assign({style:null==Ve?void 0:Ve.menuItemContent,className:r.default.menuItemContentPadded},{children:[t.jsx(l.Copy,{size:16,color:null==Ve?void 0:Ve.menuIconColor}),t.jsx("p",Object.assign({style:null==Ve?void 0:Ve.menuLabel},{children:"Copy"}))]}))}))]}))]}),ut.userStory&&xt?t.jsx(c.default,{type:"outline",children:"Cancel",style:null==Ve?void 0:Ve.cancelButton,onClick:()=>{var e;null===(e=Rt.current)||void 0===e||e.abort(),ct(e=>Object.assign(Object.assign({},e),{userStory:!1}))}}):t.jsx(t.Fragment,{}),ut.userStory&&xt?t.jsx(c.default,{type:"fill",children:Bt?t.jsxs("span",Object.assign({className:r.default.savingSpinner,style:null==Ve?void 0:Ve.savingSpinner},{children:[t.jsx(l.LoaderCircle,{className:r.default.spinAnimation,style:null==Ve?void 0:Ve.spinAnimation}),t.jsx("span",{children:"Saving..."})]})):"Save",isDisable:Bt,style:Bt?null==Ve?void 0:Ve.savingButton:null==Ve?void 0:Ve.saveButton,onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){yield Wt()})}):!A&&!U&&!le&&xt&&!1!==(null==Xt?void 0:Xt.showEditButton)&&t.jsx("button",Object.assign({className:r.default.iconButton,style:null==Ve?void 0:Ve.editButton,onClick:()=>ct(e=>Object.assign(Object.assign({},e),{userStory:!0}))},{children:t.jsx(l.PencilIcon,{color:null==Ve?void 0:Ve.pencilIconColor,size:16})})),ne&&Qt&&xt&&!A&&!U&&!1!==(null==Xt?void 0:Xt.showEditButton)&&t.jsxs("button",Object.assign({type:"button",className:r.default.addSectionButton,style:null==He?void 0:He.addSectionButton,onClick:e=>{var t,n,l;e.stopPropagation();const s=(null!==(n=null===(t=D.sub_features)||void 0===t?void 0:t.length)&&void 0!==n?n:0)+1,i={artifactId:a.v4(),title:`New Section ${s}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},o=Object.assign(Object.assign({},D),{sub_features:[...null!==(l=D.sub_features)&&void 0!==l?l:[],i]});dt(o),B(o),Ct(!0),mt(i.title)},"aria-label":"Add section",title:"Add section"},{children:[t.jsx(l.Plus,{size:14}),t.jsx("span",Object.assign({className:r.default.addSectionLabel},{children:"Add Section"}))]})),!Qt&&!A&&!le&&!U&&t.jsx("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),null==H||H()},className:r.default.iconButton,style:null==He?void 0:He.deleteButton,"aria-label":"Delete section",title:"Delete section"},{children:t.jsx(l.Trash2,{size:16})})),Ye&&t.jsx("button",Object.assign({type:"button",className:r.default.iconButton,style:null==We?void 0:We.button,disabled:nt,onClick:e=>{if(e.stopPropagation(),jt)return yt(null),void pt(!1);yt(structuredClone(null!=et?et:{})),Ct(!0),pt(!0)}},{children:jt?t.jsx(l.X,{size:16,color:null==Ve?void 0:Ve.pencilIconColor,style:null==We?void 0:We.cancelIcon}):t.jsx(l.PencilIcon,{size:16,color:null==Ve?void 0:Ve.pencilIconColor,style:null==We?void 0:We.editIcon})})),(null==Xt?void 0:Xt.actionItemsButton)&&t.jsxs(t.Fragment,{children:[t.jsx("span",Object.assign({className:r.default.actionItemBtn,style:null==Ve?void 0:Ve.actionItemBtn,onClick:e=>{e.stopPropagation(),Dt(e.currentTarget)}},{children:t.jsx(l.Ellipsis,{})})),t.jsx(i.Menu,Object.assign({id:"user-story-action-menu",anchorEl:Et,open:!!Et,onClose:zt,style:null==Ve?void 0:Ve.userStoryShareMenu},{children:null==G?void 0:G.items.map((e,n)=>t.jsx(i.MenuItem,Object.assign({style:null==Ve?void 0:Ve.userStoryMenuItem,onClick:()=>{e.onclick(D),zt()}},{children:t.jsxs("div",Object.assign({className:r.default.menuItemContent,style:Object.assign(Object.assign({},null==Ve?void 0:Ve.menuItemContent),!e.isActive&&{cursor:"not-allowed",opacity:.5})},{children:[t.jsx("span",Object.assign({className:r.default.menuItemIcon,style:null==Ve?void 0:Ve.menuItemIcon},{children:e.icon})),t.jsx("p",Object.assign({style:null==Ve?void 0:Ve.menuLabel},{children:e.name})),t.jsx("span",{className:r.default.menuItemRight,style:null==Ve?void 0:Ve.menuItemRight})]}))}),`action-item-${n}-${e.name}`))}))]}),t.jsx("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),Vt()},style:null==Ve?void 0:Ve.chevronButton,className:r.default.chevronButton},{children:xt?t.jsx(l.ChevronUp,{className:r.default.chevronIcon,color:null==Ve?void 0:Ve.chevronIconColor}):t.jsx(l.ChevronDown,{className:r.default.chevronIcon,color:null==Ve?void 0:Ve.chevronIconColor})}))]}))]})),t.jsx("div",{className:r.default.divider,style:null==Ve?void 0:Ve.dividerStyle})]})),xt&&t.jsx("div",Object.assign({className:r.default.cardContent,style:Object.assign(Object.assign({},null==Ve?void 0:Ve.cardContentStyle),{borderTop:K?"1px solid #E5E5E5":"none"})},{children:Pe?t.jsxs("div",Object.assign({className:r.default.loadingContainer},{children:[t.jsx("div",Object.assign({className:r.default.loadingIconWrapper},{children:t.jsx(l.Hourglass,{size:28,color:"#5B3DF5",className:r.default.spinAnimation})})),t.jsxs("div",{children:[t.jsx("h3",Object.assign({className:r.default.loadingTitle},{children:"Section generation in progress.."})),t.jsx("p",Object.assign({className:r.default.loadingSubtitle},{children:"This may take a few minutes"}))]}),t.jsx("button",Object.assign({type:"button",onClick:()=>null==ke?void 0:ke(),className:r.default.viewStatusButton},{children:"View Status"}))]})):Re?t.jsxs("div",Object.assign({className:r.default.noDataContainer,style:null==Je?void 0:Je.container},{children:[t.jsx("img",{src:o.default,alt:"No data available",className:r.default.noDataIllustration,style:null==Je?void 0:Je.illustration}),t.jsx("h3",Object.assign({className:r.default.noDataTitle,style:null==Je?void 0:Je.title},{children:"No Data Available for This Section"})),t.jsx("p",Object.assign({className:r.default.noDataSubtitle,style:null==Je?void 0:Je.subtitle},{children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."}))]})):t.jsxs("div",Object.assign({className:r.default.contentInner,style:null==Ve?void 0:Ve.contentInner},{children:[t.jsxs("div",Object.assign({className:r.default.descriptionSection,style:null==Ve?void 0:Ve.descriptionSection},{children:[t.jsx("div",{className:r.default.justifyBetween,style:null==Ve?void 0:Ve.justifyBetween}),ut.userStory?t.jsx(v.default,{ref:kt,minHeight:"100%",height:"100%",type:"string",value:d.formatMarkdown(D.value)||"",handleUpdateState:(e,t)=>{const n=d.indentMarkdown(t);dt(e=>Object.assign(Object.assign({},e),{value:n||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:ut.userStory?"edit":"readOnly",onSaveUnsavedChanges:()=>e.__awaiter(void 0,void 0,void 0,function*(){yield Wt(),Ct(!1)}),onDiscardUnsavedChanges:()=>{dt(Object.assign(Object.assign({},structuredClone(D)),{value:d.formatMarkdown(D.value)||""})),ct(e=>Object.assign(Object.assign({},e),{userStory:!1})),Ct(!1)},isSavingUnsavedChanges:Bt}):Ye?t.jsx(y.default,{styles:Xe,fields:tt,readonly:!jt,isSaving:lt,value:null!==(we=null!=ft?ft:et)&&void 0!==we?we:{},onChange:yt,onSave:()=>e.__awaiter(void 0,void 0,void 0,function*(){var e;ft&&(yield null===(e=null==ze?void 0:ze.onSave)||void 0===e?void 0:e.call(ze,D,ft),yt(null),pt(!1))}),onCancel:()=>{yt(null),pt(!1)}}):t.jsxs(t.Fragment,{children:[t.jsx(g.default,{showUserStoryDiff:U,isParent:""===T,message:d.formatMarkdown(D.value)||"",artifactId:D.artifactId,customStyles:$e,isDisplayHighlightControl:L,contextVariant:$,showConfidenceScore:J,CDNeededInChip:ae}),(ie||oe)&&t.jsxs("div",Object.assign({className:r.default.actionButtonsContainer,style:null==Ke?void 0:Ke.container},{children:[oe&&!ut.userStory&&t.jsxs(t.Fragment,{children:[t.jsx("button",Object.assign({type:"button",className:r.default.actionButton,style:null==Ke?void 0:Ke.button,disabled:oe.disabled||oe.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=oe.onClick)||void 0===t||t.call(oe),ct(e=>Object.assign(Object.assign({},e),{userStory:!0})),Ct(!0)}},{children:oe.isLoading?t.jsxs(t.Fragment,{children:[t.jsx(l.LoaderCircle,{size:16,className:r.default.actionButtonSpinner,style:null==Ke?void 0:Ke.icon}),t.jsx("span",Object.assign({style:null==Ke?void 0:Ke.text},{children:null!==(Ne=oe.label)&&void 0!==Ne?Ne:"Edit"}))]}):t.jsxs(t.Fragment,{children:[t.jsx(l.PencilIcon,{size:16,style:null==Ke?void 0:Ke.icon}),t.jsx("span",Object.assign({style:null==Ke?void 0:Ke.text},{children:null!==(Ee=oe.label)&&void 0!==Ee?Ee:"Edit"}))]})})),ie&&t.jsx("span",{className:r.default.actionButtonDivider})]}),ie&&t.jsx("button",Object.assign({type:"button",className:r.default.actionButton,style:null==Ke?void 0:Ke.button,disabled:ie.disabled||ie.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=ie.onClick)||void 0===t||t.call(ie)}},{children:ie.isLoading?t.jsxs(t.Fragment,{children:[t.jsx(l.LoaderCircle,{size:16,className:r.default.actionButtonSpinner,style:null==Ke?void 0:Ke.icon}),t.jsx("span",Object.assign({style:null==Ke?void 0:Ke.text},{children:null!==(De=ie.label)&&void 0!==De?De:"Approve"}))]}):t.jsxs(t.Fragment,{children:[t.jsx(l.Check,{size:16,style:null==Ke?void 0:Ke.icon}),t.jsx("span",Object.assign({style:null==Ke?void 0:Ke.text},{children:null!==(Be=ie.label)&&void 0!==Be?Be:"Approve"}))]})}))]}))]})]})),null===(Te=rt.sub_features)||void 0===Te?void 0:Te.map((e,n)=>{const l=O(F,!1,e.artifactId);return t.jsx(w,{artifactId:b,isUserStoryCurrentlyUpdated:s,artifactTitleId:`${N}-${String.fromCharCode(65+n)}`,parentUserStory:D,parentIndex:`${T}${T&&"."}${P}`,currentIndex:`${n+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const n=[...D.sub_features||[]];n[e]=t,B(Object.assign(Object.assign({},D),{sub_features:n}))})(n,e),enableDownload:!0,isDiffEditReviewMode:A,showUserStoryDiff:U,updateUserStoryArtifact:R,handleDownloadUserStory:_,handleOpenSendDialog:M,isDisplayHighlightControl:L,elementDisplayConfig:F,_resolvedConfig:l,actionItemsConfig:G,onDelete:()=>(e=>{const t=(D.sub_features||[]).filter((t,n)=>n!==e),n=Object.assign(Object.assign({},D),{sub_features:t});dt(n),B(n)})(n),expandedSubFeatures:Q,disableEditPlan:le,useMuiTooltip:se},e.artifactId)})]}))}))]}))};exports.StoryCard=w,exports.UserStoryCardWrapper=({artifactTitleIDs:e,expandedSubFeatures:n,isDiffEditReviewMode:s,showUserStoryDiff:i,updateUserStoryArtifact:o,isUserStoryCurrentlyUpdated:a,artifactId:d,handleOpenSendDialog:u,handleDownloadUserStory:c,selectedArtifactId:v,isDisplayHighlightControl:g,elementDisplayConfig:p,showWrapper:f,actionItemsConfig:y,contextVariant:h,showDisplayName:m,allowTitleEdit:b,showConfidenceScore:S,showBorderTop:x,defaultExpanded:C,showCompletionPanel:I=!1,completionPanelConfig:N,showAddSectionButton:E=!1,disableEditPlan:D=!1,useMuiTooltip:B=!1,approveButtonConfig:T,editButtonConfig:P,CDNeededInChip:k})=>{const{userStory:A,setUserStory:U,customStyles:_,searchQueryList:M,currentHighlightIndex:R,setCurrentHighlightIndex:q,segmentComponentConfig:L,sectionStatusConfig:F}=j.useRequirementAI(),z=null==_?void 0:_.userStoryCardStyles,V=0===R,W=R===M.length-1;return t.jsxs("div",Object.assign({className:r.default.userStoryCardWrapper,style:g?Object.assign(Object.assign({},null==z?void 0:z.userStoryCardWrapper),{position:"relative"}):null==z?void 0:z.userStoryCardWrapper},{children:[g&&t.jsx(t.Fragment,{children:M.length>0&&t.jsx("div",Object.assign({className:r.default.wrapper},{children:t.jsx("div",Object.assign({className:r.default.highlightNavigation},{children:t.jsxs("div",Object.assign({className:r.default.navigationContainer},{children:[t.jsxs("span",Object.assign({className:r.default.navCounter},{children:[R+1," of ",M.length]})),t.jsxs("div",Object.assign({className:r.default.navButtons},{children:[t.jsx("button",Object.assign({onClick:()=>{R>0&&q(e=>e-1)},className:r.default.navButton,disabled:V},{children:t.jsx(l.ChevronUpIcon,{size:20,className:r.default.navIcon})})),t.jsx("button",Object.assign({onClick:()=>{R<M.length-1&&q(e=>e+1)},className:r.default.navButton,disabled:W},{children:t.jsx(l.ChevronDownIcon,{size:20,className:r.default.navIcon})}))]}))]}))}))}))}),A.map((l,r)=>{const j=O(p,!0);return t.jsx(w,{isUserStoryCurrentlyUpdated:a,artifactId:d,artifactTitleId:e[r]||"",expandedSubFeatures:n,currentUserStory:l,onUserStoryChange:e=>{U(t=>(t[r]=e,[...t]))},parentIndex:"",currentIndex:`${r+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:s,showUserStoryDiff:i,updateUserStoryArtifact:o,handleOpenSendDialog:u,handleDownloadUserStory:c,selectedArtifactId:v,isDisplayHighlightControl:g,elementDisplayConfig:p,_resolvedConfig:j,showWrapper:f,defaultExpanded:C,actionItemsConfig:y,contextVariant:h,showDisplayName:m,allowTitleEdit:b,showConfidenceScore:S,showBorderTop:x,sectionStatusConfig:F,showCompletionPanel:I,completionPanelConfig:N,showAddSectionButton:E,disableEditPlan:D,useMuiTooltip:B,approveButtonConfig:T,CDNeededInChip:k,editButtonConfig:P},l.artifactId)})]}))},exports.default=w,exports.replaceLearnedTagsWithInfo=C;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),l=require("lucide-react"),s=require("showdown"),i=require("@mui/material"),o=require("../../icons/Illustration.svg.js"),a=require("uuid"),r=require("./UserStoryCard.module.css.js"),d=require("../../utils/helpers.js"),u=require("../../utils/user-story.utils.js"),c=require("../../shared/AtomicButton.js"),v=require("../RichTextEditor/RichTextEditor.js"),g=require("../userstory-with-citation/UserStoryWithCitation.js"),p=require("../RequirementAIWrapper/RequirementAIWrapper.js"),j=require("../story-screen/BigEnoughPanel.js"),y=require("./TitleEditor/TitleEditor.js"),f=require("./ClinicalTrialSection.js"),h=require("../story-screen/CompletionPanel.js"),m=require("../../icons/CDIcon.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=b(s);const x={[p.SectionStatus.WAITING]:"WAITING TO GENERATE",[p.SectionStatus.IN_PROGRESS]:"IN PROGRESS",[p.SectionStatus.GENERATED]:"GENERATED",[p.SectionStatus.FAILED]:"FAILED",[p.SectionStatus.GENERATE]:"GENERATE",[p.SectionStatus.APPROVED]:"APPROVED"};function C(e){const n=[],s=/<learned>(.*?)<\/learned>/g;let o,r=0,d=0;for(;null!==(o=s.exec(e));){const[,u]=o,c=o.index;c>r&&n.push(t.jsx("span",{children:e.slice(r,c)},"text-pre-"+d++)),n.push(t.jsx(i.Tooltip,Object.assign({title:u,placement:"top"},{children:t.jsx(l.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),`tooltip-${a.v4()}`)),r=s.lastIndex}return r<(null==e?void 0:e.length)&&n.push(t.jsx("span",{children:e.slice(r)},"text-post-"+d++)),n}function O(e,t,n){var l;if(!e)return{};if(t)return Object.assign({},e.parentConfig);const s=Object.assign({},e.childConfig);return n&&(null===(l=e.subFeatureOverrides)||void 0===l?void 0:l[n])?Object.assign(Object.assign({},s),e.subFeatureOverrides[n]):s}const I=({displayName:e})=>{var n;const{customStyles:s}=p.useRequirementAI(),i=null===(n=null==s?void 0:s.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return t.jsxs("div",Object.assign({className:r.default.displayName,style:null==i?void 0:i.wrapper},{children:[t.jsx(l.Bookmark,{className:r.default.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),t.jsxs("span",Object.assign({style:null==i?void 0:i.label},{children:[e,":"]}))]}))},w=({isUserStoryCurrentlyUpdated:s,artifactId:b,artifactTitleId:N,parentUserStory:E,currentUserStory:D,onUserStoryChange:B,parentIndex:T,currentIndex:k,enableDownload:P,isDiffEditReviewMode:A,showUserStoryDiff:U,handleDownloadUserStory:_,handleOpenSendDialog:M,updateUserStoryArtifact:R,selectedArtifactId:q,isDisplayHighlightControl:L,elementDisplayConfig:F,_resolvedConfig:z,showWrapper:W=!1,defaultExpanded:V,actionItemsConfig:G,onDelete:H,contextVariant:$,expandedSubFeatures:Q,showDisplayName:X=!0,allowTitleEdit:Z=!0,showConfidenceScore:J=!0,showBorderTop:K=!0,sectionStatusConfig:Y,showCompletionPanel:ee=!1,completionPanelConfig:te,showAddSectionButton:ne=!1,disableEditPlan:le=!1,useMuiTooltip:se=!1,approveButtonConfig:ie,editButtonConfig:oe,CDNeededInChip:ae,blockNumber:re})=>{var de,ue,ce,ve,ge,pe,je,ye,fe,he,me,be,Se,xe,Ce,Oe,Ie,we,Ne,Ee,De,Be,Te,ke;const{isLoadingSectionData:Pe=!1,onLoadSectionData:Ae,status:Ue,onStatusClick:_e,completedCount:Me,totalCount:Re,isNoDataAvailable:qe=!1}=null!=Y?Y:{},{searchQueryList:Le,citations:Fe,customStyles:ze,customSectionConfig:We}=p.useRequirementAI(),Ve=null==ze?void 0:ze.userStoryCardStyles,Ge=null==Ve?void 0:Ve.customSectionEditButton,He=null==Ve?void 0:Ve.statusStyles,$e=null===(de=null==ze?void 0:ze.userStoryCardStyles)||void 0===de?void 0:de.userStoryEditStyles,Qe=null===(ue=null==ze?void 0:ze.userStoryScreenStyles)||void 0===ue?void 0:ue.userStoryContentStyles,Xe=null==Ve?void 0:Ve.progressHeaderStyles,Ze=null==Ve?void 0:Ve.clinicalTrialSectionStyles,Je=null==Ve?void 0:Ve.CompletionStyles,Ke=null==Ve?void 0:Ve.noDataStyles,Ye=null==Ve?void 0:Ve.approveButtonStyles,et=null!==(ve=null===(ce=null==We?void 0:We.shouldRender)||void 0===ce?void 0:ce.call(We,D))&&void 0!==ve&&ve,tt=null===(ge=null==We?void 0:We.getValue)||void 0===ge?void 0:ge.call(We,D),nt=null!==(je=null===(pe=null==We?void 0:We.getFields)||void 0===pe?void 0:pe.call(We,D))&&void 0!==je?je:[],lt=null!==(ye=null==We?void 0:We.isEditDisabled)&&void 0!==ye&&ye,st=null!==(he=null===(fe=null==We?void 0:We.isSaving)||void 0===fe?void 0:fe.call(We,D))&&void 0!==he&&he,it=(ot=null!==(me=D.completion_percentage)&&void 0!==me?me:0,at=Je,ot>=80?null==at?void 0:at.highCompletion:ot>=50?null==at?void 0:at.mediumCompletion:null==at?void 0:at.lowCompletion);var ot,at;const rt={[p.SectionStatus.WAITING]:null==He?void 0:He.waiting,[p.SectionStatus.IN_PROGRESS]:null==He?void 0:He.inProgress,[p.SectionStatus.GENERATED]:null==He?void 0:He.generated,[p.SectionStatus.FAILED]:null==He?void 0:He.failed,[p.SectionStatus.GENERATE]:null==He?void 0:He.generate,[p.SectionStatus.APPROVED]:null==He?void 0:He.approved},[dt,ut]=n.useState(Object.assign(Object.assign({},structuredClone(D)),{value:d.formatMarkdown(D.value)||""})),[ct,vt]=n.useState({userStory:!!D.isDefaultEdit}),[gt,pt]=n.useState(!1),[jt,yt]=n.useState(!1),[ft,ht]=n.useState(null),[mt,bt]=n.useState(null),{userStory:St,customIcons:xt}=p.useRequirementAI(),[Ct,Ot]=n.useState(null!=V?V:""===T||q===D.artifactId||!!D.isDefaultOpen),[It,wt]=n.useState(!1),[Nt,Et]=n.useState(null),[Dt,Bt]=n.useState(null),[Tt,kt]=n.useState(!1),Pt=n.useRef(null),At=n.useRef(null),[Ut,_t]=n.useState(!1),[Mt,Rt]=n.useState(!1),qt=n.useRef(null),[Lt,Ft]=n.useState(!1);n.useEffect(()=>{s&&Ot(s)},[s]),n.useEffect(()=>{ut(Object.assign(Object.assign({},structuredClone(D)),{value:d.formatMarkdown(D.value)||""}))},[D]),n.useEffect(()=>{Le.length>0?Ot(!0):void 0===V&&q&&Ot(q===D.artifactId)},[Le,q,D.artifactId]),n.useEffect(()=>{Q&&Q.length>0&&Ot(Q.includes(D.artifactId)||""===T||q===D.artifactId||!!D.isDefaultOpen)},[Q]);const zt=()=>{Et(null)},Wt=()=>{Bt(null)},Vt=()=>{Ct&&ct.userStory&&At.current&&!At.current.requestClose()||Ot(e=>!e)},Gt=()=>e.__awaiter(void 0,void 0,void 0,function*(){var e,t;kt(!0);try{"userStory"==="userStory"&&(B(dt),console.log("I am changing RTE editor values",dt)),yield null===(e=null==oe?void 0:oe.onSaveEditedSection)||void 0===e?void 0:e.call(oe,dt),yield R(Fe,St,b,null===(t=qt.current)||void 0===t?void 0:t.signal),B(Object.assign(Object.assign({},dt),{isDefaultEdit:!1})),vt(e=>Object.assign(Object.assign({},e),{userStory:!1}))}finally{kt(!1)}});const Ht=null!=(null==D?void 0:D.big_enough)&&!Number.isNaN(D.big_enough)&&!!(null==D?void 0:D.big_enough_decision_factors),$t=null!==(be=null==D?void 0:D.completion_percentage)&&void 0!==be?be:0,Qt=!!(null==D?void 0:D.completion_decision_factors),Xt=""===T,Zt=null!=z?z:O(F,Xt),Jt=!A&&!U;return n.useEffect(()=>{if(!mt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${mt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[mt]),n.useEffect(()=>{D.isDefaultEdit&&vt(e=>Object.assign(Object.assign({},e),{userStory:!0}))},[D.isDefaultEdit]),console.log("block number in userstory card ",re),t.jsxs("div",Object.assign({className:r.default.card,"data-block-id":"user-story-card-wrapper-"+re,style:null==Ve?void 0:Ve.cardStyle,id:`story-card-${D.title}`,"data-expanded":Ct},{children:[t.jsxs("div",Object.assign({className:r.default.titleSection,style:null==Ve?void 0:Ve.titleSection},{children:[t.jsxs("div",Object.assign({className:r.default.titleRow,style:null==Ve?void 0:Ve.titleRow,onClick:Vt},{children:[t.jsxs("div",Object.assign({className:r.default.titleLeft,style:null==Ve?void 0:Ve.titleLeft,onMouseEnter:()=>_t(!0),onMouseLeave:()=>_t(!1)},{children:[X&&t.jsx(I,{displayName:N}),gt&&Jt?t.jsx(y.InlineTitleEditor,{title:D.title,onSave:t=>((t,n)=>e.__awaiter(void 0,void 0,void 0,function*(){var e;try{let l=Object.assign({},D);D.artifactId===n?l.title=t:l.sub_features=(null===(e=D.sub_features)||void 0===e?void 0:e.map(e=>e.artifactId===n?Object.assign(Object.assign({},e),{title:t}):e))||[],ut(l),B(l),pt(!1)}catch(e){console.error("Failed to save title",e)}}))(t,D.artifactId),onCancel:()=>{pt(!1)},inputStyle:null==$e?void 0:$e.inlineTitleInput,confirmButtonStyle:null==$e?void 0:$e.inlineTitleConfirm,cancelButtonStyle:null==$e?void 0:$e.inlineTitleCancel},"inline-title-editor"):t.jsxs("div",Object.assign({className:r.default.storyTitleWrapper},{children:[t.jsx(i.Tooltip,Object.assign({title:C(D.title),arrow:!0},{children:t.jsx("h2",Object.assign({title:se?void 0:D.title,className:r.default.storyTitle,style:null==Ve?void 0:Ve.storyTitle},{children:C(D.title)}),D.artifactId)})),ee&&!et&&(Qt?t.jsx(h.CompletionPanel,Object.assign({customIcons:null==xt?void 0:xt.userStoryIcons,customStyles:null==Ve?void 0:Ve.aiReasoningCitaionStyles,currentUserStory:D,panelStyles:null==Ve?void 0:Ve.CompletionStyles,onToggleStateChange:Rt,completionPanelConfig:te},{children:t.jsxs("div",Object.assign({style:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",gap:"4px"},null==Je?void 0:Je.badge),it)},{children:[t.jsxs("span",{children:[$t,"% Completed"]}),t.jsx("span",Object.assign({style:{display:"flex",alignItems:"center"}},{children:t.jsx(m.default,{color:"currentColor"})})),Mt?t.jsx(l.ChevronUp,{size:14,style:null==Je?void 0:Je.chevronStyle}):t.jsx(l.ChevronDown,{size:14,style:null==Je?void 0:Je.chevronStyle})]}))})):t.jsx("div",Object.assign({style:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",gap:"4px"},null==Je?void 0:Je.badge),it)},{children:t.jsxs("span",{children:[$t,"% Completed"]})}))),Z&&t.jsx("button",Object.assign({type:"button",className:r.default.titleEditButton,style:null==$e?void 0:$e.titleEditButton,onClick:e=>{e.stopPropagation(),pt(!0),Ct||Ot(!0)},"aria-label":"Edit title",title:"Edit title"},{children:t.jsx("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:t.jsx("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})}))}))]}))]})),(Ue||void 0!==Me&&void 0!==Re)&&t.jsxs("div",Object.assign({className:r.default.statusContainer},{children:[void 0!==Me&&void 0!==Re&&t.jsxs("div",Object.assign({className:r.default.completedBadge},{children:["Completed: ",Me,"/",Re]})),Ue&&t.jsx("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),null==_e||_e()},onMouseEnter:()=>Ft(!0),onMouseLeave:()=>Ft(!1),className:r.default.statusButton,style:Object.assign(Object.assign({},null===(Se=rt[Ue])||void 0===Se?void 0:Se.default),Lt&&(null===(xe=rt[Ue])||void 0===xe?void 0:xe.hover))},{children:x[Ue]}))]})),t.jsxs("div",Object.assign({className:r.default.titleActions,style:null==Ve?void 0:Ve.titleActions,onClick:e=>e.stopPropagation()},{children:[(Zt.showProgressPercentage||Zt.showGapBox)&&W&&t.jsxs("div",Object.assign({className:r.default.progressHeader,style:null==Xe?void 0:Xe.wrapper},{children:[Zt.showProgressPercentage&&t.jsxs("div",Object.assign({className:r.default.progressPercentage,style:null==Xe?void 0:Xe.percentage},{children:[null!==(Oe=null!==(Ce=null==D?void 0:D.confidenceScore)&&void 0!==Ce?Ce:null==Zt?void 0:Zt.confidenceValue)&&void 0!==Oe?Oe:"0","%"]})),Zt.showGapBox&&t.jsxs("div",Object.assign({className:r.default.gapBox,style:null==Xe?void 0:Xe.gapBox},{children:[null!==(we=null!==(Ie=null==D?void 0:D.gapValue)&&void 0!==Ie?Ie:null==Zt?void 0:Zt.gapBoxValue)&&void 0!==we?we:"2"," ","Gaps"]}))]})),Ht&&t.jsx(j.BigEnoughPanel,{customIcons:null==xt?void 0:xt.userStoryIcons,customStyles:null==Ve?void 0:Ve.aiReasoningCitaionStyles,currentUserStory:D,panelStyles:null==Ve?void 0:Ve.BigEnoughStyles}),!ct.userStory&&t.jsxs(t.Fragment,{children:[!1!==(null==Zt?void 0:Zt.showShareButton)&&t.jsx("button",Object.assign({className:r.default.iconButton,style:null==Ve?void 0:Ve.iconButton,onClick:e=>{Et(e.currentTarget)}},{children:t.jsx(l.ExternalLink,{size:16})})),t.jsxs(i.Menu,Object.assign({id:"user-story-share-menu",anchorEl:Nt,open:!!Nt,onClose:()=>Et(null),style:null==Ve?void 0:Ve.userStoryShareMenu},{children:[P&&t.jsx(i.MenuItem,Object.assign({style:null==Ve?void 0:Ve.userStoryMenuItem,onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){wt(!0),_&&(yield Promise.all([_("pdf"),_("doc")]),wt(!1))})},{children:t.jsxs("div",Object.assign({ref:Pt,className:r.default.menuItemContent,style:null==Ve?void 0:Ve.menuItemContent},{children:[t.jsx(l.Download,{size:16,color:null==Ve?void 0:Ve.menuIconColor}),t.jsx("p",Object.assign({style:null==Ve?void 0:Ve.menuLabel},{children:"Download"}))]}))})),t.jsx(i.MenuItem,Object.assign({style:null==Ve?void 0:Ve.userStoryMenuItem,onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){let e=D;E&&(e=Object.assign(Object.assign({},D),{value:`${u.replaceTitleSection(null==E?void 0:E.value,D.title)} \n${D.value}`})),null==M||M(!0,[e],D.artifactId),zt()})},{children:t.jsxs("div",Object.assign({style:null==Ve?void 0:Ve.menuItemContent,className:r.default.menuItemContentPadded},{children:[t.jsx(l.Share2,{size:16,color:null==Ve?void 0:Ve.menuIconColor}),t.jsx("p",Object.assign({style:null==Ve?void 0:Ve.menuLabel},{children:"Send"}))]}))})),t.jsx(i.MenuItem,Object.assign({style:null==Ve?void 0:Ve.userStoryMenuItem,onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){const e=(new S.default.Converter).makeHtml(d.formatMarkdown(D.value)||D.value),t=function(e){const t=(new S.default.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(d.formatMarkdown(D.value)||D.value),n=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{yield navigator.clipboard.write([n]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{zt()}})},{children:t.jsxs("div",Object.assign({style:null==Ve?void 0:Ve.menuItemContent,className:r.default.menuItemContentPadded},{children:[t.jsx(l.Copy,{size:16,color:null==Ve?void 0:Ve.menuIconColor}),t.jsx("p",Object.assign({style:null==Ve?void 0:Ve.menuLabel},{children:"Copy"}))]}))}))]}))]}),ct.userStory&&Ct?t.jsx(c.default,{type:"outline",children:"Cancel",style:null==Ve?void 0:Ve.cancelButton,onClick:()=>{var e;null===(e=qt.current)||void 0===e||e.abort(),vt(e=>Object.assign(Object.assign({},e),{userStory:!1}))}}):t.jsx(t.Fragment,{}),ct.userStory&&Ct?t.jsx(c.default,{type:"fill",children:Tt?t.jsxs("span",Object.assign({className:r.default.savingSpinner,style:null==Ve?void 0:Ve.savingSpinner},{children:[t.jsx(l.LoaderCircle,{className:r.default.spinAnimation,style:null==Ve?void 0:Ve.spinAnimation}),t.jsx("span",{children:"Saving..."})]})):"Save",isDisable:Tt,style:Tt?null==Ve?void 0:Ve.savingButton:null==Ve?void 0:Ve.saveButton,onClick:()=>e.__awaiter(void 0,void 0,void 0,function*(){yield Gt()})}):!A&&!U&&!le&&Ct&&!1!==(null==Zt?void 0:Zt.showEditButton)&&t.jsx("button",Object.assign({className:r.default.iconButton,style:null==Ve?void 0:Ve.editButton,onClick:()=>vt(e=>Object.assign(Object.assign({},e),{userStory:!0}))},{children:t.jsx(l.PencilIcon,{color:null==Ve?void 0:Ve.pencilIconColor,size:16})})),ne&&Xt&&Ct&&!A&&!U&&!1!==(null==Zt?void 0:Zt.showEditButton)&&t.jsxs("button",Object.assign({type:"button",className:r.default.addSectionButton,style:null==$e?void 0:$e.addSectionButton,onClick:e=>{var t,n,l;e.stopPropagation();const s=(null!==(n=null===(t=D.sub_features)||void 0===t?void 0:t.length)&&void 0!==n?n:0)+1,i={artifactId:a.v4(),title:`New Section ${s}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},o=Object.assign(Object.assign({},D),{sub_features:[...null!==(l=D.sub_features)&&void 0!==l?l:[],i]});ut(o),B(o),Ot(!0),bt(i.title)},"aria-label":"Add section",title:"Add section"},{children:[t.jsx(l.Plus,{size:14}),t.jsx("span",Object.assign({className:r.default.addSectionLabel},{children:"Add Section"}))]})),!Xt&&!A&&!le&&!U&&t.jsx("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),null==H||H()},className:r.default.iconButton,style:null==$e?void 0:$e.deleteButton,"aria-label":"Delete section",title:"Delete section"},{children:t.jsx(l.Trash2,{size:16})})),et&&t.jsx("button",Object.assign({type:"button",className:r.default.iconButton,style:null==Ge?void 0:Ge.button,disabled:lt,onClick:e=>{if(e.stopPropagation(),jt)return ht(null),void yt(!1);ht(structuredClone(null!=tt?tt:{})),Ot(!0),yt(!0)}},{children:jt?t.jsx(l.X,{size:16,color:null==Ve?void 0:Ve.pencilIconColor,style:null==Ge?void 0:Ge.cancelIcon}):t.jsx(l.PencilIcon,{size:16,color:null==Ve?void 0:Ve.pencilIconColor,style:null==Ge?void 0:Ge.editIcon})})),(null==Zt?void 0:Zt.actionItemsButton)&&t.jsxs(t.Fragment,{children:[t.jsx("span",Object.assign({className:r.default.actionItemBtn,style:null==Ve?void 0:Ve.actionItemBtn,onClick:e=>{e.stopPropagation(),Bt(e.currentTarget)}},{children:t.jsx(l.Ellipsis,{})})),t.jsx(i.Menu,Object.assign({id:"user-story-action-menu",anchorEl:Dt,open:!!Dt,onClose:Wt,style:null==Ve?void 0:Ve.userStoryShareMenu},{children:null==G?void 0:G.items.map((e,n)=>t.jsx(i.MenuItem,Object.assign({style:null==Ve?void 0:Ve.userStoryMenuItem,onClick:()=>{e.onclick(D),Wt()}},{children:t.jsxs("div",Object.assign({className:r.default.menuItemContent,style:Object.assign(Object.assign({},null==Ve?void 0:Ve.menuItemContent),!e.isActive&&{cursor:"not-allowed",opacity:.5})},{children:[t.jsx("span",Object.assign({className:r.default.menuItemIcon,style:null==Ve?void 0:Ve.menuItemIcon},{children:e.icon})),t.jsx("p",Object.assign({style:null==Ve?void 0:Ve.menuLabel},{children:e.name})),t.jsx("span",{className:r.default.menuItemRight,style:null==Ve?void 0:Ve.menuItemRight})]}))}),`action-item-${n}-${e.name}`))}))]}),t.jsx("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),Vt()},style:null==Ve?void 0:Ve.chevronButton,className:r.default.chevronButton},{children:Ct?t.jsx(l.ChevronUp,{className:r.default.chevronIcon,color:null==Ve?void 0:Ve.chevronIconColor}):t.jsx(l.ChevronDown,{className:r.default.chevronIcon,color:null==Ve?void 0:Ve.chevronIconColor})}))]}))]})),t.jsx("div",{className:r.default.divider,style:null==Ve?void 0:Ve.dividerStyle})]})),Ct&&t.jsx("div",Object.assign({className:r.default.cardContent,style:Object.assign(Object.assign({},null==Ve?void 0:Ve.cardContentStyle),{borderTop:K?"1px solid #E5E5E5":"none"})},{children:Pe?t.jsxs("div",Object.assign({className:r.default.loadingContainer},{children:[t.jsx("div",Object.assign({className:r.default.loadingIconWrapper},{children:t.jsx(l.Hourglass,{size:28,color:"#5B3DF5",className:r.default.spinAnimation})})),t.jsxs("div",{children:[t.jsx("h3",Object.assign({className:r.default.loadingTitle},{children:"Section generation in progress.."})),t.jsx("p",Object.assign({className:r.default.loadingSubtitle},{children:"This may take a few minutes"}))]}),t.jsx("button",Object.assign({type:"button",onClick:()=>null==Ae?void 0:Ae(),className:r.default.viewStatusButton},{children:"View Status"}))]})):qe?t.jsxs("div",Object.assign({className:r.default.noDataContainer,style:null==Ke?void 0:Ke.container},{children:[t.jsx("img",{src:o.default,alt:"No data available",className:r.default.noDataIllustration,style:null==Ke?void 0:Ke.illustration}),t.jsx("h3",Object.assign({className:r.default.noDataTitle,style:null==Ke?void 0:Ke.title},{children:"No Data Available for This Section"})),t.jsx("p",Object.assign({className:r.default.noDataSubtitle,style:null==Ke?void 0:Ke.subtitle},{children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."}))]})):t.jsxs("div",Object.assign({className:r.default.contentInner,style:null==Ve?void 0:Ve.contentInner},{children:[t.jsxs("div",Object.assign({className:r.default.descriptionSection,style:null==Ve?void 0:Ve.descriptionSection},{children:[t.jsx("div",{className:r.default.justifyBetween,style:null==Ve?void 0:Ve.justifyBetween}),ct.userStory?t.jsx(v.default,{ref:At,minHeight:"100%",height:"100%",type:"string",value:d.formatMarkdown(D.value)||"",handleUpdateState:(e,t)=>{const n=d.indentMarkdown(t);ut(e=>Object.assign(Object.assign({},e),{value:n||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:ct.userStory?"edit":"readOnly",onSaveUnsavedChanges:()=>e.__awaiter(void 0,void 0,void 0,function*(){yield Gt(),Ot(!1)}),onDiscardUnsavedChanges:()=>{ut(Object.assign(Object.assign({},structuredClone(D)),{value:d.formatMarkdown(D.value)||""})),vt(e=>Object.assign(Object.assign({},e),{userStory:!1})),Ot(!1)},isSavingUnsavedChanges:Tt}):et?t.jsx(f.default,{styles:Ze,fields:nt,readonly:!jt,isSaving:st,value:null!==(Ne=null!=ft?ft:tt)&&void 0!==Ne?Ne:{},onChange:ht,onSave:()=>e.__awaiter(void 0,void 0,void 0,function*(){var e;ft&&(yield null===(e=null==We?void 0:We.onSave)||void 0===e?void 0:e.call(We,D,ft),ht(null),yt(!1))}),onCancel:()=>{ht(null),yt(!1)}}):t.jsxs(t.Fragment,{children:[t.jsx(g.default,{showUserStoryDiff:U,isParent:""===T,message:d.formatMarkdown(D.value)||"",artifactId:D.artifactId,customStyles:Qe,isDisplayHighlightControl:L,contextVariant:$,showConfidenceScore:J,CDNeededInChip:ae,blockId:re}),(ie||oe)&&t.jsxs("div",Object.assign({className:r.default.actionButtonsContainer,style:null==Ye?void 0:Ye.container},{children:[oe&&!ct.userStory&&t.jsxs(t.Fragment,{children:[t.jsx("button",Object.assign({type:"button",className:r.default.actionButton,style:null==Ye?void 0:Ye.button,disabled:oe.disabled||oe.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=oe.onClick)||void 0===t||t.call(oe),vt(e=>Object.assign(Object.assign({},e),{userStory:!0})),Ot(!0)}},{children:oe.isLoading?t.jsxs(t.Fragment,{children:[t.jsx(l.LoaderCircle,{size:16,className:r.default.actionButtonSpinner,style:null==Ye?void 0:Ye.icon}),t.jsx("span",Object.assign({style:null==Ye?void 0:Ye.text},{children:null!==(Ee=oe.label)&&void 0!==Ee?Ee:"Edit"}))]}):t.jsxs(t.Fragment,{children:[t.jsx(l.PencilIcon,{size:16,style:null==Ye?void 0:Ye.icon}),t.jsx("span",Object.assign({style:null==Ye?void 0:Ye.text},{children:null!==(De=oe.label)&&void 0!==De?De:"Edit"}))]})})),ie&&t.jsx("span",{className:r.default.actionButtonDivider})]}),ie&&t.jsx("button",Object.assign({type:"button",className:r.default.actionButton,style:null==Ye?void 0:Ye.button,disabled:ie.disabled||ie.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=ie.onClick)||void 0===t||t.call(ie)}},{children:ie.isLoading?t.jsxs(t.Fragment,{children:[t.jsx(l.LoaderCircle,{size:16,className:r.default.actionButtonSpinner,style:null==Ye?void 0:Ye.icon}),t.jsx("span",Object.assign({style:null==Ye?void 0:Ye.text},{children:null!==(Be=ie.label)&&void 0!==Be?Be:"Approve"}))]}):t.jsxs(t.Fragment,{children:[t.jsx(l.Check,{size:16,style:null==Ye?void 0:Ye.icon}),t.jsx("span",Object.assign({style:null==Ye?void 0:Ye.text},{children:null!==(Te=ie.label)&&void 0!==Te?Te:"Approve"}))]})}))]}))]})]})),null===(ke=dt.sub_features)||void 0===ke?void 0:ke.map((e,n)=>{console.log("UserStoryCardWrapper: sub",e);const l=O(F,!1,e.artifactId);return t.jsx(w,{artifactId:b,isUserStoryCurrentlyUpdated:s,artifactTitleId:`${N}-${String.fromCharCode(65+n)}`,parentUserStory:D,parentIndex:`${T}${T&&"."}${k}`,currentIndex:`${n+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const n=[...D.sub_features||[]];n[e]=t,B(Object.assign(Object.assign({},D),{sub_features:n}))})(n,e),enableDownload:!0,isDiffEditReviewMode:A,showUserStoryDiff:U,updateUserStoryArtifact:R,handleDownloadUserStory:_,handleOpenSendDialog:M,isDisplayHighlightControl:L,elementDisplayConfig:F,_resolvedConfig:l,actionItemsConfig:G,onDelete:()=>(e=>{const t=(D.sub_features||[]).filter((t,n)=>n!==e),n=Object.assign(Object.assign({},D),{sub_features:t});ut(n),B(n)})(n),expandedSubFeatures:Q,disableEditPlan:le,useMuiTooltip:se,blockNumber:e.blockNumber},e.artifactId)})]}))}))]}))};exports.StoryCard=w,exports.UserStoryCardWrapper=({artifactTitleIDs:e,expandedSubFeatures:n,isDiffEditReviewMode:s,showUserStoryDiff:i,updateUserStoryArtifact:o,isUserStoryCurrentlyUpdated:a,artifactId:d,handleOpenSendDialog:u,handleDownloadUserStory:c,selectedArtifactId:v,isDisplayHighlightControl:g,elementDisplayConfig:j,showWrapper:y,actionItemsConfig:f,contextVariant:h,showDisplayName:m,allowTitleEdit:b,showConfidenceScore:S,showBorderTop:x,defaultExpanded:C,showCompletionPanel:I=!1,completionPanelConfig:N,showAddSectionButton:E=!1,disableEditPlan:D=!1,useMuiTooltip:B=!1,approveButtonConfig:T,editButtonConfig:k,CDNeededInChip:P})=>{const{userStory:A,setUserStory:U,customStyles:_,searchQueryList:M,currentHighlightIndex:R,setCurrentHighlightIndex:q,segmentComponentConfig:L,sectionStatusConfig:F}=p.useRequirementAI(),z=null==_?void 0:_.userStoryCardStyles,W=0===R,V=R===M.length-1;return t.jsxs("div",Object.assign({className:r.default.userStoryCardWrapper,style:g?Object.assign(Object.assign({},null==z?void 0:z.userStoryCardWrapper),{position:"relative"}):null==z?void 0:z.userStoryCardWrapper},{children:[g&&t.jsx(t.Fragment,{children:M.length>0&&t.jsx("div",Object.assign({className:r.default.wrapper},{children:t.jsx("div",Object.assign({className:r.default.highlightNavigation},{children:t.jsxs("div",Object.assign({className:r.default.navigationContainer},{children:[t.jsxs("span",Object.assign({className:r.default.navCounter},{children:[R+1," of ",M.length]})),t.jsxs("div",Object.assign({className:r.default.navButtons},{children:[t.jsx("button",Object.assign({onClick:()=>{R>0&&q(e=>e-1)},className:r.default.navButton,disabled:W},{children:t.jsx(l.ChevronUpIcon,{size:20,className:r.default.navIcon})})),t.jsx("button",Object.assign({onClick:()=>{R<M.length-1&&q(e=>e+1)},className:r.default.navButton,disabled:V},{children:t.jsx(l.ChevronDownIcon,{size:20,className:r.default.navIcon})}))]}))]}))}))}))}),A.map((l,r)=>{console.log("UserStoryCardWrapper: userstory",l);const p=O(j,!0);return t.jsx(w,{isUserStoryCurrentlyUpdated:a,artifactId:d,artifactTitleId:e[r]||"",expandedSubFeatures:n,currentUserStory:l,onUserStoryChange:e=>{U(t=>(t[r]=e,[...t]))},parentIndex:"",currentIndex:`${r+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:s,showUserStoryDiff:i,updateUserStoryArtifact:o,handleOpenSendDialog:u,handleDownloadUserStory:c,selectedArtifactId:v,isDisplayHighlightControl:g,elementDisplayConfig:j,_resolvedConfig:p,showWrapper:y,defaultExpanded:C,actionItemsConfig:f,contextVariant:h,showDisplayName:m,allowTitleEdit:b,showConfidenceScore:S,showBorderTop:x,sectionStatusConfig:F,showCompletionPanel:I,completionPanelConfig:N,showAddSectionButton:E,disableEditPlan:D,useMuiTooltip:B,approveButtonConfig:T,CDNeededInChip:P,editButtonConfig:k},l.artifactId)})]}))},exports.default=w,exports.replaceLearnedTagsWithInfo=C;
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("./Segment.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=l(require("dompurify"));exports.default=({id:l,children:i,props:d,segmentComponentConfig:a,customStyles:s,customIcons:r,extractText:u,isUpdatedSegment:v=!1})=>{var g,m,c,p,S,h,f,x,b,y,_,C,j;const D=(null==d?void 0:d.id)||"Segment",I=(null==d?void 0:d.decisionstrength)||"80",{segmentDataList:U,getSegmentExampleComponent:q,handleViewGlossary:E,upadatedSegmentDataList:F,handleFetchUpdatedSegmentDetails:L,handleFetchSegmentDetails:O,handleDeleteSegment:w}=a||{},R=v?null==F?void 0:F.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==D?void 0:D.split("-"))||void 0===n?void 0:n[0])}):null==U?void 0:U.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==D?void 0:D.split("-"))||void 0===n?void 0:n[0])}),k={id:D,reason:null!==(g=null==R?void 0:R.reason)&&void 0!==g?g:"",gap:null!==(m=null==R?void 0:R.gap)&&void 0!==m?m:"",explanation:null!==(c=null==R?void 0:R.explanation)&&void 0!==c?c:"",relevance_score:null!==(p=null==R?void 0:R.relevance_score)&&void 0!==p?p:0,isOpen:!1};let G;const M=u(i),T=d["data-table"];let V="";if(T&&!v)try{V=decodeURIComponent(atob(T))}catch(e){console.error("Failed to decode data-table for segment",D,e)}const W=o.default.sanitize(V),z=()=>n.jsx("div",{dangerouslySetInnerHTML:{__html:W}});return R||!O||v||null==O||O(D),D&&R&&q&&!v&&(G=T?n.jsx(z,{}):q(D,M,R.segment_type)),n.jsx(t.default,Object.assign({id:D,segmentUUID:l,label:null!==(S=null==R?void 0:R.label)&&void 0!==S?S:null==R?void 0:R.segment_name,decisionStrength:I,aiReason:k,customIcons:r,aiReasoningCitationCustomStyles:s,segmentExampleComponent:G,handleViewGlossary:E,customStyles:{segmentWrapper:null===(h=null==s?void 0:s.segment)||void 0===h?void 0:h.segmentWrapper,container:null===(f=null==s?void 0:s.segment)||void 0===f?void 0:f.container,label:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.label,decisionStrength:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.decisionStrength,buttonContainer:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.buttonContainer,cheveronIcon:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.cheveronIcon,segmentExample:null===(C=null==s?void 0:s.segment)||void 0===C?void 0:C.segmentExample,loadingSkeleton:null===(j=null==s?void 0:s.segment)||void 0===j?void 0:j.SegmentLoadingSkeletonStyles},isUpdatedSegment:v,onOpen:()=>e.__awaiter(void 0,void 0,void 0,function*(){!R&&v&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),yield null==L?void 0:L(D))}),onDelete:e=>{if(R)return null==w?void 0:w(e,R)}},{children:i}),D)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("./Segment.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=l(require("dompurify"));exports.default=({id:l,children:i,props:d,segmentComponentConfig:a,customStyles:s,customIcons:r,extractText:u,isUpdatedSegment:v=!1,blockId:g})=>{var m,c,p,S,h,f,b,x,y,_,C,D,j;const I=(null==d?void 0:d.id)||"Segment",U=(null==d?void 0:d.decisionstrength)||"80",{segmentDataList:q,getSegmentExampleComponent:E,handleViewGlossary:F,upadatedSegmentDataList:L,handleFetchUpdatedSegmentDetails:O,handleFetchSegmentDetails:k,handleDeleteSegment:w}=a||{},R=v?null==L?void 0:L.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==I?void 0:I.split("-"))||void 0===n?void 0:n[0])}):null==q?void 0:q.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==I?void 0:I.split("-"))||void 0===n?void 0:n[0])}),W={id:I,reason:null!==(m=null==R?void 0:R.reason)&&void 0!==m?m:"",gap:null!==(c=null==R?void 0:R.gap)&&void 0!==c?c:"",explanation:null!==(p=null==R?void 0:R.explanation)&&void 0!==p?p:"",relevance_score:null!==(S=null==R?void 0:R.relevance_score)&&void 0!==S?S:0,isOpen:!1};let G;const M=u(i),T=d["data-table"];let V="";if(T&&!v)try{V=decodeURIComponent(atob(T))}catch(e){console.error("Failed to decode data-table for segment",I,e)}const z=o.default.sanitize(V),H=()=>n.jsx("div",{dangerouslySetInnerHTML:{__html:z}});return R||!k||v||null==k||k(I),I&&R&&E&&!v&&(G=T?n.jsx(H,{}):E(I,M,R.segment_type)),n.jsx(t.default,Object.assign({id:I,segmentUUID:l,label:null!==(h=null==R?void 0:R.label)&&void 0!==h?h:null==R?void 0:R.segment_name,decisionStrength:U,aiReason:W,customIcons:r,aiReasoningCitationCustomStyles:s,segmentExampleComponent:G,handleViewGlossary:F,customStyles:{segmentWrapper:null===(f=null==s?void 0:s.segment)||void 0===f?void 0:f.segmentWrapper,container:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.container,label:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.label,decisionStrength:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.decisionStrength,buttonContainer:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.buttonContainer,cheveronIcon:null===(C=null==s?void 0:s.segment)||void 0===C?void 0:C.cheveronIcon,segmentExample:null===(D=null==s?void 0:s.segment)||void 0===D?void 0:D.segmentExample,loadingSkeleton:null===(j=null==s?void 0:s.segment)||void 0===j?void 0:j.SegmentLoadingSkeletonStyles},isUpdatedSegment:v,onOpen:()=>e.__awaiter(void 0,void 0,void 0,function*(){!R&&v&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),yield null==O?void 0:O(I))}),onDelete:e=>{if(console.log("SegmentWrapper: onDelete",e,R,g),R)return null==w?void 0:w(e,R,g)}},{children:i}),I)};
2
2
  //# sourceMappingURL=SegmentWrapper.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("react-markdown"),o=require("rehype-raw"),l=require("./UserStoryWithCitation.module.css.js"),s=require("../../shared/useMarkdownSearch.js"),d=require("lucide-react"),r=require("@mui/material"),a=require("dompurify"),c=require("../../shared/UpdatedAnimationContent.js"),u=require("../../shared/GeneratedCodeCitation.js"),g=require("../../shared/CitationLoadingIndicator.js"),v=require("../RequirementAIWrapper/RequirementAIWrapper.js"),h=require("../../icons/CognitiveDecision.js"),p=require("../../icons/BrainRed.js"),m=require("../ai-reasoning/AiReasoningCitation.js"),f=require("../../icons/RelevanceScoreIcon.js"),C=require("../RecommendationBlock/RecommendationBlock.js"),j=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),b=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),w=require("./components/HighlightButtonComponent.js");function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var I=_(t),R=_(i),O=_(o),N=_(a);const $=t.createContext(!1),k=t.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),A=t.createContext({rowId:""}),q=({aiReason:e,isHighConfidence:i,customStyle:o,customIcons:s})=>{var d;const{expandedInfo:r,setExpanded:a,reasonToRow:c}=t.useContext(k),{rowId:u}=t.useContext(A),g=String(e.id);u&&c.current.set(g,u);const v=(null===(d=null==r?void 0:r.aiReason)||void 0===d?void 0:d.id)===e.id,m=i?(null==s?void 0:s.highConfidence)||n.jsx(h.default,{}):(null==s?void 0:s.lowConfidence)||n.jsx(p.default,{});return n.jsxs("button",Object.assign({className:l.default.aiReasoningButton,style:o,onClick:n=>{n.stopPropagation(),n.preventDefault(),a(v?null:u,v?null:e)}},{children:[m,v?n.jsx("i",{className:`pi pi-angle-up ${i?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`}):n.jsx("i",{className:`pi pi-angle-down ${i?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`})]}))},E=({children:e,node:i,customStyles:o,customIcons:s})=>{var d,r;const a=t.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=t.useContext(k),u=(null==c?void 0:c.rowId)===a,g=Array.isArray(null==i?void 0:i.children)?i.children.filter(e=>"element"===e.type).length:1,v=null!==(r=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d.style)&&void 0!==r?r:void 0;return n.jsxs(A.Provider,Object.assign({value:{rowId:a}},{children:[n.jsx("tr",Object.assign({style:v?{cssText:v}:void 0},{children:e})),u&&(null==c?void 0:c.aiReason)&&n.jsx("tr",Object.assign({style:{width:"100%"}},{children:n.jsx("td",Object.assign({colSpan:g||1,className:l.default.tableExpandedCell},{children:n.jsx("div",Object.assign({className:l.default.tableExpandedCellInner},{children:n.jsx("div",Object.assign({className:l.default.tableExpandedCellContent},{children:n.jsx(x.default,{aiReason:c.aiReason,customIcons:s,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})}))}))}))}))]}))};const M=["del","ins"];function U(e){return function(e,n,t){const i=n.join("|");return e.replace(new RegExp(`<(${i})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,i)=>`<${n}>${t(i)}</${n}>`)}(e,M,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,t)=>`@@CODE_SPAN_${n.push(t)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,t)=>{var i;return`<code>${o=null!==(i=n[Number(t)])&&void 0!==i?i:"",o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var o})}(e)).join(""))}const L=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function T(e,n){const t=[],i=new Set(n.map(e=>e.toLowerCase())),o=e=>{var n,l;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>o(e)).flat().filter(e=>null!=e);if(!I.default.isValidElement(e))return e;const s="string"==typeof e.type?e.type.toLowerCase():"";if(i.has(s))return t.push(e),null;if(L.has(s))return e;const d=null===(l=I.default.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,o))||void 0===l?void 0:l.flat().filter(e=>null!=e);return d&&0!==d.length?I.default.cloneElement(e,void 0,d):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:o(e),extractedNodes:t}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:i,noMarkdownContent:o,useMarkdown:a=!0,isParent:h,scenario:p,showUserStoryDiff:x=!1,aiReasoningsForBlock:_,isCitationLoadingDisplay:A=!1,className:M,highConfidenceIcon:L,lowConfidenceIcon:D,customStyles:P,customIcons:F,contextVariant:H,aiReasoningDiffView:B,userStoryCitations:V,artifactId:W,isCraflow:z,onCraAccept:G,onCraReject:Q,craFlowConfig:J,isDisplayHighlightControl:K=!1,showConfidenceScore:X=!0,CDNeededInChip:Y})=>{var Z;const ee=t.useRef(null),{userStory:ne,inlineUpdateComponentConfig:te,getAvgScoreForStory:ie,setUserStory:oe,aiReasoning:le,setAiReasoning:se,customIcons:de,searchQueryList:re,searchQueryReasoningIdList:ae,currentHighlightIndex:ce,segmentComponentConfig:ue,diffEditConfig:ge}=v.useRequirementAI(),ve=null!=F?F:null==de?void 0:de.userStoryIcons;null==P||P.searchHighlight;const{search:he,clear:pe}=s.useMarkdownSearch(ee),[me,fe]=t.useState("1"),[Ce,je]=t.useState(null),xe=t.useRef(new Map),[be,ye]=t.useState(new Set),Se=t.useCallback((e,n)=>{je(e&&n?{rowId:e,aiReason:n}:null)},[]),we=W?ie(W):0,[_e,Ie]=t.useState([]),Re=t.useCallback(e=>{ye(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})},[]),Oe=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Oe).join(""):I.default.isValidElement(e)?Oe(e.props.children):"",Ne=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,t)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(t.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,t,i,o)=>{const l=i.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${t} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,t)=>{if(/<table[\s>]/i.test(t)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(t))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,t,i,o)=>{const l=n.substring(0,o),s=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(s+1))||/^\s+\d+\.\s/.test(l.substring(s+1)),r=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(s+1));if(d||r){let e=i;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${t}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,t=[];let i;const o=new RegExp(n.source,n.flags);for(;null!==(i=o.exec(e));){const e=i[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),o=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;t.push({index:i.index,endIndex:i.index+i[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===t.length)return e;let l=e;for(let e=t.length-1;e>=0;e--){const n=t[e],i=n.changedItemCount-n.deletedItemCount;if(0===i)continue;const o=l.substring(0,n.index).split("\n").reverse();let s=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(s=!0);break}}if(!s)continue;const d=n.endIndex,r=e+1<t.length?t[e+1].index:l.length;let a=l.substring(d,r);a=a.replace(/^(\s*)(\d+)\.\s/gm,(e,n,t)=>`${n}${parseInt(t,10)+i}. `),l=l.substring(0,d)+a+l.substring(r)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const t=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:t!==n}),`<deleted>${t}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const t=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:t!==n,preview:n.substring(0,120)}),`<changed>${t}</changed>`}),n}(n),n=U(n),n},$e=t.useMemo(()=>i?Ne(i):i,[i]);t.useEffect(()=>{Ie(_||le)},[_,le]);const ke=t.useMemo(()=>({span:t=>{var i,o,l,s,d,{node:r,children:a}=t,c=e.__rest(t,["node","children"]);const u=null!==(o=null===(i=null==r?void 0:r.properties)||void 0===i?void 0:i["highlight-id"])&&void 0!==o?o:null==c?void 0:c["highlight-id"],g="string"==typeof u&&be.has(u),v=null!==(s=null===(l=null==r?void 0:r.properties)||void 0===l?void 0:l["highlight-color"])&&void 0!==s?s:null==c?void 0:c["highlight-color"];return n.jsx("span",Object.assign({style:Object.assign(Object.assign({},null!==(d=null==P?void 0:P.span)&&void 0!==d?d:{}),g?{backgroundColor:v||"#fef08a"}:{})},{children:a}))},button:t=>{var i,o,l,s,d,r,{node:a,children:c}=t,u=e.__rest(t,["node","children"]);const g=null!==(o=null===(i=null==a?void 0:a.properties)||void 0===i?void 0:i.action)&&void 0!==o?o:null==u?void 0:u.action,v=null!==(s=null===(l=null==a?void 0:a.properties)||void 0===l?void 0:l["highlight-id"])&&void 0!==s?s:null==u?void 0:u["highlight-id"],h=null!==(r=null===(d=null==a?void 0:a.properties)||void 0===d?void 0:d["highlight-type"])&&void 0!==r?r:null==u?void 0:u["highlight-type"];return"highlight"===g?n.jsx(w.default,{highlightId:v,handleHighlightSpan:Re,icon:"web"===h?null==ve?void 0:ve.webCitationIcon:"doc"===h?null==ve?void 0:ve.fileCitationIcon:n.jsx(n.Fragment,{}),customStyles:"web"===h?null==P?void 0:P.webButton:"doc"===h?null==P?void 0:P.docButton:{}}):null},upt:t=>{var i,{node:o,children:l}=t,s=e.__rest(t,["node","children"]);const d=null==s?void 0:s.id,r=d?null===(i=d.split("$"))||void 0===i?void 0:i[1]:null,a=le.find(e=>e.id.toString()===r);return a?n.jsx(n.Fragment,{children:n.jsx(b.default,Object.assign({aiReason:a,customStyles:null==P?void 0:P.inlineUpdatedComponent,handleClickCognitiveDecision:null==te?void 0:te.handleClickCognitiveDecision,handleClickUpdatedPill:null==te?void 0:te.handleClickUpdatedPill,handleClickOutputValue:null==te?void 0:te.handleClickOutputValue,customIcons:null==te?void 0:te.customIcons,CDNeededInChip:Y},{children:l}))}):l},del:t=>{var i,o,s,d,{node:r,children:a}=t,c=e.__rest(t,["node","children"]);const u=c.aireason,g=u&&(null===(i=u.deviation_details)||void 0===i?void 0:i.resolved)&&("rejected"===(null===(o=u.deviation_details)||void 0===o?void 0:o.resolved)||"reverted"===(null===(s=u.deviation_details)||void 0===s?void 0:s.resolved)),{cleanedChildren:v,extractedNodes:h}=T(a,["ins"]);return n.jsxs(n.Fragment,{children:[n.jsx("span",Object.assign({className:l.default.deleted,style:Object.assign(Object.assign({},null!==(d=null==P?void 0:P.deleted)&&void 0!==d?d:{}),{textDecoration:g?"none":"line-through"})},c,{onClick:c.onclick},{children:v})),h]})},ins:t=>{var{children:i}=t,o=e.__rest(t,["children"]);const{cleanedChildren:s,extractedNodes:d}=T(i,["del"]);return n.jsxs(n.Fragment,{children:[n.jsx("span",Object.assign({className:l.default.inserted,style:null==P?void 0:P.inserted},o,{onClick:o.onclick},{children:s})),d]})},preserved:t=>{var{children:i}=t,o=e.__rest(t,["children"]);return n.jsx("span",Object.assign({className:l.default.preserved,style:null==P?void 0:P.preserved},o,{onClick:o.onclick},{children:i}))},h1:t=>{var i=e.__rest(t,["node"]);return n.jsx("h1",Object.assign({className:l.default.heading1,style:null==P?void 0:P.heading1},{children:i.children}))},h2:t=>{var i=e.__rest(t,["node"]);return n.jsx("h2",Object.assign({className:l.default.heading2,style:null==P?void 0:P.heading2},{children:i.children}))},h3:t=>{var i=e.__rest(t,["node"]);return n.jsx("h3",Object.assign({className:l.default.heading3,style:null==P?void 0:P.heading3},{children:i.children}))},b:t=>{var i=e.__rest(t,["node"]);return n.jsx("b",Object.assign({className:l.default.bold,style:null==P?void 0:P.bold},{children:null==i?void 0:i.children}))},p:t=>{var i=e.__rest(t,["node"]);return n.jsx("p",Object.assign({},i,{className:l.default.paragraph,style:null==P?void 0:P.paragraph},{children:i.children}))},updated:t=>{var{node:i}=t,o=e.__rest(t,["node"]);return n.jsx(c.default,Object.assign({},o,{showUserStoryDiff:x,currentUpdatedTagId:me,setCurrentUpdatedTagId:fe,userStory:ne,setUserStory:oe,setAiReasoning:se,node:i,isCraflow:z,onCraAccept:G,onCraReject:Q,diffEditConfig:ge,customStyles:null==P?void 0:P.updatedContent,craFlowConfig:J}))},ol:t=>{var i,o,s,{node:d}=t,r=e.__rest(t,["node"]);const a=null!==(s=null!==(o=null===(i=null==d?void 0:d.properties)||void 0===i?void 0:i.start)&&void 0!==o?o:null==r?void 0:r.start)&&void 0!==s?s:void 0;return n.jsx("ol",Object.assign({className:l.default.orderedList,style:null==P?void 0:P.olist},a?{start:Number(a)}:{},{children:null==r?void 0:r.children}))},ul:t=>{var i=e.__rest(t,["node"]);return n.jsx("ul",Object.assign({className:l.default.unorderedList,style:null==P?void 0:P.ulist},{children:null==i?void 0:i.children}))},table:({children:e})=>n.jsx("div",Object.assign({className:l.default.tableWrapper},{children:n.jsx("table",Object.assign({className:l.default.table,style:null==P?void 0:P.table},{children:e}))})),tr:({node:e,children:t})=>n.jsx(E,{node:e,children:t,customStyles:P}),td:({node:t,children:i})=>{var o;const l=null!==(o=null==t?void 0:t.properties)&&void 0!==o?o:{},{style:s}=l,d=e.__rest(l,["style"]);return n.jsx($.Provider,Object.assign({value:!0},{children:n.jsx("td",Object.assign({},d,{style:s?{cssText:s}:void 0},{children:i}))}))},th:({node:t,children:i})=>{var o;const l=null!==(o=null==t?void 0:t.properties)&&void 0!==o?o:{},{style:s}=l,d=e.__rest(l,["style"]);return n.jsx($.Provider,Object.assign({value:!0},{children:n.jsx("th",Object.assign({},d,{style:s?{cssText:s}:void 0},{children:i}))}))},recommendation:t=>{var i,o=e.__rest(t,["node"]);const l=`The AI has selected this content based on: ${(null===(i=null==o?void 0:o.children)||void 0===i?void 0:i[0])||""}`;return n.jsx(C.default,Object.assign({},o,{customStyles:null==P?void 0:P.recommendationBlock,label:l}))},a:i=>{var o,l,s,{inline:d,children:r,node:a}=i,c=e.__rest(i,["inline","children","node"]);const u=t.useContext($)||"true"==(null==c?void 0:c.table),g=`${null==c?void 0:c.href}`,v=null===(o=g.split("$"))||void 0===o?void 0:o[0],h=null===(l=g.split("$"))||void 0===l?void 0:l[1];if("ai_reasoning"===v){const e=(null!==(s=x?B:le)&&void 0!==s?s:[]).find(e=>e.id.toString()===decodeURIComponent(h)),t=ae.includes(h);if(e){if(u)return n.jsx(q,{aiReason:e,customStyle:null==P?void 0:P.tableAiReasoning,customIcons:ve,isHighConfidence:e.relevance_score>=m.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const i=Oe(r),o="source"!==i.trim().toLowerCase();return n.jsx(m.default,{aiReason:e,isSourceHasHighlight:t,inlineLabel:i,isInlineCitation:o,customIcons:ve,customStyles:{aiReasoningContent:null==P?void 0:P.aiReasoningContent,aiReasoningAccordion:null==P?void 0:P.aiReasoningAccordion,aiReasoningMarkdown:null==P?void 0:P.aiReasoningMarkdown,aiReasoningPill:null==P?void 0:P.aiReasoningPill,webCitation:null==P?void 0:P.webCitation,stormeeCitation:null==P?void 0:P.stormeeCitation,waveformCitation:null==P?void 0:P.waveformCitation,imageCitation:null==P?void 0:P.imageCitation,fileCitation:null==P?void 0:P.fileCitation,appModCitation:null==P?void 0:P.appModCitation,rcaCitation:null==P?void 0:P.rcaCitation,readFileCitation:null==P?void 0:P.readFileCitation,loadingCitations:null==P?void 0:P.loadingCitations,chatCitation:null==P?void 0:P.chatCitation,bigEnoughCitation:null==P?void 0:P.bigEnoughCitation}})}}return null},code:t=>{var{inline:i,children:o,className:s,node:d}=t;e.__rest(t,["inline","children","className","node"]);return/language-(\w+)/.exec(s||"")||(null==s?void 0:s.includes("language-"))?n.jsx("div",{children:n.jsx("code",Object.assign({className:l.default.blockCode,style:null==P?void 0:P.code},{children:o}))}):n.jsx("code",Object.assign({className:l.default.inlineCode,style:null==P?void 0:P.code},{children:o}))},learned:({children:e})=>n.jsx(r.Tooltip,Object.assign({title:e,placement:"top"},{children:n.jsx(d.Info,{size:16,className:l.default.learned})})),generatedcode:t=>{var i=e.__rest(t,["node"]);const o=(null==i?void 0:i.language)||"python",l=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const t=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(t).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?t(e.props.children):""};n=t(e.children)}}catch(t){console.error("Error decoding generated code:",t),n=String(e.children)}return n})(i);return n.jsx(u.default,{title:"Generated Code",code:l,language:o,customStyles:{pill:null==P?void 0:P.generatedCodePill,content:null==P?void 0:P.generatedCodeContent}})},updatedsegment:t=>{var i,o,l,s,{node:d,children:r}=t,a=e.__rest(t,["node","children"]);const c=`${null===(i=d.position)||void 0===i?void 0:i.start.line}-${null===(o=d.position)||void 0===o?void 0:o.start.column}-${null===(l=d.position)||void 0===l?void 0:l.end.line}-${null===(s=d.position)||void 0===s?void 0:s.end.column}`,u=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(a),g=u?n.jsx("div",{dangerouslySetInnerHTML:{__html:N.default.sanitize(u)}}):n.jsx("div",{children:r});return n.jsx(y.default,{id:c,node:d,children:g,props:a,segmentComponentConfig:ue,customStyles:P,customIcons:F,extractText:Oe,isUpdatedSegment:!0})},segment:t=>{var i,o,l,s,{node:d,children:r}=t,a=e.__rest(t,["node","children"]);const c=`${null===(i=d.position)||void 0===i?void 0:i.start.line}-${null===(o=d.position)||void 0===o?void 0:o.start.column}-${null===(l=d.position)||void 0===l?void 0:l.end.line}-${null===(s=d.position)||void 0===s?void 0:s.end.column}`;return n.jsx(y.default,{id:c,node:d,children:r,props:a,segmentComponentConfig:ue,customStyles:P,customIcons:F,extractText:Oe})}}),[_e,J,le,V,me,x,i,F,re,ae,P,ue,be,Re]);return t.useEffect(()=>{if(!ee.current)return;if(!re.length)return void pe();let e;if(0===ae.length||K)requestAnimationFrame(()=>{he([re[ce].replace(/\*/g,"")])});else{const n=ee.current,t=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{t.disconnect(),requestAnimationFrame(()=>{he([re[ce].replace(/\*/g,"")])})},50)});t.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[re,ae,ce,K]),n.jsx(k.Provider,Object.assign({value:{expandedInfo:Ce,setExpanded:Se,reasonToRow:xe}},{children:n.jsxs("div",Object.assign({ref:ee,className:`${l.default.container} ${"approving"!==p?l.default.wrapper:""} ${M||""}`,style:null==P?void 0:P.container},{children:[a?n.jsx(S.MarkdownContextProvider,{children:n.jsx(R.default,Object.assign({components:ke,rehypePlugins:[O.default]},{children:$e}))}):o,we>0&&X&&n.jsx("div",Object.assign({className:l.default.confidenceScoreContainer,style:null==P?void 0:P.confidenceScoreContainer},{children:n.jsxs("span",Object.assign({className:l.default.confidenceScore,style:null==P?void 0:P.confidenceScore},{children:[n.jsx(f.default,{size:14,color:(null==P?void 0:P.confidenceScoreIconColor)||"#166534"}),we,"%"]}))})),A&&n.jsx("div",Object.assign({className:l.default.citationLoader,style:null==P?void 0:P.citationLoaderContainer},{children:n.jsx(g.default,{customStyles:{container:null==P?void 0:P.citationLoadingContainer,icon:null==P?void 0:P.citationLoadingIcon,text:null==P?void 0:P.citationLoadingText}})})),h&&n.jsx("div",Object.assign({style:Object.assign({},null===(Z=null==P?void 0:P.attachedContext)||void 0===Z?void 0:Z.wrapper),className:"flex mt-5"},{children:n.jsx(j.default,{customStyles:null==P?void 0:P.attachedContext,variant:H})}))]}))}))},exports.splitNestedDiffNodes=T;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("react-markdown"),o=require("rehype-raw"),l=require("./UserStoryWithCitation.module.css.js"),s=require("../../shared/useMarkdownSearch.js"),d=require("lucide-react"),r=require("@mui/material"),a=require("dompurify"),c=require("../../shared/UpdatedAnimationContent.js"),u=require("../../shared/GeneratedCodeCitation.js"),g=require("../../shared/CitationLoadingIndicator.js"),v=require("../RequirementAIWrapper/RequirementAIWrapper.js"),h=require("../../icons/CognitiveDecision.js"),p=require("../../icons/BrainRed.js"),m=require("../ai-reasoning/AiReasoningCitation.js"),f=require("../../icons/RelevanceScoreIcon.js"),C=require("../RecommendationBlock/RecommendationBlock.js"),j=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),b=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),w=require("./components/HighlightButtonComponent.js");function I(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=I(t),R=I(i),O=I(o),N=I(a);const $=t.createContext(!1),k=t.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),A=t.createContext({rowId:""}),q=({aiReason:e,isHighConfidence:i,customStyle:o,customIcons:s})=>{var d;const{expandedInfo:r,setExpanded:a,reasonToRow:c}=t.useContext(k),{rowId:u}=t.useContext(A),g=String(e.id);u&&c.current.set(g,u);const v=(null===(d=null==r?void 0:r.aiReason)||void 0===d?void 0:d.id)===e.id,m=i?(null==s?void 0:s.highConfidence)||n.jsx(h.default,{}):(null==s?void 0:s.lowConfidence)||n.jsx(p.default,{});return n.jsxs("button",Object.assign({className:l.default.aiReasoningButton,style:o,onClick:n=>{n.stopPropagation(),n.preventDefault(),a(v?null:u,v?null:e)}},{children:[m,v?n.jsx("i",{className:`pi pi-angle-up ${i?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`}):n.jsx("i",{className:`pi pi-angle-down ${i?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`})]}))},E=({children:e,node:i,customStyles:o,customIcons:s})=>{var d,r;const a=t.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=t.useContext(k),u=(null==c?void 0:c.rowId)===a,g=Array.isArray(null==i?void 0:i.children)?i.children.filter(e=>"element"===e.type).length:1,v=null!==(r=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d.style)&&void 0!==r?r:void 0;return n.jsxs(A.Provider,Object.assign({value:{rowId:a}},{children:[n.jsx("tr",Object.assign({style:v?{cssText:v}:void 0},{children:e})),u&&(null==c?void 0:c.aiReason)&&n.jsx("tr",Object.assign({style:{width:"100%"}},{children:n.jsx("td",Object.assign({colSpan:g||1,className:l.default.tableExpandedCell},{children:n.jsx("div",Object.assign({className:l.default.tableExpandedCellInner},{children:n.jsx("div",Object.assign({className:l.default.tableExpandedCellContent},{children:n.jsx(x.default,{aiReason:c.aiReason,customIcons:s,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})}))}))}))}))]}))};const M=["del","ins"];function U(e){return function(e,n,t){const i=n.join("|");return e.replace(new RegExp(`<(${i})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,i)=>`<${n}>${t(i)}</${n}>`)}(e,M,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,t)=>`@@CODE_SPAN_${n.push(t)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,t)=>{var i;return`<code>${o=null!==(i=n[Number(t)])&&void 0!==i?i:"",o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var o})}(e)).join(""))}const L=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function T(e,n){const t=[],i=new Set(n.map(e=>e.toLowerCase())),o=e=>{var n,l;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>o(e)).flat().filter(e=>null!=e);if(!_.default.isValidElement(e))return e;const s="string"==typeof e.type?e.type.toLowerCase():"";if(i.has(s))return t.push(e),null;if(L.has(s))return e;const d=null===(l=_.default.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,o))||void 0===l?void 0:l.flat().filter(e=>null!=e);return d&&0!==d.length?_.default.cloneElement(e,void 0,d):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:o(e),extractedNodes:t}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:i,noMarkdownContent:o,useMarkdown:a=!0,isParent:h,scenario:p,showUserStoryDiff:x=!1,aiReasoningsForBlock:I,isCitationLoadingDisplay:A=!1,className:M,highConfidenceIcon:L,lowConfidenceIcon:D,customStyles:P,customIcons:F,contextVariant:H,aiReasoningDiffView:B,userStoryCitations:V,artifactId:W,isCraflow:z,onCraAccept:G,onCraReject:Q,craFlowConfig:J,isDisplayHighlightControl:K=!1,showConfidenceScore:X=!0,CDNeededInChip:Y,blockId:Z})=>{var ee;console.log("userstorywithcitation blockid ",Z);const ne=t.useRef(null),{userStory:te,inlineUpdateComponentConfig:ie,getAvgScoreForStory:oe,setUserStory:le,aiReasoning:se,setAiReasoning:de,customIcons:re,searchQueryList:ae,searchQueryReasoningIdList:ce,currentHighlightIndex:ue,segmentComponentConfig:ge,diffEditConfig:ve}=v.useRequirementAI(),he=null!=F?F:null==re?void 0:re.userStoryIcons;null==P||P.searchHighlight;const{search:pe,clear:me}=s.useMarkdownSearch(ne),[fe,Ce]=t.useState("1"),[je,xe]=t.useState(null),be=t.useRef(new Map),[ye,Se]=t.useState(new Set),we=t.useCallback((e,n)=>{xe(e&&n?{rowId:e,aiReason:n}:null)},[]),Ie=W?oe(W):0,[_e,Re]=t.useState([]),Oe=t.useCallback(e=>{Se(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})},[]),Ne=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Ne).join(""):_.default.isValidElement(e)?Ne(e.props.children):"",$e=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,t)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(t.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,t,i,o)=>{const l=i.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${t} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,t)=>{if(/<table[\s>]/i.test(t)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(t))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,t,i,o)=>{const l=n.substring(0,o),s=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(s+1))||/^\s+\d+\.\s/.test(l.substring(s+1)),r=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(s+1));if(d||r){let e=i;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${t}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,t=[];let i;const o=new RegExp(n.source,n.flags);for(;null!==(i=o.exec(e));){const e=i[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),o=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;t.push({index:i.index,endIndex:i.index+i[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===t.length)return e;let l=e;for(let e=t.length-1;e>=0;e--){const n=t[e],i=n.changedItemCount-n.deletedItemCount;if(0===i)continue;const o=l.substring(0,n.index).split("\n").reverse();let s=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(s=!0);break}}if(!s)continue;const d=n.endIndex,r=e+1<t.length?t[e+1].index:l.length;let a=l.substring(d,r);a=a.replace(/^(\s*)(\d+)\.\s/gm,(e,n,t)=>`${n}${parseInt(t,10)+i}. `),l=l.substring(0,d)+a+l.substring(r)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const t=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:t!==n}),`<deleted>${t}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const t=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:t!==n,preview:n.substring(0,120)}),`<changed>${t}</changed>`}),n}(n),n=U(n),n},ke=t.useMemo(()=>i?$e(i):i,[i]);t.useEffect(()=>{Re(I||se)},[I,se]);const Ae=t.useMemo(()=>({span:t=>{var i,o,l,s,d,{node:r,children:a}=t,c=e.__rest(t,["node","children"]);const u=null!==(o=null===(i=null==r?void 0:r.properties)||void 0===i?void 0:i["highlight-id"])&&void 0!==o?o:null==c?void 0:c["highlight-id"],g="string"==typeof u&&ye.has(u),v=null!==(s=null===(l=null==r?void 0:r.properties)||void 0===l?void 0:l["highlight-color"])&&void 0!==s?s:null==c?void 0:c["highlight-color"];return n.jsx("span",Object.assign({style:Object.assign(Object.assign({},null!==(d=null==P?void 0:P.span)&&void 0!==d?d:{}),g?{backgroundColor:v||"#fef08a"}:{})},{children:a}))},button:t=>{var i,o,l,s,d,r,{node:a,children:c}=t,u=e.__rest(t,["node","children"]);const g=null!==(o=null===(i=null==a?void 0:a.properties)||void 0===i?void 0:i.action)&&void 0!==o?o:null==u?void 0:u.action,v=null!==(s=null===(l=null==a?void 0:a.properties)||void 0===l?void 0:l["highlight-id"])&&void 0!==s?s:null==u?void 0:u["highlight-id"],h=null!==(r=null===(d=null==a?void 0:a.properties)||void 0===d?void 0:d["highlight-type"])&&void 0!==r?r:null==u?void 0:u["highlight-type"];return"highlight"===g?n.jsx(w.default,{highlightId:v,handleHighlightSpan:Oe,icon:"web"===h?null==he?void 0:he.webCitationIcon:"doc"===h?null==he?void 0:he.fileCitationIcon:n.jsx(n.Fragment,{}),customStyles:"web"===h?null==P?void 0:P.webButton:"doc"===h?null==P?void 0:P.docButton:{}}):null},upt:t=>{var i,{node:o,children:l}=t,s=e.__rest(t,["node","children"]);const d=null==s?void 0:s.id,r=d?null===(i=d.split("$"))||void 0===i?void 0:i[1]:null,a=se.find(e=>e.id.toString()===r);return a?n.jsx(n.Fragment,{children:n.jsx(b.default,Object.assign({aiReason:a,customStyles:null==P?void 0:P.inlineUpdatedComponent,handleClickCognitiveDecision:null==ie?void 0:ie.handleClickCognitiveDecision,handleClickUpdatedPill:null==ie?void 0:ie.handleClickUpdatedPill,handleClickOutputValue:null==ie?void 0:ie.handleClickOutputValue,customIcons:null==ie?void 0:ie.customIcons,CDNeededInChip:Y},{children:l}))}):l},del:t=>{var i,o,s,d,{node:r,children:a}=t,c=e.__rest(t,["node","children"]);const u=c.aireason,g=u&&(null===(i=u.deviation_details)||void 0===i?void 0:i.resolved)&&("rejected"===(null===(o=u.deviation_details)||void 0===o?void 0:o.resolved)||"reverted"===(null===(s=u.deviation_details)||void 0===s?void 0:s.resolved)),{cleanedChildren:v,extractedNodes:h}=T(a,["ins"]);return n.jsxs(n.Fragment,{children:[n.jsx("span",Object.assign({className:l.default.deleted,style:Object.assign(Object.assign({},null!==(d=null==P?void 0:P.deleted)&&void 0!==d?d:{}),{textDecoration:g?"none":"line-through"})},c,{onClick:c.onclick},{children:v})),h]})},ins:t=>{var{children:i}=t,o=e.__rest(t,["children"]);const{cleanedChildren:s,extractedNodes:d}=T(i,["del"]);return n.jsxs(n.Fragment,{children:[n.jsx("span",Object.assign({className:l.default.inserted,style:null==P?void 0:P.inserted},o,{onClick:o.onclick},{children:s})),d]})},preserved:t=>{var{children:i}=t,o=e.__rest(t,["children"]);return n.jsx("span",Object.assign({className:l.default.preserved,style:null==P?void 0:P.preserved},o,{onClick:o.onclick},{children:i}))},h1:t=>{var i=e.__rest(t,["node"]);return n.jsx("h1",Object.assign({className:l.default.heading1,style:null==P?void 0:P.heading1},{children:i.children}))},h2:t=>{var i=e.__rest(t,["node"]);return n.jsx("h2",Object.assign({className:l.default.heading2,style:null==P?void 0:P.heading2},{children:i.children}))},h3:t=>{var i=e.__rest(t,["node"]);return n.jsx("h3",Object.assign({className:l.default.heading3,style:null==P?void 0:P.heading3},{children:i.children}))},b:t=>{var i=e.__rest(t,["node"]);return n.jsx("b",Object.assign({className:l.default.bold,style:null==P?void 0:P.bold},{children:null==i?void 0:i.children}))},p:t=>{var i=e.__rest(t,["node"]);return n.jsx("p",Object.assign({},i,{className:l.default.paragraph,style:null==P?void 0:P.paragraph},{children:i.children}))},updated:t=>{var{node:i}=t,o=e.__rest(t,["node"]);return n.jsx(c.default,Object.assign({},o,{showUserStoryDiff:x,currentUpdatedTagId:fe,setCurrentUpdatedTagId:Ce,userStory:te,setUserStory:le,setAiReasoning:de,node:i,isCraflow:z,onCraAccept:G,onCraReject:Q,diffEditConfig:ve,customStyles:null==P?void 0:P.updatedContent,craFlowConfig:J}))},ol:t=>{var i,o,s,{node:d}=t,r=e.__rest(t,["node"]);const a=null!==(s=null!==(o=null===(i=null==d?void 0:d.properties)||void 0===i?void 0:i.start)&&void 0!==o?o:null==r?void 0:r.start)&&void 0!==s?s:void 0;return n.jsx("ol",Object.assign({className:l.default.orderedList,style:null==P?void 0:P.olist},a?{start:Number(a)}:{},{children:null==r?void 0:r.children}))},ul:t=>{var i=e.__rest(t,["node"]);return n.jsx("ul",Object.assign({className:l.default.unorderedList,style:null==P?void 0:P.ulist},{children:null==i?void 0:i.children}))},table:({children:e})=>n.jsx("div",Object.assign({className:l.default.tableWrapper},{children:n.jsx("table",Object.assign({className:l.default.table,style:null==P?void 0:P.table},{children:e}))})),tr:({node:e,children:t})=>n.jsx(E,{node:e,children:t,customStyles:P}),td:({node:t,children:i})=>{var o;const l=null!==(o=null==t?void 0:t.properties)&&void 0!==o?o:{},{style:s}=l,d=e.__rest(l,["style"]);return n.jsx($.Provider,Object.assign({value:!0},{children:n.jsx("td",Object.assign({},d,{style:s?{cssText:s}:void 0},{children:i}))}))},th:({node:t,children:i})=>{var o;const l=null!==(o=null==t?void 0:t.properties)&&void 0!==o?o:{},{style:s}=l,d=e.__rest(l,["style"]);return n.jsx($.Provider,Object.assign({value:!0},{children:n.jsx("th",Object.assign({},d,{style:s?{cssText:s}:void 0},{children:i}))}))},recommendation:t=>{var i,o=e.__rest(t,["node"]);const l=`The AI has selected this content based on: ${(null===(i=null==o?void 0:o.children)||void 0===i?void 0:i[0])||""}`;return n.jsx(C.default,Object.assign({},o,{customStyles:null==P?void 0:P.recommendationBlock,label:l}))},a:i=>{var o,l,s,{inline:d,children:r,node:a}=i,c=e.__rest(i,["inline","children","node"]);const u=t.useContext($)||"true"==(null==c?void 0:c.table),g=`${null==c?void 0:c.href}`,v=null===(o=g.split("$"))||void 0===o?void 0:o[0],h=null===(l=g.split("$"))||void 0===l?void 0:l[1];if("ai_reasoning"===v){const e=(null!==(s=x?B:se)&&void 0!==s?s:[]).find(e=>e.id.toString()===decodeURIComponent(h)),t=ce.includes(h);if(e){if(u)return n.jsx(q,{aiReason:e,customStyle:null==P?void 0:P.tableAiReasoning,customIcons:he,isHighConfidence:e.relevance_score>=m.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const i=Ne(r),o="source"!==i.trim().toLowerCase();return n.jsx(m.default,{aiReason:e,isSourceHasHighlight:t,inlineLabel:i,isInlineCitation:o,customIcons:he,customStyles:{aiReasoningContent:null==P?void 0:P.aiReasoningContent,aiReasoningAccordion:null==P?void 0:P.aiReasoningAccordion,aiReasoningMarkdown:null==P?void 0:P.aiReasoningMarkdown,aiReasoningPill:null==P?void 0:P.aiReasoningPill,webCitation:null==P?void 0:P.webCitation,stormeeCitation:null==P?void 0:P.stormeeCitation,waveformCitation:null==P?void 0:P.waveformCitation,imageCitation:null==P?void 0:P.imageCitation,fileCitation:null==P?void 0:P.fileCitation,appModCitation:null==P?void 0:P.appModCitation,rcaCitation:null==P?void 0:P.rcaCitation,readFileCitation:null==P?void 0:P.readFileCitation,loadingCitations:null==P?void 0:P.loadingCitations,chatCitation:null==P?void 0:P.chatCitation,bigEnoughCitation:null==P?void 0:P.bigEnoughCitation}})}}return null},code:t=>{var{inline:i,children:o,className:s,node:d}=t;e.__rest(t,["inline","children","className","node"]);return/language-(\w+)/.exec(s||"")||(null==s?void 0:s.includes("language-"))?n.jsx("div",{children:n.jsx("code",Object.assign({className:l.default.blockCode,style:null==P?void 0:P.code},{children:o}))}):n.jsx("code",Object.assign({className:l.default.inlineCode,style:null==P?void 0:P.code},{children:o}))},learned:({children:e})=>n.jsx(r.Tooltip,Object.assign({title:e,placement:"top"},{children:n.jsx(d.Info,{size:16,className:l.default.learned})})),generatedcode:t=>{var i=e.__rest(t,["node"]);const o=(null==i?void 0:i.language)||"python",l=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const t=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(t).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?t(e.props.children):""};n=t(e.children)}}catch(t){console.error("Error decoding generated code:",t),n=String(e.children)}return n})(i);return n.jsx(u.default,{title:"Generated Code",code:l,language:o,customStyles:{pill:null==P?void 0:P.generatedCodePill,content:null==P?void 0:P.generatedCodeContent}})},updatedsegment:t=>{var i,o,l,s,{node:d,children:r}=t,a=e.__rest(t,["node","children"]);const c=`${null===(i=d.position)||void 0===i?void 0:i.start.line}-${null===(o=d.position)||void 0===o?void 0:o.start.column}-${null===(l=d.position)||void 0===l?void 0:l.end.line}-${null===(s=d.position)||void 0===s?void 0:s.end.column}`,u=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(a),g=u?n.jsx("div",{dangerouslySetInnerHTML:{__html:N.default.sanitize(u)}}):n.jsx("div",{children:r});return n.jsx(y.default,{id:c,node:d,children:g,props:a,segmentComponentConfig:ge,customStyles:P,customIcons:F,extractText:Ne,isUpdatedSegment:!0})},segment:t=>{var i,o,l,s,{node:d,children:r}=t,a=e.__rest(t,["node","children"]);const c=`${null===(i=d.position)||void 0===i?void 0:i.start.line}-${null===(o=d.position)||void 0===o?void 0:o.start.column}-${null===(l=d.position)||void 0===l?void 0:l.end.line}-${null===(s=d.position)||void 0===s?void 0:s.end.column}`;return n.jsx(y.default,{id:c,node:d,children:r,props:a,segmentComponentConfig:ge,customStyles:P,customIcons:F,extractText:Ne,blockId:Z})}}),[_e,J,se,V,fe,x,i,F,ae,ce,P,ge,ye,Oe,Z]);return t.useEffect(()=>{if(!ne.current)return;if(!ae.length)return void me();let e;if(0===ce.length||K)requestAnimationFrame(()=>{pe([ae[ue].replace(/\*/g,"")])});else{const n=ne.current,t=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{t.disconnect(),requestAnimationFrame(()=>{pe([ae[ue].replace(/\*/g,"")])})},50)});t.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[ae,ce,ue,K]),n.jsx(k.Provider,Object.assign({value:{expandedInfo:je,setExpanded:we,reasonToRow:be}},{children:n.jsxs("div",Object.assign({ref:ne,className:`${l.default.container} ${"approving"!==p?l.default.wrapper:""} ${M||""}`,style:null==P?void 0:P.container},{children:[a?n.jsx(S.MarkdownContextProvider,{children:n.jsx(R.default,Object.assign({components:Ae,rehypePlugins:[O.default]},{children:ke}))}):o,Ie>0&&X&&n.jsx("div",Object.assign({className:l.default.confidenceScoreContainer,style:null==P?void 0:P.confidenceScoreContainer},{children:n.jsxs("span",Object.assign({className:l.default.confidenceScore,style:null==P?void 0:P.confidenceScore},{children:[n.jsx(f.default,{size:14,color:(null==P?void 0:P.confidenceScoreIconColor)||"#166534"}),Ie,"%"]}))})),A&&n.jsx("div",Object.assign({className:l.default.citationLoader,style:null==P?void 0:P.citationLoaderContainer},{children:n.jsx(g.default,{customStyles:{container:null==P?void 0:P.citationLoadingContainer,icon:null==P?void 0:P.citationLoadingIcon,text:null==P?void 0:P.citationLoadingText}})})),h&&n.jsx("div",Object.assign({style:Object.assign({},null===(ee=null==P?void 0:P.attachedContext)||void 0===ee?void 0:ee.wrapper),className:"flex mt-5"},{children:n.jsx(j.default,{customStyles:null==P?void 0:P.attachedContext,variant:H})}))]}))}))},exports.splitNestedDiffNodes=T;
2
2
  //# sourceMappingURL=UserStoryWithCitation.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as e}from"tslib";import{jsxs as t,jsx as n,Fragment as i}from"react/jsx-runtime";import{useState as l,useRef as o,useEffect as s}from"react";import{ChevronUp as a,ChevronDown as r,ExternalLink as d,Download as c,Share2 as u,Copy as v,LoaderCircle as g,PencilIcon as p,Plus as m,Trash2 as y,X as h,Ellipsis as b,Hourglass as S,Check as f,ChevronUpIcon as C,ChevronDownIcon as j,Info as O,Bookmark as I}from"lucide-react";import N from"showdown";import{Tooltip as w,Menu as E,MenuItem as D}from"@mui/material";import B from"../../icons/Illustration.svg.js";import{v4 as x}from"uuid";import T from"./UserStoryCard.module.css.js";import{formatMarkdown as A,indentMarkdown as P}from"../../utils/helpers.js";import{replaceTitleSection as U}from"../../utils/user-story.utils.js";import k from"../../shared/AtomicButton.js";import R from"../RichTextEditor/RichTextEditor.js";import M from"../userstory-with-citation/UserStoryWithCitation.js";import{SectionStatus as _,useRequirementAI as L}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as z}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as V}from"./TitleEditor/TitleEditor.js";import G from"./ClinicalTrialSection.js";import{CompletionPanel as H}from"../story-screen/CompletionPanel.js";import W from"../../icons/CDIcon.js";const $={[_.WAITING]:"WAITING TO GENERATE",[_.IN_PROGRESS]:"IN PROGRESS",[_.GENERATED]:"GENERATED",[_.FAILED]:"FAILED",[_.GENERATE]:"GENERATE",[_.APPROVED]:"APPROVED"};function F(e){const t=[],i=/<learned>(.*?)<\/learned>/g;let l,o=0,s=0;for(;null!==(l=i.exec(e));){const[,a]=l,r=l.index;r>o&&t.push(n("span",{children:e.slice(o,r)},"text-pre-"+s++)),t.push(n(w,Object.assign({title:a,placement:"top"},{children:n(O,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),`tooltip-${x()}`)),o=i.lastIndex}return o<(null==e?void 0:e.length)&&t.push(n("span",{children:e.slice(o)},"text-post-"+s++)),t}function q(e,t,n){var i;if(!e)return{};if(t)return Object.assign({},e.parentConfig);const l=Object.assign({},e.childConfig);return n&&(null===(i=e.subFeatureOverrides)||void 0===i?void 0:i[n])?Object.assign(Object.assign({},l),e.subFeatureOverrides[n]):l}const Q=({displayName:e})=>{var i;const{customStyles:l}=L(),o=null===(i=null==l?void 0:l.userStoryCardStyles)||void 0===i?void 0:i.showDisplayName;return t("div",Object.assign({className:T.displayName,style:null==o?void 0:o.wrapper},{children:[n(I,{className:T.displayNameIcon,style:null==o?void 0:o.displayNameIcon}),t("span",Object.assign({style:null==o?void 0:o.label},{children:[e,":"]}))]}))},Z=({isUserStoryCurrentlyUpdated:C,artifactId:j,artifactTitleId:O,parentUserStory:I,currentUserStory:J,onUserStoryChange:K,parentIndex:X,currentIndex:Y,enableDownload:ee,isDiffEditReviewMode:te,showUserStoryDiff:ne,handleDownloadUserStory:ie,handleOpenSendDialog:le,updateUserStoryArtifact:oe,selectedArtifactId:se,isDisplayHighlightControl:ae,elementDisplayConfig:re,_resolvedConfig:de,showWrapper:ce=!1,defaultExpanded:ue,actionItemsConfig:ve,onDelete:ge,contextVariant:pe,expandedSubFeatures:me,showDisplayName:ye=!0,allowTitleEdit:he=!0,showConfidenceScore:be=!0,showBorderTop:Se=!0,sectionStatusConfig:fe,showCompletionPanel:Ce=!1,completionPanelConfig:je,showAddSectionButton:Oe=!1,disableEditPlan:Ie=!1,useMuiTooltip:Ne=!1,approveButtonConfig:we,editButtonConfig:Ee,CDNeededInChip:De})=>{var Be,xe,Te,Ae,Pe,Ue,ke,Re,Me,_e,Le,ze,Ve,Ge,He,We,$e,Fe,qe,Qe,Ze,Je,Ke,Xe;const{isLoadingSectionData:Ye=!1,onLoadSectionData:et,status:tt,onStatusClick:nt,completedCount:it,totalCount:lt,isNoDataAvailable:ot=!1}=null!=fe?fe:{},{searchQueryList:st,citations:at,customStyles:rt,customSectionConfig:dt}=L(),ct=null==rt?void 0:rt.userStoryCardStyles,ut=null==ct?void 0:ct.customSectionEditButton,vt=null==ct?void 0:ct.statusStyles,gt=null===(Be=null==rt?void 0:rt.userStoryCardStyles)||void 0===Be?void 0:Be.userStoryEditStyles,pt=null===(xe=null==rt?void 0:rt.userStoryScreenStyles)||void 0===xe?void 0:xe.userStoryContentStyles,mt=null==ct?void 0:ct.progressHeaderStyles,yt=null==ct?void 0:ct.clinicalTrialSectionStyles,ht=null==ct?void 0:ct.CompletionStyles,bt=null==ct?void 0:ct.noDataStyles,St=null==ct?void 0:ct.approveButtonStyles,ft=null!==(Ae=null===(Te=null==dt?void 0:dt.shouldRender)||void 0===Te?void 0:Te.call(dt,J))&&void 0!==Ae&&Ae,Ct=null===(Pe=null==dt?void 0:dt.getValue)||void 0===Pe?void 0:Pe.call(dt,J),jt=null!==(ke=null===(Ue=null==dt?void 0:dt.getFields)||void 0===Ue?void 0:Ue.call(dt,J))&&void 0!==ke?ke:[],Ot=null!==(Re=null==dt?void 0:dt.isEditDisabled)&&void 0!==Re&&Re,It=null!==(_e=null===(Me=null==dt?void 0:dt.isSaving)||void 0===Me?void 0:Me.call(dt,J))&&void 0!==_e&&_e,Nt=((e,t)=>e>=80?null==t?void 0:t.highCompletion:e>=50?null==t?void 0:t.mediumCompletion:null==t?void 0:t.lowCompletion)(null!==(Le=J.completion_percentage)&&void 0!==Le?Le:0,ht),wt={[_.WAITING]:null==vt?void 0:vt.waiting,[_.IN_PROGRESS]:null==vt?void 0:vt.inProgress,[_.GENERATED]:null==vt?void 0:vt.generated,[_.FAILED]:null==vt?void 0:vt.failed,[_.GENERATE]:null==vt?void 0:vt.generate,[_.APPROVED]:null==vt?void 0:vt.approved},[Et,Dt]=l(Object.assign(Object.assign({},structuredClone(J)),{value:A(J.value)||""})),[Bt,xt]=l({userStory:!!J.isDefaultEdit}),[Tt,At]=l(!1),[Pt,Ut]=l(!1),[kt,Rt]=l(null),[Mt,_t]=l(null),{userStory:Lt,customIcons:zt}=L(),[Vt,Gt]=l(null!=ue?ue:""===X||se===J.artifactId||!!J.isDefaultOpen),[Ht,Wt]=l(!1),[$t,Ft]=l(null),[qt,Qt]=l(null),[Zt,Jt]=l(!1),Kt=o(null),Xt=o(null),[Yt,en]=l(!1),[tn,nn]=l(!1),ln=o(null),[on,sn]=l(!1);s(()=>{C&&Gt(C)},[C]),s(()=>{Dt(Object.assign(Object.assign({},structuredClone(J)),{value:A(J.value)||""}))},[J]),s(()=>{st.length>0?Gt(!0):void 0===ue&&se&&Gt(se===J.artifactId)},[st,se,J.artifactId]),s(()=>{me&&me.length>0&&Gt(me.includes(J.artifactId)||""===X||se===J.artifactId||!!J.isDefaultOpen)},[me]);const an=()=>{Ft(null)},rn=()=>{Qt(null)},dn=()=>{Vt&&Bt.userStory&&Xt.current&&!Xt.current.requestClose()||Gt(e=>!e)},cn=()=>e(void 0,void 0,void 0,function*(){var e,t;Jt(!0);try{"userStory"==="userStory"&&(K(Et),console.log("I am changing RTE editor values",Et)),yield null===(e=null==Ee?void 0:Ee.onSaveEditedSection)||void 0===e?void 0:e.call(Ee,Et),yield oe(at,Lt,j,null===(t=ln.current)||void 0===t?void 0:t.signal),K(Object.assign(Object.assign({},Et),{isDefaultEdit:!1})),xt(e=>Object.assign(Object.assign({},e),{userStory:!1}))}finally{Jt(!1)}});const un=null!=(null==J?void 0:J.big_enough)&&!Number.isNaN(J.big_enough)&&!!(null==J?void 0:J.big_enough_decision_factors),vn=null!==(ze=null==J?void 0:J.completion_percentage)&&void 0!==ze?ze:0,gn=!!(null==J?void 0:J.completion_decision_factors),pn=""===X,mn=null!=de?de:q(re,pn),yn=!te&&!ne;return s(()=>{if(!Mt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${Mt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[Mt]),s(()=>{J.isDefaultEdit&&xt(e=>Object.assign(Object.assign({},e),{userStory:!0}))},[J.isDefaultEdit]),t("div",Object.assign({className:T.card,style:null==ct?void 0:ct.cardStyle,id:`story-card-${J.title}`,"data-expanded":Vt},{children:[t("div",Object.assign({className:T.titleSection,style:null==ct?void 0:ct.titleSection},{children:[t("div",Object.assign({className:T.titleRow,style:null==ct?void 0:ct.titleRow,onClick:dn},{children:[t("div",Object.assign({className:T.titleLeft,style:null==ct?void 0:ct.titleLeft,onMouseEnter:()=>en(!0),onMouseLeave:()=>en(!1)},{children:[ye&&n(Q,{displayName:O}),Tt&&yn?n(V,{title:J.title,onSave:t=>((t,n)=>e(void 0,void 0,void 0,function*(){var e;try{let i=Object.assign({},J);J.artifactId===n?i.title=t:i.sub_features=(null===(e=J.sub_features)||void 0===e?void 0:e.map(e=>e.artifactId===n?Object.assign(Object.assign({},e),{title:t}):e))||[],Dt(i),K(i),At(!1)}catch(e){console.error("Failed to save title",e)}}))(t,J.artifactId),onCancel:()=>{At(!1)},inputStyle:null==gt?void 0:gt.inlineTitleInput,confirmButtonStyle:null==gt?void 0:gt.inlineTitleConfirm,cancelButtonStyle:null==gt?void 0:gt.inlineTitleCancel},"inline-title-editor"):t("div",Object.assign({className:T.storyTitleWrapper},{children:[n(w,Object.assign({title:F(J.title),arrow:!0},{children:n("h2",Object.assign({title:Ne?void 0:J.title,className:T.storyTitle,style:null==ct?void 0:ct.storyTitle},{children:F(J.title)}),J.artifactId)})),Ce&&!ft&&(gn?n(H,Object.assign({customIcons:null==zt?void 0:zt.userStoryIcons,customStyles:null==ct?void 0:ct.aiReasoningCitaionStyles,currentUserStory:J,panelStyles:null==ct?void 0:ct.CompletionStyles,onToggleStateChange:nn,completionPanelConfig:je},{children:t("div",Object.assign({style:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",gap:"4px"},null==ht?void 0:ht.badge),Nt)},{children:[t("span",{children:[vn,"% Completed"]}),n("span",Object.assign({style:{display:"flex",alignItems:"center"}},{children:n(W,{color:"currentColor"})})),n(tn?a:r,{size:14,style:null==ht?void 0:ht.chevronStyle})]}))})):n("div",Object.assign({style:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",gap:"4px"},null==ht?void 0:ht.badge),Nt)},{children:t("span",{children:[vn,"% Completed"]})}))),he&&n("button",Object.assign({type:"button",className:T.titleEditButton,style:null==gt?void 0:gt.titleEditButton,onClick:e=>{e.stopPropagation(),At(!0),Vt||Gt(!0)},"aria-label":"Edit title",title:"Edit title"},{children:n("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})}))}))]}))]})),(tt||void 0!==it&&void 0!==lt)&&t("div",Object.assign({className:T.statusContainer},{children:[void 0!==it&&void 0!==lt&&t("div",Object.assign({className:T.completedBadge},{children:["Completed: ",it,"/",lt]})),tt&&n("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),null==nt||nt()},onMouseEnter:()=>sn(!0),onMouseLeave:()=>sn(!1),className:T.statusButton,style:Object.assign(Object.assign({},null===(Ve=wt[tt])||void 0===Ve?void 0:Ve.default),on&&(null===(Ge=wt[tt])||void 0===Ge?void 0:Ge.hover))},{children:$[tt]}))]})),t("div",Object.assign({className:T.titleActions,style:null==ct?void 0:ct.titleActions,onClick:e=>e.stopPropagation()},{children:[(mn.showProgressPercentage||mn.showGapBox)&&ce&&t("div",Object.assign({className:T.progressHeader,style:null==mt?void 0:mt.wrapper},{children:[mn.showProgressPercentage&&t("div",Object.assign({className:T.progressPercentage,style:null==mt?void 0:mt.percentage},{children:[null!==(We=null!==(He=null==J?void 0:J.confidenceScore)&&void 0!==He?He:null==mn?void 0:mn.confidenceValue)&&void 0!==We?We:"0","%"]})),mn.showGapBox&&t("div",Object.assign({className:T.gapBox,style:null==mt?void 0:mt.gapBox},{children:[null!==(Fe=null!==($e=null==J?void 0:J.gapValue)&&void 0!==$e?$e:null==mn?void 0:mn.gapBoxValue)&&void 0!==Fe?Fe:"2"," ","Gaps"]}))]})),un&&n(z,{customIcons:null==zt?void 0:zt.userStoryIcons,customStyles:null==ct?void 0:ct.aiReasoningCitaionStyles,currentUserStory:J,panelStyles:null==ct?void 0:ct.BigEnoughStyles}),!Bt.userStory&&t(i,{children:[!1!==(null==mn?void 0:mn.showShareButton)&&n("button",Object.assign({className:T.iconButton,style:null==ct?void 0:ct.iconButton,onClick:e=>{Ft(e.currentTarget)}},{children:n(d,{size:16})})),t(E,Object.assign({id:"user-story-share-menu",anchorEl:$t,open:!!$t,onClose:()=>Ft(null),style:null==ct?void 0:ct.userStoryShareMenu},{children:[ee&&n(D,Object.assign({style:null==ct?void 0:ct.userStoryMenuItem,onClick:()=>e(void 0,void 0,void 0,function*(){Wt(!0),ie&&(yield Promise.all([ie("pdf"),ie("doc")]),Wt(!1))})},{children:t("div",Object.assign({ref:Kt,className:T.menuItemContent,style:null==ct?void 0:ct.menuItemContent},{children:[n(c,{size:16,color:null==ct?void 0:ct.menuIconColor}),n("p",Object.assign({style:null==ct?void 0:ct.menuLabel},{children:"Download"}))]}))})),n(D,Object.assign({style:null==ct?void 0:ct.userStoryMenuItem,onClick:()=>e(void 0,void 0,void 0,function*(){let e=J;I&&(e=Object.assign(Object.assign({},J),{value:`${U(null==I?void 0:I.value,J.title)} \n${J.value}`})),null==le||le(!0,[e],J.artifactId),an()})},{children:t("div",Object.assign({style:null==ct?void 0:ct.menuItemContent,className:T.menuItemContentPadded},{children:[n(u,{size:16,color:null==ct?void 0:ct.menuIconColor}),n("p",Object.assign({style:null==ct?void 0:ct.menuLabel},{children:"Send"}))]}))})),n(D,Object.assign({style:null==ct?void 0:ct.userStoryMenuItem,onClick:()=>e(void 0,void 0,void 0,function*(){const e=(new N.Converter).makeHtml(A(J.value)||J.value),t=function(e){const t=(new N.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(A(J.value)||J.value),n=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{yield navigator.clipboard.write([n]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{an()}})},{children:t("div",Object.assign({style:null==ct?void 0:ct.menuItemContent,className:T.menuItemContentPadded},{children:[n(v,{size:16,color:null==ct?void 0:ct.menuIconColor}),n("p",Object.assign({style:null==ct?void 0:ct.menuLabel},{children:"Copy"}))]}))}))]}))]}),Bt.userStory&&Vt?n(k,{type:"outline",children:"Cancel",style:null==ct?void 0:ct.cancelButton,onClick:()=>{var e;null===(e=ln.current)||void 0===e||e.abort(),xt(e=>Object.assign(Object.assign({},e),{userStory:!1}))}}):n(i,{}),Bt.userStory&&Vt?n(k,{type:"fill",children:Zt?t("span",Object.assign({className:T.savingSpinner,style:null==ct?void 0:ct.savingSpinner},{children:[n(g,{className:T.spinAnimation,style:null==ct?void 0:ct.spinAnimation}),n("span",{children:"Saving..."})]})):"Save",isDisable:Zt,style:Zt?null==ct?void 0:ct.savingButton:null==ct?void 0:ct.saveButton,onClick:()=>e(void 0,void 0,void 0,function*(){yield cn()})}):!te&&!ne&&!Ie&&Vt&&!1!==(null==mn?void 0:mn.showEditButton)&&n("button",Object.assign({className:T.iconButton,style:null==ct?void 0:ct.editButton,onClick:()=>xt(e=>Object.assign(Object.assign({},e),{userStory:!0}))},{children:n(p,{color:null==ct?void 0:ct.pencilIconColor,size:16})})),Oe&&pn&&Vt&&!te&&!ne&&!1!==(null==mn?void 0:mn.showEditButton)&&t("button",Object.assign({type:"button",className:T.addSectionButton,style:null==gt?void 0:gt.addSectionButton,onClick:e=>{var t,n,i;e.stopPropagation();const l=(null!==(n=null===(t=J.sub_features)||void 0===t?void 0:t.length)&&void 0!==n?n:0)+1,o={artifactId:x(),title:`New Section ${l}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},s=Object.assign(Object.assign({},J),{sub_features:[...null!==(i=J.sub_features)&&void 0!==i?i:[],o]});Dt(s),K(s),Gt(!0),_t(o.title)},"aria-label":"Add section",title:"Add section"},{children:[n(m,{size:14}),n("span",Object.assign({className:T.addSectionLabel},{children:"Add Section"}))]})),!pn&&!te&&!Ie&&!ne&&n("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),null==ge||ge()},className:T.iconButton,style:null==gt?void 0:gt.deleteButton,"aria-label":"Delete section",title:"Delete section"},{children:n(y,{size:16})})),ft&&n("button",Object.assign({type:"button",className:T.iconButton,style:null==ut?void 0:ut.button,disabled:Ot,onClick:e=>{if(e.stopPropagation(),Pt)return Rt(null),void Ut(!1);Rt(structuredClone(null!=Ct?Ct:{})),Gt(!0),Ut(!0)}},{children:Pt?n(h,{size:16,color:null==ct?void 0:ct.pencilIconColor,style:null==ut?void 0:ut.cancelIcon}):n(p,{size:16,color:null==ct?void 0:ct.pencilIconColor,style:null==ut?void 0:ut.editIcon})})),(null==mn?void 0:mn.actionItemsButton)&&t(i,{children:[n("span",Object.assign({className:T.actionItemBtn,style:null==ct?void 0:ct.actionItemBtn,onClick:e=>{e.stopPropagation(),Qt(e.currentTarget)}},{children:n(b,{})})),n(E,Object.assign({id:"user-story-action-menu",anchorEl:qt,open:!!qt,onClose:rn,style:null==ct?void 0:ct.userStoryShareMenu},{children:null==ve?void 0:ve.items.map((e,i)=>n(D,Object.assign({style:null==ct?void 0:ct.userStoryMenuItem,onClick:()=>{e.onclick(J),rn()}},{children:t("div",Object.assign({className:T.menuItemContent,style:Object.assign(Object.assign({},null==ct?void 0:ct.menuItemContent),!e.isActive&&{cursor:"not-allowed",opacity:.5})},{children:[n("span",Object.assign({className:T.menuItemIcon,style:null==ct?void 0:ct.menuItemIcon},{children:e.icon})),n("p",Object.assign({style:null==ct?void 0:ct.menuLabel},{children:e.name})),n("span",{className:T.menuItemRight,style:null==ct?void 0:ct.menuItemRight})]}))}),`action-item-${i}-${e.name}`))}))]}),n("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),dn()},style:null==ct?void 0:ct.chevronButton,className:T.chevronButton},{children:n(Vt?a:r,{className:T.chevronIcon,color:null==ct?void 0:ct.chevronIconColor})}))]}))]})),n("div",{className:T.divider,style:null==ct?void 0:ct.dividerStyle})]})),Vt&&n("div",Object.assign({className:T.cardContent,style:Object.assign(Object.assign({},null==ct?void 0:ct.cardContentStyle),{borderTop:Se?"1px solid #E5E5E5":"none"})},{children:t("div",Ye?Object.assign({className:T.loadingContainer},{children:[n("div",Object.assign({className:T.loadingIconWrapper},{children:n(S,{size:28,color:"#5B3DF5",className:T.spinAnimation})})),t("div",{children:[n("h3",Object.assign({className:T.loadingTitle},{children:"Section generation in progress.."})),n("p",Object.assign({className:T.loadingSubtitle},{children:"This may take a few minutes"}))]}),n("button",Object.assign({type:"button",onClick:()=>null==et?void 0:et(),className:T.viewStatusButton},{children:"View Status"}))]}):ot?Object.assign({className:T.noDataContainer,style:null==bt?void 0:bt.container},{children:[n("img",{src:B,alt:"No data available",className:T.noDataIllustration,style:null==bt?void 0:bt.illustration}),n("h3",Object.assign({className:T.noDataTitle,style:null==bt?void 0:bt.title},{children:"No Data Available for This Section"})),n("p",Object.assign({className:T.noDataSubtitle,style:null==bt?void 0:bt.subtitle},{children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."}))]}):Object.assign({className:T.contentInner,style:null==ct?void 0:ct.contentInner},{children:[t("div",Object.assign({className:T.descriptionSection,style:null==ct?void 0:ct.descriptionSection},{children:[n("div",{className:T.justifyBetween,style:null==ct?void 0:ct.justifyBetween}),Bt.userStory?n(R,{ref:Xt,minHeight:"100%",height:"100%",type:"string",value:A(J.value)||"",handleUpdateState:(e,t)=>{const n=P(t);Dt(e=>Object.assign(Object.assign({},e),{value:n||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:Bt.userStory?"edit":"readOnly",onSaveUnsavedChanges:()=>e(void 0,void 0,void 0,function*(){yield cn(),Gt(!1)}),onDiscardUnsavedChanges:()=>{Dt(Object.assign(Object.assign({},structuredClone(J)),{value:A(J.value)||""})),xt(e=>Object.assign(Object.assign({},e),{userStory:!1})),Gt(!1)},isSavingUnsavedChanges:Zt}):ft?n(G,{styles:yt,fields:jt,readonly:!Pt,isSaving:It,value:null!==(qe=null!=kt?kt:Ct)&&void 0!==qe?qe:{},onChange:Rt,onSave:()=>e(void 0,void 0,void 0,function*(){var e;kt&&(yield null===(e=null==dt?void 0:dt.onSave)||void 0===e?void 0:e.call(dt,J,kt),Rt(null),Ut(!1))}),onCancel:()=>{Rt(null),Ut(!1)}}):t(i,{children:[n(M,{showUserStoryDiff:ne,isParent:""===X,message:A(J.value)||"",artifactId:J.artifactId,customStyles:pt,isDisplayHighlightControl:ae,contextVariant:pe,showConfidenceScore:be,CDNeededInChip:De}),(we||Ee)&&t("div",Object.assign({className:T.actionButtonsContainer,style:null==St?void 0:St.container},{children:[Ee&&!Bt.userStory&&t(i,{children:[n("button",Object.assign({type:"button",className:T.actionButton,style:null==St?void 0:St.button,disabled:Ee.disabled||Ee.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=Ee.onClick)||void 0===t||t.call(Ee),xt(e=>Object.assign(Object.assign({},e),{userStory:!0})),Gt(!0)}},{children:Ee.isLoading?t(i,{children:[n(g,{size:16,className:T.actionButtonSpinner,style:null==St?void 0:St.icon}),n("span",Object.assign({style:null==St?void 0:St.text},{children:null!==(Qe=Ee.label)&&void 0!==Qe?Qe:"Edit"}))]}):t(i,{children:[n(p,{size:16,style:null==St?void 0:St.icon}),n("span",Object.assign({style:null==St?void 0:St.text},{children:null!==(Ze=Ee.label)&&void 0!==Ze?Ze:"Edit"}))]})})),we&&n("span",{className:T.actionButtonDivider})]}),we&&n("button",Object.assign({type:"button",className:T.actionButton,style:null==St?void 0:St.button,disabled:we.disabled||we.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=we.onClick)||void 0===t||t.call(we)}},{children:we.isLoading?t(i,{children:[n(g,{size:16,className:T.actionButtonSpinner,style:null==St?void 0:St.icon}),n("span",Object.assign({style:null==St?void 0:St.text},{children:null!==(Je=we.label)&&void 0!==Je?Je:"Approve"}))]}):t(i,{children:[n(f,{size:16,style:null==St?void 0:St.icon}),n("span",Object.assign({style:null==St?void 0:St.text},{children:null!==(Ke=we.label)&&void 0!==Ke?Ke:"Approve"}))]})}))]}))]})]})),null===(Xe=Et.sub_features)||void 0===Xe?void 0:Xe.map((e,t)=>{const i=q(re,!1,e.artifactId);return n(Z,{artifactId:j,isUserStoryCurrentlyUpdated:C,artifactTitleId:`${O}-${String.fromCharCode(65+t)}`,parentUserStory:J,parentIndex:`${X}${X&&"."}${Y}`,currentIndex:`${t+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const n=[...J.sub_features||[]];n[e]=t,K(Object.assign(Object.assign({},J),{sub_features:n}))})(t,e),enableDownload:!0,isDiffEditReviewMode:te,showUserStoryDiff:ne,updateUserStoryArtifact:oe,handleDownloadUserStory:ie,handleOpenSendDialog:le,isDisplayHighlightControl:ae,elementDisplayConfig:re,_resolvedConfig:i,actionItemsConfig:ve,onDelete:()=>(e=>{const t=(J.sub_features||[]).filter((t,n)=>n!==e),n=Object.assign(Object.assign({},J),{sub_features:t});Dt(n),K(n)})(t),expandedSubFeatures:me,disableEditPlan:Ie,useMuiTooltip:Ne},e.artifactId)})]}))}))]}))},J=({artifactTitleIDs:e,expandedSubFeatures:l,isDiffEditReviewMode:o,showUserStoryDiff:s,updateUserStoryArtifact:a,isUserStoryCurrentlyUpdated:r,artifactId:d,handleOpenSendDialog:c,handleDownloadUserStory:u,selectedArtifactId:v,isDisplayHighlightControl:g,elementDisplayConfig:p,showWrapper:m,actionItemsConfig:y,contextVariant:h,showDisplayName:b,allowTitleEdit:S,showConfidenceScore:f,showBorderTop:O,defaultExpanded:I,showCompletionPanel:N=!1,completionPanelConfig:w,showAddSectionButton:E=!1,disableEditPlan:D=!1,useMuiTooltip:B=!1,approveButtonConfig:x,editButtonConfig:A,CDNeededInChip:P})=>{const{userStory:U,setUserStory:k,customStyles:R,searchQueryList:M,currentHighlightIndex:_,setCurrentHighlightIndex:z,segmentComponentConfig:V,sectionStatusConfig:G}=L(),H=null==R?void 0:R.userStoryCardStyles,W=0===_,$=_===M.length-1;return t("div",Object.assign({className:T.userStoryCardWrapper,style:g?Object.assign(Object.assign({},null==H?void 0:H.userStoryCardWrapper),{position:"relative"}):null==H?void 0:H.userStoryCardWrapper},{children:[g&&n(i,{children:M.length>0&&n("div",Object.assign({className:T.wrapper},{children:n("div",Object.assign({className:T.highlightNavigation},{children:t("div",Object.assign({className:T.navigationContainer},{children:[t("span",Object.assign({className:T.navCounter},{children:[_+1," of ",M.length]})),t("div",Object.assign({className:T.navButtons},{children:[n("button",Object.assign({onClick:()=>{_>0&&z(e=>e-1)},className:T.navButton,disabled:W},{children:n(C,{size:20,className:T.navIcon})})),n("button",Object.assign({onClick:()=>{_<M.length-1&&z(e=>e+1)},className:T.navButton,disabled:$},{children:n(j,{size:20,className:T.navIcon})}))]}))]}))}))}))}),U.map((t,i)=>{const C=q(p,!0);return n(Z,{isUserStoryCurrentlyUpdated:r,artifactId:d,artifactTitleId:e[i]||"",expandedSubFeatures:l,currentUserStory:t,onUserStoryChange:e=>{k(t=>(t[i]=e,[...t]))},parentIndex:"",currentIndex:`${i+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:o,showUserStoryDiff:s,updateUserStoryArtifact:a,handleOpenSendDialog:c,handleDownloadUserStory:u,selectedArtifactId:v,isDisplayHighlightControl:g,elementDisplayConfig:p,_resolvedConfig:C,showWrapper:m,defaultExpanded:I,actionItemsConfig:y,contextVariant:h,showDisplayName:b,allowTitleEdit:S,showConfidenceScore:f,showBorderTop:O,sectionStatusConfig:G,showCompletionPanel:N,completionPanelConfig:w,showAddSectionButton:E,disableEditPlan:D,useMuiTooltip:B,approveButtonConfig:x,CDNeededInChip:P,editButtonConfig:A},t.artifactId)})]}))};export{Z as StoryCard,J as UserStoryCardWrapper,Z as default,F as replaceLearnedTagsWithInfo};
1
+ import{__awaiter as e}from"tslib";import{jsxs as t,jsx as n,Fragment as i}from"react/jsx-runtime";import{useState as l,useRef as o,useEffect as s}from"react";import{ChevronUp as a,ChevronDown as r,ExternalLink as d,Download as c,Share2 as u,Copy as v,LoaderCircle as g,PencilIcon as p,Plus as m,Trash2 as y,X as h,Ellipsis as b,Hourglass as S,Check as f,ChevronUpIcon as C,ChevronDownIcon as j,Info as O,Bookmark as I}from"lucide-react";import N from"showdown";import{Tooltip as w,Menu as E,MenuItem as D}from"@mui/material";import B from"../../icons/Illustration.svg.js";import{v4 as x}from"uuid";import T from"./UserStoryCard.module.css.js";import{formatMarkdown as A,indentMarkdown as P}from"../../utils/helpers.js";import{replaceTitleSection as U}from"../../utils/user-story.utils.js";import k from"../../shared/AtomicButton.js";import R from"../RichTextEditor/RichTextEditor.js";import M from"../userstory-with-citation/UserStoryWithCitation.js";import{SectionStatus as _,useRequirementAI as L}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as z}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as V}from"./TitleEditor/TitleEditor.js";import W from"./ClinicalTrialSection.js";import{CompletionPanel as G}from"../story-screen/CompletionPanel.js";import H from"../../icons/CDIcon.js";const $={[_.WAITING]:"WAITING TO GENERATE",[_.IN_PROGRESS]:"IN PROGRESS",[_.GENERATED]:"GENERATED",[_.FAILED]:"FAILED",[_.GENERATE]:"GENERATE",[_.APPROVED]:"APPROVED"};function F(e){const t=[],i=/<learned>(.*?)<\/learned>/g;let l,o=0,s=0;for(;null!==(l=i.exec(e));){const[,a]=l,r=l.index;r>o&&t.push(n("span",{children:e.slice(o,r)},"text-pre-"+s++)),t.push(n(w,Object.assign({title:a,placement:"top"},{children:n(O,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),`tooltip-${x()}`)),o=i.lastIndex}return o<(null==e?void 0:e.length)&&t.push(n("span",{children:e.slice(o)},"text-post-"+s++)),t}function q(e,t,n){var i;if(!e)return{};if(t)return Object.assign({},e.parentConfig);const l=Object.assign({},e.childConfig);return n&&(null===(i=e.subFeatureOverrides)||void 0===i?void 0:i[n])?Object.assign(Object.assign({},l),e.subFeatureOverrides[n]):l}const Q=({displayName:e})=>{var i;const{customStyles:l}=L(),o=null===(i=null==l?void 0:l.userStoryCardStyles)||void 0===i?void 0:i.showDisplayName;return t("div",Object.assign({className:T.displayName,style:null==o?void 0:o.wrapper},{children:[n(I,{className:T.displayNameIcon,style:null==o?void 0:o.displayNameIcon}),t("span",Object.assign({style:null==o?void 0:o.label},{children:[e,":"]}))]}))},Z=({isUserStoryCurrentlyUpdated:C,artifactId:j,artifactTitleId:O,parentUserStory:I,currentUserStory:J,onUserStoryChange:K,parentIndex:X,currentIndex:Y,enableDownload:ee,isDiffEditReviewMode:te,showUserStoryDiff:ne,handleDownloadUserStory:ie,handleOpenSendDialog:le,updateUserStoryArtifact:oe,selectedArtifactId:se,isDisplayHighlightControl:ae,elementDisplayConfig:re,_resolvedConfig:de,showWrapper:ce=!1,defaultExpanded:ue,actionItemsConfig:ve,onDelete:ge,contextVariant:pe,expandedSubFeatures:me,showDisplayName:ye=!0,allowTitleEdit:he=!0,showConfidenceScore:be=!0,showBorderTop:Se=!0,sectionStatusConfig:fe,showCompletionPanel:Ce=!1,completionPanelConfig:je,showAddSectionButton:Oe=!1,disableEditPlan:Ie=!1,useMuiTooltip:Ne=!1,approveButtonConfig:we,editButtonConfig:Ee,CDNeededInChip:De,blockNumber:Be})=>{var xe,Te,Ae,Pe,Ue,ke,Re,Me,_e,Le,ze,Ve,We,Ge,He,$e,Fe,qe,Qe,Ze,Je,Ke,Xe,Ye;const{isLoadingSectionData:et=!1,onLoadSectionData:tt,status:nt,onStatusClick:it,completedCount:lt,totalCount:ot,isNoDataAvailable:st=!1}=null!=fe?fe:{},{searchQueryList:at,citations:rt,customStyles:dt,customSectionConfig:ct}=L(),ut=null==dt?void 0:dt.userStoryCardStyles,vt=null==ut?void 0:ut.customSectionEditButton,gt=null==ut?void 0:ut.statusStyles,pt=null===(xe=null==dt?void 0:dt.userStoryCardStyles)||void 0===xe?void 0:xe.userStoryEditStyles,mt=null===(Te=null==dt?void 0:dt.userStoryScreenStyles)||void 0===Te?void 0:Te.userStoryContentStyles,yt=null==ut?void 0:ut.progressHeaderStyles,ht=null==ut?void 0:ut.clinicalTrialSectionStyles,bt=null==ut?void 0:ut.CompletionStyles,St=null==ut?void 0:ut.noDataStyles,ft=null==ut?void 0:ut.approveButtonStyles,Ct=null!==(Pe=null===(Ae=null==ct?void 0:ct.shouldRender)||void 0===Ae?void 0:Ae.call(ct,J))&&void 0!==Pe&&Pe,jt=null===(Ue=null==ct?void 0:ct.getValue)||void 0===Ue?void 0:Ue.call(ct,J),Ot=null!==(Re=null===(ke=null==ct?void 0:ct.getFields)||void 0===ke?void 0:ke.call(ct,J))&&void 0!==Re?Re:[],It=null!==(Me=null==ct?void 0:ct.isEditDisabled)&&void 0!==Me&&Me,Nt=null!==(Le=null===(_e=null==ct?void 0:ct.isSaving)||void 0===_e?void 0:_e.call(ct,J))&&void 0!==Le&&Le,wt=((e,t)=>e>=80?null==t?void 0:t.highCompletion:e>=50?null==t?void 0:t.mediumCompletion:null==t?void 0:t.lowCompletion)(null!==(ze=J.completion_percentage)&&void 0!==ze?ze:0,bt),Et={[_.WAITING]:null==gt?void 0:gt.waiting,[_.IN_PROGRESS]:null==gt?void 0:gt.inProgress,[_.GENERATED]:null==gt?void 0:gt.generated,[_.FAILED]:null==gt?void 0:gt.failed,[_.GENERATE]:null==gt?void 0:gt.generate,[_.APPROVED]:null==gt?void 0:gt.approved},[Dt,Bt]=l(Object.assign(Object.assign({},structuredClone(J)),{value:A(J.value)||""})),[xt,Tt]=l({userStory:!!J.isDefaultEdit}),[At,Pt]=l(!1),[Ut,kt]=l(!1),[Rt,Mt]=l(null),[_t,Lt]=l(null),{userStory:zt,customIcons:Vt}=L(),[Wt,Gt]=l(null!=ue?ue:""===X||se===J.artifactId||!!J.isDefaultOpen),[Ht,$t]=l(!1),[Ft,qt]=l(null),[Qt,Zt]=l(null),[Jt,Kt]=l(!1),Xt=o(null),Yt=o(null),[en,tn]=l(!1),[nn,ln]=l(!1),on=o(null),[sn,an]=l(!1);s(()=>{C&&Gt(C)},[C]),s(()=>{Bt(Object.assign(Object.assign({},structuredClone(J)),{value:A(J.value)||""}))},[J]),s(()=>{at.length>0?Gt(!0):void 0===ue&&se&&Gt(se===J.artifactId)},[at,se,J.artifactId]),s(()=>{me&&me.length>0&&Gt(me.includes(J.artifactId)||""===X||se===J.artifactId||!!J.isDefaultOpen)},[me]);const rn=()=>{qt(null)},dn=()=>{Zt(null)},cn=()=>{Wt&&xt.userStory&&Yt.current&&!Yt.current.requestClose()||Gt(e=>!e)},un=()=>e(void 0,void 0,void 0,function*(){var e,t;Kt(!0);try{"userStory"==="userStory"&&(K(Dt),console.log("I am changing RTE editor values",Dt)),yield null===(e=null==Ee?void 0:Ee.onSaveEditedSection)||void 0===e?void 0:e.call(Ee,Dt),yield oe(rt,zt,j,null===(t=on.current)||void 0===t?void 0:t.signal),K(Object.assign(Object.assign({},Dt),{isDefaultEdit:!1})),Tt(e=>Object.assign(Object.assign({},e),{userStory:!1}))}finally{Kt(!1)}});const vn=null!=(null==J?void 0:J.big_enough)&&!Number.isNaN(J.big_enough)&&!!(null==J?void 0:J.big_enough_decision_factors),gn=null!==(Ve=null==J?void 0:J.completion_percentage)&&void 0!==Ve?Ve:0,pn=!!(null==J?void 0:J.completion_decision_factors),mn=""===X,yn=null!=de?de:q(re,mn),hn=!te&&!ne;return s(()=>{if(!_t)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${_t}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[_t]),s(()=>{J.isDefaultEdit&&Tt(e=>Object.assign(Object.assign({},e),{userStory:!0}))},[J.isDefaultEdit]),console.log("block number in userstory card ",Be),t("div",Object.assign({className:T.card,"data-block-id":"user-story-card-wrapper-"+Be,style:null==ut?void 0:ut.cardStyle,id:`story-card-${J.title}`,"data-expanded":Wt},{children:[t("div",Object.assign({className:T.titleSection,style:null==ut?void 0:ut.titleSection},{children:[t("div",Object.assign({className:T.titleRow,style:null==ut?void 0:ut.titleRow,onClick:cn},{children:[t("div",Object.assign({className:T.titleLeft,style:null==ut?void 0:ut.titleLeft,onMouseEnter:()=>tn(!0),onMouseLeave:()=>tn(!1)},{children:[ye&&n(Q,{displayName:O}),At&&hn?n(V,{title:J.title,onSave:t=>((t,n)=>e(void 0,void 0,void 0,function*(){var e;try{let i=Object.assign({},J);J.artifactId===n?i.title=t:i.sub_features=(null===(e=J.sub_features)||void 0===e?void 0:e.map(e=>e.artifactId===n?Object.assign(Object.assign({},e),{title:t}):e))||[],Bt(i),K(i),Pt(!1)}catch(e){console.error("Failed to save title",e)}}))(t,J.artifactId),onCancel:()=>{Pt(!1)},inputStyle:null==pt?void 0:pt.inlineTitleInput,confirmButtonStyle:null==pt?void 0:pt.inlineTitleConfirm,cancelButtonStyle:null==pt?void 0:pt.inlineTitleCancel},"inline-title-editor"):t("div",Object.assign({className:T.storyTitleWrapper},{children:[n(w,Object.assign({title:F(J.title),arrow:!0},{children:n("h2",Object.assign({title:Ne?void 0:J.title,className:T.storyTitle,style:null==ut?void 0:ut.storyTitle},{children:F(J.title)}),J.artifactId)})),Ce&&!Ct&&(pn?n(G,Object.assign({customIcons:null==Vt?void 0:Vt.userStoryIcons,customStyles:null==ut?void 0:ut.aiReasoningCitaionStyles,currentUserStory:J,panelStyles:null==ut?void 0:ut.CompletionStyles,onToggleStateChange:ln,completionPanelConfig:je},{children:t("div",Object.assign({style:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",gap:"4px"},null==bt?void 0:bt.badge),wt)},{children:[t("span",{children:[gn,"% Completed"]}),n("span",Object.assign({style:{display:"flex",alignItems:"center"}},{children:n(H,{color:"currentColor"})})),n(nn?a:r,{size:14,style:null==bt?void 0:bt.chevronStyle})]}))})):n("div",Object.assign({style:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",gap:"4px"},null==bt?void 0:bt.badge),wt)},{children:t("span",{children:[gn,"% Completed"]})}))),he&&n("button",Object.assign({type:"button",className:T.titleEditButton,style:null==pt?void 0:pt.titleEditButton,onClick:e=>{e.stopPropagation(),Pt(!0),Wt||Gt(!0)},"aria-label":"Edit title",title:"Edit title"},{children:n("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})}))}))]}))]})),(nt||void 0!==lt&&void 0!==ot)&&t("div",Object.assign({className:T.statusContainer},{children:[void 0!==lt&&void 0!==ot&&t("div",Object.assign({className:T.completedBadge},{children:["Completed: ",lt,"/",ot]})),nt&&n("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),null==it||it()},onMouseEnter:()=>an(!0),onMouseLeave:()=>an(!1),className:T.statusButton,style:Object.assign(Object.assign({},null===(We=Et[nt])||void 0===We?void 0:We.default),sn&&(null===(Ge=Et[nt])||void 0===Ge?void 0:Ge.hover))},{children:$[nt]}))]})),t("div",Object.assign({className:T.titleActions,style:null==ut?void 0:ut.titleActions,onClick:e=>e.stopPropagation()},{children:[(yn.showProgressPercentage||yn.showGapBox)&&ce&&t("div",Object.assign({className:T.progressHeader,style:null==yt?void 0:yt.wrapper},{children:[yn.showProgressPercentage&&t("div",Object.assign({className:T.progressPercentage,style:null==yt?void 0:yt.percentage},{children:[null!==($e=null!==(He=null==J?void 0:J.confidenceScore)&&void 0!==He?He:null==yn?void 0:yn.confidenceValue)&&void 0!==$e?$e:"0","%"]})),yn.showGapBox&&t("div",Object.assign({className:T.gapBox,style:null==yt?void 0:yt.gapBox},{children:[null!==(qe=null!==(Fe=null==J?void 0:J.gapValue)&&void 0!==Fe?Fe:null==yn?void 0:yn.gapBoxValue)&&void 0!==qe?qe:"2"," ","Gaps"]}))]})),vn&&n(z,{customIcons:null==Vt?void 0:Vt.userStoryIcons,customStyles:null==ut?void 0:ut.aiReasoningCitaionStyles,currentUserStory:J,panelStyles:null==ut?void 0:ut.BigEnoughStyles}),!xt.userStory&&t(i,{children:[!1!==(null==yn?void 0:yn.showShareButton)&&n("button",Object.assign({className:T.iconButton,style:null==ut?void 0:ut.iconButton,onClick:e=>{qt(e.currentTarget)}},{children:n(d,{size:16})})),t(E,Object.assign({id:"user-story-share-menu",anchorEl:Ft,open:!!Ft,onClose:()=>qt(null),style:null==ut?void 0:ut.userStoryShareMenu},{children:[ee&&n(D,Object.assign({style:null==ut?void 0:ut.userStoryMenuItem,onClick:()=>e(void 0,void 0,void 0,function*(){$t(!0),ie&&(yield Promise.all([ie("pdf"),ie("doc")]),$t(!1))})},{children:t("div",Object.assign({ref:Xt,className:T.menuItemContent,style:null==ut?void 0:ut.menuItemContent},{children:[n(c,{size:16,color:null==ut?void 0:ut.menuIconColor}),n("p",Object.assign({style:null==ut?void 0:ut.menuLabel},{children:"Download"}))]}))})),n(D,Object.assign({style:null==ut?void 0:ut.userStoryMenuItem,onClick:()=>e(void 0,void 0,void 0,function*(){let e=J;I&&(e=Object.assign(Object.assign({},J),{value:`${U(null==I?void 0:I.value,J.title)} \n${J.value}`})),null==le||le(!0,[e],J.artifactId),rn()})},{children:t("div",Object.assign({style:null==ut?void 0:ut.menuItemContent,className:T.menuItemContentPadded},{children:[n(u,{size:16,color:null==ut?void 0:ut.menuIconColor}),n("p",Object.assign({style:null==ut?void 0:ut.menuLabel},{children:"Send"}))]}))})),n(D,Object.assign({style:null==ut?void 0:ut.userStoryMenuItem,onClick:()=>e(void 0,void 0,void 0,function*(){const e=(new N.Converter).makeHtml(A(J.value)||J.value),t=function(e){const t=(new N.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(A(J.value)||J.value),n=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{yield navigator.clipboard.write([n]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{rn()}})},{children:t("div",Object.assign({style:null==ut?void 0:ut.menuItemContent,className:T.menuItemContentPadded},{children:[n(v,{size:16,color:null==ut?void 0:ut.menuIconColor}),n("p",Object.assign({style:null==ut?void 0:ut.menuLabel},{children:"Copy"}))]}))}))]}))]}),xt.userStory&&Wt?n(k,{type:"outline",children:"Cancel",style:null==ut?void 0:ut.cancelButton,onClick:()=>{var e;null===(e=on.current)||void 0===e||e.abort(),Tt(e=>Object.assign(Object.assign({},e),{userStory:!1}))}}):n(i,{}),xt.userStory&&Wt?n(k,{type:"fill",children:Jt?t("span",Object.assign({className:T.savingSpinner,style:null==ut?void 0:ut.savingSpinner},{children:[n(g,{className:T.spinAnimation,style:null==ut?void 0:ut.spinAnimation}),n("span",{children:"Saving..."})]})):"Save",isDisable:Jt,style:Jt?null==ut?void 0:ut.savingButton:null==ut?void 0:ut.saveButton,onClick:()=>e(void 0,void 0,void 0,function*(){yield un()})}):!te&&!ne&&!Ie&&Wt&&!1!==(null==yn?void 0:yn.showEditButton)&&n("button",Object.assign({className:T.iconButton,style:null==ut?void 0:ut.editButton,onClick:()=>Tt(e=>Object.assign(Object.assign({},e),{userStory:!0}))},{children:n(p,{color:null==ut?void 0:ut.pencilIconColor,size:16})})),Oe&&mn&&Wt&&!te&&!ne&&!1!==(null==yn?void 0:yn.showEditButton)&&t("button",Object.assign({type:"button",className:T.addSectionButton,style:null==pt?void 0:pt.addSectionButton,onClick:e=>{var t,n,i;e.stopPropagation();const l=(null!==(n=null===(t=J.sub_features)||void 0===t?void 0:t.length)&&void 0!==n?n:0)+1,o={artifactId:x(),title:`New Section ${l}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},s=Object.assign(Object.assign({},J),{sub_features:[...null!==(i=J.sub_features)&&void 0!==i?i:[],o]});Bt(s),K(s),Gt(!0),Lt(o.title)},"aria-label":"Add section",title:"Add section"},{children:[n(m,{size:14}),n("span",Object.assign({className:T.addSectionLabel},{children:"Add Section"}))]})),!mn&&!te&&!Ie&&!ne&&n("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),null==ge||ge()},className:T.iconButton,style:null==pt?void 0:pt.deleteButton,"aria-label":"Delete section",title:"Delete section"},{children:n(y,{size:16})})),Ct&&n("button",Object.assign({type:"button",className:T.iconButton,style:null==vt?void 0:vt.button,disabled:It,onClick:e=>{if(e.stopPropagation(),Ut)return Mt(null),void kt(!1);Mt(structuredClone(null!=jt?jt:{})),Gt(!0),kt(!0)}},{children:Ut?n(h,{size:16,color:null==ut?void 0:ut.pencilIconColor,style:null==vt?void 0:vt.cancelIcon}):n(p,{size:16,color:null==ut?void 0:ut.pencilIconColor,style:null==vt?void 0:vt.editIcon})})),(null==yn?void 0:yn.actionItemsButton)&&t(i,{children:[n("span",Object.assign({className:T.actionItemBtn,style:null==ut?void 0:ut.actionItemBtn,onClick:e=>{e.stopPropagation(),Zt(e.currentTarget)}},{children:n(b,{})})),n(E,Object.assign({id:"user-story-action-menu",anchorEl:Qt,open:!!Qt,onClose:dn,style:null==ut?void 0:ut.userStoryShareMenu},{children:null==ve?void 0:ve.items.map((e,i)=>n(D,Object.assign({style:null==ut?void 0:ut.userStoryMenuItem,onClick:()=>{e.onclick(J),dn()}},{children:t("div",Object.assign({className:T.menuItemContent,style:Object.assign(Object.assign({},null==ut?void 0:ut.menuItemContent),!e.isActive&&{cursor:"not-allowed",opacity:.5})},{children:[n("span",Object.assign({className:T.menuItemIcon,style:null==ut?void 0:ut.menuItemIcon},{children:e.icon})),n("p",Object.assign({style:null==ut?void 0:ut.menuLabel},{children:e.name})),n("span",{className:T.menuItemRight,style:null==ut?void 0:ut.menuItemRight})]}))}),`action-item-${i}-${e.name}`))}))]}),n("button",Object.assign({type:"button",onClick:e=>{e.stopPropagation(),cn()},style:null==ut?void 0:ut.chevronButton,className:T.chevronButton},{children:n(Wt?a:r,{className:T.chevronIcon,color:null==ut?void 0:ut.chevronIconColor})}))]}))]})),n("div",{className:T.divider,style:null==ut?void 0:ut.dividerStyle})]})),Wt&&n("div",Object.assign({className:T.cardContent,style:Object.assign(Object.assign({},null==ut?void 0:ut.cardContentStyle),{borderTop:Se?"1px solid #E5E5E5":"none"})},{children:t("div",et?Object.assign({className:T.loadingContainer},{children:[n("div",Object.assign({className:T.loadingIconWrapper},{children:n(S,{size:28,color:"#5B3DF5",className:T.spinAnimation})})),t("div",{children:[n("h3",Object.assign({className:T.loadingTitle},{children:"Section generation in progress.."})),n("p",Object.assign({className:T.loadingSubtitle},{children:"This may take a few minutes"}))]}),n("button",Object.assign({type:"button",onClick:()=>null==tt?void 0:tt(),className:T.viewStatusButton},{children:"View Status"}))]}):st?Object.assign({className:T.noDataContainer,style:null==St?void 0:St.container},{children:[n("img",{src:B,alt:"No data available",className:T.noDataIllustration,style:null==St?void 0:St.illustration}),n("h3",Object.assign({className:T.noDataTitle,style:null==St?void 0:St.title},{children:"No Data Available for This Section"})),n("p",Object.assign({className:T.noDataSubtitle,style:null==St?void 0:St.subtitle},{children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."}))]}):Object.assign({className:T.contentInner,style:null==ut?void 0:ut.contentInner},{children:[t("div",Object.assign({className:T.descriptionSection,style:null==ut?void 0:ut.descriptionSection},{children:[n("div",{className:T.justifyBetween,style:null==ut?void 0:ut.justifyBetween}),xt.userStory?n(R,{ref:Yt,minHeight:"100%",height:"100%",type:"string",value:A(J.value)||"",handleUpdateState:(e,t)=>{const n=P(t);Bt(e=>Object.assign(Object.assign({},e),{value:n||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:xt.userStory?"edit":"readOnly",onSaveUnsavedChanges:()=>e(void 0,void 0,void 0,function*(){yield un(),Gt(!1)}),onDiscardUnsavedChanges:()=>{Bt(Object.assign(Object.assign({},structuredClone(J)),{value:A(J.value)||""})),Tt(e=>Object.assign(Object.assign({},e),{userStory:!1})),Gt(!1)},isSavingUnsavedChanges:Jt}):Ct?n(W,{styles:ht,fields:Ot,readonly:!Ut,isSaving:Nt,value:null!==(Qe=null!=Rt?Rt:jt)&&void 0!==Qe?Qe:{},onChange:Mt,onSave:()=>e(void 0,void 0,void 0,function*(){var e;Rt&&(yield null===(e=null==ct?void 0:ct.onSave)||void 0===e?void 0:e.call(ct,J,Rt),Mt(null),kt(!1))}),onCancel:()=>{Mt(null),kt(!1)}}):t(i,{children:[n(M,{showUserStoryDiff:ne,isParent:""===X,message:A(J.value)||"",artifactId:J.artifactId,customStyles:mt,isDisplayHighlightControl:ae,contextVariant:pe,showConfidenceScore:be,CDNeededInChip:De,blockId:Be}),(we||Ee)&&t("div",Object.assign({className:T.actionButtonsContainer,style:null==ft?void 0:ft.container},{children:[Ee&&!xt.userStory&&t(i,{children:[n("button",Object.assign({type:"button",className:T.actionButton,style:null==ft?void 0:ft.button,disabled:Ee.disabled||Ee.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=Ee.onClick)||void 0===t||t.call(Ee),Tt(e=>Object.assign(Object.assign({},e),{userStory:!0})),Gt(!0)}},{children:Ee.isLoading?t(i,{children:[n(g,{size:16,className:T.actionButtonSpinner,style:null==ft?void 0:ft.icon}),n("span",Object.assign({style:null==ft?void 0:ft.text},{children:null!==(Ze=Ee.label)&&void 0!==Ze?Ze:"Edit"}))]}):t(i,{children:[n(p,{size:16,style:null==ft?void 0:ft.icon}),n("span",Object.assign({style:null==ft?void 0:ft.text},{children:null!==(Je=Ee.label)&&void 0!==Je?Je:"Edit"}))]})})),we&&n("span",{className:T.actionButtonDivider})]}),we&&n("button",Object.assign({type:"button",className:T.actionButton,style:null==ft?void 0:ft.button,disabled:we.disabled||we.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=we.onClick)||void 0===t||t.call(we)}},{children:we.isLoading?t(i,{children:[n(g,{size:16,className:T.actionButtonSpinner,style:null==ft?void 0:ft.icon}),n("span",Object.assign({style:null==ft?void 0:ft.text},{children:null!==(Ke=we.label)&&void 0!==Ke?Ke:"Approve"}))]}):t(i,{children:[n(f,{size:16,style:null==ft?void 0:ft.icon}),n("span",Object.assign({style:null==ft?void 0:ft.text},{children:null!==(Xe=we.label)&&void 0!==Xe?Xe:"Approve"}))]})}))]}))]})]})),null===(Ye=Dt.sub_features)||void 0===Ye?void 0:Ye.map((e,t)=>{console.log("UserStoryCardWrapper: sub",e);const i=q(re,!1,e.artifactId);return n(Z,{artifactId:j,isUserStoryCurrentlyUpdated:C,artifactTitleId:`${O}-${String.fromCharCode(65+t)}`,parentUserStory:J,parentIndex:`${X}${X&&"."}${Y}`,currentIndex:`${t+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const n=[...J.sub_features||[]];n[e]=t,K(Object.assign(Object.assign({},J),{sub_features:n}))})(t,e),enableDownload:!0,isDiffEditReviewMode:te,showUserStoryDiff:ne,updateUserStoryArtifact:oe,handleDownloadUserStory:ie,handleOpenSendDialog:le,isDisplayHighlightControl:ae,elementDisplayConfig:re,_resolvedConfig:i,actionItemsConfig:ve,onDelete:()=>(e=>{const t=(J.sub_features||[]).filter((t,n)=>n!==e),n=Object.assign(Object.assign({},J),{sub_features:t});Bt(n),K(n)})(t),expandedSubFeatures:me,disableEditPlan:Ie,useMuiTooltip:Ne,blockNumber:e.blockNumber},e.artifactId)})]}))}))]}))},J=({artifactTitleIDs:e,expandedSubFeatures:l,isDiffEditReviewMode:o,showUserStoryDiff:s,updateUserStoryArtifact:a,isUserStoryCurrentlyUpdated:r,artifactId:d,handleOpenSendDialog:c,handleDownloadUserStory:u,selectedArtifactId:v,isDisplayHighlightControl:g,elementDisplayConfig:p,showWrapper:m,actionItemsConfig:y,contextVariant:h,showDisplayName:b,allowTitleEdit:S,showConfidenceScore:f,showBorderTop:O,defaultExpanded:I,showCompletionPanel:N=!1,completionPanelConfig:w,showAddSectionButton:E=!1,disableEditPlan:D=!1,useMuiTooltip:B=!1,approveButtonConfig:x,editButtonConfig:A,CDNeededInChip:P})=>{const{userStory:U,setUserStory:k,customStyles:R,searchQueryList:M,currentHighlightIndex:_,setCurrentHighlightIndex:z,segmentComponentConfig:V,sectionStatusConfig:W}=L(),G=null==R?void 0:R.userStoryCardStyles,H=0===_,$=_===M.length-1;return t("div",Object.assign({className:T.userStoryCardWrapper,style:g?Object.assign(Object.assign({},null==G?void 0:G.userStoryCardWrapper),{position:"relative"}):null==G?void 0:G.userStoryCardWrapper},{children:[g&&n(i,{children:M.length>0&&n("div",Object.assign({className:T.wrapper},{children:n("div",Object.assign({className:T.highlightNavigation},{children:t("div",Object.assign({className:T.navigationContainer},{children:[t("span",Object.assign({className:T.navCounter},{children:[_+1," of ",M.length]})),t("div",Object.assign({className:T.navButtons},{children:[n("button",Object.assign({onClick:()=>{_>0&&z(e=>e-1)},className:T.navButton,disabled:H},{children:n(C,{size:20,className:T.navIcon})})),n("button",Object.assign({onClick:()=>{_<M.length-1&&z(e=>e+1)},className:T.navButton,disabled:$},{children:n(j,{size:20,className:T.navIcon})}))]}))]}))}))}))}),U.map((t,i)=>{console.log("UserStoryCardWrapper: userstory",t);const C=q(p,!0);return n(Z,{isUserStoryCurrentlyUpdated:r,artifactId:d,artifactTitleId:e[i]||"",expandedSubFeatures:l,currentUserStory:t,onUserStoryChange:e=>{k(t=>(t[i]=e,[...t]))},parentIndex:"",currentIndex:`${i+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:o,showUserStoryDiff:s,updateUserStoryArtifact:a,handleOpenSendDialog:c,handleDownloadUserStory:u,selectedArtifactId:v,isDisplayHighlightControl:g,elementDisplayConfig:p,_resolvedConfig:C,showWrapper:m,defaultExpanded:I,actionItemsConfig:y,contextVariant:h,showDisplayName:b,allowTitleEdit:S,showConfidenceScore:f,showBorderTop:O,sectionStatusConfig:W,showCompletionPanel:N,completionPanelConfig:w,showAddSectionButton:E,disableEditPlan:D,useMuiTooltip:B,approveButtonConfig:x,CDNeededInChip:P,editButtonConfig:A},t.artifactId)})]}))};export{Z as StoryCard,J as UserStoryCardWrapper,Z as default,F as replaceLearnedTagsWithInfo};
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as e}from"tslib";import{jsx as n}from"react/jsx-runtime";import t from"./Segment.js";import l from"dompurify";const o=({id:o,children:i,props:d,segmentComponentConfig:a,customStyles:s,customIcons:r,extractText:m,isUpdatedSegment:v=!1})=>{var u,g,c,p,S,h,f,b,y,x,C,D,_;const I=(null==d?void 0:d.id)||"Segment",U=(null==d?void 0:d.decisionstrength)||"80",{segmentDataList:E,getSegmentExampleComponent:F,handleViewGlossary:L,upadatedSegmentDataList:j,handleFetchUpdatedSegmentDetails:O,handleFetchSegmentDetails:R,handleDeleteSegment:k}=a||{},w=v?null==j?void 0:j.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==I?void 0:I.split("-"))||void 0===n?void 0:n[0])}):null==E?void 0:E.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==I?void 0:I.split("-"))||void 0===n?void 0:n[0])}),G={id:I,reason:null!==(u=null==w?void 0:w.reason)&&void 0!==u?u:"",gap:null!==(g=null==w?void 0:w.gap)&&void 0!==g?g:"",explanation:null!==(c=null==w?void 0:w.explanation)&&void 0!==c?c:"",relevance_score:null!==(p=null==w?void 0:w.relevance_score)&&void 0!==p?p:0,isOpen:!1};let T;const V=m(i),W=d["data-table"];let z="";if(W&&!v)try{z=decodeURIComponent(atob(W))}catch(e){console.error("Failed to decode data-table for segment",I,e)}const H=l.sanitize(z),M=()=>n("div",{dangerouslySetInnerHTML:{__html:H}});return w||!R||v||null==R||R(I),I&&w&&F&&!v&&(T=W?n(M,{}):F(I,V,w.segment_type)),n(t,Object.assign({id:I,segmentUUID:o,label:null!==(S=null==w?void 0:w.label)&&void 0!==S?S:null==w?void 0:w.segment_name,decisionStrength:U,aiReason:G,customIcons:r,aiReasoningCitationCustomStyles:s,segmentExampleComponent:T,handleViewGlossary:L,customStyles:{segmentWrapper:null===(h=null==s?void 0:s.segment)||void 0===h?void 0:h.segmentWrapper,container:null===(f=null==s?void 0:s.segment)||void 0===f?void 0:f.container,label:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.label,decisionStrength:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.decisionStrength,buttonContainer:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.buttonContainer,cheveronIcon:null===(C=null==s?void 0:s.segment)||void 0===C?void 0:C.cheveronIcon,segmentExample:null===(D=null==s?void 0:s.segment)||void 0===D?void 0:D.segmentExample,loadingSkeleton:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.SegmentLoadingSkeletonStyles},isUpdatedSegment:v,onOpen:()=>e(void 0,void 0,void 0,function*(){!w&&v&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),yield null==O?void 0:O(I))}),onDelete:e=>{if(w)return null==k?void 0:k(e,w)}},{children:i}),I)};export{o as default};
1
+ import{__awaiter as e}from"tslib";import{jsx as n}from"react/jsx-runtime";import l from"./Segment.js";import t from"dompurify";const o=({id:o,children:i,props:d,segmentComponentConfig:a,customStyles:s,customIcons:r,extractText:m,isUpdatedSegment:v=!1,blockId:u})=>{var g,c,p,S,h,f,b,y,x,C,D,I,_;const U=(null==d?void 0:d.id)||"Segment",E=(null==d?void 0:d.decisionstrength)||"80",{segmentDataList:F,getSegmentExampleComponent:L,handleViewGlossary:j,upadatedSegmentDataList:k,handleFetchUpdatedSegmentDetails:O,handleFetchSegmentDetails:R,handleDeleteSegment:W}=a||{},w=v?null==k?void 0:k.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==U?void 0:U.split("-"))||void 0===n?void 0:n[0])}):null==F?void 0:F.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==U?void 0:U.split("-"))||void 0===n?void 0:n[0])}),G={id:U,reason:null!==(g=null==w?void 0:w.reason)&&void 0!==g?g:"",gap:null!==(c=null==w?void 0:w.gap)&&void 0!==c?c:"",explanation:null!==(p=null==w?void 0:w.explanation)&&void 0!==p?p:"",relevance_score:null!==(S=null==w?void 0:w.relevance_score)&&void 0!==S?S:0,isOpen:!1};let T;const V=m(i),z=d["data-table"];let H="";if(z&&!v)try{H=decodeURIComponent(atob(z))}catch(e){console.error("Failed to decode data-table for segment",U,e)}const M=t.sanitize(H),q=()=>n("div",{dangerouslySetInnerHTML:{__html:M}});return w||!R||v||null==R||R(U),U&&w&&L&&!v&&(T=z?n(q,{}):L(U,V,w.segment_type)),n(l,Object.assign({id:U,segmentUUID:o,label:null!==(h=null==w?void 0:w.label)&&void 0!==h?h:null==w?void 0:w.segment_name,decisionStrength:E,aiReason:G,customIcons:r,aiReasoningCitationCustomStyles:s,segmentExampleComponent:T,handleViewGlossary:j,customStyles:{segmentWrapper:null===(f=null==s?void 0:s.segment)||void 0===f?void 0:f.segmentWrapper,container:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.container,label:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.label,decisionStrength:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.decisionStrength,buttonContainer:null===(C=null==s?void 0:s.segment)||void 0===C?void 0:C.buttonContainer,cheveronIcon:null===(D=null==s?void 0:s.segment)||void 0===D?void 0:D.cheveronIcon,segmentExample:null===(I=null==s?void 0:s.segment)||void 0===I?void 0:I.segmentExample,loadingSkeleton:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.SegmentLoadingSkeletonStyles},isUpdatedSegment:v,onOpen:()=>e(void 0,void 0,void 0,function*(){!w&&v&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),yield null==O?void 0:O(U))}),onDelete:e=>{if(console.log("SegmentWrapper: onDelete",e,w,u),w)return null==W?void 0:W(e,w,u)}},{children:i}),U)};export{o as default};
2
2
  //# sourceMappingURL=SegmentWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as e}from"tslib";import{jsx as n,Fragment as i,jsxs as o}from"react/jsx-runtime";import t,{createContext as l,useRef as r,useState as d,useCallback as a,useMemo as s,useEffect as c,useContext as u}from"react";import g from"react-markdown";import v from"rehype-raw";import p from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as h}from"../../shared/useMarkdownSearch.js";import{Info as m}from"lucide-react";import{Tooltip as C}from"@mui/material";import f from"dompurify";import b from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as S}from"../RequirementAIWrapper/RequirementAIWrapper.js";import j from"../../icons/CognitiveDecision.js";import I from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as $}from"../ai-reasoning/AiReasoningCitation.js";import O from"../../icons/RelevanceScoreIcon.js";import x from"../RecommendationBlock/RecommendationBlock.js";import N from"../UserStoryCard/AttachedContext.js";import k from"../ai-reasoning/AiReasoningCitationContent.js";import A from"./components/InlineUpdatedComponent.js";import U from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as E}from"../../store/markdown-context.js";import L from"./components/HighlightButtonComponent.js";const T=l(!1),_=l({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),D=l({rowId:""}),M=({aiReason:e,isHighConfidence:i,customStyle:t,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=u(_),{rowId:c}=u(D),g=String(e.id);c&&s.current.set(g,c);const v=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===e.id,h=i?(null==l?void 0:l.highConfidence)||n(j,{}):(null==l?void 0:l.lowConfidence)||n(I,{});return o("button",Object.assign({className:p.aiReasoningButton,style:t,onClick:n=>{n.stopPropagation(),n.preventDefault(),a(v?null:c,v?null:e)}},{children:[h,n("i",v?{className:`pi pi-angle-up ${i?p.aiReasoningIconHighConfidence:p.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${i?p.aiReasoningIconHighConfidence:p.aiReasoningIconLowConfidence}`})]}))},P=({children:e,node:i,customStyles:t,customIcons:l})=>{var d,a;const s=r(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=u(_),g=(null==c?void 0:c.rowId)===s,v=Array.isArray(null==i?void 0:i.children)?i.children.filter(e=>"element"===e.type).length:1,h=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return o(D.Provider,Object.assign({value:{rowId:s}},{children:[n("tr",Object.assign({style:h?{cssText:h}:void 0},{children:e})),g&&(null==c?void 0:c.aiReason)&&n("tr",Object.assign({style:{width:"100%"}},{children:n("td",Object.assign({colSpan:v||1,className:p.tableExpandedCell},{children:n("div",Object.assign({className:p.tableExpandedCellInner},{children:n("div",Object.assign({className:p.tableExpandedCellContent},{children:n(k,{aiReason:c.aiReason,customIcons:l,customStyles:{aiReasoningContent:null==t?void 0:t.aiReasoningContent,aiReasoningAccordion:null==t?void 0:t.aiReasoningAccordion,aiReasoningMarkdown:null==t?void 0:t.aiReasoningMarkdown,aiReasoningPill:null==t?void 0:t.aiReasoningPill,webCitation:null==t?void 0:t.webCitation,stormeeCitation:null==t?void 0:t.stormeeCitation,waveformCitation:null==t?void 0:t.waveformCitation,imageCitation:null==t?void 0:t.imageCitation,fileCitation:null==t?void 0:t.fileCitation,appModCitation:null==t?void 0:t.appModCitation,rcaCitation:null==t?void 0:t.rcaCitation,readFileCitation:null==t?void 0:t.readFileCitation,loadingCitations:null==t?void 0:t.loadingCitations,chatCitation:null==t?void 0:t.chatCitation}})}))}))}))}))]}))};const H=["del","ins"];function F(e){return function(e,n,i){const o=n.join("|");return e.replace(new RegExp(`<(${o})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,o)=>`<${n}>${i(o)}</${n}>`)}(e,H,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var o;return`<code>${t=null!==(o=n[Number(i)])&&void 0!==o?o:"",t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var t})}(e)).join(""))}const B=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function V(e,n){const i=[],o=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!t.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(o.has(d))return i.push(e),null;if(B.has(d))return e;const a=null===(r=t.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?t.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const q=({message:l,noMarkdownContent:j,useMarkdown:I=!0,isParent:k,scenario:D,showUserStoryDiff:H=!1,aiReasoningsForBlock:B,isCitationLoadingDisplay:q=!1,className:z,highConfidenceIcon:W,lowConfidenceIcon:G,customStyles:Q,customIcons:J,contextVariant:K,aiReasoningDiffView:X,userStoryCitations:Y,artifactId:Z,isCraflow:ee,onCraAccept:ne,onCraReject:ie,craFlowConfig:oe,isDisplayHighlightControl:te=!1,showConfidenceScore:le=!0,CDNeededInChip:re})=>{var de;const ae=r(null),{userStory:se,inlineUpdateComponentConfig:ce,getAvgScoreForStory:ue,setUserStory:ge,aiReasoning:ve,setAiReasoning:pe,customIcons:he,searchQueryList:me,searchQueryReasoningIdList:Ce,currentHighlightIndex:fe,segmentComponentConfig:be,diffEditConfig:ye}=S(),we=null!=J?J:null==he?void 0:he.userStoryIcons;null==Q||Q.searchHighlight;const{search:Se,clear:je}=h(ae),[Ie,Re]=d("1"),[$e,Oe]=d(null),xe=r(new Map),[Ne,ke]=d(new Set),Ae=a((e,n)=>{Oe(e&&n?{rowId:e,aiReason:n}:null)},[]),Ue=Z?ue(Z):0,[Ee,Le]=d([]),Te=a(e=>{ke(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),_e=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(_e).join(""):t.isValidElement(e)?_e(e.props.children):"",De=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,o,t)=>{const l=o.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,o,t)=>{const l=n.substring(0,t),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=o;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let o;const t=new RegExp(n.source,n.flags);for(;null!==(o=t.exec(e));){const e=o[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),t=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:o.index,endIndex:o.index+o[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==t?void 0:t[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],o=n.changedItemCount-n.deletedItemCount;if(0===o)continue;const t=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of t){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+o}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=F(n),n},Me=s(()=>l?De(l):l,[l]);c(()=>{Le(B||ve)},[B,ve]);const Pe=s(()=>({span:i=>{var o,t,l,r,d,{node:a,children:s}=i,c=e(i,["node","children"]);const u=null!==(t=null===(o=null==a?void 0:a.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==t?t:null==c?void 0:c["highlight-id"],g="string"==typeof u&&Ne.has(u),v=null!==(r=null===(l=null==a?void 0:a.properties)||void 0===l?void 0:l["highlight-color"])&&void 0!==r?r:null==c?void 0:c["highlight-color"];return n("span",Object.assign({style:Object.assign(Object.assign({},null!==(d=null==Q?void 0:Q.span)&&void 0!==d?d:{}),g?{backgroundColor:v||"#fef08a"}:{})},{children:s}))},button:o=>{var t,l,r,d,a,s,{node:c,children:u}=o,g=e(o,["node","children"]);const v=null!==(l=null===(t=null==c?void 0:c.properties)||void 0===t?void 0:t.action)&&void 0!==l?l:null==g?void 0:g.action,p=null!==(d=null===(r=null==c?void 0:c.properties)||void 0===r?void 0:r["highlight-id"])&&void 0!==d?d:null==g?void 0:g["highlight-id"],h=null!==(s=null===(a=null==c?void 0:c.properties)||void 0===a?void 0:a["highlight-type"])&&void 0!==s?s:null==g?void 0:g["highlight-type"];return"highlight"===v?n(L,{highlightId:p,handleHighlightSpan:Te,icon:"web"===h?null==we?void 0:we.webCitationIcon:"doc"===h?null==we?void 0:we.fileCitationIcon:n(i,{}),customStyles:"web"===h?null==Q?void 0:Q.webButton:"doc"===h?null==Q?void 0:Q.docButton:{}}):null},upt:o=>{var t,{node:l,children:r}=o,d=e(o,["node","children"]);const a=null==d?void 0:d.id,s=a?null===(t=a.split("$"))||void 0===t?void 0:t[1]:null,c=ve.find(e=>e.id.toString()===s);return c?n(i,{children:n(A,Object.assign({aiReason:c,customStyles:null==Q?void 0:Q.inlineUpdatedComponent,handleClickCognitiveDecision:null==ce?void 0:ce.handleClickCognitiveDecision,handleClickUpdatedPill:null==ce?void 0:ce.handleClickUpdatedPill,handleClickOutputValue:null==ce?void 0:ce.handleClickOutputValue,customIcons:null==ce?void 0:ce.customIcons,CDNeededInChip:re},{children:r}))}):r},del:t=>{var l,r,d,a,{node:s,children:c}=t,u=e(t,["node","children"]);const g=u.aireason,v=g&&(null===(l=g.deviation_details)||void 0===l?void 0:l.resolved)&&("rejected"===(null===(r=g.deviation_details)||void 0===r?void 0:r.resolved)||"reverted"===(null===(d=g.deviation_details)||void 0===d?void 0:d.resolved)),{cleanedChildren:h,extractedNodes:m}=V(c,["ins"]);return o(i,{children:[n("span",Object.assign({className:p.deleted,style:Object.assign(Object.assign({},null!==(a=null==Q?void 0:Q.deleted)&&void 0!==a?a:{}),{textDecoration:v?"none":"line-through"})},u,{onClick:u.onclick},{children:h})),m]})},ins:t=>{var{children:l}=t,r=e(t,["children"]);const{cleanedChildren:d,extractedNodes:a}=V(l,["del"]);return o(i,{children:[n("span",Object.assign({className:p.inserted,style:null==Q?void 0:Q.inserted},r,{onClick:r.onclick},{children:d})),a]})},preserved:i=>{var{children:o}=i,t=e(i,["children"]);return n("span",Object.assign({className:p.preserved,style:null==Q?void 0:Q.preserved},t,{onClick:t.onclick},{children:o}))},h1:i=>{var o=e(i,["node"]);return n("h1",Object.assign({className:p.heading1,style:null==Q?void 0:Q.heading1},{children:o.children}))},h2:i=>{var o=e(i,["node"]);return n("h2",Object.assign({className:p.heading2,style:null==Q?void 0:Q.heading2},{children:o.children}))},h3:i=>{var o=e(i,["node"]);return n("h3",Object.assign({className:p.heading3,style:null==Q?void 0:Q.heading3},{children:o.children}))},b:i=>{var o=e(i,["node"]);return n("b",Object.assign({className:p.bold,style:null==Q?void 0:Q.bold},{children:null==o?void 0:o.children}))},p:i=>{var o=e(i,["node"]);return n("p",Object.assign({},o,{className:p.paragraph,style:null==Q?void 0:Q.paragraph},{children:o.children}))},updated:i=>{var{node:o}=i,t=e(i,["node"]);return n(b,Object.assign({},t,{showUserStoryDiff:H,currentUpdatedTagId:Ie,setCurrentUpdatedTagId:Re,userStory:se,setUserStory:ge,setAiReasoning:pe,node:o,isCraflow:ee,onCraAccept:ne,onCraReject:ie,diffEditConfig:ye,customStyles:null==Q?void 0:Q.updatedContent,craFlowConfig:oe}))},ol:i=>{var o,t,l,{node:r}=i,d=e(i,["node"]);const a=null!==(l=null!==(t=null===(o=null==r?void 0:r.properties)||void 0===o?void 0:o.start)&&void 0!==t?t:null==d?void 0:d.start)&&void 0!==l?l:void 0;return n("ol",Object.assign({className:p.orderedList,style:null==Q?void 0:Q.olist},a?{start:Number(a)}:{},{children:null==d?void 0:d.children}))},ul:i=>{var o=e(i,["node"]);return n("ul",Object.assign({className:p.unorderedList,style:null==Q?void 0:Q.ulist},{children:null==o?void 0:o.children}))},table:({children:e})=>n("div",Object.assign({className:p.tableWrapper},{children:n("table",Object.assign({className:p.table,style:null==Q?void 0:Q.table},{children:e}))})),tr:({node:e,children:i})=>n(P,{node:e,children:i,customStyles:Q}),td:({node:i,children:o})=>{var t;const l=null!==(t=null==i?void 0:i.properties)&&void 0!==t?t:{},{style:r}=l,d=e(l,["style"]);return n(T.Provider,Object.assign({value:!0},{children:n("td",Object.assign({},d,{style:r?{cssText:r}:void 0},{children:o}))}))},th:({node:i,children:o})=>{var t;const l=null!==(t=null==i?void 0:i.properties)&&void 0!==t?t:{},{style:r}=l,d=e(l,["style"]);return n(T.Provider,Object.assign({value:!0},{children:n("th",Object.assign({},d,{style:r?{cssText:r}:void 0},{children:o}))}))},recommendation:i=>{var o,t=e(i,["node"]);const l=`The AI has selected this content based on: ${(null===(o=null==t?void 0:t.children)||void 0===o?void 0:o[0])||""}`;return n(x,Object.assign({},t,{customStyles:null==Q?void 0:Q.recommendationBlock,label:l}))},a:i=>{var o,t,l,{inline:r,children:d,node:a}=i,s=e(i,["inline","children","node"]);const c=u(T)||"true"==(null==s?void 0:s.table),g=`${null==s?void 0:s.href}`,v=null===(o=g.split("$"))||void 0===o?void 0:o[0],p=null===(t=g.split("$"))||void 0===t?void 0:t[1];if("ai_reasoning"===v){const e=(null!==(l=H?X:ve)&&void 0!==l?l:[]).find(e=>e.id.toString()===decodeURIComponent(p)),i=Ce.includes(p);if(e){if(c)return n(M,{aiReason:e,customStyle:null==Q?void 0:Q.tableAiReasoning,customIcons:we,isHighConfidence:e.relevance_score>=$});const o=_e(d),t="source"!==o.trim().toLowerCase();return n(R,{aiReason:e,isSourceHasHighlight:i,inlineLabel:o,isInlineCitation:t,customIcons:we,customStyles:{aiReasoningContent:null==Q?void 0:Q.aiReasoningContent,aiReasoningAccordion:null==Q?void 0:Q.aiReasoningAccordion,aiReasoningMarkdown:null==Q?void 0:Q.aiReasoningMarkdown,aiReasoningPill:null==Q?void 0:Q.aiReasoningPill,webCitation:null==Q?void 0:Q.webCitation,stormeeCitation:null==Q?void 0:Q.stormeeCitation,waveformCitation:null==Q?void 0:Q.waveformCitation,imageCitation:null==Q?void 0:Q.imageCitation,fileCitation:null==Q?void 0:Q.fileCitation,appModCitation:null==Q?void 0:Q.appModCitation,rcaCitation:null==Q?void 0:Q.rcaCitation,readFileCitation:null==Q?void 0:Q.readFileCitation,loadingCitations:null==Q?void 0:Q.loadingCitations,chatCitation:null==Q?void 0:Q.chatCitation,bigEnoughCitation:null==Q?void 0:Q.bigEnoughCitation}})}}return null},code:i=>{var{inline:o,children:t,className:l,node:r}=i;e(i,["inline","children","className","node"]);return/language-(\w+)/.exec(l||"")||(null==l?void 0:l.includes("language-"))?n("div",{children:n("code",Object.assign({className:p.blockCode,style:null==Q?void 0:Q.code},{children:t}))}):n("code",Object.assign({className:p.inlineCode,style:null==Q?void 0:Q.code},{children:t}))},learned:({children:e})=>n(C,Object.assign({title:e,placement:"top"},{children:n(m,{size:16,className:p.learned})})),generatedcode:i=>{var o=e(i,["node"]);const t=(null==o?void 0:o.language)||"python",l=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=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 n(y,{title:"Generated Code",code:l,language:t,customStyles:{pill:null==Q?void 0:Q.generatedCodePill,content:null==Q?void 0:Q.generatedCodeContent}})},updatedsegment:i=>{var o,t,l,r,{node:d,children:a}=i,s=e(i,["node","children"]);const c=`${null===(o=d.position)||void 0===o?void 0:o.start.line}-${null===(t=d.position)||void 0===t?void 0:t.start.column}-${null===(l=d.position)||void 0===l?void 0:l.end.line}-${null===(r=d.position)||void 0===r?void 0:r.end.column}`,u=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(s),g=n("div",u?{dangerouslySetInnerHTML:{__html:f.sanitize(u)}}:{children:a});return n(U,{id:c,node:d,children:g,props:s,segmentComponentConfig:be,customStyles:Q,customIcons:J,extractText:_e,isUpdatedSegment:!0})},segment:i=>{var o,t,l,r,{node:d,children:a}=i,s=e(i,["node","children"]);const c=`${null===(o=d.position)||void 0===o?void 0:o.start.line}-${null===(t=d.position)||void 0===t?void 0:t.start.column}-${null===(l=d.position)||void 0===l?void 0:l.end.line}-${null===(r=d.position)||void 0===r?void 0:r.end.column}`;return n(U,{id:c,node:d,children:a,props:s,segmentComponentConfig:be,customStyles:Q,customIcons:J,extractText:_e})}}),[Ee,oe,ve,Y,Ie,H,l,J,me,Ce,Q,be,Ne,Te]);return c(()=>{if(!ae.current)return;if(!me.length)return void je();let e;if(0===Ce.length||te)requestAnimationFrame(()=>{Se([me[fe].replace(/\*/g,"")])});else{const n=ae.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{Se([me[fe].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[me,Ce,fe,te]),n(_.Provider,Object.assign({value:{expandedInfo:$e,setExpanded:Ae,reasonToRow:xe}},{children:o("div",Object.assign({ref:ae,className:`${p.container} ${"approving"!==D?p.wrapper:""} ${z||""}`,style:null==Q?void 0:Q.container},{children:[I?n(E,{children:n(g,Object.assign({components:Pe,rehypePlugins:[v]},{children:Me}))}):j,Ue>0&&le&&n("div",Object.assign({className:p.confidenceScoreContainer,style:null==Q?void 0:Q.confidenceScoreContainer},{children:o("span",Object.assign({className:p.confidenceScore,style:null==Q?void 0:Q.confidenceScore},{children:[n(O,{size:14,color:(null==Q?void 0:Q.confidenceScoreIconColor)||"#166534"}),Ue,"%"]}))})),q&&n("div",Object.assign({className:p.citationLoader,style:null==Q?void 0:Q.citationLoaderContainer},{children:n(w,{customStyles:{container:null==Q?void 0:Q.citationLoadingContainer,icon:null==Q?void 0:Q.citationLoadingIcon,text:null==Q?void 0:Q.citationLoadingText}})})),k&&n("div",Object.assign({style:Object.assign({},null===(de=null==Q?void 0:Q.attachedContext)||void 0===de?void 0:de.wrapper),className:"flex mt-5"},{children:n(N,{customStyles:null==Q?void 0:Q.attachedContext,variant:K})}))]}))}))};export{q as default,V as splitNestedDiffNodes};
1
+ import{__rest as e}from"tslib";import{jsx as n,Fragment as i,jsxs as o}from"react/jsx-runtime";import t,{createContext as l,useRef as r,useState as d,useCallback as a,useMemo as s,useEffect as c,useContext as u}from"react";import g from"react-markdown";import v from"rehype-raw";import p from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as h}from"../../shared/useMarkdownSearch.js";import{Info as m}from"lucide-react";import{Tooltip as C}from"@mui/material";import f from"dompurify";import b from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as S}from"../RequirementAIWrapper/RequirementAIWrapper.js";import j from"../../icons/CognitiveDecision.js";import I from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as $}from"../ai-reasoning/AiReasoningCitation.js";import O from"../../icons/RelevanceScoreIcon.js";import x from"../RecommendationBlock/RecommendationBlock.js";import N from"../UserStoryCard/AttachedContext.js";import k from"../ai-reasoning/AiReasoningCitationContent.js";import A from"./components/InlineUpdatedComponent.js";import U from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as E}from"../../store/markdown-context.js";import L from"./components/HighlightButtonComponent.js";const T=l(!1),_=l({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),D=l({rowId:""}),M=({aiReason:e,isHighConfidence:i,customStyle:t,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=u(_),{rowId:c}=u(D),g=String(e.id);c&&s.current.set(g,c);const v=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===e.id,h=i?(null==l?void 0:l.highConfidence)||n(j,{}):(null==l?void 0:l.lowConfidence)||n(I,{});return o("button",Object.assign({className:p.aiReasoningButton,style:t,onClick:n=>{n.stopPropagation(),n.preventDefault(),a(v?null:c,v?null:e)}},{children:[h,n("i",v?{className:`pi pi-angle-up ${i?p.aiReasoningIconHighConfidence:p.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${i?p.aiReasoningIconHighConfidence:p.aiReasoningIconLowConfidence}`})]}))},P=({children:e,node:i,customStyles:t,customIcons:l})=>{var d,a;const s=r(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=u(_),g=(null==c?void 0:c.rowId)===s,v=Array.isArray(null==i?void 0:i.children)?i.children.filter(e=>"element"===e.type).length:1,h=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return o(D.Provider,Object.assign({value:{rowId:s}},{children:[n("tr",Object.assign({style:h?{cssText:h}:void 0},{children:e})),g&&(null==c?void 0:c.aiReason)&&n("tr",Object.assign({style:{width:"100%"}},{children:n("td",Object.assign({colSpan:v||1,className:p.tableExpandedCell},{children:n("div",Object.assign({className:p.tableExpandedCellInner},{children:n("div",Object.assign({className:p.tableExpandedCellContent},{children:n(k,{aiReason:c.aiReason,customIcons:l,customStyles:{aiReasoningContent:null==t?void 0:t.aiReasoningContent,aiReasoningAccordion:null==t?void 0:t.aiReasoningAccordion,aiReasoningMarkdown:null==t?void 0:t.aiReasoningMarkdown,aiReasoningPill:null==t?void 0:t.aiReasoningPill,webCitation:null==t?void 0:t.webCitation,stormeeCitation:null==t?void 0:t.stormeeCitation,waveformCitation:null==t?void 0:t.waveformCitation,imageCitation:null==t?void 0:t.imageCitation,fileCitation:null==t?void 0:t.fileCitation,appModCitation:null==t?void 0:t.appModCitation,rcaCitation:null==t?void 0:t.rcaCitation,readFileCitation:null==t?void 0:t.readFileCitation,loadingCitations:null==t?void 0:t.loadingCitations,chatCitation:null==t?void 0:t.chatCitation}})}))}))}))}))]}))};const H=["del","ins"];function F(e){return function(e,n,i){const o=n.join("|");return e.replace(new RegExp(`<(${o})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,o)=>`<${n}>${i(o)}</${n}>`)}(e,H,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var o;return`<code>${t=null!==(o=n[Number(i)])&&void 0!==o?o:"",t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var t})}(e)).join(""))}const B=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function V(e,n){const i=[],o=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!t.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(o.has(d))return i.push(e),null;if(B.has(d))return e;const a=null===(r=t.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?t.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const q=({message:l,noMarkdownContent:j,useMarkdown:I=!0,isParent:k,scenario:D,showUserStoryDiff:H=!1,aiReasoningsForBlock:B,isCitationLoadingDisplay:q=!1,className:z,highConfidenceIcon:W,lowConfidenceIcon:G,customStyles:Q,customIcons:J,contextVariant:K,aiReasoningDiffView:X,userStoryCitations:Y,artifactId:Z,isCraflow:ee,onCraAccept:ne,onCraReject:ie,craFlowConfig:oe,isDisplayHighlightControl:te=!1,showConfidenceScore:le=!0,CDNeededInChip:re,blockId:de})=>{var ae;console.log("userstorywithcitation blockid ",de);const se=r(null),{userStory:ce,inlineUpdateComponentConfig:ue,getAvgScoreForStory:ge,setUserStory:ve,aiReasoning:pe,setAiReasoning:he,customIcons:me,searchQueryList:Ce,searchQueryReasoningIdList:fe,currentHighlightIndex:be,segmentComponentConfig:ye,diffEditConfig:we}=S(),Se=null!=J?J:null==me?void 0:me.userStoryIcons;null==Q||Q.searchHighlight;const{search:je,clear:Ie}=h(se),[Re,$e]=d("1"),[Oe,xe]=d(null),Ne=r(new Map),[ke,Ae]=d(new Set),Ue=a((e,n)=>{xe(e&&n?{rowId:e,aiReason:n}:null)},[]),Ee=Z?ge(Z):0,[Le,Te]=d([]),_e=a(e=>{Ae(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),De=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(De).join(""):t.isValidElement(e)?De(e.props.children):"",Me=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,o,t)=>{const l=o.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,o,t)=>{const l=n.substring(0,t),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=o;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let o;const t=new RegExp(n.source,n.flags);for(;null!==(o=t.exec(e));){const e=o[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),t=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:o.index,endIndex:o.index+o[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==t?void 0:t[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],o=n.changedItemCount-n.deletedItemCount;if(0===o)continue;const t=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of t){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+o}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=F(n),n},Pe=s(()=>l?Me(l):l,[l]);c(()=>{Te(B||pe)},[B,pe]);const He=s(()=>({span:i=>{var o,t,l,r,d,{node:a,children:s}=i,c=e(i,["node","children"]);const u=null!==(t=null===(o=null==a?void 0:a.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==t?t:null==c?void 0:c["highlight-id"],g="string"==typeof u&&ke.has(u),v=null!==(r=null===(l=null==a?void 0:a.properties)||void 0===l?void 0:l["highlight-color"])&&void 0!==r?r:null==c?void 0:c["highlight-color"];return n("span",Object.assign({style:Object.assign(Object.assign({},null!==(d=null==Q?void 0:Q.span)&&void 0!==d?d:{}),g?{backgroundColor:v||"#fef08a"}:{})},{children:s}))},button:o=>{var t,l,r,d,a,s,{node:c,children:u}=o,g=e(o,["node","children"]);const v=null!==(l=null===(t=null==c?void 0:c.properties)||void 0===t?void 0:t.action)&&void 0!==l?l:null==g?void 0:g.action,p=null!==(d=null===(r=null==c?void 0:c.properties)||void 0===r?void 0:r["highlight-id"])&&void 0!==d?d:null==g?void 0:g["highlight-id"],h=null!==(s=null===(a=null==c?void 0:c.properties)||void 0===a?void 0:a["highlight-type"])&&void 0!==s?s:null==g?void 0:g["highlight-type"];return"highlight"===v?n(L,{highlightId:p,handleHighlightSpan:_e,icon:"web"===h?null==Se?void 0:Se.webCitationIcon:"doc"===h?null==Se?void 0:Se.fileCitationIcon:n(i,{}),customStyles:"web"===h?null==Q?void 0:Q.webButton:"doc"===h?null==Q?void 0:Q.docButton:{}}):null},upt:o=>{var t,{node:l,children:r}=o,d=e(o,["node","children"]);const a=null==d?void 0:d.id,s=a?null===(t=a.split("$"))||void 0===t?void 0:t[1]:null,c=pe.find(e=>e.id.toString()===s);return c?n(i,{children:n(A,Object.assign({aiReason:c,customStyles:null==Q?void 0:Q.inlineUpdatedComponent,handleClickCognitiveDecision:null==ue?void 0:ue.handleClickCognitiveDecision,handleClickUpdatedPill:null==ue?void 0:ue.handleClickUpdatedPill,handleClickOutputValue:null==ue?void 0:ue.handleClickOutputValue,customIcons:null==ue?void 0:ue.customIcons,CDNeededInChip:re},{children:r}))}):r},del:t=>{var l,r,d,a,{node:s,children:c}=t,u=e(t,["node","children"]);const g=u.aireason,v=g&&(null===(l=g.deviation_details)||void 0===l?void 0:l.resolved)&&("rejected"===(null===(r=g.deviation_details)||void 0===r?void 0:r.resolved)||"reverted"===(null===(d=g.deviation_details)||void 0===d?void 0:d.resolved)),{cleanedChildren:h,extractedNodes:m}=V(c,["ins"]);return o(i,{children:[n("span",Object.assign({className:p.deleted,style:Object.assign(Object.assign({},null!==(a=null==Q?void 0:Q.deleted)&&void 0!==a?a:{}),{textDecoration:v?"none":"line-through"})},u,{onClick:u.onclick},{children:h})),m]})},ins:t=>{var{children:l}=t,r=e(t,["children"]);const{cleanedChildren:d,extractedNodes:a}=V(l,["del"]);return o(i,{children:[n("span",Object.assign({className:p.inserted,style:null==Q?void 0:Q.inserted},r,{onClick:r.onclick},{children:d})),a]})},preserved:i=>{var{children:o}=i,t=e(i,["children"]);return n("span",Object.assign({className:p.preserved,style:null==Q?void 0:Q.preserved},t,{onClick:t.onclick},{children:o}))},h1:i=>{var o=e(i,["node"]);return n("h1",Object.assign({className:p.heading1,style:null==Q?void 0:Q.heading1},{children:o.children}))},h2:i=>{var o=e(i,["node"]);return n("h2",Object.assign({className:p.heading2,style:null==Q?void 0:Q.heading2},{children:o.children}))},h3:i=>{var o=e(i,["node"]);return n("h3",Object.assign({className:p.heading3,style:null==Q?void 0:Q.heading3},{children:o.children}))},b:i=>{var o=e(i,["node"]);return n("b",Object.assign({className:p.bold,style:null==Q?void 0:Q.bold},{children:null==o?void 0:o.children}))},p:i=>{var o=e(i,["node"]);return n("p",Object.assign({},o,{className:p.paragraph,style:null==Q?void 0:Q.paragraph},{children:o.children}))},updated:i=>{var{node:o}=i,t=e(i,["node"]);return n(b,Object.assign({},t,{showUserStoryDiff:H,currentUpdatedTagId:Re,setCurrentUpdatedTagId:$e,userStory:ce,setUserStory:ve,setAiReasoning:he,node:o,isCraflow:ee,onCraAccept:ne,onCraReject:ie,diffEditConfig:we,customStyles:null==Q?void 0:Q.updatedContent,craFlowConfig:oe}))},ol:i=>{var o,t,l,{node:r}=i,d=e(i,["node"]);const a=null!==(l=null!==(t=null===(o=null==r?void 0:r.properties)||void 0===o?void 0:o.start)&&void 0!==t?t:null==d?void 0:d.start)&&void 0!==l?l:void 0;return n("ol",Object.assign({className:p.orderedList,style:null==Q?void 0:Q.olist},a?{start:Number(a)}:{},{children:null==d?void 0:d.children}))},ul:i=>{var o=e(i,["node"]);return n("ul",Object.assign({className:p.unorderedList,style:null==Q?void 0:Q.ulist},{children:null==o?void 0:o.children}))},table:({children:e})=>n("div",Object.assign({className:p.tableWrapper},{children:n("table",Object.assign({className:p.table,style:null==Q?void 0:Q.table},{children:e}))})),tr:({node:e,children:i})=>n(P,{node:e,children:i,customStyles:Q}),td:({node:i,children:o})=>{var t;const l=null!==(t=null==i?void 0:i.properties)&&void 0!==t?t:{},{style:r}=l,d=e(l,["style"]);return n(T.Provider,Object.assign({value:!0},{children:n("td",Object.assign({},d,{style:r?{cssText:r}:void 0},{children:o}))}))},th:({node:i,children:o})=>{var t;const l=null!==(t=null==i?void 0:i.properties)&&void 0!==t?t:{},{style:r}=l,d=e(l,["style"]);return n(T.Provider,Object.assign({value:!0},{children:n("th",Object.assign({},d,{style:r?{cssText:r}:void 0},{children:o}))}))},recommendation:i=>{var o,t=e(i,["node"]);const l=`The AI has selected this content based on: ${(null===(o=null==t?void 0:t.children)||void 0===o?void 0:o[0])||""}`;return n(x,Object.assign({},t,{customStyles:null==Q?void 0:Q.recommendationBlock,label:l}))},a:i=>{var o,t,l,{inline:r,children:d,node:a}=i,s=e(i,["inline","children","node"]);const c=u(T)||"true"==(null==s?void 0:s.table),g=`${null==s?void 0:s.href}`,v=null===(o=g.split("$"))||void 0===o?void 0:o[0],p=null===(t=g.split("$"))||void 0===t?void 0:t[1];if("ai_reasoning"===v){const e=(null!==(l=H?X:pe)&&void 0!==l?l:[]).find(e=>e.id.toString()===decodeURIComponent(p)),i=fe.includes(p);if(e){if(c)return n(M,{aiReason:e,customStyle:null==Q?void 0:Q.tableAiReasoning,customIcons:Se,isHighConfidence:e.relevance_score>=$});const o=De(d),t="source"!==o.trim().toLowerCase();return n(R,{aiReason:e,isSourceHasHighlight:i,inlineLabel:o,isInlineCitation:t,customIcons:Se,customStyles:{aiReasoningContent:null==Q?void 0:Q.aiReasoningContent,aiReasoningAccordion:null==Q?void 0:Q.aiReasoningAccordion,aiReasoningMarkdown:null==Q?void 0:Q.aiReasoningMarkdown,aiReasoningPill:null==Q?void 0:Q.aiReasoningPill,webCitation:null==Q?void 0:Q.webCitation,stormeeCitation:null==Q?void 0:Q.stormeeCitation,waveformCitation:null==Q?void 0:Q.waveformCitation,imageCitation:null==Q?void 0:Q.imageCitation,fileCitation:null==Q?void 0:Q.fileCitation,appModCitation:null==Q?void 0:Q.appModCitation,rcaCitation:null==Q?void 0:Q.rcaCitation,readFileCitation:null==Q?void 0:Q.readFileCitation,loadingCitations:null==Q?void 0:Q.loadingCitations,chatCitation:null==Q?void 0:Q.chatCitation,bigEnoughCitation:null==Q?void 0:Q.bigEnoughCitation}})}}return null},code:i=>{var{inline:o,children:t,className:l,node:r}=i;e(i,["inline","children","className","node"]);return/language-(\w+)/.exec(l||"")||(null==l?void 0:l.includes("language-"))?n("div",{children:n("code",Object.assign({className:p.blockCode,style:null==Q?void 0:Q.code},{children:t}))}):n("code",Object.assign({className:p.inlineCode,style:null==Q?void 0:Q.code},{children:t}))},learned:({children:e})=>n(C,Object.assign({title:e,placement:"top"},{children:n(m,{size:16,className:p.learned})})),generatedcode:i=>{var o=e(i,["node"]);const t=(null==o?void 0:o.language)||"python",l=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=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 n(y,{title:"Generated Code",code:l,language:t,customStyles:{pill:null==Q?void 0:Q.generatedCodePill,content:null==Q?void 0:Q.generatedCodeContent}})},updatedsegment:i=>{var o,t,l,r,{node:d,children:a}=i,s=e(i,["node","children"]);const c=`${null===(o=d.position)||void 0===o?void 0:o.start.line}-${null===(t=d.position)||void 0===t?void 0:t.start.column}-${null===(l=d.position)||void 0===l?void 0:l.end.line}-${null===(r=d.position)||void 0===r?void 0:r.end.column}`,u=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(s),g=n("div",u?{dangerouslySetInnerHTML:{__html:f.sanitize(u)}}:{children:a});return n(U,{id:c,node:d,children:g,props:s,segmentComponentConfig:ye,customStyles:Q,customIcons:J,extractText:De,isUpdatedSegment:!0})},segment:i=>{var o,t,l,r,{node:d,children:a}=i,s=e(i,["node","children"]);const c=`${null===(o=d.position)||void 0===o?void 0:o.start.line}-${null===(t=d.position)||void 0===t?void 0:t.start.column}-${null===(l=d.position)||void 0===l?void 0:l.end.line}-${null===(r=d.position)||void 0===r?void 0:r.end.column}`;return n(U,{id:c,node:d,children:a,props:s,segmentComponentConfig:ye,customStyles:Q,customIcons:J,extractText:De,blockId:de})}}),[Le,oe,pe,Y,Re,H,l,J,Ce,fe,Q,ye,ke,_e,de]);return c(()=>{if(!se.current)return;if(!Ce.length)return void Ie();let e;if(0===fe.length||te)requestAnimationFrame(()=>{je([Ce[be].replace(/\*/g,"")])});else{const n=se.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{je([Ce[be].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[Ce,fe,be,te]),n(_.Provider,Object.assign({value:{expandedInfo:Oe,setExpanded:Ue,reasonToRow:Ne}},{children:o("div",Object.assign({ref:se,className:`${p.container} ${"approving"!==D?p.wrapper:""} ${z||""}`,style:null==Q?void 0:Q.container},{children:[I?n(E,{children:n(g,Object.assign({components:He,rehypePlugins:[v]},{children:Pe}))}):j,Ee>0&&le&&n("div",Object.assign({className:p.confidenceScoreContainer,style:null==Q?void 0:Q.confidenceScoreContainer},{children:o("span",Object.assign({className:p.confidenceScore,style:null==Q?void 0:Q.confidenceScore},{children:[n(O,{size:14,color:(null==Q?void 0:Q.confidenceScoreIconColor)||"#166534"}),Ee,"%"]}))})),q&&n("div",Object.assign({className:p.citationLoader,style:null==Q?void 0:Q.citationLoaderContainer},{children:n(w,{customStyles:{container:null==Q?void 0:Q.citationLoadingContainer,icon:null==Q?void 0:Q.citationLoadingIcon,text:null==Q?void 0:Q.citationLoadingText}})})),k&&n("div",Object.assign({style:Object.assign({},null===(ae=null==Q?void 0:Q.attachedContext)||void 0===ae?void 0:ae.wrapper),className:"flex mt-5"},{children:n(N,{customStyles:null==Q?void 0:Q.attachedContext,variant:K})}))]}))}))};export{q as default,V as splitNestedDiffNodes};
2
2
  //# sourceMappingURL=UserStoryWithCitation.js.map
@@ -83,9 +83,10 @@ interface StoryCardProps {
83
83
  approveButtonConfig?: ApproveButtonConfig;
84
84
  editButtonConfig?: EditButtonConfig;
85
85
  CDNeededInChip?: boolean;
86
+ blockNumber?: string;
86
87
  }
87
88
  export declare function replaceLearnedTagsWithInfo(content: string): React.ReactNode[];
88
- export declare const StoryCard: ({ isUserStoryCurrentlyUpdated, artifactId, artifactTitleId, parentUserStory, currentUserStory, onUserStoryChange, parentIndex, currentIndex, enableDownload, isDiffEditReviewMode, showUserStoryDiff, handleDownloadUserStory, handleOpenSendDialog, updateUserStoryArtifact, selectedArtifactId, isDisplayHighlightControl, elementDisplayConfig, _resolvedConfig, showWrapper, defaultExpanded, actionItemsConfig, onDelete, contextVariant, expandedSubFeatures, showDisplayName, allowTitleEdit, showConfidenceScore, showBorderTop, sectionStatusConfig, showCompletionPanel, completionPanelConfig, showAddSectionButton, disableEditPlan, useMuiTooltip, approveButtonConfig, editButtonConfig, CDNeededInChip }: StoryCardProps) => import("react/jsx-runtime").JSX.Element;
89
+ export declare const StoryCard: ({ isUserStoryCurrentlyUpdated, artifactId, artifactTitleId, parentUserStory, currentUserStory, onUserStoryChange, parentIndex, currentIndex, enableDownload, isDiffEditReviewMode, showUserStoryDiff, handleDownloadUserStory, handleOpenSendDialog, updateUserStoryArtifact, selectedArtifactId, isDisplayHighlightControl, elementDisplayConfig, _resolvedConfig, showWrapper, defaultExpanded, actionItemsConfig, onDelete, contextVariant, expandedSubFeatures, showDisplayName, allowTitleEdit, showConfidenceScore, showBorderTop, sectionStatusConfig, showCompletionPanel, completionPanelConfig, showAddSectionButton, disableEditPlan, useMuiTooltip, approveButtonConfig, editButtonConfig, CDNeededInChip, blockNumber }: StoryCardProps) => import("react/jsx-runtime").JSX.Element;
89
90
  interface IProps {
90
91
  isUserStoryCurrentlyUpdated?: boolean;
91
92
  artifactId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"UserStoryCard.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/UserStoryCard/UserStoryCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AA0B/D,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAMlE,OAAQ,EAA8C,mBAAmB,EA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CA+GhnB,CAAA;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"UserStoryCard.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/UserStoryCard/UserStoryCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AA0B/D,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAMlE,OAAQ,EAA8C,mBAAmB,EAAoB,MAAM,8CAA8C,CAAC;AAClJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAYzE,UAAU,iBAAiB;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAElC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,qBAAqB;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;I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C9B,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,eAAO,MAAM,oBAAoB,4iBAA0kB,MAAM,4CAiHhnB,CAAA;AAED,eAAe,SAAS,CAAC"}
@@ -10,7 +10,8 @@ interface SegmentWrapperProps {
10
10
  customIcons?: any;
11
11
  extractText: (node: React.ReactNode) => string;
12
12
  isUpdatedSegment?: boolean;
13
+ blockId?: string;
13
14
  }
14
- declare const SegmentWrapper: ({ id, children, props, segmentComponentConfig, customStyles, customIcons, extractText, isUpdatedSegment }: SegmentWrapperProps) => import("react/jsx-runtime").JSX.Element;
15
+ declare const SegmentWrapper: ({ id, children, props, segmentComponentConfig, customStyles, customIcons, extractText, isUpdatedSegment, blockId }: SegmentWrapperProps) => import("react/jsx-runtime").JSX.Element;
15
16
  export default SegmentWrapper;
16
17
  //# sourceMappingURL=SegmentWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentWrapper.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/segment/SegmentWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAY,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAI7E,UAAU,mBAAmB;IACzB,EAAE,EAAC,MAAM,CAAC;IACV,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;IACjD,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,MAAM,CAAC;IAC/C,gBAAgB,CAAC,EAAC,OAAO,CAAA;CAC5B;AAGD,QAAA,MAAM,cAAc,8GASjB,mBAAmB,4CA4FrB,CAAA;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"SegmentWrapper.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/segment/SegmentWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAY,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAI7E,UAAU,mBAAmB;IACzB,EAAE,EAAC,MAAM,CAAC;IACV,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;IACjD,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,MAAM,CAAC;IAC/C,gBAAgB,CAAC,EAAC,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,QAAA,MAAM,cAAc,uHAWjB,mBAAmB,4CA6FrB,CAAA;AAED,eAAe,cAAc,CAAA"}
@@ -115,11 +115,12 @@ interface UserStoryWithCitationsProps {
115
115
  displayActionButtons: boolean;
116
116
  };
117
117
  CDNeededInChip?: boolean;
118
+ blockId?: string;
118
119
  }
119
120
  export declare function splitNestedDiffNodes(children: React.ReactNode, nestedTagNames: string[]): {
120
121
  cleanedChildren: React.ReactNode;
121
122
  extractedNodes: React.ReactNode[];
122
123
  };
123
- declare const UserStoryWithCitations: ({ message, noMarkdownContent, useMarkdown, isParent, scenario, showUserStoryDiff, aiReasoningsForBlock, isCitationLoadingDisplay, className, highConfidenceIcon, lowConfidenceIcon, customStyles, customIcons, contextVariant, aiReasoningDiffView, userStoryCitations, artifactId, isCraflow, onCraAccept, onCraReject, craFlowConfig, isDisplayHighlightControl, showConfidenceScore, CDNeededInChip }: UserStoryWithCitationsProps) => import("react/jsx-runtime").JSX.Element;
124
+ declare const UserStoryWithCitations: ({ message, noMarkdownContent, useMarkdown, isParent, scenario, showUserStoryDiff, aiReasoningsForBlock, isCitationLoadingDisplay, className, highConfidenceIcon, lowConfidenceIcon, customStyles, customIcons, contextVariant, aiReasoningDiffView, userStoryCitations, artifactId, isCraflow, onCraAccept, onCraReject, craFlowConfig, isDisplayHighlightControl, showConfidenceScore, CDNeededInChip, blockId }: UserStoryWithCitationsProps) => import("react/jsx-runtime").JSX.Element;
124
125
  export default UserStoryWithCitations;
125
126
  //# sourceMappingURL=UserStoryWithCitation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserStoryWithCitation.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuF,MAAM,OAAO,CAAC;AAW5G,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,aAAa,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC7Y,OAA+B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AASzI,OAAwB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AA2BlE,MAAM,WAAW,iCAAiC;IAChD,eAAe,CAAC,EAAE,KAAK,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AAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC,YAAY,CAAC,EAAE,iCAAiC,CAAC;IACjD,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,cAAc,CAAC,EAAC,UAAU,GAAG,QAAQ,CAAC;IACtC,mBAAmB,CAAC,EAAC,OAAO,CAAC;IAI7B,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,GAAG,CAAC;IAKzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC,aAAa,CAAC,EAAE;QACd,SAAS,EAAE,OAAO,CAAC;QACnB,YAAY,EAAE,UAAU,EAAE,CAAC;QAC3B,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACpE,wBAAwB,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;QAC5F,oBAAoB,EAAE,OAAO,CAAC;KAC/B,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAA;CAEzB;AAkWD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,cAAc,EAAE,MAAM,EAAE;;;EAoEzB;AAED,QAAA,MAAM,sBAAsB,6YAgCzB,2BAA2B,4CAsqB7B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"UserStoryWithCitation.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation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Q,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACpE,wBAAwB,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;QAC5F,oBAAoB,EAAE,OAAO,CAAC;KAC/B,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,OAAO,CAAC,EAAC,MAAM,CAAA;CAChB;AAkWD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,cAAc,EAAE,MAAM,EAAE;;;EAoEzB;AAED,QAAA,MAAM,sBAAsB,sZAiCzB,2BAA2B,4CAwqB7B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -19,6 +19,6 @@ export type TSegmentComponentConfig = {
19
19
  handleFetchSegmentDetails?: (segmentId: string) => Promise<void>;
20
20
  handleFetchUpdatedSegmentDetails?: (segmentId: string) => Promise<void>;
21
21
  getSegmentExampleComponent?: (segmentId: string, originalValue: string, segmentType: TSegmentType) => JSX.Element;
22
- handleDeleteSegment?: (scope: DeleteScope, segment: TSegment) => Promise<void>;
22
+ handleDeleteSegment?: (scope: DeleteScope, segment: TSegment, blockId?: string) => Promise<void>;
23
23
  };
24
24
  //# sourceMappingURL=segment.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"segment.type.d.ts","sourceRoot":"","sources":["../../../../../../src/features/RequirementAI/types/segment.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACzE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9C,MAAM,MAAM,QAAQ,GAAG;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MA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AY,CAAC;IAC3B,KAAK,EAAC,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAClC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC7B,uBAAuB,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,yBAAyB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,gCAAgC,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,0BAA0B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,KAAK,GAAG,CAAC,OAAO,CAAC;IAClH,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpG,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/requirement-ai",
3
- "version": "0.0.227",
3
+ "version": "0.0.228",
4
4
  "author": "Saptyadeep Bhattacharjee",
5
5
  "description": "",
6
6
  "license": "MIT",