@viswa-test/test-citation 0.0.231 → 0.0.232

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 (95) hide show
  1. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +2 -0
  3. package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -0
  4. package/dist/cjs/features/CognitiveCompare/components/connectedLines.js +1 -1
  5. package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  6. package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  7. package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
  8. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
  9. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
  10. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
  11. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.js +1 -1
  12. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
  13. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
  14. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
  15. package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  16. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  17. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  18. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  19. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
  20. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  21. package/dist/cjs/features/RequirementAI/utils/helpers.js +1 -1
  22. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  23. package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +2 -0
  24. package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -0
  25. package/dist/features/CognitiveCompare/components/connectedLines.js +1 -1
  26. package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  27. package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  28. package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
  29. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
  30. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
  31. package/dist/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
  32. package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.js +1 -1
  33. package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
  34. package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
  35. package/dist/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
  36. package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  37. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  38. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  39. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  40. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
  41. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  42. package/dist/features/RequirementAI/utils/helpers.js +1 -1
  43. package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
  44. package/dist/types/src/CommonConstants/CommonConstants.d.ts +0 -1365
  45. package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
  46. package/dist/types/src/RedlineApprovalCardTest.d.ts +1 -0
  47. package/dist/types/src/RedlineApprovalCardTest.d.ts.map +1 -0
  48. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  49. package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
  50. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
  51. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  52. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +5 -0
  53. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
  54. package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +1 -0
  55. package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
  56. package/dist/types/src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts +3 -0
  57. package/dist/types/src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -0
  58. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +3379 -0
  59. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -0
  60. package/dist/types/src/features/CognitiveCompare/components/connectedLines.d.ts.map +1 -1
  61. package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts +2 -1
  62. package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
  63. package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts +1 -1
  64. package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
  65. package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts +1 -1
  66. package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
  67. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/Editor.d.ts.map +1 -1
  68. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.d.ts.map +1 -1
  69. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts +2 -6
  70. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts.map +1 -1
  71. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts +2 -6
  72. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts.map +1 -1
  73. package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  74. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +6 -12
  75. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  76. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +2 -1
  77. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  78. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +0 -4
  79. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  80. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
  81. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +0 -1
  82. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
  83. package/package.json +2 -2
  84. package/dist/cjs/utils/tagHelper.js +0 -2
  85. package/dist/cjs/utils/tagHelper.js.map +0 -1
  86. package/dist/types/src/constants/deviationData.d.ts +0 -887
  87. package/dist/types/src/constants/deviationData.d.ts.map +0 -1
  88. package/dist/types/src/constants/treeData.d.ts +0 -732
  89. package/dist/types/src/constants/treeData.d.ts.map +0 -1
  90. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts +0 -8
  91. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts.map +0 -1
  92. package/dist/types/src/utils/tagHelper.d.ts +0 -5
  93. package/dist/types/src/utils/tagHelper.d.ts.map +0 -1
  94. package/dist/utils/tagHelper.js +0 -2
  95. package/dist/utils/tagHelper.js.map +0 -1
@@ -1,2 +1,2 @@
1
- var e='.PlaygroundEditorTheme__ltr{text-align:left}.PlaygroundEditorTheme__rtl{text-align:right}.PlaygroundEditorTheme__paragraph{font-family:Inter,sans-serif;line-height:28px;margin:0 0 8px;position:relative}.PlaygroundEditorTheme__paragraph:last-child{margin-bottom:0}.PlaygroundEditorTheme__quote{border-left:4px solid #ced0d4;color:#65676b;font-size:15px;margin:0 0 10px 20px;padding-left:16px}.PlaygroundEditorTheme__h1{font-family:Inter,sans-serif;font-size:24px;margin:12px 0 4px;padding:0}.PlaygroundEditorTheme__h2{font-size:20px}.PlaygroundEditorTheme__h2,.PlaygroundEditorTheme__h3{font-family:Inter,sans-serif;margin:10px 0 0;padding:0}.PlaygroundEditorTheme__h3{font-size:18px;text-transform:uppercase}.PlaygroundEditorTheme__textBold{font-family:Inter,sans-serif;font-weight:700}.PlaygroundEditorTheme__textItalic{font-style:italic}.PlaygroundEditorTheme__textUnderline{text-decoration:underline}.PlaygroundEditorTheme__textStrikethrough{text-decoration:line-through}.PlaygroundEditorTheme__textUnderlineStrikethrough{text-decoration:underline line-through}.PlaygroundEditorTheme__textSubscript{font-size:.8em;vertical-align:sub!important}.PlaygroundEditorTheme__textSuperscript{font-size:.8em;vertical-align:super}.PlaygroundEditorTheme__textCode{background-color:#f0f2f5;font-family:Menlo,Consolas,Monaco,monospace;font-size:94%;padding:1px .25rem}.PlaygroundEditorTheme__hashtag{background-color:#5890ff26;border-bottom:1px solid #5890ff4d}.PlaygroundEditorTheme__link{color:#216fdb;text-decoration:none}.PlaygroundEditorTheme__link:hover{text-decoration:underline}.PlaygroundEditorTheme__code{background-color:#f0f2f5;display:block;font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.53;margin:8px 0;overflow-x:auto;padding:8px 8px 8px 52px;position:relative;tab-size:2}.PlaygroundEditorTheme__code:before{background-color:#eee;border-right:1px solid #ccc;color:#777;content:attr(data-gutter);left:0;min-width:25px;padding:8px;position:absolute;text-align:right;top:0;white-space:pre-wrap}.PlaygroundEditorTheme__code:after{color:#00000080;content:attr(data-highlight-language);font-size:10px;padding:3px;position:absolute;right:3px;text-transform:uppercase;top:0}.PlaygroundEditorTheme__table{border-collapse:collapse;border-spacing:0;max-width:100%;overflow-y:scroll;table-layout:fixed;width:100%}.PlaygroundEditorTheme__tableCell{border:1px solid #000;min-width:75px;padding:6px 8px;text-align:start;vertical-align:top}.PlaygroundEditorTheme__tableCellHeader{background-color:#f2f3f5;text-align:start}.PlaygroundEditorTheme__characterLimit{background-color:#fbb!important;display:inline}.PlaygroundEditorTheme__ul{list-style-type:disc}.PlaygroundEditorTheme__ol1,.PlaygroundEditorTheme__ul{list-style-position:outside;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol1{list-style-type:decimal}.PlaygroundEditorTheme__ol2{list-style-position:outside;list-style-type:upper-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol3{list-style-position:outside;list-style-type:lower-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol4{list-style-position:outside;list-style-type:upper-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol5{list-style-position:outside;list-style-type:lower-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__listItem{display:list-item;margin:8px 24px 8px 8px;padding:0 8px}.PlaygroundEditorTheme__nestedListItem{list-style-type:inherit;margin-left:16px}ol .PlaygroundEditorTheme__nestedListItem{list-style-type:none}.PlaygroundEditorTheme__listItemChecked,.PlaygroundEditorTheme__listItemUnchecked{list-style-type:none;margin-left:8px;margin-right:8px;outline:none;padding-left:24px;padding-right:24px;position:relative}.PlaygroundEditorTheme__listItemChecked{text-decoration:line-through}.PlaygroundEditorTheme__listItemChecked:before,.PlaygroundEditorTheme__listItemUnchecked:before{background-size:cover;content:"";cursor:pointer;display:block;height:16px;left:0;position:absolute;top:2px;width:16px}.PlaygroundEditorTheme__listItemChecked[dir=rtl]:before,.PlaygroundEditorTheme__listItemUnchecked[dir=rtl]:before{left:auto;right:0}.PlaygroundEditorTheme__listItemChecked:focus:before,.PlaygroundEditorTheme__listItemUnchecked:focus:before{border-radius:2px;box-shadow:0 0 0 2px #a6cdfe}.PlaygroundEditorTheme__tokenComment{color:#708090}.PlaygroundEditorTheme__tokenPunctuation{color:#999}.PlaygroundEditorTheme__tokenProperty{color:#905}.PlaygroundEditorTheme__tokenSelector{color:#690}.PlaygroundEditorTheme__tokenOperator{color:#9a6e3a}.PlaygroundEditorTheme__tokenAttr{color:#07a}.PlaygroundEditorTheme__tokenVariable{color:#e90}.PlaygroundEditorTheme__tokenFunction{color:#dd4a68}.PlaygroundEditorTheme__mark{background:#ffd40024;border-bottom:2px solid #ffd4004d;padding-bottom:2px}.PlaygroundEditorTheme__markOverlap{background:#ffd4004d;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__mark.selected{background:#ffd40080;border-bottom:2px solid #ffd400}.PlaygroundEditorTheme__markOverlap.selected{background:#ffd400b3;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__embedBlock{user-select:none}.PlaygroundEditorTheme__embedBlockFocus{outline:2px solid #3c84f4}.PlaygroundEditorTheme__highlight-button{display:none}.PlaygroundEditorTheme__insert-node{background-color:#8cbeff;text-decoration:none}.PlaygroundEditorTheme__delete-node{text-decoration:line-through;text-decoration-color:#dc2626}[class^=PlaygroundEditorTheme__update-node]>.PlaygroundEditorTheme__insert-node{background-color:#f3e8ff}.PlaygroundEditorTheme__manual-node-accepted,[class^=PlaygroundEditorTheme__manual-node]>.PlaygroundEditorTheme__insert-node{background-color:#8cbeff}.PlaygroundEditorTheme__manual-node-rejected{text-decoration:underline;text-decoration-color:red}.PlaygroundEditorTheme__update-node-accepted{background-color:#f3e8ff;-webkit-box-decoration-break:clone;box-decoration-break:clone;display:inline}';!function(){if("undefined"==typeof document)return;const o=document.createElement("style");o.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&o.setAttribute("nonce",t),o.appendChild(document.createTextNode(e));const r=document.head||document.getElementsByTagName("head")[0]||document.documentElement;r&&r.appendChild(o)}();export{e as default};
1
+ var e='.PlaygroundEditorTheme__ltr{text-align:left}.PlaygroundEditorTheme__rtl{text-align:right}.PlaygroundEditorTheme__paragraph{font-family:Inter,sans-serif;line-height:28px;margin:0 0 8px;position:relative}.PlaygroundEditorTheme__paragraph:last-child{margin-bottom:0}.PlaygroundEditorTheme__quote{border-left:4px solid #ced0d4;color:#65676b;font-size:15px;margin:0 0 10px 20px;padding-left:16px}.PlaygroundEditorTheme__h1{font-family:Inter,sans-serif;font-size:24px;margin:12px 0 4px;padding:0}.PlaygroundEditorTheme__h2{font-size:20px}.PlaygroundEditorTheme__h2,.PlaygroundEditorTheme__h3{font-family:Inter,sans-serif;margin:10px 0 0;padding:0}.PlaygroundEditorTheme__h3{font-size:18px;text-transform:uppercase}.PlaygroundEditorTheme__textBold{font-family:Inter,sans-serif;font-weight:700}.PlaygroundEditorTheme__textItalic{font-style:italic}.PlaygroundEditorTheme__textUnderline{text-decoration:underline}.PlaygroundEditorTheme__textStrikethrough{text-decoration:line-through}.PlaygroundEditorTheme__textUnderlineStrikethrough{text-decoration:underline line-through}.PlaygroundEditorTheme__textSubscript{font-size:.8em;vertical-align:sub!important}.PlaygroundEditorTheme__textSuperscript{font-size:.8em;vertical-align:super}.PlaygroundEditorTheme__textCode{background-color:#f0f2f5;font-family:Menlo,Consolas,Monaco,monospace;font-size:94%;padding:1px .25rem}.PlaygroundEditorTheme__hashtag{background-color:#5890ff26;border-bottom:1px solid #5890ff4d}.PlaygroundEditorTheme__link{color:#216fdb;text-decoration:none}.PlaygroundEditorTheme__link:hover{text-decoration:underline}.PlaygroundEditorTheme__code{background-color:#f0f2f5;display:block;font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.53;margin:8px 0;overflow-x:auto;padding:8px 8px 8px 52px;position:relative;tab-size:2}.PlaygroundEditorTheme__code:before{background-color:#eee;border-right:1px solid #ccc;color:#777;content:attr(data-gutter);left:0;min-width:25px;padding:8px;position:absolute;text-align:right;top:0;white-space:pre-wrap}.PlaygroundEditorTheme__code:after{color:#00000080;content:attr(data-highlight-language);font-size:10px;padding:3px;position:absolute;right:3px;text-transform:uppercase;top:0}.PlaygroundEditorTheme__table{border-collapse:collapse;border-spacing:0;max-width:100%;overflow-y:scroll;table-layout:fixed;width:100%}.PlaygroundEditorTheme__tableCell{border:1px solid #000;min-width:75px;padding:6px 8px;text-align:start;vertical-align:top}.PlaygroundEditorTheme__tableCellHeader{background-color:#f2f3f5;text-align:start}.PlaygroundEditorTheme__characterLimit{background-color:#fbb!important;display:inline}.PlaygroundEditorTheme__ul{list-style-type:disc}.PlaygroundEditorTheme__ol1,.PlaygroundEditorTheme__ul{list-style-position:outside;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol1{list-style-type:decimal}.PlaygroundEditorTheme__ol2{list-style-position:outside;list-style-type:upper-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol3{list-style-position:outside;list-style-type:lower-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol4{list-style-position:outside;list-style-type:upper-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol5{list-style-position:outside;list-style-type:lower-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__listItem{display:list-item;margin:8px 24px 8px 8px;padding:0 8px}.PlaygroundEditorTheme__nestedListItem{list-style-type:inherit;margin-left:16px}ol .PlaygroundEditorTheme__nestedListItem{list-style-type:none}.PlaygroundEditorTheme__listItemChecked,.PlaygroundEditorTheme__listItemUnchecked{list-style-type:none;margin-left:8px;margin-right:8px;outline:none;padding-left:24px;padding-right:24px;position:relative}.PlaygroundEditorTheme__listItemChecked{text-decoration:line-through}.PlaygroundEditorTheme__listItemChecked:before,.PlaygroundEditorTheme__listItemUnchecked:before{background-size:cover;content:"";cursor:pointer;display:block;height:16px;left:0;position:absolute;top:2px;width:16px}.PlaygroundEditorTheme__listItemChecked[dir=rtl]:before,.PlaygroundEditorTheme__listItemUnchecked[dir=rtl]:before{left:auto;right:0}.PlaygroundEditorTheme__listItemChecked:focus:before,.PlaygroundEditorTheme__listItemUnchecked:focus:before{border-radius:2px;box-shadow:0 0 0 2px #a6cdfe}.PlaygroundEditorTheme__tokenComment{color:#708090}.PlaygroundEditorTheme__tokenPunctuation{color:#999}.PlaygroundEditorTheme__tokenProperty{color:#905}.PlaygroundEditorTheme__tokenSelector{color:#690}.PlaygroundEditorTheme__tokenOperator{color:#9a6e3a}.PlaygroundEditorTheme__tokenAttr{color:#07a}.PlaygroundEditorTheme__tokenVariable{color:#e90}.PlaygroundEditorTheme__tokenFunction{color:#dd4a68}.PlaygroundEditorTheme__mark{background:#ffd40024;border-bottom:2px solid #ffd4004d;padding-bottom:2px}.PlaygroundEditorTheme__markOverlap{background:#ffd4004d;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__mark.selected{background:#ffd40080;border-bottom:2px solid #ffd400}.PlaygroundEditorTheme__markOverlap.selected{background:#ffd400b3;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__embedBlock{user-select:none}.PlaygroundEditorTheme__embedBlockFocus{outline:2px solid #3c84f4}.PlaygroundEditorTheme__delete-node{text-decoration:var(--delete-node-text-decoration,line-through);text-decoration-color:var(--delete-node-decoration-color,#dc2626);text-decoration-thickness:var(--delete-node-decoration-thickness,2px)}.PlaygroundEditorTheme__insert-node{background-color:var(--insert-node-bg,#dbeafe);border-radius:var(--insert-node-border-radius,2px);color:var(--insert-node-color,#1e3a8a);padding:var(--insert-node-padding,1px 2px);text-decoration:var(--insert-node-text-decoration,none)}.PlaygroundEditorTheme__highlight-button{display:none}';!function(){if("undefined"==typeof document)return;const o=document.createElement("style");o.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&o.setAttribute("nonce",t),o.appendChild(document.createTextNode(e));const r=document.head||document.getElementsByTagName("head")[0]||document.documentElement;r&&r.appendChild(o)}();export{e as default};
2
2
  //# sourceMappingURL=theme.css.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useRef as n,useState as o,useEffect as a,useImperativeHandle as i}from"react";import{DEFAULT_TOOLBAR_CONFIG as l}from"./Editor/constants/editorConfig.js";import c from"./Editor/Editor.js";import{useRefStore as s}from"../../store/ref.context.js";import{$generateHtmlFromNodes as u}from"@lexical/html";import d from"turndown";import{tables as h}from"turndown-plugin-gfm";import{UnsavedChangesPopup as p}from"../UnsavedChangesPopup/UnsavedChangesPopup.js";import{mergeTagAcrossParagraphs as m,unescapeTagIds as g}from"../../../../utils/tagHelper.js";const f=new d({headingStyle:"atx",codeBlockStyle:"fenced"});f.keep(["ins","del","mark"]),f.keep(e=>{var t,r;return"A"===e.nodeName&&null!==(r=null===(t=e.getAttribute("href"))||void 0===t?void 0:t.includes("ai_reasoning$"))&&void 0!==r&&r}),f.keep(e=>"SPAN"===e.nodeName&&e.hasAttribute("highlight-id")),f.addRule("md-table-passthrough",{filter:e=>"PRE"===e.nodeName&&"true"===e.getAttribute("data-md-table"),replacement:(e,t)=>t.textContent||""}),f.use(h);const E=e=>(e||"").replace(/\r\n/g,"\n").trim(),v=r(({type:r,value:d,handleUpdateState:h,onBlur:v,placeholder:A,minHeight:S,height:$,mode:y,doNotShowBorderInViewMode:w,onEditBlocked:b,onSaveUnsavedChanges:x,onDiscardUnsavedChanges:C,isSavingUnsavedChanges:N=!1},B)=>{const T=n(null),[L,q]=o({type:r,value:d}),[H,I]=o(0),[R,_]=o(!1),j=n(d),k=n(d),M=n(Boolean(d)),{contentRef:U,setContentRef:V}=s();a(()=>{q(e=>({...e,value:d})),j.current=d,k.current=d,M.current=Boolean(d),_(!1)},[d]),i(B,()=>({requestClose:()=>!("edit"===y&&E(j.current)!==E(k.current))||(_(!0),!1)}),[y]);return a(()=>{const e=()=>{U&&U.current&&I(U.current.clientHeight-60)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[U]),e("div",{style:{position:"relative",width:"100%",height:$,minHeight:S},children:[R&&t(p,{isSaving:N,onSave:async()=>{await(null==x?void 0:x()),j.current=k.current,_(!1)},onDiscard:()=>{k.current=j.current,null==C||C(),_(!1)}}),t(c,{minHeight:S,height:$,placeholder:A||"Enter some text...",onChange:(e,t)=>{e.read(()=>{const e=u(t,null),r=(new DOMParser).parseFromString(e,"text/html");r.querySelectorAll("span").forEach(e=>{const t=e.getAttribute("style")||"";t.includes("background-color")&&t.includes("rgb(219, 234, 254)")&&e.setAttribute("data-review","insert"),t.includes("text-decoration")&&t.includes("line-through")&&e.setAttribute("data-review","delete")}),r.querySelectorAll("strong code").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll("code strong").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const n=["upt","manual","ins","del","preserved"];function o(e,t){const r=e.cloneNode(!0),a=new Map;r.querySelectorAll(n.join(",")).forEach(e=>{if(e===r)return;const n=`%%NESTED${a.size}%%`;a.set(n,o(e,t)),e.replaceWith(n)});let i=t.turndown(r.innerHTML);a.forEach((e,t)=>{i=i.replace(t,e)});const l=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),c=e.tagName.toLowerCase();return l?`<${c} ${l}>${i}</${c}>`:`<${c}>${i}</${c}>`}r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const a=[];r.querySelectorAll("invisible").forEach((e,t)=>{a.push(e.outerHTML),e.replaceWith(r.createTextNode(`%%INVISIBLE_${t}%%`))});const i=[];r.querySelectorAll("upt, manual").forEach((e,t)=>{i.push(o(e,f)),e.replaceWith(r.createTextNode(`%%REVIEW_${t}%%`))});const l=[];r.querySelectorAll("table").forEach((e,t)=>{l.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let c=f.turndown(r.body.innerHTML);i.forEach((e,t)=>{c=c.replace(`%%REVIEW\\_${t}%%`,` ${e} `)}),a.forEach((e,t)=>{c=c.replace(new RegExp(`%%INVISIBLE\\\\*_${t}%%`,"g"),` ${e} `)}),l.forEach((e,t)=>{c=c.replace(`%%TABLE\\_${t}%%`,`\n\n${e}\n\n`)}),c=c.replace(/\*{4}([^*]+)\*{4}/g,"**$1**");["upt","manual","del","ins","preserved"].forEach(e=>{c=m(c,e)}),c=g(c,["manual","upt"]),M.current&&(j.current=c,M.current=!1),k.current=c,((e,t)=>{h(e,t)})("prompt",c)})},toolbarConfig:l,editorRef:T,mode:y,initialString:{type:L.type,value:L.value},dynamicHeight:H,onBlur:v,doNotShowBorderInViewMode:w||!1,onEditBlocked:b})]})});v.displayName="RichTextEditor";export{v as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useRef as n,useState as o,useEffect as a,useImperativeHandle as i}from"react";import{DEFAULT_TOOLBAR_CONFIG as l}from"./Editor/constants/editorConfig.js";import c from"./Editor/Editor.js";import{useRefStore as s}from"../../store/ref.context.js";import{$generateHtmlFromNodes as u}from"@lexical/html";import d from"turndown";import{tables as h}from"turndown-plugin-gfm";import{UnsavedChangesPopup as p}from"../UnsavedChangesPopup/UnsavedChangesPopup.js";const m=new d({headingStyle:"atx",codeBlockStyle:"fenced"});m.keep(["ins","del","mark"]),m.keep(e=>{var t,r;return"A"===e.nodeName&&null!==(r=null===(t=e.getAttribute("href"))||void 0===t?void 0:t.includes("ai_reasoning$"))&&void 0!==r&&r}),m.keep(e=>"SPAN"===e.nodeName&&e.hasAttribute("highlight-id")),m.addRule("md-table-passthrough",{filter:e=>"PRE"===e.nodeName&&"true"===e.getAttribute("data-md-table"),replacement:(e,t)=>t.textContent||""}),m.use(h);const f=e=>(e||"").replace(/\r\n/g,"\n").trim(),g=r(({type:r,value:d,handleUpdateState:h,onBlur:g,placeholder:E,minHeight:v,height:A,mode:S,doNotShowBorderInViewMode:$,onEditBlocked:y,onSaveUnsavedChanges:w,onDiscardUnsavedChanges:b,isSavingUnsavedChanges:x=!1},C)=>{const N=n(null),[B,T]=o({type:r,value:d}),[L,q]=o(0),[I,H]=o(!1),_=n(d),k=n(d),M=n(Boolean(d)),{contentRef:R,setContentRef:j}=s();a(()=>{T(e=>({...e,value:d})),_.current=d,k.current=d,M.current=Boolean(d),H(!1)},[d]),i(C,()=>({requestClose:()=>!("edit"===S&&f(_.current)!==f(k.current))||(H(!0),!1)}),[S]);return a(()=>{const e=()=>{R&&R.current&&q(R.current.clientHeight-60)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[R]),e("div",{style:{position:"relative",width:"100%",height:A,minHeight:v},children:[I&&t(p,{isSaving:x,onSave:async()=>{await(null==w?void 0:w()),_.current=k.current,H(!1)},onDiscard:()=>{k.current=_.current,null==b||b(),H(!1)}}),t(c,{minHeight:v,height:A,placeholder:E||"Enter some text...",onChange:(e,t)=>{e.read(()=>{const e=u(t,null),r=(new DOMParser).parseFromString(e,"text/html");r.querySelectorAll("span").forEach(e=>{const t=e.getAttribute("style")||"";t.includes("background-color")&&t.includes("rgb(219, 234, 254)")&&e.setAttribute("data-review","insert"),t.includes("text-decoration")&&t.includes("line-through")&&e.setAttribute("data-review","delete")}),r.querySelectorAll("strong code").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll("code strong").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const n=["upt","manual","ins","del","preserved"];function o(e,t){const r=e.cloneNode(!0),a=new Map;r.querySelectorAll(n.join(",")).forEach(e=>{if(e===r)return;const n=`%%NESTED${a.size}%%`;a.set(n,o(e,t)),e.replaceWith(n)});let i=t.turndown(r.innerHTML);a.forEach((e,t)=>{i=i.replace(t,e)});const l=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),c=e.tagName.toLowerCase();return l?`<${c} ${l}>${i}</${c}>`:`<${c}>${i}</${c}>`}r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const a=[];r.querySelectorAll("invisible").forEach((e,t)=>{a.push(e.outerHTML),e.replaceWith(r.createTextNode(`%%INVISIBLE_${t}%%`))});const i=[];r.querySelectorAll("upt, manual").forEach((e,t)=>{i.push(o(e,m)),e.replaceWith(r.createTextNode(`%%REVIEW_${t}%%`))});const l=[];r.querySelectorAll("table").forEach((e,t)=>{l.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let c=m.turndown(r.body.innerHTML);a.forEach((e,t)=>{c=c.replace(`%%INVISIBLE\\_${t}%%`,` ${e} `)}),i.forEach((e,t)=>{c=c.replace(`%%REVIEW\\_${t}%%`,` ${e} `)}),l.forEach((e,t)=>{c=c.replace(`%%TABLE\\_${t}%%`,`\n\n${e}\n\n`)}),c=c.replace(/\*{4}([^*]+)\*{4}/g,"**$1**"),M.current&&(_.current=c,M.current=!1),k.current=c,((e,t)=>{h(e,t)})("prompt",c)})},toolbarConfig:l,editorRef:N,mode:S,initialString:{type:B.type,value:B.value},dynamicHeight:L,onBlur:g,doNotShowBorderInViewMode:$||!1,onEditBlocked:y})]})});g.displayName="RichTextEditor";export{g as default};
2
2
  //# sourceMappingURL=RichTextEditor.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as i,Fragment as n}from"react/jsx-runtime";import{PenLine as o,CheckCircle as t,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import{useState as s}from"react";import{ToneToggle as c}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as p}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as g}from"../icons/aiMagic.svg.js";import{Tooltip as u}from"@mui/material";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as m}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as y}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";const h=[{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"}],x=({toneIndex:n,configs:o=h})=>{const t=Math.min(n,o.length-1),{color:l,angle:r,arcD:d}=o[t]||o[1]||o[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return i("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),e("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},f=({type:i,customStyles:n={}})=>{const o={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"},...n},t=o[i]||o.Medium;return e("div",{style:t,children:i})},S=["Lenient","Balanced","Aggressive"],b={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},C={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},I={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},k={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},w={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},B={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},T={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},A={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},D={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},E={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},R={display:"flex",gap:8,marginBottom:18},z={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"},W={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},j={borderTop:"0.5px solid #eee",padding:"14px 0px"},L={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},M={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},H={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},_={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},F={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},N={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},O={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},P={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},U={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};function q({onAssignClick:n,onOpenCognitive:o,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return i("div",{style:{...U,minWidth:"200px"},children:[i("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:n,children:[e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:i("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("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e("circle",{cx:"9",cy:"7",r:"4"})]})}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),o&&i("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>o(e),children:[t&&e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:t}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]}),d&&i("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>d(e),children:[r&&e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}function $({onAssignClick:n,onOpenCognitive:o,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[c,p]=s(!1);return i("div",{style:{position:"relative",display:"flex"},children:[e("button",{onClick:()=>p(!c),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:i("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("circle",{cx:"12",cy:"12",r:"1"}),e("circle",{cx:"12",cy:"5",r:"1"}),e("circle",{cx:"12",cy:"19",r:"1"})]})}),c&&e(q,{onAssignClick:n?()=>{p(!1),n&&n()}:void 0,onOpenCognitive:o?e=>{p(!1),o&&o(e)}:void 0,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}function G({users:n,onClick:o}){const t=n.length;return i("div",{onClick:o,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==n?void 0:n[0].length)>9?(null==n?void 0:n[0].slice(0,9))+"...":null==n?void 0:n[0]}),t>1&&i("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",t-1]})]})}function V({onClose:U,aiReason:q,onActionTrigger:V,onIterate:J,initialTone:K,onRegenerate:Q,labels:X={},toneLevelsConfig:Y=S,toneColorsConfig:Z=b,dialConfigs:ee=h,actions:ie,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:te={},customIcons:le={},onOpenCognitive:re,onHistoryClick:de,historyIconSmall:ae,historyTootipTitle:se,showTone:ce=!0,cognitiveSectionStyle:pe={},cognitiveScoreBadgeStyle:ge={},cognitiveScoreTextStyle:ue={},cognitiveStyles:ve={},cognitiveClassNames:me={},cognitiveTitle:ye="Cognitive Integrity",cognitiveTootipTitle:he="Cognitive Decisioning",cognitiveLeftIcon:xe,cognitiveIconSmall:fe,showCognitiveRightArrow:Se=!0,isStreaming:be,onAssignClick:Ce,assignedUsers:Ie,onReviewUsersClick:ke,redlineId:we,aiReasonId:Be}){var Te,Ae,De,Ee,Re,ze,We,je,Le,Me,He,_e,Fe,Ne,Oe,Pe,Ue,qe,$e;let Ge=Y.findIndex(e=>e===K);-1===Ge&&(Ge=1);const[Ve,Je]=s(!0),[Ke,Qe]=s(!1),[Xe,Ye]=s(!1),[Ze,ei]=s(Ge),[ii]=s(Ge),ni=Y[Ze],oi=Z[ni]||"#BA7517",ti=Ze!==ii,li=[{id:"iterate",icon:le.iterateIcon||e(o,{size:16,color:"#64748B"}),label:X.btnIterate||"Iterate",color:"#64748B",onClick:J},{id:"accept",icon:le.acceptIcon||e(t,{size:16,color:"#10B981"}),label:X.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:le.rejectIcon||e(l,{size:16,color:"#DC2626"}),label:X.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:ri,redlineConfig:di,updateRedlineDataParent:ai}=v(),si=ie||li;return i("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(Te=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Te?void 0:Te.root},children:[i("div",{style:{...I,...null===(Ae=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.header,marginBottom:Xe?"16px":"12px"},children:[i("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{children:le.summaryIcon||e(r,{size:16,color:"#E24B4A"})}),e("span",{style:{...k,...null===(De=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===De?void 0:De.title},children:X.summaryHeader||"Summary"})]}),Ie&&Ie.length>0&&e(G,{users:Ie,onClick:e=>{e.stopPropagation(),null==ke||ke()}})]}),i("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(Ce||re)&&e($,{onAssignClick:Ce,onOpenCognitive:re,cognitiveIconSmall:fe,cognitiveTootipTitle:he,historyIconSmall:ae,onHistoryClick:de,historyTootipTitle:se}),e("button",{onClick:U,style:{...W,...null===(Ee=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ee?void 0:Ee.closeBtn,color:"#64748B"},children:"✕"})]})]}),e(u,{title:null===(Re=null==q?void 0:q.redlining_details)||void 0===Re?void 0:Re.redline_title,children:e("p",{style:{...w,...null===(ze=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ze?void 0:ze.bodyText},children:null===(We=null==q?void 0:q.redlining_details)||void 0===We?void 0:We.redline_title})}),e("p",{style:{...B,...null===(je=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===je?void 0:je.summary},children:null===(Le=null==q?void 0:q.redlining_details)||void 0===Le?void 0:Le.redline_summary}),i("div",{style:{...T,...null===(Me=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Me?void 0:Me.impactContainer},children:[i("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i("button",{onClick:()=>Je(!Ve),style:{...D,...null===(He=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===He?void 0:He.impactToggle},children:[e("span",{style:{...E,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.impactToggleLabel},children:X.impactHeader||"Impact"}),e("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ve?"rotate(180deg)":"rotate(0deg)"},children:e(d,{size:16,color:"#E24B4A"})})]}),e(f,{type:(null==q?void 0:q.severity)||"Medium",customStyles:te})]}),Ve&&e(n,{children:e("div",{style:{...A,...null===(Fe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.impactText},children:e(y,{message:`${null!==(Oe=null===(Ne=null==q?void 0:q.redlining_details)||void 0===Ne?void 0:Ne.redline_impact)&&void 0!==Oe?Oe:X.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.impactMarkdown})})})]}),e("div",{style:{...R,...null===(Ue=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.actionContainer},children:si.map(e=>{var n,o;const t=ne||e.disabled,l=t?{cursor:"not-allowed",opacity:.5,...null===(n=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...e.disabledStyle}:{};return i("button",{style:{...z,...null===(o=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:e.color,...e.style,...l},onClick:t?void 0:()=>{var i;e.useLabel?(async e=>{var i,n,o;null==V||V({status:"loading",action:e,metadata:{redlineId:we,aiReasonId:Be}});try{const{updated_reqai:t}=await m({documentId:ri,userEmail:null==di?void 0:di.userEmail,userName:null==di?void 0:di.userName,redlineId:null!==(i=null==q?void 0:q.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==di?void 0:di.baseApiUrl,redlineConfigId:null!==(n=null==di?void 0:di.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==di?void 0:di.token)&&void 0!==o?o:"");await(null==ai?void 0:ai(t)),null==V||V({status:"success",action:e,metadata:{redlineId:we,aiReasonId:Be}})}catch(e){null==V||V({status:"failed",action:null,metadata:{redlineId:we,aiReasonId:Be}})}})(e.id.toLowerCase()):null===(i=e.onClick)||void 0===i||i.call(e)},disabled:t,children:[e.icon,e.label]},e.id)})}),ce&&i("div",{style:{...j,...null===(qe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===qe?void 0:qe.toneContainer},children:[i("button",{onClick:()=>Qe(!Ke),style:{...L,...null===($e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===$e?void 0:$e.toneToggleBtn},children:[i("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e(x,{toneIndex:Ze,configs:ee}),e("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:X.toneHeader||"Redline Tone"})]}),e("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ke?"rotate(180deg)":"rotate(0deg)"},children:e(d,{size:16,color:"#111"})})]}),Ke&&i(n,{children:[e("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:X.toneDescription||"Controls how assertively AI is redlining"}),e(c,{isDirty:ti,onToneChange:e=>{ei(e)},toneColor:oi,toneIndex:Ze,onClickRegenerate:()=>null==Q?void 0:Q(ni),toneLabels:Y,isStreaming:be,aiReason:q})]})]}),re&&i("div",{className:null==me?void 0:me.section,onClick:e=>{e.stopPropagation(),re&&re(e)},style:{...M,...null==ve?void 0:ve.section,...pe},children:[i("div",{className:null==me?void 0:me.headerLeft,style:{...H,...null==ve?void 0:ve.headerLeft},children:[e("span",{className:null==me?void 0:me.titleIcon,style:{..._,...null==ve?void 0:ve.titleIcon},children:null!=xe?xe:e(p,{})}),e("div",{className:null==me?void 0:me.cognitiveTitle,style:{...F,...null==ve?void 0:ve.cognitiveTitle},children:ye})]}),i("div",{className:null==me?void 0:me.headerRight,style:{...N,...null==ve?void 0:ve.headerRight},children:[void 0!==(null==q?void 0:q.relevance_score)&&null!==(null==q?void 0:q.relevance_score)?i("span",{className:null==me?void 0:me.scoreBadge,style:{...O,...null==ve?void 0:ve.scoreBadge,...ge},children:[e(g,{}),i("span",{className:null==me?void 0:me.scoreText,style:{...P,...null==ve?void 0:ve.scoreText,...ue},children:[Math.round(Number(q.relevance_score)),"%"]})]}):null,Se&&e("span",{style:{display:"flex",alignItems:"center"},children:e(a,{size:16,color:"#64748B"})})]})]})]})}export{q as AssignMenu,G as DisplayUsers,$ as KebabMenu,V as default};
1
+ import{jsx as e,jsxs as i,Fragment as n}from"react/jsx-runtime";import{PenLine as o,CheckCircle as t,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import{useState as s}from"react";import{ToneToggle as c}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as p}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as g}from"../icons/aiMagic.svg.js";import{Tooltip as u}from"@mui/material";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as m}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as x}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";const y=[{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"}],h=({toneIndex:n,configs:o=y})=>{const t=Math.min(n,o.length-1),{color:l,angle:r,arcD:d}=o[t]||o[1]||o[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return i("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),e("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},f=({type:i,customStyles:n={}})=>{const o={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"},...n},t=o[i]||o.Medium;return e("div",{style:t,children:i})},b=["Lenient","Balanced","Aggressive"],S={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},C={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},I={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},k={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},w={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},B={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},A={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},T={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},D={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},R={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},E={display:"flex",gap:8,marginBottom:18},z={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"},W={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},j={borderTop:"0.5px solid #eee",padding:"14px 0px"},L={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},M={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},_={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},F={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},H={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},N={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},O={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},P={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},U={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};function q({onAssignClick:n,disableAssignButton:o=!1,onOpenCognitive:t,cognitiveIconSmall:l,cognitiveTootipTitle:r}){const d="20px";return i("div",{style:{...U,minWidth:"200px"},children:[i("div",{style:{padding:"8px",cursor:o?"not-allowed":"pointer",opacity:o?.5:1,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:o?void 0:n,children:[e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:i("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("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e("circle",{cx:"9",cy:"7",r:"4"})]})}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),t&&i("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>t(e),children:[l&&e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:l}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r})]})]})}function $({onAssignClick:n,disableAssignButton:o=!1,onOpenCognitive:t,cognitiveIconSmall:l,cognitiveTootipTitle:r}){const[d,a]=s(!1);return i("div",{style:{position:"relative",display:"flex"},children:[e("button",{onClick:()=>a(!d),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:i("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("circle",{cx:"12",cy:"12",r:"1"}),e("circle",{cx:"12",cy:"5",r:"1"}),e("circle",{cx:"12",cy:"19",r:"1"})]})}),d&&e(q,{onAssignClick:n?()=>{a(!1),n&&n()}:void 0,disableAssignButton:o,onOpenCognitive:t?e=>{a(!1),t&&t(e)}:void 0,cognitiveIconSmall:l,cognitiveTootipTitle:r})]})}function G({users:n,onClick:o}){const t=n.length;return i("div",{onClick:o,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==n?void 0:n[0].length)>9?(null==n?void 0:n[0].slice(0,9))+"...":null==n?void 0:n[0]}),t>1&&i("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",t-1]})]})}function V({onClose:U,aiReason:q,onActionTrigger:V,onIterate:J,initialTone:K,onRegenerate:Q,labels:X={},toneLevelsConfig:Y=b,toneColorsConfig:Z=S,dialConfigs:ee=y,actions:ie,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:te={},customIcons:le={},onOpenCognitive:re,showTone:de=!0,cognitiveSectionStyle:ae={},cognitiveScoreBadgeStyle:se={},cognitiveScoreTextStyle:ce={},cognitiveStyles:pe={},cognitiveClassNames:ge={},cognitiveTitle:ue="Cognitive Integrity",cognitiveTootipTitle:ve="Cognitive Decisioning",cognitiveLeftIcon:me,cognitiveIconSmall:xe,showCognitiveRightArrow:ye=!0,isStreaming:he,onAssignClick:fe,disableAssignButton:be=!1,assignedUsers:Se,onReviewUsersClick:Ce,redlineId:Ie,aiReasonId:ke}){var we,Be,Ae,Te,De,Re,Ee,ze,We,je,Le,Me,_e,Fe,He,Ne,Oe,Pe,Ue;let qe=Y.findIndex(e=>e===K);-1===qe&&(qe=1);const[$e,Ge]=s(!0),[Ve,Je]=s(!1),[Ke,Qe]=s(!1),[Xe,Ye]=s(qe),[Ze]=s(qe),ei=Y[Xe],ii=Z[ei]||"#BA7517",ni=Xe!==Ze,oi=[{id:"iterate",icon:le.iterateIcon||e(o,{size:16,color:"#64748B"}),label:X.btnIterate||"Iterate",color:"#64748B",onClick:J},{id:"accept",icon:le.acceptIcon||e(t,{size:16,color:"#10B981"}),label:X.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:le.rejectIcon||e(l,{size:16,color:"#DC2626"}),label:X.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:ti,redlineConfig:li,updateRedlineDataParent:ri}=v(),di=ie||oi;return i("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(we=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===we?void 0:we.root},children:[i("div",{style:{...I,...null===(Be=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Be?void 0:Be.header,marginBottom:Ke?"16px":"12px"},children:[i("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{children:le.summaryIcon||e(r,{size:16,color:"#E24B4A"})}),e("span",{style:{...k,...null===(Ae=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.title},children:X.summaryHeader||"Summary"})]}),Se&&Se.length>0&&e(G,{users:Se,onClick:e=>{e.stopPropagation(),null==Ce||Ce()}})]}),i("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(fe||re)&&e($,{onAssignClick:fe,disableAssignButton:be,onOpenCognitive:re,cognitiveIconSmall:xe,cognitiveTootipTitle:ve}),e("button",{onClick:U,style:{...W,...null===(Te=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Te?void 0:Te.closeBtn,color:"#64748B"},children:"✕"})]})]}),e(u,{title:null===(De=null==q?void 0:q.redlining_details)||void 0===De?void 0:De.redline_title,children:e("p",{style:{...w,...null===(Re=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Re?void 0:Re.bodyText},children:null===(Ee=null==q?void 0:q.redlining_details)||void 0===Ee?void 0:Ee.redline_title})}),e("p",{style:{...B,...null===(ze=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ze?void 0:ze.summary},children:null===(We=null==q?void 0:q.redlining_details)||void 0===We?void 0:We.redline_summary}),i("div",{style:{...A,...null===(je=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===je?void 0:je.impactContainer},children:[i("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i("button",{onClick:()=>Ge(!$e),style:{...D,...null===(Le=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Le?void 0:Le.impactToggle},children:[e("span",{style:{...R,...null===(Me=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Me?void 0:Me.impactToggleLabel},children:X.impactHeader||"Impact"}),e("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:$e?"rotate(180deg)":"rotate(0deg)"},children:e(d,{size:16,color:"#E24B4A"})})]}),e(f,{type:(null==q?void 0:q.severity)||"Medium",customStyles:te})]}),$e&&e(n,{children:e("div",{style:{...T,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.impactText},children:e(x,{message:`${null!==(He=null===(Fe=null==q?void 0:q.redlining_details)||void 0===Fe?void 0:Fe.redline_impact)&&void 0!==He?He:X.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Ne=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ne?void 0:Ne.impactMarkdown})})})]}),e("div",{style:{...E,...null===(Oe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.actionContainer},children:di.map(e=>{var n,o;const t=ne||e.disabled,l=t?{cursor:"not-allowed",opacity:.5,...null===(n=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...e.disabledStyle}:{};return i("button",{style:{...z,...null===(o=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:e.color,...e.style,...l},onClick:t?void 0:()=>{var i;e.useLabel?(async e=>{var i,n,o;null==V||V({status:"loading",action:e,metadata:{redlineId:Ie,aiReasonId:ke}});try{const{updated_reqai:t}=await m({documentId:ti,userEmail:null==li?void 0:li.userEmail,userName:null==li?void 0:li.userName,redlineId:null!==(i=null==q?void 0:q.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==li?void 0:li.baseApiUrl,redlineConfigId:null!==(n=null==li?void 0:li.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==li?void 0:li.token)&&void 0!==o?o:"");await(null==ri?void 0:ri(t)),null==V||V({status:"success",action:e,metadata:{redlineId:Ie,aiReasonId:ke}})}catch(e){null==V||V({status:"failed",action:null,metadata:{redlineId:Ie,aiReasonId:ke}})}})(e.id.toLowerCase()):null===(i=e.onClick)||void 0===i||i.call(e)},disabled:t,children:[e.icon,e.label]},e.id)})}),de&&i("div",{style:{...j,...null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.toneContainer},children:[i("button",{onClick:()=>Je(!Ve),style:{...L,...null===(Ue=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.toneToggleBtn},children:[i("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e(h,{toneIndex:Xe,configs:ee}),e("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:X.toneHeader||"Redline Tone"})]}),e("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ve?"rotate(180deg)":"rotate(0deg)"},children:e(d,{size:16,color:"#111"})})]}),Ve&&i(n,{children:[e("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:X.toneDescription||"Controls how assertively AI is redlining"}),e(c,{isDirty:ni,onToneChange:e=>{Ye(e)},toneColor:ii,toneIndex:Xe,onClickRegenerate:()=>null==Q?void 0:Q(ei),toneLabels:Y,isStreaming:he,aiReason:q})]})]}),re&&i("div",{className:null==ge?void 0:ge.section,onClick:e=>{e.stopPropagation(),re&&re(e)},style:{...M,...null==pe?void 0:pe.section,...ae},children:[i("div",{className:null==ge?void 0:ge.headerLeft,style:{..._,...null==pe?void 0:pe.headerLeft},children:[e("span",{className:null==ge?void 0:ge.titleIcon,style:{...F,...null==pe?void 0:pe.titleIcon},children:null!=me?me:e(p,{})}),e("div",{className:null==ge?void 0:ge.cognitiveTitle,style:{...H,...null==pe?void 0:pe.cognitiveTitle},children:ue})]}),i("div",{className:null==ge?void 0:ge.headerRight,style:{...N,...null==pe?void 0:pe.headerRight},children:[void 0!==(null==q?void 0:q.relevance_score)&&null!==(null==q?void 0:q.relevance_score)?i("span",{className:null==ge?void 0:ge.scoreBadge,style:{...O,...null==pe?void 0:pe.scoreBadge,...se},children:[e(g,{}),i("span",{className:null==ge?void 0:ge.scoreText,style:{...P,...null==pe?void 0:pe.scoreText,...ce},children:[Math.round(Number(q.relevance_score)),"%"]})]}):null,ye&&e("span",{style:{display:"flex",alignItems:"center"},children:e(a,{size:16,color:"#64748B"})})]})]})]})}export{q as AssignMenu,G as DisplayUsers,$ as KebabMenu,V as default};
2
2
  //# sourceMappingURL=DeviationSummary.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useState as n,useRef as o,useEffect as i}from"react";import{ChevronUp as a,ChevronDown as r,ExternalLink as s,Download as d,Share2 as u,Copy as c,LoaderCircle as v,PencilIcon as p,Plus as m,Trash2 as y,X as h,Ellipsis as f,Hourglass as g,Check as S,ChevronUpIcon as C,ChevronDownIcon as I,Info as N,Bookmark as b}from"lucide-react";import w from"showdown";import{Tooltip as D,Menu as E,MenuItem as B}from"@mui/material";import x from"../../icons/Illustration.svg.js";import{v4 as T}from"uuid";import U from"./UserStoryCard.module.css.js";import{formatMarkdown as A,indentMarkdown as P}from"../../utils/helpers.js";import{replaceTitleSection as k}from"../../utils/user-story.utils.js";import R from"../../shared/AtomicButton.js";import _ from"../RichTextEditor/RichTextEditor.js";import M from"../userstory-with-citation/UserStoryWithCitation.js";import{SectionStatus as L,useRequirementAI as $}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as V}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as j}from"./TitleEditor/TitleEditor.js";import{updateRedlineDocument as O,getRedlineDocumentId as z,createRedlineDocument as G}from"../../../../service/redlineService.js";import H from"./ClinicalTrialSection.js";import{CompletionPanel as W}from"../story-screen/CompletionPanel.js";import F from"../../icons/CDIcon.js";const q={[L.WAITING]:"WAITING TO GENERATE",[L.IN_PROGRESS]:"IN PROGRESS",[L.GENERATED]:"GENERATED",[L.FAILED]:"FAILED",[L.GENERATE]:"GENERATE",[L.APPROVED]:"APPROVED"};function Q(e){const l=[],n=/<learned>(.*?)<\/learned>/g;let o,i=0,a=0;for(;null!==(o=n.exec(e));){const[,r]=o,s=o.index;s>i&&l.push(t("span",{children:e.slice(i,s)},"text-pre-"+a++)),l.push(t(D,{title:r,placement:"top",children:t(N,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${T()}`)),i=n.lastIndex}return i<(null==e?void 0:e.length)&&l.push(t("span",{children:e.slice(i)},"text-post-"+a++)),l}function Z(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 J=({displayName:l})=>{var n;const{customStyles:o}=$(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e("div",{className:U.displayName,style:null==i?void 0:i.wrapper,children:[t(b,{className:U.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e("span",{style:null==i?void 0:i.label,children:[l,":"]})]})},K=({isUserStoryCurrentlyUpdated:C,artifactId:I,artifactTitleId:N,parentUserStory:b,currentUserStory:z,onUserStoryChange:G,parentIndex:X,currentIndex:Y,enableDownload:ee,isDiffEditReviewMode:te,showUserStoryDiff:le,handleDownloadUserStory:ne,handleOpenSendDialog:oe,updateUserStoryArtifact:ie,selectedArtifactId:ae,isDisplayHighlightControl:re,elementDisplayConfig:se,_resolvedConfig:de,showWrapper:ue=!1,defaultExpanded:ce,actionItemsConfig:ve,onDelete:pe,contextVariant:me,expandedSubFeatures:ye,showDisplayName:he=!0,allowTitleEdit:fe=!0,showConfidenceScore:ge=!0,showBorderTop:Se=!0,sectionStatusConfig:Ce,showCompletionPanel:Ie=!1,showAddSectionButton:Ne=!1,disableEditPlan:be=!1,useMuiTooltip:we=!1,approveButtonConfig:De,CDNeededInChip:Ee})=>{var Be,xe,Te,Ue,Ae,Pe,ke,Re,_e,Me,Le,$e,Ve,je,Oe,ze,Ge,He;const{isLoadingSectionData:We=!1,onLoadSectionData:Fe,status:qe,onStatusClick:Qe,completedCount:Ze,totalCount:Je,isNoDataAvailable:Ke=!1}=null!=Ce?Ce:{},{searchQueryList:Xe,citations:Ye,customStyles:et,onEditBlocked:tt,redlineDcoumentId:lt,redlineConfig:nt,customSectionConfig:ot,updateRedlineDataParent:it,aiReasoning:at}=$(),rt=null==et?void 0:et.userStoryCardStyles,st=null==rt?void 0:rt.customSectionEditButton,dt=null==rt?void 0:rt.statusStyles,ut=null===(Be=null==et?void 0:et.userStoryCardStyles)||void 0===Be?void 0:Be.userStoryEditStyles,ct=null===(xe=null==et?void 0:et.userStoryScreenStyles)||void 0===xe?void 0:xe.userStoryContentStyles,vt=null==rt?void 0:rt.progressHeaderStyles,pt=null==rt?void 0:rt.clinicalTrialSectionStyles,mt=null==rt?void 0:rt.CompletionStyles,yt=null==rt?void 0:rt.noDataStyles,ht=null==rt?void 0:rt.approveButtonStyles,ft=null!==(Ue=null===(Te=null==ot?void 0:ot.shouldRender)||void 0===Te?void 0:Te.call(ot,z))&&void 0!==Ue&&Ue,gt=null===(Ae=null==ot?void 0:ot.getValue)||void 0===Ae?void 0:Ae.call(ot,z),St=null!==(ke=null===(Pe=null==ot?void 0:ot.getFields)||void 0===Pe?void 0:Pe.call(ot,z))&&void 0!==ke?ke:[],Ct=null!==(Re=null==ot?void 0:ot.isEditDisabled)&&void 0!==Re&&Re,It=null!==(Me=null===(_e=null==ot?void 0:ot.isSaving)||void 0===_e?void 0:_e.call(ot,z))&&void 0!==Me&&Me,Nt=((e,t)=>e>=80?null==t?void 0:t.highCompletion:e>=50?null==t?void 0:t.mediumCompletion:null==t?void 0:t.lowCompletion)(null!==(Le=z.completion_percentage)&&void 0!==Le?Le:0,mt),bt={[L.WAITING]:null==dt?void 0:dt.waiting,[L.IN_PROGRESS]:null==dt?void 0:dt.inProgress,[L.GENERATED]:null==dt?void 0:dt.generated,[L.FAILED]:null==dt?void 0:dt.failed,[L.GENERATE]:null==dt?void 0:dt.generate,[L.APPROVED]:null==dt?void 0:dt.approved},[wt,Dt]=n({...structuredClone(z),value:A(z.value)||""}),[Et,Bt]=n({userStory:!!z.isDefaultEdit}),[xt,Tt]=n(!1),[Ut,At]=n(!1),[Pt,kt]=n(null),[Rt,_t]=n(null),{userStory:Mt,customIcons:Lt}=$(),[$t,Vt]=n(null!=ce?ce:""===X||ae===z.artifactId||!!z.isDefaultOpen),[jt,Ot]=n(!1),[zt,Gt]=n(null),[Ht,Wt]=n(null),[Ft,qt]=n(!1),Qt=o(null),Zt=o(null),[Jt,Kt]=n(!1),[Xt,Yt]=n(!1),el=o(null),[tl,ll]=n(z.value);i(()=>{C&&Vt(C)},[C]),i(()=>{Dt({...structuredClone(z),value:A(z.value)||""})},[z]),i(()=>{Xe.length>0?Vt(!0):void 0===ce&&(ae?Vt(ae===z.artifactId):ye&&ye.length>0&&Vt(ye.includes(z.artifactId)))},[Xe,ae,z.artifactId,ye]);const nl=()=>{Gt(null)},ol=()=>{Wt(null)},il=()=>{$t&&Et.userStory&&Zt.current&&!Zt.current.requestClose()||Vt(e=>!e)},al=async()=>{var e;try{"userStory"==="userStory"&&(G(wt),console.log("I am changing RTE editor values",wt)),await ie(Ye,Mt,I,null===(e=el.current)||void 0===e?void 0:e.signal)}finally{}};const rl=null!=(null==z?void 0:z.big_enough)&&!Number.isNaN(z.big_enough)&&!!(null==z?void 0:z.big_enough_decision_factors),sl=null!==($e=null==z?void 0:z.completion_percentage)&&void 0!==$e?$e:0,dl=!!(null==z?void 0:z.completion_decision_factors),ul=""===X,cl=null!=de?de:Z(se,ul),vl=!te&&!le;i(()=>{if(!Rt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${Rt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[Rt]),i(()=>{z.isDefaultEdit&&Bt(e=>({...e,userStory:!0}))},[z.isDefaultEdit]);return i(()=>ll(z.value),[z.value]),e("div",{className:U.card,style:null==rt?void 0:rt.cardStyle,id:`story-card-${z.title}`,"data-expanded":$t,children:[e("div",{className:U.titleSection,style:null==rt?void 0:rt.titleSection,children:[e("div",{className:U.titleRow,style:null==rt?void 0:rt.titleRow,onClick:il,children:[e("div",{className:U.titleLeft,style:null==rt?void 0:rt.titleLeft,onMouseEnter:()=>Kt(!0),onMouseLeave:()=>Kt(!1),children:[he&&t(J,{displayName:N}),xt&&vl?t(j,{title:z.title,onSave:e=>(async(e,t)=>{var l;try{let n={...z};z.artifactId===t?n.title=e:n.sub_features=(null===(l=z.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],Dt(n),G(n),Tt(!1)}catch(e){console.error("Failed to save title",e)}})(e,z.artifactId),onCancel:()=>{Tt(!1)},inputStyle:null==ut?void 0:ut.inlineTitleInput,confirmButtonStyle:null==ut?void 0:ut.inlineTitleConfirm,cancelButtonStyle:null==ut?void 0:ut.inlineTitleCancel},"inline-title-editor"):e("div",{className:U.storyTitleWrapper,children:[t(D,{title:Q(z.title),arrow:!0,children:t("h2",{title:we?void 0:z.title,className:U.storyTitle,style:null==rt?void 0:rt.storyTitle,children:Q(z.title)},z.artifactId)}),Ie&&!ft&&(dl?t(W,{customIcons:null==Lt?void 0:Lt.userStoryIcons,customStyles:null==rt?void 0:rt.aiReasoningCitaionStyles,currentUserStory:z,panelStyles:null==rt?void 0:rt.CompletionStyles,onToggleStateChange:Yt,children:e("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==mt?void 0:mt.badge,...Nt},children:[e("span",{children:[sl,"% Completed"]}),t("span",{style:{display:"flex",alignItems:"center"},children:t(F,{color:"currentColor"})}),t(Xt?a:r,{size:14,style:null==mt?void 0:mt.chevronStyle})]})}):t("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==mt?void 0:mt.badge,...Nt},children:e("span",{children:[sl,"% Completed"]})})),fe&&t("button",{type:"button",className:U.titleEditButton,style:null==ut?void 0:ut.titleEditButton,onClick:e=>{e.stopPropagation(),Tt(!0),$t||Vt(!0)},"aria-label":"Edit title",title:"Edit title",children:t("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("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!==Ze&&void 0!==Je)&&e("div",{className:U.statusContainer,children:[void 0!==Ze&&void 0!==Je&&e("div",{className:U.completedBadge,children:["Completed: ",Ze,"/",Je]}),qe&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==Qe||Qe()},className:U.statusButton,style:bt[qe],children:q[qe]})]}),e("div",{className:U.titleActions,style:null==rt?void 0:rt.titleActions,onClick:e=>e.stopPropagation(),children:[(cl.showProgressPercentage||cl.showGapBox)&&ue&&e("div",{className:U.progressHeader,style:null==vt?void 0:vt.wrapper,children:[cl.showProgressPercentage&&e("div",{className:U.progressPercentage,style:null==vt?void 0:vt.percentage,children:[null!==(je=null!==(Ve=null==z?void 0:z.confidenceScore)&&void 0!==Ve?Ve:null==cl?void 0:cl.confidenceValue)&&void 0!==je?je:"0","%"]}),cl.showGapBox&&e("div",{className:U.gapBox,style:null==vt?void 0:vt.gapBox,children:[null!==(ze=null!==(Oe=null==z?void 0:z.gapValue)&&void 0!==Oe?Oe:null==cl?void 0:cl.gapBoxValue)&&void 0!==ze?ze:"2"," ","Gaps"]})]}),rl&&t(V,{customIcons:null==Lt?void 0:Lt.userStoryIcons,customStyles:null==rt?void 0:rt.aiReasoningCitaionStyles,currentUserStory:z,panelStyles:null==rt?void 0:rt.BigEnoughStyles}),!Et.userStory&&e(l,{children:[!1!==(null==cl?void 0:cl.showShareButton)&&t("button",{className:U.iconButton,style:null==rt?void 0:rt.iconButton,onClick:e=>{Gt(e.currentTarget)},children:t(s,{size:16})}),e(E,{id:"user-story-share-menu",anchorEl:zt,open:!!zt,onClose:()=>Gt(null),style:null==rt?void 0:rt.userStoryShareMenu,children:[ee&&t(B,{style:null==rt?void 0:rt.userStoryMenuItem,onClick:async()=>{Ot(!0),ne&&(await Promise.all([ne("pdf"),ne("doc")]),Ot(!1))},children:e("div",{ref:Qt,className:U.menuItemContent,style:null==rt?void 0:rt.menuItemContent,children:[t(d,{size:16,color:null==rt?void 0:rt.menuIconColor}),t("p",{style:null==rt?void 0:rt.menuLabel,children:"Download"})]})}),t(B,{style:null==rt?void 0:rt.userStoryMenuItem,onClick:async()=>{let e=z;b&&(e={...z,value:`${k(null==b?void 0:b.value,z.title)} \n${z.value}`}),null==oe||oe(!0,[e],z.artifactId),nl()},children:e("div",{style:null==rt?void 0:rt.menuItemContent,className:U.menuItemContentPadded,children:[t(u,{size:16,color:null==rt?void 0:rt.menuIconColor}),t("p",{style:null==rt?void 0:rt.menuLabel,children:"Send"})]})}),t(B,{style:null==rt?void 0:rt.userStoryMenuItem,onClick:async()=>{const e=(new w.Converter).makeHtml(A(z.value)||z.value),t=function(e){const t=(new w.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(A(z.value)||z.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{nl()}},children:e("div",{style:null==rt?void 0:rt.menuItemContent,className:U.menuItemContentPadded,children:[t(c,{size:16,color:null==rt?void 0:rt.menuIconColor}),t("p",{style:null==rt?void 0:rt.menuLabel,children:"Copy"})]})})]})]}),!Ft&&Et.userStory&&$t?t(R,{type:"outline",children:"Cancel",style:null==rt?void 0:rt.cancelButton,onClick:()=>{var e;null===(e=el.current)||void 0===e||e.abort(),Bt(e=>({...e,userStory:!1}))}}):t(l,{}),Et.userStory&&$t?t(R,{type:"fill",children:Ft?e("span",{className:U.savingSpinner,style:null==rt?void 0:rt.savingSpinner,children:[t(v,{className:U.spinAnimation,style:null==rt?void 0:rt.spinAnimation}),t("span",{children:"Saving..."})]}):"Save",isDisable:Ft,style:Ft?null==rt?void 0:rt.savingButton:null==rt?void 0:rt.saveButton,onClick:async()=>{qt(!0),await al();let e=await(async()=>{var e,t,l,n,o;let i=wt.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==nt?void 0:nt.callUpdateDocument){const{updated_reqai:a}=await O({documentId:lt,sectionId:z.artifactId,baseApiUrl:null==nt?void 0:nt.baseApiUrl,updatedContent:i,userEmail:nt.userEmail,userName:nt.userName,redlineConfigId:null!==(e=nt.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==nt?void 0:nt.token)&&void 0!==t?t:"");i=null===(o=null===(n=null===(l=null==a?void 0:a.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==it?void 0:it(a))}}catch(e){console.error("failed to update redline document",e),i=tl}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={...wt,value:e};G({...t,isDefaultEdit:!1}),ll(t.value),Bt(e=>({...e,userStory:!1})),qt(!1)}}):!te&&!le&&!be&&$t&&!1!==(null==cl?void 0:cl.showEditButton)&&t("button",{className:U.iconButton,style:null==rt?void 0:rt.editButton,onClick:()=>Bt(e=>({...e,userStory:!0})),children:t(p,{color:null==rt?void 0:rt.pencilIconColor,size:16})}),Ne&&ul&&$t&&!te&&!le&&!1!==(null==cl?void 0:cl.showEditButton)&&e("button",{type:"button",className:U.addSectionButton,style:null==ut?void 0:ut.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=z.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:T(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...z,sub_features:[...null!==(n=z.sub_features)&&void 0!==n?n:[],i]};Dt(a),G(a),Vt(!0),_t(i.title)},"aria-label":"Add section",title:"Add section",children:[t(m,{size:14}),t("span",{className:U.addSectionLabel,children:"Add Section"})]}),!ul&&!te&&!be&&!le&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==pe||pe()},className:U.iconButton,style:null==ut?void 0:ut.deleteButton,"aria-label":"Delete section",title:"Delete section",children:t(y,{size:16})}),ft&&t("button",{type:"button",className:U.iconButton,style:null==st?void 0:st.button,disabled:Ct,onClick:e=>{if(e.stopPropagation(),Ut)return kt(null),void At(!1);kt(structuredClone(null!=gt?gt:{})),Vt(!0),At(!0)},children:Ut?t(h,{size:16,color:null==rt?void 0:rt.pencilIconColor,style:null==st?void 0:st.cancelIcon}):t(p,{size:16,color:null==rt?void 0:rt.pencilIconColor,style:null==st?void 0:st.editIcon})}),(null==cl?void 0:cl.actionItemsButton)&&e(l,{children:[t("span",{className:U.actionItemBtn,style:null==rt?void 0:rt.actionItemBtn,onClick:e=>{e.stopPropagation(),Wt(e.currentTarget)},children:t(f,{})}),t(E,{id:"user-story-action-menu",anchorEl:Ht,open:!!Ht,onClose:ol,style:null==rt?void 0:rt.userStoryShareMenu,children:null==ve?void 0:ve.items.map((l,n)=>t(B,{style:null==rt?void 0:rt.userStoryMenuItem,onClick:()=>{l.onclick(z),ol()},children:e("div",{className:U.menuItemContent,style:{...null==rt?void 0:rt.menuItemContent,...!l.isActive&&{cursor:"not-allowed",opacity:.5}},children:[t("span",{className:U.menuItemIcon,style:null==rt?void 0:rt.menuItemIcon,children:l.icon}),t("p",{style:null==rt?void 0:rt.menuLabel,children:l.name}),t("span",{className:U.menuItemRight,style:null==rt?void 0:rt.menuItemRight})]})},`action-item-${n}-${l.name}`))})]}),t("button",{type:"button",onClick:e=>{e.stopPropagation(),il()},style:null==rt?void 0:rt.chevronButton,className:U.chevronButton,children:t($t?a:r,{className:U.chevronIcon,color:null==rt?void 0:rt.chevronIconColor})})]})]}),t("div",{className:U.divider,style:null==rt?void 0:rt.dividerStyle})]}),$t&&t("div",{className:U.cardContent,style:{...null==rt?void 0:rt.cardContentStyle,borderTop:Se?"1px solid #E5E5E5":"none"},children:e("div",We?{className:U.loadingContainer,children:[t("div",{className:U.loadingIconWrapper,children:t(g,{size:28,color:"#5B3DF5",className:U.spinAnimation})}),e("div",{children:[t("h3",{className:U.loadingTitle,children:"Section generation in progress.."}),t("p",{className:U.loadingSubtitle,children:"This may take a few minutes"})]}),t("button",{type:"button",onClick:()=>null==Fe?void 0:Fe(),className:U.viewStatusButton,children:"View Status"})]}:Ke?{className:U.noDataContainer,style:null==yt?void 0:yt.container,children:[t("img",{src:x,alt:"No data available",className:U.noDataIllustration,style:null==yt?void 0:yt.illustration}),t("h3",{className:U.noDataTitle,style:null==yt?void 0:yt.title,children:"No Data Available for This Section"}),t("p",{className:U.noDataSubtitle,style:null==yt?void 0:yt.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}:{className:U.contentInner,style:null==rt?void 0:rt.contentInner,children:[e("div",{className:U.descriptionSection,style:null==rt?void 0:rt.descriptionSection,children:[t("div",{className:U.justifyBetween,style:null==rt?void 0:rt.justifyBetween}),Et.userStory?t(_,{ref:Zt,minHeight:"100%",height:"100%",type:"string",value:A((pl=tl,pl.replace(/<(upt|manual)\s+id="([^"]+)"[^>]*>/gs,(e,t,l)=>{if(/\sdata-status=/.test(e))return e;const n=function(e){var t;const l=e.split("$"),n=l[1]||l[0];for(const e of at)if(e.id===n)return(null===(t=e.redlining_details)||void 0===t?void 0:t.status)||"";return""}(l);return e.replace(/>$/,` data-status="${n}">`)})))||"",handleUpdateState:(e,t)=>{const l=P(t);Dt(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:Et.userStory?"edit":"readOnly",onEditBlocked:tt,onSaveUnsavedChanges:async()=>{await al(),Vt(!1)},onDiscardUnsavedChanges:()=>{Dt({...structuredClone(z),value:A(z.value)||""}),Bt(e=>({...e,userStory:!1})),Vt(!1)},isSavingUnsavedChanges:Ft}):ft?t(H,{styles:pt,fields:St,readonly:!Ut,isSaving:It,value:null!==(Ge=null!=Pt?Pt:gt)&&void 0!==Ge?Ge:{},onChange:kt,onSave:async()=>{var e;Pt&&(await(null===(e=null==ot?void 0:ot.onSave)||void 0===e?void 0:e.call(ot,z,Pt)),kt(null),At(!1))},onCancel:()=>{kt(null),At(!1)}}):e(l,{children:[t(M,{showUserStoryDiff:le,isParent:""===X,message:A(z.value)||"",artifactId:z.artifactId,customStyles:ct,isDisplayHighlightControl:re,contextVariant:me,showConfidenceScore:ge,CDNeededInChip:Ee}),De&&t("div",{className:U.approveButtonContainer,style:null==ht?void 0:ht.container,children:t("button",{type:"button",className:U.approveButton,style:null==ht?void 0:ht.button,disabled:De.disabled||De.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=null==De?void 0:De.onClick)||void 0===t||t.call(De)},children:De.isLoading?e(l,{children:[t(v,{size:16,className:U.spinner,style:null==ht?void 0:ht.icon}),t("span",{style:null==ht?void 0:ht.text,children:De.label})]}):e(l,{children:[t("span",{style:null==ht?void 0:ht.text,children:De.label}),t(S,{size:16,style:null==ht?void 0:ht.icon})]})})})]})]}),null===(He=wt.sub_features)||void 0===He?void 0:He.map((e,l)=>{const n=Z(se,!1,e.artifactId);return t(K,{artifactId:I,isUserStoryCurrentlyUpdated:C,artifactTitleId:`${N}-${String.fromCharCode(65+l)}`,parentUserStory:z,parentIndex:`${X}${X&&"."}${Y}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const l=[...z.sub_features||[]];l[e]=t,G({...z,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:te,showUserStoryDiff:le,updateUserStoryArtifact:ie,handleDownloadUserStory:ne,handleOpenSendDialog:oe,isDisplayHighlightControl:re,elementDisplayConfig:se,_resolvedConfig:n,actionItemsConfig:ve,onDelete:()=>(e=>{const t=(z.sub_features||[]).filter((t,l)=>l!==e),l={...z,sub_features:t};Dt(l),G(l)})(l),expandedSubFeatures:ye,disableEditPlan:be,useMuiTooltip:we},e.artifactId)})]})})]});var pl},X=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:a,showUserStoryDiff:r,updateUserStoryArtifact:s,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:y,showWrapper:h,actionItemsConfig:f,contextVariant:g,showDisplayName:S,allowTitleEdit:N,showConfidenceScore:b,showBorderTop:w,defaultExpanded:D,showCompletionPanel:E=!1,showAddSectionButton:B=!1,disableEditPlan:x=!1,useMuiTooltip:T=!1,approveButtonConfig:A,CDNeededInChip:P,setRedlineDocumentIdParent:k})=>{const{userStory:R,setUserStory:_,customStyles:M,searchQueryList:L,currentHighlightIndex:V,setCurrentHighlightIndex:j,segmentComponentConfig:O,sectionStatusConfig:H,redlineConfig:W,setRedlineDocumentId:F}=$(),q=null==M?void 0:M.userStoryCardStyles,Q=0===V,J=V===L.length-1;return i(()=>{if(!(null==W?void 0:W.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await z({baseApiUrl:W.documentBaseApiUrl||"",comparisonId:W.documentComparisonId||""});if(t)F(t);else{const{document_id:t}=await G({baseApiUrl:W.baseApiUrl,changelogConfigId:W.changelogConfigId,comparisonId:W.documentComparisonId,artifactId:W.artifactId,inputData:W.inputData,redlineConfigId:W.redlineConfigId,userEmail:W.userEmail,userName:W.userName},null!==(e=null==W?void 0:W.token)&&void 0!==e?e:"");t&&(F(t),null==k||k(t))}})()},[]),e("div",{className:U.userStoryCardWrapper,style:m?{...null==q?void 0:q.userStoryCardWrapper,position:"relative"}:null==q?void 0:q.userStoryCardWrapper,children:[m&&t(l,{children:L.length>0&&t("div",{className:U.wrapper,children:t("div",{className:U.highlightNavigation,children:e("div",{className:U.navigationContainer,children:[e("span",{className:U.navCounter,children:[V+1," of ",L.length]}),e("div",{className:U.navButtons,children:[t("button",{onClick:()=>{V>0&&j(e=>e-1)},className:U.navButton,disabled:Q,children:t(C,{size:20,className:U.navIcon})}),t("button",{onClick:()=>{V<L.length-1&&j(e=>e+1)},className:U.navButton,disabled:J,children:t(I,{size:20,className:U.navIcon})})]})]})})})}),R.map((e,l)=>{const i=Z(y,!0);return t(K,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:e,onUserStoryChange:e=>{_(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:r,updateUserStoryArtifact:s,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:y,_resolvedConfig:i,showWrapper:h,defaultExpanded:D,actionItemsConfig:f,contextVariant:g,showDisplayName:S,allowTitleEdit:N,showConfidenceScore:b,showBorderTop:w,sectionStatusConfig:H,showCompletionPanel:E,showAddSectionButton:B,disableEditPlan:x,useMuiTooltip:T,approveButtonConfig:A,CDNeededInChip:P},e.artifactId)})]})};export{K as StoryCard,X as UserStoryCardWrapper,K as default,Q as replaceLearnedTagsWithInfo};
1
+ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useState as n,useRef as o,useEffect as i}from"react";import{ChevronUp as a,ChevronDown as r,ExternalLink as s,Download as d,Share2 as u,Copy as c,LoaderCircle as v,PencilIcon as p,Plus as m,Trash2 as y,X as h,Ellipsis as f,Hourglass as g,Check as S,ChevronUpIcon as C,ChevronDownIcon as I,Info as b,Bookmark as w}from"lucide-react";import N from"showdown";import{Tooltip as D,Menu as E,MenuItem as x}from"@mui/material";import B from"../../icons/Illustration.svg.js";import{v4 as T}from"uuid";import A from"./UserStoryCard.module.css.js";import{formatMarkdown as U,indentMarkdown as k}from"../../utils/helpers.js";import{replaceTitleSection as P}from"../../utils/user-story.utils.js";import R from"../../shared/AtomicButton.js";import _ from"../RichTextEditor/RichTextEditor.js";import F from"../userstory-with-citation/UserStoryWithCitation.js";import{SectionStatus as M,useRequirementAI as L}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as j}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as V}from"./TitleEditor/TitleEditor.js";import{updateRedlineDocument as z,getRedlineDocumentId as O,createRedlineDocument as W}from"../../../../service/redlineService.js";import $ from"./ClinicalTrialSection.js";import{CompletionPanel as G}from"../story-screen/CompletionPanel.js";import H from"../../icons/CDIcon.js";const q={[M.WAITING]:"WAITING TO GENERATE",[M.IN_PROGRESS]:"IN PROGRESS",[M.GENERATED]:"GENERATED",[M.FAILED]:"FAILED",[M.GENERATE]:"GENERATE",[M.APPROVED]:"APPROVED"};function Q(e){const l=[],n=/<learned>(.*?)<\/learned>/g;let o,i=0,a=0;for(;null!==(o=n.exec(e));){const[,r]=o,s=o.index;s>i&&l.push(t("span",{children:e.slice(i,s)},"text-pre-"+a++)),l.push(t(D,{title:r,placement:"top",children:t(b,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${T()}`)),i=n.lastIndex}return i<(null==e?void 0:e.length)&&l.push(t("span",{children:e.slice(i)},"text-post-"+a++)),l}function Z(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 J=({displayName:l})=>{var n;const{customStyles:o}=L(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e("div",{className:A.displayName,style:null==i?void 0:i.wrapper,children:[t(w,{className:A.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e("span",{style:null==i?void 0:i.label,children:[l,":"]})]})},K=({isUserStoryCurrentlyUpdated:C,artifactId:I,artifactTitleId:b,parentUserStory:w,currentUserStory:O,onUserStoryChange:W,parentIndex:X,currentIndex:Y,enableDownload:ee,isDiffEditReviewMode:te,showUserStoryDiff:le,handleDownloadUserStory:ne,handleOpenSendDialog:oe,updateUserStoryArtifact:ie,selectedArtifactId:ae,isDisplayHighlightControl:re,elementDisplayConfig:se,_resolvedConfig:de,showWrapper:ue=!1,defaultExpanded:ce,actionItemsConfig:ve,onDelete:pe,contextVariant:me,expandedSubFeatures:ye,showDisplayName:he=!0,allowTitleEdit:fe=!0,showConfidenceScore:ge=!0,showBorderTop:Se=!0,sectionStatusConfig:Ce,showCompletionPanel:Ie=!1,showAddSectionButton:be=!1,disableEditPlan:we=!1,useMuiTooltip:Ne=!1,approveButtonConfig:De,CDNeededInChip:Ee,onAssignSectionClick:xe})=>{var Be,Te,Ae,Ue,ke,Pe,Re,_e,Fe,Me,Le,je,Ve,ze,Oe,We,$e,Ge;const{isLoadingSectionData:He=!1,onLoadSectionData:qe,status:Qe,onStatusClick:Ze,completedCount:Je,totalCount:Ke,isNoDataAvailable:Xe=!1}=null!=Ce?Ce:{},{searchQueryList:Ye,citations:et,customStyles:tt,onEditBlocked:lt,redlineDcoumentId:nt,redlineConfig:ot,customSectionConfig:it,updateRedlineDataParent:at}=L(),rt=null==tt?void 0:tt.userStoryCardStyles,st=null==rt?void 0:rt.customSectionEditButton,dt=null==rt?void 0:rt.statusStyles,ut=null===(Be=null==tt?void 0:tt.userStoryCardStyles)||void 0===Be?void 0:Be.userStoryEditStyles,ct=null===(Te=null==tt?void 0:tt.userStoryScreenStyles)||void 0===Te?void 0:Te.userStoryContentStyles,vt=null==rt?void 0:rt.progressHeaderStyles,pt=null==rt?void 0:rt.clinicalTrialSectionStyles,mt=null==rt?void 0:rt.CompletionStyles,yt=null==rt?void 0:rt.noDataStyles,ht=null==rt?void 0:rt.approveButtonStyles,ft=null!==(Ue=null===(Ae=null==it?void 0:it.shouldRender)||void 0===Ae?void 0:Ae.call(it,O))&&void 0!==Ue&&Ue,gt=null===(ke=null==it?void 0:it.getValue)||void 0===ke?void 0:ke.call(it,O),St=null!==(Re=null===(Pe=null==it?void 0:it.getFields)||void 0===Pe?void 0:Pe.call(it,O))&&void 0!==Re?Re:[],Ct=null!==(_e=null==it?void 0:it.isEditDisabled)&&void 0!==_e&&_e,It=null!==(Me=null===(Fe=null==it?void 0:it.isSaving)||void 0===Fe?void 0:Fe.call(it,O))&&void 0!==Me&&Me,bt=((e,t)=>e>=80?null==t?void 0:t.highCompletion:e>=50?null==t?void 0:t.mediumCompletion:null==t?void 0:t.lowCompletion)(null!==(Le=O.completion_percentage)&&void 0!==Le?Le:0,mt),wt={[M.WAITING]:null==dt?void 0:dt.waiting,[M.IN_PROGRESS]:null==dt?void 0:dt.inProgress,[M.GENERATED]:null==dt?void 0:dt.generated,[M.FAILED]:null==dt?void 0:dt.failed,[M.GENERATE]:null==dt?void 0:dt.generate,[M.APPROVED]:null==dt?void 0:dt.approved},[Nt,Dt]=n({...structuredClone(O),value:U(O.value)||""}),[Et,xt]=n({userStory:!!O.isDefaultEdit}),[Bt,Tt]=n(!1),[At,Ut]=n(!1),[kt,Pt]=n(null),[Rt,_t]=n(null),{userStory:Ft,customIcons:Mt}=L(),[Lt,jt]=n(null!=ce?ce:""===X||ae===O.artifactId||!!O.isDefaultOpen),[Vt,zt]=n(!1),[Ot,Wt]=n(null),[$t,Gt]=n(null),[Ht,qt]=n(!1),Qt=o(null),Zt=o(null),[Jt,Kt]=n(!1),[Xt,Yt]=n(!1),el=o(null),[tl,ll]=n(O.value);i(()=>{C&&jt(C)},[C]),i(()=>{Dt({...structuredClone(O),value:U(O.value)||""})},[O]),i(()=>{Ye.length>0?jt(!0):void 0===ce&&(ae?jt(ae===O.artifactId):ye&&ye.length>0&&jt(ye.includes(O.artifactId)))},[Ye,ae,O.artifactId,ye]);const nl=()=>{Wt(null)},ol=()=>{Gt(null)},il=()=>{Lt&&Et.userStory&&Zt.current&&!Zt.current.requestClose()||jt(e=>!e)},al=async()=>{var e;try{"userStory"==="userStory"&&(W(Nt),console.log("I am changing RTE editor values",Nt)),await ie(et,Ft,I,null===(e=el.current)||void 0===e?void 0:e.signal)}finally{}};const rl=null!=(null==O?void 0:O.big_enough)&&!Number.isNaN(O.big_enough)&&!!(null==O?void 0:O.big_enough_decision_factors),sl=null!==(je=null==O?void 0:O.completion_percentage)&&void 0!==je?je:0,dl=!!(null==O?void 0:O.completion_decision_factors),ul=""===X,cl=null!=de?de:Z(se,ul),vl=!te&&!le;i(()=>{if(!Rt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${Rt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[Rt]),i(()=>{O.isDefaultEdit&&xt(e=>({...e,userStory:!0}))},[O.isDefaultEdit]);return i(()=>ll(O.value),[O.value]),e("div",{className:A.card,style:null==rt?void 0:rt.cardStyle,id:`story-card-${O.title}`,"data-expanded":Lt,children:[e("div",{className:A.titleSection,style:null==rt?void 0:rt.titleSection,children:[e("div",{className:A.titleRow,style:null==rt?void 0:rt.titleRow,onClick:il,children:[e("div",{className:A.titleLeft,style:null==rt?void 0:rt.titleLeft,onMouseEnter:()=>Kt(!0),onMouseLeave:()=>Kt(!1),children:[he&&t(J,{displayName:b}),Bt&&vl?t(V,{title:O.title,onSave:e=>(async(e,t)=>{var l;try{let n={...O};O.artifactId===t?n.title=e:n.sub_features=(null===(l=O.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],Dt(n),W(n),Tt(!1)}catch(e){console.error("Failed to save title",e)}})(e,O.artifactId),onCancel:()=>{Tt(!1)},inputStyle:null==ut?void 0:ut.inlineTitleInput,confirmButtonStyle:null==ut?void 0:ut.inlineTitleConfirm,cancelButtonStyle:null==ut?void 0:ut.inlineTitleCancel},"inline-title-editor"):e("div",{className:A.storyTitleWrapper,children:[t(D,{title:Q(O.title),arrow:!0,children:t("h2",{title:Ne?void 0:O.title,className:A.storyTitle,style:null==rt?void 0:rt.storyTitle,children:Q(O.title)},O.artifactId)}),Ie&&!ft&&(dl?t(G,{customIcons:null==Mt?void 0:Mt.userStoryIcons,customStyles:null==rt?void 0:rt.aiReasoningCitaionStyles,currentUserStory:O,panelStyles:null==rt?void 0:rt.CompletionStyles,onToggleStateChange:Yt,children:e("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==mt?void 0:mt.badge,...bt},children:[e("span",{children:[sl,"% Completed"]}),t("span",{style:{display:"flex",alignItems:"center"},children:t(H,{color:"currentColor"})}),t(Xt?a:r,{size:14,style:null==mt?void 0:mt.chevronStyle})]})}):t("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==mt?void 0:mt.badge,...bt},children:e("span",{children:[sl,"% Completed"]})})),fe&&t("button",{type:"button",className:A.titleEditButton,style:null==ut?void 0:ut.titleEditButton,onClick:e=>{e.stopPropagation(),Tt(!0),Lt||jt(!0)},"aria-label":"Edit title",title:"Edit title",children:t("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("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!==Je&&void 0!==Ke)&&e("div",{className:A.statusContainer,children:[void 0!==Je&&void 0!==Ke&&e("div",{className:A.completedBadge,children:["Completed: ",Je,"/",Ke]}),Qe&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==Ze||Ze()},className:A.statusButton,style:wt[Qe],children:q[Qe]})]}),e("div",{className:A.titleActions,style:null==rt?void 0:rt.titleActions,onClick:e=>e.stopPropagation(),children:[(cl.showProgressPercentage||cl.showGapBox)&&ue&&e("div",{className:A.progressHeader,style:null==vt?void 0:vt.wrapper,children:[cl.showProgressPercentage&&e("div",{className:A.progressPercentage,style:null==vt?void 0:vt.percentage,children:[null!==(ze=null!==(Ve=null==O?void 0:O.confidenceScore)&&void 0!==Ve?Ve:null==cl?void 0:cl.confidenceValue)&&void 0!==ze?ze:"0","%"]}),cl.showGapBox&&e("div",{className:A.gapBox,style:null==vt?void 0:vt.gapBox,children:[null!==(We=null!==(Oe=null==O?void 0:O.gapValue)&&void 0!==Oe?Oe:null==cl?void 0:cl.gapBoxValue)&&void 0!==We?We:"2"," ","Gaps"]})]}),rl&&t(j,{customIcons:null==Mt?void 0:Mt.userStoryIcons,customStyles:null==rt?void 0:rt.aiReasoningCitaionStyles,currentUserStory:O,panelStyles:null==rt?void 0:rt.BigEnoughStyles}),t(D,{title:"Assign Section",arrow:!0,placement:"top",slotProps:{tooltip:{sx:{bgcolor:"#1E293B",color:"#FFFFFF",fontSize:"14px",fontWeight:400,px:2,py:2,borderRadius:"18px",boxShadow:"0px 8px 20px rgba(0,0,0,0.18)"}},arrow:{sx:{color:"#1E293B"}}},children:t("div",{style:{border:"1px solid #D1D5DB",padding:"5px 15px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",background:"#FFFFFF"},onClick:xe,children:e("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",className:"lucide lucide-users-round-icon lucide-users-round",children:[t("path",{d:"M18 21a8 8 0 0 0-16 0"}),t("circle",{cx:"10",cy:"8",r:"5"}),t("path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3"})]})})}),!Et.userStory&&e(l,{children:[!1!==(null==cl?void 0:cl.showShareButton)&&t("button",{className:A.iconButton,style:null==rt?void 0:rt.iconButton,onClick:e=>{Wt(e.currentTarget)},children:t(s,{size:16})}),e(E,{id:"user-story-share-menu",anchorEl:Ot,open:!!Ot,onClose:()=>Wt(null),style:null==rt?void 0:rt.userStoryShareMenu,children:[ee&&t(x,{style:null==rt?void 0:rt.userStoryMenuItem,onClick:async()=>{zt(!0),ne&&(await Promise.all([ne("pdf"),ne("doc")]),zt(!1))},children:e("div",{ref:Qt,className:A.menuItemContent,style:null==rt?void 0:rt.menuItemContent,children:[t(d,{size:16,color:null==rt?void 0:rt.menuIconColor}),t("p",{style:null==rt?void 0:rt.menuLabel,children:"Download"})]})}),t(x,{style:null==rt?void 0:rt.userStoryMenuItem,onClick:async()=>{let e=O;w&&(e={...O,value:`${P(null==w?void 0:w.value,O.title)} \n${O.value}`}),null==oe||oe(!0,[e],O.artifactId),nl()},children:e("div",{style:null==rt?void 0:rt.menuItemContent,className:A.menuItemContentPadded,children:[t(u,{size:16,color:null==rt?void 0:rt.menuIconColor}),t("p",{style:null==rt?void 0:rt.menuLabel,children:"Send"})]})}),t(x,{style:null==rt?void 0:rt.userStoryMenuItem,onClick:async()=>{const e=(new N.Converter).makeHtml(U(O.value)||O.value),t=function(e){const t=(new N.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(U(O.value)||O.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{nl()}},children:e("div",{style:null==rt?void 0:rt.menuItemContent,className:A.menuItemContentPadded,children:[t(c,{size:16,color:null==rt?void 0:rt.menuIconColor}),t("p",{style:null==rt?void 0:rt.menuLabel,children:"Copy"})]})})]})]}),!Ht&&Et.userStory&&Lt?t(R,{type:"outline",children:"Cancel",style:null==rt?void 0:rt.cancelButton,onClick:()=>{var e;null===(e=el.current)||void 0===e||e.abort(),xt(e=>({...e,userStory:!1}))}}):t(l,{}),Et.userStory&&Lt?t(R,{type:"fill",children:Ht?e("span",{className:A.savingSpinner,style:null==rt?void 0:rt.savingSpinner,children:[t(v,{className:A.spinAnimation,style:null==rt?void 0:rt.spinAnimation}),t("span",{children:"Saving..."})]}):"Save",isDisable:Ht,style:Ht?null==rt?void 0:rt.savingButton:null==rt?void 0:rt.saveButton,onClick:async()=>{qt(!0),await al();let e=await(async()=>{var e,t,l,n,o;let i=Nt.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==ot?void 0:ot.callUpdateDocument){const{updated_reqai:a}=await z({documentId:nt,sectionId:O.artifactId,baseApiUrl:null==ot?void 0:ot.baseApiUrl,updatedContent:i,userEmail:ot.userEmail,userName:ot.userName,redlineConfigId:null!==(e=ot.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==ot?void 0:ot.token)&&void 0!==t?t:"");i=null===(o=null===(n=null===(l=null==a?void 0:a.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==at?void 0:at(a))}}catch(e){console.error("failed to update redline document",e),i=tl}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={...Nt,value:e};W({...t,isDefaultEdit:!1}),ll(t.value),xt(e=>({...e,userStory:!1})),qt(!1)}}):!te&&!le&&!we&&Lt&&!1!==(null==cl?void 0:cl.showEditButton)&&t("button",{className:A.iconButton,style:null==rt?void 0:rt.editButton,onClick:()=>xt(e=>({...e,userStory:!0})),children:t(p,{color:null==rt?void 0:rt.pencilIconColor,size:16})}),be&&ul&&Lt&&!te&&!le&&!1!==(null==cl?void 0:cl.showEditButton)&&e("button",{type:"button",className:A.addSectionButton,style:null==ut?void 0:ut.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=O.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:T(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...O,sub_features:[...null!==(n=O.sub_features)&&void 0!==n?n:[],i]};Dt(a),W(a),jt(!0),_t(i.title)},"aria-label":"Add section",title:"Add section",children:[t(m,{size:14}),t("span",{className:A.addSectionLabel,children:"Add Section"})]}),!ul&&!te&&!we&&!le&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==pe||pe()},className:A.iconButton,style:null==ut?void 0:ut.deleteButton,"aria-label":"Delete section",title:"Delete section",children:t(y,{size:16})}),ft&&t("button",{type:"button",className:A.iconButton,style:null==st?void 0:st.button,disabled:Ct,onClick:e=>{if(e.stopPropagation(),At)return Pt(null),void Ut(!1);Pt(structuredClone(null!=gt?gt:{})),jt(!0),Ut(!0)},children:At?t(h,{size:16,color:null==rt?void 0:rt.pencilIconColor,style:null==st?void 0:st.cancelIcon}):t(p,{size:16,color:null==rt?void 0:rt.pencilIconColor,style:null==st?void 0:st.editIcon})}),(null==cl?void 0:cl.actionItemsButton)&&e(l,{children:[t("span",{className:A.actionItemBtn,style:null==rt?void 0:rt.actionItemBtn,onClick:e=>{e.stopPropagation(),Gt(e.currentTarget)},children:t(f,{})}),t(E,{id:"user-story-action-menu",anchorEl:$t,open:!!$t,onClose:ol,style:null==rt?void 0:rt.userStoryShareMenu,children:null==ve?void 0:ve.items.map((l,n)=>t(x,{style:null==rt?void 0:rt.userStoryMenuItem,onClick:()=>{l.onclick(O),ol()},children:e("div",{className:A.menuItemContent,style:{...null==rt?void 0:rt.menuItemContent,...!l.isActive&&{cursor:"not-allowed",opacity:.5}},children:[t("span",{className:A.menuItemIcon,style:null==rt?void 0:rt.menuItemIcon,children:l.icon}),t("p",{style:null==rt?void 0:rt.menuLabel,children:l.name}),t("span",{className:A.menuItemRight,style:null==rt?void 0:rt.menuItemRight})]})},`action-item-${n}-${l.name}`))})]}),t("button",{type:"button",onClick:e=>{e.stopPropagation(),il()},style:null==rt?void 0:rt.chevronButton,className:A.chevronButton,children:t(Lt?a:r,{className:A.chevronIcon,color:null==rt?void 0:rt.chevronIconColor})})]})]}),t("div",{className:A.divider,style:null==rt?void 0:rt.dividerStyle})]}),Lt&&t("div",{className:A.cardContent,style:{...null==rt?void 0:rt.cardContentStyle,borderTop:Se?"1px solid #E5E5E5":"none"},children:e("div",He?{className:A.loadingContainer,children:[t("div",{className:A.loadingIconWrapper,children:t(g,{size:28,color:"#5B3DF5",className:A.spinAnimation})}),e("div",{children:[t("h3",{className:A.loadingTitle,children:"Section generation in progress.."}),t("p",{className:A.loadingSubtitle,children:"This may take a few minutes"})]}),t("button",{type:"button",onClick:()=>null==qe?void 0:qe(),className:A.viewStatusButton,children:"View Status"})]}:Xe?{className:A.noDataContainer,style:null==yt?void 0:yt.container,children:[t("img",{src:B,alt:"No data available",className:A.noDataIllustration,style:null==yt?void 0:yt.illustration}),t("h3",{className:A.noDataTitle,style:null==yt?void 0:yt.title,children:"No Data Available for This Section"}),t("p",{className:A.noDataSubtitle,style:null==yt?void 0:yt.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}:{className:A.contentInner,style:null==rt?void 0:rt.contentInner,children:[e("div",{className:A.descriptionSection,style:null==rt?void 0:rt.descriptionSection,children:[t("div",{className:A.justifyBetween,style:null==rt?void 0:rt.justifyBetween}),Et.userStory?t(_,{ref:Zt,minHeight:"100%",height:"100%",type:"string",value:U(tl)||"",handleUpdateState:(e,t)=>{const l=k(t);Dt(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:Et.userStory?"edit":"readOnly",onEditBlocked:lt,onSaveUnsavedChanges:async()=>{await al(),jt(!1)},onDiscardUnsavedChanges:()=>{Dt({...structuredClone(O),value:U(O.value)||""}),xt(e=>({...e,userStory:!1})),jt(!1)},isSavingUnsavedChanges:Ht}):ft?t($,{styles:pt,fields:St,readonly:!At,isSaving:It,value:null!==($e=null!=kt?kt:gt)&&void 0!==$e?$e:{},onChange:Pt,onSave:async()=>{var e;kt&&(await(null===(e=null==it?void 0:it.onSave)||void 0===e?void 0:e.call(it,O,kt)),Pt(null),Ut(!1))},onCancel:()=>{Pt(null),Ut(!1)}}):e(l,{children:[t(F,{showUserStoryDiff:le,isParent:""===X,message:U(O.value)||"",artifactId:O.artifactId,customStyles:ct,isDisplayHighlightControl:re,contextVariant:me,showConfidenceScore:ge,CDNeededInChip:Ee}),De&&t("div",{className:A.approveButtonContainer,style:null==ht?void 0:ht.container,children:t("button",{type:"button",className:A.approveButton,style:null==ht?void 0:ht.button,disabled:De.disabled||De.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=null==De?void 0:De.onClick)||void 0===t||t.call(De)},children:De.isLoading?e(l,{children:[t(v,{size:16,className:A.spinner,style:null==ht?void 0:ht.icon}),t("span",{style:null==ht?void 0:ht.text,children:De.label})]}):e(l,{children:[t("span",{style:null==ht?void 0:ht.text,children:De.label}),t(S,{size:16,style:null==ht?void 0:ht.icon})]})})})]})]}),null===(Ge=Nt.sub_features)||void 0===Ge?void 0:Ge.map((e,l)=>{const n=Z(se,!1,e.artifactId);return t(K,{artifactId:I,isUserStoryCurrentlyUpdated:C,artifactTitleId:`${b}-${String.fromCharCode(65+l)}`,parentUserStory:O,parentIndex:`${X}${X&&"."}${Y}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const l=[...O.sub_features||[]];l[e]=t,W({...O,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:te,showUserStoryDiff:le,updateUserStoryArtifact:ie,handleDownloadUserStory:ne,handleOpenSendDialog:oe,isDisplayHighlightControl:re,elementDisplayConfig:se,_resolvedConfig:n,actionItemsConfig:ve,onDelete:()=>(e=>{const t=(O.sub_features||[]).filter((t,l)=>l!==e),l={...O,sub_features:t};Dt(l),W(l)})(l),expandedSubFeatures:ye,disableEditPlan:we,useMuiTooltip:Ne},e.artifactId)})]})})]})},X=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:a,showUserStoryDiff:r,updateUserStoryArtifact:s,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:y,showWrapper:h,actionItemsConfig:f,contextVariant:g,showDisplayName:S,allowTitleEdit:b,showConfidenceScore:w,showBorderTop:N,defaultExpanded:D,showCompletionPanel:E=!1,showAddSectionButton:x=!1,disableEditPlan:B=!1,useMuiTooltip:T=!1,approveButtonConfig:U,CDNeededInChip:k,setRedlineDocumentIdParent:P})=>{const{userStory:R,setUserStory:_,customStyles:F,searchQueryList:M,currentHighlightIndex:j,setCurrentHighlightIndex:V,segmentComponentConfig:z,sectionStatusConfig:$,redlineConfig:G,setRedlineDocumentId:H}=L(),q=null==F?void 0:F.userStoryCardStyles,Q=0===j,J=j===M.length-1;return i(()=>{if(!(null==G?void 0:G.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await O({baseApiUrl:G.documentBaseApiUrl||"",comparisonId:G.documentComparisonId||""});if(t)H(t);else{const{document_id:t}=await W({baseApiUrl:G.baseApiUrl,changelogConfigId:G.changelogConfigId,comparisonId:G.documentComparisonId,artifactId:G.artifactId,inputData:G.inputData,redlineConfigId:G.redlineConfigId,userEmail:G.userEmail,userName:G.userName},null!==(e=null==G?void 0:G.token)&&void 0!==e?e:"");t&&(H(t),null==P||P(t))}})()},[]),e("div",{className:A.userStoryCardWrapper,style:m?{...null==q?void 0:q.userStoryCardWrapper,position:"relative"}:null==q?void 0:q.userStoryCardWrapper,children:[m&&t(l,{children:M.length>0&&t("div",{className:A.wrapper,children:t("div",{className:A.highlightNavigation,children:e("div",{className:A.navigationContainer,children:[e("span",{className:A.navCounter,children:[j+1," of ",M.length]}),e("div",{className:A.navButtons,children:[t("button",{onClick:()=>{j>0&&V(e=>e-1)},className:A.navButton,disabled:Q,children:t(C,{size:20,className:A.navIcon})}),t("button",{onClick:()=>{j<M.length-1&&V(e=>e+1)},className:A.navButton,disabled:J,children:t(I,{size:20,className:A.navIcon})})]})]})})})}),R.map((e,l)=>{const i=Z(y,!0);return t(K,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:e,onUserStoryChange:e=>{_(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:r,updateUserStoryArtifact:s,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:y,_resolvedConfig:i,showWrapper:h,defaultExpanded:D,actionItemsConfig:f,contextVariant:g,showDisplayName:S,allowTitleEdit:b,showConfidenceScore:w,showBorderTop:N,sectionStatusConfig:$,showCompletionPanel:E,showAddSectionButton:x,disableEditPlan:B,useMuiTooltip:T,approveButtonConfig:U,CDNeededInChip:k},e.artifactId)})]})};export{K as StoryCard,X as UserStoryCardWrapper,K as default,Q as replaceLearnedTagsWithInfo};
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,Fragment as n,jsxs as i}from"react/jsx-runtime";import o,{createContext as t,useRef as l,useState as r,useCallback as d,useMemo as a,useEffect as s,useContext as c}from"react";import u from"react-markdown";import p from"rehype-raw";import g from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as h}from"../../shared/useMarkdownSearch.js";import{Info as v}from"lucide-react";import{Tooltip as m}from"@mui/material";import C from"dompurify";import f from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as S}from"../RequirementAIWrapper/RequirementAIWrapper.js";import b from"../../icons/CognitiveDecision.js";import I from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as $}from"../ai-reasoning/AiReasoningCitation.js";import x from"../../icons/RelevanceScoreIcon.js";import N from"../RecommendationBlock/RecommendationBlock.js";import k from"../UserStoryCard/AttachedContext.js";import A from"../ai-reasoning/AiReasoningCitationContent.js";import j from"./components/InlineUpdatedComponent.js";import U from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as E}from"../../store/markdown-context.js";import L from"./components/InlineManualComponent.js";import M from"./components/HighlightButtonComponent.js";import{escapeTagIds as T,splitTagAcrossParagraphs as P}from"../../../../utils/tagHelper.js";const D=t(!1),_=t({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),H=t({rowId:""}),F=({aiReason:n,isHighConfidence:o,customStyle:t,customIcons:l})=>{var r;const{expandedInfo:d,setExpanded:a,reasonToRow:s}=c(_),{rowId:u}=c(H),p=String(n.id);u&&s.current.set(p,u);const h=(null===(r=null==d?void 0:d.aiReason)||void 0===r?void 0:r.id)===n.id,v=o?(null==l?void 0:l.highConfidence)||e(b,{}):(null==l?void 0:l.lowConfidence)||e(I,{});return i("button",{className:g.aiReasoningButton,style:t,onClick:e=>{e.stopPropagation(),e.preventDefault(),a(h?null:u,h?null:n)},children:[v,e("i",h?{className:`pi pi-angle-up ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`})]})},B=({children:n,node:o,customStyles:t,customIcons:r})=>{var d,a;const s=l(Math.random().toString(36).slice(2)).current,{expandedInfo:u}=c(_),p=(null==u?void 0:u.rowId)===s,h=Array.isArray(null==o?void 0:o.children)?o.children.filter(e=>"element"===e.type).length:1,v=null!==(a=null===(d=null==o?void 0:o.properties)||void 0===d?void 0:d.style)&&void 0!==a?a:void 0;return i(H.Provider,{value:{rowId:s},children:[e("tr",{style:v?{cssText:v}:void 0,children:n}),p&&(null==u?void 0:u.aiReason)&&e("tr",{style:{width:"100%"},children:e("td",{colSpan:h||1,className:g.tableExpandedCell,children:e("div",{className:g.tableExpandedCellInner,children:e("div",{className:g.tableExpandedCellContent,children:e(A,{aiReason:u.aiReason,customIcons:r,customStyles:{aiReasoningContent:null==t?void 0:t.aiReasoningContent,aiReasoningAccordion:null==t?void 0:t.aiReasoningAccordion,aiReasoningMarkdown:null==t?void 0:t.aiReasoningMarkdown,aiReasoningPill:null==t?void 0:t.aiReasoningPill,webCitation:null==t?void 0:t.webCitation,stormeeCitation:null==t?void 0:t.stormeeCitation,waveformCitation:null==t?void 0:t.waveformCitation,imageCitation:null==t?void 0:t.imageCitation,fileCitation:null==t?void 0:t.fileCitation,appModCitation:null==t?void 0:t.appModCitation,rcaCitation:null==t?void 0:t.rcaCitation,readFileCitation:null==t?void 0:t.readFileCitation,loadingCitations:null==t?void 0:t.loadingCitations,chatCitation:null==t?void 0:t.chatCitation}})})})})})]})};const O=["del","ins"];function V(e){return function(e,n,i){const o=n.join("|");return e.replace(new RegExp(`<(${o})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,o)=>`<${n}>${i(o)}</${n}>`)}(e,O,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var o;return`<code>${t=null!==(o=n[Number(i)])&&void 0!==o?o:"",t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var t})}(e)).join(""))}const q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,r;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!o.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(q.has(d))return e;const a=null===(r=o.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===r?void 0:r.flat().filter(e=>null!=e);return a&&0!==a.length?o.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const W=({message:t,noMarkdownContent:b,useMarkdown:I=!0,isParent:A,scenario:H,showUserStoryDiff:O=!1,aiReasoningsForBlock:q,isCitationLoadingDisplay:W=!1,className:G,highConfidenceIcon:Q,lowConfidenceIcon:J,customStyles:K,customIcons:X,contextVariant:Y,aiReasoningDiffView:Z,userStoryCitations:ee,artifactId:ne,isCraflow:ie,onCraAccept:oe,onCraReject:te,craFlowConfig:le,isDisplayHighlightControl:re=!1,showConfidenceScore:de=!0,CDNeededInChip:ae})=>{var se;const ce=l(null),{userStory:ue,inlineUpdateComponentConfig:pe,getAvgScoreForStory:ge,setUserStory:he,aiReasoning:ve,setAiReasoning:me,customIcons:Ce,searchQueryList:fe,searchQueryReasoningIdList:ye,currentHighlightIndex:we,segmentComponentConfig:Se,inlineManualComponentConfig:be,diffEditConfig:Ie}=S(),Re=null!=X?X:null==Ce?void 0:Ce.userStoryIcons;null==K||K.searchHighlight;const{search:$e,clear:xe}=h(ce),[Ne,ke]=r("1"),[Ae,je]=r(null),Ue=l(new Map),[Ee,Le]=r(new Set),Me=d((e,n)=>{je(e&&n?{rowId:e,aiReason:n}:null)},[]),Te=ne?ge(ne):0,[Pe,De]=r([]),_e=d(e=>{Le(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),He=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(He).join(""):o.isValidElement(e)?He(e.props.children):"",Fe=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,o,t)=>{const l=o.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,o,t)=>{const l=n.substring(0,t),r=l.lastIndexOf("\n"),d=/^\s+[-*]\s/.test(l.substring(r+1))||/^\s+\d+\.\s/.test(l.substring(r+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(r+1));if(d||a){let e=o;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let o;const t=new RegExp(n.source,n.flags);for(;null!==(o=t.exec(e));){const e=o[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),t=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:o.index,endIndex:o.index+o[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==t?void 0:t[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],o=n.changedItemCount-n.deletedItemCount;if(0===o)continue;const t=l.substring(0,n.index).split("\n").reverse();let r=!1;for(const e of t){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(r=!0);break}}if(!r)continue;const d=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(d,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+o}. `),l=l.substring(0,d)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=V(n),n},Be=a(()=>t?Fe(t):t,[t]);s(()=>{De(q||ve)},[q,ve]);const Oe=a(()=>({span:({node:n,children:i,...o})=>{var t,l,r,d,a;const s=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t["highlight-id"])&&void 0!==l?l:null==o?void 0:o["highlight-id"],c="string"==typeof s&&Ee.has(s),u=null!==(d=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-color"])&&void 0!==d?d:null==o?void 0:o["highlight-color"];return e("span",{style:{...null!==(a=null==K?void 0:K.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:i,children:o,...t})=>{var l,r,d,a,s,c;const u=null!==(r=null===(l=null==i?void 0:i.properties)||void 0===l?void 0:l.action)&&void 0!==r?r:null==t?void 0:t.action,p=null!==(a=null===(d=null==i?void 0:i.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(c=null===(s=null==i?void 0:i.properties)||void 0===s?void 0:s["highlight-type"])&&void 0!==c?c:null==t?void 0:t["highlight-type"];return"highlight"===u?e(M,{highlightId:p,handleHighlightSpan:_e,icon:"web"===g?null==Re?void 0:Re.webCitationIcon:"doc"===g?null==Re?void 0:Re.fileCitationIcon:e(n,{}),customStyles:"web"===g?null==K?void 0:K.webButton:"doc"===g?null==K?void 0:K.docButton:{}}):null},upt:({node:i,children:o,...t})=>{var l,r;const d=null==t?void 0:t.id,a=d?null===(r=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===r?void 0:r.replaceAll("@","<").replaceAll("#",">"):null,s=ve.find(e=>e.id.toString()===a);return s?e(n,{children:e(j,{aiReason:s,customStyles:null==K?void 0:K.inlineUpdatedComponent,handleClickCognitiveDecision:null==pe?void 0:pe.handleClickCognitiveDecision,handleClickUpdatedPill:null==pe?void 0:pe.handleClickUpdatedPill,handleClickOutputValue:null==pe?void 0:pe.handleClickOutputValue,customIcons:null==pe?void 0:pe.customIcons,CDNeededInChip:ae,children:o||e(n,{})})}):o||e(n,{})},del:({node:o,children:t,...l})=>{var r;const{cleanedChildren:d,extractedNodes:a}=z(t,["ins"]);return i(n,{children:[e("span",{className:g.deleted,style:null!==(r=null==K?void 0:K.deleted)&&void 0!==r?r:{},...l,onClick:()=>{l.onclick&&l.onclick()},children:d}),a]})},ins:({children:o,...t})=>{var l;const{cleanedChildren:r,extractedNodes:d}=z(o,["del"]);return i(n,{children:[e("span",{className:g.inserted,style:null!==(l=null==K?void 0:K.inserted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:r}),d]})},preserved:({children:n,...i})=>e("span",{className:g.preserved,style:null==K?void 0:K.preserved,...i,children:n}),manual:({children:i,...o})=>{var t;const l=null===(t=null==o?void 0:o.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),r=ve.find(e=>e.id.toString()===l);return r?e(L,{aiReason:r,handleClick:null==be?void 0:be.handleClick,children:i}):i||e(n,{})},invisible:({children:i,...o})=>e(n,{}),h1:({node:n,...i})=>e("h1",{className:g.heading1,style:null==K?void 0:K.heading1,children:i.children}),h2:({node:n,...i})=>e("h2",{className:g.heading2,style:null==K?void 0:K.heading2,children:i.children}),h3:({node:n,...i})=>e("h3",{className:g.heading3,style:null==K?void 0:K.heading3,children:i.children}),b:({node:n,...i})=>e("b",{className:g.bold,style:null==K?void 0:K.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e("p",{...i,className:g.paragraph,style:null==K?void 0:K.paragraph,children:i.children}),updated:({node:n,...i})=>e(f,{...i,showUserStoryDiff:O,currentUpdatedTagId:Ne,setCurrentUpdatedTagId:ke,userStory:ue,setUserStory:he,setAiReasoning:me,node:n,isCraflow:ie,onCraAccept:oe,onCraReject:te,diffEditConfig:Ie,customStyles:null==K?void 0:K.updatedContent,craFlowConfig:le}),ol:({node:n,...i})=>{var o,t,l;const r=null!==(l=null!==(t=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.start)&&void 0!==t?t:null==i?void 0:i.start)&&void 0!==l?l:void 0;return e("ol",{className:g.orderedList,style:null==K?void 0:K.olist,...r?{start:Number(r)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e("ul",{className:g.unorderedList,style:null==K?void 0:K.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e("div",{className:g.tableWrapper,children:e("table",{className:g.table,style:null==K?void 0:K.table,children:n})}),tr:({node:n,children:i})=>e(B,{node:n,children:i,customStyles:K}),td:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(D.Provider,{value:!0,children:e("td",{...l,style:t?{cssText:t}:void 0,children:i})})},th:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(D.Provider,{value:!0,children:e("th",{...l,style:t?{cssText:t}:void 0,children:i})})},recommendation:({node:n,...i})=>{var o;const t=`The AI has selected this content based on: ${(null===(o=null==i?void 0:i.children)||void 0===o?void 0:o[0])||""}`;return e(N,{...i,customStyles:null==K?void 0:K.recommendationBlock,label:t})},a:({inline:n,children:i,node:o,...t})=>{var l,r,d;const a=c(D)||"true"==(null==t?void 0:t.table),s=`${null==t?void 0:t.href}`,u=null===(l=s.split("$"))||void 0===l?void 0:l[0],p=null===(r=s.split("$"))||void 0===r?void 0:r[1];if("ai_reasoning"===u){const n=(null!==(d=O?Z:ve)&&void 0!==d?d:[]).find(e=>e.id.toString()===decodeURIComponent(p)),o=ye.includes(p);if(n){if(a)return e(F,{aiReason:n,customStyle:null==K?void 0:K.tableAiReasoning,customIcons:Re,isHighConfidence:n.relevance_score>=$});const t=He(i),l="source"!==t.trim().toLowerCase();return e(R,{aiReason:n,isSourceHasHighlight:o,inlineLabel:t,isInlineCitation:l,customIcons:Re,customStyles:{aiReasoningContent:null==K?void 0:K.aiReasoningContent,aiReasoningAccordion:null==K?void 0:K.aiReasoningAccordion,aiReasoningMarkdown:null==K?void 0:K.aiReasoningMarkdown,aiReasoningPill:null==K?void 0:K.aiReasoningPill,webCitation:null==K?void 0:K.webCitation,stormeeCitation:null==K?void 0:K.stormeeCitation,waveformCitation:null==K?void 0:K.waveformCitation,imageCitation:null==K?void 0:K.imageCitation,fileCitation:null==K?void 0:K.fileCitation,appModCitation:null==K?void 0:K.appModCitation,rcaCitation:null==K?void 0:K.rcaCitation,readFileCitation:null==K?void 0:K.readFileCitation,loadingCitations:null==K?void 0:K.loadingCitations,chatCitation:null==K?void 0:K.chatCitation,bigEnoughCitation:null==K?void 0:K.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:o,node:t,...l})=>/language-(\w+)/.exec(o||"")||(null==o?void 0:o.includes("language-"))?e("div",{children:e("code",{className:g.blockCode,style:null==K?void 0:K.code,children:i})}):e("code",{className:g.inlineCode,style:null==K?void 0:K.code,children:i}),learned:({children:n})=>e(m,{title:n,placement:"top",children:e(v,{size:16,className:g.learned})}),generatedcode:({node:n,...i})=>{const o=(null==i?void 0:i.language)||"python",t=(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(y,{title:"Generated Code",code:t,language:o,customStyles:{pill:null==K?void 0:K.generatedCodePill,content:null==K?void 0:K.generatedCodeContent}})},updatedsegment:({node:n,children:i,...o})=>{var t,l,r,d;const a=`${null===(t=n.position)||void 0===t?void 0:t.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.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}})(o),c=e("div",s?{dangerouslySetInnerHTML:{__html:C.sanitize(s)}}:{children:i});return e(U,{id:a,node:n,children:c,props:o,segmentComponentConfig:Se,customStyles:K,customIcons:X,extractText:He,isUpdatedSegment:!0})},segment:({node:n,children:i,...o})=>{var t,l,r,d;const a=`${null===(t=n.position)||void 0===t?void 0:t.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(r=n.position)||void 0===r?void 0:r.end.line}-${null===(d=n.position)||void 0===d?void 0:d.end.column}`;return e(U,{id:a,node:n,children:i,props:o,segmentComponentConfig:Se,customStyles:K,customIcons:X,extractText:He})}}),[Pe,le,ve,ee,Ne,O,t,X,fe,ye,K,Se,Ee,_e]),Ve=a(()=>{let e=T(Be,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=P(e,n)}),e},[Be]);return s(()=>{if(!ce.current)return;if(!fe.length)return void xe();let e;if(0===ye.length||re)requestAnimationFrame(()=>{$e([fe[we].replace(/\*/g,"")])});else{const n=ce.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{$e([fe[we].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[fe,ye,we,re]),e(_.Provider,{value:{expandedInfo:Ae,setExpanded:Me,reasonToRow:Ue},children:i("div",{ref:ce,className:`${g.container} ${"approving"!==H?g.wrapper:""} ${G||""}`,style:null==K?void 0:K.container,children:[I?e(E,{children:e(u,{components:Oe,rehypePlugins:[p],children:Ve})}):b,Te>0&&de&&e("div",{className:g.confidenceScoreContainer,style:null==K?void 0:K.confidenceScoreContainer,children:i("span",{className:g.confidenceScore,style:null==K?void 0:K.confidenceScore,children:[e(x,{size:14,color:(null==K?void 0:K.confidenceScoreIconColor)||"#166534"}),Te,"%"]})}),W&&e("div",{className:g.citationLoader,style:null==K?void 0:K.citationLoaderContainer,children:e(w,{customStyles:{container:null==K?void 0:K.citationLoadingContainer,icon:null==K?void 0:K.citationLoadingIcon,text:null==K?void 0:K.citationLoadingText}})}),A&&e("div",{style:{...null===(se=null==K?void 0:K.attachedContext)||void 0===se?void 0:se.wrapper},className:"flex mt-5",children:e(k,{customStyles:null==K?void 0:K.attachedContext,variant:Y})})]})})};export{W as default,z as splitNestedDiffNodes};
1
+ import{jsx as e,Fragment as n,jsxs as i}from"react/jsx-runtime";import o,{createContext as t,useRef as l,useState as d,useCallback as r,useMemo as a,useEffect as s,useContext as c}from"react";import u from"react-markdown";import p from"rehype-raw";import g from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as h}from"../../shared/useMarkdownSearch.js";import{Info as v}from"lucide-react";import{Tooltip as m}from"@mui/material";import C from"dompurify";import f from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as S}from"../RequirementAIWrapper/RequirementAIWrapper.js";import b from"../../icons/CognitiveDecision.js";import I from"../../icons/BrainRed.js";import R,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as $}from"../ai-reasoning/AiReasoningCitation.js";import x from"../../icons/RelevanceScoreIcon.js";import N from"../RecommendationBlock/RecommendationBlock.js";import k from"../UserStoryCard/AttachedContext.js";import A from"../ai-reasoning/AiReasoningCitationContent.js";import j from"./components/InlineUpdatedComponent.js";import U from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as E}from"../../store/markdown-context.js";import L from"./components/InlineManualComponent.js";import M from"./components/HighlightButtonComponent.js";const T=t(!1),P=t({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),D=t({rowId:""}),_=({aiReason:n,isHighConfidence:o,customStyle:t,customIcons:l})=>{var d;const{expandedInfo:r,setExpanded:a,reasonToRow:s}=c(P),{rowId:u}=c(D),p=String(n.id);u&&s.current.set(p,u);const h=(null===(d=null==r?void 0:r.aiReason)||void 0===d?void 0:d.id)===n.id,v=o?(null==l?void 0:l.highConfidence)||e(b,{}):(null==l?void 0:l.lowConfidence)||e(I,{});return i("button",{className:g.aiReasoningButton,style:t,onClick:e=>{e.stopPropagation(),e.preventDefault(),a(h?null:u,h?null:n)},children:[v,e("i",h?{className:`pi pi-angle-up ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`}:{className:`pi pi-angle-down ${o?g.aiReasoningIconHighConfidence:g.aiReasoningIconLowConfidence}`})]})},H=({children:n,node:o,customStyles:t,customIcons:d})=>{var r,a;const s=l(Math.random().toString(36).slice(2)).current,{expandedInfo:u}=c(P),p=(null==u?void 0:u.rowId)===s,h=Array.isArray(null==o?void 0:o.children)?o.children.filter(e=>"element"===e.type).length:1,v=null!==(a=null===(r=null==o?void 0:o.properties)||void 0===r?void 0:r.style)&&void 0!==a?a:void 0;return i(D.Provider,{value:{rowId:s},children:[e("tr",{style:v?{cssText:v}:void 0,children:n}),p&&(null==u?void 0:u.aiReason)&&e("tr",{style:{width:"100%"},children:e("td",{colSpan:h||1,className:g.tableExpandedCell,children:e("div",{className:g.tableExpandedCellInner,children:e("div",{className:g.tableExpandedCellContent,children:e(A,{aiReason:u.aiReason,customIcons:d,customStyles:{aiReasoningContent:null==t?void 0:t.aiReasoningContent,aiReasoningAccordion:null==t?void 0:t.aiReasoningAccordion,aiReasoningMarkdown:null==t?void 0:t.aiReasoningMarkdown,aiReasoningPill:null==t?void 0:t.aiReasoningPill,webCitation:null==t?void 0:t.webCitation,stormeeCitation:null==t?void 0:t.stormeeCitation,waveformCitation:null==t?void 0:t.waveformCitation,imageCitation:null==t?void 0:t.imageCitation,fileCitation:null==t?void 0:t.fileCitation,appModCitation:null==t?void 0:t.appModCitation,rcaCitation:null==t?void 0:t.rcaCitation,readFileCitation:null==t?void 0:t.readFileCitation,loadingCitations:null==t?void 0:t.loadingCitations,chatCitation:null==t?void 0:t.chatCitation}})})})})})]})};const F=["del","ins"];function B(e){return function(e,n,i){const o=n.join("|");return e.replace(new RegExp(`<(${o})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,o)=>`<${n}>${i(o)}</${n}>`)}(e,F,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var o;return`<code>${t=null!==(o=n[Number(i)])&&void 0!==o?o:"",t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}</code>`;var t})}(e)).join(""))}const O=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function V(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,d;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!o.isValidElement(e))return e;const r="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(r))return i.push(e),null;if(O.has(r))return e;const a=null===(d=o.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===d?void 0:d.flat().filter(e=>null!=e);return a&&0!==a.length?o.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}const q=({message:t,noMarkdownContent:b,useMarkdown:I=!0,isParent:A,scenario:D,showUserStoryDiff:F=!1,aiReasoningsForBlock:O,isCitationLoadingDisplay:q=!1,className:z,highConfidenceIcon:W,lowConfidenceIcon:G,customStyles:Q,customIcons:J,contextVariant:K,aiReasoningDiffView:X,userStoryCitations:Y,artifactId:Z,isCraflow:ee,onCraAccept:ne,onCraReject:ie,craFlowConfig:oe,isDisplayHighlightControl:te=!1,showConfidenceScore:le=!0,CDNeededInChip:de})=>{var re;const ae=l(null),{userStory:se,inlineUpdateComponentConfig:ce,getAvgScoreForStory:ue,setUserStory:pe,aiReasoning:ge,setAiReasoning:he,customIcons:ve,searchQueryList:me,searchQueryReasoningIdList:Ce,currentHighlightIndex:fe,segmentComponentConfig:ye,inlineManualComponentConfig:we,diffEditConfig:Se}=S(),be=null!=J?J:null==ve?void 0:ve.userStoryIcons;null==Q||Q.searchHighlight;const{search:Ie,clear:Re}=h(ae),[$e,xe]=d("1"),[Ne,ke]=d(null),Ae=l(new Map),[je,Ue]=d(new Set),Ee=r((e,n)=>{ke(e&&n?{rowId:e,aiReason:n}:null)},[]),Le=Z?ue(Z):0,[Me,Te]=d([]),Pe=r(e=>{Ue(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),De=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(De).join(""):o.isValidElement(e)?De(e.props.children):"",_e=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,o,t)=>{const l=o.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,o,t)=>{const l=n.substring(0,t),d=l.lastIndexOf("\n"),r=/^\s+[-*]\s/.test(l.substring(d+1))||/^\s+\d+\.\s/.test(l.substring(d+1)),a=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(d+1));if(r||a){let e=o;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let o;const t=new RegExp(n.source,n.flags);for(;null!==(o=t.exec(e));){const e=o[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),t=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:o.index,endIndex:o.index+o[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==t?void 0:t[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],o=n.changedItemCount-n.deletedItemCount;if(0===o)continue;const t=l.substring(0,n.index).split("\n").reverse();let d=!1;for(const e of t){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(d=!0);break}}if(!d)continue;const r=n.endIndex,a=e+1<i.length?i[e+1].index:l.length;let s=l.substring(r,a);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+o}. `),l=l.substring(0,r)+s+l.substring(a)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=B(n),n},He=a(()=>t?_e(t):t,[t]);s(()=>{Te(O||ge)},[O,ge]);const Fe=a(()=>({span:({node:n,children:i,...o})=>{var t,l,d,r,a;const s=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t["highlight-id"])&&void 0!==l?l:null==o?void 0:o["highlight-id"],c="string"==typeof s&&je.has(s),u=null!==(r=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-color"])&&void 0!==r?r:null==o?void 0:o["highlight-color"];return e("span",{style:{...null!==(a=null==Q?void 0:Q.span)&&void 0!==a?a:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:i,children:o,...t})=>{var l,d,r,a,s,c;const u=null!==(d=null===(l=null==i?void 0:i.properties)||void 0===l?void 0:l.action)&&void 0!==d?d:null==t?void 0:t.action,p=null!==(a=null===(r=null==i?void 0:i.properties)||void 0===r?void 0:r["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(c=null===(s=null==i?void 0:i.properties)||void 0===s?void 0:s["highlight-type"])&&void 0!==c?c:null==t?void 0:t["highlight-type"];return"highlight"===u?e(M,{highlightId:p,handleHighlightSpan:Pe,icon:"web"===g?null==be?void 0:be.webCitationIcon:"doc"===g?null==be?void 0:be.fileCitationIcon:e(n,{}),customStyles:"web"===g?null==Q?void 0:Q.webButton:"doc"===g?null==Q?void 0:Q.docButton:{}}):null},upt:({node:i,children:o,...t})=>{var l;const d=null==t?void 0:t.id,r=d?null===(l=d.split("$"))||void 0===l?void 0:l[1]:null,a=ge.find(e=>e.id.toString()===r);return a?e(n,{children:e(j,{aiReason:a,customStyles:null==Q?void 0:Q.inlineUpdatedComponent,handleClickCognitiveDecision:null==ce?void 0:ce.handleClickCognitiveDecision,handleClickUpdatedPill:null==ce?void 0:ce.handleClickUpdatedPill,handleClickOutputValue:null==ce?void 0:ce.handleClickOutputValue,customIcons:null==ce?void 0:ce.customIcons,CDNeededInChip:de,children:o||e(n,{})})}):o||e(n,{})},del:({node:o,children:t,...l})=>{var d;const{cleanedChildren:r,extractedNodes:a}=V(t,["ins"]);return i(n,{children:[e("span",{className:g.deleted,style:null!==(d=null==Q?void 0:Q.deleted)&&void 0!==d?d:{},...l,onClick:()=>{l.onclick&&l.onclick()},children:r}),a]})},ins:({children:o,...t})=>{var l;const{cleanedChildren:d,extractedNodes:r}=V(o,["del"]);return i(n,{children:[e("span",{className:g.inserted,style:null!==(l=null==Q?void 0:Q.inserted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:d}),r]})},preserved:({children:n,...i})=>e("span",{className:g.preserved,style:null==Q?void 0:Q.preserved,...i,children:n}),manual:({children:n,...i})=>{const o=null==i?void 0:i.id,t=ge.find(e=>e.id.toString()===o);return t?e(L,{aiReason:t,handleClick:null==we?void 0:we.handleClick,children:n}):n},invisible:({children:i,...o})=>e(n,{}),h1:({node:n,...i})=>e("h1",{className:g.heading1,style:null==Q?void 0:Q.heading1,children:i.children}),h2:({node:n,...i})=>e("h2",{className:g.heading2,style:null==Q?void 0:Q.heading2,children:i.children}),h3:({node:n,...i})=>e("h3",{className:g.heading3,style:null==Q?void 0:Q.heading3,children:i.children}),b:({node:n,...i})=>e("b",{className:g.bold,style:null==Q?void 0:Q.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e("p",{...i,className:g.paragraph,style:null==Q?void 0:Q.paragraph,children:i.children}),updated:({node:n,...i})=>e(f,{...i,showUserStoryDiff:F,currentUpdatedTagId:$e,setCurrentUpdatedTagId:xe,userStory:se,setUserStory:pe,setAiReasoning:he,node:n,isCraflow:ee,onCraAccept:ne,onCraReject:ie,diffEditConfig:Se,customStyles:null==Q?void 0:Q.updatedContent,craFlowConfig:oe}),ol:({node:n,...i})=>{var o,t,l;const d=null!==(l=null!==(t=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.start)&&void 0!==t?t:null==i?void 0:i.start)&&void 0!==l?l:void 0;return e("ol",{className:g.orderedList,style:null==Q?void 0:Q.olist,...d?{start:Number(d)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e("ul",{className:g.unorderedList,style:null==Q?void 0:Q.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e("div",{className:g.tableWrapper,children:e("table",{className:g.table,style:null==Q?void 0:Q.table,children:n})}),tr:({node:n,children:i})=>e(H,{node:n,children:i,customStyles:Q}),td:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(T.Provider,{value:!0,children:e("td",{...l,style:t?{cssText:t}:void 0,children:i})})},th:({node:n,children:i})=>{var o;const{style:t,...l}=null!==(o=null==n?void 0:n.properties)&&void 0!==o?o:{};return e(T.Provider,{value:!0,children:e("th",{...l,style:t?{cssText:t}:void 0,children:i})})},recommendation:({node:n,...i})=>{var o;const t=`The AI has selected this content based on: ${(null===(o=null==i?void 0:i.children)||void 0===o?void 0:o[0])||""}`;return e(N,{...i,customStyles:null==Q?void 0:Q.recommendationBlock,label:t})},a:({inline:n,children:i,node:o,...t})=>{var l,d,r;const a=c(T)||"true"==(null==t?void 0:t.table),s=`${null==t?void 0:t.href}`,u=null===(l=s.split("$"))||void 0===l?void 0:l[0],p=null===(d=s.split("$"))||void 0===d?void 0:d[1];if("ai_reasoning"===u){const n=(null!==(r=F?X:ge)&&void 0!==r?r:[]).find(e=>e.id.toString()===decodeURIComponent(p)),o=Ce.includes(p);if(n){if(a)return e(_,{aiReason:n,customStyle:null==Q?void 0:Q.tableAiReasoning,customIcons:be,isHighConfidence:n.relevance_score>=$});const t=De(i),l="source"!==t.trim().toLowerCase();return e(R,{aiReason:n,isSourceHasHighlight:o,inlineLabel:t,isInlineCitation:l,customIcons:be,customStyles:{aiReasoningContent:null==Q?void 0:Q.aiReasoningContent,aiReasoningAccordion:null==Q?void 0:Q.aiReasoningAccordion,aiReasoningMarkdown:null==Q?void 0:Q.aiReasoningMarkdown,aiReasoningPill:null==Q?void 0:Q.aiReasoningPill,webCitation:null==Q?void 0:Q.webCitation,stormeeCitation:null==Q?void 0:Q.stormeeCitation,waveformCitation:null==Q?void 0:Q.waveformCitation,imageCitation:null==Q?void 0:Q.imageCitation,fileCitation:null==Q?void 0:Q.fileCitation,appModCitation:null==Q?void 0:Q.appModCitation,rcaCitation:null==Q?void 0:Q.rcaCitation,readFileCitation:null==Q?void 0:Q.readFileCitation,loadingCitations:null==Q?void 0:Q.loadingCitations,chatCitation:null==Q?void 0:Q.chatCitation,bigEnoughCitation:null==Q?void 0:Q.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:o,node:t,...l})=>/language-(\w+)/.exec(o||"")||(null==o?void 0:o.includes("language-"))?e("div",{children:e("code",{className:g.blockCode,style:null==Q?void 0:Q.code,children:i})}):e("code",{className:g.inlineCode,style:null==Q?void 0:Q.code,children:i}),learned:({children:n})=>e(m,{title:n,placement:"top",children:e(v,{size:16,className:g.learned})}),generatedcode:({node:n,...i})=>{const o=(null==i?void 0:i.language)||"python",t=(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(y,{title:"Generated Code",code:t,language:o,customStyles:{pill:null==Q?void 0:Q.generatedCodePill,content:null==Q?void 0:Q.generatedCodeContent}})},updatedsegment:({node:n,children:i,...o})=>{var t,l,d,r;const a=`${null===(t=n.position)||void 0===t?void 0:t.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===(r=n.position)||void 0===r?void 0:r.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}})(o),c=e("div",s?{dangerouslySetInnerHTML:{__html:C.sanitize(s)}}:{children:i});return e(U,{id:a,node:n,children:c,props:o,segmentComponentConfig:ye,customStyles:Q,customIcons:J,extractText:De,isUpdatedSegment:!0})},segment:({node:n,children:i,...o})=>{var t,l,d,r;const a=`${null===(t=n.position)||void 0===t?void 0:t.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===(r=n.position)||void 0===r?void 0:r.end.column}`;return e(U,{id:a,node:n,children:i,props:o,segmentComponentConfig:ye,customStyles:Q,customIcons:J,extractText:De})}}),[Me,oe,ge,Y,$e,F,t,J,me,Ce,Q,ye,je,Pe]);return s(()=>{if(!ae.current)return;if(!me.length)return void Re();let e;if(0===Ce.length||te)requestAnimationFrame(()=>{Ie([me[fe].replace(/\*/g,"")])});else{const n=ae.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{Ie([me[fe].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[me,Ce,fe,te]),e(P.Provider,{value:{expandedInfo:Ne,setExpanded:Ee,reasonToRow:Ae},children:i("div",{ref:ae,className:`${g.container} ${"approving"!==D?g.wrapper:""} ${z||""}`,style:null==Q?void 0:Q.container,children:[I?e(E,{children:e(u,{components:Fe,rehypePlugins:[p],children:He})}):b,Le>0&&le&&e("div",{className:g.confidenceScoreContainer,style:null==Q?void 0:Q.confidenceScoreContainer,children:i("span",{className:g.confidenceScore,style:null==Q?void 0:Q.confidenceScore,children:[e(x,{size:14,color:(null==Q?void 0:Q.confidenceScoreIconColor)||"#166534"}),Le,"%"]})}),q&&e("div",{className:g.citationLoader,style:null==Q?void 0:Q.citationLoaderContainer,children:e(w,{customStyles:{container:null==Q?void 0:Q.citationLoadingContainer,icon:null==Q?void 0:Q.citationLoadingIcon,text:null==Q?void 0:Q.citationLoadingText}})}),A&&e("div",{style:{...null===(re=null==Q?void 0:Q.attachedContext)||void 0===re?void 0:re.wrapper},className:"flex mt-5",children:e(k,{customStyles:null==Q?void 0:Q.attachedContext,variant:K})})]})})};export{q as default,V as splitNestedDiffNodes};
2
2
  //# sourceMappingURL=UserStoryWithCitation.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as l}from"react/jsx-runtime";import n from"./InlineManualComponent.module.css.js";function a(a){var i,o,e,t;return l("span",{className:n[`manual-${null===(i=a.aiReason.redlining_details)||void 0===i?void 0:i.status}`],"data-id":null===(t=null===(e=null===(o=null==a?void 0:a.aiReason)||void 0===o?void 0:o.id)||void 0===e?void 0:e.toString)||void 0===t?void 0:t.call(e),onClick:l=>{var n;l.stopPropagation(),l.preventDefault(),null===(n=a.handleClick)||void 0===n||n.call(a,l.currentTarget,a.aiReason)},children:a.children})}export{a as default};
1
+ import{jsx as l}from"react/jsx-runtime";import n from"./InlineManualComponent.module.css.js";function i(i){var a,o,e,r;return l("span",{className:n[`manual-${null===(a=i.aiReason.redlining_details)||void 0===a?void 0:a.status}`],id:null===(r=null===(e=null===(o=null==i?void 0:i.aiReason)||void 0===o?void 0:o.id)||void 0===e?void 0:e.toString)||void 0===r?void 0:r.call(e),onClick:l=>{var n;l.stopPropagation(),l.preventDefault(),null===(n=i.handleClick)||void 0===n||n.call(i,l.currentTarget,i.aiReason)},children:i.children})}export{i as default};
2
2
  //# sourceMappingURL=InlineManualComponent.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as l,jsxs as e,Fragment as n}from"react/jsx-runtime";import{Divider as o,CircularProgress as i}from"@mui/material";import{hexToOpacity as t}from"../../../utils/css.utils.js";import r from"./InlineUpdatedComponent.module.css.js";import d from"../../../icons/CognitiveDecision.js";import{Check as a,X as s,Undo2 as u,ChevronDown as c}from"lucide-react";import{useRef as v,useState as p,useCallback as m,useLayoutEffect as g}from"react";const f=({aiReason:f,children:h,customStyles:C,handleClickCognitiveDecision:y,handleClickUpdatedPill:b,handleClickOutputValue:w,customIcons:_,CDNeededInChip:k=!0})=>{var N,D,P,S,$,I,j,x,z,A,L,R,T,W,E,M,O,U,B,F,H,q,V;const G=v(null),J=v(null),[K,Q]=p(null),X=m(()=>{var l;const e=J.current,n=(null===(l=G.current)||void 0===l?void 0:l.offsetParent)||(null==e?void 0:e.offsetParent);if(!(e&&n instanceof HTMLElement))return;const o=e.getBoundingClientRect(),i=n.getBoundingClientRect(),t=o.top-i.top+o.height/2;Q(l=>null!==l&&Math.abs(l-t)<.5?l:t)},[]);g(()=>{X()}),g(()=>{var l,e;if("undefined"==typeof window)return;const n=window.requestAnimationFrame(X);window.addEventListener("resize",X);const o="undefined"!=typeof ResizeObserver?new ResizeObserver(X):null;J.current&&(null==o||o.observe(J.current));const i=(null===(l=G.current)||void 0===l?void 0:l.offsetParent)||(null===(e=J.current)||void 0===e?void 0:e.offsetParent);return i instanceof HTMLElement&&(null==o||o.observe(i)),()=>{window.cancelAnimationFrame(n),window.removeEventListener("resize",X),null==o||o.disconnect()}},[X]);const Y="pending"!==(null===(N=f.redlining_details)||void 0===N?void 0:N.status)?"#303030":null===(S=null===(P=null===(D=f.redlining_details)||void 0===D?void 0:D.evaluation_outputs)||void 0===P?void 0:P.metadata)||void 0===S?void 0:S.label_color,Z={color:Y||"#000000",background:t(Y||"#000000",25),border:`1px solid ${t(Y||"#000000",75)}`},ll=Y||"#000000",el=t(Y||"#000000",25),nl={background:t(Y||"#000000",75),...null==C?void 0:C.dividerStyle};let ol=null;const il=null===($=f.redlining_details)||void 0===$?void 0:$.status;"accepted"===il?ol=null!==(I=null==_?void 0:_.accepted)&&void 0!==I?I:l(a,{color:"#16A34A"}):"rejected"===il?ol=null!==(j=null==_?void 0:_.rejected)&&void 0!==j?j:l(s,{color:"#DC2626"}):"reverted"===il&&(ol=null!==(x=null==_?void 0:_.reverted)&&void 0!==x?x:l(u,{color:"#475569"}));const tl=null===K?{}:{"--inline-update-anchor-top":`${K}px`},rl=null===K?"":` ${r.anchorAligned}`;return e("span",{className:r.inlineUpdatedWrapper,children:[ol&&l("span",{className:`${r.resolvedStatus}${rl}`,style:{...tl,...null==C?void 0:C.resolvedIcon},children:ol}),l("span",{ref:G,"data-id":f.id.toString(),onClick:l=>{l.stopPropagation(),null==b||b(l.currentTarget,f)},className:`${r.pillWrapper}${rl}`,style:{...tl,...null==C?void 0:C.pillStyleWrapper},children:e("span",{className:r.pillComponent,style:{...Z,...null===(z=null==C?void 0:C.pillComponent)||void 0===z?void 0:z.commonStyle},children:[l("span",{children:(null===(R=null===(L=null===(A=f.redlining_details)||void 0===A?void 0:A.evaluation_outputs)||void 0===L?void 0:L.metadata)||void 0===R?void 0:R.label_text)||""}),l(o,{className:r.dividerStyle,style:nl}),l("span",{className:r["output-container"],onClick:l=>{w&&(l.stopPropagation(),null==w||w(l.currentTarget,f))},children:f.resolving?l(i,{size:(null===(T=null==C?void 0:C.loader)||void 0===T?void 0:T.size)||18,"aria-label":"Loading…",sx:{color:(null===(W=null==C?void 0:C.loader)||void 0===W?void 0:W.color)||Y}}):"pending"!==(null===(E=f.redlining_details)||void 0===E?void 0:E.status)?ol:null===(O=null===(M=null==f?void 0:f.redlining_details)||void 0===M?void 0:M.evaluation_outputs)||void 0===O?void 0:O.output_value}),k&&e(n,{children:[l(o,{className:r.dividerStyle,style:nl}),l("span",{onClick:l=>{l.stopPropagation(),null==y||y(l.currentTarget,f)},className:r.cognitiveDecisionWrapper,style:null===(U=null==C?void 0:C.cognitiveDecisionIcon)||void 0===U?void 0:U.wrapper,children:l(d,{color:(null===(B=null==C?void 0:C.cognitiveDecisionIcon)||void 0===B?void 0:B.color)||ll,backgroundColor:(null===(F=null==C?void 0:C.cognitiveDecisionIcon)||void 0===F?void 0:F.backgroundColor)||el})}),l("span",{className:r.chevronWrapper,style:null===(H=null==C?void 0:C.Chevron)||void 0===H?void 0:H.wrapper,children:l(c,{color:(null===(q=null==C?void 0:C.Chevron)||void 0===q?void 0:q.color)||Y})})]})]})}),l("span",{ref:J,className:r[`upt-${null===(V=f.redlining_details)||void 0===V?void 0:V.status}`],onClick:l=>{l.preventDefault(),l.stopPropagation(),G.current&&(null==b||b(G.current,f))},children:h})]})};export{f as default};
1
+ import{jsx as e,jsxs as l,Fragment as n}from"react/jsx-runtime";import{Divider as o,CircularProgress as i}from"@mui/material";import{hexToOpacity as t}from"../../../utils/css.utils.js";import r from"./InlineUpdatedComponent.module.css.js";import d from"../../../icons/CognitiveDecision.js";import{Check as a,X as s,Undo2 as u,ChevronDown as c}from"lucide-react";import{useRef as v,useState as p,useCallback as m,useLayoutEffect as g}from"react";const f=({aiReason:f,children:h,customStyles:C,handleClickCognitiveDecision:y,handleClickUpdatedPill:b,handleClickOutputValue:w,customIcons:_,CDNeededInChip:k=!0})=>{var N,D,P,S,$,I,j,x,z,A,L,R,T,W,E,M,O,U,B,F,H;const q=v(null),V=v(null),[G,J]=p(null),K=m(()=>{var e;const l=V.current,n=(null===(e=q.current)||void 0===e?void 0:e.offsetParent)||(null==l?void 0:l.offsetParent);if(!(l&&n instanceof HTMLElement))return;const o=l.getBoundingClientRect(),i=n.getBoundingClientRect(),t=o.top-i.top+o.height/2;J(e=>null!==e&&Math.abs(e-t)<.5?e:t)},[]);g(()=>{K()}),g(()=>{var e,l;if("undefined"==typeof window)return;const n=window.requestAnimationFrame(K);window.addEventListener("resize",K);const o="undefined"!=typeof ResizeObserver?new ResizeObserver(K):null;V.current&&(null==o||o.observe(V.current));const i=(null===(e=q.current)||void 0===e?void 0:e.offsetParent)||(null===(l=V.current)||void 0===l?void 0:l.offsetParent);return i instanceof HTMLElement&&(null==o||o.observe(i)),()=>{window.cancelAnimationFrame(n),window.removeEventListener("resize",K),null==o||o.disconnect()}},[K]);const Q="pending"!==(null===(N=f.redlining_details)||void 0===N?void 0:N.status)?"#303030":null===(S=null===(P=null===(D=f.redlining_details)||void 0===D?void 0:D.evaluation_outputs)||void 0===P?void 0:P.metadata)||void 0===S?void 0:S.label_color,X={color:Q||"#000000",background:t(Q||"#000000",25),border:`1px solid ${t(Q||"#000000",75)}`},Y=Q||"#000000",Z=t(Q||"#000000",25),ee={background:t(Q||"#000000",75),...null==C?void 0:C.dividerStyle};let le=null;const ne=null===($=f.redlining_details)||void 0===$?void 0:$.status;"accepted"===ne?le=null!==(I=null==_?void 0:_.accepted)&&void 0!==I?I:e(a,{color:"#16A34A"}):"rejected"===ne?le=null!==(j=null==_?void 0:_.rejected)&&void 0!==j?j:e(s,{color:"#DC2626"}):"reverted"===ne&&(le=null!==(x=null==_?void 0:_.reverted)&&void 0!==x?x:e(u,{color:"#475569"}));const oe=null===G?{}:{"--inline-update-anchor-top":`${G}px`},ie=null===G?"":` ${r.anchorAligned}`;return l("span",{className:r.inlineUpdatedWrapper,children:[le&&e("span",{className:`${r.resolvedStatus}${ie}`,style:{...oe,...null==C?void 0:C.resolvedIcon},children:le}),e("span",{ref:q,id:f.id.toString(),onClick:e=>{e.stopPropagation(),null==b||b(e.currentTarget,f)},className:`${r.pillWrapper}${ie}`,style:{...oe,...null==C?void 0:C.pillStyleWrapper},children:l("span",{className:r.pillComponent,style:{...X,...null===(z=null==C?void 0:C.pillComponent)||void 0===z?void 0:z.commonStyle},children:[e("span",{children:(null===(R=null===(L=null===(A=f.redlining_details)||void 0===A?void 0:A.evaluation_outputs)||void 0===L?void 0:L.metadata)||void 0===R?void 0:R.label_text)||""}),e(o,{className:r.dividerStyle,style:ee}),e("span",{className:r["output-container"],onClick:e=>{w&&(e.stopPropagation(),null==w||w(e.currentTarget,f))},children:f.resolving?e(i,{size:20,"aria-label":"Loading…"}):"pending"!==(null===(T=f.redlining_details)||void 0===T?void 0:T.status)?le:null===(E=null===(W=null==f?void 0:f.redlining_details)||void 0===W?void 0:W.evaluation_outputs)||void 0===E?void 0:E.output_value}),k&&l(n,{children:[e(o,{className:r.dividerStyle,style:ee}),e("span",{onClick:e=>{e.stopPropagation(),null==y||y(e.currentTarget,f)},className:r.cognitiveDecisionWrapper,style:null===(M=null==C?void 0:C.cognitiveDecisionIcon)||void 0===M?void 0:M.wrapper,children:e(d,{color:(null===(O=null==C?void 0:C.cognitiveDecisionIcon)||void 0===O?void 0:O.color)||Y,backgroundColor:(null===(U=null==C?void 0:C.cognitiveDecisionIcon)||void 0===U?void 0:U.backgroundColor)||Z})}),e("span",{className:r.chevronWrapper,style:null===(B=null==C?void 0:C.Chevron)||void 0===B?void 0:B.wrapper,children:e(c,{color:(null===(F=null==C?void 0:C.Chevron)||void 0===F?void 0:F.color)||Q})})]})]})}),e("span",{ref:V,className:r[`upt-${null===(H=f.redlining_details)||void 0===H?void 0:H.status}`],onClick:e=>{e.preventDefault(),e.stopPropagation(),q.current&&(null==b||b(q.current,f))},children:h})]})};export{f as default};
2
2
  //# sourceMappingURL=InlineUpdatedComponent.js.map
@@ -1,2 +1,2 @@
1
- function e(e){try{return e}catch(e){console.error("Error in formatMarkdown",e)}}function r(e){return e.includes("Acceptance Criteria")?e=null==(e=null==(e=null==(e=null==e?void 0:e.replace(/\\n/g,"\n"))?void 0:e.replace(/(\*\*.+?\*\*)\s*:/g,"\n$1:\n"))?void 0:e.replace(/(?<!\d)(\d+(?:\.\d+)+)\./g,(e,r)=>{const n=r.split(".");return`${" ".repeat(n.length-1)}${r}.`}))?void 0:e.replace(/([^\n])\n(?![\n\*#])/g,"$1<br>\n"):e}const n=e=>{if(!e)return"";e=(e=(e=(e=(e=e.replace(/%&&%[\s\S]*?%&&%/g,"")).replace(/<!--[\s\S]*?-->/g,"")).replace(/<crredirection[^>]*>[\s\S]*?<\/crredirection>/gi,"")).replace(/<answerExample[^>]*>[\s\S]*?<\/answerExample>/gi,"")).replace(/<a\s+data-cognitive-reasoning[^>]*>[\s\S]*?<\/a>/gi,"");return["b","strong","i","em","u","ol","ul","li","p","div","span","h1","h2","h3","h4","h5","h6","highlight","br","hr"].forEach(r=>{const n=new RegExp(`</?${r}[^>]*>`,"gi");e=e.replace(n,"")}),e=(e=(e=(e=(e=e.replace("ð","")).replace(/\*\*/g,"")).replace(/\n/g," ")).replace(/\s+/g," ")).trim()},a=e=>{const r=(new DOMParser).parseFromString(e,"text/html");return Array.from(r.querySelectorAll('a[href^="ai_reasoning$"]')).map(e=>e.getAttribute("href").replace("ai_reasoning$",""))},t=e=>{const r=(new DOMParser).parseFromString(e,"text/html");return r.querySelectorAll('a[href^="ai_reasoning$"]').forEach(e=>{e.remove()}),r.body.innerHTML.trim()};export{a as extractAllAiReasoningIds,e as formatMarkdown,r as indentMarkdown,t as stripAiReasoningAnchors,n as stripHtmlAndMetadata};
1
+ function e(e){try{return e=null==e?void 0:e.replace(/(?<!\d)(\d+(?:\.\d+)+)\./g,(e,r)=>{const n=r.split(".");return`${" ".repeat(n.length-1)}${r}.`})}catch(e){console.error("Error in formatMarkdown",e)}}function r(e){return e.includes("Acceptance Criteria")?e=null==(e=null==(e=null==(e=null==e?void 0:e.replace(/\\n/g,"\n"))?void 0:e.replace(/(\*\*.+?\*\*)\s*:/g,"\n$1:\n"))?void 0:e.replace(/(?<!\d)(\d+(?:\.\d+)+)\./g,(e,r)=>{const n=r.split(".");return`${" ".repeat(n.length-1)}${r}.`}))?void 0:e.replace(/([^\n])\n(?![\n\*#])/g,"$1<br>\n"):e}const n=e=>{if(!e)return"";e=(e=(e=(e=(e=e.replace(/%&&%[\s\S]*?%&&%/g,"")).replace(/<!--[\s\S]*?-->/g,"")).replace(/<crredirection[^>]*>[\s\S]*?<\/crredirection>/gi,"")).replace(/<answerExample[^>]*>[\s\S]*?<\/answerExample>/gi,"")).replace(/<a\s+data-cognitive-reasoning[^>]*>[\s\S]*?<\/a>/gi,"");return["b","strong","i","em","u","ol","ul","li","p","div","span","h1","h2","h3","h4","h5","h6","highlight","br","hr"].forEach(r=>{const n=new RegExp(`</?${r}[^>]*>`,"gi");e=e.replace(n,"")}),e=(e=(e=(e=(e=e.replace("ð","")).replace(/\*\*/g,"")).replace(/\n/g," ")).replace(/\s+/g," ")).trim()},t=e=>{const r=(new DOMParser).parseFromString(e,"text/html");return Array.from(r.querySelectorAll('a[href^="ai_reasoning$"]')).map(e=>e.getAttribute("href").replace("ai_reasoning$",""))},a=e=>{const r=(new DOMParser).parseFromString(e,"text/html");return r.querySelectorAll('a[href^="ai_reasoning$"]').forEach(e=>{e.remove()}),r.body.innerHTML.trim()};export{t as extractAllAiReasoningIds,e as formatMarkdown,r as indentMarkdown,a as stripAiReasoningAnchors,n as stripHtmlAndMetadata};
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,oBAAoB,+CA4MzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAOA,QAAA,MAAM,oBAAoB,+CA8MzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}