chordia-ui 3.4.2 → 3.4.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.
Files changed (31) hide show
  1. package/dist/Timeline.cjs.js +6 -1
  2. package/dist/Timeline.cjs.js.map +1 -1
  3. package/dist/Timeline.es.js +597 -129
  4. package/dist/Timeline.es.js.map +1 -1
  5. package/dist/UpdatedInteractionRecording.cjs.js +1 -1
  6. package/dist/UpdatedInteractionRecording.cjs.js.map +1 -1
  7. package/dist/UpdatedInteractionRecording.es.js +260 -258
  8. package/dist/UpdatedInteractionRecording.es.js.map +1 -1
  9. package/dist/components/UpdatedInteractionDetails.cjs.js +2 -2
  10. package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
  11. package/dist/components/UpdatedInteractionDetails.es.js +349 -322
  12. package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
  13. package/dist/components/media.cjs.js +1 -1
  14. package/dist/components/media.cjs.js.map +1 -1
  15. package/dist/components/media.es.js +8 -9
  16. package/dist/components/media.es.js.map +1 -1
  17. package/dist/index.cjs.js +1 -1
  18. package/dist/index.es.js +52 -53
  19. package/dist/index.es.js.map +1 -1
  20. package/dist/pages/interactionDetails.cjs.js +2 -2
  21. package/dist/pages/interactionDetails.cjs.js.map +1 -1
  22. package/dist/pages/interactionDetails.es.js +16 -17
  23. package/dist/pages/interactionDetails.es.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +35 -1
  26. package/src/components/UpdatedInteractionDetails/UpdatedInteractionRecording.jsx +142 -124
  27. package/src/components/UpdatedInteractionDetails/UpdatedInteractionSignals.jsx +14 -6
  28. package/dist/TranscriptCard.cjs.js +0 -7
  29. package/dist/TranscriptCard.cjs.js.map +0 -1
  30. package/dist/TranscriptCard.es.js +0 -474
  31. package/dist/TranscriptCard.es.js.map +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("../SummarySection.cjs.js"),xe=require("../AgentLiftCard.cjs.js"),e=require("react/jsx-runtime"),p=require("react"),z=require("lucide-react"),ne=require("../SmallButton.cjs.js"),He=require("../SectionLabel.cjs.js");require("../sortable.esm.cjs.js");require("react-dom");require("../TourGuideTooltip.cjs.js");require("recharts");require("../UploadInteraction.cjs.js");require("../colors.cjs.js");require("../UpdatedInteractionRecording.cjs.js");const Je=require("../Timeline.cjs.js"),Qe=require("../TranscriptCard.cjs.js");require("../Tooltip.cjs.js");const We="coaching-synthesis-keyframes";function Xe(){if(typeof document>"u"||document.getElementById(We))return;const n=document.createElement("style");n.id=We,n.textContent=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("../SummarySection.cjs.js"),xe=require("../AgentLiftCard.cjs.js"),e=require("react/jsx-runtime"),p=require("react"),z=require("lucide-react"),ne=require("../SmallButton.cjs.js"),He=require("../SectionLabel.cjs.js");require("../sortable.esm.cjs.js");require("react-dom");require("../TourGuideTooltip.cjs.js");require("recharts");require("../UploadInteraction.cjs.js");require("../colors.cjs.js");require("../UpdatedInteractionRecording.cjs.js");const Oe=require("../Timeline.cjs.js");require("../Tooltip.cjs.js");const We="coaching-synthesis-keyframes";function Qe(){if(typeof document>"u"||document.getElementById(We))return;const n=document.createElement("style");n.id=We,n.textContent=`
2
2
  @keyframes coaching-shimmer {
3
3
  0% { background-position: -200% 0; }
4
4
  100% { background-position: 200% 0; }
@@ -7,5 +7,5 @@
7
7
  0%, 100% { opacity: 0.4; }
8
8
  50% { opacity: 1; }
9
9
  }
10
- `,document.head.appendChild(n)}function Oe({data:n,loading:o,error:s}){var C,T;if(p.useEffect(()=>{Xe()},[]),o)return e.jsxs("div",{style:{padding:"20px 0",display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:"var(--rail-tone)",animation:"coaching-pulse 1.5s ease-in-out infinite"}}),e.jsx("span",{style:{fontSize:"var(--text-base)",color:"var(--rail-tone)",fontFamily:"var(--font-sans)",fontWeight:500},children:"Compass is synthesizing coaching insights…"})]}),[180,260,220].map((S,x)=>e.jsx("div",{style:{height:10,width:S,maxWidth:"100%",borderRadius:4,background:"linear-gradient(90deg, var(--hover-warm-subtle) 25%, var(--hover-warm) 50%, var(--hover-warm-subtle) 75%)",backgroundSize:"200% 100%",animation:"coaching-shimmer 1.8s ease-in-out infinite",animationDelay:`${x*.2}s`}},x))]});if(s)return e.jsx("div",{style:{padding:"16px 0",fontSize:"var(--text-base)",color:"var(--text-faint)",fontFamily:"var(--font-sans)"},children:"Unable to generate coaching summary."});if(!n)return null;const a=n.strengths||[],i=n.improvements||[],m=n.organizational||n.organizational_insights||[],b=typeof n.one_liner=="string"?n.one_liner:((C=n.one_liner)==null?void 0:C.text)||"",h=typeof n.context=="string"?n.context:((T=n.context)==null?void 0:T.text)||"";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,fontFamily:"var(--font-sans)"},children:[b&&e.jsx("div",{style:{fontSize:"var(--text-lg)",fontWeight:600,color:"var(--text-strong)",lineHeight:1.4},children:b}),h&&e.jsx("div",{style:{fontSize:"var(--text-base)",color:"var(--text-muted)",lineHeight:1.45},children:h}),a.length>0&&e.jsx(Be,{icon:e.jsx(z.TrendingUp,{size:13}),label:"Strengths",color:"var(--rail-discovery)",items:a}),i.length>0&&e.jsx(Be,{icon:e.jsx(z.Lightbulb,{size:13}),label:"Improvements",color:"var(--rail-compliance)",items:i}),m.length>0&&e.jsx(Be,{icon:e.jsx(z.Building,{size:13}),label:"Organizational",color:"var(--rail-outcome)",items:m}),n.overall&&e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-faint)",fontStyle:"italic",marginTop:2},children:["Overall: ",n.overall.replace(/_/g," ")]})]})}function Be({icon:n,label:o,color:s,items:a}){return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:6,color:s,fontSize:"var(--text-base)",fontWeight:650,letterSpacing:"0.04em"},children:[n,o]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map((i,m)=>{const b=typeof i=="string"?i:(i==null?void 0:i.text)||"",h=typeof i=="object"?i==null?void 0:i.quote:null;return e.jsxs("div",{style:{paddingLeft:14},children:[e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-base)",lineHeight:1.4},children:["• ",b]}),h&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:4,marginTop:3,paddingLeft:8},children:[e.jsx(z.MessageSquareQuote,{size:10,style:{color:"var(--text-faint)",flexShrink:0,marginTop:2}}),e.jsxs("span",{style:{fontSize:"var(--text-base)",color:"var(--text-muted)",fontStyle:"italic",lineHeight:1.35},children:['"',h,'"']})]})]},m)})})]})}function Ue(n){const o=Math.floor(n/60),s=Math.round(n%60);return`${o}:${s.toString().padStart(2,"0")}`}function $e({title:n,meta:o,callPurpose:s,classification:a,dimensions:i}){const m=s||{},b=a||{};return e.jsxs(ne.Card,{variant:"elevated",padding:"sm",children:[e.jsx("div",{style:{fontSize:"var(--text-md)",fontWeight:550,color:"var(--text-strong)",lineHeight:1.375,marginBottom:6},children:n}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"4px 12px",fontSize:11,color:"var(--text-muted)"},children:[o.evaluated_dt&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Date"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:new Date(o.evaluated_dt).toLocaleString()})]}),o.duration_seconds!=null&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Duration"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:Ue(o.duration_seconds)})]}),o.message_count&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Messages"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:o.message_count})]}),m.interaction_direction&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Direction"}),e.jsx("div",{style:{color:"var(--text-base)"},children:m.interaction_direction})]}),m.interaction_driver&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Driver"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:m.interaction_driver})]}),m.customer_intent&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Intent"}),e.jsx("div",{style:{color:"var(--text-base)"},children:m.customer_intent})]}),b.interaction_paradigm&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Paradigm"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:b.interaction_paradigm})]}),i.map((h,C)=>e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:10,color:"var(--text-faint)"},children:h.label||h.key}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:h.value})]},C))]}),o.session_id&&e.jsx("div",{style:{fontSize:10,color:"var(--text-faint)",fontFamily:"var(--font-mono)",marginTop:4,userSelect:"all"},children:o.session_id})]})}function et({scores:n}){return n!=null&&n.length?e.jsx(ne.DetailCard,{title:"Scores",children:e.jsx("div",{style:{display:"flex",gap:24,flexWrap:"wrap"},children:n.map((o,s)=>{const a=o.value!=null?Math.round(o.value):null;return e.jsxs("div",{style:{textAlign:"center",minWidth:48},children:[e.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--text-ink)"},children:a??"—"}),e.jsx("div",{style:{fontSize:"var(--text-sm)",color:"var(--text-muted)",marginTop:2},children:o.label||o.key})]},s)})})}):null}const Pe={outcome:{label:"Outcome",icon:e.jsx(z.Target,{size:12}),color:"var(--rail-outcome)"},process:{label:"Process & Protocol",icon:e.jsx(z.FileText,{size:12}),color:"var(--rail-discovery)"},compliance:{label:"Compliance",icon:e.jsx(z.Scale,{size:12}),color:"var(--rail-compliance)"},customer_friction:{label:"Customer Friction",icon:e.jsx(z.Zap,{size:12}),color:"var(--rail-coral)"},experience:{label:"Experience",icon:e.jsx(z.MessageSquare,{size:12}),color:"var(--rail-teal)"}},tt={risk:{icon:e.jsx(z.Zap,{size:10}),color:"var(--rail-signal-churn)"},opportunity:{icon:e.jsx(z.Lightbulb,{size:10}),color:"var(--state-unknown)"},excellence:{icon:e.jsx(z.CheckCircle,{size:10}),color:"var(--rail-teal)"}};function qe({signals:n,expandedSignals:o,toggleSignal:s,playEvidence:a,timelinePlaying:i,currentTimeSeconds:m,highlightTurns:b,borderRadius:h}){var T;if(!((T=n==null?void 0:n.signals)!=null&&T.length))return null;const C=p.useMemo(()=>{const S={};for(const x of n.signals){const j=x.group||"experience";S[j]||(S[j]=[]),S[j].push(x)}return S},[n]);return e.jsx(ne.DetailCard,{title:`Signals (${n.present_count} present / ${n.total_signals_evaluated} evaluated)`,borderRadius:h,children:Object.entries(C).map(([S,x])=>{const j=Pe[S]||Pe.experience;return e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs(He.SectionLabel,{style:{display:"flex",alignItems:"center",gap:4},children:[j.icon,e.jsx("span",{children:j.label})]}),e.jsx("div",{style:{marginTop:4,display:"flex",flexDirection:"column",gap:6},children:x.map((u,y)=>{var D,L,$;const _=u.display_name||u.key||"",F=(D=u.baseline)==null?void 0:D.delta,R=((L=u.observations)==null?void 0:L.length)>0,I=o.has(u.key);return e.jsxs("div",{id:`signal-${u.key}`,style:{border:"1px solid var(--border, rgba(52, 58, 64, 0.12))",borderRadius:"var(--radius-md, 8px)",background:"var(--paper, rgba(255, 255, 255, 0.98))",overflow:"hidden"},children:[e.jsxs("button",{type:"button",onClick:k=>{R&&(s(u.key),k.currentTarget.blur())},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",background:"transparent",borderTop:"1px solid transparent",borderRight:"1px solid transparent",borderLeft:"1px solid transparent",borderBottom:"1px solid var(--border, rgba(52, 58, 64, 0.08))",cursor:R?"pointer":"default"},title:[u.confidence!=null?`Confidence: ${Math.round(u.confidence*100)}%`:"",F!=null?`Δ baseline: ${F>0?"+":""}${(F*100).toFixed(1)}%`:""].filter(Boolean).join(" · "),children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[($=tt[u.kind])==null?void 0:$.icon,e.jsx("span",{children:_}),R&&e.jsxs("span",{style:{marginLeft:4,fontSize:10,opacity:.6},children:["(",u.observations.length,")"]})]}),R&&e.jsx(z.ChevronDown,{size:14,style:{color:"var(--text-muted)",flexShrink:0,transform:I?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.16s ease"}})]}),I&&u.observations&&e.jsx("div",{style:{width:"100%",margin:"0 0 6px"},children:u.observations.map((k,N)=>{var G;return e.jsx("div",{style:{marginBottom:6},children:e.jsxs("div",{style:{display:"flex",borderRadius:"var(--radius-sm, 8px)",background:"var(--paper, #fff)",overflow:"hidden"},children:[e.jsx("div",{style:{width:3,background:j.color}}),e.jsxs("div",{style:{flex:1,fontSize:"var(--text-sm)",color:"var(--text-muted)",padding:"8px 12px"},children:[e.jsx("div",{style:{fontWeight:600,color:"var(--text-base)",marginBottom:3,fontSize:"var(--text-base)"},children:k.key||""}),e.jsx("div",{style:{marginBottom:6,lineHeight:1.4},children:k.reason||k.explanation||""}),(G=k.evidence)==null?void 0:G.map((Z,q)=>{const M=Z.start_ms,A=Z.end_ms;let H=!1;if(M!=null&&i){const O=M/1e3,W=A!=null?A/1e3:O+1,K=m??0;H=K>=O&&K<=W+.25}return e.jsx(xe.EvidenceItem,{ev:Z,isPlaying:H,railColor:j.color,onPlay:(O,W)=>a==null?void 0:a(O,W,Z.turn_ids),onHighlight:b},q)})]})]})},N)})})]},y)})})]},S)})})}const Me={risk:{icon:e.jsx(z.Zap,{size:10}),color:"var(--rail-signal-churn)"},opportunity:{icon:e.jsx(z.Lightbulb,{size:10}),color:"var(--state-unknown)"},excellence:{icon:e.jsx(z.CheckCircle,{size:10}),color:"var(--rail-teal)"}};function Ne({guidance:n,playEvidence:o,timelinePlaying:s,currentTimeSeconds:a,highlightTurns:i,borderRadius:m}){var b;return(b=n==null?void 0:n.items)!=null&&b.length?e.jsx(ne.DetailCard,{title:`Guidance (${n.total_items} items)`,borderRadius:m,children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:n.items.map((h,C)=>{var x;const T=Me[h.guidance_kind]||Me.excellence,S=h.owner==="organization"?{bg:"color-mix(in srgb, var(--rail-discovery) 15%, transparent)",color:"var(--rail-discovery)",text:"ORG"}:h.owner==="shared"?{bg:"color-mix(in srgb, var(--state-unknown) 15%, transparent)",color:"var(--state-unknown)",text:"SHARED"}:{bg:"color-mix(in srgb, var(--rail-teal) 10%, transparent)",color:"var(--rail-teal)",text:"AGENT"};return e.jsxs("div",{style:{padding:"10px 12px",borderRadius:"var(--radius)",background:"var(--paper)",borderLeft:`3px solid ${T.color}`},children:[e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-strong)",display:"flex",alignItems:"center",gap:5,fontWeight:550},children:[T.icon," ",h.title||"",e.jsx("span",{style:{fontSize:9,padding:"1px 6px",borderRadius:8,marginLeft:4,background:S.bg,color:S.color,fontWeight:600},children:S.text})]}),h.detail&&e.jsx("div",{style:{fontSize:"var(--text-sm)",color:"var(--text-muted)",marginTop:4,lineHeight:1.4},children:h.detail}),(x=h.signal_refs)==null?void 0:x.map((j,u)=>{var y;return e.jsxs("div",{style:{marginTop:6},children:[e.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)",fontWeight:600,marginBottom:3,display:"flex",alignItems:"center",gap:3},children:[e.jsx(z.CornerDownRight,{size:10})," ",j.display_name||j.signal_key,j.confidence!=null&&e.jsxs("span",{style:{fontWeight:400,opacity:.7},children:[" ","(",Math.round(j.confidence*100),"%)"]})]}),(y=j.evidence)==null?void 0:y.map((_,F)=>{const R=_.start_ms,I=_.end_ms;let D=!1;if(R!=null&&s){const L=R/1e3,$=I!=null?I/1e3:L+1,k=a??0;D=k>=L&&k<=$+.25}return e.jsx(xe.EvidenceItem,{ev:_,isPlaying:D,onPlay:(L,$)=>o==null?void 0:o(L,$,_.turn_ids),onHighlight:i},F)})]},u)})]},C)})})}):null}function Ke({nba:n}){const o=(n==null?void 0:n.recommendations)||(n==null?void 0:n.actions)||[];return o.length?e.jsx(ne.DetailCard,{title:"Next Best Actions",children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:o.slice(0,8).map((s,a)=>e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[e.jsx(z.Target,{size:12})," ",e.jsx("strong",{style:{color:"var(--text-base)"},children:s.action||s.title||""}),s.rationale&&` — ${s.rationale}`]},a))})}):null}function Ye({audioUrl:n,timelineSegments:o,durationSeconds:s,currentTimeSeconds:a,timelinePlaying:i,playbackRate:m,onSeek:b,onTogglePlay:h,onSeekBack:C,onSeekForward:T,onSetPlaybackRate:S,audioRef:x}){return n?e.jsxs(ne.DetailCard,{title:"Recording",children:[e.jsx(Je.Timeline,{segments:o,durationSeconds:s||0,currentTimeSeconds:a,onSeek:b,showControls:!0,hasRecording:!0,timelinePlaying:i,playbackRate:m,onTogglePlay:h,onSeekBack:C,onSeekForward:T,onSetPlaybackRate:S}),e.jsx("audio",{ref:x,preload:"none",style:{display:"none"},children:e.jsx("source",{src:n,type:"audio/mpeg"})})]}):null}function Ge({transcript:n,audioUrl:o,highlightedTurns:s,activeTurnIndex:a,timelinePlaying:i,turnObservations:m,setExpandedSignals:b,onTurnPlayPause:h}){var S;if(!((S=n==null?void 0:n.messages)!=null&&S.length))return null;const C=(x,j)=>{if(x==null)return;const u=F=>{const R=Math.floor(F/6e4),I=Math.floor(F%6e4/1e3);return`${R.toString().padStart(2,"0")}:${I.toString().padStart(2,"0")}`},y=u(x),_=j!=null?u(j):y;return`${y}–${_}`},T=n.messages.map((x,j)=>{var u,y;return{actor:x.actor==="agent"?((u=n.actor_map)==null?void 0:u.agent)||"Agent":((y=n.actor_map)==null?void 0:y.customer)||"Customer",actorType:x.actor==="agent"?"agent":"customer",text:x.text||"",timeRange:C(x.start??x.start_ms,x.end??x.end_ms),isHighlighted:s.has(j),highlightColor:i&&a===j?x.actor==="agent"?"var(--rail-outcome)":"var(--rail-discovery)":void 0,observations:(m[j]||[]).map(_=>({..._,onClick:()=>{b(F=>new Set([...F,_.signalKey])),setTimeout(()=>{const F=document.getElementById(`signal-${_.signalKey}`);F&&F.scrollIntoView({behavior:"smooth",block:"nearest"})},100)}}))}});return e.jsx("div",{id:"transcript-container",children:e.jsx(Qe.TranscriptCard,{turns:T,audioUrl:o,activeTurnIndex:a,autoScrollActiveTurn:i,isExternalPlaying:i,onTurnPlayPause:h})})}const Le={padding:0,border:"none",background:"transparent",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.65)",cursor:"pointer",fontFamily:"inherit"},Ve=n=>{if(!n)return null;const o=String(n).toLowerCase();return o==="supervisor"?"var(--rail-compliance)":o==="admin"||o==="administrator"?"var(--rail-discovery)":o==="agent"?"var(--rail-outcome)":null},Ae=n=>{if(!n)return[];const o=[n.messages,n.comments,n.thread_messages,n.items,n.children];for(const s of o)if(Array.isArray(s)&&s.length)return s;return n.messages&&Array.isArray(n.messages.data)?n.messages.data:[]},Fe=(n,o=null,s=0)=>{const a=[];return(n||[]).forEach((i,m)=>{const b=i.author||{},h=b.name||i.author_name||"Unknown",C=b.initials||h.split(" ").map(y=>y[0]).join("").toUpperCase()||"U",T=b.role||i.author_role,S=Ve(T),x=b.color||i.author_color||S||"#6B7C93",j=i.id||`msg-${s+m}`,u={id:j,author:{name:h,initials:C,color:x,role:T},content:i.content||i.text||"",timestamp:i.timestamp||i.created_at_display||i.created_at||"",type:i.type||"comment",isEdited:i.isEdited||i.is_edited||i.edited||!1,references:i.references||[],parentId:i.parentId||i.parent_message_id||o||null};a.push(u),Array.isArray(i.replies)&&i.replies.length>0&&a.push(...Fe(i.replies,j,s+a.length))}),a},nt=n=>{if(!n)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(n))return n;try{const o=new Date(n);if(Number.isNaN(o.getTime()))return n;const s=new Date,a=o.getFullYear()===s.getFullYear()&&o.getMonth()===s.getMonth()&&o.getDate()===s.getDate(),i=new Date(s);i.setDate(i.getDate()-1);const m=o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth()&&o.getDate()===i.getDate(),b=o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});if(a)return`Today at ${b}`;if(m)return`Yesterday at ${b}`;const C=(s.getTime()-o.getTime())/(1e3*60*60*24);return C<7&&C>0?`${o.toLocaleDateString(void 0,{weekday:"long"})} at ${b}`:`${o.toLocaleDateString(void 0,{month:"short",day:"numeric",year:o.getFullYear()!==s.getFullYear()?"numeric":void 0})} at ${b}`}catch{return n}};function rt({sessionTitle:n,sessionSubtitle:o,threadLabel:s,messages:a,messageThread:i,onSendMessage:m,onReplyMessage:b,onEditMessage:h,onDeleteMessage:C,onCreateNewThread:T,onThreadSelect:S,currentUser:x,isLoading:j=!1}){const[u,y]=p.useState(""),[_,F]=p.useState(!1),[R,I]=p.useState(a||[]),[D,L]=p.useState(!1),[$,k]=p.useState(null),[N,G]=p.useState([]),[Z,q]=p.useState(null),[M,A]=p.useState(null),[H,O]=p.useState(""),[W,K]=p.useState(null),[P,X]=p.useState(""),[ae,re]=p.useState(null),[we,ie]=p.useState(!1),[U,le]=p.useState(""),[V,ge]=p.useState(!1),[ze,ee]=p.useState(new Set),te=p.useRef(null),Te=p.useRef(null),oe=x&&x.role&&String(x.role).toLowerCase()||"",se=p.useMemo(()=>{if(!x)return{name:"You",initials:"YO",color:"#6B7C93"};const t=x.name||"You",g=x.initials||t.split(" ").map(l=>l[0]).join("").toUpperCase()||"YO",v=x.role&&String(x.role).toLowerCase(),w=Ve(v),r=x.color||w||"#6B7C93";return{...x,name:t,initials:g,color:r}},[x]),fe=oe==="supervisor"||oe==="admin",he=p.useMemo(()=>{const t={};return(R||[]).forEach(g=>{g.parentId&&(t[g.parentId]||(t[g.parentId]=[]),t[g.parentId].push(g))}),t},[R]),ye=p.useMemo(()=>(R||[]).filter(t=>!t.parentId),[R]),ce=t=>M===t,Ie=t=>W===t,_e=s||n||o,Re=M?R.find(t=>t.id===M):null;p.useEffect(()=>{i||a&&I(a)},[a,i]),p.useEffect(()=>{if(!i)return;const t=Array.isArray(i.threads)?i.threads:Array.isArray(i.items)?i.items:[];if(t.length>0){const v=t.map((l,d)=>{const f=l.id||l.thread_id||`thread-${d+1}`,E=l.label||l.title||(d===0?s||"Session":`Thread ${d+1}`),c=Ae(l),B=Fe(c);return{id:f,label:E,messages:B}});G(v);const w=v.find(l=>(l.messages||[]).length>0)||v[0],r=(w==null?void 0:w.messages)||[];I(r),ee(new Set),q((w==null?void 0:w.id)||null);return}const g=Ae(i);if(g.length){const v=Fe(g);I(v),ee(new Set);const w=i.id||"thread-1",r=i.title||s||"Thread 1";G([{id:w,label:r}]),q(w)}},[i,s]),p.useEffect(()=>{s&&G(t=>t.map((g,v)=>v===0?{...g,label:s}:g))},[s]),p.useEffect(()=>{if(!te.current||!R||R.length===0)return;const t=te.current.parentElement;t?t.scrollTop=t.scrollHeight:te.current.scrollIntoView({behavior:"smooth",block:"end"})},[R]);const me=async()=>{const t=U.trim();if(t){ge(!0);try{const g=`thread-${Date.now()}`;G(v=>[...v,{id:g,label:t.slice(0,32)||`Thread ${v.length+1}`}]),q(g),await(T==null?void 0:T(t)),le(""),ie(!1)}finally{ge(!1)}}},De=()=>{ie(!1),le("")},be=async()=>{const t=u.trim();if(!t)return;const g=t;y("");const v=`temp-${Date.now()}`,w={id:v,author:se,content:g,timestamp:"Just now",type:"comment",isOptimistic:!0,parentId:M||null};if(I(r=>[...r,w]),m){L(!0);try{await m({content:g,parent_message_id:M||null}),I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l))}catch{I(r=>r.filter(l=>l.id!==v))}finally{L(!1)}A(null);return}I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l)),A(null)},Ee=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),be())},ve=t=>{A(t.id),O(""),K(null),X(""),k(null),b==null||b(t)},je=async t=>{const g=H.trim();if(!g)return;const v=`reply-${Date.now()}`,w={id:v,author:se,content:g,timestamp:"Just now",type:"comment",isOptimistic:!m,parentId:t};I(r=>[...r,w]),L(!0);try{m&&(await m({content:g,parent_message_id:t}),I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l))),A(null),O("")}catch{m&&I(r=>r.filter(l=>l.id!==v))}finally{L(!1)}},Se=t=>{K(t.id),X(t.content||""),A(null),O(""),k(null)},de=async()=>{const t=P.trim();if(!(!t||!W))try{const g=await(h==null?void 0:h({id:W,content:t}));if(g&&typeof g=="object"&&g.success===!1)return;I(v=>v.map(w=>w.id===W?{...w,content:t,isEdited:!0}:w)),K(null),X("")}catch(g){console.error("MessageThread edit failed:",g)}},pe=()=>{K(null),X("")},ke=t=>{re(t),k(null)},Ce=async()=>{if(!ae)return;const t=ae;re(null),I(g=>g.filter(v=>v.id!==t.id)),await(C==null?void 0:C(t))},ue=(t,g=0)=>{var f,E;const v=he[t.id]||[],w=v.length>0,r=ze.has(t.id),l=Ie(t.id),d=ce(t.id);return e.jsx("div",{children:e.jsxs("div",{onMouseEnter:()=>t.type!=="system"&&k(t.id),onMouseLeave:()=>k(null),style:{display:"flex",gap:"12px",opacity:t.type==="system"?.75:1,padding:"4px 0",margin:"0 -4px",borderRadius:"8px",marginLeft:g>0?16:0},children:[t.type!=="system"?e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:t.author.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:t.author.initials}):e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:"rgba(30, 33, 37, 0.1)",color:"rgba(30, 33, 37, 0.55)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(z.Clock,{size:16})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:"8px",marginBottom:"6px",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"13px",fontWeight:650,color:"rgba(30, 33, 37, 0.9)"},children:t.author.name}),t.timestamp&&e.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--default-mono-font-family)",color:"rgba(30, 33, 37, 0.5)"},children:nt(t.timestamp)}),((f=t.author)==null?void 0:f.role)&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",fontSize:"10px",color:"rgba(30, 33, 37, 0.6)",background:"rgba(30, 33, 37, 0.08)",padding:"3px 8px",borderRadius:"6px",textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:600},children:String(t.author.role)}),(t.isEdited||t.is_edited)&&e.jsx("span",{style:{fontSize:"10px",color:"rgba(30, 33, 37, 0.5)",fontStyle:"italic"},children:"(Edited)"})]}),t.type!=="system"&&$===t.id&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexShrink:0},children:[e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),ve(t)},style:Le,children:"Reply"}),h&&e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),Se(t)},style:Le,children:"Edit"}),C&&e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),ke(t)},style:{...Le,color:"rgba(198, 99, 99, 0.9)"},children:"Delete"})]})]}),l?e.jsxs("div",{style:{marginTop:"4px"},children:[e.jsx("textarea",{value:P,onChange:c=>X(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),de()),c.key==="Escape"&&pe()},placeholder:"Edit message...",autoFocus:!0,style:{width:"100%",minHeight:"56px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.2)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"8px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:pe,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(30, 33, 37, 0.15)",c.currentTarget.style.color="rgba(30, 33, 37, 0.7)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(30, 33, 37, 0.1)",c.currentTarget.style.color="rgba(30, 33, 37, 0.45)"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:de,disabled:!(P!=null&&P.trim()),style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:P!=null&&P.trim()?"white":"rgba(30, 33, 37, 0.45)",background:P!=null&&P.trim()?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",cursor:P!=null&&P.trim()?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},children:"Edit"})]})]}):e.jsx("div",{style:{fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",lineHeight:1.55,marginBottom:(E=t.references)!=null&&E.length?"8px":0},children:t.content}),d&&e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsx("textarea",{value:H,onChange:c=>O(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(A(null),O(""))},placeholder:"Type your reply...",disabled:D,autoFocus:!0,style:{width:"100%",minHeight:"64px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.16)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:()=>{A(null),O("")},disabled:D,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:D?"not-allowed":"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>je(t.id),disabled:!H.trim()||D,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:H.trim()&&!D?"white":"rgba(30, 33, 37, 0.45)",background:H.trim()&&!D?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",cursor:H.trim()&&!D?"pointer":"not-allowed"},children:"Reply"})]})]}),w&&e.jsxs("div",{style:{marginTop:8},children:[e.jsxs("button",{type:"button",onClick:()=>ee(c=>{const B=new Set(c);return B.has(t.id)?B.delete(t.id):B.add(t.id),B}),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 8px",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.6)",background:"transparent",border:"none",borderRadius:6,cursor:"pointer"},title:r?"Collapse replies":"Expand replies",children:[e.jsx(z.ChevronRight,{size:14,style:{flexShrink:0,transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"}}),e.jsxs("span",{children:[v.length," ",v.length===1?"reply":"replies"]})]}),r&&e.jsx("div",{style:{marginTop:8,marginLeft:16,paddingLeft:16,borderLeft:"2px solid rgba(52, 58, 64, 0.14)"},children:v.map(c=>ue(c,g+1))})]})]})]})},t.id)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"rgba(255, 255, 255, 0.98)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",position:"relative"},children:[ae&&e.jsx("div",{style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(30, 33, 37, 0.35)",borderRadius:"12px"},onClick:()=>re(null),children:e.jsxs("div",{style:{background:"white",borderRadius:"12px",padding:"20px 24px",boxShadow:"0 8px 24px rgba(30, 33, 37, 0.15)",maxWidth:"320px",width:"90%"},onClick:t=>t.stopPropagation(),children:[e.jsx("p",{style:{margin:0,marginBottom:"20px",fontSize:"14px",fontWeight:500,color:"rgba(30, 33, 37, 0.9)",lineHeight:1.45},children:"Do you really want to delete?"}),e.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:()=>re(null),style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:Ce,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"white",background:"var(--Base-Strong, #0B0B0B)",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Delete"})]})]})}),_e&&e.jsx("div",{style:{padding:"14px 16px",borderBottom:"1px solid rgba(52, 58, 64, 0.12)",background:"rgba(255, 255, 255, 0.98)"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"rgba(30, 33, 37, 0.95)",marginBottom:"4px"},children:s||"Session Discussion"}),(n||o)&&e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.52)"},children:n||o}),N.length>0&&e.jsx("div",{style:{marginTop:"8px",display:"flex",flexWrap:"wrap",gap:"8px"},children:N.map(t=>{const g=t.id===Z;return e.jsx("button",{type:"button",onClick:()=>{q(t.id),Array.isArray(t.messages)&&(I(t.messages),ee(new Set)),k(null),A(null),K(null),S==null||S(t)},style:{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(184, 156, 106, 0.35)",background:g?"rgba(184, 156, 106, 0.16)":"rgba(255, 255, 255, 0.9)",color:"rgba(30, 33, 37, 0.85)",fontSize:"11px",fontWeight:500,cursor:"pointer"},children:t.label},t.id)})})]}),fe&&e.jsxs("button",{type:"button",onClick:()=>{ie(t=>!t)},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",fontSize:"13px",fontWeight:500,color:"rgba(30, 33, 37, 0.75)",background:"transparent",border:"1px solid rgba(30, 33, 37, 0.12)",borderRadius:"6px",cursor:"pointer",transition:"background 0.15s ease, color 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.background="rgba(231, 212, 162, 0.12)",t.currentTarget.style.color="rgba(30, 33, 37, 0.9)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},title:"Start a new discussion thread",children:[e.jsx("span",{style:{fontSize:16,lineHeight:1,marginTop:-1},children:"+"}),"New thread"]})]})}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"16px"},children:[we&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px",background:"rgba(30, 33, 37, 0.04)",border:"1px solid rgba(52, 58, 64, 0.14)",borderRadius:"8px"},children:[e.jsx("textarea",{value:U,onChange:t=>le(t.target.value),onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),me())},placeholder:"Start a new thread...",disabled:V,style:{width:"100%",minHeight:"64px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.16)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:De,disabled:V,style:{padding:"6px 14px",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.7)",background:"rgba(30, 33, 37, 0.08)",border:"none",borderRadius:"6px",cursor:V?"not-allowed":"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:me,disabled:!U.trim()||V,style:{padding:"6px 14px",fontSize:"12px",fontWeight:600,color:"white",background:U.trim()&&!V?"#5e88b0":"rgba(30, 33, 37, 0.25)",border:"none",borderRadius:"6px",cursor:U.trim()&&!V?"pointer":"not-allowed"},children:V?"Sending...":"Send"})]})]}),j?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"rgba(30, 33, 37, 0.42)"},children:"Loading messages..."}):ye.length===0?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"rgba(30, 33, 37, 0.42)"},children:"No messages yet. Start the conversation!"}):ye.map(t=>ue(t,0)),e.jsx("div",{ref:te})]}),e.jsx("div",{style:{padding:"12px",borderTop:"1px solid rgba(52, 58, 64, 0.12)",background:"rgba(255, 255, 255, 0.95)"},children:e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:se.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:se.initials}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx("textarea",{ref:Te,value:u,onChange:t=>y(t.target.value),onKeyDown:Ee,onFocus:()=>F(!0),onBlur:()=>F(!1),placeholder:Re?"Type your reply...":"Add a comment...",style:{width:"100%",minHeight:"38px",maxHeight:"120px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.85)",background:"white",border:`1px solid ${_?"rgba(94, 136, 176, 0.35)":"rgba(52, 58, 64, 0.16)"}`,borderRadius:"8px",resize:"vertical",outline:"none",transition:"border-color 0.15s ease",fontFamily:"inherit",lineHeight:1.5}}),e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},children:e.jsx("button",{type:"button",onClick:be,disabled:!u.trim()||D,style:{padding:"8px 16px",background:u.trim()&&!D?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",color:u.trim()&&!D?"white":"rgba(30, 33, 37, 0.45)",fontSize:"12px",fontWeight:600,cursor:u.trim()&&!D?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},children:D?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 0.6s linear infinite"}}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(z.Send,{size:14}),"Send"]})})})]})]})})]})}function Y(n,o){return n.find(s=>s.block_id===o)}function it({data:n,audioUrl:o,coachingData:s,messageThread:a,coachingLoading:i,coachingError:m,onThreadSendMessage:b,onThreadEditMessage:h,onThreadDeleteMessage:C,onThreadCreateNewThread:T,onThreadSelect:S,threadLoading:x,threadCurrentUser:j}){var ve,je,Se,de,pe,ke,Ce,ue,t,g,v,w;const u=n.blocks||[];n.evidence_index;const y=p.useRef(null),_=p.useRef(null),[F,R]=p.useState(new Set),[I,D]=p.useState(new Set),[L,$]=p.useState(0),[k,N]=p.useState(!1),[G,Z]=p.useState(1),q=((ve=Y(u,"interaction-metadata"))==null?void 0:ve.payload)||{},M=((je=Y(u,"interaction-context"))==null?void 0:je.payload)||{},A=((Se=Y(u,"interaction-summary"))==null?void 0:Se.payload)||{};(de=Y(u,"interaction-scores"))!=null&&de.payload;const H=((pe=Y(u,"interaction-signals"))==null?void 0:pe.payload)||{},O=((ke=Y(u,"interaction-guidance"))==null?void 0:ke.payload)||{},W=((Ce=Y(u,"interaction-transcript"))==null?void 0:Ce.payload)||{},K=((ue=Y(u,"interaction-nba"))==null?void 0:ue.payload)||{},X=((((t=Y(u,"interaction-dimensions"))==null?void 0:t.payload)||{}).dimensions||[]).filter(r=>r.value),ae=((g=Y(u,"interaction-outcome-lift"))==null?void 0:g.payload)||{},re=p.useMemo(()=>{var d;const r={},l={outcome:{color:"var(--rail-outcome)"},process:{color:"var(--rail-discovery)"},compliance:{color:"var(--rail-compliance)"},customer_friction:{color:"var(--rail-coral)"},experience:{color:"var(--rail-teal)"}};for(const f of H.signals||[]){const E=l[f.group]||{};for(const c of f.observations||[])for(const B of c.evidence||[])if((d=B.turn_ids)!=null&&d.length)for(const J of B.turn_ids)r[J]||(r[J]=[]),r[J].some(Ze=>Ze.label===(c.key||f.display_name||f.key))||r[J].push({label:c.key||f.display_name||f.key,reason:c.reason||c.explanation||"",color:E.color||"var(--state-present)",signalKey:f.key})}return r},[H.signals]),we=((v=W.messages)==null?void 0:v.map((r,l)=>{var B,J;const d=r.start??r.start_ms?(r.start??r.start_ms)/1e3:0,f=r.end??r.end_ms?(r.end??r.end_ms)/1e3:d+1,E=r.actor==="agent",c=E?((B=W.actor_map)==null?void 0:B.agent)||"Agent":((J=W.actor_map)==null?void 0:J.customer)||"Customer";return{startTime:d,endTime:f,actor:c,actorColor:E?"var(--rail-outcome)":"var(--rail-discovery)"}}))||[],ie=p.useMemo(()=>{if(!k&&L===0)return-1;const r=W.messages||[],l=L*1e3;for(let d=r.length-1;d>=0;d--){const f=r[d].start??r[d].start_ms;if(f!=null&&l>=f)return d}return-1},[L,k,W.messages]),U=r=>{y.current&&(y.current.currentTime=r,$(r))},le=()=>{if(y.current)if(k)y.current.pause(),N(!1);else{const r=y.current.play();r!==void 0&&r.catch(()=>{}),N(!0)}},V=()=>{y.current&&(y.current.currentTime=Math.max(0,y.current.currentTime-15))},ge=()=>{if(y.current){const r=q.duration_seconds||y.current.duration||0;y.current.currentTime=Math.min(r,y.current.currentTime+15)}},ze=r=>{y.current&&(y.current.playbackRate=r,Z(r))};p.useEffect(()=>{const r=y.current;if(!r)return;const l=()=>$(r.currentTime),d=()=>N(!0),f=()=>N(!1),E=()=>N(!1);return r.addEventListener("timeupdate",l),r.addEventListener("play",d),r.addEventListener("pause",f),r.addEventListener("ended",E),()=>{r.removeEventListener("timeupdate",l),r.removeEventListener("play",d),r.removeEventListener("pause",f),r.removeEventListener("ended",E)}},[o]);const ee=(r,l)=>{const d=y.current;if(!d||r==null)return;const f=r/1e3;d.currentTime=f,$(f);const E=d.play();if(E!==void 0&&E.catch(()=>{}),_.current&&(d.removeEventListener("timeupdate",_.current),_.current=null),l!=null){const c=l/1e3,B=()=>{d.currentTime>=c&&(d.pause(),_.current&&(d.removeEventListener("timeupdate",_.current),_.current=null))};_.current=B,d.addEventListener("timeupdate",B)}},te=(r,l,d)=>{const f=y.current;if(!f||r==null)return;const E=r/1e3,c=l!=null?l/1e3:E+1,B=f.currentTime;if(k&&B>=E&&(c==null||B<=c+.25)){f.pause();return}ee(r,l),d!=null&&d.length&&oe(d)},Te=(r,l)=>{const f=(W.messages||[])[l],E=y.current;if(!f||!E)return;const c=f.start??f.start_ms,B=f.end??f.end_ms;if(k&&ie===l){E.pause();return}c!=null&&ee(c,B)},oe=r=>{R(new Set(r));const l=document.getElementById("transcript-container");l&&l.scrollIntoView({behavior:"smooth",block:"nearest"}),setTimeout(()=>R(new Set),5e3)},se=r=>{D(l=>{const d=new Set(l);return d.has(r)?d.delete(r):d.add(r),d})},fe=((w=M.call_purpose)==null?void 0:w.interaction_driver)||A.one_liner||"Interaction Detail",[he,ye]=p.useState("signals"),ce=p.useRef(null),[Ie,_e]=p.useState(null);p.useLayoutEffect(()=>{if(i||!ce.current)return;const r=()=>{var f;const d=((f=ce.current)==null?void 0:f.offsetHeight)||0;d>0&&_e(d)};r();const l=window.requestAnimationFrame(r);return()=>window.cancelAnimationFrame(l)},[i,s,q,M]);const Re=async r=>{if(b){await b(r);return}},me=async r=>{if(h)return h(r)},De=async r=>{if(C){await C(r);return}},be=async r=>{if(T){await T(r);return}},Ee=a&&Object.keys(a).length>0?a:void 0;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"10px",flexWrap:"wrap"},children:[e.jsxs("div",{ref:ce,style:{flex:"1 1 420px",minWidth:320,display:"flex",flexDirection:"column",gap:10},children:[e.jsx($e,{title:fe,meta:q,callPurpose:M.call_purpose,classification:M.classification,dimensions:X}),e.jsx(xe.AgentLiftCard,{outcomeLift:ae}),(i||s||m)&&e.jsx(ne.DetailCard,{title:"Coaching Summary",children:e.jsx(Oe,{data:s,loading:i,error:m})})]}),e.jsxs("div",{style:{flex:"1 1 420px",minWidth:320,display:"flex",flexDirection:"column",height:Ie},children:[e.jsx(He.Tabs,{tabs:[{key:"signals",label:"Signals"},{key:"guidance",label:"Guidance"}],active:he,onSelect:ye,size:"compact",borderTopRightRadius:12,borderTopLeftRadius:12}),e.jsxs("div",{className:"custom-thin-scrollbar-library",style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:10},children:[he==="signals"?e.jsx(qe,{signals:H,expandedSignals:I,toggleSignal:se,playEvidence:te,timelinePlaying:k,currentTimeSeconds:L,highlightTurns:oe,borderRadius:"0px 0px 12px 12px"}):e.jsx(Ne,{guidance:O,playEvidence:te,timelinePlaying:k,currentTimeSeconds:L,highlightTurns:oe,borderRadius:"0px 0px 12px 12px"}),e.jsx(Ke,{nba:K})]})]})]}),e.jsx(Ye,{audioUrl:o,timelineSegments:we,durationSeconds:q.duration_seconds,currentTimeSeconds:L,timelinePlaying:k,playbackRate:G,onSeek:U,onTogglePlay:le,onSeekBack:V,onSeekForward:ge,onSetPlaybackRate:ze,audioRef:y}),e.jsx(Ge,{transcript:W,audioUrl:o,highlightedTurns:F,activeTurnIndex:ie,timelinePlaying:k,turnObservations:re,setExpandedSignals:D,onTurnPlayPause:Te}),e.jsx(rt,{sessionTitle:fe,messageThread:Ee,currentUser:j,isLoading:x,onSendMessage:Re,onEditMessage:me,onDeleteMessage:De,onCreateNewThread:be,onThreadSelect:S})]})}class ot extends p.Component{constructor(o){super(o),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o,s){console.error("InteractionDetailPanel render error:",o,s==null?void 0:s.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function st(n){return e.jsx(ot,{fallback:e.jsx("div",{style:{padding:16,color:"var(--state-unknown)",fontSize:12},children:"Error rendering detail."}),children:e.jsx(it,{...n})})}function at({pattern:n}){const[o,s]=p.useState(!1),a={name:"Customer Escalation Likelihood",description:"Based on observed patterns, this session shows indicators consistent with potential escalation.",technicalKey:"signal.escalation_likelihood",probability:.68,confidence:.81,observations:3};return n==="text-link"?e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsxs("div",{style:{padding:"14px 16px 14px 21px"},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px",marginBottom:"10px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]}),!o&&e.jsx("button",{onClick:()=>s(!0),style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.56)",background:"none",border:"none",padding:0,cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(30, 33, 37, 0.2)"},onMouseEnter:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.78)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.4)"},onMouseLeave:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.56)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.2)"},children:"View contributing observations"})]}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"}),e.jsx("button",{onClick:()=>s(!1),style:{marginTop:"10px",fontSize:"12px",color:"rgba(30, 33, 37, 0.56)",background:"none",border:"none",padding:0,cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(30, 33, 37, 0.2)"},onMouseEnter:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.78)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.4)"},onMouseLeave:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.56)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.2)"},children:"Hide observations"})]})]}):n==="rotating-chevron"?e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsx("button",{type:"button",onClick:()=>s(!o),style:{width:"100%",padding:"14px 16px 14px 21px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",transition:"background 0.15s ease"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(231, 212, 162, 0.08)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]})]}),e.jsx("div",{style:{paddingTop:"2px",color:"rgba(30, 33, 37, 0.42)",flexShrink:0,transition:"transform 0.2s ease"},children:e.jsx(z.ChevronDown,{size:18,style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})})]})}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"})]})]}):e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsxs("button",{type:"button",onClick:()=>s(!o),style:{width:"100%",padding:"14px 16px 14px 21px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",display:"flex",alignItems:"flex-start",gap:"12px",transition:"background 0.15s ease"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(231, 212, 162, 0.08)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[e.jsx("div",{style:{paddingTop:"2px",color:"rgba(30, 33, 37, 0.42)",flexShrink:0},children:o?e.jsx(z.ChevronDown,{size:16}):e.jsx(z.ChevronRight,{size:16})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]})]})]}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"})]})]})}exports.ConditionCard=Q.ConditionCard;exports.ModelScoreCard=Q.ModelScoreCard;exports.ObservationCard=Q.ObservationCard;exports.ScoreDriverCard=Q.ScoreDriverCard;exports.ScoreDriverCardVariant=Q.ScoreDriverCardVariant;exports.SignalCard=Q.SignalCard;exports.SmallObservationCard=Q.SmallObservationCard;exports.SummarySection=Q.SummarySection;exports.AgentLiftCard=xe.AgentLiftCard;exports.EvidenceItem=xe.EvidenceItem;exports.CoachingSynthesisCard=Oe;exports.ExpandPatternComparison=at;exports.InteractionContext=$e;exports.InteractionDetailPanel=st;exports.InteractionGuidance=Ne;exports.InteractionNBA=Ke;exports.InteractionRecording=Ye;exports.InteractionScores=et;exports.InteractionSignals=qe;exports.InteractionTranscript=Ge;
10
+ `,document.head.appendChild(n)}function $e({data:n,loading:o,error:s}){var C,T;if(p.useEffect(()=>{Qe()},[]),o)return e.jsxs("div",{style:{padding:"20px 0",display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:"var(--rail-tone)",animation:"coaching-pulse 1.5s ease-in-out infinite"}}),e.jsx("span",{style:{fontSize:"var(--text-base)",color:"var(--rail-tone)",fontFamily:"var(--font-sans)",fontWeight:500},children:"Compass is synthesizing coaching insights…"})]}),[180,260,220].map((S,x)=>e.jsx("div",{style:{height:10,width:S,maxWidth:"100%",borderRadius:4,background:"linear-gradient(90deg, var(--hover-warm-subtle) 25%, var(--hover-warm) 50%, var(--hover-warm-subtle) 75%)",backgroundSize:"200% 100%",animation:"coaching-shimmer 1.8s ease-in-out infinite",animationDelay:`${x*.2}s`}},x))]});if(s)return e.jsx("div",{style:{padding:"16px 0",fontSize:"var(--text-base)",color:"var(--text-faint)",fontFamily:"var(--font-sans)"},children:"Unable to generate coaching summary."});if(!n)return null;const a=n.strengths||[],i=n.improvements||[],m=n.organizational||n.organizational_insights||[],b=typeof n.one_liner=="string"?n.one_liner:((C=n.one_liner)==null?void 0:C.text)||"",h=typeof n.context=="string"?n.context:((T=n.context)==null?void 0:T.text)||"";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,fontFamily:"var(--font-sans)"},children:[b&&e.jsx("div",{style:{fontSize:"var(--text-lg)",fontWeight:600,color:"var(--text-strong)",lineHeight:1.4},children:b}),h&&e.jsx("div",{style:{fontSize:"var(--text-base)",color:"var(--text-muted)",lineHeight:1.45},children:h}),a.length>0&&e.jsx(Be,{icon:e.jsx(z.TrendingUp,{size:13}),label:"Strengths",color:"var(--rail-discovery)",items:a}),i.length>0&&e.jsx(Be,{icon:e.jsx(z.Lightbulb,{size:13}),label:"Improvements",color:"var(--rail-compliance)",items:i}),m.length>0&&e.jsx(Be,{icon:e.jsx(z.Building,{size:13}),label:"Organizational",color:"var(--rail-outcome)",items:m}),n.overall&&e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-faint)",fontStyle:"italic",marginTop:2},children:["Overall: ",n.overall.replace(/_/g," ")]})]})}function Be({icon:n,label:o,color:s,items:a}){return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:6,color:s,fontSize:"var(--text-base)",fontWeight:650,letterSpacing:"0.04em"},children:[n,o]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map((i,m)=>{const b=typeof i=="string"?i:(i==null?void 0:i.text)||"",h=typeof i=="object"?i==null?void 0:i.quote:null;return e.jsxs("div",{style:{paddingLeft:14},children:[e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-base)",lineHeight:1.4},children:["• ",b]}),h&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:4,marginTop:3,paddingLeft:8},children:[e.jsx(z.MessageSquareQuote,{size:10,style:{color:"var(--text-faint)",flexShrink:0,marginTop:2}}),e.jsxs("span",{style:{fontSize:"var(--text-base)",color:"var(--text-muted)",fontStyle:"italic",lineHeight:1.35},children:['"',h,'"']})]})]},m)})})]})}function Xe(n){const o=Math.floor(n/60),s=Math.round(n%60);return`${o}:${s.toString().padStart(2,"0")}`}function qe({title:n,meta:o,callPurpose:s,classification:a,dimensions:i}){const m=s||{},b=a||{};return e.jsxs(ne.Card,{variant:"elevated",padding:"sm",children:[e.jsx("div",{style:{fontSize:"var(--text-md)",fontWeight:550,color:"var(--text-strong)",lineHeight:1.375,marginBottom:6},children:n}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"4px 12px",fontSize:11,color:"var(--text-muted)"},children:[o.evaluated_dt&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Date"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:new Date(o.evaluated_dt).toLocaleString()})]}),o.duration_seconds!=null&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Duration"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:Xe(o.duration_seconds)})]}),o.message_count&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Messages"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:o.message_count})]}),m.interaction_direction&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Direction"}),e.jsx("div",{style:{color:"var(--text-base)"},children:m.interaction_direction})]}),m.interaction_driver&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Driver"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:m.interaction_driver})]}),m.customer_intent&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Intent"}),e.jsx("div",{style:{color:"var(--text-base)"},children:m.customer_intent})]}),b.interaction_paradigm&&e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"Paradigm"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:b.interaction_paradigm})]}),i.map((h,C)=>e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:10,color:"var(--text-faint)"},children:h.label||h.key}),e.jsx("div",{style:{fontSize:12,color:"var(--text-base)"},children:h.value})]},C))]}),o.session_id&&e.jsx("div",{style:{fontSize:10,color:"var(--text-faint)",fontFamily:"var(--font-mono)",marginTop:4,userSelect:"all"},children:o.session_id})]})}function Ue({scores:n}){return n!=null&&n.length?e.jsx(ne.DetailCard,{title:"Scores",children:e.jsx("div",{style:{display:"flex",gap:24,flexWrap:"wrap"},children:n.map((o,s)=>{const a=o.value!=null?Math.round(o.value):null;return e.jsxs("div",{style:{textAlign:"center",minWidth:48},children:[e.jsx("div",{style:{fontSize:20,fontWeight:700,color:"var(--text-ink)"},children:a??"—"}),e.jsx("div",{style:{fontSize:"var(--text-sm)",color:"var(--text-muted)",marginTop:2},children:o.label||o.key})]},s)})})}):null}const Pe={outcome:{label:"Outcome",icon:e.jsx(z.Target,{size:12}),color:"var(--rail-outcome)"},process:{label:"Process & Protocol",icon:e.jsx(z.FileText,{size:12}),color:"var(--rail-discovery)"},compliance:{label:"Compliance",icon:e.jsx(z.Scale,{size:12}),color:"var(--rail-compliance)"},customer_friction:{label:"Customer Friction",icon:e.jsx(z.Zap,{size:12}),color:"var(--rail-coral)"},experience:{label:"Experience",icon:e.jsx(z.MessageSquare,{size:12}),color:"var(--rail-teal)"}},et={risk:{icon:e.jsx(z.Zap,{size:10}),color:"var(--rail-signal-churn)"},opportunity:{icon:e.jsx(z.Lightbulb,{size:10}),color:"var(--state-unknown)"},excellence:{icon:e.jsx(z.CheckCircle,{size:10}),color:"var(--rail-teal)"}};function Ne({signals:n,expandedSignals:o,toggleSignal:s,playEvidence:a,timelinePlaying:i,currentTimeSeconds:m,highlightTurns:b,borderRadius:h}){var T;if(!((T=n==null?void 0:n.signals)!=null&&T.length))return null;const C=p.useMemo(()=>{const S={};for(const x of n.signals){const j=x.group||"experience";S[j]||(S[j]=[]),S[j].push(x)}return S},[n]);return e.jsx(ne.DetailCard,{title:`Signals (${n.present_count} present / ${n.total_signals_evaluated} evaluated)`,borderRadius:h,children:Object.entries(C).map(([S,x])=>{const j=Pe[S]||Pe.experience;return e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs(He.SectionLabel,{style:{display:"flex",alignItems:"center",gap:4},children:[j.icon,e.jsx("span",{children:j.label})]}),e.jsx("div",{style:{marginTop:4,display:"flex",flexDirection:"column",gap:6},children:x.map((u,y)=>{var D,L,$;const _=u.display_name||u.key||"",F=(D=u.baseline)==null?void 0:D.delta,R=((L=u.observations)==null?void 0:L.length)>0,I=o.has(u.key);return e.jsxs("div",{id:`signal-${u.key}`,style:{border:"1px solid var(--border, rgba(52, 58, 64, 0.12))",borderRadius:"var(--radius-md, 8px)",background:"var(--paper, rgba(255, 255, 255, 0.98))",overflow:"hidden"},children:[e.jsxs("button",{type:"button",onClick:k=>{R&&(s(u.key),k.currentTarget.blur())},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",background:"transparent",borderTop:"1px solid transparent",borderRight:"1px solid transparent",borderLeft:"1px solid transparent",borderBottom:"1px solid var(--border, rgba(52, 58, 64, 0.08))",cursor:R?"pointer":"default"},title:[u.confidence!=null?`Confidence: ${Math.round(u.confidence*100)}%`:"",F!=null?`Δ baseline: ${F>0?"+":""}${(F*100).toFixed(1)}%`:""].filter(Boolean).join(" · "),children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap"},children:[($=et[u.kind])==null?void 0:$.icon,e.jsx("span",{children:_}),R&&e.jsxs("span",{style:{marginLeft:4,fontSize:10,opacity:.6},children:["(",u.observations.length,")"]})]}),R&&e.jsx(z.ChevronDown,{size:14,style:{color:"var(--text-muted)",flexShrink:0,transform:I?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.16s ease"}})]}),I&&u.observations&&e.jsx("div",{style:{width:"100%",margin:"0 0 6px"},children:u.observations.map((k,N)=>{var G;return e.jsx("div",{style:{marginBottom:6},children:e.jsxs("div",{style:{display:"flex",borderRadius:"var(--radius-sm, 8px)",background:"var(--paper, #fff)",overflow:"hidden"},children:[e.jsx("div",{style:{width:3,background:j.color}}),e.jsxs("div",{style:{flex:1,fontSize:"var(--text-sm)",color:"var(--text-muted)",padding:"8px 12px"},children:[e.jsx("div",{style:{fontWeight:600,color:"var(--text-base)",marginBottom:3,fontSize:"var(--text-base)"},children:k.key||""}),e.jsx("div",{style:{marginBottom:6,lineHeight:1.4},children:k.reason||k.explanation||""}),(G=k.evidence)==null?void 0:G.map((Z,q)=>{const M=Z.start_ms,A=Z.end_ms;let H=!1;if(M!=null&&i){const O=M/1e3,W=A!=null?A/1e3:O+1,K=m??0;H=K>=O&&K<=W+.25}return e.jsx(xe.EvidenceItem,{ev:Z,isPlaying:H,railColor:j.color,onPlay:(O,W)=>a==null?void 0:a(O,W,Z.turn_ids),onHighlight:b},q)})]})]})},N)})})]},y)})})]},S)})})}const Me={risk:{icon:e.jsx(z.Zap,{size:10}),color:"var(--rail-signal-churn)"},opportunity:{icon:e.jsx(z.Lightbulb,{size:10}),color:"var(--state-unknown)"},excellence:{icon:e.jsx(z.CheckCircle,{size:10}),color:"var(--rail-teal)"}};function Ke({guidance:n,playEvidence:o,timelinePlaying:s,currentTimeSeconds:a,highlightTurns:i,borderRadius:m}){var b;return(b=n==null?void 0:n.items)!=null&&b.length?e.jsx(ne.DetailCard,{title:`Guidance (${n.total_items} items)`,borderRadius:m,children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:n.items.map((h,C)=>{var x;const T=Me[h.guidance_kind]||Me.excellence,S=h.owner==="organization"?{bg:"color-mix(in srgb, var(--rail-discovery) 15%, transparent)",color:"var(--rail-discovery)",text:"ORG"}:h.owner==="shared"?{bg:"color-mix(in srgb, var(--state-unknown) 15%, transparent)",color:"var(--state-unknown)",text:"SHARED"}:{bg:"color-mix(in srgb, var(--rail-teal) 10%, transparent)",color:"var(--rail-teal)",text:"AGENT"};return e.jsxs("div",{style:{padding:"10px 12px",borderRadius:"var(--radius)",background:"var(--paper)",borderLeft:`3px solid ${T.color}`},children:[e.jsxs("div",{style:{fontSize:"var(--text-base)",color:"var(--text-strong)",display:"flex",alignItems:"center",gap:5,fontWeight:550},children:[T.icon," ",h.title||"",e.jsx("span",{style:{fontSize:9,padding:"1px 6px",borderRadius:8,marginLeft:4,background:S.bg,color:S.color,fontWeight:600},children:S.text})]}),h.detail&&e.jsx("div",{style:{fontSize:"var(--text-sm)",color:"var(--text-muted)",marginTop:4,lineHeight:1.4},children:h.detail}),(x=h.signal_refs)==null?void 0:x.map((j,u)=>{var y;return e.jsxs("div",{style:{marginTop:6},children:[e.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)",fontWeight:600,marginBottom:3,display:"flex",alignItems:"center",gap:3},children:[e.jsx(z.CornerDownRight,{size:10})," ",j.display_name||j.signal_key,j.confidence!=null&&e.jsxs("span",{style:{fontWeight:400,opacity:.7},children:[" ","(",Math.round(j.confidence*100),"%)"]})]}),(y=j.evidence)==null?void 0:y.map((_,F)=>{const R=_.start_ms,I=_.end_ms;let D=!1;if(R!=null&&s){const L=R/1e3,$=I!=null?I/1e3:L+1,k=a??0;D=k>=L&&k<=$+.25}return e.jsx(xe.EvidenceItem,{ev:_,isPlaying:D,onPlay:(L,$)=>o==null?void 0:o(L,$,_.turn_ids),onHighlight:i},F)})]},u)})]},C)})})}):null}function Ye({nba:n}){const o=(n==null?void 0:n.recommendations)||(n==null?void 0:n.actions)||[];return o.length?e.jsx(ne.DetailCard,{title:"Next Best Actions",children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:o.slice(0,8).map((s,a)=>e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:4},children:[e.jsx(z.Target,{size:12})," ",e.jsx("strong",{style:{color:"var(--text-base)"},children:s.action||s.title||""}),s.rationale&&` — ${s.rationale}`]},a))})}):null}function Ge({audioUrl:n,timelineSegments:o,durationSeconds:s,currentTimeSeconds:a,timelinePlaying:i,playbackRate:m,onSeek:b,onTogglePlay:h,onSeekBack:C,onSeekForward:T,onSetPlaybackRate:S,audioRef:x}){return n?e.jsxs(ne.DetailCard,{title:"Recording",children:[e.jsx(Oe.Timeline,{segments:o,durationSeconds:s||0,currentTimeSeconds:a,onSeek:b,showControls:!0,hasRecording:!0,timelinePlaying:i,playbackRate:m,onTogglePlay:h,onSeekBack:C,onSeekForward:T,onSetPlaybackRate:S}),e.jsx("audio",{ref:x,preload:"none",style:{display:"none"},children:e.jsx("source",{src:n,type:"audio/mpeg"})})]}):null}function Ve({transcript:n,audioUrl:o,highlightedTurns:s,activeTurnIndex:a,timelinePlaying:i,turnObservations:m,setExpandedSignals:b,onTurnPlayPause:h}){var S;if(!((S=n==null?void 0:n.messages)!=null&&S.length))return null;const C=(x,j)=>{if(x==null)return;const u=F=>{const R=Math.floor(F/6e4),I=Math.floor(F%6e4/1e3);return`${R.toString().padStart(2,"0")}:${I.toString().padStart(2,"0")}`},y=u(x),_=j!=null?u(j):y;return`${y}–${_}`},T=n.messages.map((x,j)=>{var u,y;return{actor:x.actor==="agent"?((u=n.actor_map)==null?void 0:u.agent)||"Agent":((y=n.actor_map)==null?void 0:y.customer)||"Customer",actorType:x.actor==="agent"?"agent":"customer",text:x.text||"",timeRange:C(x.start??x.start_ms,x.end??x.end_ms),isHighlighted:s.has(j),highlightColor:i&&a===j?x.actor==="agent"?"var(--rail-outcome)":"var(--rail-discovery)":void 0,observations:(m[j]||[]).map(_=>({..._,onClick:()=>{b(F=>new Set([...F,_.signalKey])),setTimeout(()=>{const F=document.getElementById(`signal-${_.signalKey}`);F&&F.scrollIntoView({behavior:"smooth",block:"nearest"})},100)}}))}});return e.jsx("div",{id:"transcript-container",children:e.jsx(Oe.TranscriptCard,{turns:T,audioUrl:o,activeTurnIndex:a,autoScrollActiveTurn:i,isExternalPlaying:i,onTurnPlayPause:h})})}const Le={padding:0,border:"none",background:"transparent",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.65)",cursor:"pointer",fontFamily:"inherit"},Ze=n=>{if(!n)return null;const o=String(n).toLowerCase();return o==="supervisor"?"var(--rail-compliance)":o==="admin"||o==="administrator"?"var(--rail-discovery)":o==="agent"?"var(--rail-outcome)":null},Ae=n=>{if(!n)return[];const o=[n.messages,n.comments,n.thread_messages,n.items,n.children];for(const s of o)if(Array.isArray(s)&&s.length)return s;return n.messages&&Array.isArray(n.messages.data)?n.messages.data:[]},Fe=(n,o=null,s=0)=>{const a=[];return(n||[]).forEach((i,m)=>{const b=i.author||{},h=b.name||i.author_name||"Unknown",C=b.initials||h.split(" ").map(y=>y[0]).join("").toUpperCase()||"U",T=b.role||i.author_role,S=Ze(T),x=b.color||i.author_color||S||"#6B7C93",j=i.id||`msg-${s+m}`,u={id:j,author:{name:h,initials:C,color:x,role:T},content:i.content||i.text||"",timestamp:i.timestamp||i.created_at_display||i.created_at||"",type:i.type||"comment",isEdited:i.isEdited||i.is_edited||i.edited||!1,references:i.references||[],parentId:i.parentId||i.parent_message_id||o||null};a.push(u),Array.isArray(i.replies)&&i.replies.length>0&&a.push(...Fe(i.replies,j,s+a.length))}),a},tt=n=>{if(!n)return"";if(!/^\d{4}-\d{2}-\d{2}T/.test(n))return n;try{const o=new Date(n);if(Number.isNaN(o.getTime()))return n;const s=new Date,a=o.getFullYear()===s.getFullYear()&&o.getMonth()===s.getMonth()&&o.getDate()===s.getDate(),i=new Date(s);i.setDate(i.getDate()-1);const m=o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth()&&o.getDate()===i.getDate(),b=o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});if(a)return`Today at ${b}`;if(m)return`Yesterday at ${b}`;const C=(s.getTime()-o.getTime())/(1e3*60*60*24);return C<7&&C>0?`${o.toLocaleDateString(void 0,{weekday:"long"})} at ${b}`:`${o.toLocaleDateString(void 0,{month:"short",day:"numeric",year:o.getFullYear()!==s.getFullYear()?"numeric":void 0})} at ${b}`}catch{return n}};function nt({sessionTitle:n,sessionSubtitle:o,threadLabel:s,messages:a,messageThread:i,onSendMessage:m,onReplyMessage:b,onEditMessage:h,onDeleteMessage:C,onCreateNewThread:T,onThreadSelect:S,currentUser:x,isLoading:j=!1}){const[u,y]=p.useState(""),[_,F]=p.useState(!1),[R,I]=p.useState(a||[]),[D,L]=p.useState(!1),[$,k]=p.useState(null),[N,G]=p.useState([]),[Z,q]=p.useState(null),[M,A]=p.useState(null),[H,O]=p.useState(""),[W,K]=p.useState(null),[P,X]=p.useState(""),[ae,re]=p.useState(null),[we,ie]=p.useState(!1),[U,le]=p.useState(""),[V,ge]=p.useState(!1),[ze,ee]=p.useState(new Set),te=p.useRef(null),Te=p.useRef(null),oe=x&&x.role&&String(x.role).toLowerCase()||"",se=p.useMemo(()=>{if(!x)return{name:"You",initials:"YO",color:"#6B7C93"};const t=x.name||"You",g=x.initials||t.split(" ").map(l=>l[0]).join("").toUpperCase()||"YO",v=x.role&&String(x.role).toLowerCase(),w=Ze(v),r=x.color||w||"#6B7C93";return{...x,name:t,initials:g,color:r}},[x]),fe=oe==="supervisor"||oe==="admin",he=p.useMemo(()=>{const t={};return(R||[]).forEach(g=>{g.parentId&&(t[g.parentId]||(t[g.parentId]=[]),t[g.parentId].push(g))}),t},[R]),ye=p.useMemo(()=>(R||[]).filter(t=>!t.parentId),[R]),ce=t=>M===t,Ie=t=>W===t,_e=s||n||o,Re=M?R.find(t=>t.id===M):null;p.useEffect(()=>{i||a&&I(a)},[a,i]),p.useEffect(()=>{if(!i)return;const t=Array.isArray(i.threads)?i.threads:Array.isArray(i.items)?i.items:[];if(t.length>0){const v=t.map((l,d)=>{const f=l.id||l.thread_id||`thread-${d+1}`,E=l.label||l.title||(d===0?s||"Session":`Thread ${d+1}`),c=Ae(l),B=Fe(c);return{id:f,label:E,messages:B}});G(v);const w=v.find(l=>(l.messages||[]).length>0)||v[0],r=(w==null?void 0:w.messages)||[];I(r),ee(new Set),q((w==null?void 0:w.id)||null);return}const g=Ae(i);if(g.length){const v=Fe(g);I(v),ee(new Set);const w=i.id||"thread-1",r=i.title||s||"Thread 1";G([{id:w,label:r}]),q(w)}},[i,s]),p.useEffect(()=>{s&&G(t=>t.map((g,v)=>v===0?{...g,label:s}:g))},[s]),p.useEffect(()=>{if(!te.current||!R||R.length===0)return;const t=te.current.parentElement;t?t.scrollTop=t.scrollHeight:te.current.scrollIntoView({behavior:"smooth",block:"end"})},[R]);const me=async()=>{const t=U.trim();if(t){ge(!0);try{const g=`thread-${Date.now()}`;G(v=>[...v,{id:g,label:t.slice(0,32)||`Thread ${v.length+1}`}]),q(g),await(T==null?void 0:T(t)),le(""),ie(!1)}finally{ge(!1)}}},De=()=>{ie(!1),le("")},be=async()=>{const t=u.trim();if(!t)return;const g=t;y("");const v=`temp-${Date.now()}`,w={id:v,author:se,content:g,timestamp:"Just now",type:"comment",isOptimistic:!0,parentId:M||null};if(I(r=>[...r,w]),m){L(!0);try{await m({content:g,parent_message_id:M||null}),I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l))}catch{I(r=>r.filter(l=>l.id!==v))}finally{L(!1)}A(null);return}I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l)),A(null)},Ee=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),be())},ve=t=>{A(t.id),O(""),K(null),X(""),k(null),b==null||b(t)},je=async t=>{const g=H.trim();if(!g)return;const v=`reply-${Date.now()}`,w={id:v,author:se,content:g,timestamp:"Just now",type:"comment",isOptimistic:!m,parentId:t};I(r=>[...r,w]),L(!0);try{m&&(await m({content:g,parent_message_id:t}),I(r=>r.map(l=>l.id===v?{...l,isOptimistic:!1}:l))),A(null),O("")}catch{m&&I(r=>r.filter(l=>l.id!==v))}finally{L(!1)}},Se=t=>{K(t.id),X(t.content||""),A(null),O(""),k(null)},de=async()=>{const t=P.trim();if(!(!t||!W))try{const g=await(h==null?void 0:h({id:W,content:t}));if(g&&typeof g=="object"&&g.success===!1)return;I(v=>v.map(w=>w.id===W?{...w,content:t,isEdited:!0}:w)),K(null),X("")}catch(g){console.error("MessageThread edit failed:",g)}},pe=()=>{K(null),X("")},ke=t=>{re(t),k(null)},Ce=async()=>{if(!ae)return;const t=ae;re(null),I(g=>g.filter(v=>v.id!==t.id)),await(C==null?void 0:C(t))},ue=(t,g=0)=>{var f,E;const v=he[t.id]||[],w=v.length>0,r=ze.has(t.id),l=Ie(t.id),d=ce(t.id);return e.jsx("div",{children:e.jsxs("div",{onMouseEnter:()=>t.type!=="system"&&k(t.id),onMouseLeave:()=>k(null),style:{display:"flex",gap:"12px",opacity:t.type==="system"?.75:1,padding:"4px 0",margin:"0 -4px",borderRadius:"8px",marginLeft:g>0?16:0},children:[t.type!=="system"?e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:t.author.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:t.author.initials}):e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:"rgba(30, 33, 37, 0.1)",color:"rgba(30, 33, 37, 0.55)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(z.Clock,{size:16})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:"8px",marginBottom:"6px",justifyContent:"space-between"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"13px",fontWeight:650,color:"rgba(30, 33, 37, 0.9)"},children:t.author.name}),t.timestamp&&e.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--default-mono-font-family)",color:"rgba(30, 33, 37, 0.5)"},children:tt(t.timestamp)}),((f=t.author)==null?void 0:f.role)&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",fontSize:"10px",color:"rgba(30, 33, 37, 0.6)",background:"rgba(30, 33, 37, 0.08)",padding:"3px 8px",borderRadius:"6px",textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:600},children:String(t.author.role)}),(t.isEdited||t.is_edited)&&e.jsx("span",{style:{fontSize:"10px",color:"rgba(30, 33, 37, 0.5)",fontStyle:"italic"},children:"(Edited)"})]}),t.type!=="system"&&$===t.id&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexShrink:0},children:[e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),ve(t)},style:Le,children:"Reply"}),h&&e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),Se(t)},style:Le,children:"Edit"}),C&&e.jsx("button",{type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),ke(t)},style:{...Le,color:"rgba(198, 99, 99, 0.9)"},children:"Delete"})]})]}),l?e.jsxs("div",{style:{marginTop:"4px"},children:[e.jsx("textarea",{value:P,onChange:c=>X(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),de()),c.key==="Escape"&&pe()},placeholder:"Edit message...",autoFocus:!0,style:{width:"100%",minHeight:"56px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.2)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"8px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:pe,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(30, 33, 37, 0.15)",c.currentTarget.style.color="rgba(30, 33, 37, 0.7)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(30, 33, 37, 0.1)",c.currentTarget.style.color="rgba(30, 33, 37, 0.45)"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:de,disabled:!(P!=null&&P.trim()),style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:P!=null&&P.trim()?"white":"rgba(30, 33, 37, 0.45)",background:P!=null&&P.trim()?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",cursor:P!=null&&P.trim()?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},children:"Edit"})]})]}):e.jsx("div",{style:{fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",lineHeight:1.55,marginBottom:(E=t.references)!=null&&E.length?"8px":0},children:t.content}),d&&e.jsxs("div",{style:{marginTop:"12px"},children:[e.jsx("textarea",{value:H,onChange:c=>O(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(A(null),O(""))},placeholder:"Type your reply...",disabled:D,autoFocus:!0,style:{width:"100%",minHeight:"64px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.16)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:()=>{A(null),O("")},disabled:D,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:D?"not-allowed":"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>je(t.id),disabled:!H.trim()||D,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:H.trim()&&!D?"white":"rgba(30, 33, 37, 0.45)",background:H.trim()&&!D?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",cursor:H.trim()&&!D?"pointer":"not-allowed"},children:"Reply"})]})]}),w&&e.jsxs("div",{style:{marginTop:8},children:[e.jsxs("button",{type:"button",onClick:()=>ee(c=>{const B=new Set(c);return B.has(t.id)?B.delete(t.id):B.add(t.id),B}),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 8px",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.6)",background:"transparent",border:"none",borderRadius:6,cursor:"pointer"},title:r?"Collapse replies":"Expand replies",children:[e.jsx(z.ChevronRight,{size:14,style:{flexShrink:0,transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"}}),e.jsxs("span",{children:[v.length," ",v.length===1?"reply":"replies"]})]}),r&&e.jsx("div",{style:{marginTop:8,marginLeft:16,paddingLeft:16,borderLeft:"2px solid rgba(52, 58, 64, 0.14)"},children:v.map(c=>ue(c,g+1))})]})]})]})},t.id)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"rgba(255, 255, 255, 0.98)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",position:"relative"},children:[ae&&e.jsx("div",{style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(30, 33, 37, 0.35)",borderRadius:"12px"},onClick:()=>re(null),children:e.jsxs("div",{style:{background:"white",borderRadius:"12px",padding:"20px 24px",boxShadow:"0 8px 24px rgba(30, 33, 37, 0.15)",maxWidth:"320px",width:"90%"},onClick:t=>t.stopPropagation(),children:[e.jsx("p",{style:{margin:0,marginBottom:"20px",fontSize:"14px",fontWeight:500,color:"rgba(30, 33, 37, 0.9)",lineHeight:1.45},children:"Do you really want to delete?"}),e.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:()=>re(null),style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"rgba(30, 33, 37, 0.45)",background:"rgba(30, 33, 37, 0.1)",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:Ce,style:{padding:"8px 16px",fontSize:"12px",fontWeight:600,color:"white",background:"var(--Base-Strong, #0B0B0B)",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Delete"})]})]})}),_e&&e.jsx("div",{style:{padding:"14px 16px",borderBottom:"1px solid rgba(52, 58, 64, 0.12)",background:"rgba(255, 255, 255, 0.98)"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"rgba(30, 33, 37, 0.95)",marginBottom:"4px"},children:s||"Session Discussion"}),(n||o)&&e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.52)"},children:n||o}),N.length>0&&e.jsx("div",{style:{marginTop:"8px",display:"flex",flexWrap:"wrap",gap:"8px"},children:N.map(t=>{const g=t.id===Z;return e.jsx("button",{type:"button",onClick:()=>{q(t.id),Array.isArray(t.messages)&&(I(t.messages),ee(new Set)),k(null),A(null),K(null),S==null||S(t)},style:{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(184, 156, 106, 0.35)",background:g?"rgba(184, 156, 106, 0.16)":"rgba(255, 255, 255, 0.9)",color:"rgba(30, 33, 37, 0.85)",fontSize:"11px",fontWeight:500,cursor:"pointer"},children:t.label},t.id)})})]}),fe&&e.jsxs("button",{type:"button",onClick:()=>{ie(t=>!t)},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",fontSize:"13px",fontWeight:500,color:"rgba(30, 33, 37, 0.75)",background:"transparent",border:"1px solid rgba(30, 33, 37, 0.12)",borderRadius:"6px",cursor:"pointer",transition:"background 0.15s ease, color 0.15s ease"},onMouseEnter:t=>{t.currentTarget.style.background="rgba(231, 212, 162, 0.12)",t.currentTarget.style.color="rgba(30, 33, 37, 0.9)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="rgba(30, 33, 37, 0.75)"},title:"Start a new discussion thread",children:[e.jsx("span",{style:{fontSize:16,lineHeight:1,marginTop:-1},children:"+"}),"New thread"]})]})}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"16px"},children:[we&&e.jsxs("div",{style:{marginBottom:"16px",padding:"12px",background:"rgba(30, 33, 37, 0.04)",border:"1px solid rgba(52, 58, 64, 0.14)",borderRadius:"8px"},children:[e.jsx("textarea",{value:U,onChange:t=>le(t.target.value),onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),me())},placeholder:"Start a new thread...",disabled:V,style:{width:"100%",minHeight:"64px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.88)",background:"white",border:"1px solid rgba(52, 58, 64, 0.16)",borderRadius:"6px",resize:"vertical",outline:"none",fontFamily:"inherit",lineHeight:1.5,marginBottom:"10px"}}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",onClick:De,disabled:V,style:{padding:"6px 14px",fontSize:"12px",fontWeight:500,color:"rgba(30, 33, 37, 0.7)",background:"rgba(30, 33, 37, 0.08)",border:"none",borderRadius:"6px",cursor:V?"not-allowed":"pointer"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:me,disabled:!U.trim()||V,style:{padding:"6px 14px",fontSize:"12px",fontWeight:600,color:"white",background:U.trim()&&!V?"#5e88b0":"rgba(30, 33, 37, 0.25)",border:"none",borderRadius:"6px",cursor:U.trim()&&!V?"pointer":"not-allowed"},children:V?"Sending...":"Send"})]})]}),j?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"rgba(30, 33, 37, 0.42)"},children:"Loading messages..."}):ye.length===0?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"rgba(30, 33, 37, 0.42)"},children:"No messages yet. Start the conversation!"}):ye.map(t=>ue(t,0)),e.jsx("div",{ref:te})]}),e.jsx("div",{style:{padding:"12px",borderTop:"1px solid rgba(52, 58, 64, 0.12)",background:"rgba(255, 255, 255, 0.95)"},children:e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:se.color,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:650,flexShrink:0},children:se.initials}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx("textarea",{ref:Te,value:u,onChange:t=>y(t.target.value),onKeyDown:Ee,onFocus:()=>F(!0),onBlur:()=>F(!1),placeholder:Re?"Type your reply...":"Add a comment...",style:{width:"100%",minHeight:"38px",maxHeight:"120px",padding:"8px 12px",fontSize:"13px",color:"rgba(30, 33, 37, 0.85)",background:"white",border:`1px solid ${_?"rgba(94, 136, 176, 0.35)":"rgba(52, 58, 64, 0.16)"}`,borderRadius:"8px",resize:"vertical",outline:"none",transition:"border-color 0.15s ease",fontFamily:"inherit",lineHeight:1.5}}),e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},children:e.jsx("button",{type:"button",onClick:be,disabled:!u.trim()||D,style:{padding:"8px 16px",background:u.trim()&&!D?"var(--Base-Strong, #0B0B0B)":"#ECEEF2",border:"none",borderRadius:"6px",color:u.trim()&&!D?"white":"rgba(30, 33, 37, 0.45)",fontSize:"12px",fontWeight:600,cursor:u.trim()&&!D?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"6px",transition:"all 0.15s ease"},children:D?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"14px",height:"14px",border:"2px solid rgba(255, 255, 255, 0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 0.6s linear infinite"}}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(z.Send,{size:14}),"Send"]})})})]})]})})]})}function Y(n,o){return n.find(s=>s.block_id===o)}function rt({data:n,audioUrl:o,coachingData:s,messageThread:a,coachingLoading:i,coachingError:m,onThreadSendMessage:b,onThreadEditMessage:h,onThreadDeleteMessage:C,onThreadCreateNewThread:T,onThreadSelect:S,threadLoading:x,threadCurrentUser:j}){var ve,je,Se,de,pe,ke,Ce,ue,t,g,v,w;const u=n.blocks||[];n.evidence_index;const y=p.useRef(null),_=p.useRef(null),[F,R]=p.useState(new Set),[I,D]=p.useState(new Set),[L,$]=p.useState(0),[k,N]=p.useState(!1),[G,Z]=p.useState(1),q=((ve=Y(u,"interaction-metadata"))==null?void 0:ve.payload)||{},M=((je=Y(u,"interaction-context"))==null?void 0:je.payload)||{},A=((Se=Y(u,"interaction-summary"))==null?void 0:Se.payload)||{};(de=Y(u,"interaction-scores"))!=null&&de.payload;const H=((pe=Y(u,"interaction-signals"))==null?void 0:pe.payload)||{},O=((ke=Y(u,"interaction-guidance"))==null?void 0:ke.payload)||{},W=((Ce=Y(u,"interaction-transcript"))==null?void 0:Ce.payload)||{},K=((ue=Y(u,"interaction-nba"))==null?void 0:ue.payload)||{},X=((((t=Y(u,"interaction-dimensions"))==null?void 0:t.payload)||{}).dimensions||[]).filter(r=>r.value),ae=((g=Y(u,"interaction-outcome-lift"))==null?void 0:g.payload)||{},re=p.useMemo(()=>{var d;const r={},l={outcome:{color:"var(--rail-outcome)"},process:{color:"var(--rail-discovery)"},compliance:{color:"var(--rail-compliance)"},customer_friction:{color:"var(--rail-coral)"},experience:{color:"var(--rail-teal)"}};for(const f of H.signals||[]){const E=l[f.group]||{};for(const c of f.observations||[])for(const B of c.evidence||[])if((d=B.turn_ids)!=null&&d.length)for(const J of B.turn_ids)r[J]||(r[J]=[]),r[J].some(Je=>Je.label===(c.key||f.display_name||f.key))||r[J].push({label:c.key||f.display_name||f.key,reason:c.reason||c.explanation||"",color:E.color||"var(--state-present)",signalKey:f.key})}return r},[H.signals]),we=((v=W.messages)==null?void 0:v.map((r,l)=>{var B,J;const d=r.start??r.start_ms?(r.start??r.start_ms)/1e3:0,f=r.end??r.end_ms?(r.end??r.end_ms)/1e3:d+1,E=r.actor==="agent",c=E?((B=W.actor_map)==null?void 0:B.agent)||"Agent":((J=W.actor_map)==null?void 0:J.customer)||"Customer";return{startTime:d,endTime:f,actor:c,actorColor:E?"var(--rail-outcome)":"var(--rail-discovery)"}}))||[],ie=p.useMemo(()=>{if(!k&&L===0)return-1;const r=W.messages||[],l=L*1e3;for(let d=r.length-1;d>=0;d--){const f=r[d].start??r[d].start_ms;if(f!=null&&l>=f)return d}return-1},[L,k,W.messages]),U=r=>{y.current&&(y.current.currentTime=r,$(r))},le=()=>{if(y.current)if(k)y.current.pause(),N(!1);else{const r=y.current.play();r!==void 0&&r.catch(()=>{}),N(!0)}},V=()=>{y.current&&(y.current.currentTime=Math.max(0,y.current.currentTime-15))},ge=()=>{if(y.current){const r=q.duration_seconds||y.current.duration||0;y.current.currentTime=Math.min(r,y.current.currentTime+15)}},ze=r=>{y.current&&(y.current.playbackRate=r,Z(r))};p.useEffect(()=>{const r=y.current;if(!r)return;const l=()=>$(r.currentTime),d=()=>N(!0),f=()=>N(!1),E=()=>N(!1);return r.addEventListener("timeupdate",l),r.addEventListener("play",d),r.addEventListener("pause",f),r.addEventListener("ended",E),()=>{r.removeEventListener("timeupdate",l),r.removeEventListener("play",d),r.removeEventListener("pause",f),r.removeEventListener("ended",E)}},[o]);const ee=(r,l)=>{const d=y.current;if(!d||r==null)return;const f=r/1e3;d.currentTime=f,$(f);const E=d.play();if(E!==void 0&&E.catch(()=>{}),_.current&&(d.removeEventListener("timeupdate",_.current),_.current=null),l!=null){const c=l/1e3,B=()=>{d.currentTime>=c&&(d.pause(),_.current&&(d.removeEventListener("timeupdate",_.current),_.current=null))};_.current=B,d.addEventListener("timeupdate",B)}},te=(r,l,d)=>{const f=y.current;if(!f||r==null)return;const E=r/1e3,c=l!=null?l/1e3:E+1,B=f.currentTime;if(k&&B>=E&&(c==null||B<=c+.25)){f.pause();return}ee(r,l),d!=null&&d.length&&oe(d)},Te=(r,l)=>{const f=(W.messages||[])[l],E=y.current;if(!f||!E)return;const c=f.start??f.start_ms,B=f.end??f.end_ms;if(k&&ie===l){E.pause();return}c!=null&&ee(c,B)},oe=r=>{R(new Set(r));const l=document.getElementById("transcript-container");l&&l.scrollIntoView({behavior:"smooth",block:"nearest"}),setTimeout(()=>R(new Set),5e3)},se=r=>{D(l=>{const d=new Set(l);return d.has(r)?d.delete(r):d.add(r),d})},fe=((w=M.call_purpose)==null?void 0:w.interaction_driver)||A.one_liner||"Interaction Detail",[he,ye]=p.useState("signals"),ce=p.useRef(null),[Ie,_e]=p.useState(null);p.useLayoutEffect(()=>{if(i||!ce.current)return;const r=()=>{var f;const d=((f=ce.current)==null?void 0:f.offsetHeight)||0;d>0&&_e(d)};r();const l=window.requestAnimationFrame(r);return()=>window.cancelAnimationFrame(l)},[i,s,q,M]);const Re=async r=>{if(b){await b(r);return}},me=async r=>{if(h)return h(r)},De=async r=>{if(C){await C(r);return}},be=async r=>{if(T){await T(r);return}},Ee=a&&Object.keys(a).length>0?a:void 0;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"10px",flexWrap:"wrap"},children:[e.jsxs("div",{ref:ce,style:{flex:"1 1 420px",minWidth:320,display:"flex",flexDirection:"column",gap:10},children:[e.jsx(qe,{title:fe,meta:q,callPurpose:M.call_purpose,classification:M.classification,dimensions:X}),e.jsx(xe.AgentLiftCard,{outcomeLift:ae}),(i||s||m)&&e.jsx(ne.DetailCard,{title:"Coaching Summary",children:e.jsx($e,{data:s,loading:i,error:m})})]}),e.jsxs("div",{style:{flex:"1 1 420px",minWidth:320,display:"flex",flexDirection:"column",height:Ie},children:[e.jsx(He.Tabs,{tabs:[{key:"signals",label:"Signals"},{key:"guidance",label:"Guidance"}],active:he,onSelect:ye,size:"compact",borderTopRightRadius:12,borderTopLeftRadius:12}),e.jsxs("div",{className:"custom-thin-scrollbar-library",style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:10},children:[he==="signals"?e.jsx(Ne,{signals:H,expandedSignals:I,toggleSignal:se,playEvidence:te,timelinePlaying:k,currentTimeSeconds:L,highlightTurns:oe,borderRadius:"0px 0px 12px 12px"}):e.jsx(Ke,{guidance:O,playEvidence:te,timelinePlaying:k,currentTimeSeconds:L,highlightTurns:oe,borderRadius:"0px 0px 12px 12px"}),e.jsx(Ye,{nba:K})]})]})]}),e.jsx(Ge,{audioUrl:o,timelineSegments:we,durationSeconds:q.duration_seconds,currentTimeSeconds:L,timelinePlaying:k,playbackRate:G,onSeek:U,onTogglePlay:le,onSeekBack:V,onSeekForward:ge,onSetPlaybackRate:ze,audioRef:y}),e.jsx(Ve,{transcript:W,audioUrl:o,highlightedTurns:F,activeTurnIndex:ie,timelinePlaying:k,turnObservations:re,setExpandedSignals:D,onTurnPlayPause:Te}),e.jsx(nt,{sessionTitle:fe,messageThread:Ee,currentUser:j,isLoading:x,onSendMessage:Re,onEditMessage:me,onDeleteMessage:De,onCreateNewThread:be,onThreadSelect:S})]})}class it extends p.Component{constructor(o){super(o),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(o,s){console.error("InteractionDetailPanel render error:",o,s==null?void 0:s.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function ot(n){return e.jsx(it,{fallback:e.jsx("div",{style:{padding:16,color:"var(--state-unknown)",fontSize:12},children:"Error rendering detail."}),children:e.jsx(rt,{...n})})}function st({pattern:n}){const[o,s]=p.useState(!1),a={name:"Customer Escalation Likelihood",description:"Based on observed patterns, this session shows indicators consistent with potential escalation.",technicalKey:"signal.escalation_likelihood",probability:.68,confidence:.81,observations:3};return n==="text-link"?e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsxs("div",{style:{padding:"14px 16px 14px 21px"},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px",marginBottom:"10px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]}),!o&&e.jsx("button",{onClick:()=>s(!0),style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.56)",background:"none",border:"none",padding:0,cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(30, 33, 37, 0.2)"},onMouseEnter:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.78)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.4)"},onMouseLeave:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.56)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.2)"},children:"View contributing observations"})]}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"}),e.jsx("button",{onClick:()=>s(!1),style:{marginTop:"10px",fontSize:"12px",color:"rgba(30, 33, 37, 0.56)",background:"none",border:"none",padding:0,cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(30, 33, 37, 0.2)"},onMouseEnter:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.78)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.4)"},onMouseLeave:i=>{i.currentTarget.style.color="rgba(30, 33, 37, 0.56)",i.currentTarget.style.textDecorationColor="rgba(30, 33, 37, 0.2)"},children:"Hide observations"})]})]}):n==="rotating-chevron"?e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsx("button",{type:"button",onClick:()=>s(!o),style:{width:"100%",padding:"14px 16px 14px 21px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",transition:"background 0.15s ease"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(231, 212, 162, 0.08)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]})]}),e.jsx("div",{style:{paddingTop:"2px",color:"rgba(30, 33, 37, 0.42)",flexShrink:0,transition:"transform 0.2s ease"},children:e.jsx(z.ChevronDown,{size:18,style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})})]})}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"})]})]}):e.jsxs("div",{style:{position:"relative",background:"rgba(255, 255, 255, 0.82)",border:"1px solid rgba(52, 58, 64, 0.12)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 2px 4px rgba(30, 33, 37, 0.06)"},children:[e.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"5px",background:"#6B7C93",opacity:.6}}),e.jsxs("button",{type:"button",onClick:()=>s(!o),style:{width:"100%",padding:"14px 16px 14px 21px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",display:"flex",alignItems:"flex-start",gap:"12px",transition:"background 0.15s ease"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(231, 212, 162, 0.08)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[e.jsx("div",{style:{paddingTop:"2px",color:"rgba(30, 33, 37, 0.42)",flexShrink:0},children:o?e.jsx(z.ChevronDown,{size:16}):e.jsx(z.ChevronRight,{size:16})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{marginBottom:"4px"},children:e.jsx("span",{style:{fontSize:"13px",fontWeight:680,color:"rgba(30, 33, 37, 0.92)",lineHeight:1.2},children:a.name})}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.65)",lineHeight:1.4,marginBottom:"6px"},children:a.description}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(30, 33, 37, 0.42)",fontFamily:"ui-monospace, monospace",marginBottom:"8px"},children:a.technicalKey}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"11.5px"},children:[e.jsx("span",{style:{color:"rgba(139, 157, 127, 0.65)"},children:"prob"}),e.jsx("strong",{style:{color:"rgba(139, 157, 127, 0.85)"},children:a.probability.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsx("span",{style:{color:"rgba(184, 156, 106, 0.65)"},children:"conf"}),e.jsx("strong",{style:{color:"rgba(184, 156, 106, 0.85)"},children:a.confidence.toFixed(2)}),e.jsx("span",{style:{color:"rgba(30, 33, 37, 0.24)"},children:"·"}),e.jsxs("span",{style:{color:"rgba(30, 33, 37, 0.52)"},children:[a.observations," observations"]})]})]})]}),o&&e.jsxs("div",{style:{borderTop:"1px solid rgba(52, 58, 64, 0.08)",background:"rgba(244, 241, 230, 0.25)",padding:"16px 16px 16px 21px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:650,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(30, 33, 37, 0.52)",marginBottom:"8px"},children:"Contributing Observations"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(30, 33, 37, 0.62)"},children:"[Observations would appear here]"})]})]})}exports.ConditionCard=Q.ConditionCard;exports.ModelScoreCard=Q.ModelScoreCard;exports.ObservationCard=Q.ObservationCard;exports.ScoreDriverCard=Q.ScoreDriverCard;exports.ScoreDriverCardVariant=Q.ScoreDriverCardVariant;exports.SignalCard=Q.SignalCard;exports.SmallObservationCard=Q.SmallObservationCard;exports.SummarySection=Q.SummarySection;exports.AgentLiftCard=xe.AgentLiftCard;exports.EvidenceItem=xe.EvidenceItem;exports.CoachingSynthesisCard=$e;exports.ExpandPatternComparison=st;exports.InteractionContext=qe;exports.InteractionDetailPanel=ot;exports.InteractionGuidance=Ke;exports.InteractionNBA=Ye;exports.InteractionRecording=Ge;exports.InteractionScores=Ue;exports.InteractionSignals=Ne;exports.InteractionTranscript=Ve;
11
11
  //# sourceMappingURL=interactionDetails.cjs.js.map