chordia-ui 3.7.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CustomFilterChips.cjs.js +1 -1
- package/dist/CustomFilterChips.cjs.js.map +1 -1
- package/dist/CustomFilterChips.es.js +2 -2
- package/dist/CustomFilterChips.es.js.map +1 -1
- package/dist/components/UpdatedInteractionDetails.cjs.js +2 -2
- package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
- package/dist/components/UpdatedInteractionDetails.es.js +14 -13
- package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +13 -13
- package/src/components/UpdatedInteractionDetails/UpdatedThreads.jsx +1 -0
- package/src/components/common/CustomFilterChips.jsx +5 -1
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
from { transform: rotate(0deg); }
|
|
13
13
|
to { transform: rotate(360deg); }
|
|
14
14
|
}
|
|
15
|
-
`}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,padding:"48px 24px"},children:[e.jsxs("svg",{width:48,height:48,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"coaching-spinner-spin 1.2s linear infinite"},children:[e.jsx("path",{d:"M43 24C43 26.4951 42.5086 28.9658 41.5537 31.271C40.5989 33.5762 39.1993 35.6707 37.435 37.435C35.6707 39.1993 33.5762 40.5989 31.271 41.5537C28.9658 42.5086 26.4951 43 24 43C21.5049 43 19.0342 42.5086 16.729 41.5537C14.4238 40.5989 12.3293 39.1993 10.565 37.435C8.80066 35.6707 7.40113 33.5762 6.44629 31.271C5.49145 28.9658 5 26.4951 5 24",stroke:"#F3E7C7",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("path",{d:"M12 24C12 22.4241 12.3104 20.8637 12.9134 19.4078C13.5165 17.9519 14.4004 16.629 15.5147 15.5147C16.629 14.4004 17.9519 13.5165 19.4078 12.9134C20.8637 12.3104 22.4241 12 24 12C25.5759 12 27.1363 12.3104 28.5922 12.9134C30.0481 13.5165 31.371 14.4004 32.4853 15.5147C33.5996 16.629 34.4835 17.9519 35.0866 19.4078C35.6896 20.8637 36 22.4241 36 24",stroke:"#00A66E",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("path",{d:"M20 24C20 24.5253 20.1035 25.0454 20.3045 25.5307C20.5055 26.016 20.8001 26.457 21.1716 26.8284C21.543 27.1999 21.984 27.4945 22.4693 27.6955C22.9546 27.8965 23.4747 28 24 28C24.5253 28 25.0454 27.8965 25.5307 27.6955C26.016 27.4945 26.457 27.1999 26.8284 26.8284C27.1999 26.457 27.4945 26.016 27.6955 25.5307C27.8965 25.0454 28 24.5253 28 24",stroke:"#F3E7C7",strokeWidth:"4",strokeLinecap:"round"})]}),e.jsx("span",{style:{fontSize:14,color:A.muted,fontWeight:500,textAlign:"center"},children:"Synthesizing coaching summary..."})]})]});if(n)return e.jsx("div",{style:{fontSize:14,color:A.muted},children:"Unable to generate coaching summary."});if(!t)return null;const o=t.strengths||[],s=t.improvements||[],l=typeof t.one_liner=="string"?t.one_liner:((h=t.one_liner)==null?void 0:h.text)||"",g=typeof t.context=="string"?t.context:((x=t.context)==null?void 0:x.text)||"";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,background:"#FFF"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(u.ShieldCheck,{size:20,color:A.accent,strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:A.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textTransform:"uppercase"},children:"Coaching Summary"})]}),l&&e.jsx("div",{style:{fontSize:14,fontWeight:500,color:A.strong,fontFamily:"var(--font-sans)",lineHeight:1.5},children:l}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,justifyContent:"space-between"},children:[g&&e.jsx("div",{style:{fontSize:14,fontWeight:400,color:A.muted,fontFamily:"var(--font-sans)",lineHeight:1.5,flex:1},children:g}),t.overall&&e.jsx(en,{overall:t.overall})]}),(o.length>0||s.length>0)&&e.jsxs("div",{style:{display:"flex",gap:24,paddingTop:24,borderTop:`1px solid ${A.absent}`},children:[e.jsx(et,{icon:e.jsx(u.TrendingUp,{size:14,color:A.strong,strokeWidth:1.5}),label:"Key Strengths",items:o}),e.jsx(et,{icon:e.jsx(u.Lightbulb,{size:14,color:A.strong,strokeWidth:1.5}),label:"Improvements",items:s})]})]})};function nn(t){const i=Math.floor(t/60),n=Math.round(t%60);return`${i}:${n.toString().padStart(2,"0")}`}const rn={display:"flex",justifyContent:"space-between",padding:"8px 8px 12px 8px",alignItems:"center",gap:24,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)"},tt={display:"flex",flexDirection:"column",flex:"1 0 0",gap:0,minWidth:0},dt=({meta:t={},callPurpose:i={},classification:n={},dimensions:o=[],outcomeQuality:s="Neutral",onMoreDetails:l,moreDetails:g=[],resolutionOutcome:h,customerIntent:x,canShowEditButton:W=!1,onEditInteraction:v})=>{const[S,a]=d.useState(!1),j=d.useRef(null),k=t.duration_seconds!=null?nn(t.duration_seconds):null,w=t.message_count,G=i.interaction_driver,H=n.interaction_paradigm,b=p=>o.find(_=>(_.key||"").toLowerCase().includes(p)),I=b("resolution_outcome"),M=b("customer_intent"),L=b("outcome_quality"),T=p=>p?p.replace(/_/g," ").replace(/\b\w/g,_=>_.toUpperCase()):null,O=s!=="Neutral"?s:L?T(L.value):s,m=h??(I?T(I.value):null),y=x??(M?T(M.value):null),c=new Set(["resolution_outcome","customer_intent","outcome_quality"].map(p=>`dim.${p}`)),D=o.filter(p=>!c.has(p.key)),V=[],Z=[[k!=null?{label:"Duration",value:k}:null,w!=null?{label:"Messages",value:w}:null],[G!=null?{label:"Driver",value:G}:null,H!=null?{label:"Paradigm",value:H}:null]];for(let p=0;p<D.length;p+=2){const _=D[p]?{label:D[p].display_name||D[p].label||D[p].key,value:T(D[p].value)}:null,X=D[p+1]?{label:D[p+1].display_name||D[p+1].label||D[p+1].key,value:T(D[p+1].value)}:null;Z.push([_,X])}Z.push([{label:"Outcome Quality",value:O},{isMoreDetails:!0}]),Z.forEach(p=>V.push(p));const Q=[m!=null&&{label:"Resolution Outcome",value:m},y!=null&&{label:"Customer Intent",value:y},...g||[]].filter(Boolean);d.useEffect(()=>{if(!S)return;const p=_=>{j.current&&!j.current.contains(_.target)&&a(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[S]);const J=p=>e.jsxs("div",{style:rn,children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:p.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:p.value})]},p.label),re=()=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"8px 8px 12px 8px",fontFamily:"var(--font-sans)",borderBottom:"none",minHeight:33},children:[e.jsxs("button",{onClick:()=>{a(p=>!p),l&&!S&&l()},style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",whiteSpace:"nowrap",flexShrink:0},children:[e.jsx("span",{children:"More Details"}),S?e.jsx(u.ChevronUp,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(u.ChevronDown,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5})]}),W&&e.jsxs("button",{onClick:v||(()=>{}),style:{display:"flex",alignItems:"center",gap:6,padding:"5px 12px",background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:12,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",cursor:"pointer",flexShrink:0},children:[e.jsx(u.Pencil,{size:15,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,lineHeight:"normal"},children:"Edit"})]})]},"more-details");return e.jsxs("div",{ref:j,style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0,position:"relative",overflow:"visible"},children:[V.map((p,_)=>{var X;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24,alignSelf:"stretch",flexWrap:"nowrap"},children:[e.jsx("div",{style:tt,children:p[0]&&!p[0].isMoreDetails?J(p[0]):e.jsx("div",{style:{flex:1}})}),e.jsx("div",{style:tt,children:p[1]&&!p[1].isMoreDetails?J(p[1]):(X=p[1])!=null&&X.isMoreDetails?re():e.jsx("div",{style:{flex:1}})})]},_)}),S&&Q.length>0&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:340,flexDirection:"column",alignItems:"flex-start",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxShadow:"-2px 2px 2px 0 rgba(0, 0, 0, 0.25)",overflow:"hidden",fontFamily:"var(--font-sans)",zIndex:50},children:[e.jsx("div",{style:{padding:"12px 16px",fontSize:13,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",alignSelf:"stretch"},children:"More details"}),Q.map(p=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",gap:24,fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",alignSelf:"stretch"},children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:p.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"120%",textAlign:"right"},children:p.value})]},p.label))]})]})},F={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",white:"var(--Grey-White, #FFF)",cardBg:"var(--surface-warm-40, rgba(243, 241, 229, 0.40))"},N=1.2,nt=3,it=t=>t!=null?Math.round(t*100)+"%":"—",rt=t=>{if(t==null)return"—";const i=(t*100).toFixed(1);return t>0?`+${i}pp`:`${i}pp`},ct=({outcomeLift:t,driverLabels:i=[]})=>{var a;if(!t||t.lift==null)return null;const n=t.p_expected,o=t.p_full,s=t.lift_raw??(o!=null&&n!=null?o-n:null),l=t.lift,g=(a=t.interpretation)!=null&&a.lift_band?t.interpretation.lift_band.replace(/_/g," "):l>=0?"Positive":"Negative",h=g.charAt(0).toUpperCase()+g.slice(1),W=/negative/i.test(g)?u.ThumbsDown:u.ThumbsUp,v=i.slice(0,nt),S=i.length-nt;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,gap:24,borderRadius:8,border:`1px solid ${F.absent}`,background:F.cardBg,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:32},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:"Agent Lift Analysis"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.strong,lineHeight:N},children:"vs. Average Agent:"}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:F.strong,lineHeight:N},children:rt(l)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,paddingLeft:8,borderLeft:`1px solid ${F.absent}`},children:[e.jsx(W,{size:14,color:F.strong}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:F.strong,lineHeight:N},children:h})]})]})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N},children:it(n)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Expected Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"Based on call type & difficulty"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${F.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N},children:rt(s)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Agent Impact"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"Behavior-driven change"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${F.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:it(o)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:600,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Predicted Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"With agent behaviors"})]})]})]})]}),i.length>0&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:"Key Drivers"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[v.map((j,k)=>e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${F.absent}`,background:F.white},children:e.jsx("span",{style:{fontSize:12,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:j})},k)),S>0&&e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${F.absent}`,background:F.white},children:e.jsxs("span",{style:{fontSize:12,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:["+ ",S]})})]})]})]})},st=({children:t,size:i=28,onClick:n,title:o})=>{const[s,l]=d.useState(!1);return e.jsx("div",{title:o,onClick:n,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:s?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},ft=({signals:t={signals:[],present_count:0,total_signals_evaluated:0},expandedSignals:i=new Set,toggleSignal:n=()=>{},playEvidence:o=()=>{},highlightTurns:s=()=>{},onShowInTranscript:l=()=>{},timelinePlaying:g=!1,currentTimeSeconds:h=0})=>{const x=(t==null?void 0:t.signals)??[],W=(t==null?void 0:t.present_count)??x.length,v=a=>{const j=Math.floor(a/6e4),k=Math.floor(a%6e4/1e3);return`${j.toString().padStart(2,"0")}:${k.toString().padStart(2,"0")}`},S=a=>g&&a.start_ms!=null&&h*1e3>=a.start_ms&&h*1e3<=(a.end_ms??a.start_ms+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",alignSelf:"stretch",width:"100%",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",flexShrink:0},children:e.jsx(u.FileSignal,{size:20,color:"#2E3236",strokeWidth:1.5})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flex:1},children:[e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Signals"}),e.jsxs("span",{style:{fontSize:14,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:[W," Signals Detected"]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",background:"var(--Grey-White, #FFF)",gap:8},children:[x.length===0&&e.jsx("div",{style:{padding:"8px 0",fontSize:14,color:"var(--Grey-Muted, #808183)"},children:"No signals detected."}),x.map((a,j)=>{var H,b,I;const k=a.key??a.id??j,w=i.has(k),G=((H=a.observations)==null?void 0:H.length)??0;return e.jsxs("div",{id:`signal-${k}`,style:{display:"flex",flexDirection:"column",width:"100%",gap:8},children:[e.jsxs("button",{onClick:()=>n(k),style:{display:"flex",padding:"8px 0",alignItems:"center",gap:12,alignSelf:"stretch",width:"100%",background:"none",border:"none",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",cursor:"pointer"},children:[e.jsxs("span",{style:{flex:1,textAlign:"left",fontSize:14,fontWeight:600,color:"var(--text-dark, #0B0A0A)",lineHeight:1.71},children:[a.display_name||((b=a.key)==null?void 0:b.replace(/_/g," ")),G>0&&e.jsxs("span",{style:{fontWeight:600,color:"var(--text-dark, #0B0A0A)",marginLeft:6},children:["(",G,")"]})]}),w?e.jsx(u.ChevronUp,{size:20,color:"#767473"}):e.jsx(u.ChevronDown,{size:20,color:"#767473"})]}),w&&((I=a.observations)==null?void 0:I.length)>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0},children:a.observations.map((M,L)=>{var T,O,m;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0",justifyContent:"space-between"},children:[e.jsx("span",{style:{flex:1,fontSize:14,fontWeight:400,color:"var(--text-subtle-warm, #767473)",lineHeight:1.5},children:M.reason||M.explanation}),((O=(T=M.evidence)==null?void 0:T[0])==null?void 0:O.start_ms)!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(st,{size:28,title:"Show in transcript",onClick:y=>{y.stopPropagation(),l(M.evidence[0].start_ms)},children:e.jsx(u.ScrollText,{size:16,color:"#808183",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.2,whiteSpace:"nowrap"},children:v(M.evidence[0].start_ms)})]})]}),(m=M.evidence)==null?void 0:m.map((y,c)=>{const D=y.start_ms!=null&&y.end_ms!=null;return y.text&&e.jsxs("div",{onClick:V=>{V.stopPropagation(),D&&o(y)},onMouseEnter:()=>s(y.turn_ids??[]),onMouseLeave:()=>s([]),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",cursor:D?"pointer":"default"},children:[D&&e.jsx(st,{size:28,children:S(y)?e.jsx(u.PauseCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(u.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2},children:["“",y.text,"”"]})]},c)})]},M.key??L)})})]},k)})]})]})},P={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",white:"var(--Grey-White, #FFF)",accent:"var(--rail-orange, #C98A5A)",track:"var(--rail-surface-2, #E3E1D7)",infoIcon:"var(--color-input-border, #ACACAD)"},sn=({score:t=4,minScore:i=0,maxScore:n=5})=>{const v=Number(t),S=Number.isFinite(v)?Math.min(Math.max(v,i),n):i,a=n>i?(S-i)/(n-i)*5:0,j=180/5,k=H=>{const b=H*Math.PI/180;return{x:121.5+85*Math.cos(b),y:123-85*Math.sin(b)}},w=(H,b)=>{const I=k(H),M=k(b),L=H-b>180?1:0;return`M ${I.x} ${I.y} A 85 85 0 ${L} 1 ${M.x} ${M.y}`},G=2;return e.jsx("svg",{width:"100%",viewBox:"0 0 243 130",fill:"none",style:{maxWidth:243},children:Array.from({length:5},(H,b)=>{const I=180-b*j-(b>0?G/2:0),M=180-(b+1)*j+(b<5-1?G/2:0),L=Math.max(0,Math.min(1,a-b)),T=w(I,M);return e.jsxs("g",{children:[e.jsx("path",{d:T,stroke:P.track,strokeWidth:30,strokeLinecap:"butt",fill:"none"}),L>0&&e.jsx("path",{d:T,stroke:P.strong,strokeWidth:30,strokeLinecap:"butt",fill:"none",pathLength:1,strokeDasharray:`${L} 1`})]},b)})})},ln=({value:t=0,maxValue:i=5})=>{const n=Number(t),o=Number.isFinite(n)?Math.min(Math.max(n,0),i):0;return e.jsx("div",{style:{display:"flex",gap:2},children:Array.from({length:i},(s,l)=>{const g=Math.max(0,Math.min(1,o-l));return e.jsx("div",{style:{width:22,height:6,borderRadius:1,background:P.track,overflow:"hidden"},children:g>0&&e.jsx("div",{style:{width:`${g*100}%`,height:"100%",background:P.strong}})},l)})})},on={CSAT:"Predicted Customer Satisfaction",Resolution:"Predicted Resolution: was the issue fully resolved?","Process Adherence":"Process Adherence: Did the agent follow procedures?",Communication:"Predicted Communication Quality: Clarity, Empathy, Professionalism"},an=({text:t,children:i})=>{const[n,o]=d.useState(!1),s=d.useRef(null),[l,g]=d.useState({top:0,left:0}),h=()=>{if(s.current){const x=s.current.getBoundingClientRect();g({top:x.top-8,left:x.left+x.width/2})}o(!0)};return e.jsxs("div",{ref:s,style:{position:"relative",display:"inline-flex"},onMouseEnter:h,onMouseLeave:()=>o(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:l.top,left:l.left,transform:"translate(-50%, -100%)",display:"flex",width:"max-content",maxWidth:300,padding:10,alignItems:"center",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-Strong, #2E3236)",zIndex:9999,pointerEvents:"none"},children:e.jsx("span",{style:{color:"#FFF",fontSize:12,fontWeight:400,lineHeight:"140%"},children:t})})]})},dn=({label:t,value:i=0,maxValue:n=5})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:8,alignItems:"flex-start"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:12,fontWeight:400,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:t}),e.jsx(an,{text:on[t]||t,children:e.jsx(u.Info,{size:14,color:P.infoIcon,strokeWidth:1,style:{cursor:"pointer"}})})]}),e.jsx(ln,{value:i,maxValue:n})]}),gt=({score:t=4,minScore:i=0,maxScore:n=5,predictedScore:o=4,predictedLabel:s="Predicted Objective",description:l="",legends:g=[{label:"CSAT",value:3},{label:"Resolution",value:4},{label:"Process Adherence",value:5},{label:"Communication",value:3}]})=>{const h=Number(t),x=Number.isFinite(h)?Math.min(Math.max(h,i),n):i,W=x.toFixed(1);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,borderRadius:8,border:`1px solid ${P.absent}`,background:P.white,alignSelf:"stretch",flex:1,gap:24},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Interaction Quality"}),e.jsx("span",{style:{fontSize:14,fontWeight:400,color:P.muted,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:l})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:24,flex:1,overflow:"hidden"},children:[e.jsxs("div",{style:{position:"relative",maxWidth:243,minWidth:160,flex:"0 1 243px",flexDirection:"column",alignItems:"center",display:"flex"},children:[e.jsx(sn,{score:t,minScore:i,maxScore:n}),(()=>{const a=-(180-(n>i?(x-i)/(n-i):0)*180-45);return e.jsxs("svg",{width:"34",height:"35",viewBox:"0 0 34 35",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{marginTop:-24,transform:`rotate(${a}deg)`,transformOrigin:"center center"},children:[e.jsx("path",{d:"M16 25.2169C19.958 25.2169 23.1667 22.0083 23.1667 18.0503C23.1667 14.0922 19.958 10.8836 16 10.8836C12.042 10.8836 8.83334 14.0922 8.83334 18.0503C8.83334 22.0083 12.042 25.2169 16 25.2169Z",fill:"var(--rail-orange, #C98A5A)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M30.4791 11.2328L33.4351 0L21.6888 3.09113C19.9212 2.41855 18.0036 2.05025 16 2.05025C7.16344 2.05025 0 9.2137 0 18.0503C0 26.8868 7.16344 34.0503 16 34.0503C24.8366 34.0503 32 26.8868 32 18.0503C32 15.6119 31.4546 13.301 30.4791 11.2328ZM16 30.5503C22.9036 30.5503 28.5 24.9538 28.5 18.0503C28.5 11.1467 22.9036 5.55025 16 5.55025C9.09644 5.55025 3.5 11.1467 3.5 18.0503C3.5 24.9538 9.09644 30.5503 16 30.5503Z",fill:"var(--rail-orange, #C98A5A)"})]})})(),e.jsx("div",{style:{fontSize:28,fontWeight:400,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:1,textAlign:"center",marginTop:8},children:W}),e.jsx("div",{style:{fontSize:15,fontWeight:500,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"center",marginTop:8},children:"Compass Score"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",justifyContent:"center",flex:1},children:[e.jsx("div",{style:{fontSize:15,fontWeight:500,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"left"},children:"Interaction Quality Index"}),e.jsx("div",{style:{width:"100%",height:1,background:P.absent}}),g.map((v,S)=>e.jsx(dn,{label:v.label,value:v.value},S))]})]})]})},ht=t=>{if(!t)return null;const n=String(t).trim().toLowerCase().split(/[^a-z]+/).filter(Boolean);return n.includes("supervisor")?"var(--rail-compliance, #C98A5A)":n.includes("admin")||n.includes("administrator")||n.includes("superadmin")?"var(--rail-discovery, #5E88B0)":n.includes("agent")?"var(--rail-outcome, #6B7C93)":null},cn=t=>{var o,s,l,g,h,x;if(!t)return null;const i=t.role??t.userRole??t.user_role??t.author_role??t.roleName??t.role_name??t.userType??t.user_type??t.type;if(typeof i=="string")return i;if(Array.isArray(i))return i.join(" ");if(i&&typeof i=="object")return i.name||i.value||i.label||null;const n=((o=t.user)==null?void 0:o.role)??((s=t.user)==null?void 0:s.userRole)??((l=t.user)==null?void 0:l.user_role)??((g=t.profile)==null?void 0:g.role)??((h=t.profile)==null?void 0:h.userRole)??((x=t.profile)==null?void 0:x.user_role);return typeof n=="string"?n:Array.isArray(n)?n.join(" "):n&&typeof n=="object"&&(n.name||n.value||n.label)||null},pt=t=>{if(!t)return"#6B7C93";const i=cn(t);return ht(i)||t.color||"#6B7C93"},be=t=>(t||"").split(" ").map(i=>i[0]).join("").toUpperCase()||"U",fn=t=>{if(!t||t==="Just now")return!0;if(/^\d{4}-\d{2}-\d{2}T/.test(t))try{const n=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",o=new Date(n);return Number.isNaN(o.getTime())?!1:Date.now()-o.getTime()<15*60*1e3}catch{return!1}const i=t.match(/^(\d+)\s*min/);return i?parseInt(i[1],10)<15:!(/\d+\s*h/.test(t)||/\d+\s*day/.test(t))},gn=t=>{if(!t)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return t;try{const i=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",n=new Date(i);if(Number.isNaN(n.getTime()))return t;const s=new Date().getTime()-n.getTime(),l=Math.floor(s/6e4),g=Math.floor(s/36e5);if(l<1)return"Just now";if(l<60)return`${l} min`;if(g<24)return`${g} h`;const h=Math.floor(g/24);return h===1?"1 day":`${h} days`}catch{return t}},ut=({name:t,initials:i,color:n,avatar:o,size:s=36})=>o?e.jsx("img",{src:o,alt:t,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:s,height:s,borderRadius:"50%",background:n||"#6B7C93",color:"#FFF",display:"flex",alignItems:"center",justifyContent:"center",fontSize:s<=32?"10px":"11px",fontWeight:650,flexShrink:0,fontFamily:"var(--default-font-family)",letterSpacing:"0.02em"},title:t,children:i||be(t)}),hn=({comment:t,isReply:i=!1,isConsecutive:n=!1,onReply:o,onSendReply:s,onEdit:l,onDelete:g,onMenuClick:h,showReply:x=!0})=>{var ge,he;const[W,v]=d.useState(!1),[S,a]=d.useState(!1),[j,k]=d.useState(!1),[w,G]=d.useState(""),[H,b]=d.useState(!1),[I,M]=d.useState(""),[L,T]=d.useState(!1),O=d.useRef(null),m=d.useRef(null),y=d.useRef(null),c=t.author||{},D=c.name||t.author_name||"Unknown",V=c.initials||be(D),Z=c.role||t.author_role,Q=c.color||ht(Z)||"#6B7C93",J=c.avatar||t.avatar,re=t.timestamp||t.created_at,p=gn(re),_=fn(re),X=!!(t.isEdited||t.is_edited||t.edited),Se=Array.isArray(t.content)?t.content:[t.content||t.text||""];return d.useEffect(()=>{if(!S)return;const r=Y=>{O.current&&!O.current.contains(Y.target)&&a(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[S]),d.useEffect(()=>{const r=m.current;if(!r)return;r.style.height="auto";const Y=140;r.style.height=Math.min(r.scrollHeight,Y)+"px",r.style.overflowY=r.scrollHeight>Y?"auto":"hidden"},[w,j]),d.useEffect(()=>{const r=y.current;if(!r)return;r.style.height="auto";const Y=140;r.style.height=Math.min(r.scrollHeight,Y)+"px",r.style.overflowY=r.scrollHeight>Y?"auto":"hidden"},[I,H]),e.jsxs("div",{onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),style:{display:"flex",paddingLeft:i?48:0,alignItems:"flex-start",gap:16,paddingTop:n?0:8,paddingBottom:8},children:[n?e.jsx("div",{style:{width:36,flexShrink:0}}):e.jsx(ut,{name:D,initials:V,color:Q,avatar:J}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:n?"flex-end":"space-between",marginBottom:n?0:6},children:[!n&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{style:{fontSize:13,fontWeight:650,color:"var(--text-ink, #1E2125)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:D}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:p}),X&&e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:"(Edited)"})]}),e.jsxs("div",{style:{position:"relative"},ref:O,children:[e.jsx("button",{type:"button",onClick:()=>a(r=>!r),style:{padding:2,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",opacity:W||S?1:0,transition:"opacity 0.15s",flexShrink:0},children:e.jsx(u.Ellipsis,{size:24,color:"var(--Grey-Muted, #808183)"})}),S&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:99,flexDirection:"column",alignItems:"flex-start",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxShadow:"-2px 2px 2px 0 rgba(0, 0, 0, 0.25)",zIndex:50,overflow:"hidden"},children:[o&&e.jsx("button",{type:"button",onClick:()=>{a(!1),b(!1),k(!0)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left"},onMouseEnter:r=>{r.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Reply"}),l&&e.jsx("button",{type:"button",disabled:!_,onClick:()=>{if(!_)return;a(!1);const r=Array.isArray(t.content)?t.content.join(`
|
|
16
|
-
`):t.content||t.text||"";M(r),b(!0),k(!1)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:_?"pointer":"not-allowed",fontSize:13,fontWeight:400,color:_?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left",opacity:_?1:.5},onMouseEnter:r=>{_&&(r.currentTarget.style.background="var(--surface-hover, #F3F7F7)")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Edit"}),g&&e.jsx("button",{type:"button",onClick:()=>{a(!1),T(!0)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left"},onMouseEnter:r=>{r.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Delete"})]})]})]}),H?e.jsxs("div",{style:{display:"flex",width:662,maxWidth:"100%",padding:"8px 12px 12px 12px",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxSizing:"border-box",marginTop:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"normal"},children:["“"," ",((ge=t.author)==null?void 0:ge.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>b(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(u.X,{size:20,color:"var(--Grey-Muted, #808183)"})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:y,value:I,onChange:r=>M(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),I.trim()&&(l==null||l({...t,content:I.trim(),isEdited:!0}),b(!1))}r.key==="Escape"&&b(!1)},autoFocus:!0,rows:1,style:{flex:1,padding:"10px 12px",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",border:"none",background:"transparent",outline:"none",boxSizing:"border-box",resize:"none",minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:()=>{I.trim()&&(l==null||l({...t,content:I.trim(),isEdited:!0}),b(!1))},disabled:!I.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:I.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:I.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:I.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",flexShrink:0,transition:"all 0.15s",lineHeight:"150%"},children:"Save"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,alignItems:"flex-start"},children:Se.map((r,Y)=>e.jsx("div",{style:{fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",lineHeight:"160%",fontFamily:"var(--default-font-family)",padding:"8px 12px",background:i?"var(--surface-hover, #F3F7F7)":"var(--surface-warm-40, rgba(243, 241, 229, 0.40))",borderRadius:8,wordBreak:"break-word"},children:r},Y))}),L&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,marginTop:8,fontSize:13,fontFamily:"var(--default-font-family)"},children:[e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontWeight:400},children:"Confirm: delete this comment?"}),e.jsx("button",{type:"button",onClick:()=>{T(!1),g==null||g(t)},style:{background:"var(--grey-light, #e9e8e8a1)",border:"none",cursor:"pointer",fontSize:13,fontWeight:600,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",padding:"4px 10px",borderRadius:6,transition:"background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.background="var(--Grey-absent, #D9D9D9)"},onMouseLeave:r=>{r.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>T(!1),style:{background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",padding:"4px 10px",borderRadius:6,transition:"background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},onMouseLeave:r=>{r.currentTarget.style.background="none"},children:"Cancel"})]}),x&&o&&!j&&!L&&e.jsxs("button",{type:"button",onClick:()=>{b(!1),k(!0)},style:{display:"flex",alignItems:"center",gap:6,marginTop:8,padding:0,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",transition:"color 0.15s"},children:[e.jsx(u.CornerDownRight,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),"Reply"]}),j&&e.jsxs("div",{style:{display:"flex",width:662,maxWidth:"100%",padding:"8px 12px 12px 12px",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxSizing:"border-box",marginTop:12},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"normal"},children:["“"," ",((he=t.author)==null?void 0:he.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>{G(""),k(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(u.X,{size:20,color:"var(--Grey-Muted, #808183)"})})]}),e.jsx("div",{style:{display:"flex",height:36,padding:16,alignItems:"center",gap:5,borderRadius:"0 8px 8px 8px",background:"var(--Grey-Strong, #2E3236)",boxSizing:"border-box",width:"100%"},children:e.jsx("span",{style:{color:"var(--Grey-White, #FFF)",fontSize:13,fontWeight:400,fontFamily:"var(--default-font-family)",lineHeight:"normal",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(t.content)?t.content[0]:t.content})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:m,value:w,onChange:r=>G(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),w.trim()&&(s==null||s({content:w.trim(),parentId:t.id}),G(""),k(!1))}r.key==="Escape"&&(G(""),k(!1))},autoFocus:!0,placeholder:"Add a reply",rows:1,style:{flex:1,padding:"10px 12px",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",border:"none",background:"transparent",outline:"none",boxSizing:"border-box",resize:"none",minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:()=>{w.trim()&&(s==null||s({content:w.trim(),parentId:t.id}),G(""),k(!1))},disabled:!w.trim(),style:{display:"flex",height:28,padding:"8px 12px",justifyContent:"center",alignItems:"center",gap:8,fontSize:13,fontWeight:600,color:w.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:w.trim()?"var(--Neutral-850, #272727)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:10,cursor:w.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Post"})]})]})]})]})},pn=({currentUser:t,onSubmit:i})=>{const[n,o]=d.useState(""),[s,l]=d.useState(!1),g=d.useRef(null);d.useEffect(()=>{const a=g.current;if(!a)return;a.style.height="auto";const j=140;a.style.height=Math.min(a.scrollHeight,j)+"px",a.style.overflowY=a.scrollHeight>j?"auto":"hidden"},[n]);const h=()=>{const a=n.trim();a&&(i==null||i(a),o(""))},x=a=>{if(a.key==="Enter"){if(a.metaKey||a.ctrlKey||a.shiftKey)return;a.preventDefault(),h()}},W=(t==null?void 0:t.initials)||be(t==null?void 0:t.name),v=pt(t),S=t==null?void 0:t.avatar;return e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"flex-start"},children:[e.jsx(ut,{name:t==null?void 0:t.name,initials:W,color:v,avatar:S}),e.jsx("div",{style:{flex:1,padding:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:s?"1px solid var(--Grey-Strong, #2E3236)":"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",transition:"border-color 0.15s"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:g,value:n,onChange:a=>o(a.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),onKeyDown:x,placeholder:"Add feedback",rows:1,style:{flex:1,border:"none",outline:"none",resize:"none",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",background:"transparent",padding:0,minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:h,disabled:!n.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:n.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:n.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:n.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",transition:"all 0.15s",flexShrink:0,lineHeight:"150%"},children:"Post"})]})})]})},xt=({comment:t,depth:i=0,isConsecutive:n=!1,onReply:o,onSendReply:s,onEdit:l,onDelete:g,onMenuClick:h})=>{const x=t.replies&&t.replies.length>0,W=!x;return e.jsxs(d.Fragment,{children:[e.jsx("div",{style:{paddingLeft:i>0?Math.min(i*32,128):0},children:e.jsx(hn,{comment:t,isReply:i>0,isConsecutive:n,onReply:o,onSendReply:s,onEdit:l,onDelete:g,onMenuClick:h,showReply:W})}),x&&t.replies.map(v=>e.jsx(xt,{comment:v,depth:i+1,onReply:o,onSendReply:s,onEdit:l,onDelete:g,onMenuClick:h},v.id))]})},yt=({comments:t=[],totalComments:i,children:n,onSendComment:o,onReply:s,onSendReply:l,onEdit:g,onDelete:h,onMenuClick:x,onMarkResolved:W,currentUser:v,isResolved:S=!1})=>{const[a,j]=d.useState([]),[k,w]=d.useState(!1),G=d.useMemo(()=>{const m=new Set(t.map(c=>c.id)),y=a.filter(c=>!m.has(c.id));return[...t,...y]},[t,a]);d.useEffect(()=>{const m=new Set(t.map(y=>y.id));j(y=>y.filter(c=>!m.has(c.id)))},[t]);const H=d.useMemo(()=>{if(!v)return{name:"You",initials:"YO",color:"#6B7C93"};const m=v.name||"You",y=v.initials||be(m),c=pt(v);return{...v,name:m,initials:y,color:c}},[v]),b=async({content:m,parentId:y})=>{if(l){w(!0);try{await l({content:m,parentId:y})}finally{w(!1)}}else{const c={id:`temp-${Date.now()}`,author:H,content:m,timestamp:"Just now",parentId:y,isOptimistic:!0};j(D=>[...D,c])}},I=async m=>{if(o){w(!0);try{await o(m)}finally{w(!1)}}else{const y={id:`temp-${Date.now()}`,author:H,content:m,timestamp:"Just now",isOptimistic:!0};j(c=>[...c,y])}},M=m=>{j(y=>y.map(c=>c.id===m.id?{...c,content:m.content,isEdited:!0}:c)),g==null||g(m)},L=m=>{j(y=>y.filter(c=>c.id!==m.id)),h==null||h(m)},T=d.useMemo(()=>{const m={};G.forEach(c=>{c.parentId&&(m[c.parentId]||(m[c.parentId]=[]),m[c.parentId].push(c))});const y=c=>({...c,replies:(m[c.id]||[]).map(y)});return G.filter(c=>!c.parentId).map(y)},[G]),O=i??G.length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",background:"var(--Grey-White, #FFF)",width:"100%",fontFamily:"var(--default-font-family)"},children:[e.jsxs("div",{style:{display:"flex",height:40,paddingBottom:8,alignItems:"center",gap:8,alignSelf:"stretch"},children:[e.jsx(u.MessagesSquare,{size:24,color:"var(--rail-orange, #C98A5A)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",textTransform:"uppercase",lineHeight:1.2},children:"Feedback & Guidance"})]}),e.jsx("div",{style:{width:"100%",height:1,background:"var(--Grey-absent, #D9D9D9)"}}),e.jsxs("div",{style:{display:"flex",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingTop:16,paddingBottom:8},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.MessagesSquare,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Feedback"}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",marginLeft:"auto"},children:[O," Comment",O!==1?"s":""]}),S?e.jsxs("div",{style:{display:"inline-flex",height:32,padding:"12px 16px 12px 12px",justifyContent:"center",alignItems:"center",gap:8,borderRadius:10,background:"var(--Rail-Surface-2, #E3E1D7)",flexShrink:0},children:[e.jsx(u.Check,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:2}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Resolved"})]}):W?e.jsxs("button",{type:"button",onClick:W,style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",fontSize:13,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:20,cursor:"pointer",fontFamily:"var(--default-font-family)",transition:"background 0.15s",lineHeight:"150%",flexShrink:0},children:[e.jsx(u.CircleCheck,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),"Mark as Resolved"]}):null]}),G.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0,marginBottom:24,maxHeight:600,overflowY:G.length>6?"auto":"visible"},children:T.map((m,y)=>{var Q,J;const c=y>0?T[y-1]:null,D=((Q=c==null?void 0:c.author)==null?void 0:Q.name)||(c==null?void 0:c.author_name),V=((J=m.author)==null?void 0:J.name)||m.author_name,Z=c&&D===V&&(!c.replies||c.replies.length===0);return e.jsx(xt,{comment:m,depth:0,isConsecutive:!!Z,onReply:s,onSendReply:b,onEdit:M,onDelete:L,onMenuClick:x},m.id)})}),G.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:16,marginLeft:48},children:[e.jsx(u.Info,{size:16,color:"var(--Grey-Muted, #808183)"}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"normal"},children:"Comments can be edited within 15 minutes."})]}),k&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0"},children:[e.jsx("div",{style:{width:16,height:16,border:"2px solid var(--Grey-absent, #D9D9D9)",borderTopColor:"var(--Grey-Strong, #2E3236)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsx("span",{style:{fontSize:13,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)"},children:"Sending..."}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}),e.jsx(pn,{currentUser:H,onSubmit:I})]}),e.jsx("div",{style:{flex:1,minWidth:0},children:n})]})]})},lt=({children:t,size:i=28,onClick:n,title:o})=>{const[s,l]=d.useState(!1);return e.jsx("div",{title:o,onClick:n,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:s?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},un=t=>{const i=Math.floor(t/6e4),n=Math.floor(t%6e4/1e3);return`${i.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`},xn=({item:t,isLast:i,onPlayEvidence:n,onShowInTranscript:o,timelinePlaying:s,currentTimeSeconds:l})=>{var a;const g=(a=t.signal_refs)==null?void 0:a.map(j=>{const k=j.display_name||j.signal_key||"",w=j.confidence!=null?` (${Math.round(j.confidence*100)}%)`:"";return k+w}).join(", "),h=t.start_ms??t.startMs,x=t.end_ms??t.endMs,W=h!=null,v=(l??0)*1e3,S=s&&W&&v>=h&&v<=(x??h+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 0",borderBottom:i?"none":"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx("span",{style:{alignSelf:"stretch",fontSize:14,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:"150%"},children:t.title||t.detail||""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[g&&e.jsx("span",{style:{fontSize:14,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",flex:1,minWidth:0},children:g}),W&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(lt,{size:28,title:S?"Pause":"Play evidence",onClick:()=>n==null?void 0:n({start_ms:h,end_ms:x}),children:S?e.jsx(u.PauseCircle,{size:17,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1}):e.jsx(u.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsx(lt,{size:28,title:"Show in transcript",onClick:()=>o==null?void 0:o(h),children:e.jsx(u.ScrollText,{size:16,color:"#808183",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.2,whiteSpace:"nowrap"},children:un(h)})]})]})]})},mt=({items:t=[],guidanceCount:i,loading:n=!1,onPlayEvidence:o,onShowInTranscript:s,timelinePlaying:l=!1,currentTimeSeconds:g=0})=>{const h=i??t.length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingTop:16,paddingBottom:8},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.Lightbulb,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Guidance"}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",marginLeft:"auto"},children:[h," Item",h!==1?"s":""]})]}),t.map((x,W)=>e.jsx(xn,{item:x,isLast:W===t.length-1,onPlayEvidence:o,onShowInTranscript:s,timelinePlaying:l,currentTimeSeconds:g},W))]})},ie=({text:t,children:i})=>{const[n,o]=d.useState(!1),s=d.useRef(null),[l,g]=d.useState({top:0,left:0});if(!t)return i;const h=()=>{if(s.current){const x=s.current.getBoundingClientRect();g({top:x.bottom+6,left:x.left+x.width/2})}o(!0)};return e.jsxs("div",{ref:s,style:{position:"relative",display:"inline-flex"},onMouseEnter:h,onMouseLeave:()=>o(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:l.top,left:l.left,transform:"translate(-50%, 0)",display:"flex",padding:10,alignItems:"center",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-Strong, #2E3236)",zIndex:9999,pointerEvents:"none",whiteSpace:"nowrap"},children:e.jsx("span",{style:{color:"#FFF",fontSize:12,fontWeight:400,lineHeight:"normal"},children:t})})]})},yn=[{key:"overview",label:"Overview"},{key:"coaching",label:"Coaching Summary"},{key:"signals",label:"Signals & Recording"},{key:"comments",label:"Feedback"}],mn=({title:t="Wheel Stud Replacement Enquiry",onBack:i,data:n,coachingData:o,coachingLoading:s=!1,audioUrl:l,audioRef:g,currentTimeSeconds:h,timelinePlaying:x,playbackRate:W,timelineSegments:v,onSeek:S,onTogglePlay:a,onSeekBack:j,onSeekForward:k,onSetPlaybackRate:w,agentName:G,agentFullName:H,customerName:b,customerFullName:I,transcript:M,activeTurnIndex:L,turnObservations:T,highlightedTurns:O,onTurnPlayPause:m,onPlayEvidence:y,onHighlightTurns:c,callPurpose:D,classification:V,outcomeQuality:Z,resolutionOutcome:Q,customerIntent:J,interactionId:re,moreDetails:p,compassScore:_,compassMaxScore:X=5,predictedCsat:Se,predictedLabel:ge="Predicted Objective",compassLegends:he,customerSessions:r,customerSessionCount:Y,onSessionClick:Ge,onViewAllSessions:Me,prevSessionDesc:Ee,prevSessionDisabled:U=!1,nextSessionDesc:Re,nextSessionDisabled:ee=!1,onPreviousSession:pe,onNextSession:ue,comments:He=[],guidance:vt=[],currentUser:B,onSendComment:jt,onSendReply:bt,onReply:St,onEdit:kt,onEditInteraction:wt,onDelete:Ct,onMenuClick:Ft,onMarkResolved:Wt,commentsResolved:It})=>{var Je;const[ke,xe]=d.useState("overview"),[Dt,Te]=d.useState(new Set),[zt,le]=d.useState(!1),[_e,Ae]=d.useState(null),[Le,Be]=d.useState(!1),[Ne,Gt]=d.useState(0),[Pe,Mt]=d.useState(!1),te=d.useRef(null),ye=d.useRef(null),we=d.useRef(null),oe=d.useRef(null),Ce=d.useRef(null),Et={overview:ye,coaching:we,signals:oe,comments:Ce},ae=d.useRef(null),Fe=d.useRef(!1);d.useEffect(()=>{const f=ae.current;if(!f)return;const z=["overview","coaching","signals","comments"],E=[ye,we,oe,Ce],R=($=>{let ne=$.parentElement;for(;ne;){const{overflow:je,overflowY:se}=window.getComputedStyle(ne);if(/(auto|scroll)/.test(je+se))return ne;ne=ne.parentElement}return null})(f),q=()=>{var je;if(Fe.current)return;let $=z[0];for(let se=E.length-1;se>=0;se--){const Xe=E[se].current;if(!Xe)continue;if(Xe.getBoundingClientRect().top<=150){$=z[se];break}}xe($);const ne=((je=ye.current)==null?void 0:je.getBoundingClientRect().top)??Number.POSITIVE_INFINITY;Mt(ne<=150)};return f.addEventListener("scroll",q,{passive:!0}),R&&R!==f&&R.addEventListener("scroll",q,{passive:!0}),window.addEventListener("scroll",q,{passive:!0,capture:!0}),q(),()=>{f.removeEventListener("scroll",q),R&&R!==f&&R.removeEventListener("scroll",q),window.removeEventListener("scroll",q,{capture:!0})}},[]);const Oe=d.useRef(null),Rt=f=>{var E;xe(f),Fe.current=!0,Oe.current=f;const z=(E=Et[f])==null?void 0:E.current;if(z){const C=ae.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,$=z.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:$,behavior:"smooth"})}else{const R=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}setTimeout(()=>{Fe.current=!1,Oe.current=null},1200)},We=r||[],Ie=We.length>1,$e=f=>{xe("signals");const z=oe.current;if(z){const C=ae.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,$=z.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:$,behavior:"smooth"})}else{const R=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}const E=f/1e3;setTimeout(()=>{var C;(C=te.current)!=null&&C.scrollToTranscript&&te.current.scrollToTranscript(E)},220)},Ye=f=>{xe("signals");const z=oe.current;if(z){const C=ae.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,$=z.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:$,behavior:"smooth"})}else{const R=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}const E=(f==null?void 0:f.start_ms)??(f==null?void 0:f.startMs);setTimeout(()=>{var C,R;if(E!=null&&((C=te.current)!=null&&C.scrollToTranscript)&&te.current.scrollToTranscript(E/1e3),y)y(f);else if(E!=null&&((R=te.current)!=null&&R.seekTo)){te.current.seekTo(E/1e3),Be(!0),Gt(E/1e3);const $=(f.end_ms??f.endMs??E+5e3)-E;setTimeout(()=>Be(!1),$)}},220)},Ht=f=>{c&&c(f)},Tt=f=>{Te(z=>{const E=new Set(z);return E.has(f)?E.delete(f):E.add(f),E})},_t=(n==null?void 0:n.blocks)||[],de=f=>{var z;return((z=_t.find(E=>E.block_id===f))==null?void 0:z.payload)||{}},K=de("interaction-metadata"),ce=de("interaction-context"),me=de("interaction-signals"),At=de("interaction-outcome-lift"),Lt=de("interaction-dimensions").dimensions||[],Bt=ce.call_purpose||{},Nt=ce.classification||{},Ke=K||{},qe=D||Bt||{},Pt=V||Nt||{},Ve=At||{},Ot=(Ve.driver_signal_keys||[]).map(f=>f.replace(/^sig\./,"").replace(/_/g," ")),$t=o||null,Yt=(Je=me==null?void 0:me.signals)!=null&&Je.length?me:{present_count:0,total_signals_evaluated:0,signals:[]},Ze=vt||[],De=G||K.agent_name||K.agent||ce.agent_name||"Agent",Kt=H||K.agent_full_name||K.agent_name||De,fe=b||K.customer_name||K.customer||ce.customer_name||"Customer",Qe=I||K.customer_full_name||K.customer_name||fe,qt=String((B==null?void 0:B.role)??(B==null?void 0:B.userRole)??(B==null?void 0:B.user_role)??(B==null?void 0:B.roleName)??(B==null?void 0:B.role_name)??"").toLowerCase(),Vt=/(admin|superadmin|administrator)/.test(qt),ze=Y??We.length,ve=K.created_dt||(n==null?void 0:n.created_dt)||ce.created_dt||"",Zt=ve?new Date(/Z$|[+-]\d{2}:\d{2}$/.test(ve)?ve:ve+"Z").toLocaleString():"",Qt=qe.interaction_direction==="inbound"?"Inbound":"Outbound";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",background:"var(--Grey-White, #FFF)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"18px 24px 0"},children:[e.jsx("button",{onClick:i,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0,flexShrink:0},children:e.jsx(u.ArrowLeft,{size:24,color:"var(--Grey-Strong, #2E3236)"})}),e.jsx("div",{style:{width:1,height:28,background:"var(--Base-absent, #D9D9D9)"}}),e.jsx("h1",{style:{color:"var(--Grey-Strong, #2E3236)",fontSize:24,fontStyle:"normal",fontWeight:400,lineHeight:"normal",margin:0,flex:1},children:t}),(pe||ue)&&!Pe&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(ie,{text:Ee,children:e.jsxs("button",{onClick:U?void 0:pe,disabled:U,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:U?"default":"pointer",opacity:U?.4:1},children:[e.jsx(u.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Session"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(ie,{text:Re,children:e.jsxs("button",{onClick:ee?void 0:ue,disabled:ee,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ee?"default":"pointer",opacity:ee?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Session"}),e.jsx(u.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]}),e.jsx("div",{style:{position:"sticky",top:68,zIndex:20,background:"var(--Grey-White, #FFF)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,background:"var(--Grey-White, #FFF)",borderBottom:"1px solid var(--Grey-Faint, #ACADAD)",padding:"0 24px",marginTop:8},children:[e.jsx("div",{style:{display:"flex",alignItems:"flex-start",minWidth:0},children:yn.map(f=>e.jsx("button",{onClick:()=>Rt(f.key),style:{display:"flex",padding:16,alignItems:"center",gap:10,background:"none",border:"none",borderBottom:ke===f.key?"3px solid var(--Grey-Strong, #2E3236)":"3px solid transparent",cursor:"pointer",fontSize:15,fontWeight:ke===f.key?500:400,color:ke===f.key?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",whiteSpace:"nowrap",transition:"border-color 0.2s ease, color 0.2s ease"},children:f.label},f.key))}),(pe||ue)&&Pe&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(ie,{text:Ee,children:e.jsxs("button",{onClick:U?void 0:pe,disabled:U,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:U?"default":"pointer",opacity:U?.4:1},children:[e.jsx(u.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Session"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(ie,{text:Re,children:e.jsxs("button",{onClick:ee?void 0:ue,disabled:ee,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ee?"default":"pointer",opacity:ee?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Session"}),e.jsx(u.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]})}),e.jsxs("div",{ref:ae,style:{padding:24,flex:1,overflowY:"auto"},children:[e.jsxs("div",{ref:ye,style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"flex-start",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",height:40,alignItems:"center",gap:16,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1},children:[e.jsx(u.ClipboardList,{size:24,color:"var(--rail-orange, #C98A5A)",strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,textTransform:"uppercase"},children:"Overview"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(u.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:Zt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(u.PhoneIncoming,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:Qt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingLeft:16,borderLeft:"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx(ie,{text:Kt,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0",cursor:"pointer"},children:[e.jsx(u.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:De})]})}),ze>1?e.jsx("div",{children:e.jsx(ie,{text:Qe,children:e.jsxs("button",{onClick:()=>le(!0),style:{display:"flex",alignItems:"center",gap:16,padding:"0 16px",height:34,borderRadius:8,background:"var(--Rail-Surface-2, #E3E1D7)",border:"none",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[e.jsx(u.CircleUser,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:fe})," ",e.jsxs("span",{children:["(",ze," Sessions)"]})]})]}),e.jsx(u.ChevronRight,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})]})})}):e.jsx(ie,{text:Qe,children:e.jsxs("button",{onClick:()=>le(!0),style:{display:"flex",alignItems:"center",gap:16,padding:"0 16px",height:34,borderRadius:8,background:"var(--Rail-Surface-2, #E3E1D7)",border:"none",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[e.jsx(u.CircleUser,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap"},children:fe})]}),e.jsx(u.ChevronRight,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})]})})]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"stretch",gap:24,alignSelf:"stretch"},children:[e.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:e.jsx(gt,{score:_??.5,minScore:0,maxScore:X,predictedScore:Se??.5,predictedLabel:ge,legends:he})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-end",gap:24,flex:1,minWidth:0},children:[e.jsx(dt,{meta:Ke,callPurpose:qe,classification:Pt,outcomeQuality:Z||"Neutral",dimensions:Lt,resolutionOutcome:Q,customerIntent:J,interactionId:re??K.interaction_id,moreDetails:p,canShowEditButton:Vt,onEditInteraction:wt}),e.jsx(ct,{outcomeLift:Ve,driverLabels:Ot})]})]})]}),e.jsx("div",{ref:we,style:{paddingTop:24},children:e.jsx(at,{data:s?null:$t,loading:s})}),e.jsxs("div",{ref:oe,style:{display:"flex",flexDirection:"column",gap:16,alignSelf:"stretch",paddingTop:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(u.FileSignal,{size:24,color:"#C98A5A",strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,textTransform:"uppercase"},children:"Signals & Recording"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:24,alignSelf:"stretch",paddingTop:16,borderTop:"1px solid #D9D9D9"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(ft,{signals:Yt,expandedSignals:Dt,toggleSignal:Tt,playEvidence:Ye,highlightTurns:Ht,onShowInTranscript:$e,timelinePlaying:x||Le,currentTimeSeconds:h??Ne})}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(ot.UpdatedInteractionRecording,{ref:te,audioUrl:l,durationSeconds:Ke.duration_seconds,audioRef:g,agentName:De,customerName:fe,currentTimeSeconds:h,timelinePlaying:x,playbackRate:W,timelineSegments:v,onSeek:S,onTogglePlay:a,onSeekBack:j,onSeekForward:k,onSetPlaybackRate:w,transcript:M,activeTurnIndex:L,turnObservations:T,highlightedTurns:O,onTurnPlayPause:m,setExpandedSignals:Te})})]})]}),e.jsx("div",{ref:Ce,style:{paddingTop:24},children:e.jsx(yt,{comments:He,totalComments:He.length,currentUser:B,onSendComment:jt||(()=>{}),onSendReply:bt||(()=>{}),onReply:St||(()=>{}),onEdit:kt||(()=>{}),onDelete:Ct||(()=>{}),onMenuClick:Ft||(()=>{}),onMarkResolved:Wt||(()=>{}),isResolved:It,children:e.jsx(mt,{items:Ze,guidanceCount:Ze.length,onPlayEvidence:Ye,onShowInTranscript:$e,timelinePlaying:x||Le,currentTimeSeconds:h??Ne})})})]}),e.jsx(Jt.SideDrawer,{open:zt,onClose:()=>le(!1),title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:"50%",background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.CircleUser,{size:20,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})}),e.jsx("div",{style:{minWidth:0},children:e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:fe})})]}),subtitle:Ie?e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.5},children:[ze," Sessions in Past"]}):null,width:470,height:"100vh",topOffset:70,footer:Ie?e.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:e.jsxs("button",{onClick:()=>{Me&&Me(),le(!1)},style:{display:"flex",height:32,padding:"0 16px 0 12px",justifyContent:"center",alignItems:"center",gap:6,background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:10,cursor:"pointer"},children:[e.jsx(u.History,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--Grey-Strong, #2E3236)"},children:"View All Sessions"})]})}):null,children:e.jsx("div",{style:{borderTop:"1px solid var(--Grey-absent, #D9D9D9)",maxHeight:"100%",overflowY:"auto"},children:Ie?We.map((f,z)=>e.jsxs("div",{onClick:()=>{Ge&&Ge(f),le(!1)},onMouseEnter:()=>Ae(z),onMouseLeave:()=>Ae(null),style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,padding:"16px 12px",borderTop:z===0?"none":"1px solid var(--Grey-absent, #D9D9D9)",background:_e===z?"var(--surface-hover, #F3F7F7)":"var(--Grey-White, #FFF)",cursor:"pointer",transition:"background 0.15s"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:14,display:"flex",alignItems:"center",gap:6,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.title}),f.status&&e.jsxs("div",{style:{fontSize:13,color:"var(--Grey-Strong, #2E3236)",marginBottom:12,lineHeight:1.2},children:[e.jsx("span",{style:{fontWeight:400},children:"Status: "}),e.jsx("span",{style:{fontWeight:400,color:"var(--Grey-Muted, #808183)"},children:f.status})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(u.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),f.date]}),(f.agent||f.agent_name)&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(u.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),f.agent||f.agent_name]})]})]}),_e===z&&e.jsx(u.ExternalLink,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.7,style:{flexShrink:0}})]},f.id||z)):e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:140,padding:"24px 12px",color:"var(--Grey-Muted, #808183)",fontSize:14,fontStyle:"italic",textAlign:"center"},children:"No previous sessions available"})})})]})};exports.UpdatedInteractionRecording=ot.UpdatedInteractionRecording;exports.UpdatedCoachingSynthesisCard=at;exports.UpdatedCompassScore=gt;exports.UpdatedGuidance=mt;exports.UpdatedInteractionContext=dt;exports.UpdatedInteractionDetails=mn;exports.UpdatedInteractionScores=ct;exports.UpdatedInteractionSignals=ft;exports.UpdatedThreads=yt;
|
|
15
|
+
`}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,padding:"48px 24px"},children:[e.jsxs("svg",{width:48,height:48,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"coaching-spinner-spin 1.2s linear infinite"},children:[e.jsx("path",{d:"M43 24C43 26.4951 42.5086 28.9658 41.5537 31.271C40.5989 33.5762 39.1993 35.6707 37.435 37.435C35.6707 39.1993 33.5762 40.5989 31.271 41.5537C28.9658 42.5086 26.4951 43 24 43C21.5049 43 19.0342 42.5086 16.729 41.5537C14.4238 40.5989 12.3293 39.1993 10.565 37.435C8.80066 35.6707 7.40113 33.5762 6.44629 31.271C5.49145 28.9658 5 26.4951 5 24",stroke:"#F3E7C7",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("path",{d:"M12 24C12 22.4241 12.3104 20.8637 12.9134 19.4078C13.5165 17.9519 14.4004 16.629 15.5147 15.5147C16.629 14.4004 17.9519 13.5165 19.4078 12.9134C20.8637 12.3104 22.4241 12 24 12C25.5759 12 27.1363 12.3104 28.5922 12.9134C30.0481 13.5165 31.371 14.4004 32.4853 15.5147C33.5996 16.629 34.4835 17.9519 35.0866 19.4078C35.6896 20.8637 36 22.4241 36 24",stroke:"#00A66E",strokeWidth:"4",strokeLinecap:"round"}),e.jsx("path",{d:"M20 24C20 24.5253 20.1035 25.0454 20.3045 25.5307C20.5055 26.016 20.8001 26.457 21.1716 26.8284C21.543 27.1999 21.984 27.4945 22.4693 27.6955C22.9546 27.8965 23.4747 28 24 28C24.5253 28 25.0454 27.8965 25.5307 27.6955C26.016 27.4945 26.457 27.1999 26.8284 26.8284C27.1999 26.457 27.4945 26.016 27.6955 25.5307C27.8965 25.0454 28 24.5253 28 24",stroke:"#F3E7C7",strokeWidth:"4",strokeLinecap:"round"})]}),e.jsx("span",{style:{fontSize:14,color:A.muted,fontWeight:500,textAlign:"center"},children:"Synthesizing coaching summary..."})]})]});if(n)return e.jsx("div",{style:{fontSize:14,color:A.muted},children:"Unable to generate coaching summary."});if(!t)return null;const o=t.strengths||[],s=t.improvements||[],l=typeof t.one_liner=="string"?t.one_liner:((h=t.one_liner)==null?void 0:h.text)||"",g=typeof t.context=="string"?t.context:((x=t.context)==null?void 0:x.text)||"";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,background:"#FFF"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(u.ShieldCheck,{size:20,color:A.accent,strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:A.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textTransform:"uppercase"},children:"Coaching Summary"})]}),l&&e.jsx("div",{style:{fontSize:14,fontWeight:500,color:A.strong,fontFamily:"var(--font-sans)",lineHeight:1.5},children:l}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,justifyContent:"space-between"},children:[g&&e.jsx("div",{style:{fontSize:14,fontWeight:400,color:A.muted,fontFamily:"var(--font-sans)",lineHeight:1.5,flex:1},children:g}),t.overall&&e.jsx(en,{overall:t.overall})]}),(o.length>0||s.length>0)&&e.jsxs("div",{style:{display:"flex",gap:24,paddingTop:24,borderTop:`1px solid ${A.absent}`},children:[e.jsx(et,{icon:e.jsx(u.TrendingUp,{size:14,color:A.strong,strokeWidth:1.5}),label:"Key Strengths",items:o}),e.jsx(et,{icon:e.jsx(u.Lightbulb,{size:14,color:A.strong,strokeWidth:1.5}),label:"Improvements",items:s})]})]})};function nn(t){const i=Math.floor(t/60),n=Math.round(t%60);return`${i}:${n.toString().padStart(2,"0")}`}const rn={display:"flex",justifyContent:"space-between",padding:"8px 8px 12px 8px",alignItems:"center",gap:24,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)"},tt={display:"flex",flexDirection:"column",flex:"1 0 0",gap:0,minWidth:0},dt=({meta:t={},callPurpose:i={},classification:n={},dimensions:o=[],outcomeQuality:s="Neutral",onMoreDetails:l,moreDetails:g=[],resolutionOutcome:h,customerIntent:x,canShowEditButton:W=!1,onEditInteraction:v})=>{const[S,a]=d.useState(!1),j=d.useRef(null),w=t.duration_seconds!=null?nn(t.duration_seconds):null,k=t.message_count,G=i.interaction_driver,H=n.interaction_paradigm,b=p=>o.find(_=>(_.key||"").toLowerCase().includes(p)),I=b("resolution_outcome"),M=b("customer_intent"),L=b("outcome_quality"),T=p=>p?p.replace(/_/g," ").replace(/\b\w/g,_=>_.toUpperCase()):null,O=s!=="Neutral"?s:L?T(L.value):s,m=h??(I?T(I.value):null),y=x??(M?T(M.value):null),c=new Set(["resolution_outcome","customer_intent","outcome_quality"].map(p=>`dim.${p}`)),D=o.filter(p=>!c.has(p.key)),V=[],Z=[[w!=null?{label:"Duration",value:w}:null,k!=null?{label:"Messages",value:k}:null],[G!=null?{label:"Driver",value:G}:null,H!=null?{label:"Paradigm",value:H}:null]];for(let p=0;p<D.length;p+=2){const _=D[p]?{label:D[p].display_name||D[p].label||D[p].key,value:T(D[p].value)}:null,X=D[p+1]?{label:D[p+1].display_name||D[p+1].label||D[p+1].key,value:T(D[p+1].value)}:null;Z.push([_,X])}Z.push([{label:"Outcome Quality",value:O},{isMoreDetails:!0}]),Z.forEach(p=>V.push(p));const Q=[m!=null&&{label:"Resolution Outcome",value:m},y!=null&&{label:"Customer Intent",value:y},...g||[]].filter(Boolean);d.useEffect(()=>{if(!S)return;const p=_=>{j.current&&!j.current.contains(_.target)&&a(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[S]);const J=p=>e.jsxs("div",{style:rn,children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:p.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:p.value})]},p.label),re=()=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"8px 8px 12px 8px",fontFamily:"var(--font-sans)",borderBottom:"none",minHeight:33},children:[e.jsxs("button",{onClick:()=>{a(p=>!p),l&&!S&&l()},style:{display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",whiteSpace:"nowrap",flexShrink:0},children:[e.jsx("span",{children:"More Details"}),S?e.jsx(u.ChevronUp,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(u.ChevronDown,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5})]}),W&&e.jsxs("button",{onClick:v||(()=>{}),style:{display:"flex",alignItems:"center",gap:6,padding:"5px 12px",background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:12,color:"var(--Grey-Strong, #2E3236)",fontSize:13,fontWeight:500,lineHeight:"normal",fontFamily:"var(--font-sans)",cursor:"pointer",flexShrink:0},children:[e.jsx(u.Pencil,{size:15,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,lineHeight:"normal"},children:"Edit"})]})]},"more-details");return e.jsxs("div",{ref:j,style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0,position:"relative",overflow:"visible"},children:[V.map((p,_)=>{var X;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24,alignSelf:"stretch",flexWrap:"nowrap"},children:[e.jsx("div",{style:tt,children:p[0]&&!p[0].isMoreDetails?J(p[0]):e.jsx("div",{style:{flex:1}})}),e.jsx("div",{style:tt,children:p[1]&&!p[1].isMoreDetails?J(p[1]):(X=p[1])!=null&&X.isMoreDetails?re():e.jsx("div",{style:{flex:1}})})]},_)}),S&&Q.length>0&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:340,flexDirection:"column",alignItems:"flex-start",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxShadow:"-2px 2px 2px 0 rgba(0, 0, 0, 0.25)",overflow:"hidden",fontFamily:"var(--font-sans)",zIndex:50},children:[e.jsx("div",{style:{padding:"12px 16px",fontSize:13,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",alignSelf:"stretch"},children:"More details"}),Q.map(p=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",gap:24,fontSize:13,fontWeight:400,lineHeight:"normal",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",alignSelf:"stretch"},children:[e.jsx("span",{style:{color:"var(--Grey-Strong, #2E3236)",whiteSpace:"nowrap",flexShrink:0},children:p.label}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"120%",textAlign:"right"},children:p.value})]},p.label))]})]})},F={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",white:"var(--Grey-White, #FFF)",cardBg:"var(--surface-warm-40, rgba(243, 241, 229, 0.40))"},N=1.2,nt=3,it=t=>t!=null?Math.round(t*100)+"%":"—",rt=t=>{if(t==null)return"—";const i=(t*100).toFixed(1);return t>0?`+${i}pp`:`${i}pp`},ct=({outcomeLift:t,driverLabels:i=[]})=>{var a;if(!t||t.lift==null)return null;const n=t.p_expected,o=t.p_full,s=t.lift_raw??(o!=null&&n!=null?o-n:null),l=t.lift,g=(a=t.interpretation)!=null&&a.lift_band?t.interpretation.lift_band.replace(/_/g," "):l>=0?"Positive":"Negative",h=g.charAt(0).toUpperCase()+g.slice(1),W=/negative/i.test(g)?u.ThumbsDown:u.ThumbsUp,v=i.slice(0,nt),S=i.length-nt;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,gap:24,borderRadius:8,border:`1px solid ${F.absent}`,background:F.cardBg,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:32},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:"Agent Lift Analysis"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.strong,lineHeight:N},children:"vs. Average Agent:"}),e.jsx("span",{style:{fontSize:14,fontWeight:600,color:F.strong,lineHeight:N},children:rt(l)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,paddingLeft:8,borderLeft:`1px solid ${F.absent}`},children:[e.jsx(W,{size:14,color:F.strong}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:F.strong,lineHeight:N},children:h})]})]})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N},children:it(n)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Expected Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"Based on call type & difficulty"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${F.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N},children:rt(s)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Agent Impact"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"Behavior-driven change"})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"flex-start",paddingLeft:24,borderLeft:`1px solid ${F.absent}`,flex:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:28,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:it(o)}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",minHeight:48},children:[e.jsx("span",{style:{fontSize:13,fontWeight:600,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:"Predicted Outcome"}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:F.muted,fontFamily:"var(--font-sans)",lineHeight:N,textAlign:"left"},children:"With agent behaviors"})]})]})]})]}),i.length>0&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,alignSelf:"stretch"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N},children:"Key Drivers"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[v.map((j,w)=>e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${F.absent}`,background:F.white},children:e.jsx("span",{style:{fontSize:12,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:j})},w)),S>0&&e.jsx("div",{style:{display:"flex",padding:8,alignItems:"center",justifyContent:"center",borderRadius:4,border:`1px solid ${F.absent}`,background:F.white},children:e.jsxs("span",{style:{fontSize:12,fontWeight:400,color:F.strong,fontFamily:"var(--font-sans)",lineHeight:N,whiteSpace:"nowrap"},children:["+ ",S]})})]})]})]})},st=({children:t,size:i=28,onClick:n,title:o})=>{const[s,l]=d.useState(!1);return e.jsx("div",{title:o,onClick:n,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:s?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},ft=({signals:t={signals:[],present_count:0,total_signals_evaluated:0},expandedSignals:i=new Set,toggleSignal:n=()=>{},playEvidence:o=()=>{},highlightTurns:s=()=>{},onShowInTranscript:l=()=>{},timelinePlaying:g=!1,currentTimeSeconds:h=0})=>{const x=(t==null?void 0:t.signals)??[],W=(t==null?void 0:t.present_count)??x.length,v=a=>{const j=Math.floor(a/6e4),w=Math.floor(a%6e4/1e3);return`${j.toString().padStart(2,"0")}:${w.toString().padStart(2,"0")}`},S=a=>g&&a.start_ms!=null&&h*1e3>=a.start_ms&&h*1e3<=(a.end_ms??a.start_ms+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",alignSelf:"stretch",width:"100%",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",flexShrink:0},children:e.jsx(u.FileSignal,{size:20,color:"#2E3236",strokeWidth:1.5})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flex:1},children:[e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Signals"}),e.jsxs("span",{style:{fontSize:14,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:[W," Signals Detected"]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",background:"var(--Grey-White, #FFF)",gap:8},children:[x.length===0&&e.jsx("div",{style:{padding:"8px 0",fontSize:14,color:"var(--Grey-Muted, #808183)"},children:"No signals detected."}),x.map((a,j)=>{var H,b,I;const w=a.key??a.id??j,k=i.has(w),G=((H=a.observations)==null?void 0:H.length)??0;return e.jsxs("div",{id:`signal-${w}`,style:{display:"flex",flexDirection:"column",width:"100%",gap:8},children:[e.jsxs("button",{onClick:()=>n(w),style:{display:"flex",padding:"8px 0",alignItems:"center",gap:12,alignSelf:"stretch",width:"100%",background:"none",border:"none",borderBottom:"1px solid var(--Grey-absent, #D9D9D9)",cursor:"pointer"},children:[e.jsxs("span",{style:{flex:1,textAlign:"left",fontSize:14,fontWeight:600,color:"var(--text-dark, #0B0A0A)",lineHeight:1.71},children:[a.display_name||((b=a.key)==null?void 0:b.replace(/_/g," ")),G>0&&e.jsxs("span",{style:{fontWeight:600,color:"var(--text-dark, #0B0A0A)",marginLeft:6},children:["(",G,")"]})]}),k?e.jsx(u.ChevronUp,{size:20,color:"#767473"}):e.jsx(u.ChevronDown,{size:20,color:"#767473"})]}),k&&((I=a.observations)==null?void 0:I.length)>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:0},children:a.observations.map((M,L)=>{var T,O,m;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignSelf:"stretch",gap:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0",justifyContent:"space-between"},children:[e.jsx("span",{style:{flex:1,fontSize:14,fontWeight:400,color:"var(--text-subtle-warm, #767473)",lineHeight:1.5},children:M.reason||M.explanation}),((O=(T=M.evidence)==null?void 0:T[0])==null?void 0:O.start_ms)!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(st,{size:28,title:"Show in transcript",onClick:y=>{y.stopPropagation(),l(M.evidence[0].start_ms)},children:e.jsx(u.ScrollText,{size:16,color:"#808183",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.2,whiteSpace:"nowrap"},children:v(M.evidence[0].start_ms)})]})]}),(m=M.evidence)==null?void 0:m.map((y,c)=>{const D=y.start_ms!=null&&y.end_ms!=null;return y.text&&e.jsxs("div",{onClick:V=>{V.stopPropagation(),D&&o(y)},onMouseEnter:()=>s(y.turn_ids??[]),onMouseLeave:()=>s([]),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0",cursor:D?"pointer":"default"},children:[D&&e.jsx(st,{size:28,children:S(y)?e.jsx(u.PauseCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}):e.jsx(u.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2},children:["“",y.text,"”"]})]},c)})]},M.key??L)})})]},w)})]})]})},P={strong:"var(--Grey-Strong, #2E3236)",muted:"var(--Grey-Muted, #808183)",absent:"var(--Grey-absent, #D9D9D9)",white:"var(--Grey-White, #FFF)",accent:"var(--rail-orange, #C98A5A)",track:"var(--rail-surface-2, #E3E1D7)",infoIcon:"var(--color-input-border, #ACACAD)"},sn=({score:t=4,minScore:i=0,maxScore:n=5})=>{const v=Number(t),S=Number.isFinite(v)?Math.min(Math.max(v,i),n):i,a=n>i?(S-i)/(n-i)*5:0,j=180/5,w=H=>{const b=H*Math.PI/180;return{x:121.5+85*Math.cos(b),y:123-85*Math.sin(b)}},k=(H,b)=>{const I=w(H),M=w(b),L=H-b>180?1:0;return`M ${I.x} ${I.y} A 85 85 0 ${L} 1 ${M.x} ${M.y}`},G=2;return e.jsx("svg",{width:"100%",viewBox:"0 0 243 130",fill:"none",style:{maxWidth:243},children:Array.from({length:5},(H,b)=>{const I=180-b*j-(b>0?G/2:0),M=180-(b+1)*j+(b<5-1?G/2:0),L=Math.max(0,Math.min(1,a-b)),T=k(I,M);return e.jsxs("g",{children:[e.jsx("path",{d:T,stroke:P.track,strokeWidth:30,strokeLinecap:"butt",fill:"none"}),L>0&&e.jsx("path",{d:T,stroke:P.strong,strokeWidth:30,strokeLinecap:"butt",fill:"none",pathLength:1,strokeDasharray:`${L} 1`})]},b)})})},ln=({value:t=0,maxValue:i=5})=>{const n=Number(t),o=Number.isFinite(n)?Math.min(Math.max(n,0),i):0;return e.jsx("div",{style:{display:"flex",gap:2},children:Array.from({length:i},(s,l)=>{const g=Math.max(0,Math.min(1,o-l));return e.jsx("div",{style:{width:22,height:6,borderRadius:1,background:P.track,overflow:"hidden"},children:g>0&&e.jsx("div",{style:{width:`${g*100}%`,height:"100%",background:P.strong}})},l)})})},on={CSAT:"Predicted Customer Satisfaction",Resolution:"Predicted Resolution: was the issue fully resolved?","Process Adherence":"Process Adherence: Did the agent follow procedures?",Communication:"Predicted Communication Quality: Clarity, Empathy, Professionalism"},an=({text:t,children:i})=>{const[n,o]=d.useState(!1),s=d.useRef(null),[l,g]=d.useState({top:0,left:0}),h=()=>{if(s.current){const x=s.current.getBoundingClientRect();g({top:x.top-8,left:x.left+x.width/2})}o(!0)};return e.jsxs("div",{ref:s,style:{position:"relative",display:"inline-flex"},onMouseEnter:h,onMouseLeave:()=>o(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:l.top,left:l.left,transform:"translate(-50%, -100%)",display:"flex",width:"max-content",maxWidth:300,padding:10,alignItems:"center",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-Strong, #2E3236)",zIndex:9999,pointerEvents:"none"},children:e.jsx("span",{style:{color:"#FFF",fontSize:12,fontWeight:400,lineHeight:"140%"},children:t})})]})},dn=({label:t,value:i=0,maxValue:n=5})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:8,alignItems:"flex-start"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:12,fontWeight:400,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:t}),e.jsx(an,{text:on[t]||t,children:e.jsx(u.Info,{size:14,color:P.infoIcon,strokeWidth:1,style:{cursor:"pointer"}})})]}),e.jsx(ln,{value:i,maxValue:n})]}),gt=({score:t=4,minScore:i=0,maxScore:n=5,predictedScore:o=4,predictedLabel:s="Predicted Objective",description:l="",legends:g=[{label:"CSAT",value:3},{label:"Resolution",value:4},{label:"Process Adherence",value:5},{label:"Communication",value:3}]})=>{const h=Number(t),x=Number.isFinite(h)?Math.min(Math.max(h,i),n):i,W=x.toFixed(1);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",padding:24,borderRadius:8,border:`1px solid ${P.absent}`,background:P.white,alignSelf:"stretch",flex:1,gap:24},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("span",{style:{fontSize:15,fontWeight:600,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:1.2},children:"Interaction Quality"}),e.jsx("span",{style:{fontSize:14,fontWeight:400,color:P.muted,fontFamily:"var(--font-sans)",lineHeight:"normal"},children:l})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:24,flex:1,overflow:"hidden"},children:[e.jsxs("div",{style:{position:"relative",maxWidth:243,minWidth:160,flex:"0 1 243px",flexDirection:"column",alignItems:"center",display:"flex"},children:[e.jsx(sn,{score:t,minScore:i,maxScore:n}),(()=>{const a=-(180-(n>i?(x-i)/(n-i):0)*180-45);return e.jsxs("svg",{width:"34",height:"35",viewBox:"0 0 34 35",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{marginTop:-24,transform:`rotate(${a}deg)`,transformOrigin:"center center"},children:[e.jsx("path",{d:"M16 25.2169C19.958 25.2169 23.1667 22.0083 23.1667 18.0503C23.1667 14.0922 19.958 10.8836 16 10.8836C12.042 10.8836 8.83334 14.0922 8.83334 18.0503C8.83334 22.0083 12.042 25.2169 16 25.2169Z",fill:"var(--rail-orange, #C98A5A)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M30.4791 11.2328L33.4351 0L21.6888 3.09113C19.9212 2.41855 18.0036 2.05025 16 2.05025C7.16344 2.05025 0 9.2137 0 18.0503C0 26.8868 7.16344 34.0503 16 34.0503C24.8366 34.0503 32 26.8868 32 18.0503C32 15.6119 31.4546 13.301 30.4791 11.2328ZM16 30.5503C22.9036 30.5503 28.5 24.9538 28.5 18.0503C28.5 11.1467 22.9036 5.55025 16 5.55025C9.09644 5.55025 3.5 11.1467 3.5 18.0503C3.5 24.9538 9.09644 30.5503 16 30.5503Z",fill:"var(--rail-orange, #C98A5A)"})]})})(),e.jsx("div",{style:{fontSize:28,fontWeight:400,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:1,textAlign:"center",marginTop:8},children:W}),e.jsx("div",{style:{fontSize:15,fontWeight:500,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"center",marginTop:8},children:"Compass Score"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",justifyContent:"center",flex:1},children:[e.jsx("div",{style:{fontSize:15,fontWeight:500,color:P.strong,fontFamily:"var(--font-sans)",lineHeight:1.2,textAlign:"left"},children:"Interaction Quality Index"}),e.jsx("div",{style:{width:"100%",height:1,background:P.absent}}),g.map((v,S)=>e.jsx(dn,{label:v.label,value:v.value},S))]})]})]})},ht=t=>{if(!t)return null;const n=String(t).trim().toLowerCase().split(/[^a-z]+/).filter(Boolean);return n.includes("supervisor")?"var(--rail-compliance, #C98A5A)":n.includes("admin")||n.includes("administrator")||n.includes("superadmin")?"var(--rail-discovery, #5E88B0)":n.includes("agent")?"var(--rail-outcome, #6B7C93)":null},cn=t=>{var o,s,l,g,h,x;if(!t)return null;const i=t.role??t.userRole??t.user_role??t.author_role??t.roleName??t.role_name??t.userType??t.user_type??t.type;if(typeof i=="string")return i;if(Array.isArray(i))return i.join(" ");if(i&&typeof i=="object")return i.name||i.value||i.label||null;const n=((o=t.user)==null?void 0:o.role)??((s=t.user)==null?void 0:s.userRole)??((l=t.user)==null?void 0:l.user_role)??((g=t.profile)==null?void 0:g.role)??((h=t.profile)==null?void 0:h.userRole)??((x=t.profile)==null?void 0:x.user_role);return typeof n=="string"?n:Array.isArray(n)?n.join(" "):n&&typeof n=="object"&&(n.name||n.value||n.label)||null},pt=t=>{if(!t)return"#6B7C93";const i=cn(t);return ht(i)||t.color||"#6B7C93"},be=t=>(t||"").split(" ").map(i=>i[0]).join("").toUpperCase()||"U",fn=t=>{if(!t||t==="Just now")return!0;if(/^\d{4}-\d{2}-\d{2}T/.test(t))try{const n=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",o=new Date(n);return Number.isNaN(o.getTime())?!1:Date.now()-o.getTime()<15*60*1e3}catch{return!1}const i=t.match(/^(\d+)\s*min/);return i?parseInt(i[1],10)<15:!(/\d+\s*h/.test(t)||/\d+\s*day/.test(t))},gn=t=>{if(!t)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return t;try{const i=/Z$|[+-]\d{2}:\d{2}$/.test(t)?t:t+"Z",n=new Date(i);if(Number.isNaN(n.getTime()))return t;const s=new Date().getTime()-n.getTime(),l=Math.floor(s/6e4),g=Math.floor(s/36e5);if(l<1)return"Just now";if(l<60)return`${l} min`;if(g<24)return`${g} h`;const h=Math.floor(g/24);return h===1?"1 day":`${h} days`}catch{return t}},ut=({name:t,initials:i,color:n,avatar:o,size:s=36})=>o?e.jsx("img",{src:o,alt:t,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:s,height:s,borderRadius:"50%",background:n||"#6B7C93",color:"#FFF",display:"flex",alignItems:"center",justifyContent:"center",fontSize:s<=32?"10px":"11px",fontWeight:650,flexShrink:0,fontFamily:"var(--default-font-family)",letterSpacing:"0.02em"},title:t,children:i||be(t)}),hn=({comment:t,isReply:i=!1,isConsecutive:n=!1,onReply:o,onSendReply:s,onEdit:l,onDelete:g,onMenuClick:h,showReply:x=!0})=>{var ge,he;const[W,v]=d.useState(!1),[S,a]=d.useState(!1),[j,w]=d.useState(!1),[k,G]=d.useState(""),[H,b]=d.useState(!1),[I,M]=d.useState(""),[L,T]=d.useState(!1),O=d.useRef(null),m=d.useRef(null),y=d.useRef(null),c=t.author||{},D=c.name||t.author_name||"Unknown",V=c.initials||be(D),Z=c.role||t.author_role,Q=c.color||ht(Z)||"#6B7C93",J=c.avatar||t.avatar,re=t.timestamp||t.created_at,p=gn(re),_=fn(re),X=!!(t.isEdited||t.is_edited||t.edited),Se=Array.isArray(t.content)?t.content:[t.content||t.text||""];return d.useEffect(()=>{if(!S)return;const r=Y=>{O.current&&!O.current.contains(Y.target)&&a(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[S]),d.useEffect(()=>{const r=m.current;if(!r)return;r.style.height="auto";const Y=140;r.style.height=Math.min(r.scrollHeight,Y)+"px",r.style.overflowY=r.scrollHeight>Y?"auto":"hidden"},[k,j]),d.useEffect(()=>{const r=y.current;if(!r)return;r.style.height="auto";const Y=140;r.style.height=Math.min(r.scrollHeight,Y)+"px",r.style.overflowY=r.scrollHeight>Y?"auto":"hidden"},[I,H]),e.jsxs("div",{onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),style:{display:"flex",paddingLeft:i?48:0,alignItems:"flex-start",gap:16,paddingTop:n?0:8,paddingBottom:8},children:[n?e.jsx("div",{style:{width:36,flexShrink:0}}):e.jsx(ut,{name:D,initials:V,color:Q,avatar:J}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:n?"flex-end":"space-between",marginBottom:n?0:6},children:[!n&&e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{style:{fontSize:13,fontWeight:650,color:"var(--text-ink, #1E2125)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:D}),e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:p}),X&&e.jsx("span",{style:{fontSize:12,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:"150%",fontFamily:"var(--default-font-family)"},children:"(Edited)"})]}),e.jsxs("div",{style:{position:"relative"},ref:O,children:[e.jsx("button",{type:"button",onClick:()=>a(r=>!r),style:{padding:2,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",opacity:W||S?1:0,transition:"opacity 0.15s",flexShrink:0},children:e.jsx(u.Ellipsis,{size:24,color:"var(--Grey-Muted, #808183)"})}),S&&e.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,display:"flex",width:99,flexDirection:"column",alignItems:"flex-start",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxShadow:"-2px 2px 2px 0 rgba(0, 0, 0, 0.25)",zIndex:50,overflow:"hidden"},children:[o&&e.jsx("button",{type:"button",onClick:()=>{a(!1),b(!1),w(!0)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left"},onMouseEnter:r=>{r.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Reply"}),l&&e.jsx("button",{type:"button",disabled:!_,onClick:()=>{if(!_)return;a(!1);const r=Array.isArray(t.content)?t.content.join(`
|
|
16
|
+
`):t.content||t.text||"";M(r),b(!0),w(!1)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:_?"pointer":"not-allowed",fontSize:13,fontWeight:400,color:_?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left",opacity:_?1:.5},onMouseEnter:r=>{_&&(r.currentTarget.style.background="var(--surface-hover, #F3F7F7)")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Edit"}),g&&e.jsx("button",{type:"button",onClick:()=>{a(!1),T(!0)},style:{display:"flex",width:"100%",padding:"10px 16px",alignItems:"center",border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%",textAlign:"left"},onMouseEnter:r=>{r.currentTarget.style.background="var(--surface-hover, #F3F7F7)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Delete"})]})]})]}),H?e.jsxs("div",{style:{display:"flex",width:662,maxWidth:"100%",padding:"8px 12px 12px 12px",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxSizing:"border-box",marginTop:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"normal"},children:["“"," ",((ge=t.author)==null?void 0:ge.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>b(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(u.X,{size:20,color:"var(--Grey-Muted, #808183)"})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:y,value:I,onChange:r=>M(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),I.trim()&&(l==null||l({...t,content:I.trim(),isEdited:!0}),b(!1))}r.key==="Escape"&&b(!1)},autoFocus:!0,rows:1,style:{flex:1,padding:"10px 12px",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",border:"none",background:"transparent",outline:"none",boxSizing:"border-box",resize:"none",minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:()=>{I.trim()&&(l==null||l({...t,content:I.trim(),isEdited:!0}),b(!1))},disabled:!I.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:I.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:I.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:I.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",flexShrink:0,transition:"all 0.15s",lineHeight:"150%"},children:"Save"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,alignItems:"flex-start"},children:Se.map((r,Y)=>e.jsx("div",{style:{fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",lineHeight:"160%",fontFamily:"var(--default-font-family)",padding:"8px 12px",background:i?"var(--surface-hover, #F3F7F7)":"var(--surface-warm-40, rgba(243, 241, 229, 0.40))",borderRadius:8,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:r},Y))}),L&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,marginTop:8,fontSize:13,fontFamily:"var(--default-font-family)"},children:[e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontWeight:400},children:"Confirm: delete this comment?"}),e.jsx("button",{type:"button",onClick:()=>{T(!1),g==null||g(t)},style:{background:"var(--grey-light, #e9e8e8a1)",border:"none",cursor:"pointer",fontSize:13,fontWeight:600,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",padding:"4px 10px",borderRadius:6,transition:"background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.background="var(--Grey-absent, #D9D9D9)"},onMouseLeave:r=>{r.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>T(!1),style:{background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",padding:"4px 10px",borderRadius:6,transition:"background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.background="var(--grey-light, #e9e8e8a1)"},onMouseLeave:r=>{r.currentTarget.style.background="none"},children:"Cancel"})]}),x&&o&&!j&&!L&&e.jsxs("button",{type:"button",onClick:()=>{b(!1),w(!0)},style:{display:"flex",alignItems:"center",gap:6,marginTop:8,padding:0,border:"none",background:"transparent",cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",transition:"color 0.15s"},children:[e.jsx(u.CornerDownRight,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),"Reply"]}),j&&e.jsxs("div",{style:{display:"flex",width:662,maxWidth:"100%",padding:"8px 12px 12px 12px",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",boxSizing:"border-box",marginTop:12},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"normal"},children:["“"," ",((he=t.author)==null?void 0:he.name)||"Unknown"]}),e.jsx("button",{type:"button",onClick:()=>{G(""),w(!1)},style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:e.jsx(u.X,{size:20,color:"var(--Grey-Muted, #808183)"})})]}),e.jsx("div",{style:{display:"flex",height:36,padding:16,alignItems:"center",gap:5,borderRadius:"0 8px 8px 8px",background:"var(--Grey-Strong, #2E3236)",boxSizing:"border-box",width:"100%"},children:e.jsx("span",{style:{color:"var(--Grey-White, #FFF)",fontSize:13,fontWeight:400,fontFamily:"var(--default-font-family)",lineHeight:"normal",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(t.content)?t.content[0]:t.content})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:m,value:k,onChange:r=>G(r.target.value),onKeyDown:r=>{if(r.key==="Enter"){if(r.metaKey||r.ctrlKey||r.shiftKey)return;r.preventDefault(),k.trim()&&(s==null||s({content:k.trim(),parentId:t.id}),G(""),w(!1))}r.key==="Escape"&&(G(""),w(!1))},autoFocus:!0,placeholder:"Add a reply",rows:1,style:{flex:1,padding:"10px 12px",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",border:"none",background:"transparent",outline:"none",boxSizing:"border-box",resize:"none",minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:()=>{k.trim()&&(s==null||s({content:k.trim(),parentId:t.id}),G(""),w(!1))},disabled:!k.trim(),style:{display:"flex",height:28,padding:"8px 12px",justifyContent:"center",alignItems:"center",gap:8,fontSize:13,fontWeight:600,color:k.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:k.trim()?"var(--Neutral-850, #272727)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:10,cursor:k.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Post"})]})]})]})]})},pn=({currentUser:t,onSubmit:i})=>{const[n,o]=d.useState(""),[s,l]=d.useState(!1),g=d.useRef(null);d.useEffect(()=>{const a=g.current;if(!a)return;a.style.height="auto";const j=140;a.style.height=Math.min(a.scrollHeight,j)+"px",a.style.overflowY=a.scrollHeight>j?"auto":"hidden"},[n]);const h=()=>{const a=n.trim();a&&(i==null||i(a),o(""))},x=a=>{if(a.key==="Enter"){if(a.metaKey||a.ctrlKey||a.shiftKey)return;a.preventDefault(),h()}},W=(t==null?void 0:t.initials)||be(t==null?void 0:t.name),v=pt(t),S=t==null?void 0:t.avatar;return e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"flex-start"},children:[e.jsx(ut,{name:t==null?void 0:t.name,initials:W,color:v,avatar:S}),e.jsx("div",{style:{flex:1,padding:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:24,borderRadius:8,border:s?"1px solid var(--Grey-Strong, #2E3236)":"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-White, #FFF)",transition:"border-color 0.15s"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8,width:"100%"},children:[e.jsx("textarea",{ref:g,value:n,onChange:a=>o(a.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),onKeyDown:x,placeholder:"Add feedback",rows:1,style:{flex:1,border:"none",outline:"none",resize:"none",fontSize:13,fontWeight:400,color:"var(--text-ink, #1E2125)",fontFamily:"var(--default-font-family)",lineHeight:"160%",background:"transparent",padding:0,minHeight:24,maxHeight:140,overflowY:"hidden"}}),e.jsx("button",{type:"button",onClick:h,disabled:!n.trim(),style:{display:"flex",padding:"6px 16px",justifyContent:"center",alignItems:"center",fontSize:13,fontWeight:600,color:n.trim()?"var(--Grey-White, #FFF)":"var(--Grey-Muted, #808183)",background:n.trim()?"var(--Grey-Strong, #2E3236)":"var(--grey-light, #e9e8e8a1)",border:"none",borderRadius:6,cursor:n.trim()?"pointer":"not-allowed",fontFamily:"var(--default-font-family)",transition:"all 0.15s",flexShrink:0,lineHeight:"150%"},children:"Post"})]})})]})},xt=({comment:t,depth:i=0,isConsecutive:n=!1,onReply:o,onSendReply:s,onEdit:l,onDelete:g,onMenuClick:h})=>{const x=t.replies&&t.replies.length>0,W=!x;return e.jsxs(d.Fragment,{children:[e.jsx("div",{style:{paddingLeft:i>0?Math.min(i*32,128):0},children:e.jsx(hn,{comment:t,isReply:i>0,isConsecutive:n,onReply:o,onSendReply:s,onEdit:l,onDelete:g,onMenuClick:h,showReply:W})}),x&&t.replies.map(v=>e.jsx(xt,{comment:v,depth:i+1,onReply:o,onSendReply:s,onEdit:l,onDelete:g,onMenuClick:h},v.id))]})},yt=({comments:t=[],totalComments:i,children:n,onSendComment:o,onReply:s,onSendReply:l,onEdit:g,onDelete:h,onMenuClick:x,onMarkResolved:W,currentUser:v,isResolved:S=!1})=>{const[a,j]=d.useState([]),[w,k]=d.useState(!1),G=d.useMemo(()=>{const m=new Set(t.map(c=>c.id)),y=a.filter(c=>!m.has(c.id));return[...t,...y]},[t,a]);d.useEffect(()=>{const m=new Set(t.map(y=>y.id));j(y=>y.filter(c=>!m.has(c.id)))},[t]);const H=d.useMemo(()=>{if(!v)return{name:"You",initials:"YO",color:"#6B7C93"};const m=v.name||"You",y=v.initials||be(m),c=pt(v);return{...v,name:m,initials:y,color:c}},[v]),b=async({content:m,parentId:y})=>{if(l){k(!0);try{await l({content:m,parentId:y})}finally{k(!1)}}else{const c={id:`temp-${Date.now()}`,author:H,content:m,timestamp:"Just now",parentId:y,isOptimistic:!0};j(D=>[...D,c])}},I=async m=>{if(o){k(!0);try{await o(m)}finally{k(!1)}}else{const y={id:`temp-${Date.now()}`,author:H,content:m,timestamp:"Just now",isOptimistic:!0};j(c=>[...c,y])}},M=m=>{j(y=>y.map(c=>c.id===m.id?{...c,content:m.content,isEdited:!0}:c)),g==null||g(m)},L=m=>{j(y=>y.filter(c=>c.id!==m.id)),h==null||h(m)},T=d.useMemo(()=>{const m={};G.forEach(c=>{c.parentId&&(m[c.parentId]||(m[c.parentId]=[]),m[c.parentId].push(c))});const y=c=>({...c,replies:(m[c.id]||[]).map(y)});return G.filter(c=>!c.parentId).map(y)},[G]),O=i??G.length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",background:"var(--Grey-White, #FFF)",width:"100%",fontFamily:"var(--default-font-family)"},children:[e.jsxs("div",{style:{display:"flex",height:40,paddingBottom:8,alignItems:"center",gap:8,alignSelf:"stretch"},children:[e.jsx(u.MessagesSquare,{size:24,color:"var(--rail-orange, #C98A5A)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",textTransform:"uppercase",lineHeight:1.2},children:"Feedback & Guidance"})]}),e.jsx("div",{style:{width:"100%",height:1,background:"var(--Grey-absent, #D9D9D9)"}}),e.jsxs("div",{style:{display:"flex",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingTop:16,paddingBottom:8},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.MessagesSquare,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Feedback"}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",marginLeft:"auto"},children:[O," Comment",O!==1?"s":""]}),S?e.jsxs("div",{style:{display:"inline-flex",height:32,padding:"12px 16px 12px 12px",justifyContent:"center",alignItems:"center",gap:8,borderRadius:10,background:"var(--Rail-Surface-2, #E3E1D7)",flexShrink:0},children:[e.jsx(u.Check,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:2}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--default-font-family)",lineHeight:"150%"},children:"Resolved"})]}):W?e.jsxs("button",{type:"button",onClick:W,style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",fontSize:13,fontWeight:500,color:"var(--Grey-Strong, #2E3236)",background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:20,cursor:"pointer",fontFamily:"var(--default-font-family)",transition:"background 0.15s",lineHeight:"150%",flexShrink:0},children:[e.jsx(u.CircleCheck,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),"Mark as Resolved"]}):null]}),G.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0,marginBottom:24,maxHeight:600,overflowY:G.length>6?"auto":"visible"},children:T.map((m,y)=>{var Q,J;const c=y>0?T[y-1]:null,D=((Q=c==null?void 0:c.author)==null?void 0:Q.name)||(c==null?void 0:c.author_name),V=((J=m.author)==null?void 0:J.name)||m.author_name,Z=c&&D===V&&(!c.replies||c.replies.length===0);return e.jsx(xt,{comment:m,depth:0,isConsecutive:!!Z,onReply:s,onSendReply:b,onEdit:M,onDelete:L,onMenuClick:x},m.id)})}),G.length>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:16,marginLeft:48},children:[e.jsx(u.Info,{size:16,color:"var(--Grey-Muted, #808183)"}),e.jsx("span",{style:{color:"var(--Grey-Muted, #808183)",fontSize:13,fontStyle:"normal",fontWeight:400,lineHeight:"normal"},children:"Comments can be edited within 15 minutes."})]}),w&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 0"},children:[e.jsx("div",{style:{width:16,height:16,border:"2px solid var(--Grey-absent, #D9D9D9)",borderTopColor:"var(--Grey-Strong, #2E3236)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsx("span",{style:{fontSize:13,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)"},children:"Sending..."}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}),e.jsx(pn,{currentUser:H,onSubmit:I})]}),e.jsx("div",{style:{flex:1,minWidth:0},children:n})]})]})},lt=({children:t,size:i=28,onClick:n,title:o})=>{const[s,l]=d.useState(!1);return e.jsx("div",{title:o,onClick:n,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i,borderRadius:9999,background:s?"var(--surface-hover, #F3F7F7)":"transparent",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},children:t})},un=t=>{const i=Math.floor(t/6e4),n=Math.floor(t%6e4/1e3);return`${i.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`},xn=({item:t,isLast:i,onPlayEvidence:n,onShowInTranscript:o,timelinePlaying:s,currentTimeSeconds:l})=>{var a;const g=(a=t.signal_refs)==null?void 0:a.map(j=>{const w=j.display_name||j.signal_key||"",k=j.confidence!=null?` (${Math.round(j.confidence*100)}%)`:"";return w+k}).join(", "),h=t.start_ms??t.startMs,x=t.end_ms??t.endMs,W=h!=null,v=(l??0)*1e3,S=s&&W&&v>=h&&v<=(x??h+5e3);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 0",borderBottom:i?"none":"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx("span",{style:{alignSelf:"stretch",fontSize:14,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:"150%"},children:t.title||t.detail||""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[g&&e.jsx("span",{style:{fontSize:14,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",flex:1,minWidth:0},children:g}),W&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(lt,{size:28,title:S?"Pause":"Play evidence",onClick:()=>n==null?void 0:n({start_ms:h,end_ms:x}),children:S?e.jsx(u.PauseCircle,{size:17,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1}):e.jsx(u.PlayCircle,{size:17,color:"var(--Grey-Muted, #808183)",strokeWidth:1})}),e.jsx(lt,{size:28,title:"Show in transcript",onClick:()=>o==null?void 0:o(h),children:e.jsx(u.ScrollText,{size:16,color:"#808183",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.2,whiteSpace:"nowrap"},children:un(h)})]})]})]})},mt=({items:t=[],guidanceCount:i,loading:n=!1,onPlayEvidence:o,onShowInTranscript:s,timelinePlaying:l=!1,currentTimeSeconds:g=0})=>{const h=i??t.length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingTop:16,paddingBottom:8},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.Lightbulb,{style:{width:20,height:20,flexShrink:0},color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5})}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:"var(--Grey-Strong, #2E3236)"},children:"Guidance"}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",fontFamily:"var(--default-font-family)",lineHeight:"150%",marginLeft:"auto"},children:[h," Item",h!==1?"s":""]})]}),t.map((x,W)=>e.jsx(xn,{item:x,isLast:W===t.length-1,onPlayEvidence:o,onShowInTranscript:s,timelinePlaying:l,currentTimeSeconds:g},W))]})},ie=({text:t,children:i})=>{const[n,o]=d.useState(!1),s=d.useRef(null),[l,g]=d.useState({top:0,left:0});if(!t)return i;const h=()=>{if(s.current){const x=s.current.getBoundingClientRect();g({top:x.bottom+6,left:x.left+x.width/2})}o(!0)};return e.jsxs("div",{ref:s,style:{position:"relative",display:"inline-flex"},onMouseEnter:h,onMouseLeave:()=>o(!1),children:[i,n&&e.jsx("div",{style:{position:"fixed",top:l.top,left:l.left,transform:"translate(-50%, 0)",display:"flex",padding:10,alignItems:"center",borderRadius:4,border:"1px solid var(--Grey-absent, #D9D9D9)",background:"var(--Grey-Strong, #2E3236)",zIndex:9999,pointerEvents:"none",whiteSpace:"nowrap"},children:e.jsx("span",{style:{color:"#FFF",fontSize:12,fontWeight:400,lineHeight:"normal"},children:t})})]})},yn=[{key:"overview",label:"Overview"},{key:"coaching",label:"Coaching Summary"},{key:"signals",label:"Signals & Recording"},{key:"comments",label:"Feedback"}],mn=({title:t="Wheel Stud Replacement Enquiry",onBack:i,data:n,coachingData:o,coachingLoading:s=!1,audioUrl:l,audioRef:g,currentTimeSeconds:h,timelinePlaying:x,playbackRate:W,timelineSegments:v,onSeek:S,onTogglePlay:a,onSeekBack:j,onSeekForward:w,onSetPlaybackRate:k,agentName:G,agentFullName:H,customerName:b,customerFullName:I,transcript:M,activeTurnIndex:L,turnObservations:T,highlightedTurns:O,onTurnPlayPause:m,onPlayEvidence:y,onHighlightTurns:c,callPurpose:D,classification:V,outcomeQuality:Z,resolutionOutcome:Q,customerIntent:J,interactionId:re,moreDetails:p,compassScore:_,compassMaxScore:X=5,predictedCsat:Se,predictedLabel:ge="Predicted Objective",compassLegends:he,customerSessions:r,customerSessionCount:Y,onSessionClick:Ge,onViewAllSessions:Me,prevSessionDesc:Ee,prevSessionDisabled:U=!1,nextSessionDesc:Re,nextSessionDisabled:ee=!1,onPreviousSession:pe,onNextSession:ue,comments:He=[],guidance:vt=[],currentUser:B,onSendComment:jt,onSendReply:bt,onReply:St,onEdit:wt,onEditInteraction:kt,onDelete:Ct,onMenuClick:Ft,onMarkResolved:Wt,commentsResolved:It})=>{var Je;const[we,xe]=d.useState("overview"),[Dt,Te]=d.useState(new Set),[zt,le]=d.useState(!1),[_e,Ae]=d.useState(null),[Le,Be]=d.useState(!1),[Ne,Gt]=d.useState(0),[Pe,Mt]=d.useState(!1),te=d.useRef(null),ye=d.useRef(null),ke=d.useRef(null),oe=d.useRef(null),Ce=d.useRef(null),Et={overview:ye,coaching:ke,signals:oe,comments:Ce},ae=d.useRef(null),Fe=d.useRef(!1);d.useEffect(()=>{const f=ae.current;if(!f)return;const z=["overview","coaching","signals","comments"],E=[ye,ke,oe,Ce],R=($=>{let ne=$.parentElement;for(;ne;){const{overflow:je,overflowY:se}=window.getComputedStyle(ne);if(/(auto|scroll)/.test(je+se))return ne;ne=ne.parentElement}return null})(f),q=()=>{var je;if(Fe.current)return;let $=z[0];for(let se=E.length-1;se>=0;se--){const Xe=E[se].current;if(!Xe)continue;if(Xe.getBoundingClientRect().top<=150){$=z[se];break}}xe($);const ne=((je=ye.current)==null?void 0:je.getBoundingClientRect().top)??Number.POSITIVE_INFINITY;Mt(ne<=150)};return f.addEventListener("scroll",q,{passive:!0}),R&&R!==f&&R.addEventListener("scroll",q,{passive:!0}),window.addEventListener("scroll",q,{passive:!0,capture:!0}),q(),()=>{f.removeEventListener("scroll",q),R&&R!==f&&R.removeEventListener("scroll",q),window.removeEventListener("scroll",q,{capture:!0})}},[]);const Oe=d.useRef(null),Rt=f=>{var E;xe(f),Fe.current=!0,Oe.current=f;const z=(E=Et[f])==null?void 0:E.current;if(z){const C=ae.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,$=z.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:$,behavior:"smooth"})}else{const R=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}setTimeout(()=>{Fe.current=!1,Oe.current=null},1200)},We=r||[],Ie=We.length>1,$e=f=>{xe("signals");const z=oe.current;if(z){const C=ae.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,$=z.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:$,behavior:"smooth"})}else{const R=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}const E=f/1e3;setTimeout(()=>{var C;(C=te.current)!=null&&C.scrollToTranscript&&te.current.scrollToTranscript(E)},220)},Ye=f=>{xe("signals");const z=oe.current;if(z){const C=ae.current;if(C&&C.scrollHeight>C.clientHeight){const R=C.getBoundingClientRect().top,$=z.getBoundingClientRect().top-R+C.scrollTop-16;C.scrollTo({top:$,behavior:"smooth"})}else{const R=z.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}}const E=(f==null?void 0:f.start_ms)??(f==null?void 0:f.startMs);setTimeout(()=>{var C,R;if(E!=null&&((C=te.current)!=null&&C.scrollToTranscript)&&te.current.scrollToTranscript(E/1e3),y)y(f);else if(E!=null&&((R=te.current)!=null&&R.seekTo)){te.current.seekTo(E/1e3),Be(!0),Gt(E/1e3);const $=(f.end_ms??f.endMs??E+5e3)-E;setTimeout(()=>Be(!1),$)}},220)},Ht=f=>{c&&c(f)},Tt=f=>{Te(z=>{const E=new Set(z);return E.has(f)?E.delete(f):E.add(f),E})},_t=(n==null?void 0:n.blocks)||[],de=f=>{var z;return((z=_t.find(E=>E.block_id===f))==null?void 0:z.payload)||{}},K=de("interaction-metadata"),ce=de("interaction-context"),me=de("interaction-signals"),At=de("interaction-outcome-lift"),Lt=de("interaction-dimensions").dimensions||[],Bt=ce.call_purpose||{},Nt=ce.classification||{},Ke=K||{},qe=D||Bt||{},Pt=V||Nt||{},Ve=At||{},Ot=(Ve.driver_signal_keys||[]).map(f=>f.replace(/^sig\./,"").replace(/_/g," ")),$t=o||null,Yt=(Je=me==null?void 0:me.signals)!=null&&Je.length?me:{present_count:0,total_signals_evaluated:0,signals:[]},Ze=vt||[],De=G||K.agent_name||K.agent||ce.agent_name||"Agent",Kt=H||K.agent_full_name||K.agent_name||De,fe=b||K.customer_name||K.customer||ce.customer_name||"Customer",Qe=I||K.customer_full_name||K.customer_name||fe,qt=String((B==null?void 0:B.role)??(B==null?void 0:B.userRole)??(B==null?void 0:B.user_role)??(B==null?void 0:B.roleName)??(B==null?void 0:B.role_name)??"").toLowerCase(),Vt=/(admin|superadmin|administrator)/.test(qt),ze=Y??We.length,ve=K.created_dt||(n==null?void 0:n.created_dt)||ce.created_dt||"",Zt=ve?new Date(/Z$|[+-]\d{2}:\d{2}$/.test(ve)?ve:ve+"Z").toLocaleString():"",Qt=qe.interaction_direction==="inbound"?"Inbound":"Outbound";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",background:"var(--Grey-White, #FFF)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"18px 24px 0"},children:[e.jsx("button",{onClick:i,style:{display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0,flexShrink:0},children:e.jsx(u.ArrowLeft,{size:24,color:"var(--Grey-Strong, #2E3236)"})}),e.jsx("div",{style:{width:1,height:28,background:"var(--Base-absent, #D9D9D9)"}}),e.jsx("h1",{style:{color:"var(--Grey-Strong, #2E3236)",fontSize:24,fontStyle:"normal",fontWeight:400,lineHeight:"normal",margin:0,flex:1},children:t}),(pe||ue)&&!Pe&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(ie,{text:Ee,children:e.jsxs("button",{onClick:U?void 0:pe,disabled:U,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:U?"default":"pointer",opacity:U?.4:1},children:[e.jsx(u.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(ie,{text:Re,children:e.jsxs("button",{onClick:ee?void 0:ue,disabled:ee,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ee?"default":"pointer",opacity:ee?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(u.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]}),e.jsx("div",{style:{position:"sticky",top:68,zIndex:20,background:"var(--Grey-White, #FFF)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,background:"var(--Grey-White, #FFF)",borderBottom:"1px solid var(--Grey-Faint, #ACADAD)",padding:"0 24px",marginTop:8},children:[e.jsx("div",{style:{display:"flex",alignItems:"flex-start",minWidth:0},children:yn.map(f=>e.jsx("button",{onClick:()=>Rt(f.key),style:{display:"flex",padding:16,alignItems:"center",gap:10,background:"none",border:"none",borderBottom:we===f.key?"3px solid var(--Grey-Strong, #2E3236)":"3px solid transparent",cursor:"pointer",fontSize:15,fontWeight:we===f.key?500:400,color:we===f.key?"var(--Grey-Strong, #2E3236)":"var(--Grey-Muted, #808183)",whiteSpace:"nowrap",transition:"border-color 0.2s ease, color 0.2s ease"},children:f.label},f.key))}),(pe||ue)&&Pe&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:[e.jsx(ie,{text:Ee,children:e.jsxs("button",{onClick:U?void 0:pe,disabled:U,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:U?"default":"pointer",opacity:U?.4:1},children:[e.jsx(u.ArrowLeft,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5}),e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Previous Interaction"})]})}),e.jsx("div",{style:{width:1,height:20,background:"var(--Grey-absent, #D9D9D9)",flexShrink:0}}),e.jsx(ie,{text:Re,children:e.jsxs("button",{onClick:ee?void 0:ue,disabled:ee,style:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",background:"none",border:"none",cursor:ee?"default":"pointer",opacity:ee?.4:1},children:[e.jsx("span",{style:{color:"var(--Neutral-800, #323232)",fontSize:13,fontWeight:400,lineHeight:"24px",fontFamily:"var(--default-font-family)",whiteSpace:"nowrap"},children:"Next Interaction"}),e.jsx(u.ArrowRight,{size:16,color:"var(--Neutral-800, #323232)",strokeWidth:1.5})]})})]})]})}),e.jsxs("div",{ref:ae,style:{padding:24,flex:1,overflowY:"auto"},children:[e.jsxs("div",{ref:ye,style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"flex-start",gap:24,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",height:40,alignItems:"center",gap:16,alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1},children:[e.jsx(u.ClipboardList,{size:24,color:"var(--rail-orange, #C98A5A)",strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,textTransform:"uppercase"},children:"Overview"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(u.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:Zt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0"},children:[e.jsx(u.PhoneIncoming,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:Qt})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,paddingLeft:16,borderLeft:"1px solid var(--Grey-absent, #D9D9D9)"},children:[e.jsx(ie,{text:Kt,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 0",cursor:"pointer"},children:[e.jsx(u.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",fontFamily:"var(--font-sans)",lineHeight:1.2},children:De})]})}),ze>1?e.jsx("div",{children:e.jsx(ie,{text:Qe,children:e.jsxs("button",{onClick:()=>le(!0),style:{display:"flex",alignItems:"center",gap:16,padding:"0 16px",height:34,borderRadius:8,background:"var(--Rail-Surface-2, #E3E1D7)",border:"none",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[e.jsx(u.CircleUser,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:fe})," ",e.jsxs("span",{children:["(",ze," Interactions)"]})]})]}),e.jsx(u.ChevronRight,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})]})})}):e.jsx(ie,{text:Qe,children:e.jsxs("button",{onClick:()=>le(!0),style:{display:"flex",alignItems:"center",gap:16,padding:"0 16px",height:34,borderRadius:8,background:"var(--Rail-Surface-2, #E3E1D7)",border:"none",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[e.jsx(u.CircleUser,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap"},children:fe})]}),e.jsx(u.ChevronRight,{size:16,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})]})})]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"stretch",gap:24,alignSelf:"stretch"},children:[e.jsx("div",{style:{flex:1,minWidth:0,display:"flex"},children:e.jsx(gt,{score:_??.5,minScore:0,maxScore:X,predictedScore:Se??.5,predictedLabel:ge,legends:he})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-end",gap:24,flex:1,minWidth:0},children:[e.jsx(dt,{meta:Ke,callPurpose:qe,classification:Pt,outcomeQuality:Z||"Neutral",dimensions:Lt,resolutionOutcome:Q,customerIntent:J,interactionId:re??K.interaction_id,moreDetails:p,canShowEditButton:Vt,onEditInteraction:kt}),e.jsx(ct,{outcomeLift:Ve,driverLabels:Ot})]})]})]}),e.jsx("div",{ref:ke,style:{paddingTop:24},children:e.jsx(at,{data:s?null:$t,loading:s})}),e.jsxs("div",{ref:oe,style:{display:"flex",flexDirection:"column",gap:16,alignSelf:"stretch",paddingTop:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(u.FileSignal,{size:24,color:"#C98A5A",strokeWidth:2}),e.jsx("span",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,textTransform:"uppercase"},children:"Signals & Recording"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:24,alignSelf:"stretch",paddingTop:16,borderTop:"1px solid #D9D9D9"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(ft,{signals:Yt,expandedSignals:Dt,toggleSignal:Tt,playEvidence:Ye,highlightTurns:Ht,onShowInTranscript:$e,timelinePlaying:x||Le,currentTimeSeconds:h??Ne})}),e.jsx("div",{style:{flex:1,minWidth:0},children:e.jsx(ot.UpdatedInteractionRecording,{ref:te,audioUrl:l,durationSeconds:Ke.duration_seconds,audioRef:g,agentName:De,customerName:fe,currentTimeSeconds:h,timelinePlaying:x,playbackRate:W,timelineSegments:v,onSeek:S,onTogglePlay:a,onSeekBack:j,onSeekForward:w,onSetPlaybackRate:k,transcript:M,activeTurnIndex:L,turnObservations:T,highlightedTurns:O,onTurnPlayPause:m,setExpandedSignals:Te})})]})]}),e.jsx("div",{ref:Ce,style:{paddingTop:24},children:e.jsx(yt,{comments:He,totalComments:He.length,currentUser:B,onSendComment:jt||(()=>{}),onSendReply:bt||(()=>{}),onReply:St||(()=>{}),onEdit:wt||(()=>{}),onDelete:Ct||(()=>{}),onMenuClick:Ft||(()=>{}),onMarkResolved:Wt||(()=>{}),isResolved:It,children:e.jsx(mt,{items:Ze,guidanceCount:Ze.length,onPlayEvidence:Ye,onShowInTranscript:$e,timelinePlaying:x||Le,currentTimeSeconds:h??Ne})})})]}),e.jsx(Jt.SideDrawer,{open:zt,onClose:()=>le(!1),title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:"50%",background:"var(--surface-hover, #F3F7F7)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(u.CircleUser,{size:20,color:"var(--Grey-Strong, #2E3236)",strokeWidth:1.7})}),e.jsx("div",{style:{minWidth:0},children:e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:fe})})]}),subtitle:Ie?e.jsxs("span",{style:{fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.5},children:[ze," Interactions in Past"]}):null,width:470,height:"100vh",topOffset:70,footer:Ie?e.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:e.jsxs("button",{onClick:()=>{Me&&Me(),le(!1)},style:{display:"flex",height:40,padding:"0 20px 0 18px",justifyContent:"center",alignItems:"center",gap:7,background:"var(--Grey-White, #FFF)",border:"1px solid var(--Grey-absent, #D9D9D9)",borderRadius:10,cursor:"pointer"},children:[e.jsx(u.History,{size:18,color:"var(--Grey-Muted, #808183)",strokeWidth:1.5}),e.jsx("span",{style:{fontSize:15,fontWeight:600,color:"var(--Grey-Strong, #2E3236)"},children:"View All Interactions"})]})}):null,children:e.jsx("div",{style:{borderTop:"1px solid var(--Grey-absent, #D9D9D9)",maxHeight:"100%",overflowY:"auto"},children:Ie?We.map((f,z)=>e.jsxs("div",{onClick:()=>{Ge&&Ge(f),le(!1)},onMouseEnter:()=>Ae(z),onMouseLeave:()=>Ae(null),style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,padding:"16px 12px",borderTop:z===0?"none":"1px solid var(--Grey-absent, #D9D9D9)",background:_e===z?"var(--surface-hover, #F3F7F7)":"var(--Grey-White, #FFF)",cursor:"pointer",transition:"background 0.15s"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:14,display:"flex",alignItems:"center",gap:6,fontWeight:400,color:"var(--Grey-Strong, #2E3236)",lineHeight:1.2,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.title}),f.status&&e.jsxs("div",{style:{fontSize:13,color:"var(--Grey-Strong, #2E3236)",marginBottom:12,lineHeight:1.2},children:[e.jsx("span",{style:{fontWeight:400},children:"Status: "}),e.jsx("span",{style:{fontWeight:400,color:"var(--Grey-Muted, #808183)"},children:f.status})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(u.CalendarDays,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),f.date]}),(f.agent||f.agent_name)&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,fontWeight:400,color:"var(--Grey-Muted, #808183)",lineHeight:1.1},children:[e.jsx(u.Headset,{size:16,color:"var(--Grey-Muted, #808183)",strokeWidth:1.8}),f.agent||f.agent_name]})]})]}),_e===z&&e.jsx(u.ExternalLink,{size:20,color:"var(--Grey-Muted, #808183)",strokeWidth:1.7,style:{flexShrink:0}})]},f.id||z)):e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:140,padding:"24px 12px",color:"var(--Grey-Muted, #808183)",fontSize:14,fontStyle:"italic",textAlign:"center"},children:"No other interactions available"})})})]})};exports.UpdatedInteractionRecording=ot.UpdatedInteractionRecording;exports.UpdatedCoachingSynthesisCard=at;exports.UpdatedCompassScore=gt;exports.UpdatedGuidance=mt;exports.UpdatedInteractionContext=dt;exports.UpdatedInteractionDetails=mn;exports.UpdatedInteractionScores=ct;exports.UpdatedInteractionSignals=ft;exports.UpdatedThreads=yt;
|
|
17
17
|
//# sourceMappingURL=UpdatedInteractionDetails.cjs.js.map
|