import{e0 as g,r as h,aq as f,bL as b,j as e,a4 as j,e1 as v,e2 as w}from"./index-CfKY7XrC.js";import{s as k,R as C,A as L}from"./agent-thread-DqdDtu0Y.js";import"./markdown-text-DG_zVSzx.js";const N={slack:"Slack",telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",web:"Web"};function y(n,t,s){return n==="slack"&&s?.teamId&&t?`https://app.slack.com/client/${s.teamId}/${t}`:null}function A({owner:n,agentId:t,conversationId:s}){const{data:r=[],isLoading:m}=g(t,s,{orgSlug:n}),l=h.useMemo(()=>r.map(o=>k(o,{showToolCalls:!0})).filter(o=>o!==null),[r]),[a,d]=s.split(":"),i=N[a]??"the source app",{org:u}=f(),{data:p=[]}=b(u?.id??"",{connectorKey:a}),x=p[0]?.config?.chatMetadata,c=y(a,d,x);return e.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-4xl flex-1 flex-col pb-6",children:m?e.jsx(j,{label:"conversation",variant:"panel"}):l.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No messages in this conversation."}):e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx(C,{messages:l,children:e.jsx(L,{readOnly:!0})}),c?e.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"mt-4 flex items-center gap-3 rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm transition-colors hover:bg-muted",children:[e.jsx(v,{platform:a,className:"size-5 shrink-0"}),e.jsxs("span",{className:"text-muted-foreground",children:["This is a read-only copy. Continue the conversation with this agent in ",i,"."]}),e.jsxs("span",{className:"ml-auto shrink-0 whitespace-nowrap font-medium text-foreground",children:["Open ",i," →"]})]}):null]})})}function O(){const{owner:n,agentId:t,conversationId:s}=w.useParams();return e.jsx(A,{owner:n,agentId:t,conversationId:s})}export{O as component};
