@viswa-test/test-citation 0.0.195 → 0.0.196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  2. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  3. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  4. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.js +1 -1
  5. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  6. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ToneToggle.js +1 -1
  7. package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
  8. package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasoningCitation.js +1 -1
  9. package/dist/cjs/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +2 -0
  10. package/dist/cjs/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js.map +1 -0
  11. package/dist/cjs/features/RequirementAI/components/segment/Segment.js +1 -1
  12. package/dist/cjs/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  13. package/dist/cjs/features/RequirementAI/components/segment/segment.module.css.js +1 -1
  14. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  15. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  16. package/dist/cjs/features/UserStoryImport/UserStoryPicker.js +1 -1
  17. package/dist/cjs/features/UserStoryImport/components/TypeDropdown.js +1 -1
  18. package/dist/cjs/features/UserStoryImport/components/UserStoryCard.js +1 -1
  19. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  20. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  21. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  22. package/dist/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.js +1 -1
  23. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  24. package/dist/features/RequirementAI/components/UserStoryCard/Popups/ToneToggle.js +1 -1
  25. package/dist/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
  26. package/dist/features/RequirementAI/components/ai-reasoning/AiReasoningCitation.js +1 -1
  27. package/dist/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +2 -0
  28. package/dist/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js.map +1 -0
  29. package/dist/features/RequirementAI/components/segment/Segment.js +1 -1
  30. package/dist/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
  31. package/dist/features/RequirementAI/components/segment/segment.module.css.js +1 -1
  32. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  33. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  34. package/dist/features/UserStoryImport/UserStoryPicker.js +1 -1
  35. package/dist/features/UserStoryImport/components/TypeDropdown.js +1 -1
  36. package/dist/features/UserStoryImport/components/UserStoryCard.js +1 -1
  37. package/dist/types/src/CommonConstants/CommonConstants.d.ts +2670 -1126
  38. package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
  39. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  40. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +13 -1
  41. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  42. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +18 -4
  43. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  44. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts +6 -1
  45. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts.map +1 -1
  46. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +5 -1
  47. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
  48. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ToneToggle.d.ts +4 -1
  49. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ToneToggle.d.ts.map +1 -1
  50. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts.map +1 -1
  51. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitation.d.ts +3 -1
  52. package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitation.d.ts.map +1 -1
  53. package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts +11 -0
  54. package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts.map +1 -0
  55. package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts +0 -1
  56. package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts.map +1 -1
  57. package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts.map +1 -1
  58. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +3 -1
  59. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  60. package/dist/types/src/features/RequirementAI/interfaces/citation.interface.d.ts +37 -0
  61. package/dist/types/src/features/RequirementAI/interfaces/citation.interface.d.ts.map +1 -1
  62. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +3 -0
  63. package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
  64. package/dist/types/src/features/UserStoryImport/UserStoryPicker.context.d.ts +1 -0
  65. package/dist/types/src/features/UserStoryImport/UserStoryPicker.context.d.ts.map +1 -1
  66. package/dist/types/src/features/UserStoryImport/UserStoryPicker.d.ts +1 -1
  67. package/dist/types/src/features/UserStoryImport/UserStoryPicker.d.ts.map +1 -1
  68. package/dist/types/src/features/UserStoryImport/UserStoryPicker.types.d.ts +1 -0
  69. package/dist/types/src/features/UserStoryImport/UserStoryPicker.types.d.ts.map +1 -1
  70. package/dist/types/src/features/UserStoryImport/components/TypeDropdown.d.ts.map +1 -1
  71. package/dist/types/src/features/UserStoryImport/components/UserStoryCard.d.ts.map +1 -1
  72. package/package.json +2 -2
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as i,jsx as o,Fragment as n}from"react/jsx-runtime";import{Info as t,ChevronDown as l,PenLine as r,CheckCircle as d,XCircle as a,ChevronRight as s}from"lucide-react";import{useState as c}from"react";import{ToneToggle as v}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as p}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as u}from"../icons/aiMagic.svg.js";var g=[{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"}],m=function(n){var t=n.toneIndex,l=n.configs,r=void 0===l?g:l,d=r[Math.min(t,r.length-1)]||r[1]||r[0],a=d.color,s=d.angle,c=d.arcD,v=(s-90)*Math.PI/180,p=11+9*Math.cos(v),u=13+9*Math.sin(v);return i("svg",e({width:"22",height:"14",viewBox:"0 0 22 14",fill:"none"},{children:[o("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),o("path",{d:c,stroke:a,strokeWidth:"2.5",strokeLinecap:"round"}),o("line",{x1:"11",y1:"13",x2:p,y2:u,stroke:a,strokeWidth:"2",strokeLinecap:"round"})]}))},y=function(i){var n=i.type,t=i.customStyles,l=void 0===t?{}:t,r=e(e({},{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"}}),l),d=r[n]||r.Medium;return o("div",e({style:d},{children:n}))},f=["Lenient","Balanced","Aggressive"],h={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},x={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"400px",overflow:"auto"},S={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},b={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},C={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111"},B={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px"},I={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},k={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},A={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},D={display:"flex",gap:8,marginBottom:18},T={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},w={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},z={borderTop:"0.5px solid #eee",paddingTop:14},R={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},W={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},E={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},j={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},L={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},M={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},F={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},H={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"};function N(N){var _,P,O,G,q,J,K,Q,U,V,X,Y,Z,$,ee,ie,oe,ne,te,le=N.onClose,re=N.aiReason,de=N.onAccept,ae=N.onReject,se=N.onIterate,ce=N.initialTone,ve=N.onRegenerate,pe=N.labels,ue=void 0===pe?{}:pe,ge=N.toneLevelsConfig,me=void 0===ge?f:ge,ye=N.toneColorsConfig,fe=void 0===ye?h:ye,he=N.dialConfigs,xe=void 0===he?g:he,Se=N.customStyles,be=void 0===Se?{}:Se,Ce=N.severityChipStyles,Be=void 0===Ce?{}:Ce,Ie=N.customIcons,ke=void 0===Ie?{}:Ie,Ae=N.onOpenCognitive,De=N.showTone,Te=void 0===De||De,we=N.cognitiveSectionStyle,ze=void 0===we?{}:we,Re=N.cognitiveScoreBadgeStyle,We=void 0===Re?{}:Re,Ee=N.cognitiveScoreTextStyle,je=void 0===Ee?{}:Ee,Le=N.cognitiveStyles,Me=void 0===Le?{}:Le,Fe=N.cognitiveClassNames,He=void 0===Fe?{}:Fe,Ne=N.cognitiveTitle,_e=void 0===Ne?"Cognitive Integrity":Ne,Pe=N.cognitiveLeftIcon,Oe=N.showCognitiveRightArrow,Ge=void 0===Oe||Oe,qe=me.findIndex(function(e){return e===ce});-1===qe&&(qe=1);var Je=c(!0),Ke=Je[0],Qe=Je[1],Ue=c(!1),Ve=Ue[0],Xe=Ue[1],Ye=c(qe),Ze=Ye[0],$e=Ye[1],ei=c(qe)[0],ii=me[Ze],oi=fe[ii]||"#BA7517",ni=Ze!==ei;return i("div",e({onClick:function(e){return e.stopPropagation()},style:e(e({},x),null===(_=null==be?void 0:be.DeviationSummaryStyles)||void 0===_?void 0:_.root)},{children:[i("div",e({style:e(e({},S),null===(P=null==be?void 0:be.DeviationSummaryStyles)||void 0===P?void 0:P.header)},{children:[i("div",e({style:{display:"flex",alignItems:"center",gap:6}},{children:[o("span",{children:ke.summaryIcon||o(t,{size:16,color:"#E24B4A"})}),o("span",e({style:e(e({},b),null===(O=null==be?void 0:be.DeviationSummaryStyles)||void 0===O?void 0:O.title)},{children:ue.summaryHeader||"Summary"}))]})),o("button",e({onClick:le,style:e(e({},w),null===(G=null==be?void 0:be.DeviationSummaryStyles)||void 0===G?void 0:G.closeBtn)},{children:"✕"}))]})),o("p",e({style:e(e({},C),null===(q=null==be?void 0:be.DeviationSummaryStyles)||void 0===q?void 0:q.bodyText)},{children:null===(J=null==re?void 0:re.deviation_details)||void 0===J?void 0:J.deviation_title})),o("p",e({style:e(e({},B),null===(K=null==be?void 0:be.DeviationSummaryStyles)||void 0===K?void 0:K.summary)},{children:null===(Q=null==re?void 0:re.deviation_details)||void 0===Q?void 0:Q.deviation_summary})),i("div",e({style:e(e({},I),null===(U=null==be?void 0:be.DeviationSummaryStyles)||void 0===U?void 0:U.impactContainer)},{children:[i("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[i("button",e({onClick:function(){return Qe(!Ke)},style:e(e({},k),null===(V=null==be?void 0:be.DeviationSummaryStyles)||void 0===V?void 0:V.impactToggle)},{children:[o("span",e({style:e(e({},A),null===(X=null==be?void 0:be.DeviationSummaryStyles)||void 0===X?void 0:X.impactToggleLabel)},{children:ue.impactHeader||"Impact"})),o("span",e({style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ke?"rotate(180deg)":"rotate(0deg)"}},{children:o(l,{size:16,color:"#E24B4A"})}))]})),o(y,{type:(null==re?void 0:re.severity)||"Medium",customStyles:Be})]})),Ke&&o("p",e({style:{fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0"}},{children:null!==(Z=null===(Y=null==re?void 0:re.deviation_details)||void 0===Y?void 0:Y.deviation_impact)&&void 0!==Z?Z:ue.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."}))]})),i("div",e({style:e(e({},D),null===($=null==be?void 0:be.DeviationSummaryStyles)||void 0===$?void 0:$.actionContainer)},{children:[i("button",e({style:e(e(e({},T),null===(ee=null==be?void 0:be.DeviationSummaryStyles)||void 0===ee?void 0:ee.actionBtn),{color:"#64748B"}),onClick:se},{children:[ke.iterateIcon||o(r,{size:16,color:"#64748B"}),ue.btnIterate||"Iterate"]}),"Iterate"),i("button",e({style:e(e(e({},T),null===(ie=null==be?void 0:be.DeviationSummaryStyles)||void 0===ie?void 0:ie.actionBtn),{color:"#10B981"}),onClick:de},{children:[ke.acceptIcon||o(d,{size:16,color:"#10B981"}),ue.btnAccept||"Approve"]}),"Accept"),i("button",e({style:e(e(e({},T),null===(oe=null==be?void 0:be.DeviationSummaryStyles)||void 0===oe?void 0:oe.actionBtn),{color:"#DC2626"}),onClick:ae},{children:[ke.rejectIcon||o(a,{size:16,color:"#DC2626"}),ue.btnReject||"Reject"]}),"reject")]})),Te&&i("div",e({style:e(e({},z),null===(ne=null==be?void 0:be.DeviationSummaryStyles)||void 0===ne?void 0:ne.toneContainer)},{children:[i("button",e({onClick:function(){return Xe(!Ve)},style:e(e({},R),null===(te=null==be?void 0:be.DeviationSummaryStyles)||void 0===te?void 0:te.toneToggleBtn)},{children:[i("div",e({style:{display:"flex",alignItems:"center",gap:8}},{children:[o(m,{toneIndex:Ze,configs:xe}),o("span",e({style:{fontSize:13,fontWeight:500,color:"#111"}},{children:ue.toneHeader||"Redline Tone"}))]})),o("span",e({style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ve?"rotate(180deg)":"rotate(0deg)"}},{children:o(l,{size:16,color:"#111"})}))]})),Ve&&i(n,{children:[o("p",e({style:{fontSize:12,color:"#888",margin:"0 0 12px"}},{children:ue.toneDescription||"Controls how assertively AI is redlining"})),o(v,{isDirty:ni,onToneChange:function(e){$e(e)},toneColor:oi,toneIndex:Ze,onClickRegenerate:function(){return null==ve?void 0:ve(ii)},toneLabels:me})]})]})),Ae&&i("div",e({className:null==He?void 0:He.section,onClick:function(e){e.stopPropagation(),Ae&&Ae(e)},style:e(e(e({},W),null==Me?void 0:Me.section),ze)},{children:[i("div",e({className:null==He?void 0:He.headerLeft,style:e(e({},E),null==Me?void 0:Me.headerLeft)},{children:[o("span",e({className:null==He?void 0:He.titleIcon,style:e(e({},j),null==Me?void 0:Me.titleIcon)},{children:null!=Pe?Pe:o(p,{})})),o("div",e({className:null==He?void 0:He.cognitiveTitle,style:e(e({},L),null==Me?void 0:Me.cognitiveTitle)},{children:_e}))]})),i("div",e({className:null==He?void 0:He.headerRight,style:e(e({},M),null==Me?void 0:Me.headerRight)},{children:[void 0!==(null==re?void 0:re.relevance_score)&&null!==(null==re?void 0:re.relevance_score)?i("span",e({className:null==He?void 0:He.scoreBadge,style:e(e(e({},F),null==Me?void 0:Me.scoreBadge),We)},{children:[o(u,{}),i("span",e({className:null==He?void 0:He.scoreText,style:e(e(e({},H),null==Me?void 0:Me.scoreText),je)},{children:[Math.round(Number(re.relevance_score)),"%"]}))]})):null,Ge&&o("span",e({style:{display:"flex",alignItems:"center"}},{children:o(s,{size:16,color:"#64748B"})}))]}))]}))]}))}export{N as default};
1
+ import{__assign as e}from"tslib";import{jsx as i,jsxs as o,Fragment as n}from"react/jsx-runtime";import{PenLine as t,CheckCircle as l,XCircle as r,Info as d,ChevronDown as a,ChevronRight as s}from"lucide-react";import{useState as c}from"react";import{ToneToggle as p}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as v}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as u}from"../icons/aiMagic.svg.js";var g=[{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"}],m=function(n){var t=n.toneIndex,l=n.configs,r=void 0===l?g:l,d=r[Math.min(t,r.length-1)]||r[1]||r[0],a=d.color,s=d.angle,c=d.arcD,p=(s-90)*Math.PI/180,v=11+9*Math.cos(p),u=13+9*Math.sin(p);return o("svg",e({width:"22",height:"14",viewBox:"0 0 22 14",fill:"none"},{children:[i("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),i("path",{d:c,stroke:a,strokeWidth:"2.5",strokeLinecap:"round"}),i("line",{x1:"11",y1:"13",x2:v,y2:u,stroke:a,strokeWidth:"2",strokeLinecap:"round"})]}))},y=function(o){var n=o.type,t=o.customStyles,l=void 0===t?{}:t,r=e(e({},{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"}}),l),d=r[n]||r.Medium;return i("div",e({style:d},{children:n}))},f=["Lenient","Balanced","Aggressive"],h={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},x={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"400px",overflow:"auto"},S={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},b={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},C={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111"},B={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px"},I={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},k={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},A={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},D={display:"flex",gap:8,marginBottom:18},T={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},w={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},z={borderTop:"0.5px solid #eee",paddingTop:14},R={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},W={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},E={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},j={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},L={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},M={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},F={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},H={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"};function N(N){var _,P,O,G,q,J,K,Q,U,V,X,Y,Z,$,ee,ie,oe=N.onClose,ne=N.aiReason,te=N.onAccept,le=N.onReject,re=N.onIterate,de=N.initialTone,ae=N.onRegenerate,se=N.labels,ce=void 0===se?{}:se,pe=N.toneLevelsConfig,ve=void 0===pe?f:pe,ue=N.toneColorsConfig,ge=void 0===ue?h:ue,me=N.dialConfigs,ye=void 0===me?g:me,fe=N.actions,he=N.disableAllActions,xe=void 0!==he&&he,Se=N.customStyles,be=void 0===Se?{}:Se,Ce=N.severityChipStyles,Be=void 0===Ce?{}:Ce,Ie=N.customIcons,ke=void 0===Ie?{}:Ie,Ae=N.onOpenCognitive,De=N.showTone,Te=void 0===De||De,we=N.cognitiveSectionStyle,ze=void 0===we?{}:we,Re=N.cognitiveScoreBadgeStyle,We=void 0===Re?{}:Re,Ee=N.cognitiveScoreTextStyle,je=void 0===Ee?{}:Ee,Le=N.cognitiveStyles,Me=void 0===Le?{}:Le,Fe=N.cognitiveClassNames,He=void 0===Fe?{}:Fe,Ne=N.cognitiveTitle,_e=void 0===Ne?"Cognitive Integrity":Ne,Pe=N.cognitiveLeftIcon,Oe=N.showCognitiveRightArrow,Ge=void 0===Oe||Oe,qe=N.isStreaming,Je=ve.findIndex(function(e){return e===de});-1===Je&&(Je=1);var Ke=c(!0),Qe=Ke[0],Ue=Ke[1],Ve=c(!1),Xe=Ve[0],Ye=Ve[1],Ze=c(Je),$e=Ze[0],ei=Ze[1],ii=c(Je)[0],oi=ve[$e],ni=ge[oi]||"#BA7517",ti=$e!==ii,li=[{id:"iterate",icon:ke.iterateIcon||i(t,{size:16,color:"#64748B"}),label:ce.btnIterate||"Iterate",color:"#64748B",onClick:re},{id:"accept",icon:ke.acceptIcon||i(l,{size:16,color:"#10B981"}),label:ce.btnAccept||"Approve",color:"#10B981",onClick:te},{id:"reject",icon:ke.rejectIcon||i(r,{size:16,color:"#DC2626"}),label:ce.btnReject||"Reject",color:"#DC2626",onClick:le}],ri=fe||li;return o("div",e({onClick:function(e){return e.stopPropagation()},style:e(e({},x),null===(_=null==be?void 0:be.DeviationSummaryStyles)||void 0===_?void 0:_.root)},{children:[o("div",e({style:e(e({},S),null===(P=null==be?void 0:be.DeviationSummaryStyles)||void 0===P?void 0:P.header)},{children:[o("div",e({style:{display:"flex",alignItems:"center",gap:6}},{children:[i("span",{children:ke.summaryIcon||i(d,{size:16,color:"#E24B4A"})}),i("span",e({style:e(e({},b),null===(O=null==be?void 0:be.DeviationSummaryStyles)||void 0===O?void 0:O.title)},{children:ce.summaryHeader||"Summary"}))]})),i("button",e({onClick:oe,style:e(e({},w),null===(G=null==be?void 0:be.DeviationSummaryStyles)||void 0===G?void 0:G.closeBtn)},{children:"✕"}))]})),i("p",e({style:e(e({},C),null===(q=null==be?void 0:be.DeviationSummaryStyles)||void 0===q?void 0:q.bodyText)},{children:null===(J=null==ne?void 0:ne.deviation_details)||void 0===J?void 0:J.deviation_title})),i("p",e({style:e(e({},B),null===(K=null==be?void 0:be.DeviationSummaryStyles)||void 0===K?void 0:K.summary)},{children:null===(Q=null==ne?void 0:ne.deviation_details)||void 0===Q?void 0:Q.deviation_summary})),o("div",e({style:e(e({},I),null===(U=null==be?void 0:be.DeviationSummaryStyles)||void 0===U?void 0:U.impactContainer)},{children:[o("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[o("button",e({onClick:function(){return Ue(!Qe)},style:e(e({},k),null===(V=null==be?void 0:be.DeviationSummaryStyles)||void 0===V?void 0:V.impactToggle)},{children:[i("span",e({style:e(e({},A),null===(X=null==be?void 0:be.DeviationSummaryStyles)||void 0===X?void 0:X.impactToggleLabel)},{children:ce.impactHeader||"Impact"})),i("span",e({style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Qe?"rotate(180deg)":"rotate(0deg)"}},{children:i(a,{size:16,color:"#E24B4A"})}))]})),i(y,{type:(null==ne?void 0:ne.severity)||"Medium",customStyles:Be})]})),Qe&&i("p",e({style:{fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0"}},{children:null!==(Z=null===(Y=null==ne?void 0:ne.deviation_details)||void 0===Y?void 0:Y.deviation_impact)&&void 0!==Z?Z:ce.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."}))]})),i("div",e({style:e(e({},D),null===($=null==be?void 0:be.DeviationSummaryStyles)||void 0===$?void 0:$.actionContainer)},{children:ri.map(function(i){var n,t,l=xe||i.disabled,r=l?e(e({cursor:"not-allowed",opacity:.5},null===(n=null==be?void 0:be.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled),i.disabledStyle):{};return o("button",e({style:e(e(e(e(e({},T),null===(t=null==be?void 0:be.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtn),{color:i.color}),i.style),r),onClick:l?void 0:i.onClick,disabled:l},{children:[i.icon,i.label]}),i.id)})})),Te&&o("div",e({style:e(e({},z),null===(ee=null==be?void 0:be.DeviationSummaryStyles)||void 0===ee?void 0:ee.toneContainer)},{children:[o("button",e({onClick:function(){return Ye(!Xe)},style:e(e({},R),null===(ie=null==be?void 0:be.DeviationSummaryStyles)||void 0===ie?void 0:ie.toneToggleBtn)},{children:[o("div",e({style:{display:"flex",alignItems:"center",gap:8}},{children:[i(m,{toneIndex:$e,configs:ye}),i("span",e({style:{fontSize:13,fontWeight:500,color:"#111"}},{children:ce.toneHeader||"Redline Tone"}))]})),i("span",e({style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Xe?"rotate(180deg)":"rotate(0deg)"}},{children:i(a,{size:16,color:"#111"})}))]})),Xe&&o(n,{children:[i("p",e({style:{fontSize:12,color:"#888",margin:"0 0 12px"}},{children:ce.toneDescription||"Controls how assertively AI is redlining"})),i(p,{isDirty:ti,onToneChange:function(e){ei(e)},toneColor:ni,toneIndex:$e,onClickRegenerate:function(){return null==ae?void 0:ae(oi)},toneLabels:ve,isStreaming:qe,aiReason:ne})]})]})),Ae&&o("div",e({className:null==He?void 0:He.section,onClick:function(e){e.stopPropagation(),Ae&&Ae(e)},style:e(e(e({},W),null==Me?void 0:Me.section),ze)},{children:[o("div",e({className:null==He?void 0:He.headerLeft,style:e(e({},E),null==Me?void 0:Me.headerLeft)},{children:[i("span",e({className:null==He?void 0:He.titleIcon,style:e(e({},j),null==Me?void 0:Me.titleIcon)},{children:null!=Pe?Pe:i(v,{})})),i("div",e({className:null==He?void 0:He.cognitiveTitle,style:e(e({},L),null==Me?void 0:Me.cognitiveTitle)},{children:_e}))]})),o("div",e({className:null==He?void 0:He.headerRight,style:e(e({},M),null==Me?void 0:Me.headerRight)},{children:[void 0!==(null==ne?void 0:ne.relevance_score)&&null!==(null==ne?void 0:ne.relevance_score)?o("span",e({className:null==He?void 0:He.scoreBadge,style:e(e(e({},F),null==Me?void 0:Me.scoreBadge),We)},{children:[i(u,{}),o("span",e({className:null==He?void 0:He.scoreText,style:e(e(e({},H),null==Me?void 0:Me.scoreText),je)},{children:[Math.round(Number(ne.relevance_score)),"%"]}))]})):null,Ge&&i("span",e({style:{display:"flex",alignItems:"center"}},{children:i(s,{size:16,color:"#64748B"})}))]}))]}))]}))}export{N as default};
2
2
  //# sourceMappingURL=DeviationSummary.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import{useState as o}from"react";import i from"./PopupDefaults.js";import{ReactComponent as r}from"../icons/History.svg.js";import{ReactComponent as a}from"../icons/message-chat-square.svg.js";import{ToneToggle as l}from"./ToneToggle.js";var d=[{id:"chat",icon:n(a,{}),label:"Chat",description:"Type on what basis you want to iterate"},{id:"risk",icon:n(a,{}),label:"Shift the risk",description:"Adjust how aggressive or lenient the language is"},{id:"history",icon:n(r,{}),label:"Historical Recommendations",description:"Pull from past recommended clauses"}],s=[{id:"1",filename:"Mutual_DA2.pdf",excerpt:'"...shall protect Confidential Information using at least the same degree of care as it uses to protect its own confidential information, but no less than reasonable c..."',tab:"Balanced"},{id:"2",filename:"Tech NDA.pdf",excerpt:'"...protect confidential information using reasonable care and appropriate safeguards..."',tab:"Balanced"},{id:"3",filename:"Corp NDA.pdf",excerpt:'"...shall use best efforts to protect any disclosed confidential materials from unauthorised access or disclosure..."',tab:"Aggressive"},{id:"4",filename:"Vendor Agreement.pdf",excerpt:'"...may use disclosed information solely for the stated purpose with no special handling required..."',tab:"Lenient"}],c=["Lenient","Balanced","Aggressive"],f={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},p=["Grounded","Innovative"];function g(o){var i=o.chatTitle,r=o.chatBody,a=o.mergedStyles,l=void 0===a?b:a;return n("div",e({style:l.body},{children:t("div",e({style:l.chatBanner},{children:[n("p",e({style:l.chatBannerTitle},{children:i})),n("p",e({style:l.chatBannerBody},{children:r}))]}))}))}function u(i){var r=i.initialTone,a=i.onRiskRegenerate,d=i.riskMode,s=i.toneLevelsConfig,g=void 0===s?c:s,u=i.toneColorsConfig,h=void 0===u?f:u,m=i.riskModesConfig,y=void 0===m?p:m,x=i.mergedStyles,v=void 0===x?b:x,C=g.findIndex(function(e){return e===r});-1===C&&(C=1);var k=o(d||y[0]||"Grounded"),B=k[0],S=k[1],T=o(C),A=T[0],R=T[1],w=o(C)[0],z=g[A],L=h[z]||"#BA7517",D=A!==w||d!==B;return t("div",e({style:v.body},{children:[n("div",e({style:{display:"flex",gap:8,marginBottom:16}},{children:y.map(function(o){return t("button",e({onClick:function(){return S(o)},style:{flex:1,display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid ".concat(B===o?"#7c5cbf":"#e0ddd8"),background:"#fff",cursor:"pointer",fontSize:13,fontWeight:500,color:"#1a1a1a"}},{children:[n("span",e({style:{width:16,height:16,borderRadius:"50%",border:"2px solid ".concat(B===o?"#7c5cbf":"#ccc"),display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:B===o&&n("span",{style:{width:8,height:8,borderRadius:"50%",background:"#7c5cbf"}})})),o.charAt(0).toUpperCase()+o.slice(1)]}),o)})})),n(l,{onToneChange:function(e){return R(e)},toneColor:L,isDirty:D,toneIndex:A,onClickRegenerate:function(){return null==a?void 0:a({tone:z,mode:B})}})]}))}function h(i){var r=i.onApply,a=i.historicalClausesData,l=void 0===a?s:a,d=i.toneLevelsConfig,f=void 0===d?c:d,p=i.mergedStyles,g=void 0===p?b:p,u=f.length>1?f[1]:f[0]||"Balanced",h=o(u),m=h[0],y=h[1],x=l.filter(function(e){return e.tab===m});return t("div",e({style:g.body},{children:[n("div",e({style:g.segmentedControl},{children:f.map(function(t){return n("button",e({onClick:function(){return y(t)},style:e(e({},g.segmentedBtn),m===t?g.segmentedBtnActive:{})},{children:t.charAt(0).toUpperCase()+t.slice(1)}),t)})})),t("div",e({style:{display:"flex",flexDirection:"column",gap:10,marginTop:12}},{children:[x.map(function(o){return t("button",e({onClick:function(){return null==r?void 0:r({type:"history",value:o.excerpt})},style:g.clauseCard},{children:[n("p",e({style:g.clauseFilename},{children:o.filename})),n("p",e({style:g.clauseExcerpt},{children:o.excerpt}))]}),o.id)}),0===x.length&&n("p",e({style:{fontSize:12,color:"#aaa",textAlign:"center",padding:"12px 0"}},{children:"No clauses for this tone"}))]}))]}))}function m(e){var t=e.type,o=e.onRiskRegenerate,i=e.initialTone,r=e.riskMode,a=e.onApply,l=e.chatTitle,d=e.chatBody,s=e.historicalClausesData,c=e.toneLevelsConfig,f=e.toneColorsConfig,p=e.riskModesConfig,m=e.mergedStyles,y=void 0===m?b:m;return"chat"===t?n(g,{chatTitle:l,chatBody:d,mergedStyles:y}):"risk"===t?n(u,{onRiskRegenerate:o,initialTone:i,riskMode:r,toneLevelsConfig:c,toneColorsConfig:f,riskModesConfig:p,mergedStyles:y}):"history"===t?n(h,{onApply:a,historicalClausesData:s,toneLevelsConfig:c,mergedStyles:y}):null}function y(r){var a=r.onBack,l=r.onChatClick,g=r.onRiskRegenerate,u=r.initialTone,h=r.riskMode,y=r.onApply,x=r.onTabToggle,v=r.menuItemsConfig,C=void 0===v?d:v,k=r.historicalClausesConfig,B=void 0===k?s:k,S=r.chatTitle,T=void 0===S?"Chat mode active":S,A=r.chatBody,R=void 0===A?"You are now chatting about this redline, continue the conversation in the left panel to refine or update it":A,w=r.headerTitle,z=void 0===w?"How would you like to iterate?":w,L=r.customStyles,D=void 0===L?{}:L,I=r.toneLevelsConfig,M=void 0===I?c:I,j=r.toneColorsConfig,F=void 0===j?f:j,H=r.riskModesConfig,W=void 0===H?p:H,E=o(null),G=E[0],N=E[1],q=e(e(e({},i.IterateMenuDefaults.styles),b),D);return t("div",e({style:q.card},{children:[t("div",e({style:q.header},{children:[n("button",e({onClick:a,style:q.backBtn,"aria-label":"Go back"},{children:"‹"})),n("span",e({style:q.headerTitle},{children:z}))]})),C.map(function(o,i){var r=G===o.id;return t("div",e({style:{borderBottom:i<C.length-1?"0.5px solid #e8e7e3":"none"}},{children:[t("button",e({onClick:function(){return e=o.id,N(function(n){return n===e?null:("chat"===e&&(null==l||l()),x&&x(e),e)});var e},style:q.row},{children:[n("div",e({style:q.rowLeft},{children:t("div",{children:[n("p",e({style:q.label},{children:o.label})),n("p",e({style:q.desc},{children:o.description}))]})})),n("span",e({style:e(e({},q.chevron),{transform:r?"rotate(90deg)":"rotate(0deg)"})},{children:"›"}))]})),n("div",e({style:{maxHeight:r?400:0,overflow:"hidden",transition:"max-height 0.25s ease"}},{children:n(m,{type:o.id,onRiskRegenerate:g,initialTone:u,riskMode:h,onApply:y,chatTitle:T,chatBody:R,historicalClausesData:B,toneLevelsConfig:M,toneColorsConfig:F,riskModesConfig:W,mergedStyles:q})}))]}),o.id)})]}))}var b={card:{background:"#fff",border:"0.5px solid #e8e7e3",borderRadius:14,width:300,maxHeight:"350px",overflow:"auto",fontFamily:"system-ui, sans-serif"},header:{display:"flex",alignItems:"center",gap:8,padding:"14px 16px",borderBottom:"0.5px solid #e8e7e3"},backBtn:{background:"none",border:"none",cursor:"pointer",fontSize:20,color:"#888",padding:0,lineHeight:1},headerTitle:{fontSize:14,fontWeight:500,color:"#1a1a1a"},row:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",cursor:"pointer",border:"none",textAlign:"left",gap:10,boxSizing:"border-box",backgroundColor:"transparent"},rowLeft:{display:"flex",alignItems:"flex-start",gap:10,flex:1},icon:{fontSize:16,color:"#666",marginTop:1,flexShrink:0},label:{margin:0,fontSize:14,fontWeight:500,color:"#1a1a1a"},desc:{margin:"2px 0 0",fontSize:12,color:"#888",lineHeight:1.4},chevron:{fontSize:18,color:"#aaa",flexShrink:0,display:"inline-block",transition:"transform 0.2s"},body:{padding:"0 16px 14px 16px"},chatBanner:{background:"#eef4fd",border:"1px solid #c5d8f7",borderRadius:10,padding:"12px 14px",marginBottom:10},chatBannerTitle:{margin:"0 0 6px",fontSize:14,fontWeight:600,color:"#3a5a8a"},chatBannerBody:{margin:0,fontSize:13,color:"#4a6080",lineHeight:1.5},applyBtn:{display:"flex",padding:"7px 10.5px",justifyContent:"center",alignItems:"center",gap:"7px",marginTop:8,fontSize:13,borderRadius:6,border:"1px solid #2563EB",background:"#2563EB",color:"#fff"},rangeLabel:{fontSize:12,color:"#888"},segmentedControl:{border:"1px solid #F2F4F7",display:"flex",background:"#F9FAFB",borderRadius:4,padding:6,gap:8},segmentedBtn:{flex:1,padding:"7px 0",fontSize:13,fontWeight:500,color:"#888",background:"transparent",border:"none",borderRadius:8,cursor:"pointer",transition:"background 0.15s, color 0.15s"},segmentedBtnActive:{background:"#dce8fa",color:"#2a4a7a",fontWeight:700},clauseCard:{background:"#fff",border:"1px solid #dde5f0",borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",width:"100%"},clauseFilename:{margin:"0 0 6px",fontSize:13,fontWeight:600,color:"#2a4a7a"},clauseExcerpt:{margin:0,fontSize:13,color:"#4a5a70",fontStyle:"italic",lineHeight:1.5}};export{y as default};
1
+ import{__assign as e}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import{useState as i}from"react";import o from"./PopupDefaults.js";import{ReactComponent as r}from"../icons/History.svg.js";import{ReactComponent as a}from"../icons/message-chat-square.svg.js";import{ToneToggle as l}from"./ToneToggle.js";var s=[{id:"chat",icon:n(a,{}),label:"Chat",description:"Type on what basis you want to iterate"},{id:"risk",icon:n(a,{}),label:"Shift the risk",description:"Adjust how aggressive or lenient the language is"},{id:"history",icon:n(r,{}),label:"Historical Recommendations",description:"Pull from past recommended clauses"}],d=[{id:"1",filename:"Mutual_DA2.pdf",excerpt:'"...shall protect Confidential Information using at least the same degree of care as it uses to protect its own confidential information, but no less than reasonable c..."',tab:"Balanced"},{id:"2",filename:"Tech NDA.pdf",excerpt:'"...protect confidential information using reasonable care and appropriate safeguards..."',tab:"Balanced"},{id:"3",filename:"Corp NDA.pdf",excerpt:'"...shall use best efforts to protect any disclosed confidential materials from unauthorised access or disclosure..."',tab:"Aggressive"},{id:"4",filename:"Vendor Agreement.pdf",excerpt:'"...may use disclosed information solely for the stated purpose with no special handling required..."',tab:"Lenient"}],c=["Lenient","Balanced","Aggressive"],f={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},p=["Grounded","Innovative"];function g(i){var o=i.chatTitle,r=i.chatBody,a=i.mergedStyles,l=void 0===a?b:a;return n("div",e({style:l.body},{children:t("div",e({style:l.chatBanner},{children:[n("p",e({style:l.chatBannerTitle},{children:o})),n("p",e({style:l.chatBannerBody},{children:r}))]}))}))}function u(o){var r=o.initialTone,a=o.onRiskRegenerate,s=o.riskMode,d=o.toneLevelsConfig,g=void 0===d?c:d,u=o.toneColorsConfig,h=void 0===u?f:u,m=o.riskModesConfig,y=void 0===m?p:m,x=o.mergedStyles,v=void 0===x?b:x,C=o.isStreaming,k=o.aiReason,B=g.findIndex(function(e){return e===r});-1===B&&(B=1);var S=i(s||y[0]||"Grounded"),R=S[0],T=S[1],A=i(B),w=A[0],z=A[1],L=i(B)[0],D=g[w],I=h[D]||"#BA7517",M=w!==L||s!==R;return t("div",e({style:v.body},{children:[n("div",e({style:{display:"flex",gap:8,marginBottom:16}},{children:y.map(function(i){return t("button",e({onClick:function(){return T(i)},style:{flex:1,display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid ".concat(R===i?"#7c5cbf":"#e0ddd8"),background:"#fff",cursor:"pointer",fontSize:13,fontWeight:500,color:"#1a1a1a"}},{children:[n("span",e({style:{width:16,height:16,borderRadius:"50%",border:"2px solid ".concat(R===i?"#7c5cbf":"#ccc"),display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:R===i&&n("span",{style:{width:8,height:8,borderRadius:"50%",background:"#7c5cbf"}})})),i.charAt(0).toUpperCase()+i.slice(1)]}),i)})})),n(l,{onToneChange:function(e){return z(e)},toneColor:I,isDirty:M,toneIndex:w,onClickRegenerate:function(){return null==a?void 0:a({tone:D,mode:R})},isStreaming:C,aiReason:k})]}))}function h(o){var r=o.onApply,a=o.historicalClausesData,l=void 0===a?d:a,s=o.toneLevelsConfig,f=void 0===s?c:s,p=o.mergedStyles,g=void 0===p?b:p,u=f.length>1?f[1]:f[0]||"Balanced",h=i(u),m=h[0],y=h[1],x=l.filter(function(e){return e.tab===m});return t("div",e({style:g.body},{children:[n("div",e({style:g.segmentedControl},{children:f.map(function(t){return n("button",e({onClick:function(){return y(t)},style:e(e({},g.segmentedBtn),m===t?g.segmentedBtnActive:{})},{children:t.charAt(0).toUpperCase()+t.slice(1)}),t)})})),t("div",e({style:{display:"flex",flexDirection:"column",gap:10,marginTop:12}},{children:[x.map(function(i){return t("button",e({onClick:function(){return null==r?void 0:r({type:"history",value:i.excerpt})},style:g.clauseCard},{children:[n("p",e({style:g.clauseFilename},{children:i.filename})),n("p",e({style:g.clauseExcerpt},{children:i.excerpt}))]}),i.id)}),0===x.length&&n("p",e({style:{fontSize:12,color:"#aaa",textAlign:"center",padding:"12px 0"}},{children:"No clauses for this tone"}))]}))]}))}function m(e){var t=e.type,i=e.onRiskRegenerate,o=e.initialTone,r=e.riskMode,a=e.onApply,l=e.chatTitle,s=e.chatBody,d=e.historicalClausesData,c=e.toneLevelsConfig,f=e.toneColorsConfig,p=e.riskModesConfig,m=e.mergedStyles,y=void 0===m?b:m,x=e.isStreaming,v=e.aiReason;return"chat"===t?n(g,{chatTitle:l,chatBody:s,mergedStyles:y}):"risk"===t?n(u,{onRiskRegenerate:i,initialTone:o,riskMode:r,toneLevelsConfig:c,toneColorsConfig:f,riskModesConfig:p,mergedStyles:y,isStreaming:x,aiReason:v}):"history"===t?n(h,{onApply:a,historicalClausesData:d,toneLevelsConfig:c,mergedStyles:y}):null}function y(r){var a=r.onBack,l=r.onChatClick,g=r.onRiskRegenerate,u=r.initialTone,h=r.riskMode,y=r.onApply,x=r.onTabToggle,v=r.menuItemsConfig,C=void 0===v?s:v,k=r.historicalClausesConfig,B=void 0===k?d:k,S=r.chatTitle,R=void 0===S?"Chat mode active":S,T=r.chatBody,A=void 0===T?"You are now chatting about this redline, continue the conversation in the left panel to refine or update it":T,w=r.headerTitle,z=void 0===w?"How would you like to iterate?":w,L=r.customStyles,D=void 0===L?{}:L,I=r.toneLevelsConfig,M=void 0===I?c:I,j=r.toneColorsConfig,F=void 0===j?f:j,H=r.riskModesConfig,W=void 0===H?p:H,E=r.isStreaming,G=r.aiReason,N=i(null),q=N[0],P=N[1],U=e(e(e({},o.IterateMenuDefaults.styles),b),D);return t("div",e({style:U.card},{children:[t("div",e({style:U.header},{children:[n("button",e({onClick:a,style:U.backBtn,"aria-label":"Go back"},{children:"‹"})),n("span",e({style:U.headerTitle},{children:z}))]})),C.map(function(i,o){var r=q===i.id;return t("div",e({style:{borderBottom:o<C.length-1?"0.5px solid #e8e7e3":"none"}},{children:[t("button",e({onClick:function(){return e=i.id,P(function(n){return n===e?null:("chat"===e&&(null==l||l()),x&&x(e),e)});var e},style:U.row},{children:[n("div",e({style:U.rowLeft},{children:t("div",{children:[n("p",e({style:U.label},{children:i.label})),n("p",e({style:U.desc},{children:i.description}))]})})),n("span",e({style:e(e({},U.chevron),{transform:r?"rotate(90deg)":"rotate(0deg)"})},{children:"›"}))]})),n("div",e({style:{maxHeight:r?400:0,overflow:"hidden",transition:"max-height 0.25s ease"}},{children:n(m,{type:i.id,onRiskRegenerate:g,initialTone:u,riskMode:h,onApply:y,chatTitle:R,chatBody:A,historicalClausesData:B,toneLevelsConfig:M,toneColorsConfig:F,riskModesConfig:W,mergedStyles:U,aiReason:G,isStreaming:E})}))]}),i.id)})]}))}var b={card:{background:"#fff",border:"0.5px solid #e8e7e3",borderRadius:14,width:300,maxHeight:"350px",overflow:"auto",fontFamily:"system-ui, sans-serif"},header:{display:"flex",alignItems:"center",gap:8,padding:"14px 16px",borderBottom:"0.5px solid #e8e7e3"},backBtn:{background:"none",border:"none",cursor:"pointer",fontSize:20,color:"#888",padding:0,lineHeight:1},headerTitle:{fontSize:14,fontWeight:500,color:"#1a1a1a"},row:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",cursor:"pointer",border:"none",textAlign:"left",gap:10,boxSizing:"border-box",backgroundColor:"transparent"},rowLeft:{display:"flex",alignItems:"flex-start",gap:10,flex:1},icon:{fontSize:16,color:"#666",marginTop:1,flexShrink:0},label:{margin:0,fontSize:14,fontWeight:500,color:"#1a1a1a"},desc:{margin:"2px 0 0",fontSize:12,color:"#888",lineHeight:1.4},chevron:{fontSize:18,color:"#aaa",flexShrink:0,display:"inline-block",transition:"transform 0.2s"},body:{padding:"0 16px 14px 16px"},chatBanner:{background:"#eef4fd",border:"1px solid #c5d8f7",borderRadius:10,padding:"12px 14px",marginBottom:10},chatBannerTitle:{margin:"0 0 6px",fontSize:14,fontWeight:600,color:"#3a5a8a"},chatBannerBody:{margin:0,fontSize:13,color:"#4a6080",lineHeight:1.5},applyBtn:{display:"flex",padding:"7px 10.5px",justifyContent:"center",alignItems:"center",gap:"7px",marginTop:8,fontSize:13,borderRadius:6,border:"1px solid #2563EB",background:"#2563EB",color:"#fff"},rangeLabel:{fontSize:12,color:"#888"},segmentedControl:{border:"1px solid #F2F4F7",display:"flex",background:"#F9FAFB",borderRadius:4,padding:6,gap:8},segmentedBtn:{flex:1,padding:"7px 0",fontSize:13,fontWeight:500,color:"#888",background:"transparent",border:"none",borderRadius:8,cursor:"pointer",transition:"background 0.15s, color 0.15s"},segmentedBtnActive:{background:"#dce8fa",color:"#2a4a7a",fontWeight:700},clauseCard:{background:"#fff",border:"1px solid #dde5f0",borderRadius:12,padding:"12px 14px",textAlign:"left",cursor:"pointer",width:"100%"},clauseFilename:{margin:"0 0 6px",fontSize:13,fontWeight:600,color:"#2a4a7a"},clauseExcerpt:{margin:0,fontSize:13,color:"#4a5a70",fontStyle:"italic",lineHeight:1.5}};export{y as default};
2
2
  //# sourceMappingURL=IterateComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Undo2 as n}from"lucide-react";import{useState as r}from"react";import i from"./PopupDefaults.js";function d(e){var t=new Date(e);return isNaN(t.getTime())?e:new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}var l=function(){return o("svg",e({width:"22",height:"22",viewBox:"0 0 22 22",fill:"none"},{children:[t("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),t("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},c=function(){return o("svg",e({width:"22",height:"22",viewBox:"0 0 22 22",fill:"none"},{children:[t("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),t("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}))},a=function(){return t("svg",e({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},{children:t("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}))},s=function(){return o("svg",e({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:[t("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),t("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),t("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}))},h=function(){return o("svg",e({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:[t("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),t("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),t("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}))},u=function(o){var n=o.open;return t("svg",e({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:n?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"}},{children:t("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))},f=function(n){var r=n.color,i=void 0===r?"#3b82f6":r;return o("svg",e({width:"15",height:"15",viewBox:"0 0 16 16",fill:"none"},{children:[t("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:i,strokeWidth:"1.5",strokeLinecap:"round"}),t("path",{d:"M1.5 3.5v4h4",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M8 5v3.5l2 1.5",stroke:i,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}))},p=function(){return o("svg",e({width:"15",height:"15",viewBox:"0 0 16 16",fill:"none"},{children:[t("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),t("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}))},k=function(){return o("svg",e({width:"15",height:"15",viewBox:"0 0 16 16",fill:"none"},{children:[t("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}))};function g(n){var r=n.title,i=n.open,d=n.onToggle,l=n.children;return o("div",e({style:{maxHeight:"170px",overflow:"auto"}},{children:[o("div",e({onClick:d,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"}},{children:[t("span",e({style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"}},{children:r})),t(u,{open:i})]})),t("div",e({style:{maxHeight:i?300:0,opacity:i?1:0,overflow:"hidden",transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"}},{children:l}))]}))}function b(t){var n=t.icon,r=t.label,i=t.onClick,d=t.customStyle,l=e({display:"flex",alignItems:"center",gap:7,padding:"8px 16px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap"},void 0===d?{}:d);return o("button",e({onClick:i,style:l,onMouseEnter:function(e){e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)"},onMouseLeave:function(e){e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow=""}},{children:[n,r]}))}function v(u){var v=u.status,m=u.onClose,y=u.impactText,x=u.secondText,B=u.actionTakenByName,C=u.actionTakenAtTime,L=void 0===C?"NA":C,w=u.onHistory,R=u.onIterate,M=u.onReinstate,W=u.onRevert,S=u.impactTitle,T=void 0===S?"Impact":S,I=u.customConfigs,D=void 0===I?{}:I,j=u.customStyles,z=void 0===j?{}:j,A=r(!0),H=A[0],F=A[1],U=r(!0),E=U[0],N=U[1],P=r(!1),O=P[0],Y=P[1],q={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:t(s,{}),StatusIcon:t(l,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:t(f,{}),label:"History",onClick:w},{icon:t(n,{size:17}),label:"Revert",onClick:W},{icon:t(k,{}),label:"Iterate",onClick:R}]},G={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:t(h,{}),StatusIcon:t(c,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:t(f,{color:"#3b82f6"}),label:"History",onClick:w},{icon:t(p,{}),label:"Reinstate",onClick:M},{icon:t(k,{}),label:"Iterate",onClick:R}]},J={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:t(s,{}),StatusIcon:t(n,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:t(f,{}),label:"History",onClick:w},{icon:t(k,{}),label:"Iterate",onClick:R}]},K=e(e({},"accepted"===v?q:"rejected"===v?G:J),D[v]||{});return o("div",e({style:e(e(e({},i.RedlineCardDefaults.root),{animation:O?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":i.RedlineCardDefaults.root.animation||"slideIn 0.32s cubic-bezier(0.22,1,0.36,1) both"}),z.root)},{children:[o("div",e({style:e(e(e({},i.RedlineCardDefaults.header),{background:K.headerBg,borderBottom:"1.5px solid ".concat(K.headerBorder)}),z.header)},{children:[o("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[K.StatusIcon,t("span",e({style:{fontSize:15,fontWeight:700,color:K.titleColor,letterSpacing:"-0.01em"}},{children:K.label}))]})),t("button",e({onClick:function(){Y(!0),m()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"}},{children:t(a,{})}))]})),o("div",e({style:e(e({},i.RedlineCardDefaults.body),z.body)},{children:[o("div",e({style:e(e({},i.RedlineCardDefaults.meta),z.meta)},{children:[o("div",e({style:{display:"flex",alignItems:"center",gap:6,marginBottom:5}},{children:[K.UserIcon,t("span",e({style:{fontSize:12.5,color:"#94a3b8",fontWeight:500}},{children:K.metaLabel}))]})),o("div",e({style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"}},{children:[B,", ",d(L)]}))]})),t("div",{style:e(e({},i.RedlineCardDefaults.divider),z.divider)}),t(g,e({title:T,open:H,onToggle:function(){return F(function(e){return!e})}},{children:t("p",e({style:e(e({},i.RedlineCardDefaults.impactText),z.impactText)},{children:y||""}))})),t("div",{style:e(e({},i.RedlineCardDefaults.divider),z.divider)}),t(g,e({title:K.secondTitle,open:E,onToggle:function(){return N(function(e){return!e})}},{children:t("div",e({style:e(e(e({},i.RedlineCardDefaults.secondSection),{background:K.secondBg,border:"1.5px solid ".concat(K.secondBorder)}),z.secondSection)},{children:x||""}))})),t("div",e({style:e(e({},i.RedlineCardDefaults.actionsContainer),z.actionsContainer)},{children:K.actions.map(function(e){return t(b,{icon:e.icon,label:e.label,onClick:e.onClick,customStyle:e.style},e.label)})}))]}))]}))}export{l as ApprovedIcon,u as ChevronIcon,a as CloseIcon,f as HistoryIcon,k as IterateIcon,v as RedlineCard,p as ReinstateIcon,c as RejectedIcon,s as UserApprovedIcon,h as UserRejectedIcon,d as formatDate};
1
+ import{__assign as e}from"tslib";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Undo2 as n}from"lucide-react";import{useState as i}from"react";import r from"./PopupDefaults.js";function d(e){var t=new Date(e);return isNaN(t.getTime())?e:new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}var l=function(){return o("svg",e({width:"22",height:"22",viewBox:"0 0 22 22",fill:"none"},{children:[t("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),t("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},a=function(){return o("svg",e({width:"22",height:"22",viewBox:"0 0 22 22",fill:"none"},{children:[t("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),t("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}))},c=function(){return t("svg",e({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},{children:t("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}))},s=function(){return o("svg",e({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:[t("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),t("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),t("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}))},h=function(){return o("svg",e({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:[t("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),t("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),t("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}))},u=function(o){var n=o.open;return t("svg",e({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:n?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"}},{children:t("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))},f=function(n){var i=n.color,r=void 0===i?"#3b82f6":i;return o("svg",e({width:"15",height:"15",viewBox:"0 0 16 16",fill:"none"},{children:[t("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:r,strokeWidth:"1.5",strokeLinecap:"round"}),t("path",{d:"M1.5 3.5v4h4",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M8 5v3.5l2 1.5",stroke:r,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}))},p=function(){return o("svg",e({width:"15",height:"15",viewBox:"0 0 16 16",fill:"none"},{children:[t("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),t("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}))},k=function(){return o("svg",e({width:"15",height:"15",viewBox:"0 0 16 16",fill:"none"},{children:[t("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}))};function g(n){var i=n.title,r=n.open,d=n.onToggle,l=n.children;return o("div",e({style:{maxHeight:"170px",overflow:"auto"}},{children:[o("div",e({onClick:d,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"}},{children:[t("span",e({style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"}},{children:i})),t(u,{open:r})]})),t("div",e({style:{maxHeight:r?300:0,opacity:r?1:0,overflow:"hidden",transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"}},{children:l}))]}))}function b(t){var n=t.icon,i=t.label,r=t.onClick,d=t.customStyle,l=void 0===d?{}:d,a=t.disabled,c=void 0!==a&&a,s=t.disabledStyle,h=void 0===s?{}:s,u=e(e({display:"flex",alignItems:"center",gap:7,padding:"8px 16px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:c?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:c?.5:1},l),c?h:{});return o("button",e({onClick:c?void 0:r,disabled:c,style:u,onMouseEnter:function(e){c||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:function(e){c||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")}},{children:[n,i]}))}function v(u){var v=u.status,m=u.onClose,y=u.impactText,x=u.secondText,B=u.actionTakenByName,C=u.actionTakenAtTime,L=void 0===C?"NA":C,w=u.onHistory,R=u.onIterate,S=u.onReinstate,M=u.onRevert,W=u.disableAllActions,T=void 0!==W&&W,I=u.impactTitle,D=void 0===I?"Impact":I,j=u.customConfigs,z=void 0===j?{}:j,A=u.customStyles,H=void 0===A?{}:A,F=i(!0),U=F[0],E=F[1],N=i(!0),P=N[0],O=N[1],Y=i(!1),q=Y[0],G=Y[1],J={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:t(s,{}),StatusIcon:t(l,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:t(f,{}),label:"History",onClick:w},{icon:t(n,{size:17}),label:"Revert",onClick:M},{icon:t(k,{}),label:"Iterate",onClick:R}]},K={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:t(h,{}),StatusIcon:t(a,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:t(f,{color:"#3b82f6"}),label:"History",onClick:w},{icon:t(p,{}),label:"Reinstate",onClick:S},{icon:t(k,{}),label:"Iterate",onClick:R}]},Q={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:t(s,{}),StatusIcon:t(n,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:t(f,{}),label:"History",onClick:w},{icon:t(k,{}),label:"Iterate",onClick:R}]},V=e(e({},"accepted"===v?J:"rejected"===v?K:Q),z[v]||{});return o("div",e({style:e(e(e({},r.RedlineCardDefaults.root),{animation:q?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":r.RedlineCardDefaults.root.animation||"slideIn 0.32s cubic-bezier(0.22,1,0.36,1) both"}),H.root)},{children:[o("div",e({style:e(e(e({},r.RedlineCardDefaults.header),{background:V.headerBg,borderBottom:"1.5px solid ".concat(V.headerBorder)}),H.header)},{children:[o("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[V.StatusIcon,t("span",e({style:{fontSize:15,fontWeight:700,color:V.titleColor,letterSpacing:"-0.01em"}},{children:V.label}))]})),t("button",e({onClick:function(){G(!0),m()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"}},{children:t(c,{})}))]})),o("div",e({style:e(e({},r.RedlineCardDefaults.body),H.body)},{children:[o("div",e({style:e(e({},r.RedlineCardDefaults.meta),H.meta)},{children:[o("div",e({style:{display:"flex",alignItems:"center",gap:6,marginBottom:5}},{children:[V.UserIcon,t("span",e({style:{fontSize:12.5,color:"#94a3b8",fontWeight:500}},{children:V.metaLabel}))]})),o("div",e({style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"}},{children:[B,", ",d(L)]}))]})),t("div",{style:e(e({},r.RedlineCardDefaults.divider),H.divider)}),t(g,e({title:D,open:U,onToggle:function(){return E(function(e){return!e})}},{children:t("p",e({style:e(e({},r.RedlineCardDefaults.impactText),H.impactText)},{children:y||""}))})),t("div",{style:e(e({},r.RedlineCardDefaults.divider),H.divider)}),t(g,e({title:V.secondTitle,open:P,onToggle:function(){return O(function(e){return!e})}},{children:t("div",e({style:e(e(e({},r.RedlineCardDefaults.secondSection),{background:V.secondBg,border:"1.5px solid ".concat(V.secondBorder)}),H.secondSection)},{children:x||""}))})),t("div",e({style:e(e({},r.RedlineCardDefaults.actionsContainer),H.actionsContainer)},{children:V.actions.map(function(o){return t(b,{icon:o.icon,label:o.label,onClick:o.onClick,customStyle:e(e({},o.style),H.actionBtn),disabled:T||o.disabled,disabledStyle:H.actionBtnDisabled},o.label)})}))]}))]}))}export{l as ApprovedIcon,u as ChevronIcon,c as CloseIcon,f as HistoryIcon,k as IterateIcon,v as RedlineCard,p as ReinstateIcon,a as RejectedIcon,s as UserApprovedIcon,h as UserRejectedIcon,d as formatDate};
2
2
  //# sourceMappingURL=RedlineStatusCard.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as t}from"tslib";import{jsxs as e,Fragment as o,jsx as n}from"react/jsx-runtime";import{RefreshCw as i}from"lucide-react";function r(r){var a=r.toneColor,l=r.toneIndex,s=r.isDirty,d=r.onToneChange,c=r.onClickRegenerate,g=r.toneLabels,u=void 0===g?["Lenient","Balanced","Aggressive"]:g,f=r.gradientColors,p=void 0===f?["#1D9E75","#BA7517","#E24B4A"]:f,h=r.buttonText,m=void 0===h?"Regenerate":h,b=r.customStyles,y=void 0===b?{}:b,v="linear-gradient(to right, ".concat(p.join(", "),")"),x=Math.max(u.length-1,1),C=l/x*100;return e(o,{children:[n("div",t({style:t({width:"100%",height:8,borderRadius:"999px",background:v,marginBottom:8,position:"relative"},y.track)},{children:n("div",{style:t({position:"absolute",top:"50%",transform:"translate(-50%, -50%)",left:"".concat(C,"%"),width:12,height:12,borderRadius:"50%",background:a,border:"2px solid #fff",boxShadow:"0 0 0 1.5px "+a,transition:"left 0.2s, background 0.2s"},y.thumb)})})),n("input",{type:"range",min:0,max:x,step:1,value:l,onChange:function(t){return d(Number(t.target.value))},style:{width:"100%",cursor:"pointer",marginBottom:4,accentColor:a,opacity:0,marginTop:-20,display:"block",position:"relative",zIndex:1}}),n("div",t({style:t({display:"flex",justifyContent:"space-between",marginBottom:10,marginTop:-4},y.labelsContainer)},{children:u.map(function(e){return n("span",t({style:{fontSize:11,color:"#aaa"}},{children:e}),e)})})),n("div",t({style:t({maxHeight:s?60:0,overflow:"hidden",transition:"max-height 0.25s ease"},y.buttonContainer)},{children:e("button",t({style:t({display:"flex",float:"right",alignItems:"center",justifyContent:"center",gap:6,fontSize:13,fontWeight:500,padding:9,borderRadius:8,border:"none",background:"#2563EB",color:"#fff",cursor:"pointer"},y.button),onClick:c},{children:[n(i,{size:16,color:"#fff"}),m]}))}))]})}export{r as ToneToggle};
1
+ import{__assign as t}from"tslib";import{jsxs as e,Fragment as o,jsx as n}from"react/jsx-runtime";import{RefreshCw as i}from"lucide-react";function r(r){var a=r.toneColor,l=r.toneIndex,s=r.isDirty,d=r.onToneChange,c=r.onClickRegenerate,g=r.toneLabels,u=void 0===g?["Lenient","Balanced","Aggressive"]:g,p=r.gradientColors,f=void 0===p?["#1D9E75","#BA7517","#E24B4A"]:p,m=r.buttonText,h=void 0===m?"Regenerate":m,b=r.customStyles,y=void 0===b?{}:b,v=r.isStreaming,x=r.aiReason,C="linear-gradient(to right, ".concat(f.join(", "),")"),k=Math.max(u.length-1,1),w=l/k*100,A=Boolean(v||(null==x?void 0:x.resolving));return e(o,{children:[n("div",t({style:t({width:"100%",height:8,borderRadius:"999px",background:C,marginBottom:8,position:"relative"},y.track)},{children:n("div",{style:t({position:"absolute",top:"50%",transform:"translate(-50%, -50%)",left:"".concat(w,"%"),width:12,height:12,borderRadius:"50%",border:"2px solid #fff",boxShadow:"0 0 0 1.5px "+a,transition:"left 0.2s, background 0.2s",cursor:A?"not-allowed":"pointer",opacity:A?.7:1,background:A?"#9CA3AF":a},y.thumb)})})),n("input",{type:"range",min:0,max:k,step:1,value:l,onChange:function(t){return d(Number(t.target.value))},style:{width:"100%",cursor:"pointer",marginBottom:4,accentColor:a,opacity:0,marginTop:-20,display:"block",position:"relative",zIndex:1}}),n("div",t({style:t({display:"flex",justifyContent:"space-between",marginBottom:10,marginTop:-4},y.labelsContainer)},{children:u.map(function(e){return n("span",t({style:{fontSize:11,color:"#aaa"}},{children:e}),e)})})),n("div",t({style:t({maxHeight:s?60:0,overflow:"hidden",transition:"max-height 0.25s ease"},y.buttonContainer)},{children:e("button",t({disabled:A,style:t({display:"flex",float:"right",alignItems:"center",justifyContent:"center",gap:6,fontSize:13,fontWeight:500,padding:9,borderRadius:8,border:"none",color:"#fff",cursor:A?"not-allowed":"pointer",opacity:A?.7:1,background:A?"#9CA3AF":a},y.button),onClick:c},{children:[n(i,{size:16,color:"#fff"}),h]}))}))]})}export{r as ToneToggle};
2
2
  //# sourceMappingURL=ToneToggle.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as i,__assign as t,__spreadArray as o}from"tslib";import{jsx as n,Fragment as e,jsxs as a}from"react/jsx-runtime";import{useRef as l,useMemo as c,Suspense as d}from"react";import r from"react-markdown";import s from"rehype-raw";import{ChevronDown as u,ChevronUp as m,Maximize2 as v,X as p,Info as h}from"lucide-react";import{Tooltip as f}from"@mui/material";import _ from"./AiReasonMarkdownWrapper.module.css.js";import g from"../../shared/ExpandableOl.js";import C from"../citations/web-citation/WebCitationWithImageRenderer.js";import b from"../citations/web-citation/WebCitationRenderer.js";import y from"../citations/image-citation/ImageCitationRenderer.js";import I from"../citations/file-citation/FileCitationRender.js";import{useRequirementAI as k}from"../RequirementAIWrapper/RequirementAIWrapper.js";import S from"../citations/stormee-citation/StormeeCitationRenderer.js";import w from"../citations/audio-citation/WaveformCitationRenderer.js";import M from"../citations/appmod-citation/AppmodCitationRenderer.js";import R from"../citations/rca-citation/RCACitationRenderer.js";import N from"../citations/readfile-citation/ReadFileCitationRenderer.js";import j from"../citations/chat-citation/ChatCitationRenderer.js";import{NonWebReasoningComponent as x}from"@e-llm-studio/citation";import P from"../citations/big-enough/BigEnoughCitationRenderer.js";var W=["appmode_citation","appmode_citations","appmod_citation","appmod_citations","image_citation","image_citations","audio_citation","audio_citations","document_citation","document_citations","rca_citation","rca_citations","web_citation","web_citations","code_generated","chat_citation","readfile_citation","readfile_citations","gpt_citation","gpt_citations","big_enough_block"],L=function(i,n,e){return o([],i.map(function(i,o){var a=o>=n&&o<=e;return t(t({},i),{highlighted_text:a?i.message:""})}),!0)},F=function(o){var F=o.label,A=o.message,E=o.isExpandableOrderedListEnabled,T=o.customStyles,D=o.citationStyles,q=o.customIcons,O=o.onSelectProceed,z=o.isDisableProceedButton,B=o.big_enough_block,G=l(null),H=k(),U=H.citations,$=H.citationConfig,J=H.chatHistory,K=H.chatCitationConfigs,Q=H.gptCitationConfigs,V=c(function(){return{h1:function(o){o.node;var e=i(o,["node"]);return n("h1",t({className:_.h1,style:null==T?void 0:T.h1},{children:null==e?void 0:e.children}))},h2:function(o){o.node;var e=i(o,["node"]);return n("h2",t({className:_.h2,style:null==T?void 0:T.h2},{children:null==e?void 0:e.children}))},h3:function(o){o.node;var e=i(o,["node"]);return n("h2",t({className:_.h3,style:null==T?void 0:T.h3},{children:null==e?void 0:e.children}))},b:function(t){return t.node,i(t,["node"]),n("b",{className:_.bold,style:null==T?void 0:T.b})},p:function(o){o.node;var e=i(o,["node"]);return n("p",t({},e,{className:_.paragraph,style:null==T?void 0:T.p},{children:null==e?void 0:e.children}))},ol:function(o){o.node;var e=i(o,["node"]);return E?n(g,t({label:F,customStyles:null==T?void 0:T.expandOlStyle,onProceed:O,isProceedDisabled:z,aiReasoningCitation:U,citationStyles:D,customIcons:q},{children:null==e?void 0:e.children})):n("ol",t({className:_.orderedList,style:null==T?void 0:T.ol},{children:null==e?void 0:e.children}))},ul:function(o){o.node;var e=i(o,["node"]);return n("ul",t({className:_.unorderedList},{children:null==e?void 0:e.children}))},a:function(o){var l,c,r,s,h,g,k,F,A,E,O,z,G,H,V,X,Y,Z,ii,ti,oi,ni,ei,ai,li,ci;o.inline;var di=o.children;o.node;var ri=i(o,["inline","children","node"]),si="true"===(null==ri?void 0:ri.table),ui="".concat(null==ri?void 0:ri.href),mi=null===(l=ui.split("$"))||void 0===l?void 0:l[0],vi=null===(c=ui.split("$"))||void 0===c?void 0:c[1],pi=("appmode_citation"===mi||"appmode_citations"===mi?(null==U?void 0:U.appmod_citations)||[]:"image_citation"===mi||"image_citations"===mi?(null==U?void 0:U.image_citations)||[]:"audio_citation"===mi||"audio_citations"===mi?(null==U?void 0:U.audio_citations)||[]:"document_citation"===mi||"document_citations"===mi?(null==U?void 0:U.file_citations)||[]:"rca_citation"===mi||"rca_citations"===mi?(null==U?void 0:U.rca_citations)||[]:"web_citation"===mi||"web_citations"===mi?(null==U?void 0:U.web_citations)||[]:"code_generated"===mi?(null==U?void 0:U.code_generated)||[]:"readfile_citation"===mi||"readfile_citations"===mi?(null==U?void 0:U.readfile_citations)||[]:"gpt_citation"===mi||"gpt_citations"===mi?U.gpt_citations||[]:"big_enough_block"===mi&&B||[]).find(function(i){return i.citation_number===decodeURIComponent(vi)}),hi=W.includes(mi);if("big_enough_block"===mi&&pi)return console.log("Rendering big enough block with citation:",D),n(P,{title:di,citation:pi,customStyles:null==D?void 0:D.bigEnoughCitation,customIcons:q});if("chat_citation"===mi){if(!J||0===J.length)return null;var fi=vi.split("-").map(Number),_i=fi[0],gi=fi[1];return _i=_i>0?_i-1:_i,gi=gi<J.length-1?gi+1:gi,n(j,{customIcon:null==q?void 0:q.chatCitationIcon,title:di,chatHistory:L(J,_i,gi),isTable:si,chatCitationProps:null==K?void 0:K.chatCitationProps,onCitationClick:null==K?void 0:K.handleCitationClicked,customStyles:null==D?void 0:D.chatCitation})}if("gpt_citation"===mi&&pi)return n(x,t({item:{text:"",dataSource:null===(s=null===(r=pi.customMetadata)||void 0===r?void 0:r.data_sources)||void 0===s?void 0:s[0],trainingDataTitle:null===(g=null===(h=pi.customMetadata)||void 0===h?void 0:h.training_data_title)||void 0===g?void 0:g[0],paraphrase:null===(F=null===(k=pi.customMetadata)||void 0===k?void 0:k.paraphrase)||void 0===F?void 0:F[0]},headerTitle:(null==Q?void 0:Q.title)||"GPT - Gemini 2.5 Flash",iconsConfig:{ChevronDownIcon:u,ChevronUpIcon:m,MaximizeIcon:v,CloseIcon:p}},null==Q?void 0:Q.gptCitationProps));if("image_citation"===mi&&!pi)return null;if("web_citation"===(null===(A=null==pi?void 0:pi.customMetadata)||void 0===A?void 0:A.type))return(null===(E=pi.customMetadata)||void 0===E?void 0:E.screenshot_url)?n(C,{title:di,citation:pi,customStyles:null==D?void 0:D.webCitation,customIcons:q}):n(b,{label:di,url:null===(O=pi.customMetadata)||void 0===O?void 0:O.link,customStyles:null==D?void 0:D.webCitation,customIcons:q});if("audio_transcript"===(null===(z=null==pi?void 0:pi.customMetadata)||void 0===z?void 0:z.type))return"stormee"===(null==pi?void 0:pi.customMetadata.audio_citation_mode)?n(d,t({fallback:n(e,{})},{children:n(S,{title:"".concat(di),citation:pi,customStyles:null==D?void 0:D.stormeeCitation,customIcons:q})})):n(d,t({fallback:n(e,{})},{children:n(w,{title:"".concat(di),citation:pi,customStyles:null==D?void 0:D.waveformCitation,customIcons:q})}));if("image_citation"===(null==pi?void 0:pi.customMetadata.type))return n(d,t({fallback:n(e,{})},{children:n(y,{title:"".concat(di),citation:pi,customIcons:q,customStyles:null==D?void 0:D.imageCitation})}));if("book_citation_doc"===(null===(G=null==pi?void 0:pi.customMetadata)||void 0===G?void 0:G.type)||"book_citation_pdf"===(null==pi?void 0:pi.customMetadata.type))return n(d,t({fallback:n(e,{})},{children:n(I,{title:"".concat(di),citation:pi,customIcons:q,customStyles:null==D?void 0:D.fileCitation})}));if("app_mod_rag_question"===(null===(H=null==pi?void 0:pi.customMetadata)||void 0===H?void 0:H.type))return n(d,t({fallback:n(e,{})},{children:n(M,{title:"".concat(di),citation:pi,customIcons:q,customStyles:null==D?void 0:D.appModCitation,codeLinkConfig:null===(V=null==$?void 0:$.appMod)||void 0===V?void 0:V.codeLinkConfig,isLoading:null===(X=null==$?void 0:$.appMod)||void 0===X?void 0:X.isLoading})}));if("rca_citation"===(null===(Y=null==pi?void 0:pi.customMetadata)||void 0===Y?void 0:Y.type))return n(d,t({fallback:n(e,{})},{children:n(R,{title:"".concat(di),citation:pi,customIcons:q,customStyles:null==D?void 0:D.rcaCitation})}));if("readfile_citation"===(null===(Z=null==pi?void 0:pi.customMetadata)||void 0===Z?void 0:Z.type))return n(d,t({fallback:n(e,{})},{children:n(N,{title:"".concat(di),citation:pi,customIcons:q,customStyles:null==D?void 0:D.readFileCitation,fileCallback:null===(ii=null==$?void 0:$.readFile)||void 0===ii?void 0:ii.fileCallback,editorConfig:null===(ti=null==$?void 0:$.readFile)||void 0===ti?void 0:ti.editorConfig,customColors:null===(oi=null==$?void 0:$.readFile)||void 0===oi?void 0:oi.customColors})}));if(hi&&!pi){var Ci=null!==(ni=null==q?void 0:q.citationLoadingIcon)&&void 0!==ni?ni:n("span",{className:_.citationSpinner,style:null===(ei=null==D?void 0:D.loadingCitations)||void 0===ei?void 0:ei.citationSpinner});return n(f,t({title:null!==(li=null===(ai=null==D?void 0:D.loadingCitations)||void 0===ai?void 0:ai.tooltipTitle)&&void 0!==li?li:"source ".concat(mi.split("_")[0]," citations"),arrow:!0},{children:a("span",t({className:_.citationSpinnerWrapper,style:null===(ci=null==D?void 0:D.loadingCitations)||void 0===ci?void 0:ci.citationSpinnerWrapper},{children:[di,Ci]}))}))}return n("span",t({},ri,{className:_.paragraph,style:null==T?void 0:T.p},{children:null==ri?void 0:ri.children}))},code:function(o){o.inline;var e=o.children,a=o.className;return o.node,i(o,["inline","children","className","node"]),/language-(\w+)/.exec(a||"")||(null==a?void 0:a.includes("language-"))?n("div",{children:n("code",t({className:_.blockCode},{children:e}))}):n("code",t({className:_.inlineCode,style:null==T?void 0:T.code},{children:e}))},learned:function(i){var o=i.children;return n(e,{children:n(f,t({title:o,placement:"top"},{children:n(h,{size:16,className:_.learnedIcon})}))})}}},[U,E,$,J,B]);return n("div",t({ref:G,className:"w-full"},{children:n(r,t({components:V,rehypePlugins:[s]},{children:A}))}))};export{F as AiReasonMarkdownWrapper,L as formatChatData};
1
+ import{__rest as i,__assign as t,__spreadArray as o}from"tslib";import{jsx as n,Fragment as e,jsxs as a}from"react/jsx-runtime";import{useRef as l,useMemo as c,Suspense as d}from"react";import r from"react-markdown";import s from"rehype-raw";import{ChevronDown as u,ChevronUp as m,Maximize2 as v,X as p,Info as _}from"lucide-react";import{Tooltip as h}from"@mui/material";import f from"./AiReasonMarkdownWrapper.module.css.js";import g from"../../shared/ExpandableOl.js";import C from"../citations/web-citation/WebCitationWithImageRenderer.js";import b from"../citations/web-citation/WebCitationRenderer.js";import y from"../citations/image-citation/ImageCitationRenderer.js";import I from"../citations/file-citation/FileCitationRender.js";import{useRequirementAI as k}from"../RequirementAIWrapper/RequirementAIWrapper.js";import S from"../citations/stormee-citation/StormeeCitationRenderer.js";import M from"../citations/audio-citation/WaveformCitationRenderer.js";import R from"../citations/appmod-citation/AppmodCitationRenderer.js";import w from"../citations/rca-citation/RCACitationRenderer.js";import N from"../citations/readfile-citation/ReadFileCitationRenderer.js";import j from"../citations/chat-citation/ChatCitationRenderer.js";import{NonWebReasoningComponent as x}from"@e-llm-studio/citation";import P from"../citations/big-enough/BigEnoughCitationRenderer.js";import W from"./ScannedCitationRenderer.js";var L=["appmode_citation","appmode_citations","appmod_citation","appmod_citations","image_citation","image_citations","audio_citation","audio_citations","document_citation","document_citations","rca_citation","rca_citations","web_citation","web_citations","code_generated","chat_citation","readfile_citation","readfile_citations","gpt_citation","gpt_citations","big_enough_block","scanned_doc_citation","scanned_doc_citations"],F=function(i,n,e){return o([],i.map(function(i,o){var a=o>=n&&o<=e;return t(t({},i),{highlighted_text:a?i.message:""})}),!0)},A=function(o){var A=o.label,D=o.message,E=o.isExpandableOrderedListEnabled,T=o.customStyles,q=o.citationStyles,O=o.customIcons,z=o.onSelectProceed,B=o.isDisableProceedButton,G=o.big_enough_block,H=l(null),U=k(),$=U.citations,J=U.citationConfig,K=U.chatHistory,Q=U.chatCitationConfigs,V=U.gptCitationConfigs,X=c(function(){return{h1:function(o){o.node;var e=i(o,["node"]);return n("h1",t({className:f.h1,style:null==T?void 0:T.h1},{children:null==e?void 0:e.children}))},h2:function(o){o.node;var e=i(o,["node"]);return n("h2",t({className:f.h2,style:null==T?void 0:T.h2},{children:null==e?void 0:e.children}))},h3:function(o){o.node;var e=i(o,["node"]);return n("h2",t({className:f.h3,style:null==T?void 0:T.h3},{children:null==e?void 0:e.children}))},b:function(t){return t.node,i(t,["node"]),n("b",{className:f.bold,style:null==T?void 0:T.b})},p:function(o){o.node;var e=i(o,["node"]);return n("p",t({},e,{className:f.paragraph,style:null==T?void 0:T.p},{children:null==e?void 0:e.children}))},ol:function(o){o.node;var e=i(o,["node"]);return E?n(g,t({label:A,customStyles:null==T?void 0:T.expandOlStyle,onProceed:z,isProceedDisabled:B,aiReasoningCitation:$,citationStyles:q,customIcons:O},{children:null==e?void 0:e.children})):n("ol",t({className:f.orderedList,style:null==T?void 0:T.ol},{children:null==e?void 0:e.children}))},ul:function(o){o.node;var e=i(o,["node"]);return n("ul",t({className:f.unorderedList},{children:null==e?void 0:e.children}))},a:function(o){var l,c,r,s,_,g,k,A,D,E,z,B,H,U,X,Y,Z,ii,ti,oi,ni,ei,ai,li,ci,di,ri,si;o.inline;var ui=o.children;o.node;var mi=i(o,["inline","children","node"]),vi="true"===(null==mi?void 0:mi.table),pi="".concat(null==mi?void 0:mi.href),_i=null===(l=pi.split("$"))||void 0===l?void 0:l[0],hi=null===(c=pi.split("$"))||void 0===c?void 0:c[1],fi=("appmode_citation"===_i||"appmode_citations"===_i?(null==$?void 0:$.appmod_citations)||[]:"image_citation"===_i||"image_citations"===_i?(null==$?void 0:$.image_citations)||[]:"audio_citation"===_i||"audio_citations"===_i?(null==$?void 0:$.audio_citations)||[]:"document_citation"===_i||"document_citations"===_i?(null==$?void 0:$.file_citations)||[]:"rca_citation"===_i||"rca_citations"===_i?(null==$?void 0:$.rca_citations)||[]:"web_citation"===_i||"web_citations"===_i?(null==$?void 0:$.web_citations)||[]:"code_generated"===_i?(null==$?void 0:$.code_generated)||[]:"readfile_citation"===_i||"readfile_citations"===_i?(null==$?void 0:$.readfile_citations)||[]:"gpt_citation"===_i||"gpt_citations"===_i?(null==$?void 0:$.gpt_citations)||[]:"scanned_doc_citation"===_i||"scanned_doc_citations"===_i?(null==$?void 0:$.scanned_doc_citations)||[]:"big_enough_block"===_i&&G||[]).find(function(i){return i.citation_number===decodeURIComponent(hi)}),gi=L.includes(_i);if("big_enough_block"===_i&&fi)return console.log("Rendering big enough block with citation:",q),n(P,{title:ui,citation:fi,customStyles:null==q?void 0:q.bigEnoughCitation,customIcons:O});if("chat_citation"===_i){if(!K||0===K.length)return null;var Ci=hi.split("-").map(Number),bi=Ci[0],yi=Ci[1];return bi=bi>0?bi-1:bi,yi=yi<K.length-1?yi+1:yi,n(j,{customIcon:null==O?void 0:O.chatCitationIcon,title:ui,chatHistory:F(K,bi,yi),isTable:vi,chatCitationProps:null==Q?void 0:Q.chatCitationProps,onCitationClick:null==Q?void 0:Q.handleCitationClicked,customStyles:null==q?void 0:q.chatCitation})}if("gpt_citation"===_i&&fi)return n(x,t({item:{text:"",dataSource:null===(s=null===(r=fi.customMetadata)||void 0===r?void 0:r.data_sources)||void 0===s?void 0:s[0],trainingDataTitle:null===(g=null===(_=fi.customMetadata)||void 0===_?void 0:_.training_data_title)||void 0===g?void 0:g[0],paraphrase:null===(A=null===(k=fi.customMetadata)||void 0===k?void 0:k.paraphrase)||void 0===A?void 0:A[0]},headerTitle:(null==V?void 0:V.title)||"GPT - Gemini 2.5 Flash",iconsConfig:{ChevronDownIcon:u,ChevronUpIcon:m,MaximizeIcon:v,CloseIcon:p}},null==V?void 0:V.gptCitationProps));if("image_citation"===_i&&!fi)return null;if("web_citation"===(null===(D=null==fi?void 0:fi.customMetadata)||void 0===D?void 0:D.type))return(null===(E=fi.customMetadata)||void 0===E?void 0:E.screenshot_url)?n(C,{title:ui,citation:fi,customStyles:null==q?void 0:q.webCitation,customIcons:O}):n(b,{label:ui,url:null===(z=fi.customMetadata)||void 0===z?void 0:z.link,customStyles:null==q?void 0:q.webCitation,customIcons:O});if("audio_transcript"===(null===(B=null==fi?void 0:fi.customMetadata)||void 0===B?void 0:B.type))return"stormee"===(null==fi?void 0:fi.customMetadata.audio_citation_mode)?n(d,t({fallback:n(e,{})},{children:n(S,{title:"".concat(ui),citation:fi,customStyles:null==q?void 0:q.stormeeCitation,customIcons:O})})):n(d,t({fallback:n(e,{})},{children:n(M,{title:"".concat(ui),citation:fi,customStyles:null==q?void 0:q.waveformCitation,customIcons:O})}));if("scanned_doc_citations"===(null===(H=null==fi?void 0:fi.customMetadata)||void 0===H?void 0:H.type)||"scanned_doc_citation"===(null===(U=null==fi?void 0:fi.customMetadata)||void 0===U?void 0:U.type))return n(d,t({fallback:n(e,{})},{children:n(W,{title:ui,citation:fi,customIcons:O,customStyles:null==q?void 0:q.scannedDocumentCitation})}));if("image_citation"===(null==fi?void 0:fi.customMetadata.type))return n(d,t({fallback:n(e,{})},{children:n(y,{title:"".concat(ui),citation:fi,customIcons:O,customStyles:null==q?void 0:q.imageCitation})}));if("book_citation_doc"===(null===(X=null==fi?void 0:fi.customMetadata)||void 0===X?void 0:X.type)||"book_citation_pdf"===(null==fi?void 0:fi.customMetadata.type))return n(d,t({fallback:n(e,{})},{children:n(I,{title:"".concat(ui),citation:fi,customIcons:O,customStyles:null==q?void 0:q.fileCitation})}));if("app_mod_rag_question"===(null===(Y=null==fi?void 0:fi.customMetadata)||void 0===Y?void 0:Y.type))return n(d,t({fallback:n(e,{})},{children:n(R,{title:"".concat(ui),citation:fi,customIcons:O,customStyles:null==q?void 0:q.appModCitation,codeLinkConfig:null===(Z=null==J?void 0:J.appMod)||void 0===Z?void 0:Z.codeLinkConfig,isLoading:null===(ii=null==J?void 0:J.appMod)||void 0===ii?void 0:ii.isLoading})}));if("rca_citation"===(null===(ti=null==fi?void 0:fi.customMetadata)||void 0===ti?void 0:ti.type))return n(d,t({fallback:n(e,{})},{children:n(w,{title:"".concat(ui),citation:fi,customIcons:O,customStyles:null==q?void 0:q.rcaCitation})}));if("readfile_citation"===(null===(oi=null==fi?void 0:fi.customMetadata)||void 0===oi?void 0:oi.type))return n(d,t({fallback:n(e,{})},{children:n(N,{title:"".concat(ui),citation:fi,customIcons:O,customStyles:null==q?void 0:q.readFileCitation,fileCallback:null===(ni=null==J?void 0:J.readFile)||void 0===ni?void 0:ni.fileCallback,editorConfig:null===(ei=null==J?void 0:J.readFile)||void 0===ei?void 0:ei.editorConfig,customColors:null===(ai=null==J?void 0:J.readFile)||void 0===ai?void 0:ai.customColors})}));if(gi&&!fi){var Ii=null!==(li=null==O?void 0:O.citationLoadingIcon)&&void 0!==li?li:n("span",{className:f.citationSpinner,style:null===(ci=null==q?void 0:q.loadingCitations)||void 0===ci?void 0:ci.citationSpinner});return n(h,t({title:null!==(ri=null===(di=null==q?void 0:q.loadingCitations)||void 0===di?void 0:di.tooltipTitle)&&void 0!==ri?ri:"source ".concat(_i.split("_")[0]," citations"),arrow:!0},{children:a("span",t({className:f.citationSpinnerWrapper,style:null===(si=null==q?void 0:q.loadingCitations)||void 0===si?void 0:si.citationSpinnerWrapper},{children:[ui,Ii]}))}))}return n("span",t({},mi,{className:f.paragraph,style:null==T?void 0:T.p},{children:null==mi?void 0:mi.children}))},code:function(o){o.inline;var e=o.children,a=o.className;return o.node,i(o,["inline","children","className","node"]),/language-(\w+)/.exec(a||"")||(null==a?void 0:a.includes("language-"))?n("div",{children:n("code",t({className:f.blockCode},{children:e}))}):n("code",t({className:f.inlineCode,style:null==T?void 0:T.code},{children:e}))},learned:function(i){var o=i.children;return n(e,{children:n(h,t({title:o,placement:"top"},{children:n(_,{size:16,className:f.learnedIcon})}))})}}},[$,E,J,K,G]);return n("div",t({ref:H,className:"w-full"},{children:n(r,t({components:X,rehypePlugins:[s]},{children:D}))}))};export{A as AiReasonMarkdownWrapper,F as formatChatData};
2
2
  //# sourceMappingURL=AiReasonMarkdownWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i}from"tslib";import{jsx as n}from"react/jsx-runtime";import t from"./AiReasoningCitationContent.js";import e from"../../icons/CognitiveDecision.js";import o from"../../../CitationRenderer/CitationRenderer.js";var r=function(){return n("svg",i({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",style:{verticalAlign:"bottom",marginLeft:"1px"}},{children:n("polyline",{points:"18 15 12 9 6 15"})}))},l=function(){return n("svg",i({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",style:{verticalAlign:"bottom",marginLeft:"1px"}},{children:n("polyline",{points:"6 9 12 15 18 9"})}))},a=75,c=function(a){var c=a.isSourceHasHighlight,s=a.aiReason,d=a.citationTitle,p=void 0===d?"":d,f=a.customStyles,m=a.customIcons,g=a.onSelectProceed,u=a.isDisableProceedButton,h=(s.relevance_score>=75?null==m?void 0:m.highConfidence:null==m?void 0:m.lowConfidence)||n(e,{});return n("span",{children:n(o,{inLineCitation:!0,citationId:"ai-reasoning-".concat(s.id),citationTitle:p,citationIcon:h,defaultExpanded:(null==s?void 0:s.isOpen)||c||!1,citationComponent:n(t,{aiReason:s,customStyles:f,customIcons:m,onSelectProceed:g,isDisableProceedButton:u}),chevronDownComponent:n(l,{}),chevronUpComponent:n(r,{}),styles:{pillButton:i({margin:"0px",padding:"4px 8px",fontSize:"15px",color:"#526eff",cursor:"pointer",verticalAlign:"middle",whiteSpace:"nowrap",display:"inline-flex",alignItems:"flex-end",background:"#ffffffff",fontWeight:"700",gap:"1.5px",border:"none"},null==f?void 0:f.aiReasoningPill),citationContent:{width:"100%",background:"transparent",minHeight:"10px",height:"fit-content"}}})})};export{a as SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING,c as default};
1
+ import{__assign as i}from"tslib";import{jsx as n}from"react/jsx-runtime";import e from"./AiReasoningCitationContent.js";import t from"../../icons/CognitiveDecision.js";import o from"../../../CitationRenderer/CitationRenderer.js";var r=function(){return n("svg",i({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",style:{verticalAlign:"bottom",marginLeft:"1px"}},{children:n("polyline",{points:"18 15 12 9 6 15"})}))},l=function(){return n("svg",i({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",style:{verticalAlign:"bottom",marginLeft:"1px"}},{children:n("polyline",{points:"6 9 12 15 18 9"})}))},a=75,c=function(a){var c=a.isSourceHasHighlight,s=a.aiReason,d=a.citationTitle,p=void 0===d?"":d,f=a.customStyles,m=a.customIcons,g=a.onSelectProceed,u=a.isDisableProceedButton,h=a.inlineLabel,v=a.isInlineCitation,x=(s.relevance_score>=75?null==m?void 0:m.highConfidence:null==m?void 0:m.lowConfidence)||n(t,{});return n("span",{children:n(o,{inLineCitation:!0,citationId:"ai-reasoning-".concat(s.id),citationTitle:v?h||"":p||"",citationIcon:v?null:x,defaultExpanded:(null==s?void 0:s.isOpen)||c||!1,citationComponent:n(e,{aiReason:s,customStyles:f,customIcons:m,onSelectProceed:g,isDisableProceedButton:u}),chevronDownComponent:n(l,{}),chevronUpComponent:n(r,{}),styles:{pillButton:i({margin:"0px",padding:"4px 8px",fontSize:"15px",color:"#526eff",cursor:"pointer",verticalAlign:"middle",whiteSpace:"nowrap",display:"inline-flex",alignItems:v?"center":"flex-end",background:"#ffffffff",fontWeight:"700",gap:"1.5px",border:"none"},null==f?void 0:f.aiReasoningPill),citationContent:{width:"100%",background:"transparent",minHeight:"10px",height:"fit-content"}}})})};export{a as SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING,c as default};
2
2
  //# sourceMappingURL=AiReasoningCitation.js.map
@@ -0,0 +1,2 @@
1
+ import{__assign as t}from"tslib";import{jsx as n}from"react/jsx-runtime";import{ScannedDocCitation as i}from"@e-llm-studio/citation";import o from"../../../RequirementAiCitations/AiReasoning/components/icons/DocumentCitationIcon.js";import e from"../../../CitationRenderer/CitationRenderer.js";var r=function(r){var a,c=r.title,l=r.citation,m=r.customIcons,s=r.customStyles,u=l.customMetadata,d=null!==(a=null==m?void 0:m.ScannedDocumentIcon)&&void 0!==a?a:n(o,{});return n(e,{inLineCitation:!0,citationTitle:c,citationId:"scanned-doc-".concat(l.citation_number),citationComponent:n(i,{pages:null==u?void 0:u.value,subHeadingText:null==u?void 0:u.artifact_title,height:"400px"}),chevronDownComponent:d,chevronUpComponent:d,styles:{pillButton:t({fontSize:"14px",margin:"0px",background:"#ffffff",color:"#526eff",cursor:"pointer",verticalAlign:"middle",whiteSpace:"nowrap",display:"inline-flex",alignItems:"center",border:"none"},null==s?void 0:s.pill),citationContent:t({width:"100%",background:"transparent",minHeight:"10px",height:"fit-content"},null==s?void 0:s.content)}})};export{r as default};
2
+ //# sourceMappingURL=ScannedCitationRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScannedCitationRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as n,__generator as t}from"tslib";import{jsxs as o,jsx as a}from"react/jsx-runtime";import r,{useContext as i,useMemo as s}from"react";import{Loader2 as l,ChevronDown as c}from"lucide-react";import{cn as m}from"../../../UserStoryImport/lib/cn.js";import u from"./segment.module.css.js";import d from"./ExampleComponentWrapper.js";import p from"../ai-reasoning/AiReasoningCitationContent.js";import g from"./SegmentLoader.js";import"./segment-common.css.js";import{MarkdownStateContext as v}from"../../store/markdown-context.js";var f=function(f){var y=f.id,h=void 0===y?"Segment":y,S=f.label,C=f.segmentUUID,b=f.originalValue;f.decisionStrength;var x=f.aiReason,j=f.customStyles,E=f.customIcons,I=f.aiReasoningCitationCustomStyles,N=f.segmentExampleComponent,w=f.handleViewGlossary,R=f.isUpdatedSegment,U=f.onOpen,k=i(v),V=k.citationsMetadata,L=k.updateCitationsMetadata;console.log("citation metadata ",V);var W=r.useState(!1),G=W[0],M=W[1],z=s(function(){return V.get(C)},[V,C]),A=s(function(){return(null==z?void 0:z.open)||!1},[z]),B=s(function(){return z&&"loading"===z.state},[z]);return o("div",e({className:"".concat(u.segmentWrapper),style:e({},null==j?void 0:j.segmentWrapper)},{children:[o("div",e({className:"segment-".concat(h,"-container segmentContainer ").concat(R?"updatedSegmentContainer":""),style:e({},null==j?void 0:j.container)},{children:[a("span",e({className:"segment-".concat(h," segmentLabel ").concat(R?"updatedSegmentLabel":""),style:e({},null==j?void 0:j.label)},{children:R?b:S})),a("button",e({className:"".concat(u.segmentExplanationButtonContainer),style:e({},null==j?void 0:j.buttonContainer),onClick:function(){return n(void 0,void 0,void 0,function(){var n;return t(this,function(t){switch(t.label){case 0:if(n=!A,M(!1),console.log("citation metadata::",n,x),!n||(null==x?void 0:x.reason))return[3,5];L(C,function(t){if(t){var o=e({},t);return o.state="loading",o}return{open:n,state:"loading"}}),t.label=1;case 1:return t.trys.push([1,,3,4]),console.log("citation metadata:: onopen"),[4,null==U?void 0:U()];case 2:return t.sent(),[3,4];case 3:return L(C,function(t){if(t){var o=e({},t);return o.state="ready",o.open=n,o}return{open:n,state:"ready"}}),[7];case 4:return[3,6];case 5:console.log("citation metadata:: else block"),L(C,function(t){if(t){var o=e({},t);return o.open=n,o}return{open:n,state:B?"loading":"ready"}}),t.label=6;case 6:return[2]}})})}},{children:B?a(l,{size:16,className:u.spinner}):a(c,{className:m(R&&u.updatedChevronIcon,u.cheveronIcon,A&&u.cheveronIconRotated),style:e({},null==j?void 0:j.cheveronIcon)})}))]})),G&&!R?a(d,{label:null!=S?S:"",segmentExampleComponent:N,customStyles:null==j?void 0:j.segmentExample,handleCancelExample:function(){M(!1)}}):A&&(B?a(g,{customStyles:null==j?void 0:j.loadingSkeleton}):a(p,{aiReason:x,customStyles:I,customIcons:E,isSegmentExplanation:!0,handleViewGlossary:w?function(){L(C,function(n){if(n){var t=e({},n);return t.open=!1,t}return{open:!1,state:B?"loading":"ready"}}),null==w||w(h)}:void 0,handleViewExample:N?function(){M(!0)}:void 0,isUpdatedSegment:R}))]}))};export{f as default};
1
+ import{__assign as e,__awaiter as n,__generator as t}from"tslib";import{jsxs as o,jsx as a}from"react/jsx-runtime";import i,{useContext as r,useMemo as l}from"react";import{Loader2 as s,ChevronDown as c}from"lucide-react";import{cn as m}from"../../../UserStoryImport/lib/cn.js";import d from"./segment.module.css.js";import u from"./ExampleComponentWrapper.js";import p from"../ai-reasoning/AiReasoningCitationContent.js";import g from"./SegmentLoader.js";import"./segment-common.css.js";import{MarkdownStateContext as v}from"../../store/markdown-context.js";var f=function(f){var h=f.id,y=void 0===h?"Segment":h,S=f.label,C=f.children,x=f.segmentUUID;f.decisionStrength;var b=f.aiReason,j=f.customStyles,E=f.customIcons,I=f.aiReasoningCitationCustomStyles,N=f.segmentExampleComponent,w=f.handleViewGlossary,R=f.isUpdatedSegment,U=f.onOpen,k=r(v),L=k.citationsMetadata,V=k.updateCitationsMetadata;console.log("citation metadata ",L);var W=i.useState(!1),A=W[0],G=W[1],M=l(function(){return L.get(x)},[L,x]),P=l(function(){return(null==M?void 0:M.open)||!1},[M]),z=l(function(){return M&&"loading"===M.state},[M]);return o("div",e({className:"".concat(d.segmentWrapper),style:e(e({},null==j?void 0:j.segmentWrapper),{display:"inline-flex",verticalAlign:"middle"})},{children:[o("div",e({className:"segment-".concat(y,"-container segmentContainer ").concat(R?"updatedSegmentContainer":""),style:e({},null==j?void 0:j.container)},{children:[a("span",e({className:"segment-".concat(y," segmentLabel ").concat(R?"updatedSegmentLabel":""),style:e({},null==j?void 0:j.label)},{children:R?C:S})),a("button",e({className:"".concat(d.segmentExplanationButtonContainer),style:e({},null==j?void 0:j.buttonContainer),onClick:function(){return n(void 0,void 0,void 0,function(){var n;return t(this,function(t){switch(t.label){case 0:if(n=!P,G(!1),console.log("citation metadata::",n,b),!n||(null==b?void 0:b.reason))return[3,5];V(x,function(t){if(t){var o=e({},t);return o.state="loading",o}return{open:n,state:"loading"}}),t.label=1;case 1:return t.trys.push([1,,3,4]),console.log("citation metadata:: onopen"),[4,null==U?void 0:U()];case 2:return t.sent(),[3,4];case 3:return V(x,function(t){if(t){var o=e({},t);return o.state="ready",o.open=n,o}return{open:n,state:"ready"}}),[7];case 4:return[3,6];case 5:console.log("citation metadata:: else block"),V(x,function(t){if(t){var o=e({},t);return o.open=n,o}return{open:n,state:z?"loading":"ready"}}),t.label=6;case 6:return[2]}})})}},{children:z?a(s,{size:16,className:d.spinner}):a(c,{className:m(R&&d.updatedChevronIcon,d.cheveronIcon,P&&d.cheveronIconRotated),style:e({},null==j?void 0:j.cheveronIcon)})}))]})),A&&!R?a("div",e({className:d.explanationPanel},{children:a(u,{label:null!=S?S:"",segmentExampleComponent:N,customStyles:null==j?void 0:j.segmentExample,handleCancelExample:function(){G(!1)}})})):P&&(z?a(g,{customStyles:null==j?void 0:j.loadingSkeleton}):a("div",e({className:d.explanationPanel},{children:a(p,{aiReason:b,customStyles:I,customIcons:E,isSegmentExplanation:!0,handleViewGlossary:w?function(){V(x,function(n){if(n){var t=e({},n);return t.open=!1,t}return{open:!1,state:z?"loading":"ready"}}),null==w||w(y)}:void 0,handleViewExample:N?function(){G(!0)}:void 0,isUpdatedSegment:R})})))]}))};export{f as default};
2
2
  //# sourceMappingURL=Segment.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as e,__generator as n}from"tslib";import{jsx as t}from"react/jsx-runtime";import o from"./Segment.js";import l from"dompurify";var i=function(i){var d,a,s,r,u,m,v,g,c,p,S,h,f,b=i.id,x=i.children,y=i.props,C=i.segmentComponentConfig,_=i.customStyles,I=i.customIcons,U=i.extractText,D=i.isUpdatedSegment,w=void 0!==D&&D,E=(null==y?void 0:y.id)||"Segment",F=(null==y?void 0:y.decisionstrength)||"80",L=C||{},k=L.segmentDataList,R=L.getSegmentExampleComponent,V=L.handleViewGlossary,j=L.upadatedSegmentDataList,G=L.handleFetchUpdatedSegmentDetails,O=L.handleFetchSegmentDetails,T=w?null==j?void 0:j.find(function(e){return String(e.segment_id)===String(E)}):null==k?void 0:k.find(function(e){return String(e.segment_id)===String(E)});console.log("meee work",T,w,k,j);var W={id:E,reason:null!==(d=null==T?void 0:T.reason)&&void 0!==d?d:"",gap:null!==(a=null==T?void 0:T.gap)&&void 0!==a?a:"",explanation:null!==(s=null==T?void 0:T.explanation)&&void 0!==s?s:"",relevance_score:null!==(r=null==T?void 0:T.relevance_score)&&void 0!==r?r:0,isOpen:!1},z=void 0,H=U(x),M=y["data-table"],q="";if(M&&!w)try{q=decodeURIComponent(atob(M))}catch(e){console.error("Failed to decode data-table for segment",E,e)}var A=l.sanitize(q);return T||!O||w||null==O||O(E),E&&T&&R&&!w&&(z=M?t(function(){return t("div",{dangerouslySetInnerHTML:{__html:A}})},{}):R(E,H,T.segment_type)),t(o,{id:E,segmentUUID:b,label:null!==(u=null==T?void 0:T.label)&&void 0!==u?u:null==T?void 0:T.segment_name,originalValue:H,decisionStrength:F,aiReason:W,customIcons:I,aiReasoningCitationCustomStyles:_,segmentExampleComponent:z,handleViewGlossary:V,customStyles:{segmentWrapper:null===(m=null==_?void 0:_.segment)||void 0===m?void 0:m.segmentWrapper,container:null===(v=null==_?void 0:_.segment)||void 0===v?void 0:v.container,label:null===(g=null==_?void 0:_.segment)||void 0===g?void 0:g.label,decisionStrength:null===(c=null==_?void 0:_.segment)||void 0===c?void 0:c.decisionStrength,buttonContainer:null===(p=null==_?void 0:_.segment)||void 0===p?void 0:p.buttonContainer,cheveronIcon:null===(S=null==_?void 0:_.segment)||void 0===S?void 0:S.cheveronIcon,segmentExample:null===(h=null==_?void 0:_.segment)||void 0===h?void 0:h.segmentExample,loadingSkeleton:null===(f=null==_?void 0:_.segment)||void 0===f?void 0:f.SegmentLoadingSkeletonStyles},isUpdatedSegment:w,onOpen:function(){return e(void 0,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return T||!w?[3,2]:(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),[4,null==G?void 0:G(E)]);case 1:e.sent(),e.label=2;case 2:return[2]}})})}},E)};export{i as default};
1
+ import{__assign as e,__awaiter as n,__generator as t}from"tslib";import{jsx as o}from"react/jsx-runtime";import l from"./Segment.js";import i from"dompurify";var d=function(d){var a,s,r,u,m,v,g,c,p,S,h,f,b,x=d.id,y=d.children,C=d.props,_=d.segmentComponentConfig,I=d.customStyles,U=d.customIcons,D=d.extractText,w=d.isUpdatedSegment,E=void 0!==w&&w,F=(null==C?void 0:C.id)||"Segment",L=(null==C?void 0:C.decisionstrength)||"80",k=_||{},R=k.segmentDataList,j=k.getSegmentExampleComponent,G=k.handleViewGlossary,O=k.upadatedSegmentDataList,T=k.handleFetchUpdatedSegmentDetails,V=k.handleFetchSegmentDetails,W=E?null==O?void 0:O.find(function(e){return String(e.segment_id)===String(F)}):null==R?void 0:R.find(function(e){return String(e.segment_id)===String(F)});console.log("meee work",W,E,R,O);var z={id:F,reason:null!==(a=null==W?void 0:W.reason)&&void 0!==a?a:"",gap:null!==(s=null==W?void 0:W.gap)&&void 0!==s?s:"",explanation:null!==(r=null==W?void 0:W.explanation)&&void 0!==r?r:"",relevance_score:null!==(u=null==W?void 0:W.relevance_score)&&void 0!==u?u:0,isOpen:!1},H=void 0,M=D(y),q=C["data-table"],A="";if(q&&!E)try{A=decodeURIComponent(atob(q))}catch(e){console.error("Failed to decode data-table for segment",F,e)}var B=i.sanitize(A);return W||!V||E||null==V||V(F),F&&W&&j&&!E&&(H=q?o(function(){return o("div",{dangerouslySetInnerHTML:{__html:B}})},{}):j(F,M,W.segment_type)),o(l,e({id:F,segmentUUID:x,label:null!==(m=null==W?void 0:W.label)&&void 0!==m?m:null==W?void 0:W.segment_name,decisionStrength:L,aiReason:z,customIcons:U,aiReasoningCitationCustomStyles:I,segmentExampleComponent:H,handleViewGlossary:G,customStyles:{segmentWrapper:null===(v=null==I?void 0:I.segment)||void 0===v?void 0:v.segmentWrapper,container:null===(g=null==I?void 0:I.segment)||void 0===g?void 0:g.container,label:null===(c=null==I?void 0:I.segment)||void 0===c?void 0:c.label,decisionStrength:null===(p=null==I?void 0:I.segment)||void 0===p?void 0:p.decisionStrength,buttonContainer:null===(S=null==I?void 0:I.segment)||void 0===S?void 0:S.buttonContainer,cheveronIcon:null===(h=null==I?void 0:I.segment)||void 0===h?void 0:h.cheveronIcon,segmentExample:null===(f=null==I?void 0:I.segment)||void 0===f?void 0:f.segmentExample,loadingSkeleton:null===(b=null==I?void 0:I.segment)||void 0===b?void 0:b.SegmentLoadingSkeletonStyles},isUpdatedSegment:E,onOpen:function(){return n(void 0,void 0,void 0,function(){return t(this,function(e){switch(e.label){case 0:return W||!E?[3,2]:(console.log("citation metadata:: handleFetchUpdatedSegmentDetails"),[4,null==T?void 0:T(F)]);case 1:e.sent(),e.label=2;case 2:return[2]}})})}},{children:y}),F)};export{d as default};
2
2
  //# sourceMappingURL=SegmentWrapper.js.map
@@ -1,2 +1,2 @@
1
- var e={segmentWrapper:"segment-module_segmentWrapper__PVOuq",segmentButtonContainer:"segment-module_segmentButtonContainer__X76sx",cheveronIcon:"segment-module_cheveronIcon__1njFy",updatedChevronIcon:"segment-module_updatedChevronIcon__8vN-t",cheveronIconRotated:"segment-module_cheveronIconRotated__qDYj7",exampleWrapper:"segment-module_exampleWrapper__ptZzj",uppercase:"segment-module_uppercase__hjgxG",exampleContainer:"segment-module_exampleContainer__9tMXx",exampleHeader:"segment-module_exampleHeader__9P11O",loaderWrapper:"segment-module_loaderWrapper__SwIof",loaderContainer:"segment-module_loaderContainer__5Mhyz",loaderHeader:"segment-module_loaderHeader__J2JnY",skeleton:"segment-module_skeleton__2uZEf",pulse:"segment-module_pulse__A17cR",title:"segment-module_title__fW93U",icon:"segment-module_icon__Dvee3",lineFull:"segment-module_lineFull__MMmOD",line90:"segment-module_line90__OFStl",line75:"segment-module_line75__9r6Xp",line60:"segment-module_line60__bLRec",exampleHeaderText:"segment-module_exampleHeaderText__MWMG0",cancelButton:"segment-module_cancelButton__-F5aZ",spinner:"segment-module_spinner__kRnWD",spin:"segment-module_spin__MV6y5"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const n=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;n&&e.setAttribute("nonce",n),e.appendChild(document.createTextNode(".segment-module_segmentWrapper__PVOuq{display:flex;flex-direction:column;gap:8px}.segment-module_segmentButtonContainer__X76sx{background-color:initial;border:none;cursor:pointer;padding:0}.segment-module_cheveronIcon__1njFy{color:#3b82f6;height:16px;transition:all .2s ease-in-out;width:16px}.segment-module_updatedChevronIcon__8vN-t{color:#16a34a}.segment-module_cheveronIconRotated__qDYj7{transform:rotate(180deg)}.segment-module_exampleWrapper__ptZzj{align-items:flex-start;display:flex;flex-direction:column;gap:12px}.segment-module_uppercase__hjgxG{text-transform:uppercase}.segment-module_exampleContainer__9tMXx{align-items:flex-start;border:2px dashed #e2e8f0;border-radius:8px;display:flex;flex-direction:column;gap:8px;padding:16px;width:100%}.segment-module_exampleHeader__9P11O{align-items:center;align-self:stretch;display:flex;justify-content:space-between}.segment-module_loaderContainer__5Mhyz,.segment-module_loaderWrapper__SwIof{border:1px solid #e5e7eb;border-radius:8px;padding:12px}.segment-module_loaderHeader__J2JnY{align-items:center;display:flex;justify-content:space-between;margin-bottom:16px}.segment-module_skeleton__2uZEf{animation:segment-module_pulse__A17cR 1.5s ease-in-out infinite;background:#e5e7eb;border-radius:6px}.segment-module_title__fW93U{height:18px;width:100px}.segment-module_icon__Dvee3{height:18px;width:18px}.segment-module_lineFull__MMmOD{height:14px;margin-bottom:10px;width:100%}.segment-module_line90__OFStl{height:14px;margin-bottom:10px;width:90%}.segment-module_line75__9r6Xp{height:14px;margin-bottom:10px;width:75%}.segment-module_line60__bLRec{height:14px;width:60%}@keyframes segment-module_pulse__A17cR{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.segment-module_exampleHeaderText__MWMG0{color:#334155;font-size:14px;font-weight:600;line-height:21px;margin:0}.segment-module_cancelButton__-F5aZ{align-items:center;align-self:stretch;background-color:initial;border:none;color:#334155;cursor:pointer;display:flex;height:fit-content;justify-content:space-between;padding:4px;transition:all .2s ease-in-out}.segment-module_cancelButton__-F5aZ:hover{background-color:#eff6ff}.segment-module_spinner__kRnWD{animation:segment-module_spin__MV6y5 1s linear infinite}@keyframes segment-module_spin__MV6y5{to{transform:rotate(1turn)}}"));const t=document.head||document.getElementsByTagName("head")[0]||document.documentElement;t&&t.appendChild(e)}();export{e as default};
1
+ var e={segmentWrapper:"segment-module_segmentWrapper__PVOuq",segmentButtonContainer:"segment-module_segmentButtonContainer__X76sx",cheveronIcon:"segment-module_cheveronIcon__1njFy",updatedChevronIcon:"segment-module_updatedChevronIcon__8vN-t",cheveronIconRotated:"segment-module_cheveronIconRotated__qDYj7",segmentPopup:"segment-module_segmentPopup__YcHor",explanationPanel:"segment-module_explanationPanel__7YlpU",exampleWrapper:"segment-module_exampleWrapper__ptZzj",uppercase:"segment-module_uppercase__hjgxG",exampleContainer:"segment-module_exampleContainer__9tMXx",exampleHeader:"segment-module_exampleHeader__9P11O",loaderWrapper:"segment-module_loaderWrapper__SwIof",loaderContainer:"segment-module_loaderContainer__5Mhyz",loaderHeader:"segment-module_loaderHeader__J2JnY",skeleton:"segment-module_skeleton__2uZEf",pulse:"segment-module_pulse__A17cR",title:"segment-module_title__fW93U",icon:"segment-module_icon__Dvee3",lineFull:"segment-module_lineFull__MMmOD",line90:"segment-module_line90__OFStl",line75:"segment-module_line75__9r6Xp",line60:"segment-module_line60__bLRec",exampleHeaderText:"segment-module_exampleHeaderText__MWMG0",cancelButton:"segment-module_cancelButton__-F5aZ",spinner:"segment-module_spinner__kRnWD",spin:"segment-module_spin__MV6y5"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const n=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;n&&e.setAttribute("nonce",n),e.appendChild(document.createTextNode(".segment-module_segmentWrapper__PVOuq{display:inline-flex;gap:8px;position:relative;vertical-align:middle}.segment-module_segmentButtonContainer__X76sx{background-color:initial;border:none;cursor:pointer;padding:0}.segment-module_cheveronIcon__1njFy{color:#3b82f6;height:16px;transition:all .2s ease-in-out;width:16px}.segment-module_updatedChevronIcon__8vN-t{color:#16a34a}.segment-module_cheveronIconRotated__qDYj7{transform:rotate(180deg)}.segment-module_segmentPopup__YcHor{left:0;min-width:500px;position:absolute;top:calc(100% + 8px);z-index:1000}.segment-module_explanationPanel__7YlpU{background:#fff;left:0;position:absolute;top:100%;width:600px;z-index:100}.segment-module_exampleWrapper__ptZzj{align-items:flex-start;display:flex;flex-direction:column;gap:12px}.segment-module_uppercase__hjgxG{text-transform:uppercase}.segment-module_exampleContainer__9tMXx{align-items:flex-start;border:2px dashed #e2e8f0;border-radius:8px;display:flex;flex-direction:column;gap:8px;padding:16px;width:100%}.segment-module_exampleHeader__9P11O{align-items:center;align-self:stretch;display:flex;justify-content:space-between}.segment-module_loaderContainer__5Mhyz,.segment-module_loaderWrapper__SwIof{border:1px solid #e5e7eb;border-radius:8px;padding:12px}.segment-module_loaderHeader__J2JnY{align-items:center;display:flex;justify-content:space-between;margin-bottom:16px}.segment-module_skeleton__2uZEf{animation:segment-module_pulse__A17cR 1.5s ease-in-out infinite;background:#e5e7eb;border-radius:6px}.segment-module_title__fW93U{height:18px;width:100px}.segment-module_icon__Dvee3{height:18px;width:18px}.segment-module_lineFull__MMmOD{height:14px;margin-bottom:10px;width:100%}.segment-module_line90__OFStl{height:14px;margin-bottom:10px;width:90%}.segment-module_line75__9r6Xp{height:14px;margin-bottom:10px;width:75%}.segment-module_line60__bLRec{height:14px;width:60%}@keyframes segment-module_pulse__A17cR{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.segment-module_exampleHeaderText__MWMG0{color:#334155;font-size:14px;font-weight:600;line-height:21px;margin:0}.segment-module_cancelButton__-F5aZ{align-items:center;align-self:stretch;background-color:initial;border:none;color:#334155;cursor:pointer;display:flex;height:fit-content;justify-content:space-between;padding:4px;transition:all .2s ease-in-out}.segment-module_cancelButton__-F5aZ:hover{background-color:#eff6ff}.segment-module_spinner__kRnWD{animation:segment-module_spin__MV6y5 1s linear infinite}@keyframes segment-module_spin__MV6y5{to{transform:rotate(1turn)}}"));const t=document.head||document.getElementsByTagName("head")[0]||document.documentElement;t&&t.appendChild(e)}();export{e as default};
2
2
  //# sourceMappingURL=segment.module.css.js.map
@@ -1,2 +1,2 @@
1
- import{__rest as n,__assign as e}from"tslib";import{jsx as i,jsxs as o}from"react/jsx-runtime";import t,{createContext as r,useRef as l,useState as a,useCallback as d,useMemo as c,useEffect as s,useContext as u}from"react";import v from"react-markdown";import g from"rehype-raw";import p from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as m}from"../../shared/useMarkdownSearch.js";import{Info as h}from"lucide-react";import{Tooltip as f}from"@mui/material";import C from"../../shared/UpdatedAnimationContent.js";import y from"../../shared/GeneratedCodeCitation.js";import S from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as R}from"../RequirementAIWrapper/RequirementAIWrapper.js";import w from"../../icons/CognitiveDecision.js";import I from"../../icons/BrainRed.js";import b,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as x}from"../ai-reasoning/AiReasoningCitation.js";import N from"../../icons/RelevanceScoreIcon.js";import A from"../RecommendationBlock/RecommendationBlock.js";import k from"../UserStoryCard/AttachedContext.js";import j from"../ai-reasoning/AiReasoningCitationContent.js";import U from"./components/InlineUpdatedComponent.js";import T from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as P}from"../../store/markdown-context.js";var $=r(!1),E=r({expandedInfo:null,setExpanded:function(){},reasonToRow:{current:new Map}}),L=r({rowId:""}),M=function(n){var t,r=n.aiReason,l=n.isHighConfidence,a=n.customStyle,d=n.customIcons,c=u(E),s=c.expandedInfo,v=c.setExpanded,g=c.reasonToRow,m=u(L).rowId,h=String(r.id);m&&g.current.set(h,m);var f=(null===(t=null==s?void 0:s.aiReason)||void 0===t?void 0:t.id)===r.id,C=l?(null==d?void 0:d.highConfidence)||i(w,{}):(null==d?void 0:d.lowConfidence)||i(I,{});return o("button",e({className:p.aiReasoningButton,style:a,onClick:function(n){n.stopPropagation(),n.preventDefault(),v(f?null:m,f?null:r)}},{children:[C,i("i",f?{className:"pi pi-angle-up ".concat(l?p.aiReasoningIconHighConfidence:p.aiReasoningIconLowConfidence)}:{className:"pi pi-angle-down ".concat(l?p.aiReasoningIconHighConfidence:p.aiReasoningIconLowConfidence)})]}))},_=function(n){var t,r,a=n.children,d=n.node,c=n.customStyles,s=n.customIcons,v=l(Math.random().toString(36).slice(2)).current,g=u(E).expandedInfo,m=(null==g?void 0:g.rowId)===v,h=Array.isArray(null==d?void 0:d.children)?d.children.filter(function(n){return"element"===n.type}).length:1,f=null!==(r=null===(t=null==d?void 0:d.properties)||void 0===t?void 0:t.style)&&void 0!==r?r:void 0;return o(L.Provider,e({value:{rowId:v}},{children:[i("tr",e({style:f?{cssText:f}:void 0},{children:a})),m&&(null==g?void 0:g.aiReason)&&i("tr",e({style:{width:"100%"}},{children:i("td",e({colSpan:h||1,className:p.tableExpandedCell},{children:i("div",e({className:p.tableExpandedCellInner},{children:i("div",e({className:p.tableExpandedCellContent},{children:i(j,{aiReason:g.aiReason,customIcons:s,customStyles:{aiReasoningContent:null==c?void 0:c.aiReasoningContent,aiReasoningAccordion:null==c?void 0:c.aiReasoningAccordion,aiReasoningMarkdown:null==c?void 0:c.aiReasoningMarkdown,aiReasoningPill:null==c?void 0:c.aiReasoningPill,webCitation:null==c?void 0:c.webCitation,stormeeCitation:null==c?void 0:c.stormeeCitation,waveformCitation:null==c?void 0:c.waveformCitation,imageCitation:null==c?void 0:c.imageCitation,fileCitation:null==c?void 0:c.fileCitation,appModCitation:null==c?void 0:c.appModCitation,rcaCitation:null==c?void 0:c.rcaCitation,readFileCitation:null==c?void 0:c.readFileCitation,loadingCitations:null==c?void 0:c.loadingCitations,chatCitation:null==c?void 0:c.chatCitation}})}))}))}))}))]}))};var D=["del","ins"];function F(n){return function(n,e,i){var o=e.join("|");return n.replace(new RegExp("<(".concat(o,")>([\\s\\S]*?)<\\/\\1>"),"gi"),function(n,e,o){return"<".concat(e,">").concat(i(o),"</").concat(e,">")})}(n,D,function(n){return n.split(/(<[^>]+>)/g).map(function(n){return!n||/^<[^>]+>$/.test(n)?n:function(n){if(!n)return n;var e=[];return n.replace(/`([^`\n]+)`/g,function(n,i){var o=e.push(i)-1;return"@@CODE_SPAN_".concat(o,"@@")}).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,function(n,i){var o,t=null!==(o=e[Number(i)])&&void 0!==o?o:"";return"<code>".concat(t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),"</code>")})}(n)}).join("")})}var H=function(r){var w,I=r.message,j=r.isParent,L=r.scenario,D=r.showUserStoryDiff,H=void 0!==D&&D,B=r.aiReasoningsForBlock,O=r.isCitationLoadingDisplay,q=void 0!==O&&O,W=r.className;r.highConfidenceIcon,r.lowConfidenceIcon;var z=r.customStyles,V=r.customIcons,G=r.aiReasoningDiffView,Q=r.userStoryCitations,J=r.artifactId,K=r.isCraflow,X=r.onCraAccept,Y=r.onCraReject,Z=r.craFlowConfig,nn=r.isDisplayHighlightControl,en=void 0!==nn&&nn,on=l(null),tn=R(),rn=tn.userStory,ln=tn.inlineUpdateComponentConfig,an=tn.getAvgScoreForStory,dn=tn.setUserStory,cn=tn.aiReasoning,sn=tn.setAiReasoning,un=tn.customIcons,vn=tn.searchQueryList,gn=tn.searchQueryReasoningIdList,pn=tn.currentHighlightIndex,mn=tn.segmentComponentConfig,hn=null!=V?V:null==un?void 0:un.userStoryIcons;null==z||z.searchHighlight;var fn=m(on),Cn=fn.search,yn=fn.clear,Sn=a("1"),Rn=Sn[0],wn=Sn[1],In=a(null),bn=In[0],xn=In[1],Nn=l(new Map),An=d(function(n,e){xn(n&&e?{rowId:n,aiReason:e}:null)},[]),kn=J?an(J):0,jn=a([]),Un=jn[0],Tn=jn[1],Pn=function(n){return null==n?"":"string"==typeof n?n:"number"==typeof n?String(n):Array.isArray(n)?n.map(Pn).join(""):t.isValidElement(n)?Pn(n.props.children):""},$n=function(n){var e=n;return e=function(n){for(var e,i=/<updated[^>]*>[\s\S]*?<\/updated>/gi,o=[],t=new RegExp(i.source,i.flags);null!==(e=t.exec(n));){var r=e[0],l=r.match(/<deleted>([\s\S]*?)<\/deleted>/i),a=r.match(/<changed>([\s\S]*?)<\/changed>/i),d=function(n){return(n.match(/^\s*\d+\.\s/gm)||[]).length};o.push({index:e.index,endIndex:e.index+e[0].length,deletedItemCount:d((null==l?void 0:l[1])||""),changedItemCount:d((null==a?void 0:a[1])||"")})}if(0===o.length)return n;for(var c=n,s=function(n){var e=o[n],i=e.changedItemCount-e.deletedItemCount;if(0===i)return"continue";for(var t=!1,r=0,l=c.substring(0,e.index).split("\n").reverse();r<l.length;r++){var a=l[r].trim();if(""!==a){/^\d+\.\s/.test(a)&&(t=!0);break}}if(!t)return"continue";var d=e.endIndex,s=n+1<o.length?o[n+1].index:c.length,u=c.substring(d,s);u=u.replace(/^(\s*)(\d+)\.\s/gm,function(n,e,o){return"".concat(e).concat(parseInt(o,10)+i,". ")}),c=c.substring(0,d)+u+c.substring(s)},u=o.length-1;u>=0;u--)s(u);return c}(e=(e=(e=(e=(e=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,function(n,e){var i=e.replace(/ai_reasoning\$(\d+)/g,function(n,e){return"ai_reasoning$".concat(e,"-legacy")});return"<deleted>".concat(i,"</deleted>")})).replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,function(n,e,i){var o=btoa(encodeURIComponent(i.trim()));return"\n\n<generatedCode".concat(e,' data-raw="').concat(o,'"></generatedCode>\n\n')})).replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2")).replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,function(n,e,i,o,t){var r=o.match(/<table[\s\S]*?<\/table>/i);if(r){var l=btoa(encodeURIComponent(r[0]));return"<segment".concat(i,' data-table="').concat(l,'"></segment>')}return n})).replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,function(n,i,o,t){var r=e.substring(0,t),l=r.lastIndexOf("\n"),a=/^\s+[-*]\s/.test(r.substring(l+1))||/^\s+\d+\.\s/.test(r.substring(l+1)),d=/^\s*(\d+\.|\s*[-*])\s+$/.test(r.substring(l+1));if(a||d){var c=o;return c=(c=(c=(c=c.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n")).replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n")).replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n")).replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),"<updated".concat(i,">").concat(c,"</updated>")}return n})),e=function(n){var e=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,function(n,e){var i=e.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==e}),"<deleted>".concat(i,"</deleted>")});return e.replace(/<changed>([\s\S]*?)<\/changed>/gi,function(n,e){var i=e.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==e,preview:e.substring(0,120)}),"<changed>".concat(i,"</changed>")})}(e),e=F(e)},En=c(function(){return I?$n(I):I},[I]);s(function(){Tn(B||cn)},[B,cn]);var Ln=c(function(){return{upt:function(o){var t;o.node;var r=o.children,l=n(o,["node","children"]),a=null==l?void 0:l.id,d=a?null===(t=a.split("$"))||void 0===t?void 0:t[1]:null,c=cn.find(function(n){return n.id.toString()===d});return c?i(U,e({aiReason:c,customStyles:null==z?void 0:z.inlineUpdatedComponent,handleClickCognitiveDecision:null==ln?void 0:ln.handleClickCognitiveDecision,handleClickUpdatedPill:null==ln?void 0:ln.handleClickUpdatedPill,handleClickOutputValue:null==ln?void 0:ln.handleClickOutputValue,customIcons:null==ln?void 0:ln.customIcons},{children:r})):r},del:function(o){o.node;var t=o.children,r=n(o,["node","children"]);return i("span",e({className:p.deleted,style:null==z?void 0:z.deleted},r,{onClick:r.onclick},{children:t}))},ins:function(o){var t=o.children,r=n(o,["children"]);return i("span",e({className:p.inserted,style:null==z?void 0:z.inserted},r,{onClick:r.onclick},{children:t}))},preserved:function(o){var t=o.children,r=n(o,["children"]);return i("span",e({className:p.preserved,style:null==z?void 0:z.preserved},r,{onClick:r.onclick},{children:t}))},h1:function(o){o.node;var t=n(o,["node"]);return i("h1",e({className:p.heading1,style:null==z?void 0:z.heading1},{children:t.children}))},h2:function(o){o.node;var t=n(o,["node"]);return i("h2",e({className:p.heading2,style:null==z?void 0:z.heading2},{children:t.children}))},h3:function(o){o.node;var t=n(o,["node"]);return i("h3",e({className:p.heading3,style:null==z?void 0:z.heading3},{children:t.children}))},b:function(o){o.node;var t=n(o,["node"]);return i("b",e({className:p.bold,style:null==z?void 0:z.bold},{children:null==t?void 0:t.children}))},p:function(o){o.node;var t=n(o,["node"]);return i("p",e({},t,{className:p.paragraph,style:null==z?void 0:z.paragraph},{children:t.children}))},updated:function(o){var t=o.node,r=n(o,["node"]);return i(C,e({},r,{showUserStoryDiff:H,currentUpdatedTagId:Rn,setCurrentUpdatedTagId:wn,userStory:rn,setUserStory:dn,setAiReasoning:sn,node:t,isCraflow:K,onCraAccept:X,onCraReject:Y,customStyles:null==z?void 0:z.updatedContent,craFlowConfig:Z}))},ol:function(o){var t,r,l,a=o.node,d=n(o,["node"]),c=null!==(l=null!==(r=null===(t=null==a?void 0:a.properties)||void 0===t?void 0:t.start)&&void 0!==r?r:null==d?void 0:d.start)&&void 0!==l?l:void 0;return i("ol",e({className:p.orderedList,style:null==z?void 0:z.olist},c?{start:Number(c)}:{},{children:null==d?void 0:d.children}))},ul:function(o){o.node;var t=n(o,["node"]);return i("ul",e({className:p.unorderedList,style:null==z?void 0:z.ulist},{children:null==t?void 0:t.children}))},table:function(n){var o=n.children;return i("div",e({className:p.tableWrapper},{children:i("table",e({className:p.table,style:null==z?void 0:z.table},{children:o}))}))},tr:function(n){var e=n.node,o=n.children;return i(_,{node:e,children:o,customStyles:z})},td:function(o){var t,r=o.node,l=o.children,a=null!==(t=null==r?void 0:r.properties)&&void 0!==t?t:{},d=a.style,c=n(a,["style"]);return i($.Provider,e({value:!0},{children:i("td",e({},c,{style:d?{cssText:d}:void 0},{children:l}))}))},th:function(o){var t,r=o.node,l=o.children,a=null!==(t=null==r?void 0:r.properties)&&void 0!==t?t:{},d=a.style,c=n(a,["style"]);return i($.Provider,e({value:!0},{children:i("th",e({},c,{style:d?{cssText:d}:void 0},{children:l}))}))},recommendation:function(o){var t;o.node;var r=n(o,["node"]),l="The AI has selected this content based on: ".concat((null===(t=null==r?void 0:r.children)||void 0===t?void 0:t[0])||"");return i(A,e({},r,{customStyles:null==z?void 0:z.recommendationBlock,label:l}))},a:function(e){var o,t,r;e.inline,e.children,e.node;var l=n(e,["inline","children","node"]),a=u($)||"true"==(null==l?void 0:l.table),d="".concat(null==l?void 0:l.href),c=null===(o=d.split("$"))||void 0===o?void 0:o[0],s=null===(t=d.split("$"))||void 0===t?void 0:t[1];if("ai_reasoning"===c){var v=(null!==(r=H?G:cn)&&void 0!==r?r:[]).find(function(n){return n.id.toString()===decodeURIComponent(s)}),g=gn.includes(s);if(v)return a?i(M,{aiReason:v,customStyle:null==z?void 0:z.tableAiReasoning,customIcons:hn,isHighConfidence:v.relevance_score>=x}):i(b,{aiReason:v,isSourceHasHighlight:g,customIcons:hn,customStyles:{aiReasoningContent:null==z?void 0:z.aiReasoningContent,aiReasoningAccordion:null==z?void 0:z.aiReasoningAccordion,aiReasoningMarkdown:null==z?void 0:z.aiReasoningMarkdown,aiReasoningPill:null==z?void 0:z.aiReasoningPill,webCitation:null==z?void 0:z.webCitation,stormeeCitation:null==z?void 0:z.stormeeCitation,waveformCitation:null==z?void 0:z.waveformCitation,imageCitation:null==z?void 0:z.imageCitation,fileCitation:null==z?void 0:z.fileCitation,appModCitation:null==z?void 0:z.appModCitation,rcaCitation:null==z?void 0:z.rcaCitation,readFileCitation:null==z?void 0:z.readFileCitation,loadingCitations:null==z?void 0:z.loadingCitations,chatCitation:null==z?void 0:z.chatCitation,bigEnoughCitation:null==z?void 0:z.bigEnoughCitation}})}return null},code:function(o){o.inline;var t=o.children,r=o.className;return o.node,n(o,["inline","children","className","node"]),/language-(\w+)/.exec(r||"")||(null==r?void 0:r.includes("language-"))?i("div",{children:i("code",e({className:p.blockCode,style:null==z?void 0:z.code},{children:t}))}):i("code",e({className:p.inlineCode,style:null==z?void 0:z.code},{children:t}))},learned:function(n){var o=n.children;return i(f,e({title:o,placement:"top"},{children:i(h,{size:16,className:p.learned})}))},generatedcode:function(e){e.node;var o=n(e,["node"]),t=(null==o?void 0:o.language)||"python",r=function(n){var e="";try{if(n["data-raw"])e=decodeURIComponent(atob(n["data-raw"]));else{var i=function(n){var e;return"string"==typeof n?n:Array.isArray(n)?n.map(i).join(""):(null===(e=null==n?void 0:n.props)||void 0===e?void 0:e.children)?i(n.props.children):""};e=i(n.children)}}catch(i){console.error("Error decoding generated code:",i),e=String(n.children)}return e}(o);return i(y,{title:"Generated Code",code:r,language:t,customStyles:{pill:null==z?void 0:z.generatedCodePill,content:null==z?void 0:z.generatedCodeContent}})},updatedsegment:function(e){var o,t,r,l,a=e.node,d=e.children,c=n(e,["node","children"]),s="".concat(null===(o=a.position)||void 0===o?void 0:o.start.line,"-").concat(null===(t=a.position)||void 0===t?void 0:t.start.column,"-").concat(null===(r=a.position)||void 0===r?void 0:r.end.line,"-").concat(null===(l=a.position)||void 0===l?void 0:l.end.column);return i(T,{id:s,node:a,children:d,props:c,segmentComponentConfig:mn,customStyles:z,customIcons:V,extractText:Pn,isUpdatedSegment:!0})},segment:function(e){var o,t,r,l,a=e.node,d=e.children,c=n(e,["node","children"]),s="".concat(null===(o=a.position)||void 0===o?void 0:o.start.line,"-").concat(null===(t=a.position)||void 0===t?void 0:t.start.column,"-").concat(null===(r=a.position)||void 0===r?void 0:r.end.line,"-").concat(null===(l=a.position)||void 0===l?void 0:l.end.column);return i(T,{id:s,node:a,children:d,props:c,segmentComponentConfig:mn,customStyles:z,customIcons:V,extractText:Pn})}}},[Un,Z,cn,Q,Rn,H,I,V,vn,gn,z,mn]);return s(function(){if(on.current){if(vn.length){var n;if(0===gn.length||en)requestAnimationFrame(function(){Cn([vn[pn].replace(/\*/g,"")])});else{var e=on.current,i=new MutationObserver(function(){clearTimeout(n),n=setTimeout(function(){i.disconnect(),requestAnimationFrame(function(){Cn([vn[pn].replace(/\*/g,"")])})},50)});i.observe(e,{childList:!0,subtree:!0})}return function(){clearTimeout(n)}}yn()}},[vn,gn,pn,en]),s(function(){return console.log("mounting userstorywithcitation"),function(){console.log("unmounting userstorywithcitation")}},[]),i(E.Provider,e({value:{expandedInfo:bn,setExpanded:An,reasonToRow:Nn}},{children:o("div",e({ref:on,className:"".concat(p.container," ").concat("approving"!==L?p.wrapper:""," ").concat(W||""),style:null==z?void 0:z.container},{children:[i(P,{children:i(v,e({components:Ln,rehypePlugins:[g]},{children:En}))}),kn>0&&i("div",e({className:p.confidenceScoreContainer,style:null==z?void 0:z.confidenceScoreContainer},{children:o("span",e({className:p.confidenceScore,style:null==z?void 0:z.confidenceScore},{children:[i(N,{size:14,color:(null==z?void 0:z.confidenceScoreIconColor)||"#166534"}),kn,"%"]}))})),q&&i("div",e({className:p.citationLoader,style:null==z?void 0:z.citationLoaderContainer},{children:i(S,{customStyles:{container:null==z?void 0:z.citationLoadingContainer,icon:null==z?void 0:z.citationLoadingIcon,text:null==z?void 0:z.citationLoadingText}})})),j&&i("div",e({style:e({},null===(w=null==z?void 0:z.attachedContext)||void 0===w?void 0:w.wrapper),className:"flex mt-5"},{children:i(k,{customStyles:null==z?void 0:z.attachedContext})}))]}))}))};export{H as default};
1
+ import{__rest as n,__assign as e}from"tslib";import{jsx as i,jsxs as o}from"react/jsx-runtime";import t,{createContext as r,useRef as l,useState as a,useCallback as d,useMemo as c,useEffect as s,useContext as u}from"react";import v from"react-markdown";import g from"rehype-raw";import m from"./UserStoryWithCitation.module.css.js";import{useMarkdownSearch as p}from"../../shared/useMarkdownSearch.js";import{Info as h}from"lucide-react";import{Tooltip as f}from"@mui/material";import C from"dompurify";import y from"../../shared/UpdatedAnimationContent.js";import S from"../../shared/GeneratedCodeCitation.js";import w from"../../shared/CitationLoadingIndicator.js";import{useRequirementAI as R}from"../RequirementAIWrapper/RequirementAIWrapper.js";import I from"../../icons/CognitiveDecision.js";import b from"../../icons/BrainRed.js";import x,{SHOW_CONFIDENCE_SCORE_THRESHOLD_IN_AI_REASONING as N}from"../ai-reasoning/AiReasoningCitation.js";import k from"../../icons/RelevanceScoreIcon.js";import A from"../RecommendationBlock/RecommendationBlock.js";import j from"../UserStoryCard/AttachedContext.js";import U from"../ai-reasoning/AiReasoningCitationContent.js";import T from"./components/InlineUpdatedComponent.js";import _ from"../segment/SegmentWrapper.js";import{MarkdownContextProvider as L}from"../../store/markdown-context.js";var M=r(!1),P=r({expandedInfo:null,setExpanded:function(){},reasonToRow:{current:new Map}}),E=r({rowId:""}),$=function(n){var t,r=n.aiReason,l=n.isHighConfidence,a=n.customStyle,d=n.customIcons,c=u(P),s=c.expandedInfo,v=c.setExpanded,g=c.reasonToRow,p=u(E).rowId,h=String(r.id);p&&g.current.set(h,p);var f=(null===(t=null==s?void 0:s.aiReason)||void 0===t?void 0:t.id)===r.id,C=l?(null==d?void 0:d.highConfidence)||i(I,{}):(null==d?void 0:d.lowConfidence)||i(b,{});return o("button",e({className:m.aiReasoningButton,style:a,onClick:function(n){n.stopPropagation(),n.preventDefault(),v(f?null:p,f?null:r)}},{children:[C,i("i",f?{className:"pi pi-angle-up ".concat(l?m.aiReasoningIconHighConfidence:m.aiReasoningIconLowConfidence)}:{className:"pi pi-angle-down ".concat(l?m.aiReasoningIconHighConfidence:m.aiReasoningIconLowConfidence)})]}))},D=function(n){var t,r,a=n.children,d=n.node,c=n.customStyles,s=n.customIcons,v=l(Math.random().toString(36).slice(2)).current,g=u(P).expandedInfo,p=(null==g?void 0:g.rowId)===v,h=Array.isArray(null==d?void 0:d.children)?d.children.filter(function(n){return"element"===n.type}).length:1,f=null!==(r=null===(t=null==d?void 0:d.properties)||void 0===t?void 0:t.style)&&void 0!==r?r:void 0;return o(E.Provider,e({value:{rowId:v}},{children:[i("tr",e({style:f?{cssText:f}:void 0},{children:a})),p&&(null==g?void 0:g.aiReason)&&i("tr",e({style:{width:"100%"}},{children:i("td",e({colSpan:h||1,className:m.tableExpandedCell},{children:i("div",e({className:m.tableExpandedCellInner},{children:i("div",e({className:m.tableExpandedCellContent},{children:i(U,{aiReason:g.aiReason,customIcons:s,customStyles:{aiReasoningContent:null==c?void 0:c.aiReasoningContent,aiReasoningAccordion:null==c?void 0:c.aiReasoningAccordion,aiReasoningMarkdown:null==c?void 0:c.aiReasoningMarkdown,aiReasoningPill:null==c?void 0:c.aiReasoningPill,webCitation:null==c?void 0:c.webCitation,stormeeCitation:null==c?void 0:c.stormeeCitation,waveformCitation:null==c?void 0:c.waveformCitation,imageCitation:null==c?void 0:c.imageCitation,fileCitation:null==c?void 0:c.fileCitation,appModCitation:null==c?void 0:c.appModCitation,rcaCitation:null==c?void 0:c.rcaCitation,readFileCitation:null==c?void 0:c.readFileCitation,loadingCitations:null==c?void 0:c.loadingCitations,chatCitation:null==c?void 0:c.chatCitation}})}))}))}))}))]}))};var F=["del","ins"];function H(n){return function(n,e,i){var o=e.join("|");return n.replace(new RegExp("<(".concat(o,")>([\\s\\S]*?)<\\/\\1>"),"gi"),function(n,e,o){return"<".concat(e,">").concat(i(o),"</").concat(e,">")})}(n,F,function(n){return n.split(/(<[^>]+>)/g).map(function(n){return!n||/^<[^>]+>$/.test(n)?n:function(n){if(!n)return n;var e=[];return n.replace(/`([^`\n]+)`/g,function(n,i){var o=e.push(i)-1;return"@@CODE_SPAN_".concat(o,"@@")}).replace(/\*\*([\s\S]+?)\*\*/g,"<strong>$1</strong>").replace(/__([\s\S]+?)__/g,"<strong>$1</strong>").replace(/@@CODE_SPAN_(\d+)@@/g,function(n,i){var o,t=null!==(o=e[Number(i)])&&void 0!==o?o:"";return"<code>".concat(t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),"</code>")})}(n)}).join("")})}var z=function(r){var I,b=r.message,U=r.noMarkdownContent,E=r.useMarkdown,F=void 0===E||E,z=r.isParent,B=r.scenario,O=r.showUserStoryDiff,V=void 0!==O&&O,q=r.aiReasoningsForBlock,W=r.isCitationLoadingDisplay,G=void 0!==W&&W,Q=r.className;r.highConfidenceIcon,r.lowConfidenceIcon;var J=r.customStyles,K=r.customIcons,X=r.aiReasoningDiffView,Y=r.userStoryCitations,Z=r.artifactId,nn=r.isCraflow,en=r.onCraAccept,on=r.onCraReject,tn=r.craFlowConfig,rn=r.isDisplayHighlightControl,ln=void 0!==rn&&rn,an=l(null),dn=R(),cn=dn.userStory,sn=dn.inlineUpdateComponentConfig,un=dn.getAvgScoreForStory,vn=dn.setUserStory,gn=dn.aiReasoning,mn=dn.setAiReasoning,pn=dn.customIcons,hn=dn.searchQueryList,fn=dn.searchQueryReasoningIdList,Cn=dn.currentHighlightIndex,yn=dn.segmentComponentConfig,Sn=null!=K?K:null==pn?void 0:pn.userStoryIcons;null==J||J.searchHighlight;var wn=p(an),Rn=wn.search,In=wn.clear,bn=a("1"),xn=bn[0],Nn=bn[1],kn=a(null),An=kn[0],jn=kn[1],Un=l(new Map),Tn=d(function(n,e){jn(n&&e?{rowId:n,aiReason:e}:null)},[]),_n=Z?un(Z):0,Ln=a([]),Mn=Ln[0],Pn=Ln[1],En=function(n){return null==n?"":"string"==typeof n?n:"number"==typeof n?String(n):Array.isArray(n)?n.map(En).join(""):t.isValidElement(n)?En(n.props.children):""},$n=function(n){var e=n;return e=function(n){for(var e,i=/<updated[^>]*>[\s\S]*?<\/updated>/gi,o=[],t=new RegExp(i.source,i.flags);null!==(e=t.exec(n));){var r=e[0],l=r.match(/<deleted>([\s\S]*?)<\/deleted>/i),a=r.match(/<changed>([\s\S]*?)<\/changed>/i),d=function(n){return(n.match(/^\s*\d+\.\s/gm)||[]).length};o.push({index:e.index,endIndex:e.index+e[0].length,deletedItemCount:d((null==l?void 0:l[1])||""),changedItemCount:d((null==a?void 0:a[1])||"")})}if(0===o.length)return n;for(var c=n,s=function(n){var e=o[n],i=e.changedItemCount-e.deletedItemCount;if(0===i)return"continue";for(var t=!1,r=0,l=c.substring(0,e.index).split("\n").reverse();r<l.length;r++){var a=l[r].trim();if(""!==a){/^\d+\.\s/.test(a)&&(t=!0);break}}if(!t)return"continue";var d=e.endIndex,s=n+1<o.length?o[n+1].index:c.length,u=c.substring(d,s);u=u.replace(/^(\s*)(\d+)\.\s/gm,function(n,e,o){return"".concat(e).concat(parseInt(o,10)+i,". ")}),c=c.substring(0,d)+u+c.substring(s)},u=o.length-1;u>=0;u--)s(u);return c}(e=(e=(e=(e=(e=(e=e.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,function(n,e){var i=e.replace(/ai_reasoning\$(\d+)/g,function(n,e){return"ai_reasoning$".concat(e,"-legacy")});return"<deleted>".concat(i,"</deleted>")})).replace(/<generatedCode([^>]*)>([\s\S]*?)<\/generatedCode>/gi,function(n,e,i){var o=btoa(encodeURIComponent(i.trim()));return"\n\n<generatedCode".concat(e,' data-raw="').concat(o,'"></generatedCode>\n\n')})).replace(/^(\s*[-*]|\s*\d+\.)\s*\n?\s*(<updated\b)/gm,"$1 $2")).replace(/(<segment\b([^>]*)>)([\s\S]*?)(<\/segment>)/gi,function(n,e,i,o,t){var r=o.match(/<table[\s\S]*?<\/table>/i);if(r){var l=btoa(encodeURIComponent(r[0]));return"<segment".concat(i,' data-table="').concat(l,'"></segment>')}return n})).replace(/<updatedsegment([^>]*)>([\s\S]*?)<\/updatedsegment>/gi,function(n,e,i){if(/<table[\s>]/i.test(i)){var o=btoa(encodeURIComponent(i));return"<updatedsegment".concat(e,' data-raw="').concat(o,'"></updatedsegment>')}return n})).replace(/<updated([^>]*)>([\s\S]*?)<\/updated>/gi,function(n,i,o,t){var r=e.substring(0,t),l=r.lastIndexOf("\n"),a=/^\s+[-*]\s/.test(r.substring(l+1))||/^\s+\d+\.\s/.test(r.substring(l+1)),d=/^\s*(\d+\.|\s*[-*])\s+$/.test(r.substring(l+1));if(a||d){var c=o;return c=(c=(c=(c=c.replace(/(<deleted>)\s*\n?\s*[-*]\s+/gi,"$1\n")).replace(/(<changed>)\s*\n?\s*[-*]\s+/gi,"$1\n")).replace(/(<deleted>)\s*\n?\s*\d+\.\s+/gi,"$1\n")).replace(/(<changed>)\s*\n?\s*\d+\.\s+/gi,"$1\n"),"<updated".concat(i,">").concat(c,"</updated>")}return n})),e=function(n){var e=n.replace(/<deleted>([\s\S]*?)<\/deleted>/gi,function(n,e){var i=e.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <deleted>",{hadChange:i!==e}),"<deleted>".concat(i,"</deleted>")});return e.replace(/<changed>([\s\S]*?)<\/changed>/gi,function(n,e){var i=e.replace(/\n{2,}/g,"\n");return console.log("[normalizeCustomTags] collapseNewlines in <changed>",{hadChange:i!==e,preview:e.substring(0,120)}),"<changed>".concat(i,"</changed>")})}(e),e=H(e)},Dn=c(function(){return b?$n(b):b},[b]);s(function(){Pn(q||gn)},[q,gn]);var Fn=c(function(){return{upt:function(o){var t;o.node;var r=o.children,l=n(o,["node","children"]),a=null==l?void 0:l.id,d=a?null===(t=a.split("$"))||void 0===t?void 0:t[1]:null,c=gn.find(function(n){return n.id.toString()===d});return c?i(T,e({aiReason:c,customStyles:null==J?void 0:J.inlineUpdatedComponent,handleClickCognitiveDecision:null==sn?void 0:sn.handleClickCognitiveDecision,handleClickUpdatedPill:null==sn?void 0:sn.handleClickUpdatedPill,handleClickOutputValue:null==sn?void 0:sn.handleClickOutputValue,customIcons:null==sn?void 0:sn.customIcons},{children:r})):r},del:function(o){var t,r,l,a,d;o.node;var c=o.children,s=n(o,["node","children"]),u=s.aireason;console.log("Vikram & nitish",u);var v={};(null===(t=u.deviation_details)||void 0===t?void 0:t.resolved)&&"rejected"===(null===(r=u.deviation_details)||void 0===r?void 0:r.resolved)&&(console.log("Vikram & nitish inside if condition"),v={textDecoration:"none"});var g=(null===(l=u.deviation_details)||void 0===l?void 0:l.resolved)&&"rejected"===(null===(a=u.deviation_details)||void 0===a?void 0:a.resolved);return i("span",e({className:m.deleted,style:e(e(e({},null!==(d=null==J?void 0:J.deleted)&&void 0!==d?d:{}),v),{textDecoration:g?"none":"line-through"})},s,{onClick:s.onclick},{children:c}))},ins:function(o){var t=o.children,r=n(o,["children"]);return i("span",e({className:m.inserted,style:null==J?void 0:J.inserted},r,{onClick:r.onclick},{children:t}))},preserved:function(o){var t=o.children,r=n(o,["children"]);return i("span",e({className:m.preserved,style:null==J?void 0:J.preserved},r,{onClick:r.onclick},{children:t}))},h1:function(o){o.node;var t=n(o,["node"]);return i("h1",e({className:m.heading1,style:null==J?void 0:J.heading1},{children:t.children}))},h2:function(o){o.node;var t=n(o,["node"]);return i("h2",e({className:m.heading2,style:null==J?void 0:J.heading2},{children:t.children}))},h3:function(o){o.node;var t=n(o,["node"]);return i("h3",e({className:m.heading3,style:null==J?void 0:J.heading3},{children:t.children}))},b:function(o){o.node;var t=n(o,["node"]);return i("b",e({className:m.bold,style:null==J?void 0:J.bold},{children:null==t?void 0:t.children}))},p:function(o){o.node;var t=n(o,["node"]);return i("p",e({},t,{className:m.paragraph,style:null==J?void 0:J.paragraph},{children:t.children}))},updated:function(o){var t=o.node,r=n(o,["node"]);return i(y,e({},r,{showUserStoryDiff:V,currentUpdatedTagId:xn,setCurrentUpdatedTagId:Nn,userStory:cn,setUserStory:vn,setAiReasoning:mn,node:t,isCraflow:nn,onCraAccept:en,onCraReject:on,customStyles:null==J?void 0:J.updatedContent,craFlowConfig:tn}))},ol:function(o){var t,r,l,a=o.node,d=n(o,["node"]),c=null!==(l=null!==(r=null===(t=null==a?void 0:a.properties)||void 0===t?void 0:t.start)&&void 0!==r?r:null==d?void 0:d.start)&&void 0!==l?l:void 0;return i("ol",e({className:m.orderedList,style:null==J?void 0:J.olist},c?{start:Number(c)}:{},{children:null==d?void 0:d.children}))},ul:function(o){o.node;var t=n(o,["node"]);return i("ul",e({className:m.unorderedList,style:null==J?void 0:J.ulist},{children:null==t?void 0:t.children}))},table:function(n){var o=n.children;return i("div",e({className:m.tableWrapper},{children:i("table",e({className:m.table,style:null==J?void 0:J.table},{children:o}))}))},tr:function(n){var e=n.node,o=n.children;return i(D,{node:e,children:o,customStyles:J})},td:function(o){var t,r=o.node,l=o.children,a=null!==(t=null==r?void 0:r.properties)&&void 0!==t?t:{},d=a.style,c=n(a,["style"]);return i(M.Provider,e({value:!0},{children:i("td",e({},c,{style:d?{cssText:d}:void 0},{children:l}))}))},th:function(o){var t,r=o.node,l=o.children,a=null!==(t=null==r?void 0:r.properties)&&void 0!==t?t:{},d=a.style,c=n(a,["style"]);return i(M.Provider,e({value:!0},{children:i("th",e({},c,{style:d?{cssText:d}:void 0},{children:l}))}))},recommendation:function(o){var t;o.node;var r=n(o,["node"]),l="The AI has selected this content based on: ".concat((null===(t=null==r?void 0:r.children)||void 0===t?void 0:t[0])||"");return i(A,e({},r,{customStyles:null==J?void 0:J.recommendationBlock,label:l}))},a:function(e){var o,r,l;e.inline;var a=e.children;e.node;var d=n(e,["inline","children","node"]),c=u(M)||"true"==(null==d?void 0:d.table),s="".concat(null==d?void 0:d.href),v=null===(o=s.split("$"))||void 0===o?void 0:o[0],g=null===(r=s.split("$"))||void 0===r?void 0:r[1];if("ai_reasoning"===v){var m=(null!==(l=V?X:gn)&&void 0!==l?l:[]).find(function(n){return n.id.toString()===decodeURIComponent(g)}),p=fn.includes(g);if(m){if(c)return i($,{aiReason:m,customStyle:null==J?void 0:J.tableAiReasoning,customIcons:Sn,isHighConfidence:m.relevance_score>=N});var h="source"!==t.Children.toArray(a).join("").trim().toLowerCase();return i(x,{aiReason:m,isSourceHasHighlight:p,inlineLabel:a,isInlineCitation:h,customIcons:Sn,customStyles:{aiReasoningContent:null==J?void 0:J.aiReasoningContent,aiReasoningAccordion:null==J?void 0:J.aiReasoningAccordion,aiReasoningMarkdown:null==J?void 0:J.aiReasoningMarkdown,aiReasoningPill:null==J?void 0:J.aiReasoningPill,webCitation:null==J?void 0:J.webCitation,stormeeCitation:null==J?void 0:J.stormeeCitation,waveformCitation:null==J?void 0:J.waveformCitation,imageCitation:null==J?void 0:J.imageCitation,fileCitation:null==J?void 0:J.fileCitation,appModCitation:null==J?void 0:J.appModCitation,rcaCitation:null==J?void 0:J.rcaCitation,readFileCitation:null==J?void 0:J.readFileCitation,loadingCitations:null==J?void 0:J.loadingCitations,chatCitation:null==J?void 0:J.chatCitation,bigEnoughCitation:null==J?void 0:J.bigEnoughCitation}})}}return null},code:function(o){o.inline;var t=o.children,r=o.className;return o.node,n(o,["inline","children","className","node"]),/language-(\w+)/.exec(r||"")||(null==r?void 0:r.includes("language-"))?i("div",{children:i("code",e({className:m.blockCode,style:null==J?void 0:J.code},{children:t}))}):i("code",e({className:m.inlineCode,style:null==J?void 0:J.code},{children:t}))},learned:function(n){var o=n.children;return i(f,e({title:o,placement:"top"},{children:i(h,{size:16,className:m.learned})}))},generatedcode:function(e){e.node;var o=n(e,["node"]),t=(null==o?void 0:o.language)||"python",r=function(n){var e="";try{if(n["data-raw"])e=decodeURIComponent(atob(n["data-raw"]));else{var i=function(n){var e;return"string"==typeof n?n:Array.isArray(n)?n.map(i).join(""):(null===(e=null==n?void 0:n.props)||void 0===e?void 0:e.children)?i(n.props.children):""};e=i(n.children)}}catch(i){console.error("Error decoding generated code:",i),e=String(n.children)}return e}(o);return i(S,{title:"Generated Code",code:r,language:t,customStyles:{pill:null==J?void 0:J.generatedCodePill,content:null==J?void 0:J.generatedCodeContent}})},updatedsegment:function(e){var o,t,r,l,a=e.node,d=e.children,c=n(e,["node","children"]),s="".concat(null===(o=a.position)||void 0===o?void 0:o.start.line,"-").concat(null===(t=a.position)||void 0===t?void 0:t.start.column,"-").concat(null===(r=a.position)||void 0===r?void 0:r.end.line,"-").concat(null===(l=a.position)||void 0===l?void 0:l.end.column),u=function(n){if(!n["data-raw"])return null;try{return decodeURIComponent(atob(n["data-raw"]))}catch(n){return console.error("Error decoding segment raw content:",n),null}}(c),v=i("div",u?{dangerouslySetInnerHTML:{__html:C.sanitize(u)}}:{children:d});return i(_,{id:s,node:a,children:v,props:c,segmentComponentConfig:yn,customStyles:J,customIcons:K,extractText:En,isUpdatedSegment:!0})},segment:function(e){var o,t,r,l,a=e.node,d=e.children,c=n(e,["node","children"]),s="".concat(null===(o=a.position)||void 0===o?void 0:o.start.line,"-").concat(null===(t=a.position)||void 0===t?void 0:t.start.column,"-").concat(null===(r=a.position)||void 0===r?void 0:r.end.line,"-").concat(null===(l=a.position)||void 0===l?void 0:l.end.column);return i(_,{id:s,node:a,children:d,props:c,segmentComponentConfig:yn,customStyles:J,customIcons:K,extractText:En})}}},[Mn,tn,gn,Y,xn,V,b,K,hn,fn,J,yn]);return console.log("normalized markdown ",Dn),s(function(){if(an.current){if(hn.length){var n;if(0===fn.length||ln)requestAnimationFrame(function(){Rn([hn[Cn].replace(/\*/g,"")])});else{var e=an.current,i=new MutationObserver(function(){clearTimeout(n),n=setTimeout(function(){i.disconnect(),requestAnimationFrame(function(){Rn([hn[Cn].replace(/\*/g,"")])})},50)});i.observe(e,{childList:!0,subtree:!0})}return function(){clearTimeout(n)}}In()}},[hn,fn,Cn,ln]),i(P.Provider,e({value:{expandedInfo:An,setExpanded:Tn,reasonToRow:Un}},{children:o("div",e({ref:an,className:"".concat(m.container," ").concat("approving"!==B?m.wrapper:""," ").concat(Q||""),style:null==J?void 0:J.container},{children:[F?i(L,{children:i(v,e({components:Fn,rehypePlugins:[g]},{children:Dn}))}):U,_n>0&&i("div",e({className:m.confidenceScoreContainer,style:null==J?void 0:J.confidenceScoreContainer},{children:o("span",e({className:m.confidenceScore,style:null==J?void 0:J.confidenceScore},{children:[i(k,{size:14,color:(null==J?void 0:J.confidenceScoreIconColor)||"#166534"}),_n,"%"]}))})),G&&i("div",e({className:m.citationLoader,style:null==J?void 0:J.citationLoaderContainer},{children:i(w,{customStyles:{container:null==J?void 0:J.citationLoadingContainer,icon:null==J?void 0:J.citationLoadingIcon,text:null==J?void 0:J.citationLoadingText}})})),z&&i("div",e({style:e({},null===(I=null==J?void 0:J.attachedContext)||void 0===I?void 0:I.wrapper),className:"flex mt-5"},{children:i(j,{customStyles:null==J?void 0:J.attachedContext})}))]}))}))};export{z as default};
2
2
  //# sourceMappingURL=UserStoryWithCitation.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from"tslib";import{jsx as l,jsxs as i,Fragment as e}from"react/jsx-runtime";import{Divider as n}from"@mui/material";import{hexToOpacity as r}from"../../../utils/css.utils.js";import d from"./InlineUpdatedComponent.module.css.js";import t from"../../../icons/CognitiveDecision.js";import{Check as c,X as a,Undo2 as v,ChevronDown as u}from"lucide-react";import s,{useRef as p,useMemo as m}from"react";var f=function(f){var h,g,C,y,_,k,b,S,D,N,j,I,x,P,W,E,T,w,A,U,V=f.aiReason,O=f.children,R=f.customStyles,q=f.handleClickCognitiveDecision,z=f.handleClickUpdatedPill,B=f.handleClickOutputValue,F=f.customIcons,G=p(),H=p(function(){null==z||z(G.current,V)}),J=m(function(){var l=function(i,e){return s.Children.map(i,function(i){var n;if(!s.isValidElement(i))return i;var r=(null===(n=i.props)||void 0===n?void 0:n.children)?l(i.props.children,e):i.props.children,d=s.cloneElement(i,o(o({},i.props),{children:r}));return e(d)})};return l(O,function(o){return s.cloneElement(o,{onclick:H.current})})},[O]),K=(null===(h=V.deviation_details)||void 0===h?void 0:h.resolved)?"#303030":null===(y=null===(C=null===(g=V.deviation_details)||void 0===g?void 0:g.evaluation_outputs)||void 0===C?void 0:C.metadata)||void 0===y?void 0:y.label_color,L={color:K||"#000000",background:r(K||"#000000",25),border:"1px solid ".concat(r(K||"#000000",75))},M=K||"#000000",Q=r(K||"#000000",25),X=o({background:r(K||"#000000",75)},null==R?void 0:R.dividerStyle),Y=null,Z=null===(_=V.deviation_details)||void 0===_?void 0:_.resolved;return"accepted"===Z?Y=null!==(k=null==F?void 0:F.accepted)&&void 0!==k?k:l(c,{color:"#16A34A"}):"rejected"===Z?Y=null!==(b=null==F?void 0:F.rejected)&&void 0!==b?b:l(a,{color:"#DC2626"}):"reverted"===Z&&(Y=null!==(S=null==F?void 0:F.reverted)&&void 0!==S?S:l(v,{color:"#475569"})),i(e,{children:[l("div",o({className:d.resolvedStatus,style:null==R?void 0:R.resolvedIcon},{children:Y})),l("div",o({ref:G,id:V.id.toString(),onClick:function(o){o.stopPropagation(),null==z||z(o.currentTarget,V)},className:d.pillWrapper,style:null==R?void 0:R.pillStyleWrapper},{children:i("div",o({className:"".concat(d.pillComponent),style:o(o({},L),null===(D=null==R?void 0:R.pillComponent)||void 0===D?void 0:D.commonStyle)},{children:[l("span",{children:(null===(I=null===(j=null===(N=V.deviation_details)||void 0===N?void 0:N.evaluation_outputs)||void 0===j?void 0:j.metadata)||void 0===I?void 0:I.label_text)||""}),l(n,{className:d.dividerStyle,style:X}),l("span",o({onClick:function(o){B&&(o.stopPropagation(),null==B||B(o.currentTarget,V))}},{children:(null===(x=V.deviation_details)||void 0===x?void 0:x.resolved)?Y:null===(W=null===(P=null==V?void 0:V.deviation_details)||void 0===P?void 0:P.evaluation_outputs)||void 0===W?void 0:W.output_value})),l(n,{className:d.dividerStyle,style:X}),l("span",o({onClick:function(o){o.stopPropagation(),null==q||q(o.currentTarget,V)},className:d.cognitiveDecisionWrapper,style:null===(E=null==R?void 0:R.cognitiveDecisionIcon)||void 0===E?void 0:E.wrapper},{children:l(t,{color:(null===(T=null==R?void 0:R.cognitiveDecisionIcon)||void 0===T?void 0:T.color)||M,backgroundColor:(null===(w=null==R?void 0:R.cognitiveDecisionIcon)||void 0===w?void 0:w.backgroundColor)||Q})})),l("span",o({className:d.chevronWrapper,style:null===(A=null==R?void 0:R.Chevron)||void 0===A?void 0:A.wrapper},{children:l(u,{color:(null===(U=null==R?void 0:R.Chevron)||void 0===U?void 0:U.color)||K})}))]}))})),J]})};export{f as default};
1
+ import{__assign as o}from"tslib";import{jsx as l,jsxs as i,Fragment as e}from"react/jsx-runtime";import{Divider as n}from"@mui/material";import{hexToOpacity as r}from"../../../utils/css.utils.js";import d from"./InlineUpdatedComponent.module.css.js";import t from"../../../icons/CognitiveDecision.js";import{Check as a,X as c,Undo2 as v,ChevronDown as u}from"lucide-react";import s,{useRef as p,useMemo as m}from"react";var f=function(f){var h,g,C,y,_,k,b,S,D,N,j,I,x,P,W,E,T,w,A,U,V=f.aiReason,O=f.children,R=f.customStyles,q=f.handleClickCognitiveDecision,z=f.handleClickUpdatedPill,B=f.handleClickOutputValue,F=f.customIcons,G=p(),H=p(function(){null==z||z(G.current,V)}),J=m(function(){var l=function(i,e){return s.Children.map(i,function(i){var n;if(!s.isValidElement(i))return i;var r=(null===(n=i.props)||void 0===n?void 0:n.children)?l(i.props.children,e):i.props.children,d=s.cloneElement(i,o(o({},i.props),{children:r}));return e(d)})};return l(O,function(o){return s.cloneElement(o,{onclick:H.current,aireason:V})})},[O]),K=(null===(h=V.deviation_details)||void 0===h?void 0:h.resolved)?"#303030":null===(y=null===(C=null===(g=V.deviation_details)||void 0===g?void 0:g.evaluation_outputs)||void 0===C?void 0:C.metadata)||void 0===y?void 0:y.label_color,L={color:K||"#000000",background:r(K||"#000000",25),border:"1px solid ".concat(r(K||"#000000",75))},M=K||"#000000",Q=r(K||"#000000",25),X=o({background:r(K||"#000000",75)},null==R?void 0:R.dividerStyle),Y=null,Z=null===(_=V.deviation_details)||void 0===_?void 0:_.resolved;return"accepted"===Z?Y=null!==(k=null==F?void 0:F.accepted)&&void 0!==k?k:l(a,{color:"#16A34A"}):"rejected"===Z?Y=null!==(b=null==F?void 0:F.rejected)&&void 0!==b?b:l(c,{color:"#DC2626"}):"reverted"===Z&&(Y=null!==(S=null==F?void 0:F.reverted)&&void 0!==S?S:l(v,{color:"#475569"})),i(e,{children:[l("div",o({className:d.resolvedStatus,style:null==R?void 0:R.resolvedIcon},{children:Y})),l("div",o({ref:G,id:V.id.toString(),onClick:function(o){o.stopPropagation(),null==z||z(o.currentTarget,V)},className:d.pillWrapper,style:null==R?void 0:R.pillStyleWrapper},{children:i("div",o({className:"".concat(d.pillComponent),style:o(o({},L),null===(D=null==R?void 0:R.pillComponent)||void 0===D?void 0:D.commonStyle)},{children:[l("span",{children:(null===(I=null===(j=null===(N=V.deviation_details)||void 0===N?void 0:N.evaluation_outputs)||void 0===j?void 0:j.metadata)||void 0===I?void 0:I.label_text)||""}),l(n,{className:d.dividerStyle,style:X}),l("span",o({onClick:function(o){B&&(o.stopPropagation(),null==B||B(o.currentTarget,V))}},{children:(null===(x=V.deviation_details)||void 0===x?void 0:x.resolved)?Y:null===(W=null===(P=null==V?void 0:V.deviation_details)||void 0===P?void 0:P.evaluation_outputs)||void 0===W?void 0:W.output_value})),l(n,{className:d.dividerStyle,style:X}),l("span",o({onClick:function(o){o.stopPropagation(),null==q||q(o.currentTarget,V)},className:d.cognitiveDecisionWrapper,style:null===(E=null==R?void 0:R.cognitiveDecisionIcon)||void 0===E?void 0:E.wrapper},{children:l(t,{color:(null===(T=null==R?void 0:R.cognitiveDecisionIcon)||void 0===T?void 0:T.color)||M,backgroundColor:(null===(w=null==R?void 0:R.cognitiveDecisionIcon)||void 0===w?void 0:w.backgroundColor)||Q})})),l("span",o({className:d.chevronWrapper,style:null===(A=null==R?void 0:R.Chevron)||void 0===A?void 0:A.wrapper},{children:l(u,{color:(null===(U=null==R?void 0:R.Chevron)||void 0===U?void 0:U.color)||K})}))]}))})),J]})};export{f as default};
2
2
  //# sourceMappingURL=InlineUpdatedComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as o}from"react/jsx-runtime";import{useEffect as r,useMemo as t,useCallback as i,useState as s,useRef as n}from"react";import{USPContext as a}from"./UserStoryPicker.context.js";import{useUserStoryPickerState as d}from"./hooks/useUserStoryPickerState.js";import{useFilteredItems as c}from"./hooks/useFilteredItems.js";import{useUSPData as l}from"./hooks/useUSPData.js";import{themeToStyle as u}from"./UserStoryPicker.theme.js";import{TooltipProvider as S}from"./lib/Tooltip.js";import"./user-story-picker.css.js";import{cn as p}from"./lib/cn.js";var v={},j={};function P(P){var f,m,h=P.userEmail,g=P.adapter,M=P.defaultView,b=void 0===M?"recent":M,y=P.defaultSort,w=void 0===y?"newest":y,U=P.defaultType,I=void 0===U?"All Types":U,C=P.defaultRepo,F=void 0===C?"allRepository":C,T=P.gitUrl,k=void 0===T?"":T,L=P.pageSize,N=void 0===L?4:L,V=P.theme,x=P.classNames,H=void 0===x?v:x,B=P.renderProps,D=void 0===B?j:B,E=P.onProceed,R=P.onStorySelect,Q=P.onProjectSelect,_=P.onSearch,z=P.onViewChange,A=P.onSortChange,q=P.onShowMore,G=P.onViewMoreDescription,J=P.onFavoriteToggle,K=P.hidePopUp,O=void 0!==K&&K,W=P.disableTooltip,X=void 0!==W&&W,Y=P.tooltipClassName,Z=P.children,$=P.mediaCacheHooks,ee=P.showCitations,oe=void 0!==ee&&ee,re=d(b,w,I,F,N),te=re[0],ie=re[1];r(function(){null==z||z(te.viewMode)},[te.viewMode,z]);var se=l(h,k,g.fetchProjects,g.fetchUserStories,te.sortBy,te.typeBy,te.scopeRepo,te.searchQuery,te.sidebarSearchQuery,te.selectedProjectId,oe),ne=se.projects,ae=se.userStories,de=se.hasMoreProjects,ce=se.hasMoreStories,le=se.loadMoreProjects,ue=se.loadMoreStories,Se=se.isLoadingProjects,pe=se.isLoadingStories,ve=se.projectStories,je=se.hasMoreProjectStories,Pe=se.loadMoreProjectStories,fe=se.isLoadingProjectStories,me=se.sidebarProjects,he=se.hasMoreSidebarProjects,ge=se.loadMoreSidebarProjects,Me=se.scopedUserStories,be=se.toggleScopedUserStories,ye=se.isLoadingSidebarProjects,we=se.favoriteStories,Ue=se.hasMoreFavoriteStories,Ie=se.loadMoreFavoriteStories,Ce=se.isLoadingFavoriteStories,Fe=se.updateFavorite,Te=te.selectedProjectId?je:ce,ke=te.selectedProjectId?Pe:ue,Le=te.selectedProjectId?fe:pe,Ne=t(function(){var e;return null!==(e=ne.find(function(e){return e.id===te.selectedProjectId}))&&void 0!==e?e:null},[ne,te.selectedProjectId]),Ve=t(function(){return Ne?ve.map(function(o){return e(e({},o),{projectName:Ne.name})}):ve},[ve,Ne]),xe=t(function(){var e;return null!==(e=(te.selectedProjectId?Ve:ae).find(function(e){return e.user_story_id===te.selectedStoryId}))&&void 0!==e?e:null},[te.selectedProjectId,Ve,ae,te.selectedStoryId]),He=c(ae,ne,te,Ve,we),Be=He.filteredStories,De=He.filteredProjects,Ee=He.visibleStories,Re=He.visibleProjects,Qe="favorites"===te.viewMode?(null!==(f=null==Be?void 0:Be.length)&&void 0!==f?f:0)>(null!==(m=null==Ee?void 0:Ee.length)&&void 0!==m?m:0):Te,_e=i(function(e,o){Fe(e,o),null==J||J(e,o)},[Fe,J]),ze=t(function(){return{adapter:g,state:te,dispatch:ie,userStories:ae,projects:ne,filteredStories:Be,filteredProjects:De,visibleStories:Ee,visibleProjects:Re,hasMoreStories:Qe,hasMoreProjects:de,selectedStory:xe,selectedProject:Ne,classNames:H,renderProps:D,mediaCacheHooks:$,showCitations:oe,loadMoreProjects:le,loadMoreStories:ke,isLoadingProjects:Se,isLoadingStories:Le,scopedUserStories:Me,toggleScopedUserStories:be,sidebarProjects:me,hasMoreSidebarProjects:he,loadMoreSidebarProjects:ge,isLoadingSidebarProjects:ye,favoriteStories:we,hasMoreFavoriteStories:Ue,loadMoreFavoriteStories:Ie,isLoadingFavoriteStories:Ce,onProceed:E,onStorySelect:R,onProjectSelect:Q,onSearch:_,onViewChange:z,onSortChange:A,onShowMore:q,onViewMoreDescription:G,onFavoriteToggle:_e,hidePopUp:O,disableTooltip:X,tooltipClassName:Y}},[g,te,ie,ae,ne,Be,De,Ee,Re,Te,Qe,de,xe,Ne,H,D,le,ke,Se,Le,me,he,ge,ye,we,Ue,Ie,Me,be,Ce,E,$,oe,R,Q,_,z,A,q,G,_e,O,X,Y]),Ae=s(!1),qe=Ae[0],Ge=Ae[1],Je=n(null);r(function(){if(g.onHostEvent){var e=g.onHostEvent("cw-project-glow",function(){Ge(!0),Je.current&&clearTimeout(Je.current),Je.current=setTimeout(function(){Ge(!1)},3e3)});return function(){Je.current&&(clearTimeout(Je.current),Je.current=null),e&&e()}}},[g]);var Ke=["usp-root",H.root].filter(Boolean).join(" "),Oe=V?u(V):void 0;return o(S,{children:o(a.Provider,e({value:ze},{children:o("div",e({className:p(Ke,"rounded-lg flex-1 min-h-0 overflow-auto border-2 pt-2",qe?"border-primary animate ease-in-out duration-500 mb-4":"transition-colors duration-500 border-transparent shadow-none"),style:Oe},{children:Z}))}))})}export{P as UserStoryPickerRoot};
1
+ import{__assign as e}from"tslib";import{jsx as o}from"react/jsx-runtime";import{useEffect as r,useMemo as t,useCallback as i,useState as s,useRef as a}from"react";import{USPContext as n}from"./UserStoryPicker.context.js";import{useUserStoryPickerState as d}from"./hooks/useUserStoryPickerState.js";import{useFilteredItems as c}from"./hooks/useFilteredItems.js";import{useUSPData as l}from"./hooks/useUSPData.js";import{themeToStyle as u}from"./UserStoryPicker.theme.js";import{TooltipProvider as S}from"./lib/Tooltip.js";import"./user-story-picker.css.js";import{cn as p}from"./lib/cn.js";var v={},j={};function f(f){var P,m,h=f.userEmail,g=f.adapter,M=f.defaultView,b=void 0===M?"recent":M,y=f.defaultSort,w=void 0===y?"newest":y,F=f.defaultType,U=void 0===F?"All Types":F,k=f.defaultRepo,I=void 0===k?"allRepository":k,C=f.gitUrl,T=void 0===C?"":C,L=f.pageSize,N=void 0===L?4:L,V=f.theme,x=f.classNames,H=void 0===x?v:x,B=f.renderProps,D=void 0===B?j:B,E=f.onProceed,R=f.onStorySelect,Q=f.onProjectSelect,W=f.onSearch,_=f.onViewChange,z=f.onSortChange,A=f.onShowMore,q=f.onViewMoreDescription,G=f.onFavoriteToggle,J=f.hidePopUp,K=void 0!==J&&J,O=f.disableTooltip,X=void 0!==O&&O,Y=f.tooltipClassName,Z=f.children,$=f.mediaCacheHooks,ee=f.showCitations,oe=void 0!==ee&&ee,re=f.featureFlagWidgetMaker,te=void 0===re||re,ie=d(b,w,U,I,N),se=ie[0],ae=ie[1];r(function(){null==_||_(se.viewMode)},[se.viewMode,_]);var ne=l(h,T,g.fetchProjects,g.fetchUserStories,se.sortBy,se.typeBy,se.scopeRepo,se.searchQuery,se.sidebarSearchQuery,se.selectedProjectId,oe),de=ne.projects,ce=ne.userStories,le=ne.hasMoreProjects,ue=ne.hasMoreStories,Se=ne.loadMoreProjects,pe=ne.loadMoreStories,ve=ne.isLoadingProjects,je=ne.isLoadingStories,fe=ne.projectStories,Pe=ne.hasMoreProjectStories,me=ne.loadMoreProjectStories,he=ne.isLoadingProjectStories,ge=ne.sidebarProjects,Me=ne.hasMoreSidebarProjects,be=ne.loadMoreSidebarProjects,ye=ne.scopedUserStories,we=ne.toggleScopedUserStories,Fe=ne.isLoadingSidebarProjects,Ue=ne.favoriteStories,ke=ne.hasMoreFavoriteStories,Ie=ne.loadMoreFavoriteStories,Ce=ne.isLoadingFavoriteStories,Te=ne.updateFavorite,Le=se.selectedProjectId?Pe:ue,Ne=se.selectedProjectId?me:pe,Ve=se.selectedProjectId?he:je,xe=t(function(){var e;return null!==(e=de.find(function(e){return e.id===se.selectedProjectId}))&&void 0!==e?e:null},[de,se.selectedProjectId]),He=t(function(){return xe?fe.map(function(o){return e(e({},o),{projectName:xe.name})}):fe},[fe,xe]),Be=t(function(){var e;return null!==(e=(se.selectedProjectId?He:ce).find(function(e){return e.user_story_id===se.selectedStoryId}))&&void 0!==e?e:null},[se.selectedProjectId,He,ce,se.selectedStoryId]),De=c(ce,de,se,He,Ue),Ee=De.filteredStories,Re=De.filteredProjects,Qe=De.visibleStories,We=De.visibleProjects,_e="favorites"===se.viewMode?(null!==(P=null==Ee?void 0:Ee.length)&&void 0!==P?P:0)>(null!==(m=null==Qe?void 0:Qe.length)&&void 0!==m?m:0):Le,ze=i(function(e,o){Te(e,o),null==G||G(e,o)},[Te,G]),Ae=t(function(){return{adapter:g,state:se,dispatch:ae,userStories:ce,projects:de,filteredStories:Ee,filteredProjects:Re,visibleStories:Qe,visibleProjects:We,hasMoreStories:_e,hasMoreProjects:le,selectedStory:Be,selectedProject:xe,classNames:H,renderProps:D,mediaCacheHooks:$,showCitations:oe,featureFlagWidgetMaker:te,loadMoreProjects:Se,loadMoreStories:Ne,isLoadingProjects:ve,isLoadingStories:Ve,scopedUserStories:ye,toggleScopedUserStories:we,sidebarProjects:ge,hasMoreSidebarProjects:Me,loadMoreSidebarProjects:be,isLoadingSidebarProjects:Fe,favoriteStories:Ue,hasMoreFavoriteStories:ke,loadMoreFavoriteStories:Ie,isLoadingFavoriteStories:Ce,onProceed:E,onStorySelect:R,onProjectSelect:Q,onSearch:W,onViewChange:_,onSortChange:z,onShowMore:A,onViewMoreDescription:q,onFavoriteToggle:ze,hidePopUp:K,disableTooltip:X,tooltipClassName:Y}},[g,se,ae,ce,de,Ee,Re,Qe,We,Le,_e,le,Be,xe,H,D,Se,Ne,ve,Ve,ge,Me,be,Fe,Ue,ke,Ie,ye,we,Ce,E,$,oe,te,R,Q,W,_,z,A,q,ze,K,X,Y]),qe=s(!1),Ge=qe[0],Je=qe[1],Ke=a(null);r(function(){if(g.onHostEvent){var e=g.onHostEvent("cw-project-glow",function(){Je(!0),Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(function(){Je(!1)},3e3)});return function(){Ke.current&&(clearTimeout(Ke.current),Ke.current=null),e&&e()}}},[g]);var Oe=["usp-root",H.root].filter(Boolean).join(" "),Xe=V?u(V):void 0;return o(S,{children:o(n.Provider,e({value:Ae},{children:o("div",e({className:p(Oe,"rounded-lg flex-1 min-h-0 overflow-auto border-2 pt-2",Ge?"border-primary animate ease-in-out duration-500 mb-4":"transition-colors duration-500 border-transparent shadow-none"),style:Xe},{children:Z}))}))})}export{f as UserStoryPickerRoot};
2
2
  //# sourceMappingURL=UserStoryPicker.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as o,useRef as t,useCallback as l,useEffect as s}from"react";import{useUSPContext as i}from"../UserStoryPicker.context.js";function u(){return n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"m18 15-6-6-6 6"})}))}function a(){return n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"m6 9 6 6 6-6"})}))}var c=[{value:"All Types",label:"All Types"},{value:"ECG Technical User Story",label:"ECG Technical User Story"},{value:"Widget Maker",label:"Widget Maker"}];function p(p){var d,m,y=p.options,v=void 0===y?c:y,f=p.className,h=p.style;p.labelStyle;var w=p.selectStyle,g=i(),k=g.state,b=g.dispatch,_=g.classNames,T=g.renderProps,B=g.onTypeChange,N=o(!1),j=N[0],x=N[1],C=t(null),E=l(function(e){b({type:"SET_TYPE",payload:e}),null==B||B(e),x(!1)},[b,B]);if(s(function(){function e(e){C.current&&!C.current.contains(e.target)&&x(!1)}return j&&document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[j]),T.renderTypeDropdown)return T.renderTypeDropdown(k.typeBy,E,v);var L=null!==(m=null===(d=v.find(function(e){return e.value===k.typeBy}))||void 0===d?void 0:d.label)&&void 0!==m?m:v[0].label,S=["usp-user-story-scope",_.scopeDropdown,f].filter(Boolean).join(" ");return r("div",e({ref:C,className:[S,j&&"open"].filter(Boolean).join(" "),style:h},{children:[r("button",e({type:"button",className:"usp-user-story-scope__trigger",style:w,onClick:function(){return x(function(e){return!e})}},{children:[n("span",e({className:"usp-user-story-scope__trigger-label"},{children:L})),n("span",e({className:"usp-user-story-scope__chevron"},{children:n(j?u:a,{})}))," "]})),j&&n("ul",e({className:"usp-user-story-scope__menu"},{children:v.map(function(r){return n("li",e({className:["usp-user-story-scope__option",k.typeBy===r.value&&"active"].filter(Boolean).join(" "),onClick:function(){return E(r.value)}},{children:r.label}),r.value)})}))]}))}export{p as TypeDropdown};
1
+ import{__assign as e}from"tslib";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as t,useRef as o,useCallback as l,useEffect as s}from"react";import{useUSPContext as i}from"../UserStoryPicker.context.js";function u(){return n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"m18 15-6-6-6 6"})}))}function a(){return n("svg",e({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"m6 9 6 6 6-6"})}))}var c=[{value:"All Types",label:"All Types"},{value:"ECG Technical User Story",label:"ECG Technical User Story"},{value:"Widget Maker",label:"Widget Maker"}];function p(p){var d,m,y=p.options,f=p.className,v=p.style;p.labelStyle;var h=p.selectStyle,g=i(),k=g.state,w=g.dispatch,b=g.classNames,_=g.renderProps,T=g.onTypeChange,B=g.featureFlagWidgetMaker,N=null!=y?y:B?c.filter(function(e){return"Widget Maker"!==e.value}):c,j=t(!1),x=j[0],C=j[1],E=o(null),L=l(function(e){w({type:"SET_TYPE",payload:e}),null==T||T(e),C(!1)},[w,T]);if(s(function(){function e(e){E.current&&!E.current.contains(e.target)&&C(!1)}return x&&document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[x]),_.renderTypeDropdown)return _.renderTypeDropdown(k.typeBy,L,N);var S=null!==(m=null===(d=N.find(function(e){return e.value===k.typeBy}))||void 0===d?void 0:d.label)&&void 0!==m?m:N[0].label,W=["usp-user-story-scope",b.scopeDropdown,f].filter(Boolean).join(" ");return r("div",e({ref:E,className:[W,x&&"open"].filter(Boolean).join(" "),style:v},{children:[r("button",e({type:"button",className:"usp-user-story-scope__trigger",style:h,onClick:function(){return C(function(e){return!e})}},{children:[n("span",e({className:"usp-user-story-scope__trigger-label"},{children:S})),n("span",e({className:"usp-user-story-scope__chevron"},{children:n(x?u:a,{})}))," "]})),x&&n("ul",e({className:"usp-user-story-scope__menu"},{children:N.map(function(r){return n("li",e({className:["usp-user-story-scope__option",k.typeBy===r.value&&"active"].filter(Boolean).join(" "),onClick:function(){return L(r.value)}},{children:r.label}),r.value)})}))]}))}export{p as TypeDropdown};
2
2
  //# sourceMappingURL=TypeDropdown.js.map