@e-llm-studio/requirement-ai 0.0.242 → 0.0.245

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  2. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  3. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  4. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  5. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  6. package/dist/cjs/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  7. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  8. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  9. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  10. package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  11. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  12. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  13. package/dist/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  14. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  15. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +1 -0
  16. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
  17. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +1 -1
  18. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  19. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +1 -1
  20. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  21. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts +1 -1
  22. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
  23. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +2 -2
  24. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
  25. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +8 -2
  26. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  27. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts +2 -1
  28. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts.map +1 -1
  29. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +2 -1
  30. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  31. package/dist/types/src/features/RequirementAI/interfaces/userstory.interface.d.ts +1 -0
  32. package/dist/types/src/features/RequirementAI/interfaces/userstory.interface.d.ts.map +1 -1
  33. package/dist/types/src/features/RequirementAI/types/segment.type.d.ts +1 -1
  34. package/dist/types/src/features/RequirementAI/types/segment.type.d.ts.map +1 -1
  35. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("react"),i=require("../Popups/PopupDefaults.js"),t=require("react-markdown"),c=require("rehype-raw"),n=require("./CitationComponent.module.css.js"),s=require("lucide-react"),l=require("../icons/cognitiveBrain.svg.js"),d=require("../icons/aiMagic.svg.js"),r=require("./CitationAnchor.js"),o=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),u=require("../../../../../service/redlineService.js"),m=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=x(a),f=x(t),j=x(c);const h=({text:a,item:i})=>e.jsx(f.default,{rehypePlugins:[j.default],components:{ol:({children:a})=>e.jsx("ol",{className:n.default["md-ol"],children:a}),ul:({children:a})=>e.jsx("ul",{className:n.default["md-ul"],children:a}),li:({children:a})=>e.jsx("li",{className:n.default["md-li"],children:a}),a:({node:a,href:t,children:c})=>e.jsx(r.default,{href:t,children:c,metaData:{citations:i.citations,docData:i.docData}})},children:a.replace(/<br\s*\/?>/gi,"\n")}),_=({text:a,markdownStyles:i,citationStyles:t,customIcons:c})=>e.jsx(o.AiReasonMarkdownWrapper,{message:a.replace(/<br\s*\/?>/gi,"\n"),customStyles:i,citationStyles:t,customIcons:c});var v=a.memo(function({item:t,title:c="Cognitive Decisioning AI",relevanceScore:r=0,showRelevanceScore:o=!0,reason:x="No reasoning provided.",impact:f="No Impact provided.",explaination:j="No explaination provided.",gap:v="None",onClose:N=()=>{},onActionTrigger:y,showResolveBtns:b=!1,sections:g,leftIcon:I,scoreIcon:C,className:k,customStyles:A={},markdownStyles:R,citationStyles:S,customIcons:q,actions:w,disableAllActions:H=!1,actionBtnDisabledStyle:B={},onBackClick:D,isImpactNeeded:T=!0,cognitiveTitle:$="Cognitive Integrity",labels:M={},chatHistory:L,openInFullscreenOnClick:P=!1,redlineId:E,aiReasonId:F}){const U=a.useMemo(()=>{const e=Number(r);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[r]),W=a.useMemo(()=>{const e=M&&M.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const a=e.trim().toLowerCase();return"none"===a||"no gap"===a||"no gaps"===a||"n/a"===a})(v)?e:v},[v]),G=M&&M.impact||"Impact",O=M&&M.explanation||"Explaination",z=M&&M.decisionFactors||"Decision Making Factors",J=M&&M.gaps||"Gaps in Decision",K=M&&M.accept||"Accept",Q=M&&M.reject||"Reject",V=M&&M.backAriaLabel||"Go back",{redlineDcoumentId:X,redlineConfig:Y,updateRedlineDataParent:Z}=m.useRequirementAI(),ee=async e=>{var a,i;null==y||y({status:"loading",action:e,metadata:{redlineId:E,aiReasonId:F}});try{const{updated_reqai:t}=await u.resolveRedline({documentId:X,userEmail:null==Y?void 0:Y.userEmail,userName:null==Y?void 0:Y.userName,redlineId:null!=E?E:"",action:e,baseApiUrl:null==Y?void 0:Y.baseApiUrl,redlineConfigId:null!==(a=null==Y?void 0:Y.redlineConfigId)&&void 0!==a?a:""},null!==(i=null==Y?void 0:Y.token)&&void 0!==i?i:"");await(null==Z?void 0:Z(t)),null==y||y({status:"success",action:e,metadata:{redlineId:E,aiReasonId:F}})}catch(a){null==y||y({status:"failed",action:e,metadata:{redlineId:E,aiReasonId:F}})}},ae=w||[{id:"reject",label:Q,onClick:()=>ee("reject"),className:n.default["btn-reject"]},{id:"accept",label:K,onClick:()=>ee("accept"),className:n.default["btn-accept"]}],ie=L&&L.length>0;return e.jsxs("div",{className:`${n.default["cite-acc"]} ${k||""}`,style:{...i.default.CitationAccordionDefaults.container,...null==A?void 0:A.container},children:[D&&e.jsxs("div",{className:n.default["cite-acc__backHeader"],children:[e.jsx("button",{type:"button",className:n.default["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),D&&D()},"aria-label":V,children:"‹"}),e.jsx("span",{className:n.default["cite-acc__backTitle"],children:$})]}),e.jsx("div",{className:n.default["cite-body"],children:g&&g.length>0?g.map(a=>!1===a.show?null:e.jsxs("div",{className:`${n.default["cite-acc__explain-body"]} ${a.bodyClassName||""}`,children:[e.jsxs("div",{className:n.default["cite-acc__innerHeader"],style:{...i.default.CitationAccordionDefaults.innerHeader,...null==A?void 0:A.innerHeader},children:[e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:a.title})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),N&&N()},children:e.jsx(s.ChevronUp,{})})]}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...i.default.CitationAccordionDefaults.innerBody,...null==A?void 0:A.innerBody},children:"string"==typeof a.content?e.jsx(h,{text:a.content,item:a.item||t||{}}):a.content})]},a.id||a.title)):e.jsxs(e.Fragment,{children:[T&&e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsxs("div",{className:n.default["cite-acc__innerHeader"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:G})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),N&&N()},children:e.jsx(s.ChevronUp,{})})]}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(h,{text:f||"",item:t||{}})})]}),j&&"No explaination provided."!==j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:O})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(h,{text:j||"",item:{}})})]}),e.jsx("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),b&&e.jsx("div",{className:n.default["cite-acc__btn-container"],children:ae.map(a=>{const i=H||a.disabled;return e.jsx("button",{className:a.className,onClick:i?void 0:a.onClick,disabled:i,style:{...a.style,...i?{opacity:.5,cursor:"not-allowed",...B,...a.disabledStyle}:{}},children:a.label},a.id)})})]}),e.jsxs("div",{className:n.default["cite-acc__header"],children:[e.jsxs("div",{className:n.default["cite-acc__headerLeft"],children:[e.jsx("span",{className:n.default["cite-acc__titleIcon"],children:I?"function"==typeof I?p.default.createElement(I):I:e.jsx(l.ReactComponent,{})}),e.jsx("div",{className:n.default["cite-acc__title"],children:c})]}),e.jsx("div",{className:n.default["cite-acc__headerRight"],children:o&&e.jsxs("span",{className:n.default["cite-acc__scoreBadge"],children:[C?"function"==typeof C?p.default.createElement(C):C:e.jsx(d.ReactComponent,{}),e.jsxs("span",{className:n.default["cite-acc__scoreText"],children:[U,"%"]})]})})]}),e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:z})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:ie?e.jsx(_,{text:x||"",markdownStyles:R,citationStyles:S,customIcons:q}):e.jsx(h,{text:x||"",item:t||{}})})]}),e.jsxs("div",{className:`${n.default["cite-acc__explain-body"]} ${n.default["cite-acc__explain-body_border"]}`,children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:J})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:ie?e.jsx(_,{text:W||"",markdownStyles:R,citationStyles:S,customIcons:q}):e.jsx(h,{text:W||"",item:t||{}})})]})]})})]})},(e,a)=>e.disableAllActions===a.disableAllActions&&(e.redlineId===a.redlineId&&(e.aiReasonId===a.aiReasonId&&(e.relevanceScore===a.relevanceScore&&(e.reason===a.reason&&(e.impact===a.impact&&(e.explaination===a.explaination&&e.gap===a.gap)))))));exports.default=v;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("react"),i=require("../Popups/PopupDefaults.js"),t=require("react-markdown"),c=require("rehype-raw"),n=require("./CitationComponent.module.css.js"),s=require("lucide-react"),l=require("../icons/cognitiveBrain.svg.js"),d=require("../icons/aiMagic.svg.js"),r=require("./CitationAnchor.js"),o=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),u=require("../../../../../service/redlineService.js"),m=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=x(a),f=x(t),j=x(c);const h=({text:a,item:i})=>e.jsx(f.default,{rehypePlugins:[j.default],components:{ol:({children:a})=>e.jsx("ol",{className:n.default["md-ol"],children:a}),ul:({children:a})=>e.jsx("ul",{className:n.default["md-ul"],children:a}),li:({children:a})=>e.jsx("li",{className:n.default["md-li"],children:a}),a:({node:a,href:t,children:c})=>e.jsx(r.default,{href:t,children:c,metaData:{citations:i.citations,docData:i.docData}})},children:a.replace(/<br\s*\/?>/gi,"\n")}),v=({text:a,markdownStyles:i,citationStyles:t,customIcons:c})=>e.jsx(o.AiReasonMarkdownWrapper,{message:a.replace(/<br\s*\/?>/gi,"\n"),customStyles:i,citationStyles:t,customIcons:c});var _=a.memo(function({item:t,title:c="Cognitive Decisioning AI",relevanceScore:r=0,showRelevanceScore:o=!0,reason:x="No reasoning provided.",impact:f="No Impact provided.",explaination:j="No explaination provided.",gap:_="None",onClose:N=()=>{},onActionTrigger:y,showResolveBtns:b=!1,sections:g,leftIcon:I,scoreIcon:C,className:k,customStyles:A={},markdownStyles:R,citationStyles:S,customIcons:q,actions:w,disableAllActions:H=!1,actionBtnDisabledStyle:B={},onBackClick:D,isImpactNeeded:T=!0,cognitiveTitle:$="Cognitive Integrity",labels:M={},chatHistory:L,openInFullscreenOnClick:P=!1,redlineId:E,aiReasonId:F}){const U=a.useMemo(()=>{const e=Number(r);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[r]),W=a.useMemo(()=>{const e=M&&M.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const a=e.trim().toLowerCase();return"none"===a||"no gap"===a||"no gaps"===a||"n/a"===a})(_)?e:_},[_]),G=M&&M.impact||"Impact",O=M&&M.explanation||"Explaination",z=M&&M.decisionFactors||"Decision Making Factors",J=M&&M.gaps||"Gaps in Decision",K=M&&M.accept||"Accept",Q=M&&M.reject||"Reject",V=M&&M.backAriaLabel||"Go back",{redlineDcoumentId:X,redlineConfig:Y,updateRedlineDataParent:Z}=m.useRequirementAI(),ee=async e=>{var a,i;try{await(null==y?void 0:y({status:"loading",action:e,metadata:{redlineId:E,aiReasonId:F}}))}catch(e){}if(null==Y?void 0:Y.callResolveRedline)try{const{updated_reqai:t}=await u.resolveRedline({documentId:X,userEmail:null==Y?void 0:Y.userEmail,userName:null==Y?void 0:Y.userName,redlineId:null!=E?E:"",action:e,baseApiUrl:null==Y?void 0:Y.baseApiUrl,redlineConfigId:null!==(a=null==Y?void 0:Y.redlineConfigId)&&void 0!==a?a:""},null!==(i=null==Y?void 0:Y.token)&&void 0!==i?i:"");await(null==Z?void 0:Z(t)),null==y||y({status:"success",action:e,metadata:{redlineId:E,aiReasonId:F}})}catch(a){null==y||y({status:"failed",action:e,metadata:{redlineId:E,aiReasonId:F}})}},ae=w||[{id:"reject",label:Q,onClick:()=>ee("reject"),className:n.default["btn-reject"]},{id:"accept",label:K,onClick:()=>ee("accept"),className:n.default["btn-accept"]}],ie=L&&L.length>0;return e.jsxs("div",{className:`${n.default["cite-acc"]} ${k||""}`,style:{...i.default.CitationAccordionDefaults.container,...null==A?void 0:A.container},children:[D&&e.jsxs("div",{className:n.default["cite-acc__backHeader"],children:[e.jsx("button",{type:"button",className:n.default["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),D&&D()},"aria-label":V,children:"‹"}),e.jsx("span",{className:n.default["cite-acc__backTitle"],children:$})]}),e.jsx("div",{className:n.default["cite-body"],children:g&&g.length>0?g.map(a=>!1===a.show?null:e.jsxs("div",{className:`${n.default["cite-acc__explain-body"]} ${a.bodyClassName||""}`,children:[e.jsxs("div",{className:n.default["cite-acc__innerHeader"],style:{...i.default.CitationAccordionDefaults.innerHeader,...null==A?void 0:A.innerHeader},children:[e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:a.title})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),N&&N()},children:e.jsx(s.ChevronUp,{})})]}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...i.default.CitationAccordionDefaults.innerBody,...null==A?void 0:A.innerBody},children:"string"==typeof a.content?e.jsx(h,{text:a.content,item:a.item||t||{}}):a.content})]},a.id||a.title)):e.jsxs(e.Fragment,{children:[T&&e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsxs("div",{className:n.default["cite-acc__innerHeader"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:G})})}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),N&&N()},children:e.jsx(s.ChevronUp,{})})]}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(h,{text:f||"",item:t||{}})})]}),j&&"No explaination provided."!==j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:O})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:e.jsx(h,{text:j||"",item:{}})})]}),e.jsx("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),b&&e.jsx("div",{className:n.default["cite-acc__btn-container"],children:ae.map(a=>{const i=H||a.disabled;return e.jsx("button",{className:a.className,onClick:i?void 0:a.onClick,disabled:i,style:{...a.style,...i?{opacity:.5,cursor:"not-allowed",...B,...a.disabledStyle}:{}},children:a.label},a.id)})})]}),e.jsxs("div",{className:n.default["cite-acc__header"],children:[e.jsxs("div",{className:n.default["cite-acc__headerLeft"],children:[e.jsx("span",{className:n.default["cite-acc__titleIcon"],children:I?"function"==typeof I?p.default.createElement(I):I:e.jsx(l.ReactComponent,{})}),e.jsx("div",{className:n.default["cite-acc__title"],children:c})]}),e.jsx("div",{className:n.default["cite-acc__headerRight"],children:o&&e.jsxs("span",{className:n.default["cite-acc__scoreBadge"],children:[C?"function"==typeof C?p.default.createElement(C):C:e.jsx(d.ReactComponent,{}),e.jsxs("span",{className:n.default["cite-acc__scoreText"],children:[U,"%"]})]})})]}),e.jsxs("div",{className:n.default["cite-acc__explain-body"],children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:z})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:ie?e.jsx(v,{text:x||"",markdownStyles:R,citationStyles:S,customIcons:q}):e.jsx(h,{text:x||"",item:t||{}})})]}),e.jsxs("div",{className:`${n.default["cite-acc__explain-body"]} ${n.default["cite-acc__explain-body_border"]}`,children:[e.jsx("div",{className:n.default["cite-acc__innerHeader"],children:e.jsx("div",{className:n.default["cite-acc__innerHeaderLeft"],children:e.jsx("div",{children:e.jsx("div",{className:n.default["cite-acc__innerTitle"],children:J})})})}),e.jsx("div",{className:`${n.default["cite-acc__innerBody"]} text-sm text-gray-600`,children:ie?e.jsx(v,{text:W||"",markdownStyles:R,citationStyles:S,customIcons:q}):e.jsx(h,{text:W||"",item:t||{}})})]})]})})]})},(e,a)=>e.disableAllActions===a.disableAllActions&&(e.redlineId===a.redlineId&&(e.aiReasonId===a.aiReasonId&&(e.relevanceScore===a.relevanceScore&&(e.reason===a.reason&&(e.impact===a.impact&&(e.explaination===a.explaination&&e.gap===a.gap)))))));exports.default=_;
2
2
  //# sourceMappingURL=CognitiveComponent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),t=require("react"),n=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var o=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),r=require("@mui/material"),s=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),d=require("../../../../../service/redlineService.js"),a=require("../../ai-reasoning/AiReasonMarkdownWrapper.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=c(t);const x=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],g=({toneIndex:i,configs:t=x})=>{const n=Math.min(i,t.length-1),{color:o,angle:l,arcD:r}=t[n]||t[1]||t[0],s=(l-90)*Math.PI/180,d=11+9*Math.cos(s),a=13+9*Math.sin(s);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:r,stroke:o,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:d,y2:a,stroke:o,strokeWidth:"2",strokeLinecap:"round"})]})},u=({type:i,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[i]||n.Medium;return e.jsx("div",{style:o,children:i})},h=["Lenient","Balanced","Aggressive"],v={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},m={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},y={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},f={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},j={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},w={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},S={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},b={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},C={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},k={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},I={display:"flex",gap:8,marginBottom:18},T={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},B={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},A={borderTop:"0.5px solid #eee",padding:"14px 0px"},E={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},R={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},W={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},L={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},D={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},F={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},z={display:"flex",padding:"4px 8px",alignItems:"center",gap:"4px",borderRadius:"var(--chip-border-radius, 16px)",border:"1px solid var(--Primitive-Gray-300, #d0d5dd)",flex:"0 1 auto",minWidth:0},M={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},H={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},_=t.memo(function({onAssignClick:i,onOpenCognitive:t,cognitiveIconSmall:n,cognitiveTootipTitle:o,historyIconSmall:l,onHistoryClick:r,historyTootipTitle:s}){const d="20px";return e.jsxs("div",{style:{...H,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),t&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>t(e),children:[n&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:n}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o})]}),r&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>r(e),children:[l&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:l}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s})]})]})}),O=t.memo(function({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d}){const[a,c]=t.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!a),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),a&&e.jsx(_,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d})]})}),q=t.memo(function({users:i,onClick:t}){const n=i.length;return e.jsxs("div",{onClick:t,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),n>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",n-1]})]})}),P=t.memo(function({steps:i}){if(!(null==i?void 0:i.length))return null;const t=i.length>=3;return e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:t?"6px 8px":"8px 10px",background:"#F8FAFC",gap:t?4:8,overflow:"hidden"},children:i.map((n,o)=>{const l=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(o),r=o===i.length-1;return e.jsxs(p.default.Fragment,{children:[e.jsxs("div",{title:n.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:t?4:6,overflow:"hidden"},children:[(s=n.status,"approved"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m15 9-6 6"}),e.jsx("path",{d:"m9 9 6 6"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),e.jsx("span",{style:{minWidth:0,color:"#475569",fontSize:t?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),n.initials&&e.jsx("span",{style:{width:t?20:22,height:t?20:22,minWidth:t?20:22,borderRadius:"50%",background:l.bg,color:l.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:t?9:10,fontWeight:700,lineHeight:1},children:n.initials})]}),!r&&e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"18",height:t?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:t?14:18},children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})]},n.id);var s})})})});var N=t.memo(function({onClose:c,aiReason:p,onActionTrigger:H,onIterate:_,initialTone:N,onRegenerate:$,labels:V={},toneLevelsConfig:U=h,toneColorsConfig:G=v,dialConfigs:K=x,actions:X,disableAllActions:J=!1,customStyles:Q={},severityChipStyles:Y={},customIcons:Z={},onOpenCognitive:ee,onHistoryClick:ie,historyIconSmall:te,historyTootipTitle:ne,showTone:oe=!0,cognitiveSectionStyle:le={},cognitiveScoreBadgeStyle:re={},cognitiveScoreTextStyle:se={},cognitiveStyles:de={},cognitiveClassNames:ae={},cognitiveTitle:ce="Cognitive Integrity",cognitiveTootipTitle:pe="Cognitive Decisioning",cognitiveLeftIcon:xe,cognitiveIconSmall:ge,showCognitiveRightArrow:ue=!0,isStreaming:he,onAssignClick:ve,assignedUsers:me,onReviewUsersClick:ye,redlineId:fe,aiReasonId:je,displayVariant:we="default",reviewTitle:Se,reviewSubtitle:be,reviewStatusIcon:Ce=e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:ke=[],showReviewProgress:Ie=!1,showOriginalText:Te=!1,originalText:Be,originalTextHeader:Ae="Original text",hideSummaryText:Ee=!1,hideSeverityChip:Re=!1}){var We,Le,De,Fe,ze,Me,He,_e,Oe,qe,Pe,Ne,$e,Ve,Ue,Ge,Ke,Xe,Je,Qe;let Ye=U.findIndex(e=>e===N);-1===Ye&&(Ye=1);const[Ze,ei]=t.useState(!0),[ii,ti]=t.useState(!1),[ni,oi]=t.useState(!1),[li,ri]=t.useState(Ye),[si]=t.useState(Ye),[di,ai]=t.useState(!0),ci="review"===we,pi=U[li],xi=G[pi]||"#BA7517",gi=li!==si,ui=[{id:"iterate",icon:Z.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:V.btnIterate||"Iterate",color:"#64748B",onClick:_},{id:"accept",icon:Z.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:V.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:Z.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:V.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:hi,redlineConfig:vi,updateRedlineDataParent:mi}=s.useRequirementAI(),yi=async e=>{var i,t,n;null==H||H({status:"loading",action:e,metadata:{redlineId:fe,aiReasonId:je}});try{const{updated_reqai:o}=await d.resolveRedline({documentId:hi,userEmail:null==vi?void 0:vi.userEmail,userName:null==vi?void 0:vi.userName,redlineId:null!==(i=null==p?void 0:p.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==vi?void 0:vi.baseApiUrl,redlineConfigId:null!==(t=null==vi?void 0:vi.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==vi?void 0:vi.token)&&void 0!==n?n:"");await(null==mi?void 0:mi(o)),null==H||H({status:"success",action:e,metadata:{redlineId:fe,aiReasonId:je}})}catch(i){null==H||H({status:"failed",action:e,metadata:{redlineId:fe,aiReasonId:je}})}},fi=X||ui;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...m,...null===(We=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===We?void 0:We.root},children:[e.jsxs("div",{style:{...y,...null===(Le=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Le?void 0:Le.header,marginBottom:ci?14:ni?"16px":"12px",...ci&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[ci?e.jsxs("div",{style:{minWidth:0,flex:"1 1 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:Ce||Z.summaryIcon||"⏳"}),e.jsx("span",{children:Se||"Redline In Review"})]}),e.jsx("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:be||(null===(De=null==p?void 0:p.redlining_details)||void 0===De?void 0:De.redline_title)})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:Z.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...f,...null===(Fe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.title},children:V.summaryHeader||"Summary"})]}),me&&me.length>0&&e.jsx(q,{users:me,onClick:e=>{e.stopPropagation(),null==ye||ye()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ve||ee||ie)&&e.jsx(O,{onAssignClick:ve,onOpenCognitive:ee,cognitiveIconSmall:ge,cognitiveTootipTitle:pe,historyIconSmall:te,onHistoryClick:ie,historyTootipTitle:ne}),e.jsx("button",{onClick:c,style:{...B,...null===(ze=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===ze?void 0:ze.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),ci&&Ie&&ke.length>0&&e.jsx(P,{steps:ke}),!Ee&&!ci&&e.jsx(e.Fragment,{children:e.jsx(r.Tooltip,{title:null===(Me=null==p?void 0:p.redlining_details)||void 0===Me?void 0:Me.redline_title,children:e.jsx("p",{style:{...j,...null===(He=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===He?void 0:He.bodyText},children:null===(_e=null==p?void 0:p.redlining_details)||void 0===_e?void 0:_e.redline_title})})}),e.jsx("p",{style:{...w,...null===(Oe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.summary},children:null===(qe=null==p?void 0:p.redlining_details)||void 0===qe?void 0:qe.redline_summary}),e.jsxs("div",{style:{...S,...null===(Pe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>ei(!Ze),style:{...C,...null===(Ne=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ne?void 0:Ne.impactToggle},children:[e.jsx("span",{style:{...k,...null===($e=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===$e?void 0:$e.impactToggleLabel},children:V.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ze?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(u,{type:(null==p?void 0:p.severity)||"Medium",customStyles:Y})]}),Ze&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...b,...null===(Ve=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ve?void 0:Ve.impactText},children:e.jsx(a.AiReasonMarkdownWrapper,{message:`${null!==(Ge=null===(Ue=null==p?void 0:p.redlining_details)||void 0===Ue?void 0:Ue.redline_impact)&&void 0!==Ge?Ge:V.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Ke=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ke?void 0:Ke.impactMarkdown})})})]}),ci&&Te&&e.jsxs("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e.jsxs("button",{onClick:()=>ai(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[e.jsx("span",{children:Ae}),e.jsx(i.ChevronDown,{size:18,color:"#1E293B",style:{transform:di?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),di&&e.jsxs("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Be||"","”"]})]}),e.jsx("div",{style:{...I,...null===(Xe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.actionContainer},children:fi.map(i=>{var t,n;const o=J||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...T,...null===(n=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{if(i.onClick){return void(!0===await i.onClick()&&i.useLabel&&await yi(i.id.toLowerCase()))}i.useLabel&&await yi(i.id.toLowerCase())},disabled:o,children:[i.icon,i.label]},i.id)})}),oe&&e.jsxs("div",{style:{...A,...null===(Je=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Je?void 0:Je.toneContainer},children:[e.jsxs("button",{onClick:()=>ti(!ii),style:{...E,...null===(Qe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(g,{toneIndex:li,configs:K}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:V.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ii?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),ii&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:V.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(n.ToneToggle,{isDirty:gi,onToneChange:e=>{ri(e)},toneColor:xi,toneIndex:li,onClickRegenerate:()=>null==$?void 0:$(pi),toneLabels:U,isStreaming:he,aiReason:p})]})]}),ee&&e.jsxs("div",{className:null==ae?void 0:ae.section,onClick:e=>{e.stopPropagation(),ee&&ee(e)},style:{...R,...null==de?void 0:de.section,...le},children:[e.jsxs("div",{className:null==ae?void 0:ae.headerLeft,style:{...W,...null==de?void 0:de.headerLeft},children:[e.jsx("span",{className:null==ae?void 0:ae.titleIcon,style:{...L,...null==de?void 0:de.titleIcon},children:null!=xe?xe:e.jsx(o.ReactComponent,{})}),e.jsx("div",{className:null==ae?void 0:ae.cognitiveTitle,style:{...D,...null==de?void 0:de.cognitiveTitle},children:ce})]}),e.jsxs("div",{className:null==ae?void 0:ae.headerRight,style:{...F,...null==de?void 0:de.headerRight},children:[void 0!==(null==p?void 0:p.relevance_score)&&null!==(null==p?void 0:p.relevance_score)?e.jsxs("span",{className:null==ae?void 0:ae.scoreBadge,style:{...z,...null==de?void 0:de.scoreBadge,...re},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==ae?void 0:ae.scoreText,style:{...M,...null==de?void 0:de.scoreText,...se},children:[Math.round(Number(p.relevance_score)),"%"]})]}):null,ue&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});exports.AssignMenu=_,exports.DisplayUsers=q,exports.KebabMenu=O,exports.default=N;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),t=require("react"),n=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var o=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),r=require("@mui/material"),s=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),d=require("../../../../../service/redlineService.js"),a=require("../../ai-reasoning/AiReasonMarkdownWrapper.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=c(t);const x=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],g=({toneIndex:i,configs:t=x})=>{const n=Math.min(i,t.length-1),{color:o,angle:l,arcD:r}=t[n]||t[1]||t[0],s=(l-90)*Math.PI/180,d=11+9*Math.cos(s),a=13+9*Math.sin(s);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:r,stroke:o,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:d,y2:a,stroke:o,strokeWidth:"2",strokeLinecap:"round"})]})},u=({type:i,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[i]||n.Medium;return e.jsx("div",{style:o,children:i})},h=["Lenient","Balanced","Aggressive"],v={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},m={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},y={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},f={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},j={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},w={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},S={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},b={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},C={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},k={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},I={display:"flex",gap:8,marginBottom:18},T={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},B={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},A={borderTop:"0.5px solid #eee",padding:"14px 0px"},R={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},E={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},W={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},L={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},D={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},F={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},z={display:"flex",padding:"4px 8px",alignItems:"center",gap:"4px",borderRadius:"var(--chip-border-radius, 16px)",border:"1px solid var(--Primitive-Gray-300, #d0d5dd)",flex:"0 1 auto",minWidth:0},M={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},H={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},_=t.memo(function({onAssignClick:i,onOpenCognitive:t,cognitiveIconSmall:n,cognitiveTootipTitle:o,historyIconSmall:l,onHistoryClick:r,historyTootipTitle:s}){const d="20px";return e.jsxs("div",{style:{...H,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),t&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>t(e),children:[n&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:n}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o})]}),r&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>r(e),children:[l&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:l}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s})]})]})}),O=t.memo(function({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d}){const[a,c]=t.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!a),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),a&&e.jsx(_,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d})]})}),q=t.memo(function({users:i,onClick:t}){const n=i.length;return e.jsxs("div",{onClick:t,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),n>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",n-1]})]})}),P=t.memo(function({steps:i}){if(!(null==i?void 0:i.length))return null;const t=i.length>=3;return e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:t?"6px 8px":"8px 10px",background:"#F8FAFC",gap:t?4:8,overflow:"hidden"},children:i.map((n,o)=>{const l=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(o),r=o===i.length-1;return e.jsxs(p.default.Fragment,{children:[e.jsxs("div",{title:n.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:t?4:6,overflow:"hidden"},children:[(s=n.status,"approved"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m15 9-6 6"}),e.jsx("path",{d:"m9 9 6 6"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),e.jsx("span",{style:{minWidth:0,color:"#475569",fontSize:t?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),n.initials&&e.jsx("span",{style:{width:t?20:22,height:t?20:22,minWidth:t?20:22,borderRadius:"50%",background:l.bg,color:l.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:t?9:10,fontWeight:700,lineHeight:1},children:n.initials})]}),!r&&e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"18",height:t?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:t?14:18},children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})]},n.id);var s})})})});var N=t.memo(function({onClose:c,aiReason:p,onActionTrigger:H,onIterate:_,initialTone:N,onRegenerate:$,labels:V={},toneLevelsConfig:U=h,toneColorsConfig:G=v,dialConfigs:K=x,actions:X,disableAllActions:J=!1,customStyles:Q={},severityChipStyles:Y={},customIcons:Z={},onOpenCognitive:ee,onHistoryClick:ie,historyIconSmall:te,historyTootipTitle:ne,showTone:oe=!0,cognitiveSectionStyle:le={},cognitiveScoreBadgeStyle:re={},cognitiveScoreTextStyle:se={},cognitiveStyles:de={},cognitiveClassNames:ae={},cognitiveTitle:ce="Cognitive Integrity",cognitiveTootipTitle:pe="Cognitive Decisioning",cognitiveLeftIcon:xe,cognitiveIconSmall:ge,showCognitiveRightArrow:ue=!0,isStreaming:he,onAssignClick:ve,assignedUsers:me,onReviewUsersClick:ye,redlineId:fe,aiReasonId:je,displayVariant:we="default",reviewTitle:Se,reviewSubtitle:be,reviewStatusIcon:Ce=e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:ke=[],showReviewProgress:Ie=!1,showOriginalText:Te=!1,originalText:Be,originalTextHeader:Ae="Original text",hideSummaryText:Re=!1,hideSeverityChip:Ee=!1}){var We,Le,De,Fe,ze,Me,He,_e,Oe,qe,Pe,Ne,$e,Ve,Ue,Ge,Ke,Xe,Je,Qe;let Ye=U.findIndex(e=>e===N);-1===Ye&&(Ye=1);const[Ze,ei]=t.useState(!0),[ii,ti]=t.useState(!1),[ni,oi]=t.useState(!1),[li,ri]=t.useState(Ye),[si]=t.useState(Ye),[di,ai]=t.useState(!0),ci="review"===we,pi=U[li],xi=G[pi]||"#BA7517",gi=li!==si,ui=[{id:"iterate",icon:Z.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:V.btnIterate||"Iterate",color:"#64748B",onClick:_},{id:"accept",icon:Z.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:V.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:Z.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:V.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:hi,redlineConfig:vi,updateRedlineDataParent:mi}=s.useRequirementAI(),yi=async e=>{var i,t,n;try{await(null==H?void 0:H({status:"loading",action:e,metadata:{redlineId:fe,aiReasonId:je}}))}catch(e){}if(null==vi?void 0:vi.callResolveRedline)try{const{updated_reqai:o}=await d.resolveRedline({documentId:hi,userEmail:null==vi?void 0:vi.userEmail,userName:null==vi?void 0:vi.userName,redlineId:null!==(i=null==p?void 0:p.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==vi?void 0:vi.baseApiUrl,redlineConfigId:null!==(t=null==vi?void 0:vi.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==vi?void 0:vi.token)&&void 0!==n?n:"");await(null==mi?void 0:mi(o)),null==H||H({status:"success",action:e,metadata:{redlineId:fe,aiReasonId:je}})}catch(i){null==H||H({status:"failed",action:e,metadata:{redlineId:fe,aiReasonId:je}})}},fi=X||ui;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...m,...null===(We=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===We?void 0:We.root},children:[e.jsxs("div",{style:{...y,...null===(Le=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Le?void 0:Le.header,marginBottom:ci?14:ni?"16px":"12px",...ci&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[ci?e.jsxs("div",{style:{minWidth:0,flex:"1 1 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:Ce||Z.summaryIcon||"⏳"}),e.jsx("span",{children:Se||"Redline In Review"})]}),e.jsx("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:be||(null===(De=null==p?void 0:p.redlining_details)||void 0===De?void 0:De.redline_title)})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:Z.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...f,...null===(Fe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.title},children:V.summaryHeader||"Summary"})]}),me&&me.length>0&&e.jsx(q,{users:me,onClick:e=>{e.stopPropagation(),null==ye||ye()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ve||ee||ie)&&e.jsx(O,{onAssignClick:ve,onOpenCognitive:ee,cognitiveIconSmall:ge,cognitiveTootipTitle:pe,historyIconSmall:te,onHistoryClick:ie,historyTootipTitle:ne}),e.jsx("button",{onClick:c,style:{...B,...null===(ze=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===ze?void 0:ze.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),ci&&Ie&&ke.length>0&&e.jsx(P,{steps:ke}),!Re&&!ci&&e.jsx(e.Fragment,{children:e.jsx(r.Tooltip,{title:null===(Me=null==p?void 0:p.redlining_details)||void 0===Me?void 0:Me.redline_title,children:e.jsx("p",{style:{...j,...null===(He=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===He?void 0:He.bodyText},children:null===(_e=null==p?void 0:p.redlining_details)||void 0===_e?void 0:_e.redline_title})})}),e.jsx("p",{style:{...w,...null===(Oe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.summary},children:null===(qe=null==p?void 0:p.redlining_details)||void 0===qe?void 0:qe.redline_summary}),e.jsxs("div",{style:{...S,...null===(Pe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>ei(!Ze),style:{...C,...null===(Ne=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ne?void 0:Ne.impactToggle},children:[e.jsx("span",{style:{...k,...null===($e=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===$e?void 0:$e.impactToggleLabel},children:V.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ze?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(u,{type:(null==p?void 0:p.severity)||"Medium",customStyles:Y})]}),Ze&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...b,...null===(Ve=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ve?void 0:Ve.impactText},children:e.jsx(a.AiReasonMarkdownWrapper,{message:`${null!==(Ge=null===(Ue=null==p?void 0:p.redlining_details)||void 0===Ue?void 0:Ue.redline_impact)&&void 0!==Ge?Ge:V.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Ke=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ke?void 0:Ke.impactMarkdown})})})]}),ci&&Te&&e.jsxs("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e.jsxs("button",{onClick:()=>ai(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[e.jsx("span",{children:Ae}),e.jsx(i.ChevronDown,{size:18,color:"#1E293B",style:{transform:di?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),di&&e.jsxs("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Be||"","”"]})]}),e.jsx("div",{style:{...I,...null===(Xe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.actionContainer},children:fi.map(i=>{var t,n;const o=J||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...T,...null===(n=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{if(i.onClick){return void(!0===await i.onClick()&&i.useLabel&&await yi(i.id.toLowerCase()))}i.useLabel&&await yi(i.id.toLowerCase())},disabled:o,children:[i.icon,i.label]},i.id)})}),oe&&e.jsxs("div",{style:{...A,...null===(Je=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Je?void 0:Je.toneContainer},children:[e.jsxs("button",{onClick:()=>ti(!ii),style:{...R,...null===(Qe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(g,{toneIndex:li,configs:K}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:V.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ii?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),ii&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:V.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(n.ToneToggle,{isDirty:gi,onToneChange:e=>{ri(e)},toneColor:xi,toneIndex:li,onClickRegenerate:()=>null==$?void 0:$(pi),toneLabels:U,isStreaming:he,aiReason:p})]})]}),ee&&e.jsxs("div",{className:null==ae?void 0:ae.section,onClick:e=>{e.stopPropagation(),ee&&ee(e)},style:{...E,...null==de?void 0:de.section,...le},children:[e.jsxs("div",{className:null==ae?void 0:ae.headerLeft,style:{...W,...null==de?void 0:de.headerLeft},children:[e.jsx("span",{className:null==ae?void 0:ae.titleIcon,style:{...L,...null==de?void 0:de.titleIcon},children:null!=xe?xe:e.jsx(o.ReactComponent,{})}),e.jsx("div",{className:null==ae?void 0:ae.cognitiveTitle,style:{...D,...null==de?void 0:de.cognitiveTitle},children:ce})]}),e.jsxs("div",{className:null==ae?void 0:ae.headerRight,style:{...F,...null==de?void 0:de.headerRight},children:[void 0!==(null==p?void 0:p.relevance_score)&&null!==(null==p?void 0:p.relevance_score)?e.jsxs("span",{className:null==ae?void 0:ae.scoreBadge,style:{...z,...null==de?void 0:de.scoreBadge,...re},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==ae?void 0:ae.scoreText,style:{...M,...null==de?void 0:de.scoreText,...se},children:[Math.round(Number(p.relevance_score)),"%"]})]}):null,ue&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});exports.AssignMenu=_,exports.DisplayUsers=q,exports.KebabMenu=O,exports.default=N;
2
2
  //# sourceMappingURL=DeviationSummary.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),n=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),l=require("../../../../../service/redlineService.js");const t={popup:{width:400,background:"#fff",borderRadius:12,overflow:"hidden",boxShadow:"0 10px 30px rgba(0,0,0,0.15)",fontFamily:"Inter, sans-serif"},actionBtnDisabled:{opacity:.5,cursor:"not-allowed",pointerEvents:"none"},header:{background:"#dfe7f8",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 14px"},title:{fontSize:14,fontWeight:600,color:"#313949"},closeButton:{border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#616b7d"},content:{padding:"16px 22px"},labelRow:{display:"flex",alignItems:"center",gap:10,marginBottom:8},labelIcon:{fontSize:18},label:{fontSize:14,color:"#7b8495"},editorInfo:{fontSize:14,fontWeight:500,color:"#313949"},divider:{margin:"14px 0",height:1,background:"#e5e7eb"},actions:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:15},resolveActions:{display:"flex",justifyContent:"space-between",gap:15,alignItems:"center"},actionBtn:{border:"1px solid #d5dbe8",background:"#fff",borderRadius:10,padding:"8px",fontSize:14,cursor:"pointer",display:"flex",alignItems:"center",gap:10,color:"#596275"}};exports.default=function({onClose:d,editorInfo:o,headerText:r,btnsConfig:s,labelText:a,onActionTrigger:c,aiReason:u=null}){var v,p;const{redlineDcoumentId:x,redlineConfig:f,updateRedlineDataParent:b}=n.useRequirementAI(),g=async e=>{var i,n,t;null==c||c({status:"loading",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}});try{const{updated_reqai:d}=await l.resolveRedline({documentId:x,userEmail:null==f?void 0:f.userEmail,userName:null==f?void 0:f.userName,redlineId:null!==(i=null==u?void 0:u.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==f?void 0:f.baseApiUrl,redlineConfigId:null!==(n=null==f?void 0:f.redlineConfigId)&&void 0!==n?n:""},null!==(t=null==f?void 0:f.token)&&void 0!==t?t:"");await(null==b?void 0:b(d)),null==c||c({status:"success",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}})}catch(i){null==c||c({status:"failed",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}})}};return e.jsxs("div",{style:t.popup,children:[e.jsxs("div",{style:t.header,children:[e.jsx("span",{style:t.title,children:r||"Manually Edited"}),e.jsx("button",{onClick:d,style:t.closeButton,"aria-label":"Close",children:"✕"})]}),e.jsxs("div",{style:t.content,children:[e.jsxs("div",{style:t.labelRow,children:[e.jsx(i.UserPen,{}),e.jsx("span",{style:t.label,children:a||"Edited By"})]}),e.jsx("div",{style:t.editorInfo,children:o}),e.jsx("div",{style:t.divider}),e.jsxs("div",{style:t.actions,children:[null==s?void 0:s.map(i=>e.jsxs("button",{style:{...t.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==u?void 0:u.redline_id,id:null==u?void 0:u.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(v=null==u?void 0:u.redlining_details)||void 0===v?void 0:v.status)||"rejected"===(null===(p=null==u?void 0:u.redlining_details)||void 0===p?void 0:p.status))&&e.jsxs("div",{style:t.resolveActions,children:[e.jsxs("button",{style:{...t.actionBtn,...(null==u?void 0:u.resolving)?t.actionBtnDisabled:{}},disabled:null==u?void 0:u.resolving,onClick:()=>g("accept"),children:[e.jsx(i.CheckCircle,{size:16,color:"#10B981"})," ","Adopt"]}),e.jsxs("button",{style:{...t.actionBtn,...(null==u?void 0:u.resolving)?t.actionBtnDisabled:{}},onClick:()=>g("reject"),disabled:null==u?void 0:u.resolving,children:[e.jsx(i.XCircle,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),l=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),n=require("../../../../../service/redlineService.js");const t={popup:{width:400,background:"#fff",borderRadius:12,overflow:"hidden",boxShadow:"0 10px 30px rgba(0,0,0,0.15)",fontFamily:"Inter, sans-serif"},actionBtnDisabled:{opacity:.5,cursor:"not-allowed",pointerEvents:"none"},header:{background:"#dfe7f8",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 14px"},title:{fontSize:14,fontWeight:600,color:"#313949"},closeButton:{border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#616b7d"},content:{padding:"16px 22px"},labelRow:{display:"flex",alignItems:"center",gap:10,marginBottom:8},labelIcon:{fontSize:18},label:{fontSize:14,color:"#7b8495"},editorInfo:{fontSize:14,fontWeight:500,color:"#313949"},divider:{margin:"14px 0",height:1,background:"#e5e7eb"},actions:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:15},resolveActions:{display:"flex",justifyContent:"space-between",gap:15,alignItems:"center"},actionBtn:{border:"1px solid #d5dbe8",background:"#fff",borderRadius:10,padding:"8px",fontSize:14,cursor:"pointer",display:"flex",alignItems:"center",gap:10,color:"#596275"}};exports.default=function({onClose:d,editorInfo:o,headerText:r,btnsConfig:a,labelText:s,onActionTrigger:c,aiReason:u=null}){var v,p;const{redlineDcoumentId:f,redlineConfig:x,updateRedlineDataParent:b}=l.useRequirementAI(),g=async e=>{var i,l,t;try{await(null==c?void 0:c({status:"loading",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}}))}catch(e){}if(null==x?void 0:x.callResolveRedline)try{const{updated_reqai:d}=await n.resolveRedline({documentId:f,userEmail:null==x?void 0:x.userEmail,userName:null==x?void 0:x.userName,redlineId:null!==(i=null==u?void 0:u.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==x?void 0:x.baseApiUrl,redlineConfigId:null!==(l=null==x?void 0:x.redlineConfigId)&&void 0!==l?l:""},null!==(t=null==x?void 0:x.token)&&void 0!==t?t:"");await(null==b?void 0:b(d)),null==c||c({status:"success",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}})}catch(i){null==c||c({status:"failed",action:e,metadata:{redlineId:null==u?void 0:u.redline_id,aiReasonId:null==u?void 0:u.id}})}};return e.jsxs("div",{style:t.popup,children:[e.jsxs("div",{style:t.header,children:[e.jsx("span",{style:t.title,children:r||"Manually Edited"}),e.jsx("button",{onClick:d,style:t.closeButton,"aria-label":"Close",children:"✕"})]}),e.jsxs("div",{style:t.content,children:[e.jsxs("div",{style:t.labelRow,children:[e.jsx(i.UserPen,{}),e.jsx("span",{style:t.label,children:s||"Edited By"})]}),e.jsx("div",{style:t.editorInfo,children:o}),e.jsx("div",{style:t.divider}),e.jsxs("div",{style:t.actions,children:[null==a?void 0:a.map(i=>e.jsxs("button",{style:{...t.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==u?void 0:u.redline_id,id:null==u?void 0:u.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(v=null==u?void 0:u.redlining_details)||void 0===v?void 0:v.status)||"rejected"===(null===(p=null==u?void 0:u.redlining_details)||void 0===p?void 0:p.status))&&e.jsxs("div",{style:t.resolveActions,children:[e.jsxs("button",{style:{...t.actionBtn,...(null==u?void 0:u.resolving)?t.actionBtnDisabled:{}},disabled:null==u?void 0:u.resolving,onClick:()=>g("accept"),children:[e.jsx(i.CheckCircle,{size:16,color:"#10B981"})," ","Adopt"]}),e.jsxs("button",{style:{...t.actionBtn,...(null==u?void 0:u.resolving)?t.actionBtnDisabled:{}},onClick:()=>g("reject"),disabled:null==u?void 0:u.resolving,children:[e.jsx(i.XCircle,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})};
2
2
  //# sourceMappingURL=ManualEditPopup.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lucide-react"),i=require("react"),o=require("./PopupDefaults.js"),n=require("@mui/material"),r=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),s=require("./DeviationSummary.js"),l=require("../../../../../service/redlineService.js"),a=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function d(e){const t=new Date(e);if(isNaN(t.getTime()))return e;return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}const c=()=>e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e.jsx("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),e.jsx("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),u=()=>e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e.jsx("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),e.jsx("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),x=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}),h=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e.jsx("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),p=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e.jsx("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}),f=({open:t})=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"},children:e.jsx("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),g=({color:t="#3b82f6"})=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M1.5 3.5v4h4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 5v3.5l2 1.5",stroke:t,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),j=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),k=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]});function b({title:t,open:i,onToggle:o,children:n}){return e.jsxs("div",{children:[e.jsxs("div",{onClick:o,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:t}),e.jsx(f,{open:i})]}),e.jsx("div",{style:{maxHeight:i?100:0,opacity:i?1:0,transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"},children:i&&e.jsx(e.Fragment,{children:n})})]})}function v({icon:t,label:i,onClick:o,customStyle:n={},disabled:r=!1,disabledStyle:s={}}){const l={display:"flex",alignItems:"center",gap:10,padding:"8px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:r?.5:1,...n,...r?s:{}};return e.jsxs("button",{onClick:r?void 0:o,disabled:r,style:l,onMouseEnter:e=>{r||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")},children:[t,i]})}exports.ApprovedIcon=c,exports.ChevronIcon=f,exports.CloseIcon=x,exports.HistoryIcon=g,exports.IterateIcon=k,exports.RedlineCard=function({status:f,onClose:y,impactText:m,secondText:C,actionTakenByName:I,actionTakenAtTime:R="NA",onHistory:S,onIterate:w,onActionTrigger:B,disableAllActions:T=!1,impactTitle:L="Impact",customConfigs:W={},customStyles:M={},secondaryTitle:D,onAssignClick:A,onReviewUsersClick:U,assignedUsers:q,redlineId:z,aiReasonId:H,cognitiveIconSmall:N,cognitiveTootipTitle:O="Cognitive Decisioning",historyIconSmall:E,onHistoryClick:F,historyTootipTitle:P,onOpenCognitive:$}){const[_,K]=i.useState(!0),[V,Y]=i.useState(!0),[G,J]=i.useState(!1);i.useState(!1);const{redlineDcoumentId:Q,redlineConfig:X,updateRedlineDataParent:Z}=a.useRequirementAI(),ee={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:e.jsx(h,{}),StatusIcon:e.jsx(c,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:e.jsx(g,{}),label:"History",onClick:S},{icon:e.jsx(t.Undo2,{size:17}),label:"Revert",useLabel:!0},{icon:e.jsx(k,{}),label:"Iterate",onClick:w}],fallbackText:"No original text available"},te={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:e.jsx(p,{}),StatusIcon:e.jsx(u,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:e.jsx(g,{color:"#3b82f6"}),label:"History",onClick:S},{icon:e.jsx(j,{}),label:"Reinstate",useLabel:!0},{icon:e.jsx(k,{}),label:"Iterate",onClick:w}],fallbackText:"No rejected recommendation available"},ie={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:e.jsx(h,{}),StatusIcon:e.jsx(t.Undo2,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:e.jsx(g,{}),label:"History",onClick:S},{icon:e.jsx(k,{}),label:"Iterate",onClick:w}],fallbackText:"No reverted redline available"};let oe;oe="accepted"===f?ee:"rejected"===f?te:ie;const ne={...oe,...W[f]||{}};return e.jsxs("div",{style:{...o.default.RedlineCardDefaults.root,animation:G?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":o.default.RedlineCardDefaults.root.animation,...M.root},children:[e.jsxs("div",{style:{...o.default.RedlineCardDefaults.header,background:ne.headerBg,borderBottom:`1.5px solid ${ne.headerBorder}`,...M.header},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:ne.StatusIcon}),e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:15,fontWeight:700,color:ne.titleColor,letterSpacing:"-0.01em"},children:ne.label}),e.jsx(n.Tooltip,{title:D,children:e.jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",fontSize:12,color:"gray"},children:D})})]}),q&&q.length>0&&e.jsx(s.DisplayUsers,{users:q,onClick:e=>{e.stopPropagation(),null==U||U()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(A||$||F)&&e.jsx(s.KebabMenu,{onAssignClick:A,onOpenCognitive:$,cognitiveIconSmall:N,cognitiveTootipTitle:O,historyIconSmall:E,onHistoryClick:F,historyTootipTitle:P}),e.jsx("button",{onClick:()=>{J(!0),y()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"},children:e.jsx(x,{})})]})]}),e.jsxs("div",{style:{...o.default.RedlineCardDefaults.body,...M.body},children:[e.jsxs("div",{style:{...o.default.RedlineCardDefaults.meta,...M.meta},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:5},children:[ne.UserIcon,e.jsx("span",{style:{fontSize:12.5,color:"#94a3b8",fontWeight:500},children:ne.metaLabel})]}),e.jsxs("div",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:[e.jsx(n.Tooltip,{title:I,children:e.jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:I})}),e.jsx("span",{children:d(R)})]})]}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.divider,...M.divider}}),e.jsx(b,{title:L,open:_,onToggle:()=>K(e=>!e),children:e.jsx("div",{style:{...o.default.RedlineCardDefaults.impactText,...M.impactText},children:e.jsx(r.AiReasonMarkdownWrapper,{message:`${m||""} [View chat](chat_citation$all)`,customStyles:M.impactMarkdown})})}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.divider,...M.divider}}),e.jsx(b,{title:ne.secondTitle,open:V,onToggle:()=>Y(e=>!e),children:C?e.jsx("div",{style:{...o.default.RedlineCardDefaults.secondSection,background:ne.secondBg,border:`1.5px solid ${ne.secondBorder}`,...M.secondSection},children:C}):e.jsxs("div",{style:{...o.default.RedlineCardDefaults.fallbackSectionStyle,...M.fallbackSectionStyle},children:[ne.fallbackText," "]})}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.actionsContainer,...M.actionsContainer},children:ne.actions.map(t=>e.jsx(v,{icon:t.icon,label:t.label,onClick:()=>{var e;t.useLabel?(async e=>{var t,i;null==B||B({status:"loading",action:e,metadata:{redlineId:z,aiReasonId:H}});try{const{updated_reqai:o}=await l.resolveRedline({documentId:Q,userEmail:null==X?void 0:X.userEmail,userName:null==X?void 0:X.userName,redlineId:null!=z?z:"",action:e,baseApiUrl:null==X?void 0:X.baseApiUrl,redlineConfigId:null!==(t=null==X?void 0:X.redlineConfigId)&&void 0!==t?t:""},null!==(i=null==X?void 0:X.token)&&void 0!==i?i:"");await(null==Z?void 0:Z(o)),null==B||B({status:"success",action:e,metadata:{redlineId:z,aiReasonId:H}})}catch(t){null==B||B({status:"failed",action:e,metadata:{redlineId:z,aiReasonId:H}})}})(t.label.toLowerCase()):null===(e=t.onClick)||void 0===e||e.call(t)},customStyle:{...t.style,...M.actionBtn},disabled:T||t.disabled,disabledStyle:M.actionBtnDisabled},t.label))})]})]})},exports.ReinstateIcon=j,exports.RejectedIcon=u,exports.UserApprovedIcon=h,exports.UserRejectedIcon=p,exports.formatDate=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lucide-react"),i=require("react"),o=require("./PopupDefaults.js"),n=require("@mui/material"),r=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),s=require("./DeviationSummary.js"),l=require("../../../../../service/redlineService.js"),a=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function d(e){const t=new Date(e);if(isNaN(t.getTime()))return e;return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}const c=()=>e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e.jsx("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),e.jsx("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),u=()=>e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e.jsx("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),e.jsx("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),x=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}),h=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e.jsx("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),p=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e.jsx("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}),f=({open:t})=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"},children:e.jsx("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),g=({color:t="#3b82f6"})=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M1.5 3.5v4h4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 5v3.5l2 1.5",stroke:t,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),j=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),k=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]});function b({title:t,open:i,onToggle:o,children:n}){return e.jsxs("div",{children:[e.jsxs("div",{onClick:o,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:t}),e.jsx(f,{open:i})]}),e.jsx("div",{style:{maxHeight:i?100:0,opacity:i?1:0,transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"},children:i&&e.jsx(e.Fragment,{children:n})})]})}function v({icon:t,label:i,onClick:o,customStyle:n={},disabled:r=!1,disabledStyle:s={}}){const l={display:"flex",alignItems:"center",gap:10,padding:"8px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:r?.5:1,...n,...r?s:{}};return e.jsxs("button",{onClick:r?void 0:o,disabled:r,style:l,onMouseEnter:e=>{r||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")},children:[t,i]})}exports.ApprovedIcon=c,exports.ChevronIcon=f,exports.CloseIcon=x,exports.HistoryIcon=g,exports.IterateIcon=k,exports.RedlineCard=function({status:f,onClose:y,impactText:m,secondText:C,actionTakenByName:I,actionTakenAtTime:R="NA",onHistory:w,onIterate:S,onActionTrigger:B,disableAllActions:T=!1,impactTitle:L="Impact",customConfigs:W={},customStyles:M={},secondaryTitle:D,onAssignClick:A,onReviewUsersClick:U,assignedUsers:q,redlineId:z,aiReasonId:H,cognitiveIconSmall:N,cognitiveTootipTitle:O="Cognitive Decisioning",historyIconSmall:E,onHistoryClick:F,historyTootipTitle:P,onOpenCognitive:$}){const[_,K]=i.useState(!0),[V,Y]=i.useState(!0),[G,J]=i.useState(!1);i.useState(!1);const{redlineDcoumentId:Q,redlineConfig:X,updateRedlineDataParent:Z}=a.useRequirementAI(),ee={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:e.jsx(h,{}),StatusIcon:e.jsx(c,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:e.jsx(g,{}),label:"History",onClick:w},{icon:e.jsx(t.Undo2,{size:17}),label:"Revert",useLabel:!0},{icon:e.jsx(k,{}),label:"Iterate",onClick:S}],fallbackText:"No original text available"},te={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:e.jsx(p,{}),StatusIcon:e.jsx(u,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:e.jsx(g,{color:"#3b82f6"}),label:"History",onClick:w},{icon:e.jsx(j,{}),label:"Reinstate",useLabel:!0},{icon:e.jsx(k,{}),label:"Iterate",onClick:S}],fallbackText:"No rejected recommendation available"},ie={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:e.jsx(h,{}),StatusIcon:e.jsx(t.Undo2,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:e.jsx(g,{}),label:"History",onClick:w},{icon:e.jsx(k,{}),label:"Iterate",onClick:S}],fallbackText:"No reverted redline available"};let oe;oe="accepted"===f?ee:"rejected"===f?te:ie;const ne={...oe,...W[f]||{}};return e.jsxs("div",{style:{...o.default.RedlineCardDefaults.root,animation:G?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":o.default.RedlineCardDefaults.root.animation,...M.root},children:[e.jsxs("div",{style:{...o.default.RedlineCardDefaults.header,background:ne.headerBg,borderBottom:`1.5px solid ${ne.headerBorder}`,...M.header},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:ne.StatusIcon}),e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:15,fontWeight:700,color:ne.titleColor,letterSpacing:"-0.01em"},children:ne.label}),e.jsx(n.Tooltip,{title:D,children:e.jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",fontSize:12,color:"gray"},children:D})})]}),q&&q.length>0&&e.jsx(s.DisplayUsers,{users:q,onClick:e=>{e.stopPropagation(),null==U||U()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(A||$||F)&&e.jsx(s.KebabMenu,{onAssignClick:A,onOpenCognitive:$,cognitiveIconSmall:N,cognitiveTootipTitle:O,historyIconSmall:E,onHistoryClick:F,historyTootipTitle:P}),e.jsx("button",{onClick:()=>{J(!0),y()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"},children:e.jsx(x,{})})]})]}),e.jsxs("div",{style:{...o.default.RedlineCardDefaults.body,...M.body},children:[e.jsxs("div",{style:{...o.default.RedlineCardDefaults.meta,...M.meta},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:5},children:[ne.UserIcon,e.jsx("span",{style:{fontSize:12.5,color:"#94a3b8",fontWeight:500},children:ne.metaLabel})]}),e.jsxs("div",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:[e.jsx(n.Tooltip,{title:I,children:e.jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:I})}),e.jsx("span",{children:d(R)})]})]}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.divider,...M.divider}}),e.jsx(b,{title:L,open:_,onToggle:()=>K(e=>!e),children:e.jsx("div",{style:{...o.default.RedlineCardDefaults.impactText,...M.impactText},children:e.jsx(r.AiReasonMarkdownWrapper,{message:`${m||""} [View chat](chat_citation$all)`,customStyles:M.impactMarkdown})})}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.divider,...M.divider}}),e.jsx(b,{title:ne.secondTitle,open:V,onToggle:()=>Y(e=>!e),children:C?e.jsx("div",{style:{...o.default.RedlineCardDefaults.secondSection,background:ne.secondBg,border:`1.5px solid ${ne.secondBorder}`,...M.secondSection},children:C}):e.jsxs("div",{style:{...o.default.RedlineCardDefaults.fallbackSectionStyle,...M.fallbackSectionStyle},children:[ne.fallbackText," "]})}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.actionsContainer,...M.actionsContainer},children:ne.actions.map(t=>e.jsx(v,{icon:t.icon,label:t.label,onClick:()=>{var e;t.useLabel?(async e=>{var t,i;try{await(null==B?void 0:B({status:"loading",action:e,metadata:{redlineId:z,aiReasonId:H}}))}catch(e){}if(null==X?void 0:X.callResolveRedline)try{const{updated_reqai:o}=await l.resolveRedline({documentId:Q,userEmail:null==X?void 0:X.userEmail,userName:null==X?void 0:X.userName,redlineId:null!=z?z:"",action:e,baseApiUrl:null==X?void 0:X.baseApiUrl,redlineConfigId:null!==(t=null==X?void 0:X.redlineConfigId)&&void 0!==t?t:""},null!==(i=null==X?void 0:X.token)&&void 0!==i?i:"");await(null==Z?void 0:Z(o)),null==B||B({status:"success",action:e,metadata:{redlineId:z,aiReasonId:H}})}catch(t){null==B||B({status:"failed",action:e,metadata:{redlineId:z,aiReasonId:H}})}})(t.label.toLowerCase()):null===(e=t.onClick)||void 0===e||e.call(t)},customStyle:{...t.style,...M.actionBtn},disabled:T||t.disabled,disabledStyle:M.actionBtnDisabled},t.label))})]})]})},exports.ReinstateIcon=j,exports.RejectedIcon=u,exports.UserApprovedIcon=h,exports.UserRejectedIcon=p,exports.formatDate=d;
2
2
  //# sourceMappingURL=RedlineStatusCard.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("lucide-react"),n=require("showdown"),o=require("@mui/material"),i=require("../../icons/Illustration.svg.js"),s=require("uuid"),a=require("./UserStoryCard.module.css.js"),r=require("../../utils/helpers.js"),d=require("../../utils/user-story.utils.js"),u=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),v=require("../userstory-with-citation/UserStoryWithCitation.js"),p=require("../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("../story-screen/BigEnoughPanel.js"),m=require("./TitleEditor/TitleEditor.js"),y=require("../../../../service/redlineService.js"),h=require("./ClinicalTrialSection.js"),S=require("../story-screen/CompletionPanel.js"),g=require("../../icons/CDIcon.js");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=C(n);const I={[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 j(t){const n=[],i=/<learned>(.*?)<\/learned>/g;let a,r=0,d=0;for(;null!==(a=i.exec(t));){const[,u]=a,c=a.index;c>r&&n.push(e.jsx("span",{children:t.slice(r,c)},"text-pre-"+d++)),n.push(e.jsx(o.Tooltip,{title:u,placement:"top",children:e.jsx(l.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${s.v4()}`)),r=i.lastIndex}return r<(null==t?void 0:t.length)&&n.push(e.jsx("span",{children:t.slice(r)},"text-post-"+d++)),n}function b(e,t,l){var n;if(!e)return{};if(t)return{...e.parentConfig};const o={...e.childConfig};return l&&(null===(n=e.subFeatureOverrides)||void 0===n?void 0:n[l])?{...o,...e.subFeatureOverrides[l]}:o}const w=({displayName:t})=>{var n;const{customStyles:o}=p.useRequirementAI(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e.jsxs("div",{className:a.default.displayName,style:null==i?void 0:i.wrapper,children:[e.jsx(l.Bookmark,{className:a.default.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e.jsxs("span",{style:null==i?void 0:i.label,children:[t,":"]})]})},N=({isUserStoryCurrentlyUpdated:n,artifactId:C,artifactTitleId:E,parentUserStory:D,currentUserStory:B,onUserStoryChange:A,parentIndex:T,currentIndex:k,enableDownload:U,isDiffEditReviewMode:P,showUserStoryDiff:R,handleDownloadUserStory:M,handleOpenSendDialog:_,updateUserStoryArtifact:q,selectedArtifactId:L,isDisplayHighlightControl:F,elementDisplayConfig:O,_resolvedConfig:z,showWrapper:V=!1,defaultExpanded:W,actionItemsConfig:G,onDelete:$,contextVariant:H,expandedSubFeatures:Q,showDisplayName:Y=!0,allowTitleEdit:X=!0,showConfidenceScore:Z=!0,showBorderTop:J=!0,sectionStatusConfig:K,showCompletionPanel:ee=!1,completionPanelConfig:te,showAddSectionButton:le=!1,disableEditPlan:ne=!1,useMuiTooltip:oe=!1,approveButtonConfig:ie,editButtonConfig:se,CDNeededInChip:ae,blockNumber:re,showAssignSection:de=!1,disableAssignSection:ue=!1,onAssignSectionClick:ce})=>{var ve,pe,fe,me,ye,he,Se,ge,Ce,xe,Ie,je,be,we,Ne,Ee,De,Be,Ae,Te,ke,Ue,Pe,Re;const{isLoadingSectionData:Me=!1,onLoadSectionData:_e,status:qe,onStatusClick:Le,completedCount:Fe,totalCount:Oe,isNoDataAvailable:ze=!1}=null!=K?K:{},{searchQueryList:Ve,citations:We,customStyles:Ge,onEditBlocked:$e,redlineDcoumentId:He,redlineConfig:Qe,customSectionConfig:Ye,updateRedlineDataParent:Xe,aiReasoning:Ze}=p.useRequirementAI(),Je=null==Ge?void 0:Ge.userStoryCardStyles,Ke=null==Je?void 0:Je.customSectionEditButton,et=null==Je?void 0:Je.statusStyles,tt=null===(ve=null==Ge?void 0:Ge.userStoryCardStyles)||void 0===ve?void 0:ve.userStoryEditStyles,lt=null===(pe=null==Ge?void 0:Ge.userStoryScreenStyles)||void 0===pe?void 0:pe.userStoryContentStyles,nt=null==Je?void 0:Je.progressHeaderStyles,ot=null==Je?void 0:Je.clinicalTrialSectionStyles,it=null==Je?void 0:Je.CompletionStyles,st=null==Je?void 0:Je.noDataStyles,at=null==Je?void 0:Je.approveButtonStyles,rt=null!==(me=null===(fe=null==Ye?void 0:Ye.shouldRender)||void 0===fe?void 0:fe.call(Ye,B))&&void 0!==me&&me,dt=null===(ye=null==Ye?void 0:Ye.getValue)||void 0===ye?void 0:ye.call(Ye,B),ut=null!==(Se=null===(he=null==Ye?void 0:Ye.getFields)||void 0===he?void 0:he.call(Ye,B))&&void 0!==Se?Se:[],ct=null!==(ge=null==Ye?void 0:Ye.isEditDisabled)&&void 0!==ge&&ge,vt=null!==(xe=null===(Ce=null==Ye?void 0:Ye.isSaving)||void 0===Ce?void 0:Ce.call(Ye,B))&&void 0!==xe&&xe,pt=(ft=null!==(Ie=B.completion_percentage)&&void 0!==Ie?Ie:0,mt=it,ft>=80?null==mt?void 0:mt.highCompletion:ft>=50?null==mt?void 0:mt.mediumCompletion:null==mt?void 0:mt.lowCompletion);var ft,mt;const yt={[p.SectionStatus.WAITING]:null==et?void 0:et.waiting,[p.SectionStatus.IN_PROGRESS]:null==et?void 0:et.inProgress,[p.SectionStatus.GENERATED]:null==et?void 0:et.generated,[p.SectionStatus.FAILED]:null==et?void 0:et.failed,[p.SectionStatus.GENERATE]:null==et?void 0:et.generate,[p.SectionStatus.APPROVED]:null==et?void 0:et.approved},[ht,St]=t.useState({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),[gt,Ct]=t.useState({userStory:!!B.isDefaultEdit}),[xt,It]=t.useState(!1),[jt,bt]=t.useState(!1),[wt,Nt]=t.useState(null),[Et,Dt]=t.useState(null),{userStory:Bt,customIcons:At}=p.useRequirementAI(),[Tt,kt]=t.useState(null!=W?W:""===T||L===B.artifactId||!!B.isDefaultOpen),[Ut,Pt]=t.useState(!1),[Rt,Mt]=t.useState(null),[_t,qt]=t.useState(null),[Lt,Ft]=t.useState(!1),Ot=t.useRef(null),zt=t.useRef(null),[Vt,Wt]=t.useState(!1),[Gt,$t]=t.useState(!1),Ht=t.useRef(null),[Qt,Yt]=t.useState(!1),[Xt,Zt]=t.useState(B.value);t.useEffect(()=>{n&&kt(n)},[n]),t.useEffect(()=>{St({...structuredClone(B),value:r.formatMarkdown(B.value)||""})},[B]),t.useEffect(()=>{Ve.length>0?kt(!0):void 0===W&&L&&kt(L===B.artifactId)},[Ve,L,B.artifactId]),t.useEffect(()=>{Q&&Q.length>0&&kt(Q.includes(B.artifactId)||""===T||L===B.artifactId||!!B.isDefaultOpen)},[Q]);const Jt=()=>{Mt(null)},Kt=()=>{qt(null)},el=()=>{Tt&&gt.userStory&&zt.current&&!zt.current.requestClose()||kt(e=>!e)},tl=async()=>{var e,t;try{"userStory"==="userStory"&&(A(ht),console.log("I am changing RTE editor values",ht)),await(null===(e=null==se?void 0:se.onSaveEditedSection)||void 0===e?void 0:e.call(se,ht)),await q(We,Bt,C,null===(t=Ht.current)||void 0===t?void 0:t.signal)}finally{}};const ll=null!=(null==B?void 0:B.big_enough)&&!Number.isNaN(B.big_enough)&&!!(null==B?void 0:B.big_enough_decision_factors),nl=null!==(je=null==B?void 0:B.completion_percentage)&&void 0!==je?je:0,ol=!!(null==B?void 0:B.completion_decision_factors),il=""===T,sl=null!=z?z:b(O,il),al=!P&&!R;t.useEffect(()=>{if(!Et)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${Et}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[Et]),t.useEffect(()=>{B.isDefaultEdit&&Ct(e=>({...e,userStory:!0}))},[B.isDefaultEdit]),console.log("block number in userstory card ",re),console.log("[TESTING-CURRENT-USER-STORY] \n",B,"\n[TESTING-USER-STORY] \n",Bt);return t.useEffect(()=>Zt(B.value),[B.value]),e.jsxs("div",{className:a.default.card,"data-block-id":"user-story-card-wrapper-"+re,style:null==Je?void 0:Je.cardStyle,id:`story-card-${B.title}`,"data-expanded":Tt,children:[e.jsxs("div",{className:a.default.titleSection,style:null==Je?void 0:Je.titleSection,children:[e.jsxs("div",{className:a.default.titleRow,style:null==Je?void 0:Je.titleRow,onClick:el,children:[e.jsxs("div",{className:a.default.titleLeft,style:null==Je?void 0:Je.titleLeft,onMouseEnter:()=>Wt(!0),onMouseLeave:()=>Wt(!1),children:[Y&&e.jsx(w,{displayName:E}),xt&&al?e.jsx(m.InlineTitleEditor,{title:B.title,onSave:e=>(async(e,t)=>{var l;try{let n={...B};B.artifactId===t?n.title=e:n.sub_features=(null===(l=B.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],St(n),A(n),It(!1)}catch(e){console.error("Failed to save title",e)}})(e,B.artifactId),onCancel:()=>{It(!1)},inputStyle:null==tt?void 0:tt.inlineTitleInput,confirmButtonStyle:null==tt?void 0:tt.inlineTitleConfirm,cancelButtonStyle:null==tt?void 0:tt.inlineTitleCancel},"inline-title-editor"):e.jsxs("div",{className:a.default.storyTitleWrapper,children:[e.jsx(o.Tooltip,{title:j(B.title),arrow:!0,children:e.jsx("h2",{title:oe?void 0:B.title,className:a.default.storyTitle,style:null==Je?void 0:Je.storyTitle,children:j(B.title)},B.artifactId)}),ee&&(ol?e.jsx(S.CompletionPanel,{customIcons:null==At?void 0:At.userStoryIcons,customStyles:null==Je?void 0:Je.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==Je?void 0:Je.CompletionStyles,onToggleStateChange:$t,completionPanelConfig:te,children:e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==it?void 0:it.badge,...pt},children:[e.jsxs("span",{children:[nl,"% Completed"]}),e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(g.default,{color:"currentColor"})}),Gt?e.jsx(l.ChevronUp,{size:14,style:null==it?void 0:it.chevronStyle}):e.jsx(l.ChevronDown,{size:14,style:null==it?void 0:it.chevronStyle})]})}):e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==it?void 0:it.badge,...pt},children:e.jsxs("span",{children:[nl,"% Completed"]})})),X&&e.jsx("button",{type:"button",className:a.default.titleEditButton,style:null==tt?void 0:tt.titleEditButton,onClick:e=>{e.stopPropagation(),It(!0),Tt||kt(!0)},"aria-label":"Edit title",title:"Edit title",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.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"})})})]})]}),(qe||void 0!==Fe&&void 0!==Oe)&&e.jsxs("div",{className:a.default.statusContainer,children:[void 0!==Fe&&void 0!==Oe&&e.jsxs("div",{className:a.default.completedBadge,children:["Completed: ",Fe,"/",Oe]}),qe&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==Le||Le()},onMouseEnter:()=>Yt(!0),onMouseLeave:()=>Yt(!1),className:a.default.statusButton,style:{...null===(be=yt[qe])||void 0===be?void 0:be.default,...Qt&&(null===(we=yt[qe])||void 0===we?void 0:we.hover)},children:I[qe]})]}),e.jsxs("div",{className:a.default.titleActions,style:null==Je?void 0:Je.titleActions,onClick:e=>e.stopPropagation(),children:[(sl.showProgressPercentage||sl.showGapBox)&&V&&e.jsxs("div",{className:a.default.progressHeader,style:null==nt?void 0:nt.wrapper,children:[sl.showProgressPercentage&&e.jsxs("div",{className:a.default.progressPercentage,style:null==nt?void 0:nt.percentage,children:[null!==(Ee=null!==(Ne=null==B?void 0:B.confidenceScore)&&void 0!==Ne?Ne:null==sl?void 0:sl.confidenceValue)&&void 0!==Ee?Ee:"0","%"]}),sl.showGapBox&&e.jsxs("div",{className:a.default.gapBox,style:null==nt?void 0:nt.gapBox,children:[null!==(Be=null!==(De=null==B?void 0:B.gapValue)&&void 0!==De?De:null==sl?void 0:sl.gapBoxValue)&&void 0!==Be?Be:"2"," ","Gaps"]})]}),ll&&e.jsx(f.BigEnoughPanel,{customIcons:null==At?void 0:At.userStoryIcons,customStyles:null==Je?void 0:Je.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==Je?void 0:Je.BigEnoughStyles}),de&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==Je?void 0:Je.iconButton,disabled:ue,onClick:e=>{e.stopPropagation(),null==ce||ce(B)},"aria-label":"Assign section users",title:"Assign section users",children:e.jsx(l.Users,{size:16})}),!gt.userStory&&e.jsxs(e.Fragment,{children:[!1!==(null==sl?void 0:sl.showShareButton)&&e.jsx("button",{className:a.default.iconButton,style:null==Je?void 0:Je.iconButton,onClick:e=>{Mt(e.currentTarget)},children:e.jsx(l.ExternalLink,{size:16})}),e.jsxs(o.Menu,{id:"user-story-share-menu",anchorEl:Rt,open:!!Rt,onClose:()=>Mt(null),style:null==Je?void 0:Je.userStoryShareMenu,children:[U&&e.jsx(o.MenuItem,{style:null==Je?void 0:Je.userStoryMenuItem,onClick:async()=>{Pt(!0),M&&(await Promise.all([M("pdf"),M("doc")]),Pt(!1))},children:e.jsxs("div",{ref:Ot,className:a.default.menuItemContent,style:null==Je?void 0:Je.menuItemContent,children:[e.jsx(l.Download,{size:16,color:null==Je?void 0:Je.menuIconColor}),e.jsx("p",{style:null==Je?void 0:Je.menuLabel,children:"Download"})]})}),e.jsx(o.MenuItem,{style:null==Je?void 0:Je.userStoryMenuItem,onClick:async()=>{let e=B;D&&(e={...B,value:`${d.replaceTitleSection(null==D?void 0:D.value,B.title)} \n${B.value}`}),null==_||_(!0,[e],B.artifactId),Jt()},children:e.jsxs("div",{style:null==Je?void 0:Je.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Share2,{size:16,color:null==Je?void 0:Je.menuIconColor}),e.jsx("p",{style:null==Je?void 0:Je.menuLabel,children:"Send"})]})}),e.jsx(o.MenuItem,{style:null==Je?void 0:Je.userStoryMenuItem,onClick:async()=>{const e=(new x.default.Converter).makeHtml(r.formatMarkdown(B.value)||B.value),t=function(e){const t=(new x.default.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(r.formatMarkdown(B.value)||B.value),l=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([l]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{Jt()}},children:e.jsxs("div",{style:null==Je?void 0:Je.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Copy,{size:16,color:null==Je?void 0:Je.menuIconColor}),e.jsx("p",{style:null==Je?void 0:Je.menuLabel,children:"Copy"})]})})]})]}),!Lt&&gt.userStory&&Tt?e.jsx(u.default,{type:"outline",children:"Cancel",style:null==Je?void 0:Je.cancelButton,onClick:()=>{var e;null===(e=Ht.current)||void 0===e||e.abort(),Ct(e=>({...e,userStory:!1}))}}):e.jsx(e.Fragment,{}),gt.userStory&&Tt?e.jsx(u.default,{type:"fill",children:Lt?e.jsxs("span",{className:a.default.savingSpinner,style:null==Je?void 0:Je.savingSpinner,children:[e.jsx(l.LoaderCircle,{className:a.default.spinAnimation,style:null==Je?void 0:Je.spinAnimation}),e.jsx("span",{children:"Saving..."})]}):"Save",isDisable:Lt,style:Lt?null==Je?void 0:Je.savingButton:null==Je?void 0:Je.saveButton,onClick:async()=>{Ft(!0),await tl();let e=await(async()=>{var e,t,l,n,o;let i=ht.value;console.log("[V] valueToUpdate before",i),i=i.replace(/<invisible\s+id="([^"]+)"\s*><\/invisible>/gi,"\x3c!-- $1 --\x3e"),console.log("[V] valueToUpdate after",i);try{if(null==Qe?void 0:Qe.callUpdateDocument){const{updated_reqai:s}=await y.updateRedlineDocument({documentId:He,sectionId:B.artifactId,baseApiUrl:null==Qe?void 0:Qe.baseApiUrl,updatedContent:i,userEmail:Qe.userEmail,userName:Qe.userName,redlineConfigId:null!==(e=Qe.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Qe?void 0:Qe.token)&&void 0!==t?t:"");i=null===(o=null===(n=null===(l=null==s?void 0:s.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==Xe?void 0:Xe(s))}}catch(e){console.error("failed to update redline document",e),i=Xt}return i=i.replace(/<!--\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\s*-->/gi,'<invisible id="$1"></invisible>'),i})();const t={...ht,value:e};A({...t,isDefaultEdit:!1}),Zt(t.value),Ct(e=>({...e,userStory:!1})),Ft(!1)}}):!P&&!R&&!ne&&Tt&&!1!==(null==sl?void 0:sl.showEditButton)&&e.jsx("button",{className:a.default.iconButton,style:null==Je?void 0:Je.editButton,onClick:()=>Ct(e=>({...e,userStory:!0})),children:e.jsx(l.PencilIcon,{color:null==Je?void 0:Je.pencilIconColor,size:16})}),le&&il&&Tt&&!P&&!R&&!1!==(null==sl?void 0:sl.showEditButton)&&e.jsxs("button",{type:"button",className:a.default.addSectionButton,style:null==tt?void 0:tt.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=B.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:s.v4(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...B,sub_features:[...null!==(n=B.sub_features)&&void 0!==n?n:[],i]};St(a),A(a),kt(!0),Dt(i.title)},"aria-label":"Add section",title:"Add section",children:[e.jsx(l.Plus,{size:14}),e.jsx("span",{className:a.default.addSectionLabel,children:"Add Section"})]}),!il&&!P&&!ne&&!R&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==$||$()},className:a.default.iconButton,style:null==tt?void 0:tt.deleteButton,"aria-label":"Delete section",title:"Delete section",children:e.jsx(l.Trash2,{size:16})}),rt&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==Ke?void 0:Ke.button,disabled:ct,onClick:e=>{if(e.stopPropagation(),jt)return Nt(null),void bt(!1);Nt(structuredClone(null!=dt?dt:{})),kt(!0),bt(!0)},children:jt?e.jsx(l.X,{size:16,color:null==Je?void 0:Je.pencilIconColor,style:null==Ke?void 0:Ke.cancelIcon}):e.jsx(l.PencilIcon,{size:16,color:null==Je?void 0:Je.pencilIconColor,style:null==Ke?void 0:Ke.editIcon})}),(null==sl?void 0:sl.actionItemsButton)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:a.default.actionItemBtn,style:null==Je?void 0:Je.actionItemBtn,onClick:e=>{e.stopPropagation(),qt(e.currentTarget)},children:e.jsx(l.Ellipsis,{})}),e.jsx(o.Menu,{id:"user-story-action-menu",anchorEl:_t,open:!!_t,onClose:Kt,style:null==Je?void 0:Je.userStoryShareMenu,children:null==G?void 0:G.items.map((t,l)=>e.jsx(o.MenuItem,{style:null==Je?void 0:Je.userStoryMenuItem,onClick:()=>{t.onclick(B),Kt()},children:e.jsxs("div",{className:a.default.menuItemContent,style:{...null==Je?void 0:Je.menuItemContent,...!t.isActive&&{cursor:"not-allowed",opacity:.5}},children:[e.jsx("span",{className:a.default.menuItemIcon,style:null==Je?void 0:Je.menuItemIcon,children:t.icon}),e.jsx("p",{style:null==Je?void 0:Je.menuLabel,children:t.name}),e.jsx("span",{className:a.default.menuItemRight,style:null==Je?void 0:Je.menuItemRight})]})},`action-item-${l}-${t.name}`))})]}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),el()},style:null==Je?void 0:Je.chevronButton,className:a.default.chevronButton,children:Tt?e.jsx(l.ChevronUp,{className:a.default.chevronIcon,color:null==Je?void 0:Je.chevronIconColor}):e.jsx(l.ChevronDown,{className:a.default.chevronIcon,color:null==Je?void 0:Je.chevronIconColor})})]})]}),e.jsx("div",{className:a.default.divider,style:null==Je?void 0:Je.dividerStyle})]}),Tt&&e.jsx("div",{className:a.default.cardContent,style:{...null==Je?void 0:Je.cardContentStyle,borderTop:J?"1px solid #E5E5E5":"none"},children:Me?e.jsxs("div",{className:a.default.loadingContainer,children:[e.jsx("div",{className:a.default.loadingIconWrapper,children:e.jsx(l.Hourglass,{size:28,color:"#5B3DF5",className:a.default.spinAnimation})}),e.jsxs("div",{children:[e.jsx("h3",{className:a.default.loadingTitle,children:"Section generation in progress.."}),e.jsx("p",{className:a.default.loadingSubtitle,children:"This may take a few minutes"})]}),e.jsx("button",{type:"button",onClick:()=>null==_e?void 0:_e(),className:a.default.viewStatusButton,children:"View Status"})]}):ze?e.jsxs("div",{className:a.default.noDataContainer,style:null==st?void 0:st.container,children:[e.jsx("img",{src:i.default,alt:"No data available",className:a.default.noDataIllustration,style:null==st?void 0:st.illustration}),e.jsx("h3",{className:a.default.noDataTitle,style:null==st?void 0:st.title,children:"No Data Available for This Section"}),e.jsx("p",{className:a.default.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."})]}):e.jsxs("div",{className:a.default.contentInner,style:null==Je?void 0:Je.contentInner,children:[e.jsxs("div",{className:a.default.descriptionSection,style:null==Je?void 0:Je.descriptionSection,children:[e.jsx("div",{className:a.default.justifyBetween,style:null==Je?void 0:Je.justifyBetween}),gt.userStory?e.jsx(c.default,{ref:zt,minHeight:"100%",height:"100%",type:"string",value:r.formatMarkdown(Xt)||"",handleUpdateState:(e,t)=>{const l=d.postprocessUserStoryAfterEdit(r.indentMarkdown(t));St(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:gt.userStory?"edit":"readOnly",onEditBlocked:$e,onSaveUnsavedChanges:async()=>{await tl(),kt(!1)},onDiscardUnsavedChanges:()=>{St({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),Ct(e=>({...e,userStory:!1})),kt(!1)},isSavingUnsavedChanges:Lt}):rt?e.jsx(h.default,{styles:ot,fields:ut,readonly:!jt,isSaving:vt,value:null!==(Ae=null!=wt?wt:dt)&&void 0!==Ae?Ae:{},onChange:Nt,onSave:async()=>{var e;wt&&(await(null===(e=null==Ye?void 0:Ye.onSave)||void 0===e?void 0:e.call(Ye,B,wt)),Nt(null),bt(!1))},onCancel:()=>{Nt(null),bt(!1)}}):e.jsxs(e.Fragment,{children:[e.jsx(v.default,{showUserStoryDiff:R,isParent:""===T,message:r.formatMarkdown(B.value)||"",artifactId:B.artifactId,customStyles:lt,isDisplayHighlightControl:F,contextVariant:H,showConfidenceScore:Z,CDNeededInChip:ae,blockId:re}),(ie||se)&&e.jsxs("div",{className:a.default.actionButtonsContainer,style:null==at?void 0:at.container,children:[se&&!gt.userStory&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:a.default.actionButton,style:null==at?void 0:at.button,disabled:se.disabled||se.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=se.onClick)||void 0===t||t.call(se),Ct(e=>({...e,userStory:!0})),kt(!0)},children:se.isLoading?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.actionButtonSpinner,style:null==at?void 0:at.icon}),e.jsx("span",{style:null==at?void 0:at.text,children:null!==(Te=se.label)&&void 0!==Te?Te:"Edit"})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.PencilIcon,{size:16,style:null==at?void 0:at.icon}),e.jsx("span",{style:null==at?void 0:at.text,children:null!==(ke=se.label)&&void 0!==ke?ke:"Edit"})]})}),ie&&e.jsx("span",{className:a.default.actionButtonDivider})]}),ie&&e.jsx("button",{type:"button",className:a.default.actionButton,style:null==at?void 0:at.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?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.actionButtonSpinner,style:null==at?void 0:at.icon}),e.jsx("span",{style:null==at?void 0:at.text,children:null!==(Ue=ie.label)&&void 0!==Ue?Ue:"Approve"})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Check,{size:16,style:null==at?void 0:at.icon}),e.jsx("span",{style:null==at?void 0:at.text,children:null!==(Pe=ie.label)&&void 0!==Pe?Pe:"Approve"})]})})]})]})]}),null===(Re=ht.sub_features)||void 0===Re?void 0:Re.map((t,l)=>{console.log("UserStoryCardWrapper: sub",t);const o=b(O,!1,t.artifactId);return e.jsx(N,{artifactId:C,isUserStoryCurrentlyUpdated:n,artifactTitleId:`${E}-${String.fromCharCode(65+l)}`,parentUserStory:B,parentIndex:`${T}${T&&"."}${k}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:t,onUserStoryChange:e=>((e,t)=>{const l=[...B.sub_features||[]];l[e]=t,A({...B,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:P,showUserStoryDiff:R,updateUserStoryArtifact:q,handleDownloadUserStory:M,handleOpenSendDialog:_,isDisplayHighlightControl:F,elementDisplayConfig:O,_resolvedConfig:o,actionItemsConfig:G,onDelete:()=>(e=>{const t=(B.sub_features||[]).filter((t,l)=>l!==e),l={...B,sub_features:t};St(l),A(l)})(l),expandedSubFeatures:Q,disableEditPlan:ne,useMuiTooltip:oe,blockNumber:t.blockNumber,showAssignSection:de,onAssignSectionClick:ce},t.artifactId)})]})})]})};exports.StoryCard=N,exports.UserStoryCardWrapper=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:m,elementDisplayConfig:h,showWrapper:S,actionItemsConfig:g,contextVariant:C,showDisplayName:x,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:w,defaultExpanded:E,showCompletionPanel:D=!1,completionPanelConfig:B,showAddSectionButton:A=!1,disableEditPlan:T=!1,useMuiTooltip:k=!1,approveButtonConfig:U,editButtonConfig:P,CDNeededInChip:R,setRedlineDocumentIdParent:M,showAssignSection:_,onAssignSectionClick:q,disableAssignSection:L})=>{const{userStory:F,setUserStory:O,customStyles:z,searchQueryList:V,currentHighlightIndex:W,setCurrentHighlightIndex:G,segmentComponentConfig:$,sectionStatusConfig:H,redlineConfig:Q,setRedlineDocumentId:Y}=p.useRequirementAI(),X=null==z?void 0:z.userStoryCardStyles,Z=0===W,J=W===V.length-1;return t.useEffect(()=>{if(!(null==Q?void 0:Q.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await y.getRedlineDocumentId({baseApiUrl:Q.documentBaseApiUrl||"",comparisonId:Q.documentComparisonId||""});if(t)Y(t);else{const{document_id:t}=await y.createRedlineDocument({baseApiUrl:Q.baseApiUrl,changelogConfigId:Q.changelogConfigId,comparisonId:Q.documentComparisonId,artifactId:Q.artifactId,inputData:Q.inputData,redlineConfigId:Q.redlineConfigId,userEmail:Q.userEmail,userName:Q.userName},null!==(e=null==Q?void 0:Q.token)&&void 0!==e?e:"");t&&(Y(t),null==M||M(t))}})()},[]),e.jsxs("div",{className:a.default.userStoryCardWrapper,style:m?{...null==X?void 0:X.userStoryCardWrapper,position:"relative"}:null==X?void 0:X.userStoryCardWrapper,children:[m&&e.jsx(e.Fragment,{children:V.length>0&&e.jsx("div",{className:a.default.wrapper,children:e.jsx("div",{className:a.default.highlightNavigation,children:e.jsxs("div",{className:a.default.navigationContainer,children:[e.jsxs("span",{className:a.default.navCounter,children:[W+1," of ",V.length]}),e.jsxs("div",{className:a.default.navButtons,children:[e.jsx("button",{onClick:()=>{W>0&&G(e=>e-1)},className:a.default.navButton,disabled:Z,children:e.jsx(l.ChevronUpIcon,{size:20,className:a.default.navIcon})}),e.jsx("button",{onClick:()=>{W<V.length-1&&G(e=>e+1)},className:a.default.navButton,disabled:J,children:e.jsx(l.ChevronDownIcon,{size:20,className:a.default.navIcon})})]})]})})})}),F.map((t,l)=>{console.log("UserStoryCardWrapper: userstory",t);const a=b(h,!0);return e.jsx(N,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:t,onUserStoryChange:e=>{O(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:m,elementDisplayConfig:h,_resolvedConfig:a,showWrapper:S,defaultExpanded:E,actionItemsConfig:g,contextVariant:C,showDisplayName:x,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:w,sectionStatusConfig:H,showCompletionPanel:D,completionPanelConfig:B,showAddSectionButton:A,disableEditPlan:T,useMuiTooltip:k,approveButtonConfig:U,CDNeededInChip:R,editButtonConfig:P,showAssignSection:_,disableAssignSection:L,onAssignSectionClick:q},t.artifactId)})]})},exports.default=N,exports.replaceLearnedTagsWithInfo=j;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("lucide-react"),n=require("showdown"),o=require("@mui/material"),i=require("../../icons/Illustration.svg.js"),s=require("uuid"),a=require("./UserStoryCard.module.css.js"),r=require("../../utils/helpers.js"),d=require("../../utils/user-story.utils.js"),u=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),v=require("../userstory-with-citation/UserStoryWithCitation.js"),p=require("../RequirementAIWrapper/RequirementAIWrapper.js"),m=require("../story-screen/BigEnoughPanel.js"),f=require("./TitleEditor/TitleEditor.js"),y=require("../../../../service/redlineService.js"),h=require("./ClinicalTrialSection.js"),S=require("../story-screen/CompletionPanel.js"),g=require("../../icons/CDIcon.js");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=C(n);const I={[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 j(t){const n=[],i=/<learned>(.*?)<\/learned>/g;let a,r=0,d=0;for(;null!==(a=i.exec(t));){const[,u]=a,c=a.index;c>r&&n.push(e.jsx("span",{children:t.slice(r,c)},"text-pre-"+d++)),n.push(e.jsx(o.Tooltip,{title:u,placement:"top",children:e.jsx(l.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${s.v4()}`)),r=i.lastIndex}return r<(null==t?void 0:t.length)&&n.push(e.jsx("span",{children:t.slice(r)},"text-post-"+d++)),n}function b(e,t,l){var n;if(!e)return{};if(t)return{...e.parentConfig};const o={...e.childConfig};return l&&(null===(n=e.subFeatureOverrides)||void 0===n?void 0:n[l])?{...o,...e.subFeatureOverrides[l]}:o}const N=({displayName:t})=>{var n;const{customStyles:o}=p.useRequirementAI(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e.jsxs("div",{className:a.default.displayName,style:null==i?void 0:i.wrapper,children:[e.jsx(l.Bookmark,{className:a.default.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e.jsxs("span",{style:null==i?void 0:i.label,children:[t,":"]})]})},w=({isUserStoryCurrentlyUpdated:n,artifactId:C,artifactTitleId:E,parentUserStory:D,currentUserStory:B,onUserStoryChange:A,parentIndex:T,currentIndex:k,enableDownload:U,isDiffEditReviewMode:P,showUserStoryDiff:R,handleDownloadUserStory:M,handleOpenSendDialog:_,updateUserStoryArtifact:q,selectedArtifactId:L,isDisplayHighlightControl:F,elementDisplayConfig:O,_resolvedConfig:$,showWrapper:z=!1,defaultExpanded:V,actionItemsConfig:W,onDelete:G,contextVariant:H,expandedSubFeatures:Q,showDisplayName:Y=!0,allowTitleEdit:X=!0,showConfidenceScore:Z=!0,showBorderTop:J=!0,sectionStatusConfig:K,showCompletionPanel:ee=!1,completionPanelConfig:te,showAddSectionButton:le=!1,disableEditPlan:ne=!1,useMuiTooltip:oe=!1,approveButtonConfig:ie,editButtonConfig:se,CDNeededInChip:ae,blockNumber:re,storyNumber:de,showAssignSection:ue=!1,disableAssignSection:ce=!1,onAssignSectionClick:ve,onSave:pe,onUserStoryAccordionStateChange:me})=>{var fe,ye,he,Se,ge,Ce,xe,Ie,je,be,Ne,we,Ee,De,Be,Ae,Te,ke,Ue,Pe,Re,Me,_e,qe;const{isLoadingSectionData:Le=!1,onLoadSectionData:Fe,status:Oe,onStatusClick:$e,completedCount:ze,totalCount:Ve,isNoDataAvailable:We=!1}=null!=K?K:{},{searchQueryList:Ge,citations:He,customStyles:Qe,onEditBlocked:Ye,redlineDcoumentId:Xe,redlineConfig:Ze,customSectionConfig:Je,updateRedlineDataParent:Ke,aiReasoning:et}=p.useRequirementAI(),tt=null==Qe?void 0:Qe.userStoryCardStyles,lt=null==tt?void 0:tt.customSectionEditButton,nt=null==tt?void 0:tt.statusStyles,ot=null===(fe=null==Qe?void 0:Qe.userStoryCardStyles)||void 0===fe?void 0:fe.userStoryEditStyles,it=null===(ye=null==Qe?void 0:Qe.userStoryScreenStyles)||void 0===ye?void 0:ye.userStoryContentStyles,st=null==tt?void 0:tt.progressHeaderStyles,at=null==tt?void 0:tt.clinicalTrialSectionStyles,rt=null==tt?void 0:tt.CompletionStyles,dt=null==tt?void 0:tt.noDataStyles,ut=null==tt?void 0:tt.approveButtonStyles,ct=null!==(Se=null===(he=null==Je?void 0:Je.shouldRender)||void 0===he?void 0:he.call(Je,B))&&void 0!==Se&&Se,vt=null===(ge=null==Je?void 0:Je.getValue)||void 0===ge?void 0:ge.call(Je,B),pt=null!==(xe=null===(Ce=null==Je?void 0:Je.getFields)||void 0===Ce?void 0:Ce.call(Je,B))&&void 0!==xe?xe:[],mt=null!==(Ie=null==Je?void 0:Je.isEditDisabled)&&void 0!==Ie&&Ie,ft=null!==(be=null===(je=null==Je?void 0:Je.isSaving)||void 0===je?void 0:je.call(Je,B))&&void 0!==be&&be,yt=(ht=null!==(Ne=B.completion_percentage)&&void 0!==Ne?Ne:0,St=rt,ht>=80?null==St?void 0:St.highCompletion:ht>=50?null==St?void 0:St.mediumCompletion:null==St?void 0:St.lowCompletion);var ht,St;const gt={[p.SectionStatus.WAITING]:null==nt?void 0:nt.waiting,[p.SectionStatus.IN_PROGRESS]:null==nt?void 0:nt.inProgress,[p.SectionStatus.GENERATED]:null==nt?void 0:nt.generated,[p.SectionStatus.FAILED]:null==nt?void 0:nt.failed,[p.SectionStatus.GENERATE]:null==nt?void 0:nt.generate,[p.SectionStatus.APPROVED]:null==nt?void 0:nt.approved},[Ct,xt]=t.useState({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),[It,jt]=t.useState({userStory:!!B.isDefaultEdit}),[bt,Nt]=t.useState(!1),[wt,Et]=t.useState(!1),[Dt,Bt]=t.useState(null),[At,Tt]=t.useState(null),{userStory:kt,customIcons:Ut}=p.useRequirementAI(),[Pt,Rt]=t.useState(null!=V?V:""===T||L===B.artifactId||!!B.isDefaultOpen),[Mt,_t]=t.useState(!1),[qt,Lt]=t.useState(null),[Ft,Ot]=t.useState(null),[$t,zt]=t.useState(!1),Vt=t.useRef(null),Wt=t.useRef(null),[Gt,Ht]=t.useState(!1),[Qt,Yt]=t.useState(!1),Xt=t.useRef(null),[Zt,Jt]=t.useState(!1),[Kt,el]=t.useState(B.value);t.useEffect(()=>{n&&Rt(n)},[n]),t.useEffect(()=>{xt({...structuredClone(B),value:r.formatMarkdown(B.value)||""})},[B]),t.useEffect(()=>{Ge.length>0?Rt(!0):void 0===V&&L&&Rt(L===B.artifactId)},[Ge,L,B.artifactId]),t.useEffect(()=>{Q&&Q.length>0&&de&&re&&Rt(Q.includes(`${de}-${re}`)||""===T||L===B.artifactId||!!B.isDefaultOpen)},[Q,de,re]);const tl=()=>{Lt(null)},ll=()=>{Ot(null)},nl=()=>{if(Pt&&It.userStory&&Wt.current&&!Wt.current.requestClose())return;const e=!Pt;Rt(e),null==me||me(B,e)},ol=async()=>{var e,t;try{"userStory"==="userStory"&&(A(Ct),console.log("I am changing RTE editor values",Ct)),await(null===(e=null==se?void 0:se.onSaveEditedSection)||void 0===e?void 0:e.call(se,Ct)),await q(He,kt,C,null===(t=Xt.current)||void 0===t?void 0:t.signal)}finally{}};const il=null!=(null==B?void 0:B.big_enough)&&!Number.isNaN(B.big_enough)&&!!(null==B?void 0:B.big_enough_decision_factors),sl=null!==(we=null==B?void 0:B.completion_percentage)&&void 0!==we?we:0,al=!!(null==B?void 0:B.completion_decision_factors),rl=""===T,dl=null!=$?$:b(O,rl),ul=!P&&!R;t.useEffect(()=>{if(!At)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${At}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[At]),t.useEffect(()=>{B.isDefaultEdit&&jt(e=>({...e,userStory:!0}))},[B.isDefaultEdit]),console.log("block number in userstory card ",re),console.log("[TESTING-CURRENT-USER-STORY] \n",B,"\n[TESTING-USER-STORY] \n",kt);return t.useEffect(()=>el(B.value),[B.value]),e.jsxs("div",{className:a.default.card,"data-block-id":`user-story-card-wrapper-${de}-${re}`,style:null==tt?void 0:tt.cardStyle,id:`story-card-${B.title}`,"data-expanded":Pt,children:[e.jsxs("div",{className:a.default.titleSection,style:null==tt?void 0:tt.titleSection,children:[e.jsxs("div",{className:a.default.titleRow,style:null==tt?void 0:tt.titleRow,onClick:nl,children:[e.jsxs("div",{className:a.default.titleLeft,style:null==tt?void 0:tt.titleLeft,onMouseEnter:()=>Ht(!0),onMouseLeave:()=>Ht(!1),children:[Y&&e.jsx(N,{displayName:E}),bt&&ul?e.jsx(f.InlineTitleEditor,{title:B.title,onSave:e=>(async(e,t)=>{var l;try{let n={...B};B.artifactId===t?n.title=e:n.sub_features=(null===(l=B.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],xt(n),A(n),Nt(!1)}catch(e){console.error("Failed to save title",e)}})(e,B.artifactId),onCancel:()=>{Nt(!1)},inputStyle:null==ot?void 0:ot.inlineTitleInput,confirmButtonStyle:null==ot?void 0:ot.inlineTitleConfirm,cancelButtonStyle:null==ot?void 0:ot.inlineTitleCancel},"inline-title-editor"):e.jsxs("div",{className:a.default.storyTitleWrapper,children:[e.jsx(o.Tooltip,{title:j(B.title),arrow:!0,children:e.jsx("h2",{title:oe?void 0:B.title,className:a.default.storyTitle,style:null==tt?void 0:tt.storyTitle,children:j(B.title)},B.artifactId)}),ee&&(al?e.jsx(S.CompletionPanel,{customIcons:null==Ut?void 0:Ut.userStoryIcons,customStyles:null==tt?void 0:tt.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==tt?void 0:tt.CompletionStyles,onToggleStateChange:Yt,completionPanelConfig:te,children:e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==rt?void 0:rt.badge,...yt},children:[e.jsxs("span",{children:[sl,"% Completed"]}),e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(g.default,{color:"currentColor"})}),Qt?e.jsx(l.ChevronUp,{size:14,style:null==rt?void 0:rt.chevronStyle}):e.jsx(l.ChevronDown,{size:14,style:null==rt?void 0:rt.chevronStyle})]})}):e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==rt?void 0:rt.badge,...yt},children:e.jsxs("span",{children:[sl,"% Completed"]})})),X&&e.jsx("button",{type:"button",className:a.default.titleEditButton,style:null==ot?void 0:ot.titleEditButton,onClick:e=>{e.stopPropagation(),Nt(!0),Pt||Rt(!0)},"aria-label":"Edit title",title:"Edit title",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.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"})})})]})]}),(Oe||void 0!==ze&&void 0!==Ve)&&e.jsxs("div",{className:a.default.statusContainer,children:[void 0!==ze&&void 0!==Ve&&e.jsxs("div",{className:a.default.completedBadge,children:["Completed: ",ze,"/",Ve]}),Oe&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==$e||$e()},onMouseEnter:()=>Jt(!0),onMouseLeave:()=>Jt(!1),className:a.default.statusButton,style:{...null===(Ee=gt[Oe])||void 0===Ee?void 0:Ee.default,...Zt&&(null===(De=gt[Oe])||void 0===De?void 0:De.hover)},children:I[Oe]})]}),e.jsxs("div",{className:a.default.titleActions,style:null==tt?void 0:tt.titleActions,onClick:e=>e.stopPropagation(),children:[(dl.showProgressPercentage||dl.showGapBox)&&z&&e.jsxs("div",{className:a.default.progressHeader,style:null==st?void 0:st.wrapper,children:[dl.showProgressPercentage&&e.jsxs("div",{className:a.default.progressPercentage,style:null==st?void 0:st.percentage,children:[null!==(Ae=null!==(Be=null==B?void 0:B.confidenceScore)&&void 0!==Be?Be:null==dl?void 0:dl.confidenceValue)&&void 0!==Ae?Ae:"0","%"]}),dl.showGapBox&&e.jsxs("div",{className:a.default.gapBox,style:null==st?void 0:st.gapBox,children:[null!==(ke=null!==(Te=null==B?void 0:B.gapValue)&&void 0!==Te?Te:null==dl?void 0:dl.gapBoxValue)&&void 0!==ke?ke:"2"," ","Gaps"]})]}),il&&e.jsx(m.BigEnoughPanel,{customIcons:null==Ut?void 0:Ut.userStoryIcons,customStyles:null==tt?void 0:tt.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==tt?void 0:tt.BigEnoughStyles}),ue&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==tt?void 0:tt.iconButton,disabled:ce,onClick:e=>{e.stopPropagation(),null==ve||ve(B)},"aria-label":"Assign section users",title:"Assign section users",children:e.jsx(l.Users,{size:16})}),!It.userStory&&e.jsxs(e.Fragment,{children:[!1!==(null==dl?void 0:dl.showShareButton)&&e.jsx("button",{className:a.default.iconButton,style:null==tt?void 0:tt.iconButton,onClick:e=>{Lt(e.currentTarget)},children:e.jsx(l.ExternalLink,{size:16})}),e.jsxs(o.Menu,{id:"user-story-share-menu",anchorEl:qt,open:!!qt,onClose:()=>Lt(null),style:null==tt?void 0:tt.userStoryShareMenu,children:[U&&e.jsx(o.MenuItem,{style:null==tt?void 0:tt.userStoryMenuItem,onClick:async()=>{_t(!0),M&&(await Promise.all([M("pdf"),M("doc")]),_t(!1))},children:e.jsxs("div",{ref:Vt,className:a.default.menuItemContent,style:null==tt?void 0:tt.menuItemContent,children:[e.jsx(l.Download,{size:16,color:null==tt?void 0:tt.menuIconColor}),e.jsx("p",{style:null==tt?void 0:tt.menuLabel,children:"Download"})]})}),e.jsx(o.MenuItem,{style:null==tt?void 0:tt.userStoryMenuItem,onClick:async()=>{let e=B;D&&(e={...B,value:`${d.replaceTitleSection(null==D?void 0:D.value,B.title)} \n${B.value}`}),null==_||_(!0,[e],B.artifactId),tl()},children:e.jsxs("div",{style:null==tt?void 0:tt.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Share2,{size:16,color:null==tt?void 0:tt.menuIconColor}),e.jsx("p",{style:null==tt?void 0:tt.menuLabel,children:"Send"})]})}),e.jsx(o.MenuItem,{style:null==tt?void 0:tt.userStoryMenuItem,onClick:async()=>{const e=(new x.default.Converter).makeHtml(r.formatMarkdown(B.value)||B.value),t=function(e){const t=(new x.default.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(r.formatMarkdown(B.value)||B.value),l=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([l]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{tl()}},children:e.jsxs("div",{style:null==tt?void 0:tt.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Copy,{size:16,color:null==tt?void 0:tt.menuIconColor}),e.jsx("p",{style:null==tt?void 0:tt.menuLabel,children:"Copy"})]})})]})]}),!$t&&It.userStory&&Pt?e.jsx(u.default,{type:"outline",children:"Cancel",style:null==tt?void 0:tt.cancelButton,onClick:()=>{var e;null===(e=Xt.current)||void 0===e||e.abort(),jt(e=>({...e,userStory:!1}))}}):e.jsx(e.Fragment,{}),It.userStory&&Pt?e.jsx(u.default,{type:"fill",children:$t?e.jsxs("span",{className:a.default.savingSpinner,style:null==tt?void 0:tt.savingSpinner,children:[e.jsx(l.LoaderCircle,{className:a.default.spinAnimation,style:null==tt?void 0:tt.spinAnimation}),e.jsx("span",{children:"Saving..."})]}):"Save",isDisable:$t,style:$t?null==tt?void 0:tt.savingButton:null==tt?void 0:tt.saveButton,onClick:async()=>{zt(!0),await ol();let e=await(async()=>{var e,t,l,n,o;let i=Ct.value;console.log("[V] valueToUpdate before",i),i=i.replace(/<invisible\s+id="([^"]+)"\s*><\/invisible>/gi,"\x3c!-- $1 --\x3e"),console.log("[V] valueToUpdate after",i);try{await(null==pe?void 0:pe(i,B.artifactId))}catch(e){}try{if(null==Ze?void 0:Ze.callUpdateDocument){const{updated_reqai:s}=await y.updateRedlineDocument({documentId:Xe,sectionId:B.artifactId,baseApiUrl:null==Ze?void 0:Ze.baseApiUrl,updatedContent:i,userEmail:Ze.userEmail,userName:Ze.userName,redlineConfigId:null!==(e=Ze.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Ze?void 0:Ze.token)&&void 0!==t?t:"");i=null===(o=null===(n=null===(l=null==s?void 0:s.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==Ke?void 0:Ke(s))}}catch(e){console.error("failed to update redline document",e),i=Kt}return i=i.replace(/<!--\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\s*-->/gi,'<invisible id="$1"></invisible>'),i})();const t={...Ct,value:e};A({...t,isDefaultEdit:!1}),el(t.value),jt(e=>({...e,userStory:!1})),zt(!1)}}):!P&&!R&&!ne&&Pt&&!1!==(null==dl?void 0:dl.showEditButton)&&e.jsx("button",{className:a.default.iconButton,style:null==tt?void 0:tt.editButton,onClick:()=>jt(e=>({...e,userStory:!0})),children:e.jsx(l.PencilIcon,{color:null==tt?void 0:tt.pencilIconColor,size:16})}),le&&rl&&Pt&&!P&&!R&&!1!==(null==dl?void 0:dl.showEditButton)&&e.jsxs("button",{type:"button",className:a.default.addSectionButton,style:null==ot?void 0:ot.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=B.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:s.v4(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...B,sub_features:[...null!==(n=B.sub_features)&&void 0!==n?n:[],i]};xt(a),A(a),Rt(!0),Tt(i.title)},"aria-label":"Add section",title:"Add section",children:[e.jsx(l.Plus,{size:14}),e.jsx("span",{className:a.default.addSectionLabel,children:"Add Section"})]}),!rl&&!P&&!ne&&!R&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==G||G()},className:a.default.iconButton,style:null==ot?void 0:ot.deleteButton,"aria-label":"Delete section",title:"Delete section",children:e.jsx(l.Trash2,{size:16})}),ct&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==lt?void 0:lt.button,disabled:mt,onClick:e=>{if(e.stopPropagation(),wt)return Bt(null),void Et(!1);Bt(structuredClone(null!=vt?vt:{})),Rt(!0),Et(!0)},children:wt?e.jsx(l.X,{size:16,color:null==tt?void 0:tt.pencilIconColor,style:null==lt?void 0:lt.cancelIcon}):e.jsx(l.PencilIcon,{size:16,color:null==tt?void 0:tt.pencilIconColor,style:null==lt?void 0:lt.editIcon})}),(null==dl?void 0:dl.actionItemsButton)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:a.default.actionItemBtn,style:null==tt?void 0:tt.actionItemBtn,onClick:e=>{e.stopPropagation(),Ot(e.currentTarget)},children:e.jsx(l.Ellipsis,{})}),e.jsx(o.Menu,{id:"user-story-action-menu",anchorEl:Ft,open:!!Ft,onClose:ll,style:null==tt?void 0:tt.userStoryShareMenu,children:null==W?void 0:W.items.map((t,l)=>e.jsx(o.MenuItem,{style:null==tt?void 0:tt.userStoryMenuItem,onClick:()=>{t.onclick(B),ll()},children:e.jsxs("div",{className:a.default.menuItemContent,style:{...null==tt?void 0:tt.menuItemContent,...!t.isActive&&{cursor:"not-allowed",opacity:.5}},children:[e.jsx("span",{className:a.default.menuItemIcon,style:null==tt?void 0:tt.menuItemIcon,children:t.icon}),e.jsx("p",{style:null==tt?void 0:tt.menuLabel,children:t.name}),e.jsx("span",{className:a.default.menuItemRight,style:null==tt?void 0:tt.menuItemRight})]})},`action-item-${l}-${t.name}`))})]}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),nl()},style:null==tt?void 0:tt.chevronButton,className:a.default.chevronButton,children:Pt?e.jsx(l.ChevronUp,{className:a.default.chevronIcon,color:null==tt?void 0:tt.chevronIconColor}):e.jsx(l.ChevronDown,{className:a.default.chevronIcon,color:null==tt?void 0:tt.chevronIconColor})})]})]}),e.jsx("div",{className:a.default.divider,style:null==tt?void 0:tt.dividerStyle})]}),Pt&&e.jsx("div",{className:a.default.cardContent,style:{...null==tt?void 0:tt.cardContentStyle,borderTop:J?"1px solid #E5E5E5":"none"},children:Le?e.jsxs("div",{className:a.default.loadingContainer,children:[e.jsx("div",{className:a.default.loadingIconWrapper,children:e.jsx(l.Hourglass,{size:28,color:"#5B3DF5",className:a.default.spinAnimation})}),e.jsxs("div",{children:[e.jsx("h3",{className:a.default.loadingTitle,children:"Section generation in progress.."}),e.jsx("p",{className:a.default.loadingSubtitle,children:"This may take a few minutes"})]}),e.jsx("button",{type:"button",onClick:()=>null==Fe?void 0:Fe(),className:a.default.viewStatusButton,children:"View Status"})]}):We?e.jsxs("div",{className:a.default.noDataContainer,style:null==dt?void 0:dt.container,children:[e.jsx("img",{src:i.default,alt:"No data available",className:a.default.noDataIllustration,style:null==dt?void 0:dt.illustration}),e.jsx("h3",{className:a.default.noDataTitle,style:null==dt?void 0:dt.title,children:"No Data Available for This Section"}),e.jsx("p",{className:a.default.noDataSubtitle,style:null==dt?void 0:dt.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}):e.jsxs("div",{className:a.default.contentInner,style:null==tt?void 0:tt.contentInner,children:[e.jsxs("div",{className:a.default.descriptionSection,style:null==tt?void 0:tt.descriptionSection,children:[e.jsx("div",{className:a.default.justifyBetween,style:null==tt?void 0:tt.justifyBetween}),It.userStory?e.jsx(c.default,{ref:Wt,minHeight:"100%",height:"100%",type:"string",value:r.formatMarkdown(Kt)||"",handleUpdateState:(e,t)=>{const l=d.postprocessUserStoryAfterEdit(r.indentMarkdown(t));xt(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:It.userStory?"edit":"readOnly",onEditBlocked:Ye,onSaveUnsavedChanges:async()=>{await ol(),Rt(!1)},onDiscardUnsavedChanges:()=>{xt({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),jt(e=>({...e,userStory:!1})),Rt(!1)},isSavingUnsavedChanges:$t}):ct?e.jsx(h.default,{styles:at,fields:pt,readonly:!wt,isSaving:ft,value:null!==(Ue=null!=Dt?Dt:vt)&&void 0!==Ue?Ue:{},onChange:Bt,onSave:async()=>{var e;Dt&&(await(null===(e=null==Je?void 0:Je.onSave)||void 0===e?void 0:e.call(Je,B,Dt)),Bt(null),Et(!1))},onCancel:()=>{Bt(null),Et(!1)}}):e.jsxs(e.Fragment,{children:[e.jsx(v.default,{showUserStoryDiff:R,isParent:""===T,message:r.formatMarkdown(B.value)||"",artifactId:B.artifactId,customStyles:it,isDisplayHighlightControl:F,contextVariant:H,showConfidenceScore:Z,CDNeededInChip:ae,blockId:re,storyId:de}),(ie||se)&&e.jsxs("div",{className:a.default.actionButtonsContainer,style:null==ut?void 0:ut.container,children:[se&&!It.userStory&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:a.default.actionButton,style:null==ut?void 0:ut.button,disabled:se.disabled||se.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=se.onClick)||void 0===t||t.call(se),jt(e=>({...e,userStory:!0})),Rt(!0)},children:se.isLoading?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.actionButtonSpinner,style:null==ut?void 0:ut.icon}),e.jsx("span",{style:null==ut?void 0:ut.text,children:null!==(Pe=se.label)&&void 0!==Pe?Pe:"Edit"})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.PencilIcon,{size:16,style:null==ut?void 0:ut.icon}),e.jsx("span",{style:null==ut?void 0:ut.text,children:null!==(Re=se.label)&&void 0!==Re?Re:"Edit"})]})}),ie&&e.jsx("span",{className:a.default.actionButtonDivider})]}),ie&&e.jsx("button",{type:"button",className:a.default.actionButton,style:null==ut?void 0:ut.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?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.actionButtonSpinner,style:null==ut?void 0:ut.icon}),e.jsx("span",{style:null==ut?void 0:ut.text,children:null!==(Me=ie.label)&&void 0!==Me?Me:"Approve"})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Check,{size:16,style:null==ut?void 0:ut.icon}),e.jsx("span",{style:null==ut?void 0:ut.text,children:null!==(_e=ie.label)&&void 0!==_e?_e:"Approve"})]})})]})]})]}),null===(qe=Ct.sub_features)||void 0===qe?void 0:qe.map((t,l)=>{console.log("UserStoryCardWrapper: sub",t);const o=b(O,!1,t.artifactId);return e.jsx(w,{artifactId:C,isUserStoryCurrentlyUpdated:n,artifactTitleId:`${E}-${String.fromCharCode(65+l)}`,parentUserStory:B,parentIndex:`${T}${T&&"."}${k}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:t,onUserStoryChange:e=>((e,t)=>{const l=[...B.sub_features||[]];l[e]=t,A({...B,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:P,showUserStoryDiff:R,updateUserStoryArtifact:q,handleDownloadUserStory:M,handleOpenSendDialog:_,isDisplayHighlightControl:F,elementDisplayConfig:O,_resolvedConfig:o,actionItemsConfig:W,onDelete:()=>(e=>{const t=(B.sub_features||[]).filter((t,l)=>l!==e),l={...B,sub_features:t};xt(l),A(l)})(l),expandedSubFeatures:Q,disableEditPlan:ne,useMuiTooltip:oe,storyNumber:t.storyNumber,blockNumber:t.blockNumber,onUserStoryAccordionStateChange:me,showAssignSection:ue,onAssignSectionClick:ve,onSave:pe},t.artifactId)})]})})]})};exports.StoryCard=w,exports.UserStoryCardWrapper=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:m,isDisplayHighlightControl:f,elementDisplayConfig:h,showWrapper:S,actionItemsConfig:g,contextVariant:C,showDisplayName:x,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:N,defaultExpanded:E,showCompletionPanel:D=!1,completionPanelConfig:B,showAddSectionButton:A=!1,disableEditPlan:T=!1,useMuiTooltip:k=!1,approveButtonConfig:U,editButtonConfig:P,CDNeededInChip:R,setRedlineDocumentIdParent:M,showAssignSection:_,onAssignSectionClick:q,disableAssignSection:L,onSave:F,onUserStoryAccordionStateChange:O})=>{const{userStory:$,setUserStory:z,customStyles:V,searchQueryList:W,currentHighlightIndex:G,setCurrentHighlightIndex:H,segmentComponentConfig:Q,sectionStatusConfig:Y,redlineConfig:X,setRedlineDocumentId:Z}=p.useRequirementAI(),J=null==V?void 0:V.userStoryCardStyles,K=0===G,ee=G===W.length-1;return t.useEffect(()=>{if(!(null==X?void 0:X.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await y.getRedlineDocumentId({baseApiUrl:X.documentBaseApiUrl||"",comparisonId:X.documentComparisonId||""});if(t)Z(t);else{const{document_id:t}=await y.createRedlineDocument({baseApiUrl:X.baseApiUrl,changelogConfigId:X.changelogConfigId,comparisonId:X.documentComparisonId,artifactId:X.artifactId,inputData:X.inputData,redlineConfigId:X.redlineConfigId,userEmail:X.userEmail,userName:X.userName},null!==(e=null==X?void 0:X.token)&&void 0!==e?e:"");t&&(Z(t),null==M||M(t))}})()},[]),e.jsxs("div",{className:a.default.userStoryCardWrapper,style:f?{...null==J?void 0:J.userStoryCardWrapper,position:"relative"}:null==J?void 0:J.userStoryCardWrapper,children:[f&&e.jsx(e.Fragment,{children:W.length>0&&e.jsx("div",{className:a.default.wrapper,children:e.jsx("div",{className:a.default.highlightNavigation,children:e.jsxs("div",{className:a.default.navigationContainer,children:[e.jsxs("span",{className:a.default.navCounter,children:[G+1," of ",W.length]}),e.jsxs("div",{className:a.default.navButtons,children:[e.jsx("button",{onClick:()=>{G>0&&H(e=>e-1)},className:a.default.navButton,disabled:K,children:e.jsx(l.ChevronUpIcon,{size:20,className:a.default.navIcon})}),e.jsx("button",{onClick:()=>{G<W.length-1&&H(e=>e+1)},className:a.default.navButton,disabled:ee,children:e.jsx(l.ChevronDownIcon,{size:20,className:a.default.navIcon})})]})]})})})}),$.map((t,l)=>{console.log("UserStoryCardWrapper: userstory",t);const a=b(h,!0);return e.jsx(w,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:t,onUserStoryChange:e=>{z(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:m,isDisplayHighlightControl:f,elementDisplayConfig:h,_resolvedConfig:a,showWrapper:S,defaultExpanded:E,actionItemsConfig:g,contextVariant:C,showDisplayName:x,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:N,sectionStatusConfig:Y,showCompletionPanel:D,completionPanelConfig:B,showAddSectionButton:A,disableEditPlan:T,useMuiTooltip:k,approveButtonConfig:U,CDNeededInChip:R,editButtonConfig:P,storyNumber:t.storyNumber,blockNumber:t.blockNumber,onUserStoryAccordionStateChange:O,showAssignSection:_,disableAssignSection:L,onAssignSectionClick:q,onSave:F},t.artifactId)})]})},exports.default=w,exports.replaceLearnedTagsWithInfo=j;
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("./Segment.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(require("dompurify"));exports.default=({id:t,children:l,props:i,segmentComponentConfig:d,customStyles:s,customIcons:a,extractText:u,isUpdatedSegment:r=!1,blockId:v,customDeleteStyles:m,customDeleteIcons:c})=>{var g,p,S,h,I,f,y,C,b,x,D,_,j,E,U,W,k,w,L;const A=(null==i?void 0:i.id)||"Segment",F=(null==i?void 0:i.decisionstrength)||"80",{segmentDataList:q,getSegmentExampleComponent:O,handleViewGlossary:R,upadatedSegmentDataList:B,handleFetchUpdatedSegmentDetails:G,handleFetchSegmentDetails:M,handleDeleteSegment:N,handleEditSegment:T,enabledSegmentActions:V,onShowNotification:z}=d||{},H=r?null==B?void 0:B.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==A?void 0:A.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==A?void 0:A.split("-"))||void 0===n?void 0:n[0])}),P={id:A,reason:null!==(g=null==H?void 0:H.reason)&&void 0!==g?g:"",gap:null!==(p=null==H?void 0:H.gap)&&void 0!==p?p:"",explanation:null!==(S=null==H?void 0:H.explanation)&&void 0!==S?S:"",relevance_score:null!==(h=null==H?void 0:H.relevance_score)&&void 0!==h?h:0,isOpen:!1};let J;const K=u(l),Q=i["data-table"];let X="";if(Q&&!r)try{X=decodeURIComponent(atob(Q))}catch(e){console.error("Failed to decode data-table for segment",A,e)}const Y=o.default.sanitize(X),Z=()=>e.jsx("div",{dangerouslySetInnerHTML:{__html:Y}});return H||!M||r||null==M||M(A),A&&H&&O&&!r&&(J=Q?e.jsx(Z,{}):O(A,K,H.segment_type)),e.jsx(n.default,{id:A,segmentUUID:t,label:null!==(I=null==H?void 0:H.label)&&void 0!==I?I:null==H?void 0:H.segment_name,decisionStrength:F,aiReason:P,customIcons:a,aiReasoningCitationCustomStyles:s,segmentExampleComponent:J,handleViewGlossary:R,customStyles:{segmentWrapper:null===(f=null==s?void 0:s.segment)||void 0===f?void 0:f.segmentWrapper,container:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.container,label:null===(C=null==s?void 0:s.segment)||void 0===C?void 0:C.label,decisionStrength:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.decisionStrength,buttonContainer:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.buttonContainer,cheveronIcon:null===(D=null==s?void 0:s.segment)||void 0===D?void 0:D.cheveronIcon,segmentExample:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.segmentExample,loadingSkeleton:null===(j=null==s?void 0:s.segment)||void 0===j?void 0:j.SegmentLoadingSkeletonStyles,editInputWrapper:null===(E=null==s?void 0:s.segment)||void 0===E?void 0:E.editInputWrapper,editInput:null===(U=null==s?void 0:s.segment)||void 0===U?void 0:U.editInput,editCheckIcon:null===(W=null==s?void 0:s.segment)||void 0===W?void 0:W.editCheckIcon,editCrossIcon:null===(k=null==s?void 0:s.segment)||void 0===k?void 0:k.editCrossIcon,headerActionsContainer:null===(w=null==s?void 0:s.segment)||void 0===w?void 0:w.headerActionsContainer,editIconButton:null===(L=null==s?void 0:s.segment)||void 0===L?void 0:L.editIconButton},isUpdatedSegment:r,onOpen:async()=>{!H&&r&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),await(null==G?void 0:G(A)))},onDelete:e=>{if(console.log("SegmentWrapper: onDelete",e,{...H,segment_uuid:A},v),H)return null==N?void 0:N(e,{...H,segment_uuid:A},v)},onEdit:e=>{if(console.log("SegmentWrapper: onEdit",H,e),H&&T)return null==T?void 0:T(H,e)},customDeleteStyles:m,customDeleteIcons:c,enabledSegmentActions:V,segmentDataList:q,onShowNotification:(e,n,t)=>{z&&z(e,n,t)},children:l},A)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("./Segment.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(require("dompurify"));exports.default=({id:t,children:l,props:i,segmentComponentConfig:d,customStyles:s,customIcons:a,extractText:u,isUpdatedSegment:r=!1,blockId:v,storyId:m,customDeleteStyles:c,customDeleteIcons:g})=>{var p,S,h,I,f,y,C,b,x,D,_,j,E,U,W,k,w,L,A;const F=(null==i?void 0:i.id)||"Segment",q=(null==i?void 0:i.decisionstrength)||"80",{segmentDataList:O,getSegmentExampleComponent:R,handleViewGlossary:B,upadatedSegmentDataList:G,handleFetchUpdatedSegmentDetails:M,handleFetchSegmentDetails:N,handleDeleteSegment:T,handleEditSegment:V,enabledSegmentActions:z,onShowNotification:H}=d||{},P=r?null==G?void 0:G.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==F?void 0:F.split("-"))||void 0===n?void 0:n[0])}):null==O?void 0:O.find(e=>{var n;return String(e.segment_id)===String(null===(n=null==F?void 0:F.split("-"))||void 0===n?void 0:n[0])}),J={id:F,reason:null!==(p=null==P?void 0:P.reason)&&void 0!==p?p:"",gap:null!==(S=null==P?void 0:P.gap)&&void 0!==S?S:"",explanation:null!==(h=null==P?void 0:P.explanation)&&void 0!==h?h:"",relevance_score:null!==(I=null==P?void 0:P.relevance_score)&&void 0!==I?I:0,isOpen:!1};let K;const Q=u(l),X=i["data-table"];let Y="";if(X&&!r)try{Y=decodeURIComponent(atob(X))}catch(e){console.error("Failed to decode data-table for segment",F,e)}const Z=o.default.sanitize(Y),$=()=>e.jsx("div",{dangerouslySetInnerHTML:{__html:Z}});return P||!N||r||null==N||N(F),F&&P&&R&&!r&&(K=X?e.jsx($,{}):R(F,Q,P.segment_type)),e.jsx(n.default,{id:F,segmentUUID:t,label:null!==(f=null==P?void 0:P.label)&&void 0!==f?f:null==P?void 0:P.segment_name,decisionStrength:q,aiReason:J,customIcons:a,aiReasoningCitationCustomStyles:s,segmentExampleComponent:K,handleViewGlossary:B,customStyles:{segmentWrapper:null===(y=null==s?void 0:s.segment)||void 0===y?void 0:y.segmentWrapper,container:null===(C=null==s?void 0:s.segment)||void 0===C?void 0:C.container,label:null===(b=null==s?void 0:s.segment)||void 0===b?void 0:b.label,decisionStrength:null===(x=null==s?void 0:s.segment)||void 0===x?void 0:x.decisionStrength,buttonContainer:null===(D=null==s?void 0:s.segment)||void 0===D?void 0:D.buttonContainer,cheveronIcon:null===(_=null==s?void 0:s.segment)||void 0===_?void 0:_.cheveronIcon,segmentExample:null===(j=null==s?void 0:s.segment)||void 0===j?void 0:j.segmentExample,loadingSkeleton:null===(E=null==s?void 0:s.segment)||void 0===E?void 0:E.SegmentLoadingSkeletonStyles,editInputWrapper:null===(U=null==s?void 0:s.segment)||void 0===U?void 0:U.editInputWrapper,editInput:null===(W=null==s?void 0:s.segment)||void 0===W?void 0:W.editInput,editCheckIcon:null===(k=null==s?void 0:s.segment)||void 0===k?void 0:k.editCheckIcon,editCrossIcon:null===(w=null==s?void 0:s.segment)||void 0===w?void 0:w.editCrossIcon,headerActionsContainer:null===(L=null==s?void 0:s.segment)||void 0===L?void 0:L.headerActionsContainer,editIconButton:null===(A=null==s?void 0:s.segment)||void 0===A?void 0:A.editIconButton},isUpdatedSegment:r,onOpen:async()=>{!P&&r&&(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),await(null==M?void 0:M(F)))},onDelete:e=>{if(console.log("SegmentWrapper: onDelete",e,{...P,segment_uuid:F},m,v),P)return null==T?void 0:T(e,{...P,segment_uuid:F},m,v)},onEdit:e=>{if(console.log("SegmentWrapper: onEdit",P,e),P&&V)return null==V?void 0:V(P,e)},customDeleteStyles:c,customDeleteIcons:g,enabledSegmentActions:z,segmentDataList:O,onShowNotification:(e,n,t)=>{H&&H(e,n,t)},children:l},F)};
2
2
  //# sourceMappingURL=SegmentWrapper.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),t=require("rehype-raw"),o=require("./UserStoryWithCitation.module.css.js"),l=require("../../shared/useMarkdownSearch.js"),d=require("lucide-react"),a=require("@mui/material"),r=require("dompurify"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),g=require("../RequirementAIWrapper/RequirementAIWrapper.js"),p=require("../../icons/CognitiveDecision.js"),h=require("../../icons/BrainRed.js"),v=require("../ai-reasoning/AiReasoningCitation.js"),m=require("../../icons/RelevanceScoreIcon.js"),f=require("../RecommendationBlock/RecommendationBlock.js"),C=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),j=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),w=require("./components/InlineManualComponent.js"),b=require("./components/HighlightButtonComponent.js"),I=require("../../../../utils/tagHelper.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=R(n),$=R(i),k=R(t),A=R(r);const q=n.createContext(!1),E=n.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),M=n.createContext({rowId:""}),T=({aiReason:i,isHighConfidence:t,customStyle:l,customIcons:d})=>{var a;const{expandedInfo:r,setExpanded:s,reasonToRow:c}=n.useContext(E),{rowId:u}=n.useContext(M),g=String(i.id);u&&c.current.set(g,u);const v=(null===(a=null==r?void 0:r.aiReason)||void 0===a?void 0:a.id)===i.id,m=t?(null==d?void 0:d.highConfidence)||e.jsx(p.default,{}):(null==d?void 0:d.lowConfidence)||e.jsx(h.default,{});return e.jsxs("button",{className:o.default.aiReasoningButton,style:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),s(v?null:u,v?null:i)},children:[m,v?e.jsx("i",{className:`pi pi-angle-up ${t?o.default.aiReasoningIconHighConfidence:o.default.aiReasoningIconLowConfidence}`}):e.jsx("i",{className:`pi pi-angle-down ${t?o.default.aiReasoningIconHighConfidence:o.default.aiReasoningIconLowConfidence}`})]})},_=({children:i,node:t,customStyles:l,customIcons:d})=>{var a,r;const s=n.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=n.useContext(E),u=(null==c?void 0:c.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,p=null!==(r=null===(a=null==t?void 0:t.properties)||void 0===a?void 0:a.style)&&void 0!==r?r:void 0;return e.jsxs(M.Provider,{value:{rowId:s},children:[e.jsx("tr",{style:p?{cssText:p}:void 0,children:i}),u&&(null==c?void 0:c.aiReason)&&e.jsx("tr",{style:{width:"100%"},children:e.jsx("td",{colSpan:g||1,className:o.default.tableExpandedCell,children:e.jsx("div",{className:o.default.tableExpandedCellInner,children:e.jsx("div",{className:o.default.tableExpandedCellContent,children:e.jsx(x.default,{aiReason:c.aiReason,customIcons:d,customStyles:{aiReasoningContent:null==l?void 0:l.aiReasoningContent,aiReasoningAccordion:null==l?void 0:l.aiReasoningAccordion,aiReasoningMarkdown:null==l?void 0:l.aiReasoningMarkdown,aiReasoningPill:null==l?void 0:l.aiReasoningPill,webCitation:null==l?void 0:l.webCitation,stormeeCitation:null==l?void 0:l.stormeeCitation,waveformCitation:null==l?void 0:l.waveformCitation,imageCitation:null==l?void 0:l.imageCitation,fileCitation:null==l?void 0:l.fileCitation,appModCitation:null==l?void 0:l.appModCitation,rcaCitation:null==l?void 0:l.rcaCitation,readFileCitation:null==l?void 0:l.readFileCitation,loadingCitations:null==l?void 0:l.loadingCitations,chatCitation:null==l?void 0:l.chatCitation}})})})})})]})};const U=["del","ins"];function L(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,U,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 t;return`<code>${o=null!==(t=n[Number(i)])&&void 0!==t?t:"",o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var o})}(e)).join(""))}const F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function P(e,n){const i=[],t=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(!N.default.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(F.has(d))return e;const a=null===(l=N.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 a&&0!==a.length?N.default.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:o(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:i,noMarkdownContent:t,useMarkdown:r=!0,isParent:p,scenario:h,showUserStoryDiff:x=!1,aiReasoningsForBlock:R,isCitationLoadingDisplay:M=!1,className:U,highConfidenceIcon:F,lowConfidenceIcon:D,customStyles:H,customIcons:O,contextVariant:B,aiReasoningDiffView:V,userStoryCitations:W,artifactId:z,isCraflow:G,onCraAccept:Q,onCraReject:J,craFlowConfig:K,isDisplayHighlightControl:X=!1,showConfidenceScore:Y=!0,CDNeededInChip:Z,blockId:ee})=>{var ne;console.log("userstorywithcitation blockid ",ee);const ie=n.useRef(null),{userStory:te,inlineUpdateComponentConfig:oe,getAvgScoreForStory:le,setUserStory:de,aiReasoning:ae,setAiReasoning:re,customIcons:se,searchQueryList:ce,searchQueryReasoningIdList:ue,currentHighlightIndex:ge,segmentComponentConfig:pe,inlineManualComponentConfig:he,diffEditConfig:ve}=g.useRequirementAI(),me=null!=O?O:null==se?void 0:se.userStoryIcons;null==H||H.searchHighlight;const{search:fe,clear:Ce}=l.useMarkdownSearch(ie),[xe,je]=n.useState("1"),[ye,Se]=n.useState(null),we=n.useRef(new Map),[be,Ie]=n.useState(new Set),Re=n.useCallback((e,n)=>{Se(e&&n?{rowId:e,aiReason:n}:null)},[]),Ne=z?le(z):0,[$e,ke]=n.useState([]),Ae=n.useCallback(e=>{Ie(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),qe=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(qe).join(""):N.default.isValidElement(e)?qe(e.props.children):"",Ee=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,t,o)=>{const l=t.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,t,o)=>{const l=n.substring(0,o),d=l.lastIndexOf("\n"),a=/^\s+[-*]\s/.test(l.substring(d+1))||/^\s+\d+\.\s/.test(l.substring(d+1)),r=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(d+1));if(a||r){let e=t;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 t;const o=new RegExp(n.source,n.flags);for(;null!==(t=o.exec(e));){const e=t[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;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const o=l.substring(0,n.index).split("\n").reverse();let d=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(d=!0);break}}if(!d)continue;const a=n.endIndex,r=e+1<i.length?i[e+1].index:l.length;let s=l.substring(a,r);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),l=l.substring(0,a)+s+l.substring(r)}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=L(n),n},Me=n.useMemo(()=>i?Ee(i):i,[i]);n.useEffect(()=>{ke(R||ae)},[R,ae]);const Te=n.useMemo(()=>({span:({node:n,children:i,...t})=>{var o,l,d,a,r;const s=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==l?l:null==t?void 0:t["highlight-id"],c="string"==typeof s&&be.has(s),u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-color"])&&void 0!==a?a:null==t?void 0:t["highlight-color"];return e.jsx("span",{style:{...null!==(r=null==H?void 0:H.span)&&void 0!==r?r:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:n,children:i,...t})=>{var o,l,d,a,r,s;const c=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.action)&&void 0!==l?l:null==t?void 0:t.action,u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(s=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-type"])&&void 0!==s?s:null==t?void 0:t["highlight-type"];return"highlight"===c?e.jsx(b.default,{highlightId:u,handleHighlightSpan:Ae,icon:"web"===g?null==me?void 0:me.webCitationIcon:"doc"===g?null==me?void 0:me.fileCitationIcon:e.jsx(e.Fragment,{}),customStyles:"web"===g?null==H?void 0:H.webButton:"doc"===g?null==H?void 0:H.docButton:{}}):null},upt:({node:n,children:i,...t})=>{var o,l;const d=null==t?void 0:t.id,a=d?null===(l=null===(o=d.split("$"))||void 0===o?void 0:o[1])||void 0===l?void 0:l.replaceAll("@","<").replaceAll("#",">"):null,r=ae.find(e=>e.id.toString()===a);if(!r)return i||e.jsx(e.Fragment,{});const s="data-main"in t,c=t["data-status"];return e.jsx(e.Fragment,{children:e.jsx(j.default,{aiReason:r,customStyles:null==H?void 0:H.inlineUpdatedComponent,handleClickCognitiveDecision:null==oe?void 0:oe.handleClickCognitiveDecision,handleClickUpdatedPill:null==oe?void 0:oe.handleClickUpdatedPill,handleClickOutputValue:null==oe?void 0:oe.handleClickOutputValue,customIcons:null==oe?void 0:oe.customIcons,CDNeededInChip:Z,showChip:s,status:c,children:i||e.jsx(e.Fragment,{})})})},del:({node:n,children:i,...t})=>{var l;const{cleanedChildren:d,extractedNodes:a}=P(i,["ins"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:o.default.deleted,style:null!==(l=null==H?void 0:H.deleted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:d}),a]})},ins:({children:n,...i})=>{var t;const{cleanedChildren:l,extractedNodes:d}=P(n,["del"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:o.default.inserted,style:null!==(t=null==H?void 0:H.inserted)&&void 0!==t?t:{},...i,onClick:()=>{i.onclick&&i.onclick()},children:l}),d]})},preserved:({children:n,...i})=>e.jsx("span",{className:o.default.preserved,style:null==H?void 0:H.preserved,...i,children:n}),manual:({children:n,...i})=>{var t;const o=null===(t=null==i?void 0:i.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),l=ae.find(e=>e.id.toString()===o),d=i["data-status"];return l?e.jsx(w.default,{aiReason:l,handleClick:null==he?void 0:he.handleClick,status:d,children:n}):n||e.jsx(e.Fragment,{})},invisible:({children:n,...i})=>e.jsx(e.Fragment,{}),h1:({node:n,...i})=>e.jsx("h1",{className:o.default.heading1,style:null==H?void 0:H.heading1,children:i.children}),h2:({node:n,...i})=>e.jsx("h2",{className:o.default.heading2,style:null==H?void 0:H.heading2,children:i.children}),h3:({node:n,...i})=>e.jsx("h3",{className:o.default.heading3,style:null==H?void 0:H.heading3,children:i.children}),b:({node:n,...i})=>e.jsx("b",{className:o.default.bold,style:null==H?void 0:H.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e.jsx("p",{...i,className:o.default.paragraph,style:null==H?void 0:H.paragraph,children:i.children}),updated:({node:n,...i})=>e.jsx(s.default,{...i,showUserStoryDiff:x,currentUpdatedTagId:xe,setCurrentUpdatedTagId:je,userStory:te,setUserStory:de,setAiReasoning:re,node:n,isCraflow:G,onCraAccept:Q,onCraReject:J,diffEditConfig:ve,customStyles:null==H?void 0:H.updatedContent,craFlowConfig:K}),ol:({node:n,...i})=>{var t,l,d;const a=null!==(d=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==l?l:null==i?void 0:i.start)&&void 0!==d?d:void 0;return e.jsx("ol",{className:o.default.orderedList,style:null==H?void 0:H.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e.jsx("ul",{className:o.default.unorderedList,style:null==H?void 0:H.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e.jsx("div",{className:o.default.tableWrapper,children:e.jsx("table",{className:o.default.table,style:null==H?void 0:H.table,children:n})}),tr:({node:n,children:i})=>e.jsx(_,{node:n,children:i,customStyles:H}),td:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("td",{...l,style:o?{cssText:o}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("th",{...l,style:o?{cssText:o}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const o=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e.jsx(f.default,{...i,customStyles:null==H?void 0:H.recommendationBlock,label:o})},a:({inline:i,children:t,node:o,...l})=>{var d,a,r;const s=n.useContext(q)||"true"==(null==l?void 0:l.table),c=`${null==l?void 0:l.href}`,u=null===(d=c.split("$"))||void 0===d?void 0:d[0],g=null===(a=c.split("$"))||void 0===a?void 0:a[1];if("ai_reasoning"===u){const n=(null!==(r=x?V:ae)&&void 0!==r?r:[]).find(e=>e.id.toString()===decodeURIComponent(g)),i=ue.includes(g);if(n){if(s)return e.jsx(T,{aiReason:n,customStyle:null==H?void 0:H.tableAiReasoning,customIcons:me,isHighConfidence:n.relevance_score>=v.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const o=qe(t),l="source"!==o.trim().toLowerCase();return e.jsx(v.default,{aiReason:n,isSourceHasHighlight:i,inlineLabel:o,isInlineCitation:l,customIcons:me,customStyles:{aiReasoningContent:null==H?void 0:H.aiReasoningContent,aiReasoningAccordion:null==H?void 0:H.aiReasoningAccordion,aiReasoningMarkdown:null==H?void 0:H.aiReasoningMarkdown,aiReasoningPill:null==H?void 0:H.aiReasoningPill,webCitation:null==H?void 0:H.webCitation,stormeeCitation:null==H?void 0:H.stormeeCitation,waveformCitation:null==H?void 0:H.waveformCitation,imageCitation:null==H?void 0:H.imageCitation,fileCitation:null==H?void 0:H.fileCitation,appModCitation:null==H?void 0:H.appModCitation,rcaCitation:null==H?void 0:H.rcaCitation,readFileCitation:null==H?void 0:H.readFileCitation,loadingCitations:null==H?void 0:H.loadingCitations,chatCitation:null==H?void 0:H.chatCitation,bigEnoughCitation:null==H?void 0:H.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:t,node:l,...d})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e.jsx("div",{children:e.jsx("code",{className:o.default.blockCode,style:null==H?void 0:H.code,children:i})}):e.jsx("code",{className:o.default.inlineCode,style:null==H?void 0:H.code,children:i}),learned:({children:n})=>e.jsx(a.Tooltip,{title:n,placement:"top",children:e.jsx(d.Info,{size:16,className:o.default.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",o=(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})(i);return e.jsx(c.default,{title:"Generated Code",code:o,language:t,customStyles:{pill:null==H?void 0:H.generatedCodePill,content:null==H?void 0:H.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var o,l,d,a;const r=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`,s=(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}})(t),c=s?e.jsx("div",{dangerouslySetInnerHTML:{__html:A.default.sanitize(s)}}):e.jsx("div",{children:i});return e.jsx(y.default,{id:r,node:n,children:c,props:t,segmentComponentConfig:pe,customStyles:H,customIcons:O,extractText:qe,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var o,l,d,a;const r=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`;return e.jsx(y.default,{id:r,node:n,children:i,props:t,segmentComponentConfig:pe,customStyles:H,customIcons:O,extractText:qe,blockId:ee})}}),[$e,K,ae,W,xe,x,i,O,ce,ue,H,pe,be,Ae,ee]),_e=n.useMemo(()=>{let e=I.escapeTagIds(Me,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=I.splitTagAcrossParagraphs(e,n,"upt"===n)}),e},[Me]);return n.useEffect(()=>{if(!ie.current)return;if(!ce.length)return void Ce();let e;if(0===ue.length||X)requestAnimationFrame(()=>{fe([ce[ge].replace(/\*/g,"")])});else{const n=ie.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{fe([ce[ge].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[ce,ue,ge,X]),e.jsx(E.Provider,{value:{expandedInfo:ye,setExpanded:Re,reasonToRow:we},children:e.jsxs("div",{ref:ie,className:`${o.default.container} ${"approving"!==h?o.default.wrapper:""} ${U||""}`,style:null==H?void 0:H.container,children:[r?e.jsx(S.MarkdownContextProvider,{children:e.jsx($.default,{components:Te,rehypePlugins:[k.default],children:_e})}):t,Ne>0&&Y&&e.jsx("div",{className:o.default.confidenceScoreContainer,style:null==H?void 0:H.confidenceScoreContainer,children:e.jsxs("span",{className:o.default.confidenceScore,style:null==H?void 0:H.confidenceScore,children:[e.jsx(m.default,{size:14,color:(null==H?void 0:H.confidenceScoreIconColor)||"#166534"}),Ne,"%"]})}),M&&e.jsx("div",{className:o.default.citationLoader,style:null==H?void 0:H.citationLoaderContainer,children:e.jsx(u.default,{customStyles:{container:null==H?void 0:H.citationLoadingContainer,icon:null==H?void 0:H.citationLoadingIcon,text:null==H?void 0:H.citationLoadingText}})}),p&&e.jsx("div",{style:{...null===(ne=null==H?void 0:H.attachedContext)||void 0===ne?void 0:ne.wrapper},className:"flex mt-5",children:e.jsx(C.default,{customStyles:null==H?void 0:H.attachedContext,variant:B})})]})})},exports.splitNestedDiffNodes=P;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),t=require("rehype-raw"),o=require("./UserStoryWithCitation.module.css.js"),l=require("../../shared/useMarkdownSearch.js"),d=require("lucide-react"),a=require("@mui/material"),r=require("dompurify"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),g=require("../RequirementAIWrapper/RequirementAIWrapper.js"),p=require("../../icons/CognitiveDecision.js"),h=require("../../icons/BrainRed.js"),v=require("../ai-reasoning/AiReasoningCitation.js"),m=require("../../icons/RelevanceScoreIcon.js"),f=require("../RecommendationBlock/RecommendationBlock.js"),C=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),j=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),w=require("./components/InlineManualComponent.js"),I=require("./components/HighlightButtonComponent.js"),b=require("../../../../utils/tagHelper.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=R(n),$=R(i),k=R(t),A=R(r);const q=n.createContext(!1),E=n.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),M=n.createContext({rowId:""}),T=({aiReason:i,isHighConfidence:t,customStyle:l,customIcons:d})=>{var a;const{expandedInfo:r,setExpanded:s,reasonToRow:c}=n.useContext(E),{rowId:u}=n.useContext(M),g=String(i.id);u&&c.current.set(g,u);const v=(null===(a=null==r?void 0:r.aiReason)||void 0===a?void 0:a.id)===i.id,m=t?(null==d?void 0:d.highConfidence)||e.jsx(p.default,{}):(null==d?void 0:d.lowConfidence)||e.jsx(h.default,{});return e.jsxs("button",{className:o.default.aiReasoningButton,style:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),s(v?null:u,v?null:i)},children:[m,v?e.jsx("i",{className:`pi pi-angle-up ${t?o.default.aiReasoningIconHighConfidence:o.default.aiReasoningIconLowConfidence}`}):e.jsx("i",{className:`pi pi-angle-down ${t?o.default.aiReasoningIconHighConfidence:o.default.aiReasoningIconLowConfidence}`})]})},_=({children:i,node:t,customStyles:l,customIcons:d})=>{var a,r;const s=n.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=n.useContext(E),u=(null==c?void 0:c.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,p=null!==(r=null===(a=null==t?void 0:t.properties)||void 0===a?void 0:a.style)&&void 0!==r?r:void 0;return e.jsxs(M.Provider,{value:{rowId:s},children:[e.jsx("tr",{style:p?{cssText:p}:void 0,children:i}),u&&(null==c?void 0:c.aiReason)&&e.jsx("tr",{style:{width:"100%"},children:e.jsx("td",{colSpan:g||1,className:o.default.tableExpandedCell,children:e.jsx("div",{className:o.default.tableExpandedCellInner,children:e.jsx("div",{className:o.default.tableExpandedCellContent,children:e.jsx(x.default,{aiReason:c.aiReason,customIcons:d,customStyles:{aiReasoningContent:null==l?void 0:l.aiReasoningContent,aiReasoningAccordion:null==l?void 0:l.aiReasoningAccordion,aiReasoningMarkdown:null==l?void 0:l.aiReasoningMarkdown,aiReasoningPill:null==l?void 0:l.aiReasoningPill,webCitation:null==l?void 0:l.webCitation,stormeeCitation:null==l?void 0:l.stormeeCitation,waveformCitation:null==l?void 0:l.waveformCitation,imageCitation:null==l?void 0:l.imageCitation,fileCitation:null==l?void 0:l.fileCitation,appModCitation:null==l?void 0:l.appModCitation,rcaCitation:null==l?void 0:l.rcaCitation,readFileCitation:null==l?void 0:l.readFileCitation,loadingCitations:null==l?void 0:l.loadingCitations,chatCitation:null==l?void 0:l.chatCitation}})})})})})]})};const U=["del","ins"];function L(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,U,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 t;return`<code>${o=null!==(t=n[Number(i)])&&void 0!==t?t:"",o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var o})}(e)).join(""))}const F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function P(e,n){const i=[],t=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(!N.default.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(F.has(d))return e;const a=null===(l=N.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 a&&0!==a.length?N.default.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:o(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:i,noMarkdownContent:t,useMarkdown:r=!0,isParent:p,scenario:h,showUserStoryDiff:x=!1,aiReasoningsForBlock:R,isCitationLoadingDisplay:M=!1,className:U,highConfidenceIcon:F,lowConfidenceIcon:D,customStyles:H,customIcons:O,contextVariant:B,aiReasoningDiffView:V,userStoryCitations:W,artifactId:z,isCraflow:G,onCraAccept:Q,onCraReject:J,craFlowConfig:K,isDisplayHighlightControl:X=!1,showConfidenceScore:Y=!0,CDNeededInChip:Z,blockId:ee,storyId:ne})=>{var ie;console.log("userstorywithcitation blockid ",ee);const te=n.useRef(null),{userStory:oe,inlineUpdateComponentConfig:le,getAvgScoreForStory:de,setUserStory:ae,aiReasoning:re,setAiReasoning:se,customIcons:ce,searchQueryList:ue,searchQueryReasoningIdList:ge,currentHighlightIndex:pe,segmentComponentConfig:he,inlineManualComponentConfig:ve,diffEditConfig:me}=g.useRequirementAI(),fe=null!=O?O:null==ce?void 0:ce.userStoryIcons;null==H||H.searchHighlight;const{search:Ce,clear:xe}=l.useMarkdownSearch(te),[je,ye]=n.useState("1"),[Se,we]=n.useState(null),Ie=n.useRef(new Map),[be,Re]=n.useState(new Set),Ne=n.useCallback((e,n)=>{we(e&&n?{rowId:e,aiReason:n}:null)},[]),$e=z?de(z):0,[ke,Ae]=n.useState([]),qe=n.useCallback(e=>{Re(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Ee=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Ee).join(""):N.default.isValidElement(e)?Ee(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,t,o)=>{const l=t.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,t,o)=>{const l=n.substring(0,o),d=l.lastIndexOf("\n"),a=/^\s+[-*]\s/.test(l.substring(d+1))||/^\s+\d+\.\s/.test(l.substring(d+1)),r=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(d+1));if(a||r){let e=t;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 t;const o=new RegExp(n.source,n.flags);for(;null!==(t=o.exec(e));){const e=t[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;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const o=l.substring(0,n.index).split("\n").reverse();let d=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(d=!0);break}}if(!d)continue;const a=n.endIndex,r=e+1<i.length?i[e+1].index:l.length;let s=l.substring(a,r);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),l=l.substring(0,a)+s+l.substring(r)}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=L(n),n},Te=n.useMemo(()=>i?Me(i):i,[i]);n.useEffect(()=>{Ae(R||re)},[R,re]);const _e=n.useMemo(()=>({span:({node:n,children:i,...t})=>{var o,l,d,a,r;const s=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==l?l:null==t?void 0:t["highlight-id"],c="string"==typeof s&&be.has(s),u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-color"])&&void 0!==a?a:null==t?void 0:t["highlight-color"];return e.jsx("span",{style:{...null!==(r=null==H?void 0:H.span)&&void 0!==r?r:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:n,children:i,...t})=>{var o,l,d,a,r,s;const c=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.action)&&void 0!==l?l:null==t?void 0:t.action,u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(s=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-type"])&&void 0!==s?s:null==t?void 0:t["highlight-type"];return"highlight"===c?e.jsx(I.default,{highlightId:u,handleHighlightSpan:qe,icon:"web"===g?null==fe?void 0:fe.webCitationIcon:"doc"===g?null==fe?void 0:fe.fileCitationIcon:e.jsx(e.Fragment,{}),customStyles:"web"===g?null==H?void 0:H.webButton:"doc"===g?null==H?void 0:H.docButton:{}}):null},upt:({node:n,children:i,...t})=>{var o,l;const d=null==t?void 0:t.id,a=d?null===(l=null===(o=d.split("$"))||void 0===o?void 0:o[1])||void 0===l?void 0:l.replaceAll("@","<").replaceAll("#",">"):null,r=re.find(e=>e.id.toString()===a);if(!r)return i||e.jsx(e.Fragment,{});const s="data-main"in t,c=t["data-status"];return e.jsx(e.Fragment,{children:e.jsx(j.default,{aiReason:r,customStyles:null==H?void 0:H.inlineUpdatedComponent,handleClickCognitiveDecision:null==le?void 0:le.handleClickCognitiveDecision,handleClickUpdatedPill:null==le?void 0:le.handleClickUpdatedPill,handleClickOutputValue:null==le?void 0:le.handleClickOutputValue,customIcons:null==le?void 0:le.customIcons,CDNeededInChip:Z,showChip:s,status:c,children:i||e.jsx(e.Fragment,{})})})},del:({node:n,children:i,...t})=>{var l;const{cleanedChildren:d,extractedNodes:a}=P(i,["ins"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:o.default.deleted,style:null!==(l=null==H?void 0:H.deleted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:d}),a]})},ins:({children:n,...i})=>{var t;const{cleanedChildren:l,extractedNodes:d}=P(n,["del"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:o.default.inserted,style:null!==(t=null==H?void 0:H.inserted)&&void 0!==t?t:{},...i,onClick:()=>{i.onclick&&i.onclick()},children:l}),d]})},preserved:({children:n,...i})=>e.jsx("span",{className:o.default.preserved,style:null==H?void 0:H.preserved,...i,children:n}),manual:({children:n,...i})=>{var t;const o=null===(t=null==i?void 0:i.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),l=re.find(e=>e.id.toString()===o),d=i["data-status"];return l?e.jsx(w.default,{aiReason:l,handleClick:null==ve?void 0:ve.handleClick,status:d,children:n}):n||e.jsx(e.Fragment,{})},invisible:({children:n,...i})=>e.jsx(e.Fragment,{}),h1:({node:n,...i})=>e.jsx("h1",{className:o.default.heading1,style:null==H?void 0:H.heading1,children:i.children}),h2:({node:n,...i})=>e.jsx("h2",{className:o.default.heading2,style:null==H?void 0:H.heading2,children:i.children}),h3:({node:n,...i})=>e.jsx("h3",{className:o.default.heading3,style:null==H?void 0:H.heading3,children:i.children}),b:({node:n,...i})=>e.jsx("b",{className:o.default.bold,style:null==H?void 0:H.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e.jsx("p",{...i,className:o.default.paragraph,style:null==H?void 0:H.paragraph,children:i.children}),updated:({node:n,...i})=>e.jsx(s.default,{...i,showUserStoryDiff:x,currentUpdatedTagId:je,setCurrentUpdatedTagId:ye,userStory:oe,setUserStory:ae,setAiReasoning:se,node:n,isCraflow:G,onCraAccept:Q,onCraReject:J,diffEditConfig:me,customStyles:null==H?void 0:H.updatedContent,craFlowConfig:K}),ol:({node:n,...i})=>{var t,l,d;const a=null!==(d=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==l?l:null==i?void 0:i.start)&&void 0!==d?d:void 0;return e.jsx("ol",{className:o.default.orderedList,style:null==H?void 0:H.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e.jsx("ul",{className:o.default.unorderedList,style:null==H?void 0:H.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e.jsx("div",{className:o.default.tableWrapper,children:e.jsx("table",{className:o.default.table,style:null==H?void 0:H.table,children:n})}),tr:({node:n,children:i})=>e.jsx(_,{node:n,children:i,customStyles:H}),td:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("td",{...l,style:o?{cssText:o}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("th",{...l,style:o?{cssText:o}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const o=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e.jsx(f.default,{...i,customStyles:null==H?void 0:H.recommendationBlock,label:o})},a:({inline:i,children:t,node:o,...l})=>{var d,a,r;const s=n.useContext(q)||"true"==(null==l?void 0:l.table),c=`${null==l?void 0:l.href}`,u=null===(d=c.split("$"))||void 0===d?void 0:d[0],g=null===(a=c.split("$"))||void 0===a?void 0:a[1];if("ai_reasoning"===u){const n=(null!==(r=x?V:re)&&void 0!==r?r:[]).find(e=>e.id.toString()===decodeURIComponent(g)),i=ge.includes(g);if(n){if(s)return e.jsx(T,{aiReason:n,customStyle:null==H?void 0:H.tableAiReasoning,customIcons:fe,isHighConfidence:n.relevance_score>=v.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const o=Ee(t),l="source"!==o.trim().toLowerCase();return e.jsx(v.default,{aiReason:n,isSourceHasHighlight:i,inlineLabel:o,isInlineCitation:l,customIcons:fe,customStyles:{aiReasoningContent:null==H?void 0:H.aiReasoningContent,aiReasoningAccordion:null==H?void 0:H.aiReasoningAccordion,aiReasoningMarkdown:null==H?void 0:H.aiReasoningMarkdown,aiReasoningPill:null==H?void 0:H.aiReasoningPill,webCitation:null==H?void 0:H.webCitation,stormeeCitation:null==H?void 0:H.stormeeCitation,waveformCitation:null==H?void 0:H.waveformCitation,imageCitation:null==H?void 0:H.imageCitation,fileCitation:null==H?void 0:H.fileCitation,appModCitation:null==H?void 0:H.appModCitation,rcaCitation:null==H?void 0:H.rcaCitation,readFileCitation:null==H?void 0:H.readFileCitation,loadingCitations:null==H?void 0:H.loadingCitations,chatCitation:null==H?void 0:H.chatCitation,bigEnoughCitation:null==H?void 0:H.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:t,node:l,...d})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e.jsx("div",{children:e.jsx("code",{className:o.default.blockCode,style:null==H?void 0:H.code,children:i})}):e.jsx("code",{className:o.default.inlineCode,style:null==H?void 0:H.code,children:i}),learned:({children:n})=>e.jsx(a.Tooltip,{title:n,placement:"top",children:e.jsx(d.Info,{size:16,className:o.default.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",o=(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})(i);return e.jsx(c.default,{title:"Generated Code",code:o,language:t,customStyles:{pill:null==H?void 0:H.generatedCodePill,content:null==H?void 0:H.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var o,l,d,a;const r=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`,s=(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}})(t),c=s?e.jsx("div",{dangerouslySetInnerHTML:{__html:A.default.sanitize(s)}}):e.jsx("div",{children:i});return e.jsx(y.default,{id:r,node:n,children:c,props:t,segmentComponentConfig:he,customStyles:H,customIcons:O,extractText:Ee,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var o,l,d,a;const r=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`;return e.jsx(y.default,{id:r,node:n,children:i,props:t,segmentComponentConfig:he,customStyles:H,customIcons:O,extractText:Ee,blockId:ee,storyId:ne})}}),[ke,K,re,W,je,x,i,O,ue,ge,H,he,be,qe,ee,ne]),Ue=n.useMemo(()=>{let e=b.escapeTagIds(Te,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=b.splitTagAcrossParagraphs(e,n,"upt"===n)}),e},[Te]);return n.useEffect(()=>{if(!te.current)return;if(!ue.length)return void xe();let e;if(0===ge.length||X)requestAnimationFrame(()=>{Ce([ue[pe].replace(/\*/g,"")])});else{const n=te.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{Ce([ue[pe].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[ue,ge,pe,X]),e.jsx(E.Provider,{value:{expandedInfo:Se,setExpanded:Ne,reasonToRow:Ie},children:e.jsxs("div",{ref:te,className:`${o.default.container} ${"approving"!==h?o.default.wrapper:""} ${U||""}`,style:null==H?void 0:H.container,children:[r?e.jsx(S.MarkdownContextProvider,{children:e.jsx($.default,{components:_e,rehypePlugins:[k.default],children:Ue})}):t,$e>0&&Y&&e.jsx("div",{className:o.default.confidenceScoreContainer,style:null==H?void 0:H.confidenceScoreContainer,children:e.jsxs("span",{className:o.default.confidenceScore,style:null==H?void 0:H.confidenceScore,children:[e.jsx(m.default,{size:14,color:(null==H?void 0:H.confidenceScoreIconColor)||"#166534"}),$e,"%"]})}),M&&e.jsx("div",{className:o.default.citationLoader,style:null==H?void 0:H.citationLoaderContainer,children:e.jsx(u.default,{customStyles:{container:null==H?void 0:H.citationLoadingContainer,icon:null==H?void 0:H.citationLoadingIcon,text:null==H?void 0:H.citationLoadingText}})}),p&&e.jsx("div",{style:{...null===(ie=null==H?void 0:H.attachedContext)||void 0===ie?void 0:ie.wrapper},className:"flex mt-5",children:e.jsx(C.default,{customStyles:null==H?void 0:H.attachedContext,variant:B})})]})})},exports.splitNestedDiffNodes=P;
2
2
  //# sourceMappingURL=UserStoryWithCitation.js.map