@viswa-test/test-citation 0.0.234 → 0.0.236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRenderer.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
- package/dist/cjs/utils/tagHelper.js +2 -0
- package/dist/cjs/utils/tagHelper.js.map +1 -0
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CitationRenderer.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -0
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
- package/dist/types/src/CitationAccordionTest.d.ts +1 -0
- package/dist/types/src/CitationAccordionTest.d.ts.map +1 -0
- package/dist/types/src/DeviationSummaryTest.d.ts.map +1 -1
- package/dist/types/src/MockDeviationSummary.d.ts +1 -0
- package/dist/types/src/MockDeviationSummary.d.ts.map +1 -0
- package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
- package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts +2 -0
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +9 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +2 -0
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +27546 -1239
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +6 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +25 -6
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.d.ts +7 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +7 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +8 -2
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.d.ts +1 -0
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts +3 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
- package/dist/types/src/utils/tagHelper.d.ts +5 -0
- package/dist/types/src/utils/tagHelper.d.ts.map +1 -0
- package/dist/utils/tagHelper.js +2 -0
- package/dist/utils/tagHelper.js.map +1 -0
- package/package.json +5 -5
- package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
- package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useRef as r,useState as i,useEffect as n}from"react";import{LexicalComposer as l}from"@lexical/react/LexicalComposer";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{OnChangePlugin as s}from"@lexical/react/LexicalOnChangePlugin";import{TabIndentationPlugin as u}from"@lexical/react/LexicalTabIndentationPlugin";import{ListNode as m,ListItemNode as c}from"@lexical/list";import{ListPlugin as d}from"@lexical/react/LexicalListPlugin";import{LinkPlugin as p}from"@lexical/react/LexicalLinkPlugin";import{LinkNode as f}from"@lexical/link";import{QuoteNode as g,HeadingNode as x}from"@lexical/rich-text";import{TablePlugin as h}from"@lexical/react/LexicalTablePlugin";import{TableNode as C,TableRowNode as v,TableCellNode as y}from"@lexical/table";import{KEY_DOWN_COMMAND as
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useRef as r,useState as i,useEffect as n}from"react";import{LexicalComposer as l}from"@lexical/react/LexicalComposer";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{OnChangePlugin as s}from"@lexical/react/LexicalOnChangePlugin";import{TabIndentationPlugin as u}from"@lexical/react/LexicalTabIndentationPlugin";import{ListNode as m,ListItemNode as c}from"@lexical/list";import{ListPlugin as d}from"@lexical/react/LexicalListPlugin";import{LinkPlugin as p}from"@lexical/react/LexicalLinkPlugin";import{LinkNode as f}from"@lexical/link";import{QuoteNode as g,HeadingNode as x}from"@lexical/rich-text";import{TablePlugin as h}from"@lexical/react/LexicalTablePlugin";import{TableNode as C,TableRowNode as v,TableCellNode as y}from"@lexical/table";import{KEY_DOWN_COMMAND as S,$getSelection as b,$isRangeSelection as j,COMMAND_PRIORITY_CRITICAL as T,TextNode as E,$isTextNode as N}from"lexical";import"./components/EditorToolbar/components/ToolbarButton/ToolbarButton.css.js";import{useRequirementAI as B}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import P from"./components/EditorContainer/EditorContainer.js";import L from"./components/EditorToolbar/EditorToolbar.js";import{LayoutPlugin as k}from"./plugins/LayoutPlugin.js";import I from"./theme/theme.js";import"./theme/theme.css.js";import"./Editor.css.js";import _ from"./components/Context/ContextMenu.js";import{MarkNode as H}from"@lexical/mark";import w from"./plugins/CommentPlugin/HTMLNode.js";import{DEFAULT_TOOLBAR_CONFIG as D}from"./constants/editorConfig.js";import{InitialHtml as M}from"./plugins/InitialHtml.js";import{InsertNode as R}from"./plugins/InsertNode.js";import{DeleteNode as A}from"./plugins/DeleteNode.js";import{HighlightSpanNode as F,HighlightButtonNode as W}from"./plugins/HighlightNode.js";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext";import{UpdateNode as O}from"./plugins/UpdateNode.js";import{ManualNode as V}from"./plugins/ManualNode.js";import{PreservedNode as U}from"./plugins/PreservedNode.js";import{InvisibleNode as X}from"./plugins/InvisibleNode.js";function Y(e){console.log(e)}function $({onEditBlocked:e}){const[t]=q();return n(()=>{const o=e=>{let t=e;for(;t;){if(["preserved","insert","delete"].includes(t.getType()))return t;if(["update","manual"].includes(t.getType())&&t.getStatus()&&"pending"===t.getStatus())return t;t=t.getParent()}return!1};function r(e){let t=e;for(;t;){if((t instanceof O||t instanceof V)&&"pending"===t.getStatus())return t.getId();t=t.getParent()}return null}return t.registerCommand(S,t=>{const i=b();if(!j(i))return!1;const n=i.getNodes().find(e=>!!o(e));if(n)return t.preventDefault(),null==e||e(r(n)||""),!0;if(i.isCollapsed()){const n=i.anchor.getNode(),l=o(n);if(l){const o=l?r(l):"";return null==e||e(o||""),t.preventDefault(),!0}if("Backspace"===t.key){const o=n.getPreviousSibling(),l=o&&(["delete","insert","preserved"].includes(o.getType())||["update","manual"].includes(o.getType())&&o.getStatus()&&"pending"===o.getStatus())?o:null;if(0===i.anchor.offset&&l)return null==e||e(r(l)||""),t.preventDefault(),!0}else if("Delete"===t.key){const o=n.getNextSibling(),l=o&&(["delete","insert","preserved"].includes(o.getType())||["update","manual"].includes(o.getType())&&o.getStatus()&&"pending"===o.getStatus())?o:null,a=n.getTextContent().length;if(i.anchor.offset===a&&l)return null==e||e(r(l)||""),t.preventDefault(),!0}}return!1},T)},[t]),null}function z({minHeight:n,height:S,placeholder:T,onFocus:q,onBlur:z,onChange:G,onToolbarButtonClick:J,toolbarConfig:K=D,editorRef:Q,editorState:Z,initialString:ee,customToolbar:te,plugins:oe,nodes:re,dynamicHeight:ie,artifactContext:ne,commentsPanelState:le,mode:ae,doNotShowBorderInViewMode:se,onEditBlocked:ue}){var me,ce,de;const pe=r(null),fe={namespace:"MyEditor",theme:I,onError:Y,nodes:[E,m,c,f,g,x,C,v,y,H,w,R,A,O,U,V,X,F,W],editorState:Z},[ge,xe]=i(null),[he,Ce]=i(!1),{customStyles:ve}=B(),ye=e=>{var t;null===(t=Q.current)||void 0===t||t.update(()=>{const t=b();j(t)&&t.getNodes().forEach(t=>{N(t)&&t.setStyle(`color: ${e}`)})})};return document.getElementById("lexical_editor_wrapper"),e(t,{children:[(null===(me=null==ve?void 0:ve.textEditorStyles)||void 0===me?void 0:me.themeStyles)&&o("style",{children:null===(ce=null==ve?void 0:ve.textEditorStyles)||void 0===ce?void 0:ce.themeStyles}),e("div",{ref:pe,className:"w-full lexical_editor_wrapper "+(se&&"readOnly"===ae?"":"lexical_editor_wrapper_box"),id:"lexical_editor_wrapper",onContextMenu:e=>{var t;e.preventDefault(),null===(t=Q.current)||void 0===t||t.update(()=>{const t=b();j(t)&&!t.isCollapsed()?(Ce(!0),xe({x:e.clientX,y:e.clientY})):(Ce(!1),xe(null))})},style:{minHeight:n,height:S,...null===(de=null==ve?void 0:ve.textEditorStyles)||void 0===de?void 0:de.textArea},children:[e(l,{initialConfig:fe,children:[" ","edit"===ae&&o($,{onEditBlocked:ue}),"edit"===ae&&o(L,{onToolbarButtonClick:J,editorWrapperRef:pe,toolbarConfig:K,customToolbar:te,editorRef:Q}),o(P,{placeholder:T}),o(u,{}),o(a,{}),o(d,{}),o(p,{}),o(h,{}),o(k,{onFocus:q,onBlur:z,editorRef:Q}),o(s,{ignoreSelectionChange:!0,ignoreHistoryMergeTagChange:!0,onChange:(e,t,o)=>{G&&G(e,t,o)}}),ee&&o(M,{initialValue:ee.value,initialFormat:ee.type,mode:ae}),oe&&oe]}),ge&&he&&"edit"===ae&&o(_,{position:ge,options:[{label:"Change Color to Red",action:()=>ye("red")},{label:"Change Color to Blue",action:()=>ye("blue")}],onClose:()=>{xe(null)}})]})]})}export{z as default};
|
|
2
2
|
//# sourceMappingURL=Editor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useEffect as
|
|
1
|
+
import{useEffect as r}from"react";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{$generateNodesFromDOM as e}from"@lexical/html";import{$getRoot as o,$isParagraphNode as a}from"lexical";import i from"showdown";import{escapeTagIds as l,splitTagAcrossParagraphs as m}from"../../../../../../utils/tagHelper.js";const n=({initialValue:n,initialFormat:p,mode:c})=>{const[s]=t();return r(()=>{if(n){if(n=(()=>{let r=l(n,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(t=>{r=m(r,t)}),r})(),p&&"html"!==p){var r=new i.Converter;n=r.makeHtml(n)}s.update(()=>{const r=o();r.clear();const t=(new DOMParser).parseFromString(n||"","text/html");e(s,t).forEach(t=>{try{a(t)&&t.setFormat("justify"),r.append(t)}catch(r){console.error("Error appending node to root: ",r)}})})}},[n,s]),r(()=>{s.setEditable("edit"===c)},[s,c]),null};export{n as InitialHtml};
|
|
2
2
|
//# sourceMappingURL=InitialHtml.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ElementNode as t}from"lexical";class s extends t{static getType(){return"manual"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("manual");return t.id=this.__id,t.className=`PlaygroundEditorTheme__manual-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("manual");return t.id=this.__id,{element:t}}updateDOM(t,s){return t.__id!==this.__id&&(s.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{manual:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"manual",version:1,id:this.__id,status:this.__status}}
|
|
1
|
+
import{ElementNode as t}from"lexical";class s extends t{static getType(){return"manual"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("manual");return t.dataset.id=this.__id,t.className=`PlaygroundEditorTheme__manual-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("manual");return t.id=this.__id,t.dataset.status=this.__status,{element:t}}updateDOM(t,s){return t.__id!==this.__id&&(s.dataset.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{manual:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"manual",version:1,id:this.__id,status:this.__status}}canInsertTextBefore(){return"pending"!==this.__status}canInsertTextAfter(){return"pending"!==this.__status}}function e(t){var e;return{node:new s(t.id||crypto.randomUUID(),null!==(e=t.dataset.status)&&void 0!==e?e:"")}}export{s as ManualNode};
|
|
2
2
|
//# sourceMappingURL=ManualNode.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ElementNode as t}from"lexical";class s extends t{static getType(){return"update"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("upt");return t.id=this.__id,t.className=`PlaygroundEditorTheme__update-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("upt");return t.id=this.__id,{element:t}}updateDOM(t,s){return t.__id!==this.__id&&(s.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{upt:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"update",version:1,id:this.__id,status:this.__status}}
|
|
1
|
+
import{ElementNode as t}from"lexical";class s extends t{static getType(){return"update"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("upt");return t.dataset.id=this.__id,t.className=`PlaygroundEditorTheme__update-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("upt");return t.id=this.__id,t.dataset.status=this.__status,{element:t}}updateDOM(t,s){return t.__id!==this.__id&&(s.dataset.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{upt:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"update",version:1,id:this.__id,status:this.__status}}canInsertTextBefore(){return"pending"!==this.__status}canInsertTextAfter(){return"pending"!==this.__status}}function e(t){var e;return{node:new s(t.id||crypto.randomUUID(),null!==(e=t.dataset.status)&&void 0!==e?e:"")}}export{s as UpdateNode};
|
|
2
2
|
//# sourceMappingURL=UpdateNode.js.map
|
|
@@ -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__highlight-button{display:none}.PlaygroundEditorTheme__insert-node{background-color:#8cbeff;text-decoration:none}.PlaygroundEditorTheme__delete-node{background-color:#fff;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{background-color:#fff;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};
|
|
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
|
|
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 l}from"react";import{DEFAULT_TOOLBAR_CONFIG as i}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]),l(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 l=t.turndown(r.innerHTML);a.forEach((e,t)=>{l=l.replace(t,e)});const i=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),c=e.tagName.toLowerCase();return i?`<${c} ${i}>${l}</${c}>`:`<${c}>${l}</${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 l=[];["manual","upt"].forEach(e=>{r.querySelectorAll(e).forEach((e,t)=>{l.push(o(e,f)),e.replaceWith(r.createTextNode(`%%REVIEW_${l.length-1}%%`))})});const i=[];r.querySelectorAll("table").forEach((e,t)=>{i.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let c=f.turndown(r.body.innerHTML);for(let e=l.length-1;e>=0;e--)c=c.replace(`%%REVIEW\\_${e}%%`,` ${l[e]} `);a.forEach((e,t)=>{c=c.replace(new RegExp(`%%INVISIBLE\\\\*_${t}%%`,"g"),` ${e} `)}),i.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:i,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};
|
|
2
2
|
//# sourceMappingURL=RichTextEditor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i,Fragment as a}from"react/jsx-runtime";import c,{memo as n,useMemo as t}from"react";import l from"../Popups/PopupDefaults.js";import r from"react-markdown";import d from"rehype-raw";import s from"./CitationComponent.module.css.js";import{ChevronUp as o}from"lucide-react";import{ReactComponent as m}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as p}from"../icons/aiMagic.svg.js";import _ from"./CitationAnchor.js";import{resolveRedline as h}from"../../../../../service/redlineService.js";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const u=({text:e,item:a})=>i(r,{rehypePlugins:[d],components:{ol:({children:e})=>i("ol",{className:s["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:s["md-ul"],children:e}),li:({children:e})=>i("li",{className:s["md-li"],children:e}),a:({node:e,href:c,children:n})=>i(_,{href:c,children:n,metaData:{citations:a.citations,docData:a.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")});var N=n(function({item:n,title:r="Cognitive Decisioning AI",relevanceScore:d=0,showRelevanceScore:_=!0,reason:N="No reasoning provided.",impact:b="No Impact provided.",explaination:y="No explaination provided.",gap:f="None",onClose:g=()=>{},onActionTrigger:x,showResolveBtns:I=!1,sections:C,leftIcon:A,scoreIcon:k,className:R,customStyles:j={},actions:B,disableAllActions:D=!1,actionBtnDisabledStyle:H={},onBackClick:$,isImpactNeeded:T=!0,cognitiveTitle:w="Cognitive Integrity",labels:L={},redlineId:S,aiReasonId:P}){const E=t(()=>{const e=Number(d);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[d]),M=t(()=>{const e=L&&L.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(f)?e:f},[f]),q=L&&L.impact||"Impact",G=L&&L.explanation||"Explaination",F=L&&L.decisionFactors||"Decision Making Factors",U=L&&L.gaps||"Gaps in Decision",W=L&&L.accept||"Accept",z=L&&L.reject||"Reject",J=L&&L.backAriaLabel||"Go back",{redlineDcoumentId:K,redlineConfig:O,updateRedlineDataParent:Q}=v(),V=async e=>{var i,a;null==x||x({status:"loading",action:e,metadata:{redlineId:S,aiReasonId:P}});try{const{updated_reqai:c}=await h({documentId:K,userEmail:null==O?void 0:O.userEmail,userName:null==O?void 0:O.userName,redlineId:null!=S?S:"",action:e,baseApiUrl:null==O?void 0:O.baseApiUrl,redlineConfigId:null!==(i=null==O?void 0:O.redlineConfigId)&&void 0!==i?i:""},null!==(a=null==O?void 0:O.token)&&void 0!==a?a:"");await(null==Q?void 0:Q(c)),null==x||x({status:"success",action:e,metadata:{redlineId:S,aiReasonId:P}})}catch(
|
|
1
|
+
import{jsxs as e,jsx as i,Fragment as a}from"react/jsx-runtime";import c,{memo as n,useMemo as t}from"react";import l from"../Popups/PopupDefaults.js";import r from"react-markdown";import d from"rehype-raw";import s from"./CitationComponent.module.css.js";import{ChevronUp as o}from"lucide-react";import{ReactComponent as m}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as p}from"../icons/aiMagic.svg.js";import _ from"./CitationAnchor.js";import{resolveRedline as h}from"../../../../../service/redlineService.js";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const u=({text:e,item:a})=>i(r,{rehypePlugins:[d],components:{ol:({children:e})=>i("ol",{className:s["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:s["md-ul"],children:e}),li:({children:e})=>i("li",{className:s["md-li"],children:e}),a:({node:e,href:c,children:n})=>i(_,{href:c,children:n,metaData:{citations:a.citations,docData:a.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")});var N=n(function({item:n,title:r="Cognitive Decisioning AI",relevanceScore:d=0,showRelevanceScore:_=!0,reason:N="No reasoning provided.",impact:b="No Impact provided.",explaination:y="No explaination provided.",gap:f="None",onClose:g=()=>{},onActionTrigger:x,showResolveBtns:I=!1,sections:C,leftIcon:A,scoreIcon:k,className:R,customStyles:j={},actions:B,disableAllActions:D=!1,actionBtnDisabledStyle:H={},onBackClick:$,isImpactNeeded:T=!0,cognitiveTitle:w="Cognitive Integrity",labels:L={},redlineId:S,aiReasonId:P}){const E=t(()=>{const e=Number(d);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[d]),M=t(()=>{const e=L&&L.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(f)?e:f},[f]),q=L&&L.impact||"Impact",G=L&&L.explanation||"Explaination",F=L&&L.decisionFactors||"Decision Making Factors",U=L&&L.gaps||"Gaps in Decision",W=L&&L.accept||"Accept",z=L&&L.reject||"Reject",J=L&&L.backAriaLabel||"Go back",{redlineDcoumentId:K,redlineConfig:O,updateRedlineDataParent:Q}=v(),V=async e=>{var i,a;null==x||x({status:"loading",action:e,metadata:{redlineId:S,aiReasonId:P}});try{const{updated_reqai:c}=await h({documentId:K,userEmail:null==O?void 0:O.userEmail,userName:null==O?void 0:O.userName,redlineId:null!=S?S:"",action:e,baseApiUrl:null==O?void 0:O.baseApiUrl,redlineConfigId:null!==(i=null==O?void 0:O.redlineConfigId)&&void 0!==i?i:""},null!==(a=null==O?void 0:O.token)&&void 0!==a?a:"");await(null==Q?void 0:Q(c)),null==x||x({status:"success",action:e,metadata:{redlineId:S,aiReasonId:P}})}catch(i){null==x||x({status:"failed",action:e,metadata:{redlineId:S,aiReasonId:P}})}},X=B||[{id:"reject",label:z,onClick:()=>V("reject"),className:s["btn-reject"]},{id:"accept",label:W,onClick:()=>V("accept"),className:s["btn-accept"]}];return e("div",{className:`${s["cite-acc"]} ${R||""}`,style:{...l.CitationAccordionDefaults.container,...null==j?void 0:j.container},children:[$&&e("div",{className:s["cite-acc__backHeader"],children:[i("button",{type:"button",className:s["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),$&&$()},"aria-label":J,children:"‹"}),i("span",{className:s["cite-acc__backTitle"],children:w})]}),i("div",{className:s["cite-body"],children:C&&C.length>0?C.map(a=>!1===a.show?null:e("div",{className:`${s["cite-acc__explain-body"]} ${a.bodyClassName||""}`,children:[e("div",{className:s["cite-acc__innerHeader"],style:{...l.CitationAccordionDefaults.innerHeader,...null==j?void 0:j.innerHeader},children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:a.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),g&&g()},children:i(o,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...l.CitationAccordionDefaults.innerBody,...null==j?void 0:j.innerBody},children:"string"==typeof a.content?i(u,{text:a.content,item:a.item||n||{}}):a.content})]},a.id||a.title)):e(a,{children:[T&&e("div",{className:s["cite-acc__explain-body"],children:[e("div",{className:s["cite-acc__innerHeader"],children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:q})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),g&&g()},children:i(o,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:b||"",item:n||{}})})]}),e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:G})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:y||"",item:{}})})]}),I&&i("div",{className:s["cite-acc__btn-container"],children:X.map(e=>{const a=D||e.disabled;return i("button",{className:e.className,onClick:a?void 0:e.onClick,disabled:a,style:{...e.style,...a?{opacity:.5,cursor:"not-allowed",...H,...e.disabledStyle}:{}},children:e.label},e.id)})}),e("div",{className:s["cite-acc__header"],children:[e("div",{className:s["cite-acc__headerLeft"],children:[i("span",{className:s["cite-acc__titleIcon"],children:A?"function"==typeof A?c.createElement(A):A:i(m,{})}),i("div",{className:s["cite-acc__title"],children:r})]}),i("div",{className:s["cite-acc__headerRight"],children:_&&e("span",{className:s["cite-acc__scoreBadge"],children:[k?"function"==typeof k?c.createElement(k):k:i(p,{}),e("span",{className:s["cite-acc__scoreText"],children:[E,"%"]})]})})]}),e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:F})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:N||"",item:n||{}})})]}),e("div",{className:`${s["cite-acc__explain-body"]} ${s["cite-acc__explain-body_border"]}`,children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:U})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:M||"",item:n||{}})})]})]})})]})},(e,i)=>e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&(e.relevanceScore===i.relevanceScore&&(e.reason===i.reason&&(e.impact===i.impact&&(e.explaination===i.explaination&&e.gap===i.gap)))))));export{N as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveComponent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i,Fragment as n}from"react/jsx-runtime";import{PenLine as o,CheckCircle as l,XCircle as t,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import{memo as s,useState as c}from"react";import{ToneToggle as p}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as g}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as v}from"../icons/aiMagic.svg.js";import{Tooltip as u}from"@mui/material";import{useRequirementAI as m}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as y}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as h}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";const x=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],f=({toneIndex:n,configs:o=x})=>{const l=Math.min(n,o.length-1),{color:t,angle:r,arcD:d}=o[l]||o[1]||o[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return e("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[i("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),i("path",{d:d,stroke:t,strokeWidth:"2.5",strokeLinecap:"round"}),i("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:t,strokeWidth:"2",strokeLinecap:"round"})]})},S=({type:e,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},l=o[e]||o.Medium;return i("div",{style:l,children:e})},b=["Lenient","Balanced","Aggressive"],I={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},C={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},k={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},w={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},B={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},T={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},R={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"},z={display:"flex",gap:8,marginBottom:18},j={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},L={borderTop:"0.5px solid #eee",padding:"14px 0px"},M={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},H={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"},N={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},U={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%"},q={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},$=s(function({onAssignClick:n,onOpenCognitive:o,cognitiveIconSmall:l,cognitiveTootipTitle:t,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return e("div",{style:{...q,minWidth:"200px"},children:[e("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:n,children:[i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:e("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:[i("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),i("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),i("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),i("circle",{cx:"9",cy:"7",r:"4"})]})}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),o&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>o(e),children:[l&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:l}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t})]}),d&&e("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&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}),G=s(function({onAssignClick:n,onOpenCognitive:o,cognitiveIconSmall:l,cognitiveTootipTitle:t,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[s,p]=c(!1);return e("div",{style:{position:"relative",display:"flex"},children:[i("button",{onClick:()=>p(!s),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},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",children:[i("circle",{cx:"12",cy:"12",r:"1"}),i("circle",{cx:"12",cy:"5",r:"1"}),i("circle",{cx:"12",cy:"19",r:"1"})]})}),s&&i($,{onAssignClick:n?()=>{p(!1),n&&n()}:void 0,onOpenCognitive:o?e=>{p(!1),o&&o(e)}:void 0,cognitiveIconSmall:l,cognitiveTootipTitle:t,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}),V=s(function({users:n,onClick:o}){const l=n.length;return e("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:[i("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]}),l>1&&e("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",l-1]})]})});var J=s(function({onClose:s,aiReason:q,onActionTrigger:$,onIterate:J,initialTone:K,onRegenerate:Q,labels:X={},toneLevelsConfig:Y=b,toneColorsConfig:Z=I,dialConfigs:ee=x,actions:ie,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:le={},customIcons:te={},onOpenCognitive:re,onHistoryClick:de,historyIconSmall:ae,historyTootipTitle:se,showTone:ce=!0,cognitiveSectionStyle:pe={},cognitiveScoreBadgeStyle:ge={},cognitiveScoreTextStyle:ve={},cognitiveStyles:ue={},cognitiveClassNames:me={},cognitiveTitle:ye="Cognitive Integrity",cognitiveTootipTitle:he="Cognitive Decisioning",cognitiveLeftIcon:xe,cognitiveIconSmall:fe,showCognitiveRightArrow:Se=!0,isStreaming:be,onAssignClick:Ie,assignedUsers:Ce,onReviewUsersClick:ke,redlineId:we,aiReasonId:Be}){var Te,Ae,Re,De,Ee,ze,je,We,Le,Me,He,_e,Fe,Ne,Ue,Oe,Pe,qe,$e;let Ge=Y.findIndex(e=>e===K);-1===Ge&&(Ge=1);const[Ve,Je]=c(!0),[Ke,Qe]=c(!1),[Xe,Ye]=c(!1),[Ze,ei]=c(Ge),[ii]=c(Ge),ni=Y[Ze],oi=Z[ni]||"#BA7517",li=Ze!==ii,ti=[{id:"iterate",icon:te.iterateIcon||i(o,{size:16,color:"#64748B"}),label:X.btnIterate||"Iterate",color:"#64748B",onClick:J},{id:"accept",icon:te.acceptIcon||i(l,{size:16,color:"#10B981"}),label:X.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:te.rejectIcon||i(t,{size:16,color:"#DC2626"}),label:X.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:ri,redlineConfig:di,updateRedlineDataParent:ai}=m(),si=ie||ti;return e("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(Te=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Te?void 0:Te.root},children:[e("div",{style:{...k,...null===(Ae=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.header,marginBottom:Xe?"16px":"12px"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i("span",{children:te.summaryIcon||i(r,{size:16,color:"#E24B4A"})}),i("span",{style:{...w,...null===(Re=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Re?void 0:Re.title},children:X.summaryHeader||"Summary"})]}),Ce&&Ce.length>0&&i(V,{users:Ce,onClick:e=>{e.stopPropagation(),null==ke||ke()}})]}),e("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(Ie||re)&&i(G,{onAssignClick:Ie,onOpenCognitive:re,cognitiveIconSmall:fe,cognitiveTootipTitle:he,historyIconSmall:ae,onHistoryClick:de,historyTootipTitle:se}),i("button",{onClick:s,style:{...W,...null===(De=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===De?void 0:De.closeBtn,color:"#64748B"},children:"✕"})]})]}),i(u,{title:null===(Ee=null==q?void 0:q.redlining_details)||void 0===Ee?void 0:Ee.redline_title,children:i("p",{style:{...B,...null===(ze=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ze?void 0:ze.bodyText},children:null===(je=null==q?void 0:q.redlining_details)||void 0===je?void 0:je.redline_title})}),i("p",{style:{...T,...null===(We=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===We?void 0:We.summary},children:null===(Le=null==q?void 0:q.redlining_details)||void 0===Le?void 0:Le.redline_summary}),e("div",{style:{...A,...null===(Me=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Me?void 0:Me.impactContainer},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{onClick:()=>Je(!Ve),style:{...D,...null===(He=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===He?void 0:He.impactToggle},children:[i("span",{style:{...E,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.impactToggleLabel},children:X.impactHeader||"Impact"}),i("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ve?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#E24B4A"})})]}),i(S,{type:(null==q?void 0:q.severity)||"Medium",customStyles:le})]}),Ve&&i(n,{children:i("div",{style:{...R,...null===(Fe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.impactText},children:i(h,{message:`${null!==(Ue=null===(Ne=null==q?void 0:q.redlining_details)||void 0===Ne?void 0:Ne.redline_impact)&&void 0!==Ue?Ue:X.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Oe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.impactMarkdown})})})]}),i("div",{style:{...z,...null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.actionContainer},children:si.map(i=>{var n,o;const l=ne||i.disabled,t=l?{cursor:"not-allowed",opacity:.5,...null===(n=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...i.disabledStyle}:{};return e("button",{style:{...j,...null===(o=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:i.color,...i.style,...t},onClick:l?void 0:()=>{var e;i.useLabel?(async e=>{var i,n,o;null==$||$({status:"loading",action:e,metadata:{redlineId:we,aiReasonId:Be}});try{const{updated_reqai:l}=await y({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(l)),null==$||$({status:"success",action:e,metadata:{redlineId:we,aiReasonId:Be}})}catch(e){null==$||$({status:"failed",action:null,metadata:{redlineId:we,aiReasonId:Be}})}})(i.id.toLowerCase()):null===(e=i.onClick)||void 0===e||e.call(i)},disabled:l,children:[i.icon,i.label]},i.id)})}),ce&&e("div",{style:{...L,...null===(qe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===qe?void 0:qe.toneContainer},children:[e("button",{onClick:()=>Qe(!Ke),style:{...M,...null===($e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===$e?void 0:$e.toneToggleBtn},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i(f,{toneIndex:Ze,configs:ee}),i("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:X.toneHeader||"Redline Tone"})]}),i("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ke?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#111"})})]}),Ke&&e(n,{children:[i("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:X.toneDescription||"Controls how assertively AI is redlining"}),i(p,{isDirty:li,onToneChange:e=>{ei(e)},toneColor:oi,toneIndex:Ze,onClickRegenerate:()=>null==Q?void 0:Q(ni),toneLabels:Y,isStreaming:be,aiReason:q})]})]}),re&&e("div",{className:null==me?void 0:me.section,onClick:e=>{e.stopPropagation(),re&&re(e)},style:{...H,...null==ue?void 0:ue.section,...pe},children:[e("div",{className:null==me?void 0:me.headerLeft,style:{..._,...null==ue?void 0:ue.headerLeft},children:[i("span",{className:null==me?void 0:me.titleIcon,style:{...F,...null==ue?void 0:ue.titleIcon},children:null!=xe?xe:i(g,{})}),i("div",{className:null==me?void 0:me.cognitiveTitle,style:{...N,...null==ue?void 0:ue.cognitiveTitle},children:ye})]}),e("div",{className:null==me?void 0:me.headerRight,style:{...U,...null==ue?void 0:ue.headerRight},children:[void 0!==(null==q?void 0:q.relevance_score)&&null!==(null==q?void 0:q.relevance_score)?e("span",{className:null==me?void 0:me.scoreBadge,style:{...O,...null==ue?void 0:ue.scoreBadge,...ge},children:[i(v,{}),e("span",{className:null==me?void 0:me.scoreText,style:{...P,...null==ue?void 0:ue.scoreText,...ve},children:[Math.round(Number(q.relevance_score)),"%"]})]}):null,Se&&i("span",{style:{display:"flex",alignItems:"center"},children:i(a,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var n,o,l,t,r,d,a,s,c,p;return e.isStreaming===i.isStreaming&&(e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&((null===(n=e.aiReason)||void 0===n?void 0:n.id)===(null===(o=i.aiReason)||void 0===o?void 0:o.id)&&((null===(l=e.aiReason)||void 0===l?void 0:l.resolving)===(null===(t=i.aiReason)||void 0===t?void 0:t.resolving)&&((null===(d=null===(r=e.aiReason)||void 0===r?void 0:r.redlining_details)||void 0===d?void 0:d.status)===(null===(s=null===(a=i.aiReason)||void 0===a?void 0:a.redlining_details)||void 0===s?void 0:s.status)&&((null===(c=e.assignedUsers)||void 0===c?void 0:c.length)===(null===(p=i.assignedUsers)||void 0===p?void 0:p.length)&&(!e.assignedUsers||!i.assignedUsers||e.assignedUsers.join(",")===i.assignedUsers.join(",")))))))))});export{$ as AssignMenu,V as DisplayUsers,G as KebabMenu,J as default};
|
|
1
|
+
import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import{PenLine as n,CheckCircle as o,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import s,{memo as c,useState as p}from"react";import{ToneToggle as g}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as h}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as u}from"../icons/aiMagic.svg.js";import{Tooltip as v}from"@mui/material";import{useRequirementAI as m}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as x}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as f}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"}],w=({toneIndex:t,configs:n=y})=>{const o=Math.min(t,n.length-1),{color:l,angle:r,arcD:d}=n[o]||n[1]||n[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return e("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[i("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),i("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),i("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},S=({type:e,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[e]||n.Medium;return i("div",{style:o,children:e})},b=["Lenient","Balanced","Aggressive"],k={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"},B={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},T={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},A={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},E={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},R={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},W={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},L={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},z={display:"flex",gap:8,marginBottom:18},j={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"},F={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},D={borderTop:"0.5px solid #eee",padding:"14px 0px"},M={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},H={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"},O={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},N={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},P={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},$={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},V={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},q=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return e("div",{style:{...U,minWidth:"200px"},children:[e("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:t,children:[i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:e("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:[i("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),i("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),i("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),i("circle",{cx:"9",cy:"7",r:"4"})]})}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),n&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>n(e),children:[o&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:o}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]}),d&&e("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&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}),G=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[s,c]=p(!1);return e("div",{style:{position:"relative",display:"flex"},children:[i("button",{onClick:()=>c(!s),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},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",children:[i("circle",{cx:"12",cy:"12",r:"1"}),i("circle",{cx:"12",cy:"5",r:"1"}),i("circle",{cx:"12",cy:"19",r:"1"})]})}),s&&i(q,{onAssignClick:t?()=>{c(!1),t&&t()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}),J=c(function({users:t,onClick:n}){const o=t.length;return e("div",{onClick:n,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[i("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==t?void 0:t[0].length)>9?(null==t?void 0:t[0].slice(0,9))+"...":null==t?void 0:t[0]}),o>1&&e("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})}),K=c(function({steps:t}){if(!(null==t?void 0:t.length))return null;const n=t.length>=3;return i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:n?"6px 8px":"8px 10px",background:"#F8FAFC",gap:n?4:8,overflow:"hidden"},children:t.map((o,l)=>{const r=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(l),d=l===t.length-1;return e(s.Fragment,{children:[e("div",{title:o.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:n?4:6,overflow:"hidden"},children:[(a=o.status,e("svg","approved"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),i("polyline",{points:"22 4 12 14.01 9 11.01"})]}:"rejected"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"m15 9-6 6"}),i("path",{d:"m9 9 6 6"})]}:{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),i("span",{style:{minWidth:0,color:"#475569",fontSize:n?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.initials&&i("span",{style:{width:n?20:22,height:n?20:22,minWidth:n?20:22,borderRadius:"50%",background:r.bg,color:r.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:n?9:10,fontWeight:700,lineHeight:1},children:o.initials})]}),!d&&e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"18",height:n?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:n?14:18},children:[i("path",{d:"M5 12h14"}),i("path",{d:"m12 5 7 7-7 7"})]})]},o.id);var a})})})});var Q=c(function({onClose:s,aiReason:c,onActionTrigger:U,onIterate:q,initialTone:Q,onRegenerate:X,labels:Y={},toneLevelsConfig:Z=b,toneColorsConfig:ee=k,dialConfigs:ie=y,actions:te,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:le={},customIcons:re={},onOpenCognitive:de,onHistoryClick:ae,historyIconSmall:se,historyTootipTitle:ce,showTone:pe=!0,cognitiveSectionStyle:ge={},cognitiveScoreBadgeStyle:he={},cognitiveScoreTextStyle:ue={},cognitiveStyles:ve={},cognitiveClassNames:me={},cognitiveTitle:xe="Cognitive Integrity",cognitiveTootipTitle:fe="Cognitive Decisioning",cognitiveLeftIcon:ye,cognitiveIconSmall:we,showCognitiveRightArrow:Se=!0,isStreaming:be,onAssignClick:ke,assignedUsers:Ce,onReviewUsersClick:Ie,redlineId:Be,aiReasonId:Te,displayVariant:Ae="default",reviewTitle:Ee,reviewSubtitle:Re,reviewStatusIcon:We=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:Le=[],showReviewProgress:ze=!1,showOriginalText:je=!1,originalText:Fe,originalTextHeader:De="Original text",hideSummaryText:Me=!1,hideSeverityChip:He=!1}){var _e,Oe,Ne,Pe,$e,Ve,Ue,qe,Ge,Je,Ke,Qe,Xe,Ye,Ze,ei,ii,ti,ni,oi;let li=Z.findIndex(e=>e===Q);-1===li&&(li=1);const[ri,di]=p(!0),[ai,si]=p(!1),[ci,pi]=p(!1),[gi,hi]=p(li),[ui]=p(li),[vi,mi]=p(!0),xi="review"===Ae,fi=Z[gi],yi=ee[fi]||"#BA7517",wi=gi!==ui,Si=[{id:"iterate",icon:re.iterateIcon||i(n,{size:16,color:"#64748B"}),label:Y.btnIterate||"Iterate",color:"#64748B",onClick:q},{id:"accept",icon:re.acceptIcon||i(o,{size:16,color:"#10B981"}),label:Y.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:re.rejectIcon||i(l,{size:16,color:"#DC2626"}),label:Y.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:bi,redlineConfig:ki,updateRedlineDataParent:Ci}=m(),Ii=async e=>{var i,t,n;null==U||U({status:"loading",action:e,metadata:{redlineId:Be,aiReasonId:Te}});try{const{updated_reqai:o}=await x({documentId:bi,userEmail:null==ki?void 0:ki.userEmail,userName:null==ki?void 0:ki.userName,redlineId:null!==(i=null==c?void 0:c.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==ki?void 0:ki.baseApiUrl,redlineConfigId:null!==(t=null==ki?void 0:ki.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==ki?void 0:ki.token)&&void 0!==n?n:"");await(null==Ci?void 0:Ci(o)),null==U||U({status:"success",action:e,metadata:{redlineId:Be,aiReasonId:Te}})}catch(i){null==U||U({status:"failed",action:e,metadata:{redlineId:Be,aiReasonId:Te}})}},Bi=te||Si;return e("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.root},children:[e("div",{style:{...I,...null===(Oe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.header,marginBottom:xi?14:ci?"16px":"12px",...xi&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[e("div",xi?{style:{minWidth:0,flex:"1 1 auto"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[i("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:We||re.summaryIcon||"⏳"}),i("span",{children:Ee||"Redline In Review"})]}),i("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Re||(null===(Ne=null==c?void 0:c.redlining_details)||void 0===Ne?void 0:Ne.redline_title)})]}:{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i("span",{children:re.summaryIcon||i(r,{size:16,color:"#E24B4A"})}),i("span",{style:{...B,...null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.title},children:Y.summaryHeader||"Summary"})]}),Ce&&Ce.length>0&&i(J,{users:Ce,onClick:e=>{e.stopPropagation(),null==Ie||Ie()}})]}),e("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ke||de||ae)&&i(G,{onAssignClick:ke,onOpenCognitive:de,cognitiveIconSmall:we,cognitiveTootipTitle:fe,historyIconSmall:se,onHistoryClick:ae,historyTootipTitle:ce}),i("button",{onClick:s,style:{...F,...null===($e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===$e?void 0:$e.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),xi&&ze&&Le.length>0&&i(K,{steps:Le}),!Me&&!xi&&i(t,{children:i(v,{title:null===(Ve=null==c?void 0:c.redlining_details)||void 0===Ve?void 0:Ve.redline_title,children:i("p",{style:{...T,...null===(Ue=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.bodyText},children:null===(qe=null==c?void 0:c.redlining_details)||void 0===qe?void 0:qe.redline_title})})}),i("p",{style:{...A,...null===(Ge=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ge?void 0:Ge.summary},children:null===(Je=null==c?void 0:c.redlining_details)||void 0===Je?void 0:Je.redline_summary}),e("div",{style:{...E,...null===(Ke=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ke?void 0:Ke.impactContainer},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{onClick:()=>di(!ri),style:{...W,...null===(Qe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.impactToggle},children:[i("span",{style:{...L,...null===(Xe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.impactToggleLabel},children:Y.impactHeader||"Impact"}),i("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ri?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#E24B4A"})})]}),i(S,{type:(null==c?void 0:c.severity)||"Medium",customStyles:le})]}),ri&&i(t,{children:i("div",{style:{...R,...null===(Ye=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ye?void 0:Ye.impactText},children:i(f,{message:`${null!==(ei=null===(Ze=null==c?void 0:c.redlining_details)||void 0===Ze?void 0:Ze.redline_impact)&&void 0!==ei?ei:Y.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(ii=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ii?void 0:ii.impactMarkdown})})})]}),xi&&je&&e("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e("button",{onClick:()=>mi(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[i("span",{children:De}),i(d,{size:18,color:"#1E293B",style:{transform:vi?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),vi&&e("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Fe||"","”"]})]}),i("div",{style:{...z,...null===(ti=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ti?void 0:ti.actionContainer},children:Bi.map(i=>{var t,n;const o=ne||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e("button",{style:{...j,...null===(n=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{if(i.onClick){return void(!0===await i.onClick()&&i.useLabel&&await Ii(i.id.toLowerCase()))}i.useLabel&&await Ii(i.id.toLowerCase())},disabled:o,children:[i.icon,i.label]},i.id)})}),pe&&e("div",{style:{...D,...null===(ni=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ni?void 0:ni.toneContainer},children:[e("button",{onClick:()=>si(!ai),style:{...M,...null===(oi=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===oi?void 0:oi.toneToggleBtn},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i(w,{toneIndex:gi,configs:ie}),i("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:Y.toneHeader||"Redline Tone"})]}),i("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ai?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#111"})})]}),ai&&e(t,{children:[i("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:Y.toneDescription||"Controls how assertively AI is redlining"}),i(g,{isDirty:wi,onToneChange:e=>{hi(e)},toneColor:yi,toneIndex:gi,onClickRegenerate:()=>null==X?void 0:X(fi),toneLabels:Z,isStreaming:be,aiReason:c})]})]}),de&&e("div",{className:null==me?void 0:me.section,onClick:e=>{e.stopPropagation(),de&&de(e)},style:{...H,...null==ve?void 0:ve.section,...ge},children:[e("div",{className:null==me?void 0:me.headerLeft,style:{..._,...null==ve?void 0:ve.headerLeft},children:[i("span",{className:null==me?void 0:me.titleIcon,style:{...O,...null==ve?void 0:ve.titleIcon},children:null!=ye?ye:i(h,{})}),i("div",{className:null==me?void 0:me.cognitiveTitle,style:{...N,...null==ve?void 0:ve.cognitiveTitle},children:xe})]}),e("div",{className:null==me?void 0:me.headerRight,style:{...P,...null==ve?void 0:ve.headerRight},children:[void 0!==(null==c?void 0:c.relevance_score)&&null!==(null==c?void 0:c.relevance_score)?e("span",{className:null==me?void 0:me.scoreBadge,style:{...$,...null==ve?void 0:ve.scoreBadge,...he},children:[i(u,{}),e("span",{className:null==me?void 0:me.scoreText,style:{...V,...null==ve?void 0:ve.scoreText,...ue},children:[Math.round(Number(c.relevance_score)),"%"]})]}):null,Se&&i("span",{style:{display:"flex",alignItems:"center"},children:i(a,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});export{q as AssignMenu,J as DisplayUsers,G as KebabMenu,Q as default};
|
|
2
2
|
//# sourceMappingURL=DeviationSummary.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Lock as i,X as n}from"lucide-react";const r={popup:{width:400,background:"#fff",borderRadius:20,padding:20,boxShadow:"0 20px 60px rgba(0,0,0,0.18), 0 8px 20px rgba(0,0,0,0.08)",display:"flex",flexDirection:"column",alignItems:"center",gap:10},content:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,width:"100%"},icon:{width:40,height:40,borderRadius:"50%",background:"#FEF2F2",color:"#DC2626",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},message:{margin:0,color:"#6B7280",fontFamily:"Inter",fontSize:15,lineHeight:1.6,flex:1},cross:{alignSelf:"start",cursor:"pointer"}};function o({message:o,onClose:s}){return e("div",{style:r.popup,children:t("div",{style:r.content,children:[e("div",{style:r.icon,children:e(i,{size:15,strokeWidth:2.2})}),e("p",{style:r.message,children:o}),e("div",{style:r.cross,onClick:s,children:e(n,{size:20,strokeWidth:2.2})})]})})}export{o as default};
|
|
2
|
+
//# sourceMappingURL=EditBlockPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditBlockPopup.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i}from"react/jsx-runtime";import{UserPen as n,CheckCircle as l,XCircle as t}from"lucide-react";import{useRequirementAI as o}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as d}from"../../../../../service/redlineService.js";function a({onClose:a,editorInfo:s,headerText:c,btnsConfig:u,labelText:p,onActionTrigger:v,aiReason:f=null}){var b,g;const{redlineDcoumentId:m,redlineConfig:y,updateRedlineDataParent:h}=o(),I=async e=>{var i,n,l;null==v||v({status:"loading",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}});try{const{updated_reqai:t}=await d({documentId:m,userEmail:null==y?void 0:y.userEmail,userName:null==y?void 0:y.userName,redlineId:null!==(i=null==f?void 0:f.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==y?void 0:y.baseApiUrl,redlineConfigId:null!==(n=null==y?void 0:y.redlineConfigId)&&void 0!==n?n:""},null!==(l=null==y?void 0:y.token)&&void 0!==l?l:"");await(null==h?void 0:h(t)),null==v||v({status:"success",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}})}catch(
|
|
1
|
+
import{jsxs as e,jsx as i}from"react/jsx-runtime";import{UserPen as n,CheckCircle as l,XCircle as t}from"lucide-react";import{useRequirementAI as o}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as d}from"../../../../../service/redlineService.js";function a({onClose:a,editorInfo:s,headerText:c,btnsConfig:u,labelText:p,onActionTrigger:v,aiReason:f=null}){var b,g;const{redlineDcoumentId:m,redlineConfig:y,updateRedlineDataParent:h}=o(),I=async e=>{var i,n,l;null==v||v({status:"loading",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}});try{const{updated_reqai:t}=await d({documentId:m,userEmail:null==y?void 0:y.userEmail,userName:null==y?void 0:y.userName,redlineId:null!==(i=null==f?void 0:f.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==y?void 0:y.baseApiUrl,redlineConfigId:null!==(n=null==y?void 0:y.redlineConfigId)&&void 0!==n?n:""},null!==(l=null==y?void 0:y.token)&&void 0!==l?l:"");await(null==h?void 0:h(t)),null==v||v({status:"success",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}})}catch(i){null==v||v({status:"failed",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}})}};return e("div",{style:r.popup,children:[e("div",{style:r.header,children:[i("span",{style:r.title,children:c||"Manually Edited"}),i("button",{onClick:a,style:r.closeButton,"aria-label":"Close",children:"✕"})]}),e("div",{style:r.content,children:[e("div",{style:r.labelRow,children:[i(n,{}),i("span",{style:r.label,children:p||"Edited By"})]}),i("div",{style:r.editorInfo,children:s}),i("div",{style:r.divider}),e("div",{style:r.actions,children:[null==u?void 0:u.map(i=>e("button",{style:{...r.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==f?void 0:f.redline_id,id:null==f?void 0:f.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(b=null==f?void 0:f.redlining_details)||void 0===b?void 0:b.status)||"rejected"===(null===(g=null==f?void 0:f.redlining_details)||void 0===g?void 0:g.status))&&e("div",{style:r.resolveActions,children:[e("button",{style:{...r.actionBtn,...(null==f?void 0:f.resolving)?r.actionBtnDisabled:{}},disabled:null==f?void 0:f.resolving,onClick:()=>I("accept"),children:[i(l,{size:16,color:"#10B981"})," ","Adopt"]}),e("button",{style:{...r.actionBtn,...(null==f?void 0:f.resolving)?r.actionBtnDisabled:{}},onClick:()=>I("reject"),disabled:null==f?void 0:f.resolving,children:[i(t,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})}const r={popup:{width:400,background:"#fff",borderRadius:12,overflow:"hidden",boxShadow:"0 10px 30px rgba(0,0,0,0.15)",fontFamily:"Inter, sans-serif"},actionBtnDisabled:{opacity:.5,cursor:"not-allowed",pointerEvents:"none"},header:{background:"#dfe7f8",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 14px"},title:{fontSize:14,fontWeight:600,color:"#313949"},closeButton:{border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#616b7d"},content:{padding:"16px 22px"},labelRow:{display:"flex",alignItems:"center",gap:10,marginBottom:8},labelIcon:{fontSize:18},label:{fontSize:14,color:"#7b8495"},editorInfo:{fontSize:14,fontWeight:500,color:"#313949"},divider:{margin:"14px 0",height:1,background:"#e5e7eb"},actions:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:15},resolveActions:{display:"flex",justifyContent:"space-between",gap:15,alignItems:"center"},actionBtn:{border:"1px solid #d5dbe8",background:"#fff",borderRadius:10,padding:"8px",fontSize:14,cursor:"pointer",display:"flex",alignItems:"center",gap:10,color:"#596275"}};export{a as default};
|
|
2
2
|
//# sourceMappingURL=ManualEditPopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{Undo2 as o}from"lucide-react";import{useState as n}from"react";import r from"./PopupDefaults.js";import{Tooltip as l}from"@mui/material";import{AiReasonMarkdownWrapper as a}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{DisplayUsers as d}from"./DeviationSummary.js";import{resolveRedline as s}from"../../../../../service/redlineService.js";import{useRequirementAI as c}from"../../RequirementAIWrapper/RequirementAIWrapper.js";function h(e){const t=new Date(e);if(isNaN(t.getTime()))return e;return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}const u=()=>t("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),e("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),p=()=>t("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),e("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),f=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}),k=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),b=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}),g=({open:t})=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"},children:e("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),m=({color:i="#3b82f6"})=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:i,strokeWidth:"1.5",strokeLinecap:"round"}),e("path",{d:"M1.5 3.5v4h4",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M8 5v3.5l2 1.5",stroke:i,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),v=()=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),e("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),y=()=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]});function x({title:o,open:n,onToggle:r,children:l}){return t("div",{children:[t("div",{onClick:r,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"},children:[e("span",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:o}),e(g,{open:n})]}),e("div",{style:{maxHeight:n?100:0,opacity:n?1:0,transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"},children:n&&e(i,{children:l})})]})}function C({icon:e,label:i,onClick:o,customStyle:n={},disabled:r=!1,disabledStyle:l={}}){const a={display:"flex",alignItems:"center",gap:10,padding:"8px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:r?.5:1,...n,...r?l:{}};return t("button",{onClick:r?void 0:o,disabled:r,style:a,onMouseEnter:e=>{r||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")},children:[e,i]})}function B({status:i,onClose:g,impactText:B,secondText:w,actionTakenByName:L,actionTakenAtTime:I="NA",onHistory:R,onIterate:S,onActionTrigger:W,disableAllActions:T=!1,impactTitle:M="Impact",customConfigs:D={},customStyles:j={},secondaryTitle:A,onAssignClick:z,onReviewUsersClick:N,assignedUsers:U,redlineId:E,aiReasonId:H}){const[F,P]=n(!0),[O,$]=n(!0),[q,_]=n(!1);n(!1);const{redlineDcoumentId:V,redlineConfig:Y,updateRedlineDataParent:G}=c(),J={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:e(k,{}),StatusIcon:e(u,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:e(m,{}),label:"History",onClick:R},{icon:e(o,{size:17}),label:"Revert",useLabel:!0},{icon:e(y,{}),label:"Iterate",onClick:S}],fallbackText:"No original text available"},K={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:e(b,{}),StatusIcon:e(p,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:e(m,{color:"#3b82f6"}),label:"History",onClick:R},{icon:e(v,{}),label:"Reinstate",useLabel:!0},{icon:e(y,{}),label:"Iterate",onClick:S}],fallbackText:"No rejected recommendation available"},Q={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:e(k,{}),StatusIcon:e(o,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:e(m,{}),label:"History",onClick:R},{icon:e(y,{}),label:"Iterate",onClick:S}],fallbackText:"No reverted redline available"};let X;X="accepted"===i?J:"rejected"===i?K:Q;const Z={...X,...D[i]||{}};return t("div",{style:{...r.RedlineCardDefaults.root,animation:q?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":r.RedlineCardDefaults.root.animation,...j.root},children:[t("div",{style:{...r.RedlineCardDefaults.header,background:Z.headerBg,borderBottom:`1.5px solid ${Z.headerBorder}`,...j.header},children:[t("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:Z.StatusIcon}),t("div",{children:[e("span",{style:{fontSize:15,fontWeight:700,color:Z.titleColor,letterSpacing:"-0.01em"},children:Z.label}),e(l,{title:A,children:e("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",fontSize:12,color:"gray"},children:A})})]}),U&&U.length>0&&e(d,{users:U,onClick:e=>{e.stopPropagation(),null==N||N()}})]}),e("button",{onClick:()=>{_(!0),g()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"},children:e(f,{})})]}),t("div",{style:{...r.RedlineCardDefaults.body,...j.body},children:[t("div",{style:{...r.RedlineCardDefaults.meta,...j.meta},children:[t("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:5},children:[Z.UserIcon,e("span",{style:{fontSize:12.5,color:"#94a3b8",fontWeight:500},children:Z.metaLabel})]}),t("div",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:[e(l,{title:L,children:e("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:L})}),e("span",{children:h(I)})]})]}),e("div",{style:{...r.RedlineCardDefaults.divider,...j.divider}}),e(x,{title:M,open:F,onToggle:()=>P(e=>!e),children:e("div",{style:{...r.RedlineCardDefaults.impactText,...j.impactText},children:e(a,{message:`${B||""} [View chat](chat_citation$all)`,customStyles:j.impactMarkdown})})}),e("div",{style:{...r.RedlineCardDefaults.divider,...j.divider}}),e(x,{title:Z.secondTitle,open:O,onToggle:()=>$(e=>!e),children:w?e("div",{style:{...r.RedlineCardDefaults.secondSection,background:Z.secondBg,border:`1.5px solid ${Z.secondBorder}`,...j.secondSection},children:w}):t("div",{style:{...r.RedlineCardDefaults.fallbackSectionStyle,...j.fallbackSectionStyle},children:[Z.fallbackText," "]})}),e("div",{style:{...r.RedlineCardDefaults.actionsContainer,...j.actionsContainer},children:Z.actions.map(t=>e(C,{icon:t.icon,label:t.label,onClick:()=>{var e;t.useLabel?(async e=>{var t,i;null==W||W({status:"loading",action:e,metadata:{redlineId:E,aiReasonId:H}});try{const{updated_reqai:o}=await s({documentId:V,userEmail:null==Y?void 0:Y.userEmail,userName:null==Y?void 0:Y.userName,redlineId:null!=E?E:"",action:e,baseApiUrl:null==Y?void 0:Y.baseApiUrl,redlineConfigId:null!==(t=null==Y?void 0:Y.redlineConfigId)&&void 0!==t?t:""},null!==(i=null==Y?void 0:Y.token)&&void 0!==i?i:"");await(null==G?void 0:G(o)),null==W||W({status:"success",action:e,metadata:{redlineId:E,aiReasonId:H}})}catch(e){null==W||W({status:"failed",action:null,metadata:{redlineId:E,aiReasonId:H}})}})(t.label.toLowerCase()):null===(e=t.onClick)||void 0===e||e.call(t)},customStyle:{...t.style,...j.actionBtn},disabled:T||t.disabled,disabledStyle:j.actionBtnDisabled},t.label))})]})]})}export{u as ApprovedIcon,g as ChevronIcon,f as CloseIcon,m as HistoryIcon,y as IterateIcon,B as RedlineCard,v as ReinstateIcon,p as RejectedIcon,k as UserApprovedIcon,b as UserRejectedIcon,h as formatDate};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{Undo2 as o}from"lucide-react";import{useState as n}from"react";import r from"./PopupDefaults.js";import{Tooltip as l}from"@mui/material";import{AiReasonMarkdownWrapper as a}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{DisplayUsers as d,KebabMenu as s}from"./DeviationSummary.js";import{resolveRedline as c}from"../../../../../service/redlineService.js";import{useRequirementAI as h}from"../../RequirementAIWrapper/RequirementAIWrapper.js";function p(e){const t=new Date(e);if(isNaN(t.getTime()))return e;return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}const u=()=>t("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),e("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),f=()=>t("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),e("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),g=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}),k=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),m=()=>t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}),b=({open:t})=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"},children:e("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),v=({color:i="#3b82f6"})=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:i,strokeWidth:"1.5",strokeLinecap:"round"}),e("path",{d:"M1.5 3.5v4h4",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M8 5v3.5l2 1.5",stroke:i,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),y=()=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),e("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),x=()=>t("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]});function C({title:o,open:n,onToggle:r,children:l}){return t("div",{children:[t("div",{onClick:r,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"},children:[e("span",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:o}),e(b,{open:n})]}),e("div",{style:{maxHeight:n?100:0,opacity:n?1:0,transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"},children:n&&e(i,{children:l})})]})}function B({icon:e,label:i,onClick:o,customStyle:n={},disabled:r=!1,disabledStyle:l={}}){const a={display:"flex",alignItems:"center",gap:10,padding:"8px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:r?.5:1,...n,...r?l:{}};return t("button",{onClick:r?void 0:o,disabled:r,style:a,onMouseEnter:e=>{r||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")},children:[e,i]})}function w({status:i,onClose:b,impactText:w,secondText:I,actionTakenByName:L,actionTakenAtTime:S="NA",onHistory:T,onIterate:R,onActionTrigger:W,disableAllActions:M=!1,impactTitle:D="Impact",customConfigs:j={},customStyles:A={},secondaryTitle:z,onAssignClick:N,onReviewUsersClick:U,assignedUsers:H,redlineId:E,aiReasonId:O,cognitiveIconSmall:F,cognitiveTootipTitle:P="Cognitive Decisioning",historyIconSmall:$,onHistoryClick:q,historyTootipTitle:_,onOpenCognitive:V}){const[Y,G]=n(!0),[J,K]=n(!0),[Q,X]=n(!1);n(!1);const{redlineDcoumentId:Z,redlineConfig:ee,updateRedlineDataParent:te}=h(),ie={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:e(k,{}),StatusIcon:e(u,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:e(v,{}),label:"History",onClick:T},{icon:e(o,{size:17}),label:"Revert",useLabel:!0},{icon:e(x,{}),label:"Iterate",onClick:R}],fallbackText:"No original text available"},oe={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:e(m,{}),StatusIcon:e(f,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:e(v,{color:"#3b82f6"}),label:"History",onClick:T},{icon:e(y,{}),label:"Reinstate",useLabel:!0},{icon:e(x,{}),label:"Iterate",onClick:R}],fallbackText:"No rejected recommendation available"},ne={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:e(k,{}),StatusIcon:e(o,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:e(v,{}),label:"History",onClick:T},{icon:e(x,{}),label:"Iterate",onClick:R}],fallbackText:"No reverted redline available"};let re;re="accepted"===i?ie:"rejected"===i?oe:ne;const le={...re,...j[i]||{}};return t("div",{style:{...r.RedlineCardDefaults.root,animation:Q?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":r.RedlineCardDefaults.root.animation,...A.root},children:[t("div",{style:{...r.RedlineCardDefaults.header,background:le.headerBg,borderBottom:`1.5px solid ${le.headerBorder}`,...A.header},children:[t("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:le.StatusIcon}),t("div",{children:[e("span",{style:{fontSize:15,fontWeight:700,color:le.titleColor,letterSpacing:"-0.01em"},children:le.label}),e(l,{title:z,children:e("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",fontSize:12,color:"gray"},children:z})})]}),H&&H.length>0&&e(d,{users:H,onClick:e=>{e.stopPropagation(),null==U||U()}})]}),t("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(N||V||q)&&e(s,{onAssignClick:N,onOpenCognitive:V,cognitiveIconSmall:F,cognitiveTootipTitle:P,historyIconSmall:$,onHistoryClick:q,historyTootipTitle:_}),e("button",{onClick:()=>{X(!0),b()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"},children:e(g,{})})]})]}),t("div",{style:{...r.RedlineCardDefaults.body,...A.body},children:[t("div",{style:{...r.RedlineCardDefaults.meta,...A.meta},children:[t("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:5},children:[le.UserIcon,e("span",{style:{fontSize:12.5,color:"#94a3b8",fontWeight:500},children:le.metaLabel})]}),t("div",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:[e(l,{title:L,children:e("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:L})}),e("span",{children:p(S)})]})]}),e("div",{style:{...r.RedlineCardDefaults.divider,...A.divider}}),e(C,{title:D,open:Y,onToggle:()=>G(e=>!e),children:e("div",{style:{...r.RedlineCardDefaults.impactText,...A.impactText},children:e(a,{message:`${w||""} [View chat](chat_citation$all)`,customStyles:A.impactMarkdown})})}),e("div",{style:{...r.RedlineCardDefaults.divider,...A.divider}}),e(C,{title:le.secondTitle,open:J,onToggle:()=>K(e=>!e),children:I?e("div",{style:{...r.RedlineCardDefaults.secondSection,background:le.secondBg,border:`1.5px solid ${le.secondBorder}`,...A.secondSection},children:I}):t("div",{style:{...r.RedlineCardDefaults.fallbackSectionStyle,...A.fallbackSectionStyle},children:[le.fallbackText," "]})}),e("div",{style:{...r.RedlineCardDefaults.actionsContainer,...A.actionsContainer},children:le.actions.map(t=>e(B,{icon:t.icon,label:t.label,onClick:()=>{var e;t.useLabel?(async e=>{var t,i;null==W||W({status:"loading",action:e,metadata:{redlineId:E,aiReasonId:O}});try{const{updated_reqai:o}=await c({documentId:Z,userEmail:null==ee?void 0:ee.userEmail,userName:null==ee?void 0:ee.userName,redlineId:null!=E?E:"",action:e,baseApiUrl:null==ee?void 0:ee.baseApiUrl,redlineConfigId:null!==(t=null==ee?void 0:ee.redlineConfigId)&&void 0!==t?t:""},null!==(i=null==ee?void 0:ee.token)&&void 0!==i?i:"");await(null==te?void 0:te(o)),null==W||W({status:"success",action:e,metadata:{redlineId:E,aiReasonId:O}})}catch(t){null==W||W({status:"failed",action:e,metadata:{redlineId:E,aiReasonId:O}})}})(t.label.toLowerCase()):null===(e=t.onClick)||void 0===e||e.call(t)},customStyle:{...t.style,...A.actionBtn},disabled:M||t.disabled,disabledStyle:A.actionBtnDisabled},t.label))})]})]})}export{u as ApprovedIcon,b as ChevronIcon,g as CloseIcon,v as HistoryIcon,x as IterateIcon,w as RedlineCard,y as ReinstateIcon,f as RejectedIcon,k as UserApprovedIcon,m as UserRejectedIcon,p as formatDate};
|
|
2
2
|
//# sourceMappingURL=RedlineStatusCard.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 s,Users as r,ExternalLink as d,Download as u,Share2 as c,Copy as v,LoaderCircle as p,PencilIcon as m,Plus as y,Trash2 as h,X as g,Ellipsis as S,Hourglass as f,Check as C,ChevronUpIcon as I,ChevronDownIcon as b,Info as N,Bookmark as w}from"lucide-react";import D from"showdown";import{Tooltip as E,Menu as B,MenuItem as A}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 k,indentMarkdown as P}from"../../utils/helpers.js";import{replaceTitleSection as R}from"../../utils/user-story.utils.js";import _ from"../../shared/AtomicButton.js";import M from"../RichTextEditor/RichTextEditor.js";import L from"../userstory-with-citation/UserStoryWithCitation.js";import{SectionStatus as V,useRequirementAI as j}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as z}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as O}from"./TitleEditor/TitleEditor.js";import{updateRedlineDocument as $,getRedlineDocumentId as G,createRedlineDocument as H}from"../../../../service/redlineService.js";import W from"./ClinicalTrialSection.js";import{CompletionPanel as F}from"../story-screen/CompletionPanel.js";import q from"../../icons/CDIcon.js";const Q={[V.WAITING]:"WAITING TO GENERATE",[V.IN_PROGRESS]:"IN PROGRESS",[V.GENERATED]:"GENERATED",[V.FAILED]:"FAILED",[V.GENERATE]:"GENERATE",[V.APPROVED]:"APPROVED"};function Z(e){const l=[],n=/<learned>(.*?)<\/learned>/g;let o,i=0,a=0;for(;null!==(o=n.exec(e));){const[,s]=o,r=o.index;r>i&&l.push(t("span",{children:e.slice(i,r)},"text-pre-"+a++)),l.push(t(E,{title:s,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 J(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 K=({displayName:l})=>{var n;const{customStyles:o}=j(),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(w,{className:U.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e("span",{style:null==i?void 0:i.label,children:[l,":"]})]})},X=({isUserStoryCurrentlyUpdated:I,artifactId:b,artifactTitleId:N,parentUserStory:w,currentUserStory:G,onUserStoryChange:H,parentIndex:Y,currentIndex:ee,enableDownload:te,isDiffEditReviewMode:le,showUserStoryDiff:ne,handleDownloadUserStory:oe,handleOpenSendDialog:ie,updateUserStoryArtifact:ae,selectedArtifactId:se,isDisplayHighlightControl:re,elementDisplayConfig:de,_resolvedConfig:ue,showWrapper:ce=!1,defaultExpanded:ve,actionItemsConfig:pe,onDelete:me,contextVariant:ye,expandedSubFeatures:he,showDisplayName:ge=!0,allowTitleEdit:Se=!0,showConfidenceScore:fe=!0,showBorderTop:Ce=!0,sectionStatusConfig:Ie,showCompletionPanel:be=!1,showAddSectionButton:Ne=!1,disableEditPlan:we=!1,useMuiTooltip:De=!1,approveButtonConfig:Ee,CDNeededInChip:Be,showAssignSection:Ae=!1,disableAssignSection:xe=!1,onAssignSectionClick:Te})=>{var Ue,ke,Pe,Re,_e,Me,Le,Ve,je,ze,Oe,$e,Ge,He,We,Fe,qe,Qe;const{isLoadingSectionData:Ze=!1,onLoadSectionData:Je,status:Ke,onStatusClick:Xe,completedCount:Ye,totalCount:et,isNoDataAvailable:tt=!1}=null!=Ie?Ie:{},{searchQueryList:lt,citations:nt,customStyles:ot,onEditBlocked:it,redlineDcoumentId:at,redlineConfig:st,customSectionConfig:rt,updateRedlineDataParent:dt,aiReasoning:ut}=j(),ct=null==ot?void 0:ot.userStoryCardStyles,vt=null==ct?void 0:ct.customSectionEditButton,pt=null==ct?void 0:ct.statusStyles,mt=null===(Ue=null==ot?void 0:ot.userStoryCardStyles)||void 0===Ue?void 0:Ue.userStoryEditStyles,yt=null===(ke=null==ot?void 0:ot.userStoryScreenStyles)||void 0===ke?void 0:ke.userStoryContentStyles,ht=null==ct?void 0:ct.progressHeaderStyles,gt=null==ct?void 0:ct.clinicalTrialSectionStyles,St=null==ct?void 0:ct.CompletionStyles,ft=null==ct?void 0:ct.noDataStyles,Ct=null==ct?void 0:ct.approveButtonStyles,It=null!==(Re=null===(Pe=null==rt?void 0:rt.shouldRender)||void 0===Pe?void 0:Pe.call(rt,G))&&void 0!==Re&&Re,bt=null===(_e=null==rt?void 0:rt.getValue)||void 0===_e?void 0:_e.call(rt,G),Nt=null!==(Le=null===(Me=null==rt?void 0:rt.getFields)||void 0===Me?void 0:Me.call(rt,G))&&void 0!==Le?Le:[],wt=null!==(Ve=null==rt?void 0:rt.isEditDisabled)&&void 0!==Ve&&Ve,Dt=null!==(ze=null===(je=null==rt?void 0:rt.isSaving)||void 0===je?void 0:je.call(rt,G))&&void 0!==ze&&ze,Et=((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!==(Oe=G.completion_percentage)&&void 0!==Oe?Oe:0,St),Bt={[V.WAITING]:null==pt?void 0:pt.waiting,[V.IN_PROGRESS]:null==pt?void 0:pt.inProgress,[V.GENERATED]:null==pt?void 0:pt.generated,[V.FAILED]:null==pt?void 0:pt.failed,[V.GENERATE]:null==pt?void 0:pt.generate,[V.APPROVED]:null==pt?void 0:pt.approved},[At,xt]=n({...structuredClone(G),value:k(G.value)||""}),[Tt,Ut]=n({userStory:!!G.isDefaultEdit}),[kt,Pt]=n(!1),[Rt,_t]=n(!1),[Mt,Lt]=n(null),[Vt,jt]=n(null),{userStory:zt,customIcons:Ot}=j(),[$t,Gt]=n(null!=ve?ve:""===Y||se===G.artifactId||!!G.isDefaultOpen),[Ht,Wt]=n(!1),[Ft,qt]=n(null),[Qt,Zt]=n(null),[Jt,Kt]=n(!1),Xt=o(null),Yt=o(null),[el,tl]=n(!1),[ll,nl]=n(!1),ol=o(null),[il,al]=n(G.value);i(()=>{I&&Gt(I)},[I]),i(()=>{xt({...structuredClone(G),value:k(G.value)||""})},[G]),i(()=>{lt.length>0?Gt(!0):void 0===ve&&(se?Gt(se===G.artifactId):he&&he.length>0&&Gt(he.includes(G.artifactId)))},[lt,se,G.artifactId,he]);const sl=()=>{qt(null)},rl=()=>{Zt(null)},dl=()=>{$t&&Tt.userStory&&Yt.current&&!Yt.current.requestClose()||Gt(e=>!e)},ul=async()=>{var e;try{"userStory"==="userStory"&&(H(At),console.log("I am changing RTE editor values",At)),await ae(nt,zt,b,null===(e=ol.current)||void 0===e?void 0:e.signal)}finally{}};const cl=null!=(null==G?void 0:G.big_enough)&&!Number.isNaN(G.big_enough)&&!!(null==G?void 0:G.big_enough_decision_factors),vl=null!==($e=null==G?void 0:G.completion_percentage)&&void 0!==$e?$e:0,pl=!!(null==G?void 0:G.completion_decision_factors),ml=""===Y,yl=null!=ue?ue:J(de,ml),hl=!le&&!ne;i(()=>{if(!Vt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${Vt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[Vt]),i(()=>{G.isDefaultEdit&&Ut(e=>({...e,userStory:!0}))},[G.isDefaultEdit]);return i(()=>al(G.value),[G.value]),e("div",{className:U.card,style:null==ct?void 0:ct.cardStyle,id:`story-card-${G.title}`,"data-expanded":$t,children:[e("div",{className:U.titleSection,style:null==ct?void 0:ct.titleSection,children:[e("div",{className:U.titleRow,style:null==ct?void 0:ct.titleRow,onClick:dl,children:[e("div",{className:U.titleLeft,style:null==ct?void 0:ct.titleLeft,onMouseEnter:()=>tl(!0),onMouseLeave:()=>tl(!1),children:[ge&&t(K,{displayName:N}),kt&&hl?t(O,{title:G.title,onSave:e=>(async(e,t)=>{var l;try{let n={...G};G.artifactId===t?n.title=e:n.sub_features=(null===(l=G.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],xt(n),H(n),Pt(!1)}catch(e){console.error("Failed to save title",e)}})(e,G.artifactId),onCancel:()=>{Pt(!1)},inputStyle:null==mt?void 0:mt.inlineTitleInput,confirmButtonStyle:null==mt?void 0:mt.inlineTitleConfirm,cancelButtonStyle:null==mt?void 0:mt.inlineTitleCancel},"inline-title-editor"):e("div",{className:U.storyTitleWrapper,children:[t(E,{title:Z(G.title),arrow:!0,children:t("h2",{title:De?void 0:G.title,className:U.storyTitle,style:null==ct?void 0:ct.storyTitle,children:Z(G.title)},G.artifactId)}),be&&!It&&(pl?t(F,{customIcons:null==Ot?void 0:Ot.userStoryIcons,customStyles:null==ct?void 0:ct.aiReasoningCitaionStyles,currentUserStory:G,panelStyles:null==ct?void 0:ct.CompletionStyles,onToggleStateChange:nl,children:e("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==St?void 0:St.badge,...Et},children:[e("span",{children:[vl,"% Completed"]}),t("span",{style:{display:"flex",alignItems:"center"},children:t(q,{color:"currentColor"})}),t(ll?a:s,{size:14,style:null==St?void 0:St.chevronStyle})]})}):t("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==St?void 0:St.badge,...Et},children:e("span",{children:[vl,"% Completed"]})})),Se&&t("button",{type:"button",className:U.titleEditButton,style:null==mt?void 0:mt.titleEditButton,onClick:e=>{e.stopPropagation(),Pt(!0),$t||Gt(!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"})})})]})]}),(Ke||void 0!==Ye&&void 0!==et)&&e("div",{className:U.statusContainer,children:[void 0!==Ye&&void 0!==et&&e("div",{className:U.completedBadge,children:["Completed: ",Ye,"/",et]}),Ke&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==Xe||Xe()},className:U.statusButton,style:Bt[Ke],children:Q[Ke]})]}),e("div",{className:U.titleActions,style:null==ct?void 0:ct.titleActions,onClick:e=>e.stopPropagation(),children:[(yl.showProgressPercentage||yl.showGapBox)&&ce&&e("div",{className:U.progressHeader,style:null==ht?void 0:ht.wrapper,children:[yl.showProgressPercentage&&e("div",{className:U.progressPercentage,style:null==ht?void 0:ht.percentage,children:[null!==(He=null!==(Ge=null==G?void 0:G.confidenceScore)&&void 0!==Ge?Ge:null==yl?void 0:yl.confidenceValue)&&void 0!==He?He:"0","%"]}),yl.showGapBox&&e("div",{className:U.gapBox,style:null==ht?void 0:ht.gapBox,children:[null!==(Fe=null!==(We=null==G?void 0:G.gapValue)&&void 0!==We?We:null==yl?void 0:yl.gapBoxValue)&&void 0!==Fe?Fe:"2"," ","Gaps"]})]}),cl&&t(z,{customIcons:null==Ot?void 0:Ot.userStoryIcons,customStyles:null==ct?void 0:ct.aiReasoningCitaionStyles,currentUserStory:G,panelStyles:null==ct?void 0:ct.BigEnoughStyles}),Ae&&t("button",{type:"button",className:U.iconButton,style:null==ct?void 0:ct.iconButton,disabled:xe,onClick:e=>{e.stopPropagation(),null==Te||Te(G)},"aria-label":"Assign section users",title:"Assign section users",children:t(r,{size:16})}),!Tt.userStory&&e(l,{children:[!1!==(null==yl?void 0:yl.showShareButton)&&t("button",{className:U.iconButton,style:null==ct?void 0:ct.iconButton,onClick:e=>{qt(e.currentTarget)},children:t(d,{size:16})}),e(B,{id:"user-story-share-menu",anchorEl:Ft,open:!!Ft,onClose:()=>qt(null),style:null==ct?void 0:ct.userStoryShareMenu,children:[te&&t(A,{style:null==ct?void 0:ct.userStoryMenuItem,onClick:async()=>{Wt(!0),oe&&(await Promise.all([oe("pdf"),oe("doc")]),Wt(!1))},children:e("div",{ref:Xt,className:U.menuItemContent,style:null==ct?void 0:ct.menuItemContent,children:[t(u,{size:16,color:null==ct?void 0:ct.menuIconColor}),t("p",{style:null==ct?void 0:ct.menuLabel,children:"Download"})]})}),t(A,{style:null==ct?void 0:ct.userStoryMenuItem,onClick:async()=>{let e=G;w&&(e={...G,value:`${R(null==w?void 0:w.value,G.title)} \n${G.value}`}),null==ie||ie(!0,[e],G.artifactId),sl()},children:e("div",{style:null==ct?void 0:ct.menuItemContent,className:U.menuItemContentPadded,children:[t(c,{size:16,color:null==ct?void 0:ct.menuIconColor}),t("p",{style:null==ct?void 0:ct.menuLabel,children:"Send"})]})}),t(A,{style:null==ct?void 0:ct.userStoryMenuItem,onClick:async()=>{const e=(new D.Converter).makeHtml(k(G.value)||G.value),t=function(e){const t=(new D.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(k(G.value)||G.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{sl()}},children:e("div",{style:null==ct?void 0:ct.menuItemContent,className:U.menuItemContentPadded,children:[t(v,{size:16,color:null==ct?void 0:ct.menuIconColor}),t("p",{style:null==ct?void 0:ct.menuLabel,children:"Copy"})]})})]})]}),!Jt&&Tt.userStory&&$t?t(_,{type:"outline",children:"Cancel",style:null==ct?void 0:ct.cancelButton,onClick:()=>{var e;null===(e=ol.current)||void 0===e||e.abort(),Ut(e=>({...e,userStory:!1}))}}):t(l,{}),Tt.userStory&&$t?t(_,{type:"fill",children:Jt?e("span",{className:U.savingSpinner,style:null==ct?void 0:ct.savingSpinner,children:[t(p,{className:U.spinAnimation,style:null==ct?void 0:ct.spinAnimation}),t("span",{children:"Saving..."})]}):"Save",isDisable:Jt,style:Jt?null==ct?void 0:ct.savingButton:null==ct?void 0:ct.saveButton,onClick:async()=>{Kt(!0),await ul();let e=await(async()=>{var e,t,l,n,o;let i=At.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==st?void 0:st.callUpdateDocument){const{updated_reqai:a}=await $({documentId:at,sectionId:G.artifactId,baseApiUrl:null==st?void 0:st.baseApiUrl,updatedContent:i,userEmail:st.userEmail,userName:st.userName,redlineConfigId:null!==(e=st.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==st?void 0:st.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==dt?void 0:dt(a))}}catch(e){console.error("failed to update redline document",e),i=il}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={...At,value:e};H({...t,isDefaultEdit:!1}),al(t.value),Ut(e=>({...e,userStory:!1})),Kt(!1)}}):!le&&!ne&&!we&&$t&&!1!==(null==yl?void 0:yl.showEditButton)&&t("button",{className:U.iconButton,style:null==ct?void 0:ct.editButton,onClick:()=>Ut(e=>({...e,userStory:!0})),children:t(m,{color:null==ct?void 0:ct.pencilIconColor,size:16})}),Ne&&ml&&$t&&!le&&!ne&&!1!==(null==yl?void 0:yl.showEditButton)&&e("button",{type:"button",className:U.addSectionButton,style:null==mt?void 0:mt.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=G.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={...G,sub_features:[...null!==(n=G.sub_features)&&void 0!==n?n:[],i]};xt(a),H(a),Gt(!0),jt(i.title)},"aria-label":"Add section",title:"Add section",children:[t(y,{size:14}),t("span",{className:U.addSectionLabel,children:"Add Section"})]}),!ml&&!le&&!we&&!ne&&t("button",{type:"button",onClick:e=>{e.stopPropagation(),null==me||me()},className:U.iconButton,style:null==mt?void 0:mt.deleteButton,"aria-label":"Delete section",title:"Delete section",children:t(h,{size:16})}),It&&t("button",{type:"button",className:U.iconButton,style:null==vt?void 0:vt.button,disabled:wt,onClick:e=>{if(e.stopPropagation(),Rt)return Lt(null),void _t(!1);Lt(structuredClone(null!=bt?bt:{})),Gt(!0),_t(!0)},children:Rt?t(g,{size:16,color:null==ct?void 0:ct.pencilIconColor,style:null==vt?void 0:vt.cancelIcon}):t(m,{size:16,color:null==ct?void 0:ct.pencilIconColor,style:null==vt?void 0:vt.editIcon})}),(null==yl?void 0:yl.actionItemsButton)&&e(l,{children:[t("span",{className:U.actionItemBtn,style:null==ct?void 0:ct.actionItemBtn,onClick:e=>{e.stopPropagation(),Zt(e.currentTarget)},children:t(S,{})}),t(B,{id:"user-story-action-menu",anchorEl:Qt,open:!!Qt,onClose:rl,style:null==ct?void 0:ct.userStoryShareMenu,children:null==pe?void 0:pe.items.map((l,n)=>t(A,{style:null==ct?void 0:ct.userStoryMenuItem,onClick:()=>{l.onclick(G),rl()},children:e("div",{className:U.menuItemContent,style:{...null==ct?void 0:ct.menuItemContent,...!l.isActive&&{cursor:"not-allowed",opacity:.5}},children:[t("span",{className:U.menuItemIcon,style:null==ct?void 0:ct.menuItemIcon,children:l.icon}),t("p",{style:null==ct?void 0:ct.menuLabel,children:l.name}),t("span",{className:U.menuItemRight,style:null==ct?void 0:ct.menuItemRight})]})},`action-item-${n}-${l.name}`))})]}),t("button",{type:"button",onClick:e=>{e.stopPropagation(),dl()},style:null==ct?void 0:ct.chevronButton,className:U.chevronButton,children:t($t?a:s,{className:U.chevronIcon,color:null==ct?void 0:ct.chevronIconColor})})]})]}),t("div",{className:U.divider,style:null==ct?void 0:ct.dividerStyle})]}),$t&&t("div",{className:U.cardContent,style:{...null==ct?void 0:ct.cardContentStyle,borderTop:Ce?"1px solid #E5E5E5":"none"},children:e("div",Ze?{className:U.loadingContainer,children:[t("div",{className:U.loadingIconWrapper,children:t(f,{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==Je?void 0:Je(),className:U.viewStatusButton,children:"View Status"})]}:tt?{className:U.noDataContainer,style:null==ft?void 0:ft.container,children:[t("img",{src:x,alt:"No data available",className:U.noDataIllustration,style:null==ft?void 0:ft.illustration}),t("h3",{className:U.noDataTitle,style:null==ft?void 0:ft.title,children:"No Data Available for This Section"}),t("p",{className:U.noDataSubtitle,style:null==ft?void 0:ft.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==ct?void 0:ct.contentInner,children:[e("div",{className:U.descriptionSection,style:null==ct?void 0:ct.descriptionSection,children:[t("div",{className:U.justifyBetween,style:null==ct?void 0:ct.justifyBetween}),Tt.userStory?t(M,{ref:Yt,minHeight:"100%",height:"100%",type:"string",value:k(il)||"",handleUpdateState:(e,t)=>{const l=P(t);xt(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:Tt.userStory?"edit":"readOnly",onEditBlocked:it,onSaveUnsavedChanges:async()=>{await ul(),Gt(!1)},onDiscardUnsavedChanges:()=>{xt({...structuredClone(G),value:k(G.value)||""}),Ut(e=>({...e,userStory:!1})),Gt(!1)},isSavingUnsavedChanges:Jt}):It?t(W,{styles:gt,fields:Nt,readonly:!Rt,isSaving:Dt,value:null!==(qe=null!=Mt?Mt:bt)&&void 0!==qe?qe:{},onChange:Lt,onSave:async()=>{var e;Mt&&(await(null===(e=null==rt?void 0:rt.onSave)||void 0===e?void 0:e.call(rt,G,Mt)),Lt(null),_t(!1))},onCancel:()=>{Lt(null),_t(!1)}}):e(l,{children:[t(L,{showUserStoryDiff:ne,isParent:""===Y,message:k(G.value)||"",artifactId:G.artifactId,customStyles:yt,isDisplayHighlightControl:re,contextVariant:ye,showConfidenceScore:fe,CDNeededInChip:Be}),Ee&&t("div",{className:U.approveButtonContainer,style:null==Ct?void 0:Ct.container,children:t("button",{type:"button",className:U.approveButton,style:null==Ct?void 0:Ct.button,disabled:Ee.disabled||Ee.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=null==Ee?void 0:Ee.onClick)||void 0===t||t.call(Ee)},children:Ee.isLoading?e(l,{children:[t(p,{size:16,className:U.spinner,style:null==Ct?void 0:Ct.icon}),t("span",{style:null==Ct?void 0:Ct.text,children:Ee.label})]}):e(l,{children:[t("span",{style:null==Ct?void 0:Ct.text,children:Ee.label}),t(C,{size:16,style:null==Ct?void 0:Ct.icon})]})})})]})]}),null===(Qe=At.sub_features)||void 0===Qe?void 0:Qe.map((e,l)=>{const n=J(de,!1,e.artifactId);return t(X,{artifactId:b,isUserStoryCurrentlyUpdated:I,artifactTitleId:`${N}-${String.fromCharCode(65+l)}`,parentUserStory:G,parentIndex:`${Y}${Y&&"."}${ee}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:e,onUserStoryChange:e=>((e,t)=>{const l=[...G.sub_features||[]];l[e]=t,H({...G,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:le,showUserStoryDiff:ne,updateUserStoryArtifact:ae,handleDownloadUserStory:oe,handleOpenSendDialog:ie,isDisplayHighlightControl:re,elementDisplayConfig:de,_resolvedConfig:n,actionItemsConfig:pe,onDelete:()=>(e=>{const t=(G.sub_features||[]).filter((t,l)=>l!==e),l={...G,sub_features:t};xt(l),H(l)})(l),expandedSubFeatures:he,disableEditPlan:we,useMuiTooltip:De,showAssignSection:Ae,onAssignSectionClick:Te},e.artifactId)})]})})]})},Y=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:y,showWrapper:h,actionItemsConfig:g,contextVariant:S,showDisplayName:f,allowTitleEdit:C,showConfidenceScore:N,showBorderTop:w,defaultExpanded:D,showCompletionPanel:E=!1,showAddSectionButton:B=!1,disableEditPlan:A=!1,useMuiTooltip:x=!1,approveButtonConfig:T,CDNeededInChip:k,setRedlineDocumentIdParent:P,showAssignSection:R,onAssignSectionClick:_,disableAssignSection:M})=>{const{userStory:L,setUserStory:V,customStyles:z,searchQueryList:O,currentHighlightIndex:$,setCurrentHighlightIndex:W,segmentComponentConfig:F,sectionStatusConfig:q,redlineConfig:Q,setRedlineDocumentId:Z}=j(),K=null==z?void 0:z.userStoryCardStyles,Y=0===$,ee=$===O.length-1;return i(()=>{if(!(null==Q?void 0:Q.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await G({baseApiUrl:Q.documentBaseApiUrl||"",comparisonId:Q.documentComparisonId||""});if(t)Z(t);else{const{document_id:t}=await H({baseApiUrl:Q.baseApiUrl,changelogConfigId:Q.changelogConfigId,comparisonId:Q.documentComparisonId,artifactId:Q.artifactId,inputData:Q.inputData,redlineConfigId:Q.redlineConfigId,userEmail:Q.userEmail,userName:Q.userName},null!==(e=null==Q?void 0:Q.token)&&void 0!==e?e:"");t&&(Z(t),null==P||P(t))}})()},[]),e("div",{className:U.userStoryCardWrapper,style:m?{...null==K?void 0:K.userStoryCardWrapper,position:"relative"}:null==K?void 0:K.userStoryCardWrapper,children:[m&&t(l,{children:O.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:[$+1," of ",O.length]}),e("div",{className:U.navButtons,children:[t("button",{onClick:()=>{$>0&&W(e=>e-1)},className:U.navButton,disabled:Y,children:t(I,{size:20,className:U.navIcon})}),t("button",{onClick:()=>{$<O.length-1&&W(e=>e+1)},className:U.navButton,disabled:ee,children:t(b,{size:20,className:U.navIcon})})]})]})})})}),L.map((e,l)=>{const i=J(y,!0);return t(X,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:e,onUserStoryChange:e=>{V(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:p,isDisplayHighlightControl:m,elementDisplayConfig:y,_resolvedConfig:i,showWrapper:h,defaultExpanded:D,actionItemsConfig:g,contextVariant:S,showDisplayName:f,allowTitleEdit:C,showConfidenceScore:N,showBorderTop:w,sectionStatusConfig:q,showCompletionPanel:E,showAddSectionButton:B,disableEditPlan:A,useMuiTooltip:x,approveButtonConfig:T,CDNeededInChip:k,showAssignSection:R,disableAssignSection:M,onAssignSectionClick:_},e.artifactId)})]})};export{X as StoryCard,Y as UserStoryCardWrapper,X as default,Z as replaceLearnedTagsWithInfo};
|
|
2
2
|
//# sourceMappingURL=UserStoryCard.js.map
|