@viswa-test/test-citation 0.0.234 → 0.0.235
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/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/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/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/userstory-with-citation/UserStoryWithCitation.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/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/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/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/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/userstory-with-citation/UserStoryWithCitation.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/types/src/RedlineEditorTest.d.ts.map +1 -1
- package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
- package/dist/types/src/constants/deviationData.d.ts +887 -0
- package/dist/types/src/constants/deviationData.d.ts.map +1 -0
- package/dist/types/src/constants/treeData.d.ts +732 -0
- package/dist/types/src/constants/treeData.d.ts.map +1 -0
- 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/CompareContext.d.ts +1 -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/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/hooks/useCompareLayout.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.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/RichTextEditor.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +2 -2
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts +8 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +7 -7
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.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/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 +2 -2
- package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
- package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
- package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +0 -2
- package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +0 -1
- package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
- package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),n=require("react"),o=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var l=require("../icons/cognitiveBrain.svg.js"),t=require("../icons/aiMagic.svg.js"),s=require("@mui/material"),r=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),d=require("../../../../../service/redlineService.js"),a=require("../../ai-reasoning/AiReasonMarkdownWrapper.js");const c=[{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"}],p=({toneIndex:i,configs:n=c})=>{const o=Math.min(i,n.length-1),{color:l,angle:t,arcD:s}=n[o]||n[1]||n[0],r=(t-90)*Math.PI/180,d=11+9*Math.cos(r),a=13+9*Math.sin(r);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:s,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:d,y2:a,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},u=({type:i,customStyles:n={}})=>{const o={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...n},l=o[i]||o.Medium;return e.jsx("div",{style:l,children:i})},x=["Lenient","Balanced","Aggressive"],g={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},v={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},m={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},h={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},y={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},f={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},j={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},S={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},C={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},b={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},I={display:"flex",gap:8,marginBottom:18},k={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},B={borderTop:"0.5px solid #eee",padding:"14px 0px"},T={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},A={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},R={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},D={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},E={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},z={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},W={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},L={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},M={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},_=n.memo(function({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:t,onHistoryClick:s,historyTootipTitle:r}){const d="20px";return e.jsxs("div",{style:{...M,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),n&&e.jsxs("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&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:o}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]}),s&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>s(e),children:[t&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:t}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r})]})]})}),H=n.memo(function({onAssignClick:i,onOpenCognitive:o,cognitiveIconSmall:l,cognitiveTootipTitle:t,historyIconSmall:s,onHistoryClick:r,historyTootipTitle:d}){const[a,c]=n.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!a),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),a&&e.jsx(_,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:o?e=>{c(!1),o&&o(e)}:void 0,cognitiveIconSmall:l,cognitiveTootipTitle:t,historyIconSmall:s,onHistoryClick:r,historyTootipTitle:d})]})}),q=n.memo(function({users:i,onClick:n}){const o=i.length;return e.jsxs("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:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),o>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})});var F=n.memo(function({onClose:M,aiReason:_,onActionTrigger:F,onIterate:N,initialTone:U,onRegenerate:O,labels:P={},toneLevelsConfig:$=x,toneColorsConfig:G=g,dialConfigs:K=c,actions:V,disableAllActions:X=!1,customStyles:J={},severityChipStyles:Q={},customIcons:Y={},onOpenCognitive:Z,onHistoryClick:ee,historyIconSmall:ie,historyTootipTitle:ne,showTone:oe=!0,cognitiveSectionStyle:le={},cognitiveScoreBadgeStyle:te={},cognitiveScoreTextStyle:se={},cognitiveStyles:re={},cognitiveClassNames:de={},cognitiveTitle:ae="Cognitive Integrity",cognitiveTootipTitle:ce="Cognitive Decisioning",cognitiveLeftIcon:pe,cognitiveIconSmall:ue,showCognitiveRightArrow:xe=!0,isStreaming:ge,onAssignClick:ve,assignedUsers:me,onReviewUsersClick:he,redlineId:ye,aiReasonId:fe}){var je,Se,Ce,be,Ie,ke,we,Be,Te,Ae,Re,De,Ee,ze,We,Le,Me,_e,He;let qe=$.findIndex(e=>e===U);-1===qe&&(qe=1);const[Fe,Ne]=n.useState(!0),[Ue,Oe]=n.useState(!1),[Pe,$e]=n.useState(!1),[Ge,Ke]=n.useState(qe),[Ve]=n.useState(qe),Xe=$[Ge],Je=G[Xe]||"#BA7517",Qe=Ge!==Ve,Ye=[{id:"iterate",icon:Y.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:P.btnIterate||"Iterate",color:"#64748B",onClick:N},{id:"accept",icon:Y.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:P.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:Y.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:P.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:Ze,redlineConfig:ei,updateRedlineDataParent:ii}=r.useRequirementAI(),ni=V||Ye;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...v,...null===(je=null==J?void 0:J.DeviationSummaryStyles)||void 0===je?void 0:je.root},children:[e.jsxs("div",{style:{...m,...null===(Se=null==J?void 0:J.DeviationSummaryStyles)||void 0===Se?void 0:Se.header,marginBottom:Pe?"16px":"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:Y.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...h,...null===(Ce=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ce?void 0:Ce.title},children:P.summaryHeader||"Summary"})]}),me&&me.length>0&&e.jsx(q,{users:me,onClick:e=>{e.stopPropagation(),null==he||he()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ve||Z)&&e.jsx(H,{onAssignClick:ve,onOpenCognitive:Z,cognitiveIconSmall:ue,cognitiveTootipTitle:ce,historyIconSmall:ie,onHistoryClick:ee,historyTootipTitle:ne}),e.jsx("button",{onClick:M,style:{...w,...null===(be=null==J?void 0:J.DeviationSummaryStyles)||void 0===be?void 0:be.closeBtn,color:"#64748B"},children:"✕"})]})]}),e.jsx(s.Tooltip,{title:null===(Ie=null==_?void 0:_.redlining_details)||void 0===Ie?void 0:Ie.redline_title,children:e.jsx("p",{style:{...y,...null===(ke=null==J?void 0:J.DeviationSummaryStyles)||void 0===ke?void 0:ke.bodyText},children:null===(we=null==_?void 0:_.redlining_details)||void 0===we?void 0:we.redline_title})}),e.jsx("p",{style:{...f,...null===(Be=null==J?void 0:J.DeviationSummaryStyles)||void 0===Be?void 0:Be.summary},children:null===(Te=null==_?void 0:_.redlining_details)||void 0===Te?void 0:Te.redline_summary}),e.jsxs("div",{style:{...j,...null===(Ae=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>Ne(!Fe),style:{...C,...null===(Re=null==J?void 0:J.DeviationSummaryStyles)||void 0===Re?void 0:Re.impactToggle},children:[e.jsx("span",{style:{...b,...null===(De=null==J?void 0:J.DeviationSummaryStyles)||void 0===De?void 0:De.impactToggleLabel},children:P.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Fe?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(u,{type:(null==_?void 0:_.severity)||"Medium",customStyles:Q})]}),Fe&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...S,...null===(Ee=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ee?void 0:Ee.impactText},children:e.jsx(a.AiReasonMarkdownWrapper,{message:`${null!==(We=null===(ze=null==_?void 0:_.redlining_details)||void 0===ze?void 0:ze.redline_impact)&&void 0!==We?We:P.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Le=null==J?void 0:J.DeviationSummaryStyles)||void 0===Le?void 0:Le.impactMarkdown})})})]}),e.jsx("div",{style:{...I,...null===(Me=null==J?void 0:J.DeviationSummaryStyles)||void 0===Me?void 0:Me.actionContainer},children:ni.map(i=>{var n,o;const l=X||i.disabled,t=l?{cursor:"not-allowed",opacity:.5,...null===(n=null==J?void 0:J.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...k,...null===(o=null==J?void 0:J.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==F||F({status:"loading",action:e,metadata:{redlineId:ye,aiReasonId:fe}});try{const{updated_reqai:l}=await d.resolveRedline({documentId:Ze,userEmail:null==ei?void 0:ei.userEmail,userName:null==ei?void 0:ei.userName,redlineId:null!==(i=null==_?void 0:_.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==ei?void 0:ei.baseApiUrl,redlineConfigId:null!==(n=null==ei?void 0:ei.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==ei?void 0:ei.token)&&void 0!==o?o:"");await(null==ii?void 0:ii(l)),null==F||F({status:"success",action:e,metadata:{redlineId:ye,aiReasonId:fe}})}catch(e){null==F||F({status:"failed",action:null,metadata:{redlineId:ye,aiReasonId:fe}})}})(i.id.toLowerCase()):null===(e=i.onClick)||void 0===e||e.call(i)},disabled:l,children:[i.icon,i.label]},i.id)})}),oe&&e.jsxs("div",{style:{...B,...null===(_e=null==J?void 0:J.DeviationSummaryStyles)||void 0===_e?void 0:_e.toneContainer},children:[e.jsxs("button",{onClick:()=>Oe(!Ue),style:{...T,...null===(He=null==J?void 0:J.DeviationSummaryStyles)||void 0===He?void 0:He.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(p,{toneIndex:Ge,configs:K}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:P.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ue?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),Ue&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:P.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(o.ToneToggle,{isDirty:Qe,onToneChange:e=>{Ke(e)},toneColor:Je,toneIndex:Ge,onClickRegenerate:()=>null==O?void 0:O(Xe),toneLabels:$,isStreaming:ge,aiReason:_})]})]}),Z&&e.jsxs("div",{className:null==de?void 0:de.section,onClick:e=>{e.stopPropagation(),Z&&Z(e)},style:{...A,...null==re?void 0:re.section,...le},children:[e.jsxs("div",{className:null==de?void 0:de.headerLeft,style:{...R,...null==re?void 0:re.headerLeft},children:[e.jsx("span",{className:null==de?void 0:de.titleIcon,style:{...D,...null==re?void 0:re.titleIcon},children:null!=pe?pe:e.jsx(l.ReactComponent,{})}),e.jsx("div",{className:null==de?void 0:de.cognitiveTitle,style:{...E,...null==re?void 0:re.cognitiveTitle},children:ae})]}),e.jsxs("div",{className:null==de?void 0:de.headerRight,style:{...z,...null==re?void 0:re.headerRight},children:[void 0!==(null==_?void 0:_.relevance_score)&&null!==(null==_?void 0:_.relevance_score)?e.jsxs("span",{className:null==de?void 0:de.scoreBadge,style:{...W,...null==re?void 0:re.scoreBadge,...te},children:[e.jsx(t.ReactComponent,{}),e.jsxs("span",{className:null==de?void 0:de.scoreText,style:{...L,...null==re?void 0:re.scoreText,...se},children:[Math.round(Number(_.relevance_score)),"%"]})]}):null,xe&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var n,o,l,t,s,r,d,a,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===(r=null===(s=e.aiReason)||void 0===s?void 0:s.redlining_details)||void 0===r?void 0:r.status)===(null===(a=null===(d=i.aiReason)||void 0===d?void 0:d.redlining_details)||void 0===a?void 0:a.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(",")))))))))});exports.AssignMenu=_,exports.DisplayUsers=q,exports.KebabMenu=H,exports.default=F;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),n=require("react"),o=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var t=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),s=require("@mui/material"),r=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),a=require("../../../../../service/redlineService.js"),d=require("../../ai-reasoning/AiReasonMarkdownWrapper.js");const c=[{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"}],p=({toneIndex:i,configs:n=c})=>{const o=Math.min(i,n.length-1),{color:t,angle:l,arcD:s}=n[o]||n[1]||n[0],r=(l-90)*Math.PI/180,a=11+9*Math.cos(r),d=13+9*Math.sin(r);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:s,stroke:t,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:a,y2:d,stroke:t,strokeWidth:"2",strokeLinecap:"round"})]})},x=({type:i,customStyles:n={}})=>{const o={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...n},t=o[i]||o.Medium;return e.jsx("div",{style:t,children:i})},u=["Lenient","Balanced","Aggressive"],g={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},v={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},m={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},y={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},h={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},f={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},j={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},S={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},C={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},b={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},I={display:"flex",gap:8,marginBottom:18},k={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},B={borderTop:"0.5px solid #eee",padding:"14px 0px"},T={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},A={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},R={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},D={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},E={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},z={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},W={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},L={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},M={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0};function H({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:t,historyIconSmall:l,onHistoryClick:s,historyTootipTitle:r}){const a="20px";return e.jsxs("div",{style:{...M,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:a,height:a,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),n&&e.jsxs("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&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:a,height:a,flexShrink:0},children:o}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t})]}),s&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>s(e),children:[l&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:a,height:a,flexShrink:0},children:l}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r})]})]})}function _({onAssignClick:i,onOpenCognitive:o,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:s,onHistoryClick:r,historyTootipTitle:a}){const[d,c]=n.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!d),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),d&&e.jsx(H,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:o?e=>{c(!1),o&&o(e)}:void 0,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:s,onHistoryClick:r,historyTootipTitle:a})]})}function q({users:i,onClick:n}){const o=i.length;return e.jsxs("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:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),o>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})}exports.AssignMenu=H,exports.DisplayUsers=q,exports.KebabMenu=_,exports.default=function({onClose:M,aiReason:H,onActionTrigger:F,onIterate:N,initialTone:O,onRegenerate:P,labels:U={},toneLevelsConfig:$=u,toneColorsConfig:G=g,dialConfigs:K=c,actions:V,disableAllActions:X=!1,customStyles:J={},severityChipStyles:Q={},customIcons:Y={},onOpenCognitive:Z,onHistoryClick:ee,historyIconSmall:ie,historyTootipTitle:ne,showTone:oe=!0,cognitiveSectionStyle:te={},cognitiveScoreBadgeStyle:le={},cognitiveScoreTextStyle:se={},cognitiveStyles:re={},cognitiveClassNames:ae={},cognitiveTitle:de="Cognitive Integrity",cognitiveTootipTitle:ce="Cognitive Decisioning",cognitiveLeftIcon:pe,cognitiveIconSmall:xe,showCognitiveRightArrow:ue=!0,isStreaming:ge,onAssignClick:ve,assignedUsers:me,onReviewUsersClick:ye,redlineId:he,aiReasonId:fe}){var je,Se,Ce,be,Ie,ke,we,Be,Te,Ae,Re,De,Ee,ze,We,Le,Me,He,_e;let qe=$.findIndex(e=>e===O);-1===qe&&(qe=1);const[Fe,Ne]=n.useState(!0),[Oe,Pe]=n.useState(!1),[Ue,$e]=n.useState(!1),[Ge,Ke]=n.useState(qe),[Ve]=n.useState(qe),Xe=$[Ge],Je=G[Xe]||"#BA7517",Qe=Ge!==Ve,Ye=[{id:"iterate",icon:Y.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:U.btnIterate||"Iterate",color:"#64748B",onClick:N},{id:"accept",icon:Y.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:U.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:Y.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:U.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:Ze,redlineConfig:ei,updateRedlineDataParent:ii}=r.useRequirementAI(),ni=V||Ye;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...v,...null===(je=null==J?void 0:J.DeviationSummaryStyles)||void 0===je?void 0:je.root},children:[e.jsxs("div",{style:{...m,...null===(Se=null==J?void 0:J.DeviationSummaryStyles)||void 0===Se?void 0:Se.header,marginBottom:Ue?"16px":"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:Y.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...y,...null===(Ce=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ce?void 0:Ce.title},children:U.summaryHeader||"Summary"})]}),me&&me.length>0&&e.jsx(q,{users:me,onClick:e=>{e.stopPropagation(),null==ye||ye()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ve||Z)&&e.jsx(_,{onAssignClick:ve,onOpenCognitive:Z,cognitiveIconSmall:xe,cognitiveTootipTitle:ce,historyIconSmall:ie,onHistoryClick:ee,historyTootipTitle:ne}),e.jsx("button",{onClick:M,style:{...w,...null===(be=null==J?void 0:J.DeviationSummaryStyles)||void 0===be?void 0:be.closeBtn,color:"#64748B"},children:"✕"})]})]}),e.jsx(s.Tooltip,{title:null===(Ie=null==H?void 0:H.redlining_details)||void 0===Ie?void 0:Ie.redline_title,children:e.jsx("p",{style:{...h,...null===(ke=null==J?void 0:J.DeviationSummaryStyles)||void 0===ke?void 0:ke.bodyText},children:null===(we=null==H?void 0:H.redlining_details)||void 0===we?void 0:we.redline_title})}),e.jsx("p",{style:{...f,...null===(Be=null==J?void 0:J.DeviationSummaryStyles)||void 0===Be?void 0:Be.summary},children:null===(Te=null==H?void 0:H.redlining_details)||void 0===Te?void 0:Te.redline_summary}),e.jsxs("div",{style:{...j,...null===(Ae=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>Ne(!Fe),style:{...C,...null===(Re=null==J?void 0:J.DeviationSummaryStyles)||void 0===Re?void 0:Re.impactToggle},children:[e.jsx("span",{style:{...b,...null===(De=null==J?void 0:J.DeviationSummaryStyles)||void 0===De?void 0:De.impactToggleLabel},children:U.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Fe?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(x,{type:(null==H?void 0:H.severity)||"Medium",customStyles:Q})]}),Fe&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...S,...null===(Ee=null==J?void 0:J.DeviationSummaryStyles)||void 0===Ee?void 0:Ee.impactText},children:e.jsx(d.AiReasonMarkdownWrapper,{message:`${null!==(We=null===(ze=null==H?void 0:H.redlining_details)||void 0===ze?void 0:ze.redline_impact)&&void 0!==We?We:U.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Le=null==J?void 0:J.DeviationSummaryStyles)||void 0===Le?void 0:Le.impactMarkdown})})})]}),e.jsx("div",{style:{...I,...null===(Me=null==J?void 0:J.DeviationSummaryStyles)||void 0===Me?void 0:Me.actionContainer},children:ni.map(i=>{var n,o;const t=X||i.disabled,l=t?{cursor:"not-allowed",opacity:.5,...null===(n=null==J?void 0:J.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...k,...null===(o=null==J?void 0:J.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:i.color,...i.style,...l},onClick:t?void 0:()=>{var e;i.useLabel?(async e=>{var i,n,o;null==F||F({status:"loading",action:e,metadata:{redlineId:he,aiReasonId:fe}});try{const{updated_reqai:t}=await a.resolveRedline({documentId:Ze,userEmail:null==ei?void 0:ei.userEmail,userName:null==ei?void 0:ei.userName,redlineId:null!==(i=null==H?void 0:H.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==ei?void 0:ei.baseApiUrl,redlineConfigId:null!==(n=null==ei?void 0:ei.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==ei?void 0:ei.token)&&void 0!==o?o:"");await(null==ii?void 0:ii(t)),null==F||F({status:"success",action:e,metadata:{redlineId:he,aiReasonId:fe}})}catch(e){null==F||F({status:"failed",action:null,metadata:{redlineId:he,aiReasonId:fe}})}})(i.id.toLowerCase()):null===(e=i.onClick)||void 0===e||e.call(i)},disabled:t,children:[i.icon,i.label]},i.id)})}),oe&&e.jsxs("div",{style:{...B,...null===(He=null==J?void 0:J.DeviationSummaryStyles)||void 0===He?void 0:He.toneContainer},children:[e.jsxs("button",{onClick:()=>Pe(!Oe),style:{...T,...null===(_e=null==J?void 0:J.DeviationSummaryStyles)||void 0===_e?void 0:_e.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(p,{toneIndex:Ge,configs:K}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:U.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Oe?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),Oe&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:U.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(o.ToneToggle,{isDirty:Qe,onToneChange:e=>{Ke(e)},toneColor:Je,toneIndex:Ge,onClickRegenerate:()=>null==P?void 0:P(Xe),toneLabels:$,isStreaming:ge,aiReason:H})]})]}),Z&&e.jsxs("div",{className:null==ae?void 0:ae.section,onClick:e=>{e.stopPropagation(),Z&&Z(e)},style:{...A,...null==re?void 0:re.section,...te},children:[e.jsxs("div",{className:null==ae?void 0:ae.headerLeft,style:{...R,...null==re?void 0:re.headerLeft},children:[e.jsx("span",{className:null==ae?void 0:ae.titleIcon,style:{...D,...null==re?void 0:re.titleIcon},children:null!=pe?pe:e.jsx(t.ReactComponent,{})}),e.jsx("div",{className:null==ae?void 0:ae.cognitiveTitle,style:{...E,...null==re?void 0:re.cognitiveTitle},children:de})]}),e.jsxs("div",{className:null==ae?void 0:ae.headerRight,style:{...z,...null==re?void 0:re.headerRight},children:[void 0!==(null==H?void 0:H.relevance_score)&&null!==(null==H?void 0:H.relevance_score)?e.jsxs("span",{className:null==ae?void 0:ae.scoreBadge,style:{...W,...null==re?void 0:re.scoreBadge,...le},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==ae?void 0:ae.scoreText,style:{...L,...null==re?void 0:re.scoreText,...se},children:[Math.round(Number(H.relevance_score)),"%"]})]}):null,ue&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})};
|
|
2
2
|
//# sourceMappingURL=DeviationSummary.js.map
|
package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),t=require("rehype-raw"),o=require("./UserStoryWithCitation.module.css.js"),l=require("../../shared/useMarkdownSearch.js"),d=require("lucide-react"),a=require("@mui/material"),r=require("dompurify"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),g=require("../RequirementAIWrapper/RequirementAIWrapper.js"),h=require("../../icons/CognitiveDecision.js"),v=require("../../icons/BrainRed.js"),p=require("../ai-reasoning/AiReasoningCitation.js"),m=require("../../icons/RelevanceScoreIcon.js"),f=require("../RecommendationBlock/RecommendationBlock.js"),C=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),j=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),w=require("./components/InlineManualComponent.js"),b=require("./components/HighlightButtonComponent.js");function I(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var R=I(n),N=I(i),$=I(t),k=I(r);const A=n.createContext(!1),q=n.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),E=n.createContext({rowId:""}),M=({aiReason:i,isHighConfidence:t,customStyle:l,customIcons:d})=>{var a;const{expandedInfo:r,setExpanded:s,reasonToRow:c}=n.useContext(q),{rowId:u}=n.useContext(E),g=String(i.id);u&&c.current.set(g,u);const p=(null===(a=null==r?void 0:r.aiReason)||void 0===a?void 0:a.id)===i.id,m=t?(null==d?void 0:d.highConfidence)||e.jsx(h.default,{}):(null==d?void 0:d.lowConfidence)||e.jsx(v.default,{});return e.jsxs("button",{className:o.default.aiReasoningButton,style:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),s(p?null:u,p?null:i)},children:[m,p?e.jsx("i",{className:`pi pi-angle-up ${t?o.default.aiReasoningIconHighConfidence:o.default.aiReasoningIconLowConfidence}`}):e.jsx("i",{className:`pi pi-angle-down ${t?o.default.aiReasoningIconHighConfidence:o.default.aiReasoningIconLowConfidence}`})]})},_=({children:i,node:t,customStyles:l,customIcons:d})=>{var a,r;const s=n.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=n.useContext(q),u=(null==c?void 0:c.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,h=null!==(r=null===(a=null==t?void 0:t.properties)||void 0===a?void 0:a.style)&&void 0!==r?r:void 0;return e.jsxs(E.Provider,{value:{rowId:s},children:[e.jsx("tr",{style:h?{cssText:h}:void 0,children:i}),u&&(null==c?void 0:c.aiReason)&&e.jsx("tr",{style:{width:"100%"},children:e.jsx("td",{colSpan:g||1,className:o.default.tableExpandedCell,children:e.jsx("div",{className:o.default.tableExpandedCellInner,children:e.jsx("div",{className:o.default.tableExpandedCellContent,children:e.jsx(x.default,{aiReason:c.aiReason,customIcons:d,customStyles:{aiReasoningContent:null==l?void 0:l.aiReasoningContent,aiReasoningAccordion:null==l?void 0:l.aiReasoningAccordion,aiReasoningMarkdown:null==l?void 0:l.aiReasoningMarkdown,aiReasoningPill:null==l?void 0:l.aiReasoningPill,webCitation:null==l?void 0:l.webCitation,stormeeCitation:null==l?void 0:l.stormeeCitation,waveformCitation:null==l?void 0:l.waveformCitation,imageCitation:null==l?void 0:l.imageCitation,fileCitation:null==l?void 0:l.fileCitation,appModCitation:null==l?void 0:l.appModCitation,rcaCitation:null==l?void 0:l.rcaCitation,readFileCitation:null==l?void 0:l.readFileCitation,loadingCitations:null==l?void 0:l.loadingCitations,chatCitation:null==l?void 0:l.chatCitation}})})})})})]})};const U=["del","ins"];function L(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,U,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var t;return`<code>${o=null!==(t=n[Number(i)])&&void 0!==t?t:"",o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var o})}(e)).join(""))}const T=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function D(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),o=e=>{var n,l;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>o(e)).flat().filter(e=>null!=e);if(!R.default.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(T.has(d))return e;const a=null===(l=R.default.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,o))||void 0===l?void 0:l.flat().filter(e=>null!=e);return a&&0!==a.length?R.default.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:o(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:i,noMarkdownContent:t,useMarkdown:r=!0,isParent:h,scenario:v,showUserStoryDiff:x=!1,aiReasoningsForBlock:I,isCitationLoadingDisplay:E=!1,className:U,highConfidenceIcon:T,lowConfidenceIcon:F,customStyles:P,customIcons:H,contextVariant:O,aiReasoningDiffView:B,userStoryCitations:V,artifactId:W,isCraflow:z,onCraAccept:G,onCraReject:Q,craFlowConfig:J,isDisplayHighlightControl:K=!1,showConfidenceScore:X=!0,CDNeededInChip:Y})=>{var Z;const ee=n.useRef(null),{userStory:ne,inlineUpdateComponentConfig:ie,getAvgScoreForStory:te,setUserStory:oe,aiReasoning:le,setAiReasoning:de,customIcons:ae,searchQueryList:re,searchQueryReasoningIdList:se,currentHighlightIndex:ce,segmentComponentConfig:ue,inlineManualComponentConfig:ge,diffEditConfig:he}=g.useRequirementAI(),ve=null!=H?H:null==ae?void 0:ae.userStoryIcons;null==P||P.searchHighlight;const{search:pe,clear:me}=l.useMarkdownSearch(ee),[fe,Ce]=n.useState("1"),[xe,je]=n.useState(null),ye=n.useRef(new Map),[Se,we]=n.useState(new Set),be=n.useCallback((e,n)=>{je(e&&n?{rowId:e,aiReason:n}:null)},[]),Ie=W?te(W):0,[Re,Ne]=n.useState([]),$e=n.useCallback(e=>{we(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),ke=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(ke).join(""):R.default.isValidElement(e)?ke(e.props.children):"",Ae=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,t,o)=>{const l=t.match(/<table[\s\S]*?<\/table>/i);if(l){return`<segment${i} data-table="${btoa(encodeURIComponent(l[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,t,o)=>{const l=n.substring(0,o),d=l.lastIndexOf("\n"),a=/^\s+[-*]\s/.test(l.substring(d+1))||/^\s+\d+\.\s/.test(l.substring(d+1)),r=/^\s*(\d+\.|\s*[-*])\s+$/.test(l.substring(d+1));if(a||r){let e=t;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let t;const o=new RegExp(n.source,n.flags);for(;null!==(t=o.exec(e));){const e=t[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),o=e.match(/<changed>([\s\S]*?)<\/changed>/i),l=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:l((null==n?void 0:n[1])||""),changedItemCount:l((null==o?void 0:o[1])||"")})}if(0===i.length)return e;let l=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const o=l.substring(0,n.index).split("\n").reverse();let d=!1;for(const e of o){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(d=!0);break}}if(!d)continue;const a=n.endIndex,r=e+1<i.length?i[e+1].index:l.length;let s=l.substring(a,r);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),l=l.substring(0,a)+s+l.substring(r)}return l}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=L(n),n},qe=n.useMemo(()=>i?Ae(i):i,[i]);n.useEffect(()=>{Ne(I||le)},[I,le]);const Ee=n.useMemo(()=>({span:({node:n,children:i,...t})=>{var o,l,d,a,r;const s=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o["highlight-id"])&&void 0!==l?l:null==t?void 0:t["highlight-id"],c="string"==typeof s&&Se.has(s),u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-color"])&&void 0!==a?a:null==t?void 0:t["highlight-color"];return e.jsx("span",{style:{...null!==(r=null==P?void 0:P.span)&&void 0!==r?r:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:n,children:i,...t})=>{var o,l,d,a,r,s;const c=null!==(l=null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.action)&&void 0!==l?l:null==t?void 0:t.action,u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(s=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-type"])&&void 0!==s?s:null==t?void 0:t["highlight-type"];return"highlight"===c?e.jsx(b.default,{highlightId:u,handleHighlightSpan:$e,icon:"web"===g?null==ve?void 0:ve.webCitationIcon:"doc"===g?null==ve?void 0:ve.fileCitationIcon:e.jsx(e.Fragment,{}),customStyles:"web"===g?null==P?void 0:P.webButton:"doc"===g?null==P?void 0:P.docButton:{}}):null},upt:({node:n,children:i,...t})=>{var o;const l=null==t?void 0:t.id,d=l?null===(o=l.split("$"))||void 0===o?void 0:o[1]:null,a=le.find(e=>e.id.toString()===d);return a?e.jsx(e.Fragment,{children:e.jsx(j.default,{aiReason:a,customStyles:null==P?void 0:P.inlineUpdatedComponent,handleClickCognitiveDecision:null==ie?void 0:ie.handleClickCognitiveDecision,handleClickUpdatedPill:null==ie?void 0:ie.handleClickUpdatedPill,handleClickOutputValue:null==ie?void 0:ie.handleClickOutputValue,customIcons:null==ie?void 0:ie.customIcons,CDNeededInChip:Y,children:i||e.jsx(e.Fragment,{})})}):i||e.jsx(e.Fragment,{})},del:({node:n,children:i,...t})=>{var l;const{cleanedChildren:d,extractedNodes:a}=D(i,["ins"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:o.default.deleted,style:null!==(l=null==P?void 0:P.deleted)&&void 0!==l?l:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:d}),a]})},ins:({children:n,...i})=>{var t;const{cleanedChildren:l,extractedNodes:d}=D(n,["del"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:o.default.inserted,style:null!==(t=null==P?void 0:P.inserted)&&void 0!==t?t:{},...i,onClick:()=>{i.onclick&&i.onclick()},children:l}),d]})},preserved:({children:n,...i})=>e.jsx("span",{className:o.default.preserved,style:null==P?void 0:P.preserved,...i,children:n}),manual:({children:n,...i})=>{const t=null==i?void 0:i.id,o=le.find(e=>e.id.toString()===t);return o?e.jsx(w.default,{aiReason:o,handleClick:null==ge?void 0:ge.handleClick,children:n}):n},invisible:({children:n,...i})=>e.jsx(e.Fragment,{}),h1:({node:n,...i})=>e.jsx("h1",{className:o.default.heading1,style:null==P?void 0:P.heading1,children:i.children}),h2:({node:n,...i})=>e.jsx("h2",{className:o.default.heading2,style:null==P?void 0:P.heading2,children:i.children}),h3:({node:n,...i})=>e.jsx("h3",{className:o.default.heading3,style:null==P?void 0:P.heading3,children:i.children}),b:({node:n,...i})=>e.jsx("b",{className:o.default.bold,style:null==P?void 0:P.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e.jsx("p",{...i,className:o.default.paragraph,style:null==P?void 0:P.paragraph,children:i.children}),updated:({node:n,...i})=>e.jsx(s.default,{...i,showUserStoryDiff:x,currentUpdatedTagId:fe,setCurrentUpdatedTagId:Ce,userStory:ne,setUserStory:oe,setAiReasoning:de,node:n,isCraflow:z,onCraAccept:G,onCraReject:Q,diffEditConfig:he,customStyles:null==P?void 0:P.updatedContent,craFlowConfig:J}),ol:({node:n,...i})=>{var t,l,d;const a=null!==(d=null!==(l=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==l?l:null==i?void 0:i.start)&&void 0!==d?d:void 0;return e.jsx("ol",{className:o.default.orderedList,style:null==P?void 0:P.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e.jsx("ul",{className:o.default.unorderedList,style:null==P?void 0:P.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e.jsx("div",{className:o.default.tableWrapper,children:e.jsx("table",{className:o.default.table,style:null==P?void 0:P.table,children:n})}),tr:({node:n,children:i})=>e.jsx(_,{node:n,children:i,customStyles:P}),td:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(A.Provider,{value:!0,children:e.jsx("td",{...l,style:o?{cssText:o}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:o,...l}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(A.Provider,{value:!0,children:e.jsx("th",{...l,style:o?{cssText:o}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const o=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e.jsx(f.default,{...i,customStyles:null==P?void 0:P.recommendationBlock,label:o})},a:({inline:i,children:t,node:o,...l})=>{var d,a,r;const s=n.useContext(A)||"true"==(null==l?void 0:l.table),c=`${null==l?void 0:l.href}`,u=null===(d=c.split("$"))||void 0===d?void 0:d[0],g=null===(a=c.split("$"))||void 0===a?void 0:a[1];if("ai_reasoning"===u){const n=(null!==(r=x?B:le)&&void 0!==r?r:[]).find(e=>e.id.toString()===decodeURIComponent(g)),i=se.includes(g);if(n){if(s)return e.jsx(M,{aiReason:n,customStyle:null==P?void 0:P.tableAiReasoning,customIcons:ve,isHighConfidence:n.relevance_score>=p.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const o=ke(t),l="source"!==o.trim().toLowerCase();return e.jsx(p.default,{aiReason:n,isSourceHasHighlight:i,inlineLabel:o,isInlineCitation:l,customIcons:ve,customStyles:{aiReasoningContent:null==P?void 0:P.aiReasoningContent,aiReasoningAccordion:null==P?void 0:P.aiReasoningAccordion,aiReasoningMarkdown:null==P?void 0:P.aiReasoningMarkdown,aiReasoningPill:null==P?void 0:P.aiReasoningPill,webCitation:null==P?void 0:P.webCitation,stormeeCitation:null==P?void 0:P.stormeeCitation,waveformCitation:null==P?void 0:P.waveformCitation,imageCitation:null==P?void 0:P.imageCitation,fileCitation:null==P?void 0:P.fileCitation,appModCitation:null==P?void 0:P.appModCitation,rcaCitation:null==P?void 0:P.rcaCitation,readFileCitation:null==P?void 0:P.readFileCitation,loadingCitations:null==P?void 0:P.loadingCitations,chatCitation:null==P?void 0:P.chatCitation,bigEnoughCitation:null==P?void 0:P.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:t,node:l,...d})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e.jsx("div",{children:e.jsx("code",{className:o.default.blockCode,style:null==P?void 0:P.code,children:i})}):e.jsx("code",{className:o.default.inlineCode,style:null==P?void 0:P.code,children:i}),learned:({children:n})=>e.jsx(a.Tooltip,{title:n,placement:"top",children:e.jsx(d.Info,{size:16,className:o.default.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",o=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e.jsx(c.default,{title:"Generated Code",code:o,language:t,customStyles:{pill:null==P?void 0:P.generatedCodePill,content:null==P?void 0:P.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var o,l,d,a;const r=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(t),c=s?e.jsx("div",{dangerouslySetInnerHTML:{__html:k.default.sanitize(s)}}):e.jsx("div",{children:i});return e.jsx(y.default,{id:r,node:n,children:c,props:t,segmentComponentConfig:ue,customStyles:P,customIcons:H,extractText:ke,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var o,l,d,a;const r=`${null===(o=n.position)||void 0===o?void 0:o.start.line}-${null===(l=n.position)||void 0===l?void 0:l.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`;return e.jsx(y.default,{id:r,node:n,children:i,props:t,segmentComponentConfig:ue,customStyles:P,customIcons:H,extractText:ke})}}),[Re,J,le,V,fe,x,i,H,re,se,P,ue,Se,$e]);return n.useEffect(()=>{if(!ee.current)return;if(!re.length)return void me();let e;if(0===se.length||K)requestAnimationFrame(()=>{pe([re[ce].replace(/\*/g,"")])});else{const n=ee.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{pe([re[ce].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[re,se,ce,K]),e.jsx(q.Provider,{value:{expandedInfo:xe,setExpanded:be,reasonToRow:ye},children:e.jsxs("div",{ref:ee,className:`${o.default.container} ${"approving"!==v?o.default.wrapper:""} ${U||""}`,style:null==P?void 0:P.container,children:[r?e.jsx(S.MarkdownContextProvider,{children:e.jsx(N.default,{components:Ee,rehypePlugins:[$.default],children:qe})}):t,Ie>0&&X&&e.jsx("div",{className:o.default.confidenceScoreContainer,style:null==P?void 0:P.confidenceScoreContainer,children:e.jsxs("span",{className:o.default.confidenceScore,style:null==P?void 0:P.confidenceScore,children:[e.jsx(m.default,{size:14,color:(null==P?void 0:P.confidenceScoreIconColor)||"#166534"}),Ie,"%"]})}),E&&e.jsx("div",{className:o.default.citationLoader,style:null==P?void 0:P.citationLoaderContainer,children:e.jsx(u.default,{customStyles:{container:null==P?void 0:P.citationLoadingContainer,icon:null==P?void 0:P.citationLoadingIcon,text:null==P?void 0:P.citationLoadingText}})}),h&&e.jsx("div",{style:{...null===(Z=null==P?void 0:P.attachedContext)||void 0===Z?void 0:Z.wrapper},className:"flex mt-5",children:e.jsx(C.default,{customStyles:null==P?void 0:P.attachedContext,variant:O})})]})})},exports.splitNestedDiffNodes=D;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),t=require("rehype-raw"),l=require("./UserStoryWithCitation.module.css.js"),o=require("../../shared/useMarkdownSearch.js"),d=require("lucide-react"),a=require("@mui/material"),r=require("dompurify"),s=require("../../shared/UpdatedAnimationContent.js"),c=require("../../shared/GeneratedCodeCitation.js"),u=require("../../shared/CitationLoadingIndicator.js"),g=require("../RequirementAIWrapper/RequirementAIWrapper.js"),p=require("../../icons/CognitiveDecision.js"),v=require("../../icons/BrainRed.js"),h=require("../ai-reasoning/AiReasoningCitation.js"),m=require("../../icons/RelevanceScoreIcon.js"),f=require("../RecommendationBlock/RecommendationBlock.js"),C=require("../UserStoryCard/AttachedContext.js"),x=require("../ai-reasoning/AiReasoningCitationContent.js"),j=require("./components/InlineUpdatedComponent.js"),y=require("../segment/SegmentWrapper.js"),S=require("../../store/markdown-context.js"),w=require("./components/InlineManualComponent.js"),I=require("./components/HighlightButtonComponent.js"),b=require("../../../../utils/tagHelper.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=R(n),$=R(i),k=R(t),A=R(r);const q=n.createContext(!1),E=n.createContext({expandedInfo:null,setExpanded:()=>{},reasonToRow:{current:new Map}}),M=n.createContext({rowId:""}),T=({aiReason:i,isHighConfidence:t,customStyle:o,customIcons:d})=>{var a;const{expandedInfo:r,setExpanded:s,reasonToRow:c}=n.useContext(E),{rowId:u}=n.useContext(M),g=String(i.id);u&&c.current.set(g,u);const h=(null===(a=null==r?void 0:r.aiReason)||void 0===a?void 0:a.id)===i.id,m=t?(null==d?void 0:d.highConfidence)||e.jsx(p.default,{}):(null==d?void 0:d.lowConfidence)||e.jsx(v.default,{});return e.jsxs("button",{className:l.default.aiReasoningButton,style:o,onClick:e=>{e.stopPropagation(),e.preventDefault(),s(h?null:u,h?null:i)},children:[m,h?e.jsx("i",{className:`pi pi-angle-up ${t?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`}):e.jsx("i",{className:`pi pi-angle-down ${t?l.default.aiReasoningIconHighConfidence:l.default.aiReasoningIconLowConfidence}`})]})},_=({children:i,node:t,customStyles:o,customIcons:d})=>{var a,r;const s=n.useRef(Math.random().toString(36).slice(2)).current,{expandedInfo:c}=n.useContext(E),u=(null==c?void 0:c.rowId)===s,g=Array.isArray(null==t?void 0:t.children)?t.children.filter(e=>"element"===e.type).length:1,p=null!==(r=null===(a=null==t?void 0:t.properties)||void 0===a?void 0:a.style)&&void 0!==r?r:void 0;return e.jsxs(M.Provider,{value:{rowId:s},children:[e.jsx("tr",{style:p?{cssText:p}:void 0,children:i}),u&&(null==c?void 0:c.aiReason)&&e.jsx("tr",{style:{width:"100%"},children:e.jsx("td",{colSpan:g||1,className:l.default.tableExpandedCell,children:e.jsx("div",{className:l.default.tableExpandedCellInner,children:e.jsx("div",{className:l.default.tableExpandedCellContent,children:e.jsx(x.default,{aiReason:c.aiReason,customIcons:d,customStyles:{aiReasoningContent:null==o?void 0:o.aiReasoningContent,aiReasoningAccordion:null==o?void 0:o.aiReasoningAccordion,aiReasoningMarkdown:null==o?void 0:o.aiReasoningMarkdown,aiReasoningPill:null==o?void 0:o.aiReasoningPill,webCitation:null==o?void 0:o.webCitation,stormeeCitation:null==o?void 0:o.stormeeCitation,waveformCitation:null==o?void 0:o.waveformCitation,imageCitation:null==o?void 0:o.imageCitation,fileCitation:null==o?void 0:o.fileCitation,appModCitation:null==o?void 0:o.appModCitation,rcaCitation:null==o?void 0:o.rcaCitation,readFileCitation:null==o?void 0:o.readFileCitation,loadingCitations:null==o?void 0:o.loadingCitations,chatCitation:null==o?void 0:o.chatCitation}})})})})})]})};const U=["del","ins"];function L(e){return function(e,n,i){const t=n.join("|");return e.replace(new RegExp(`<(${t})>([\\s\\S]*?)<\\/\\1>`,"gi"),(e,n,t)=>`<${n}>${i(t)}</${n}>`)}(e,U,e=>e.split(/(<[^>]+>)/g).map(e=>!e||/^<[^>]+>$/.test(e)?e:function(e){if(!e)return e;const n=[];return e.replace(/`([^`\n]+)`/g,(e,i)=>`@@CODE_SPAN_${n.push(i)-1}@@`).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,(e,i)=>{var t;return`<code>${l=null!==(t=n[Number(i)])&&void 0!==t?t:"",l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code>`;var l})}(e)).join(""))}const F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function P(e,n){const i=[],t=new Set(n.map(e=>e.toLowerCase())),l=e=>{var n,o;try{if(null==e||"boolean"==typeof e)return null;if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e.map(e=>l(e)).flat().filter(e=>null!=e);if(!N.default.isValidElement(e))return e;const d="string"==typeof e.type?e.type.toLowerCase():"";if(t.has(d))return i.push(e),null;if(F.has(d))return e;const a=null===(o=N.default.Children.map(null===(n=e.props)||void 0===n?void 0:n.children,l))||void 0===o?void 0:o.flat().filter(e=>null!=e);return a&&0!==a.length?N.default.cloneElement(e,void 0,a):null}catch(n){return console.error("splitNestedDiffNodes failed while processing node:",n),e}};try{return{cleanedChildren:l(e),extractedNodes:i}}catch(n){return console.error("splitNestedDiffNodes failed:",n),{cleanedChildren:e,extractedNodes:[]}}}exports.default=({message:i,noMarkdownContent:t,useMarkdown:r=!0,isParent:p,scenario:v,showUserStoryDiff:x=!1,aiReasoningsForBlock:R,isCitationLoadingDisplay:M=!1,className:U,highConfidenceIcon:F,lowConfidenceIcon:D,customStyles:H,customIcons:O,contextVariant:B,aiReasoningDiffView:V,userStoryCitations:W,artifactId:z,isCraflow:G,onCraAccept:Q,onCraReject:J,craFlowConfig:K,isDisplayHighlightControl:X=!1,showConfidenceScore:Y=!0,CDNeededInChip:Z})=>{var ee;const ne=n.useRef(null),{userStory:ie,inlineUpdateComponentConfig:te,getAvgScoreForStory:le,setUserStory:oe,aiReasoning:de,setAiReasoning:ae,customIcons:re,searchQueryList:se,searchQueryReasoningIdList:ce,currentHighlightIndex:ue,segmentComponentConfig:ge,inlineManualComponentConfig:pe,diffEditConfig:ve}=g.useRequirementAI(),he=null!=O?O:null==re?void 0:re.userStoryIcons;null==H||H.searchHighlight;const{search:me,clear:fe}=o.useMarkdownSearch(ne),[Ce,xe]=n.useState("1"),[je,ye]=n.useState(null),Se=n.useRef(new Map),[we,Ie]=n.useState(new Set),be=n.useCallback((e,n)=>{ye(e&&n?{rowId:e,aiReason:n}:null)},[]),Re=z?le(z):0,[Ne,$e]=n.useState([]),ke=n.useCallback(e=>{Ie(n=>{const i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),Ae=e=>null==e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(Ae).join(""):N.default.isValidElement(e)?Ae(e.props.children):"",qe=e=>{let n=e;return n=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>`<deleted>${n.replace(/ai_reasoning\$(\d+)/g,(e,n)=>`ai_reasoning$${n}-legacy`)}</deleted>`),n=n.replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,(e,n,i)=>`\n\n<generatedCode${n} data-raw="${btoa(encodeURIComponent(i.trim()))}"></generatedCode>\n\n`),n=n.replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2"),n=n.replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,(e,n,i,t,l)=>{const o=t.match(/<table[\s\S]*?<\/table>/i);if(o){return`<segment${i} data-table="${btoa(encodeURIComponent(o[0]))}"></segment>`}return e}),n=n.replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,(e,n,i)=>{if(/<table[\s>]/i.test(i)){return`<updatedsegment${n} data-raw="${btoa(encodeURIComponent(i))}"></updatedsegment>`}return e}),n=n.replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,(e,i,t,l)=>{const o=n.substring(0,l),d=o.lastIndexOf("\n"),a=/^\s+[-*]\s/.test(o.substring(d+1))||/^\s+\d+\.\s/.test(o.substring(d+1)),r=/^\s*(\d+\.|\s*[-*])\s+$/.test(o.substring(d+1));if(a||r){let e=t;return e=e.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n"),e=e.replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),e=e.replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),`<updated${i}>${e}</updated>`}return e}),n=function(e){const n=/<updated[^>]*>[\s\S]*?<\/updated>/gi,i=[];let t;const l=new RegExp(n.source,n.flags);for(;null!==(t=l.exec(e));){const e=t[0],n=e.match(/<deleted>([\s\S]*?)<\/deleted>/i),l=e.match(/<changed>([\s\S]*?)<\/changed>/i),o=e=>(e.match(/^\s*\d+\.\s/gm)||[]).length;i.push({index:t.index,endIndex:t.index+t[0].length,deletedItemCount:o((null==n?void 0:n[1])||""),changedItemCount:o((null==l?void 0:l[1])||"")})}if(0===i.length)return e;let o=e;for(let e=i.length-1;e>=0;e--){const n=i[e],t=n.changedItemCount-n.deletedItemCount;if(0===t)continue;const l=o.substring(0,n.index).split("\n").reverse();let d=!1;for(const e of l){const n=e.trim();if(""!==n){/^\d+\.\s/.test(n)&&(d=!0);break}}if(!d)continue;const a=n.endIndex,r=e+1<i.length?i[e+1].index:o.length;let s=o.substring(a,r);s=s.replace(/^(\s*)(\d+)\.\s/gm,(e,n,i)=>`${n}${parseInt(i,10)+t}. `),o=o.substring(0,a)+s+o.substring(r)}return o}(n),n=function(e){let n=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==n}),`<deleted>${i}</deleted>`});return n=n.replace(/<changed>([\s\S]*?)<\/changed>/gi,(e,n)=>{const i=n.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==n,preview:n.substring(0,120)}),`<changed>${i}</changed>`}),n}(n),n=L(n),n},Ee=n.useMemo(()=>i?qe(i):i,[i]);n.useEffect(()=>{$e(R||de)},[R,de]);const Me=n.useMemo(()=>({span:({node:n,children:i,...t})=>{var l,o,d,a,r;const s=null!==(o=null===(l=null==n?void 0:n.properties)||void 0===l?void 0:l["highlight-id"])&&void 0!==o?o:null==t?void 0:t["highlight-id"],c="string"==typeof s&&we.has(s),u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-color"])&&void 0!==a?a:null==t?void 0:t["highlight-color"];return e.jsx("span",{style:{...null!==(r=null==H?void 0:H.span)&&void 0!==r?r:{},...c?{backgroundColor:u||"#fef08a"}:{}},children:i})},button:({node:n,children:i,...t})=>{var l,o,d,a,r,s;const c=null!==(o=null===(l=null==n?void 0:n.properties)||void 0===l?void 0:l.action)&&void 0!==o?o:null==t?void 0:t.action,u=null!==(a=null===(d=null==n?void 0:n.properties)||void 0===d?void 0:d["highlight-id"])&&void 0!==a?a:null==t?void 0:t["highlight-id"],g=null!==(s=null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r["highlight-type"])&&void 0!==s?s:null==t?void 0:t["highlight-type"];return"highlight"===c?e.jsx(I.default,{highlightId:u,handleHighlightSpan:ke,icon:"web"===g?null==he?void 0:he.webCitationIcon:"doc"===g?null==he?void 0:he.fileCitationIcon:e.jsx(e.Fragment,{}),customStyles:"web"===g?null==H?void 0:H.webButton:"doc"===g?null==H?void 0:H.docButton:{}}):null},upt:({node:n,children:i,...t})=>{var l,o;const d=null==t?void 0:t.id,a=d?null===(o=null===(l=d.split("$"))||void 0===l?void 0:l[1])||void 0===o?void 0:o.replaceAll("@","<").replaceAll("#",">"):null,r=de.find(e=>e.id.toString()===a);return r?e.jsx(e.Fragment,{children:e.jsx(j.default,{aiReason:r,customStyles:null==H?void 0:H.inlineUpdatedComponent,handleClickCognitiveDecision:null==te?void 0:te.handleClickCognitiveDecision,handleClickUpdatedPill:null==te?void 0:te.handleClickUpdatedPill,handleClickOutputValue:null==te?void 0:te.handleClickOutputValue,customIcons:null==te?void 0:te.customIcons,CDNeededInChip:Z,children:i||e.jsx(e.Fragment,{})})}):i||e.jsx(e.Fragment,{})},del:({node:n,children:i,...t})=>{var o;const{cleanedChildren:d,extractedNodes:a}=P(i,["ins"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.default.deleted,style:null!==(o=null==H?void 0:H.deleted)&&void 0!==o?o:{},...t,onClick:()=>{t.onclick&&t.onclick()},children:d}),a]})},ins:({children:n,...i})=>{var t;const{cleanedChildren:o,extractedNodes:d}=P(n,["del"]);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.default.inserted,style:null!==(t=null==H?void 0:H.inserted)&&void 0!==t?t:{},...i,onClick:()=>{i.onclick&&i.onclick()},children:o}),d]})},preserved:({children:n,...i})=>e.jsx("span",{className:l.default.preserved,style:null==H?void 0:H.preserved,...i,children:n}),manual:({children:n,...i})=>{var t;const l=null===(t=null==i?void 0:i.id)||void 0===t?void 0:t.replaceAll("@","<").replaceAll("#",">"),o=de.find(e=>e.id.toString()===l);return o?e.jsx(w.default,{aiReason:o,handleClick:null==pe?void 0:pe.handleClick,children:n}):n||e.jsx(e.Fragment,{})},invisible:({children:n,...i})=>e.jsx(e.Fragment,{}),h1:({node:n,...i})=>e.jsx("h1",{className:l.default.heading1,style:null==H?void 0:H.heading1,children:i.children}),h2:({node:n,...i})=>e.jsx("h2",{className:l.default.heading2,style:null==H?void 0:H.heading2,children:i.children}),h3:({node:n,...i})=>e.jsx("h3",{className:l.default.heading3,style:null==H?void 0:H.heading3,children:i.children}),b:({node:n,...i})=>e.jsx("b",{className:l.default.bold,style:null==H?void 0:H.bold,children:null==i?void 0:i.children}),p:({node:n,...i})=>e.jsx("p",{...i,className:l.default.paragraph,style:null==H?void 0:H.paragraph,children:i.children}),updated:({node:n,...i})=>e.jsx(s.default,{...i,showUserStoryDiff:x,currentUpdatedTagId:Ce,setCurrentUpdatedTagId:xe,userStory:ie,setUserStory:oe,setAiReasoning:ae,node:n,isCraflow:G,onCraAccept:Q,onCraReject:J,diffEditConfig:ve,customStyles:null==H?void 0:H.updatedContent,craFlowConfig:K}),ol:({node:n,...i})=>{var t,o,d;const a=null!==(d=null!==(o=null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.start)&&void 0!==o?o:null==i?void 0:i.start)&&void 0!==d?d:void 0;return e.jsx("ol",{className:l.default.orderedList,style:null==H?void 0:H.olist,...a?{start:Number(a)}:{},children:null==i?void 0:i.children})},ul:({node:n,...i})=>e.jsx("ul",{className:l.default.unorderedList,style:null==H?void 0:H.ulist,children:null==i?void 0:i.children}),table:({children:n})=>e.jsx("div",{className:l.default.tableWrapper,children:e.jsx("table",{className:l.default.table,style:null==H?void 0:H.table,children:n})}),tr:({node:n,children:i})=>e.jsx(_,{node:n,children:i,customStyles:H}),td:({node:n,children:i})=>{var t;const{style:l,...o}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("td",{...o,style:l?{cssText:l}:void 0,children:i})})},th:({node:n,children:i})=>{var t;const{style:l,...o}=null!==(t=null==n?void 0:n.properties)&&void 0!==t?t:{};return e.jsx(q.Provider,{value:!0,children:e.jsx("th",{...o,style:l?{cssText:l}:void 0,children:i})})},recommendation:({node:n,...i})=>{var t;const l=`The AI has selected this content based on: ${(null===(t=null==i?void 0:i.children)||void 0===t?void 0:t[0])||""}`;return e.jsx(f.default,{...i,customStyles:null==H?void 0:H.recommendationBlock,label:l})},a:({inline:i,children:t,node:l,...o})=>{var d,a,r;const s=n.useContext(q)||"true"==(null==o?void 0:o.table),c=`${null==o?void 0:o.href}`,u=null===(d=c.split("$"))||void 0===d?void 0:d[0],g=null===(a=c.split("$"))||void 0===a?void 0:a[1];if("ai_reasoning"===u){const n=(null!==(r=x?V:de)&&void 0!==r?r:[]).find(e=>e.id.toString()===decodeURIComponent(g)),i=ce.includes(g);if(n){if(s)return e.jsx(T,{aiReason:n,customStyle:null==H?void 0:H.tableAiReasoning,customIcons:he,isHighConfidence:n.relevance_score>=h.SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING});const l=Ae(t),o="source"!==l.trim().toLowerCase();return e.jsx(h.default,{aiReason:n,isSourceHasHighlight:i,inlineLabel:l,isInlineCitation:o,customIcons:he,customStyles:{aiReasoningContent:null==H?void 0:H.aiReasoningContent,aiReasoningAccordion:null==H?void 0:H.aiReasoningAccordion,aiReasoningMarkdown:null==H?void 0:H.aiReasoningMarkdown,aiReasoningPill:null==H?void 0:H.aiReasoningPill,webCitation:null==H?void 0:H.webCitation,stormeeCitation:null==H?void 0:H.stormeeCitation,waveformCitation:null==H?void 0:H.waveformCitation,imageCitation:null==H?void 0:H.imageCitation,fileCitation:null==H?void 0:H.fileCitation,appModCitation:null==H?void 0:H.appModCitation,rcaCitation:null==H?void 0:H.rcaCitation,readFileCitation:null==H?void 0:H.readFileCitation,loadingCitations:null==H?void 0:H.loadingCitations,chatCitation:null==H?void 0:H.chatCitation,bigEnoughCitation:null==H?void 0:H.bigEnoughCitation}})}}return null},code:({inline:n,children:i,className:t,node:o,...d})=>/language-(\w+)/.exec(t||"")||(null==t?void 0:t.includes("language-"))?e.jsx("div",{children:e.jsx("code",{className:l.default.blockCode,style:null==H?void 0:H.code,children:i})}):e.jsx("code",{className:l.default.inlineCode,style:null==H?void 0:H.code,children:i}),learned:({children:n})=>e.jsx(a.Tooltip,{title:n,placement:"top",children:e.jsx(d.Info,{size:16,className:l.default.learned})}),generatedcode:({node:n,...i})=>{const t=(null==i?void 0:i.language)||"python",l=(e=>{let n="";try{if(e["data-raw"])n=decodeURIComponent(atob(e["data-raw"]));else{const i=e=>{var n;return"string"==typeof e?e:Array.isArray(e)?e.map(i).join(""):(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?i(e.props.children):""};n=i(e.children)}}catch(i){console.error("Error decoding generated code:",i),n=String(e.children)}return n})(i);return e.jsx(c.default,{title:"Generated Code",code:l,language:t,customStyles:{pill:null==H?void 0:H.generatedCodePill,content:null==H?void 0:H.generatedCodeContent}})},updatedsegment:({node:n,children:i,...t})=>{var l,o,d,a;const r=`${null===(l=n.position)||void 0===l?void 0:l.start.line}-${null===(o=n.position)||void 0===o?void 0:o.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`,s=(e=>{if(!e["data-raw"])return null;try{return decodeURIComponent(atob(e["data-raw"]))}catch(e){return console.error("Error decoding segment raw content:",e),null}})(t),c=s?e.jsx("div",{dangerouslySetInnerHTML:{__html:A.default.sanitize(s)}}):e.jsx("div",{children:i});return e.jsx(y.default,{id:r,node:n,children:c,props:t,segmentComponentConfig:ge,customStyles:H,customIcons:O,extractText:Ae,isUpdatedSegment:!0})},segment:({node:n,children:i,...t})=>{var l,o,d,a;const r=`${null===(l=n.position)||void 0===l?void 0:l.start.line}-${null===(o=n.position)||void 0===o?void 0:o.start.column}-${null===(d=n.position)||void 0===d?void 0:d.end.line}-${null===(a=n.position)||void 0===a?void 0:a.end.column}`;return e.jsx(y.default,{id:r,node:n,children:i,props:t,segmentComponentConfig:ge,customStyles:H,customIcons:O,extractText:Ae})}}),[Ne,K,de,W,Ce,x,i,O,se,ce,H,ge,we,ke]),Te=n.useMemo(()=>{let e=b.escapeTagIds(Ee,["manual","upt"]);return["del","ins","preserved","manual","upt"].forEach(n=>{e=b.splitTagAcrossParagraphs(e,n)}),e},[Ee]);return n.useEffect(()=>{if(!ne.current)return;if(!se.length)return void fe();let e;if(0===ce.length||X)requestAnimationFrame(()=>{me([se[ue].replace(/\*/g,"")])});else{const n=ne.current,i=new MutationObserver(()=>{clearTimeout(e),e=setTimeout(()=>{i.disconnect(),requestAnimationFrame(()=>{me([se[ue].replace(/\*/g,"")])})},50)});i.observe(n,{childList:!0,subtree:!0})}return()=>{clearTimeout(e)}},[se,ce,ue,X]),e.jsx(E.Provider,{value:{expandedInfo:je,setExpanded:be,reasonToRow:Se},children:e.jsxs("div",{ref:ne,className:`${l.default.container} ${"approving"!==v?l.default.wrapper:""} ${U||""}`,style:null==H?void 0:H.container,children:[r?e.jsx(S.MarkdownContextProvider,{children:e.jsx($.default,{components:Me,rehypePlugins:[k.default],children:Te})}):t,Re>0&&Y&&e.jsx("div",{className:l.default.confidenceScoreContainer,style:null==H?void 0:H.confidenceScoreContainer,children:e.jsxs("span",{className:l.default.confidenceScore,style:null==H?void 0:H.confidenceScore,children:[e.jsx(m.default,{size:14,color:(null==H?void 0:H.confidenceScoreIconColor)||"#166534"}),Re,"%"]})}),M&&e.jsx("div",{className:l.default.citationLoader,style:null==H?void 0:H.citationLoaderContainer,children:e.jsx(u.default,{customStyles:{container:null==H?void 0:H.citationLoadingContainer,icon:null==H?void 0:H.citationLoadingIcon,text:null==H?void 0:H.citationLoadingText}})}),p&&e.jsx("div",{style:{...null===(ee=null==H?void 0:H.attachedContext)||void 0===ee?void 0:ee.wrapper},className:"flex mt-5",children:e.jsx(C.default,{customStyles:null==H?void 0:H.attachedContext,variant:B})})]})})},exports.splitNestedDiffNodes=P;
|
|
2
2
|
//# sourceMappingURL=UserStoryWithCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("./InlineManualComponent.module.css.js");exports.default=function(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("./InlineManualComponent.module.css.js");exports.default=function(a){var i,n,o,r;return e.jsx("span",{className:l.default[`manual-${null===(i=a.aiReason.redlining_details)||void 0===i?void 0:i.status}`],"data-id":null===(r=null===(o=null===(n=null==a?void 0:a.aiReason)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toString)||void 0===r?void 0:r.call(o),onClick:e=>{var l;e.stopPropagation(),e.preventDefault(),null===(l=a.handleClick)||void 0===l||l.call(a,e.currentTarget,a.aiReason)},children:a.children})};
|
|
2
2
|
//# sourceMappingURL=InlineManualComponent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("@mui/material"),n=require("../../../utils/css.utils.js"),i=require("./InlineUpdatedComponent.module.css.js"),o=require("../../../icons/CognitiveDecision.js"),t=require("lucide-react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("@mui/material"),n=require("../../../utils/css.utils.js"),i=require("./InlineUpdatedComponent.module.css.js"),o=require("../../../icons/CognitiveDecision.js"),t=require("lucide-react"),d=require("react");exports.default=({aiReason:r,children:a,customStyles:s,handleClickCognitiveDecision:u,handleClickUpdatedPill:c,handleClickOutputValue:v,customIcons:p,CDNeededInChip:f=!0})=>{var g,m,h,x,j,C,y,b,_,w,k,D,N,P,S,T,q,O,$,I,L,R,z;const E=d.useRef(null),A=d.useRef(null),[W,M]=d.useState(null),U=d.useCallback(()=>{var e;const l=A.current,n=(null===(e=E.current)||void 0===e?void 0:e.offsetParent)||(null==l?void 0:l.offsetParent);if(!(l&&n instanceof HTMLElement))return;const i=l.getBoundingClientRect(),o=n.getBoundingClientRect(),t=i.top-o.top+i.height/2;M(e=>null!==e&&Math.abs(e-t)<.5?e:t)},[]);d.useLayoutEffect(()=>{U()}),d.useLayoutEffect(()=>{var e,l;if("undefined"==typeof window)return;const n=window.requestAnimationFrame(U);window.addEventListener("resize",U);const i="undefined"!=typeof ResizeObserver?new ResizeObserver(U):null;A.current&&(null==i||i.observe(A.current));const o=(null===(e=E.current)||void 0===e?void 0:e.offsetParent)||(null===(l=A.current)||void 0===l?void 0:l.offsetParent);return o instanceof HTMLElement&&(null==i||i.observe(o)),()=>{window.cancelAnimationFrame(n),window.removeEventListener("resize",U),null==i||i.disconnect()}},[U]);const F="pending"!==(null===(g=r.redlining_details)||void 0===g?void 0:g.status)?"#303030":null===(x=null===(h=null===(m=r.redlining_details)||void 0===m?void 0:m.evaluation_outputs)||void 0===h?void 0:h.metadata)||void 0===x?void 0:x.label_color,B={color:F||"#000000",background:n.hexToOpacity(F||"#000000",25),border:`1px solid ${n.hexToOpacity(F||"#000000",75)}`},H=F||"#000000",V=n.hexToOpacity(F||"#000000",25),X={background:n.hexToOpacity(F||"#000000",75),...null==s?void 0:s.dividerStyle};let G=null;const J=null===(j=r.redlining_details)||void 0===j?void 0:j.status;"accepted"===J?G=null!==(C=null==p?void 0:p.accepted)&&void 0!==C?C:e.jsx(t.Check,{color:"#16A34A"}):"rejected"===J?G=null!==(y=null==p?void 0:p.rejected)&&void 0!==y?y:e.jsx(t.X,{color:"#DC2626"}):"reverted"===J&&(G=null!==(b=null==p?void 0:p.reverted)&&void 0!==b?b:e.jsx(t.Undo2,{color:"#475569"}));const K=null===W?{}:{"--inline-update-anchor-top":`${W}px`},Q=null===W?"":` ${i.default.anchorAligned}`;return e.jsxs("span",{className:i.default.inlineUpdatedWrapper,children:[G&&e.jsx("span",{className:`${i.default.resolvedStatus}${Q}`,style:{...K,...null==s?void 0:s.resolvedIcon},children:G}),e.jsx("span",{ref:E,"data-id":r.id.toString(),onClick:e=>{e.stopPropagation(),null==c||c(e.currentTarget,r)},className:`${i.default.pillWrapper}${Q}`,style:{...K,...null==s?void 0:s.pillStyleWrapper},children:e.jsxs("span",{className:i.default.pillComponent,style:{...B,...null===(_=null==s?void 0:s.pillComponent)||void 0===_?void 0:_.commonStyle},children:[e.jsx("span",{children:(null===(D=null===(k=null===(w=r.redlining_details)||void 0===w?void 0:w.evaluation_outputs)||void 0===k?void 0:k.metadata)||void 0===D?void 0:D.label_text)||""}),e.jsx(l.Divider,{className:i.default.dividerStyle,style:X}),e.jsx("span",{className:i.default["output-container"],onClick:e=>{v&&(e.stopPropagation(),null==v||v(e.currentTarget,r))},children:r.resolving?e.jsx(l.CircularProgress,{size:(null===(N=null==s?void 0:s.loader)||void 0===N?void 0:N.size)||18,"aria-label":"Loading…",sx:{color:(null===(P=null==s?void 0:s.loader)||void 0===P?void 0:P.color)||F}}):"pending"!==(null===(S=r.redlining_details)||void 0===S?void 0:S.status)?G:null===(q=null===(T=null==r?void 0:r.redlining_details)||void 0===T?void 0:T.evaluation_outputs)||void 0===q?void 0:q.output_value}),f&&e.jsxs(e.Fragment,{children:[e.jsx(l.Divider,{className:i.default.dividerStyle,style:X}),e.jsx("span",{onClick:e=>{e.stopPropagation(),null==u||u(e.currentTarget,r)},className:i.default.cognitiveDecisionWrapper,style:null===(O=null==s?void 0:s.cognitiveDecisionIcon)||void 0===O?void 0:O.wrapper,children:e.jsx(o.default,{color:(null===($=null==s?void 0:s.cognitiveDecisionIcon)||void 0===$?void 0:$.color)||H,backgroundColor:(null===(I=null==s?void 0:s.cognitiveDecisionIcon)||void 0===I?void 0:I.backgroundColor)||V})}),e.jsx("span",{className:i.default.chevronWrapper,style:null===(L=null==s?void 0:s.Chevron)||void 0===L?void 0:L.wrapper,children:e.jsx(t.ChevronDown,{color:(null===(R=null==s?void 0:s.Chevron)||void 0===R?void 0:R.color)||F})})]})]})}),e.jsx("span",{ref:A,className:i.default[`upt-${null===(z=r.redlining_details)||void 0===z?void 0:z.status}`],onClick:e=>{e.preventDefault(),e.stopPropagation(),E.current&&(null==c||c(E.current,r))},children:a})]})};
|
|
2
2
|
//# sourceMappingURL=InlineUpdatedComponent.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.escapeTagIds=function(e,s){const n=s.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),i=new RegExp(`<(${n})\\b([^>]*?)\\bid="([^"]*)"([^>]*)>`,"gi");return e.replace(i,(e,s,n,i,r)=>`<${s}${n}id="${i.replace(/</g,"@").replace(/>/g,"#")}"${r}>`)},exports.mergeTagAcrossParagraphs=function(e,s){var n,i,r,l;const t=["del","ins","preserved"].includes(s),c=["manual","upt"].includes(s),a=new RegExp(`(<${s}(?:\\s[^>]*)?>)|(</${s}>)|(${t?"</?(?:manual|upt)\\b[^>]*>":"$^"})`,"gi");let o,p="",$=0,u="",d="",g="",x="";for(;null!==(o=a.exec(e));){const s=e.slice($,o.index),[,f,v,b]=o;if(g)if(x+=s,b)p+=g+x+b,u="",d="",g="",x="";else if(f){const e=c&&null!==(i=null===(n=f.match(/\bid\s*=\s*["']?([^"'\s>]+)["']?/i))||void 0===n?void 0:n[1])&&void 0!==i?i:"";/^\s*$/.test(x)&&(c&&e===d||t)?(p+=x,x="",g=""):(p+=g+x+f,u=f,d=e,g="",x="")}else v&&(p+=g+x,g=v,x="");else u?(p+=s,b?p+=b:v?g=v:f&&(p+=f)):(p+=s,b?p+=b:f?(u=f,d=c&&null!==(l=null===(r=f.match(/\bid\s*=\s*["']?([^"'\s>]+)["']?/i))||void 0===r?void 0:r[1])&&void 0!==l?l:"",p+=f):v&&(p+=v));$=a.lastIndex}const f=e.slice($);return p+=g?g+x+f:f,p},exports.splitTagAcrossParagraphs=function(e,s){const n=new RegExp(`(<${s}(?:\\s[^>]*)?>)|(</${s}>)|(\\n\\s*\\n+)`,"gi");let i="",r=!1;return e.replace(n,(e,n,l,t)=>n?(r=!0,i=n,n):l?(r=!1,i="",l):t&&r?`</${s}>${t}${i}`:e)},exports.unescapeTagIds=function(e,s){const n=s.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),i=new RegExp(`<(${n})\\b([^>]*?)\\bid="([^"]*)"([^>]*)>`,"gi");return e.replace(i,(e,s,n,i,r)=>`<${s}${n}id="${i.replace(/@/g,"<").replace(/#/g,">")}"${r}>`)};
|
|
2
|
+
//# sourceMappingURL=tagHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagHelper.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i}from"tslib";import{jsxs as
|
|
1
|
+
import{__assign as i}from"tslib";import{jsxs as o,jsx as e,Fragment as n}from"react/jsx-runtime";import{ChevronUp as t,ChevronDown as l}from"lucide-react";import{useState as r,useMemo as d}from"react";import a from"./ResizableSplitPane.js";import u from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as s,DefaultFullScreenIcon as c}from"../../assests/svg/PdfViewerIcons.js";import p from"react-markdown";import g from"rehype-raw";import{Box as m}from"@mui/material";import{SHARED_MARKDOWN_STYLES as h}from"./CognitiveCompareConfig.js";import"react-dom";import{useCompareContext as v}from"./CompareContext.js";import{processGuidelinesMarkdown as f}from"./Guidelines/utils/processGuidelinesMarkdown.js";import"./MoreFunctionsPopup.js";import"./components/SubSectionAccordion.js";import"./components/LHSSectionRow.js";import"./components/RHSSectionRow.js";var _=function(o){var t,l,r,s,c,_,x,b=o.href,y=o.metaData,F=o.citationTitle,w=o.citationType,C=o.citationReason,P=o.isFullscreen,S=v().guidelinesData,R=function(i){try{var o=new URL(i,window.location.origin);return{citationNumber:o.searchParams.get("citationNumber"),phraseToHighlight:o.searchParams.get("phrase_to_highlight")}}catch(i){return{citationNumber:null,phraseToHighlight:null}}}(b),j=R.citationNumber,k=R.phraseToHighlight,D=j&&(null===(t=null==y?void 0:y.citations)||void 0===t?void 0:t[j])||{},T=(null===(l=null==y?void 0:y.docData)||void 0===l?void 0:l.documents)||{},H=(null===(r=null==y?void 0:y.docData)||void 0===r?void 0:r.input_index_map)||{},z=null==H?void 0:H[0],A=null==H?void 0:H[1],E=z?T[z]:null,N=A?T[A]:null,I=z?D[z]:null,V=A?D[A]:null,W=d(function(){var i,o,n,t;return I&&E?e(u,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==E?void 0:E.title,pdfUrl:null==E?void 0:E.signed_url,highlightText:[null!==(i=null==I?void 0:I.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(o=null==I?void 0:I.custom_metadata)||void 0===o?void 0:o.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(n=null==I?void 0:I.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number,null===(t=null==I?void 0:I.custom_metadata)||void 0===t?void 0:t.pdf_end_page_number]}):null},[null==E?void 0:E.title,null==E?void 0:E.signed_url,null==I?void 0:I.highlighted_text,null===(s=null==I?void 0:I.custom_metadata)||void 0===s?void 0:s.pdf_start_page_number,null===(c=null==I?void 0:I.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]),B=d(function(){var i,o,n,t;return V&&N?e(u,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==N?void 0:N.title,pdfUrl:null==N?void 0:N.signed_url,jumpToPageValue:1,highlightText:[null!==(i=null==V?void 0:V.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(o=null==V?void 0:V.custom_metadata)||void 0===o?void 0:o.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(n=null==V?void 0:V.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number,null===(t=null==V?void 0:V.custom_metadata)||void 0===t?void 0:t.pdf_end_page_number]}):null},[null==N?void 0:N.title,null==N?void 0:N.signed_url,null==V?void 0:V.highlighted_text,null===(_=null==V?void 0:V.custom_metadata)||void 0===_?void 0:_.pdf_start_page_number,null===(x=null==V?void 0:V.custom_metadata)||void 0===x?void 0:x.pdf_end_page_number]),U=d(function(){if(!W)return null;var o="rulebook_citation"===w?e(n,{children:e(m,i({sx:i(i({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},h),{overflow:"auto"})},{children:e(p,i({rehypePlugins:[g]},{children:f({guidelinesData:S,targetHighlights:[k],labelColor:"#FEF08A"})}))}))}):B;return o?e(a,{leftComponent:W,rightComponent:o,isFullscreen:P}):W},[W,B,w,P]);return j?"rulebook_citation"===w?e("div",I?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:U}):i({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:C||"Rulebook citation selected."})):["contract","clause"].includes(F)?e("div",I||V?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:U}):{children:"Missing PDF Citation. Please try again later"}):e("div",{children:"No Citation Found. Please try again later"}):null},x=function(n){var d,a,u,p=n.href,g=n.children,m=n.citationType,h=n.citationReason,v=n.metaData,f=n.chevronUpComponent,x=void 0===f?null:f,b=n.chevronDownComponent,y=void 0===b?null:b,F=n.customStyle,w=void 0===F?{}:F,C=n.defaultState,P=r(void 0!==C&&C),S=P[0],R=P[1],j=r(!1),k=j[0],D=j[1],T="string"==typeof g&&(null===(d=null==g?void 0:g.split("\n"))||void 0===d?void 0:d.length)>1?g.split("\n").join(" "):g,H="string"==typeof g?g:g[0],z=null!=x?x:function(i){var o,n;return e(t,{size:null!==(o=null==i?void 0:i.fontSize)&&void 0!==o?o:16,color:null!==(n=null==i?void 0:i.color)&&void 0!==n?n:"rgb(214, 51, 132)"})}(null!==(a=null==w?void 0:w.arrow)&&void 0!==a?a:{}),A=null!=y?y:function(i){var o,n;return e(l,{size:null!==(o=null==i?void 0:i.fontSize)&&void 0!==o?o:16,color:null!==(n=null==i?void 0:i.color)&&void 0!==n?n:"rgb(214, 51, 132)"})}(null!==(u=null==w?void 0:w.arrow)&&void 0!==u?u:{});return o("span",i({style:i({display:"inline"},w.relativeWrapper||{})},{children:[e("div",i({style:i({display:"inline",marginTop:0},w.citationButtonWrapper||{})},{children:o("button",i({type:"button",onClick:function(){return R(function(i){return!i})},style:i({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},w.citationButton||{})},{children:[e("span",{children:T}),e("span",i({style:{display:"flex",alignItems:"center"}},{children:S?z:A}))]}))})),S&&o("div",i({style:k?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:e("button",i({onClick:function(){D(function(i){return!i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:e(k?s:c,{})}))})),e("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:e(_,{href:p,children:g,metaData:v,citationTitle:H,citationType:m,citationReason:h,isFullscreen:k})}))]}))]}))};export{x as default};
|
|
2
2
|
//# sourceMappingURL=CitationAnchor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as r,jsxs as n}from"react/jsx-runtime";import{useMemo as e}from"react";import{Box as i,Typography as o}from"@mui/material";import a from"react-markdown";import c from"rehype-raw";import l from"./CitationAnchor.js";var u=function(t){try{var r="undefined"!=typeof window?window.location.origin:"http://localhost";return new URL(t,r)}catch(t){return null}},s=function(t,r){var n,e=t.match(new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i"));return null!==(n=null==e?void 0:e[2])&&void 0!==n?n:""},f=function(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},h=function(t,r,n){if(!n)return t;var e=f(n),i=new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i");return i.test(t)?t.replace(i,"".concat(r,'="').concat(e,'"')):t.replace(/<a\b/i,"<a ".concat(r,'="').concat(e,'"'))},p=function(t){if(!t||!t.includes("rulebook_citation"))return t;var r=t;return Array.from(t.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi)).forEach(function(t){var n,e=t[0],i=t[1]||"",o=s(i,"type");if("rulebook_citation"===o){var a=s(i,"reason"),c=s(i,"href"),l=u(c),p=null===(n=((null==l?void 0:l.searchParams.get("citationNumber"))||"").match(/^rb_(.+)$/))||void 0===n?void 0:n[1];if(p){var d={citation_type:(null==l?void 0:l.searchParams.get("citation_type"))||"",phrase_to_highlight:(null==l?void 0:l.searchParams.get("phrase_to_highlight"))||""};if(d.citation_type||d.phrase_to_highlight){var m=!1,v=function(t){var r=u(t);return(null==r?void 0:r.searchParams.get("citationNumber"))!==p?t:(m=!0,function(t,r){var n=u(t);if(!n)return t;Object.entries(r).forEach(function(t){var r=t[0],e=t[1];e&&n.searchParams.set(r,e)});var e="".concat(n.pathname).concat(n.search).concat(n.hash);return t.startsWith("./")?".".concat(e):!t.startsWith("/")&&e.startsWith("/")?e.slice(1):e}(t,d))};r=r.replace(/\[([^\]]+)\]\(([^)\n]+)\)/g,function(t,r,n){var e=v(n);return e===n?t:'<a type="'.concat(f(o),'" reason="').concat(f(a),'" href="').concat(f(e),'">').concat(r,"</a>")}),m||(r=r.replace(/<a\b([^>]*)>/gi,function(t,r){var n=s(r,"href"),e=v(n);if(e===n)return t;var i=t.replace(/\bhref\s*=\s*(['"])(.*?)\1/i,function(t,r){return"href=".concat(r).concat(e).concat(r)});return h(h(i,"type",o),"reason",a)})),m&&(r=r.replace(e,""))}}}}),r};function d(u){var s=u.content,f=void 0===s?"":s,h=u.title,d=void 0===h?"":h,m=u.citations,v=void 0===m?{}:m,g=u.styles,x=void 0===g?{}:g,y=u.docData,b=void 0===y?{}:y;u.open;var _=e(function(){return JSON.stringify(v||{})},[v]),w=e(function(){return v},[_]),E=e(function(){return JSON.stringify(b||{})},[b]),D=e(function(){return b},[E]),P=e(function(){return{citations:w,docData:D}},[w,D]),C=e(function(){return p(f)},[f]),R=e(function(){return{a:function(t){var n=t.href,e=void 0===n?"":n,i=t.children,o=t.type,a=t.reason;return r(l,{href:e,children:i,citationType:o,citationReason:a,metaData:P})}}},[P]);return n(i,t({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[r(i,t({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:r(o,t({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:d}))})),r(i,t({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:r(i,t({sx:{display:"flex",flexDirection:"column"}},{children:r(o,t({component:"div",sx:t({},x)},{children:r(a,t({components:R,rehypePlugins:[c]},{children:C}))}))}))}))]}))}export{d as default};
|
|
2
2
|
//# sourceMappingURL=CitationRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as a,useEffect as c,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g}from"@mui/material";import{ChevronDown as h}from"lucide-react";import{ButtonCognitiveIcon as m}from"../../assests/svg/ButtonCognitiveIcon.js";import S from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as R,generateColorPalette as b,findKeyPathByNodeId as y,DEVIATION_BADGE_SEPARATOR as C,hasMeaningfulRedlineTags as w,scrollAndHighlightClause as B,scrollAndWait as _,waitForScrollIdle as E}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as F,DEFAULT_FIELD_CONFIG as I,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as A,EMPTY_SUMMARY_POPUP_STATE as k,DEFAULT_COMPONENT_HEADER_TEXT as D}from"./CognitiveCompareConstants.js";import O from"./CognitivePopup.js";import P from"./MoreFunctionsPopup.js";import j from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as N}from"./hooks/useCompareData.js";import{useComparePopups as M}from"./hooks/useComparePopups.js";import{useSectionRefs as H}from"./hooks/useSectionRefs.js";import{useAccordionState as z}from"./hooks/useAccordionState.js";import{useDeviationNavigation as q}from"./hooks/useDeviationNavigation.js";import W from"./components/CompareHeader.js";import V from"./components/SubSectionAccordion.js";import G from"./components/LHSSectionRow.js";import K from"./components/RHSSectionRow.js";import Y from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as J}from"./CompareContext.js";import{useStyleHelpers as X}from"./hooks/useStyles.js";import{useResizeHandler as $}from"./hooks/useResizeHandler.js";import{useLinesCalculator as U}from"./hooks/useLinesCalculator.js";import{useSideBySide as Q}from"./hooks/useSideBySide.js";import Z from"./components/SvgConnectors.js";import ee from"./Guidelines/components/GuidelinePanel.js";var ne=function(ne){var ie,te,oe,re,le,ue,ae,ce,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ee,Fe,Ie,Te,Ae,ke,De,Oe,Pe,je,Le=ne.componentHeaderText,Ne=void 0===Le?D:Le,Me=ne.treeData,He=ne.comparisonConfig,ze=ne.leftColumnTitleText,qe=ne.rightColumnTitleText,We=ne.markdownStyles,Ve=ne.resetTrigger,Ge=ne.displayConfig,Ke=void 0===Ge?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Ge,Ye=ne.onMaintainRelativeOrderChange,Je=ne.popupConfig,Xe=ne.deviationData,$e=void 0===Xe?{}:Xe,Ue=ne.deviationNodeIdToView,Qe=ne.resetDeviationNodeId,Ze=ne.isProposingFix,en=void 0!==Ze&&Ze,nn=ne.proposingFixNodeId,tn=ne.isRedlineFlow,on=ne.badgeStyleOverride,rn=ne.guidelinesData,ln=l(Ke.maintainRelativeOrder),un=ln[0],an=ln[1],cn=null!==(ie=null==Ke?void 0:Ke.expandLevels)&&void 0!==ie?ie:0,sn=!!(null==Ke?void 0:Ke.expandAllSections),dn=!!un||!!(null==Ke?void 0:Ke.showDeviationBadges),vn=l(!1),fn=vn[0],pn=vn[1],gn=l(null),hn=gn[0],mn=gn[1],Sn=l(null===(oe=null!==(te=null==Me?void 0:Me.newEvaluationResult)&&void 0!==te?te:null==Ke?void 0:Ke.enableDeviationSchemaBackwardCompatibility)||void 0===oe||oe)[0],xn=l(new Set),Rn=xn[0],bn=xn[1],yn=l([]),Cn=yn[0],wn=yn[1],Bn=l(!1),_n=Bn[0],En=Bn[1],Fn=u(null),In=u(null),Tn=u(null),An=u(null),kn=u(null),Dn=u(!1),On=u(null),Pn=u({}),jn=u([]),Ln=u(function(){}),Nn=u(null),Mn=u(function(){}),Hn=a(function(){return JSON.stringify($e||{})},[JSON.stringify($e)]),zn=a(function(){return $e||{}},[Hn]),qn=a(function(){return(null==Me?void 0:Me.cognitive_decisioning)||{}},[Me]),Wn=a(function(){return e(e({},F),We)},[We]),Vn=u(null),Gn=u(null),Kn=u(null),Yn=u(null),Jn=u(null),Xn=u(null),$n=u(null),Un=u(null),Qn=u(null),Zn=u(null),ei=M(Vn),ni=ei.cognitivePopup,ii=ei.setCognitivePopup,ti=ei.moreFunctions,oi=ei.setMoreFunctions,ri=ei.position,li=ei.setPosition,ui=ei.activeBadgeId,ai=ei.summaryPopup,ci=ei.setSummaryPopup,si=ei.closeSummaryPopup,di=ei.setActiveBadgeId,vi=ei.popupRef,fi=ei.handleOpenCognitiveCompare,pi=ei.openCognitivePopupFromState,gi=ei.closeCognitivePopup,hi=ei.closeMoreFunctionsPopup,mi=a(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==He?void 0:He.fields)&&void 0!==e?e:I,thresholds:{high:null!==(i=null===(n=null==He?void 0:He.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:T.thresholds.high,medium:null!==(o=null===(t=null==He?void 0:He.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:T.thresholds.medium,exact:null!==(l=null===(r=null==He?void 0:He.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:T.thresholds.exact}}},[He]),Si=l(null),xi=Si[0];Si[1];var Ri=null===(ue=null===(re=null==Me?void 0:Me.documents)||void 0===re?void 0:re[null===(le=null==Me?void 0:Me.input_index_map)||void 0===le?void 0:le[0]])||void 0===ue?void 0:ue.title,bi=null===(se=null===(ae=null==Me?void 0:Me.documents)||void 0===ae?void 0:ae[null===(ce=null==Me?void 0:Me.input_index_map)||void 0===ce?void 0:ce[1]])||void 0===se?void 0:se.title,yi=x(ze||Ri||"Uploaded Contract"),Ci=null===(pe=null===(fe=null===(de=null==Me?void 0:Me.documents)||void 0===de?void 0:de[null===(ve=null==Me?void 0:Me.input_index_map)||void 0===ve?void 0:ve[0]])||void 0===fe?void 0:fe.metadata)||void 0===pe?void 0:pe.file_name,wi=x(Ci),Bi=null===(Se=null===(me=null===(ge=null==Me?void 0:Me.documents)||void 0===ge?void 0:ge[null===(he=null==Me?void 0:Me.input_index_map)||void 0===he?void 0:he[1]])||void 0===me?void 0:me.metadata)||void 0===Se?void 0:Se.file_name,_i=x(Bi),Ei=x(qe||bi||"Reference Template"),Fi=N(Me,un,zn,mi,Sn,rn),Ii=Fi.isGuidelineMode,Ti=Fi.activeProposed,Ai=Fi.existingRule,ki=Fi.proposedSections,Di=Fi.existingSections,Oi=Fi.visibleFields,Pi=Fi.parentDeviationRecord,ji=Fi.deviationNumberRegistry,Li=Fi.deviationParentRegistry,Ni=Fi.parseError;c(function(){Ni&&mn("Failed to load comparison: ".concat(Ni))},[Ni]);var Mi=ki.length>0||Di.length>0,Hi=a(function(){if(!tn)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";w(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(ki),i(Di),"".concat(e,":").concat(n)},[tn,ki,Di]);c(function(){if(ki.length||Di.length)if(sn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=un?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(ki,"left"),i(Di,"right"),bt(e),Ct(n)}else if(cn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=un?"".concat(n,"-").concat(r):String(r);t[u]=!0}var a=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&a(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&a(e.subsections,String(r),2)})};r(ki,"left",cn),r(Di,"right",cn),bt(t),Ct(o)}},[sn,cn,ki,Di,un]);var zi=H(Oi.map(function(e){return e.key}),Math.max(ki.length,Di.length)),qi=zi.leftRefs,Wi=zi.rightRefs,Vi=zi.sectionLeftRefs,Gi=zi.sectionRightRefs,Ki=zi.lhsBadgeRefs,Yi=zi.rhsBadgeRefs,Ji=zi.sectionRightRowRefs,Xi=zi.subSectionLeftRefs,$i=zi.subSectionRightRefs,Ui=zi.sectionRowRefs,Qi=zi.getSectionRowRef,Zi=zi.getSubSectionRef,et=zi.getBadgeRef,nt=Q({isGuidelineMode:Ii,maintainRelativeOrder:un,proposedSections:ki,existingSections:Di,leftContainerRef:Un,rightContainerRef:Kn,scrollContainerRef:Vn,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,rhsTopSpacerRef:Yn,rhsBottomSpacerRef:Jn,lhsTopSpacerRef:Xn,lhsBottomSpacerRef:$n,calculateLinesRef:Ln,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,closeMoreFunctionsPopup:hi,setErrorToast:mn,moreFunctions:ti,closeSummaryPopup:si}),it=nt.isSideBySide,tt=nt.isArrowVisible,ot=nt.setIsArrowVisible,rt=nt.isResizing,lt=nt.setIsResizing,ut=nt.isSideBySideLoading,at=nt.activeSideBySideSection,ct=nt.scrollLock,st=nt.sideBySideCacheRef,dt=nt.isSideBySideRef,vt=nt.activeSideBySideRightSectionRef,ft=nt.activeSideBySideSectionRef,pt=nt.sideBySideLineRef,gt=nt.highlightedClauseRefs,ht=nt.clearClauseHighlight,mt=nt.resetSideBySide,St=nt.activateSideBySide,xt=z({maintainRelativeOrder:!!un,proposedSections:ki,existingSections:Di,activeSideBySideSection:at,connectedSections:Rn,resetSideBySide:mt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,svgContainerRef:Fn,isAnimatingRef:Dn,animationTimerRef:On,calculateLinesRef:Ln,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i}),Rt=xt.expandedSections,bt=xt.setExpandedSections,yt=xt.expandedSubSections,Ct=xt.setExpandedSubSections,wt=xt.handleSubSectionToggle,Bt=xt.toggleSection,_t=xt.forceExpandCrossWiredSections,Et=function(){var e,n;if(null!=at){var i=null===(e=Vi.current[at])||void 0===e?void 0:e.current,t=null===(n=Gi.current[at])||void 0===n?void 0:n.current,o=Kn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),a=r.top-u.top,c=l.top-u.top-a;o.scrollBy({top:c,behavior:"smooth"})}}},Ft=s(function(e){null==e||e.stopPropagation(),En(function(e){var n=!e;return n&&requestAnimationFrame(function(){Et()}),n})},[Et]);c(function(){tn&&"off"!==Hi&&"0:0"!==Hi&&(st.current=null,jn.current=[],requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)}))},[tn,Hi]);var It=a(function(){var e=new Map,n=new Map,i=1;if(un)ki.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),Di.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=ki.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(ki.length,Di.length),o=0;o<t;o++){var r=ki[o],l=Di[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[ki,Di,un]),Tt=Ai.analysis,At=x(null===(Re=null===(xe=null==Tt?void 0:Tt.rule_difference_comparison)||void 0===xe?void 0:xe.summary)||void 0===Re?void 0:Re.overall_summary),kt=!!At.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Dt=null!==(be=null==Me?void 0:Me.base_root_id)&&void 0!==be?be:"-1";null==Me||Me[Dt];var Ot=Sn?null!==(De=null!==(Te=$e&&(null===(Ie=null==$e?void 0:$e[Dt])||void 0===Ie?void 0:Ie.evaluation_result))&&void 0!==Te?Te:null===(ke=null===(Ae=null==Me?void 0:Me.nodes)||void 0===Ae?void 0:Ae[Dt])||void 0===ke?void 0:ke.evaluation_result)&&void 0!==De?De:null:null!==(Fe=null!==(we=$e&&(null===(Ce=null===(ye=null==$e?void 0:$e[Dt])||void 0===ye?void 0:ye.evaluation_result)||void 0===Ce?void 0:Ce[0]))&&void 0!==we?we:null===(Ee=null===(_e=null===(Be=null==Me?void 0:Me.nodes)||void 0===Be?void 0:Be[Dt])||void 0===_e?void 0:_e.evaluation_result)||void 0===Ee?void 0:Ee[0])&&void 0!==Fe?Fe:null,Pt=R(Ot),jt=b(null!==(je=null===(Pe=null===(Oe=null==Ot?void 0:Ot.evaluation_outputs)||void 0===Oe?void 0:Oe.metadata)||void 0===Pe?void 0:Pe.label_color)&&void 0!==je?je:A);if(on){var Lt=on(Pt);Lt&&(jt=e(e({},jt),{badgeBg:Lt.bg,badgeText:Lt.text,badgeBorder:Lt.border}))}var Nt=u(mt);c(function(){Nt.current=mt},[mt]);var Mt=u(gi);c(function(){Mt.current=gi},[gi]);var Ht=s(function(e,n,i,t,o,r){return Go.current(e,n,i,t,o,r)},[]),zt=s(function(e,n,i,t,o){return Yo.current(e,n,i,t,o)},[]),qt=s(function(){return Jo.current()},[]),Wt=s(function(e,n){return Xo.current(e,n)},[]),Vt=s(function(e){return $o.current(e)},[]),Gt=s(function(e){return Uo.current(e)},[]),Kt=s(function(){return Qo.current()},[]),Yt=s(function(){var e,n;ht(),null===(e=Nt.current)||void 0===e||e.call(Nt),En(!1),bn(new Set),wn([]),jn.current=[],fo([]),go(null),ci(k),null===(n=Mt.current)||void 0===n||n.call(Mt),requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})},[]),Jt=u(Yt);c(function(){Jt.current=Yt},[Yt]),c(function(){Ve&&Jt.current()},[Ve]);var Xt=a(function(){return{documents:null==Me?void 0:Me.documents,input_index_map:null==Me?void 0:Me.input_index_map}},[JSON.stringify(null==Me?void 0:Me.documents),JSON.stringify(null==Me?void 0:Me.input_index_map)]),$t=u(Me);c(function(){$t.current=Me},[Me]);var Ut=u(qn);c(function(){Ut.current=qn},[qn]);var Qt=s(function(n,i,t,o,r,l,u){var a,c,s,d,v,f,p,g,h,m,S,R,b=x(null==i?void 0:i.id)||x(null==t?void 0:t.id)||"",y=(b?null===(a=Ut.current)||void 0===a?void 0:a[b]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:b,decisioning:[],gap:[],relevance_score:0},w=null!==(s=null===(c=Ui.current[o])||void 0===c?void 0:c.current)&&void 0!==s?s:null,B=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(C)))return u(l);var a=o.split(C)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return s?e(e(e({},c),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),_=(null!==(f=null===(v=null===(d=null==B?void 0:B.cognitive_decisioning)||void 0===d?void 0:d.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==f?f:0)>0||(null!==(h=null===(g=null===(p=null==B?void 0:B.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===g?void 0:g.length)&&void 0!==h?h:0)>0,E=null!==(m=null==Ke?void 0:Ke.isLoading)&&void 0!==m&&m,F=!0;if(Ii)if(B&&Object.keys(B).length>0){var I=Array.isArray(B)?B[0]:B,T=null===(R=null===(S=null==I?void 0:I.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===R?void 0:R.is_orphan;!0!==T&&"true"!==T&&"Yes"!==T&&"yes"!==T||(F=!1)}else F=!1;return{isLoading:E&&!_,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:y,anchorEl:n,sectionAnchorEl:w,badgeStyle:l||null,sectionIdx:o,docData:Xt,deviationData:B,isOrphan:!!r,hasGuidelineMatches:F}},[Xt,null==Ke?void 0:Ke.isLoading,Ii]),Zt=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),ti.open&&ti.sectionIdx===o)hi();else{var u=e.currentTarget,a="left";(null===(l=Kn.current)||void 0===l?void 0:l.contains(u))&&(a="right");ht(),dt.current&&mt(),bn(new Set),wn([]),jn.current=[],gi(),ai.open?_o():si(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(C)){var r=o.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(n=Ki.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=Yi.current[o])||void 0===i?void 0:i.current:null===(t=Ki.current[o])||void 0===t?void 0:t.current}()||u;oi(Qt(e,n,t,o,i,r))})}},[ti.open,ti.sectionIdx,hi,si,Qt]),eo=s(function(){var e=ti.sectionIdx;ti.isOrphan,hi(),si(),null!==e&&(_t(e),ht(),dt.current&&mt(),wn([]),jn.current=[],bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Ln.current&&Ln.current()},50))},[ti.sectionIdx,ti.isOrphan,hi,si,mt]),no=s(function(){var e=kn.current;if(e){kn.current=null;var n=ki.findIndex(function(n){return n.id===e}),i=Di.findIndex(function(n){return n.id===e}),t=-1===n?y(ki,e):null,o=-1===i?y(Di,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(gt.current.add(r),B(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(un)-1!==r&&Un.current&&a(function(){return u(n,t,Vi,Xi)},Un.current),-1!==l&&Kn.current&&a(function(){return u(i,o,Gi,$i)},Kn.current);else{var c=Vn.current;if(!c)return;a(function(){return-1!==r?u(n,t,Vi,Xi):u(i,o,Gi,$i)},c)}}},[ki,Di,un,Vi,Gi,Xi,$i,Un,Kn,Vn]),io=s(function(n){if(n){ht(),mt(),bn(new Set),wn([]),jn.current=[],si(),gi();var i=ki.findIndex(function(e){return e.id===n}),t=Di.findIndex(function(e){return e.id===n}),o=-1===i?y(ki,n):null,r=-1===t?y(Di,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;kn.current=n,bt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=un?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=un?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Ct(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){kn.current===n&&to.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[ki,Di,un,bt,Ct,mt,si,gi]),to=u(no);c(function(){to.current=no},[no]);var oo=u(null);c(function(){if(xi){var e=mi.fields.find(function(e){return e.analysisKey===xi||e.key===xi});if(e){var n=qi.current[e.key]||Wi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[xi,mi.fields]);var ro=s(function(e){var n,i,t,o,r,l,u,a,c,s=null===(n=null==Tt?void 0:Tt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[Tt]),lo=X({proposedSections:ki,existingSections:Di,maintainRelativeOrder:un,cognitiveMap:qn,deviationData:zn,treeData:Me,resolvedComparisonConfig:mi,badgeStyleOverride:on}),uo=lo.getSectionCompareStyle,ao=lo.getSubSectionCompareStyle,co=lo.getDeviationStyleByKey,so=U({containerRef:In,leftContainerRef:Un,rightContainerRef:Kn,svgContainerRef:Fn,pathRefs:Pn,leftHeaderRef:Tn,rightHeaderRef:An,proposedSections:ki,existingSections:Di,visibleFields:Oi,leftRefs:qi,rightRefs:Wi,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,expandedSections:Rt,expandedSubSections:yt,connectedSections:Rn,isSideBySide:it,activeSideBySideSection:at,maintainRelativeOrder:un,isGuidelineMode:Ii,cognitiveMap:qn,getSectionCompareStyle:uo,getSubSectionCompareStyle:ao,getDeviationStyleByKey:co,isArrowVisible:tt,isAnimatingRef:Dn,isSideBySideRef:dt,sideBySideCacheRef:st,sideBySideLineRef:pt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,connectedLines:Cn,setConnectedLines:wn,cachedConnectedPositions:jn,calculateLinesRef:Ln,resizeTimerRef:Nn,scrollLock:ct,scrollSyncLocked:_n,handleResizeRef:Mn,activeProposed:Ti,existingRule:Ai,analysisData:Tt,pendingScrollTargetRef:Qn,pendingScrollCallbackRef:Zn,resolvedComparisonConfig:mi,getFieldData:ro}),vo=so.lines,fo=so.setLines,po=so.overallConnector,go=so.setOverallConnector,ho=so.svgDimensions,mo=so.handleColumnScroll;c(function(){ai.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})})},[ai.anchorEl,_n]);var So=s(function(){ht(),En(!1),bt({}),Ct({}),mt(),bn(new Set),wn([]),jn.current=[],si(),gi(),hi(),requestAnimationFrame(function(){Ln.current&&Ln.current()})},[bt,Ct,mt,si,gi,hi]);c(function(){it||0!==Rn.size||En(!1)},[it,Rn]);var xo=a(function(){return Object.values(Rt).some(Boolean)||Object.values(yt).some(Boolean)},[Rt,yt]),Ro=u(null),bo=u(0),yo=u(0),Co=u(0),wo=$({timerRef:Ro,ruleComponentRef:Gn,scrollContainerRef:Vn,containerRef:In,maintainRelativeOrder:un,proposedSections:ki,existingSections:Di,isSideBySideRef:dt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,sectionRowRefs:Ui,sectionRightRowRefs:Ji,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,leftContainerRef:Un,rightContainerRef:Kn,calculateLinesRef:Ln,handleResizeRef:Mn,setIsResizing:lt,setIsArrowVisible:ot,sideBySideCacheRef:st,cachedConnectedPositions:jn}).handleResize;c(function(){Mn.current=wo},[wo,Mn]),c(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var a=e[e.length-1];if(a){var c=null!==(u=null===(l=null===(r=a.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:a.contentRect.width;Math.abs(c-n.current)<1?o():(n.current=c,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Gn.current&&o.push(e(Gn.current,bo,n,function(){return Mn.current()},function(){})),Vn.current&&o.push(e(Vn.current,yo,i,function(){return Mn.current()},function(){return Ln.current()})),In.current&&o.push(e(In.current,Co,t,function(){return Mn.current()},function(){return Ln.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),c(function(){dt.current=it},[it]),c(function(){ft.current=at},[at]);var Bo=s(function(){var e,n=ti.sectionIdx,i=ti.isOrphan;if(si(),null!=n){var t="left";ti.anchorEl&&(null===(e=Kn.current)||void 0===e?void 0:e.contains(ti.anchorEl))&&(t="right"),_t(n),St(n,i,{sourceSide:t})}},[St,ti.isOrphan,ti.sectionIdx,ti.anchorEl,si]),_o=s(function(){si(),mt(),bn(new Set),wn([]),jn.current=[]},[si,mt]),Eo=null!==ti.sectionIdx&&Rn.has(ti.sectionIdx),Fo=q({proposedSections:ki,existingSections:Di,parentDeviationRecord:Pi,expandedSections:Rt,maintainRelativeOrder:!!un,scrollContainerRef:Vn,leftContainerRef:Un,rightContainerRef:Kn,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi}),Io=Fo.showDeviationNavigation,To=Fo.showOpenNodeRef,Ao=Fo.adjustScrollForPopup,ko=s(function(e,n,i,t,o){var r,l="string"==typeof t?x(t).trim():x(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;gi();var a="left";(null===(r=Kn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(C)){var r=n.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(i=Ki.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=Yi.current[n])||void 0===t?void 0:t.current:null===(o=Ki.current[n])||void 0===o?void 0:o.current};if(i)return mt(),bn(new Set),wn([]),jn.current=[],void(l&&(_t(n),requestAnimationFrame(function(){var e=c()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ci({open:!0,anchorEl:e,summary:t,displayImpact:o})})));_t(n),l?setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var a=l.top-window.innerHeight/2;un?(null===(e=Un.current)||void 0===e||e.scrollBy({top:a,behavior:"smooth"}),null===(n=Kn.current)||void 0===n||n.scrollBy({top:a,behavior:"smooth"})):null===(i=Vn.current)||void 0===i||i.scrollBy({top:a,behavior:"smooth"})}}ci({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[St,gi,ci,mt,_t]),Do=a(function(){var e;if(!Ue)return null;var n=null===(e=null==Ue?void 0:Ue.id)||void 0===e?void 0:e.split(":")[0];for(var i in Pi){if((Pi[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ue,Pi]),Oo=u({id:null,triggerMs:null}),Po=u(null);c(function(){if(null==Ue?void 0:Ue.id){var o=Number(Ue.trigger),r=Oo.current;if((null==r?void 0:r.triggerMs)!==o){if(!(Ue.id.includes(":")&&/:\d+$/.test(Ue.id)))return Oo.current={id:Ue.id,triggerMs:o},void io(Ue.id);var l=Ue.id.split(":"),u=l[0],a=l[1],c=null!=a?a:"0";Po.current!==Ue.id&&(si(),gi(),mt(),bn(new Set),wn([]),jn.current=[],Po.current=Ue.id);var s=!1,d=0,v=null,f=null,p=!1,g=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},h=function(){var r,l,a,m;if(!s){var S=function(){Oo.current={id:Ue.id,triggerMs:o}},x=null,R=null;for(var b in Pi){var y=Pi[b].find(function(e){return e.id===u});if(y){x=b,R=y;break}}if(R&&x){var w=ki.findIndex(function(e){return e.id===x}),B=Di.findIndex(function(e){return e.id===x}),F=-1===w&&-1!==B,I=g(ki,R.id),T=g(Di,R.id);if(I&&!T&&!F){var A=I.split("-"),k=Number(A[0]);if(un){var D=null===(l=null===(r=ki[k])||void 0===r?void 0:r.refIndexes)||void 0===l?void 0:l[0],O=Di.findIndex(function(e){return e.selfIndex===D});-1!==O&&(k=O)}T=n([k],A.slice(1),!0).join("-")}if(I||T){var P=I?Number(I.split("-")[0]):w,j=T?Number(T.split("-")[0]):B,L=j>=0?j:T?Number(T.split("-")[0]):-1,N=ki[P],M=Di[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,q=F||(!I&&!!T||H&&!z);if(q){if(!(un?!!Ko.current["right-".concat(j)]:!!Ko.current[String(j)])&&j>=0)return Bt(j,"right"),void(v=setTimeout(h,200))}else if(!(un?!!Ko.current["left-".concat(P)]:!!Ko.current[String(P)])&&P>=0)return Bt(P,"left"),void(v=setTimeout(h,200));var W=I||"",V=T||"",G="".concat(R.id).concat(C).concat(c).concat(C).concat(W).concat(C).concat(V),K="".concat(R.id).concat(C).concat(c);if(!p){_t(G),p=!0,d=0;var Y=function(){var e,n,i=null===(e=Ki.current[K])||void 0===e?void 0:e.current,t=null===(n=Yi.current[K])||void 0===n?void 0:n.current;return q||!i&&!!t?t:i};return null==f||f(),void(v=setTimeout(function(){var e,n,i,t,o,r,l;s||(e=Y,n=function(){s||(f=null,h())},t=0,o=null,r=null,l=function(){if(!s){var u=e();if(u&&0!==u.getBoundingClientRect().height){var a=u.getBoundingClientRect(),c=a.top,d=a.height,v=null!==o&&Math.abs(c-o)<.5,f=null!==r&&Math.abs(d-r)<.5;if(v&&f){if(++t>=5)return void n()}else t=0;o=c,r=d,i=requestAnimationFrame(l)}else i=requestAnimationFrame(l)}},i=requestAnimationFrame(l),f=function(){return cancelAnimationFrame(i)})},300))}var J=null===(a=Ki.current[K])||void 0===a?void 0:a.current,X=null===(m=Yi.current[K])||void 0===m?void 0:m.current;if(J||X){var $=q||!J&&!!X,U=$?X:J,Q=un?$?Kn.current:Un.current:Vn.current;if(U&&Q){var Z=U.getBoundingClientRect();if(0!==Z.height){var ee=Q.getBoundingClientRect(),ne=Z.top-ee.top+Q.scrollTop-ee.height/2+Z.height/2,ie=(null==I?void 0:I.includes("-"))||(null==T?void 0:T.includes("-")),te=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,a,d,v,f;return t(this,function(t){switch(t.label){case 0:return s?[2]:(S(),n=U instanceof Element?window.getComputedStyle(U).color:"",[J,X].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[J,X].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(a=null===(u=R.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===a?void 0:a[c])||R,o=(null===(d=R.evaluationResult)||void 0===d?void 0:d.evaluation_outputs)||R.evaluation_outputs,!!J&&!!X?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},un?[4,Promise.all([Un.current?l(E(Un.current),600):Promise.resolve(),Kn.current?l(E(Kn.current),600):Promise.resolve()])]:[3,2]):(r=$?(null===(v=Yi.current[ie?K:j])||void 0===v?void 0:v.current)||X:(null===(f=Ki.current[ie?K:P])||void 0===f?void 0:f.current)||J,Ao(r,function(){ci({open:!0,anchorEl:r,displayImpact:Ue.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==Qe||Qe(),[2]));case 1:t.sent(),t.label=2;case 2:return St(G,!1,{toggleIfSame:!1,sourceSide:F?"right":"left",onReady:function(){var n,t,o,r;S();var l=$?(null===(n=Yi.current[K])||void 0===n?void 0:n.current)||X:(null===(t=Ki.current[K])||void 0===t?void 0:t.current)||J,u=(null===(o=Ki.current[K])||void 0===o?void 0:o.current)||J,a=(null===(r=Yi.current[K])||void 0===r?void 0:r.current)||X;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"})),ci({open:!0,anchorEl:l,displayImpact:Ue.displayImpact,summary:e({},i)}),null==Qe||Qe()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():_(Q,ne,te)}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}};return v=setTimeout(h,100),function(){s=!0,v&&clearTimeout(v),null==f||f()}}}},[Ue,Pi,ki,Di,un,Rt,St,ci,io]),c(function(){var n,i,t;if(ai.open){var o=ai.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(Ki.current)||r(Yi.current);if(l){var u=(null===(i=Yi.current[l])||void 0===i?void 0:i.current)||(null===(t=Ki.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ci(function(n){return e(e({},n),{anchorEl:u})})}}}},[ai.open,ai.anchorEl,_n,Rn,Rt]);var jo=ni.open,Lo=ni.sectionIdx,No=ni.isOrphan,Mo=ni.badgeStyle,Ho=ni.anchorEl,zo=ni.sectionAnchorEl;c(function(){var n;if(Ke.isStreamingEnabled&&jo&&null!=Lo&&Lo!==Dt){var i="string"==typeof Lo?Lo.split(C)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(ki,i):null,r=i&&"string"==typeof i?t(Di,i):null,l="number"==typeof Lo?ki[Lo]||null:o||i&&((null===(n=null==Me?void 0:Me.nodes)||void 0===n?void 0:n[i])||(null==Me?void 0:Me[i]))||null,u="number"==typeof Lo?Di[Lo]||null:r,a=Qt(Ho,l,u,Lo,No,Mo);ii(function(n){return n.open?x(n.cognitiveData)===x(a.cognitiveData)&&x(n.deviationData)===x(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e(e(e({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[jo,Lo,No,Mo,Ho,zo,ki,Di,Qt]);var qo=s(function(e){var n=e.section,i=e.keyPath,t=e.depth,r=void 0===t?0:t,l=e.columnKey,u=void 0===l?"left":l,a=e.parentNodeId,c=void 0===a?"":a,s=e.sectionOffset;return o(V,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:c,sectionOffset:s})},[]),Wo=a(function(){return ki.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&un?null:o(G,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[ki]),Vo=a(function(){return Di.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&un?null:o(K,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[Di]),Go=u(Zt);c(function(){Go.current=Zt},[Zt]);var Ko=u(Rt);c(function(){Ko.current=Rt},[Rt]);var Yo=u(ko);c(function(){Yo.current=ko},[ko]);var Jo=u(_o);c(function(){Jo.current=_o},[_o]);var Xo=u(Bt);c(function(){Xo.current=Bt},[Bt]);var $o=u(wt);c(function(){$o.current=wt},[wt]);var Uo=u(qo);c(function(){Uo.current=qo},[qo]);var Qo=u(mt);c(function(){Qo.current=mt},[mt]);var Zo=a(function(){return{isGuidelineMode:Ii,maintainRelativeOrder:!!un,showDeviationBadges:dn,isProposingFix:en,proposingFixNodeId:nn,isRedlineFlow:tn,isSideBySide:it,activeSideBySideSection:at,scrollSyncLocked:_n,toggleScrollSyncLocked:Ft,summaryPopupAnchorEl:ai.anchorEl,connectedSections:Rn,proposedSections:ki,existingSections:Di,deviationNumberRegistry:ji,deviationParentRegistry:Li,treeData:Me,displayConfig:Ke,resolvedMarkdownStyles:Wn,unifiedNumbering:It,expandedSections:Rt,expandedSubSections:yt,setExpandedSubSections:Ct,getSectionCompareStyle:uo,getSubSectionCompareStyle:ao,getBadgeRef:et,getSectionRowRef:Qi,getSubSectionRef:Zi,sectionLeftRefs:Vi,sectionRightRefs:Gi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,openMoreFunctionsPopup:Ht,handleOpenSummaryPopup:zt,openSummaryPopup:zt,handleCloseSummaryPopup:qt,toggleSection:Wt,handleSubSectionToggle:Vt,renderSubSectionAccordion:Gt,resetSideBySide:Kt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,showDeviationNavigation:Io,showOpenNodeRef:To,deviationNodeIdToView:null==Ue?void 0:Ue.id,deviationTargetParentId:Do}},[Ii,un,dn,en,nn,tn,it,at,_n,Ft,ai.anchorEl,Rn,ki,Di,ji,Ke,Wn,It,Rt,yt,Ct,uo,ao,et,Qi,Zi,Io,To,Ue,Do]);return o(J,e({value:Zo},{children:r(d,e({ref:Gn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[fn&&o(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:o(j,{})})),ai.open&&o(Y,{open:ai.open,anchorEl:ai.anchorEl,containerEl:oo.current,clipTopEl:Tn.current,scrollContainerEl:Vn.current,onClose:_o,summary:ai.summary,displayImpact:ai.displayImpact,isScrollLocked:_n}),o(P,{open:ti.open,anchorEl:ti.anchorEl,maintainRelativeOrder:!!un,sectionTitle:ti.sectionTitle,referenceSectionTitle:ti.refSectionTitle,onClose:hi,onOpenCognitiveCompare:fi,onOpenSideBySide:Bo,onConnect:eo,isConnected:Eo,isOrphan:!Ii&&!!ti.isOrphan,isGuidelineMode:Ii,hasGuidelineMatches:ti.hasGuidelineMatches}),ni.open&&o(O,{open:ni.open,popupRef:vi,position:ri,popupConfig:Je,onClose:function(){li(null),ii(function(n){return e(e({},n),{open:!1})}),di(null)},markdownStyles:We,sectionTitle:wi,referenceSectionTitle:_i,cognitiveData:ni.cognitiveData,anchorEl:ni.anchorEl,sectionAnchorEl:ni.sectionAnchorEl,scrollContainerEl:Vn.current,badgeStyle:ni.badgeStyle,docData:ni.docData,deviationData:ni.deviationData,isLoading:ni.isLoading}),o(v,e({open:!!hn,autoHideDuration:8e3,onClose:function(){return mn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return mn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:hn}))})),o(W,{componentHeaderText:Ne,displayConfig:Ke,maintainRelativeOrder:un,onCollapseAll:So,showCollapseAll:xo,onToggleView:function(e){pn(!0),setTimeout(function(){an(!e),null==Ye||Ye(!e),En(!1),mt(),si(),bn(new Set),wn([]),jn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){pn(!1)},600)})})},50)}}),o(d,e({ref:Vn,onScroll:mo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:un?"visible":"auto",borderTop:At&&kt?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},un?{flex:1}:{})},{children:r(d,e({ref:In,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},un?{flex:1,overflow:"visible"}:{})},{children:[o(Z,{svgContainerRef:Fn,svgDimensions:ho,isResizing:rt,overallConnector:po,rootDeviationStyle:jt,lines:vo,isSideBySide:it,activeSideBySideSection:at,isArrowVisible:tt,maintainRelativeOrder:un,proposedSections:ki,existingSections:Di,cognitivePopup:ni,activeBadgeId:ui,closeCognitivePopup:gi,setActiveBadgeId:di,openCognitivePopupFromState:pi,buildSectionPopupState:Qt,connectedLines:Cn,pathRefs:Pn}),r(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},un?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:Tn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:o(p,e({title:yi,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:yi}))}))})),r(d,e({ref:Un,onScroll:mo,sx:e({p:"12px",display:"flex",flexDirection:"column"},un?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:Xn,style:{width:"100%",height:"0px",flexShrink:0}}),Mi&&Wo,o("div",{ref:$n,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:oo,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:o(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:r(d,e({onClick:function(n){n.stopPropagation(),ni.open&&ui===Dt?gi():(di(Dt),pi(Qt(n.currentTarget,{title:"",content:"",evaluationResult:Ot,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Dt,!0,e(e({},jt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:jt.badgeBg,color:jt.badgeText,border:"1px solid ".concat(jt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Pt?Pt:o(L,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(m,{})})),o(h,{size:11,style:{transform:ni.open&&ui===Dt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),r(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},un?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[ut&&o(S,{sections:11}),o(d,e({ref:An,sx:e({p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},un?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},Ii?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:o(p,e({title:Ei,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ei}))}))})),r(d,e({ref:Kn,onScroll:mo,sx:e({p:Ii?"0px":"12px",display:"flex",flexDirection:"column"},un?e(e({maxHeight:"calc(100vh - 250px)"},!Ii&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:Yn,style:{width:"100%",height:"0px",flexShrink:0}}),Ii?o(ee,{guidelinesData:rn,deviationData:$e,connectedSections:Rn,proposedSections:ki}):Mi&&Vo,o("div",{ref:Jn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ne as default};
|
|
1
|
+
import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as a,useEffect as c,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g}from"@mui/material";import{ChevronDown as h}from"lucide-react";import{ButtonCognitiveIcon as m}from"../../assests/svg/ButtonCognitiveIcon.js";import S from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as R,generateColorPalette as b,findKeyPathByNodeId as y,DEVIATION_BADGE_SEPARATOR as C,hasMeaningfulRedlineTags as w,scrollAndHighlightClause as B,scrollAndWait as _,waitForScrollIdle as E}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as F,DEFAULT_FIELD_CONFIG as I,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as A,EMPTY_SUMMARY_POPUP_STATE as D,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import O from"./CognitivePopup.js";import P from"./MoreFunctionsPopup.js";import j from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as N}from"./hooks/useCompareData.js";import{useComparePopups as M}from"./hooks/useComparePopups.js";import{useSectionRefs as H}from"./hooks/useSectionRefs.js";import{useAccordionState as z}from"./hooks/useAccordionState.js";import{useDeviationNavigation as q}from"./hooks/useDeviationNavigation.js";import W from"./components/CompareHeader.js";import V from"./components/SubSectionAccordion.js";import G from"./components/LHSSectionRow.js";import K from"./components/RHSSectionRow.js";import Y from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as J}from"./CompareContext.js";import{useStyleHelpers as X}from"./hooks/useStyles.js";import{useResizeHandler as $}from"./hooks/useResizeHandler.js";import{useLinesCalculator as U}from"./hooks/useLinesCalculator.js";import{useSideBySide as Q}from"./hooks/useSideBySide.js";import Z from"./components/SvgConnectors.js";import ee from"./Guidelines/components/GuidelinePanel.js";var ne=function(ne){var ie,te,oe,re,le,ue,ae,ce,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ee,Fe,Ie,Te,Ae,De,ke,Oe,Pe,je,Le=ne.componentHeaderText,Ne=void 0===Le?k:Le,Me=ne.treeData,He=ne.comparisonConfig,ze=ne.leftColumnTitleText,qe=ne.rightColumnTitleText,We=ne.markdownStyles,Ve=ne.resetTrigger,Ge=ne.displayConfig,Ke=void 0===Ge?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Ge,Ye=ne.onMaintainRelativeOrderChange,Je=ne.popupConfig,Xe=ne.deviationData,$e=void 0===Xe?{}:Xe,Ue=ne.deviationNodeIdToView,Qe=ne.resetDeviationNodeId,Ze=ne.isProposingFix,en=void 0!==Ze&&Ze,nn=ne.proposingFixNodeId,tn=ne.isRedlineFlow,on=ne.badgeStyleOverride,rn=ne.guidelinesData,ln=l(Ke.maintainRelativeOrder),un=ln[0],an=ln[1],cn=null!==(ie=null==Ke?void 0:Ke.expandLevels)&&void 0!==ie?ie:0,sn=!!(null==Ke?void 0:Ke.expandAllSections),dn=!!un||!!(null==Ke?void 0:Ke.showDeviationBadges),vn=l(!1),fn=vn[0],pn=vn[1],gn=l(null),hn=gn[0],mn=gn[1],Sn=l(null===(oe=null!==(te=null==Me?void 0:Me.newEvaluationResult)&&void 0!==te?te:null==Ke?void 0:Ke.enableDeviationSchemaBackwardCompatibility)||void 0===oe||oe)[0],xn=l(new Set),Rn=xn[0],bn=xn[1],yn=l([]),Cn=yn[0],wn=yn[1],Bn=l(!1),_n=Bn[0],En=Bn[1],Fn=u(null),In=u(null),Tn=u(null),An=u(null),Dn=u(null),kn=u(!1),On=u(null),Pn=u({}),jn=u([]),Ln=u(function(){}),Nn=u(null),Mn=u(function(){}),Hn=a(function(){return JSON.stringify($e||{})},[JSON.stringify($e)]),zn=a(function(){return $e||{}},[Hn]),qn=a(function(){return(null==Me?void 0:Me.cognitive_decisioning)||{}},[Me]),Wn=a(function(){return e(e({},F),We)},[We]),Vn=u(null),Gn=u(null),Kn=u(null),Yn=u(null),Jn=u(null),Xn=u(null),$n=u(null),Un=u(null),Qn=u(null),Zn=u(null),ei=M(Vn),ni=ei.cognitivePopup,ii=ei.setCognitivePopup,ti=ei.moreFunctions,oi=ei.setMoreFunctions,ri=ei.position,li=ei.setPosition,ui=ei.activeBadgeId,ai=ei.summaryPopup,ci=ei.setSummaryPopup,si=ei.closeSummaryPopup,di=ei.setActiveBadgeId,vi=ei.popupRef,fi=ei.handleOpenCognitiveCompare,pi=ei.openCognitivePopupFromState,gi=ei.closeCognitivePopup,hi=ei.closeMoreFunctionsPopup,mi=a(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==He?void 0:He.fields)&&void 0!==e?e:I,thresholds:{high:null!==(i=null===(n=null==He?void 0:He.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:T.thresholds.high,medium:null!==(o=null===(t=null==He?void 0:He.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:T.thresholds.medium,exact:null!==(l=null===(r=null==He?void 0:He.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:T.thresholds.exact}}},[He]),Si=l(null),xi=Si[0];Si[1];var Ri=null===(ue=null===(re=null==Me?void 0:Me.documents)||void 0===re?void 0:re[null===(le=null==Me?void 0:Me.input_index_map)||void 0===le?void 0:le[0]])||void 0===ue?void 0:ue.title,bi=null===(se=null===(ae=null==Me?void 0:Me.documents)||void 0===ae?void 0:ae[null===(ce=null==Me?void 0:Me.input_index_map)||void 0===ce?void 0:ce[1]])||void 0===se?void 0:se.title,yi=x(ze||Ri||"Uploaded Contract"),Ci=null===(pe=null===(fe=null===(de=null==Me?void 0:Me.documents)||void 0===de?void 0:de[null===(ve=null==Me?void 0:Me.input_index_map)||void 0===ve?void 0:ve[0]])||void 0===fe?void 0:fe.metadata)||void 0===pe?void 0:pe.file_name,wi=x(Ci),Bi=null===(Se=null===(me=null===(ge=null==Me?void 0:Me.documents)||void 0===ge?void 0:ge[null===(he=null==Me?void 0:Me.input_index_map)||void 0===he?void 0:he[1]])||void 0===me?void 0:me.metadata)||void 0===Se?void 0:Se.file_name,_i=x(Bi),Ei=x(qe||bi||"Reference Template"),Fi=N(Me,un,zn,mi,Sn,rn),Ii=Fi.isGuidelineMode,Ti=Fi.activeProposed,Ai=Fi.existingRule,Di=Fi.proposedSections,ki=Fi.existingSections,Oi=Fi.visibleFields,Pi=Fi.parentDeviationRecord,ji=Fi.deviationNumberRegistry,Li=Fi.deviationParentRegistry,Ni=Fi.parseError;c(function(){Ni&&mn("Failed to load comparison: ".concat(Ni))},[Ni]);var Mi=Di.length>0||ki.length>0,Hi=a(function(){if(!tn)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";w(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Di),i(ki),"".concat(e,":").concat(n)},[tn,Di,ki]);c(function(){if(Di.length||ki.length)if(sn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=un?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(Di,"left"),i(ki,"right"),bt(e),Ct(n)}else if(cn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=un?"".concat(n,"-").concat(r):String(r);t[u]=!0}var a=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&a(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&a(e.subsections,String(r),2)})};r(Di,"left",cn),r(ki,"right",cn),bt(t),Ct(o)}},[sn,cn,Di,ki,un]);var zi=H(Oi.map(function(e){return e.key}),Math.max(Di.length,ki.length)),qi=zi.leftRefs,Wi=zi.rightRefs,Vi=zi.sectionLeftRefs,Gi=zi.sectionRightRefs,Ki=zi.lhsBadgeRefs,Yi=zi.rhsBadgeRefs,Ji=zi.sectionRightRowRefs,Xi=zi.subSectionLeftRefs,$i=zi.subSectionRightRefs,Ui=zi.sectionRowRefs,Qi=zi.getSectionRowRef,Zi=zi.getSubSectionRef,et=zi.getBadgeRef,nt=Q({isGuidelineMode:Ii,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,leftContainerRef:Un,rightContainerRef:Kn,scrollContainerRef:Vn,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,rhsTopSpacerRef:Yn,rhsBottomSpacerRef:Jn,lhsTopSpacerRef:Xn,lhsBottomSpacerRef:$n,calculateLinesRef:Ln,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,closeMoreFunctionsPopup:hi,setErrorToast:mn,moreFunctions:ti,closeSummaryPopup:si}),it=nt.isSideBySide,tt=nt.isArrowVisible,ot=nt.setIsArrowVisible,rt=nt.isResizing,lt=nt.setIsResizing,ut=nt.isSideBySideLoading,at=nt.activeSideBySideSection,ct=nt.scrollLock,st=nt.sideBySideCacheRef,dt=nt.isSideBySideRef,vt=nt.activeSideBySideRightSectionRef,ft=nt.activeSideBySideSectionRef,pt=nt.sideBySideLineRef,gt=nt.highlightedClauseRefs,ht=nt.clearClauseHighlight,mt=nt.resetSideBySide,St=nt.activateSideBySide,xt=z({maintainRelativeOrder:!!un,proposedSections:Di,existingSections:ki,activeSideBySideSection:at,connectedSections:Rn,resetSideBySide:mt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,svgContainerRef:Fn,isAnimatingRef:kn,animationTimerRef:On,calculateLinesRef:Ln,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i}),Rt=xt.expandedSections,bt=xt.setExpandedSections,yt=xt.expandedSubSections,Ct=xt.setExpandedSubSections,wt=xt.handleSubSectionToggle,Bt=xt.toggleSection,_t=xt.forceExpandCrossWiredSections,Et=function(){var e,n;if(null!=at){var i=null===(e=Vi.current[at])||void 0===e?void 0:e.current,t=null===(n=Gi.current[at])||void 0===n?void 0:n.current,o=Kn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),a=r.top-u.top,c=l.top-u.top-a;o.scrollBy({top:c,behavior:"smooth"})}}},Ft=s(function(e){null==e||e.stopPropagation(),En(function(e){var n=!e;return n&&requestAnimationFrame(function(){Et()}),n})},[Et]);c(function(){tn&&"off"!==Hi&&"0:0"!==Hi&&(st.current=null,jn.current=[],requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)}))},[tn,Hi]);var It=a(function(){var e=new Map,n=new Map,i=1;if(un)Di.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),ki.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Di.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Di.length,ki.length),o=0;o<t;o++){var r=Di[o],l=ki[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Di,ki,un]),Tt=Ai.analysis,At=x(null===(Re=null===(xe=null==Tt?void 0:Tt.rule_difference_comparison)||void 0===xe?void 0:xe.summary)||void 0===Re?void 0:Re.overall_summary),Dt=!!At.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),kt=null!==(be=null==Me?void 0:Me.base_root_id)&&void 0!==be?be:"-1";null==Me||Me[kt];var Ot=Sn?null!==(ke=null!==(Te=$e&&(null===(Ie=null==$e?void 0:$e[kt])||void 0===Ie?void 0:Ie.evaluation_result))&&void 0!==Te?Te:null===(De=null===(Ae=null==Me?void 0:Me.nodes)||void 0===Ae?void 0:Ae[kt])||void 0===De?void 0:De.evaluation_result)&&void 0!==ke?ke:null:null!==(Fe=null!==(we=$e&&(null===(Ce=null===(ye=null==$e?void 0:$e[kt])||void 0===ye?void 0:ye.evaluation_result)||void 0===Ce?void 0:Ce[0]))&&void 0!==we?we:null===(Ee=null===(_e=null===(Be=null==Me?void 0:Me.nodes)||void 0===Be?void 0:Be[kt])||void 0===_e?void 0:_e.evaluation_result)||void 0===Ee?void 0:Ee[0])&&void 0!==Fe?Fe:null,Pt=R(Ot),jt=b(null!==(je=null===(Pe=null===(Oe=null==Ot?void 0:Ot.evaluation_outputs)||void 0===Oe?void 0:Oe.metadata)||void 0===Pe?void 0:Pe.label_color)&&void 0!==je?je:A);if(on){var Lt=on(Pt);Lt&&(jt=e(e({},jt),{badgeBg:Lt.bg,badgeText:Lt.text,badgeBorder:Lt.border}))}var Nt=u(mt);c(function(){Nt.current=mt},[mt]);var Mt=u(gi);c(function(){Mt.current=gi},[gi]);var Ht=s(function(e,n,i,t,o,r){return Go.current(e,n,i,t,o,r)},[]),zt=s(function(e,n,i,t,o){return Yo.current(e,n,i,t,o)},[]),qt=s(function(){return Jo.current()},[]),Wt=s(function(e,n){return Xo.current(e,n)},[]),Vt=s(function(e){return $o.current(e)},[]),Gt=s(function(e){return Uo.current(e)},[]),Kt=s(function(){return Qo.current()},[]),Yt=s(function(){var e,n;ht(),null===(e=Nt.current)||void 0===e||e.call(Nt),En(!1),bn(new Set),wn([]),jn.current=[],fo([]),go(null),ci(D),null===(n=Mt.current)||void 0===n||n.call(Mt),requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})},[]),Jt=u(Yt);c(function(){Jt.current=Yt},[Yt]),c(function(){Ve&&Jt.current()},[Ve]);var Xt=a(function(){return{documents:null==Me?void 0:Me.documents,input_index_map:null==Me?void 0:Me.input_index_map}},[JSON.stringify(null==Me?void 0:Me.documents),JSON.stringify(null==Me?void 0:Me.input_index_map)]),$t=u(Me);c(function(){$t.current=Me},[Me]);var Ut=u(qn);c(function(){Ut.current=qn},[qn]);var Qt=s(function(n,i,t,o,r,l,u){var a,c,s,d,v,f,p,g,h,m,S,R,b=x(null==i?void 0:i.id)||x(null==t?void 0:t.id)||"",y=(b?null===(a=Ut.current)||void 0===a?void 0:a[b]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:b,decisioning:[],gap:[],relevance_score:0},w=null!==(s=null===(c=Ui.current[o])||void 0===c?void 0:c.current)&&void 0!==s?s:null,B=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(C)))return u(l);var a=o.split(C)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return s?e(e(e({},c),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),_=(null!==(f=null===(v=null===(d=null==B?void 0:B.cognitive_decisioning)||void 0===d?void 0:d.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==f?f:0)>0||(null!==(h=null===(g=null===(p=null==B?void 0:B.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===g?void 0:g.length)&&void 0!==h?h:0)>0,E=null!==(m=null==Ke?void 0:Ke.isLoading)&&void 0!==m&&m,F=!0;if(Ii)if(B&&Object.keys(B).length>0){var I=Array.isArray(B)?B[0]:B,T=null===(R=null===(S=null==I?void 0:I.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===R?void 0:R.is_orphan;!0!==T&&"true"!==T&&"Yes"!==T&&"yes"!==T||(F=!1)}else F=!1;return{isLoading:E&&!_,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:y,anchorEl:n,sectionAnchorEl:w,badgeStyle:l||null,sectionIdx:o,docData:Xt,deviationData:B,isOrphan:!!r,hasGuidelineMatches:F}},[Xt,null==Ke?void 0:Ke.isLoading,Ii]),Zt=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),ti.open&&ti.sectionIdx===o)hi();else{var u=e.currentTarget,a="left";(null===(l=Kn.current)||void 0===l?void 0:l.contains(u))&&(a="right");ht(),dt.current&&mt(),bn(new Set),wn([]),jn.current=[],gi(),ai.open?_o():si(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(C)){var r=o.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(n=Ki.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=Yi.current[o])||void 0===i?void 0:i.current:null===(t=Ki.current[o])||void 0===t?void 0:t.current}()||u;oi(Qt(e,n,t,o,i,r))})}},[ti.open,ti.sectionIdx,hi,si,Qt]),eo=s(function(){var e=ti.sectionIdx;ti.isOrphan,hi(),si(),null!==e&&(_t(e),ht(),dt.current&&mt(),wn([]),jn.current=[],bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Ln.current&&Ln.current()},50))},[ti.sectionIdx,ti.isOrphan,hi,si,mt]),no=s(function(){var e=Dn.current;if(e){Dn.current=null;var n=Di.findIndex(function(n){return n.id===e}),i=ki.findIndex(function(n){return n.id===e}),t=-1===n?y(Di,e):null,o=-1===i?y(ki,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(gt.current.add(r),B(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(un)-1!==r&&Un.current&&a(function(){return u(n,t,Vi,Xi)},Un.current),-1!==l&&Kn.current&&a(function(){return u(i,o,Gi,$i)},Kn.current);else{var c=Vn.current;if(!c)return;a(function(){return-1!==r?u(n,t,Vi,Xi):u(i,o,Gi,$i)},c)}}},[Di,ki,un,Vi,Gi,Xi,$i,Un,Kn,Vn]),io=s(function(n){if(n){ht(),mt(),bn(new Set),wn([]),jn.current=[],si(),gi();var i=Di.findIndex(function(e){return e.id===n}),t=ki.findIndex(function(e){return e.id===n}),o=-1===i?y(Di,n):null,r=-1===t?y(ki,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;Dn.current=n,bt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=un?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=un?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Ct(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){Dn.current===n&&to.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Di,ki,un,bt,Ct,mt,si,gi]),to=u(no);c(function(){to.current=no},[no]);var oo=u(null);c(function(){if(xi){var e=mi.fields.find(function(e){return e.analysisKey===xi||e.key===xi});if(e){var n=qi.current[e.key]||Wi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[xi,mi.fields]);var ro=s(function(e){var n,i,t,o,r,l,u,a,c,s=null===(n=null==Tt?void 0:Tt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[Tt]),lo=X({proposedSections:Di,existingSections:ki,maintainRelativeOrder:un,cognitiveMap:qn,deviationData:zn,treeData:Me,resolvedComparisonConfig:mi,badgeStyleOverride:on}),uo=lo.getSectionCompareStyle,ao=lo.getSubSectionCompareStyle,co=lo.getDeviationStyleByKey,so=U({containerRef:In,leftContainerRef:Un,rightContainerRef:Kn,svgContainerRef:Fn,pathRefs:Pn,leftHeaderRef:Tn,rightHeaderRef:An,proposedSections:Di,existingSections:ki,visibleFields:Oi,leftRefs:qi,rightRefs:Wi,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,expandedSections:Rt,expandedSubSections:yt,connectedSections:Rn,isSideBySide:it,activeSideBySideSection:at,maintainRelativeOrder:un,isGuidelineMode:Ii,cognitiveMap:qn,getSectionCompareStyle:uo,getSubSectionCompareStyle:ao,getDeviationStyleByKey:co,isArrowVisible:tt,isAnimatingRef:kn,isSideBySideRef:dt,sideBySideCacheRef:st,sideBySideLineRef:pt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,connectedLines:Cn,setConnectedLines:wn,cachedConnectedPositions:jn,calculateLinesRef:Ln,resizeTimerRef:Nn,scrollLock:ct,scrollSyncLocked:_n,handleResizeRef:Mn,activeProposed:Ti,existingRule:Ai,analysisData:Tt,pendingScrollTargetRef:Qn,pendingScrollCallbackRef:Zn,resolvedComparisonConfig:mi,getFieldData:ro}),vo=so.lines,fo=so.setLines,po=so.overallConnector,go=so.setOverallConnector,ho=so.svgDimensions,mo=so.handleColumnScroll;c(function(){ai.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})})},[ai.anchorEl,_n]);var So=s(function(){ht(),En(!1),bt({}),Ct({}),mt(),bn(new Set),wn([]),jn.current=[],si(),gi(),hi(),requestAnimationFrame(function(){Ln.current&&Ln.current()})},[bt,Ct,mt,si,gi,hi]);c(function(){it||0!==Rn.size||En(!1)},[it,Rn]);var xo=a(function(){return Object.values(Rt).some(Boolean)||Object.values(yt).some(Boolean)},[Rt,yt]),Ro=u(null),bo=u(0),yo=u(0),Co=u(0),wo=$({timerRef:Ro,ruleComponentRef:Gn,scrollContainerRef:Vn,containerRef:In,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,isSideBySideRef:dt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,sectionRowRefs:Ui,sectionRightRowRefs:Ji,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,leftContainerRef:Un,rightContainerRef:Kn,calculateLinesRef:Ln,handleResizeRef:Mn,setIsResizing:lt,setIsArrowVisible:ot,sideBySideCacheRef:st,cachedConnectedPositions:jn}).handleResize;c(function(){Mn.current=wo},[wo,Mn]),c(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var a=e[e.length-1];if(a){var c=null!==(u=null===(l=null===(r=a.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:a.contentRect.width;Math.abs(c-n.current)<1?o():(n.current=c,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Gn.current&&o.push(e(Gn.current,bo,n,function(){return Mn.current()},function(){})),Vn.current&&o.push(e(Vn.current,yo,i,function(){return Mn.current()},function(){return Ln.current()})),In.current&&o.push(e(In.current,Co,t,function(){return Mn.current()},function(){return Ln.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),c(function(){dt.current=it},[it]),c(function(){ft.current=at},[at]);var Bo=s(function(){var e,n=ti.sectionIdx,i=ti.isOrphan;if(si(),null!=n){var t="left";ti.anchorEl&&(null===(e=Kn.current)||void 0===e?void 0:e.contains(ti.anchorEl))&&(t="right"),_t(n),St(n,i,{sourceSide:t})}},[St,ti.isOrphan,ti.sectionIdx,ti.anchorEl,si]),_o=s(function(){si(),mt(),bn(new Set),wn([]),jn.current=[]},[si,mt]),Eo=null!==ti.sectionIdx&&Rn.has(ti.sectionIdx),Fo=q({proposedSections:Di,existingSections:ki,parentDeviationRecord:Pi,expandedSections:Rt,maintainRelativeOrder:!!un,scrollContainerRef:Vn,leftContainerRef:Un,rightContainerRef:Kn,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi}),Io=Fo.showDeviationNavigation,To=Fo.showOpenNodeRef,Ao=Fo.adjustScrollForPopup,Do=s(function(e,n,i,t,o){var r,l="string"==typeof t?x(t).trim():x(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;gi();var a="left";(null===(r=Kn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(C)){var r=n.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(i=Ki.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=Yi.current[n])||void 0===t?void 0:t.current:null===(o=Ki.current[n])||void 0===o?void 0:o.current};if(i)return mt(),bn(new Set),wn([]),jn.current=[],void(l&&(_t(n),requestAnimationFrame(function(){var e=c()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ci({open:!0,anchorEl:e,summary:t,displayImpact:o})})));_t(n),l?setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var a=l.top-window.innerHeight/2;un?(null===(e=Un.current)||void 0===e||e.scrollBy({top:a,behavior:"smooth"}),null===(n=Kn.current)||void 0===n||n.scrollBy({top:a,behavior:"smooth"})):null===(i=Vn.current)||void 0===i||i.scrollBy({top:a,behavior:"smooth"})}}ci({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[St,gi,ci,mt,_t]),ko=a(function(){var e;if(!Ue)return null;var n=null===(e=null==Ue?void 0:Ue.id)||void 0===e?void 0:e.split(":")[0];for(var i in Pi){if((Pi[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ue,Pi]),Oo=u({id:null,triggerMs:null}),Po=u(null);c(function(){if(null==Ue?void 0:Ue.id){var o=Number(Ue.trigger),r=Oo.current;if((null==r?void 0:r.triggerMs)!==o){if(!(Ue.id.includes(":")&&/:\d+$/.test(Ue.id)))return Oo.current={id:Ue.id,triggerMs:o},void io(Ue.id);var l=Ue.id.split(":"),u=l[0],a=l[1],c=null!=a?a:"0";Po.current!==Ue.id&&(si(),gi(),mt(),bn(new Set),wn([]),jn.current=[],Po.current=Ue.id);var s=!1,d=0,v=null,f=null,p=!1,g=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},h=function(){var r,l,a,m;if(!s){var S=function(){Oo.current={id:Ue.id,triggerMs:o}},x=null,R=null;for(var b in Pi){var y=Pi[b].find(function(e){return e.id===u});if(y){x=b,R=y;break}}if(R&&x){var w=Di.findIndex(function(e){return e.id===x}),B=ki.findIndex(function(e){return e.id===x}),F=-1===w&&-1!==B,I=g(Di,R.id),T=g(ki,R.id);if(I&&!T&&!F){var A=I.split("-"),D=Number(A[0]);if(un){var k=null===(l=null===(r=Di[D])||void 0===r?void 0:r.refIndexes)||void 0===l?void 0:l[0],O=ki.findIndex(function(e){return e.selfIndex===k});-1!==O&&(D=O)}T=n([D],A.slice(1),!0).join("-")}if(I||T){var P=I?Number(I.split("-")[0]):w,j=T?Number(T.split("-")[0]):B,L=j>=0?j:T?Number(T.split("-")[0]):-1,N=Di[P],M=ki[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,q=F||(!I&&!!T||H&&!z);if(q){if(!(un?!!Ko.current["right-".concat(j)]:!!Ko.current[String(j)])&&j>=0)return Bt(j,"right"),void(v=setTimeout(h,200))}else if(!(un?!!Ko.current["left-".concat(P)]:!!Ko.current[String(P)])&&P>=0)return Bt(P,"left"),void(v=setTimeout(h,200));var W=I||"",V=T||"",G="".concat(R.id).concat(C).concat(c).concat(C).concat(W).concat(C).concat(V),K="".concat(R.id).concat(C).concat(c);if(!p){_t(G),p=!0,d=0;var Y=function(){var e,n,i=null===(e=Ki.current[K])||void 0===e?void 0:e.current,t=null===(n=Yi.current[K])||void 0===n?void 0:n.current;return q||!i&&!!t?t:i};return null==f||f(),void(v=setTimeout(function(){var e,n,i,t,o,r,l;s||(e=Y,n=function(){s||(f=null,h())},t=0,o=null,r=null,l=function(){if(!s){var u=e();if(u&&0!==u.getBoundingClientRect().height){var a=u.getBoundingClientRect(),c=a.top,d=a.height,v=null!==o&&Math.abs(c-o)<.5,f=null!==r&&Math.abs(d-r)<.5;if(v&&f){if(++t>=5)return void n()}else t=0;o=c,r=d,i=requestAnimationFrame(l)}else i=requestAnimationFrame(l)}},i=requestAnimationFrame(l),f=function(){return cancelAnimationFrame(i)})},300))}var J=null===(a=Ki.current[K])||void 0===a?void 0:a.current,X=null===(m=Yi.current[K])||void 0===m?void 0:m.current;if(J||X){var $=q||!J&&!!X,U=$?X:J,Q=un?$?Kn.current:Un.current:Vn.current;if(U&&Q){var Z=U.getBoundingClientRect();if(0!==Z.height){var ee=Q.getBoundingClientRect(),ne=Z.top-ee.top+Q.scrollTop-ee.height/2+Z.height/2,ie=(null==I?void 0:I.includes("-"))||(null==T?void 0:T.includes("-")),te=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,a,d,v,f;return t(this,function(t){switch(t.label){case 0:return s?[2]:(S(),n=U instanceof Element?window.getComputedStyle(U).color:"",[J,X].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[J,X].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(a=null===(u=R.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===a?void 0:a[c])||R,o=(null===(d=R.evaluationResult)||void 0===d?void 0:d.evaluation_outputs)||R.evaluation_outputs,!!J&&!!X?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},un?[4,Promise.all([Un.current?l(E(Un.current),600):Promise.resolve(),Kn.current?l(E(Kn.current),600):Promise.resolve()])]:[3,2]):(r=$?(null===(v=Yi.current[ie?K:j])||void 0===v?void 0:v.current)||X:(null===(f=Ki.current[ie?K:P])||void 0===f?void 0:f.current)||J,Ao(r,function(){ci({open:!0,anchorEl:r,displayImpact:Ue.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==Qe||Qe(),[2]));case 1:t.sent(),t.label=2;case 2:return St(G,!1,{toggleIfSame:!1,sourceSide:F?"right":"left",onReady:function(){var n,t,o,r;S();var l=$?(null===(n=Yi.current[K])||void 0===n?void 0:n.current)||X:(null===(t=Ki.current[K])||void 0===t?void 0:t.current)||J,u=(null===(o=Ki.current[K])||void 0===o?void 0:o.current)||J,a=(null===(r=Yi.current[K])||void 0===r?void 0:r.current)||X;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"})),ci({open:!0,anchorEl:l,displayImpact:Ue.displayImpact,summary:e({},i)}),null==Qe||Qe()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():_(Q,ne,te)}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}};return v=setTimeout(h,100),function(){s=!0,v&&clearTimeout(v),null==f||f()}}}},[Ue,Pi,Di,ki,un,Rt,St,ci,io]),c(function(){var n,i,t;if(ai.open){var o=ai.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(Ki.current)||r(Yi.current);if(l){var u=(null===(i=Yi.current[l])||void 0===i?void 0:i.current)||(null===(t=Ki.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ci(function(n){return e(e({},n),{anchorEl:u})})}}}},[ai.open,ai.anchorEl,_n,Rn,Rt]);var jo=ni.open,Lo=ni.sectionIdx,No=ni.isOrphan,Mo=ni.badgeStyle,Ho=ni.anchorEl,zo=ni.sectionAnchorEl;c(function(){var n;if(Ke.isStreamingEnabled&&jo&&null!=Lo&&Lo!==kt){var i="string"==typeof Lo?Lo.split(C)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(Di,i):null,r=i&&"string"==typeof i?t(ki,i):null,l="number"==typeof Lo?Di[Lo]||null:o||i&&((null===(n=null==Me?void 0:Me.nodes)||void 0===n?void 0:n[i])||(null==Me?void 0:Me[i]))||null,u="number"==typeof Lo?ki[Lo]||null:r,a=Qt(Ho,l,u,Lo,No,Mo);ii(function(n){return n.open?x(n.cognitiveData)===x(a.cognitiveData)&&x(n.deviationData)===x(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e(e(e({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[jo,Lo,No,Mo,Ho,zo,Di,ki,Qt]);var qo=s(function(e){var n=e.section,i=e.keyPath,t=e.depth,r=void 0===t?0:t,l=e.columnKey,u=void 0===l?"left":l,a=e.parentNodeId,c=void 0===a?"":a,s=e.sectionOffset;return o(V,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:c,sectionOffset:s})},[]),Wo=a(function(){return Di.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&un?null:o(G,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Di]),Vo=a(function(){return ki.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&un?null:o(K,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[ki]),Go=u(Zt);c(function(){Go.current=Zt},[Zt]);var Ko=u(Rt);c(function(){Ko.current=Rt},[Rt]);var Yo=u(Do);c(function(){Yo.current=Do},[Do]);var Jo=u(_o);c(function(){Jo.current=_o},[_o]);var Xo=u(Bt);c(function(){Xo.current=Bt},[Bt]);var $o=u(wt);c(function(){$o.current=wt},[wt]);var Uo=u(qo);c(function(){Uo.current=qo},[qo]);var Qo=u(mt);c(function(){Qo.current=mt},[mt]);var Zo=a(function(){return{isGuidelineMode:Ii,maintainRelativeOrder:!!un,showDeviationBadges:dn,isProposingFix:en,proposingFixNodeId:nn,isRedlineFlow:tn,isSideBySide:it,activeSideBySideSection:at,scrollSyncLocked:_n,toggleScrollSyncLocked:Ft,summaryPopupAnchorEl:ai.anchorEl,connectedSections:Rn,proposedSections:Di,existingSections:ki,deviationNumberRegistry:ji,deviationParentRegistry:Li,treeData:Me,displayConfig:Ke,resolvedMarkdownStyles:Wn,unifiedNumbering:It,expandedSections:Rt,expandedSubSections:yt,setExpandedSubSections:Ct,getSectionCompareStyle:uo,getSubSectionCompareStyle:ao,getBadgeRef:et,getSectionRowRef:Qi,getSubSectionRef:Zi,sectionLeftRefs:Vi,sectionRightRefs:Gi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,openMoreFunctionsPopup:Ht,handleOpenSummaryPopup:zt,openSummaryPopup:zt,handleCloseSummaryPopup:qt,toggleSection:Wt,handleSubSectionToggle:Vt,renderSubSectionAccordion:Gt,resetSideBySide:Kt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,showDeviationNavigation:Io,showOpenNodeRef:To,deviationNodeIdToView:null==Ue?void 0:Ue.id,deviationTargetParentId:ko,guidelinesData:rn}},[Ii,un,dn,en,nn,tn,it,at,_n,Ft,ai.anchorEl,Rn,Di,ki,ji,Ke,Wn,It,Rt,yt,Ct,uo,ao,et,Qi,Zi,Io,To,Ue,ko,rn]);return o(J,e({value:Zo},{children:r(d,e({ref:Gn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[fn&&o(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:o(j,{})})),ai.open&&o(Y,{open:ai.open,anchorEl:ai.anchorEl,containerEl:oo.current,clipTopEl:Tn.current,scrollContainerEl:Vn.current,onClose:_o,summary:ai.summary,displayImpact:ai.displayImpact,isScrollLocked:_n}),o(P,{open:ti.open,anchorEl:ti.anchorEl,maintainRelativeOrder:!!un,sectionTitle:ti.sectionTitle,referenceSectionTitle:ti.refSectionTitle,onClose:hi,onOpenCognitiveCompare:fi,onOpenSideBySide:Bo,onConnect:eo,isConnected:Eo,isOrphan:!Ii&&!!ti.isOrphan,isGuidelineMode:Ii,hasGuidelineMatches:ti.hasGuidelineMatches}),ni.open&&o(O,{open:ni.open,popupRef:vi,position:ri,popupConfig:Je,onClose:function(){li(null),ii(function(n){return e(e({},n),{open:!1})}),di(null)},markdownStyles:We,sectionTitle:wi,referenceSectionTitle:_i,cognitiveData:ni.cognitiveData,anchorEl:ni.anchorEl,sectionAnchorEl:ni.sectionAnchorEl,scrollContainerEl:Vn.current,badgeStyle:ni.badgeStyle,docData:ni.docData,deviationData:ni.deviationData,isLoading:ni.isLoading}),o(v,e({open:!!hn,autoHideDuration:8e3,onClose:function(){return mn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return mn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:hn}))})),o(W,{componentHeaderText:Ne,displayConfig:Ke,maintainRelativeOrder:un,onCollapseAll:So,showCollapseAll:xo,onToggleView:function(e){pn(!0),setTimeout(function(){an(!e),null==Ye||Ye(!e),En(!1),mt(),si(),bn(new Set),wn([]),jn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){pn(!1)},600)})})},50)}}),o(d,e({ref:Vn,onScroll:mo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:un?"visible":"auto",borderTop:At&&Dt?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},un?{flex:1}:{})},{children:r(d,e({ref:In,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},un?{flex:1,overflow:"visible"}:{})},{children:[o(Z,{svgContainerRef:Fn,svgDimensions:ho,isResizing:rt,overallConnector:po,rootDeviationStyle:jt,lines:vo,isSideBySide:it,activeSideBySideSection:at,isArrowVisible:tt,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,cognitivePopup:ni,activeBadgeId:ui,closeCognitivePopup:gi,setActiveBadgeId:di,openCognitivePopupFromState:pi,buildSectionPopupState:Qt,connectedLines:Cn,pathRefs:Pn}),r(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},un?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:Tn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:o(p,e({title:yi,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:yi}))}))})),r(d,e({ref:Un,onScroll:mo,sx:e({p:"12px",display:"flex",flexDirection:"column"},un?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:Xn,style:{width:"100%",height:"0px",flexShrink:0}}),Mi&&Wo,o("div",{ref:$n,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:oo,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:o(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:r(d,e({onClick:function(n){n.stopPropagation(),ni.open&&ui===kt?gi():(di(kt),pi(Qt(n.currentTarget,{title:"",content:"",evaluationResult:Ot,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,kt,!0,e(e({},jt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:jt.badgeBg,color:jt.badgeText,border:"1px solid ".concat(jt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Pt?Pt:o(L,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(m,{})})),o(h,{size:11,style:{transform:ni.open&&ui===kt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),r(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},un?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[ut&&o(S,{sections:11}),o(d,e({ref:An,sx:e({p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},un?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},Ii?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:o(p,e({title:Ei,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ei}))}))})),r(d,e({ref:Kn,onScroll:mo,sx:e({p:Ii?"0px":"12px",display:"flex",flexDirection:"column"},un?e(e({maxHeight:"calc(100vh - 250px)"},!Ii&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:Yn,style:{width:"100%",height:"0px",flexShrink:0}}),Ii?o(ee,{guidelinesData:rn,deviationData:$e,connectedSections:Rn,proposedSections:Di}):Mi&&Vo,o("div",{ref:Jn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ne as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__spreadArray as o,__assign as
|
|
1
|
+
import{__spreadArray as o,__assign as i}from"tslib";import{jsx as r}from"react/jsx-runtime";import{useMemo as e}from"react";import{Box as t}from"@mui/material";import l from"react-markdown";import a from"rehype-raw";import{SHARED_MARKDOWN_STYLES as n}from"../../CognitiveCompareConfig.js";import{DEVIATION_BADGE_SEPARATOR as u,generateColorPalette as d}from"../../CognitiveComparehelpers.js";import{processGuidelinesMarkdown as s}from"../utils/processGuidelinesMarkdown.js";var g=function(g){var v=g.guidelinesData,p=g.deviationData,m=g.connectedSections,f=g.proposedSections,h=Array.from(m)[0],c=e(function(){var i;if(null==h||!p)return{targetHighlights:[],labelColor:""};var r="";"number"==typeof h?r=(null===(i=f[h])||void 0===i?void 0:i.nodeId)||"":"string"==typeof h&&(r=h.includes(u)?h.split(u)[0]:h.split("::")[0].split(":")[0]);var e=p[r];if(!e)return{targetHighlights:[],labelColor:""};var t=[],l=e.evaluation_result||{},a="";return Object.values(l).forEach(function(i){var r,e,l,n,u;(null===(r=null==i?void 0:i.deviation_highlights)||void 0===r?void 0:r.rulebook_guidelines)&&(t=o(o([],t,!0),i.deviation_highlights.rulebook_guidelines,!0),a=(null===(l=null===(e=i.evaluation_outputs)||void 0===e?void 0:e.metadata)||void 0===l?void 0:l.label_color)?d(null===(u=null===(n=i.evaluation_outputs)||void 0===n?void 0:n.metadata)||void 0===u?void 0:u.label_color).bg:"")}),{targetHighlights:t.filter(Boolean),labelColor:a}},[h,p,f]),b=c.targetHighlights,C=c.labelColor,_=e(function(){return s({guidelinesData:v,targetHighlights:b,labelColor:C||"#FEF08A"})},[v,b,C]);return r(t,i({sx:i(i({padding:"0px 12px",backgroundColor:"#FFFFFF",borderRadius:"8px"},n),{overflow:"visible"})},{children:r(l,i({rehypePlugins:[a]},{children:_}))}))};export{g as default};
|
|
2
2
|
//# sourceMappingURL=GuidelinePanel.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var a=function(a){var t,n,o=a.guidelinesData,e=a.targetHighlights,c=void 0===e?[]:e,i=a.labelColor,l=void 0===i?"#FEF08A":i,r=(null===(n=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.artifactData)||void 0===n?void 0:n.userStorySnapshot)||[],u="";return r.forEach(function(a){var t;a.title&&(u+="### ".concat(a.title,"\n\n")),a.value&&(u+="".concat(a.value,"\n\n")),null===(t=a.sub_features)||void 0===t||t.forEach(function(a){a.title&&(u+="#### ".concat(a.title,"\n\n")),a.value&&(u+="".concat(a.value,"\n\n"))})}),c.forEach(function(a,t){var n=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),o=new RegExp("(".concat(n,")"),"g");u=u.replace(o,'<mark id="guideline-target-'.concat(t,'" style="background-color: ').concat(l,'; border-radius: 3px; padding: 2px;">$1</mark>'))}),u};export{a as processGuidelinesMarkdown};
|
|
2
|
+
//# sourceMappingURL=processGuidelinesMarkdown.js.map
|